diff --git a/md/dev/slHNW9yRie0/slHNW9yRie0.md b/md/dev/slHNW9yRie0/slHNW9yRie0.md
new file mode 100644
index 0000000000000000000000000000000000000000..5f0357ad35ef697aab2680c0e77d52375699e33a
--- /dev/null
+++ b/md/dev/slHNW9yRie0/slHNW9yRie0.md
@@ -0,0 +1,441 @@
+# COLD DIFFUSION: INVERTING ARBITRARY IMAGE TRANSFORMS WITHOUT NOISE
+
+Anonymous authors Paper under double-blind review
+
+# ABSTRACT
+
+Standard diffusion models involve an image transform – adding Gaussian noise – and an image restoration operator that inverts this degradation. We observe that the generative behavior of diffusion models is not strongly dependent on the choice of image degradation, and in fact an entire family of generative models can be constructed by varying this choice. Even when using completely deterministic degradations (e.g., blur, masking, and more), the training and test-time update rules that underlie diffusion models can be easily generalized to create generative models. The success of these fully deterministic models calls into question the community’s understanding of diffusion models, which relies on noise in either gradient Langevin dynamics or variational inference, and paves the way for generalized diffusion models that invert arbitrary processes.
+
+
+Figure 1: Demonstration of the forward and backward processes for both hot and cold diffusions. While standard diffusions are built on Gaussian noise (top row), we show that generative models can be built on arbitrary and even noiseless/cold image transforms, including the ImageNet-C snowification operator, and an animorphosis operator that adds a random animal image from AFHQ.
+
+# 1 INTRODUCTION
+
+Diffusion models have recently emerged as powerful tools for generative modeling (Ramesh et al., 2022). Diffusion models come in many flavors, but all are built around the concept of random noise removal; one trains an image restoration/denoising network that accepts an image contaminated with Gaussian noise, and outputs a denoised image. At test time, the denoising network is used to convert pure Gaussian noise into a photo-realistic image using an update rule that alternates between applying the denoiser and adding Gaussian noise. When the right sequence of updates is applied, complex generative behavior is observed.
+
+The origins of diffusion models, and also our theoretical understanding of these models, are strongly based on the role played by Gaussian noise during training and generation. Diffusion has been understood as a random walk around the image density function using Langevin dynamics (SohlDickstein et al., 2015; Song & Ermon, 2019), which requires Gaussian noise in each step. The walk begins in a high temperature (heavy noise) state, and slowly anneals into a “cold” state with little if any noise. Another line of work derives the loss for the denoising network using variational inference with a Gaussian prior (Ho et al., 2020; Song et al., 2021a; Nichol & Dhariwal, 2021).
+
+In this work, we examine the need for Gaussian noise, or any randomness at all, for diffusion models to work in practice. We consider generalized diffusion models that live outside the confines of the theoretical frameworks from which diffusion models arose. Rather than limit ourselves to models built around Gaussian noise, we consider models built around arbitrary image transformations like blurring, downsampling, etc. We train a restoration network to invert these deformations using a simple $\ell _ { p }$ loss. When we apply a sequence of updates at test time that alternate between the image restoration model and the image degradation operation, generative behavior emerges, and we obtain photo-realistic images.
+
+The existence of cold diffusions that require no Gaussian noise (or any randomness) during training or testing raises questions about the limits of our theoretical understanding of diffusion models. It also unlocks the door for potentially new types of generative models with very different properties than conventional diffusion seen so far.
+
+# 2 BACKGROUND
+
+Both the Langevin dynamics and variational inference interpretations of diffusion models rely on properties of the Gaussian noise used in the training and sampling pipelines. From the scorematching generative networks perspective (Song & Ermon, 2019; Song et al., 2021b), noise in the training process is critically thought to expand the support of the low-dimensional training distribution to a set of full measure in ambient space. The noise is also thought to act as data augmentation to improve score predictions in low density regions, allowing for mode mixing in the stochastic gradient Langevin dynamics (SGLD) sampling. The gradient signal in low-density regions can be further improved during sampling by injecting large magnitudes of noise in the early steps of SGLD and gradually reducing this noise in later stages.
+
+Kingma et al. (2021) propose a method to learn a noise schedule that leads to faster optimization. Using a classic statistical result, Kadkhodaie & Simoncelli (2021) show the connection between removing additive Gaussian noise and the gradient of the log of the noisy signal density in deterministic linear inverse problems. Here, we shed light on the role of noise in diffusion models through theoretical and empirical results in applications to inverse problems and image generation.
+
+Iterative neural models have been used for various inverse problems (Romano et al., 2016; Metzler et al., 2017). Recently, diffusion models have been applied to them (Song et al., 2021b) for the problems of deblurring, denoising, super-resolution, and compressive sensing (Whang et al., 2021; Kawar et al., 2021; Saharia et al., 2021; Kadkhodaie & Simoncelli, 2021).
+
+Although not their focus, previous works on diffusion models have included experiments with deterministic image generation (Song et al., 2021a; Dhariwal & Nichol, 2021; Karras et al., 2022) and in selected inverse problems (Kawar et al., 2022). Recently, Rissanen et al. (2022) use a combination of Gaussian noise and blurring as a forward process for diffusion. Though they show the feasibility of a different degradation, here we show definitively that noise is not a necessity in diffusion models, and we observe the effects of removing noise for a number of inverse problems.
+
+Despite prolific work on generative models in recent years, methods to probe the properties of learned distributions and measure how closely they approximate the real training data are by no means closed fields of investigation.
+
+Indirect feature space similarity metrics such as Inception Score (Salimans et al., 2016), Mode Score (Che et al., 2016), Frechet inception distance (FID) (Heusel et al., 2017), and Kernel inception distance (KID) (Binkowski et al., 2018) have been proposed and adopted to some extent, but they ´ have notable limitations (Barratt & Sharma, 2018). To adopt a popular frame of reference, we will use FID as the feature similarity metric for our experiments.
+
+# 3 GENERALIZED DIFFUSION
+
+Standard diffusion models are built around two components. First, there is an image degradation operator that contaminates images with Gaussian noise. Second, a trained restoration operator is created to perform denoising. The image generation process alternates between the application of these two operators. In this work, we consider the construction of generalized diffusions built around arbitrary degradation operations. These degradations can be randomized (as in the case of standard diffusion) or deterministic.
+
+# 3.1 MODEL COMPONENTS AND TRAINING
+
+Given an image $\boldsymbol { x } _ { 0 } \in \mathbb { R } ^ { N }$ , consider the degradation of $x _ { 0 }$ by operator $D$ with severity $t$ , denoted $x _ { t } = D ( x _ { 0 } , t )$ . The output distribution $D ( x _ { 0 } , t )$ of the degradation should vary continuously in $t$ , and the operator should satisfy $D ( x _ { 0 } , 0 ) = x _ { 0 }$ .
+
+In the standard diffusion framework, $D$ adds Gaussian noise with variance proportional to $t$ . In our generalized formulation, we choose $D$ to perform various other transformations such as blurring, masking out pixels, downsampling, and more, with severity that depends on $t$ . We explore a range of choices for $D$ in Section 4.
+
+We also require a restoration operator $R$ that (approximately) inverts $D$ . This operator has the property that $R ( x _ { t } , t ) \approx x _ { 0 }$ . In practice, this operator is implemented via a neural network parameterized by $\theta$ . The restoration network is trained via the minimization problem
+
+$$
+\operatorname* { m i n } _ { \theta } \mathbb { E } _ { x \sim \mathcal { X } } \| R _ { \theta } ( D ( x , t ) , t ) - x \| ,
+$$
+
+where $x$ denotes a random image sampled from distribution $\mathcal { X }$ and $\| \cdot \|$ denotes a norm, which we take to be $\ell _ { 1 }$ in our experiments. We have so far used the subscript $R _ { \theta }$ to emphasize the dependence of $R$ on $\theta$ during training, but we will omit this symbol for simplicity in the discussion below.
+
+# 3.2 SAMPLING FROM THE MODEL
+
+After choosing a degradation $D$ and training a model $R$ to perform the restoration, these operators can be used in tandem to invert severe degradations by using standard methods borrowed from the diffusion literature. For small degradations $\left( t \approx 0 \right)$ ), a single application of $R$ can be used to obtain a restored image in one shot. However, because $R$ is typically trained using a simple convex loss, it yields blurry results when used with large $t$ . Rather, diffusion models (Song et al., 2021a; Ho et al., 2020) perform generation by iteratively applying the denoising operator and then adding noise back to the image, with
+
+
Algorithm 1 Naive Sampling Input: A degraded sample xt
for s=t,t-1,...,1 do xo←R(xs,s) xs-1= D(xo,s-1) end for
Return: xo Algorithm 2 Transformation Agnostic Cold Sampling
Input: A degraded sample xt fors=t,t-1,...,1do
+
+the level of added noise decreasing over time. This is the standard update sequence in Algorithm 1.
+
+When the restoration operator is perfect, i.e. when $R ( D ( x _ { 0 } , t ) , t ) = x _ { 0 }$ for all $t$ , one can easily see that Algorithm 1 produces exact iterates of the form $x _ { s } = D ( x _ { 0 } , s )$ . But what happens for imperfect restoration operators? In this case, errors can cause the iterates $x _ { s }$ to wander away from $D ( x _ { 0 } , s )$ , and inaccurate reconstruction may occur.
+
+We find that the standard sampling approach in Algorithm 1 (explained further in A.8) works well for noise-based diffusion, possibly because the restoration operator $R$ has been trained to correct (random Gaussian) errors in its inputs. However, we find that it yields poor results in the case of cold diffusions with smooth/differentiable degradations as demonstrated for a deblurring model in
+
+Figure 2. We propose Transformation Agnostic Cold Sampling (TACoS) in Algorithm 2, which we find to be superior for inverting smooth, cold degradations.
+
+This sampler has important mathematical properties that enable it to recover high quality results. Specifically, for a class of linear degradation operations, it can be shown to produce exact reconstruction (i.e. $x _ { s } = D ( x _ { 0 } , s ) )$ ) even when the restoration operator $R$ fails to perfectly invert $D$ . We discuss this in the following section.
+
+# 3.3 PROPERTIES OF TACOS
+
+It is clear from inspection that both Algorithms 1 and 2 perfectly reconstruct the iterate $x _ { s } ~ = ~ D ( x _ { 0 } , s )$ for all $s \ < \ t$ if the restoration operator is a perfect inverse for the degradation operator. In this section, we analyze the stability of these algorithms to errors in the restoration operator.
+
+For small values of $x$ and $s$ , TACoS as described in 2 is tolerant of error in the restoration operator $R$ .To see why, consider a model problem with a linear degradation function of the form $D ( x , s ) \approx x { \bar { + } } s \cdot e$ for
+
+
+Figure 2: Comparison of sampling methods for unconditional generation using cold diffusion on the CelebA dataset. Iterations 2, 4, 8, 16, 32, 64, 128, 192, and 256 are presented. Top: Algorithm 1 produces compounding artifacts and fails to generate a new image. Bottom: TACoS succeeds in sampling a high quality image without noise.
+
+a constant vector $e$ . We chose this ansatz because the Taylor expansion of any smooth degradation $D ( x , s )$ around $x = x _ { 0 } , s = 0$ has the form $D ( x , s ) \approx x + s \cdot e ( x ) + { \mathrm { H O T } }$ where HOT denotes higher order terms. Note, however, the analysis below requires $e$ to be a constant that does not depend on $x$ . The constant/zeroth-order term in this Taylor expansion is zero because we assumed above that the degradation operator satisfies $D ( x , 0 ) = { \overset { \cdot } { x } }$ .
+
+For a degradation $D ( x , s )$ and any restoration operator $R$ , the term $x _ { s - 1 }$ in TACoS becomes
+
+$$
+\begin{array} { r l } & { x _ { s } - D ( R ( x _ { s } , s ) , s ) + D ( R ( x _ { s } , s ) , s - 1 ) = D ( x _ { 0 } , s ) - D ( R ( x _ { s } , s ) , s ) + D ( R ( x _ { s } , s ) , s - 1 ) } \\ & { \ = x _ { 0 } + s \cdot e - R ( x _ { s } , s ) - s \cdot e + R ( x _ { s } , s ) + ( s - 1 ) \cdot e = x _ { 0 } + ( s - 1 ) = D ( x _ { 0 } , s - 1 ) } \end{array}
+$$
+
+By induction, we see that the algorithm produces the value $x _ { s } = D ( x _ { 0 } , s )$ for all $s < t$ , regardless of the choice of $R$ . In other words, for any choice of $R$ , the iteration behaves the same as it would when $R$ is a perfect inverse for the degradation $D$ .
+
+By contrast, Algorithm 1 does not enjoy this behavior even for small values of $s$ . In fact, when $R$ is not a perfect inverse for $D$ , $x _ { 0 }$ is not a fixed point of the update rule in Algorithm 1 because $x _ { 0 } \neq D ( \bar { R ( x , 0 ) } , 0 ) = R ( x , 0 )$ and hence compounds errors. If $R$ does not perfectly invert $D$ we should expect Algorithm 1 to incur errors, even for small values of $s$ . Meanwhile, for small values of $s$ , the behavior of $D$ approaches its first-order Taylor expansion and Algorithm 2 becomes immune to errors in $R$ . Figure 2 demonstrates the stability of TACoS described in Algorithm 2 vs Algorithm 1 for a deblurring model. Note that our analysis is not meant to be a complete convergence theory, rather to highlight a desirable theoretical property of our method that a naive sampler lacks.
+
+# 4 GENERALIZED DIFFUSIONS WITH VARIOUS TRANSFORMATIONS
+
+In this section, we take the first step towards cold diffusion by reversing different degradations and hence performing conditional generation. We will extend our methods to perform unconditional (i.e. from scratch) generation in Section 5. We emprically evaluate generalized diffusion models trained on different degradations with TACoS proposed in Algorithm 2. We perform experiments on the vision tasks of deblurring, inpainting, super-resolution, and the unconventional task of synthetic snow removal. We perform our experiments on MNIST (LeCun et al., 1998), CIFAR-10 (Krizhevsky, 2009), and CelebA (Liu et al., 2015). In each of these tasks, we gradually remove the information from the clean image, creating a sequence of images such that $D ( x _ { 0 } , t )$ retains less information than $D ( x _ { 0 } , t - 1 )$ . For these different tasks, we present both qualitative and quantitative results on a held-out testing dataset and demonstrate the importance of the sampling technique described in Algorithm 2. For all quantitative results in this section, the Frechet inception distance (FID) scores (Heusel et al., 2017) for degraded and reconstructed images are measured with respect to the testing data. Additional information about the quantitative results, convergence criteria, hyperparameters, and architecture of the models presented below can be found in the appendix.
+
+# 4.1 DEBLURRING
+
+We consider a generalized diffusion based on a Gaussian blur operation (as opposed to Gaussian noise) in which an image at step $t$ has more blur than at $t - 1$ . The forward process given the Gaussian kernels $\{ G _ { s } \}$ and the image $x _ { t - 1 }$ at step $t - 1$ can thus be written as
+
+$$
+x _ { t } = G _ { t } * x _ { t - 1 } = G _ { t } * \ldots * G _ { 1 } * x _ { 0 } = { \bar { G } } _ { t } * x _ { 0 } = D ( x _ { 0 } , t ) ,
+$$
+
+where $^ *$ denotes the convolution operator, which blurs an image using a kernel.
+
+We train a deblurring model by minimizing the loss equation 1, and then use TACoS to invert this blurred diffusion process for which we trained a DNN to predict the clean image $\scriptstyle { \hat { x } } _ { 0 }$ . Qualitative results are shown in Figure 3 and quantitative results in Table 1. Qualitatively, we can see that images created using the sampling process are sharper and in some cases completely different as compared to the direct reconstruction of the clean image. Quantitatively we can see that the reconstruction metrics such as RMSE and PSNR get worse when we use the sampling process, but on the other hand FID with respect to held-out test data improves. The qualitative improvements and decrease in FID show the benefits of the generalized sampling routine, which brings the learned distribution closer to the true data manifold.
+
+In the case of blur operator, the sampling routine can be thought of adding frequencies at each step. This is because the sampling routine involves the term $D ( \hat { x _ { 0 } } , t ) - D ( \hat { x _ { 0 } } , t - \mathbf { \bar { 1 } } )$ which in the case of blur becomes ${ \bar { G } } _ { t } * x _ { 0 } - { \bar { G } } _ { t - 1 } * x _ { 0 }$ . This results in a difference of Gaussians, which is a band pass filter and contains frequencies that were removed at step $t$ . Thus, in the sampling process, we sequentially add the frequencies that were removed during the degradation process.
+
+
+Figure 3: Deblurring models trained on the MNIST, CIFAR-10, and CelebA datasets. Left to right: degraded inputs $D ( x _ { 0 } , T )$ , direct reconstruction $R ( D ( x _ { 0 } , T ) )$ , sampled reconstruction with TACoS described in Algorithm 2, and original image.
+
+Table 1: Quantitative metrics for quality of image reconstruction using deblurring models.
+
+
Dataset
Degraded
Sampled
Direct
FID
SSIM
RMSE
FID
SSIM
RMSE
FID
SSIM
RMSE
MNIST
438.59
0.287
0.287
4.69
0.718
0.154
5.10
0.757
0.142
CIFAR-10
298.60
0.315
0.136
80.08
0.773
0.075
83.69
0.775
0.071
CelebA
382.81
0.254
0.193
26.14
0.568
0.093
36.37
0.607
0.083
+
+# 4.2 INPAINTING
+
+We define a schedule of transforms that progressively grays-out pixels from the input image. We remove pixels using a Gaussian mask as follows: For input images of size $n \times n$ we start with a 2D Gaussian curve of variance $\beta$ , discretized into an $n \times n$ array. We normalize so the peak of the curve has value 1, and subtract the result from 1 so the center of the mask as value 0. We randomize the location of the Gaussian mask for MNIST and CIFAR-10, but keep it centered for CelebA. We denote the final mask by $z _ { \beta }$ .
+
+Input images $x _ { 0 }$ are iteratively masked for $T$ steps via multiplication with a sequence of masks $\{ z _ { \beta _ { i } } \}$ with increasing $\beta _ { i }$ . We can control the amount of information removed at each step by tuning the $\beta _ { i }$ parameter. In the language of Section 3, $\begin{array} { r } { D ( x _ { 0 } , t ) = x _ { 0 } \cdot \prod _ { i = 1 } ^ { t } z _ { \beta _ { i } } } \end{array}$ , where the operator $\cdot$ denotes entry-wise multiplication.
+
+Figure 4 presents results on test images and compares the output of the inpainting model to the original image. The reconstructed images display reconstructed features qualitatively consistent with the context provided by the unperturbed regions of the image. We quantitatively assess the effectiveness of the inpainting models on each of the datasets by comparing distributional similarity metrics before and after the reconstruction. Our results are summarized in Table 2. Note, the FID scores here are computed with respect to the held-out validation set.
+
+
+Figure 4: Inpainting models trained on the MNIST, CIFAR-10, and CelebA datasets. Left to right: Degraded inputs $D ( x _ { 0 } , T )$ , direct reconstruction $R ( D ( x _ { 0 } , T ) )$ , sampled reconstruction with TACoS described in Algorithm 2, and original image.
+
+Table 2: Quantitative metrics for quality of image reconstruction using inpainting models.
+
+
Dataset
Degraded
Sampled
Direct
FID
SSIM
RMSE
FID
SSIM
RMSE
FID
SSIM
RMSE
MNIST
108.48
0.490
0.262
1.61
0.941
0.068
2.24
0.948
0.060
CIFAR-10
40.83
0.615
0.143
8.92
0.859
0.068
9.97
0.869
0.063
CelebA
127.85
0.663
0.155
5.73
0.917
0.043
7.74
0.922
0.039
+
+# 4.3 SUPER-RESOLUTION
+
+For this task, the degradation operator downsamples the image by a factor of two in each direction. The final resolution of $x _ { T }$ is $4 \times 4$ for MNIST and CIFAR-10 and $2 \times 2$ in the case of Celeb-A. After each down-sampling, the lower-resolution image is resized to the original image size, using nearestneighbor interpolation. More details are available in Appendix A.3
+
+Figure 5 presents example testing data inputs for all datasets and compares the output of the superresolution model to the original image. Though the reconstructed images are not perfect for the more challenging datasets, the reconstructed features are qualitatively consistent with the context provided by the low resolution image. Table 3 compares the distributional similarity metrics between degraded/reconstructed images and test samples.
+
+
+Figure 5: Superresolution models trained on the MNIST, CIFAR-10, and CelebA datasets. Left to right: degraded inputs $D ( x _ { 0 } , T )$ , direct reconstruction $R ( D ( x _ { 0 } , T ) )$ , sampled reconstruction with TACoS described in Algorithm 2, and original image.
+
+Table 3: Quantitative metrics for quality of image reconstruction using super-resolution models.
+
+
Dataset
Degraded
Sampled
Direct
FID
SSIM
RMSE
FID
SSIM
RMSE
FID
SSIM
RMSE
MNIST
368.56
0.178
0.231
4.33
0.820
0.115
4.05
0.823
0.114
CIFAR-10
358.99
0.279
0.146
152.76
0.411
0.155
169.94
0.420
0.152
CelebA
349.85
0.335
0.225
96.92
0.381
0.201
112.84
0.400
0.196
+
+# 4.4 SNOWIFICATION
+
+Apart from traditional degradations, we additionally provide results for the task of synthetic snow removal using the offical implementation of the snowification transform from ImageNet-C (Hendrycks & Dietterich, 2019). The purpose of this experiment is to demonstrate that generalized diffusion can succeed even with exotic transforms that lack the scale-space and compositional properties of blur operators. Similar to other tasks, we degrade the images by adding snow, such that the level of snow increases with step $t$ . We provide more implementation details in Appendix.
+
+We illustrate our desnowification results in Figure 6. We present testing examples, as well as their snowified images, from all the datasets, and compare the desnowified results with the original images. The desnowified images feature near-perfect reconstruction results for CIFAR-10 examples with lighter snow, and exhibit visually distinctive restoration for Celeb-A examples with heavy snow. We provide quantitative results in Table 4.
+
+
+Figure 6: Desnowification models trained on the CIFAR-10, and CelebA datasets. Left to right: degraded inputs $D ( x _ { 0 } , T )$ , direct reconstruction $R ( D ( x _ { 0 } , T ) )$ , sampled reconstruction with TACoS described in Algorithm 2, and original image.
+
+Table 4: Quantitative metrics for quality of image reconstruction using desnowification models.
+
+
Dataset
FID
Degraded Image SSIM
RMSE
FID
Reconstruction SSIM
RMSE
CIFAR-10
125.63
0.419
0.327
31.10
0.074
0.838
CelebA
398.31
0.338
0.283
27.09
0.033
0.907
+
+# 5 COLD GENERATION
+
+Diffusion models can successfully learn the underlying distribution of training data, and thus generate diverse, high quality images (Song et al., 2021a; Dhariwal & Nichol, 2021; Jolicoeur-Martineau et al., 2021; Ho et al., 2022). We will first discuss deterministic generation using Gaussian noise and then discuss in detail unconditional generation using deblurring. Finally, we provide a proof of concept that the TACoS described in Algorithm 2 can be extended to other degradations.
+
+# 5.1 GENERATION USING DETERMINISTIC NOISE DEGRADATION
+
+Here we discuss image generation using a noise-based degradation presented in our notation from Section 3, which we will later prove is equivalent to DDIM (Song et al., 2021a). We use the following degradation operator: $D ( \dot { x _ { , } } t ) = \sqrt { \dot { \alpha _ { t } } } x + \sqrt { 1 - \alpha _ { t } } z$ .
+
+$D$ is an interpolation between the data point $x$ and a sampled noise pattern $z \in \mathcal { N } ( 0 , 1 )$ . During training, $D$ is applied once and thus $z$ is sampled once for every image in every batch. However, sampling involves iterative applications of the degradation operator $D$ , which poses the question of how to pick $z$ for the sequence of degradations $D$ applied in a single image generation.
+
+There are three possible choices for $z$ . The first would be to resample $z$ for each application of $D$ , but this would make the sampling process nondeterministic for a fixed starting point. Another option is to sample a noise pattern $z$ once for each separate image generation and reuse it in each application of $D$ . In Table 5 we refer to this approach as Fixed Noise. Finally, one can calculate the noise vector $z$ to be used in step $t$ of reconstruction by using the formula
+
+$$
+\widehat { z } ( x _ { t } , t ) = \frac { x _ { t } - \sqrt { \alpha _ { t } } R ( x _ { t } , t ) } { \sqrt { 1 - \alpha _ { t } } } .
+$$
+
+This method denoted Estimated Noise in Table 5 turns out to be equivalent to the deterministic sampling proposed in Song et al. (2021a). We discuss this equivalence in detail in Appendix A.6.
+
+# 5.2 IMAGE GENERATION USING BLUR
+
+The forward diffusion process in noise-based diffusion models has the advantage that the degraded image distribution at the final step $T$ is simply an isotropic Gaussian. One can therefore perform (unconditional) generation by first drawing a sample from the isotropic Gaussian, and sequentially denoising it with backward diffusion.
+
+When using blur as a degradation, the fully degraded images do not form a nice closed-form distribution that we can sample from. They do, however, form a simple enough distribution that can be modeled with simple methods. Note that every image $x _ { 0 }$ degenerates to an $x _ { T }$ that is constant (i.e., every pixel is the same color) for large $T$ . Furthermore, the constant value is exactly the channelwise mean of the RGB image $x _ { 0 }$ , and can be represented with a 3-vector. This 3-dimensional distribution is easily represented using a Gaussian mixture model (GMM). This GMM can be sampled to produce the random pixel values of a severely blurred image, which can be deblurred using cold diffusion to create a new image.
+
+Our generative model uses a blurring schedule where we progressively blur each image with a Gaussian kernel of size $2 7 \times 2 7$ over 300 steps. The standard deviation of the kernel starts at 1 and increases exponentially at the rate of 0.01. We then fit a simple GMM with one component to the distribution of channel-wise means. To generate an image from scratch, we sample the channel-wise mean from the GMM, expand the 3D vector into a $1 2 8 \times 1 2 8$ image with three channels, and then apply TACoS.
+
+Empirically, the presented pipeline generates images with high fidelity but low diversity, as reflected quantitatively by comparing the perfect symmetry column with results from hot diffusion in Table 5. We attribute this to the perfect correlation between pixels of $x _ { T }$ sampled from the channel-wise mean Gaussian mixture model. To break the symmetry between pixels, we add a small amount of Gaussian noise (of standard deviation 0.002) to each sampled $x _ { T }$ . As shown in Table 5, the simple trick drastically improves the quality of generated images. We also present the qualitative results for cold diffusion using blur transformation in Figure 7, and further discuss the necessity of TACoS proposed in Algorithm 2 for generation in Appendix A.7.
+
+Table 5: FID scores for CelebA and AFHQ datasets using hot (noise) and cold diffusion (blur transformation). Breaking the symmetry within pixels of the same channel further improves FID.
+
+
Hot Diffusion
Cold Diffusion
Dataset
Fixed Noise
Estimated Noise
Perfect symmetry
Broken symmetry
CelebA
59.91
23.11
97.00
49.45
AFHQ
25.62
20.59
93.05
54.68
+
+
+Figure 7: Examples of generated samples from $1 2 8 \times 1 2 8$ CelebA and AFHQ datasets using cold diffusion with blur transformation
+
+# 5.3 GENERATION USING OTHER TRANSFORMATIONS
+
+In this section, we provide a proof of concept that generation can be extended to other transformations. Specifically, we show preliminary results on inpainting, super-resolution, and animorphosis.
+
+Inspired by the simplicity of the degraded image distribution for the blurring routine presented in the previous section, we use degradation routines with predictable final distributions here as well.
+
+To use the Gaussian mask transformation for generation, we modify the masking routine so the final degraded image is completely devoid of information. One might think a natural option is to send all of the images to a completely black image $x _ { T }$ , but this would not allow for any diversity in generation. To get around this maximally non-injective property, we instead make the mask turn all pixels to a random, solid color. This still removes all of the information from the image, but it allows us to recover different samples from the learned distribution via Algorithm 2 by starting off with different color images. More formally, a Gaussian mask $\begin{array} { r } { G _ { t } = \prod _ { i = 1 } ^ { t } \bar { z } _ { \beta _ { i } } } \end{array}$ is created in a similar way as discussed in the Section 4.2, but instead of multiplying it directly to the image $x _ { 0 }$ , we create $x _ { t }$ as $G _ { t } \cdot x _ { 0 } + ( 1 - G _ { t } ) \cdot c$ , where $c$ is an image of a randomly sampled color.
+
+For super-resolution, the routine down-samples to a resolution of $2 \times 2$ , or 4 values in each channel. These degraded images can be represented as one-dimensional vectors, and their distribution is modeled using one Gaussian distribution. Using the same methods described for generation using blurring described above, we sample from this Gaussian-fitted distribution of the lower-dimensional degraded image space and pass this sampled point through the generation process trained on superresolution data to create one output.
+
+Additionally to show one can invert nearly any transformation, we include a new transformation deemed animorphosis, where we iteratively transform a human face from CelebA to an animal face from AFHQ. Though we chose CelebA and AFHQ for our experimentation, in principle such interpolation can be done for any two initial data distributions.
+
+More formally, given an image √ $x$ and a random image $z$ sampled from the AFHQ manifold, $x _ { t }$ can be written as $\begin{array} { r } { \dot { x _ { t } } = \sqrt { \alpha _ { t } } x + \dot { \sqrt { 1 - \alpha _ { t } } } z } \end{array}$ . Note this is essentially the same as the noising procedure, but instead of adding noise we are adding a progressively higher weighted AFHQ image. In order to sample from the learned distribution, we sample a random image of an animal and use TACoS.
+
+We present results for the CelebA dataset, and hence the quantitative results in terms of FID scores for inpainting, super-resolution and animorphosis are 90.14, 92.91 and 48.51 respectively. We further show some qualitative samples in Figure 8, and in Figure 1.
+
+
+Figure 8: Preliminary demonstration of the generative abilities of other cold diffusins on the $1 2 8 \times$ 128 CelebA dataset. The top row is with animorphosis models, the middle row is with inpainting models, and the bottom row exhibits super-resolution models.
+
+# 6 CONCLUSION
+
+Existing diffusion models rely on Gaussian noise for both forward and reverse processes. In this work, we find that the random noise can be removed entirely from the diffusion model framework, and replaced with arbitrary transforms. In doing so, our generalization of diffusion models and their sampling procedures allows us to restore images afflicted by deterministic degradations such as blur, inpainting and downsampling. This framework paves the way for a more diverse landscape of diffusion models beyond the Gaussian noise paradigm. The different properties of these diffusions may prove useful for a range of applications, including image generation and beyond.
+
+# REPRODUCIBILITY STATEMENT
+
+We provided our full code base as supplementary material, which is a modified version of the traditional diffusion database found at https://github.com/lucidrains/denoising-diffusion-pytorch. To facilitate the reproducibility of our results, we have included detailed hyperparameters for training each of our cold diffusion models in Appendices A.1-A.5. Due to space constraints in the main body, we opted to present a relatively small number of qualitative results. Many more examples of both conditionally and unconditionally generated images can be found in the Appendix.
+
+# REFERENCES
+
+Shane Barratt and Rishi Sharma. A note on the inception score. arXiv preprint arXiv:1801.01973, 2018.
+
+Mikołaj Binkowski, Danica J Sutherland, Michael Arbel, and Arthur Gretton. Demystifying mmd ´ gans. arXiv preprint arXiv:1801.01401, 2018.
+
+Tong Che, Yanran Li, Athul Paul Jacob, Yoshua Bengio, and Wenjie Li. Mode regularized generative adversarial networks. arXiv preprint arXiv:1612.02136, 2016.
+
+Prafulla Dhariwal and Alexander Quinn Nichol. Diffusion models beat gans on image synthesis. volume 34, 2021.
+
+Dan Hendrycks and Thomas G. Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations, ICLR 2019. OpenReview.net, 2019.
+
+Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. Advances in neural information processing systems, 30, 2017.
+
+Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 32, 2020.
+
+Jonathan Ho, Chitwan Saharia, William Chan, David J. Fleet, Mohammad Norouzi, and Tim Salimans. Cascaded diffusion models for high fidelity image generation. J. Mach. Learn. Res., 23, 2022.
+
+Alexia Jolicoeur-Martineau, Remi Pich ´ e-Taillefer, Ioannis Mitliagkas, and Remi Tachet des ´ Combes. Adversarial score matching and improved sampling for image generation. International Conference on Learning Representations, 2021.
+
+Zahra Kadkhodaie and Eero Simoncelli. Stochastic solutions for linear inverse problems using the prior implicit in a denoiser. Advances in Neural Information Processing Systems, 34, 2021.
+
+Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of diffusionbased generative models. arXiv preprint arXiv:2206.00364, 2022.
+
+Bahjat Kawar, Gregory Vaksman, and Michael Elad. Stochastic image denoising by sampling from the posterior distribution. International Conference on Computer Vision Workshops, 2021.
+
+Bahjat Kawar, Michael Elad, Stefano Ermon, and Jiaming Song. Denoising diffusion restoration models. arXiv preprint arXiv:2201.11793, 2022.
+
+Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
+
+Diederik P. Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. On density estimation with diffusion models. Advances in Neural Information Processing Systems, 34, 2021.
+
+Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
+
+Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to´ document recognition. Proc. IEEE, 86(11):2278–2324, 1998.
+
+Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), December 2015.
+
+Christopher A. Metzler, Ali Mousavi, and Richard G. Baraniuk. Learned D-AMP: principled neural network based compressive image recovery. Advances in Neural Information Processing Systems, 30, 2017.
+
+Alexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 8162–8171, 2021.
+
+Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
+
+Severi Rissanen, Markus Heinonen, and Arno Solin. Generative modelling with inverse heat dissipation. arXiv preprint arXiv:2206.13397, 2022.
+
+Yaniv Romano, Michael Elad, and Peyman Milanfar. The little engine that could: Regularization by denoising (RED). arXiv preprint arXiv:1611.02862, 2016.
+
+Chitwan Saharia, Jonathan Ho, William Chan, Tim Salimans, David J. Fleet, and Mohammad Norouzi. Image super-resolution via iterative refinement. arXiv preprint arXiv:2104.07636, 2021.
+
+Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. Advances in neural information processing systems, 29, 2016.
+
+Jascha Sohl-Dickstein, Eric A. Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, volume 37 of JMLR Workshop and Conference Proceedings, 2015.
+
+Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. International Conference on Learning Representations, 2021a.
+
+Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in Neural Information Processing Systems, 32, 2019.
+
+Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. International Conference on Learning Representations, 2021b.
+
+Jay Whang, Mauricio Delbracio, Hossein Talebi, Chitwan Saharia, Alexandros G. Dimakis, and Peyman Milanfar. Deblurring via stochastic refinement. arXiv preprint arXiv:2112.02475, 2021.
+
+# A APPENDIX
+
+# A.1 DEBLURRING
+
+For the deblurring experiments, we train the models on different datasets for 700,000 gradient steps. We use the Adam (Kingma & Ba, 2014) optimizer with learning rate $2 \times 1 0 ^ { - 5 }$ . The training was done on the batch size of 32, and we accumulate the gradients every 2 steps. Our final model is an Exponential Moving Average of the trained model with decay rate 0.995 which is updated after every 10 gradient steps.
+
+For the MNIST dataset, we blur recursively 40 times, with a discrete Gaussian kernel of size 11x11 and a standard deviation 7. In the case of CIFAR-10, we recursively blur with a Gaussian kernel of fixed size 11x11, but at each step $t$ , the standard deviation of the Gaussian kernel is given by $0 . 0 1 * t + 0 . 3 5$ . The blur routine for CelebA dataset involves blurring images with a Gaussian kernel of 15x15 and the standard deviation of the Gaussian kernel grows exponentially with time $t$ at the rate of 0.01.
+
+
+Figure 9 shows an additional nine images for each of MNIST, CIFAR-10 and CelebA. Figures 19 and 20 show the iterative sampling process using a deblurring model for ten example images from each dataset. We further show 400 random images to demonstrate the qualitative results in the Figure 21.
+Figure 9: Additional examples from deblurring models trained on the MNIST, CIFAR-10, and CelebA datasets. Left to right: degraded inputs $D ( x _ { 0 } , T )$ , direct reconstruction $R ( D ( x _ { 0 } , T ) )$ , sampled reconstruction with TACoS described in Algorithm 2, and original image.
+
+# A.2 INPAINTING
+
+For the inpainting transformation, models were trained on different datasets with 60,000 gradient steps. The models were trained using Adam (Kingma & Ba, 2014) optimizer with learning rate $2 \times$ $1 0 ^ { \div { 5 } }$ . We use batch size 64, and the gradients are accumulated after every 2 steps. The final model is an Exponential Moving Average of the trained model with decay rate 0.995. This EMA model is updated after every 10 gradient steps. For all our inpainting experiments we use a randomized Gaussian mask and $T = 5 0$ with $\beta _ { 1 } = 1$ and $\beta _ { i + 1 } = \beta _ { i } + 0 . 1$ .
+
+To avoid potential leakage of information due to floating point computation of the Gaussian mask, we discretize the masked image before passing it through the inpainting model. This was done by rounding all pixel values to the eight most significant digits.
+
+Figure 11 shows nine additional inpainting examples on each of the MNIST, CIFAR-10, and CelebA datasets. Figure 10 demonstrates an example of the iterative sampling process of an inpainting model for one image in each dataset.
+
+# A.3 SUPER-RESOLUTION
+
+We train the super-resolution model per Section 3.1 for 700,000 iterations. We use the Adam (Kingma & Ba, 2014) optimizer with learning rate $2 \times 1 0 ^ { - 5 }$ . The batch size is 32, and we accumulate the gradients every 2 steps. Our final model is an Exponential Moving Average of the trained model with decay rate 0.995. We update the EMA model every 10 gradient steps.
+
+The number of time-steps depends on the size of the input image and the final image. For MNIST and for CIFAR10, the number of time steps is 3, as it takes three steps of halving the resolution to reduce the initial image down to $4 \times 4$ . For CelebA, the number of time steps is 6 to reduce the initial image down to $2 \times 2$ . For CIFAR10, we apply random crop and random horizontal flip for regularization.
+
+Figure 13 shows an additional nine super-resolution examples on each of the MNIST, CIFAR-10, and CelebA datasets. Figure 12 shows one example of the progressive increase in resolution achieved with the sampling process using a super-resolution model for each dataset.
+
+# A.4 COLORIZATION
+
+Here we provide results for the additional task of colorization. Starting with the original RGBimage $x _ { 0 }$ , we realize colorization by iteratively desaturating for $T$ steps until the final image $x _ { T }$ is a fully gray-scale image. We use a series of three-channel $1 \times 1$ convolution filters ${ \mathbf z } ( \alpha ) \ : = \ : $ $\{ z ^ { 1 } ( \alpha ) , \bar { z } ^ { 2 } ( \alpha ) , z ^ { 3 } ( \alpha ) \}$ with the form
+
+$$
+\begin{array} { c } { { z ^ { 1 } ( \alpha ) = \alpha \left( \frac 1 3 \frac 1 3 \frac 1 3 \right) + \left( 1 - \alpha \right) ( 1 0 0 ) } } \\ { { z ^ { 2 } ( \alpha ) = \alpha \left( \frac 1 3 \frac 1 3 \frac 1 3 \right) + ( 1 - \alpha ) ( 0 1 0 ) } } \\ { { z ^ { 3 } ( \alpha ) = \alpha \left( \frac 1 3 \frac 1 3 \frac 1 3 \right) + ( 1 - \alpha ) ( 0 0 1 ) } } \end{array}
+$$
+
+and obtain $D ( x , t ) = \mathbf { z } ( \alpha _ { t } ) * x$ via a schedule defined as $\alpha _ { 1 } , \ldots , \alpha _ { t }$ for each respective step. Notice that a gray image is obtained when $x _ { T } = { \bf z } ( 1 ) * x _ { 0 }$ .
+
+We can tune the ratio $\alpha _ { t }$ to control the amount of information removed in each step. For our experiment, we schedule the ratio such that for every $t$ we have
+
+$$
+x _ { t } = \mathbf { z } ( \alpha _ { t } ) * \ldots * \mathbf { z } ( \alpha _ { 1 } ) * x _ { 0 } = \mathbf { z } ( \frac { t } { T } ) * x _ { 0 } .
+$$
+
+This schedule ensures that color information lost between steps is smaller in earlier stage of the diffusion and becomes larger as $t$ increases.
+
+We train the models on different datasets for 700,000 gradient steps. We use Adam (Kingma & Ba, 2014) optimizer with learning rate $2 \times 1 0 ^ { - 5 }$ . We use batch size 32, and we accumulate the gradients every 2 steps. Our final model is an exponential moving average of the trained model with decay rate 0.995. We update the EMA model every 10 gradient steps. For CIFAR-10 we use $T = 5 0$ and for CelebA we use $T = 2 0$ .
+
+
+Figure 10: Progressive inpainting of selected masked MNIST, CIFAR-10, and CelebA images.
+
+
+Figure 11: Additional examples from inpainting models trained on the MNIST, CIFAR-10, and CelebA datasets. Left to right: degraded inputs $D ( x _ { 0 } , T )$ , direct reconstruction $R ( D ( x _ { 0 } , T ) )$ , sampled reconstruction with TACoS described in Algorithm 2, and original image.
+
+
+Figure 12: Progressive upsampling of selected downsampled MNIST, CIFAR-10, and CelebA images. The original image is at the left for each of these progressive upsamplings.
+
+We illustrate our recolorization results in Figure 14. We present testing examples, as well as their grey scale images, from all the datasets, and compare the recolorization results with the original images. The recolored images feature correct color separation between different regions, and feature various and yet semantically correct colorization of objects. Our sampling technique still yields minor differences in comparison to the direct reconstruction, although the change is not visually apparent. We attribute this to the shape restriction of colorization task, as human perception is rather insensitive to minor color change. We also provide quantitative measurement for the effectiveness of our recolorization results in terms of different similarity metrics, and summarize the results in Table 6.
+
+Table 6: Quantitative metrics for quality of image reconstruction using recolorization models for all three channel datasets.
+
+
Degraded Image
Reconstruction
Dataset
FID
SSIM
RMSE
FID
SSIM
RMSE
CIFAR-10
97.39
0.937
0.078
45.74
0.942
0.069
CelebA
41.20
0.942
0.089
17.50
0.973
0.042
+
+
+Figure 13: Additional examples from super-resolution models trained on the MNIST, CIFAR-10, and CelebA datasets. Left to right: degraded inputs $D ( x _ { 0 } , T )$ , direct reconstruction $R ( D ( x _ { 0 } , T ) )$ , sampled reconstruction with TACoS described in Algorithm 2, and original image.
+
+
+Figure 14: Recolorization models trained on the CIFAR-10 and CelebA datasets. Left to right: degraded inputs $D ( x _ { 0 } , T )$ , direct reconstruction $R ( D ( x _ { 0 } , T ) )$ , sampled reconstruction with TACoS described in Algorithm 2, and original image.
+
+# A.5 IMAGE SNOW
+
+Here we provide results for the additional task of snowification, which is a direct adaptation of the offical implementation of ImageNet-C snowification process (Hendrycks & Dietterich, 2019). To determine the snow pattern of a given image $\boldsymbol { x } _ { 0 } \in \mathbb { R } ^ { \boldsymbol { \dot { C } } \times \boldsymbol { H } \times \boldsymbol { W } }$ , we first construct a seed matrix $S _ { A } \in \mathbb { R } ^ { H \times W }$ where each entry is sampled from a Gaussian distribution $N ( \mu , \sigma )$ . The upper-left corner of $S _ { A }$ is then zoomed into another matrix $S _ { B } \in \mathbb { R } ^ { H \times W }$ with spline interpolation. Next, we create a new matrix $S _ { C }$ by filtering each value of $S _ { B }$ with a given threshold $c _ { 1 }$ as
+
+$$
+\begin{array} { r } { S _ { C } [ i ] [ j ] = \left\{ \begin{array} { l l } { 0 , } & { S _ { B } [ i ] [ j ] \le c _ { 1 } } \\ { S _ { B } [ i ] [ j ] , } & { S _ { B } [ i ] [ j ] > c _ { 1 } } \end{array} \right. } \end{array}
+$$
+
+and clip each entry of $S _ { C }$ into the range $[ 0 , 1 ]$ . We then convolve $S _ { C }$ using a motion blur kernel with standard deviation $c _ { 2 }$ to create the snow pattern $S$ and its up-side-down rotation $S ^ { \prime }$ . The direction of the motional blur kernel is randomly chosen as either vertical or horizontal. The final snow image is created by again clipping each value of $x _ { 0 } + S + S ^ { \prime }$ into the range $[ 0 , 1 ]$ . For simplicity, we abstract the process as a function $h ( x _ { 0 } , S _ { A } , c _ { 0 } , c _ { 1 } )$ .
+
+
+Figure 15: Additional examples from Desnowification models trained on the CIFAR-10 and CelebA datasets. Left to right: degraded inputs $D ( x _ { 0 } , T )$ , direct reconstruction $R ( D ( x _ { 0 } , T ) )$ , sampled reconstruction with TACoS described in Algorithm 2, and original image.
+
+To create a series of between $[ c _ { 0 } ^ { \mathrm { s t a r t } } , c _ { 0 } ^ { \mathrm { e n d } } ]$ and $T$ images with increasing snowification, we linearly interpolate $[ c _ { 1 } ^ { \mathrm { s t a r f } } , c _ { 1 } ^ { \mathrm { e n d } } ]$ respectively, to create $c _ { 0 } ( t )$ and $c _ { 1 } ( t )$ , $t = 1 , \dots , T$ . Then for $c _ { 0 }$ and $c _ { 1 }$ each $x _ { 0 }$ , a seed matrix $S _ { x }$ is sampled, the motion blur direction is randomized, and we construct each related $x _ { t }$ by $x _ { t } = h ( x _ { 0 } , S _ { x } , c _ { 0 } ( t ) , c _ { 1 } ( t ) )$ . Visually, $c _ { 0 } ( t )$ dictates the severity of the snow, while $c _ { 1 } ( t )$ determines how “windy” the snowified image seems.
+
+For both CIFAR-10 and Celeb-A, we use the same Gaussian distribution with parameters $\mu = 0 . 5 5$ and $\sigma = 0 . 3$ to generate the seed matrix. For CIFAR-10, we choose $c _ { 0 } ^ { \mathrm { s t a r t } } = 1 . 1 5$ , $c _ { 0 } ^ { \mathrm { e n d } } = 0 . 7$ , $c _ { 1 } ^ { \mathrm { s t a r t } } = 0 . 0 5$ and $c _ { 1 } ^ { \mathrm { e n d } } = 1 6$ 0 0 , which generates a visually lighter snow. For Celeb-A, we choose $c _ { 0 } ^ { \mathrm { s t a r t } } = 1 . 1 5$ , $c _ { 0 } ^ { \mathrm { e n d } } = 0 . 5 5$ , $c _ { 1 } ^ { \mathrm { s t a r t } } = 0 . 0 5$ and $c _ { 1 } ^ { \mathrm { e n d } } = 2 0 $ , which generates a visually heavier snow.
+
+We train the models on different datasets for 700,000 gradient steps. We use Adam (Kingma & Ba, 2014) optimizer with learning rate $2 \times 1 0 ^ { - 5 }$ . We use batch size 32, and we accumulate the gradients every 2 steps. Our final model is an exponential moving average of the trained model with decay rate 0.995. We update the EMA model every 10 gradient steps. For CIFAR-10 we use $T = 2 0 0$ and for CelebA we use $T = 2 0 0$ . We note that the seed matrix is resampled for each individual training batch, and hence the snow pattern varies across the training stage.
+
+# A.6 GENERATION USING NOISE : FURTHER DETAILS
+
+Here we show the equivalence between the sampling method proposed in Algorithm 2 and the deterministic sampling in DDIM (Song et al., 2021a). Given the image $x _ { t }$ at step $t$ , we have the restored clean image $\hat { x _ { 0 } }$ from the diffusion model. Hence given the estimated $\hat { x _ { 0 } }$ and $x _ { t }$ , we can estimate the noise $z ( x _ { t } , t )$ (or $\hat { z }$ ) as
+
+$$
+z ( x _ { t } , t ) = \frac { x _ { t } - \sqrt { \alpha _ { t } } \hat { x _ { 0 } } } { \sqrt { 1 - \alpha _ { t } } } ,
+$$
+
+Thus, the $D ( \hat { x _ { 0 } } , t )$ and $D ( \hat { x _ { 0 } } , t - 1 )$ can be written as
+
+$$
+D ( \hat { x _ { 0 } } , t ) = \sqrt { \alpha _ { t } } \hat { x _ { 0 } } + \sqrt { 1 - \alpha _ { t } } \hat { z } ,
+$$
+
+$$
+D ( \hat { x _ { 0 } } , t - 1 ) = \sqrt { \alpha _ { t - 1 } } \hat { x _ { 0 } } + \sqrt { 1 - \alpha _ { t - 1 } } \hat { z } ,
+$$
+
+using which the sampling process in Algorithm 2 to estimate $x _ { t - 1 }$ can be written as,
+
+$$
+\begin{array} { r l } & { x _ { t - 1 } = x _ { t } - D ( \hat { x _ { 0 } } , t ) + D ( \hat { x _ { 0 } } , t - 1 ) } \\ & { \qquad = x _ { t } - \big ( \sqrt { \alpha _ { t } } \hat { x _ { 0 } } + \sqrt { 1 - \alpha _ { t } } \hat { z } \big ) + \big ( \sqrt { \alpha _ { t - 1 } } \hat { x _ { 0 } } + \sqrt { 1 - \alpha _ { t - 1 } } \hat { z } \big ) } \\ & { \qquad = \sqrt { \alpha _ { t - 1 } } \hat { x _ { 0 } } + \sqrt { 1 - \alpha _ { t - 1 } } \hat { z } } \end{array}
+$$
+
+which is same as the sampling method as described in (Song et al., 2021a). The only difference from the original (Song et al., 2021a) is the order for estimating $\hat { x _ { 0 } }$ and $\hat { z }$ . The original (Song et al., 2021a) paper estimated $\hat { z }$ first and then used this to predict clean image $\hat { x _ { 0 } }$ , while we first predict the clean image $\hat { x _ { 0 } }$ and then estimate the noise $\hat { z }$ .
+
+# A.7 GENERATION USING BLUR TRANSFORMATION: FURTHER DETAILS
+
+
+Figure 16: Examples of generated samples from $1 2 8 \times 1 2 8$ CelebA and AFHQ datasets using Method 2 with perfect symmetry.
+
+The Figure 16, shows the generation without breaking any symmetry within each channel are quite promising as well.
+
+Necessity of Algorithm 2: In the case of unconditional generation, we observe a marked superiority in quality of the sampled reconstruction using Algorithm 2 over any other method considered. For example, in the broken symmetry case, the FID of the directly reconstructed images is 257.69 for CelebA and 214.24 for AFHQ, which are far worse than the scores of 49.45 and 54.68 from Table 5. In Figure 17, we also give a qualitative comparison of this difference. We can also clearly see from Figure 18 that Algorithm 1, the method used in Song et al. (2021b) and Ho et al. (2020), completely fails to produce an image close to the target data distribution.
+
+# A.8 ALGORITHM 1 IS SAME AS DDIM/DDPM SAMPLING
+
+The sampling method proposed in Song et al. (2021a) in it’s equation 12 is given as
+
+$$
+x _ { t - 1 } = \sqrt { \alpha _ { t - 1 } } \cdot \mathrm { \ " { s p r e d i c t e d } } x _ { 0 } \mathrm { \ " { ~ , ~ } } + \sqrt { 1 - \alpha _ { t - 1 } - \sigma _ { t } ^ { 2 } } \epsilon _ { \theta } ( x _ { t } ) + \sigma _ { t } \epsilon _ { t }
+$$
+
+where $\epsilon _ { \theta } ( x _ { t } )$ is the noise predicted by the diffusion model given $x _ { t }$ and $t$ . The term “predicted $x _ { 0 }$ ” or $\hat { x _ { 0 } }$ can be computed directly given $x _ { t }$ and $\epsilon _ { \theta } ( x _ { t } )$ as
+
+$$
+\hat { x _ { 0 } } = \frac { x _ { t } - \sqrt { 1 - \alpha _ { t } } \epsilon _ { \theta } ( x _ { t } ) } { \sqrt { \alpha _ { t } } } ,
+$$
+
+Hence using $\hat { z }$ instead of $\epsilon _ { \theta } ( x _ { t } )$ and $\hat { x _ { 0 } }$ to indicate predicted clean image, we have
+
+$$
+x _ { t - 1 } = \sqrt { \alpha _ { t - 1 } } \cdot \hat { x _ { 0 } } + \sqrt { 1 - \alpha _ { t - 1 } - \sigma _ { t } ^ { 2 } } \hat { z } + \sigma _ { t } \epsilon _ { t }
+$$
+
+Thus, the sampling step can interpreted as follows: At each step $t$ , we start with a noisy image $x _ { t }$ and use the diffusion model to estimate the clean image $\hat { x _ { 0 } }$ and the noise $\hat { z }$ that was added to this clean image $\hat { x _ { 0 } }$ to get the noisy image $x _ { t }$ . In order to move to lesser noisy image $x _ { t - 1 }$ , one “adds back” lesser noise to the the “predicted clean image” $\hat { x _ { 0 } }$ . Now one can add back noise in 2 ways, either the noise which was added to the clean image $\hat { x _ { 0 } }$ which is $\hat { z }$ or sample a new uncorrelated noise $\epsilon _ { t }$ . Infact both of these noise can be added using $\sigma _ { t }$ as the hyperparameter that weighs the amount of each noise added. This $\sigma _ { t }$ is placed in the equation such that for any choice of $\sigma _ { t }$ , the standard deviation of noise added back is $\sqrt { 1 - \alpha _ { t - 1 } }$ . For $\sigma _ { t } = 0$ , we only add back the estimated noise $\hat { z }$ and no uncorrelated noise $\epsilon _ { t }$ which is infact the DDIM sampling. While for $\sigma _ { t } = \sqrt { ( 1 - \alpha _ { t - 1 } ) / ( 1 - \alpha _ { t } ) } \sqrt { 1 - \alpha _ { t } / \alpha _ { t - 1 } }$ we get the sampling method described in DDPM.
+
+Nevertheless, for any choice of $\sigma _ { t }$ , the sampling method involves a denoising operation which is shown as $R ( x _ { s } , s )$ in Algorithm 1 and adding back noise shown as $x _ { s - 1 } = D ( \hat { x _ { 0 } } , s - 1 )$ in Algorithm 1. The only difference between different sampling methods explained in DDPM or DDIM is how one degrades the image back.
+
+
+Figure 17: Comparison of direct reconstruction with sampling using TACoS described in Algorithm 2 for generation with blur transformation and broken symmetry. Left-hand column is the initial cold images generated using the simple Gaussian model. Middle column has images generated in one step (i.e. direct reconstruction). Right-hand column are the images sampled with TACoS described in Algorithm 2. We present results for both CelebA (top) and AFHQ (bottom) with resolution $1 2 8 \times 1 2 8$ .
+
+
+Figure 18: Comparison of Algorithm 1 (top row) and Algorithm 2 (bottom row) for generation with Method 2 and broken symmetry on $1 2 8 \times 1 2 8$ CelebA dataset. We demonstrate that Algorithm 1 fails completely to generate a new image.
+
+
+Figure 19: Progressive deblurring of selected blurred MNIST and CIFAR-10 images.
+
+
+Figure 20: Progressive deblurring of selected blurred CelebA images.
+
+
+Figure 21: Deblurred Cifar10 images
\ No newline at end of file
diff --git a/md/dev/t877958UGZ/t877958UGZ.md b/md/dev/t877958UGZ/t877958UGZ.md
new file mode 100644
index 0000000000000000000000000000000000000000..88883bbcf33cc047a3718887de10839d1993ba78
--- /dev/null
+++ b/md/dev/t877958UGZ/t877958UGZ.md
@@ -0,0 +1,465 @@
+# Cheap and Quick: Efficient Vision-Language Instruction Tuning for Large Language Models
+
+Gen Luo13, Yiyi Zhou12, Tianhe Ren1, Shengxin Chen1, Xiaoshuai Sun12, Rongrong $\mathbf { J i ^ { 1 2 3 * } }$
+1Key Laboratory of Multimedia Trusted Perception and Efficient Computing, Ministry of Education of China, School of Informatics, Xiamen University, 361005, P.R. China.
+2Institute of Artificial Intelligence, Xiamen University, 361005, P.R. China.
+3 Peng Cheng Laboratory, Shenzhen, 518000, China. {luogen,chenshengxin,rentianhe}@stu.xmu.edu.cn, {zhouyiyi,xssun,rrji}@xmu.edu.cn
+
+# Abstract
+
+Recently, growing interest has been aroused in extending the multimodal capability of large language models (LLMs), e.g., vision-language (VL) learning, which is regarded as the next milestone of artificial general intelligence. However, existing solutions are prohibitively expensive, which not only need to optimize excessive parameters, but also require another large-scale pre-training before VL instruction tuning. In this paper, we propose a novel and affordable solution for the effective VL adaption of LLMs, called Mixture-of-Modality Adaptation (MMA). Instead of using large neural networks to connect the image encoder and LLM, MMA adopts lightweight modules, i.e., adapters, to bridge the gap between LLMs and VL tasks, which also enables the joint optimization of the image and language models. Meanwhile, MMA is also equipped with a routing algorithm to help LLMs achieve an automatic shift between single- and multi-modal instructions without compromising their ability of natural language understanding. To validate MMA, we apply it to a recent LLM called LLaMA and term this formed large visionlanguage instructed model as LaVIN. To validate MMA and LaVIN, we conduct extensive experiments under two setups, namely multimodal science question answering and multimodal dialogue. The experimental results not only demonstrate the competitive performance and the superior training efficiency of LaVIN than existing multimodal LLMs, but also confirm its great potential as a general-purpose chatbot. More importantly, the actual expenditure of LaVIN is extremely cheap, e.g., only 1.4 training hours with 3.8M trainable parameters, greatly confirming the effectiveness of MMA. Our project is released at https://luogen1996. github.io/lavin.
+
+# 1 Introduction
+
+In recent years, large language models (LLMs) [3, 37, 5, 52, 38] have continuously pushed the upper limit of natural language understanding with ever increasing parameter sizes and pre-training data scales. The introduction of instruction tuning [30, 31, 35] also enables LLMs to engage in human-like conversations and handle various natural language processing (NLP) tasks [29, 44, 45], approaching artificial general intelligence, e.g., GPT-3.5 [33]. The next milestone is often regarded to extend these LLMs with multimodal capabilities, e.g., vision-language (VL) learning, making LLMs applicable to more real-world application scenarios. Such a target has been recently realized by GPT-4 [34], which is likely to adopt a large-scale vision-language corpus to directly train a multimodal GPT.
+
+
+
+
+Stage-2: Instruction Tuning
+
+
+Stage-1: VL Alignment
+(a) Expert System
+(b) Modular Training Scheme
+
+
+(c) Mixture-of-Modality Adaptation
+Figure 1: Comparison of different multimodal adaptation schemes for LLMs. In the expert system, LLMs play a role of controller, while the ensemble of LLM and vision models is expensive in terms 点:of computation and storage overhead. The modular training regime (b) requires an additional large 计算效率低,参数低效 1. 计算效率高(单张A100可训练),参数高效(2~4 M)neck branch and another large-scale pre-training for cross-modal alignment, which is inefficient in 多阶段优化进一步增大了计算量,同时优化效率低 2. 单阶段联合优化(Training from scratch )training and performs worse in previous NLP tasks. In contrast, the proposed Mixture-of-Modality Adaption (MMA) (c) is an end-to-end optimization scheme, which is cheap in training and superior in the automatic shift between text-only and image-text instructions.
+
+However, the training regime of GPT-4 [34] is prohibitively expensive, and recent endeavors [49, 50, 1, 8, 56, 4] are still keen to efficient VL adaptions of LLMs. As shown in Fig. 1, the existing multimodal solutions for LLMs can be roughly divided into two main categories, i.e., the expert system and the modular training ones, respectively. In the expert system solution [49, 50, 41], LLMs usually serve as a manager to interpret different natural language instructions, and then call the corresponding vision models to handle the input image, e.g., image captioning [18, 27], visual question answering [55, 28] or text-to-image generation [39]. The advantage of this solution is that it does not require the re-training of LLMs and can make full use of existing vision models. However, the ensemble of LLMs and various vision models still exhibits significant redundancy in terms of computation and parameters, leading to excessive memory footprints. Meanwhile, the joint optimization of LLMs and vision models is still an obstacle.
+
+In this case, increasing attention has been paid to the modular training of LLMs [17, 21, 56, 15, 56]. As illustrated in Fig. 1, this paradigm often requires LLMs to deploy an additional neck branch to connect the visual encoders, and then performs another pre-training on numerous image-text pairs for cross-modal alignment. Afterwards, the neck branch and LLM are jointly tuned via VL instructions. Despite the effectiveness, the required VL pre-training is still expensive for a quick adaptation of LLMs. For instance, the pre-training of BLIP2 [17] consumes more than 100 GPU hours on 129 millions of image-text pairs. In addition, this paradigm often requires to update most parameters of LLM, limiting the efficiency of VL instruction tuning. For example, LLaVA-13B [21] fully fine-tunes the entire LLM during VL instruction tuning, resulting in significant increases in training time and intermediate storage overhead2. More importantly, these fine-tune schemes will inevitably undermine the NLP capabilities of LLMs due to the drastic changes in their parameter spaces. For instance, the existing multimodal LLMs, such as BLIP2 [17] and miniGPT4 [56], do not support text-only instructions, greatly hindering their applications.
+
+In this paper, we propose a novel and efficient solution for vision-language instruction tuning, termed Mixture-of-Modality Adaptation (MMA). Different from existing modular training scheme [17, 21], MMA is an end-to-end optimization regime. By connecting the image encoder and LLM with lightweight adapters, MMA can jointly optimize the entire multimodal LLM via a small number of parameters, saving more than thousands times of storage overhead compared with existing solutions [21, 56, 17]. To obtain a quick shift between text-only and image-text instructions, MMA equips the inserted adapters with a routing scheme, which can dynamically choose the suitable adaptation path for the inputs of different modalities, thereby well preserving the NLP capability of LLMs. To validate MMA, we apply it to a recently proposed LLM called LLaMA [43], and term this new large vision-language instructed model as LaVIN. With the help of MMA, LaVIN can achieve cheap and quick adaptations on VL tasks without the requirement of another large-scale pre-training.
+
+To validate LaVIN, we first conduct quantitative experiments on ScienceQA [24]. Experimental results show that LaVIN can achieve on-par performance with the advanced multimodal LLMs, e.g., LLaVA [21], while reducing up to $7 1 . 4 \%$ training time and $9 9 . 9 \%$ storage costs. Notably, fine-tuning
+
+LaVIN on ScienceQA only takes 1.4 hours with 8 A100 GPUs, and the updated parameters are only 3.8M. In addition, we also extend LaVIN to a multimodal chatbot via tuning on $5 2 k$ text-only instructions [42] and $1 5 2 k$ text-image pairs [21]. The qualitative comparisons show that LaVIN can accurately execute various types of human instructions, e.g., coding, math and image captioning, while yielding superior vision-language understanding than existing multimodal chatbots [56, 17, 50].
+
+In summary, our contributions are three folds:
+
+• We present a novel and efficient solution for vision-language instruction tuning, namely Mixture-of-Modality Adaptation (MMA), which does not require the expensive VL pretraining and can maintain the NLP capabilities of LLMs. • Based on MMA, we propose a new multimodal LLM, namely LaVIN. Experimental results show the superior efficiency and competitive performance of LaVIN against existing multimodal LLMs, and also confirm its great potential as a general-purpose chatbot. • We release the source code and pre-trained checkpoints associated with this paper. We believe that our project can well facilitate the development of multimodal LLM.
+
+# 2 Related Work
+
+# 2.1 Parameter-Efficient Transfer Learning
+
+Since large language models have ever-increasing parameter sizes, parameter-efficient transfer learning (PETL) [13, 19, 25, 14, 22, 12] has gained increasing attention to reduce training and storage overhead of LLMs. PETL aims to insert or fine-tune a small number of parameters into LLMs, thereby achieving the adaption on downstream tasks. In early efforts [13, 12], a small MLP network, known as Adapter [13], is inserted into LLMs to project their hidden features to the semantic spaces of downstream tasks. Based on Adapter, numerous PETL methods [19, 46, 25, 14, 22, 12] have been proposed to further enhance adaptation capabilities [19, 46, 25, 22, 12] and inference speed [14]. Among them, AdaMix [46] is a method relatively close to our MMA, which also includes a set of candidate adapters for downstream task routing. However, AdaMix is static and task-dependent, of which routing path is fixed after training. In contrast, our MMA is a dynamic method based on the input modality embeddings. Moreover, AdaMix is still an unimodal module and hard to adaptively adjust the adaptions of different modalities. Driven by the great success in NLP, PETL has also achieved significant progresses in large vision models [26, 2, 54], e.g., ViT [7] and CLIP [36]. Despite the effectiveness, PETL for multimodal LLMs still lacks explorations. A very recent PETL method [51] is proposed for multimodal LLMs , but its performance still lags behind full fine-tuning.
+
+# 2.2 Multimodal Instruction-following LLMs
+
+Instruction tuning [30, 31, 35, 47, 48] aims to fine-tune LLMs on natural language corpus describing diverse NLP tasks. This simple and effective method has been successfully applied to various wellknown LLMs, such as InstructGPT [35] and FLAN-T5 [6], greatly improving their performance and generalization ability. Motivated by this success, numerous efforts have been devoted to constructing multimodal instruction-following LLMs. Existing works can be categorized into two groups, e.g., the expert systems [49, 50, 41] and modular training ones [17, 21, 56, 15, 56], respectively. The representative expert systems, such as Visual ChatGPT [49] and MMREACT [50], employ LLMs as the controller to invoke various vision models to accomplish the VL instructions. Despite the effectiveness, this heavy system also incurs non-negligible burdens in terms of storage and computation. Recently, modular training models [17, 21, 56, 15, 56] as proposed as more efficient alternatives. Among them, Flamingo [1] is the first large-scale multimodal LLM that pre-trains on numerous image-text pairs, which demonstrates strong zero-shot ability on diverse tasks. The following works, including BLIP-2 [17], FROMAGe [16], PaLM-E [8], KOSMOS-1 [15] and LLaVA [21], not only optimize the model architecture [17, 16, 8, 15] but also improve the quality of VL instruction data [21]. Despite their effectiveness, most multimodal LLMs require expensive training costs and perform worse on text-only instructions.
+
+Response: The image features a small brown dog running across a grassy field, with its tongue out and ears flapping. The dog appears to be enjoying itself as it runs through the open space. In the background, there are several trees scattered across the field, adding to the natural setting.
+
+
+Figure 2: The overview of the Mixture-of-Modality Adaptation (MMA) and the architecture of LaVIN. In LaVIN, the novel Mixture-of-Modality Adapters are employed to process the instructions of different modalities. During instruction tuning, LaVIN is optimized by Mixture of Modality Training (MMT) in an end-to-end manner.
+
+# 3 Method
+
+# 3.1 Mixture-of-Modality Adaptation
+
+In this paper, we propose a novel learning regime for the vision-language adaption of LLMs, which is called Mixture-of-Modality Adaptation (MMA). As shown in Fig. 2, MMA includes two novel designs, namely Mixture-of-Modality Adapter (MM-Adapter) and Mixture-of-Modality Training (MMT). Specifically, MM-Adapter extends LLMs with multimodal abilities via lightweight adapters, which also realizes the automatic shift between single- and multi-modal instructions. Afterwards, the entire multimodal LLM is jointly optimized via MMT, which is cheap in training time and storage.
+
+Mixture-of-Modality Adapter (MM-Adapter). As shown in Fig. 2, we connect the LLM with the image encoder with a set of lightweight adaptation modules. In the image encoder, these modules can be the common adapters [13, 26]. In the LLM, unimodal adaptation modules are inferior in handling single- and multi-modal instructions simultaneously.
+
+In particular, we first introduce a modality token $t _ { m } \in \mathbb { R } ^ { c }$ to indicate the input modality, which is defined by
+
+$$
+t _ { m } = m E _ { m } .
+$$
+
+Here, $E _ { m } \in \mathbb { R } ^ { 2 \times c }$ is the modality embedding. $m \in \mathbb { R } ^ { 2 }$ is a one-hot vector to represent the input modality. Based on the modality token $t _ { m }$ , MM-Adapter can dynamically adjust the adaptations for the input features $Z \in \mathbb { R } ^ { \tilde { n } \times c }$ . In practice, $Z$ can be the single- or multi-modal features, which will be introduced in Sec 3.2. Thus, MM-Adapter can be defined by
+
+$$
+Z ^ { \prime } = Z + s \cdot r o u t e r { \left( f _ { a _ { 1 } } ( Z ) , f _ { a _ { 2 } } ( Z ) ; f _ { w } ( t _ { m } ) \right) } .
+$$
+
+Here, $f _ { a _ { 1 } }$ and $f _ { a _ { 2 } }$ are RepAdapters [26] in our paper. $s$ is the scale factor, and router $\cdot ( \cdot )$ is a routing function to decide the routing path of two adapters. To further reduce the parameter costs, the downsampling projection of two adapters are shared.
+
+
+Figure 3: Illustration of the Mixture-of-Modality Adapter (MMA). MMA can dynamically select the appropriate adapter according to the input modalities.
+
+As shown in Fig. 3, the key to realize the dynamic adaptations lies in the design of the routing function router $( \cdot )$ , which is formulated as
+
+$$
+\begin{array} { r l } & { r o u t e r { \left( f _ { a _ { 1 } } ( Z ) , f _ { a _ { 2 } } ( Z ) \right) } = \hat { w } _ { 0 } \cdot f _ { a _ { 1 } } ( Z ) + \hat { w } _ { 1 } \cdot f _ { a _ { 2 } } ( Z ) , } \\ & { \mathrm { w h e r e } \quad \hat { w } = f _ { w } ( t _ { m } ) = \mathrm { s o f t m a x } ( \frac { t _ { m } W _ { m } + b _ { m } } { \tau } ) . } \end{array}
+$$
+
+Here, $W _ { m } \in \mathbb { R } ^ { c \times 2 }$ and $b _ { m } \in \mathbb { R } ^ { 2 }$ are the weight matrix and bias, respectively. $\hat { w }$ denotes the routing weights, and $\tau$ is the temperature of the softmax. Based on Eq. 2 and 3, MM-Adapter can select the best adaption path according to the modalities of input instructions. More importantly, the process of MM-Adapter only introduces a few of additional parameters, which is still efficient. In practice, MM-Adapter can be used as the unimodal adapter to improve the adaptation ability, thus we also apply it to the image encoder.
+
+Mixture-of-Modality Training (MMT). Based on MM-Adapter, the target of MMT is to freeze the large image encoder and LLM, and only fine-tune the inserted adapters. In this case, the entire multimodal LLM can be jointly optimized in an end-to-end manner. Specifically, the end-to-end optimization objective can be formulated by
+
+$$
+\arg \operatorname* { m i n } _ { { } } \mathcal { L } ( f _ { \phi } ( Z ) , R ; \theta _ { a } ) .
+$$
+
+Here, $R$ and $\mathcal { L } ( \cdot )$ denote the ground-truth response [24] and the objective loss function, respectively. $f _ { \phi }$ is the LLM, and $\theta _ { a }$ denotes the adaptation parameters. $I \in \mathbb { R } ^ { h \times w \times 3 }$ and $T \in \mathbb { R } ^ { l }$ denote the input image and text instruction, respectively.
+
+During training, we construct a mini training batch randomly sampled from text-only and text-image instructions. In this case, the overall training objective $\mathcal { L }$ can be defined by
+
+$$
+\mathcal { L } = \sum _ { i = 1 } ^ { m } \sum _ { s = 1 } ^ { S + 1 } \log p ( R _ { s } ^ { i } | Z ^ { i } , R _ { 0 : s - 1 } ^ { i } ; \theta _ { a } ) .
+$$
+
+Here, $m$ denotes the batch size, and $S$ is the length of the response. After MMT, the multimodal LLM can effectively execute the input instructions of different modalities.
+
+In our training scheme, the number of optimized parameters is still kept at a very small scale, e.g., $3 { \sim } 5 \mathbf { M }$ , which greatly reduces the training time and the storage cost. Compared to existing modular training paradigm, MMA does not require additional VL pre-training and can optimize the entire model end-to-end, further improving the training efficiency.
+
+# 3.2 Large Vision-language Instructed Model
+
+To validate MMA, we apply it to an LLM called LLaMA [43] and adopt CLIP-ViT [36] as the image encoder. Here, we term this new large vision-language instructed model as LaVIN.
+
+Given the input image $\boldsymbol { I } \in \mathbb { R } ^ { h \times w \times 3 }$ , we use the [cls] tokens from every fourth layer of ViT [7] as the visual feature, denoted as $\ b { X } \in \mathbb { R } ^ { n \times d }$ . In the image encoder, we insert the adapters before the multi-head attention modules. We represent the text instruction with word embeddings, denoted as $Y \in \mathbb { R } ^ { l \times c }$ . Then, a simple visual adapter is used to transform the visual features to the same dimension with the LLM, which is defined by
+
+$$
+X ^ { \prime } = \sigma ( X W _ { d } + b _ { d } ) W _ { u } + b _ { u } .
+$$
+
+Here, $W _ { d } \in \mathbb { R } ^ { d \times d _ { h } }$ and $W _ { u } \in \mathbb { R } ^ { d _ { h } \times c }$ denote the weight matrices, while $W _ { d } \in \mathbb { R } ^ { d _ { h } }$ and $b _ { u } \in \mathbb { R } ^ { c }$ are the bias terms. $\sigma$ is the SwiGLU activation function [40]. In practice, $d _ { h }$ is much smaller than $d$ and $c$ , so the input of LLM can be defined by
+
+$$
+Z = { \left\{ \begin{array} { l l } { [ t _ { m } , X ^ { \prime } , Y ] } & { t e x t - i m a g e , } \\ { [ t _ { m } , Y ] } & { t e x t o n l y . } \end{array} \right. }
+$$
+
+Here, $[ \cdot ]$ denotes the concatenation. Based on the multimodal input, LLM can predict the next token step by step, which can be formulated by
+
+$$
+p _ { t } = \prod _ { s = 1 } ^ { S + 1 } p ( R _ { s } | Z , R _ { 0 : s - 1 } ; \theta _ { l } , \theta _ { a } )
+$$
+
+Here, $p _ { t } \in \mathbb { R } ^ { m }$ denotes the probabilities of the predicted word and $m$ is the length of the word embeddings. $\theta _ { l }$ and $\theta _ { a }$ denote the parameters of LLM and adaptation modules, respectively.
+
+Compared with previous works [17, 56, 21], the architecture of LaVIN is much simpler and more lightweight, which is also easier to optimize. For example, the visual neck of LaVIN is 6 times smaller than that of LLaVA [21], but the performance of two models is close.
+
+Table 1: Comparison on ScienceQA test set. Question classes: $\mathbf { N A T } =$ natural science, $\mathrm { S O C = }$ social science, $\mathrm { L A N } =$ language science, TXT $=$ text context, IMG $=$ image context, ${ \mathrm { N O } } =$ no context, G1-6 $=$ grades 1-6, $G 7 - 1 2 =$ grades 7-12. $\dagger$ denotes that LaVIN is trained with 40 epochs. #T-Params denotes that the number of trainable parameters.
+
+
Method
#T-Param
LLM
Subject
Context Modality
Grade
Average
NAT
sOC
LAN
TXT
IMG
NO
G1-6
G7-12
Zero-& few-shot methods
Human [24]
90.23
84.97
87.48
89.60
87.50
88.10
91.59
82.42
88.40
GPT-3.5 [24]
X
74.64
69.74
76.00
74.44
67.28
77.42
76.80
68.89
73.97
GPT-3.5 (CoT) [24]
√
75.44
70.87
78.09
74.68
67.43
79.93
78.23
69.68
75.17
GPT-4 [34]
-
√
84.06
73.45
87.36
81.87
70.75
90.73
84.69
79.10
82.69
Representative&SoTA models
UnifiedQA [24]
223M
X
71.00
76.04
78.91
66.42
66.53
81.81
77.06
68.82
74.11
MM-CoTBase [53]
223M
X
87.52
77.17
85.82
87.88
82.90
86.83
84.65
85.37
84.91
MM-CoTLarge [53]
738M
×
95.91
82.00
90.82
95.26
88.80
92.89
92.44
90.31
91.68
LLaVA [21]
13B
√
90.36
95.95
88.00
89.49
88.00
90.66
90.93
90.90
90.92
Parameter-efficientmethods
LLaMA-Adapter [51]
1.8M
√
84.37
88.30
84.36
83.72
80.32
86.90
85.83
84.05
85.19
LaVIN-7B (ours)
3.8M
√
89.25
94.94
85.24
88.51
87.46
88.08
90.16
88.07
89.41
LaVIN-13B (ours)
5.4M
√
90.32
94.38
87.73
89.44
87.65
90.31
91.19
89.26
90.50
LaVIN-13B† (ours)
5.4M
√
89.88
94.49
89.82
88.95
87.61
91.85
91.45
89.72
90.83
+
+
Settings
#T-Params
NAT
SOC
LAN
TXT
IMG
NO
G1-6
G7-12
Avg.
Text Only
1.8M
82.86
82.56
82.28
81.23
75.81
86.06
83.26
81.54
82.65(+0.00)
+ Vision Modality (MMT)
2.4M
85.97
90.66
83.55
84.90
83.59
86.41
88.14
83.06
86.32(+3.67)
+ Joint Opt. (MMT)
2.5M
86.59
94.71
82.91
85.63
84.98
86.41
88.62
85.04
87.34(+4.69)
+ Stronger Image Enc.
2.9M
88.01
94.94
83.64
87.15
86.81
87.04
89.87
85.56
88.33(+5.68)
+ MM-Adapter
3.8M
89.25
94.94
85.24
88.51
87.46
88.08
90.16
88.07
89.41(+6.76)
+ Larger LLM (13B)
5.4M
90.32
94.38
87.73
89.44
87.65
90.31
91.19
89.26
90.50(+7.85)
+
+Table 2: Ablation studies on ScienceQA test set. For the text-only baseline, we use the image caption to prompt the model. ViT-B/16 and LLaMA-7B are used as the default image encoder and LLM. “Joint Opt” denotes the joint optimization of image encoder and LLM. The Mixture-of-Modality Training (MMT) is ablated with the settings of “Vision Modality” and “Joint Opt.”.
+
+# 4 Experiments
+
+# 4.1 Datasets and Metrics
+
+ScienceQA. ScienceQA [24] is the large-scale multimodal dataset for science question answering, which covers various domains, including 3 subjects, 26 topics, 127 categories and 379 skills. ScienceQA consists of text-only and text-image examples in three splits namely train, val and test, with 12,726, 4,241 and 4,241 examples, respectively. We evaluate our model using average accuracy.
+
+Alphaca-52k & LLaVA-158k. Alphaca-52k [42] contains 52k text-only instruction-following data generated by GPT-3.5 [3]. LLaVA-158k [21] is a large-scale text-image instruction-following dataset, where the answer is automatically generated by GPT-4 [34]. Following LLaVA [21], GPT-4 is employed to evaluate the quality of the chatbot’s responses, which will assign higher scores to superior responses within a range of 1 to 10.
+
+# 4.2 Implementation Details
+
+We employ the ViT-L/14 [7] of the pre-trained CLIP [36] as the image encoder. The visual features consist of six [cls] tokens extracted from every fourth layer of ViT-L/14. For LLM, LLaMA7B [43] and LLaMA-13B [43] are used. The default dimension of the visual neck is set to 128. The dimension of MM-Adapter is 8, and the temperature is set to 10 for LaVIN-7B and 5 for LaVIN-13B. For text-only baseline, the image encoder is removed, and MM-Adapter is replaced with RepAdapter [26]. We adopt AdamW [23] as the optimizer, and train the model for 20 epochs with a cosine decay learning rate schedule. The batch size, learning rate and weight decay are set to 32, 9e-3 and 0.02, respectively. During the generation stage, the decoding uses top- $p$ sampling with a temperature of 0.1 and a top- $p$ value of 0.75, respectively. For the experiments of multimodal chatbot, all hyperparameters remain the same, except for the training epochs, which are reduced to 15.
+
+# 4.3 Experimental Results
+
+# 4.3.1 Quantitative Experiments
+
+Results on ScienceQA. In Tab. 1, We first compare LaVIN with the state-of-the-art methods on ScienceQA. From this table, the first observation is that the few-shot LLMs, such as GPT-4, still perform worse than human, suggesting the great challenge of ScienceQA. In contrast, existing supervised methods [21, 51, 53] yield better results. In particular, MM-CoTLarge [53] achieves the best performance, e.g., 91.68. However, MM-CoT mainly focuses on the multimodal chain-of-thought for language models, of which contribution is orthogonal to our approach. In particular, LLaVA [21] is an end-to-end multimodal LLM, which is more close to our work.
+
+The results show that LLaVA remains competitive performance against MM-CoTLarge[53], especially in the category of SOC. Despite the effectiveness, its number of trainable parameters is still large, leading to higher training overhead. LLaMA-Adapter [51] adopts a parameterefficient scheme to reduce the training overhead, but its performance still greatly lags behind LLaVA. Compared to these approaches, LaVIN achieves the better trade-offs between performance and training efficiency. For exam
+
+
Methods
#T-Params
Accuracy
LLaVA [21]
13B
85.81
LLaMA-Adapter [51]
1.8M
85.19
LaVIN-7B
3.8M
89.41 (+4.22)
LaVIN-13B
5.4M
90.83 (+5.02)
+
+Table 3: Results of LaVIN and existing multimodal LLMs without the pre-training stage. We report the average accuracy on ScienceQA test set.
+
+ple, LaVIN-7B consumes a similar scale of trainable parameters as LLaMA-Adapter [51], while outperforming it by $+ 4 . 2 2$ gains. When scaling up to 13B, LaVIN can obtain more significant performance gains, i.e., $+ 5 . 6 4$ . Compared to LLaVA, LaVIN-13B also achieves comparable performance and even performs better in some question classes, e.g., LAN and NO. Considering the much lower training costs than LLaVA, such competitive performance greatly confirms the efficiency and designs of LaVIN.
+
+In Tab. 3, we compare LaVIN with existing methods without VL pretraining. From this table, we observe that both LLaVA [21] and LLaMAAdapter achieve the similar performance, i.e., 85.81 vs. 85.19. In particular, LLaVA [21] and LLaMAAdapter [51] freeze the image backbone, and the entire multimodal LLM is not jointly optimized, which hinders the learning of visual content. Moreover, the adaptation module in LLaMA-Adapter does not consider
+
+
Methods
PT Data
#T-Params
BLEU-4
CIDEr
ClipCap [32]
0
-
33.5
113.1
LLaMA-Adapter V2 [11]
0
14M
36.2
122.2
BLIP [18]
14M
583M
40.4
136.7
BLIP-2 [17]
129M
188M
43.7
145.3
LaVIN (ours)
0
5.4M
36.4
126.9
LaVIN (ours)
0.6M
5.4M
37.8
131.7
+
+Table 4: Fine-tuning results of LaVIN and existing multimodal LLMs on COCO captioning. We report performance on Karpathy test split.
+
+the modality gap in the input instructions, greatly limiting its performance upper bound. In contrast, with the help of MMA, LaVIN significantly outperforms these approaches, e.g., $+ 5 . 0 2$ gains over LLaVA. These results validate the proposed MMA towards the effective and efficient VL adaption, and confirm the designs of LaVIN.
+
+Results on COCO Captioning. In Tab 4, we compare LaVIN with existing methods on the task of image captioning. From these results, we can still observe the competitive performance of LaVIN. As a parameter-efficient tuning method, LaVIN outperforms LLaMA-Adapter v2 [11] by a large margin, e.g., up to $+ 9 . 5$ of CIDEr. Compared with large-scale pre-training models, e.g., BLIP and BLIP-2, the performance of LaVIN is still comparable, while the expenditure is much cheaper. For instance, with only $0 . 6 \mathbf { M }$ pre-training data and 5.4M updated parameters, LAVIN can achieve 131.7 CIDEr on COCO Captioning. Notably, our tuning only takes 4 GPU hours on 8 A100s, while BLIP-2 requires more than 300 GPU hours on 16 A100s. These results further validate the effectiveness and training efficiency of MMA and LaVIN.
+
+Zero-shot evaluation on NLP and multimodal benchmarks. In Tab. 5, we evaluate the zero-shot ability of LaVIN and existing methods on TruthfulQA [20] and MME [10]. On TruthfulQA [20], we observe that the zero-shot performance of existing multimodal LLMs is obviously inferior to the original LLaMA. In stark contrast, LaVIN can further improve the performance by $+ 9 . 2 \%$ than LLaMA-Base [43] through its mixture-of-modality adaptation. On MME [10], a challenging benchmark for multimodal evaluation, LaVIN still demonstrates competitive performance against existing multimodal LLMs. Expect for BLIP-2 [17], which is pre-trained on numerous data, the other methods perform similarly to or worse than LaVIN, e.g., 866.5 of MiniGPT-4 vs. 963.6 of LaVIN on MME-C. These results confirm the strong generalization ability of LaVIN, and also validate that the NLP capabilities are well preserved by MMA during VL instruction tuning.
+
+Ablation study. To gain deep insights into MMA and LaVIN, we conduct comprehensive ablation studies in Tab. 2. From this table, we can see that each design of MMA and LaVIN greatly contributes to the final performance. As shown in Tab. 2, the mixture-of-modality training (MMT) brings the most significant gains, e.g., $+ 4 . 6 9$ . In MMT, the joint training with the vision modality provides up to $+ 3 . 6 7$ performance gains for LaVIN. With the joint optimization of the image encoder and LLM, the performance of LaVIN further boosts from 86.32 to 87.34, suggesting the significance of the joint optimization for multimodal LLMs. With the help of MMT, LaVIN already surpasses the ex
+
+Table 5: Zero-shot results on NLP and multimodal benchmarks. “Mc1_targets” setup is used on TruthfulQA [20]. “MME-C” and “MME-P” denote the splits of Cognition and Perception on MME benchmark [10], respectively.
+
+
Methods TruthfulQA MME-C MME-P
LLaMA-Base [43]
38.7
=
=
LLaMA-Adapter V2 [11]
24.4
972.6
248.9
LLaVA [21]
16.4
502.8
214.6
BLIP-2 [17]
-
1293.8
290.0
MiniGPT-4 [56]
1
866.5
292.1
LaVIN (ours)
47.9
963.6
249.6
+
+isting parameter-efficient method, i.e., LLaMA-Adapter. Additionally, the stronger image encoder, i.e., ViT-L/14, also improves the average accuracy by 0.99. An interesting observation is that a better image encoder provides noticeable performance gains for both image-based and text-based questions. When adopting MM-Adapter to LaVIN, we observe $+ 1 . 0 8$ gains on average accuracy. Such an improvement only requires extra 0.9M parameters, which is very lightweight. Meanwhile, the performance of $\mathrm { L a V I N }$ is significantly improved by MM-Adapter on more challenging metrics like G7-12, i.e., $+ 2 . 5 1$ . After scaling up LLM to 13B, the performance of LaVIN is further improved by $+ 1 . 0 9$ . Overall, these ablations well validate the significance of MMA in adapting multimodal LLM, and also confirm the effectiveness of LaVIN.
+
+Comparison of training efficiency. In Tab. 6, we compare the training expenditures of LaVIN, LLaVA [21] and BLIP2 [17]. The first observation is that the pre-training cost of BLIP2 is actually expensive, which requires more than 200 hours. Meanwhile, LLaVA cannot be trained on common machines with the default training settings3. Thus, it requires some GPU memorysaving techniques [9] to avoid out of memory (OOM). However, its training time and storage requirement are still significant. For example, it still takes up to 26GB space to store the updated parameters of the LLM. In contrast, LaVIN demonstrates superior training efficiency with the help of MMA. Compared to LLaVA,
+
+Table 6: Training costs of LaVIN and existing multimodal LLMs on ScienceQA. $^ \ddag$ denotes that GPU memory-saving techniques are used. “OOM” denotes out of GPU memory. All results are evaluated on 8 A100 GPUs.
+
+
Methods
#T-Params Memory
Time
#Storage
BLIP2 [17]
188M
1
>200 hours
1
LLaVA [21]
13B
OOM
N/A
N/A
LLaVA‡ [21]
13B
36.8G
7 hours
26GB
LaVIN-7B
3.8M
33.9G
1.4 hours
15M
LaVIN-13B
5.4M
55.9G
2 hours
20M
+
+LaVIN-7B and LaVIN-13B reduce about $80 \%$ and $7 1 . 4 \%$ training time, respectively. In terms of GPU memory and storage cost, our approach can save more than $40 \%$ GPU memory and $9 9 . 9 \%$ disk storage. Overall, these results greatly confirm the training efficiency of MMA.
+
+# 4.3.2 Qualitative Experiments
+
+Examples of different instruction-following tasks. In Fig 4, we compare LaVIN with existing methods [51, 21] on single- and multi-modal instruction-following tasks, e.g., math, coding and image captioning. Compared to LLaVA [21] and LLaMA-Adapter [51], LaVIN achieves overall better responses across multiple tasks. In Fig.4 (a), LaVIN correctly answers the math problem with a result of 28.8, whereas LLaMA-Adapter [43] provides an incorrect answer. In example (d), LaVIN generates accurate code for the request of “print prime numbers up to 100”. In contrast, the
+
+If a toy costs $\$ 24$ and the price is increased by $20 \%$ , what is the new price of the toy?
+
+Translate the following Chinese into English :生如夏 花之绚烂死如秋叶之静美.
+
+I mix water with water, do I get thin water or thick water?
+
+Write a python code that: Print out all prime numbers up to 100.
+
+LaVIN (ours): foriinrange(1,101):
+
+# LaVIN (ours):
+
+The new price of the toy is \$28.80.
+
+# LaVIN (ours):
+
+Life is like a summer flower, death is like a autumn leaf, quiet and beautiful.
+
+# LaVIN (ours):
+
+You will get the same type of water, just a mixture of the two.
+
+# LLaMA-Adapter:
+
+# LLaMA-Adapter:
+
+The new price of the toy is $\$ 28.40$ .
+
+# LLaMA-Adapter:
+
+Born like summer flowers, die like autumn leaves.
+
+LLaMA-Adapter: Thin water.
+
+1 def prime_numbers(n): foriin range(2,n): $\mathrm { ~ i ~ } = = \mathrm { ~ 0 ~ }$ print(i) prime_numbers(100) (d) Coding
+
+# (a) Math
+
+(b) Translation
+
+# (c) Question Answering
+
+How many food containers are there in the image?
+
+Describe the Image.
+
+
+
+
+
+The boy's clothes in the image are wet, is it because of the rain?
+
+# LaVIN (ours)
+
+: In the image, there are two food containers on the dining table. One container holds a sandwich, and the other holds a plate of broccoli. The sandwich appears to be cut in half, and the broccoli is served on a separate plate.
+
+# LLaVA
+
+: There are three food containers in the image: a bowl, a plate, and a sandwich.
+
+
+Figure 4: Comparison between LaVIN-13B and existing methods on single- and multi-modal instructions. The noteworthy aspects of the responses are highlighted in green, whereas the illogical portions are marked in red. More tasks and examples are given in appendix.
+
+# LaVIN (ours)
+
+# LaVIN (ours)
+
+: The image features a beach scene with a large number of kites flying in the sky.
+
+: No, the boy's clothes are wet because he is surfing in the ocean
+
+# LLaVA
+
+: The image captures a lively beach scene with several people enjoying kite flying near the ocean.
+
+# LLaVA
+
+: Yes, it is likely that the boy's clothes are wet due to the rain.
+
+(e) Visual Question Answering (f) Image Captioning (g) Multimodal Reasoning
+
+code written by LLaMA-Adapter is to check prime numbers, which does not produce any output during execution. Meanwhile, LaVIN presents a clear and concise coding behavior, acting more like a professional programmer. In Fig 4 (e)-(g), LaVIN demonstrates remarkable visual reasoning ability in accomplishing various multimodal tasks. In Fig.4 (e), LaVIN accurately answers the complex questions about the number of food containers in the image and provides a detailed description about the complex scene. The same observation can also be witnessed in Fig.4 (g), where LaVIN infers a correct reason for the wetness of the boy’s clothes. Overall, these examples show the superior reasoning ability of LaVIN in executing single- and multi-modal instructions, while also confirming the significance of MMA in adapting LLMs to multi-modal tasks.
+
+Examples of multimodal dialogue In Fig. 5, we compare LaVIN with existing multimodal LLMs in multi-turn conversations, and use GPT4 [34] to evaluate the quality of their responses. From the results, we can see that LaVIN has higher GPT4 scores among all compared models, suggesting superior ability in multimodal dialogue. Meanwhile, we also observe different response styles of these multimodal LLMs. In particular, BLIP2 [17] tends to produce brief responses, which lack detailed explanations. In contrast, the responses of MiniGPT4 [56] are the longest among all models, but their content is often redundant and repetitive. Compared to them, LaVIN and LLaVA [21] can generate more accurate responses. Particularly, LaVIN performs better than the other methods, mainly due to its more logical and detailed descriptions. As illustrated in the first question, LaVIN not only provides the correct answer, but also explains the reason behind it. In the second question, LaVIN and LLaVA are required to judge whether the man will get wet, and LaVIN answers “yes" while LLaVA considers “no". It can be seen that the reason of LaVIN is more comprehensive, logical and persuasive than LLaVA, which considers the situation of “the overhand may not provide the complete protection”. Overall, these examples confirm that MMA equips LLMs with excellent multi-modal ability, requiring no pre-training on large-scale image-text data.
+
+# 5 Limitations and Broader Impact
+
+We observe two primary limitations of LaVIN. Firstly, LaVIN may generate incorrect or fabricate responses, similar to existing multimodal LLMs. Secondly, LaVIN can not identify extremely fine
+
+# : If it rains now, will the man get wet?
+
+# : What is the baby doing in the image?
+
+
+: What is the weather in the image now?
+
+# : What color is the baby's clothes?
+
+# LaVIN (ours)
+
+:The weather in the image appears to be sunny, as the man is holding a baby in his arms outside, and there are no visible signs of rain or stormy conditions. The presence of a horse in the scene suggests that the location might be a farm or a rural area, where sunny weather is more common. GPT4 Score: 9
+
+# LaVIN (ours)
+
+: Yes, if it rains now, the man will get wet. In the image, the man is holding a baby and petting a brown horse, and they are both standing under an overhang. If it starts raining, the overhang will not provide complete protection from the rain, and the man will get wet as he continues to interact with the horse and the baby.
+
+# LaVIN (ours)
+
+: In the image, the baby is being held by a man, who is also holding a horse's nose. The baby is reaching out to touch the horse's nose, likely experiencing the horse for the first time. This interaction between the baby and the horse creates a moment of connection and curiosity for the child.
+
+# LaVIN (ours)
+
+: The baby's clothes are white. In the image, the man is holding the baby while the horse is nuzzling the baby's face. The baby is wearing a white onesie, which stands out against the man's brown shirt and the horse's color.
+
+# GPT4 Score: 8
+
+BLIP2 : Yes. PT4 Score: 6
+
+# GPT4 Score: 9
+
+# GPT4 Score: 9
+
+BLIP2: Petting the horse. GPT4 Score: 7
+
+BLIP2 : Blue. GPT4 Score: 2
+
+BLIP2 : It is a sunny day. GPT4 Score: 7
+
+# LLaVA
+
+: The weather in the image is sunny.
+GPT4 Score: 7
+
+# LLaVA
+
+: No, the man will not get wet if it starts raining, as he is already inside the stable with the horse. The stable provides shelter from the rain, keeping both the man and the horse dry.
+
+# LLaVA
+
+: The baby is touching the horse, reaching out to pet it while being held by the man.
+
+# LLaVA
+
+: The baby is wearing white clothes.
+
+# GPT4 Score: 7
+
+# GPT4 Score: 8
+
+# GPT4 Score: 7
+
+# MiniGPT4
+
+:It is not possible to determine the current weather in the location depicted in the image, as the image does not provide any information about the weather conditions. The image shows a man, a baby, and a horse standing in front of a building with a thatched roof, but it does not provide any information about the weather or the environment in the area.
+
+GPT4 Score: 4
+
+# MiniGPT4
+
+:It is not possible to determine whether the man in the image would get wet if it starts raining, as the image does not provide any information about the current weather conditions or the environment in the area. The image shows a man holding a baby, but it does not provide any information about the weather or the environment in the area.
+
+# MiniGPT4
+
+:In the image, the baby is reaching out to touch the horse’s nose. The baby is held up by the man, who is standing next to the horse, and the baby is reaching out with one hand to touch the horse’s nose. The baby is smiling and seems to be enjoying the interaction with the horse.
+
+# MiniGPT4
+
+:The baby in the image is not wearing any clothes.
+
+# GPT4 Score: 5
+
+GPT4 Score: 9
+
+GPT4 Score: 2
+
+Figure 5: Comparison of LaVIN-13B and existing multimodal LLMs in multi-turn conversations. GPT-4 assigns a score ranging from 1 to 10 to evaluate the quality of a response, with a higher score indicating superior performance. The noteworthy aspects of the responses are highlighted in green, whereas the illogical portions are marked in red.
+
+grained visual content, such as text characters. We believe that the recognition ability of LaVIN still has a large room to improve, which will be left in our future work.
+
+# 6 Conclusions
+
+In this paper, we propose a novel and affordable solution for vision-language instruction tuning, namely Mixture-of-Modality Adaptation (MMA). Particularly, MMA is an end-to-end optimization regime, which connects the image encoder and LLM via lightweight adapters. With the help of MMA, the entire multimodal LLM can be jointly optimized via a small number of parameters, greatly reducing the training costs. Meanwhile, we also propose a novel routing algorithm in MMA, which can help the model automatically shifts the reasoning paths for single- and multimodal instructions. Based on MMA, we develop a large vision-language instructed model called LaVIN, which demonstrates a superior reasoning ability than existing multimodal LLMs in various instruction-following tasks.
+
+Acknowledgements. This work was supported by National Key R&D Program of China (No.2022ZD0118201) , the National Science Fund for Distinguished Young Scholars (No.62025603), the National Natural Science Foundation of China (No. U21B2037, No. U22B2051, No. 62176222, No. 62176223, No. 62176226, No. 62072386, No. 62072387, No. 62072389, No. 62002305 and No. 62272401), the Natural Science Foundation of Fujian Province of China (No.2021J01002, No.2022J06001), and the China Fundamental Research Funds for the Central Universities (Grant No. 20720220068). We also thank Dr. Mingbao Lin for his valuable suggestions.
+
+References
+[1] Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katherine Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. Advances in Neural Information Processing Systems, 35:23716–23736, 2022.
+[2] Shoufa Chen, Chongjian Ge, Zhan Tong, Jiangliu Wang, Yibing Song, Jue Wang, and Ping Luo. Adaptformer: Adapting vision transformers for scalable visual recognition. CoRR, abs/2205.13535, 2022.
+[3] Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey E Hinton. Big selfsupervised models are strong semi-supervised learners. Advances in neural information processing systems (NeurIPS), 33:22243–22255, 2020.
+[4] Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E. Gonzalez, Ion Stoica, and Eric P. Xing. Vicuna: An open-source chatbot impressing gpt-4 with $9 0 \% *$ chatgpt quality, March 2023.
+[5] Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
+[6] Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, et al. Scaling instruction-finetuned language models. arXiv preprint arXiv:2210.11416, 2022.
+[7] 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.
+[8] Danny Driess, Fei Xia, Mehdi SM Sajjadi, Corey Lynch, Aakanksha Chowdhery, Brian Ichter, Ayzaan Wahid, Jonathan Tompson, Quan Vuong, Tianhe Yu, et al. Palm-e: An embodied multimodal language model. arXiv preprint arXiv:2303.03378, 2023.
+[9] FairScale authors. Fairscale: A general purpose modular pytorch library for high performance and large scale training. https://github.com/facebookresearch/fairscale, 2021.
+[10] Chaoyou Fu, Peixian Chen, Yunhang Shen, Yulei Qin, Mengdan Zhang, Xu Lin, Zhenyu Qiu, Wei Lin, Jinrui Yang, Xiawu Zheng, et al. Mme: A comprehensive evaluation benchmark for multimodal large language models. arXiv preprint arXiv:2306.13394, 2023.
+[11] Peng Gao, Jiaming Han, Renrui Zhang, Ziyi Lin, Shijie Geng, Aojun Zhou, Wei Zhang, Pan Lu, Conghui He, Xiangyu Yue, et al. Llama-adapter v2: Parameter-efficient visual instruction model. arXiv preprint arXiv:2304.15010, 2023.
+[12] Junxian He, Chunting Zhou, Xuezhe Ma, Taylor Berg-Kirkpatrick, and Graham Neubig. Towards a unified view of parameter-efficient transfer learning. In ICLR, 2022.
+[13] Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin de Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-efficient transfer learning for NLP. In ICML, 2019.
+[14] Edward J Hu, yelong shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. In ICLR, 2022.
+[15] Shaohan Huang, Li Dong, Wenhui Wang, Yaru Hao, Saksham Singhal, Shuming Ma, Tengchao Lv, Lei Cui, Owais Khan Mohammed, Qiang Liu, et al. Language is not all you need: Aligning perception with language models. arXiv preprint arXiv:2302.14045, 2023.
+[16] Jing Yu Koh, Ruslan Salakhutdinov, and Daniel Fried. Grounding language models to images for multimodal generation. arXiv preprint arXiv:2301.13823, 2023.
+[17] Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. Blip-2: Bootstrapping language-image pre-training with frozen image encoders and large language models. arXiv preprint arXiv:2301.12597, 2023.
+[18] Junnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping language-image pre-training for unified vision-language understanding and generation. In International Conference on Machine Learning, pages 12888–12900. PMLR, 2022.
+
+[19] Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. In ACL/IJCNLP, 2021.
+
+[20] Stephanie Lin, Jacob Hilton, and Owain Evans. Truthfulqa: Measuring how models mimic human falsehoods. arXiv preprint arXiv:2109.07958, 2021.
+
+[21] Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. arXiv preprint arXiv:2304.08485, 2023.
+
+[22] Xiao Liu, Kaixuan Ji, Yicheng Fu, Zhengxiao Du, Zhilin Yang, and Jie Tang. P-tuning v2: Prompt tuning can be comparable to fine-tuning universally across scales and tasks. CoRR, abs/2110.07602, 2021.
+
+[23] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
+
+[24] Pan Lu, Swaroop Mishra, Tanglin Xia, Liang Qiu, Kai-Wei Chang, Song-Chun Zhu, Oyvind Tafjord, Peter Clark, and Ashwin Kalyan. Learn to explain: Multimodal reasoning via thought chains for science question answering. Advances in Neural Information Processing Systems, 35:2507–2521, 2022.
+
+[25] Yuning Lu, Jianzhuang Liu, Yonggang Zhang, Yajing Liu, and Xinmei Tian. Prompt distribution learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
+
+[26] Gen Luo, Minglang Huang, Yiyi Zhou, Xiaoshuai Sun, Guannan Jiang, Zhiyu Wang, and Rongrong Ji. Towards efficient visual adaption via structural re-parameterization. arXiv preprint arXiv:2302.08106, 2023.
+
+[27] Gen Luo, Yiyi Zhou, Xiaoshuai Sun, Yan Wang, Liujuan Cao, Yongjian Wu, Feiyue Huang, and Rongrong Ji. Towards lightweight transformer via group-wise transformation for vision-and-language tasks. IEEE Transactions on Image Processing, 31:3386–3398, 2022.
+
+[28] Gen Luo, Yiyi Zhou, Xiaoshuai Sun, Yongjian Wu, Yue Gao, and Rongrong Ji. Towards language-guided visual recognition via dynamic convolutions. International Journal of Computer Vision, pages 1–19, 2023.
+
+[29] Todor Mihaylov, Peter Clark, Tushar Khot, and Ashish Sabharwal. Can a suit of armor conduct electricity? a new dataset for open book question answering. Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2018.
+
+[30] Swaroop Mishra, Daniel Khashabi, Chitta Baral, Yejin Choi, and Hannaneh Hajishirzi. Reframing instructional prompts to gptk’s language. ACL Findings, 2021.
+
+[31] Swaroop Mishra, Arindam Mitra, Neeraj Varshney, Bhavdeep Sachdeva, Peter Clark, Chitta Baral, and Ashwin Kalyan. Numglue: A suite of fundamental yet challenging mathematical reasoning tasks. The 60th Annual Meeting of the Association for Computational Linguistics (ACL), 2022.
+
+[32] Ron Mokady, Amir Hertz, and Amit H Bermano. Clipcap: Clip prefix for image captioning. arXiv preprint arXiv:2111.09734, 2021.
+
+[33] OpenAI. Chatgpt, 2023.
+
+[34] OpenAI. Gpt-4 technical report, 2023.
+
+[35] Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35:27730–27744, 2022.
+
+[36] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. In ICML, Proceedings of Machine Learning Research, 2021.
+
+[37] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
+
+[38] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 21:140:1–140:67, 2020.
+
+[39] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10684–10695, 2022.
+
+[40] Noam Shazeer. Glu variants improve transformer. arXiv preprint arXiv:2002.05202, 2020.
+[41] Yongliang Shen, Kaitao Song, Xu Tan, Dongsheng Li, Weiming Lu, and Yueting Zhuang. Hugginggpt: Solving ai tasks with chatgpt and its friends in huggingface. arXiv preprint arXiv:2303.17580, 2023.
+[42] Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model. https://github. com/tatsu-lab/stanford_alpaca, 2023.
+[43] Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023.
+[44] Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. arXiv preprint arXiv:1804.07461, 2018.
+[45] Yan Wang, Xiaojiang Liu, and Shuming Shi. Deep neural solver for math word problems. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 845–854, 2017.
+[46] Yaqing Wang, Subhabrata Mukherjee, Xiaodong Liu, Jing Gao, Ahmed Hassan Awadallah, and Jianfeng Gao. Adamix: Mixture-of-adapter for parameter-efficient tuning of large language models. arXiv preprint arXiv:2205.12410, 2022.
+[47] Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language model with self generated instructions. arXiv preprint arXiv:2212.10560, 2022.
+[48] Yizhong Wang, Swaroop Mishra, Pegah Alipoormolabashi, Yeganeh Kordi, Amirreza Mirzaei, Anjana Arunkumar, Arjun Ashok, Arut Selvan Dhanasekaran, Atharva Naik, David Stap, et al. Benchmarking generalization via in-context instructions on $1 { , } 6 0 0 { + }$ language tasks. arXiv preprint arXiv:2204.07705, 2022.
+[49] Chenfei Wu, Shengming Yin, Weizhen Qi, Xiaodong Wang, Zecheng Tang, and Nan Duan. Visual chatgpt: Talking, drawing and editing with visual foundation models. arXiv preprint arXiv:2303.04671, 2023.
+[50] Zhengyuan Yang, Linjie Li, Jianfeng Wang, Kevin Lin, Ehsan Azarnasab, Faisal Ahmed, Zicheng Liu, Ce Liu, Michael Zeng, and Lijuan Wang. Mm-react: Prompting chatgpt for multimodal reasoning and action. arXiv preprint arXiv:2303.11381, 2023.
+[51] Renrui Zhang, Jiaming Han, Aojun Zhou, Xiangfei Hu, Shilin Yan, Pan Lu, Hongsheng Li, Peng Gao, and Yu Qiao. Llama-adapter: Efficient fine-tuning of language models with zero-init attention. arXiv preprint arXiv:2303.16199, 2023.
+[52] Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, et al. Opt: Open pre-trained transformer language models. arXiv preprint arXiv:2205.01068, 2022.
+[53] Zhuosheng Zhang, Aston Zhang, Mu Li, Hai Zhao, George Karypis, and Alex Smola. Multimodal chain-of-thought reasoning in language models. arXiv preprint arXiv:2302.00923, 2023.
+[54] Kaiyang Zhou, Jingkang Yang, Chen Change Loy, and Ziwei Liu. Conditional prompt learning for vision-language models. In CVPR, 2022.
+[55] Yiyi Zhou, Rongrong Ji, Xiaoshuai Sun, Jinsong Su, Deyu Meng, Yue Gao, and Chunhua Shen. Plenty is plague: Fine-grained learning for visual question answering. IEEE transactions on pattern analysis and machine intelligence, 44(2):697–709, 2019.
+[56] Deyao Zhu, Jun Chen, Xiaoqian Shen, Xiang Li, and Mohamed Elhoseiny. Minigpt-4: Enhancing vision-language understanding with advanced large language models. arXiv preprint arXiv:2304.10592, 2023.
\ No newline at end of file
diff --git a/md/dev/tDw7Mmat8co/tDw7Mmat8co.md b/md/dev/tDw7Mmat8co/tDw7Mmat8co.md
new file mode 100644
index 0000000000000000000000000000000000000000..c2df28ab19e1d878d3e9cb40364e31ab009f075c
--- /dev/null
+++ b/md/dev/tDw7Mmat8co/tDw7Mmat8co.md
@@ -0,0 +1,668 @@
+# TOWARDS SAFE REINFORCEMENT LEARNING VIA CONSTRAINING CONDITIONAL VALUE-AT-RISK
+
+Anonymous authors Paper under double-blind review
+
+# ABSTRACT
+
+Though deep reinforcement learning (DRL) has obtained substantial success, it may encounter catastrophic failures due to the intrinsic uncertainty caused by stochasticity in both environments and policies. Existing safe reinforcement learning methods are often based on transforming the optimization criterion and adopting the variance of the return as a measure of uncertainty. However, the return variance introduces a bias for penalizing both positive and negative risk equally, deviated from the purpose of safe reinforcement learning to penalize negative ones only. To address this issue, we propose to use the conditional value-at-risk (CVaR) as an assessment of risk, which guarantees that the probability for reaching a catastrophic state is below a desired threshold. Furthermore, we present a novel reinforcement learning framework of CVaR-Proximal-Policy-Optimization (CPPO) which formalizes the risk-sensitive constrained optimization problem by keeping its CVaR under a given threshold. To evaluate the robustness of policies, we theoretically prove that performance degradation under observation disturbance and transition disturbance depends on the gap of value function between the best state and the worst state. We also show that CPPO can generate more robust policies under disturbance. Experimental results show that CPPO achieves higher cumulative reward and exhibits stronger robustness against observation disturbance and transition disturbance on a series of continuous control tasks in MuJoCo.
+
+# 1 INTRODUCTION
+
+Deep reinforcement learning (DRL) has achieved enormous success on a variety of tasks, ranging from playing Atari games (Mnih et al., 2013; 2015; 2016), Go (Silver et al., 2016) to manipulating complex robotics in the real world (Kendall et al., 2019). However, due to the intrinsic stochasticity in both environments and policies, these methods may result in catastrophic failures (Heger, 1994; Coraluppi & Marcus, 1999) and the agent may receive significantly negative outcomes. Several factors can be associated with this phenomenon. One is that traditional DRL only aims at cumulative reward maximization without considering the stochasticity of the environment (Garcıa & Fernandez ´ , 2015), which may lead to serious consequences with a certain probability and expose our policies to risk. This can be illustrated briefly in the case of self-driving, where the agent might try to achieve the highest reward by acting dangerously, e.g. agents may drive along the edge of a curve for reaching the end with a short time ignoring the danger in driving. Also, the usage of deep neural networks to construct complicated mappings from a high-dimensional state space $s$ to an action space $\mathcal { A }$ in DRL algorithms can make them vulnerable to adversarial attacks (Huang et al., 2017).
+
+Various efforts have been made on safe reinforcement learning (safe RL) (Heger, 1994; Coraluppi & Marcus, 1999; Garcıa & Fernandez ´ , 2015). Garcıa & Fernandez ´ (2015) conduct a comprehensive survey on safe RL and argue that an array of methods in this area are based on transforming the optimization criterion by considering the risk of the return. For example, $\hat { Q }$ -Learning (Heger, 1994) uses a lower bound to estimate the Q-target in $Q$ -Learning for avoiding the risk; and Geibel & Wysotzki (2005) propose the expected-value-minus-variance-criterion that subtracts the variance of the return from the cumulative reward. However, due to the consideration of the worst-case outcomes (Heger, 1994), one major drawback of those transformed optimization criteria is that they may lead to overly pessimistic policies, which will focus too much on the worst case and own poor average performance. Moreover, although variance is a standard measure of the risk of the policy (Gosavi, 2009; Tamar et al., 2012), it does not distinguish between positive and negative risk and penalizes both equally (Szego¨, 2002), deviated form the purpose of safe RL to only penalize negative ones.
+
+To address the shortcomings of the worst-case outcomes as well as the variance of the return used in previous objective-modification methods of safe RL (Garcıa & Fernandez ´ , 2015; Geibel & Wysotzki, 2005; Heger, 1994), we propose to use conditional value-at-risk (CVaR) for evaluating the risk of policies. CVaR is a well established metric in economic uncertainty analysis (Alexander & Baptista, 2004; Alexander et al., 2006) and captures the expectation of the random variable to be an outlier with a given threshold. Unlike variance, CVaR can only capture negative trajectories with relatively low return. Considering to use CVaR to capture the respectively low return of the trajectory, we naturally propose to improve the robustness of the on-policy algorithms by CVaR. By integrating CVaR with Proximal Policy Optimization (PPO) (Schulman et al., 2017), we present a new algorithm called CVaR-Proximal-Policy-Optimization (CPPO) and notionally analyze policies’ robustness against different kinds of disturbance. We show that although the observation disturbance and transition disturbance are structurally different, the performance degradation resulted from each of them is theoretically dependent on the Value Function Range (VFR), which is introduced as the value function gap between the best and worst states in this paper. We further show that CPPO can improve the robustness of policies against observation disturbance and transition disturbance since CVaR can control the value function of states with relatively low value and further control the VFR value. Empirically, we compare CPPO to multiple on-policy baselines as well as some previous CVaR-based methods on various continuous control tasks in MuJoCo (Todorov et al., 2012). Our results show that CPPO achieves higher cumulative reward in the training stage and exhibits stronger robustness when we apply perturbations to these environments.
+
+In summary, our contributions are:
+
+• We analyze the advantages of choosing CVaR as the metric for evaluating the risk of policy compared with the worst-case outcome as well as the variance of the return. Furthermore, we propose a constrained optimization problem in order to maximize the cumulative reward as well as controlling the risk, which can be solved by our CPPO algorithm; • We theoretically analyze the performance of trained policies under observation and transition disturbance, and build a theoretical connection of these two types of structurally different disturbance. This analysis indicates that our CPPO can improve the robustness of policies; • We empirically demonstrate that our method exhibits stronger robustness under observation/transition perturbations than other common on-policy RL algorithms and previous CVaR-based RL algorithms in MuJoCo simulator.
+
+# 2 BACKGROUND
+
+In this section, we briefly introduce safe reinforcement learning (safe RL) and conditional value-at-risk (CVaR), which motivate us to adopt CVaR as a metric of risk in safe RL.
+
+# 2.1 SAFE RL
+
+In standard RL setting, the agent interacts with an unknown environment and learns to achieve the highest long-term return. The task is modeled as a Markov decision process (MDP) of $\mathcal { M } =$ $( S , \bar { \mathcal { A } } , \mathcal { R } , \mathcal { P } , \gamma )$ , where $s$ and $\mathcal { A }$ represent the state space and the action space, respectively; $\mathcal { P }$ : $S \times { \mathcal { A } } \times { \mathcal { S } } [ 0 , 1 ]$ denotes the transition probability that captures the dynamics of the environment; $\mathcal { R } : \mathcal { S } \times \mathcal { A } [ - \mathrm { \bar { \it { R } } _ { \mathrm { { m a x } } } } , { \boldsymbol { R } _ { \mathrm { { m a x } } } } ]$ represents the reward function; and $\gamma$ is a discount factor. We use $\pi _ { \theta }$ to represent the policy of the agent with parameter $\theta$ , which is a mapping from $s$ to $\mathcal { A }$ . At any time step $t$ , the agent perceives current state $s _ { t } \in S$ , chooses its action $a _ { t } \in \mathcal A$ sampled from the distribution $\pi _ { \boldsymbol { \theta } } ( \cdot | s _ { t } )$ and obtains a reward $r _ { t }$ . All these timesteps consist of a trajectory $\tau = ( s _ { 0 } , a _ { 0 } , r _ { i } , s _ { 1 } , a _ { 1 } , \ldots )$ . Given an MDP $\mathcal { M }$ , the goal of RL is to find the optimal policy $\pi _ { \theta ^ { \ast } }$ with the highest expected cumulative reward as
+
+$$
+\operatorname* { m a x } _ { \theta } J ( \pi _ { \theta } ) \triangleq \mathbb { E } \left[ D ( \pi _ { \theta } ) \triangleq \sum _ { t = 1 } ^ { \infty } \gamma ^ { t } r _ { t } \Big \vert \pi _ { \theta } \right] ,
+$$
+
+where $D ( \pi _ { \theta } )$ represents the return of the policy $\pi _ { \theta }$ , and $J ( \pi _ { \theta } )$ is the expectation of $D ( \pi _ { \theta } )$
+
+However, problem (1) only focuses on cumulative reward without considering the risk of the policy, which may cause catastrophic results (Heger, 1994; Coraluppi & Marcus, 1999). To address this problem, an array of safe RL methods tend to change the objective in problem (1) in order to eliminate the uncertainty and avoid the danger. In general, uncertainty can be categorized into two types, namely, inherent uncertainty and parameter uncertainty (Garcıa & Fernandez ´ , 2015). The inherent uncertainty of RL refers to the transition dynamics in MDP. For example the agent might end up in completely different situations when repeating its actions from the same starting state. Previous works (Heger, 1994; Gaskett, 2003) choose the worst-case criterion to address the issue as
+
+$$
+\operatorname* { m a x } _ { \theta } J _ { i n h } ( \pi _ { \theta } ) \triangleq \operatorname* { m a x } _ { \theta } \operatorname* { m i n } _ { \tau \sim \pi _ { \theta } } \left[ D ( \tau ) \triangleq \sum _ { t = 1 } ^ { \infty } \gamma ^ { t } r _ { t } \right] .
+$$
+
+As a counterpart of $Q$ -Learning, Heger (1994) proposes $\hat { Q }$ -Learning with the implementation of (2), and Gaskett (2003) presents $\beta$ -pessimistic $Q$ -Learning, which adds a parameter $\beta$ to control the pessimistic level.
+
+There are also various studies that assess the effectiveness of variance for acquiring safe policies (Sato et al., 2001; Gosavi, 2009; Tamar et al., 2012). Some previous work (Howard & Matheson, 1972) considers exponential utility function and formalizes it as the combination of cumulative reward and the variance of the return $\dot { V } a r ( D ( \pi _ { \theta } ) )$ as
+
+$$
+\operatorname* { m a x } _ { \theta } \delta ^ { - 1 } \log \mathbb { E } _ { \pi } \left[ \exp ( \delta D ( \pi _ { \theta } ) ) \right] = \operatorname* { m a x } _ { \theta } \left[ J ( \pi _ { \theta } ) + \frac { \delta } { 2 } V a r ( D ( \pi _ { \theta } ) ) + O ( \delta ^ { 2 } ) \right] .
+$$
+
+As for the parameter uncertainty of RL, it denotes scenarios where the parameters of the MDP are unknown or there is a gap between the training and testing environments. Studies conducted by Nilim & El Ghaoui (2005) and Tamar et al. (2013) assume that the actual transition belongs to a set $\hat { \mathcal { P } }$ and consider the following problem as
+
+$$
+\operatorname* { m a x } _ { \theta } \operatorname* { m i n } _ { \mathcal { P } \in \hat { \mathcal { P } } } J _ { p a r } ( \pi _ { \theta } , \mathcal { P } ) \triangleq \mathbb { E } \left[ D ( \pi _ { \theta } ) \triangleq \sum _ { t = 1 } ^ { \infty } \gamma ^ { t } r _ { t } \Big \vert \pi _ { \theta } \right] .
+$$
+
+However, previous safe RL methods suffer from serious drawbacks. First, both (2) and (3) are maxmin problems, which do not have general effective solutions and usually have a high computational complexity. Second, focusing on the worst trajectories may cause over-pessimistic behaviors. For example, $\hat { Q }$ -Learning aims to improve the performance under the worst scenario, which can lead to extremely conservative actions (Heger, 1994). Finally, the direct usage of variance to evaluate risk is another potential concern because it will penalize not only the possibility of particularly bad trajectories, but also the good ones, yielding a drop in the agent’s performance (Szego¨, 2002).
+
+# 2.2 CVAR
+
+Value-at-risk (VaR) and conditional value-at-risk (CVaR) are well-established metrics for measuring risk in economy (Alexander & Baptista, 2004; Alexander et al., 2006). First, we will give the definition of VaR and CVaR (Chow & Ghavamzadeh, 2014):
+
+Definition 1 (VaR and CVaR). For a bounded-mean random variable $Z$ , the value-at-risk (VaR) of confidence level $\alpha \in ( 0 , 1 )$ is defined as:
+
+$$
+\operatorname { V a R } _ { \alpha } ( Z ) = \operatorname* { m i n } \{ z | F ( z ) \geq \alpha \} ,
+$$
+
+where $F ( z ) = P ( Z \leq z )$ is the cumulative distribution function $( C D F )$ ; and the condition valueat-risk (CVaR) of confidence level $\alpha$ is defined as the expectation of the $\alpha$ -tail distribution of $Z$ as
+
+$$
+\operatorname { C V a R } _ { \alpha } ( Z ) = \mathbb { E } _ { z \sim Z } \{ z | z \geq \operatorname { V a R } _ { \alpha } ( Z ) \} .
+$$
+
+It is easy to prove that (Chow et al., 2015):
+
+$$
+\operatorname* { l i m } _ { \alpha \to 1 ^ { - } } \operatorname { C V a R } _ { \alpha } ( Z ) = \operatorname* { m a x } ( Z ) .
+$$
+
+Previous works have attempted to use CVaR to analyze the risk-MDP, which considers cost function $\mathcal { C }$ rather than reward function $\mathcal { R }$ . Chow & Ghavamzadeh (2014) and Chow et al. (2017) propose gradient-based methods like policy gradient and actor critic to optimize loss of MDP as well as keeping the CVaR under certain value. They also propose methods based on value iteration and Bellman equation to deal with the optimization of risk-MDP with CVaR (Chow et al., 2015). However, these works ignore the reward in MDP and thus cannot be directly used in RL settings.
+
+# 3 METHODOLOGY
+
+We now present our method that maximizes the expected reward while restricting the risk of the policy. We focus on increasing the agent’s performance on relatively worse trajectories, which loosens the max-min problem to an constrained optimization problem. Moreover, we can make our policy less conservative by modifying the parameter $\alpha$ in CVaR. Compared with variance, CVaR is a better metric for measuring risk, because it, by definition, captures only bad trajectories.
+
+# 3.1 PROBLEM FORMULATION
+
+In standard RL, what we receive is the reward signal rather than the risk signal, thus we can only evaluate the risk of a trajectory by its return. For simplicity, we suppose there exists a decreasing smoothing function $f : \mathbb { R } \to \mathbb { R }$ with its inverse function $f ^ { - 1 }$ and the risk of a trajectory $\tau$ is $f ( D ( \tau ) \bar { ) }$ For example, the most simple case is that we can use the opposite number of the return to define the risk of the trajectory, i.e. $\dot { f ( D ( \tau ) ) } = - D ( \tau )$ .
+
+First we propose Theorem 1 as below to calculate VaR and CVaR of $f ( D ( \tau ) )$ :
+
+Theorem 1. For any given policy $\pi _ { \theta }$ and its cumulative reward $D ( \pi _ { \theta } )$ , we have:
+
+$$
+\begin{array} { r l } & { \mathrm { \mathrm { \mathrm { \mathrm { V a R } } } } _ { \alpha } ( f ( D ( \pi _ { \theta } ) ) ) = \operatorname* { m i n } \{ z | F _ { D ( \pi _ { \theta } ) } ( f ^ { - 1 } ( z ) ) \le 1 - \alpha \} } \\ & { \mathrm { \mathrm { C V a R } } _ { \alpha } ( f ( D ( \pi _ { \theta } ) ) ) = \mathbb { E } _ { z \sim D ( \pi _ { \theta } ) } \{ f ( z ) | f ( z ) \ge \mathrm { \mathrm { V a R } } _ { \alpha } ( f ( D ( \pi _ { \theta } ) ) \} . } \end{array}
+$$
+
+Specially, we consider to take the opposite number of the return of a trajectory as its risk, i.e. $\dot { f } ( D ( \pi _ { \theta } \dot { ) } ) = - D ( \pi _ { \theta } )$ and we can prove that
+
+$$
+\begin{array} { r l } & { \quad \quad - \mathrm { V a R } _ { \alpha } ( - D ( \pi _ { \theta } ) ) = \operatorname* { m a x } \{ z | F _ { D ( \pi _ { \theta } ) } ( z ) \leq 1 - \alpha \} , } \\ & { \quad \quad - \mathrm { C V a R } _ { \alpha } ( - D ( \pi _ { \theta } ) ) = \mathbb { E } _ { z \sim D ( \pi _ { \theta } ) } \{ z | z \leq - \mathrm { V a R } _ { \alpha } ( - D ( \pi _ { \theta } ) ) \} . } \end{array}
+$$
+
+Based on equation (6), we have:
+
+$$
+\operatorname* { l i m } _ { \alpha \to 1 ^ { - } } - \mathrm { C V a R } _ { \alpha } ( - D ( \pi _ { \theta } ) ) = \operatorname* { m i n } ( D ( \pi _ { \theta } ) ) ,
+$$
+
+and if we assume that $- \mathrm { C V a R } _ { \alpha } ( - D ( \pi _ { \theta } ) ) \ge \beta $ , then we have:
+
+$$
+P ( D ( \pi _ { \theta } ) \leq \beta ) \leq 1 - \alpha .
+$$
+
+The proof of Theorem 1 is in Appendix B.1. By this theorem, we can use $- \mathrm { C V a R } _ { \alpha } \bigl ( - D ( \pi _ { \theta } ) \bigr )$ to represent the expected reward of the trajectories generated by $\pi _ { \theta }$ with relatively lower reward.
+
+As mentioned in Section 2.1, some safe RL objectives, such as problems (2) and (3), are intractable max-min problems. However, with the property in Eq. (7) of CVaR, we can equally transform problem (2) as
+
+$$
+\operatorname* { m a x } _ { \theta } J _ { i n h } ( \pi _ { \theta } ) = \operatorname* { m a x } _ { \theta } \operatorname* { l i m } _ { \alpha 1 ^ { - } } [ - \mathrm { C V a R } _ { \alpha } ( - D ( \pi _ { \theta } ) ) ] .
+$$
+
+We can further loosen problem (8) by assigning $\alpha$ a fixed value, which reforms the original max-min problem into a solvable optimization problem. Furthermore, to address the pessimism in safe RL, we balance between the standard RL objective (1) and the safe RL objective (8) after relaxation, which yields the constrained optimization problem as
+
+$$
+\begin{array} { l } { \displaystyle \operatorname* { m a x } _ { \theta } J ( \pi _ { \theta } ) } \\ { \displaystyle s . t . - \mathrm { C V a R } _ { \alpha } ( - D ( \pi _ { \theta } ) ) \ge \beta , } \end{array}
+$$
+
+where $\alpha , \beta$ are hyper-parameters and we denote the best policy of problem (9) as $\pi _ { c } ( \alpha , \beta )$
+
+Now we discuss some properties of $\pi _ { c } ( \alpha , \beta )$ . Since $\pi _ { c } ( \alpha , \beta )$ is the optimal solution of (9) and satisfies the constraints. By Theorem 1, we naturally have
+
+$$
+P ( D ( \pi _ { c } ( \alpha , \beta ) ) \leq \beta ) \leq 1 - \alpha ,
+$$
+
+which means that we can guarantee the probability of policy $\pi _ { c } ( \alpha , \beta )$ generating low-reward trajectories is below a desired threshold.
+
+Compared with the best policy $\pi _ { s }$ of the standard RL problem (1), $\pi _ { c } ( \alpha , \beta )$ is the policy that maximizes the expected total reward in a restricted region related to hyper-parameters $\alpha , \beta$ . Obviously we have $J ( \pi _ { c } ( \tilde { \alpha , \beta } ) ) \le J ( \pi _ { s } )$ . However, we can also give a lower bound of $J ( \pi _ { c } ( \alpha , \beta ) )$ as follows:
+
+Theorem 2. Assume there exists a constant $M > 0$ and every trajectory $\tau = ( S _ { 0 } , A _ { 0 } , R _ { 1 } , S _ { 1 } , A _ { 1 } , \ldots )$ satisfies $\textstyle \sum _ { t = 1 } ^ { \infty } \gamma ^ { t } R _ { t } \leq M$ , we have
+
+$$
+J ( \pi _ { c } ( \alpha , \beta ) ) \geq \frac { J ( \pi _ { s } ) - \alpha M } { 1 - \alpha } .
+$$
+
+The key of the proof is to consider whether $\pi _ { s }$ satisfies our constraint and the detailed proof of Theorem 2 can be found in Appendix B.2. Therefore, although $\pi _ { c } ( \alpha , \beta )$ is in a restricted region, its expected cumulative reward will be no worse than the lower bound we prove in Theorem 2.
+
+# 3.2 OPTIMIZATION AND ALGORITHM
+
+We now simplify the constrained problem (9) to an unconstrained one. First, with properties of CVaR, we can equivalently reformulate problem (9) as
+
+$$
+\begin{array} { l } { \displaystyle \operatorname* { m i n } _ { \theta , \nu } - J ( \pi _ { \theta } ) } \\ { \displaystyle s . t . \ - \nu + \frac { 1 } { 1 - \alpha } \mathbb { E } [ ( - D ( \pi _ { \theta } ) + \nu ) ^ { + } ] \leq - \beta . } \end{array}
+$$
+
+The deviation is provided in Appendix B.3. Then, by using Lagrangian relaxation method (Bertsekas, 1997), we need to solve the saddle point of the function $\bar { L } ( \theta , \bar { \nu } , \lambda )$ as
+
+$$
+\operatorname* { m a x } _ { \lambda \geq 0 } \operatorname* { m i n } _ { \theta , \nu } L ( \theta , \nu , \lambda ) \triangleq - J ( \pi _ { \theta } ) + \lambda \left( - \nu + \frac { 1 } { 1 - \alpha } \mathbb { E } [ ( - D ( \pi _ { \theta } ) + \nu ) ^ { + } ] + \beta \right) .
+$$
+
+For solving problem (11), we will extend Proximal Policy Optimization (PPO) (Schulman et al., 2017) with CVaR and propose our algorithm named CVaR Proximal Policy Optimization (CPPO). In particular, the key point of Policy Gradient methods is to evaluate the gradient (Sutton et al., 2000) of the objective. Here, we use methods in (Chow & Ghavamzadeh, 2014) to compute the gradient of our objective function (11) with respected to $\nu , \theta , \lambda$ as below:
+
+$$
+\partial _ { \nu } L ( \theta , \nu , \lambda ) = - \lambda + \frac { \lambda } { 1 - \alpha } \mathbb { E } _ { \xi \sim \pi _ { \theta } } \mathbf { 1 } \{ \nu \geq D ( \xi ) \} )
+$$
+
+$$
+\begin{array} { l } { { \nabla _ { \theta } L ( \theta , \nu , \lambda ) = - \mathbb { E } _ { \xi \sim \pi _ { \theta } } ( \nabla _ { \theta } \log P _ { \theta } ( \xi ) ) \left( D ( \xi ) - \displaystyle \frac { \lambda } { 1 - \alpha } ( - D ( \xi ) + \nu ) ^ { + } \right) } } \\ { { \nabla _ { \lambda } L ( \theta , \nu , \lambda ) = - \nu + \displaystyle \frac { 1 } { 1 - \alpha } \mathbb { E } _ { \xi \sim \pi _ { \theta } } ( - D ( \xi ) + \nu ) ^ { + } + \beta . } } \end{array}
+$$
+
+The key of the deviation is to deform the objective in problem (11) as the integration of trajectories and the detailed calculation is in Appendix B.4. Moreover, with the increasing of policies’ performance during training, it’s unreasonable to fix $\beta$ to constrain the risk of the policy. Thus we consider to modify $\beta$ as a function of the risk of trajectories in the current epoch. Based on PPO and the algorithm by Chow & Ghavamzadeh (2014), we can use the gradient given above to develop an on-policy algorithm called CPPO (see Algorithm 1 in Appendix A).
+
+# 4 THEORETICAL ANALYSIS
+
+In this section, we analyze the robustness of policies against observation and transition perturbations, and explain why CVaR can improve the robustness of policies.
+
+# 4.1 PERFORMANCE AGAINST OBSERVATION DISTURBANCE
+
+For any MDP $\mathcal { M }$ and given policy $\pi$ , we denote its expected cumulative reward and value function as $J _ { \mathcal { M } } ( \pi )$ and $V _ { \mathcal { M } , \pi }$ , respectively. We define the Value Function Range (VFR) to capture the gap of the value function between the best state and the worst state as following.
+
+Definition 2 (Value Function Range). For MDP $\mathcal { M }$ , we define the Value Function Range (VFR) of policy $\pi$ as
+
+$$
+\hat { V } _ { M , \pi } = \operatorname* { m a x } _ { s } V _ { M , \pi } ( s ) - \operatorname* { m i n } _ { s } V _ { M , \pi } ( s ) ,
+$$
+
+where $V _ { \mathcal { M } , \pi }$ is the value function (Sutton & Barto, 2018) of policy $\pi$ in MDP $\mathcal { M }$ .
+
+Moreover, for every state $s \in \mathcal { M }$ , we can define its discounted future state distribution as $d _ { \mathcal { M } } ^ { \pi } ( s ) =$ $\begin{array} { r } { ( 1 - \gamma ) \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } \dot { P ( s _ { t } = s | \pi , { \mathcal { M } } ) } } \end{array}$ M . First, we will consider the situation of observation disturbance. Similar to the setting of SA-MDP (Zhang et al., 2020), we introduce adversary $\nu : \mathcal { S } \mathcal { S }$ to describe the disturbance of state and denote the policy disturbed by adversary $\nu$ as $\hat { \pi } _ { \nu }$ , which means ${ \hat { \pi } } _ { \nu } ( \cdot | s ) = \pi ( \cdot | \nu ( s ) )$ . We can theoretically calculate and bound the difference of performance between $\pi$ and $\hat { \pi } _ { \nu }$ in Theorem 3 as below:
+
+Theorem 3. For any policy $\pi$ and any adversary $\nu$ , the reduction of expected cumulative reward of $\pi$ against the observation disturbance of $\nu$ is:
+
+$$
+\begin{array} { c } { { J _ { \mathcal { M } } ( \pi ) - J _ { \mathcal { M } } ( \hat { \pi } _ { \nu } ) = \displaystyle \frac { \gamma } { 1 - \gamma } \mathbb { E } _ { s \sim d _ { \mathcal { M } } ^ { \hat { \pi } _ { \nu } } } \mathbb { E } _ { a \sim \pi ( \cdot \vert \nu ( s ) ) } \left( 1 - \displaystyle \frac { \pi ( a \vert s ) } { \pi ( a \vert \nu ( s ) ) } \right) \mathbb { E } _ { s ^ { \prime } \sim P } V _ { \mathcal { M } , \pi } ( s ^ { \prime } ) } } \\ { { + \displaystyle \frac { 1 } { 1 - \gamma } \mathbb { E } _ { s \sim d _ { \mathcal { M } } ^ { \hat { \pi } _ { \nu } } } \mathbb { E } _ { a \sim \pi ( \cdot \vert \nu ( s ) ) } \left( 1 - \displaystyle \frac { \pi ( a \vert s ) } { \pi ( a \vert \nu ( s ) ) } \right) R ( s , a ) . } } \end{array}
+$$
+
+Furthermore, an upper bound of it is as follows:
+
+$$
+\begin{array} { r l } & { | J _ { \mathcal M } ( \pi ) - J _ { \mathcal M } ( \hat { \pi } _ { \nu } ) | \le \displaystyle \frac { \gamma } { 1 - \gamma } \operatorname* { m a x } _ { s } D _ { T V } \big ( \pi ( \cdot | s ) , \pi ( \cdot | \nu ( s ) ) \big ) \hat { V } _ { \mathcal M , \pi } } \\ & { \qquad + \displaystyle \frac { 2 } { 1 - \gamma } \operatorname* { m a x } _ { s } D _ { T V } \big ( \pi ( \cdot | s ) , \pi ( \cdot | \nu ( s ) ) \operatorname* { m a x } _ { s , a } | R ( s , a ) | . } \end{array}
+$$
+
+The key of the proof is to analyze the relations of $V _ { \mathcal { M } , \hat { \pi } _ { \nu } } - V _ { \mathcal { M } , \pi }$ with different states and the complete proof of Theorem 3 is in Appendix B.5, resembling the proof by Kakade & Langford (2002). Moreover, for the upper bound, Theorem 3 provides a structurally homologous, but tighter bound than the bound provided in Zhang et al. (2020) since our VFR can be bounded by $\operatorname* { m a x } _ { s , a } | R ( s , a ) |$ , which is also proven in Appendix B.5. Compared with the victim policy $\pi$ for given MDP $\mathcal { M }$ , the factors mainly affect the performance of the disturbed policy $\pi _ { \nu }$ are Total Variation distance $\begin{array} { r } { \operatorname* { m a x } _ { s } D _ { T V } ( \pi ( \cdot | s ) , \pi ( \cdot | \nu ( s ) ) } \end{array}$ and the VFR $\hat { V } _ { \mathcal { M } , \pi }$ . The former one, TV distance, depends on the victim policy $\pi$ as well as the disturbance $\nu$ and reflects the robustness of the victim policy and the adversarial ability of the adversary both. However, independent of the adversary, the latter one, VFR of the policy, only depends on the value functions of $\pi$ in $\mathcal { M }$ , reflecting the robustness of the victim policy. Thus we can improve the robustness under observation disturbance of the policy by controlling VFR of the policy.
+
+# 4.2 PERFORMANCE AGAINST TRANSITION DISTURBANCE
+
+Now, we consider the situation of transition disturbance. We assume that the transition $\mathcal { P }$ is disturbed to $\hat { \mathcal { P } }$ and attempt to evaluate the reduction of cumulative reward against the disturbance. Similar to Theorem 3, we can also theoretically show a similar result as below:
+
+Theorem 4. For any policy $\pi$ in MDP $\mathcal { M } = ( S , \mathcal { A } , \mathcal { P } , \mathcal { R } , \gamma )$ and any disturbed environment $\hat { \mathcal { M } } = ( S , \mathcal { A } , \hat { \mathcal { P } } , \mathcal { R } , \gamma )$ , the reduction of cumulative reward against the transition disturbance is:
+
+$$
+J _ { \mathcal { M } } ( \pi ) - J _ { \hat { \mathcal { M } } } ( \pi ) = \frac { \gamma } { 1 - \gamma } \mathbb { E } _ { s \sim d _ { \hat { \mathcal { M } } } ^ { \pi } } \mathbb { E } _ { a \sim \pi } \mathbb { E } _ { s ^ { \prime } \sim \hat { P } } \left( 1 - \frac { P ( s ^ { \prime } | s , a ) } { \hat { P } ( s ^ { \prime } | s , a ) } \right) V _ { \mathcal { M } , \pi } ( s ^ { \prime } ) .
+$$
+
+Furthermore, an upper bound of the reduction is:
+
+$$
+J _ { \mathcal { M } } ( \pi ) - J _ { \hat { \mathcal { M } } } ( \pi ) \leq \frac { 2 \gamma } { 1 - \gamma } \operatorname* { m a x } _ { s , a } D _ { T V } ( P ( \cdot | s , a ) , \hat { P } ( \cdot | s , a ) ) \hat { V } _ { \mathcal { M } , \pi } .
+$$
+
+The proof of Theorem 4 is similar to that of Theorem 3 and is also deferred to Appendix B.5. Similarly, compared with the victim policy $\pi$ for a given MDP $\mathcal { M }$ , the factors that mainly affect the performance of $\pi$ in disturbed environment $\hat { \mathcal { M } }$ are TV distance $\begin{array} { r } { \operatorname* { m a x } _ { s , a } D _ { T V } ( P ( \cdot | s , a ) , \hat { P } ( \cdot | s , a ) ) } \end{array}$ and the VFR $\hat { V } _ { \mathcal { M } , \pi }$ . The former one, TV distance, depends on the range of transition disturbance and reflect the adversarial ability of the adversary, which cannot be controlled by safe RL. Nevertheless, the latter one VFR only depends on the value functions of $\pi$ in $\mathcal { M }$ and is an intrinsic property of the victim policy. Therefore, we can improve the robustness of the victim under transition disturbance policy by controlling $\hat { V } _ { \mathcal { M } , \pi }$ .
+
+# 4.3 CONNECTION BETWEEN THE OBSERVATION AND TRANSITION DISTURBANCE
+
+Observation disturbance and transition disturbance are structurally different, as they affect observation of the policy and MDP respectively. Although existing literature usually considers them separately, by Theorem 3 and Theorem 4, we can find out that the effects of them on cumulative reward are similarly depending on the VFR $\hat { V } _ { \mathcal { M } , \pi }$ , which is an inherent property of $\pi$ and independent of the adversary. Thus we can improve the robustness of the policy under observation disturbance as well as transition disturbance by controlling its VFR.
+
+Moreover, we will discuss the connection between controlling the VFR $\hat { V } _ { \mathcal { M } , \pi }$ and CVaR-based RL. For controlling $\hat { V } _ { \mathcal { M } , \pi }$ , it’s more reasonable to maximize $\mathrm { m i n } _ { s } V _ { \mathcal { M } , \pi } ( s )$ rather than minimize $\operatorname* { m a x } _ { s } V _ { \mathcal { M } , \pi } ( s )$ . However, as mentioned in Sec 3.1, directly maximizing the value function of the worst state may cause our policy to be over conservative. Thus it’s more reasonable to loosen $\mathrm { m i n } _ { s } V _ { \mathcal { M } , \pi } ( s )$ to $- \mathrm { C V a R } _ { \alpha } ( - V ( s ) )$ , here $s \sim \mu ( \cdot )$ obeys the initial distribution of the environment. Our CVaR-based objective (9) imposes a constraint on $\dot { - } \mathrm { C V a R } _ { \alpha } ( - D ( \tau ) )$ since we can prove that
+
+Theorem 5. For any $\alpha ~ \in ~ [ 0 , 1 ]$ , We can prove that $- \mathrm { C V a R } _ { \alpha } ( - D ( \tau ) )$ is a lower bound of $- \mathrm { C V a R } _ { \alpha } ( - V ( s ) )$ , i.e.
+
+$$
+- \operatorname { C V a R } _ { \alpha } ( - D ( \tau ) ) \leq - \operatorname { C V a R } _ { \alpha } ( - V ( s ) )
+$$
+
+The proof of Theorem 5 is deferred to Appendix B.6. Therefore, our CVaR-based methods consider to constrain $- \mathrm { C V a R } _ { \alpha } ( - D ( \tau ) )$ for improving VFR of the policy and further improve the robustness of the policy against observation disturbance as well as transition disturbance.
+
+# 5 EXPERIMENTS
+
+In this section, we empirically evaluate the performance and the robustness under observation disturbance and transition disturbance of our method CPPO in a series of continuous control tasks in MuJoCo (Todorov et al., 2012) against other common on-policy RL algorithms.
+
+# 5.1 EXPERIMENT SETUP
+
+Environments. We choose MuJoCo (Todorov et al., 2012) as our experiments environment. As a robotic locomotion simulator, MuJoCo has an array of different continuous control tasks such as Ant, Walker2d, HalfCheetah, Hopper, Swimmer and so on, which are widely used for the evaluation of RL algorithms.
+
+Baselines and Codes. We will compare our algorithm with the common on-policy algorithms and previous CVaR-based algorithms. For the former, we choose Vanilla Policy Gradient (VPG) (Sutton et al., 2000), Trust Region Policy Optimization (TRPO) (Schulman et al., 2015) and PPO (Schulman et al., 2017). For the latter, we implement PG-CMDP (Chow & Ghavamzadeh, 2014) with deep neural network. And we use Adam (Kingma & Ba, 2015) to optimize all the parameters. The implementation of all codes, including CPPO and baselines, are based on SpinningUp (Achiam, 2018).
+
+Evaluations. First, we compare the cumulative reward of each algorithm in the training process and their performance after convergence. For the trained models, in order to measure their robustness and safety, we compare their performance under transition disturbance and observation disturbance respectively. For observation disturbance, we apply Gaussian disturbance to the agent’s observation to study the relationship between the agent’s performance and the magnitude of the disturbance. For transition perturbation, since MuJoCo is a physical simulation engine and its transition is depend on its physics parameters, we choose to modify the mass of the agent to change the transition dynamics, and study the relationship between the the agent’s performance and the mass of the agent.
+
+# 5.2 PERFORMANCE IN TRAINING STAGE
+
+In this part, we compare the performance of our CPPO against common on-policy algorithms as well as the previous CVaR-based algorithm in MuJoCo environments such as Ant, Halfcheetah, Walker2d, Swimmer and Hopper. For each algorithm in each task, we train 10 policies with different random seeds since the environment and environments and policies are stochastic. Table 1 shows the mean and variance of the cumulative reward of 10 policies trained by each algorithm in each environment and we bold the highest cumulative reward over all algorithms. For each algorithm in each task, we also plot the mean and variance of the ten policies as a function of timesteps in the training stage as shown in Figure 1. The four subgraphs represent the experimental results on Halfcheetah, Walker2d, Swimmer and Hopper respectively. The solid line represents the average reward of 10 strategies, and the part with lighter color represents the variance of them. As we can see from the figure, CPPO represented by pink has achieved significant performance improvement on HalfCheetah, Swimmer and Hopper against all baselines. We can also find that our CPPO gain higher cumulative reward of the worst-case outcome than other baselines on Walker2d.
+
+Table 1: The cumulative reward (mean $\pm$ one std) of best policy trained by VPG, TRPO, PPO and CPPO in different MuJoCo games. In each column we bold the best performance over all algorithms.
+
+
Env Method
Ant-v3
HalfCheetah-v3
Walker2d-v3
Swimmer-v3
Hopper-v3
VPG
12.8± 0.0
896.9± 531.1
628.6± 229.4
48.3±11.3
888.4± 209.5
TRPO
1625.4± 356.4
2073.8± 741.3
2005.6± 398.7
101.2± 29.3
2391.4± 455.3
PPO
3372.2± 301.4
3245.4± 947.3
2946.3± 944.3
122.0± 7.9
2726.0± 886.0
PG-CMDP
7.4± 3.6
928.7± 562.9
596.7± 219.9
55.4±18.8
1039.2± 21.1
CPPO(ours)
3514.7± 247.2
3680.5± 1121.3
3194.0± 648.2
182.5± 46.0
3144.6± 158.4
+
+
+Figure 1: Cumulative reward curves for VPG, TRPO, PPO and our CPPO. The x-axes indicate the number of steps interacting with the environment, and the y-axes indicate the performance of the agent, including average rewards with standard deviations.
+
+# 5.3 ROBUSTNESS AGAINST OBSERVATION DISTURBANCE IN TEST STAGE
+
+Trained agents may failed in the test stage because of the gap between the observation and the true state. Consequently, for evaluating the robustness of each algorithm, we add standard Gaussian disturbance to the observation in the test stage. For this purpose, we plot the performance of the trained policies under observation disturbance in Figure 2. In each subfigure, the solid line and the part with lighter color represent the average reward and the variance of 10 strategies respectively. From the figure, we can found that the performance degradation is positively related to the size of disturbance, which is shown in Theorem 3. Moreover, since the value function of all states in these policies are relatively low and VFR of these policies is low, we can discover that VPG and PG-CMDP stay robustness under observation disturbance, which is shown in Theorem 3. As shown in the figure, CPPO has made significant progress in Swimmer and Hopper than baselines. Therefore, our CPPO enables to keep robustness under observation disturbance.
+
+# 5.4 ROBUSTNESS AGAINST TRANSITION DISTURBANCE IN TEST STAGE
+
+Trained agents may also fail in testing stage because of the transition gap between the simulator and the true environment. Therefore, we evaluate the performance of all algorithms under the transition disturbance for measuring their robustness and safety. Since MuJoCo is a physics simulator modeled on the physical world, we can disturb the transition by modifying environment parameters. For this purpose, we choose to modify the mass of the robot and the default mass of environment HalfCheetah,
+
+
+Figure 2: Cumulative reward curves for VPG, TRPO, PPO and our CPPO under observation disturbance. The $\mathbf { X }$ -axes indicate the range of the disturbance, and the y-axes indicate the average performance of the algorithm under the state disturbance.
+
+
+Figure 3: Cumulative reward curves for VPG, TRPO, PPO and our CPPO under transition disturbance. The $\mathbf { X }$ -axes indicate the mass of the agent, and the y-axes indicate the average performance of the algorithm when the mass changes.
+
+Walker2d, Swimmer and Hopper are 6.36, 3.53, 34.6 and 3.53 respectively. Therefore, we draw Figure 3 to describe the results of agents, which are trained under standard mass condition and tested under different mass conditions. The solid line represents the average reward of 10 strategies, and the part with lighter color represents the variance of them. As seen in this figure, the performance of all algorithms decreases to a certain extent with the change of agent quality (whether it becomes larger or smaller) and the degree of decline is positively correlated with the quality change, which is consistent with our theoretical analysis in Theorem 4, that is, the upper bound of the performance difference of the algorithm is related to the size of the transition disturbance. Similar to the result under observation disturbance, we can can discover that VPG and PG-CMDP stay robustness under transition disturbance since their VFR is low, which is also shown in Theorem 4. At the same time, we can also see that CPPO achieve higher outcome in different tasks, specially in Swimmer and Hopper. It indicates that our method can improve the robustness of policies under transition disturbance.
+
+# 6 CONCLUSIONS
+
+In this paper, we analyze the advantages of CVaR for evaluating the risk of policy compared with the worst-case outcome as well as the variance of the return. Furthermore, we consider a risk-sensitive optimization objective and propose CPPO to solve it. Moreover, we provide theoretical connection of policies’ robustness against observation disturbance and transition disturbance, which are structurally different. By introducing the notion of value function range (VFR), we indicate that our CPPO can improve the robustness of policies. Finally, we evaluate our algorithms in various MuJoCo tasks and show that CPPO obtains better performance as well as stronger robustness than various strong competitors.
+
+# REPRODUCIBILITY STATEMENT
+
+We ensure the reproducibility of our paper from two aspects. (1) Experiment: The implementation and result of our experiment are described in Sec. 5. (2) Theory and Method: We provide the pseudo code of our algorithm in Appendix A. We also provide complete proofs of all the theoretical results mentioned in the paper in Appendix B.
+
+# ETHICS STATEMENT
+
+Deep reinforcement learning may encounter catastrophic failures due to the stochasticity. It is very imperative to develop safe reinforcement learning algorithms. This paper proposes a CPPO method to improve the robustness under observation and transition disturbance. Also, this paper provides theoretical analysis of the connection between observation and transition disturbance. It may promote the development of safe and reliable reinforcement learning algorithms in the future.
+
+# REFERENCES
+
+Joshua Achiam. Spinning Up in Deep Reinforcement Learning. 2018. 5.1
+
+Gordon J Alexander and Alexandre M Baptista. A comparison of var and cvar constraints on portfolio selection with the mean-variance model. Management Science, 50(9):1261–1273, 2004. 1, 2.2
+
+Siddharth Alexander, Thomas F Coleman, and Yuying Li. Minimizing cvar and var for a portfolio of derivatives. Journal of Banking & Finance (JBF), 30(2):583–605, 2006. 1, 2.2
+
+Dimitri P Bertsekas. Nonlinear programming. Journal of the Operational Research Society (JORS), 48(3):334–334, 1997. 3.2
+
+Yinlam Chow and Mohammad Ghavamzadeh. Algorithms for cvar optimization in mdps. In Proceedings of the 27th International Conference on Neural Information Processing Systems (NeurIPS), pp. 3509–3517, 2014. 2.2, 2.2, 3.2, 3.2, 5.1, B.4
+
+Yinlam Chow, Aviv Tamar, Shie Mannor, and Marco Pavone. Risk-sensitive and robust decisionmaking: a cvar optimization approach. Advances in Neural Information Processing Systems (NeurIPS), 28:1522–1530, 2015. 2.2, 2.2, B.3
+
+Yinlam Chow, Mohammad Ghavamzadeh, Lucas Janson, and Marco Pavone. Risk-constrained reinforcement learning with percentile risk criteria. The Journal of Machine Learning Research (JMLR), 18(1):6070–6120, 2017. 2.2
+
+Stefano P Coraluppi and Steven I Marcus. Risk-sensitive and minimax control of discrete-time, finite-state markov decision processes. Automatica, 35(2):301–309, 1999. 1, 2.1
+
+Javier Garcıa and Fernando Fernandez. A comprehensive survey on safe reinforcement learning. ´ Journal of Machine Learning Research (JMLR), 16(1):1437–1480, 2015. 1, 2.1
+
+Chris Gaskett. Reinforcement learning under circumstances beyond its control. Proceedings of the International Conference on Computational Intelligence for Modelling Control and Automation, 2003. 2.1, 2.1
+
+Peter Geibel and Fritz Wysotzki. Risk-sensitive reinforcement learning applied to control under constraints. Journal of Artificial Intelligence Research (JAIR), 24:81–108, 2005. 1
+
+Abhijit Gosavi. Reinforcement learning for model building and variance-penalized control. In Proceedings of the 2009 Winter Simulation Conference (WSC), pp. 373–379. IEEE, 2009. 1, 2.1
+
+Matthias Heger. Consideration of risk in reinforcement learning. In Machine Learning Proceedings 1994, pp. 105–111. Elsevier, 1994. 1, 2.1, 2.1, 2.1
+
+Ronald A Howard and James E Matheson. Risk-sensitive markov decision processes. Management Science, 18(7):356–369, 1972. 2.1
+
+Sandy Huang, Nicolas Papernot, Ian Goodfellow, Yan Duan, and Pieter Abbeel. Adversarial attacks on neural network policies. arXiv preprint arXiv:1702.02284, 2017. 1
+
+Sham Kakade and John Langford. Approximately optimal approximate reinforcement learning. In In Proc. 19th International Conference on Machine Learning (ICML). Citeseer, 2002. 4.1
+
+Alex Kendall, Jeffrey Hawke, David Janz, Przemyslaw Mazur, Daniele Reda, John-Mark Allen, Vinh-Dieu Lam, Alex Bewley, and Amar Shah. Learning to drive in a day. In 2019 International Conference on Robotics and Automation (ICRA), pp. 8248–8254. IEEE, 2019. 1
+
+Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015. URL http://arxiv.org/abs/ 1412.6980. 5.1
+
+Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013. 1
+
+Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin A. Riedmiller, Andreas 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. URL https://doi.org/10.1038/nature14236. 1
+
+Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International conference on machine learning (ICML), pp. 1928–1937. PMLR, 2016. 1
+
+Arnab Nilim and Laurent El Ghaoui. Robust control of markov decision processes with uncertain transition matrices. Operations Research, 53(5):780–798, 2005. 2.1
+
+R Tyrrell Rockafellar, Stanislav Uryasev, et al. Optimization of conditional value-at-risk. B.3
+
+Makoto Sato, Hajime Kimura, and Shibenobu Kobayashi. Td algorithm for the variance of return and mean-variance reinforcement learning. Transactions of the Japanese Society for Artificial Intelligence (JSAI), 16(3):353–362, 2001. 2.1
+
+John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International conference on machine learning (ICML), pp. 1889–1897. PMLR, 2015. 5.1
+
+John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017. 1, 3.2, 5.1
+
+David Silver, Aja Huang, Chris J. Maddison, Arthur Guez, Laurent Sifre, George van den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Vedavyas Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy P. Lillicrap, Madeleine Leach, Koray Kavukcuoglu, Thore Graepel, and Demis Hassabis. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016. URL https://doi.org/10.1038/nature16961. 1
+
+Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018. 2
+
+Richard S Sutton, David A McAllester, Satinder P Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. In Advances in neural information processing systems (NeurIPS), pp. 1057–1063, 2000. 3.2, 5.1
+
+Giorgio Szego. Measures of risk. ¨ Journal of Banking & finance (JBF), 26(7):1253–1272, 2002. 1, 2.1
+
+Aviv Tamar, Dotan Di Castro, and Shie Mannor. Policy gradients with variance related risk criteria. In Proceedings of the 29th International Coference on International Conference on Machine Learning (ICML), pp. 1651–1658, 2012. 1, 2.1
+
+Aviv Tamar, Huan Xu, and Shie Mannor. Scaling up robust mdps by reinforcement learning. arXiv preprint arXiv:1306.6189, 2013. 2.1
+
+Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 5026–5033. IEEE, 2012. 1, 5, 5.1
+
+Huan Zhang, Hongge Chen, Chaowei Xiao, Bo Li, Mingyan Liu, Duane Boning, and Cho-Jui Hsieh. Robust deep reinforcement learning against adversarial perturbations on state observations. Advances in Neural Information Processing Systems (NeurIPS), 33:21024–21037, 2020. 4.1, 4.1, B.5
+
+# A PSEUDO CODE OF CPPO
+
+Algorithm 1 CVaR Proximal Policy Optimization(CPPO)
+
+Require: confidence level $\alpha$ and reward tolerance $\beta$ , learning rate $l r _ { \eta } , l r _ { \theta } , l r _ { \lambda } , l r _ { \phi }$
+
+Ensure: $\theta$ of parameterized policy $\pi _ { \theta }$ (always be random policy), $\phi$ of parameterized value function $V _ { \phi }$ .
+
+for $k = 1 , 2 , . . . , N _ { i t e r }$ do
+
+Generate $N$ trajectories $\mathcal { D } _ { k } = \{ \xi _ { i } \} _ { i = 1 } ^ { N }$ by following the current policy $\pi _ { \theta }$ .
+
+Compute reward $\hat { R } _ { i } ^ { t }$ of each state $s _ { i , t }$ in each trajectory $\xi _ { i }$ and the cumulative reward $D ( \xi _ { i } )$
+
+Compute advantage estimates $\hat { A } _ { i } ^ { t }$ of each state $s _ { i , t }$ in each trajectory $\xi _ { i }$
+
+Update parameters respectively:
+
+$$
+\begin{array} { l } { \displaystyle \eta \gets \eta - l r _ { 0 } \left( - \lambda + \frac { \lambda } { N ( 1 - \alpha ) } \sum _ { i = 1 } ^ { N } \{ \{ \eta \geq D ( \xi _ { i } ) \} \} \right) } \\ { \displaystyle \theta \gets \theta + l r _ { 0 } \frac { 1 } { N T } \sum _ { i = 1 } ^ { N } \sum _ { t = 1 } ^ { T } \nabla _ { \theta } \operatorname* { m i n } \left( \frac { \pi _ { \theta } ( \alpha _ { i } ^ { t } | \xi _ { i } ^ { t } ) } { \pi _ { \theta } ( \alpha _ { i } ^ { t } | \alpha _ { i } ^ { t } | \xi _ { i } ^ { t } ) } \mathring { A } _ { t } ^ { t } , g ( \epsilon , \hat { A } _ { i } ^ { t } ) \right) } \\ { \displaystyle \qquad - l r _ { \theta } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } ( \nabla _ { \theta } \log P _ { \theta } ( \xi _ { i } ) ) \frac { 1 } { 1 - \alpha } ( - D ( \xi _ { i } ) + \eta ) \mathbf { 1 } \{ \eta \geq D ( \xi _ { i } ) \} } \\ { \displaystyle \lambda \gets \lambda + l r _ { \lambda } \left( - \eta + \frac { \sum _ { i = 1 } ^ { N } ( - D ( \xi _ { i } ) + \eta ) ^ { + } } { N ( 1 - \alpha ) } + \beta \right) } \\ { \displaystyle \phi \gets \phi + l r _ { \theta } \left( \frac { 1 } { N T } \sum _ { i = 1 } ^ { N } \sum _ { t = 1 } ^ { T } ( \zeta _ { \zeta } ( s _ { i , t } ) - \hat { R } _ { i } ^ { t } ) \nabla _ { \theta } \nu _ { \theta } ( s _ { i , t } ) \right) } \end{array}
+$$
+
+Modify $\beta$ as a function of the return of current trajectories:
+
+$$
+\beta g ( \xi _ { 1 } , \xi _ { 2 } , . . . , \xi _ { N } )
+$$
+
+# end for
+
+# B PROOFS OF THEOREMS
+
+In this section, we will provide the proofs of theorems proposed in the paper.
+
+# B.1 THE PROOF OF THEOREM 1
+
+Proof. By definition of VaR and CVaR, we have:
+
+$$
+F _ { f ( D ( \pi _ { \theta } ) ) } ( z ) = P ( f ( D ( \pi _ { \theta } ) ) \leq z ) = P ( D ( \pi _ { \theta } ) \geq f ^ { - 1 } ( z ) ) = 1 - F _ { D ( \pi _ { \theta } ) } ( f ^ { - 1 } ( z ) ) ,
+$$
+
+$$
+\begin{array} { r l } & { \mathrm { V a R } _ { \alpha } ( f ( D ( \pi _ { \theta } ) ) ) = \operatorname* { m i n } \{ z | F _ { f ( D ( \pi _ { \theta } ) ) } ( z ) \ge \alpha \} } \\ & { \quad \quad \quad = \operatorname* { m i n } \{ z | 1 - F _ { D ( \pi _ { \theta } ) } ( f ^ { - 1 } ( z ) ) \ge \alpha \} } \\ & { \quad \quad \quad = \operatorname* { m i n } \{ z | F _ { D ( \pi _ { \theta } ) } ( f ^ { - 1 } ( z ) ) \le 1 - \alpha \} , } \end{array}
+$$
+
+$$
+\begin{array} { r l } & { \mathrm { C V a R } _ { \alpha } ( f ( D ( \pi _ { \theta } ) ) ) = \mathbb { E } _ { w \sim f ( D ( \pi _ { \theta } ) ) } \{ w | w \ge \mathrm { V a R } _ { \alpha } ( f ( D ( \pi _ { \theta } ) ) ) \} } \\ & { \quad \quad \quad = \mathbb { E } _ { z \sim D ( \pi _ { \theta } ) } \{ f ( z ) | f ( z ) \ge \mathrm { V a R } _ { \alpha } ( f ( D ( \pi _ { \theta } ) ) \} . } \end{array}
+$$
+
+When we set $f ( Z ) = - Z$ , we can naturally prove that
+
+$$
+\begin{array} { r l } & { - \mathrm { V a R } _ { \alpha } ( - Z ) = - \operatorname* { m i n } \{ z | F _ { Z } ( - z ) \le 1 - \alpha \} } \\ & { \qquad = - \operatorname* { m i n } \{ z | 1 - F _ { Z } ( - z ) \ge \alpha \} } \\ & { \qquad = \operatorname* { m a x } \{ - z | 1 - F _ { Z } ( - z ) \ge \alpha \} } \\ & { \qquad = \operatorname* { m a x } \{ z | F _ { Z } ( z ) \le 1 - \alpha \} , } \end{array}
+$$
+
+$$
+\begin{array} { r l } & { - \mathrm { C V a R } _ { \alpha } ( - Z ) = - \mathbb { E } _ { z \sim Z } \{ - z | - z \ge \mathrm { V a R } _ { \alpha } ( - Z ) \} . } \\ & { \qquad = \mathbb { E } _ { z \sim Z } \{ z | - z \ge \mathrm { V a R } _ { \alpha } ( - Z ) \} } \\ & { \qquad = \mathbb { E } _ { z \sim Z } \{ z | z \le - \mathrm { V a R } _ { \alpha } ( - Z ) \} . } \end{array}
+$$
+
+If we assume that $- \mathrm { C V a R } _ { \alpha } ( - Z ) \geq \beta$ , then we have:
+
+$$
+\begin{array} { r l } & { P ( Z \leq \beta ) \leq P ( Z \leq - \mathrm { C V a R } _ { \alpha } ( - Z ) ) } \\ & { \qquad = P ( Z \leq \mathbb { E } _ { w \sim Z } \{ w | w \leq - \mathrm { V a R } _ { \alpha } ( - Z ) \} ) } \\ & { \qquad = P ( Z \leq - \mathrm { V a R } _ { \alpha } ( - Z ) ) } \\ & { \qquad = P ( Z \leq \operatorname* { m a x } \{ z | F _ { Z } ( z ) \leq 1 - \alpha \} ) } \\ & { \qquad = 1 - \alpha . } \end{array}
+$$
+
+So we have proven it.
+
+# B.2 THE PROOF OF THEOREM 2
+
+Proof. Since we assume $M$ is the upper bound of the total reward of every trajectory, we have $J ( \pi _ { s } ) \le M$ . We consider two scenarios.
+
+In the first case, if $\pi _ { s }$ satisfies that $- C V a R _ { \alpha } ( - D ( \pi _ { s } ) ) \ge \beta$ . Obviously, we have $\pi _ { c } ( \alpha , \beta ) = \pi _ { s }$ thus
+
+$$
+J ( \pi _ { c } ( \alpha , \beta ) ) = J ( \pi _ { s } ) \ge \frac { J ( \pi _ { s } ) - \alpha M } { 1 - \alpha } .
+$$
+
+Otherwise, we assume that $- \mathrm { C V a R } _ { \alpha } ( - D ( \pi _ { s } ) ) < \beta$ , Since $- \mathrm { C V a R } _ { \alpha } ( - D ( \pi _ { c } ( \alpha , \beta ) ) ) \ge \beta$ , we set $B = - V a R _ { \alpha } ( - D ( \pi _ { c } ( \alpha , \beta ) ) )$ and have:
+
+$$
+\begin{array} { r l } & { J ( \pi _ { c } ( \alpha , \beta ) ) = \displaystyle \int _ { \tau \sim \pi _ { c } ( \alpha , \beta ) } p ( \tau ) D ( \tau ) d \tau } \\ & { \quad \quad \quad = \displaystyle \int _ { D ( \tau ) \leq B } p ( \tau ) D ( \tau ) d \tau + \displaystyle \int _ { D ( \tau ) > B } p ( \tau ) D ( \tau ) d \tau } \\ & { \quad \quad \quad \geq - \alpha C V a R ( - D ( \pi _ { c } ( \alpha , \beta ) ) ) + \displaystyle \int _ { D ( \tau ) > B } p ( \tau ) B d \tau } \\ & { \quad \quad \quad \geq A \alpha + A ( 1 - \alpha ) } \\ & { \quad \quad = \beta . } \end{array}
+$$
+
+By the similar way, we set:
+
+$$
+\begin{array} { r } { A = - \operatorname { V a R } _ { \alpha } ( - D ( \pi _ { \theta } ) ) = \operatorname* { m a x } \{ z | F _ { D ( \pi _ { \theta } ) } ( z ) \le 1 - \alpha \} , } \end{array}
+$$
+
+thus
+
+$$
+\begin{array} { r l } { J ( \pi _ { s } ) = \displaystyle \int _ { \tau \sim \pi _ { s } } p ( \tau ) D ( \tau ) d \tau } \\ { \displaystyle } & { \phantom { = } = \displaystyle \int _ { D ( \tau ) \leq A } p ( \tau ) D ( \tau ) d \tau + \displaystyle \int _ { D ( \tau ) > A } p ( \tau ) D ( \tau ) d \tau } \\ { \displaystyle } & { \phantom { = } = \displaystyle \int _ { D ( \tau ) \leq A } p ( \tau ) A d \tau + \displaystyle \int _ { D ( \tau ) > A } p ( \tau ) M d \tau } \\ { \displaystyle } & { \phantom { = } = A ( 1 - \alpha ) + M \alpha } \\ { \displaystyle } & { \phantom { = } < \beta ( 1 - \alpha ) + M \alpha } \\ { \displaystyle } & { \leq J ( \pi _ { c } ( \alpha , \beta ) ) ( 1 - \alpha ) + M \alpha . } \end{array}
+$$
+
+So we have proven J(πc(α, β)) ≥ J(πs)−αM1−α .
+
+# B.3 THE PROOF OF EQUIVALENTLY DEFORMING PROBLEM (9)
+
+In this part, we will equivalently deforming problem (9) as
+
+$$
+\begin{array} { r l } { \underset { \theta } { \operatorname* { m a x } } J ( \pi _ { \theta } ) } & { s . t . - \mathrm { C V a R } _ { \alpha } ( - D ( \pi _ { \theta } ) ) \geq \beta } \\ { \Leftrightarrow \underset { \theta } { \operatorname* { m i n } } - J ( \pi _ { \theta } ) } & { s . t . \mathrm { C V a R } _ { \alpha } ( - D ( \pi _ { \theta } ) ) \leq - \beta } \\ { \overset { 1 } { \Leftrightarrow } \underset { \theta } { \operatorname* { m i n } } - J ( \pi _ { \theta } ) } & { s . t . \underset { \nu \in R } { \operatorname* { m i n } } \{ \nu + \frac { 1 } { 1 - \alpha } \mathbb { E } [ ( - D ( \pi _ { \theta } ) - \nu ) ^ { + } ] \} \leq - \beta } \\ { \Leftrightarrow \underset { \theta } { \operatorname* { m i n } } - J ( \pi _ { \theta } ) } & { s . t . \underset { \nu \in R } { \operatorname* { m i n } } \{ - \nu + \frac { 1 } { 1 - \alpha } \mathbb { E } [ ( - D ( \pi _ { \theta } ) + \nu ) ^ { + } ] \} \leq - \beta } \\ { \Leftrightarrow \underset { \theta , \nu } { \operatorname* { m i n } } - J ( \pi _ { \theta } ) } & { s . t . - \nu + \frac { 1 } { 1 - \alpha } \mathbb { E } [ ( - D ( \pi _ { \theta } ) + \nu ) ^ { + } ] \leq - \beta . } \end{array}
+$$
+
+Here we derive a formula 1 since CVaR owns the property (Rockafellar et al.; Chow et al., 2015):
+
+$$
+\operatorname { C V a R } _ { \alpha } ( Z ) = \operatorname* { m i n } _ { \eta \in R } \left\{ \eta + { \frac { 1 } { 1 - \alpha } } \mathbb { E } [ ( Z - \eta ) ^ { + } ] \right\} .
+$$
+
+So we have proven it.
+
+# B.4 CALCULATING THE GRADIENT OF $L ( \theta , \nu , \lambda )$
+
+In this part, we will calculate the gradient $\partial _ { \nu } L ( \theta , \nu , \lambda ) , \bigtriangledown _ { \theta } L ( \theta , \nu , \lambda )$ and $\bigtriangledown \lambda L ( \theta , \nu , \lambda )$ of the function $L ( \bar { \theta } , \nu , \lambda )$ by using the methods in (Chow $\&$ Ghavamzadeh, 2014):
+
+$$
+L ( \theta , \nu , \lambda ) = - J ( \pi _ { \theta } ) + \lambda ( - \nu + { \frac { 1 } { 1 - \alpha } } \mathbb { E } [ ( - D ( \pi _ { \theta } ) + \nu ) ^ { + } ] + \beta ) .
+$$
+
+First we can expand the expectation as
+
+$$
+\begin{array} { l } { { \displaystyle { \cal L } ( \theta , \nu , \lambda ) = - J ( \pi _ { \theta } ) + \lambda ( - \nu + \frac { 1 } { 1 - \alpha } \mathbb { E } [ ( - D ( \pi _ { \theta } ) + \nu ) ^ { + } ] + \beta ) } } \\ { { \displaystyle ~ = - \sum _ { \xi } P _ { \theta } ( \xi ) D ( \xi ) - \lambda \nu + \frac { \lambda } { 1 - \alpha } \sum _ { \xi } P _ { \theta } ( \xi ) ( - D ( \xi ) + \nu ) ^ { + } + \lambda \beta . } } \end{array}
+$$
+
+We can see that $P _ { \theta } ( \xi )$ will only depend on $\theta$ and $\xi$ , so we have easily calculate the gradient of $\lambda$ as
+
+$$
+\begin{array} { l } { \nabla _ { \lambda } L ( \theta , \nu , \lambda ) = - \nu + \displaystyle \frac { 1 } { 1 - \alpha } \sum _ { \xi } P _ { \theta } ( \xi ) ( - D ( \xi ) + \nu ) ^ { + } + \beta } \\ { = - \nu + \displaystyle \frac { 1 } { 1 - \alpha } \mathbb { E } _ { \xi \sim \pi _ { \theta } } ( - D ( \xi ) + \nu ) ^ { + } + \beta . } \end{array}
+$$
+
+Then we calculate the gradient of $\nu$ . Since $( D ( \xi ) - \nu ) ^ { + }$ isn’t differentiable to $\nu$ at the point of $\nu = D ( \xi )$ , so we consider its semi gradient as
+
+$$
+\partial _ { \nu } ( - D ( \xi ) + \nu ) ^ { + } = \left\{ \begin{array} { l l } { 0 } & { \nu < D ( \xi ) } \\ { q ( 0 \le q \le 1 ) } & { \nu = D ( \xi ) } \\ { 1 } & { \nu > D ( \xi ) } \end{array} \right.
+$$
+
+And we can calculate the gradient of $\nu$ as below:
+
+$$
+\begin{array} { l } { { \displaystyle \partial _ { \nu } L ( \theta , \nu , \lambda ) = - \lambda + \frac { \lambda } { 1 - \alpha } \sum _ { \xi } P _ { \theta } ( \xi ) \partial _ { \nu } ( - D ( \xi ) + \nu ) ^ { + } } } \\ { { \displaystyle \qquad = - \lambda + \frac { \lambda } { 1 - \alpha } \sum _ { \xi } P _ { \theta } ( \xi ) \mathbf { 1 } \{ \nu > D ( \xi ) \} + \frac { \lambda q } { 1 - \alpha } \sum _ { \xi } P _ { \theta } ( \xi ) \mathbf { 1 } \{ \nu = D ( \xi ) \} } } \\ { { \displaystyle \qquad = - \lambda + \frac { \lambda } { 1 - \alpha } \sum _ { \xi } P _ { \theta } ( \xi ) \mathbf { 1 } \{ \nu \geq D ( \xi ) \} \quad ( l e t q = 1 ) } } \\ { { \displaystyle \qquad = - \lambda + \frac { \lambda } { 1 - \alpha } \mathbb { E } _ { \xi \sim \pi _ { \theta } } \mathbf { 1 } \{ \nu \geq D ( \xi ) \} ) . } } \end{array}
+$$
+
+Finally, we will calculate the gradient of $\theta$ as
+
+$$
+\begin{array} { l } { \displaystyle \nabla _ { \theta } L ( \theta , \nu , \lambda ) = - \sum _ { \xi } \nabla _ { \theta } P _ { \theta } ( \xi ) D ( \xi ) + \frac { \lambda } { 1 - \alpha } \sum _ { \xi } \nabla _ { \theta } P _ { \theta } ( \xi ) ( - D ( \xi ) + \nu ) ^ { + } } \\ { \displaystyle = \sum _ { \xi } \nabla _ { \theta } P _ { \theta } ( \xi ) ( - D ( \xi ) + \frac { \lambda } { 1 - \alpha } ( - D ( \xi ) + \nu ) \mathbf { 1 } \{ \nu \geq D ( \xi ) \} ) } \\ { \displaystyle = \sum _ { \xi } ( \nabla _ { \theta } \log P _ { \theta } ( \xi ) ) P _ { \theta } ( \xi ) ( - D ( \xi ) + \frac { \lambda } { 1 - \alpha } ( - D ( \xi ) + \nu ) \mathbf { 1 } \{ \nu \geq D ( \xi ) \} ) } \\ { \displaystyle = - \sum _ { \xi } ( \nabla _ { \theta } \log P _ { \theta } ( \xi ) ) P _ { \theta } ( \xi ) D ( \xi ) + \sum _ { \xi } ( \nabla _ { \theta } \log P _ { \theta } ( \xi ) ) P _ { \theta } ( \xi ) \frac { \lambda ( \nu - D ( \xi ) ) } { 1 - \alpha } \mathbf { 1 } \{ \nu \geq D ( \xi ) \} } \\ { \displaystyle = - \sum _ { \xi } \nabla _ { \theta } \log P _ { \theta } ( \xi ) ( \xi ) \frac { \lambda } { 1 - \alpha } \left( \frac { \lambda } { 1 - \alpha } ( - D ( \xi ) + \nu ) ^ { + } \right) . } \end{array}
+$$
+
+So we have calculated these three gradient.
+
+# B.5 THE PROOF OF THEOREM 3 AND THEOREM 4
+
+Before proving Theorem 3 and Theorem 4, we first examine a property of $d _ { \mathcal { M } } ^ { \pi }$ :
+
+Lemma 1. For any state $s \in S$ , we have:
+
+$$
+d _ { \mathcal { M } } ^ { \pi } ( s ) = ( 1 - \gamma ) P ( s _ { 0 } = s ) + \gamma \sum _ { s ^ { \prime } } d _ { \mathcal { M } } ^ { \pi } ( s ^ { \prime } ) \sum _ { a } \pi ( a | s ) P ( s ^ { \prime } | s , a ) .
+$$
+
+Proof. Here we’ll prove this lemma. By the definition of $d _ { \mathcal { M } } ^ { \pi } ( s )$ , we have:
+
+$$
+\begin{array} { r l } { \displaystyle } & { d _ { \mathbf { A } } ^ { \kappa } ( s ) - ( 1 - \gamma ) P ^ { \kappa } ( s _ { 0 } = s ) } \\ & { = ( 1 - \gamma ) \displaystyle \sum _ { \ell = 1 } ^ { \infty } \sum _ { s ^ { \prime } } \gamma ^ { \ell } P ( s _ { \ell - 1 } = s ^ { \prime } , s _ { \ell } = s | \pi , M ) } \\ & { = ( 1 - \gamma ) \displaystyle \sum _ { \ell = 0 } ^ { \infty } \sum _ { s ^ { \prime } } \gamma ^ { \ell + 1 } P ( s _ { \ell } = s ^ { \prime } | \pi , M ) P ( s _ { \ell + 1 } = s | s _ { \ell } = s ^ { \prime } , \pi , M ) } \\ & { = \gamma \displaystyle \sum _ { s ^ { \prime } } \left[ ( 1 - \gamma ) \displaystyle \sum _ { \ell = 1 } ^ { \infty } \gamma ^ { \ell } P ( s _ { \ell } = s ^ { \prime } | \pi , M ) \right] P ( s _ { 1 } = s | s _ { 0 } = s ^ { \prime } , \pi , M ) } \\ & { = \gamma \displaystyle \sum _ { s ^ { \prime } } d _ { M } ^ { \kappa } ( s ^ { \prime } ) P ( s _ { 1 } = s | s _ { 0 } = s ^ { \prime } , \pi , M ) } \\ & { = \gamma \displaystyle \sum _ { s ^ { \prime } } d _ { M } ^ { \kappa } ( s ^ { \prime } ) \sum _ { s ^ { \prime } } \pi ( \boldsymbol { a } | s ) P ( s ^ { \prime } | s , \boldsymbol { a } ) . } \end{array}
+$$
+
+Thus we have proven it.
+
+Now we will prove Theorem 3.
+
+Theorem 3. For any policy $\pi$ and any adversary $\nu$ , we can calculate the reduction of expected cumulative reward of $\pi$ against the observation disturbance of $\nu$ as
+
+$$
+\begin{array} { l } { { J _ { \mathcal { M } } ( \pi ) - J _ { \mathcal { M } } ( \hat { \pi } _ { \nu } ) = \displaystyle \frac { \gamma } { 1 - \gamma } \mathbb { E } _ { s \sim d _ { \mathcal { M } } ^ { \hat { \pi } _ { \nu } } } \mathbb { E } _ { a \sim \pi ( \cdot \vert \nu ( s ) ) } \left( 1 - \displaystyle \frac { \pi ( a \vert s ) } { \pi ( a \vert \nu ( s ) ) } \right) \mathbb { E } _ { s ^ { \prime } \sim P } V _ { \mathcal { M } , \pi } ( s ^ { \prime } ) } } \\ { { \displaystyle \qquad + \frac { 1 } { 1 - \gamma } \mathbb { E } _ { s \sim d _ { \mathcal { M } } ^ { \hat { \pi } _ { \nu } } } \mathbb { E } _ { a \sim \pi ( \cdot \vert \nu ( s ) ) } \left( 1 - \displaystyle \frac { \pi ( a \vert s ) } { \pi ( a \vert \nu ( s ) ) } \right) R ( s , a ) . } } \end{array}
+$$
+
+Furthermore, we can give an upper bound of it:
+
+$$
+\begin{array} { r l } & { | J _ { \mathcal M } ( \pi ) - J _ { \mathcal M } ( \hat { \pi } _ { \nu } ) | \leq \displaystyle \frac { \gamma } { 1 - \gamma } \operatorname* { m a x } _ { s } D _ { T V } ( \pi ( \cdot | s ) , \pi ( \cdot | \nu ( s ) ) ) \hat { V } _ { \mathcal M , \pi } } \\ & { \qquad + \displaystyle \frac { 2 } { 1 - \gamma } \operatorname* { m a x } _ { s } D _ { T V } ( \pi ( \cdot | s ) , \pi ( \cdot | \nu ( s ) ) \operatorname* { m a x } _ { s , a } | R ( s , a ) | . } \end{array}
+$$
+
+Proof. Considering the bellman equation of value function of $\pi , \hat { \pi } _ { \nu }$ in $\mathcal { M }$ , we have:
+
+$$
+\begin{array} { l } { { \displaystyle V _ { \mathcal { M } , \pi } ( s ) = \sum _ { a } \pi ( a | s ) [ R ( s , a ) + \gamma \sum _ { s ^ { \prime } } P ( s ^ { \prime } | s , a ) V _ { \mathcal { M } , \pi } ( s ^ { \prime } ) ] } , } \\ { { \displaystyle V _ { \mathcal { M } , \hat { \pi } _ { \nu } } ( s ) = \sum _ { a } \pi ( a | \nu ( s ) ) [ R ( s , a ) + \gamma \sum _ { s ^ { \prime } } P ( s ^ { \prime } | s , a ) V _ { \mathcal { M } , \hat { \pi } _ { \nu } } ( s ^ { \prime } ) ] . } } \end{array}
+$$
+
+By subtracting two value functions, we can deduce:
+
+$$
+\begin{array} { l } { { \displaystyle V _ { \mathcal { M } , \hat { \pi } _ { \nu } } ( s ) - V _ { \mathcal { M } , \pi } ( s ) = \gamma \sum _ { a } ( \pi ( a | \nu ( s ) ) - \pi ( a | s ) ) \sum _ { s ^ { \prime } } P ( s ^ { \prime } | s , a ) V _ { \mathcal { M } , \pi } ( s ^ { \prime } ) } } \\ { { \displaystyle \qquad + \gamma \sum _ { a } \pi ( a | \nu ( s ) ) \sum _ { s ^ { \prime } } P ( s ^ { \prime } | s , a ) ( V _ { \mathcal { M } , \hat { \pi } _ { \nu } } ( s ^ { \prime } ) - V _ { \mathcal { M } , \pi } ( s ^ { \prime } ) ) } } \\ { { \displaystyle \qquad + \sum _ { a } [ \pi ( a | \nu ( s ) ) - \pi ( a | s ) ] R ( s , a ) . } } \end{array}
+$$
+
+uation (26) satisfies for every state : $s$ , thus we calculate the expectation of equation (26) for $s \sim d _ { \mathcal { M } } ^ { \hat { \pi } _ { \nu } }$
+
+$$
+\begin{array} { r l } & { \quad \sum _ { k } ^ { \ell } d _ { k , k } ^ { \ell + 1 } ( \delta ) | V _ { M , k , \ell } ( e ) - V _ { M , \tau } ( s ) | } \\ & { = \gamma \sum _ { k } ^ { \ell } d _ { M , k } ^ { \ell + 1 } ( s ) \sum _ { \ell } ^ { \ell } ( \alpha ( \iota ( y ( s ) ) ) - \tau ( \iota ( s ) ) ) \sum _ { k } ^ { \ell } P ( \ell ^ { \prime } | s , \alpha ) | V _ { M , \tau } ( s ^ { \prime } ) } \\ & { + \gamma \sum _ { k } ^ { \ell } d _ { M , k } ^ { \ell + 1 } ( s ) \sum _ { \ell } ^ { \ell - 1 } ( \alpha ( \iota ( y ( s ) ) ) \sum _ { k } ^ { \ell } P ( \ell ^ { \prime } | s , \alpha ) | V _ { M , \ell } ( s ^ { \prime } ) - V _ { M , \alpha } ( \ell ^ { \prime } ) ) } \\ & { + \sum _ { k } ^ { \ell } d _ { M , k } ^ { \ell + 1 } ( s ) \sum _ { \ell } ^ { \ell } ( \alpha ( \iota ( y ( s ) ) ) - \tau ( \iota ( s ) ) | H ( s , \alpha ) | } \\ & { - \gamma \sum _ { k } ^ { \ell } d _ { M , \ell } ^ { \ell + 1 } ( s ) \sum _ { \ell } ^ { \ell } ( \alpha ( \iota ( y ( s ) ) ) - \tau ( \iota ( s ) ) ) \sum _ { \ell } ^ { \ell } P ( \ell ^ { \prime } | s , \alpha ) | V _ { M , \tau } ( s ^ { \prime } ) } \\ & { + \sum _ { k } ^ { \ell } ( \delta ) _ { M , k , \ell } ( s ^ { \prime } ) - V _ { M , \ell } ( s ^ { \prime } ) | [ \gamma _ { 2 } \sum _ { \ell } ^ { \ell } d _ { M , \ell } ^ { \ell + 1 } ( s ) \sum _ { \ell } ^ { \ell } ( \ell ^ { \prime } | s , \alpha ) ] } \\ & { + \sum _ { k } ^ { \ell } d _ { M , k , \ell } ^ { \ell + 1 } ( s ) \sum _ { \ell } ^ { \ell } ( \alpha | H ( s ) ) - \tau ( \iota ( s ) ) \sum _ { \ell } ^ { \ell + 1 } d _ { M , \ell } ^ { \ell + 1 } ( s ) \sum _ { \ell } ^ { \ell + 1 } ( \ell ^ { \prime } | s , \alpha ) | P ( s ^ { \prime } | s , \alpha ) ) } \\ & + \sum _ { k } ^ \end{array}
+$$
+
+By Lemma 1, we have:
+
+$$
+\begin{array} { l } { { { \displaystyle \sum _ { s } d _ { \mathcal { M } } ^ { \hat { \pi } _ { \nu } } ( s ) [ V _ { M , \hat { \pi } _ { \nu } } ( s ) - V _ { M , \pi } ( s ) ] } } } \\ { { { \displaystyle = \gamma \sum _ { s } d _ { \mathcal { M } } ^ { \hat { \pi } _ { \nu } } ( s ) \sum _ { a } ( \pi ( a | \nu ( s ) ) - \pi ( a | s ) ) \sum _ { s ^ { \prime } } P ( s ^ { \prime } | s , a ) V _ { M , \pi } ( s ^ { \prime } ) } } } \\ { { { \displaystyle + \sum _ { s ^ { \prime } } ( V _ { M , \hat { \pi } _ { \nu } } ( s ^ { \prime } ) - V _ { M , \pi } ( s ^ { \prime } ) ) \left[ d _ { \mathcal { M } } ^ { \hat { \pi } _ { \nu } } ( s ^ { \prime } ) - ( 1 - \gamma ) P ( s _ { 0 } = s ^ { \prime } ) \right] } } } \\ { { { \displaystyle + \sum _ { s } d _ { \mathcal { M } } ^ { \hat { \pi } _ { \nu } } ( s ) \sum _ { a } [ \pi ( a | \nu ( s ) ) - \pi ( a | s ) ] R ( s , a ) . } } } \end{array}
+$$
+
+By moving the second term of the right part in (28) to the left part, we can deduce:
+
+$$
+\begin{array} { c } { { ( 1 - \gamma ) \displaystyle \sum _ { s ^ { \prime } } ( V _ { M , \hat { \pi } _ { \nu } } ( s ^ { \prime } ) - V _ { M , \pi } ( s ^ { \prime } ) ) P ( s _ { 0 } = s ^ { \prime } ) } } \\ { { \displaystyle = \gamma \sum _ { s } d _ { { \mathcal M } } ^ { \hat { \pi } _ { \nu } } ( s ) \sum _ { a } ( \pi ( a | \nu ( s ) ) - \pi ( a | s ) ) \sum _ { s ^ { \prime } } P ( s ^ { \prime } | s , a ) V _ { M , \pi } ( s ^ { \prime } ) } } \\ { { + \sum _ { s } d _ { { \mathcal M } } ^ { \hat { \pi } _ { \nu } } ( s ) \sum _ { a } [ \pi ( a | \nu ( s ) ) - \pi ( a | s ) ] R ( s , a ) , } } \end{array}
+$$
+
+thus:
+
+$$
+\begin{array} { r l } { ( 1 - \gamma ) ( J _ { M } ( \hat { \pi } _ { \nu } ) - J _ { M } ( \pi ) ) = ( 1 - \gamma ) \displaystyle \sum _ { s ^ { \prime } } ( V _ { M , \hat { \pi } _ { \nu } } ( s ^ { \prime } ) - V _ { M , \pi } ( s ^ { \prime } ) ) P ( s _ { 0 } = s ^ { \prime } ) } & { } \\ { = \gamma \displaystyle \sum _ { s } d _ { M } ^ { \hat { \pi } _ { \nu } } ( s ) \displaystyle \sum _ { a } ( \pi ( a | \nu ( s ) ) - \pi ( a | s ) ) \displaystyle \sum _ { s ^ { \prime } } P ( s ^ { \prime } | s , a ) V _ { M , \pi } ( s ^ { \prime } ) } & { } \\ { + \displaystyle \sum _ { s } d _ { M } ^ { \hat { \pi } _ { \nu } } ( s ) \displaystyle \sum _ { a } \{ \pi ( a | \nu ( s ) ) - \pi ( a | s ) \} H ( s , a ) } & { } \\ { = \gamma \mathbb { E } _ { s \sim d _ { M } ^ { \nu _ { \nu } } } \mathbb { E } _ { a \sim \pi ( \cdot | \nu ( s ) ) } \left( 1 - \displaystyle \frac { \pi ( a | s ) } { \pi ( a | \nu ( s ) ) } \right) \mathbb { E } _ { s ^ { \prime } \sim P ( \cdot | s , a ) } V _ { M , \pi } ( s ^ { \prime } ) } & { } \\ { + \mathbb { E } _ { s \sim d _ { M } ^ { \nu _ { \nu } } } \mathbb { E } _ { a \sim \pi ( \cdot | \nu ( s ) ) } \left( 1 - \displaystyle \frac { \pi ( a | s ) } { \pi ( a | \nu ( s ) ) } \right) R ( s , a ) . } & { } \end{array}
+$$
+
+And we can prove:
+
+$$
+\begin{array} { c } { { J _ { \mathcal M } ( \pi ) - J _ { \mathcal M } ( \hat { \pi } _ { \nu } ) = \displaystyle \frac { \gamma } { 1 - \gamma } \mathbb E _ { s \sim d _ { \mathcal M } ^ { \hat { \pi } _ { \nu } } } \mathbb E _ { a \sim \pi ( \cdot \vert \nu ( s ) ) } \left( 1 - \displaystyle \frac { \pi ( a \vert s ) } { \pi ( a \vert \nu ( s ) ) } \right) \mathbb E _ { s ^ { \prime } \sim P ( \cdot \vert s , a ) } V _ { \mathcal M , \pi } ( s ^ { \prime } ) } } \\ { { + \displaystyle \frac { 1 } { 1 - \gamma } \mathbb E _ { s \sim d _ { \mathcal M } ^ { \hat { \pi } _ { \nu } } } \mathbb E _ { a \sim \pi ( \cdot \vert \nu ( s ) ) } \left( 1 - \displaystyle \frac { \pi ( a \vert s ) } { \pi ( a \vert \nu ( s ) ) } \right) R ( s , a ) . } } \end{array}
+$$
+
+Since $\begin{array} { r } { \mathbb { E } _ { a \sim \pi ( \cdot | \nu ( s ) ) } \left( 1 - \frac { \pi ( a | s ) } { \pi ( a | \nu ( s ) ) } \right) = 0 } \end{array}$ , we can subtract a benchmark, which will not affect its value. Specially, we consider VFR $\begin{array} { r } { \hat { V } _ { M , \pi } = \operatorname* { m a x } _ { s ^ { \prime } } V _ { M , \pi } ( s ^ { \prime } ) - \operatorname* { m i n } _ { s ^ { \prime } } V _ { M , \pi } ( s ^ { \prime } ) } \end{array}$ and we have $| V _ { M , \pi } ( s ) -$ $\begin{array} { r } { \hat { V } _ { M , \pi } | \leq \frac { \hat { V } _ { M , \pi } } { 2 } } \end{array}$ VˆM,π2 for every state s, thus we can prove that
+
+$$
+\begin{array} { r l } { \mathcal { J } _ { \boldsymbol { A } \boldsymbol { A } } ( \boldsymbol { \tilde { x } } ) - \mathcal { J } _ { \boldsymbol { A } \boldsymbol { A } } ( \boldsymbol { \tilde { x } } , \boldsymbol { \tilde { x } } ) | \leq \frac { \gamma } { 1 - \frac { \gamma } { 2 } } \sum _ { t = - \frac { \gamma } { 2 } } ^ { \boldsymbol { \kappa } } \sum _ { w \leq t \leq t } \delta _ { t \leq t \leq t } | w | \boldsymbol { x } | | - \frac { \gamma \cdot \zeta ^ { 2 } \cdot \delta ^ { 2 } } { 4 ( \boldsymbol { \mu } ( t - \boldsymbol { \tilde { \mu } } ) ) } | \mathbb { E } _ { w \leq t - \frac { \gamma } { 2 } \cdot \boldsymbol { \tau } ( s , t ) } \delta ^ { t } M _ { \boldsymbol { A } , w } | \delta ^ { t } - \delta ^ { t } \cdot \boldsymbol { x } _ { w , t } | } \\ & { + \frac { \gamma } { 1 - \frac { \gamma } { 2 } } \mathbb { E } _ { w \leq t \leq t } \sum _ { w \leq t \leq t } | w | \delta ^ { t } - \boldsymbol { \tau } _ { w \leq t \leq t } | \delta ^ { t } \cdot \boldsymbol { w } | } \\ & { \leq \frac { \gamma } { 1 - \frac { \gamma } { 2 } } \frac { \gamma } { 6 } \sum _ { t = - \frac { \gamma } { 2 } } ^ { \boldsymbol { \kappa } } \delta _ { t \leq t \leq t } ^ { 2 } \exp | \delta ^ { t } - \frac { \gamma \cdot \zeta ^ { 2 } \cdot \delta ^ { 2 } } { 4 ( \boldsymbol { \mu } ( t - \boldsymbol { \tilde { \mu } } ) ) } | \frac { \prod ( \delta ^ { t } ) \cdot \delta ^ { 2 } \cdot \boldsymbol { x } _ { w , t } } { 2 } } \\ & + \frac { \gamma } { 1 - \frac { \gamma } { 2 } } \frac { \gamma } { 6 } \sum _ { s \leq t \leq t } \delta ^ { t } \frac { \gamma } { 6 } \exp | \delta ^ { t } - \frac { \gamma \cdot \zeta ^ { 2 } \cdot \delta ^ { 2 } } { 4 ( \boldsymbol { \mu } ( t - \boldsymbol { \tilde { \mu } } ) ) } | \frac { \prod ( \delta ^ { t } ) \cdot \zeta ^ { 2 } \cdot \delta ^ { 2 } } { 2 ( \boldsymbol { \mu } ( t - \boldsymbol { \tilde { \mu } } ) ) } \\ & + \frac { \gamma } { 1 - \frac { \gamma } { 2 } } \sum _ { t = - \frac { \gamma } { 2 } } ^ \ \end{array}
+$$
+
+Thus we have proven Theorem 3.
+
+Furthermore, we will prove that our bound is tighter than the bound in Zhang et al. (2020):
+
+$$
+\begin{array} { r l } { \bigl | J _ { M } ( \pi ) - J _ { M } ( \hat { \pi } _ { \nu } ) \bigr | \leq \displaystyle \frac { \gamma } { 1 - \gamma } \underset { s } { \operatorname* { m a x } } D _ { T V } \bigl ( \pi \cdot | s ) , \pi ( \cdot | \nu ( s ) ) \bigr ) \hat { V } _ { M , \pi } } & { } \\ & { \qquad + \displaystyle \frac { 2 } { 1 - \gamma } \underset { s } { \operatorname* { m a x } } D _ { T V } \bigl ( \pi ( \cdot | s ) , \pi ( \cdot | \nu ( s ) ) \underset { s , a } { \operatorname* { m a x } } | R ( s , a ) | } \\ & { \qquad \leq \displaystyle \frac { 2 \gamma } { 1 - \gamma } \underset { s } { \operatorname* { m a x } } D _ { T V } \bigl ( \pi ( \cdot | s ) , \pi ( \cdot | \nu ( s ) ) \bigr ) \underset { s , a } { \operatorname* { m a x } } | V _ { M , \pi } ( s ) | } \\ & { \qquad + \displaystyle \frac { 2 } { 1 - \gamma } \underset { s } { \operatorname* { m a x } } D _ { T V } \bigl ( \pi ( \cdot | s ) , \pi ( \cdot | \nu ( s ) ) \underset { s , a } { \operatorname* { m a x } } | R ( s , a ) | } \\ & { \qquad \leq \Bigl ( \displaystyle \frac { 2 \gamma } { ( 1 - \gamma ) ^ { 2 } } + \frac { 2 } { 1 - \gamma } \Bigr ) \underset { s } { \operatorname* { m a x } } D _ { T V } \bigl ( \pi ( \cdot | s ) , \pi ( \cdot | \nu ( s ) ) \bigr ) \underset { s , a } { \operatorname* { m a x } } | R ( s , a ) | . } \end{array}
+$$
+
+Finally, we will prove Theorem 4 by using the similar method of Theorem 3.
+
+Theorem 4. For any policy $\pi$ in MDP $\mathcal { M } = ( S , \mathcal { A } , \mathcal { P } , \mathcal { R } , \gamma )$ and any disturbed environment $\hat { \mathcal { M } } = ( S , \mathcal { A } , \hat { \mathcal { P } } , \mathcal { R } , \gamma )$ , the reduction of cumulative reward against the transition disturbance is
+
+$$
+J _ { \mathcal { M } } ( \pi ) - J _ { \hat { \mathcal { M } } } ( \pi ) = \frac { \gamma } { 1 - \gamma } \mathbb { E } _ { s \sim d _ { \hat { \mathcal { M } } } ^ { \pi } } \mathbb { E } _ { a \sim \pi } \mathbb { E } _ { s ^ { \prime } \sim \hat { P } } \left( 1 - \frac { P ( s ^ { \prime } | s , a ) } { \hat { P } ( s ^ { \prime } | s , a ) } \right) V _ { \mathcal { M } , \pi } ( s ^ { \prime } ) .
+$$
+
+Furthermore, we can give a upper bound of the reduction is therefore
+
+$$
+J _ { \mathcal { M } } ( \pi ) - J _ { \hat { \mathcal { M } } } ( \pi ) \leq \frac { 2 \gamma } { 1 - \gamma } \operatorname* { m a x } _ { s , a } D _ { T V } ( P ( \cdot | s , a ) , \hat { P } ( \cdot | s , a ) ) \hat { V } _ { \mathcal { M } , \pi } .
+$$
+
+Proof. Similarly, considering the bellman equation of value function of $\pi$ in $\mathcal { M } , \hat { \mathcal { M } }$ , we have
+
+$$
+\begin{array} { l } { { \displaystyle V _ { \mathcal { M } , \pi } ( s ) = \sum _ { a } \pi ( a | s ) [ R ( s , a ) + \gamma \sum _ { s ^ { \prime } } P ( s ^ { \prime } | s , a ) V _ { \mathcal { M } , \pi } ( s ^ { \prime } ) ] } , } \\ { { \displaystyle V _ { \hat { \mathcal { M } } , \pi } ( s ) = \sum _ { a } \pi ( a | s ) [ R ( s , a ) + \gamma \sum _ { s ^ { \prime } } \hat { P } ( s ^ { \prime } | s , a ) V _ { \hat { \mathcal { M } } , \pi } ( s ^ { \prime } ) ] . } } \end{array}
+$$
+
+By subtracting them, we have
+
+$$
+\begin{array} { r l r } & { } & { { \cal V } _ { \hat { \mathcal M } , \pi } ( s ) - { \cal V } _ { \mathcal M , \pi } ( s ) = \gamma \displaystyle \sum _ { a } \pi ( a \vert s ) \sum _ { s ^ { \prime } } ( \hat { P } ( s ^ { \prime } \vert s , a ) - P ( s ^ { \prime } \vert s , a ) ) { \cal V } _ { \mathcal M , \pi } ( s ^ { \prime } ) } \\ & { } & { \quad \quad \quad + \gamma \displaystyle \sum _ { a } \pi ( a \vert s ) \sum _ { s ^ { \prime } } \hat { P } ( s ^ { \prime } \vert s , a ) ( { \cal V } _ { \hat { \mathcal M } , \pi } ( s ^ { \prime } ) - { \cal V } _ { \mathcal M , \pi } ( s ^ { \prime } ) ) . } \end{array}
+$$
+
+Since equation (26) satisfies for every state $s$ , thus we calculate the expectation of equation (26) for $s \sim d _ { \mathcal { M } } ^ { \hat { \pi } _ { \nu } }$ and use Lemma 1:
+
+$$
+\begin{array} { r l } & { \quad \sum _ { \nu } d _ { \mathcal { M } } ^ { \nu } ( s ) [ F _ { A , \nu } ( s ) - V _ { M , \tau } ( \hat { s } ) ] } \\ & { = \gamma \sum _ { \nu } d _ { \mathcal { M } , \nu } ^ { \nu } \langle s \rangle \sum _ { \alpha } ( \alpha ) | s \rangle \sum _ { \nu } ^ { \nu } \left( \hat { P } ( s ) | s , \alpha ) - P ( s ^ { \nu } | s , \alpha ) | V _ { A , \alpha } ( s ^ { \nu } ) \right. } \\ & { \quad + \gamma \sum _ { \nu } \sum _ { \alpha } d _ { \mathcal { M } ^ { \nu } } ^ { \nu } \langle s \rangle \sum _ { \alpha } \pi ( s ) | s \rangle \sum _ { \nu } ^ { \nu } \hat { P } ( s ^ { \nu } | s , \alpha ) | V _ { A , \alpha } ( s ^ { \nu } ) - V _ { M , \tau } ( s ^ { \nu } ) \ } \\ & { \quad \left. = \gamma \sum _ { \nu } \frac { d _ { \mathcal { M } ^ { \nu } } ^ { \nu } ( s ) } { d _ { \mathcal { M } } ^ { \nu } ( s ) } \sum _ { \alpha } \pi ( s ) | s \rangle \sum _ { \nu } ^ { \nu } \left( \hat { P } ( s ^ { \nu } | s , \alpha ) - P ( s ^ { \nu } | s , \alpha ) | V _ { A , \alpha } ( s ^ { \nu } ) \right. \right. } \\ & { \quad \left. + \sum _ { \nu } ( V _ { A , \alpha } ( s ^ { \nu } ) - V _ { M , \tau } ( s ^ { \nu } ) ) \sum _ { \alpha } e ^ { - \alpha \int _ { \alpha } ^ { \tau } ( s ^ { \nu } ) } \sum _ { \nu } \pi ( s ) | s \rangle \sum _ { \alpha } \pi ( s ) | s \rangle \hat { P } ( s ^ { \nu } | s , \alpha ) \right) } \\ & { \quad \times \sum _ { \nu } \hat { Q } _ { K , \alpha } ^ { \nu } ( s ^ { \nu } ) - V _ { M , \tau } ( s ^ { \nu } ) \sum _ { \nu } \hat { Q } _ { K , \alpha } ^ { \nu } ( s ) \sum _ { \alpha } \pi ( s ) | s \rangle \sum _ { \alpha } \hat { Q } ( s ^ { \nu } ) | s \rangle \hat { Q } ( s ^ { \nu } | s , \alpha ) \hat { Q } ( s ^ { \nu } ) } \\ & \quad \times \sum _ { \nu } \hat { Q } _ { K , \alpha } ^ { \nu } ( s ) \sum _ { \alpha } \pi ( \end{array}
+$$
+
+Similarly, by moving the second term of the right part in (37) to the left part, we can deduce that
+
+$$
+\begin{array} { r l r } { { ( 1 - \gamma ) \sum _ { s ^ { \prime } } ( V _ { \hat { \mathcal { M } } , \pi } ( s ^ { \prime } ) - V _ { \mathcal { M } , \pi } ( s ^ { \prime } ) ) P ( s _ { 0 } = s ^ { \prime } ) } } \\ & { } & { \quad = \gamma \sum _ { s } d _ { \hat { \mathcal { M } } } ^ { \pi } ( s ) \sum _ { a } \pi ( a | s ) \sum _ { s ^ { \prime } } ( \hat { P } ( s ^ { \prime } | s , a ) - P ( s ^ { \prime } | s , a ) ) V _ { \mathcal { M } , \pi } ( s ^ { \prime } ) , } \end{array}
+$$
+
+thus:
+
+$$
+\begin{array}{c} ( 1 - \gamma ) ( J _ { \hat { \mathcal { M } } } ( \pi ) - J _ { \mathcal { M } } ( \pi ) ) = ( 1 - \gamma ) \sum _ { s ^ { \prime } } ( V _ { \hat { \mathcal { M } } , \pi } ( s ^ { \prime } ) - V _ { \mathcal { M } , \pi } ( s ^ { \prime } ) ) P ( s _ { 0 } = s ^ { \prime } ) \\ { = \gamma \sum _ { s } d _ { \hat { \mathcal { M } } } ^ { \pi } ( s ) \sum _ { a } \pi ( a | s ) \sum _ { s ^ { \prime } } ( \hat { P } ( s ^ { \prime } | s , a ) - P ( s ^ { \prime } | s , a ) ) V _ { \mathcal { M } , \pi } ( s ^ { \prime } ) } \\ { = \gamma \mathbb { E } _ { s \sim d _ { \hat { \mathcal { M } } } ^ { \pi } } \mathbb { E } _ { a \sim \pi ( \cdot | s ) } \mathbb { E } _ { s ^ { \prime } \sim \hat { P } ( \cdot | s , a ) } \left( 1 - \frac { P ( s ^ { \prime } | s , a ) } { \hat { P } ( s ^ { \prime } | s , a ) } \right) V _ { \mathcal { M } , \pi } ( s ^ { \prime } ) . } \end{array}
+$$
+
+Thus we have proven:
+
+$$
+J _ { \mathcal { M } } ( \pi ) - J _ { \hat { \mathcal { M } } } ( \pi ) = \frac { \gamma } { 1 - \gamma } \mathbb { E } _ { s \sim d _ { \hat { \mathcal { M } } } ^ { \pi } } \mathbb { E } _ { a \sim \pi ( \cdot \vert s ) } \mathbb { E } _ { s ^ { \prime } \sim \hat { P } ( \cdot \vert s , a ) } \left( 1 - \frac { P ( s ^ { \prime } \vert s , a ) } { \hat { P } ( s ^ { \prime } \vert s , a ) } \right) V _ { \mathcal { M } , \pi } ( s ^ { \prime } ) .
+$$
+
+Similarly, we consider VFR $\begin{array} { r } { \hat { V } _ { M , \pi } = \operatorname* { m a x } _ { s ^ { \prime } } V _ { M , \pi } ( s ^ { \prime } ) - \operatorname* { m i n } _ { s ^ { \prime } } V _ { M , \pi } ( s ^ { \prime } ) } \end{array}$ and we have $| V _ { M , \pi } ( s ) -$ $\begin{array} { r } { \hat { V } _ { M , \pi } | \leq \frac { \hat { V } _ { M , \pi } } { 2 } } \end{array}$ VˆM,π for every state s, thus we can prove:
+
+$$
+\begin{array} { r l } & { \displaystyle | J _ { M } ( \pi ) - J _ { M } ( \hat { \pi } _ { \nu } ) | \leq \frac { \gamma } { 1 - \gamma } \mathbb { E } _ { s \sim d _ { \bar { M } } ^ { \pi } } \mathbb { E } _ { a \sim \pi \left( \cdot \vert s \rangle \right) } \mathbb { E } _ { s ^ { \prime } \sim \hat { P } ( \cdot \vert s , a ) } \left. 1 - \frac { P \left( s ^ { \prime } \vert s , a \right) } { \hat { P } \left( s ^ { \prime } \vert s , a \right) } \right. \left. V _ { M , \pi } ( s ^ { \prime } ) - \hat { V } _ { M , \pi } \right. } \\ & { \qquad \leq \frac { \gamma } { 1 - \gamma } \mathbb { E } _ { s \sim d _ { \bar { M } } ^ { \pi } } \mathbb { E } _ { a \sim \pi \left( \cdot \vert s \rangle \right) } \mathbb { E } _ { s ^ { \prime } \sim \hat { P } ( \cdot \vert s , a ) } \left. 1 - \frac { P \left( s ^ { \prime } \vert s , a \right) } { \hat { P } \left( s ^ { \prime } \vert s , a \right) } \right. \frac { \hat { V } _ { M , \pi } } { 2 } } \\ & { \displaystyle = \frac { \gamma } { 1 - \gamma } \mathbb { E } _ { s \sim d _ { \bar { M } } ^ { \pi } } \mathbb { E } _ { a \sim \pi \left( \cdot \vert s \rangle \right) } \sum _ { s ^ { \prime } } \left. \hat { P } \left( s ^ { \prime } \vert s , a \right) - P ( s ^ { \prime } \vert s , a ) \right. \frac { \hat { V } _ { M , \pi } } { 2 } } \\ & { \displaystyle = \frac { \gamma } { 1 - \gamma } \mathbb { E } _ { s \sim d _ { \bar { M } } ^ { \pi } } \mathbb { E } _ { a \sim \pi \left( \cdot \vert s \rangle \right) } D _ { T V } ( P ( \cdot \vert s , a ) , \hat { P } ( \cdot \vert s , a ) ) \hat { V } _ { M , \pi } . } \end{array}
+$$
+
+Thus we have proven Theorem 4.
+
+# B.6 THE PROOF OF THEOREM 5
+
+By Theorem 1, we have
+
+$$
+\begin{array} { r l } & { - \mathrm { C V a R } _ { \alpha } ( - V ( s ) ) = \mathbb { E } _ { z \sim V ( s ) } \{ z | z \le - \mathrm { V a R } _ { \alpha } ( - V ( s ) ) \} } \\ & { \quad \quad \quad \quad = \mathbb { E } _ { \tau } \{ D ( \tau ) | V ( s _ { 0 } ) \le - \mathrm { V a R } _ { \alpha } ( - V ( s ) ) \} } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \ge \mathbb { E } _ { \tau } \{ D ( \tau ) | D ( \tau ) \le - \mathrm { V a R } _ { \alpha } ( - D ( \tau ) ) \} } \\ & { \quad \quad \quad \quad = - \mathrm { C V a R } _ { \alpha } ( - D ( \tau ) ) . } \end{array}
+$$
+
+Here the inequality holds since $P ( V ( s _ { 0 } ) \leq - \mathrm { V a R } _ { \alpha } ( - V ( s ) ) ) = P ( D ( \tau ) \leq - \mathrm { V a R } _ { \alpha } ( - D ( \tau ) ) ) =$ $\alpha$ . Thus we have proven Theorem 5.
\ No newline at end of file
diff --git a/md/dev/tGHi1HFNBx1/tGHi1HFNBx1.md b/md/dev/tGHi1HFNBx1/tGHi1HFNBx1.md
new file mode 100644
index 0000000000000000000000000000000000000000..b0e38bf31860ddec63432d1a04995ffb9030cc21
--- /dev/null
+++ b/md/dev/tGHi1HFNBx1/tGHi1HFNBx1.md
@@ -0,0 +1,1040 @@
+# DATA SUBSET SELECTION VIA MACHINE TEACHING
+
+Anonymous authors Paper under double-blind review
+
+# ABSTRACT
+
+We study the problem of data subset selection: given a fully labeled dataset and a training procedure, select a subset such that training on that subset yields approximately the same test performance as training on the full dataset. We propose an algorithm, inspired by recent work in machine teaching, that has theoretical guarantees, compelling empirical performance, and is model-agnostic meaning the algorithm’s only information comes from the predictions of models trained on subsets. Furthermore, we prove lower bounds that show that our algorithm achieves a subset with near-optimal size (under computational hardness assumptions) while training on a number of subsets that is optimal up to extraneous log factors. We then empirically compare our algorithm, machine teaching algorithms, and coreset techniques on six common image datasets with convolutional neural networks. We find that our machine teaching algorithm can find a subset of CIFAR10 of size less than 16k that yields the same performance ( $5 \%$ error) as training on the full dataset of size 50k.
+
+# 1 INTRODUCTION
+
+Machine learning has made tremendous progress in the past two years with large models such as GPT-3 and CLIP (Brown et al., 2020; Radford et al., 2021). A key ingredient in these milestones is increasing the amount of training data to Internet scale. However, large datasets come with a cost, and not all – or maybe not even most – training data is useful. Data subset selection addresses this practical issue with the goal of finding a subset of a dataset so that training on the subset yields approximately the same test performance as training on the full dataset (Wei et al., 2015). Applications of data subset selection include continual learning (Aljundi et al., 2019; Borsos et al., 2020; Yoon et al., 2021), experience replay (Schaul et al., 2016; Hu et al., 2021), curriculum learning (Bengio et al., 2009; Wang et al., 2021), and data-efficient learning (Killamsetty et al., 2021a). Additionally, data subset selection is closely related to active learning (Settles, 2009; Sener & Savarese, 2018) and to fundamental questions about the role of data in learning (Toneva et al., 2018).
+
+Data subset selection has been studied in two quite different contexts. First, perhaps the more popular approaches are found in the coreset literature (Sener & Savarese, 2018; Coleman et al., 2020; Mirzasoleiman et al., 2020; Paul et al., 2021), an empirically driven (Guo et al., 2022) research area that includes a variety of techniques to select important and diverse points, often with an eye towards minimal computational cost of subset selection. Second, machine teaching (Goldman & Kearns, 1995; Shinohara & Miyano, 1991) focuses on minimizing the number of examples a teacher must present to a learner and can be reframed as data subset selection in some settings. As machine teaching has mostly been studied from a conceptual or theoretical viewpoint, black-box models such as modern neural networks present a practical challenge for machine teaching. However, recently, a theoretical breakthrough in the machine teaching literature (Dasgupta et al., 2019; Cicalese et al., 2020) formalizes and provides algorithms with analysis for teaching black-box learners. Although these works are mainly theoretical, they also include some limited empirical evaluation, though with implementations that include unjustified heuristics. Furthermore, Dasgupta et al. (2019) includes no baselines and Cicalese et al. (2020) only includes random sampling as a baseline. As of yet, the two algorithms have not been compared in the literature, much less to other coreset methods.
+
+In this work, we bring together these two lines of research, through both theoretical analysis and empirical evaluation. We make a clear connection between a particular machine teaching setting and data subset selection, use this insight to introduce an algorithm with state of the art and near-optimal asymptotics, prove correctness of implementation heuristics from previous machine teaching work, and empirically evaluate methods from both machine teaching and coreset selection on a standard set of benchmarks for the first time. The subset size returned by our machine teaching algorithm shaves off a factor logarithmic in the dataset size compared to existing work. Furthermore, through novel lower bounds, we show that the subset size of our algorithm is near-optimal (under computational hardness assumptions regarding the NP-complete class of problems) and that the expected number of times we must query the learner (train a network) is optimal up to extraneous log factors.
+
+Existing machine teaching algorithms from Dasgupta et al. (2019); Cicalese et al. (2020) perform well when our learner fits labels perfectly (zero training error) but fail catastrophically if the learner makes a few training errors. To address this issue, prior work (Cicalese et al., 2020) removes the training errors from the predictions provided to the teacher, a technique we refer to as error squashing. We provide a rigorous theoretical framework that explains why this technique of squashing errors is justified and effective, and furthermore, use it in our algorithm.
+
+Finally, and perhaps most importantly, we compare machine teaching algorithms, including ours, to state-of-the-art coreset selection techniques and random sampling. We perform experiments with three convolutional neural network architectures on six image datasets (CIFAR10, CIFAR100, CINIC10, MNIST, Fashion MNIST, SVHN). We find that the machine teaching algorithms all perform roughly the same and consistently match or outperform the coreset selection techniques.
+
+In summary, our main contributions are:
+
+• Proposing a machine teaching subset selection algorithm with analysis and lower bounds, showing that the algorithm achieves optimal asymptotic performance up to extraneous log factors.
+• Providing the first analysis for the justification of error squashing.
+• Experimentally comparing machine teaching algorithms and coreset techniques using three convolutional neural network architectures on six image datasets.
+
+In Sections 2 and 3, we introduce the classification setting and present our algorithm with its guarantee. Next, we show our main theoretical results in Section 4 and experimental results in Section 5. Finally, we discuss our work within the context of related work in Sections 6 and 7.
+
+# 2 SETTING
+
+We work in a classification setting with an input space $\mathcal { X }$ and a finite output space $\mathcal { V }$ . Given a distribution $\mathcal { D }$ over $\mathcal { X } \times \mathcal { V }$ , we wish to find a classifier $h : \mathcal { X } \mathcal { Y }$ with low (test) error: $\operatorname { e r r } ( h ) =$ $\operatorname* { P r } _ { ( x , y ) \sim \mathcal { D } } [ h ( x ) \neq y ]$ .
+
+In this work, we assume we have a hypothesis class $\mathcal { H }$ and a learner $L$ , where each $h \in \mathcal H$ is a function $h : \mathcal { X } \to \mathcal { Y }$ and the learner is a function: $L : ( \mathcal { X } \times \mathcal { Y } ) ^ { * } \to \mathcal { H }$ .
+
+We assume we have a pool of $m$ labeled data points, $\{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { m } \subset ( \mathcal { X } \times \mathcal { Y } ) ^ { m }$ . The objective of data subset selection is to select a subset $S \subset [ m ]$ of small size $| S |$ such that $\operatorname { e r r } ( L ( \{ ( x _ { i } , \overbar y _ { i } ) : i \in$ $S \}$ ) is low; perhaps as low as the error of training on all data: $\operatorname { e r r } ( L ( \{ ( x _ { i } , y _ { i } ) : i \in [ m ] \} )$ ).
+
+# 3 METHOD
+
+Although our ultimate objective is low test error, without a comprehensive understanding of generalization for models such as neural networks, we instrumentally focus on achieving low error on the pool of $m$ datapoints. Zhang et al. (2021) show that modern neural networks can exactly fit arbitrary (even random) ground truth labels. Following previous machine teaching work, we initially assume that the learner makes no errors on the training subset, and refer to these learners as interpolating learners. Note that for interpolating learners, we can always achieve zero pool error if we train with the entire pool. However, it may be possible to select a smaller subset that yields zero pool error. Later, we relax this assumption as it is only approximately true in practice.
+
+# 3.1 MAIN ALGORITHM
+
+In this section, we present our algorithm (see Algorithm 1 for pseudo-code). Our algorithm is an iterative algorithm, where each iteration is composed of three steps: sampling a subset of the pool, training on that subset, and using the results of training to update the subset sampling distribution. The intuitive principle behind our algorithm is that if we train on a subset $S \subset [ m ]$ and receive a hypothesis $h \in \mathcal H$ , we want to emphasize the points (i.e., include some of the points in future subsets) where the hypothesis makes errors with respect to the ground truth labels. Then, in future iterations, that same hypothesis will not be returned by an interpolating learner since the hypothesis would make an error on the subset.
+
+At each iteration, the algorithm samples a subset $S _ { t }$ and trains on that subset to yield a hypothesis $h _ { t }$ . For sampling a subset at the $t ^ { t h }$ iteration, the algorithm independently samples Bernoulli random variables with probability $p _ { t , i }$ , and upon success, includes the $i ^ { t h }$ point. The success probability of the Bernoulli variable for the $i ^ { t h }$ point at the $t ^ { t h }$ iteration is $p _ { t , i }$ and we sample a set $S _ { t }$ such that $\begin{array} { r } { \operatorname* { P r } ( S _ { t } = S ) = \left( \prod _ { i \in S } p _ { t , i } \right) \left( \prod _ { i \in [ m ] \backslash S } ( 1 - p _ { t , i } ) \right) } \end{array}$ . Thus, in order to emphasize errors, the algorithm sets the next iteration’s Bernoulli to have higher success probability $( p _ { t + 1 , i } > p _ { t , i } )$ .
+
+While there are a variety of ways to increase the probabilities, our algorithm calculates the errors $E _ { t } : = E _ { h _ { t } }$ (where $E _ { h } = \{ i \in [ m ] : h ( x _ { i } ) \neq y _ { i } \} \quad$ ) on the entire pool made by the hypothesis $h _ { t }$ and sequentially doubles the probabilities corresponding to the errors until $\textstyle \sum _ { i \in E _ { t } } p _ { t , i }$ is sufficiently large (larger than a hyperparameter, $\xi$ ). Since a probability might exceed 1 after this step, we subsequently clip the probabilities to 1.
+
+Because the algorithm only updates probabilities via doubling, a natural choice is to initialize $p _ { 1 , i }$ as a (negative) power of 2: $2 ^ { - k _ { 0 } }$ for some integer $k _ { 0 }$ . Then, $p _ { t , i }$ is always a power of two, since doubled powers of 2 are powers of 2.
+
+The final aspect of the algorithm is that we periodically halve all probabilities. This step is key to improving the guarantee on the size of the subset from previous work (Dasgupta et al., 2019; Cicalese et al., 2020) to the asymptotically near-optimal subset size in this work. Note that without this halving step, the probabilities only increase with the number of iterations.
+
+Our algorithm has two hyperparameters, $\hat { d }$ and $\hat { N }$ , which are used to set the doubling limit $\xi$ , the initial power $k _ { 0 }$ , and the number of iterations between halving the probabilities. The algorithm will succeed with high probability if the two hyperparameters are upper bounds on $d ^ { * }$ , the size of the smallest subset that yields zero pool errors, and $N$ , the size of the induced hypothesis set, a set we will define in the next section. Conveniently, in the cases where the algorithm fails, it returns whether $\hat { d }$ was too small or $\hat { N }$ was too small. We can set $\hat { d }$ and $\hat { N }$ to be arbitrarily large to yield valid subsets, but the size of the resulting subsets will be very large. See Algorithm 1 for pseudo-code.
+
+# 3.2 ALGORITHMIC ANALYSIS
+
+For the analysis, we begin by assuming that our learner is interpolating, meaning that it makes no errors on the subset it is trained on. More precisely, if $h _ { S } = L ( \{ ( x _ { i } , y _ { i } ) : i \in S \} )$ ) where $S \subset [ m ]$ , then $\forall i \in S : h _ { S } ( x _ { i } ) = y _ { i }$ . Note that this implies that if we train on the entire dataset, a hypothesis that makes zero pool errors is returned.
+
+Define $\overline { { \mathcal { H } } }$ as the induced hypothesis class, that is, all hypotheses that can be returned by training on a subset: $\overline { { \mathscr { H } } } = \{ L ( \{ ( x _ { i } , y _ { i } ) : i \in S \} ) : S \subset [ m ] \}$ . Note that the size of $\overline { { \mathcal { H } } }$ could be as large as $2 ^ { m }$ (the number of subsets) but can be much smaller if the data has structure that can be leveraged by the model. Our framework technically requires a deterministic learner and we can fix the random seed for training; however, this is not a practical issue as it is extremely unlikely that we will train a model on the exact same subset at two different iterations.
+
+We now define $d ^ { * }$ and $N$ . Let $E _ { h }$ be the errors of a hypothesis $h$ : $E _ { h } = \{ i \in [ m ] : h ( x _ { i } ) \neq y _ { i } \}$ . Let $\mathcal { E }$ be the set of possible errors: $\mathcal { E } = \{ E _ { h } : h \in \overline { { \mathcal { H } } } \} - \{ \emptyset \}$ . We say a set $S$ “fully intersects” $\mathcal { E }$ if for all $E _ { h } \in \mathcal { E }$ , $| S \cap E _ { h } | \geq 1$ . Note that an interpolating learner trained on a fully intersecting subset $S$ will yield 0 pool error; if not, then the returned hypothesis $h _ { t }$ would have non-zero training error on the subset $S _ { t }$ which contradicts the interpolating assumption. Let $d ^ { * }$ be the size of smallest
+
+# Algorithm 1
+
+Input: examples $\{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { m } \subset ( \mathcal { X } \times \mathcal { Y } ) ^ { m }$ , failure probability $\delta$ , $\hat { d } \in \mathbb { Z } _ { + }$ , $\hat { N } \in \mathbb { Z } _ { + }$
+$k _ { 0 } = \lfloor \log _ { 2 } ( m / \hat { d } ) \rfloor$
+$\xi = \ln ( 4 \hat { N } ^ { 2 } \log _ { 2 } ( m ) / \delta )$
+$\forall i : k _ { 1 , i } = k _ { 0 }$
+for $t = 1 , 2 , \ldots , 4 \hat { d } k _ { 0 }$ do Sample $S _ { t }$ such that $i \in S _ { t }$ independently with probability $p _ { t , i } = 2 ^ { - k _ { t , i } }$ Train $h _ { t } = L ( \{ ( x _ { i } , y _ { i } ) \} _ { i \in S _ { t } } )$ Calculate the errors of $h _ { t }$ on the pool: $E _ { t } : = E _ { h _ { t } } = \{ i \in [ m ] : h _ { t } ( x _ { i } ) \neq y _ { i } \}$ if $| E _ { t } | = 0$ then return SUCCESS: $\hat { S } = S _ { t }$ else if $\textstyle \sum _ { i \in E _ { t } } p _ { t , i } \geq \xi$ then return FAILURE TYPE 1: $\hat { N }$ is too small else $\begin{array} { r l } & { \mathbf { \Phi } _ { \Delta _ { t } } ^ { \mathbf { x } } = \left\lceil \log _ { 2 } \left( \frac { \xi } { \sum _ { i \in E _ { t } } p _ { t , i } } \right) \right\rceil } \\ & { k _ { t + 1 , i } = \operatorname* { m a x } ( 0 , k _ { t , i } - \Delta _ { t } \mathbf { 1 } [ i \in E _ { t } ] + \mathbf { 1 } [ t ( \operatorname { m o d } ) 2 \hat { d } = 0 ] ) } \end{array}$ end if end if
+end for
+return FAILURE TYPE 2: $\hat { d }$ is too small
+
+fully intersecting set, that is, $d ^ { * } : = \arg \operatorname* { m i n } _ { S \subset [ m ] } | S |$ subject to $| S \cap E _ { h } | \geq 1$ $\forall E _ { h } \in \mathcal { E }$ . With these definitions, we are ready to give our algorithmic analysis theorem.
+
+Theorem 1. Suppose $\hat { d } \geq d ^ { * }$ and $\hat { N } \geq N : = | \overline { { \mathcal { H } } } |$ . Then, with probability at least $1 - \delta$ , Algorithm 1 returns successfully within $O ( d ^ { * } \log ( m / d ^ { * } ) )$ queries to the learner and the size of the returned set is $| \hat { S } | = O ( \hat { d } ( \log \hat { N } + \log \log m + \log ( 1 / \delta ) )$ .
+
+The proof of Theorem 1 is in Appendix D. Note that the $\log \log m$ term is negligible, for example, it can be ignored (subsumed in the constants) if $m \leq 2 ^ { N }$ which is true in reasonable cases. In Section 4, we provide lower bounds showing that the number of queries to the learner is asymptotically optimal up to extraneous log factors and that the size of the returned subset is asymptotically optimal (with a computational hardness assumption) if we assume $\log \log m$ is a low-order term compared to $\log N$ and that $\delta$ is a small constant. To choose the hyperparameters $\hat { d }$ and $\xi = \Theta ( \log \hat { N } )$ , we can use a doubling approach to find a constant factor approximation to $d ^ { * }$ and $\log N$ .
+
+# 3.3 NON-INTERPOLATING LEARNERS
+
+For non-interpolating learners, Algorithm 1 might never return successfully even for a single training error. To remedy this, we can “squash” the training errors, that is, remove the points from $E _ { t }$ that also appear in $S _ { t }$ . More precisely, when we calculate errors on the pool, instead of defining $E _ { t } = \{ i \in \bar { [ m ] } : h _ { t } ( x ) \neq y _ { i } \}$ , define $\dot { E } _ { t } = \{ i \in [ m ] : h _ { t } ( x ) \neq y _ { i } \land i \notin \bar { S } _ { t } \}$ . For the experiments, we run Algorithm 1 with this edit. This error squashing technique is used beyond our algorithm. This technique is explicitly used for the experiments in Cicalese et al. (2020) and likely a similar approach is used for Dasgupta et al. (2019) as we found experimentally that the algorithm dramatically fails, as written, without error squashing. Similar to this paper, the algorithmic analysis of Cicalese et al. (2020) assumes interpolating learners, but the practical algorithm includes error squashing.
+
+# 4 THEORY
+
+In this section, we first cover notation definitions, a particular class of learners, and the equivalence between machine teaching and the classic set cover problem. Next, we cover our lower bounds and results for the error squashing technique.
+
+# 4.1 NOTATION DEFINITIONS
+
+Let $\mathbb { Z }$ denote the set of integers and $\mathbb { Z } _ { + }$ denote the set of positive integers. Let $[ k ] = \{ 1 , 2 , \dots , k \}$ . For a set $S$ , let ${ \mathcal { P } } ( S )$ denote the power set of $S$ . For a set $S$ , let $S ^ { k }$ be the repeated Cartesian product; for example, $S ^ { 3 } = S \times S \times S$ . Let ${ \widetilde { O } } ( \cdot )$ denote $O ( \cdot )$ where extraneous log factors are ignored. In particular, $O ( f ( n ) \log ^ { k } ( f ( n ) ) = { \widetilde O } ( f ( n ) )$ .
+
+# 4.2 RANKED MINIMAL ERROR LEARNERS
+
+Here, we define a type of learner that appears in the constructions for our lower bounds and is given as an example in the error squashing framework. Intuitively, a ranked minimal error learner is a learner with a hypothesis class $\mathcal { H }$ and a ranking $\sigma$ such that the learner returns the lowest ranked hypothesis that has minimal error.
+
+Definition 1. Let $\mathcal { X }$ and $\mathcal { V }$ be finite. We say a learner $L$ is a ranked minimal error learner if there exists a (finite) hypothesis class $\mathcal { H }$ and a bijection $\sigma : { \mathcal { H } } [ | { \mathcal { H } } | ]$ such that for any $D \subset \mathcal { P } ( \mathcal { X } \times \mathcal { Y } )$ , with $\begin{array} { r } { k = \operatorname* { m i n } _ { h \in \mathcal { H } } | \{ ( x , y ) \in D : h ( x ) \neq \dot { y } \} | } \end{array}$ , $\begin{array} { r } { L ( D ) = \arg \operatorname* { m i n } _ { h : | \{ ( x , y ) \in D : h ( x ) \neq y \} | = k } \sigma ( h ) . } \end{array}$ .
+
+Note that since we focus on fixed datasets and classification in this work, finite $\mathcal { X }$ and $\mathcal { V }$ are not a restriction for our purposes. If we assume the ground truth labels are generated by a member of the hypothesis class, $\exists h ^ { * } \in { \mathcal { H } } : \forall ( x , y ) \in D : y = h ^ { * } ( x )$ , then the learner is an interpolating learner.
+
+# 4.3 LOWER BOUNDS
+
+We present two lower bounds that are query-based lower bounds proved using similar techniques. In particular, we construct a ranked minimal error learner with a special structure that depends on a random “key” (e.g., a random vector). We show that even if the teacher knew all the structure of the learner except the random key, any teaching algorithm will not be able to return a subset of size $\lambda d ^ { * }$ (a $\lambda$ -approximation) with few queries and probability greater than $1 / 2$ .
+
+Theorem 2. Fix any $\lambda \geq 1$ and $m \geq 2 \lambda$ . There exists a distribution over interpolating ranked minimal error learners and an $m$ -sized dataset with optimal subset size $d ^ { * }$ , such that any teaching algorithm requires $2 ^ { \Omega ( m / \lambda ) }$ queries to achieve at most $\lambda d ^ { * }$ subset size with probability at least $1 / 2$ .
+
+The proof is in Appendix E.1. This would appear to be very bad news: we require an exponential number of queries to even achieve a valid subset that is a factor $\lambda$ larger than the optimal subset. Fortunately, as shown later, we can not in general approximate the optimal subset to a factor of $o ( \log N )$ (asymptotically strictly better than $\log N )$ . Furthermore, $N$ is very large in the construction for Theorem 2; so large that $\log N = \Theta ( m )$ . Thus, if we are content with an approximation guarantee of ${ \cal O } ( \log N )$ , then far fewer queries to the learner are required, as the existence of Algorithm 1 shows.
+
+Theorem 3. Fix any $k \geq 1$ , $\ell \geq 1$ , and $\lambda \geq 1$ . There exists a distribution over interpolating ranked minimal error learners and a dataset of size $m = k ( \left\lceil e \lambda \right\rceil ) ^ { \ell }$ with optimal subset size $d ^ { * } = k$ and $N = O ( k \ln ( m / k ) / \ln ( \lambda ) )$ , such that any teaching algorithm requires $\Omega \left( \frac { d ^ { * } \ln ( m / d ^ { * } ) } { \ln ^ { 2 } ( \lambda ) } \right)$ queries to achieve at most $\lambda d ^ { * }$ subset size with probability at least $1 / 2$ .
+
+The proof is in Appendix E.2. Note that this implies achieving an approximation ratio of ${ \cal O } ( \log N )$ or $O ( \log m \log N )$ (as found in Cicalese et al. (2020); Dasgupta et al. (2019)) requires $\widetilde \Omega ( d ^ { * } \ln ( m / d ^ { * } ) )$ queries.
+
+We now present a computational hardness lower bound on finding a subset with a small $o ( \log N )$ approximation ratio to optimal, even with unlimited learner queries so that $\overline { { \mathcal { H } } }$ could be explicitly constructed. This result is a straightforward application of the following theorem to the set cover equivalence of machine teaching.
+
+Theorem 4 ((Theorem 4.4 from Feige (1998)). If there is some $\epsilon > 0$ such that a polynomial time algorithm can approximate set cover within $( 1 - \epsilon ) \ln n$ , then $N P \subset T I M E { \big ( } n ^ { O ( \log \log n ) } { \big ) }$ .
+
+Let us interpret this result. For set cover instances, the “size” $n$ of a problem is measured in terms of the number of elements, our $N$ . Feige (1998) defines $\mathrm { T I M E } ( f ( n ) )$ to be the set of problems solvable in $f ( n )$ (determnistic) time. The conclusion ${ \mathrm { N P } } \subset { \mathrm { T I M E } } { \big ( } n ^ { O ( \log \log n ) } { \big ) }$ is slightly weaker than ${ \mathrm { N P } } \subset { \mathrm { T I M E } } ( n ^ { O ( 1 ) } ) = { \mathrm { P } }$ which would imply the famous $P = N P$ . All the same, if it were to be shown that ${ \mathrm { N P } } \subset { \mathrm { T I M E } } { \big ( } n ^ { O ( \log \log n ) } { \big ) }$ , it would revolutionize complexity theory, and thus, it is doubtful that such a statement can be shown to be true without significant obstacles.
+
+Then, a direct result of set cover equivalence (Goldman & Kearns, 1995) and Theorem 4 Feige (1998) is that approximating machine teaching to within $\textstyle { \frac { 1 } { 2 } } \ln N$ would imply NP $\subset$ $\mathrm { T I M E } \big ( n ^ { O ( \log \log n ) } \big )$ .
+
+# 4.4 ERROR SQUASHING FRAMEWORK
+
+In a nutshell, our framework consists of defining a general condition for a learner, defining a teaching set definition for non-interpolating learners, then showing that achieving such a teaching set reduces, by way of error squashing, to a standard set cover problem (if the learner meets the condition). This means that the error squashing technique effortlessly converts any machine teaching algorithm for interpolating learners to a machine teaching algorithm for non-interpolating learners, which inherits the same theoretical guarantees, albeit with a larger hypothesis class.
+
+# 4.4.1 LEARNERS INVARIANT TO CONSISTENT ADDITIONS
+
+In this section, we first define a general condition on a learner: if a learner trained on a dataset correctly predicts a point, then additionally including that point in the dataset does not change the the learner’s predictions.
+
+Definition 2 (Invariant to consistent additions). We say a learner is invariant to consistent additions $i f \forall D \subset \mathcal { P } ( \mathcal { X } \times \mathcal { Y } )$ , $x \subset \mathcal { X }$ , $y \subset \mathcal { V }$ : $L ( D ) ( x ) = y \implies L ( D ) = L ( D \cup \{ ( x , y ) \} )$ .
+
+Intuitively, for models that minimize error, adding a point with zero loss will not change the model. In particular, we have the following proposition:
+
+Proposition 1. A ranked minimal error learner is invariant to consistent additions.
+
+The proof of Proposition 1 can be found in Appendix F. The invariance to consistent additions is more general than ranked minimal error learners: see an example in Appendix F.7.1.
+
+# 4.4.2 ERROR INCLUSIVE TEACHING SETS
+
+Recall that error squashing with machine teaching means that when the learner is passed a subset $S _ { t }$ and returns a hypothesis $h _ { t }$ , the teacher acts as if the hypothesis makes no errors on the subset $S _ { t }$ . Machine teaching algorithms only terminate when the returned hypothesis makes no errors on the pool, which means that all the errors of $h _ { t }$ are squashed with respect to $S _ { t }$ . For a fixed dataset and learner, we say a set $S$ is “error inclusive” if all errors of $L ( S )$ are inside $S$ . Formally, for a fixed dataset $\{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { m }$ , define $L ^ { ( \mathrm { e r r } ) } : \mathcal { P } ( [ m ] ) \mathcal { P } ( [ m ] )$ as the set of indices of points where errors are made by a learner trained on a subset $S$ : $L ^ { \mathrm { ( e r r ) } } ( S ) = \{ i \in [ m ] : L ( \{ ( x _ { i ^ { \prime } } , y _ { i ^ { \prime } } ) : i ^ { \prime } \in S \} ) ( x _ { i } ) \neq$ $y _ { i } \}$ .
+
+Definition 3. For a fixed dataset, we say a set $S$ is “error inclusive” if $L ^ { ( e r r ) } ( S ) \subset S$
+
+Error inclusivity means that $S$ contains the points useful for generalization outside $S$ , as well as the (presumably) nuisance points that are hard or impossible to classify correctly, such as incorrectly labeled ground truth. An error squashing machine teaching algorithm, if it returns successfully, must return an error inclusive set. An important consequence of error inclusivity is that, for a learner invariant to consistent additions, the learner trained on the set will yield the same result as training on the entire dataset.
+
+Proposition 2. Suppose a learner $L$ is invariant to consistent additions. If a set $S$ is error inclusive, $L ^ { ( e r ) } ( S ) = L ^ { ( e r r ) } ( \dot { [ } \dot { m } ] )$ .
+
+The proof of Proposition 5 is in Appendix F.6. Interpreted further, error inclusivity implies that the number of errors from training on $S$ is the same as the number of errors from training on the entire dataset, $| L ^ { ( \mathrm { e r r } ) } ( S ) | = | L ^ { ( \mathrm { e r r } ) } ( [ \stackrel { } { m } ] ) |$ . Furthermore, error inclusivity implies $L ^ { \mathrm { ( e r r ) } } ( [ m ] ) \stackrel { \textstyle } { \subset } S$ , meaning that $S$ contains the errors of training on the full dataset. Error inclusivity is a condition on a set that we will use as the teaching set condition for non-interpolating learners.
+
+Note that Cicalese et al. (2020) introduce another teaching set condition for non-interpolating learners, $k$ -extended teaching sets. In Appendix F, we compare $k$ -extended teaching sets and error inclusive teaching sets for ranked minimal errors. We find they are remarkably similar, though neither is stronger than the other: there exist examples where the smallest $k$ -extended teaching set is of size $\Theta ( m )$ but there exists an error inclusive set of size $\Theta ( 1 )$ , and vice versa. However, we show error inclusive sets are much easier to design algorithms for.
+
+# 4.4.3 EXTENDED ERROR SETS
+
+Recall that in the context of machine teaching with interpolating learners, we define the errors of a hypothesis as $E _ { h } = \left\{ i \in [ m ] : h ( x _ { i } ) \neq y _ { i } \right\}$ and let $\mathcal { E } = \dot { \{ E _ { h } : h \in \overline { { \mathcal { H } } } \} } - \{ \varnothing \}$ be the error sets. Then a set $S \subset [ m ]$ is a valid teaching set if $S$ fully intersects $\mathcal { E }$ (intersects each element of $\mathcal { E }$ ). Similarly, black-box machine teaching is like a game where elements of $\mathcal { E }$ are revealed by learner queries and a solution $S \subset [ m ]$ must intersect every element. In fact, there is an equivalence between these two views, observed in Goldman & Kearns (1995) as the relationship between set cover and machine teaching. For a more complete exposition, see Appendix F.
+
+Define the extended error sets as ${ \mathcal { E } } ^ { + } = \{ L ^ { \mathrm { ( e r r ) } } ( S ) \setminus S : S \subset [ m ] \} - \{ \emptyset \}$ . For interpolating models, ${ \mathcal { E } } ^ { + } = { \mathcal { E } }$ . If we find a set $S \subset [ m ]$ that fully intersects ${ \mathcal { E } } ^ { + }$ , we are guaranteed that when the learner is trained on $S$ , there will be no errors outside of $S$ : $S$ is error inclusive. Not only this, we show that, in fact, fully intersecting ${ \mathcal { E } } ^ { + }$ is equivalent to error inclusivity.
+
+Proposition 3. Fix a dataset. If a learner is invariant to consistent additions, $S$ fully intersects ${ \mathcal { E } } ^ { + }$ if and only if $S$ is error inclusive.
+
+Thus, we show that (for learners invariant to consistent additions) the error squashing technique converts machine teaching with non-interpolating learners to set cover, though of an expanded set. Then, black-box machine teaching algorithms (which are online set cover algorithms in disguise) can be run with the same theoretical guarantees, though with a larger $N$ . Note that the same is not true of $k$ -extended teaching sets (Cicalese et al., 2020) which require solving “generalized set cover” that is harder to design algorithms for (e.g. Cicalese et al. (2020) does not implement any).
+
+# 5 EXPERIMENTS
+
+We evaluate 7 subset selection methods: Random sampling, Entropy sampling (Lewis & Gale, 1994), Forgetting events (Toneva et al., 2018), GraNd (Paul et al., 2021), DHPZ (Dasgupta et al., 2019), CFLM (Cicalese et al., 2020), and our introduced algorithm. Although there are many coreset selection techniques, we focused on the methods that achieve the highest accuracy regardless of computation cost. We compare to Entropy, Forgetting, and GraNd as the coreset selection methods because they perform the best in the evaluation on CIFAR10 by Guo et al. (2022) in our dataset subset size regime $20 \%$ to $60 \%$ of CIFAR10). More details can be found in Appendix B.
+
+We compare results on 6 common image datasets (all but CINIC101 retrieved using torchvision) and use the predefined train/test splits. The six datasets are: CIFAR10 (Krizhevsky, 2009), CIFAR100 (Krizhevsky, 2009), CINIC10 (Darlow et al., 2018), FashionMNIST (FMNIST) (Xiao et al., 2017), MNIST (LeCun, 1998), and SVHN (Netzer et al., 2011).
+
+We evaluate using three architectures: Myrtle, VGG, and ResNet10. Myrtle was created by Page (2018) by stripping away parts of ResNet and modifying the training procedure while balancing between training speed and accuracy on CIFAR-10. The end result is a network that achieves $96 \%$ on CIFAR-10 in three minutes of training time. VGG (Simonyan & Zisserman, 2015) and ResNet10 (He et al., 2016) are created according to a common pytorch library for the CIFAR datasets2. More details including training hyperparameters can be found in Appendix B.
+
+# 5.1 RESULTS
+
+We first show results (see Figure 1) for the seven methods on all six datasets with one of the architectures, ResNet10. We note that there is a variety of performances from the coreset methods though the forgetting events technique consistently performs the best (lower test error). The machine teaching approaches behave similarly to each other, and outperform all coreset methods.
+
+
+Figure 1: Plots for ResNet10 across six datasets. Error bars are from training with 10 replications on a subset.
+
+
+Figure 2: Plots for CIFAR10 across three model architectures. Error bars are from training with 10 replications on a subset.
+
+Note that in a few cases (SVHN and FMNIST), achieving near-zero pool error is insufficient to achieve minimal test error with the data. This is surprising because the models trained on the machine teaching subsets get less than $0 . 0 1 \%$ error on the pool outside of the subset, meaning that every point is either seen or predicted correctly by the model.
+
+Next, we study how varying the model architecture impacts performance. We show results for the seven methods with the three architectures on CIFAR10 in Figure 2. We can draw approximately the same conclusions, though surprisingly, Entropy performs worse than random on non-ResNet architectures. We note that while Entropy performs better than random in Guo et al. (2022) and Coleman et al. (2020), both these papers use ResNet architectures.
+
+Full results for all combinations of datasets and architectures can be found in Appendix C. Although we do not measure or report wall clock time, a proxy is the number of times the model is trained. For Entropy and Forgetting, the model is trained once, for GraNd, the model is trained ten times, and the number of iterations for the machine teaching methods are shown in Table 1.
+
+Finally, we perform cross-architecture experiments where model architecture used during subset selection is different from the model architecture used for evaluation. Interestingly, the behavior of the machine teaching methods differers dramatically, from transferring as well as random to transferring as well as the full dataset. See Figure 3 for an example. All 54 combinations of datasets, subset selection architectures, and evaluation architectures can be found in Appendix C.
+
+
+Figure 3: Example cross-architecture plots where the subset selection architecture differs from the evaluation architecture. Error bars are from training on a subset with 10 replications.
+
+# 6 RELATED WORK
+
+We note a number of works, sometimes known as coreset methods, focus on reducing the time to train a model once by training with less data, perhaps with a drop in performance (Coleman et al., 2020; Mirzasoleiman et al., 2020; Paul et al., 2021; Killamsetty et al., 2021b;a). A key challenge in that formulation is creating a data selection algorithm that is computationally fast enough to avoid negating the computational gain of training on less data. In this work, we focus on data selection when we will train multiple times on the data subset (curriculum learning, continual learning, etc), so computational cost is less of an issue.
+
+Data subset selection without knowing the labels of the datapoints before a point is selected is known as active learning (Settles, 2009), a strictly harder problem. Note that an optimal data subset collected with full knowledge of the labels is an upper bound on how well an active learning algorithm can perform.
+
+As mentioned throughout this work, machine teaching (Goldman & Kearns, 1995; Zhu et al., 2018) is closely related to subset selection; especially Dasgupta et al. (2019) and Cicalese et al. (2020). In these works, the specification for machine teaching with black-box models is a bit different from our formulation. In particular, those works require the teaching set to be built up iteratively so that the queried subsets form a nested sequence. While natural from a machine teaching perspective, this requirement is unnecessary for subset selection as we can train on arbitrary subsets before returning an arbitrary subset. This less restrictive specification is likely why the $\log m$ factor can be trimmed from our algorithm subset size; see Alon et al. (2009) for more details on a related lower bound.
+
+An adjacent problem setting is that of “Dataset Distillation” (Wang et al., 2018; Nguyen et al., 2021) or “Dataset Condensation” (Zhao et al., 2020; Zhao & Bilen, 2021) where a very small (e.g. 100 images) dataset of synthetic images yields decent, but markedly sub-par, performance. Additionally, the optimized synthetic images can be very far from the natural data distribution.
+
+# 7 DISCUSSION
+
+In this work, we bring together the neural network coreset algorithm and recent machine teaching literature in data subset selection. At the same time, we streamline the theory for machine teaching by proving the correctness of an effective heuristic used in machine teaching implementations and by closing theoretical gaps in the asymptotic number of learner queries and size of the returned subset. More broadly, we hope the insights produced in this work will spur further research in selecting informative datasets and the role of data in learning.
+
+# REFERENCES
+
+Rahaf Aljundi, Min Lin, Baptiste Goujaud, and Yoshua Bengio. Gradient based sample selection for online continual learning. Advances in Neural Information Processing Systems, 2019.
+
+Noga Alon, Baruch Awerbuch, Yossi Azar, Niv Buchbinder, and Joseph Naor. The online set cover problem. SIAM Journal on Computing, 2009.
+
+Yoshua Bengio, Jer´ ome Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. ˆ International Conference on Machine Learning, 2009.
+
+Zalan Borsos, Mojmir Mutny, and Andreas Krause. Coresets via bilevel optimization for continual ´ learning and streaming. Advances in Neural Information Processing Systems, 2020.
+
+Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in Neural Information Processing Systems, 2020.
+
+Ferdinando Cicalese, Eduardo Laber, Marco Molinaro, et al. Teaching with limited information on the learner’s behaviour. International Conference on Machine Learning, 2020.
+
+Cody Coleman, Christopher Yeh, Stephen Mussmann, Baharan Mirzasoleiman, Peter Bailis, Percy Liang, Jure Leskovec, and Matei Zaharia. Selection via proxy: Efficient data selection for deep learning. International Conference on Learning Representations, 2020.
+
+Luke Darlow, Elliot Crowley, Antreas Antoniou, and Amos Storkey. Cinic-10 is not imagenet or cifar-10. arXiv preprint arXiv:1810.03505, 2018.
+
+Sanjoy Dasgupta, Daniel Hsu, Stefanos Poulis, and Xiaojin Zhu. Teaching a black-box learner. International Conference on Machine Learning, 2019.
+
+Uriel Feige. A threshold of ln n for approximating set cover. Journal of the ACM, 1998.
+
+Sally Goldman and Michael Kearns. On the complexity of teaching. Journal of Computer and System Sciences, 1995.
+
+Chengcheng Guo, Bo Zhao, and Yanbing Bai. Deepcore: A comprehensive library for coreset selection in deep learning. arXiv preprint arXiv:2204.08499, 2022.
+
+Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. Proceedings of the IEEE conference on computer vision and pattern recognition, 2016.
+
+Guannan Hu, Wu Zhang, and Wenhao Zhu. Prioritized experience replay for continual learning. International Conference on Computational Intelligence and Applications, 2021.
+
+Richard Karp. Reducibility among combinatorial problems. Complexity of computer computations, 1972.
+
+Krishnateja Killamsetty, Sivasubramanian Durga, Ganesh Ramakrishnan, Abir De, and Rishabh Iyer. Grad-match: Gradient matching based data subset selection for efficient deep model training. International Conference on Machine Learning, 2021a.
+
+Krishnateja Killamsetty, Durga Sivasubramanian, Ganesh Ramakrishnan, and Rishabh Iyer. Glister: Generalization based data subset selection for efficient and robust learning. AAAI Conference on Artificial Intelligence, 2021b.
+
+Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.
+
+Yann LeCun. The mnist database of handwritten digits. 1998.
+
+David Lewis and William Gale. A sequential algorithm for training text classifiers. SIGIR, 1994.
+
+Baharan Mirzasoleiman, Jeff Bilmes, and Jure Leskovec. Coresets for data-efficient training of machine learning models. International Conference on Machine Learning, 2020.
+
+Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Ng. Reading digits in natural images with unsupervised feature learning. 2011.
+
+Timothy Nguyen, Roman Novak, Lechao Xiao, and Jaehoon Lee. Dataset distillation with infinitely wide convolutional networks. Advances in Neural Information Processing Systems, 2021.
+
+David Page. myrtle.ai, 2018. URL https://myrtle.ai/ how-to-train-your-resnet-4-architecture/.
+
+Mansheej Paul, Surya Ganguli, and Gintare Karolina Dziugaite. Deep learning on a data diet: Finding important examples early in training. Advances in Neural Information Processing Systems, 2021.
+
+Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. International Conference on Machine Learning, 2021.
+
+Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. International Conference on Learning Representations, 2016.
+
+Ozan Sener and Silvio Savarese. Active learning for convolutional neural networks: A core-set approach. International Conference on Learning Representations, 2018.
+
+Burr Settles. Active learning literature survey. 2009.
+
+Ayumi Shinohara and Satoru Miyano. Teachability in computational learning. New Generation Computing, 1991.
+
+Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. International Conference on Learning Representations, 2015.
+
+Mariya Toneva, Alessandro Sordoni, Remi Tachet des Combes, Adam Trischler, Yoshua Bengio, and Geoffrey Gordon. An empirical study of example forgetting during deep neural network learning. International Conference on Learning Representations, 2018.
+
+Tongzhou Wang, Jun-Yan Zhu, Antonio Torralba, and Alexei Efros. Dataset distillation. arXiv preprint arXiv:1811.10959, 2018.
+
+Xin Wang, Yudong Chen, and Wenwu Zhu. A survey on curriculum learning. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021.
+
+Kai Wei, Rishabh Iyer, and Jeff Bilmes. Submodularity in data subset selection and active learning. International Conference on Machine Learning, 2015.
+
+Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: A novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017.
+
+Jaehong Yoon, Divyam Madaan, Eunho Yang, and Sung Ju Hwang. Online coreset selection for rehearsal-based continual learning. International Conference on Learning Representations, 2021.
+
+Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning (still) requires rethinking generalization. Communications of the ACM, 2021.
+
+Bo Zhao and Hakan Bilen. Dataset condensation with differentiable siamese augmentation. International Conference on Machine Learning, 2021.
+
+Bo Zhao, Konda Reddy Mopuri, and Hakan Bilen. Dataset condensation with gradient matching. arXiv preprint arXiv:2006.05929, 2020.
+
+Xiaojin Zhu, Adish Singla, Sandra Zilles, and Anna Rafferty. An overview of machine teaching. arXiv preprint arXiv:1801.05927, 2018.
+
+Table 2: This table shows the value of the parameters that are related to a $\log N$ estimate. For example, $\lambda$ for DHPZ, $\xi$ for ours, and the number of sampling repetitions for CFLM. All parameters are the minimal element from the set $\{ 2 ^ { k } 1 0 ^ { 3 } : k \in \mathbb { Z } \}$ such that the algorithm returns successfully.
+
+
Dataset
入 (DHPZ)
Sampling Repeats (CFLM)
m(Ours)
CIFAR10
1000
2000
1000
CIFAR100
8000
16000
4000
CINIC10
8000
16000
8000
SVHN
1000
2000
500
FMNIST
1000
2000
500
MNIST
125
250
125
+
+# A APPENDIX OVERVIEW
+
+This appendix is split into 5 sections:
+
+• Additional Experimental Results
+• Experimental Details
+• Upper Bound Proofs
+• Lower Bound Proofs
+• Error Squashing Framework Exposition and Proofs
+
+# A.1 NOTATION DEFINITIONS
+
+Let $\mathbb { Z }$ denote the set of integers and $\mathbb { Z } _ { + }$ denote the set of positive integers. Let $[ k ] = \{ 1 , 2 , \dots , k \}$ .
+For a set $S$ , let $\mathcal { P } ( S )$ denote the power set of $S$ . For a set $S$ , let $S ^ { k }$ be the repeated Cartesian product;
+for example, $S ^ { 3 } = \stackrel { \cdot } { S } \times S \times S$ .
+
+Let ${ \widetilde { O } } ( \cdot )$ denote $O ( \cdot )$ where extraneous log factors are ignored. For example, if an algorithm has a $O ( n \log n )$ runtime, it also has a ${ \widetilde { O } } ( n )$ runtime. Note that we cannot ignore all log terms (otherwise we can drop everything: $O ( n ) = O ( \log ( \exp ( n ) ) )$ , only log factors where the non-log version of an expression also appears.
+
+# B EXPERIMENTAL DETAILS
+
+# B.1 MACHINE TEACHING IMPLEMENTATION DETAILS
+
+The machine teaching techniques, including ours, have three implementation adaptations. First, all methods are run with error squashing. Second, instead of terminating when no pool errors (outside of the training errors) are made, the algorithms return when the number of pool errors is less than $1 0 ^ { - 4 } m$ . Third, to avoid training on very small subsets where training instabilities occur, when a machine teaching algorithm attempts to query a subset with fewer than $1 0 ^ { 4 }$ points, we randomly sample enough points so that the total number of points is exactly $1 0 ^ { 4 }$ . Because MNIST requires significantly fewer points, we randomly sampled to $1 0 ^ { 3 }$ points.
+
+All machine teaching algorithms include a hyperparameter that roughly corresponds to $\log N$ . For each method and dataset, we tuned over the set $\{ 2 ^ { k } 1 0 ^ { 3 } : k \in \mathbb { Z } \}$ to find the minimal hyperparameter value where the algorithm returned successfully. See Table 2. Our proposed algorithm additionally has the hyperparameter $\hat { d }$ which was set to $1 0 ^ { 3 }$ for all experiments except for MNIST it was set to $1 0 ^ { 2 }$ .
+
+# B.2 CORESET IMPLEMENTATION DETAILS
+
+Forgetting scores were calculated while training the subset selection model once. Ten different subset selection models were trained for the ten different runs.
+
+Table 3: This table shows the number of queries to the learner for the machine teaching methods with the Myrtle architecture.
+
+
Dataset
DHPZ
CFLM
Ours
CIFAR10
128
108
125
CIFAR100
126
150
146
CINIC10
144
197
201
SVHN
76
89
87
FMNIST
105
73
102
MNIST
47
39
42
+
+Entropy was calculated using the softmax probability distribution after training until completion.
+Ten different subset selection models were trained for the ten different runs.
+
+GraNd was calculated as the L2 norm of the gradient of cross entropy loss with respect to the last layer’s weights and biases, averaged over ten runs. All ten replications used the same GraNd scores (averaged from ten runs).
+
+# B.3 MYRTLE DETAILS
+
+Details for the Myrtle architecture can be found here https://github.com/davidcpage/ cifar10-fast. Specifically, we use the updated version that uses a preprocessing whitening block and a weighted KL and cross entropy loss, as well as tricks such as Ghost BatchNorm, two sets of SGD optimizers, and exponential moving averages. Note that we use neither CutOut augmentation nor test time augmentation, as we stick to training augmentation with crops and flips. We keep most hyperparameters the same as the default ones, except we train for $5 0 * 5 0 0 0 0$ steps and set the base learning rate to 0.4.
+
+# B.4 VGG AND RESNET10 DETAILS
+
+The code for the VGG and ResNet10 can be found at https://github.com/kuangliu/ pytorch-cifar. VGG was created with the command VGG(’VGG13’) and ResNet10 was created with the command ResNet(BasicBlock, [1, 1, 1, 1]). Both architectures were trained using SGD with momentum of 0.9 and weight decay 0.0005, and a triangular learning rate schedule with a maximum learning rate of 0.1. Cross entropy loss and a gradient scaler were also used. The number of gradient steps was set to be $5 0 \times m$ (i.e. 50 epochs for the full training, more for subsets).
+
+# C ADDITIONAL EXPERIMENTS
+
+We first present the number of iterations for the machine teaching methods with Myrtle and VGG in Table 3 and Table 4.
+
+This appendix includes the full experimental plots. In the first figure (Figure 4), all three architectures are run with all six datasets. The following three figures are cross-architecture experiments and are grouped by the evaluation architecture. See Figure 5 for Myrtle evaluation, Figure 6 for VGG evaluation, and Figure 7 for ResNet10 evaluation. “CIFAR10 with Myrtle” means Myrtle was used for both subset selection and evaluation, while “CIFAR10 from VGG to ResNet10” means VGG was used for subset selection and ResNet10 was used for evaluation.
+
+
+Figure 4: Plots for three architectures by six datasets.
+
+
+Figure 5: Cross-architecture evaluation on Myrtle.
+
+
+Figure 6: Cross-architecture evaluation on VGG.
+
+
+Figure 7: Cross-architecture evaluation on ResNet10.
+
+Table 4: This table shows the number of queries to the learner for the machine teaching methods with the VGG architecture.
+
+
Dataset
DHPZ
CFLM
Ours
CIFAR10
143
158
116
CIFAR100
123
123
143
CINIC10
202
158
195
SVHN
90
79
113
FMNIST
87
99
96
MNIST
42
45
38
+
+# D UPPER BOUND PROOFS
+
+In this section, we prove the following theorem through a sequence of lemmas.
+
+Theorem 1. Suppose $\hat { d } \geq d ^ { * }$ and $\hat { N } \geq N : = | \overline { { \mathcal { H } } } |$ . Then, with probability at least $1 - \delta$ , Algorithm 1 returns successfully within $O ( d ^ { * } \log ( m / d ^ { * } ) )$ queries to the learner and the size of the returned set is $| \hat { S } | = O ( \hat { d } ( \log \hat { N } + \log \log m + \log ( 1 / \delta ) )$ .
+
+Throughout this section, we implicitly assume $\hat { d } \geq d ^ { * }$ and $\hat { N } \geq N$ .
+
+# D.1 HIGH PROBABILITY EVENT
+
+Set $\overline { { T } } = 2 \hat { N } \lfloor \log _ { 2 } m \rfloor$ and recall that $\xi = \ln ( 4 \hat { N } ^ { 2 } \log _ { 2 } ( m ) / \delta )$
+
+$$
+\begin{array} { c l c r } { { } } & { { } } & { { G _ { h , t } = \left\{ \left| S _ { t } \cap E _ { h } \right| \geq 1 \vee \displaystyle \sum _ { i \in E _ { h } } p _ { t , i } < \xi \right\} } } \\ { { } } & { { } } & { { \overline { { { T } } } } } \\ { { } } & { { } } & { { G = \displaystyle \bigcap _ { t = 1 } ^ { T } \bigcap _ { h \in \overline { { { \mathcal H } } } } G _ { h , t } } } \end{array}
+$$
+
+Lemma 1. Event $G$ holds with probability $\textstyle 1 - { \frac { \delta } { 2 } }$
+
+Proof. Fix any $h \in { \overline { { \mathcal { H } } } }$ and $t \leq \overline { { T } }$ .
+
+Examine the random variable $\begin{array} { r } { | S _ { t } \cap E _ { h } | = \sum _ { i \in E _ { h } } } \end{array}$ Bernoulli $\left( p _ { t , i } \right)$ . Set $\begin{array} { r } { P _ { h , t } = \sum _ { i \in E _ { h } } p _ { t , i } } \end{array}$ . By a Chernoff bound and taking the limit $\delta 1$ ,
+
+$$
+\begin{array} { c } { \displaystyle \operatorname* { P r } ( | S _ { t } \cap E _ { t } | < ( 1 - \delta ) P _ { h , t } ) \leq \left( \frac { e ^ { - \delta } } { ( 1 - \delta ) ^ { ( 1 - \delta ) } } \right) ^ { P _ { h , t } } } \\ { \displaystyle \operatorname* { P r } ( | S _ { t } \cap E _ { h } | = 0 ) \leq \exp ( - P _ { h , t } ) } \end{array}
+$$
+
+Therefore,
+
+$$
+\mathrm { P r } ( \lnot G _ { h , t } ) \le \exp ( - \xi )
+$$
+
+Then, by a union bound,
+
+$$
+\begin{array} { l } { \displaystyle \operatorname* { P r } ( - G ) = \operatorname* { P r } \left( \bigcup _ { \lfloor - 1 \lambda _ { \hbar \in \widetilde { \mathbb { H } } } } ^ { \mathcal { T } } \bigcup _ { - \left. h , t \right. } - \bigcup _ { \substack { \widetilde { \mathbb { H } } \le \widetilde { \mathbb { H } } _ { \widetilde { \mathbb { H } } } } } \right) } \\ { \displaystyle \quad \le \sum _ { \ell = 1 } ^ { \overline { { T } } } \sum _ { k \in \widetilde { \mathbb { H } } } \operatorname* { P r } ( - G _ { h , t } ) } \\ { \displaystyle \quad \le \frac { T N \cot ( - \xi ) } { \alpha } } \\ { \displaystyle \le 2 \hat { N } \log _ { 2 } ( m ) N \frac { \delta } { 4 \hat { N } ^ { 2 } \log _ { 2 } ( m ) } } \\ { \displaystyle \le \frac { \delta } { 2 } } \end{array}
+$$
+
+Lemma 2. If G holds, then for $\begin{array} { r } { t \leq \overline { { T } } , \sum _ { i \in E _ { t } } p _ { t , i } < \xi } \end{array}$ .
+
+Proof. By definition of the interpolating model, $\vert S _ { t } \cap E _ { t } \vert = 0$ , therefore, since $G$ holds, $\textstyle \sum _ { i \in E _ { t } } p _ { t , i } < \xi$ . □
+
+Note this implies that if $G$ holds and the algorithm terminates before $\overline { T }$ , we won’t return FAILURE TYPE 1
+
+# D.2 BOUND ON NUMBER OF ITERATIONS
+
+Lemma 3. If $G$ holds and $\hat { N } < 2 d ^ { * }$ , then the algorithm returns successfully within $\hat { N } \leq 2 d ^ { * } k _ { 0 }$ iterations.
+
+Proof. First note that $\overline { { T } } = 2 \hat { N } \log _ { 2 } ( m ) \geq \hat { N }$
+
+Note that, under $G$ and if the probabilities are not halved, a hypothesis cannot be returned twice by the learner. This is because when a learner returns $h _ { t }$ , for the next iterations, the weight will be at least $\xi$ and under $G$ , by Lemma 2, $h _ { t }$ cannot be returned again. Thus, if $N \leq \hat { N } < 2 \bar { d }$ , the learner will return all hypotheses before halving. □
+
+Lemma 4. If $G$ holds and $\hat { N } \geq 2 d ^ { * }$ , Algorithm $^ { l }$ returns successfully within $2 d ^ { * } k _ { 0 } + 1$ iterations.
+
+Proof. Fix a subset solution $S ^ { * }$ that has the optimal size $d ^ { * }$ .
+
+Note that $T \leq 2 \hat { d } \lfloor \log _ { 2 } ( m ) \rfloor \leq \hat { N } \lfloor \log _ { 2 } ( m ) \rfloor \leq \overline { { T } } .$
+
+Suppose we have not returned by iteration $T$ ; then, by assumption $\forall t \leq T : | E _ { t } | \geq 1$
+
+Note that $E _ { t } \in \mathcal { E }$ , so $| S ^ { * } \cap E _ { t } | \geq 1$
+
+$$
+\begin{array} { c } { { \displaystyle \sum _ { i \in S ^ { * } } \mathbf { 1 } [ i \in E _ { t } ] \geq 1 } } \\ { { \displaystyle \sum _ { i \in S ^ { * } } \sum _ { t = 1 } ^ { T } \mathbf { 1 } [ i \in E _ { t } ] \geq T } } \end{array}
+$$
+
+Note that at every iteration, $k _ { t , i }$ for $i$ in $E _ { t }$ decrease by at least one. By $G$ holding, $E _ { t } \leq \xi$ . Thus, $\Delta _ { t } \geq 1$ . And further, if $k _ { t , i } = \mathrm { ~ 0 ~ }$ , then $p _ { t , i } = 1$ , $i \in S _ { t }$ , and $i \notin E _ { t }$ .
+
+$$
+k _ { T + 1 , i } \leq k _ { 0 } - \sum _ { t = 1 } ^ { T } \mathbf { 1 } [ i \in E _ { t } ] + \sum _ { t = 1 } ^ { T } \mathbf { 1 } [ t ( \mathrm { m o d } ) 2 \hat { d } = 0 ]
+$$
+
+But since $k _ { T + 1 , i } \geq 0$ ,
+
+$$
+\begin{array} { c } { { { \displaystyle { k _ { 0 } - \sum _ { i = 1 } ^ { T } \left[ i \in E _ { i } \right] + \frac { T } { 2 \hat { d } } \geq 0 } } } } \\ { { { \displaystyle { d ^ { * } k _ { 0 } - \sum _ { i \in S ^ { s } } \sum _ { \ell = 1 } ^ { T } \left[ i \in E _ { i } \right] + \frac { d ^ { * } T } { 2 \hat { d } } \geq 0 } } } } \\ { { { \displaystyle d ^ { * } k _ { 0 } - T + \frac { d ^ { * } T } { 2 \hat { d } } \geq 0 } } } \\ { { { \displaystyle d ^ { * } k _ { 0 } \geq \left( 1 - \frac { d ^ { * } } { 2 \hat { d } } \right) T } } } \\ { { { \displaystyle d ^ { * } k _ { 0 } \geq \left( 1 - \frac { d ^ { * } } { 2 \hat { d } } \right) T } } } \\ { { { \displaystyle d ^ { * } k _ { 0 } \geq \frac { 1 } { 2 } T } } } \\ { { { \displaystyle { d ^ { * } k _ { 0 } \geq T } } } } \end{array}
+$$
+
+which is a contradiction. So the algorithm must have returned before $T$ .
+
+Thus, in either case ( $\hat { N } < 2 \hat { d }$ or $\hat { N } \geq 2 \hat { d } ,$ ), the algorithm terminates before $\overline { T }$ iterations and within $2 d ^ { * } k _ { 0 } + 1$ iterations.
+
+# D.2.1 SIZE OF RETURNED SUBSET
+
+We now analyze the size of the returned set $| \hat { S } |$ . First, note that at every iteration, $\mathbb { E } [ | S _ { t } | ] = \sum _ { i } p _ { t , i }$ . We can think of bounding the size of $| \hat { S } |$ as bounding the size of each $| S _ { t } |$ which involves bounding the mean $( \sum _ { i } p _ { t , i } )$ and the deviation from the mean. First we bound the deviation.
+
+Lemma 5. If $\textstyle \sum _ { i = 1 } ^ { m } p _ { t , i } \leq L$ for all $t \leq \overline { { T } }$ , then, with $1 - \delta$ probability, $| S _ { t } | \le \operatorname* { m a x } ( e ^ { 2 } L , \ln ( 2 \overline { { T } } / \delta )$ for each $t \leq \overline { { T } }$ i=1 with probability at least $\textstyle 1 - { \frac { \delta } { 2 } }$ .
+
+Proof. Note that $\left| S _ { t } \right| = \textstyle \sum _ { i = 1 } ^ { m }$ Bernoulli $\left( p _ { t , i } \right)$
+
+Define $\textstyle P _ { t } = \sum _ { i = 1 } ^ { m } p _ { t , i }$ . Note $0 \leq P _ { t } \leq L$
+
+Fix $t$ . By a Chernoff bound, for any $\kappa > 0$ ,
+
+$$
+\operatorname* { P r } [ | S _ { t } | \geq ( 1 + \kappa ) P _ { t } ] \leq \left( { \frac { e ^ { \kappa } } { ( 1 + \kappa ) ^ { ( 1 + \kappa ) } } } \right) ^ { P _ { t } }
+$$
+
+Define $c = \operatorname* { m a x } ( e ^ { 2 } , \ln ( 2 \hat { N } \overline { { T } } ) / L )$
+
+Let $( 1 + \kappa ) P _ { t } = c L$ , so $\begin{array} { r } { \kappa = \frac { c L } { P _ { t } } - 1 } \end{array}$
+
+$$
+\begin{array} { r l r } & { } & { { \mathrm { P r } } [ | | S _ { t } | \geq c L ] \leq \frac { e ^ { c L - P _ { t } } } { ( c L / P _ { t } ) ^ { ( c L ) } } } \\ & { } & { \qquad \leq \frac { e ^ { c L } } { ( c ) ^ { ( c L ) } } } \\ & { } & { \qquad = \left( \frac { e } { c } \right) ^ { c L } } \\ & { } & { \qquad \leq e ^ { - c L } } \\ & { } & { { \mathrm { P r } } [ | S _ { t } | \geq \operatorname* { m a x } ( e ^ { 2 } L , \ln ( 2 \overline { T } / \delta ) ) ] \leq \frac { \delta } { 2 \overline { T } } } \end{array}
+$$
+
+Finally, a union bound over all iterations $t \leq \overline { { T } }$ yields the result.
+
+Lemma 6. If event $G$ holds, for $t \leq \overline { { T } }$ ,
+
+$$
+\sum _ { i = 1 } ^ { n } p _ { t , i } \leq 8 { \hat { d } } \xi
+$$
+
+Proof. We will show something slightly stronger, for $t \leq \overline { { T } }$ ,
+
+$$
+\sum _ { i = 1 } ^ { n } p _ { t , i } \leq ( 2 \hat { d } + ( ( t - 1 ) ( \mathrm { m o d } ) ( 2 \hat { d } ) ) ) ( 2 \xi ) \qquad
+$$
+
+We prove this by induction. As a base case, for $t = 1$ ,
+
+$$
+\begin{array} { c l c r } { \displaystyle \sum _ { i = 1 } ^ { n } p _ { 1 , i } = m 2 ^ { - k _ { 0 } } } \\ { \displaystyle } \\ { \leq m 2 ^ { \log _ { 2 } ( m / \hat { d } ) + 1 } } \\ { \displaystyle } & { = 2 \hat { d } } \\ { \displaystyle } & { \leq ( 2 \hat { d } + 0 ) ( 2 \xi ) } \end{array}
+$$
+
+For the inductive case, we examine two cases: $t$ (mod) $( 2 \hat { d } ) \neq 0$ and $t$ (mod) $( 2 \hat { d } ) = 0$ . In both cases, we rely on Lemma 2 and event $G$ holding. For the first case,
+
+$$
+\begin{array} { r l } { \displaystyle \sum _ { i = 1 } ^ { n } p _ { i + 1 } x - \displaystyle \sum _ { j = 1 } ^ { n } \alpha _ { i + 1 , j } x } \\ { = } & { \frac { 1 } { \sqrt { \pi \alpha _ { i } } } } \\ & { \le \displaystyle \sum _ { i = 1 } ^ { n } 2 x + \alpha _ { i } x _ { i } ( 1 ) \| \boldsymbol { \mathcal { E } } \boldsymbol { x } _ { i } } \\ & { \le \displaystyle \sum _ { i = 1 } ^ { n } 2 x + \alpha _ { i } x _ { i } ( 1 ) \| \boldsymbol { \mathcal { E } } \boldsymbol { x } _ { i } } \\ & { < \displaystyle \sum _ { j = 1 } ^ { n } 2 x + \alpha _ { i } x _ { j } ( 1 ) \| \boldsymbol { \mathcal { E } } \boldsymbol { u } _ { i } ^ { \mathrm { ( ) } } } \\ & { \le \displaystyle \sum _ { i = 1 } ^ { n } 2 x + \alpha _ { i } ^ { 2 } x _ { j } ^ { 2 } \| x _ { i } ^ { 3 } - x _ { i } ^ { 3 } \| x _ { i } ^ { 4 } } \\ & { \le \displaystyle \sum _ { j = 1 } ^ { n } \alpha _ { i } x _ { j } + \gamma \displaystyle \sum _ { i \in \mathcal { N } _ { i } } ^ { n } \sum _ { j = 1 } ^ { n } \gamma _ { i , j } x _ { i } } \\ & { \le \displaystyle \sum _ { i = 1 } ^ { n } \alpha _ { i } x _ { j } + \gamma \displaystyle \sum _ { i \in \mathcal { N } _ { i } } ^ { n } \sum _ { j = 1 } ^ { n } 2 x } \\ & { < \displaystyle ( 2 + ( \alpha _ { i } - 1 ) \operatorname* { m a x } ( 2 ) + 2 ) \| \boldsymbol { \mathcal { E } } \boldsymbol { u } _ { i } ^ { \mathrm { ( ) } } } \\ & { \le ( 2 + ( \alpha _ { i } + 1 ) - 1 ) \operatorname* { m a x } ( 2 ) + 2 \| x _ { i } ^ { 2 } \| x _ { j } ^ { 2 } } \end{array}
+$$
+
+For the second case,
+
+$$
+\begin{array} { r l } { \displaystyle \sum _ { k = 1 } ^ { n } \beta _ { k + 1 , i } = \sum _ { t = 1 } ^ { n } 2 ^ { k } h + 1 , } \\ & { \le \displaystyle \sum _ { k = 1 } ^ { n } 2 ^ { - k } h + 3 . 0 1 | c s | h - 1 } \\ & { \le \displaystyle \sum _ { k = 1 } ^ { n } 2 ^ { - k } h + 1 . 0 1 | c s | h - 1 } \\ & { \le \displaystyle \sum _ { k = 1 } ^ { 1 } \left[ \displaystyle \sum _ { k = 1 } ^ { n } 2 ^ { - k } h + \displaystyle \sum _ { k = 1 } ^ { n } 2 ^ { - k } h _ { k } + 3 . 1 \right] } \\ & { \le \displaystyle \frac { 1 } { 2 } \left[ \displaystyle \sum _ { k = 1 } ^ { n } p _ { k , i } + 2 . 6 \right] } \\ & { = \displaystyle \frac { 1 } { 2 } \left( ( 2 \hat { a } + ( ( 2 \hat { a } - 1 ) + 1 ) 2 \xi ) \right. } \\ & { \left. = 4 \hat { a } \xi \right. } \\ & { = \displaystyle \left( 2 \hat { a } + ( ( t + 1 ) - 1 ) ( \operatorname* { m o l } 2 \hat { a } ) \right) 2 \xi } \end{array}
+$$
+
+Putting the bound on the mean and deviation of the mean, we achieve a bound on $\lvert S _ { t } \rvert$ and thus $| \hat { S } |$ . Proposition 4. With probability $1 - \delta$ ,
+
+$$
+\begin{array} { r l } & { | \hat { S } | \le \operatorname* { m a x } ( e ^ { 2 } 8 \hat { d } \xi , \ln ( 2 \overline { { T } } / \delta ) ) } \\ & { \quad \le e ^ { 2 } 8 \hat { d } \xi } \\ & { \quad = O \left( \hat { d } ( \log ( \hat { N } ) + \log \log m + \log ( 1 / \delta ) ) \right) } \end{array}
+$$
+
+# E LOWER BOUNDS
+
+In this section, we prove three lower bounds.
+
+# E.1 PROOF OF QUERY LOWER BOUND FOR LARGE N
+
+Theorem 2. Fix any $\lambda \geq 1$ and $m \geq 2 \lambda$ . There exists a distribution over interpolating ranked minimal error learners and an $m$ -sized dataset with optimal subset size $d ^ { * }$ , such that any teaching algorithm requires $2 ^ { \Omega ( m / \lambda ) }$ queries to achieve at most $\lambda d ^ { * }$ subset size with probability at least $1 / 2$ .
+
+Proof. Let the dataset include $m$ points that are all labeled 0.
+
+Let $K \subset [ m ]$ be randomly chosen such that $K \subset [ m ]$ and $| K | = \lfloor m / ( 2 \lambda ) \rfloor \ge 1$ . $K$ is the random “key”.
+
+$$
+L ( \{ { \vec { D } } _ { i } : i \in S \} ) ( x _ { j } ) = { \left\{ \begin{array} { l l } { 1 } & { K \not \subset S , | S | \leq m / 2 , j \not \in S } \\ { 0 } & { { \mathrm { o t h e r w i s e } } } \end{array} \right. }
+$$
+
+We show that the learner can be written as a ranked minimal error learner.
+
+Define
+
+$$
+\begin{array} { r l } & { h _ { S } ( x _ { j } ) = \mathbf { 1 } [ j \notin S ] } \\ & { \qquad \mathcal { H } = \{ h _ { S } : S \subset [ m ] : K \notin S \land | S | \leq m / 2 \} \cup \{ h _ { [ m ] } \} } \end{array}
+$$
+
+and let $R ( h _ { S } ) < R ( h _ { S ^ { \prime } } )$ if $| S | < | S ^ { \prime } |$ (i.e. the learner prefers $h _ { S }$ with smaller $S$ ).
+
+Note that this learner is an interpolating learner because $L ( K )$ has zero errors. Furthermore, $d ^ { * } =$ $\vert K \vert = \lfloor m / ( 2 \lambda ) \rfloor$ .
+
+Note that any set of size $| S | = m / 2 + 1$ achieves no errors (error inclusive) but the size is more than $d ^ { * } \lambda$ .
+
+Furthermore, to achieve $d ^ { * } \lambda$ , a necessary condition for any algorithm is to query a subset where $| S | \le m / 2 \land K \subset S$ . Otherwise, there will be many errors $( \geq m / 2 )$ and no information will be gained on $K$ . This is not sufficient, but is necessary.
+
+Furthermore, for any subset $| S | \le m / 2$ , the probability that $K \subset S$ is at most $1 / 2 ^ { | K | }$ .
+
+Thus, by a union bound, in $2 ^ { | K | - 1 }$ iterations, there is a $1 / 2$ chance that the algorithm has not met the necessary condition and thus is not done. Thus, the expected number of iterations is at least
+
+$$
+2 ^ { | K | - 1 } = 2 ^ { \lfloor m / ( 2 \lambda ) \rfloor - 1 } = 2 ^ { \Omega ( m / \lambda ) }
+$$
+
+# E.2 QUERY LOWER BOUND FOR SMALL N
+
+Just for this section, define $[ n ] = \{ 0 , 1 , \ldots , n - 1 \}$ . In other words, we start at zero rather than one.
+
+Here we describe a ranked minimal error learner that requires $\widetilde \Omega ( d ^ { * } \log ( m / d ^ { * } ) )$ iterations (queries) to even achieve even a rough approximation of the optimal subset.
+
+Fix any $C , \ell , k \in \mathbb { Z } _ { + }$ . Let there be a randomly chosen vector ${ \vec { c } } \in [ C ] ^ { k \ell }$ . Index $\vec { c }$ by $[ k \ell ]$
+
+For simplicity let the ground truth labels all be 0.
+
+Let $x \in [ k ] \times [ C ] ^ { \ell }$ .
+
+Let there be $k \ell + 1$ hypotheses where one hypothesis is a hypothesis that makes no mistakes $h ^ { * } =$ $h _ { \infty }$ . For the other $k \ell$ hypotheses, index the hypotheses by $[ k \ell ]$ .
+
+$$
+h _ { i } ( x ) = { \left\{ \begin{array} { l l } { 1 } & { i / / \ell = x _ { 1 } \wedge x _ { 2 , i \% \ell } = { \vec { c } } _ { i } } \\ { 0 } & { { \mathrm { o t h e r w i s e } } } \end{array} \right. }
+$$
+
+where $/ /$ signifies integer division and $\%$ signifies modulo.
+
+Let $R ( h _ { i } ) = i$ and $R ( h _ { \infty } ) = k \ell$ . So $h _ { 0 }$ is preferred, and we must rule out all but the last hypothesis to achieve zero error.
+
+We assume the teacher knows everything about the structure of the hypotheses except for the randomness in defining $\vec { c }$ (the random “key”).
+
+Note that we can cover all non-optimal hypotheses with $k$ points, so $d ^ { * } = k$ .
+
+We now describe the dynamics of making queries. At every iteration $t$ , the teacher can keep track of an uncertainty set for each element of $\vec { c }$ . In particular, let $V _ { t , i } \in \mathcal { P } ( [ C ] )$ be an uncertainty set such that we know $\vec { c } _ { i } \in V _ { t , i }$ at the $t ^ { t h }$ iteration. In particular, each uncertainty set begins as $[ C ]$ . If the $i ^ { t h }$ hypothesis is returned by the learner, the teacher knows $V _ { t , i } = \{ \vec { c } _ { i } \}$ . If we know that we covered $h _ { i }$ with a query set $X _ { t }$ (by knowing the ranked order of hypotheses), then we know that $\begin{array} { r } { \vec { c } _ { i } \in \bigcup _ { x \in X _ { t } : x _ { 1 } = i / / \ell } x _ { 2 , i \% \ell } . } \end{array}$
+
+Given the above, we can refine the problem to the following problem with states $Z _ { t } \in [ C ] ^ { k \ell }$ , actions $A _ { t } \in [ C ] ^ { k \ell }$ , and randomness $R _ { t } \in \mathsf { \bar { [ } } k \ell ] \cup \{ \infty \}$ .
+
+Let $Z _ { t , i } = | V _ { t , i } |$ be the size of the uncertainty set.
+
+Let
+
+$$
+A _ { t , i } = \left| \left( \bigcup _ { x \in X _ { t } : x _ { 1 } = i / / \ell } x _ { 2 , i \mathcal { Y } _ { 0 } \ell } \right) \cap V _ { t , i } \right|
+$$
+
+be the number of elements within the certainty set that we cover with $X _ { t }$ .
+
+Finally, let $R _ { t }$ be the hypothesis returned from the learner to the teacher at the $t ^ { t h }$ iteration.
+
+Given a state $Z _ { t }$ , the teacher chooses $X _ { t }$ which can be converted to an $A _ { t }$ such that $0 ~ \leq$ $A _ { t , i } ~ \leq ~ Z _ { t , i }$ . For any query set $X _ { t }$ that the teacher queries, we convert this to an $A _ { t }$ where $\begin{array} { r } { \vert X _ { t } \vert = \sum _ { i _ { 1 } \in [ k ] } \operatorname* { m a x } _ { i _ { 2 } \in [ \ell ] } A _ { t , i _ { 1 } \ell + i _ { 2 } } } \end{array}$ .
+
+The learner gives the teacher a hypothesis (and thus $R _ { t }$ ) that is random with respect to the randomness in $\vec { c }$ such that
+
+$$
+\begin{array} { l } { \displaystyle \operatorname* { P r } ( R _ { t } = i ) = \prod _ { j = 1 } ^ { i - 1 } \frac { A _ { t , j } } { Z _ { t , j } } \left( 1 - \frac { A _ { t , i } } { Z _ { t , i } } \right) } \\ { \displaystyle \operatorname* { P r } ( R _ { t } = \infty ) = \prod _ { j = 1 } ^ { k \ell } \frac { A _ { t , j } } { Z _ { t , j } } } \end{array}
+$$
+
+In other words, $h _ { i }$ is returned by the learner if the query $X _ { t }$ covers the first $i - 1$ hypotheses, but fails to cover the $i ^ { t h }$ hypothesis. Finally, we return $h ^ { * } = h _ { \infty }$ if the rest of the hypotheses are covered.
+
+Then, on a state $Z _ { t }$ , action $A _ { t }$ , and learner’s hypothesis $R _ { t }$ , we can generate the next state as
+
+$$
+Z _ { t + 1 , i } = \left\{ { \begin{array} { l l } { A _ { t , i } } & { i < R _ { t } } \\ { 1 } & { i = R _ { t } } \\ { Z _ { t , i } } & { i > R _ { t } } \end{array} } \right.
+$$
+
+# E.2.1 ANALYSIS FOR LOWER BOUND
+
+The analysis hinges on examining the potential function:
+
+$$
+P ( Z _ { t } ) = \sum _ { i = 1 } ^ { k \ell } \ln \left( \frac { C } { Z _ { t , i } } \right)
+$$
+
+First, note that the potential function is monotone increasing (not strictly) with the number of iterations. Further note that $P ( Z _ { 1 } ) = 0$ since $Z _ { 1 , i } = C$ .
+
+Note that at any iteration $t$ and state $Z _ { t }$ , the teacher can cover all possible (with respect to the uncertainty sets) hypotheses with exactly
+
+$$
+Q ( Z _ { t } ) = \sum _ { i _ { 1 } \in [ k ] } \operatorname* { m a x } _ { i _ { 2 } \in [ \ell ] } Z _ { t , i _ { 1 } \ell + i _ { 2 } }
+$$
+
+points. Furthermore, all uncertainty sets cannot be covered with fewer points. For an algorithm to achieve a final subset of size of at most $\lambda k$ , it must be the case that $Q ( Z _ { t } ) \leq \lambda k$ .
+
+Lemma 7. For an algorithm to achieve a final subset at iteration $t$ of size at most $\lambda k$ , it must be the case that
+
+$$
+P ( Z _ { t } ) \geq k \ell \ln \left( \frac { C } { \lambda } \right)
+$$
+
+Proof. This follows from solving the relaxed optimization problem where $Z _ { t , i } \in \mathbb { R }$ and $1 \leq Z _ { t , i } \leq$ $C$ .
+
+$$
+\operatorname* { m i n } P ( Z _ { t } ) { \mathrm { ~ s u c h ~ t h a t ~ } } Q ( Z _ { t } ) \leq \lambda k
+$$
+
+which has a global solution where all elements of $Z _ { t }$ are equal: $Z _ { t , i } = \lambda$
+
+# Lemma 8.
+
+$$
+\mathbb { E } [ P ( Z _ { t + 1 } ) - P ( Z _ { t } ) ] \leq 1 + \ln ( C )
+$$
+
+Proof.
+
+$$
+\begin{array} { r l } { \sum [ P ( Z _ { t + 1 } ) - P ( Z _ { t } ) ] = \mathbb { E } \Bigg [ \displaystyle \sum _ { i = 1 } ^ { N } \log \left( \frac { Z _ { t , i + 1 } } { Z _ { t + 1 } } \right) \Bigg ] } \\ & { = \displaystyle \sum _ { i = 1 } ^ { N } \mathbb { P } ( \bar { X } _ { t } - \tau ) \left[ \displaystyle \sum _ { i = 1 } ^ { N - 1 } \log \left( \frac { Z _ { t , i } } { Z _ { t , i } } \right) \mid \mathrm { ~ i n } \left( \frac { Z _ { t , i } } { \bar { X } _ { t } } \right) \right] } \\ & { \leq \operatorname* { l i m } ( Z ) + \displaystyle \sum _ { i = 1 } ^ { N } \mathbb { P } ( \bar { X } _ { t } - \tau ) \displaystyle \sum _ { i = 1 } ^ { N - 1 } \operatorname* { i n } \left( \frac { Z _ { t , i } } { Z _ { t , i } } \right) } \\ & { = \operatorname* { l i m } ( Z ) + \displaystyle \sum _ { i = 1 } ^ { N } \displaystyle \sum _ { i = 1 } ^ { N } \displaystyle \sum _ { i = 1 } ^ { N } \log \left( R _ { t } - \tau \right) \ln \left( \frac { Z _ { t , i } } { Z _ { t , i } } \right) } \\ & { = \operatorname* { l i m } ( Z ) + \displaystyle \sum _ { i = 1 } ^ { N } \displaystyle \sum _ { i = 1 } ^ { N } \operatorname* { i n } \left( \frac { Z _ { t , i } } { Z _ { t , i } } \right) \ln \left( \frac { Z _ { t , i } } { \bar { X } _ { t } } \right) } \\ & { = \operatorname* { l i m } ( Z ) + \displaystyle \sum _ { i = 1 } ^ { N } \displaystyle \sum _ { i = 1 } ^ { N } \left( \frac { 1 } { Z _ { t , i } } \right) \ln \left( \frac { Z _ { t , i } } { \bar { X } _ { t } } \right) } \\ & { = \operatorname* { l i m } ( Z ) + \displaystyle \sum _ { i = 1 } ^ { N - 1 } \left( \displaystyle \sum _ { i = 1 } ^ { N } \frac { 1 } { Z _ { t , i } } \right) \ln \left( \frac { Z _ { t , i } } { \bar { X } _ { t } } \right) } \\ & { = \operatorname* { l i m } ( Z ) + \displaystyle \sum _ { i = 1 } ^ { N - 1 } \left( \displaystyle \sum _ { i = 1 } ^ { N } \frac { 1 } { Z _ { t , i } } \right) \ln \left( \frac { Z _ { t , i } } { \bar { X } _ { t } } \right) } \end{array}
+$$
+
+Define $\pi \in \mathbb { R } ^ { k \ell }$ where $\begin{array} { r } { \pi _ { i } = \frac { A _ { t , i } } { Z _ { t , i } } } \end{array}$ so $0 \leq \pi _ { i } \leq 1$ . We can solve the relaxed problem of maximizing over $\pi$ to upper bound the expression.
+
+$$
+\mathbb { E } [ P ( Z _ { t + 1 } ) - P ( Z _ { t } ) ] \leq \ln ( C ) + \sum _ { i = 0 } ^ { k \ell - 1 } \left( \prod _ { j = 0 } ^ { i } \pi _ { j } \right) \ln \left( \frac { 1 } { \pi _ { i } } \right)
+$$
+
+Define $\begin{array} { r } { f _ { \pi } ( \sigma ) = \pi \left( \ln \left( \frac { 1 } { \pi } \right) + \sigma \right) } \end{array}$ . Then,
+
+$$
+\begin{array} { l } { { \displaystyle \sum _ { i = 0 } ^ { k \ell - 1 } \left( \prod _ { j = 0 } ^ { i } \pi _ { j } \right) \ln \left( \frac { 1 } { \pi _ { i } } \right) = \pi _ { 0 } \ln \left( \frac { 1 } { \pi _ { 0 } } \right) + \pi _ { 0 } \pi _ { 1 } \ln \left( \frac { 1 } { \pi _ { 1 } } \right) + \dots + \pi _ { 0 } \pi _ { 1 } \dots \pi _ { k \ell - 1 } \ln \left( \frac { 1 } { \pi _ { k \ell - 1 } } \right) } } \\ { { \displaystyle \qquad ( 7 \pi _ { 0 } ( f _ { \pi _ { 1 } } ( \dots f _ { \pi _ { k \ell - 2 } } ( f _ { \pi _ { k \ell - 1 } } ( 0 ) ) \dots ) ) } } \\ { { \displaystyle \qquad ( 7 \pi _ { 0 } ( f _ { \pi _ { 1 } } ( \dots f _ { \pi _ { k \ell - 2 } } ( f _ { \pi _ { k \ell - 1 } } ( 0 ) ) \dots ) ) } } \end{array} ( 7 ) ~ ,
+$$
+
+Note that if $\sigma \leq 1$ , then $f _ { \pi } ( \sigma ) \leq 1$ for any $0 \leq \pi \leq 1$ . So, by induction,
+
+$$
+\sum _ { i = 0 } ^ { k \ell - 1 } \left( \prod _ { j = 0 } ^ { i } \pi _ { j } \right) \ln \left( { \frac { 1 } { \pi _ { i } } } \right) \leq 1
+$$
+
+and we get the result.
+
+Intuitively, if an algorithm can only increase $P ( Z _ { t } )$ (in expectation) by $1 + \ln ( C )$ for every iteration and the algorithm isn’t done until $\begin{array} { r } { P ( Z _ { t } ) \geq k \ell \ln \left( \frac { C } { \lambda } \right) } \end{array}$ , we have a lower bound.
+
+Lemma 9. For any algorithm that returns a subset of size at most $\lambda k$ at random iteration $\tau$ ,
+
+$$
+\operatorname* { P r } \left[ \tau \leq \left\lfloor \frac { k \ell \ln ( C / \lambda ) } { 2 ( 1 + \ln ( C ) ) } \right\rfloor \right] \leq \frac { 1 } { 2 }
+$$
+
+Proof. Noting that $P ( Z _ { 1 } ) = 0$ , for any $T$ ,
+
+$$
+\begin{array} { r l r } { { \mathbb { E } [ P ( Z _ { T + 1 } ) ] = \sum _ { t = 1 } ^ { T } \mathbb { E } [ P ( Z _ { t + 1 } - P ( Z _ { t } ) ] } } \\ & { } & { \leq T ( 1 + \ln ( C ) ) } \end{array}
+$$
+
+By Markov’s inequality,
+
+$$
+\begin{array} { r l } & { \operatorname* { P r } ( \tau \leq T ) \leq \operatorname* { P r } \left( P ( Z _ { T + 1 } ) \geq k \ell \ln \left( \frac { C } { \lambda } \right) \right) } \\ & { \qquad \leq \frac { \operatorname { \mathbb { E } } [ P ( Z _ { T + 1 } ) ] } { k \ell \ln \left( \frac { C } { \lambda } \right) } } \\ & { \qquad \leq \frac { T ( 1 + \ln ( C ) ) } { k \ell \ln \left( \frac { C } { \lambda } \right) } } \end{array}
+$$
+
+If we set $\begin{array} { r } { T = \lfloor \frac { k \ell \ln ( C / \lambda ) } { 2 ( 1 + \ln ( C ) ) } \rfloor } \end{array}$ , then $\textstyle \operatorname* { P r } ( \tau \leq T ) \leq { \frac { 1 } { 2 } }$ . Or equivalently,
+
+$$
+\operatorname* { P r } \left( \tau \geq \frac { k \ell \ln ( C / \lambda ) } { 2 ( 1 + \ln ( C ) ) } \right) \geq \frac { 1 } { 2 }
+$$
+
+Finally, we convert this bound into something more usable.
+
+Note that d∗ = k, m = kCℓ and N = kℓ + 1. Thus, ℓ = ln(m/k) .
+
+Set $C = \lceil e \lambda \rceil$
+
+Then, with probability at least $1 / 2$ , $\tau$ is at least,
+
+$$
+\begin{array} { r l } & { \frac { k \ell \ln ( C / \lambda ) } { 2 ( 1 + \ln ( C ) ) } \geq \frac { k \ln ( m / k ) \ln ( e ) } { 2 ( 1 + \ln ( e \lambda + 1 ) ) ( \ln ( e \lambda + 1 ) ) } } \\ & { \qquad \geq \frac { k \ln ( m / k ) } { 2 ( 2 + \ln ( \lambda ) + 1 / e ) ) ( 1 + \ln ( \lambda ) + 1 / e ) } } \\ & { \qquad \geq \frac { k \ln ( m / k ) } { 2 ( 3 + \ln ( \lambda ) ) ^ { 2 } } } \\ & { \qquad = \frac { d ^ { * } \ln ( m / d ^ { * } ) } { 2 ( 3 + \ln ( \lambda ) ) ^ { 2 } } } \end{array}
+$$
+
+If $\lambda \leq \lambda ^ { \prime } \log ( m ) \log ( N ) \leq \lambda ^ { \prime } \log ( m ) \log ( k \ln ( m / k ) )$ (for constant $\lambda ^ { \prime }$ ), then, the expected number of iterations is $\widetilde \Omega ( d ^ { * } \log ( m / d ^ { * } ) )$ .
+
+# F ERROR SQUASHING
+
+# F.1 BACKGROUND
+
+In this subsection, we review related theoretical work in more detail as background to our framework and algorithms.
+
+# F.1.1 SETCOVER AND INTERACTIVE VARIANTS
+
+Setcover is a classic computer science problem (Karp, 1972). While there are many similar and equivalent formulations, for this work, we formulate the problem in terms of $m$ binary decision variables and $N$ elements, where each element is represented by the decision variables that would “cover” the element: $Z _ { i } ~ \subset ~ [ m ]$ for each $i \in [ N ]$ . A solution is a subset $S \subset [ m ]$ such that $\forall i \in [ N ] : \exists s \in S : s \in Z _ { i }$ . In other words, we choose a subset $S \subset [ m ]$ of the decision variables so that all elements $Z _ { i }$ intersect $S$ . We wish to find a solution of smallest size $| S |$ .
+
+In the standard non-interactive version of setcover, all elements and sets are known, and there exist algorithms that return a solution of size $O ( \log ( N ) C _ { 0 \mathrm { { P T } } } )$ where $C _ { \mathrm { O P T } }$ is the size of the optimal solution set. In an interactive variant known as online set cover (Alon et al., 2009), the elements are not known at the beginning, only the number of decision variables $m$ . The algorithm is initialized with $S _ { 0 } = \emptyset$ . Then, for each iteration $t = 1 , 2 , \ldots$ , an adversary chooses an element $i _ { t } \in [ N ]$ that is not intersected by $S _ { t }$ (i.e. $S _ { t } \cap Z _ { i _ { t } } = \emptyset $ ) and reveals the decision variables that would cover $i _ { t }$ (i.e. $Z _ { i _ { t } }$ ). The algorithm then chooses a set $s _ { t }$ such that $s _ { t } \in Z _ { i _ { t } }$ is permanently added to the solution: $\boldsymbol { S _ { t } } ^ { \prime } = \boldsymbol { S _ { t - 1 } } \bar { \cup } \{ \boldsymbol { s _ { t } } \}$ . This process continues until all elements are covered and the adversary has no possible elements to choose. Note that the online set cover problem is harder than the standard set cover problem: if we were given all elements, we can simulate an adversary. Furthermore, the number of iterations $t$ is exactly the size of the final set. Alon et al. (2009) provides an algorithm that returns a solution of size $O ( \log ( N ) \log ( m ) C _ { \mathrm { O P T } } )$ where $C _ { \mathrm { O P T } }$ is the optimal (offline) solution.
+
+In this work, we examine another interactive set cover variant that is harder than standard set cover but is a relaxed version of online set cover. We call this exploratory set cover. Like online set cover, the elements are not known at the beginning; the algorithm is only given the number of decision variables $m$ . The algorithm has access to an adversarial oracle which takes a potential solution $S _ { t } \subset [ m ]$ and reveals either that $S _ { t }$ is a valid solution, or chooses an element $i _ { t }$ such that $Z _ { i _ { t } }$ has an empty intersection with $S _ { t }$ and reveals $Z _ { i _ { t } }$ . However, unlike the online set cover version, the sets $S _ { t }$ are arbitrary; for example, they need not be nested. At any iteration, the algorithm can return a final solution $\hat { S }$ that must intersect all $Z _ { i }$ . An algorithm is evaluated by two evaluation aspects, the number of exploratory iterations and the size of the final solution $| \hat { S } |$ .
+
+# F.1.2 SET COVER HARDNESS
+
+Set cover is one of Karp’s 21 NP-hard problems (Karp, 1972). Additionally, approximating set cover with an approximation factor of $o ( \log n )$ is computationally hard. To be specific, unless NP problems can be solved in $n ^ { O ( \log \log n ) }$ time (a slightly weaker statement than $\mathbf { P } = \mathbf { N P }$ ), there is no algorithm for set cover that always returns a set cover of size $( 1 - \epsilon ) \ln ( N ) C _ { \mathrm { O P T } }$ , where $C _ { \mathrm { O P T } }$ is the optimal set cover size (Feige, 1998). Alon et al. (2009) shows that approximating online set cover requires a larger approximation factor; any algorithm must return solutions of size at least $\widetilde \Omega ( \ln ( N ) \mathrm { l n } ( m ) C _ { 0 \mathrm { P T } } )$ where $C _ { \mathrm { O P T } }$ is the optimal (offline) solution (Alon et al., 2009). Note that the exploratory set cover problem is harder than standard set cover but easier than online set cover.
+
+# F.1.3 MACHINE TEACHING
+
+Machine teaching (Shinohara & Miyano, 1991; Goldman & Kearns, 1995) is a machine learning task where a teacher provides data points to the learner. In the most classic setting, the learner has a finite hypothesis class $\mathcal { H }$ , where each hypothesis is a mapping from $\mathcal { X }$ to $\mathcal { V }$ , the teacher knows the learner’s hypothesis class and which hypothesis is correct, and provides a teaching set $S \subset { \mathcal { X } }$ which uniquely determines the correct hypothesis. In particular, for a hypothesis class $\mathcal { H }$ and a correct hypothesis $h ^ { * }$ , a set $S$ is a teaching set if
+
+$$
+\forall h \in { \mathcal { H } } \setminus \{ h ^ { * } \} : \exists x \in S : h ( x ) \neq h ^ { * } ( x )
+$$
+
+Intuitively, if the teacher provides $\{ ( x , h ^ { \ast } ( x ) ) : x \in S \}$ to the learner, then the only remaining consistent hypothesis is $h ^ { * }$ .
+
+Machine teaching in this setting, where the teacher knows the entire hypothesis class of the learner, has a straightforward reduction to set cover. In particular, identify each hypothesis $h \in { \mathcal { H } } \setminus \{ h ^ { * } \}$ as an element to be covered and
+
+$$
+E _ { h } = \{ x \in \mathcal { X } : h ( x ) \neq h ^ { * } ( x ) \}
+$$
+
+as the decision variables (datapoints in subset) that cover $h$ .
+
+An important quantity is the size of the smallest teaching set $d ^ { * }$ , which is a function of both the hypothesis class $\mathcal { H }$ and the true hypothesis $h ^ { \ast } \in \mathcal { H }$ . Note that the “teaching dimension” (Goldman & Kearns, 1995), is the maximum of $d ^ { * }$ over all $h ^ { \ast } \in \mathcal { H }$ .
+
+For the general non-realizable setting, Cicalese et al. (2020) defines a $k$ -extended teaching set. For a hypothesis class $\mathcal { H }$ and true hypothesis $h ^ { * }$ , if $h ^ { * }$ makes $k$ errors on a dataset, then $S$ is a $k$ -extended teaching set if $| S \cap C _ { h } | \geq k + 1$ for any hypothesis that makes at least $k + 1$ errors.
+
+# F.2 INVARIANCE TO CONSISTENT ADDITIONS
+
+Suppose we have a hypothesis class $\mathcal { H }$ and a learner $L$ , where each $h \in \mathcal H$ is a function $h : \mathcal { X } \to \mathcal { Y }$ and the learner is a function:
+
+$$
+L : \mathcal { P } ( \mathcal { X } \times \mathcal { Y } ) \mathcal { H }
+$$
+
+Throughout this work, we make the following assumption about the learner.
+
+Definition 4 (Invariant to consistent additions). We say a learner is invariant to consistent additions $i f \forall D \subset \mathcal { P } ( \mathcal { X } \times \mathcal { Y } )$ , $x \subset \mathcal { X }$ , $y \subset \mathcal { V }$ :
+
+$$
+L ( D ) ( x ) = y \implies L ( D ) = L ( D \cup \{ ( x , y ) \} )
+$$
+
+A simple example of a learner that meets this condition is a “ranked minimal error learner”. To avoid handling infinite hypothesis classes, assume $\mathcal { X }$ is finite for this example. Fix a hypothesis class $\mathcal { H }$
+
+(note $| \mathcal { H } | \leq | \mathcal { V } | ^ { | \mathcal { X } | } )$ and a bijective ranking $\sigma : { \mathcal { H } } [ | { \mathcal { H } } | ]$ . A ranked minimal error learner returns the highest ranked hypothesis among the hypotheses in $\mathcal { H }$ achieving minimal error on the dataset:
+
+$$
+L ( D ) = \underset { \substack { h : | \{ ( x , y ) \in D : h ( x ) \neq y \} | = \operatorname* { m i n } _ { h ^ { \prime } \in \mathcal { H } } | \{ ( x , y ) \in D : h ^ { \prime } ( x ) \neq y \} | } } { \arg \operatorname* { m i n } } \sigma ( h )
+$$
+
+Proposition 1. A ranked minimal error learner is invariant to consistent additions.
+
+The proof of Proposition 1 can be found in Appendix F.6. The invariance to consistent additions is more general than ranked minimal error learners: see an example in Appendix F.7.1.
+
+# F.3 INDUCED HYPOTHESIS CLASSES
+
+Fix an size $m$ dataset $\{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { m } \subset ( \mathcal { X } \times \mathcal { Y } ) ^ { m }$ . Note that the learner might have a very large hypothesis class, maybe even large enough to fit arbitrary labels for a $m$ -sized dataset $\langle | \mathcal { H } | = | \mathcal { V } | ^ { m } )$ . However, we can define the induced hypothesis class as
+
+$$
+\overline { { \mathcal { H } } } = \{ L ( \{ ( x _ { i } , y _ { i } ) : i \in S \} ) : S \subset [ m ] \}
+$$
+
+which could be significantly smaller, depending on the structure of the model and data. Then, we can define the error sets as
+
+$$
+\mathcal { E } = \{ \{ i : h ( x _ { i } ) \neq y _ { i } \} : h \in \overline { { \mathcal { H } } } \} - \{ \emptyset \}
+$$
+
+where $E _ { h } \in \mathcal { E }$ is the set of datapoints that eliminate a hypothesis $h$ .
+
+For notational convenience, define $L ^ { ( \mathrm { e r r } ) } : \mathcal { P } ( [ m ] ) \mathcal { P } ( [ m ] )$ as the set of errors when trained on a subset $S$ :
+
+$$
+L ^ { \mathrm { ( e r r ) } } ( S ) = \{ i : L ( \{ ( x _ { i ^ { \prime } } , y _ { i ^ { \prime } } ) : i ^ { \prime } \in S \} ) ( x _ { i } ) \neq y _ { i } \}
+$$
+
+then, $\mathcal { E }$ is simply,
+
+$$
+\mathcal { E } = \{ L ^ { \mathrm { e r r } } ( S ) : S \subset [ m ] \} - \{ \varnothing \}
+$$
+
+# F.4 ERROR INCLUSIVITY
+
+We wish to find a set $S$ such that makes as few errors as if we trained on the entire dataset: $\vert L ^ { ( \mathrm { e r r } ) } ( S ) \vert = \vert L ^ { ( \mathrm { e r r } ) } ( [ m ] ) \vert$ . However, this condition is a bit general as we might happen to have $| L ^ { \mathrm { ( e r r ) } } ( \emptyset ) | \ = \ | L ^ { \mathrm { ( e r r ) } } ( [ m ] ) |$ , in which case $S \ = \ \emptyset$ is perhaps unlikely to generalize to test points. Instead, we might wish to find a set $S$ that, when trained on, yields no errors outside of $S$ .
+
+Definition 5. For a fixed dataset, we say a set is “error inclusive” if the following holds:
+
+$$
+L ^ { ( e r r ) } ( S ) \subset S
+$$
+
+Note that $[ m ]$ is always error inclusive. Furthermore, if a learner is invariant to consistent additions, ${ \cal L } ^ { ( \mathrm { e r r } ) } ( S ) \bar { = } \bar { \cal L } ^ { ( \mathrm { e r r } ) } ( [ m ] )$ .
+
+Proposition 5. Suppose a learner $L$ is invariant to consistent additions. If a set $S$ is error inclusive,
+
+$$
+L ^ { ( e r r ) } ( S ) = L ^ { ( e r r ) } ( [ m ] )
+$$
+
+The proof of Proposition 5 is in Appendix F.6. Interpreted further, $| L ^ { ( \mathrm { e r r } ) } ( S ) | = | L ^ { ( \mathrm { e r r } ) } ( [ m ] ) |$ and $L ^ { ( \mathrm { e r r } ) } ( [ m ] ) \subset S$ , meaning that $S$ contains the errors of training on the full dataset.
+
+# F.4.1 INTERPOLATING LEARNERS
+
+We say a learner is “interpolating” if it makes no training errors: $L ^ { ( \mathrm { e r r } ) } ( S ) \cap S = \emptyset$ . In this case, we can achieve 0 errors on the entire dataset. Furthermore, note that for interpolating learners, error inclusivity of a set $S$ implies that training on $S$ results in zero error on the entire dataset.
+
+# F.4.2 RESULTS
+
+Define the extended error sets as
+
+$$
+{ \mathcal { E } } ^ { + } = \{ L ^ { \mathrm { ( e r r ) } } ( S ) \setminus S : S \subset [ m ] \} - \{ \emptyset \}
+$$
+
+Proposition 3. Fix a dataset. If a learner is invariant to consistent additions,
+
+The proof can be found in Appendix F.6.
+
+Define
+
+$$
+d ^ { * } = \operatorname* { m i n } _ { \substack { s \mathrm { f u l l y i n t e r s e c t s } \varepsilon + } } | S |
+$$
+
+Note that in the case of interpolating learners, ${ \mathcal { E } } ^ { + } = { \mathcal { E } }$ , and $d ^ { * }$ is the size of the optimal teaching set.
+
+Thus, as in the machine teaching case, we have reduced the problem of finding a good subset to finding a minimal setcover, though of an expanded set.
+
+Note that we can convert a data subset selection algorithm with interpolating learners (online or exploratory set cover algorithm) into a subset selection algorithm without assuming an interpolating learner, simply by acting as if training errors don’t exist. In particular, if we train on a subset $S _ { t }$ and receive a hypothesis $h _ { t }$ , rather than intersecting $\{ i : h _ { t } ( x _ { i } ) \neq y _ { i } \}$ , we can intersect $\{ i : h _ { t } ( x _ { i } ) \neq$ $y _ { i } \wedge i \notin { \dot { S _ { t } } } \bar { \} }$ . Put another way, when using a realizable algorithm on a non-interpolating learner, we can “squash” the training errors and pretend they don’t exist. In fact, this technique is used as a heuristic in Cicalese et al. (2020) to make the algorithm work in practice. Thus, we provide a framework justifying the use of this technique previously used as a heuristic.
+
+# F.5 COMPARISON TO K-EXTENDED TEACHING DIMENSION
+
+Cicalese et al. (2020) introduces the concept of $k$ -extended teaching set for a hypothesis class $\mathcal { H }$ and a dataset $\{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { m } \subset ( \mathcal { X } \times \mathcal { Y } ) ^ { m }$ . In particular, let $\begin{array} { r } { k = \operatorname* { m i n } _ { h \in { \mathcal { H } } } | \{ i \in [ m ] : h ( x _ { i } ) \neq y _ { i } \} | } \end{array}$ be the minimal number of errors of a hypothesis in $\mathcal { H }$ . A set $S$ is a $k$ -extended teaching set, if for any $h \in \mathcal H$ such that $| \{ i \in [ m ] : h ( x _ { i } ) \neq y _ { i } \} | \ge k + 1$ , $| \{ i \in S : h ( x _ { i } ) \neq y _ { i } \} | \geq k + 1$ . In other words, any hypothesis that makes $k + 1$ errors (more than the optimal number) on the entire dataset, makes $k + 1$ errors on the selected subset $S$ .
+
+Here, for ranked minimal error learners, we compare $k$ -extended teaching sets to error inclusive sets (and thus sets that fully intersect ${ \mathcal { E } } ^ { + }$ ). Fix a dataset, hypotheses $\mathcal { H }$ , and ranking $\sigma$ . Let $k$ be the minimal number of errors for a hypothesis $h \in \mathcal H$ for $\vec { D }$ . For a ranked minimal error learner, $| L ^ { ( \mathrm { e r r } ) } ( [ m ] ) | = k$ , so an error inclusive set must make $k$ errors. Therefore any hypothesis $h$ where $\sigma ( h ) \div \bar { \sigma ( \cal L ( \{ ( x _ { i } , y _ { i } ) : i \in [ m ] \} ) ) } = \sigma ^ { * }$ must incur at least $k + 1$ errors on $S$ , and any hypothesis $h$ where $\sigma ( h ) > \sigma ( L ( \{ ( x _ { i } , y _ { i } ) : i \in [ m ] \} ) ) = \sigma ^ { * }$ must incur at least $k$ errors on $S$ . A comparison of the two concepts is shown in Table 5.
+
+Note that error inclusivity requires one less error on Type $\mathrm { I I }$ hypotheses and $k$ more errors on Type III (error optimal) hypotheses. We can construct cases where the smallest error inclusive subset is of size $m$ but the smallest $k$ -extended teaching set is of size 0 (see Appendix F.7.3). In the other direction, there are cases where the smallest error inclusive subset is of size 2 while the smallest $k$ -extended teaching set is of size $m - 1$ (see Appendix F.7.4). Thus, the two notions of optimality are similar but neither is a stronger condition than the other.
+
+Table 5: A comparison between $k$ -extended teaching sets and error inclusive sets. The three columns correspond to three types of hypotheses separated by two attributes: whether a hypothesis is ranked higher or lower than $\bar { L } ^ { ( \mathrm { e r r } ) } ( [ m ] )$ , and whether the total number of errors for a hypothesis is optimal, $k$ , or sub-optimal, $\geq k + 1$ . Note that $L ^ { \mathrm { ( e r r ) } } ( [ m ] )$ is the highest ranked hypothesis with optimal errors $k$ , so there are no hypotheses with $k$ errors and rank lower than $\sigma ^ { * }$ .
+
+
Hypothesis type
Type I
Type II
Type III
o(h) Total errors
<*
>g*
>g*
Errors for k-extended
≥k+1
≥k+1
=k
≥k+1
≥k+1
≥0
Errors for error inclusive
≥k+1
≥k
≥k
+
+# F.6 FRAMEWORK PROOFS
+
+# Proposition 1. A ranked minimal error learner is invariant to consistent additions.
+
+Proof. Suppose $L$ is a ranked minimal error learner with hypothesis class $\mathcal { H }$ and ranking $\sigma$ . Fix a dataset $D \subset \mathcal { P } ( \mathcal { X } \times \mathcal { Y } )$ , an input $x \in \mathcal { X }$ , and an output $y \in \mathcal { V }$ . It suffices to show that $L ( D ) ( x ) = y$ implies $L ( D ) = L ( D \cup ( x , y ) )$ .
+
+Define $D ^ { + } = D \cup \{ ( x , y ) \}$ . Define $E : \mathcal { P } ( \mathcal { X } \times \mathcal { Y } ) \times \mathcal { H } \mathbb { Z } _ { + }$ as $E ( D , h ) = | \{ ( x , y ) \in D :$ $h ( x ) \neq y \}$ .
+
+$$
+\begin{array} { l } { \displaystyle \quad \underline { E } = \operatorname* { m i n } _ { h \in \mathcal H } E ( D , h ) } \\ { \displaystyle \underline { E } ^ { + } = \operatorname* { m i n } _ { h \in \mathcal H } E ( D ^ { + } , h ) } \\ { \displaystyle M = \{ h : E ( D , h ) = \underline { E } \} } \\ { \displaystyle M ^ { + } = \{ h : E ( D ^ { + } , h ) = \underline { E } ^ { + } \} } \end{array}
+$$
+
+note that
+
+$$
+\begin{array} { c } { { L ( D ) = \underset { h \in { \cal M } } { \arg \operatorname* { m i n } } \sigma ( h ) } } \\ { { L ( D ^ { + } ) = \underset { h \in { \cal M } ^ { + } } { \arg \operatorname* { m i n } } \sigma ( h ) } } \end{array}
+$$
+
+Define
+
+$$
+\begin{array} { r } { \underline { { \sigma } } = \underset { h \in M } { \operatorname* { m i n } } \sigma ( h ) } \\ { \underline { { \sigma } } ^ { + } = \underset { h \in M } { \operatorname* { m i n } } \sigma ( h ) } \end{array}
+$$
+
+Because $L ( D ) \in { \cal M } , E ( D , L ( D ) ) = \underline { { E } } .$ .
+
+Because $D \subset D ^ { + }$ , so $E ^ { + } \geq \underline { { E } }$ .
+
+Therefore, $E ^ { + } = E$ .
+
+Because $E ( D , h ) \leq E ( D ^ { + } , h )$ and $\underline { { E } } ^ { + } = \underline { { E } } , M ^ { + } \subset M$ . Furthermore, $E ( D ^ { + } , L ( D ) ) = \underline { { E } } = \underline { { E } } ^ { + }$ , so $L ( D ) \in { \mathrm { \Omega } } M ^ { + }$ .
+
+$$
+\sigma ( L ( D ) ) = \operatorname* { m i n } _ { h \in M } \sigma ( h ) \leq \operatorname* { m i n } _ { h \in M ^ { + } } \sigma ( h ) \leq \sigma ( L ( D ) )
+$$
+
+Because $\sigma$ is bijective, it has a unique argmax.
+
+so $L ( D ^ { + } ) = \arg \operatorname* { m i n } _ { h \in M ^ { + } } \sigma ( h ) = L ( D ) .$
+
+Lemma 10. Suppose a learner $L$ is invariant to consistent additions. Then, for a fixed dataset $\{ ( x _ { i } , y _ { i } ) : i \in [ \bar { m } ] \}$ , and for any subsets $S , S ^ { \prime } \subset [ m ]$ ,
+
+$$
+L ^ { ( e r r ) } ( S ) \cap S ^ { \prime } = \varnothing \implies L ^ { ( e r r ) } ( S \cup S ^ { \prime } ) = L ^ { ( e r r ) } ( S )
+$$
+
+Proof. We prove by induction on the size of $S ^ { \prime }$
+
+As the base case, if $| S ^ { \prime } | = 0$ , the statement trivially holds.
+
+Suppose the lemma holds for any $| S ^ { \prime } | = k$ . Now, we must show $L ^ { ( \mathrm { e r r } ) } ( S ) \cap S ^ { \prime } = \varnothing \implies L ^ { ( \mathrm { e r r } ) } ( S \cup$ $S ^ { \prime } \dot { ) } = L ^ { ( \mathrm { e r r } ) } ( S )$ for $| S ^ { \prime } | = k + 1$ .
+
+Choose $s$ and $S ^ { \prime \prime }$ with $\left| S ^ { \prime \prime } \right| = k$ such that $S ^ { \prime } = S ^ { \prime \prime } \cup \{ s \}$ . Then, $L ^ { ( \mathrm { e r r } ) } ( S ) \cap S ^ { \prime } = \emptyset$ implies $L ^ { ( \mathrm { e r r } ) } ( S ) \cap S ^ { \prime \prime } = \emptyset$ and thus $L ^ { ( \mathrm { e r r } ) } ( S \cup S ^ { \prime \prime } ) = L ^ { ( \mathrm { e r r } ) } ( S )$ .
+
+Furthermore, $L ^ { ( \mathrm { e r r } ) } ( S ) \cap S ^ { \prime } = \emptyset$ implies $s \not \in L ^ { ( \mathrm { e r r } ) } ( S ) = L ^ { ( \mathrm { e r r } ) } ( S \cup S ^ { \prime \prime } )$ . Therefore,
+
+$$
+L ( \{ ( x _ { i } , y _ { i } ) : i \in S \cup S ^ { \prime \prime } \} ) ( x _ { s } ) = y _ { s }
+$$
+
+since the learner is invariant to consistent additions,
+
+$$
+\begin{array} { r } { z ( \{ ( x _ { i } , y _ { i } ) : i \in S \cup S ^ { \prime \prime } \} ) = L ( \{ ( x _ { i } , y _ { i } ) : i \in S \cup S ^ { \prime \prime } \} \cup \{ ( x _ { s } , y _ { s } ) \} ) = L ( ( x _ { i } , y _ { i } ) : i \in S \cup S ^ { \prime \prime } \cup \{ s \} ) } \end{array}
+$$
+
+$$
+L ^ { ( \operatorname { e r r } ) } ( S ) = L ^ { ( \operatorname { e r r } ) } ( S \cup S ^ { \prime \prime } ) = L ^ { ( \operatorname { e r r } ) } ( S \cup S ^ { \prime \prime } \cup \{ s \} ) = L ^ { ( \operatorname { e r r } ) } ( S \cup S ^ { \prime } )
+$$
+
+Proposition 5. Suppose a learner $L$ is invariant to consistent additions. If a set $S$ is error inclusive,
+
+$$
+L ^ { ( e r r ) } ( S ) = L ^ { ( e r r ) } ( [ m ] )
+$$
+
+Proof. Note that since $L ^ { \mathrm { ( e r r ) } } ( S ) \subset S , L ^ { \mathrm { ( e r r ) } } ( S ) \cap ( [ m ] \setminus S ) = \emptyset .$
+
+By Lemma 10, this implies $L ( S ) = L ( S \cup ( [ m ] \setminus S ) ) = L ( [ m ] )$ . Then, $L ^ { \mathrm { ( e r r ) } } ( S ) = L ^ { \mathrm { ( e r r ) } } ( [ m ] )$ .
+
+Lemma 11. Suppose a learner $L$ is invariant to consistent additions. For any sets $S ^ { * } , S \subset [ m ] , i f$ $S ^ { * }$ is error inclusive, then either
+
+$$
+| ( L ^ { ( e r r ) } ( S ) \setminus S ) \cap S ^ { * } | \geq 1
+$$
+
+or
+
+$$
+L ^ { ( e r r ) } ( S ^ { * } ) = L ^ { ( e r r ) } ( S )
+$$
+
+Proof. By the assumption of error inclusivity, $L ^ { ( \mathrm { e r r } ) } ( S ^ { * } ) \setminus S ^ { * } = \emptyset$ .
+
+Thus $L ^ { ( \mathrm { e r r } ) } ( S ^ { * } ) \cap \lnot S ^ { * } \cap S = \emptyset$ and $L ^ { ( \mathrm { e r r } ) } ( S ^ { * } ) \cap ( S \setminus S ^ { * } ) = \emptyset$ . Since $L$ is invariant to consistent additions, $L ^ { \mathrm { ( e r r ) } } ( S ^ { * } ) = L ^ { \mathrm { ( e r r ) } } ( S ^ { * } \cup ( S \setminus S ^ { * } ) ) = L ^ { \mathrm { ( e r r ) } } ( S \cup S ^ { * } ) .$ .
+
+Suppose the first conclusion is not satisfied: $( L ^ { ( \mathrm { e r r } ) } ( S ) \setminus S ) \cap S ^ { * } = \emptyset$ , then $L ^ { ( \mathrm { e r r } ) } ( S ) \cap ( S ^ { * } \setminus S ) = \emptyset$ .
+Since the learner is invariant to consistent additions, $L ^ { \mathrm { ( e r r ) } } ( S ) = L ^ { \mathrm { ( e r r ) } } ( S \cup ( S ^ { * } \setminus S ) ) ^ { * } = L ^ { \mathrm { ( e r r ) } } ( S \cup S ^ { * } )$ .
+
+Thus, $L ^ { \mathrm { ( e r r ) } } ( S ) = L ^ { \mathrm { ( e r r ) } } ( S \cup S ^ { * } ) = L ^ { \mathrm { ( e r r ) } } ( S ^ { * } ) .$
+
+Proposition 3. If a learner $L$ is invariant to consistent additions, then,
+
+Proof. : Suppose $S$ fully intersects ${ \mathcal { E } } ^ { + }$ . Then, for any set $S ^ { \prime }$ , either $L ^ { ( \mathrm { e r r } ) } ( S ^ { \prime } ) \ \backslash \ S ^ { \prime } \ = \ \varnothing$ or $| ( L ^ { ( \mathrm { e r r } ) } ( S ^ { \prime } ) \setminus S ^ { \prime } ) \cap S | \ge 1$ .
+
+Set $S ^ { \prime } = S$ . Then, because $( L ^ { ( \mathrm { e r r } ) } ( S ) \setminus S ) \cap S = \emptyset$ , it must be the case that $L ^ { ( \mathrm { e r r } ) } ( S ) \setminus S = \emptyset$ and thus $S$ is error inclusive.
+
+: Suppose a set $S$ is error inclusive.
+
+Pick any set $S ^ { \prime } \subset [ m ]$ . It suffices to show that either $L ^ { ( \mathrm { e r r } ) } ( S ^ { \prime } ) / S ^ { \prime } = \emptyset$ or $| ( L ^ { \mathrm { ( e r r ) } } ( S ^ { \prime } ) / S ^ { \prime } ) \cap S | \ge 1$
+
+By Lemma 11, there are two cases:
+
+Case 1: $| ( L ^ { ( \mathrm { e r r } ) } ( S ^ { \prime } ) \setminus S ^ { \prime } ) \cap S | \geq 1$ .
+
+We are done.
+
+Case 2: $L ^ { \mathrm { ( e r r ) } } ( S ) = L ^ { \mathrm { ( e r r ) } } ( S ^ { \prime } )$ and $( L ^ { ( \mathrm { e r r } ) } ( S ^ { \prime } ) \setminus S ^ { \prime } ) \cap S = \emptyset$ .
+
+$$
+\begin{array} { r l r } & { } & { ( L ^ { ( \mathrm { e r r } ) } ( S ^ { \prime } ) \setminus S ^ { \prime } ) \cap S = \emptyset } \\ & { } & { ( L ^ { ( \mathrm { e r r } ) } ( S ^ { \prime } ) \cap S ) \cap \neg S ^ { \prime } = \emptyset } \\ & { } & { ( L ^ { ( \mathrm { e r r } ) } ( S ) \cap S ) \cap \neg S ^ { \prime } = \emptyset } \\ & { } & { L ^ { ( \mathrm { e r r } ) } ( S ) \cap \neg S ^ { \prime } = \emptyset } \\ & { } & { L ^ { ( \mathrm { e r r } ) } ( S ^ { \prime } ) \cap \neg S ^ { \prime } = \emptyset } \\ & { } & { L ^ { ( \mathrm { e r r } ) } ( S ^ { \prime } ) \setminus S ^ { \prime } = \emptyset } \end{array}
+$$
+
+where the third to last line follows from the error inclusivity of $S$ .
+
+# F.7 EXAMPLES
+
+# F.7.1 EXAMPLE OF LEARNER THAT IS NOT A MINIMAL ERROR LEARNER, BUT IS INVARIANT TO CONSISTENT ADDITIONS
+
+We examine a situation with three datapoints and binary labels. The dataset is $\begin{array} { r l } { D } & { { } = } \end{array}$ $\{ ( x _ { 1 } , 0 ) , ( x _ { 2 } , 0 ) , ( x _ { 3 } , 0 ) \}$ and the learner $L$ has two hypotheses $h _ { 1 }$ and $h _ { 2 }$ where
+
+$$
+\begin{array} { r l } & { h _ { 1 } ( x _ { 1 } ) = 1 } \\ & { h _ { 1 } ( x _ { 2 } ) = 0 } \\ & { h _ { 1 } ( x _ { 3 } ) = 0 } \\ & { h _ { 2 } ( x _ { 1 } ) = 0 } \\ & { h _ { 2 } ( x _ { 2 } ) = 1 } \\ & { h _ { 2 } ( x _ { 3 } ) = 1 } \end{array}
+$$
+
+the learner has the following mapping:
+
+$$
+\begin{array} { r l r } & { } & { L ( \emptyset ) = h _ { 2 } } \\ & { } & { L ( \{ ( x _ { 1 } , 0 ) \} ) = h _ { 2 } } \\ & { } & { L ( \{ ( x _ { 2 } , 0 ) \} ) = h _ { 1 } } \\ & { } & { L ( \{ ( x _ { 3 } , 0 ) \} ) = h _ { 1 } } \\ & { } & { L ( \{ ( x _ { 1 } , 0 ) , ( x _ { 2 } , 0 ) \} ) = h _ { 1 } } \\ & { } & { L ( \{ ( x _ { 1 } , 0 ) , ( x _ { 3 } , 0 ) \} ) = h _ { 2 } } \\ & { } & { L ( \{ ( x _ { 1 } , 0 ) , ( x _ { 3 } , 0 ) \} ) = h _ { 2 } } \\ & { } & { L ( \{ ( x _ { 2 } , 0 ) , ( x _ { 3 } , 0 ) \} ) = h _ { 1 } } \\ & { } & { L ( \{ ( x _ { 1 } , 0 ) , ( x _ { 2 } , 0 ) , ( x _ { 3 } , 0 ) \} ) = h _ { 2 } } \end{array}
+$$
+
+Note that $h _ { 2 }$ has two errors on $D$ , while $h _ { 1 }$ only has one error. However, $L ( D ) = h _ { 2 }$ . Thus, the learner does not return the hypothesis with minimal error.
+
+However, a simple examination yields invariance to consistent additions. For example, $L ( \{ ( x _ { 2 } , 0 ) \} ) ( x _ { 3 } ) { \bar { = } } y _ { 3 }$ and $L ( \{ ( x _ { 2 } , 0 ) \} ) = L ( \{ ( x _ { 2 } , 0 ) , ( x _ { 3 } , 0 ) \} )$ .
+
+# F.7.2 COMPARISON BETWEEN INDUCED HYPOTHESIS CLASS AND EXTENDED ERROR SETS
+
+Here we show that ${ \mathcal { E } } ^ { + }$ can be larger than $\mathcal { E }$ .
+
+We examine a situation with three datapoints and binary labels. The dataset is $\begin{array} { r l } { D } & { { } = } \end{array}$ $\{ ( x _ { 1 } , 0 ) , ( x _ { 2 } , 0 ) , ( x _ { 3 } , 0 ) \}$ and the learner $L$ has two hypotheses $h _ { 1 }$ and $h _ { 2 }$ where
+
+$$
+\begin{array} { r l } & { h _ { 1 } ( x _ { 1 } ) = 1 } \\ & { h _ { 1 } ( x _ { 2 } ) = 0 } \\ & { h _ { 1 } ( x _ { 3 } ) = 0 } \\ & { h _ { 2 } ( x _ { 1 } ) = 0 } \\ & { h _ { 2 } ( x _ { 2 } ) = 1 } \\ & { h _ { 2 } ( x _ { 3 } ) = 1 } \end{array}
+$$
+
+$$
+\begin{array} { r l r } & { } & { L ( \emptyset ) = h _ { 2 } } \\ & { } & { L ( \{ ( x _ { 1 } , 0 ) \} ) = h _ { 2 } } \\ & { } & { L ( \{ ( x _ { 2 } , 0 ) \} ) = h _ { 1 } } \\ & { } & { L ( \{ ( x _ { 3 } , 0 ) \} ) = h _ { 1 } } \\ & { } & { L ( \{ ( x _ { 1 } , 0 ) , ( x _ { 2 } , 0 ) \} ) = h _ { 1 } } \\ & { } & { L ( \{ ( x _ { 1 } , 0 ) , ( x _ { 3 } , 0 ) \} ) = h _ { 2 } } \\ & { } & { L ( \{ ( x _ { 1 } , 0 ) , ( x _ { 3 } , 0 ) \} ) = h _ { 2 } } \\ & { } & { L ( \{ ( x _ { 2 } , 0 ) , ( x _ { 3 } , 0 ) \} ) = h _ { 1 } } \\ & { } & { L ( \{ ( x _ { 1 } , 0 ) , ( x _ { 2 } , 0 ) , ( x _ { 3 } , 0 ) \} ) = h _ { 1 } } \end{array}
+$$
+
+Then, $\mathcal { E } ^ { + } = \{ \{ 1 \} , \{ 2 , 3 \} , \{ 2 \} , \{ 3 \} \}$ while $\mathcal { E } = \{ \{ 1 \} , \{ 2 , 3 \} \}$ .
+
+# F.7.3 K-EXTENDED TEACHING SET SUPERIORITY
+
+In the following example, $\mathcal { H } = \{ h _ { i } \} _ { i }$ and $\sigma ( h _ { i } ) = i$ .
+
+$$
+\begin{array} { c } { y . = ( 0 , 0 , 0 , \ldots , 0 , 0 ) } \\ { \ } \\ { h _ { 1 } ( x . ) = ( 1 , 0 , 0 , 0 , \ldots , 0 , 0 ) } \\ { \ h _ { 2 } ( x . ) = ( 0 , 1 , 0 , 0 , 0 , \ldots , 0 , 0 ) } \\ { h _ { 3 } ( x . ) = ( 0 , 0 , 1 , 0 , 0 , \ldots , 0 , 0 ) } \\ { h _ { 4 } ( x . ) = ( 0 , 0 , 0 , 1 , 0 , \ldots , 0 , 0 ) } \\ { \ \cdot \cdot \cdot } \\ { h _ { m } ( x . ) = ( 0 , 0 , 0 , 0 , 0 , \ldots , 0 , 1 ) } \end{array}
+$$
+
+In this case, the smallest 1-extended teaching set is $\varnothing$ while the smallest error inclusive set is $\{ 1 , 2 , \ldots , m \}$ .
+
+# F.7.4 ERROR INCLUSIVITY SUPERIORITY
+
+In the following example, $\mathcal { H } = \{ h _ { i } \} _ { i }$ and $\sigma ( h _ { i } ) = i$ .
+
+$$
+\begin{array} { r } { y . = ( 0 , 0 , 0 , 0 , 0 , \ldots , 0 , 0 , 0 ) } \\ { h _ { 1 } ( x . ) = ( 1 , 0 , 0 , 0 , 0 , \ldots , 0 , 0 , 0 ) } \\ { h _ { 2 } ( x . ) = ( 0 , 1 , 0 , 0 , 0 , \ldots , 0 , 0 , 1 ) } \\ { h _ { 3 } ( x . ) = ( 0 , 0 , 1 , 0 , 0 , \ldots , 0 , 0 , 1 ) } \\ { h _ { 4 } ( x . ) = ( 0 , 0 , 0 , 1 , 0 , \ldots , 0 , 0 , 1 ) } \\ { \ldots } \\ { h _ { m - 1 } ( x . ) = ( 0 , 0 , 0 , 0 , 0 , \ldots , 0 , 1 , 1 ) } \end{array}
+$$
+
+In this case, the smallest 1-extended teaching set is $\{ 2 , 3 , \ldots , m \}$ while the smallest error inclusive set is $\{ 1 , m \}$ .
\ No newline at end of file
diff --git a/md/dev/tGbpgz6yOrI/tGbpgz6yOrI.md b/md/dev/tGbpgz6yOrI/tGbpgz6yOrI.md
new file mode 100644
index 0000000000000000000000000000000000000000..1a4f49487ad700b9f43cee366ca94476cb2fb7ae
--- /dev/null
+++ b/md/dev/tGbpgz6yOrI/tGbpgz6yOrI.md
@@ -0,0 +1,334 @@
+# R3M: A Universal Visual Representation for Robot Manipulation
+
+Suraj $\mathbf { N a i r ^ { 1 , * } }$ , Aravind Rajeswaran2, Vikash Kumar2, Chelsea $\mathbf { F i n n ^ { 1 } }$ , Abhinav Gupta2
+
+1Stanford University, 2Meta AI
+
+Abstract: We study how visual representations pre-trained on diverse human video data can enable data-efficient learning of downstream robotic manipulation tasks. Concretely, we pre-train a visual representation using the Ego4D human video dataset using a combination of time-contrastive learning, video-language alignment, and an L1 penalty to encourage sparse and compact representations. The resulting representation, R3M, can be used as a frozen perception module for downstream policy learning. Across a suite of 12 simulated robot manipulation tasks, we find that R3M improves task success by over $2 0 \%$ compared to training from scratch and by over $1 0 \%$ compared to state-of-the-art visual representations like CLIP and MoCo. Furthermore, R3M enables a Franka Emika Panda arm to learn a range of manipulation tasks in a real, cluttered apartment given just 20 demonstrations.
+
+Keywords: Visual Representation Learning, Robotic Manipulation
+
+# 1 Introduction
+
+How do we train a robot to complete a manipulation task from images? A standard and widely used approach is to train an end-to-end model from scratch using data from the same domain [1]. However, this can be prohibitively data intensive and severely limits generalization. In contrast, computer vision and natural language processing (NLP) have recently taken a major departure from this “tabula rasa” paradigm. These fields have focused on using diverse, large-scale datasets to build reusable, pre-trained representations. Such models have become ubiquitous; for example, visual representations from ImageNet [2] can be reused for tasks like cancer detection [3], and pre-trained language embeddings like BERT [4] have been used for everything from medical coding [5] to visual question answering [6]. Such an equivalent of an ImageNet [2] or BERT [4] model for robotics, that can be readily downloaded and used for any downstream simulation or real-world manipulation task, has remained elusive.
+
+Why have we struggled in building this universal representation for robotics? Our conjecture is that we haven’t converged on using the appropriate datasets for robotics. Collecting large and diverse datasets of robots interacting with the physical world can be costly, even without human annotation. Recent attempts at creating such datasets [7, 8, 9, 10], consist of a limited number of tasks in at most a handful of different environments. This lack of diversity and scale makes it difficult to learn representations that are broadly applicable. At the same time, the recent history of computer vision and NLP suggests an alternate route for robotics. The best representations in these fields did not arise out of task-specific and carefully curated datasets, but rather the use of abundant in-the-wild data [4, 11, 12, 13]. Analogously, for robotics and motor control, we have access to videos of humans interacting in semantically interesting ways with their environments [14, 15, 16]. This data is large and diverse, spanning scenes across the globe, and tasks ranging from folding clothes to cooking a meal. While the embodiment present in this data differs from most robots, prior work [17, 18] has found that such human video data can still be useful for learning reward functions. Furthermore, domain gap has not been a major barrier for using pre-trained representations in traditional vision and NLP tasks. In this backdrop, we ask the pertinent question: can visual representations pre-trained on diverse human videos enable efficient downstream learning of robotic manipulation skills?
+
+
+Figure 1: Pre-Training Reusable Representations for Robot Manipulation (R3M): We pre-train a visual representation using diverse human video datasets like Ego4D [16], and study its effectiveness for downstream robot manipulation tasks. Our representation model, R3M, is trained using a combination of time-contrastive learning, video-language alignment, and an L1 sparsity penalty. We find that R3M enables data efficient imitation learning across several simulated and real-world robot manipulation tasks.
+
+We hypothesize that a good representation for vision-based robotic manipulation consists of three components. First, it should contain information necessary for physical interaction, and thus should capture the temporal dynamics of the scene (i.e. how states might transition to other states). Second, it should have a prior over semantic relevance, and should focus on task relevant features like objects and their relationships. Finally, it should be compact, and not include features irrelevant to the above criteria (e.g. backgrounds). Towards satisfying these three criteria, we study a representation learning approach that combines (1) time contrastive learning [19] to learn a representation that captures temporal dynamics, (2) video-language alignment to capture semantically relevant features of the scene, and (3) L1 and L2 penalties to encourage sparsity. Our experimental evaluation in Section 4.4 finds that all three components are important for training highly performant representations.
+
+In this work we empirically demonstrate that representations pre-trained on diverse human video datasets like Ego4D [16] can enable efficient downstream policy learning for robotic manipulation. Our core contribution is an artifact – the pre-trained vision model – that can be used readily in other work. Concretely, we pre-train a reusable representation for robotic manipulation (R3M), which can be used as a frozen perception module for downstream policy learning in simulated and real robot manipulation tasks. We demonstrate this via extensive experimental results across three existing benchmark simulation environments (Adroit [20], Franka-Kitchen [21], and MetaWorld [22]) as well as real robot experiments in a cluttered apartment setting. R3M features outperform a wide range of visual representations like CLIP [12], (supervised) ImageNet [2], MoCo [23, 24], and learning from scratch by over $10 \%$ when evaluated across 12 tasks, 9 viewpoints, and 3 different simulation environments. On a Franka Emika Panda robot, R3M enables learning challenging tasks like putting lettuce in a pan and folding a towel with a $50 \%$ average success rate, given less than 10 minutes of human demonstrations (see Figure 1), which is nearly double the success rate compared to CLIP features. Overall, on the basis of these results, we believe that R3M has the potential to become a standard vision model for robot manipulation, which can be simply downloaded and used off-the-shelf for any robot manipulation task or environment. See https: //sites.google.com/view/robot-r3m for pre-trained models and code.
+
+# 2 Related Work
+
+Representation Learning for Robotics. Our work is certainly not the first to study the problem of learning general representations for robotics. One line of work focuses on learning representations from in-domain data, that is, using data from the target environment and task for training the representation. Such methods include contrastive learning with data augmentation [25, 26, 27, 28], dynamics prediction [29, 30], bi-simulation [31], temporal or goal distance [32, 33], or domain specific information [34]. However, because they are trained on data exclusively from the target domain and task, the learned representations fail to generalize and cannot be re-used to enable faster learning in unseen tasks and environments.
+
+Recently, there has been growing interest in learning more general representations for motor control from large-scale out-of-domain data like images from the web. This includes the use of CLIP, supervised MS-COCO, supervised ImageNet, MoCo ImageNet features, or data from different robots [35, 36, 37, 38, 23, 39]. In contrast to prior work, we pre-train the representation using diverse human video and language data, as opposed to static frames and/or class labels. Further, in our experimental evaluation, we observe that our pre-trained representation outperforms prior work significantly on a comprehensive evaluation suite. Concurrently, Xiao et al. [40] also explore the use of human interaction data to pre-train visual representations for motor control. However their learned representation only uses static frames from these videos and does not utilize temporal or semantic information like R3M. Furthermore, our evaluation focuses on data efficient imitation learning, and enables real-world learning in cluttered environments with just $\sim 1 0$ minutes of demonstration data.
+
+Leveraging Human Videos for Robot Learning. Several prior works have explored using human video data in robot learning, for example to acquire goals [41, 42, 43], to learn visual dynamics models [44, 45, 46, 47], or to learn representations and rewards [19, 48, 49, 50, 51, 52]. However, these prior works typically focus on a small dataset of human videos closely resembling the robot environment. In contrast, our work leverages diverse human video data like Ego4D [16] to learn visual reusable visual representations that generalize broadly.
+
+Natural Language and Robotic Manipulation. Prior works have explored the use of natural language in robot manipulation, primarily as a means of task specification [53, 54, 36, 55] or reward learning [56]. In contrast, we use diverse human video data and language annotations to learn reusable visual representations for control. Prior work has also found visual representations informed by language, like CLIP [12], to be effective for control [36, 37]. Through empirical evaluations, we find that our R3M representation substantially outperforms CLIP for robot manipulation.
+
+Learning from Diverse Robot Data. Towards robots that generalize more broadly, there are a number of works that study how to scale up the size and diversity of data robots learn from. Many of these works focus on collecting and learning from robot data itself [57, 58, 7, 8, 9, 10, 59]. However, these works often contain at most a handful of different environments, making generalization across a range of unseen scenes difficult. While we also aim to enable generalization by learning from diverse data, our focus is instead on (1) learning from human video data and hence a larger distribution of environments and tasks, and (2) pre-training a visual representation, as opposed to policies or models.
+
+Representation Learning from Videos. Finally, there is a rich literature of works that study learning image representations from videos [60, 61, 19, 62, 63, 64] outside of the context of robotics. Additionally, there are a number of works that use language to learn representations from videos [65, 66]. Critically, unlike all of these works, the main contribution of this work is not to propose a novel representation learning approach, but rather in studying if representations trained on diverse video and language of human interaction can enable more efficient learning of robotic manipulation.
+
+# 3 R3M: Reusable Representations for Robotic Manipulation
+
+Our goal is to use diverse human video data to pre-train a single reusable visual representation for motor control, particularly robotic manipulation, that can enable efficient downstream learning in previously unseen environments and tasks. In this section, we cover the different components of our approach, beginning by describing our problem formulation in Section 3.1, the data sources we use in Section 3.2, and our training objective in Section 3.3.
+
+# 3.1 Preliminaries
+
+Formally, we assume that we have access to a dataset $\mathcal { D }$ of $N$ videos, where each video consists of a sequence of RGB frames $[ I _ { 0 } , I _ { 1 } , . . . , I _ { T } ]$ . Additionally, we assume that each video is paired with a natural language description $l$ , that describes what task is being completed in the video. From this data, our goal is to learn a single image encoder $\mathcal { F } _ { \phi }$ , that maps images to a deterministic, continuous embedding, that is $z = \mathcal { F } _ { \phi } ( I )$ . Once trained, we want to be able to repeatedly reuse $\mathcal { F }$ for downstream policy learning. Specifically, the downstream problem will involve an agent sequentially choosing actions given image observations $I$ , and instead of using raw images as input, the agent will use the pre-trained ${ \mathcal { F } } _ { \phi } ( I )$ as a state representation.
+
+
+Figure 2: Ego4D [16] Video and Language (left). Sample frames and associated language from Grauman et al. [16] used for training R3M. R3M Training (right). We train R3M with time contrastive learning, encouraging states closer in time to be closer in embedding space and video-language alignment to encourage the embeddings to capture semantically relevant features.
+
+# 3.2 Data Sources
+
+For our learned representation $\mathcal { F } _ { \phi }$ to be useful in a wide range of downstream tasks and environments, it should (1) be trained on data that is diverse enough to facilitate generalization, and (2) provide a useful signal for features relevant to robotic manipulation. One approach would be to be use natural images off the web (e.g. ImageNet [2]). While diverse, these images tend to focus on one particular object, and do not capture an agent interacting with multiple objects in a scene. Alternatively, data of humans interacting in the world [14, 65, 16] is both diverse and contains useful interaction in scenes similar to those we would like robots to interact in. Of the many human video datasets, we leverage the Ego4D dataset [16] due to it’s diversity and size, although in principle our method can be used on any suitable video dataset. Ego4D contains videos of people engaging in a wide range of tasks from cooking to socializing to assembling objects from more than 70 locations across the globe, and in total contains more than 3500 hours of data. Each video clip also contains a natural language annotation describing the behavior of the person in the video (See Figure 2 (left)).
+
+# 3.3 Training R3M
+
+What should a good representation for robotic manipulation from human video data capture? We propose three key components: (1) it should capture temporal dynamics, as the agent will be sequentially interacting in the environment to accomplish tasks, (2) it should capture semantically relevant features, and (3) it should be compact. We next describe how we use time contrastive learning to capture (1), video-language alignment for (2), and the use of L1 regularization to encourage (3). See Figure 2 (right) for an overview of our training objective.
+
+Time Contrastive Learning. To encourage $\mathcal { F } _ { \phi }$ to capture features relevant to physical interaction and sequential decision making, the first part of our objective is a time contrastive loss [61]. Given a batch of videos we train the encoder to produce a representation such that the distance between images closer in time is smaller than for images farther in time or from different videos. Specifically, we sample a batch of sequences of frames $[ I _ { i } , I _ { j > i } , I _ { k > j } ] ^ { 1 : B }$ , then minimize the InfoNCE loss [67]:
+
+$$
+\mathcal { L } _ { t c n } = - \sum _ { b \in B } \log \frac { e ^ { S ( z _ { i } ^ { b } , z _ { j } ^ { b } ) } } { e ^ { S ( z _ { i } ^ { b } , z _ { j } ^ { b } ) } + e ^ { S ( z _ { i } ^ { b } , z _ { k } ^ { b } ) } + e ^ { S ( z _ { i } ^ { b } , z _ { i } ^ { \ne b } ) } }
+$$
+
+where $z = \mathcal { F } _ { \phi } ( I )$ , and $z _ { i } ^ { \neq b }$ is a negative example sampled from a different video in the batch. $s$
+denotes a measure of similarity, which in our case is implemented as the negative L2 distance.
+
+Video-Language Alignment. To encourage $\mathcal { F } _ { \phi }$ to capture semantically relevant features, we train a language prediction module from the embedding outputted by $\mathcal { F } _ { \phi }$ . Essentially, by capturing features predictive of language, like “putting the apple on the plate”, the learned representation should capture semantically relevant parts of the scene like the plate and apple state, that are likely relevant to downstream manipulation tasks. Following Nair et al. [56], we train a model $\mathcal { G } _ { \theta } ( \mathcal { F } _ { \phi } ( I _ { 0 } ) , \mathcal { F } _ { \phi } ( I _ { i } ) , l )$ that takes in an initial image $I _ { 0 }$ , a future image $I _ { i }$ , language $l$ and outputs a score corresponding to if transitioning from $I _ { 0 }$ to $I _ { i }$ completes the language $l$ . We train the model under the objective that (1) the score should increase over the course of the video, and (2) the score should be higher for correct pairings of video/language than for incorrect pairings. Again we sample a video clip and paired language $[ I _ { i } , I _ { j > i } , l ] ^ { 1 : B }$ , and then train for this objective directly with a contrastive loss, that is:
+
+$$
+\mathcal { L } _ { l a n g u a g e } = - \sum _ { b \in B } \log \frac { e ^ { \mathcal { G } _ { \theta } ( z _ { 0 } ^ { b } , z _ { j > i } ^ { b } , l ^ { b } ) } } { e ^ { \mathcal { G } _ { \theta } ( z _ { 0 } ^ { b } , z _ { j > i } ^ { b } , l ^ { b } ) } + e ^ { \mathcal { G } _ { \theta } ( z _ { 0 } ^ { b } , z _ { i } ^ { b } , l ^ { b } ) } + e ^ { \mathcal { G } _ { \theta } ( z _ { 0 } ^ { \ne b } , z _ { j > i } ^ { \ne b } , l ^ { b } ) } }
+$$
+
+where again $z = \mathcal { F } _ { \phi } ( I )$ , and $z ^ { \neq b }$ is a negative example sampled from a different video in the batch (that does not match the language instruction $l ^ { b }$ ).
+
+Regularization. Finally, we hypothesize that sparse and compact representations benefit control, particularly in low data imitation learning. State-distribution shift is a well studied failure mode in imitation learning [68], where policies trained with behavior cloning drift off the expert state distribution. Reducing the effective dimensionality of the state space (which we implement with a simple L1 and L2 penalty) can help mitigate this issue, as we demonstrate in Section 4.4.
+
+R3M Summary $\pmb { \& }$ Implementation. The final objective for training R3M is the weighted sum:
+
+$$
+\mathcal { L } ( \phi , \theta ) = \mathbb { E } _ { I _ { 0 } ^ { 1 ; B } , \theta , \boldsymbol { k } \sim \mathcal { D } } [ \lambda _ { 1 } \mathcal { L } _ { t c n } + \lambda _ { 2 } \mathcal { L } _ { l a n g u a g e } + \lambda _ { 3 } | | \mathcal { F } _ { \phi } ( I _ { i } ) | | _ { 1 } + \lambda _ { 4 } | | \mathcal { F } _ { \phi } ( I _ { i } ) | | _ { 2 } ]
+$$
+
+In principle, R3M can be implemented on top of any encoding architecture for $\mathcal { F } _ { \phi }$ . In our experiments we focus on the ResNet50 architecture, and we release pre-trained R3M models with ResNet18, ResNet34, and ResNet50 architectures [69], as well as the accompanying training code. During training, $\phi$ and $\theta$ are trained with an Adam optimizer to minimize Equation 3. Lastly, R3M also trains with random cropping, applied at the video level (that is, within a batch all frames from the same video are cropped identically). Please see the appendix for further implementation details.
+
+# 4 Experiments
+
+In our experiments, we aim to study how the pre-trained R3M representation can be re-used for multiple downstream robot learning tasks. First, we study if R3M enables more data efficient imitation learning on unseen environments and tasks compared to existing visual representations and learning from scratch. Second, again in the data efficient imitation learning setting, we ablate the different components of the R3M training objective and observe that all components are important for final performance. Third, we study if R3M can enable efficient real robot learning in a visually rich household setting. Finally, in the appendix, we take a deeper look at task performance of R3M and prior methods with different amounts of data, different camera viewpoints, and different tasks.
+
+# 4.1 Imitation Learning Evaluation Framework
+
+Our evaluation methodology is loosely inspired by Parisi et al. [23]. We focus on evaluating visual representations as frozen perception modules for downstream policy learning with behavior cloning. Given a pretrained visual representation $\mathcal { F } _ { \phi }$ , we form the state representation as a concatenation of the visual embedding $z _ { t } = \mathcal { F } _ { \phi } ( I _ { t } )$ and the robot proprioceptive (e.g. joint positions and velocities) reading $p _ { t }$ . The policy, $\pi$ , is trained with a standard behavior cloning loss $| | a _ { t } - \pi ( [ z _ { t } , p _ { t } ] ) | | _ { 2 } ^ { 2 }$ . We parameterize $\pi$ as a two-layer MLP preceded by a BatchNorm at the input. We train the agent for 20,000 steps, evaluate it online in the environment every 1000 steps, and report the best success rate achieved. For each visual representation and each task, we run 3 seeds of behavior cloning. The final success rate reported on a task is the average over multiple seeds, viewpoints, and demo dataset sizes.
+
+Comparisons and Baselines. We compare our R3M model to three existing visual representations that have been shown to be effective for control: CLIP [12] which trains image representations to be aligned with paired natural language through contrastive learning and has been shown to be useful for some manipulation [36] and navigation tasks [37], ImNet Supervised which uses features pre-trained for ImageNet classification task [2] and has been shown to be effective for reinforcement learning [38], and MoCo (345) (PVR) [23], which compresses and fuses the third, fourth, and fifth convolutional layers of a ResNet-50 model trained with MoCo [24] on ImageNet, and has been shown to be effective for imitation learning [23]. We note here that our usage of the Moco (345) model differs from the setup in Parisi et al. [23] in aspects like propreoception features, frame stacking etc. As a result, the numerical results are not directly comparable across the two works. At the same time, we emphasize that all visual representations are used in the same way within our evaluation protocol.
+
+
+Figure 3: Simulated Evaluation Environments. We consider a comprehensive set of manipulation tasks in simulation (left), including 5 tasks with a Sawyer from MetaWorld [22], 5 tasks from a Franka operating over a Kitchen [21], and 2 dexterous manipulation tasks from Adroit [20], with multiple views per environment (right).
+
+# 4.2 Simulation Environments
+
+Next, we describe the environments and tasks used in our evaluations. For a comprehensive evaluation, we use three robot manipulation domains: MetaWorld [22], the Franka Kitchen environment [21], and Adroit [20] (See Figure 3). Note these environments are only used for downstream learning, and these environments and tasks are never seen during R3M training. In the MetaWorld environment we consider the tasks of assembling a ring onto a peg, picking and placing a block between bins, pushing a button, opening a drawer, and hammering a nail. In Franka Kitchen, we learn the tasks of sliding the right door open, opening the left door, turning on the light, turning the stove top knob, and opening the microwave. Finally, in Adroit we consider the tasks of reorienting the pen to the specified position, and picking and moving the ball to specified position. In all tasks, the agent is provided with image observations, as well as proprioceptive data of the robot (end-effector pose, joint positions, etc.) that is concatenated to the encoded image. All tasks involve variation, either by varying the position of the target object in MetaWorld, the positioning of the desk in Franka Kitchen, or the chosen goals in Adroit. For a robust evaluation, we consider multiple views for each environment (See Figure 3), and 3 dataset sizes: [5, 10, 25] in MetaWorld and Franka Kitchen, and [25, 50, 100] in the more challenging Adroit environments. Our comparisons measure performance for each environment and task, averaged over view, dataset size, and object or goal positions.
+
+# 4.3 Exp. 1: Does R3M enable efficient imitation on unseen environments and tasks?
+
+In this first experiment, we measure the success rate of downstream imitation learning using different visual representations. In Figure 4, we first notice that R3M is overall able to learn these vision based manipulation tasks in an extremely low data regime with ${ \approx } 6 2 \%$ success rate, despite never seeing any data from the target environments in training the representation, while outperforming learning from scratch by more than $20 \%$ . Moreover, we observe that R3M outperforms all prior representations by more than $10 \%$ on average across all 12 tasks. By training on diverse interactive video data, and with objectives that capture temporal structure and language relevance, R3M is the best performing method in all 3 environments, and on 11/12 of the tasks (See appendix for performance breakdown by task). The best two performing comparisons are CLIP and MoCo (345) (PVR), with CLIP performing better on MetaWorld, and MoCo (345) (PVR) performing better on Franka Kitchen and Adroit. Unsurprisingly, learning from scratch performs poorly in the low-data regime we study. Ultimately, we conclude that pre-trained visual representations are essential to good performance in the low-data imitation learning regime, and using R3M with diverse human video data is especially effective for learning representations useful for robotic manipulation.
+
+
+Figure 4: Data Efficient Imitation Learning in Unseen Environments/Tasks. We report the success rates of downstream imitation learning with standard error bars. We observe that across 12 tasks R3M outperforms baselines like MoCo (345) (PVR), CLIP, Supervised ImageNet features, and training from scratch.
+
+In this experiment, we seek to understand the different components of R3M, beginning with the objective. Specifically, we compare the full R3M with R3M(-Aug), which does not use crop augmentations, R3M(-L1), which does not include $L 1$ regularization, and R3M(-Lang), which does not include include the
+
+4.4 Exp. 2: Which components of R3M are important?
+
+
Environment
Supervised
Self-Supervised R3M(-Lang)
R3M
R3M(-Aug)
R3M(-L1)
Franka Kitchen
53.1 ±2.7%
51.1 ±2.7%
46.7 ±2.7%
47.2±2.9%
MetaWorld
69.2 ±2.0%
68.9 ±2.1%
65.0 ±2.4%
67.0±2.0%
Adroit
65.0 ±1.7%
61.3 ±2.1%
66.5 ±1.6%
45.6 ±3.3%
All Domains
62.4 ±1.3%
60.4 ±1.4%
59.4 ±1.5%
53.2 ±1.5%
+
+Table 1: Ablating Components of R3M. We see report success rate of downstream imitation learning on variants of R3M. We observe that on average, removing the L1 penalty have a negative impact, particularly on the Franka Kitchen and MetaWorld environments. Lastly, removing language grounding has the most significant drop in performance, particularly on the Adroit tasks.
+
+video-language alignment loss. In Table 1, we report success rates per environment and averaged over all environments. First, we notice that on average across the three environments, we see a drop in performance of ${ \approx } 2 \%$ from removing crop augmentation or from removing the $L 1$ regularization. Interestingly, the impact of removing the sparsity regularization depends on the environment. In Franka Kitchen and MetaWorld, sparsity is helpful, while in Adroit removing sparsity actually helps performance slightly. We suspect this is partly due to the Adroit environment using more demonstrations, mitigating the state distribution shift issue.
+
+We see that across all environments, removing video-language alignment loss has the largest negative impact on performance, particularly in the Adroit environment. We hypothesize that language alignment plays an important role in better capturing semantic features that might be predictive of objects and useful for object manipulation. Nevertheless, we note that even in the fully self-supervised regime, our R3M model still outperforms prior state of the art visual representations like ImageNet trained MoCo (345) (PVR) [23] and CLIP [12] by a significant margin.
+
+Next, we seek to answer the question: How important is the data? To do so we include comparisons that disentangles the role of the dataset and the training objective. In particular, we have trained a MoCo model on the exact same frames of the Ego4D dataset used to train our R3M model (See Table 2). Additionally we compare to the MVP model [70], which trains a ViT-B masked auto-encoder on the Ego-soup dataset, which comprises of Ego4D and other egocentric video datasets.. We evaluate these comparisons on the Franka Kitchen and Adroit environments, and find that the MoCo-Ego4D model, which uses the same data and compute as R3M, gets an average success rate $\sim 1 0 \%$ lower than R3M in both environments. Moreover, we find the MVP models performs $\sim 2 0 \%$ worse than R3M. This suggests that while there is indeed a large benefit coming from diverse human video data compared to static ImageNet images $34 \% $ $42 \%$ on Franka), the data is not the only source of improvement, and the R3M objective provides an additional $\sim 1 0 \%$ boost in success rate.
+
+Table 2: Importance of Data vs. Algorithm. We find that the MoCo-Ego4D and MVP models, which leverage the same or more data and compute as R3M perform more than $10 \%$ worse.
+
+
Franka
Adroit
R3M
53.1(2.7)
65.0 (1.7)
MoCo-Ego4D
42.0 (2.8)
54.9 (2.7)
MVP([70])
27.0 (2.6)
51.4 (2.7)
+
+
+Figure 5: Real World Robot Learning with R3M. With R3M we are able to learn challenging tasks like putting lettuce in the pan, pushing the cup to the goal, and folding the towel from just 20 demonstrations. See appendix for more examples of real robot tasks and details about the robot setup.
+
+# 4.5 Exp. 3: Does R3M enable data efficient learning in real world environments?
+
+Finally, we test if R3M can enable data-efficient robot learning in cluttered real-world environments. To do so, we bring a Franka Emika Panda robot into a real graduate student apartment, and aim to learn household tasks from pixels with just 20 demonstrations per task, using the pre-trained R3M representation. We have the robot complete five tasks: (1) closing a dresser drawer, (2) picking a face mask placed randomly on a desk and placing it in the dresser drawer, (3) picking up lettuce randomly placed on a cutting board and putting in a cooking pan, (4) pushing a mug to a goal location, and (5) folding a towel (See Figure 5). Like in our simulation experiments, we collect a small number of demonstrations and do simple behavior cloning with the pre-trained representation.
+
+In Table 3, we report the success rates comparing R3M and CLIP, one of the stronger baselines from our evaluations in simulation. We observe that while the two perform similarly on the easier task of closing the drawer, R3M consistently performs better on the other four tasks (See Figure 5), which require more precise visual representations, yielding nearly double the success rate on average.
+
+# 5 Limitations and Future Work
+
+
Success out of 10 trials
R3M
CLIP
Closing Drawer Putting Mask in Dresser
80% 30%
70% 10%
Putting Lettuce in Pan Pushing Mug to Goal
60% 70%
0% 40%
Folding Towel
40%
0%
Average
56%
24%
+
+Table 3: Real World Success Rates. R3M outperforms CLIP on the challenging real world manipulation tasks.
+
+In this work, we set out to study if pre-training visual representations on diverse human videos can enable efficient learning of downstream robotic manipulation tasks. While we were excited by strong results on a wide set of simulated and real robotic tasks, a number of important limitations remain. Our current evaluation is limited to imitation learning, specifically behavior cloning, with a small number of task demonstrations. While we would hope to see R3M be equally beneficial for other robotic learning settings like reinforcement learning, it could be the case that a good pretrained representation for RL is not the same as a good pre-trained representation for imitation. Studying how R3M performs in RL settings, and changes that may need to made to improve its performance is an exciting next step. The current R3M model also only provides a single-frame state representation. In principle, pre-training on human videos should be able to go beyond state representations (e.g. reward learning and task specification). Studying if R3M embeddings or the language grounding module can provide a useful reward signal is an interesting direction for future work.
+
+# Acknowledgments
+
+The authors would like to thank the Ego4D team at Meta AI for assistance in using the dataset. We’d also like to thank Karl Pertsch, Simone Parisi, Sidd Karamcheti, and numerous members of Meta AI and the IRIS labs for valuable discussions. This work is in part supported by ONR grant N00014-22-1-2621. Finally, the authors would also like to thank Evan Coleman for assistance with the robot.
+
+# References
+
+[1] S. Levine, C. Finn, T. Darrell, and P. Abbeel. End-to-end training of deep visuomotor policies. The Journal of Machine Learning Research, 17(1):1334–1373, 2016.
+[2] J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A Large-Scale Hierarchical Image Database. In CVPR09, 2009.
+[3] D. Mzurikwao, M. Khan, O. Samuel, J. Cinatl, M. Wass, M. Michaelis, G. Marcelli, and C. S. Ang. Towards image-based cancer cell lines authentication using deep neural networks. Scientific Reports, 10, 11 2020. doi:10.1038/s41598-020-76670-6.
+[4] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL-HLT), Minneapolis, Minnesota, June 2019. Association for Computational Linguistics.
+[5] Z. Zhang, J. Liu, and N. Razavian. BERT-XML: Large scale automated ICD coding using BERT pretraining. In Proceedings of the 3rd Clinical Natural Language Processing Workshop, pages 24–34, Online, Nov. 2020. Association for Computational Linguistics. doi:10.18653/v1/ 2020.clinicalnlp-1.3. URL https://aclanthology.org/2020.clinicalnlp-1.3.
+[6] Z. Yang, N. Garcia, C. Chu, M. Otani, Y. Nakashima, and H. Takemura. Bert representations for video question answering. In 2020 IEEE Winter Conference on Applications of Computer Vision (WACV), pages 1545–1554, 2020. doi:10.1109/WACV45572.2020.9093596.
+[7] S. Dasari, F. Ebert, S. Tian, S. Nair, B. Bucher, K. Schmeckpeper, S. Singh, S. Levine, and C. Finn. Robonet: Large-scale multi-robot learning. In Conference on Robot Learning, 2019.
+[8] A. Mandlekar, J. Booher, M. Spero, A. Tung, A. Gupta, Y. Zhu, A. Garg, S. Savarese, and L. Fei-Fei. Scaling robot supervision to hundreds of hours with roboturk: Robotic manipulation dataset through human reasoning and dexterity. In 2019 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 1048–1055. IEEE, 2019.
+[9] S. Young, D. Gandhi, S. Tulsiani, A. Gupta, P. Abbeel, and L. Pinto. Visual imitation made easy. In CoRL, 2020.
+[10] F. Ebert, Y. Yang, K. Schmeckpeper, B. Bucher, G. Georgakis, K. Daniilidis, C. Finn, and S. Levine. Bridge data: Boosting generalization of robotic skills with cross-domain datasets. ArXiv, abs/2109.13396, 2021.
+[11] T. B. Brown et al. Language models are few-shot learners. arXiv:2005.14165, 2020.
+[12] A. Radford, J. W. Kim, C. Hallacy, A. Ramesh, G. Goh, S. Agarwal, G. Sastry, A. Askell, P. Mishkin, J. Clark, G. Krueger, and I. Sutskever. Learning transferable visual models from natural language supervision. In ICML, 2021.
+[13] P. Goyal, Q. Duval, I. Seessel, M. Caron, I. Misra, L. Sagun, A. Joulin, and P. Bojanowski. Vision models are more robust and fair when pretrained on uncurated images without supervision. ArXiv, abs/2202.08360, 2022.
+[14] R. Goyal, S. Ebrahimi Kahou, V. Michalski, J. Materzynska, S. Westphal, H. Kim, V. Haenel, I. Fruend, P. Yianilos, M. Mueller-Freitag, et al. The” something something” video database for learning and evaluating visual common sense. In Proceedings of the IEEE International Conference on Computer Vision, pages 5842–5850, 2017.
+[15] D. Damen, H. Doughty, G. M. Farinella, S. Fidler, A. Furnari, E. Kazakos, D. Moltisanti, J. Munro, T. Perrett, W. Price, and M. Wray. Scaling egocentric vision: The epic-kitchens dataset. In European Conference on Computer Vision (ECCV), 2018.
+[16] K. Grauman et al. Ego4D: Around the World in 3,000 Hours of Egocentric Video, 2021.
+[17] L. Shao, T. Migimatsu, Q. Zhang, K. Yang, and J. Bohg. Concept2robot: Learning manipulation concepts from instructions and human demonstrations. In Proceedings of Robotics: Science and Systems (RSS), 2020.
+[18] A. S. Chen, S. Nair, and C. Finn. Learning generalizable robotic reward functions from ”in-the-wild” human videos. ArXiv, abs/2103.16817, 2021.
+[19] P. Sermanet, C. Lynch, Y. Chebotar, J. Hsu, E. Jang, S. Schaal, and S. Levine. Time-contrastive networks: Self-supervised learning from video. Proceedings of International Conference in Robotics and Automation (ICRA), 2018.
+[20] A. Rajeswaran, V. Kumar, A. Gupta, J. Schulman, E. Todorov, and S. Levine. Learning complex dexterous manipulation with deep reinforcement learning and demonstrations. ArXiv, abs/1709.10087, 2018.
+[21] A. Gupta, V. Kumar, C. Lynch, S. Levine, and K. Hausman. Relay policy learning: Solving long-horizon tasks via imitation and reinforcement learning. In CoRL, 2019.
+[22] T. Yu, D. Quillen, Z. He, R. Julian, K. Hausman, C. Finn, and S. Levine. Meta-world: A benchmark and evaluation for multi-task and meta reinforcement learning. In Conference on Robot Learning, 2020.
+[23] S. Parisi, A. Rajeswaran, S. Purushwalkam, and A. K. Gupta. The unsurprising effectiveness of pre-trained vision models for control. 2022.
+[24] K. He, H. Fan, Y. Wu, S. Xie, and R. B. Girshick. Momentum contrast for unsupervised visual representation learning. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 9726–9735, 2020.
+[25] M. Laskin, K. Lee, A. Stooke, L. Pinto, P. Abbeel, and A. Srinivas. Reinforcement learning with augmented data. ArXiv, abs/2004.14990, 2020.
+[26] A. Srinivas, M. Laskin, and P. Abbeel. Curl: Contrastive unsupervised representations for reinforcement learning. In ICML, 2020.
+[27] I. Kostrikov, D. Yarats, and R. Fergus. Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. ArXiv, abs/2004.13649, 2021.
+[28] J. Pari, N. M. M. Shafiullah, S. P. Arunachalam, and L. Pinto. The surprising effectiveness of representation learning for visual imitation. ArXiv, abs/2112.01511, 2021.
+[29] C. Gelada, S. Kumar, J. Buckman, O. Nachum, and M. G. Bellemare. Deepmdp: Learning continuous latent space models for representation learning. ArXiv, abs/1906.02736, 2019.
+[30] D. Hafner, T. P. Lillicrap, J. Ba, and M. Norouzi. Dream to control: Learning behaviors by latent imagination. ArXiv, abs/1912.01603, 2020.
+[31] A. Zhang, R. McAllister, R. Calandra, Y. Gal, and S. Levine. Learning invariant representations for reinforcement learning without reconstruction. ArXiv, abs/2006.10742, 2021.
+[32] S. Nair, S. Savarese, and C. Finn. Goal-aware prediction: Learning to model what matters. ArXiv, abs/2007.07170, 2020.
+[33] M. Hong, K. Lee, M. Kang, W. Jung, and S. Oh. Dynamics-aware metric embedding: Metric learning in a latent space for visual planning. IEEE Robotics and Automation Letters, 2022.
+[34] R. Jonschkowski and O. Brock. Learning state representations with robotic priors. Autonomous Robots, 39:407–428, 10 2015. doi:10.1007/s10514-015-9459-7.
+[35] Y.-C. Lin, A. Zeng, S. Song, P. Isola, and T.-Y. Lin. Learning to see before learning to act: Visual pre-training for manipulation. 2020 IEEE International Conference on Robotics and Automation (ICRA), pages 7286–7293, 2020.
+[36] M. Shridhar, L. Manuelli, and D. Fox. Cliport: What and where pathways for robotic manipulation. In CoRL, 2021.
+[37] A. Khandelwal, L. Weihs, R. Mottaghi, and A. Kembhavi. Simple but effective: Clip embeddings for embodied ai. ArXiv, abs/2111.09888, 2021.
+[38] R. Shah and V. Kumar. Rrl: Resnet as representation for reinforcement learning. ArXiv, abs/2107.03380, 2021.
+[39] Y. Seo, K. Lee, S. James, and P. Abbeel. Reinforcement learning with action-free pre-training from videos. ArXiv, abs/2203.13880, 2022.
+[40] T. Xiao, I. Radosavovic, T. Darrell, and J. Malik. Masked visual pre-training for motor control. 2022.
+[41] Y. Liu, A. Gupta, P. Abbeel, and S. Levine. Imitation from observation: Learning to imitate behaviors from raw video via context translation. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pages 1118–1125. IEEE, 2018.
+[42] P. Sharma, D. Pathak, and A. Gupta. Third-person visual imitation learning via decoupled hierarchical controller. In NeurIPS, 2019.
+[43] L. Smith, N. Dhawan, M. Zhang, P. Abbeel, and S. Levine. AVID: Learning Multi-Stage Tasks via Pixel-Level Translation of Human Videos. In Proceedings of Robotics: Science and Systems, Corvalis, Oregon, USA, July 2020.
+[44] T. Yu, C. Finn, S. Dasari, A. Xie, T. Zhang, P. Abbeel, and S. Levine. One-shot imitation from observing humans via domain-adaptive meta-learning. In Proceedings of Robotics: Science and Systems, Pittsburgh, Pennsylvania, June 2018.
+[45] K. Schmeckpeper, A. Xie, O. Rybkin, S. Tian, K. Daniilidis, S. Levine, and C. Finn. Learning predictive models from observation and interaction. In ECCV, 2020.
+[46] A. D. Edwards and C. L. Isbell. Perceptual values from observation. arXiv preprint arXiv:1905.07861, 2019.
+[47] K. Schmeckpeper, O. Rybkin, K. Daniilidis, S. Levine, and C. Finn. Reinforcement learning with videos: Combining offline observations with interaction. In CoRL, 2020.
+[48] R. Scalise, J. Thomason, Y. Bisk, and S. Srinivasa. Improving robot success detection using static object data. In Proceedings of the 2019 IEEE/RSJ International Conference on Intelligent Robots and Systems, 2019.
+[49] S. Pirk, M. Khansari, Y. Bai, C. Lynch, and P. Sermanet. Online object representations with contrastive learning, 2019.
+[50] H. Xiong, Q. Li, Y.-C. Chen, H. Bharadhwaj, S. Sinha, and A. Garg. Learning by watching: Physical imitation of manipulation skills from human videos, 2021.
+[51] N. Das, S. Bechtle, T. Davchev, D. Jayaraman, A. Rai, and F. Meier. Model-based inverse reinforcement learning from visual demonstrations, 2021.
+[52] K. Zakka, A. Zeng, P. Florence, J. Tompson, J. Bohg, and D. Dwibedi. Xirl: Cross-embodiment inverse reinforcement learning, 2021.
+[53] S. Stepputtis, J. Campbell, M. Phielipp, S. Lee, C. Baral, and H. B. Amor. Language-conditioned imitation learning for robot manipulation tasks. ArXiv, abs/2010.12083, 2020.
+[54] C. Lynch and P. Sermanet. Grounding language in play. ArXiv, abs/2005.07648, 2020.
+[55] Y. Cui, S. Niekum, A. Gupta, V. Kumar, and A. Rajeswaran. Can Foundation Models Perform Zero-Shot Task Specification For Robot Manipulation? In L4DC, 2022.
+[56] S. Nair, E. Mitchell, K. Chen, B. Ichter, S. Savarese, and C. Finn. Learning language-conditioned robot behavior from offline data and crowd-sourced annotation. In CoRL, 2021.
+[57] L. Pinto and A. Gupta. Supersizing self-supervision: Learning to grasp from 50k tries and 700 robot hours. In IEEE international conference on robotics and automation (ICRA), 2016.
+[58] P. Sharma, L. Mohan, L. Pinto, and A. K. Gupta. Multiple interactions made easy (mime): Large scale demonstrations data for imitation. In CoRL, 2018.
+[59] E. Jang, A. Irpan, M. Khansari, D. Kappler, F. Ebert, C. Lynch, S. Levine, and C. Finn. Bcz: Zero-shot task generalization with robotic imitation learning. In A. Faust, D. Hsu, and G. Neumann, editors, Proceedings of the 5th Conference on Robot Learning, volume 164 of Proceedings of Machine Learning Research, pages 991–1002. PMLR, 08–11 Nov 2022. URL https://proceedings.mlr.press/v164/jang22a.html.
+[60] X. Wang and A. K. Gupta. Unsupervised learning of visual representations using videos. 2015 IEEE International Conference on Computer Vision (ICCV), pages 2794–2802, 2015.
+[61] P. Sermanet, K. Xu, and S. Levine. Unsupervised perceptual rewards for imitation learning. Proceedings of Robotics: Science and Systems (RSS), 2017.
+[62] X. Wang, A. Jabri, and A. A. Efros. Learning correspondence from the cycle-consistency of time. 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 2561–2571, 2019.
+[63] A. Jabri, A. Owens, and A. A. Efros. Space-time correspondence as a contrastive random walk. ArXiv, abs/2006.14613, 2020.
+[64] M. Goyal, S. Modi, R. Goyal, and S. Gupta. Human hands as probes for interactive object understanding. In Computer Vision and Pattern Recognition (CVPR), 2022.
+[65] A. Miech, D. Zhukov, J.-B. Alayrac, M. Tapaswi, I. Laptev, and J. Sivic. Howto100m: Learning a text-video embedding by watching hundred million narrated video clips. 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pages 2630–2640, 2019.
+[66] H. Xu, G. Ghosh, P.-Y. Huang, D. Okhonko, A. Aghajanyan, and F. M. L. Z. C. Feichtenhofer. Videoclip: Contrastive pre-training for zero-shot video-text understanding. ArXiv, abs/2109.14084, 2021.
+[67] A. van den Oord, Y. Li, and O. Vinyals. Representation learning with contrastive predictive coding. ArXiv, abs/1807.03748, 2018.
+[68] S. Ross, G. J. Gordon, and J. A. Bagnell. A reduction of imitation learning and structured prediction to no-regret online learning. In AISTATS, 2011.
+[69] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 770–778, 2016.
+[70] I. Radosavovic, T. Xiao, S. James, P. Abbeel, J. Malik, and T. Darrell. Real-world robot learning with masked visual pre-training. CoRL, 2022.
+[71] V. Sanh, L. Debut, J. Chaumond, and T. Wolf. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. ArXiv, abs/1910.01108, 2019.
+
+# A R3M Training Details
+
+# A.1 Data Preprocessing
+
+The Ego4D dataset consists of several hour long videos within a certain scene. Within each scene, there are many sub-clips, each with a natural language annotation. R3M trains with these shorter video clips paired with language annotations.
+
+For faster training R3M parses each video clip into frames (Resized and cropped to $2 2 4 \mathbf { x } 2 2 4 )$ and samples frames from a video clip individually. See the codebase for more details on the implementation of sampling the videos.
+
+# A.2 Training Architecture and Hyper-Parameters
+
+R3M can in principle be trained with any visual encoding architecture for $\mathcal { F } _ { \phi }$ . We train with off the shelf ResNet18, 34, and 50 [69], as implemented by torchvision.models.
+
+The language prediction head is implemented as an 5 layer MLP with sizes $[ 2 ^ { * } E + L$ , 1024, 1024, 1024, 1024] and output a scalar score, where $E$ is the output dimension of $\mathcal { F } _ { \phi }$ and $L$ is the output dimension of the DistilBERT [71] sentence encoder (768) from HuggingFace transformers.
+
+During training of R3M, we use batch sizes of 16 video clips (where 5 frames are samples from each video clip: an initial image, final image, and sequence of 3 frames). The initial and final frames are sampled from the first and last $20 \%$ of the video clip.
+
+R3M models are trained for one million steps in our experiments, and for 1.5 million steps in our released models, with a learning rate of 0.0001.
+
+For the training objective in Equation 3, we use hyperparameters $\lambda _ { 1 } ~ = ~ 1 , \lambda _ { 2 } ~ = ~ 1 , \lambda _ { 3 } ~ =$ $0 . 0 0 0 0 1 , \lambda _ { 4 } = 0 . 0 0 0 0 1$ .
+
+# A.3 Additional Implementation Details
+
+In practice, we use more than one negative video example in training Equations 1 and 2. Instead we use 3 negative examples, sampled from different videos in the batch.
+
+Additionally in training for Equation 2, we consider the following positive pairs within a single batch element: Initial and Final Frames $( I _ { 0 } , I _ { g } )$ , $\left( I _ { 0 } , I _ { j > i } \right)$ , and $\left( I _ { 0 } , I _ { k > j } \right)$ , with corresponding negatives $( I _ { 0 } , I _ { 0 } )$ , $( I _ { 0 } , I _ { i } )$ , and $( I _ { 0 } , I _ { j } )$ respectively. Using a larger number of positive examples from a single video and multiple negative examples from different videos stabilizes training.
+
+# A.4 Example Usage
+
+Using R3M is simple. The codebase is located at https://github.com/facebookresearch/r3m. Simply clone the repo and install via pip install -e . Then R3M can be loaded by running:
+
+from r3m import load_r3m 2 r3m $=$ load_r3m (" resnet50 ") # resnet18 , resnet34 3 r3m . eval ()
+
+# B Evaluation Details
+
+# B.1 Simulation Environments
+
+We focus on three simulation environments: Franka Kitchen, MetaWorld, and Adroit.
+
+Franka Kitchen. The Franka Kitchen environments used in this paper are modified from the original environment; specifically, we add additional randomization to the scene. We randomly change the position of the kitchen between episodes, making the task significantly more challenging both in perception and control.
+
+The 5 tasks in the Franka Kitchen involve opening the left door, opening the sliding door, turning on the light, turning the knob, and opening the microwave. All Franka tasks include proprioceptive data of the arm joint positions and gripper positions. The horizon for all Franka tasks is 50 steps, and our imitation experiments use either 5, 10, or 25 demos.
+
+
+Figure 6: Real World Robot Learning with R3M. With R3M we are able to learn challenging tasks like closing the drawer, putting the mask in the dresser, putting lettuce in the pan, pushing the cup to the goal, and folding the towel from just 20 demonstrations.
+
+MetaWorld. The MetaWorld environments are the standard V2 Button Pressing, Bin Picking, Drawer Opening, Hammer, and Assembly environments available in MetaWorld [22]. In all tasks, the target object (drawer, peg, block, etc.) position is randomized between episodes.
+
+All MetaWorld tasks include proprioceptive data of the gripper end effector pose and gripper open/- close. The horizon for all MetaWorld tasks is 500 steps, and our imitation experiments use either 5, 10, or 25 demos.
+
+Adroit. We use the standard Pen and Relocate tasks in the Adroit hand manipulation suite. The goal position of the pen and the goal position of the ball are randomized between episodes, and specified visually.
+
+All Adroit tasks include proprioceptive data of the hand joints, and in the Relocate task also includes the global position of the hand. The horizon for the Pen task is 100 steps and for the Relocate task is 200 steps. Our imitation experiments use either 25, 50, or 100 demos.
+
+# B.2 Real World Environments
+
+Our real world experiments involve bringing a Franka Emika Panda robot into a real graduate student apartment. The tasks involve putting lettuce in a pan in the kitchen, pushing a mug to a goal position on a dining table, closing a drawer, putting a mask in a drawer, and folding a towel (See Figure 6). All tasks involve randomization (e.g. the towel/lettuce/mug/mask position or drawer position). The initial state of the gripper is also randomized each episode.
+
+
+Figure 7: Real Robot Camera Viewpoints. Camera view used for learning each of the real robot tasks.
+
+The robot observation includes RGB images froma USB webcam, positioned differently for each task (See Figure 7). The robot end effector position is also concatenated with the image embedding during imitation learning.
+
+# B.3 Demo Data Collection
+
+In the Franka Kitchen and Adroit tasks, expert data is generated by training a state based agent with model free RL [20]. The state based trajectories are then replayed and rendered with image observations.
+
+In the MetaWorld environment, a heuristic policy using state information is used to generate expert data, which is then replayed and rendered with image observations.
+
+On the real robot, demonstrations are collected by a human tele-operator with a PlayStation controller. The control is applied directly in the end effector Cartesian space, and the demo trajectories are directly saved with visual observations.
+
+# B.4 Comparisons
+
+In all experiments all models use a ResNet50 base architecture.
+
+CLIP: The CLIP comparison uses the of the shelf CLIP RN50 model available at https://github.
+com/openai/CLIP.
+
+ImNet Supervised: This comparison uses the default ResNet architecture available from torchvision.models with pretrained $\cdot ^ { = }$ True.
+
+MoCo (345): This comparison uses a pre-trained MoCo model on Imagenet which fuses the third, fourth, and fifth convolutional layers as proposed in [23].
+
+Note that our usage of the Moco (345) model differs from the setup in Parisi et al. [23] in aspects like proprioception features, frame stacking etc. As a result, the numerical results are not directly comparable across the two works.
+
+Scratch: uses the default ResNet architecture available from torchvision.models with pretrained $\equiv$ False. Additionally, it lets gradients from the behavior cloning MSE loss pass into the visual encoder.
+
+MoCo-Ego4D: This comparison uses a pre-trained MoCo model on the samed data as R3M from the Ego4D dataset.
+
+MVP: This comparison uses a pretrained MVP [40, 70] model, which trains an MAE with a ViT-B architecture on the Ego-Soup dataset, which consists of Ego4D and other egocentric human video datasets.
+
+# B.5 Behavior Cloning Hyperparameters
+
+The downstream policy is a 2 layer MLP with hidden sizes [256,256] preceded by a BatchNorm. The input to the policy is the concatenated visual embedding and proprioceptive data, and the output is
+
+
+Figure 8: Performance over different views/dataset sizes. We report the success rate of R3M and baseline across each view (left) and dataset size (right). We see that the performance improvement from R3M is consistent across all views. We also observe that while absolute performance increases with more demos, the performance improvement from R3M is consistent across all demo sizes.
+
+the action. The policy is trained with a learning rate of 0.001, and a batch size of 32 for 20000 steps, evaluating every 1000.
+
+# C Additional Results
+
+# C.1 How does performance vary across viewpoint and demo dataset size?
+
+In our next experiment, we take a closer look at R3M performance compared to prior methods across viewpoints and dataset sizes. In Figure 8, we plot the average success rate of each method across each dataset size and viewpoint. We observe that the performance improvement of R3M is consistent across all viewpoints, and it is the highest performing representation in all cases. Interestingly, we see that the same does not hold amongst the prior methods, where the ranking between MoCo (345) and CLIP changes based on the chosen viewpoint.
+
+Additionally, we also study the impact of dataset size for imitation learning. Again, we observe that the performance improvement from R3M is consistent, outperforming the baselines across every environment and demo dataset size. We observe that in the Franka Kitchen and Adroit environments, the performance gain from R3M stays consistent with increase in dataset size, even as the absolute performance of all methods improves. Overall, we clearly observe that the performance benefit of R3M is not tied to a specific viewpoint or dataset size.
+
+# C.2 Performance Breakdown By Task
+
+In Figure 9 we report the success rate on each task individually. Note each success rate for each method is still the average over 3 views, 3 demo sizes, and 3 seeds. We observe that on 11/12 tasks R3M is the highest performing method.
+
+
+Assembly, Bin Picking, Button Pressing, Drawer Opening, Hammering
+Sliding Door, Turning Light On, Opening Door, Turning Knob, Opening Microwave
+Figure 9: Per task Success Rate. We observe that R3M is the highest performing method on 11/12 tasks.
\ No newline at end of file
diff --git a/md/dev/tHK5ntjp-5K/tHK5ntjp-5K.md b/md/dev/tHK5ntjp-5K/tHK5ntjp-5K.md
new file mode 100644
index 0000000000000000000000000000000000000000..a474047b05dee1746590317f03831aeffdeafc27
--- /dev/null
+++ b/md/dev/tHK5ntjp-5K/tHK5ntjp-5K.md
@@ -0,0 +1,445 @@
+# LION: Latent Point Diffusion Models for 3D Shape Generation
+
+Xiaohui Zeng1,2,3,∗ Arash Vahdat1 Francis Williams1
+
+Zan Gojcic1 Or Litany1 Sanja Fidler1,2,3 Karsten Kreis1
+
+1NVIDIA 2University of Toronto 3Vector Institute {xzeng,avahdat,fwilliams,zgojcic,olitany,sfidler,kkreis}@nvidia.com
+
+# Abstract
+
+Denoising diffusion models (DDMs) have shown promising results in 3D point cloud synthesis. To advance 3D DDMs and make them useful for digital artists, we require (i) high generation quality, (ii) flexibility for manipulation and applications such as conditional synthesis and shape interpolation, and (iii) the ability to output smooth surfaces or meshes. To this end, we introduce the hierarchical Latent Point Diffusion Model (LION) for 3D shape generation. LION is set up as a variational autoencoder (VAE) with a hierarchical latent space that combines a global shape latent representation with a point-structured latent space. For generation, we train two hierarchical DDMs in these latent spaces. The hierarchical VAE approach boosts performance compared to DDMs that operate on point clouds directly, while the point-structured latents are still ideally suited for DDM-based modeling. Experimentally, LION achieves state-of-the-art generation performance on multiple ShapeNet benchmarks. Furthermore, our VAE framework allows us to easily use LION for different relevant tasks: LION excels at multimodal shape denoising and voxel-conditioned synthesis, and it can be adapted for text- and image-driven 3D generation. We also demonstrate shape autoencoding and latent shape interpolation, and we augment LION with modern surface reconstruction techniques to generate smooth 3D meshes. We hope that LION provides a powerful tool for artists working with 3D shapes due to its high-quality generation, flexibility, and surface reconstruction. Project page and code: https://nv-tlabs.github.io/LION.
+
+# 1 Introduction
+
+Generative modeling of 3D shapes has extensive applications in 3D content creation and has become an active area of research [1–52]. However, to be useful as a tool for digital artists, generative models of 3D shapes have to fulfill several criteria: (i) Generated shapes need to be realistic and of highquality without artifacts. (ii) The model should enable flexible and interactive use and refinement: For example, a user may want to refine a generated shape and synthesize versions with varying details. Or an artist may provide a coarse or noisy input shape, thereby guiding the model to produce multiple realistic high-quality outputs. Similarly, a user may want to interpolate different shapes. (iii) The model should output smooth meshes, which are the standard representation in most graphics software.
+
+Existing 3D generative models build on various frameworks, including generative adversarial networks (GANs) [1–23], variational autoencoders (VAEs) [24–30], normalizing flows [31–34], autoregressive models [35–38], and more [39–44]. Most recently, denoising diffusion models (DDMs)
+
+
+Figure 1: LION is set up as a hierarchical point cloud VAE with denoising diffusion models over the shape latent and latent point distributions. PointVoxel CNNs (PVCNN) with adaptive Group Normalization (Ada. GN) are used as neural networks. The latent points can be interpreted as a smoothed version of the input point cloud. Shape As Points (SAP) is optionally used for mesh reconstruction.
+
+have emerged as powerful generative models, achieving outstanding results not only on image synthesis [53–64] but also for point cloud-based 3D shape generation [45–47]. In DDMs, the data is gradually perturbed by a diffusion process, while a deep neural network is trained to denoise. This network can then be used to synthesize novel data in an iterative fashion when initialized from random noise [53, 65–67]. However, existing DDMs for 3D shape synthesis struggle with simultaneously satisfying all criteria discussed above for practically useful 3D generative models.
+
+Here, we aim to develop a DDM-based generative model of 3D shapes overcoming these limitations. We introduce the Latent Point Diffusion Model (LION) for 3D shape generation (see Fig. 1). Similar to previous 3D DDMs, LION operates on point clouds, but it is constructed as a VAE with DDMs in latent space. LION comprises a hierarchical latent space with a vector-valued global shape latent and another point-structured latent space. The latent representations are predicted with point cloud processing encoders, and two latent DDMs are trained in these latent spaces. Synthesis in LION proceeds by drawing novel latent samples from the hierarchical latent DDMs and decoding back to the original point cloud space. Importantly, we also demonstrate how to augment LION with modern surface reconstruction methods [68] to synthesize smooth shapes as desired by artists. LION has multiple advantages:
+
+Expressivity: By mapping point clouds into regularized latent spaces, the DDMs in latent space are effectively tasked with learning a smoothed distribution. This is easier than training on potentially complex point clouds directly [58], thereby improving expressivity. However, point clouds are, in principle, an ideal representation for DDMs. Because of that, we use latent points, this is, we keep a point cloud structure for our main latent representation. Augmenting the model with an additional global shape latent variable in a hierarchical manner further boosts expressivity. We validate LION on several popular ShapeNet benchmarks and achieve state-of-the-art synthesis performance.
+
+Varying Output Types: Extending LION with Shape As Points (SAP) [68] geometry reconstruction allows us to also output smooth meshes. Fine-tuning SAP on data generated by LION’s autoencoder reduces synthesis noise and enables us to generate high-quality geometry. LION combines (latent) point cloud-based modeling, ideal for DDMs, with surface reconstruction, desired by artists.
+
+Flexibility: Since LION is set up as a VAE, it can be easily adapted for different tasks without retraining the latent DDMs: We can efficiently fine-tune LION’s encoders on voxelized or noisy inputs, which a user can provide for guidance. This enables multimodal voxel-guided synthesis and shape denoising. We also leverage LION’s latent spaces for shape interpolation and autoencoding. Optionally training the DDMs conditioned on CLIP embeddings enables image- and text-driven 3D generation.
+
+In summary, we make the following contributions: (i) We introduce LION, a novel generative model for 3D shape synthesis, which operates on point clouds and is built on a hierarchical VAE framework with two latent DDMs. (ii) We validate LION’s high synthesis quality by reaching state-of-the-art performance on widely used ShapeNet benchmarks. (iii) We achieve high-quality and diverse 3D shape synthesis with LION even when trained jointly over many classes without conditioning. (iv) We propose to combine LION with SAP-based surface reconstruction. (v) We demonstrate the flexibility of our framework by adapting it to relevant tasks such as multimodal voxel-guided synthesis.
+
+# 2 Background
+
+Traditionally, DDMs were introduced in a discrete-step fashion: Given samples $\mathbf { x } _ { 0 } \sim q ( \mathbf { x } _ { 0 } )$ from a data distribution, DDMs use a Markovian fixed forward diffusion process defined as [65, 53]
+
+
+Figure 2: Generated meshes with LION. Right: Synthesizing different details by diffuse-denoise (see Sec. 3.1) in latent space, while preserving overall shapes.
+
+$$
+q ( \mathbf { x } _ { 1 : T } | \mathbf { x } _ { 0 } ) : = \prod _ { t = 1 } ^ { T } q ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } ) , \qquad q ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } ) : = \mathcal { N } ( \mathbf { x } _ { t } ; \sqrt { 1 - \beta _ { t } } \mathbf { x } _ { t - 1 } , \beta _ { t } I ) ,
+$$
+
+where $T$ denotes the number of steps and $q \big ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } \big )$ is a Gaussian transition kernel, which gradually adds noise to the input with a variance schedule $\beta _ { 1 } , . . . , \beta _ { T }$ . The $\beta _ { t }$ are chosen such that the chain approximately converges to a standard Gaussian distribution after $T$ steps, $q ( \mathbf { x } _ { T } ) { \approx } { \mathcal { N } } ( \mathbf { x } _ { T } ; \mathbf { 0 } , I )$ . DDMs learn a parametrized reverse process (model parameters $\pmb \theta$ ) that inverts the forward diffusion:
+
+$$
+p _ { \theta } ( \mathbf { x } _ { 0 : T } ) : = p ( \mathbf { x } _ { T } ) \prod _ { t = 1 } ^ { T } p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) , \qquad p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) : = \mathcal { N } ( \mathbf { x } _ { t - 1 } ; \mu _ { \theta } ( \mathbf { x } _ { t } , t ) , \rho _ { t } ^ { 2 } I ) .
+$$
+
+This generative reverse process is also Markovian with Gaussian transition kernels, which use fixed variances $\rho _ { t } ^ { 2 }$ . DDMs can be interpreted as latent variable models, where $\mathbf { x } _ { 1 } , . . . , \mathbf { x } _ { T }$ are latents, and the forward process $q \big ( \mathbf { x } _ { 1 : T } | \mathbf { x } _ { 0 } \big )$ acts as a fixed approximate posterior, to which the generative $p _ { \pmb { \theta } } ( \mathbf { x } _ { 0 : T } )$ is fit. DDMs are trained by minimizing the variational upper bound on the negative log-likelihood of the data $\mathbf { x } _ { \mathrm { 0 } }$ under $p _ { \theta } ( \mathbf { x } _ { 0 : T } )$ . Up to irrelevant constant terms, this objective can be expressed as [53]
+
+$$
+\operatorname* { m i n } _ { \theta } \mathbb { E } _ { t \sim U \left\{ 1 , T \right\} , \mathbf { x } _ { 0 } \sim p \left( \mathbf { x } _ { 0 } \right) , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , I ) } \left[ w ( t ) | | \epsilon - \epsilon _ { \theta } ( \alpha _ { t } \mathbf { x } _ { 0 } + \sigma _ { t } \epsilon , t ) | | _ { 2 } ^ { 2 } \right] , w ( t ) = \frac { \beta _ { t } ^ { 2 } } { 2 \rho _ { t } ^ { 2 } ( 1 - \beta _ { t } ) ( 1 - \alpha _ { t } ^ { 2 } ) } ,
+$$
+
+where $\alpha _ { t } = \sqrt { \prod _ { s = 1 } ^ { t } ( 1 - \beta _ { s } ) }$ and $\sigma _ { t } ~ = ~ \sqrt { 1 - \alpha _ { t } ^ { 2 } }$ are the parameters of the tractable diffused distribution after $t$ steps $q ( \mathbf { x } _ { t } | \mathbf { x } _ { 0 } ) = \mathcal { N } ( \mathbf { x } _ { t } ; \alpha _ { t } \mathbf { x } _ { 0 } , \sigma _ { t } ^ { 2 } I )$ . Furthermore, Eq. (3) employs the widely used parametrization µθ(xt, t) := √ 11−βt $\begin{array} { r } { \mu _ { \theta } ( \mathbf { x } _ { t } , t ) : = \frac { 1 } { \sqrt { 1 - \beta _ { t } } } \left( \mathbf { x } _ { t } - \frac { \beta _ { t } } { \sqrt { 1 - \alpha _ { t } ^ { 2 } } } \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) \right) } \end{array}$ . It is common practice to set $w ( t ) = 1$ , instead of the one in Eq. (3), which often promotes perceptual quality of the generated output. In the objective of Eq. (3), the model $\epsilon _ { \theta }$ is, for all possible steps $t$ along the diffusion process, effectively trained to predict the noise vector $\epsilon$ that is necessary to denoise an observed diffused sample $\mathbf { x } _ { t }$ . After training, the DDM can be sampled with ancestral sampling in an iterative fashion:
+
+$$
+\begin{array} { r } { \mathbf { x } _ { t - 1 } = \frac { 1 } { \sqrt { 1 - \beta _ { t } } } ( \mathbf { x } _ { t } - \frac { \beta _ { t } } { \sqrt { 1 - \alpha _ { t } ^ { 2 } } } \pmb { \epsilon } _ { \theta } ( \mathbf { x } _ { t } , t ) ) + \rho _ { t } \pmb { \eta } , } \end{array}
+$$
+
+where $\eta \sim \mathcal { N } ( \eta ; 0 , I )$ . This sampling chain is initialized from a random sample $\mathbf { x } _ { T } \sim \mathcal { N } ( \mathbf { x } _ { T } ; \mathbf { 0 } , I )$ .
+Furthermore, the noise injection in Eq. 4 is usually omitted in the last sampling step.
+
+DDMs can also be expressed with a continuous-time framework [67, 69]. In this formulation, the diffusion and reverse generative processes are described by differential equations. This approach allows for deterministic sampling and encoding schemes based on ordinary differential equations (ODEs). We make use of this framework in Sec. 3.1 and we review this approach in more detail in App. B.
+
+# 3 Hierarchical Latent Point Diffusion Models
+
+We first formally introduce LION, then discuss various applications and extensions in Sec. 3.1, and finally recapitulate its unique advantages in Sec. 3.2. See Fig. 1 for a visualization of LION.
+
+We are modeling point clouds $\mathbf { x } \in \mathbb { R } ^ { 3 \times N }$ , consisting of $N$ points with xyz-coordinates in $\mathbb { R } ^ { 3 }$ . LION is set up as a hierarchical VAE with DDMs in latent space. It uses a vector-valued global shape latent $\mathbf { z } _ { 0 } \in \mathbb { R } ^ { D _ { \mathbf { z } } }$ and a point cloud-structured latent $\mathbf { h } _ { 0 } \in \mathbf { \bar { \mathbb { R } } } ^ { ( 3 + D _ { \mathbf { h } } ) \times N }$ . Specifically, $\mathbf { h } _ { 0 }$ is a latent point cloud consisting of $N$ points with $x y z$ -coordinates in $\mathbb { R } ^ { 3 }$ . In addition, each latent point can carry additional $D _ { \mathbf { h } }$ latent features. Training of LION is then performed in two stages—first, we train it as a regular VAE with standard Gaussian priors; then, we train the latent DDMs on the latent encodings.
+
+First Stage Training. Initially, LION is trained by maximizing a modified variational lower bound on the data log-likelihood (ELBO) with respect to the encoder and decoder parameters $\phi$ and $\boldsymbol { \xi }$ [70, 71]:
+
+$$
+\begin{array} { r l } & { \mathcal { L } _ { \mathrm { E L B O } } ( \boldsymbol { \phi } , \boldsymbol { \xi } ) = \mathbb { E } _ { p ( \mathbf { x } ) , q _ { \phi } ( \mathbf { z } _ { 0 } | \mathbf { x } ) , q _ { \phi } ( \mathbf { h } _ { 0 } | \mathbf { x } , \mathbf { z } _ { 0 } ) } [ \log p _ { \xi } ( \mathbf { x } | \mathbf { h } _ { 0 } , \mathbf { z } _ { 0 } ) } \\ & { \qquad - \lambda _ { \mathbf { z } } D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } _ { 0 } | \mathbf { x } ) \vert p ( \mathbf { z } _ { 0 } ) ) - \lambda _ { \mathbf { h } } D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { h } _ { 0 } | \mathbf { x } , \mathbf { z } _ { 0 } ) \vert p ( \mathbf { h } _ { 0 } ) ) ] . } \end{array}
+$$
+
+
+Figure 3: Generated shapes (top: point clouds, bottom: corresponding meshes) from LION trained jointly over 13 classes of ShapeNet-vol without conditioning (Sec. 5.2).
+
+Here, the global shape latent $\mathbf { z } _ { 0 }$ is sampled from the posterior distribution $q _ { \phi } ( \mathbf { z } _ { 0 } | \mathbf { x } )$ , which is parametrized by factorial Gaussians, whose means and variances are predicted via an encoder network. The point cloud latent $\mathbf { h } _ { 0 }$ is sampled from a similarly parametrized posterior $q _ { \phi } ( \mathbf { h } _ { 0 } | \mathbf { x } , \mathbf { z } _ { 0 } )$ , while also conditioning on $\mathbf { z } _ { 0 }$ ( $\cdot \phi$ denotes the parameters of both encoders). Furthermore, $p _ { \pmb { \xi } } ( \mathbf { x } | \mathbf { h } _ { 0 } , \mathbf { z } _ { 0 } )$ denotes the decoder, parametrized as a factorial Laplace distribution with predicted means and fixed unit scale parameter (corresponding to an $L _ { 1 }$ reconstruction loss). $\lambda _ { \mathbf { z } }$ and $\lambda _ { \mathbf { h } }$ are hyperparameters balancing reconstruction accuracy and Kullback-Leibler regularization (note that only for $\lambda _ { \mathbf { z } } = \lambda _ { \mathbf { h } } = 1$ we are optimizing a rigorous ELBO). The priors $p ( \mathbf { z } _ { 0 } )$ and $p ( \mathbf { h } _ { 0 } )$ are $\mathcal { N } ( \mathbf { 0 } , \pmb { I } )$ . Also see Fig. 1 again.
+
+Second Stage Training. In principle, we could use the VAE’s priors to sample encodings and generate new shapes. However, the simple Gaussian priors will not accurately match the encoding distribution from the training data and therefore produce poor samples (prior hole problem [58, 72–79]). This motivates training highly expressive latent DDMs. In particular, in the second stage we freeze the VAE’s encoder and decoder networks and train two latent DDMs on the encodings $\mathbf { z } _ { 0 }$ and $\mathbf { h } _ { 0 }$ sampled from $q _ { \phi } ( \mathbf { z } _ { 0 } | \mathbf { x } )$ and $q _ { \phi } ( \mathbf { h } _ { 0 } | \mathbf { x } , \mathbf { z } _ { 0 } )$ , minimizing score matching (SM) objectives similar to Eq. (2):
+
+$$
+\begin{array} { r l } & { \mathcal { L } _ { \mathrm { S M } ^ { \mathbf { z } } } ( \pmb { \theta } ) = \mathbb { E } _ { t \sim U \{ 1 , T \} , p ( \mathbf { x } ) , q _ { \phi } ( \mathbf { z } _ { 0 } | \mathbf { x } ) , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , I ) } | | \epsilon - \epsilon _ { \theta } ( \mathbf { z } _ { t } , t ) | | _ { 2 } ^ { 2 } , } \\ & { \mathcal { L } _ { \mathrm { S M } ^ { \mathbf { h } } } ( \pmb { \psi } ) = \mathbb { E } _ { t \sim U \{ 1 , T \} , p ( \mathbf { x } ) , q _ { \phi } ( \mathbf { z } _ { 0 } | \mathbf { x } ) , q _ { \phi } ( \mathbf { h } _ { 0 } | \mathbf { x } , \mathbf { z } _ { 0 } ) , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , I ) } | | \epsilon - \epsilon _ { \psi } ( \mathbf { h } _ { t } , \mathbf { z } _ { 0 } , t ) | | _ { 2 } ^ { 2 } , } \end{array}
+$$
+
+where ${ \bf z } _ { t } = \alpha _ { t } { \bf z } _ { 0 } + \sigma _ { t } \epsilon$ and $\mathbf { h } _ { t } = \alpha _ { t } \mathbf { h } _ { 0 } + \sigma _ { t } \mathbf { \epsilon } \epsilon$ are the diffused latent encodings. Furthermore, $\pmb \theta$ denotes the parameters of the global shape latent DDM $\boldsymbol { \epsilon } _ { \boldsymbol { \theta } } ( \mathbf { z } _ { t } , t )$ , and $\psi$ refers to the parameters of the conditional DDM $\mathbf { \epsilon } _ { \psi } ( \mathbf { h } _ { t } , \bar { \mathbf { z } _ { 0 } } , t )$ trained over the latent point cloud (note the conditioning on $\mathbf { z } _ { 0 }$ ).
+
+Generation. With the latent DDMs, we can formally define a hierarchical generative model $\begin{array} { r } { p _ { \xi , \psi , \theta } ( \mathbf { x } , \mathbf { h } _ { 0 } , \mathbf { z } _ { 0 } ) = p _ { \xi } ( \mathbf { x } | \mathbf { h } _ { 0 } , \mathbf { z } _ { 0 } ) p _ { \psi } ( \mathbf { h } _ { 0 } | \mathbf { z } _ { 0 } ) p _ { \theta } ( \mathbf { z } _ { 0 } ) } \end{array}$ , where $p _ { \pmb { \theta } } ( \mathbf { z } _ { 0 } )$ denotes the distribution of the global shape latent DDM, $p _ { \psi } ( \mathbf { h } _ { 0 } | \mathbf { z } _ { 0 } )$ refers to the DDM modeling the point cloud-structured latents, and $p _ { \pmb { \xi } } ( \mathbf { x } | \mathbf { h } _ { 0 } , \mathbf { z } _ { 0 } )$ is LION’s decoder. We can hierarchically sample the latent DDMs following Eq. (4) and then translate the latent points back to the original point cloud space with the decoder.
+
+Network Architectures and DDM Parametrization. Let us briefly summarize key implementation choices. The encoder networks, as well as the decoder and the latent point DDM, operating on point clouds $\mathbf { x }$ , are all implemented based on Point-Voxel CNNs (PVCNNs) [80], following Zhou et al. [46]. PVCNNs efficiently combine the point-based processing of PointNets [81, 82] with the strong spatial inductive bias of convolutions. The DDM modeling the global shape latent uses a ResNet [83] structure with fully-connected layers (implemented as $1 \times 1$ -convolutions). All conditionings on the global shape latent are implemented via adaptive Group Normalization [84] in the PVCNN layers. Furthermore, following Vahdat et al. [58] we use a mixed score parametrization in both latent DDMs. This means that the score models are parametrized to predict a residual correction to an analytic standard Gaussian score. This is beneficial since the latent encodings are regularized towards a standard Gaussian distribution during the first training stage (see App. D for all details).
+
+# 3.1 Applications and Extensions
+
+Here, we discuss how LION can be used and extended for different relevant applications.
+
+Multimodal Generation. We can synthesize different variations of a given shape, enabling multimodal generation in a controlled manner: Given a shape, i.e., its point cloud $\mathbf { x }$ , we encode it into latent space. Then, we diffuse its encodings $\mathbf { z } _ { 0 }$ and $\mathbf { h } _ { 0 }$ for a small number of steps $\tau < T$ towards intermediate ${ \bf z } _ { \tau }$ and ${ \bf h } _ { \tau }$ along the diffusion process such that only local details are destroyed. Running the reverse generation process from this intermediate $\tau$ , starting at ${ \bf z } _ { \tau }$ and ${ \bf h } _ { \tau }$ , leads to variations of the original shape with different details (see, for instance, Fig. 2). We refer to this procedure as diffuse-denoise (details in App. C.1). Similar techniques have been used for image editing [85].
+
+Encoder Fine-tuning for Voxel-Conditioned Synthesis and Denoising. In practice, an artist using a 3D generative model may have a rough idea of the desired shape. For instance, they may be able to quickly construct a coarse voxelized shape, to which the generative model then adds realistic details.
+
+
+Figure 4: Voxelguided synthesis with LION. We run diffuse-denoise in latent space (see Sec. 3.1) to generate diverse plausible clean shapes.
+
+In LION, we can support such applications: using a similar ELBO as in Eq. (5), but with a frozen decoder, we can fine-tune LION’s encoder networks to take voxelized shapes as input (we simply place points at the voxelized shape’s surface) and map them to the corresponding latent encodings $\mathbf { z } _ { 0 }$ and $\mathbf { h } _ { 0 }$ that reconstruct the original non-voxelized point cloud. Now, a user can utilize the fine-tuned encoders to encode voxelized shapes and generate plausible detailed shapes. Importantly, this can be naturally combined with the diffuse-denoise procedure to clean up imperfect encodings and to generate different possible detailed shapes (see Fig. 4).
+
+Furthermore, this approach is general. Instead of voxel-conditioned synthesis, we can also fine-tune the encoder networks on noisy shapes to perform multimodal shape denoising, also potentially combined with diffuse-denoise. LION supports these applications easily without re-training the latent DDMs due to its VAE framework with additional encoders and decoders, in contrast to previous works that train DDMs on point clouds directly [46, 47]. See App. C.2 for technical details.
+
+Shape Interpolation. LION also enables shape interpolation: We can encode different point clouds into LION’s hierarchical latent space and use the probability flow ODE (see App. B) to further encode into the latent DDMs’ Gaussian priors, where we can safely perform spherical interpolation and expect valid shapes along the interpolation path. We can use the intermediate encodings to generate the interpolated shapes (see Fig. 7; details in App. C.3).
+
+Surface Reconstruction. While point clouds are an ideal 3D representation for DDMs, artists may prefer meshed outputs. Hence, we propose to combine LION with modern geometry reconstruction methods (see Figs. 2, 4 and 5). We use Shape As Points (SAP) [68], which is based on differentiable Poisson surface reconstruction and can be trained to extract smooth meshes from noisy point clouds. Moreover, we fine-tune SAP on training data generated by LION’s autoencoder to better adjust SAP to the noise distribution in point clouds generated by LION. Specifically, we take clean shapes, encode them into latent space, run a few steps of diffuse-denoise that only slightly modify some details, and decode back. The diffuse-denoise in latent space results in noise in the generated point ated points. clouds similar to what is observed during unconditional synthesis (details in App. C.4).
+
+
+Figure 5: Reconstructing a mesh from LION’s gener
+
+# 3.2 LION’s Advantages
+
+We now recapitulate LION’s unique advantages. LION’s structure as a hierarchical VAE with latent DDMs is inspired by latent DDMs on images [57, 58, 77]. This framework has key benefits:
+
+(i) Expressivity: First training a VAE that regularizes the latent encodings to approximately fall under standard Gaussian distributions, which are also the DDMs’ equilibrium distributions towards which the diffusion processes converge, results in an easier modeling task for the DDMs: They have to model only the remaining mismatch between the actual encoding distributions and their own Gaussian priors [58]. This translates into improved expressivity, which is further enhanced by the additional decoder network. However, point clouds are, in principle, an ideal representation for the DDM framework, because they can be diffused and denoised easily and powerful point cloud processing architectures exist. Therefore, LION uses point cloud latents that combine the advantages of both latent DDMs and 3D point clouds. Our point cloud latents can be interpreted as smoothed versions of the original point clouds that are easier to model (see Fig. 1). Moreover, the hierarchical VAE setup with an additional global shape latent increases LION’s expressivity even further and results in natural disentanglement between overall shape and local details captured by the shape latents and latent points (Sec. 5.2).
+
+(ii) Flexibility: Another advantage of LION’s VAE framework is that its encoders can be fine-tuned for various relevant tasks, as discussed previously, and it also enables easy shape interpolation. Other 3D point cloud DDMs operating on point clouds directly [47, 46] do not offer simultaneously as much flexibility and expressivity out-of-the-box (see quantitative comparisons in Secs. 5.1 and 5.4).
+
+(iii) Mesh Reconstruction: As discussed, while point clouds are ideal for DDMs, artists likely prefer meshed outputs. As explained above, we propose to use LION together with modern surface reconstruction techniques [68], again combining the best of both worlds—a point cloud-based VAE backbone ideal for DDMs, and smooth geometry reconstruction methods operating on the synthesized point clouds to generate practically useful smooth surfaces, which can be easily transformed into meshes.
+
+
+Figure 6: Unconditional shape generation with 2,048 points for airplane, car and chair classes (class-specific models trained on PointFlow’s ShapeNet data with global normalization).
+
+# 4 Related Work
+
+We are building on DDMs [53, 65–67], which have been used most prominently for image [53–63] and speech synthesis [86–91]. We train DDMs in latent space, an idea that has been explored for image [57, 58, 77] and music [92] generation, too. However, these works did not train separate conditional DDMs. Hierarchical DDM training has been used for generative image upsampling [54], text-to-image generation [63, 64], and semantic image modeling [60]. Most relevant among these works is Preechakul et al. [60], which extracts a high-level semantic representation of an image with an auxiliary encoder and then trains a DDM that adds details directly in image space. We are the first to explore related concepts for 3D shape synthesis and we also train both DDMs in latent space. Furthermore, DDMs and VAEs have also been combined in such a way that the DDM improves the output of the VAE [93].
+
+Most related to LION are “Point-Voxel Diffusion” (PVD) [46] and “Diffusion Probabilistic Models for 3D Point Cloud Generation” (DPM) [47]. PVD trains a DDM directly on point clouds, and our decision to use PVCNNs is inspired by this work. DPM, like LION, uses a shape latent variable, but models its distribution with Normalizing Flows [94, 95], and then trains a weaker point-wise conditional DDM directly on the point cloud data (this allows DPM to learn useful representations in its latent variable, but sacrifices generation quality). As we show below, neither PVD nor DPM easily enables applications such as multimodal voxel-conditioned synthesis and denoising. Furthermore, LION achieves significantly stronger generation performance. Finally, neither PVD nor DPM reconstructs meshes from the generated point clouds. Point cloud and 3D shape generation have also been explored with other generative models: PointFlow [31], DPF-Net [33] and SoftFlow [32] rely on Normalizing Flows [94–97]. SetVAE [29] treats point cloud synthesis as set generation and uses VAEs. ShapeGF [45] learns distributions over gradient fields that model shape surfaces. Both IM-GAN [7], which models shapes as neural fields, and l-GAN [2] train GANs over latent variables that encode the shapes, similar to other works [3], while r-GAN [2] generates point clouds directly. PDGN [52] proposes progressive deconvolutional networks within a point cloud GAN. SP-GAN [19] uses a spherical point cloud prior. Other progressive [22, 37] and graph-based architectures [4, 6] have been used, too. Also generative cellular automata (GCAs) can be employed for voxel-based 3D shape generation [43]. In orthogonal work, point cloud DDMs have been used for generative shape completion [46, 98].
+
+Recently, image-driven [8–16, 44] training of 3D generative models as well as text-driven 3D generation [34, 49–51] have received much attention. These are complementary directions to ours; in fact, augmenting LION with additional image-based training or including text-guidance are promising future directions. Finally, we are relying on SAP [68] for mesh generation. Strong alternative approaches for reconstructing smooth surfaces from point clouds exist [99–103].
+
+
+Figure 7: Interpolating different shapes by interpolating their encodings in the standard Gaussian priors of LION’s latent DDMs (details in App. C.3).
+
+Table 1: Generation metrics (1-NNA↓) on airplane, chair, car categories from ShapeNet dataset from PointFlow [31]. Training and test data normalized globally into [-1, 1].
+
+
Airplane
Chair
Car
CD EMD
CD
EMD
CD
EMD
r-GAN[2]
98.40 96.79
83.69
99.70
94.46
599.01
1-GAN (CD) [2]
87.30 )93.95
68.58
83.84
66.49
88.78
1-GAN (EMD)[2]
89.49 76.91
71.90
64.65
71.16
66.19
PointFlow [31]
75.68 370.74
62.84
60.57
58.10
56.25
SoftFlow [32]
76.05 65.80
59.21
60.05
64.77
60.09
SetVAE [29]
76.54 67.65
58.84
60.57
59.94
59.94
DPF-Net [33]
75.18 65.55
62.00
58.53
62.35
54.48
DPM[47]
76.42 86.91
60.05
74.77
68.89
79.97
PVD [46]
73.82 64.81
56.26
53.32
54.55
53.83
LION (ours)
67.41 61.23
53.70
52.34
53.41 51.14
+
+Table 2: Generation results (1-NNA↓) on ShapeNet dataset from PointFlow [31]. All data normalized individually into [-1, 1].
+
+
Airplane
Chair
Car
CD
EMD
CD EMD
CD EMD
TreeGAN[ [6]
97.53 99.88 88.37
96.37 89.77
94.89
ShapeGF[ [45]
81.23 80.86
58.01
61.25 61.79
57.24
SP-GAN[19]
94.69 93.95
72.58
83.69
87.36 85.94
PDGN [52]
94.94 91.73
71.83
79.00 89.35 87.22
GCA [43]
88.15 85.93
64.27
64.50 70.45
64.20
LION(ours)
76.30 67.04 56.50 53.85 59.52 49.29
+
+Table 3: Results (1-NNA↓) on ShapeNet-vol.
+
+
Airplane
Chair
Car
CD EMD
CD EMD
CD EMD
IM-GAN[7]
79.70 77.85 57.09
58.20 88.92
84.58
DPM[47] PVD [46]
83.04 96.04 61.96 66.46 56.06 61.89
74.96 77.30 57.90 64.49
87.12 55.74
LION (ours) 53.47 53.84 52.07
48.67
54.81 50.53
+
+# 5 Experiments
+
+We provide an overview of our most interesting experimental results in the main paper. All experiment details and extensive additional experiments can be found in App. E and App. F, respectively.
+
+# 5.1 Single-Class 3D Shape Generation
+
+Datasets. To compare LION against existing methods, we use ShapeNet [104], the most widely used dataset to benchmark 3D shape generative models. Following previous works [31, 46, 47], we train on three categories: airplane, chair, car. Also like previous methods, we primarily rely on PointFlow’s [31] dataset splits and preprocssing. It normalizes the data globally across the whole dataset. However, some baselines require per-shape normalization [19, 43, 45, 52]; hence, we also train on such data. Furthermore, training SAP requires signed distance fields (SDFs) for volumetric supervision, which the PointFlow data does not offer. Hence, for simplicity we follow Peng et al. [68, 101] and also use their data splits and preprocessing, which includes SDFs.We train LION, DPM, PVD, and IM-GAN (which synthesizes shapes as SDFs) also on as ShapeNet-vol here). This data is also per-shape normalized.
+
+Evaluation. Model evaluation follows previous works [31, 46]. Various metrics to evaluate point cloud generative models exist, with different advantages and disadvantages, discussed in detail by Yang et al. [31]. Following recent works [31, 46], we use 1-NNA (with both Chamfer distance (CD) and earth mover distance (EMD)) as our main metric. It quantifies the distributional similarity between generated shapes and validation set and measures both quality and diversity [31]. For fair comparisons, all metrics are computed on point clouds, not meshed outputs (App. E.2 discusses different metrics; further results on coverage (COV) and minimum matching distance (MMD) in App. F.2).
+
+
+Figure 8: Samples from our unconditional 13-class model: In each column, we use the same global shape latent $\mathbf { z } _ { 0 }$ .
+
+this dataset version (denoted Dataset details in App. E.1.
+
+Table 4: Generation results (1- NNA↓) of LION trained jointly on 13 classes of ShapeNet-vol.
+
+
Model
CD
EMD
TreeGAN [6]
96.80
96.60
PointFlow [31]
63.25
66.05
ShapeGF[45]
55.65
59.00
SetVAE [29]
79.25
95.25
PDGN [52]
71.05
86.00
DPF-Net [33]
67.10
64.75
DPM[47]
62.30
86.50
PVD [46]
58.65
57.85
LION (ours)
51.85
48.95
+
+Results. Samples from LION are shown in Fig. 6 and quantitative results in Tabs. 1-3 (see Sec. 4 for details about baselines—to reduce the number of baselines to train, we are focusing on the most recent and competitive ones). LION outperforms all baselines and achieves state-of-the-art performance on all classes and dataset versions. Importantly, we outperform both PVD and DPM, which also leverage DDMs, by large margins. Our samples are diverse and appear visually pleasing.
+
+
+Figure 9: Generated point clouds from LION trained jointly over 55 classes of ShapeNet-vol (no conditioning).
+
+
+Figure 10: Samples from LION trained on ShapeNet’s Mug and Bottle classes, and on Turbosquid animals.
+
+Mesh Reconstruction. As explained in Sec. 3.1, we combine LION with mesh reconstruction, to directly synthesize practically useful meshes. We show generated meshes in Fig. 2, which look smooth and of high quality. In Fig. 2, we also visually demonstrate how we can vary the local details of synthesized shapes while preserving the overall shape with our diffuse-denoise technique (Sec. 3.1). Details about the number of diffusion steps for all diffuse-denoise experiments are in App. E.
+
+Shape Interpolation. As discussed in Sec. 3.1, LION also enables shape interpolation, potentially useful for shape editing applications. We show this in Fig. 7, combined with mesh reconstruction. The generated shapes are clean and semantically plausible along the entire interpolation path. In App. F.12.1, we also show interpolations from PVD [46] and DPM [47] for comparison.
+
+# 5.2 Many-class Unconditional 3D Shape Generation
+
+13-Class LION Model. We train a LION model jointly without any class conditioning on 13 different categories (airplane, chair, car, lamp, table, sofa, cabinet, bench, telephone, loudspeaker, display, watercraft, rifle) from ShapeNet (ShapeNet-vol version). Training a single model without conditioning over such diverse shapes is challenging, as the data distribution is highly complex and multimodal. We show LION’s generated samples in Fig. 3, including meshes: LION synthesizes high-quality and diverse plausible shapes even when trained on such complex data. We report the model’s quantitative generation performance in Tab. 4, and we also trained various strong baseline methods under the same setting for comparison. We find that LION significantly outperforms all baselines by a large margin. We further observe that the hierarchical VAE architecture of LION becomes crucial: The shape latent variable $\mathbf { z } _ { 0 }$ captures global shape, while the latent points $\mathbf { h } _ { 0 }$ model details. This can be seen in Fig. 8: we show samples when fixing the global shape latent $\mathbf { z } _ { 0 }$ and only sample $\mathbf { h } _ { 0 }$ (details in App. F.3).
+
+55-Class LION Model. Encouraged by these results, we also trained a LION model again jointly without any class conditioning on all 55 different categories from ShapeNet. Note that we did on purpose not use class-conditioning in these experiments to create a difficult 3D generation task and thereby explore LION’s scalability to highly complex and multimodal datasets. We show generated point cloud samples in Fig. 9 (we did not train an SAP model on the 55 classes data): LION synthesizes high-quality and diverse shapes. It can even generate samples from the cap class, which contributes with only 39 training data samples, indicating that LION has an excellent mode coverage that even includes the very rare classes. To the best of our knowledge no previous 3D shape generative models have demonstrated satisfactory generation performance for such diverse and multimodal 3D data without relying on conditioning information (details in App. F.4). In conclusion, we observe that LION out-of-the-box easily scales to highly complex multi-category shape generation.
+
+# 5.3 Training LION on Small Datasets
+
+Next, we explore whether LION can also be trained successfully on very small datasets. To this end, we train models on the Mug and Bottle ShapeNet classes. The number of training samples is 149 and 340, respectively, which is much smaller than the common classes like chair, car and airplane. Furthermore, we also train LION on 553 animal assets from the TurboSquid data repository. Generated shapes from the three models are shown in Fig. 10. LION is able to generate correct mugs and bottles as well as diverse and high-quality animal shapes. We conclude that LION also performs well even when training in the challenging low-data setting (details in Apps. F.5 and F.6).
+
+
+Figure 11: Voxel-guided synthesis. We show different methods with 0 and 50 steps of diffuse-denoise. Voxelizations of generated points are also shown: Yellow boxes indicate generated points correctly fill input voxels, green boxes indicate voxels should be filled but are left empty, red boxes indicate extra voxels.
+
+
+Figure 13: Voxel-guided generation. Quality metrics for output points (lower is better) and voxel IOU with respect to input (higher is better). $x -$ - axes denote diffuse-denoise steps.
+
+
+Figure 12: Reconstruction metrics with respect to clean inputs for airplane category (lower is better) when guiding synthesis with voxelized or noisy inputs (using uniform, outlier, and normal noise, see App. F.7). $_ x$ -axes denote number of diffuse-denoise steps.
+
+# 5.4 Voxel-guided Shape Synthesis and Denoising with Fine-tuned Encoders
+
+Next, we test our strategy for multimodal voxel-guided shape synthesis (see Sec. 3.1) using the airplane class LION model (experiment details in App. E, more experiments in App. F.7). We first voxelize our training set and fine-tune our encoder networks to produce the correct encodings to decode back the original shapes. When processing voxelized shapes with our point-cloud networks, we sample points on the surface of the voxels. As discussed, we can use different numbers of diffusedenoise steps in latent space to generate various plausible shapes and correct for poor encodings. Instead of voxelizations, we can also consider different noisy inputs (we use normal, uniform, and outlier noise, see App. F.7) and achieve multimodal denoising with the same approach. The same tasks can be attempted with the important DDM-based baselines PVD and DPM, by directly—not in a latent space—diffusing and denoising voxelized (converted to point clouds) or noisy point clouds.
+
+Fig. 12 shows the reconstruction performance of LION, DPM and PVD for different numbers of diffuse-denoise steps (we voxelized or noised the validation set to measure this). We see that for almost all inputs—voxelized or different noises—LION performs best. PVD and DPM perform acceptably for normal and uniform noise, which is similar to the noise injected during training of their DDMs, but perform very poorly for outlier noise or voxel inputs, which is the most relevant case to us, because voxels can be easily placed by users. It is LION’s unique framework with additional fine-tuned encoders in its VAE and only latent DDMs that makes this possible. Performing more diffuse-denoise steps means that more independent, novel shapes are generated. These will be cleaner and of higher quality, but also correspond less to the noisy or voxel inputs used for guidance. In Fig. 13, we show this trade-off for the voxel-guidance experiment (other experiments in App. F.7), where (top) we measured the outputs’ synthesis quality by calculating 1-NNA with respect to the validation set, and (bottom) the average intersection over union (IOU) between the input voxels and the voxelized outputs. We generally see a trade-off: More diffuse-denoise steps result in lower 1-NNA (better quality), but also lower IOU. LION strikes the best balance by a large gap: Its additional encoder network directly generates plausible latent encodings from the perturbed inputs that are both high quality and also correspond well to the input. This trade-off is visualized in Fig. 11 for LION, DPM, and PVD, where we show generated point clouds and voxelizations (note that performing no diffuse-denoise at all for PVD and DPM corresponds to simply keeping the input, as these models’ DDMs operate directly on point clouds). We see that running 50 diffuse-denoise steps to generate diverse outputs for DPM and especially PVD results in a significant violation of the input voxelization. In contrast, LION generates realistic outputs that also obey the driving voxels. Overall, LION wins out both in this task and also in unconditional generation with large gaps over these previous DDM-based point cloud generative models. We conclude that LION does not only offer state-of-the-art 3D shape generation quality, but is also very versatile. Note that guided synthesis can also be combined with mesh reconstruction, as shown in Fig. 4.
+
+
+Figure 14: We apply Text2Mesh [49] on meshes generated by LION. In Text2Mesh, textures are generated and meshes refined such that rendered images of the 3D objects are aligned with user-provided text prompts [105].
+
+
+Figure 16: Text-driven shape generation of chairs and cars with LION. Bottom row is the text prompt used as input.
+
+# 5.5 Sampling Time
+
+While our main experiments use 1,000-step DDPM-based synthesis, which takes $\approx 2 7 . 1 2$ seconds, we can significantly accelerate generation without significant loss in quality. Using DDIM-based sampling [106], we can generate high quality shapes in under one second (Fig. 15), which would enable real-time interactive applications. More analyses in App. F.9.
+
+
+Figure 15: 25-step DDIM [106] samples (0.89 seconds per shape).
+
+# 5.6 Overview of Additional Experiments in Appendix
+
+(i) In App. F.1, we perform various ablation studies. The experiments quantitatively validate LION’s architecture choices and the advantage of our hierarchical VAE setup with conditional latent DDMs. (ii) In App. F.8, we measure LION’s autoencoding performance. (iii) To demonstrate the value of directly outputting meshes, in App. F.10 we use Text2Mesh [49] to generate textures based on text prompts for synthesized LION samples (Fig. 14). This would not be possible, if we only generated point clouds. (iv) To qualitatively show that LION can be adapted easily to other relevant tasks, in App. F.11 we condition LION on CLIP embeddings of the shapes’ rendered images, following CLIP-Forge [34] (Fig. 16). This enables text-driven 3D shape generation and single view 3D reconstruction (Fig. 17). (v) We also show many more samples (Apps. F.2-F.6) and shape interpolations (App. F.12) from our models, more examples of voxel-guided and noise-guided synthesis (App. F.7), and we further analyze our 13-class LION model (App. F.3.2).
+
+# 6 Conclusions
+
+We introduced LION, a novel generative model of 3D shapes. LION uses a VAE framework with hierarchical DDMs in latent space and can be combined with SAP for mesh generation. LION achieves state-of-the-art shape generation performance and enables applications such as voxel-conditioned synthesis, multimodal shape denoising, and shape interpolation. LION is currently trained on 3D point clouds only and can not directly generate textured shapes. A promising extension would be to include image-based training by incorporating neural or differentiable rendering [17, 107–111] and to also synthesize textures [16, 112–114]. Furthermore, LION currently focuses on single object generation only. It would be interesting to extend it to full 3D scene synthesis. Moreover, synthesis could be further accelerated by building on works on accelerated sampling from DDMs [61, 62, 67, 106, 115–121].
+
+Broader Impact. We believe that LION can potentially improve 3D content creation and assist the workflow of digital artists. We designed LION with such applications in mind and hope that it can grow into a practical tool enhancing artists’ creativity. Although we do not see any immediate negative use-cases for LION, it is important that practitioners apply an abundance of caution to mitigate impacts given generative modeling more generally can also be used for malicious purposes, discussed for instance in Vaccari and Chadwick [122], Nguyen et al. [123], Mirsky and Lee [124].
+
+
+Figure 17: Single view 3D reconstructions of a car from an RGB image. LION can generate multiple plausible outputs using our diffuse-denoise technique.
+
+References
+[1] Jiajun Wu, Chengkai Zhang, Tianfan Xue, Bill Freeman, and Josh Tenenbaum. Learning a probabilistic latent space of object shapes via 3d generative-adversarial modeling. In Advances in Neural Information Processing Systems, 2016. [2] Panos Achlioptas, Olga Diamanti, Ioannis Mitliagkas, and Leonidas Guibas. Learning representations and generative models for 3D point clouds. In ICML, 2018.
+[3] Chun-Liang Li, Manzil Zaheer, Yang Zhang, Barnabas Poczos, and Ruslan Salakhutdinov. Point cloud gan. arXiv preprint arXiv:1810.05795, 2018.
+[4] Diego Valsesia, Giulia Fracastoro, and Enrico Magli. Learning localized generative models for 3d point clouds via graph convolution. In International Conference on Learning Representations (ICLR) 2019, 2019. [5] Wenlong Huang, Brian Lai, Weijian Xu, and Zhuowen Tu. 3d volumetric modeling with introspective neural networks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33(01), pages 8481–8488, 2019. [6] Dong Wook Shu, Sung Woo Park, and Junseok Kwon. 3d point cloud generative adversarial network based on tree structured graph convolutions. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 3859–3868, 2019.
+[7] Zhiqin Chen and Hao Zhang. Learning implicit fields for generative shape modeling. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2019. [8] Michael Niemeyer and Andreas Geiger. Giraffe: Representing scenes as compositional generative neural feature fields. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2021. [9] Katja Schwarz, Yiyi Liao, Michael Niemeyer, and Andreas Geiger. Graf: Generative radiance fields for 3d-aware image synthesis. In Advances in Neural Information Processing Systems (NeurIPS), 2020.
+[10] Yiyi Liao, Katja Schwarz, Lars Mescheder, and Andreas Geiger. Towards unsupervised learning of generative models for 3d controllable image synthesis. In Proceedings IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2020.
+[11] Eric Chan, Marco Monteiro, Petr Kellnhofer, Jiajun Wu, and Gordon Wetzstein. pi-gan: Periodic implicit generative adversarial networks for 3d-aware image synthesis. In Proc. CVPR, 2021.
+[12] Eric R. Chan, Connor Z. Lin, Matthew A. Chan, Koki Nagano, Boxiao Pan, Shalini De Mello, Orazio Gallo, Leonidas Guibas, Jonathan Tremblay, Sameh Khamis, Tero Karras, and Gordon Wetzstein. Efficient geometry-aware 3D generative adversarial networks. In arXiv, 2021.
+[13] Roy Or-El, Xuan Luo, Mengyi Shan, Eli Shechtman, Jeong Joon Park, and Ira Kemelmacher-Shlizerman. Stylesdf: High-resolution 3d-consistent image and geometry generation. arXiv preprint arXiv:2112.11427, 2021.
+[14] Jiatao Gu, Lingjie Liu, Peng Wang, and Christian Theobalt. Stylenerf: A style-based 3d aware generator for high-resolution image synthesis. In International Conference on Learning Representations, 2022.
+[15] Peng Zhou, Lingxi Xie, Bingbing Ni, and Qi Tian. CIPS-3D: A 3D-Aware Generator of GANs Based on Conditionally-Independent Pixel Synthesis. arXiv preprint arXiv:2110.09788, 2021.
+[16] Dario Pavllo, Jonas Kohler, Thomas Hofmann, and Aurelien Lucchi. Learning generative models of textured 3d meshes from real-world images. In IEEE/CVF International Conference on Computer Vision (ICCV), 2021.
+[17] Yuxuan Zhang, Wenzheng Chen, Huan Ling, Jun Gao, Yinan Zhang, Antonio Torralba, and Sanja Fidler. Image {gan}s meet differentiable rendering for inverse graphics and interpretable 3d neural rendering. In International Conference on Learning Representations, 2021.
+[18] Moritz Ibing, Isaak Lim, and Leif P. Kobbelt. 3d shape generation with grid-based implicit functions. In 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
+[19] Ruihui Li, Xianzhi Li, Ke-Hei Hui, and Chi-Wing Fu. SP-GAN:sphere-guided 3d shape generation and manipulation. ACM Transactions on Graphics (Proc. SIGGRAPH), 40(4), 2021.
+[20] A. Luo, T. Li, W. Zhang, and T. Lee. Surfgen: Adversarial 3d shape synthesis with explicit surface discriminators. In 2021 IEEE/CVF International Conference on Computer Vision (ICCV), 2021.
+[21] Zhiqin Chen, Vladimir G. Kim, Matthew Fisher, Noam Aigerman, Hao Zhang, and Siddhartha Chaudhuri. Decor-gan: 3d shape detailization by conditional refinement. In Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
+[22] Cheng Wen, Baosheng Yu, and Dacheng Tao. Learning progressive point embeddings for 3d point cloud generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10266–10275, 2021.
+[23] Zekun Hao, Arun Mallya, Serge Belongie, and Ming-Yu Liu. GANcraft: Unsupervised 3D Neural Rendering of Minecraft Worlds. In ICCV, 2021.
+[24] Or Litany, Alex Bronstein, Michael Bronstein, and Ameesh Makadia. Deformable shape completion with graph convolutional autoencoders. CVPR, 2018.
+[25] Qingyang Tan, Lin Gao, Yu-Kun Lai, and Shihong Xia. Variational autoencoders for deforming 3d mesh models. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 5841–5850, 2018.
+[26] Kaichun Mo, Paul Guerrero, Li Yi, Hao Su, Peter Wonka, Niloy Mitra, and Leonidas J Guibas. Structurenet: Hierarchical graph networks for 3d shape generation. arXiv preprint arXiv:1908.00575, 2019.
+[27] Lin Gao, Jie Yang, Tong Wu, Yu-Jie Yuan, Hongbo Fu, Yu-Kun Lai, and Hao(Richard) Zhang. SDM-NET: Deep generative network for structured deformable mesh. ACM Transactions on Graphics (Proceedings of ACM SIGGRAPH Asia 2019), 38(6):243:1–243:15, 2019.
+[28] Lin Gao, Tong Wu, Yu-Jie Yuan, Ming-Xian Lin, Yu-Kun Lai, and Hao Zhang. Tm-net: Deep generative networks for textured meshes. ACM Transactions on Graphics (TOG), 40(6):263:1–263:15, 2021.
+[29] Jinwoo Kim, Jaehoon Yoo, Juho Lee, and Seunghoon Hong. Setvae: Learning hierarchical composition for generative modeling of set-structured data. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 15059–15068, June 2021.
+[30] Paritosh Mittal, Yen-Chi Cheng, Maneesh Singh, and Shubham Tulsiani. AutoSDF: Shape priors for 3d completion, reconstruction and generation. In CVPR, 2022.
+[31] Guandao Yang, Xun Huang, Zekun Hao, Ming-Yu Liu, Serge Belongie, and Bharath Hariharan. PointFlow: 3D point cloud generation with continuous normalizing flows. In ICCV, 2019.
+[32] Hyeongju Kim, Hyeonseung Lee, Woo Hyun Kang, Joun Yeop Lee, and Nam Soo Kim. SoftFlow: Probabilistic framework for normalizing flow on manifolds. In NeurIPS, 2020.
+[33] Roman Klokov, Edmond Boyer, and Jakob Verbeek. Discrete point flow networks for efficient point cloud generation. In ECCV, 2020.
+[34] Aditya Sanghi, Hang Chu, Joseph G Lambourne, Ye Wang, Chin-Yi Cheng, and Marco Fumero. Clipforge: Towards zero-shot text-to-shape generation. arXiv preprint arXiv:2110.02624, 2021.
+[35] Yongbin Sun, Yue Wang, Ziwei Liu, Joshua E Siegel, and Sanjay E Sarma. Pointgrow: Autoregressively learned point cloud generation with self-attention. In Winter Conference on Applications of Computer Vision, 2020.
+[36] Charlie Nash, Yaroslav Ganin, S. M. Ali Eslami, and Peter W. Battaglia. Polygen: An autoregressive generative model of 3d meshes. ICML, 2020.
+[37] Wei-Jan Ko, Hui-Yu Huang, Yu-Liang Kuo, Chen-Yi Chiu, Li-Heng Wang, and Wei-Chen Chiu. Rpg: Learning recursive point cloud generation. arXiv preprint arXiv:2105.14322, 2021.
+[38] Moritz Ibing, Gregor Kobsik, and Leif Kobbelt. Octree transformer: Autoregressive 3d shape generation on hierarchically structured sequences. arXiv preprint arXiv:2111.12480, 2021.
+[39] Jianwen Xie, Zilong Zheng, Ruiqi Gao, Wenguan Wang, Zhu Song-Chun, and Ying Nian Wu. Learning descriptor networks for 3d shape synthesis and analysis. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
+[40] Jianwen Xie, Yifei Xu, Zilong Zheng, Ruiqi Gao, Wenguan Wang, Zhu Song-Chun, and Ying Nian Wu. Generative pointnet: Deep energy-based learning on unordered point sets for 3d generation, reconstruction and classification. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
+[41] Tianchang Shen, Jun Gao, Kangxue Yin, Ming-Yu Liu, and Sanja Fidler. Deep marching tetrahedra: a hybrid representation for high-resolution 3d shape synthesis. In Advances in Neural Information Processing Systems (NeurIPS), 2021.
+[42] Kangxue Yin, Jun Gao, Maria Shugrina, Sameh Khamis, and Sanja Fidler. 3dstylenet: Creating 3d shapes with geometric and texture style variations. In Proceedings of International Conference on Computer Vision (ICCV), 2021.
+[43] Dongsu Zhang, Changwoon Choi, Jeonghwan Kim, and Young Min Kim. Learning to generate 3d shapes with generative cellular automata. In International Conference on Learning Representations, 2021.
+[44] Chen Chao, Zhizhong Han, Yu-Shen Liu, and Matthias Zwicker. Unsupervised learning of fine structure generation for 3d point clouds by 2d projection matching. arXiv preprint arXiv:2108.03746, 2021.
+[45] Ruojin Cai, Guandao Yang, Hadar Averbuch-Elor, Zekun Hao, Serge Belongie, Noah Snavely, and Bharath Hariharan. Learning gradient fields for shape generation. In Proceedings of the European Conference on Computer Vision (ECCV), 2020.
+[46] Linqi Zhou, Yilun Du, and Jiajun Wu. 3d shape generation and completion through point-voxel diffusion. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), 2021.
+[47] Shitong Luo and Wei Hu. Diffusion probabilistic models for 3d point cloud generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
+[48] Yu Deng, Jiaolong Yang, and Xin Tong. Deformed implicit field: Modeling 3d shapes with learned dense correspondence. In IEEE Computer Vision and Pattern Recognition, 2021.
+[49] Oscar Michel, Roi Bar-On, Richard Liu, Sagie Benaim, and Rana Hanocka. Text2mesh: Text-driven neural stylization for meshes. arXiv preprint arXiv:2112.03221, 2021.
+[50] Ajay Jain, Ben Mildenhall, Jonathan T. Barron, Pieter Abbeel, and Ben Poole. Zero-shot text-guided object generation with dream fields. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
+[51] Nasir Khalid, Tianhao Xie, Eugene Belilovsky, and Tiberiu Popa. Text to mesh without 3d supervision using limit subdivision. arXiv preprint arXiv:2203.13333, 2022.
+[52] Le Hui, Rui Xu, Jin Xie, Jianjun Qian, and Jian Yang. Progressive point cloud deconvolution generation network. In ECCV, 2020.
+[53] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In Advances in Neural Information Processing Systems, 2020.
+[54] Jonathan Ho, Chitwan Saharia, William Chan, David J Fleet, Mohammad Norouzi, and Tim Salimans. Cascaded diffusion models for high fidelity image generation. arXiv preprint arXiv:2106.15282, 2021.
+[55] Alexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, 2021.
+[56] Prafulla Dhariwal and Alexander Quinn Nichol. Diffusion models beat GANs on image synthesis. In Advances in Neural Information Processing Systems, 2021.
+[57] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. arXiv preprint arXiv:2112.10752, 2021.
+[58] Arash Vahdat, Karsten Kreis, and Jan Kautz. Score-based generative modeling in latent space. In Advances in Neural Information Processing Systems, 2021.
+[59] Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741, 2021.
+[60] Konpat Preechakul, Nattanat Chatthee, Suttisak Wizadwongsa, and Supasorn Suwajanakorn. Diffusion autoencoders: Toward a meaningful and decodable representation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
+[61] Tim Dockhorn, Arash Vahdat, and Karsten Kreis. Score-based generative modeling with critically-damped langevin diffusion. In International Conference on Learning Representations (ICLR), 2022.
+[62] Zhisheng Xiao, Karsten Kreis, and Arash Vahdat. Tackling the generative learning trilemma with denoising diffusion GANs. In International Conference on Learning Representations (ICLR), 2022.
+[63] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
+[64] Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S. Sara Mahdavi, Rapha Gontijo Lopes, Tim Salimans, Jonathan Ho, David J Fleet, and Mohammad Norouzi. Photorealistic text-to-image diffusion models with deep language understanding. arXiv preprint arXiv:2205.11487, 2022.
+[65] Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, 2015.
+[66] Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. In Proceedings of the 33rd Annual Conference on Neural Information Processing Systems, 2019.
+[67] Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2021.
+[68] Songyou Peng, Chiyu "Max" Jiang, Yiyi Liao, Michael Niemeyer, Marc Pollefeys, and Andreas Geiger. Shape as points: A differentiable poisson solver. In Advances in Neural Information Processing Systems (NeurIPS), 2021.
+[69] Diederik P Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational diffusion models. In Advances in Neural Information Processing Systems, 2021.
+[70] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In The International Conference on Learning Representations, 2014.
+[71] Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In International Conference on Machine Learning, 2014.
+[72] Jakub Tomczak and Max Welling. Vae with a vampprior. In International Conference on Artificial Intelligence and Statistics, pages 1214–1223, 2018.
+[73] Hiroshi Takahashi, Tomoharu Iwata, Yuki Yamanaka, Masanori Yamada, and Satoshi Yagi. Variational autoencoder with implicit optimal priors. Proceedings of the AAAI Conference on Artificial Intelligence, 33(01):5066–5073, Jul. 2019.
+[74] Matthias Bauer and Andriy Mnih. Resampled priors for variational autoencoders. In Kamalika Chaudhuri and Masashi Sugiyama, editors, Proceedings of the Twenty-Second International Conference on Artificial Intelligence and Statistics, volume 89 of Proceedings of Machine Learning Research, pages 66–75. PMLR, 16–18 Apr 2019.
+[75] Arash Vahdat and Jan Kautz. NVAE: A deep hierarchical variational autoencoder. In Advances in Neural Information Processing Systems, 2020.
+[76] Jyoti Aneja, Alexander Schwing, Jan Kautz, and Arash Vahdat. NCP-VAE: Variational autoencoders with noise contrastive priors. In Advances in Neural Information Processing Systems, 2021.
+[77] Abhishek Sinha, Jiaming Song, Chenlin Meng, and Stefano Ermon. D2c: Diffusion-denoising models for few-shot conditional generation. In Advances in Neural Information Processing Systems, 2021.
+[78] Mihaela Rosca, Balaji Lakshminarayanan, and Shakir Mohamed. Distribution matching in variational inference. arXiv preprint arXiv:1802.06847, 2018.
+[79] Matthew D Hoffman and Matthew J Johnson. Elbo surgery: yet another way to carve up the variational evidence lower bound. In Workshop in Advances in Approximate Bayesian Inference, NeurIPS, 2016.
+[80] Zhijian Liu, Haotian Tang, Yujun Lin, and Song Han. Point-voxel cnn for efficient 3d deep learning. In Advances in Neural Information Processing Systems, 2019.
+[81] Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
+[82] Charles R Qi, Li Yi, Hao Su, and Leonidas J Guibas. Pointnet++: Deep hierarchical feature learning on point sets in a metric space. In Advances in Neural Information Processing Systems, 2017.
+[83] Kaiming He, X. Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
+[84] Yuxin Wu and Kaiming He. Group normalization. In Proceedings of the European Conference on Computer Vision (ECCV), 2018.
+[85] Chenlin Meng, Yutong He, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. SDEdit: Guided image synthesis and editing with stochastic differential equations. In International Conference on Learning Representations, 2022.
+[86] Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, and William Chan. Wavegrad: Estimating gradients for waveform generation. In International Conference on Learning Representations (ICLR), 2021.
+[87] Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. DiffWave: A Versatile Diffusion Model for Audio Synthesis. In International Conference on Learning Representations, 2021.
+[88] Myeonghun Jeong, Hyeongju Kim, Sung Jun Cheon, Byoung Jin Choi, and Nam Soo Kim. Diff-tts: A denoising diffusion model for text-to-speech. arXiv preprint arXiv:2104.01409, 2021.
+[89] Nanxin Chen, Yu Zhang, Heiga Zen, Ron J. Weiss, Mohammad Norouzi, Najim Dehak, and William Chan. Wavegrad 2: Iterative refinement for text-to-speech synthesis. arXiv preprint arXiv:2106.09660, 2021.
+[90] Vadim Popov, Ivan Vovk, Vladimir Gogoryan, Tasnima Sadekova, and Mikhail Kudinov. Grad-tts: A diffusion probabilistic model for text-to-speech. In International Conference on Machine Learning, 2021.
+[91] Songxiang Liu, Dan Su, and Dong Yu. Diffgan-tts: High-fidelity and efficient text-to-speech with denoising diffusion gans. arXiv preprint arXiv:2201.11972, 2022.
+[92] Gautam Mittal, Jesse Engel, Curtis Hawthorne, and Ian Simon. Symbolic music generation with diffusion models. In Proceedings of the 22nd International Society for Music Information Retrieval Conference, 2021.
+[93] Kushagra Pandey, Avideep Mukherjee, Piyush Rai, and Abhishek Kumar. Diffusevae: Efficient, controllable and high-fidelity generation from low-dimensional latents. arXiv preprint arXiv:2201.00308, 2022.
+[94] Danilo Jimenez Rezende and Shakir Mohamed. Variational inference with normalizing flows. In International Conference on Machine Learning, 2015.
+[95] Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real NVP. In International Conference on Learning Representations ICLR, 2017.
+[96] Ricky T. Q. Chen, Yulia Rubanova, Jesse Bettencourt, and David Duvenaud. Neural ordinary differential equations. Advances in Neural Information Processing Systems, 2018.
+[97] Will Grathwohl, Ricky T. Q. Chen, Jesse Bettencourt, Ilya Sutskever, and David Duvenaud. FFJORD: Free-form continuous dynamics for scalable reversible generative models. In International Conference on Learning Representations, 2019.
+[98] Zhaoyang Lyu, Zhifeng Kong, Xudong XU, Liang Pan, and Dahua Lin. A conditional point diffusionrefinement paradigm for 3d point cloud completion. In International Conference on Learning Representations (ICLR), 2022.
+[99] Thibault Groueix, Matthew Fisher, Vladimir G. Kim, Bryan Russell, and Mathieu Aubry. AtlasNet: A Papier-Mâché Approach to Learning 3D Surface Generation. In Proceedings IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2018.
+[100] Lars Mescheder, Michael Oechsle, Michael Niemeyer, Sebastian Nowozin, and Andreas Geiger. Occupancy networks: Learning 3d reconstruction in function space. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4460–4470, 2019.
+[101] Songyou Peng, Michael Niemeyer, Lars Mescheder, and Andreas Geiger Marc Pollefeys. Convolutional occupancy networks. In European Conference on Computer Vision (ECCV), 2020.
+
+[102] Francis Williams, Matthew Trager, Joan Bruna, and Denis Zorin. Neural splines: Fitting 3d surfaces with infinitely-wide neural networks. In 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
+
+[103] Francis Williams, Zan Gojcic, Sameh Khamis, Denis Zorin, Joan Bruna, Sanja Fidler, and Or Litany. Neural fields as learnable kernels for 3d reconstruction. arXiv preprint arXiv:2111.13674, 2021.
+
+[104] Angel X. Chang, Thomas Funkhouser, Leonidas Guibas, Pat Hanrahan, Qixing Huang, Zimo Li, Silvio Savarese, Manolis Savva, Shuran Song, Hao Su, Jianxiong Xiao, Li Yi, and Fisher Yu. ShapeNet: An Information-Rich 3D Model Repository. Technical Report arXiv:1512.03012 [cs.GR], Stanford University — Princeton University — Toyota Technological Institute at Chicago, 2015.
+
+[105] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, ICML, 2021.
+
+[106] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations, 2021.
+
+[107] Wenzheng Chen, Huan Ling, Jun Gao, Edward Smith, Jaakko Lehtinen, Alec Jacobson, and Sanja Fidler. Learning to predict 3d objects with an interpolation-based differentiable renderer. In Advances in Neural Information Processing Systems, 2019.
+
+[108] Samuli Laine, Janne Hellsten, Tero Karras, Yeongho Seol, Jaakko Lehtinen, and Timo Aila. Modular primitives for high-performance differentiable rendering. ACM Transactions on Graphics, 2020.
+
+[109] Ben Mildenhall, Pratul P. Srinivasan, Matthew Tancik, Jonathan T. Barron, Ravi Ramamoorthi, and Ren Ng. Nerf: Representing scenes as neural radiance fields for view synthesis. In ECCV, 2020.
+
+[110] Wenzheng Chen, Joey Litalien, Jun Gao, Zian Wang, Clement Fuji Tsang, Sameh Khamis, Or Litany, and Sanja Fidler. DIB- $\mathbf { \cdot R } { + + }$ : Learning to predict lighting and material with a hybrid differentiable renderer. In Advances in Neural Information Processing Systems (NeurIPS), 2021.
+
+[111] Ayush Tewari, Justus Thies, Ben Mildenhall, Pratul Srinivasan, Edgar Tretschk, Yifan Wang, Christoph Lassner, Vincent Sitzmann, Ricardo Martin-Brualla, Stephen Lombardi, Tomas Simon, Christian Theobalt, Matthias Niessner, Jonathan T. Barron, Gordon Wetzstein, Michael Zollhoefer, and Vladislav Golyanik. Advances in neural rendering. arXiv preprint arXiv:2111.05849, 2021.
+
+[112] Michael Oechsle, Lars Mescheder, Michael Niemeyer, Thilo Strauss, and Andreas Geiger. Texture fields: Learning texture representations in function space. In Proceedings IEEE International Conf. on Computer Vision (ICCV), 2019.
+
+[113] Zhiqin Chen, Kangxue Yin, and Sanja Fidler. Auv-net: Learning aligned uv maps for texture transfer and synthesis. In The Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
+
+[114] Yawar Siddiqui, Justus Thies, Fangchang Ma, Qi Shan, Matthias Nießner, and Angela Dai. Texturify: Generating textures on 3d shape surfaces. arXiv preprint arXiv:2204.02411, 2022.
+
+[115] Daniel Watson, Jonathan Ho, Mohammad Norouzi, and William Chan. Learning to efficiently sample from diffusion probabilistic models. arXiv preprint arXiv:2106.03802, 2021.
+
+[116] Zhifeng Kong and Wei Ping. On fast sampling of diffusion probabilistic models. arXiv preprint arXiv:2106.00132, 2021.
+
+[117] Alexia Jolicoeur-Martineau, Ke Li, Rémi Piché-Taillefer, Tal Kachman, and Ioannis Mitliagkas. Gotta Go Fast When Generating Data with Score-Based Models. arXiv preprint arXiv:2105.14080, 2021.
+
+[118] Daniel Watson, William Chan, Jonathan Ho, and Mohammad Norouzi. Learning Fast Samplers for Diffusion Models by Differentiating Through Sample Quality. In International Conference on Learning Representations, 2022.
+
+[119] Luping Liu, Yi Ren, Zhijie Lin, and Zhou Zhao. Pseudo numerical methods for diffusion models on manifolds. In International Conference on Learning Representations (ICLR), 2022.
+
+[120] Tim Salimans and Jonathan Ho. Progressive distillation for fast sampling of diffusion models. In International Conference on Learning Representations (ICLR), 2022.
+
+[121] Fan Bao, Chongxuan Li, Jun Zhu, and Bo Zhang. Analytic-DPM: an Analytic Estimate of the Optimal Reverse Variance in Diffusion Probabilistic Models. In International Conference on Learning Representations, 2022.
+[122] Cristian Vaccari and Andrew Chadwick. Deepfakes and disinformation: Exploring the impact of synthetic political video on deception, uncertainty, and trust in news. Social Media $^ +$ Society, 6(1): 2056305120903408, 2020.
+[123] Thanh Thi Nguyen, Quoc Viet Hung Nguyen, Cuong M. Nguyen, Dung Nguyen, Duc Thanh Nguyen, and Saeid Nahavandi. Deep learning for deepfakes creation and detection: A survey. arXiv preprint arXiv:1909.11573, 2021.
+[124] Yisroel Mirsky and Wenke Lee. The creation and detection of deepfakes: A survey. ACM Comput. Surv., 54(1), 2021.
+[125] Merlin Nimier-David, Delio Vicini, Tizian Zeltner, and Wenzel Jakob. Mitsuba 2: a retargetable forward and inverse renderer. ACM Transactions on Graphics, 38:1–17, 11 2019. doi: 10.1145/3355089.3356498.
+[126] Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained categorization. In 4th International IEEE Workshop on 3D Representation and Recognition (3dRR-13), Sydney, Australia, 2013.
+[127] Sungjoon Choi, Qian-Yi Zhou, Stephen Miller, and Vladlen Koltun. A large dataset of object scans. arXiv:1602.02481, 2016.
+[128] Xingyuan Sun, Jiajun Wu, Xiuming Zhang, Zhoutong Zhang, Chengkai Zhang, Tianfan Xue, Joshua B Tenenbaum, and William T Freeman. Pix3d: Dataset and methods for single-image 3d shape modeling. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
+[129] Brian DO Anderson. Reverse-time diffusion equation models. Stochastic Processes and their Applications, 12(3):313–326, 1982.
+[130] Ulrich G Haussmann and Etienne Pardoux. Time reversal of diffusions. The Annals of Probability, pages 1188–1205, 1986.
+[131] Pascal Vincent. A connection between score matching and denoising autoencoders. Neural Computation, 23(7):1661–1674, 2011.
+[132] Radford M Neal and Geoffrey E Hinton. A view of the em algorithm that justifies incremental, sparse, and other variants. In Learning in graphical models, pages 355–368. Springer, 1998.
+[133] Diederik P. Kingma and Max Welling. An introduction to variational autoencoders. Foundations and Trends in Machine Learning, 12(4):307–392, 2019.
+[134] J. R. Dormand and P. J. Prince. A family of embedded runge–kutta formulae. Journal of Computational and Applied Mathematics, 6(1):19–26, 1980.
+[135] Michael Kazhdan, Matthew Bolitho, and Hugues Hoppe. Poisson surface reconstruction. In Proceedings of the fourth Eurographics symposium on Geometry processing, volume 7, 2006.
+[136] William E. Lorensen and Harvey E. Cline. Marching cubes: A high resolution 3d surface construction algorithm. In Proceedings of the 14th Annual Conference on Computer Graphics and Interactive Techniques, SIGGRAPH ’87, page 163–169, New York, NY, USA, 1987. Association for Computing Machinery.
+[137] Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7132–7141, 2018.
+[138] Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. In International Conference on Learning Representations, 2018.
+[139] Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(11), 2008.
+[140] Yue Wang, Yongbin Sun, Ziwei Liu, Sanjay E. Sarma, Michael M. Bronstein, and Justin M. Solomon. Dynamic graph cnn for learning on point clouds. ACM Transactions on Graphics (TOG), 2019.
+[141] Hengshuang Zhao, Li Jiang, Jiaya Jia, Philip HS Torr, and Vladlen Koltun. Point transformer. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 16259–16268, 2021.
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes] Please see Sec. 6.
+(c) Did you discuss any potential negative societal impacts of your work? [Yes] Please see Sec. 6.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [N/A] We did not derive novel theoretical results. We rather propose a novel generative model of 3D shapes.
+(b) Did you include complete proofs of all theoretical results? [N/A]
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No] We will release code and instructions to reproduce all experiments upon acceptance of the manuscript. The internal guidelines of our institution prevent us from releasing code at this stage.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We provide all model training and evaluation details in the App. D, including all hyperparameters.
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Following standard conventions in the related 3D generative modeling literature, we do not report error bars. Furthermore, we avoid running similar setups repeatedly to save computational resources (our main models are quite large and require substantial GPU resources for training, see App. E.9).
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] Please see App. E.9.
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes] For baseline comparisons we run publicly available code from previous, publicly available papers, which we cite. We also use various datasets. Here, we present a summary. To compare to baselines, we use the following codes: • r-GAN, l-GAN [2]: https://github.com/optas/latent_3d_points (MIT License) • PointFlow [31]: https://github.com/stevenygd/PointFlow (MIT License) • SoftFlow [32]: https://github.com/ANLGBOY/SoftFlow • Set-VAE [29]: https://github.com/jw9730/setvae (MIT License) • DPF-NET [33]: https://github.com/Regenerator/dpf-nets • DPM [47]: https://github.com/luost26/diffusion-point-cloud (MIT License) • PVD [46]: https://github.com/alexzhou907/PVD (MIT License) • ShapeGF [45]: https://github.com/RuojinCai/ShapeGF (MIT License) • SP-GAN [19]: https://github.com/liruihui/sp-gan (MIT License) • PDGN [52]: https://github.com/fpthink/PDGN (MIT License) • IM-GAN [7]: https://github.com/czq142857/implicit-decoder (MIT license) and https://github.com/czq142857/IM-NET-pytorch (MIT license) • GCA [43]: https://github.com/96lives/gca (MIT license)
+
+We use further codebases in other places:
+
+• We use the MitSuba renderer for visualizations [125]: https: //github.com/mitsuba-renderer/mitsuba2 (License: https: //github.com/mitsuba-renderer/mitsuba2/blob/master/LICENSE),
+
+and the code to generate the scene discription files for MitSuba [31]: https://github.com/zekunhao1995/PointFlowRenderer.
+• We rely on SAP [68] for mesh generation with the code at https://github.com/ autonomousvision/shape_as_points (MIT License).
+• For calculating the evaluation metrics, we use the implementation for CD at https: //github.com/ThibaultGROUEIX/ChamferDistancePytorch (MIT License) and for EMD at https://github.com/daerduoCarey/PyTorchEMD.
+• We use Text2Mesh [49] for per-sample text-driven texture synthesis: https:// github.com/threedle/text2mesh (MIT License)
+
+We also rely on the following datasets:
+
+• ShapeNet [104]. Its terms of use can be found at https://shapenet.org/ terms.
+• The Cars dataset [126] from http://ai.stanford.edu/\~jkrause/cars/car_ dataset.html with ImageNet License: https://image-net.org/download. php.
+• The TurboSquid data repository, https://www.turbosquid.com. We obtained a custom license from TurboSquid.
+• Redwood 3DScan Dataset [127]: https://github.com/isl-org/ redwood-3dscan (Public Domain)
+• Pix3D [128]: https://github.com/xingyuansun/pix3d. (Creative Commons Attribution 4.0 International License).
+(b) Did you mention the license of the assets? [Yes] In App. E.8, we mention the licenses of the codes and other assets we are using.
+(c) Did you include any new assets either in the supplemental material or as a URL? [No]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] We are primarily using the publicly available ShapeNet [104] dataset, which has been widely used in the generative modeling literature as standard benchmark. It only consists of simple 3D models of shapes such as airplanes, chairs, cars, etc.
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/tZXaHWfsXB/tZXaHWfsXB.md b/md/dev/tZXaHWfsXB/tZXaHWfsXB.md
new file mode 100644
index 0000000000000000000000000000000000000000..5e33bc2b3a67355ba92d0ccf6b807a0190d6d264
--- /dev/null
+++ b/md/dev/tZXaHWfsXB/tZXaHWfsXB.md
@@ -0,0 +1,376 @@
+# Transcending Scaling Laws with $0 . 1 \%$ Extra Compute
+
+Yi Tay† Jason Wei† Hyung Won Chung† Vinh Q. Tran David R. $\mathbf { S _ { 0 } } _ { } ^ { \dagger }$ Siamak Shakeri Xavier Garcia Huaixiu Steven Zheng Jinfeng Rao† Aakanksha Chowdhery Denny Zhou Donald Metzler Slav Petrov Neil Houlsby Quoc V. Le Mostafa Dehghani Google {vqtran,dehghani}@google.com
+
+# Abstract
+
+Scaling language models improves performance but comes with significant computational costs. This paper proposes UL2R, a method that substantially improves existing language models and their scaling curves with a relatively tiny amount of extra compute. The key idea is to continue training a state-of-theart large language model on a few more steps with UL2’s mixture-of-denoiser objective. We show that, with almost negligible extra computational costs and no new sources of data, we are able to substantially improve the scaling properties of large language models on downstream metrics. In this paper, we continue training a baseline language model, PaLM, with UL2R, introducing a new set of models at 8B, 62B, and 540B scale which we call UPaLM. Impressively, at 540B scale, we show an approximately 2x computational savings rate where U-PaLM achieves the same performance as the final PaLM 540B model at around half its computational budget (i.e., saving ${ \sim } 4 . 4$ million TPUv4 hours). We further show that this improved scaling curve leads to “emergent abilities” on challenging BIG-Bench tasks—for instance, U-PaLM does much better on some tasks or demonstrates better quality at much smaller scale (62B as opposed to 540B). Overall, we show that U-PaLM outperforms PaLM on many few-shot setups, including reasoning tasks with chain-of-thought (e.g., GSM8K), multilingual tasks (MGSM, TydiQA), MMLU and challenging BIG-Bench tasks.
+
+# 1 Introduction
+
+There has been significant interest in scaling of language models [Rae et al., 2021, Chowdhery et al., 2022, Brown et al., 2020]. Scaling has inspired new research across multiple fronts, e.g., scaling laws [Kaplan et al., 2020, Hoffmann et al., 2022, Tay et al., 2022a], emergent abilities [Wei et al., 2022a, Ganguli et al., 2022], reasoning capabilities [Wei et al., 2022b, Lewkowycz et al., 2022], inter alia. Generally, scaling laws predict a continued improvement in language model quality as we continue to scale up the computational budget (e.g., bigger models or more data). To date, most large language models that form the basis of scaling law research are trained almost exclusively as left-to-right causal language models [Kaplan et al., 2020, Hoffmann et al., 2022].
+
+
+Figure 1: Compute (training flops) versus Quality (average of $^ { 2 0 + }$ NLP zero and few-shot tasks listed in Appendix 11.2). The black dotted line shows the path from initialization from a PaLM checkpoint and training further with UL2R.
+
+This paper proposes a new method to dramatically improve the scaling curves of large language models on downstream performance with a relatively tiny amount of additional computation cost. The key idea is to continue training an existing causal language model [Chowdhery et al., 2022] with a mixture of new objectives—specifically, the UL2 training objective mixture [Tay et al., 2022b]. This restoration is expected to only cost roughly $0 . 1 \%$ to $1 \%$ of the original training FLOPs and requires no new data sources, making it highly efficient and convenient. We call this approach UL2R or UL2Restore.
+
+The UL2 objective combines prefix language modeling and long-short span corruption (e.g., infilling) tasks [Raffel et al., 2019] that can be controlled at inference time using a mode switching prompt. Training a large language model with UL2 can be interpreted as teaching it to leverage bidirectional attention (i.e., PrefixLM) or leverage infilling-style pretraining that have been the foundation of language understanding (e.g., T5 [Raffel et al., 2019]). To this end, we postulate that imbuing a state-of-theart large language model such as PaLM [Chowdhery et al., 2022] with these diverse pretraining schemes as a complement to the original language model objective, enables the model to perform significantly better. Moreover, the UL2 objective enables new prompting capabilities in PaLM which allows it to perform infilling based prompting.
+
+We show that adapting PaLM with UL2R not only results in significantly better scaling laws on well-established few-shot NLP tasks, but also, in our scaling experiments on downstream few-shot tasks, we show that UL2R is two times more efficient (computation savings of approximately 2x) at 540B scale - reaching the performance of the final PaLM 540B model with only half the computation, saving up to 4.4 million TPUv4 hours.
+
+In addition to competitive performance across a range of well-established NLP [Wang et al., 2019], multilingual [Clark et al., 2020a, Shi et al., 2022], and reasoning [Cobbe et al., 2021] benchmarks, we also study the impact of UL2R on a suite of challenging BigBench tasks from Wei et al. [2022a]. Notably, a subset of tasks are described as ‘emergent‘ because PaLM’s performance remains flat up to model scale of 62B and only becomes better than non-random at 540B scale. On these set of tasks, we find that UL2R enables (1) doing significantly better at tasks that PaLM struggles at (e.g., navigate, geometric shapes, hyperbaton) and (2) elicits emergent behavior at a smaller scale such as 62B or 8B (e.g., crass ai, vitaminc fact verification). On top of that, U-PaLM strongly outperforms PaLM on some challenging BigBench tasks.
+
+Emergence within the context of large language models is a nascent research area. As the Nobel prize-winning physicist Philip Anderson put it, ‘More is different.‘ [Anderson, 1972] which describes unpredictable phenomena at different scales. In our context and with mixture-of-denoisers in UL2, we would like to think of this phenomena as ‘More is different, but different can also more’ since different pretraining objectives can improve language model quality or elicit new emergent abilities. This work shows that diversity and richer training paradigms can be key to learning new capabilities that were previously hard to acquire with only causal language modeling.
+
+Finally, in addition to emergent task performance and overall improved scaling curves, we show that U-PaLM is also practically more useful since it is equipped with a secondary mode of prompting, i.e., bidirectional infilling. Specifically, UL2R enables a secondary capability for prompting U-PaLM which can be used to fill in more than one blanks in the input prompt. Interestingly, we find that only a small amount of UL2R (e.g., $0 . 1 \%$ tokens or FLOPs) is sufficient to imbue the model with this new capability.
+
+# 2 U-PaLM
+
+This section introduces the technical details of UPaLM (i.e., $\mathbf { P a L M + U L 2 R }$ ). U-PaLM is initialized from PaLM and leverages the same architecture. This section describes the training procedures of UL2R and how they are applied to continue training PaLM. We refer the reader to Section 10 in the Appendix for a comprehensive review of related work.
+
+# 2.1 Training Data
+
+To keep things consistent, we train this model with the same data mixture as PaLM and do not rely on additional sources of data (labeled or unlabeled).
+
+There are three main reasons for this choice. Firstly, we did not want to introduce new tokens to our training process which could conflate findings. Secondly, we did not want to over-index on scaling studies that only measure impact on upstream cross entropy [Hernandez et al., 2022] which claims that repeating data in small quantities could be dis-proportionally harmful. Since the empirical results we obtained are strong, we postulate that repeating tokens could perhaps be not harmful at smaller quantities after all. This is also backed by the continued training of PaLM 62B in [Chowdhery et al., 2022] which showed that repeated data could result in small gains, albeit not as strong as fresh tokens. Thirdly, we consider our data transformation (via UL2) on the training data sufficiently unique and therefore prevents us from explicitly training on the same data with the exact objective or suffering from any memorization issues.
+
+# 2.2 Prefix Language Model Architecture
+
+We train U-PaLM using the prefix language model (PrefixLM) architecture, also sometimes known as a non-causal decoder-only model. The PrefixLM architecture keeps a non-causal mask in its prefix (or inputs) and applies bidirectional attention to input tokens.
+
+In this architecture, we use a total combined sequence length of 2048 (e.g., PaLM’s sequence length) which is then split to 1024 inputs and 1024 targets. In the original UL2 paper and infrastructure, an artifact of its preprocessing pipeline applies padding tokens first before combining inputs and targets. For decoder-only language models, this is inefficient since we would end up with a concatenation of [prefix] [prefix’s padding] [target].
+
+In this work, we optimize the Prefix padding by forcing the model to concatenate prefix and target before applying any additional padding. Packing, trimming and padding is then subsequently applied later after the prefix has been concatenated with the targets. Through this prefix optimization, we are able to improve example-level sample efficiency of the model.
+
+# 2.3 Loss Objectives
+
+This section describes the setting for the UL2 mixture-of-denoisers that we use in UL2R. The UL2 mixture-of-denoiser objective comprises of three types of denoisers.
+
+• Regular denoising whereby the noise is sampled as spans, replaced with sentinel tokens. This is also the standard span corruption task used in Raffel et al. [2019]. Spans are typically uniformly sampled with a mean of 3 and a corruption rate of $1 5 \%$ .
+
+• Extreme denoising whereby the noise is increased to relatively ‘extreme‘ amounts in either a huge percentage of the original text or being very long in nature. Spans are typically uniformly sampled with a mean length of $\mathbf { 3 2 0 R }$ a corruption rate of up to $5 0 \%$ .
+
+• Sequential denoising whereby the noise is always sampled from the start of the text to a randomly sampled point in the text. This is also known as the PrefixLM objective (not to be confused with the architecture).
+
+We kept this simple since many ablations were already explored in Tay et al. [2022b]. We kept the original 7 denoisers as the initial version but later found that a mixture of only three tasks, e.g., $5 0 \%$ PrefixLM, $2 5 \%$ Long (extreme) span corruption, and $2 5 \%$ regular span corruption to be quite simple and efficient for the setup of continued training. We kept the original mode prompting tokens in the original UL2 design. We used [S2S] for S-denoisers (PrefixLM), [NLU] for R-denosiers and [NLG] for X-denoisers. The 540B U-PaLM model was mainly trained with $50 \%$ S-denoiser (PrefixLM), $25 \%$ R-denoisers, and $2 5 \%$ X-denoisers.
+
+# 2.4 Training
+
+We train the 540B model for a total of $2 0 \mathrm { k }$ steps with a batch size of 32. We mildly ablate these settings in early experiments with 62B and 8B models but keep them capped within a certain ballpark (e.g., 128 batch size for 50k steps). As a result, this is more similar to ‘finetuning’ as compared to full pretraining. The number of additional tokens is therefore very negligible compared to the original pretraining run often coming in at around or less than $0 . 1 \%$ additional compute. The total number of extra tokens we train on for the 540B model is approximately 1.3 billion which constitutes $0 . 1 6 \%$ extra computation, as the original PaLM model was pretrained on 780B tokens. We use a cosine learning rate decay schedule that anneals the learning rate from $1 0 ^ { - 4 }$ to $1 0 ^ { - 6 }$ . Notably, we also tried a low constant learning rate and found them to perform quite identically. Our U-PaLM 8B and 62B models are trained using 64 TPUv4 chips. Training an U-PaLM 540B model only consumes 512 TPUv4 chips and finishes in about 5 days which is considered to be lightweight.
+
+# 3 Experiments
+
+# 3.1 Improved Scaling Properties on Few-shot Learning
+
+In this experiment, we show improved scaling curves from small amounts of UL2R training on top of both PaLM 8B and PaLM 540B. We use downstream metrics and few-shot evaluation since (1) this is closer to usability of these models and (2) loss with UL2 and causal language modeling is not comparable. We initialized and trained multiple U-PaLM models using different PaLM intermediate checkpoints. On the 8B model, we repeated this 7 times at different intervals. Given that the 540B model was more computationally demanding, we only managed to fit 3 points. For evaluation, we use the average score of NLU and NLG tasks from the GPT-3 suite [Brown et al., 2020]. In total we use 26 tasks (e.g., TriviaQA, NaturalQuestions, SuperGLUE, PIQA, OpenbookQA, ANLI etc). Detailed scores for Figure 2 can be found in the Appendix.
+
+
+Figure 2: Computation cost (training flops) [Dehghani et al., 2021] versus Quality (average of $2 0 { + } \mathrm { N L P }$ zero and few-shot tasks). The dotted line shows the path from initialization from a PaLM checkpoint and training further with UL2R. These plots also present pairs of PaLM and U-PaLM models with comparable/similar performance along with the ratio of PaLM computation cost vs the corresponding U-PaLM computation cost. For example, PaLM 540B trained for $\sim 2 5 0 0$ zFLOPs (right most point) took $\sim 2 . 3 5$ times of the computation cost of U-PaLM 540B trained for $\sim 1 0 7 5$ zFLOPs, while both models are comparable in terms of performance on zero/few shot on NLP tasks.
+
+
+Figure 3: Break down scores of individual zero-shot and one-shot NLP tasks for PaLM and U-PaLM 540B trained for 780B tokens. U-PaLM outperforms PaLM 540B and achieves SOTA on 21 out of 26 tasks.
+
+Figure 2 shows that U-PaLM substantially outperforms the original PaLM models both at 8B scale and 540B scale. Note that the dotted lines represent a pathway before and after UL2R training, we show that UL2R training improves the scaling curve of PaLM substantially, i.e., UL2R provides a more compute-efficient performance improvement compared to training the original PaLM models for longer with the standard causal language modeling objective.
+
+8B versus 540B Generally, UL2R consistently improves the underlying PaLM models. Nevertheless, we observe different behaviors on the 8B and 540B models. The gap seems to narrow as the performance of PaLM 8B starts to plateau, i.e., the largest gains are near to the middle of training. As for 540B, the gain continues to grow even at 780B tokens. We believe that this is due to the fact that PaLM 540B still has significant headroom beyond 780B tokens.
+
+Savings Rate At a certain stage of training, we have an option to continue training for K more steps using the standard causal language modeling objective OR applying UL2R for a small amount of steps. Here we discuss the counterfactual savings rate of choosing UL2R as opposed to continue training with caussal language modeling. For the 540B model, the saving rates at the middle checkpoint is approximately $2 \mathbf { x }$ . This is equivalent to about 4.4 million TPUv4 hours for the 540B model. For the 8B model, the saving rate tend to be lowest at both the start and convergence of the model. It seems to be higher at middle stages of training (relative to convergence) which shows that the utility of UL2R changes with respect to the amount of causal language modeling training already done. For the 540B model, since the PaLM model was not trained to convergence and the number of tokens to parameters ratio is relatively low, the savings rate could still be increasing even beyond $2 . 3 5 \mathrm { x }$ . Overall, the amount of savings is quite proportionate to the point of training and stage of convergence of the model and can probably be predicted by standard scaling laws [Kaplan et al., 2020, Hoffmann et al., 2022].
+
+Table 1: List of challenging tasks in the BigBench emergent suite (BBES) and corresponding scores of PaLM 540B and U-PaLM 540B. All results are reported with standard 5-shot prompting.
+
+
task
task /reasoning type
PaLM540B
U-PaLM540B
navigate
arithmetic,logical
55.3
67.0 (+21.2%)
strategyqa
multi-step
73.9
78.3 (+6.0%)
crass_ai
commonsense
97.7
100 (+2.4%)
logical_sequence
commonsense
92.3
86.5 (-6.7%)
vitaminc_fact_verification
contextual, commonsense
70.2
73.9 (+5.3%)
understanding_fables
commonsense
75.7
78.4 (+3.6%)
identify_odd_metaphor
analogical
87.2
87.5 (+0.3%)
hyperbaton
contextual QA
54.2
59.9 (+10.5%)
causal_judgment
causal and commonsense
65.3
68.4 (+4.7 %)
english_proverbs
commonsense,contextual QA
91.2
87.5 (-4.2%)
geometric_shapes
algorithmic,visual
44.0
49.3 (+12.0%)
physics_questions
logical, physics,math
7.6
12.5 (+64.5%)
snarks
commmonsense
69.1
86.1 (+24.6%)
analogical_similarity
analogical
36.5
37.5 (+2.7%)
international_phonetic_alphabet_nli
reading comprehension
65.9
68.0 (+3.2%)
movie_dialog_same_or_different
commonsense,reading compre.
64.8
68.8 (+6.2%)
timedial
commonsense,logical
78.3
81.2 (+3.7%)
question_selection
reading comprehension
54.8
59.8 (+9.1%)
logical_fallacy_detection
logical reasoning
80.3
81.4 (+1.4%)
unit_interpretation
arithmetic,logical
47.0
51.0 (+8.5%)
language_identification
multilingual
36.0
38.9 (+8.1%)
average (21 tasks)
64.3
67.7 (+5.3%)
+
+
+Figure 4: Scaling plots on BIG-Bench emergent suite (BBES) for different sizes of PaLM, U-PaLM, Gopher, and GPT-3 as a function of training FLOPs. Scores are normalized scores where zero denotes more or less random performance. X-axis is in log-scale.
+
+Breakdown on individual tasks Figure 3 reports the individual scores on each zero and one-shot task in the mixture. We show that U-PaLM 540B outperforms PaLM 540B on 21 out of 26 tasks. Given that PaLM is the SOTA language model on these tasks, this makes U-PaLM the new state-of-the-art on these tasks.
+
+# 3.2 BigBench Emergent Suite
+
+We select a suite of challenging tasks from BigBench based on a criterion that performance on PaLM on these tasks remain relatively flat-lined at 8B and 62B scale but suddenly unlocks at 540B. We also consider tasks that are difficult for PaLM 540B to solve (near random performance). We call these suite of tasks EMERGENT suite of BigBench tasks (BBES) as inspired by the criterion set by Wei et al. [2022a]. Note that while these set of tasks overlap but are not entirely identical to BBH [Suzgun et al., 2022]. Moreover, BBES uses the default prompting and templates as BIG-Bench and do not use chain-of-thought prompting. Hence, they are not entirely comparable. BBH results can be found later in section 11.1.3.
+
+Table 2: Results on finetuning on SuperGLUE and TydiQA dev sets.
+
+
PaLM 8B
U-PaLM8B
PaLM 62B
U-PaLM 62B
SuperGLUE (Avg)
83.4
86.1(+3.2%)
89.5
91.4 (+2.1%)
TydiQA (EM/F1)
75.7/85.2
77.5 (+2.3%)/86.7(+1.7%)
78.3/87.3
78.4 (+0.1%)/88.5 (+2.1%)
+
+Table 3: Results on Massively Multi-Task Language Understanding (MMLU) test set.
+
+
Method
Accuracy
Random
25.0%
Average Human Rater
34.5%
GPT-3 5-shot
43.9%
Gopher 5-shot
60.0%
Chinchilla 5-shot
67.6%
PaLM540B 5shot U-PaLM540B 5-shot
69.3 % 70.7 % (+2.0%)
+
+# 3.2.1 BIG-Bench Results
+
+Table 1 reports the results of PaLM 540B and U-PaLM 540B on the BigBench emergent suite. We also describe the task and reasoning task for each task. Note that some tasks require a conjunction of various ‘skills’ to excel at. For example, the navigate task is a combination of spatial reasoning and arithmetic (counting).
+
+Overall results and Scaling Plots We observe that U-PaLM outperforms PaLM on 19 out of the 21 tasks at 540B scale. Moreover, the gains on certain tasks are substantial (e.g., $5 5 . 3 \% \to 6 7 . 0 \%$ ) on navigate and $6 9 . 1 \% \to 8 6 . 1 \%$ on snarks). On average, there is a $+ 5 . 4 \%$ relative quality gain on the un-normalized aggregated average across all 21 tasks which we consider to be pretty strong results. Figure 4 which shows the scaling plots of U-PaLM relative to other models. Whenever possible, we also include baselines such as GPT-3 or Gopher from the official BIG-Bench repository.
+
+UL2R unlocks emergent task performance at smaller scales Scale (e.g., scaling to 540B) is known to be one factor that results in emergent task performance [Wei et al., 2022a]. We show that UL2R is able to elicit emergent abilities at smaller scales. For example, the quality on certain tasks such as crass_ai, vitaminc, identify_odd_metaphors are tasks where performance starts to spike at 62B scale (as opposed to only at 540B with the PaLM model. In rarer occasions, the performance of U-PaLM 8B is even higher than PaLM 62B (e.g., snarks, understanding_fables). Overall, these results show that there are strong evidence that inductive bias (e.g., combinations of prefix language modeling, span corruption based pretraining in UL2) could be crucial when it comes to unraveling new abilities in large language models.
+
+# 3.2.2 MMLU Results
+
+We compare PaLM and U-PaLM on the Massively Multi-Task Language Understanding (MMLU) benchmark [Hendrycks et al., 2020]. Table 3 reports our results on MMLU’s test set. Prior results are reported from [Hoffmann et al., 2022]. Our results show that U-PaLM outperforms PaLM on this task in the 5-shot setup by $2 . 0 \%$ relative gain.
+
+# 3.3 Finetuning
+
+We conduct experiments on SuperGLUE [Wang et al., 2019] and TydiQA [Clark et al., 2020a] finetuning. We conduct experiments at 8B and 62B scale1. Fine-tuning is conducted with a constant learning rate for $1 0 0 k$ steps with a batch size of 32. Table 2 reports finetuning results. We observe that there is substantial improvement in fine-tuning especially at the 8B scale. The gains diminish slightly at 62B scale but are still modest in general. We note that PaLM’s fine-tuning performance can be generally considered weaker than expected. For instance, PaLM 8B is generally outperformed by a T5.1.1 large model on the SuperGLUE dev average. We postulate that training PaLM on UL2 and span corruption tasks in complement to causal language modeling can ameliorate some of its flaws. Our results ascertains this by showing that U-PaLM strongly improves quality especially at smaller (8B) scales.
+
+
+Figure 5: An example of a prompt that is improved by rephrasing to use U-PaLM’s infilling capabilities.
+
+# 3.4 Additional Results & Analysis
+
+We conduct additional, extensive, evaluation and analysis of our approach. Due to space constraints we refer the reader to Section 11 in the Appendix. There we provide results for zero-shot and few-shot NLP tasks including commonsense reasoning, closed book QA & reading comprehension, reasoning & chain-of-thought, and few-shot multilingual tasks. We find that the improvements from U-PaLM over PaLM generally hold across these additional tasks, with major improvements on certain tasks such as GSM8K $( + 6 . 6 \% )$ [Cobbe et al., 2021], BIG-Bench Hard $( + 1 0 . 7 \% )$ [Suzgun et al., 2022], and MGSM $( + 8 . 7 \% )$ [Shi et al., 2022]. We also include analysis of BBES performance, scaling curves for few-shot experiments, and additional discussion of our methods.
+
+in. Notably, with U-PaLM it is possible to query both the infill style and the traditional style via the usage of extra ID tokens (as it is used in denoising) or without, respectively.
+
+In Figure 5, we include example outputs for PaLM, U-PaLM with traditional prompting, as well as U-PaLM with infill prompting. We phrase this particular prompt in two ways: one as a question that is suitable for traditional prompting via PaLM and one leveraging U-PaLM’s infill capabilities. In the traditional phrasing, both PaLM and U-PaLM do not produce the correct answer. With the infill phrasing, PaLM ignores the infill token (extra ID token) as PaLM has not seen it during training, and instead produces the rest of the steps after step 4. U-PaLM correctly infills the second step in this example. Finally, a third example is included to demonstrate U-PaLM’s ability to infill multiple slots. These examples demonstrate that, with only a small amount of additional training, we are able to expand the functionality of PaLM to serve an entirely new class of queries.
+
+# 4 Qualitative Analysis: New Prompting Capabilities
+
+# 4.1 Infilling Ability
+
+Left-to-right casual language model pretraining has typically allowed models to provide meaningful continuations of prompts. With U-PaLM we observe that, by extending pretraining with a small amount of UL2 denoising steps, the model is also able to pick up infilling abilities – where the model is given a location in the middle of a prompt to fill
+
+# 4.2 Leveraging Specific Pretraining Modes
+
+Recall that via the UL2 objective, R-, X-, and S-denoisers are associated with the [NLU], [NLG], and [S2S] mode tokens respectively. S-denoisers are essentially the PrefixLM objective, while R- and X-denoisers are variations of span corruption, and thus are also associated with extra ID tokens which we can use during prompting for infill (as shown above.) Given this unique setup, we can control the mode token during inference to gain access to specific knowledge that might have been acquired in one mode but not another. This effectively provides us with more options in how to answer prompts, without the need to make any changes to the learned model or its inference algorithm.
+
+
+Figure 6: An example of a prompt that works only when querying a specific pretraining mode.
+
+
+Figure 7: Querying U-PaLM for diverse outputs by using different prompt mode token and LM/infill combinations.
+
+In Figure 6, we include a challenging example where we ask the model to do zero-shot cross-lingual question answering from an English question into a Vietnamese answer. For PaLM and U-PaLM default, we pass the input as-is to the model. For the rest, we prepend one of [S2S], [NLU], or [NLG] to the beginning of the input, and in the case of [NLU] and [NLG], we add the infill token at the end of the input, as typical for these modes. Interestingly, U-PaLM in [S2S] mode is the only variant that returns the correct answer in Vietnamese. Regular PaLM produces the correct answer, but ignores the Vietnamese request, while U-PaLM with default prompting (no mode, no infill) produces a roughly correct answer but could be more specific (’xanh’ encompasses both greens and blues). This example shows how accessing specific mode tokens may work well for some prompts more so than others, giving us a powerful technique to serve a larger variety of prompts.
+
+Even though [NLU] and [NLG] modes typically coincide during pretraining with span corruption (involving extra ID tokens, infilling), we can still use [NLU] and [NLG] mode tokens with no infilling at all. Similarly we can use infilling but with no mode tokens. The variety of ways to prompt U-PaLM results in a useful technique to increase the diversity of the outputs we can get from the model, without resorting to alternative decoding techniques (e.g. sampling). This is particularly useful for more open-ended prompts.
+
+In Figure 7, we ask PaLM and all variants of querying U-PaLM to write a haiku about "a cat baking a cake on a lake" - a very random prompt that the model is unlikely to see during training, yet requires very structured output. All outputs use greedy decoding here, and surprisingly all models generate reasonable haikus about the topic, although not all follow a strict 5-7-5 syllable structure. PaLM’s haiku repeats the first and last line, which is somewhat less interesting. We can see that the different combinations of querying U-PaLM results in pleasantly varying poems.
+
+# 4.3 Improved Diversity for Open-ended Generation
+
+Beyond improving the scaling behavior of PaLM, we find that the small amount of continued training applied in UL2R is sufficient to imbue PaLM with new prompting abilities introduced by the UL2 objective. Namely, the use of denoising in UL2 allows PaLM to acquire infilling abilities. Infilling allows U-PaLM to have a second approach to tackling prompts, which we observe to be very useful. In addition, with U-PaLM we can also supply mode tokens to gain access to specific pretraining objectives. This gives us a powerful tool to control the model without making any updates to the model or its inference. In this section we provide some examples of situations where U-PaLM’s expanded prompting capabilities prove to be useful.
+
+# 8 Acknowledgements
+
+We thank Le Hou and Oliver Bousquet for their advice and feedback on the paper. We thank Barret Zoph and William Fedus for early discussions about this paper. We thank Adam Roberts for feedback on prior work.
+
+# 5 Conclusion
+
+We proposed UL2R for continued training of PaLM. We show that with only ${ \approx } 0 . 1 \%$ additional FLOPs (or compute), we are able to improve the scaling curve and properties of PaLM on many downstream tasks and metrics. Notably, UL2R enables a 4.4 million TPUv4 savings at 540B scale. The resulting model which we call U-PaLM outperforms PaLM on English NLP tasks (e.g., commonsense reasoning and closed-book question answering), reasoning tasks with chain-of-thought, multilingual reasoning, MMLU and a suite of challenging BIG-Bench tasks.
+
+# 6 Limitations
+
+In this work we show the effectiveness of continued training of a 540B PaLM model with UL2R over conditional language modeling alone. We only demonstrate this for the PaLM model and pretraining corpus. Our study is only a demonstration of what is possible with an example near state-of-the-art system, and we do not provide results on what would happen if the underlying model and pretraining corpus were to differ from the one studied here. For example, what would happen if we applied ULR2 to a model that was trained to saturation on a corpus already? Would we observe similar improvements? What would happen if we use a weaker underlying model? This paper also only studies models with $^ { 8 \mathrm { B + } }$ parameters, and does not provide insight on how UL2R would perform on smaller models and compute regions. We leave these investigations for future work, and this work should not be interpreted as a comprehensive study of continued pretraining or model reuse.
+
+# References
+
+Armen Aghajanyan, Anchit Gupta, Akshat Shrivastava, Xilun Chen, Luke Zettlemoyer, and Sonal Gupta. Muppet: Massive multi-task representations with prefinetuning. arXiv preprint arXiv:2101.11038, 2021.
+
+Philip W Anderson. More is different: broken symmetry and the nature of the hierarchical structure of science. Science, 177(4047):393–396, 1972.
+
+Vamsi Aribandi, Yi Tay, Tal Schuster, Jinfeng Rao, Huaixiu Steven Zheng, Sanket Vaibhav Mehta, Honglei Zhuang, Vinh Q. Tran, Dara Bahri, Jianmo Ni, Jai Prakash Gupta, Kai Hui, Sebastian Ruder, and Donald Metzler. Ext5: Towards extreme multi-task scaling for transfer learning. ICLR, 2022. URL https://arxiv.org/abs/2111.10952.
+
+Yonatan Bisk, Rowan Zellers, Jianfeng Gao, Yejin Choi, et al. Piqa: Reasoning about physical commonsense in natural language. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pages 7432–7439, 2020.
+
+Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
+
+Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
+
+Hyung Won Chung, Longpre Shayne Hou, Le and, Barret Zoph, Yi Tay, William Fedus, and et al. Scaling instruction-finetuned language models. arXiv preprint, 2022.
+
+# 7 Ethics Statement
+
+As this work continues training PaLM, we defer discussion of ethical considerations with respect to large language models to the original PaLM paper [Chowdhery et al., 2022]. We do note though that this work presents a way of improving large language models without training from scratch, and all the different types of cost (e.g. environmental) that that might entail.
+
+Christopher Clark, Kenton Lee, Ming-Wei Chang, Tom Kwiatkowski, Michael Collins, and Kristina Toutanova. Boolq: Exploring the surprising difficulty of natural yes/no questions. In NAACL, 2019.
+
+Jonathan H Clark, Eunsol Choi, Michael Collins, Dan Garrette, Tom Kwiatkowski, Vitaly Nikolaev, and Jennimaria Palomaki. Tydi qa: A benchmark for information-seeking question answering in typologically diverse languages. Transactions of the Association for Computational Linguistics, 8: 454–470, 2020a.
+
+Kevin Clark, Minh-Thang Luong, Quoc V Le, and Christopher D Manning. Electra: Pre-training text encoders as discriminators rather than generators. arXiv preprint arXiv:2003.10555, 2020b.
+
+Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.
+
+Mostafa Dehghani, Yi Tay, Anurag Arnab, Lucas Beyer, and Ashish Vaswani. The efficiency misnomer. In International Conference on Learning Representations, 2021.
+
+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.
+
+Andrew Drozdov, Nathanael Schärli, Ekin Akyürek, Nathan Scales, Xinying Song, Xinyun Chen, Olivier Bousquet, and Denny Zhou. Compositional semantic parsing with large language models. arXiv preprint arXiv:2209.15003, 2022.
+
+Deep Ganguli, Danny Hernandez, Liane Lovitt, Nova DasSarma, Tom Henighan, Andy Jones, Nicholas Joseph, Jackson Kernion, Ben Mann, Amanda Askell, et al. Predictability and surprise in large generative models. arXiv preprint arXiv:2202.07785, 2022. URL https://arxiv.org/abs/2202.07785.
+
+Mor Geva, Daniel Khashabi, Elad Segal, Tushar Khot, Dan Roth, and Jonathan Berant. Did aristotle use a laptop? a question answering benchmark with implicit reasoning strategies. Transactions of the Association for Computational Linguistics, 9: 346–361, 2021.
+
+Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. arXiv preprint arXiv:2009.03300, 2020.
+
+Danny Hernandez, Tom Brown, Tom Conerly, Nova DasSarma, Dawn Drain, Sheer El-Showk, Nelson Elhage, Zac Hatfield-Dodds, Tom Henighan, Tristan Hume, et al. Scaling laws and interpretability of learning from repeated data. arXiv preprint arXiv:2205.10487, 2022.
+
+Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, et al. Training computeoptimal large language models. arXiv preprint arXiv:2203.15556, 2022.
+
+Mandar Joshi, Eunsol Choi, Daniel S Weld, and Luke Zettlemoyer. Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension. arXiv preprint arXiv:1705.03551, 2017.
+
+Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
+
+Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Matthew Kelcey, Jacob Devlin, Kenton Lee, Kristina N. Toutanova, Llion Jones, Ming-Wei Chang, Andrew Dai, Jakob Uszkoreit, Quoc Le, and Slav Petrov. Natural questions: a benchmark for question answering research. Transactions of the Association of Computational Linguistics, 2019.
+
+Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. arXiv preprint arXiv:2104.08691, 2021.
+
+Aitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, et al. Solving quantitative reasoning problems with language models. arXiv preprint arXiv:2206.14858, 2022.
+
+Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. arXiv preprint arXiv:2203.02155, 2022. URL https://arxiv.org/abs/2203.02155.
+
+Denis Paperno, Germ’an Kruszewski, Angeliki Lazaridou, Ngoc Quan Pham, Raffaella Bernardi, Sandro Pezzelle, Marco Baroni, Gemma Boleda, and Raquel Fern’andez. The LAMBADA dataset: Word prediction requiring a broad discourse context. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1525–1534, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1144. URL https://www.aclweb.org/anthology/P16-1144.
+
+Jack W Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, Francis Song, John Aslanides, Sarah Henderson, Roman Ring, Susannah Young, et al. Scaling language models: Methods, analysis & insights from training gopher. arXiv preprint arXiv:2112.11446, 2021.
+
+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. arXiv preprint arXiv:1910.10683, 2019.
+
+Adam Roberts, Colin Raffel, and Noam Shazeer. How much knowledge can you pack into the parameters of a language model? arXiv preprint arXiv:2002.08910, 2020.
+
+Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. Winogrande: An adversarial winograd schema challenge at scale. arXiv preprint arXiv:1907.10641, 2019.
+
+Victor Sanh, Albert Webson, Colin Raffel, Stephen Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, et al. Multitask prompted training enables zero-shot task generalization. ICLR, 2022. URL https: //openreview.net/forum?id=9Vrb9D0WI4.
+
+Freda Shi, Mirac Suzgun, Markus Freitag, Xuezhi Wang, Suraj Srivats, Soroush Vosoughi, Hyung Won Chung, Yi Tay, Sebastian Ruder, Denny Zhou, et al. Language models are multilingual chain-of-thought reasoners. arXiv preprint arXiv:2210.03057, 2022.
+
+Aarohi Srivastava, Abhinav Rastogi, Abhishek Rao, Abu Awal Md Shoeb, Abubakar Abid, Adam Fisch, Adam R Brown, Adam Santoro, Aditya Gupta, Adrià Garriga-Alonso, et al. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models. arXiv preprint arXiv:2206.04615, 2022.
+
+Jacob Steinhardt. Future ml systems will be qualitatively different, 2022. Accessed May 20, 2022.
+
+Mirac Suzgun, Nathan Scales, Nathanael Scharli, Sebastian Gehrmann, Yi Tay, Hyung Won Chung, Aakanksha Chowdhery, Quoc V. Le, Ed H. Chi, Denny Zhou, and Jason Wei. Challenging big-bench tasks and whether chain-of-thought can solve them. arXiv preprint, 2022.
+
+Alon Talmor, Jonathan Herzig, Nicholas Lourie, and Jonathan Berant. CommonsenseQA: A question answering challenge targeting commonsense knowledge. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4149–4158, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1421. URL https://aclanthology.org/N19-1421.
+
+Yi Tay, Mostafa Dehghani, Jinfeng Rao, William Fedus, Samira Abnar, Hyung Won Chung, Sharan Narang, Dani Yogatama, Ashish Vaswani, and Donald Metzler. Scale efficiently: Insights from pre-training and fine-tuning transformers. arXiv preprint arXiv:2109.10686, 2021.
+
+Yi Tay, Mostafa Dehghani, Samira Abnar, Hyung Won Chung, William Fedus, Jinfeng Rao, Sharan Narang, Vinh Q Tran, Dani Yogatama, and Donald Metzler. Scaling laws vs model architectures: How does inductive bias influence scaling? arXiv preprint arXiv:2207.10551, 2022a.
+
+Yi Tay, Mostafa Dehghani, Vinh Q Tran, Xavier Garcia, Dara Bahri, Tal Schuster, Huaixiu Steven
+
+Zheng, Neil Houlsby, and Donald Metzler. Unifying language learning paradigms. arXiv preprint arXiv:2205.05131, 2022b.
+
+Yi Tay, Vinh Q Tran, Mostafa Dehghani, Jianmo Ni, Dara Bahri, Harsh Mehta, Zhen Qin, Kai Hui, Zhe Zhao, Jai Gupta, et al. Transformer memory as a differentiable search index. arXiv preprint arXiv:2202.06991, 2022c.
+
+Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, Heng-Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, et al. Lamda: Language models for dialog applications. arXiv preprint arXiv:2201.08239, 2022.
+
+Alex Wang, Yada Pruksachatkun, Nikita Nangia, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. Superglue: A stickier benchmark for general-purpose language understanding systems. arXiv preprint arXiv:1905.00537, 2019.
+
+Thomas Wang, Adam Roberts, Daniel Hesslow, Teven Le Scao, Hyung Won Chung, Iz Beltagy, Julien Launay, and Colin Raffel. What language model architecture and pretraining objective work best for zero-shot generalization? arXiv preprint arXiv:2204.05832, 2022a.
+
+Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022b.
+
+Jason Wei, Maarten Bosma, Vincent Y Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M Dai, and Quoc V Le. Finetuned language models are zero-shot learners. arXiv preprint arXiv:2109.01652, 2021.
+
+Jason Wei, Yi Tay, Rishi Bommasani, Colin Raffel, Barret Zoph, Sebastian Borgeaud, Dani Yogatama, Maarten Bosma, Denny Zhou, Donald Metzler, et al. Emergent abilities of large language models. Transactions on Machine Learning Research (TMLR), 2022a.
+
+Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. Conference on Neural Information Processing Systems (NeurIPS), 2022b.
+
+Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. Advances in neural information processing systems, 32, 2019.
+
+Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, et al. Scaling autoregressive models for contentrich text-to-image generation. arXiv preprint arXiv:2206.10789, 2022.
+
+Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. Hellaswag: Can a machine really finish your sentence? arXiv preprint arXiv:1905.07830, 2019.
+
+Denny Zhou, Nathanael Schärli, Le Hou, Jason Wei, Nathan Scales, Xuezhi Wang, Dale Schuurmans, Olivier Bousquet, Quoc Le, and Ed Chi. Least-tomost prompting enables complex reasoning in large language models. arXiv preprint arXiv:2205.10625, 2022.
+
+Barret Zoph, Irwan Bello, Sameer Kumar, Nan Du, Yanping Huang, Jeff Dean, Noam Shazeer, and William Fedus. St-moe: Designing stable and transferable sparse expert models, 2022. URL https://arxiv.org/abs/2202.08906.
+
+# 9 Appendix
+
+# 10 Related Work
+
+Large language models Scaling and improving large language models is one of the most impactful research areas in modern artificial intelligence [Chowdhery et al., 2022]. To this end, large language models not only continue to improve as we scale in terms of data or computational budget [Hoffmann et al., 2022, Kaplan et al., 2020] but also acquire new abilities [Wei et al., 2022a]. The impact of large language models has been ubiquitous and pervasive, unlocking breakthroughs across many fields, e.g., reasoning [Wei et al., 2022b, Wang et al., 2022b, Zhou et al., 2022, Drozdov et al., 2022], math [Lewkowycz et al., 2022], dialog [Thoppilan et al., 2022], multimodal applications [Yu et al., 2022], retrieval [Tay et al., 2022c] inter alia.
+
+While there have been many paradigms and self-supervision methods proposed to train these models [Devlin et al., 2018, Clark et al., 2020b, Yang et al., 2019, Raffel et al., 2019], to this date most large language models (i.e., more than 100B parameters) are trained as decoder-only casual language models. For example, flagship large language models such as GPT-3 [Brown et al., 2020], Gopher [Rae et al., 2021] and PaLM [Chowdhery et al., 2022] are all trained as causal language models. Meanwhile, bidirectional models (e.g., BERT [Devlin et al., 2018], T5 [Raffel et al., 2019], ST-MoE [Zoph et al., 2022]) have also been very popular as the goto model of choice, especially in smaller computational regimes (e.g., less than 30B parameters and often times in the ranges of hundred of millions of parameters).
+
+Scaling laws of large language models Kaplan et al. [2020] investigated scaling laws of Transformer language models and first showed the scaling laws are predictive of future performance. The authors found that model size (and not shape) correlates strongly with model quality, i.e., upstream cross entropy. Tay et al. [2021] studied the scaling properties of encoder-decoder models and their impact on upstream and downstream finetuning tasks. Generally, Tay et al. [2021] found that upstream perplexity and downstream quality does not always correlate. As a follow up, Tay et al. [2022a] studied the scaling laws of different model architectures and found that inductive bias does significantly impact the scaling behavior of the model. Finally, Hoffmann et al. [2022] proposed compute-optimal models that popularized the ‘chinchilla’ scaling laws - an approach that aims to be predictive of the optimal amount of data given the number of model parameters. In this work, we mainly consider scaling laws over downstream performance largely because this is more reflective of a language model’s usability. Since downstream performance is more important than upstream cross entropy, we advocate for future scaling studies to always incorporate downstream evaluation (and metrics) as opposed to only using cross entropy loss.
+
+Emergent Abilities New behaviors that arise due to scaling language models have been increasingly referred to as emergent abilities [Steinhardt, 2022, Ganguli et al., 2022, Wei et al., 2022a]. For instance, Wei et al. [2022a] define emergent abilities as “abilities that are not present in smaller models but as present in larger models.” For a few-shot prompted task, this would look like a flat scaling curve (random performance) until a certain critical threshold, during which performance increases to substantially above random. This type of phenomena has been observed across dozens of tasks in the BIG-Bench benchmark [Srivastava et al., 2022]. Although such emergent abilities are typically observed as a function of scale, increasing model scale to induce emergent abilities is computationally expensive. In this paper we show how UL2R unlocks emergence without increasing the number of model parameters.
+
+Continued Training of Language Models The paradigm of continue to train (or finetune) a language model on more data or tasks is commonly known as adaptation. A range of prior work has shown that finetuning language models on a collection of NLP tasks can improve downstream performance on a broad range of downstream tasks [Aghajanyan et al., 2021, Aribandi et al., 2022, Wei et al., 2021, Sanh et al., 2022, Ouyang et al., 2022, inter alia]. The majority of this prior work, however, requires additional data such as aggregating dozens or hundreds of NLP datasets [Raffel et al., 2019, Aghajanyan et al., 2021, Aribandi et al., 2022], writing additional templates of instructions [Wei et al., 2021, Sanh et al., 2022], or finetuning on human-labeled annotations [Ouyang et al., 2022]. UL2R does not require new data since it simply re-uses the pre-training data, which makes it orthogonal to continued training methods that leverage large collections of NLP datasets. Adapting a pretrained language model with a new self-supervised objective has been explored. For example, a model trained with a language modeling objective can be adapted by further training with the masked language modeling objective [Wang et al., 2022a]. The other direction is also possible; a model trained with a masked language objective can be adapted with the causal language modeling objective [Wang et al., 2022a, Lester et al., 2021]. UL2R follows a similar idea but uptrains a language model with a set of diverse and new preordaining tasks from mixture-of-denoisers, even after a vast amounts of standard pretraining and demonstrates a very rapid improvement on variety of setups and tasks.
+
+Unified language learner (UL2) The UL2 [Tay et al., 2022b] model is a state-of-the-art model that bridges both generative causal language models and bidirectional language models. UL2 proposes a mixture-of-denoiser objective that mixes prefix (non-causal) language modeling and infilling (span corruption) within the same model and leverages mode prompts to switch between modes during downstream tasks. UL2 is architecture agnostic in which the authors argue that the choice of decoderonly versus encoder-decoder models is largely an efficiency trade-off. In [Tay et al., 2022b], the final UL2 model was trained as a 20B encoder-decoder model, which achieves very compelling performance on both finetuning and in-context learning.
+
+# 11 Additional Results & Analysis
+
+# 11.0.1 Analyzing individual task performance on BIG-Bench
+
+This section dives into individual task performance and attempts to understand quality on different types of BIG-Bench tasks.
+
+Spatial or Visual Reasoning Tasks The first category of tasks that U-PaLM does extremely well on are tasks that require some form of spatial or visual reasoning (e.g., navigate or geometric_shapes). In both of these tasks, U-PaLM 8B outperforms PaLM 540B. We postulate that this is due to the prefix language model architecture and additional PrefixLM training that U-PaLM undergoes. To give a better illustration, consider the following examples from these tasks.
+
+• In the navigate task, an example is as follows: ‘Turn right. Take 1 step. Turn right. Take 6 steps. Turn right. Take 1 step. Turn right. Take 2 steps. Take 4 steps.‘ and the task is a binary classification task that determines if the agent returns to the starting point.
+
+• In the geometric_shapes task, the goal is to predict the shape given an SVG path, e.g., given ‘M $3 I , 2 9 L 3 4 , 7 6 L 8 2 , I 6 L 3 I , 2 9 ^ { \circ }$ the model should predict triangle.
+
+Here, it is worth noting that both tasks can be improved intuitively by having bidirectional attention and being trained using a PrefixLM like objective. This could explain why U-PaLM could outperform PaLM 540B even at 8B because it was given the right inductive bias.
+
+Commonsense and Knowledge Tasks A reasonable portion out of the 21 tasks require some form of commonsense or language-based knowledge in order to do well. It is worth noting that U-PaLM does not train on any new unique tokens (or new data) and therefore, has no access to no new ‘knowledge’ compared to vanilla PaLM. Hence, gains here are expected to be milder compared to tasks that rely more on algorithmic or other types of reasoning. However, we observe some relatively smaller gains in certain tasks (e.g., understanding_fables or movie_dialog_same_or_different). Amongst the tasks in this category, one exception is the snarks task which involves detecting sarcasm in natural language. It is worth noting that the only 2 out of 21 tasks where U-PaLM underperforms PaLM belongs to this category (e.g., logical_sequence and english_proverbs). We think this is reasonable since we do not completely expect UL2R to always improve upon this category of tasks given that it does not actually process new data tokens.
+
+Context Reasoning or Reading Comprehension Tasks Some tasks require some understanding of context and then requires the language model to answer questions based on this context. An example of this is the vitaminc_fact_verficiation task which tries to determine the veracity of a claim given external evidence (context). Another example is the understanding_fables task where the goal is to determine the ‘morale of the story’ given context (passage or story). It is worth noting that U-PaLM exhibits emergence at 62B scale on these two tasks even though the final 540B model performance is relatively similar. We postulate that this is due to the architectural (and pretraining) advantage of PrefixLM which aids the model in performing much better even at smaller scales. Intuitively, being able to bidirectionally reason with context (prefix) could be important in context reasoning tasks.
+
+Table 4: Results on zero-shot commonsense reasoning.
+
+
Task /Model Size FLOPS (ZFLOPS)
PaLM 62B 295.7
U-PaLM 62B 298.7
Chinchilla 70B
Gopher 280B
PaLM 540B 2527.2
U-PaLM 540B
BoolQ 0-shot
84.8
85.4
588 83.7
504 81.8
88.0
2529.7 88.8(+0.9%)
PIQA 0-shot
80.5
81.4
81.8
81.8
82.3
84.1(+2.2%)
HellaSwag 0-shot
79.7
79.7
80.8
79.7
83.4
84.1(+0.8%)
Winogrande 0-shot
77.0
76.2
74.9
70.1
81.1
82.6 (+1.8%)
Avg. Commonsense
80.5
80.7
80.3
78.2
83.7
84.9 (+1.4%)
+
+Multi-step Reasoning, Analogical Reasoning and Arithmetic tasks We observe that there are some performance improvements on analogical reasoning task (e.g., analogical_similarity) or multi-step reasoning tasks (strategyqa) at 540B scale. However, unlike context reasoning tasks, the performance on these class of tasks tend to follow similar scaling patterns albeit with slightly better performance. For example, based on Figure 4, we note that strategyqa follows relatively similar scaling curves to PaLM.
+
+# 11.1 Zero-shot and Few-shot NLP
+
+In this section, we evaluate our models on various well-established NLP tasks. These tasks test a spectrum of zero and few-shot abilities of U-PaLM.
+
+# 11.1.1 Commonsense Reasoning
+
+We conduct experiments on four zero-shot commonsense reasoning benchmarks. Specifically, following [Hoffmann et al., 2022], we use BoolQ [Clark et al., 2019], PIQA [Bisk et al., 2020], HellaSWAG [Zellers et al., 2019] and Winogrande [Sakaguchi et al., 2019]. Aside from PaLM 62B and PaLM 540B which we use for direct comparisons with U-PaLM, we also compare with Chinchilla 70B [Hoffmann et al., 2022] and Gopher 280B [Rae et al., 2021]. Table 4 reports the results on zero-shot commonsense reasoning.
+
+We show that U-PaLM 540B outperforms PaLM 540B on all four tasks with an average of $( + 1 . 4 \% )$ relative improvement and attains the best performance across all models.
+
+# 11.1.2 Question Answering and Reading Comprehension
+
+We evaluate zero-shot and few-shot closed book question answering (CBQA) tasks [Kwiatkowski et al., 2019, Joshi et al., 2017, Roberts et al., 2020] along with the zero-shot Lambada reading comprehension task [Paperno et al., 2016]. Table 5 reports the results of our experiments. We compare with PaLM 62B, PaLM 540B, Chinchilla 70B and
+
+Table 5: Results on closed book QA and reading comprehension.
+
+
Task/Model Size FLOPS (ZFLOPS)
PaLM 62B 295.7
U-PaLM 62B 298.7
Chinchilla 70B 588
Gopher 280B 504
PaLM 540B 2527.2
U-PaLM 540B 2529.7
TriviaQA 0-shot
67.3
68.3
67.0
52.8
76.9
76.4 (-0.7%)
TriviaQA few-shot
72.7
73.6
73.2
63.6
81.4
82.0 (+0.7%)
Natural Questions 0-shot
18.1
18.7
16.6
10.1
21.2
21.7 (+2.4%)
Natural Questions few-shot
27.6
30.5
31.5
24.5
36.0
40.1 (+11.4%)
Lambada 0-shot
75.4
79.7
77.2
74.5
77.9
80.5 (+3.3%)
Avg. QA/RC
52.2
54.3
53.0
45.1
58.7
60.1(+2.3%)
+
+Table 6: Experiment results on reasoning and chain-ofthought reasoning experiments.
+
+
Task /Model
Minerva 540B
PaLM540B
U-PaLM540B
GSM8K
57.8
54.9
58.5 (+6.6%)
BBH
37.2
44.8
49.6 (+10.7%)
StrategyQA
61.9
76.4
76.6(+0.2%)
CSQA
72.2
76.9
80.1(+4.2%)
+
+Gopher 280B. Overall, on few-shot CBQA and reading comprehension, we observe that U-PaLM 540B outperforms PaLM 540B by $+ 2 . 3 \%$ on average and up to $+ 1 1 . 4 \%$ on few-shot natural questions. Meanwhile, the gain at 62B scale is also strong (i.e., $+ 2 . 1 \%$ on average).
+
+# 11.1.3 Reasoning and Chain-of-thought Experiments
+
+We conduct experiments on reasoning and CoT and compare U-PaLM 540B with PaLM 540B and Minerva 540B. We use the GSM8K [Cobbe et al., 2021], BBH [Suzgun et al., 2022], StrategyQA [Geva et al., 2021] and CommonsenseQA [Talmor et al., 2019] benchmarks. All tasks are run with chain-of-thought (CoT) prompting. Table 6 reports results on reasoning and CoT benchmarks. U-PaLM 540B outperforms both PaLM 540B and Minverva 540B. Notably, the gains on GSM8K and BBH are relatively strong. This shows that U-PaLM does well on reasoning and is well-suited for chain-of-thought reasoning.
+
+# 11.1.4 Multilingual Few-shot Reasoning and Question Answering Tasks
+
+We conduct experiments on few-shot multilingual reasoning and question answering tasks. We use the MGSM (multilingual grade school math) benchmark proposed in [Shi et al., 2022]. For multilingual question answering, we use the well-established TydiQA [Clark et al., 2020a] benchmark. In our experiments, both PaLM 540B and U-PaLM 540B uses chain-of-thought prompting [Wei et al., 2022b]. Table 7 reports our results on MGSM and TydiQA. Our results show that U-PaLM outperform PaLM by a considerable margin $( + 3 . 2 \%$ on TydiQA and $+ 8 . 7 \%$ on MGSM).
+
+Table 7: Experiments on Multilingual GSM (MGSM) [Shi et al., 2022] and TydiQA [Clark et al., 2020a]
+
+
Task /Model
PaLM540B
U-PaLM540B
TydiQA
52.9
54.6(+3.2%)
MGSM
45.9
49.9 (+8.7%)
+
+Table 8: Results of PaLM vs U-PaLM at different FLOPs (# tokens) at 540B scale.
+
+
Model Task/#Tokens
PaLM540B
U-PaLM540B
182B
329B
780B
182B+
329B+
780B+
TriviaQA 1shot
73.4
74.4
81.4
73.3
75.6
82.0
NQA 1shot
23.2
25.6
29.3
24.4
28.1
30.7
WebQA 1shot
21.6
19.9
22.6
21.0
21.7
23.4
BoolQ
82.4
85.6
88.0
85.8
88.2
88.8
ReCORD
91.5
92.7
92.9
91.5
92.6
93.0
COPA
92.0
93.0
93.0
94.0
93.0
96.0
RTE
68.6
67.2
72.9
73.7
71.5
75.5
WIC
50.8
53.8
59.1
52.2
58.0
62.2
WSC
88.1
86.7
89.1
87.0
88.1
87.4
CB
57.1
48.2
51.8
69.6
71.4
69.6
MultiRC
76.7
81.1
83.5
78.4
81.7
83.8
Winogrande
89.4
88.3
90.1
87.9
89.7
88.3
Winograd
76.9
79.6
81.1
78.2
79.3
82.6
ANLIR1
44.3
49.4
48.4
50.3
50.6
55.3
ANLIR2
41.3
42.7
44.2
43.5
45.2
47.8
ANLIR3
43.8
42.8
45.7
46.7
49.3
57.0
PIQA
81.0
81.9
82.3
80.8
82.0
84.1
StoryCloze
82.7
83.9
84.6
83.7
84.2
87.0
HellaSwag
79.1
81.8
83.4
79.5
82.3
84.1
ArcE
74.8
72.8
76.6
74.6
76.3
85.9
ArcC
48.0
46.9
53.0
48.6
50.4
60.3
RaceM
63.6
67.3
68.1
63.2
67.1
67.2
OpenbookQA
50.2
51.2
53.4
50.2
51.2
53.6
RaceH
45.3
48.5
49.1
45.5
48.5
51.3
Lambada 1shot
75.4
77.5
81.8
74.3
79.9
80.0
SquadV2 1shot
70.5
71.3
78.7
71.8
70.3
78.2
Average
62.7
63.8
66.5
64.1
66.2
69.4
+
+# 11.2 Details of Scaling Curves for Few-shot Experiments
+
+We compute a mean aggregated score of the following tasks. We use 21 zero-shot rank classification tasks, i.e., BoolQ, Record, COPA, RTE, WiC, WSC, CB, MultiRC, Winograd, Winogrande, ANLI R1, ANLI R2, ANLI R3, PIQA, StoryCloze, HellaSwag, Arc-E, Arc-C, RaceM, RaceH, OpenbookQA. We use 5 one-shot generative tasks, i.e., TriviaQA, NaturalQuestions, WebQuestions,SQuaDV2 and Lambada. All tasks use the accuracy (or exact match) metric except MultiRC which reports f1a following [Brown et al., 2020]. In total, the aggregated metric is a mean over all 26 tasks. We list the scores that correspond to Figure 2’s 540B scaling plot below.
+
+# 11.3 Details of Vocab and Sentinel Tokens
+
+For U-PaLM, we had to train on span corruption or infilling task. We use the same setup as UL2 and T5 where we inject sentinel tokens, e.g., } }$ into the masked positions. In T5, sentinel ids are added as 100 additional vocab tokens at the end of the sentencepiece (vocab). In PaLM, since we restart from an existing PaLM checkpoints, it was quite cumbersome to initialize 100 new embeddings in the vocab. Hence, we opt to simply use the last 100 subwords as sentinel tokens. Finally, we also use eos symbols in the vocab when training the model.
+
+# 11.4 Details of Prompt Templates
+
+As stated in Section 3.2, BBES uses the default prompting and templates a BIG-Bench and do not use chain-of-thought prompting. For full BBH and MMLU results, we use the same set of prompts as [Chung et al., 2022], which we refer the reader to for more details. However, our 5-shot MMLU prompts do not use chain-of-thought, only directly stating the answer option, e.g. "Answer: (C)". Prompts for our zero-shot and few-shot NLP evaluations in Section 10.1 use the same basic templates as [Brown et al., 2020].
+
+# 11.5 Additional Discussion
+
+In this section, we delve into some additional topics and discussions.
+
+# 11.5.1 What about training from scratch?
+
+We address the elephant in the room. There are multiple perspectives to this question. The first is that UL2R can be thought as a form of ‘UL2 schedule‘ that sets a single causal language model objective from 0 to $N$ steps and then doing the UL2 mixture from $N$ to $N + \epsilon$ . In this sense, if we wanted to train from scratch, this would require modifying the mixture to have significantly more causal language modeling. The second perspective is that UL2R introduces a natural curriculum where the model spents a large fraction of training acquiring basic language modeling before moving on to tasks like infilling or learning how to leverage bidirectional receptive fields. Whether there is a taxonomy or hierarchical of pretraining tasks is still an open question which we hope to answer in future work. The third perspective is simply the practical aspect of U-PaLM. Training a PaLM 540B model from scratch is incredibly costly and we would like to reuse our existing models (or components) as much as possible to design new models for new tasks. U-PaLM is an instance of this type of research. Finally, given that many language models are trained as causal language models, we believe that UL2R presents great opportunity for improving existing models with only a small amount of compute.
\ No newline at end of file
diff --git a/md/dev/tZmqS73_07/tZmqS73_07.md b/md/dev/tZmqS73_07/tZmqS73_07.md
new file mode 100644
index 0000000000000000000000000000000000000000..9eb60dc2fb51c2317db856db9a9894be5f653d4d
--- /dev/null
+++ b/md/dev/tZmqS73_07/tZmqS73_07.md
@@ -0,0 +1,574 @@
+# 3D MOLECULAR GENERATION BY VIRTUAL DYNAMICS
+
+Anonymous authors Paper under double-blind review
+
+# ABSTRACT
+
+Structure-based drug design, i.e., finding molecules with high affinities to the target protein pocket, is one of the most critical tasks in drug discovery. Traditional solutions, like virtual screening, require exhaustively searching on a large molecular database, which are inefficient and cannot get novel molecules beyond the database. The pocket-based 3D molecular generation model, i.e., directly generating a molecule with a 3D structure and binding position in the pocket, is a new promising way to address this issue. However, the method is very challenging due to the complexity brought by the huge continuous 3D space in the pocket cavity. Herein, inspired by Molecular Dynamics, we propose a novel pocket-based 3D molecular generation framework VD-Gen. VD-Gen consists of a Virtual Dynamics mechanism and several carefully designed stages to generate fine-grained 3D molecules with binding positions in the pocket cavity end-to-end. Rather than directly generating or sampling atoms with 3D positions in the pocket like in early attempts, in VD-Gen, we first randomly scatter many virtual particles in the pocket; then with the proposed Virtual Dynamics mechanism, a deep model, acting like a "force field", iteratively moves these virtual particles to positions that are highly possible to contain real atoms. After virtual particles are stabilized in 3D space, we extract the atoms from them. Finally, we further refine the 3D positions of atoms by Virtual Dynamics again, to get a fine-grained 3D molecule. Extensive experiment results on pocket-based molecular generation demonstrate that VD-Gen can generate novel 3D molecules to fill the target pocket cavity with high binding affinities, significantly outperforming previous baselines.
+
+# 1 INTRODUCTION
+
+Structure-based (pocket-based) drug design, i.e., finding a molecule to fill the cavity of the protein pocket with a high binding affinity [1; 2; 3; 4], is one of the most critical tasks in drug discovery. The most widely used method is virtual screening [5; 6; 7]. Virtual screening iteratively places molecules from a molecular database into the target pocket cavity and evaluates molecules with good binding based on rules such as energy estimation [8; 9; 10; 11]. However, virtual screening is inefficient for the exhaustive search and is infeasible to generate new molecules that are not in the database. Recently, molecular generative models have become a potential solution to address the problem as they could generate novel molecules in an efficient way. The early attempts focused on ligand-based molecular generation[12; 13; 14], which trains models to learn the underlying distribution of the molecules in training data and generate similar molecules. However, those methods didn’t consider conditional information, such as the shape of the pocket. Therefore, the generated molecules could hardly fit well with a given pocket in practice. Later, more efforts were paid to studying how to leverage the information of protein pockets for molecular generation. Some pocket-based generative models simply generate molecules in the form of SMILES or graphs [15; 16], without considering the 3D geometric position of the molecule and pocket, which is closely related to binding affinity.
+
+However, directly generating pocket-based molecules in the 3D space is not trivial. Given the 3D structure of a pocket, the ultimate goal of the task is to generate 3D molecules which contain a set of atoms, each with an atom type and the corresponding 3D position. The biggest challenge here is the large space of continuous 3D positions. In most existing generative models (in images/texts), the space of position is usually small and discrete, like an image with $2 2 4 \times 2 2 4$ pixels. To address that, there are some early attempts, which can be roughly categorized into two classes, molecular 3D density grid generation [17] and auto-regressive 3D generation [18; 19; 20]. In 3D density grid generation, similar to images, pockets and molecules are converted to 3D density grids with coarse-grained positions. 3D convolutional models could be used here. But it compresses the information of the pocket structure and is hard to generate accurate (fine-grained) molecules due to the coarse-grained grid positions. In auto-regressive 3D generation, an atom (with a 3D position and an atom type) is sampled (or generated) at each time step. But it is very inefficient due to the large sampling space of 3D positions. Besides, using sequential generation for 3D molecules is not reasonable since we do not know which atoms should be generated first.
+
+
+Figure 1: The framework of VD-Gen, which consists of 4 stages, for generating fine-grained 3D molecules with binding positions in the pocket end-to-end. In Equilibrium and Refinement, the proposed Virtual Dynamics is used to iteratively move the virtual particles.
+
+In short, existing models did not fully tackle the challenges in pocket-based 3D molecular generation. The ideal models should be able to generate fine-grained 3D molecules efficiently, in a one-shot (non-auto-regressive) fashion. To achieve that, we proposed a novel 3D molecular generation framework, VD-Gen, based on a Virtual Dynamics (VD) mechanism. Inspired by the Molecular Dynamics [21; 22], VD contains a deep model, which acts like a "force field", iteratively moving the random scattered "virtual particles" (VPs) to positions that are highly possible to contain real atoms. Based on VD , as illustrated in Fig. 1, VD-Gen framework contains 4 stages to directly generate 3D molecules in the pocket end-to-end. 1) Equilibrium. To cover the pocket cavity space as much as possible, many VPs are first randomly placed. Then the VPs are iteratively moved by VD until equilibrium. Ideally, the VPs will be moved into several clusters, each representing a possible atom. 2) Extraction. We want to extract atoms from equilibrious VPs in this stage. First, a success rate will be predicted for each VP, a higher success rate means that VP is more close to its target, and the VPs with low success rates will be filtered. Then, a model is used to predict the clustering of VPs, by a pair-wise fashion, and the VPs in the same cluster will be merged into one atom. With the merged atoms, we can get a molecule with a 3D structure. 3) Refinement. Although a 3D molecule could be generated in Extraction stage, it may be inaccurate due to the error in merging multiple VPs. To get a more accurate 3D molecule, the atoms are iteratively moved by VD again in this step. 4) Confidence. A confidence score for the generated 3D molecule will be provided by the model in this stage. The confidence score is instrumental when selecting or ranking from multiple generated results.
+
+# Our contributions can be summarized as follows:
+
+• We propose Virtual Dynamics (VD) mechanism, which implicitly simulates Molecular Dynamics by a deep model, iteratively moving the particles to positions that highly possibly contain atoms. We design several strategies, like least-action target assignment and iterative movement, to make the training of VD feasible. • Although VD can generate rough shapes (densities of particles) of 3D molecules, it is hard to extract molecules from the shapes. To address the problem, we further propose a novel pocket-based 3D molecular generation framework VD-Gen, which end-to-end extracts a 3D molecule from many particles, then refines it by VD again, and predicts a confidence score used for selecting or ranking. • Under VD-Gen, to tackle the limited data in pocket-based 3D molecular generation, we design a self-partial-generation pretraining task and successfully use it to further improve performance. • Multiple evaluation metrics, such as Vina [23], MM-PBSA [24], 3D Similarity [25], are used to benchmark VD-Gen thoroughly. Experiments results demonstrate that VD-Gen can generate diverse drug-like molecules with high binding affinities, significantly outperforming all baselines. Ablation studies and case studies are designed to further demonstrate the effectiveness of VD-Gen.
+
+# 2 METHOD
+
+The problem of pocket-based 3D molecular generation could be denoted as $\mathbf { M } = h ( \mathbf { P } ; \pmb { \theta } )$ , where $h ( \cdot ; \theta )$ is the model with learnable parameter $\pmb { \theta }$ , $\mathbf { P } = \{ ( \pmb { x } _ { i } ^ { p } , \pmb { y } _ { i } ^ { p } ) \} _ { i = 1 } ^ { u }$ is the set of $u$ atoms in the pocket, $\pmb { x } _ { i } ^ { p } \in \mathbb { R } ^ { t }$ and $\pmb { y } _ { i } ^ { p } \in \mathbb { R } ^ { 3 }$ are the $i$ -th pocket atom’s type (one-hot) and coordinate, respectively, $t$ is the number of atom types, and $\mathbf { M } = \{ ( \pmb { x } _ { i } , \pmb { y } _ { i } ) \} _ { i = 1 } ^ { m }$ is the set of $m$ atoms of the generated molecule.
+
+
+Figure 2: The backbone model used in VD-Gen. Details are in Appendix A.1.1 and Alg. 2.
+
+# 2.1 VIRTUAL DYNAMICS
+
+As aforementioned, directly generating M is challenging due to the large space of 3D positions. Therefore, inspired by Molecular dynamics (MD), we propose Virtual Dynamics (VD), which iteratively refines the particles from a random state, rather than direct generation. MD is a Newtonian Mechanics based computational simulation to move atoms or other microscopic particles. In MD, what determines how atoms move is the molecular force field, a physical model that defines the interactions between atoms. The potential energy surface (PES) [26; 27], a function of energy based on atomic positions, is used to describe the energy landscape of the system. Each minimal energy on PES corresponds to a physical stable state, in which the atoms prefer to stay in particular positions.
+
+Virtual Dynamics (VD) contains a deep model, acting like a "force field", implicitly predicting the preferred positions of ligand molecular atoms in the pocket cavity by moving the "virtual particles"(VPs) toward those positions. Formally, VD could be denoted as ${ \bf V } _ { r } = h ( { \bf V } _ { 0 } , { \bf P } , r ; \theta )$ , where $r$ is the number of rounds, $\mathbf { V } _ { r } = \{ ( \boldsymbol { { \mathbf { \mathit { x } } } } _ { i } ^ { r } , \boldsymbol { { \mathbf { \mathit { y } } } } _ { i } ^ { r } ) \} _ { i = 1 } ^ { n }$ is the set of $n$ VPs that are generated at the $r$ -th round. Here we define the VPs as particles without fixed atom types. Besides, VD can generate more VPs than the real atoms, i.e., $n = | \mathbf { V } _ { r } ^ { n } |$ can be larger than $m = | M |$ , and VPs can overlap with each other. To train a model to achieve effective movement of VPs, VD consists of 4 parts: 1) Backbone Model, a SE(3) model takes $\mathbf { V } _ { r }$ as input and outputs the refined $\mathbf { V } _ { r + 1 }$ ; 2) Target Assignment, a method to assign targets for VPs during training; 3) Iterative Movement, a strategy to update positions of VPs iteratively like MD; 4) Training Objectives, effective objective functions to train VD .
+
+Backbone Model We can denote the model as $\mathbf { V } _ { r + 1 } = f ( \mathbf { V } _ { r } , \mathbf { P } ; \theta )$ . To predict the coordinates effectively, the model $f$ should be SE(3)-equivariance. We mainly follow the design of the efficient SE(3)-equivariance Transformer proposed in Uni-Mol [28] and Graphormer-3D [29]. However, they did not consider the interaction between pocket and molecule. Therefore, as illustrated in Fig. 2, we extend the model by adding an additional pocket encoder, and a particle-pocket attention layer to capture the interactions between pocket atoms and VPs. In particular, the key/value in the particle-pocket attention is from the node representation of the last layer in the pocket encoder. Besides, to encode the 3D spatial interactions between the pocket and VPs, the pair distance between pocket atoms and VPs is used for particle-pocket spatial position encoding. For efficiency purposes, particle-pocket attention is only used in every 4-layer, not in all layers.
+
+To encode 3D positions, we follow Uni-Mol and use SE(3)-invariant Gaussian kernel to encode the pair-wise Euclidean distances, as shown in Fig. 2. To predict 3D positions directly, the SE(3)- equivariance coordinate head in Uni-Mol [28] is used. Besides, to predict the atom types of particles after movement, an atom type prediction head is introduced. Due to space restrictions, we leave the details of the above components in Appendix A.1.1.
+
+Target Assignment The goal of model $f$ is to move the VPs to the preferred positions of ligand molecular atoms. To achieve this, we can directly assign a real atom as the training target for each VP. Formally, given the ground-truth atoms $\mathbf { G } = \{ ( \boldsymbol { { \mathbf { x } } } _ { i } ^ { g } , \boldsymbol { { \mathbf { y } } } _ { i } ^ { g } ) \} _ { i = 1 } ^ { m }$ and the random initialized VPs $\mathbf { V } _ { 0 }$
+
+# Algorithm 1 Iterative Movement
+
+Require: R: max rounds, P: pocket atoms, $\mathbf { V } _ { 0 }$ : random initialized virtual particles
+1: $r \gets \mathrm { u n i f o r m } ( 1 , R )$ if training else $R$ ▷ Sampling is only enabled at training
+2: disable_gradient() ▷ Disable gradient calculation globally
+3: for $k \in [ 1 , . . . , r - 1 )$ do ▷ Iterative updates without gradients
+4: $\mathbf { V } _ { k } f ( \mathbf { V } _ { k - 1 } , \mathbf { P } ; \boldsymbol { \theta } )$ ▷ backbone model $f$ predict the types and positions
+5: enable_gradient() ▷ Enable gradient calculation globally
+6: $\mathbf { V } _ { r } \gets f ( \mathbf { V } _ { r - 1 } , \mathbf { P } ; \theta )$ $\triangleright$ update with gradients
+7: return $\mathbf { V } _ { r }$ ▷ Return the positions and types of particles
+
+there are $n ^ { m }$ possible assignments. Following the principle of least action [30], the assignment with minimal moving distance is favored. That is to optimize $\begin{array} { r } { \mathbf { M i n } \sum _ { i = 1 } ^ { n } \| \pmb { y } _ { i } ^ { 0 } - \pmb { y } _ { a _ { i } } ^ { g } \| _ { 2 } } \end{array}$ , where $\mathbf { \boldsymbol { x } } _ { i } ^ { 0 }$ is the initial position and $a _ { i } \in \mathbb { N }$ is the assigned target for $i$ -th VP. This optimization problem is easy to solve: for each VP, assign its nearest real atom as the training target, i.e., $a _ { i } = \arg \operatorname* { m i n } _ { \mathbf { \mu } _ { - } , \mathbf { \bar { \mu } } _ { - } = 1 } ^ { m } \| \pmb { y } _ { i } ^ { 0 } - \pmb { y } _ { j } ^ { g } \| _ { 2 }$ However, by this method, some real atoms may not be assigned as targets when VPs are closer to other real atoms. To increase the coverage, there are two methods. The first is taking the coverage as a constraint in the above optimization problem; the second is using more VPs to cover the pocket cavity as possible. Although the former is more favorable from the algorithm perspective, it increases the learning difficulty of VP movement since the constrained assignment breaks the principle of least action 1. Therefore, in VD , we take the latter one, using more VPs to ensure coverage. Besides, we propose an algorithm to determine the pocket cavity, and VPs are only initialized inside the detected cavity. In particular, we use a breadth-first search algorithm, from a given position in the cavity, to detect the cavity space. Details are in Appendix A.1.2.
+
+Iterative Movement Since VPs are scattered randomly in the pocket cavity, there is a wide range of distances between each VP and its target. As a result, it is not realistic that every VP can be moved to the right target position in one step. Therefore, VD takes a strategy that iteratively moves the VPs and predicts their types with multiple rounds. In particular, at each round, the model will take the VPs’ positions and types from the previous round as inputs, and output the new positions and types for them. In the first few rounds, the VPs that are close to the target positions will soonly approach their target positions. But for the VPs that are far away from the target positions, it may take more rounds to approach. In short, with iterative movement, more VPs could reach their target positions.
+
+However, training the model with multiple rounds is not efficient in both speed and memory consumption. To reduce the training cost, we adopt the stochastic iteration in AlphaFold2 [31]. In particular, during training, the number of rounds $r$ is uniformly sampled between 1 and $R$ , where $R$ is the max round. Then, the model is run on the forward-only mode in the first $r - 1$ rounds, without loss calculation and gradient backward. Finally, the gradient and backward are enabled at the $r$ -th round. During inference, the sampling on rounds is not used. The above algorithm is shown in Alg. 1.
+
+In addition, we propose two technologies to improve training stability. First, the SE(3) coordinate head is initialized to predict the zero delta positions; thus, the predicted movements of VPs are nearly zeros at the beginning of training, and gradually increase. Second, to avoid moving too fast in each round, a regularization of the delta distance between the input and output positions is used during training.
+
+Training Objectives With assigned targets $( a _ { i } = \arg \operatorname* { m i n } _ { j = 1 } ^ { m } \| y _ { i } ^ { 0 } - y _ { j } ^ { g } \| _ { 2 } )$ , the training of VD is straightforward. First, a clip L2 loss is used for the coordinate prediction, clipping is for the training stability. Second, as aforementioned, a regularization of the moving distance of iterative movement is introduced to avoid moving too fast and improve training stability. Third, a negative log likelihood loss is used for the particle type prediction. Finally, two auxiliary L1 losses are used for the particle-particle pair distance prediction and particle-pocket pair distance prediction, respectively. The final training objective loss function could be denoted as:
+
+$$
+\begin{array} { l } { \displaystyle \mathcal { L } _ { \mathcal { V D } } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \big ( \mathrm { c l i p } ( | | \boldsymbol { y } _ { i } ^ { r } - \boldsymbol { y } _ { a _ { i } } ^ { g } | | _ { 2 } , \boldsymbol { \tau } ) + \operatorname* { m a x } ( | | \boldsymbol { y } _ { i } ^ { r } - \boldsymbol { y } _ { i } ^ { r - 1 } | | _ { 2 } - \delta , 0 ) + \mathrm { N L } ( \bar { \boldsymbol { x } } _ { i } ^ { r } , \boldsymbol { x } _ { a _ { i } } ^ { g } ) } \\ { \displaystyle \qquad + \frac { 1 } { n } \sum _ { j = 1 } ^ { n } | | d _ { i j } ^ { r } - d _ { a _ { i } , a _ { j } } ^ { g } | | _ { 1 } + \frac { 1 } { u } \sum _ { j = 1 } ^ { u } | | c _ { i j } ^ { r } - c _ { a _ { i } , j } ^ { g } | | _ { 1 } \bigg ) , } \end{array}
+$$
+
+where $r$ is the number of rounds, $\bar { \pmb x } _ { i } ^ { r }$ is the predicted atom type distribution of $i$ -th particle, $d _ { i j } ^ { r }$ $( d _ { a _ { i } , a _ { j } } ^ { g } )$ is the predicted (ground-truth) distance of the $i$ -th and $j$ -th particle pair, $c _ { i j } ^ { r } \ ( c _ { a _ { i } , j } ^ { g } )$ is the predicted (ground-truth) distance of the $i$ -th particle and the $j$ -th pocket atom.
+
+# 2.2 VD-GEN FRAMEWORK
+
+With VD , a rough shape (density of VPs) of the 3D molecule could be formed by the VPs after iterative movement. We may use some rule-based solutions, like clustering by distances, to extract 3D molecules from the VPs. However, rule-based solutions are not end-to-end and could fail in various scenarios. Therefore, to better leverage VD , we further develop an end-to-end pocket-based 3D molecular generation framework, called VD-Gen, with the following 4 stages, illustrated in Fig 1.
+
+Equilibrium This stage is exactly the same as the VD . Many VPs are first uniformly scattered in the pocket. Then, VPs iteratively move toward their target positions. Finally, VPs will reach a stable state.
+
+Extraction With the equilibrious VPs, a rough shape of the 3D molecule could be got, and we want to extract a 3D molecule from it. For the end-to-end purpose, we propose a deep model based solution to extract atoms. Formally, the model can be denoted as ${ \bf W } _ { 0 } = h _ { e x } ( { \bf V } _ { r } , { \bf P } ; \theta _ { e x } )$ , where $\theta _ { e x }$ is learnable parameters, $\mathbf { W } _ { 0 } = \{ ( \hat { \pmb { x } } _ { i } ^ { 0 } , \hat { \pmb { y } } _ { i } ^ { 0 } ) \} _ { i = 1 } ^ { m }$ is the set of $m$ VPs after extraction. The model reduces VPs from $n$ to $m$ by two steps, filter and merge. First, as some VPs may fail to approach their target positions, we want to filter out them. A binary classification head is used to predict the success rates of VPs, and the training targets are "success" if the distances between VPs and their target positions after Equilibrium are smaller than a threshold. And we filter out the VPs based on the predicted success rate.
+
+Second, we want to merge the remaining VPs into atoms. Based on the pair representation of VPs, we use another binary classification head to predict whether a VP pair should be merged or not. Ideally, the VPs with the same target atom should be merged, thus training label for a VP pair with the same atom target is set to "true". When there are $n$ VPs and $m$ real atoms, the ratio of "true" class is about m×(n/m)2 $\begin{array} { r } { { \frac { m \times ( n / m ) ^ { 2 } } { n ^ { 2 } } } = { \frac { 1 } { m } } } \end{array}$ . As $m$ ranges from dozens to hundreds, the binary classification task here is very unbalanced. Thus, we introduce a focal loss [32] to balance the classes. With the predicted pair-wise merge probability matrix, we can use a threshold to get a binary merge matrix and merge VPs into clusters according to the matrix. However, it is hard to decide a threshold since the training of pair-wise merge is unbalanced. To tackle that, we further introduce a prediction task for the number of ligand molecular atoms, based on pocket atom representation. During inference, we use binary search to find a merging threshold that satisfies the predicted atom number, details are in Appendix A. There will be several (ideally $m$ ) merge clusters, and we denote ${ \pmb w } _ { i }$ as the set of the indices of $i$ -th cluster’s VPs. Then, to initialize $\mathbf { W } _ { 0 }$ , we use $\hat { \pmb { x } } _ { i } ^ { 0 } = \mathrm { U n i f o r m } ( \{ \pmb { x } _ { j } ^ { r } | j \in \pmb { w } _ { i } \} )$ ) and $\hat { \pmb { y } } _ { i } ^ { 0 } = \mathrm { M e a n } ( \{ \pmb { y } _ { j } ^ { r } | j \in \pmb { w } _ { i } \} )$ , to sample an atom type and get an average coordinate respectively.
+
+Refinement After Extraction, a 3D molecule with a set of VPs $( \mathbf { W } _ { 0 } )$ ) could be formed. However, due to the possible error in Extraction, the predicted 3D molecule may not be very accurate. To get a more accurate 3D molecule $( \mathbf { W } _ { r } )$ , we use VD again, with different model weights, to iteratively move these VPs to their target positions. Different with Equilibrium, the training target assignment of the $i$ -th VP is the most frequent target atom in the cluster ${ \pmb w } _ { i }$ , not its nearest atom.
+
+Confidence Abundant molecules are usually generated in real-world tasks. We want to select or rank the molecules according to binding affinities. Although we can use computational simulations or wet experiments to examine the generated molecules, they are too costly, especially for a large number of molecules. To further improve the usability of ${ \tt V D - G e n }$ and reduce the extra cost of selecting good molecules, we explicitly train a task to learn the confidence scores for the generated molecules. In particular, following AlphaFold [31], we compute the LDDT score [33] of the generated molecule and ground-truth molecule, and a pLDDT(predict LDDT) head is used to learn the LDDT score. During inference, the output of pLDDT head is used as the confidence score of the generated molecule.
+
+The loss functions in the above 4 stages are combined, and the entire VD-Gen framework is trained end-to-end. Due to space restrictions, we leave the details of the above loss functions in Appendix A.
+
+# 2.3 PRE-TRAINING FOR VD-GEN
+
+Due to the limited protein-ligand binding data for the supervised training, VD-Gen may fail to train or overfit the small training data. Therefore, to improve the model ability, we pretrain the pocket encoder and the VP encoder by large-scale unlabeled data, respectively. The pretrained pocket encoder is directly taken from the pretrained one from Uni-Mol [28]. For the VP encoder, the pretraining is mostly the same as the VD-Gen framework, except that pocket is not involved. In particular, the pocket related components, like particle-pocket attention, are all removed. Nevertheless, without pocket as a condition, the training of VD-Gen is infeasible. So we design a self-partial-generation pretraining task, by using a part of the molecule as the known condition and generating the unknown part. To be more consistent with finetuning, only a few atoms, about $20 \%$ to $30 \%$ , are kept as a condition. To have a continuous 3D space for VPs to generate, we randomly remove the atoms in the continuous region. We use a greedy recursive algorithm to find a cluster of atoms to remove, and then, the VPs are randomly scattered in the continuous region of these removed atoms.
+
+During finetuning, the backbone model in VD-Gen loads the weights from two pretrained models. For the VP encoder, the weights in the particle-pocket attention layers are not pretrained and are randomly initialized. Gated layers, initialized as zeros, are used in the residual connections of particle-pocket attention layers. Therefore, the outputs of random initialized particle-pocket attention layers will not affect the pretrained encoders at the beginning of finetuning.
+
+# 2.4 EXTENDING VD-GEN TO POCKET-BASED 3D MOLECULAR OPTIMIZATION
+
+Molecular optimization is also an important task in real-world drug design. In molecular optimization, rather than generating from scratch, the goal is to replace a part of the given molecule, like a fragment, and to get a molecule with better binding affinity. Here, we extend VD-Gen to the pocket-based 3D molecular optimization. In particular, as illustrated in Fig. 8, we first randomly remove a fragment of the given molecule, and the model is learned to generate it, with the pocket and the remaining atoms in the molecule as conditions. In this way, although it is not trained to optimize molecules directly, the model learns how to remove-then-fill a fragment of a molecule, and thus could be used in molecular optimization tasks. The benchmark results of molecular optimization are left to Appendix B.8.
+
+# 3 EXPERIMENTS
+
+# 3.1 SETTINGS
+
+Evaluation metrics There is not a golden metric to evaluate the generated molecules, so we use multiple metrics to have a comprehensive evaluation. 1) 3D Similarity. As the pocket-based 3D generation models are trained by the 3D structures of the pockets and molecules, the most direct metric to examine the models’ generative ability is to evaluate the 3D similarity between the generated molecule and the ground-truth one. Here we use LIGSIFT [25] to calculate the overlapping ratio in 3D space between two molecules. 2) Vina. Docking scores, like Vina [23], are widely used in previous pocket-based generation works, for they are easy to compute. To be consistent with previous works, we also use Vina as a metric. However, previous works usually relied on Vina’s re-docking, in which the molecular conformation and binding pose may be largely changed by docking tools. Thus, to directly evaluate the 3D molecules generated by model, we add an additional Vina\* score that does not use re-docking. 3) MM-PBSA. Although docking scores are easy and fast to compute, they are proposed to recall the possible hits in the large-scale virtual screening, not for ranking. Thus, docking scores are not good metrics to compare the binding affinities for different models [34], and we further use the slower but more accurate MM-PBSA (Molecular Mechanics Poisson–Boltzmann Surface Area) [35] as a metric. Based on MM-PBSA, we add two additional metrics. MM-PBSA B.T. (MM-PBSA Better than Target), which computes the percentage of generated molecules with better MM-PBSA scores than ground-truth. MM-PBSA Rank, which computes the average rankings of different models among different complexes. Due to MM-PBSA scores varying largely in different complexes, MM-PBSA Rank can better compare different models. The details of the above metrics are described in Appendix B.2.
+
+Data We use 3D molecular conformations from Uni-Mol [28] to pretrain VP encoder. PDBBind 2020 dataset [36; 37], containing 19,443 protein-ligand complexes crystal structures, are used to finetune the VD-Gen. Although the cross-docked data [38] used in the previous works is much larger, it is built by docking tools and thus is not accurate as PDBBind, so we do not use it. For the test set, we use 100 protein-ligand complex crystal structures from [24], on which MM-PBSA was validated to be effective. To avoid leakage, we remove the training data’s complexes whose protein sequences are similar to the ones in the test set. In particular, two protein sequences are identified as similar if their e-value from BLAST [39] search results is larger than 0.4. There are 18,413 training complexes after filtering.
+
+Training We leave the detailed hyper-parameters used in training to Appendix B.1.
+
+# 3.2 MOLECULE GENERATION PERFORMANCE
+
+Baselines We compare VD-Gen with several previous 3D pocket-base molecular generation models: the 3D density generation model LiGAN [17], and the auto-regressive 3D generation models
+
+Table 1: Performance on pocket-based 3D molecular generation.
+
+
Model
3D Sim(↑)
Vina(↓)
Vina*(↓)
MM-PBSA(↓)
MM-PBSA- Rank(↓)
MM-PBSA- B.T.(%↑)
LiGAN[17]
0.356
-6.724
-5.372
-17.865
2.57
0.3
3DSBDD[18]
0.365
-8.662
-7.227
-30.221
2.26
3.2
GraphBP[19]
0.333
-8.710
-3.689
-5.130
3.98
0
Pocket2Mol[20]
0.352
-8.332
-6.525
-7.823
3.49
0
VD-Gen
0.414
-9.047
-7.444
-51.258
1.18
13.5
+
+Table 2: Ablation study on pretraining.
+
+
Setting
|no pretrain|pretrain pocket encoder only|pretrain VP encoder only |pretrain
3D Similarity (↑) |
0.361
0.379
0.402
0.414
+
+GraphBP [19], 3DSBDD [18], and Pocket2Mol [20]. For all models, we generate 500 results for each pocket, and then select 100 from them. For 3DSBDD and Pocket2Mol, beam search is used and the top 100 results are selected. For VD-Gen, the selection is based on the confidence score. For LiGAN and GraphBP, random 100 results are selected due to they did not implement beam search.
+
+Results As we pay more attention to the generated molecules with high binding affinities, we report the top 5-th percentile result for Vina, Vina\*, and MM-PBSA. MM-PBSA-Rank is calculated based on the top 5-th percentile MM-PBSA result. The 10-th, 25-th, and 50-th percentile results are in Appendix B.3.
+
+From the results in Table 1, it is easy to conclude: 1) VD-Gen significantly outperforms all other baselines in all metrics, with top-1 MM-PBSA Rank, demonstrating the superior performance of the proposed VD-Gen. 2) MM-PBSA B.T shows that VD-Gen can generate more molecules with better MM-PBSA scores than the ground-truth ones, while baseline hardly can. 3) In 3D Similarity results, VD-Gen also largely outperforms baselines, indicating that VD-Gen effectively learned the pocket-based 3D molecular generation and can generalize to unseen pockets. 4) Although some baselines achieve good performance on Vina scores, like GraphBP and Pocket2Mol, their Vina\* and MM-PBSA scores are very poor. We believe the re-docking in Vina fixes their generated 3D structures and then a good Vina score could be obtained. This result indicates that the previously widely used Vina score is not a good metric for pocket-based 3D molecular generation.
+
+# 3.3 ABLATION STUDY
+
+Pocket coverage As discussed in Sec. 2.1, Virtual Dynamics requires many VPs to cover the pocket cavity as much as possible. And we study how the number of VPs affects the final performance, the results are shown in Fig. 3(a). From the result, it is clear that the number of VPs will affect the performance, and the results with more VPs are better.
+
+Effectiveness of Refinement stage The Refinement stage is used to further refine the 3D molecule after Extraction. To examine how Refinement affects the final performance, we benchmarked different movement iterations in Refinement. As shown in Fig. 3(c), we can find the results with more iterations are better. The result indicates the necessity of the Refinement stage.
+
+Iterative Movement ronuds Iterative Movement is critical in the Virtual Dynamics. From the result in Fig. 3(c), we can find the results with more rounds are better. We also benchmark the effectiveness of Iterative Movement in Equilibrium stage. And we reduce the movement iterations to $2 5 \%$ in Refinement stage, to better show the impact brought by Equilibrium stage. As shown in Fig. 3(b), we can find more iteration rounds in Equilibrium also improves the final performance.
+
+Effectiveness of Confidence stage The pLDDT score is outputted at Confidence stage, and used for selecting or ranking molecules, and we want to check its effectiveness. In particular, we calculate the correlation between 3D similarity and the pLDDT for the generated molecules on a pocket (PDBID 1I7Z), and the result is shown in Fig. 3(d). It is clear that with a larger pLDDT score, the corresponding 3D Similarity is better. This result indicates that the confidence score provided by VD-Gen is effective to select or rank the generated molecules.
+
+Effectiveness of pretraining We also benchmark the performance brought by pretraining. In particular, we add three additional models, one without any pretraining, one only with pocket pretraining, and one only with particle pretraining. From the results shown in Table 2, we can easily conclude that pretraining indeed boosts the performance of VD-Gen.
+
+
+
+
+Figure 3: Ablation studies for VD-Gen.
+
+
+Figure 4: Generated molecules with high 3D similarity to the reference molecular and high PBSA scores for three protein pockets. Gray surfaces are the protein pockets. Green molecules are the ground truth molecules. Purple molecules are the molecules generated by ${ \tt V D - G e n }$ . Lower Vina score, lower PBSA score and higher 3D similarity indicate higher binding affinity.
+
+# 3.4 CASE STUDY
+
+Here, we selected three protein pockets from the test set to visualize the generated results of VD-Gen on pocket-based generation tasks. As shown in Fig 4, for each pocket, 3 molecules (purple molecules in the middle column) with the top MM-PBSA scores are selected for display. These molecules are shown as they as, without any structural post-processing. Green molecules are the ground truth molecules, and the rightmost column is the spatial overlapping of the generated molecules and the original molecule.
+
+In the first case (PDBID: 2XBW), the protein pocket has a pit deep inside the protein (bottom left of the image), the volume of which can accommodate about one benzene ring. It is a challenging task due to the small size of the pit and the long distance from the center of the whole pocket. We can see that the molecules generated by VD-Gen have successfully grown fragments within the pit. On the other hand, the three generated molecules have good 3D similarity with the original molecules, and the MM-PBSA score is good, the Vina scores of the original molecule are much better than those of the three generated molecules. If we only use Vina to pick molecules, It may lead to not picking good molecules.
+
+In the second case (PDBID: 1BHX), the protein pocket is bulky, which requires the generation of protein-interacting fragments at both ends of the protein pocket, and connecting the two ends together by a molecular backbone, we can see the original molecule is long and distorted, making it a challenging prediction task. We see that the molecules generated by VD-Gen replicate the shape of the original molecules well, filling the uneven protein pockets well. All three molecules have good 3D similarity and MM-PBSA scores.
+
+In the third case (PDBID: 2BRM), the protein pocket is flat, which requires that the molecular backbone of the ligand bound to it should be close to a planar structure, such as composed of conjugated aromatic rings. We can see that the molecules generated by VD-Gen are the same as the original molecular structures, whose molecular backbone is a planar structure composed of conjugated aromatic rings, and the part toward the outside of the pocket is flexible. We can see that in this case, Vina scoring, MM-PBSA scoring, and 3D similarity all show good agreements.
+
+From these three cases in Fig 4, we can see that VD-Gen has demonstrated good generation capabilities on different types of challenging molecular generation tasks. For example, the generated molecules can fill deep pockets, follow the trend of large pockets, or match the special structure of the pockets, and the 3D similarity between the generated molecule and the molecule in the original crystal structure is high. On the other hand, we can see that the MM-PBSA score and 3D similarity maintain good consistency in evaluating the quality of generated molecules, while the Vina score fails in some cases, which indicates that it is unreasonable to select molecules based on the Vina score alone.
+
+# 4 RELATED WORK
+
+Ligand-Based Molecular Generation Early works focused on ligand-based molecular generation, took a set of molecules as training data, and generated molecules based on the learned distribution of training data. And these methods mainly represented molecules as 1D SMILES strings and 2D molecular graphs, and used VAEs [12; 13; 14; 40; 41; 42], GANs [43; 44], flow models [45] for oneshot generation, RNNs [46; 47; 48; 49], reinforcement learning approaches[50; 51] for step-by-step generation. And some works [52; 53; 54] tried to preserve structural features like molecular scaffolds, or physicochemical properties like QED, to gain better generated molecules compared to randomly generation. However, those methods did not take the binding affinity against a specific protein pocket as a target directly thus the generated molecules hardly worked well in real-world tasks. Some recent works [55; 56; 57; 58] also tried the ligand-based 3D molecular generation.
+
+Pocket-Based Molecular Generation Due to the importance of binding affinity in drug design, recent works involved the information of protein pockets for molecular generation. Early attempts [15; 16] encoded pocket information and took it as a condition to generate molecules in SMILES strings or molecular graphs. However, since the binding affinity depends on the spatial positions of pocket and molecule, the latter works paid more effort in generating molecules with 3D spatial structures. Some works [17], recognized as molecular 3D density grid generation, converted pockets and molecules into 3D density grids, and applied 3D convolutional models like processing images. But as the pocket cavity is large, the positions of pockets and molecules are coarse-grained in 3D density grids and it leads to information loss and hard to generate fine-grained molecules. Besides, it is not end-to-end since the conversion from 3D density to 3D coordinates is required and usually causes additional accuracy loss. Some other works [18; 19; 20], recognized as auto-regressive 3D molecular generation, sampled/generated atoms in 3D space one by one to form a molecule. Suffering from the large space of continuous 3D positions, it is quite inefficient. Besides, unlike the sequential nature in text, the atoms in a molecule do not have a sequential order. That is, we do not know which atoms should be generated first, and thus, using auto-regressive generation for 3D molecules is not reasonable.
+
+# 5 CONCLUSION
+
+In this paper, we propose VD-Gen, a novel pocket-based 3D molecular generation framework, which consists of a Virtual Dynamics mechanism and several stages, to generate fine-grained 3D molecules with good binding affinities against the pocket end-to-end. In particular, with Virtual Dynamics, many virtual particles are first randomly scattered in the pocket cavity, and are iteratively moved to positions that are highly possible to contain real atoms. Then, a coarse-grained 3D molecule could be extracted by deep models from these particles. Next, the 3D molecule is continued refined by Virtual Dynamics again, and a fine-grained 3D molecule could be obtained. Finally, a confidence score will be calculated for the generated molecule for the need of selecting or ranking. Several strategies are proposed to make the training of VD-Gen feasible. Experiment results demonstrate that VD-Gen can generate molecules with higher binding affinities to protein pockets and more accurate 3D binding structures than other baselines. Several case studies also demonstrate the effectiveness of VD-Gen.
+
+REFERENCES
+[1] Hugo Kubinyi. 3D QSAR in drug design: volume 1: theory methods and applications, volume 1. Springer Science & Business Media, 1993.
+[2] Renee L DesJarlais, Robert P Sheridan, George L Seibel, J Scott Dixon, Irwin D Kuntz, and R Venkataraghavan. Using shape complementarity as an initial screen in designing ligands for a receptor binding site of known three-dimensional structure. Journal of medicinal chemistry, 31(4):722–729, 1988.
+[3] Robert S DeWitte, Alexey V Ishchenko, and Eugene I Shakhnovich. Smog: de novo design method based on simple, fast, and accurate free energy estimates. 2. case studies in molecular design. Journal of the American Chemical Society, 119(20):4608–4617, 1997.
+[4] Robert S DeWitte and Eugene I Shakhnovich. Smog: de novo design method based on simple, fast, and accurate free energy estimates. 1. methodology and supporting evidence. Journal of the American Chemical Society, 118(47):11733–11744, 1996.
+[5] W Patrick Walters, Matthew T Stahl, and Mark A Murcko. Virtual screening—an overview. Drug discovery today, 3(4):160–178, 1998.
+[6] Brian K Shoichet. Screening in a spirit haunted world. Drug discovery today, 11(13-14):607– 615, 2006.
+[7] Brian K Shoichet. Virtual screening of chemical libraries. Nature, 432(7019):862–865, 2004.
+[8] Anita de Ruiter and Chris Oostenbrink. Free energy calculations of protein–ligand interactions. Current opinion in chemical biology, 15(4):547–552, 2011.
+[9] Christophe Chipot and Andrew Pohorille. Free energy calculations, volume 86. Springer, 2007.
+[10] Clara D Christ, Alan E Mark, and Wilfred F Van Gunsteren. Basic ingredients of free energy calculations: a review. Journal of computational chemistry, 31(8):1569–1582, 2010.
+[11] Julien Michel and Jonathan W Essex. Prediction of protein–ligand binding affinity by free energy simulations: assumptions, pitfalls and expectations. Journal of computer-aided molecular design, 24(8):639–658, 2010.
+[12] Matt J Kusner, Brooks Paige, and José Miguel Hernández-Lobato. Grammar variational autoencoder. In International conference on machine learning, pages 1945–1954. PMLR, 2017.
+[13] Hanjun Dai, Yingtao Tian, Bo Dai, Steven Skiena, and Le Song. Syntax-directed variational autoencoder for structured data. arXiv preprint arXiv:1802.08786, 2018.
+[14] Robin Winter, Floriane Montanari, Andreas Steffen, Hans Briem, Frank Noé, and Djork-Arné Clevert. Efficient multi-objective molecular optimization in a continuous latent space. Chemical science, 10(34):8016–8024, 2019.
+[15] Miha Skalic, Davide Sabbadin, Boris Sattarov, Simone Sciabola, and Gianni De Fabritiis. From target to drug: generative modeling for the multimodal structure-based ligand design. Molecular pharmaceutics, 16(10):4282–4291, 2019.
+[16] Mingyuan Xu, Ting Ran, and Hongming Chen. De novo molecule design through the molecular generative model conditioned by 3d information of protein binding sites. Journal of Chemical Information and Modeling, 61(7):3240–3254, 2021.
+[17] Matthew Ragoza, Tomohide Masuda, and David Ryan Koes. Generating 3d molecules conditional on receptor binding sites with deep generative models. Chemical science, 13(9):2701– 2713, 2022.
+[18] Shitong Luo, Jiaqi Guan, Jianzhu Ma, and Jian Peng. A 3d molecule generative model for structure-based drug design. arXiv preprint arXiv:2203.10446, 2022.
+[19] Meng Liu, Youzhi Luo, Kanji Uchino, Koji Maruhashi, and Shuiwang Ji. Generating 3d molecules for target protein binding. arXiv preprint arXiv:2204.09410, 2022.
+
+[20] Xingang Peng, Shitong Luo, Jiaqi Guan, Qi Xie, Jian Peng, and Jianzhu Ma. Pocket2mol: Efficient molecular sampling based on 3d protein pockets. arXiv preprint arXiv:2205.07249, 2022.
+
+[21] Berni J Alder and Thomas Everett Wainwright. Studies in molecular dynamics. i. general method. The Journal of Chemical Physics, 31(2):459–466, 1959.
+
+[22] Berni Julian Alder and Thomas Everett Wainwright. Studies in molecular dynamics. ii. behavior of a small number of elastic spheres. The Journal of Chemical Physics, 33(5):1439–1451, 1960.
+
+[23] Oleg Trott and Arthur J Olson. Autodock vina: improving the speed and accuracy of docking with a new scoring function, efficient optimization, and multithreading. Journal of computational chemistry, 31(2):455–461, 2010.
+
+[24] Maohua Yang, Dongdong Wang, and Hang Zheng. Uni-gbsa: An automatic workflow to perform $\mathrm { { m m / g b ( p b ) s a } }$ calculations for virtual screening. ChemRxiv, 2022.
+
+[25] Ambrish Roy and Jeffrey Skolnick. Ligsift: an open-source tool for ligand structural alignment and virtual screening. Bioinformatics, 31(4):539–544, 2015.
+
+[26] Alan D McNaught, Andrew Wilkinson, et al. Compendium of chemical terminology, volume 1669. Blackwell Science Oxford, 1997.
+
+[27] Shin Sato. On a new method of drawing the potential energy surface. The Journal of chemical physics, 23(3):592–593, 1955.
+
+[28] Gengmo Zhou, Zhifeng Gao, Qiankun Ding, Hang Zheng, Hongteng Xu, Zhewei Wei, Linfeng Zhang, and Guolin Ke. Uni-mol: A universal 3d molecular representation learning framework. 2022.
+
+[29] Yu Shi, Shuxin Zheng, Guolin Ke, Yifei Shen, Jiacheng You, Jiyan He, Shengjie Luo, Chang Liu, Di He, and Tie-Yan Liu. Benchmarking graphormer on large-scale molecular modeling datasets. arXiv preprint arXiv:2203.04810, 2022.
+
+[30] Richard Feynman. The Character of Physical Law, with new foreword. MIT press, 2017.
+
+[31] John Jumper, Richard Evans, Alexander Pritzel, Tim Green, Michael Figurnov, Olaf Ronneberger, Kathryn Tunyasuvunakool, Russ Bates, Augustin Žídek, Anna Potapenko, et al. Highly accurate protein structure prediction with alphafold. Nature, 596(7873):583–589, 2021.
+
+[32] Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollár. Focal loss for dense object detection. In Proceedings of the IEEE international conference on computer vision, pages 2980–2988, 2017.
+
+[33] Valerio Mariani, Marco Biasini, Alessandro Barbato, and Torsten Schwede. lddt: a local superposition-free score for comparing protein structures and models using distance difference tests. Bioinformatics, 29(21):2722–2728, 2013.
+
+[34] Tiejun Cheng, Xun Li, Yan Li, Zhihai Liu, and Renxiao Wang. Comparative assessment of scoring functions on a diverse test set. Journal of chemical information and modeling, 49(4):1079–1093, 2009.
+
+[35] Samuel Genheden and Ulf Ryde. The mm/pbsa and mm/gbsa methods to estimate ligand-binding affinities. Expert opinion on drug discovery, 10(5):449–461, 2015.
+
+[36] Renxiao Wang, Xueliang Fang, Yipin Lu, and Shaomeng Wang. The pdbbind database: Collection of binding affinities for protein- ligand complexes with known three-dimensional structures. Journal of medicinal chemistry, 47(12):2977–2980, 2004.
+
+[37] Renxiao Wang, Xueliang Fang, Yipin Lu, Chao-Yie Yang, and Shaomeng Wang. The pdbbind database: methodologies and updates. Journal of medicinal chemistry, 48(12):4111–4119, 2005.
+
+[38] Paul G Francoeur, Tomohide Masuda, Jocelyn Sunseri, Andrew Jia, Richard B Iovanisci, Ian Snyder, and David R Koes. Three-dimensional convolutional neural networks and a crossdocked data set for structure-based drug design. Journal of Chemical Information and Modeling, 60(9):4200–4215, 2020.
+
+[39] Christiam Camacho, George Coulouris, Vahram Avagyan, Ning Ma, Jason Papadopoulos, Kevin Bealer, and Thomas L Madden. Blast+: architecture and applications. BMC bioinformatics, 10(1):1–9, 2009.
+
+[40] Ryan-Rhys Griffiths and José Miguel Hernández-Lobato. Constrained bayesian optimization for automatic chemical design using variational autoencoders. Chemical science, 11(2):577–586, 2020.
+
+[41] Orion Dollar, Nisarg Joshi, David AC Beck, and Jim Pfaendtner. Attention-based generative models for de novo molecular design. Chemical Science, 12(24):8362–8372, 2021.
+
+[42] André F Oliveira, Juarez LF Da Silva, and Marcos G Quiles. Molecular property prediction and molecular design using a supervised grammar variational autoencoder. Journal of Chemical Information and Modeling, 62(4):817–828, 2022.
+
+[43] Gabriel Lima Guimaraes, Benjamin Sanchez-Lengeling, Carlos Outeiral, Pedro Luis Cunha Farias, and Alán Aspuru-Guzik. Objective-reinforced generative adversarial networks (organ) for sequence generation models. arXiv preprint arXiv:1705.10843, 2017.
+
+[44] Benjamin Sanchez-Lengeling, Carlos Outeiral, Gabriel L Guimaraes, and Alan Aspuru-Guzik. Optimizing distributions over molecular space. an objective-reinforced generative adversarial network for inverse-design chemistry (organic). 2017.
+
+[45] Chence Shi, Minkai Xu, Zhaocheng Zhu, Weinan Zhang, Ming Zhang, and Jian Tang. Graphaf: a flow-based autoregressive model for molecular graph generation. arXiv preprint arXiv:2001.09382, 2020.
+
+[46] Marcus Olivecrona, Thomas Blaschke, Ola Engkvist, and Hongming Chen. Molecular de-novo design through deep reinforcement learning. Journal of cheminformatics, 9(1):1–14, 2017.
+
+[47] Esben Jannik Bjerrum and Richard Threlfall. Molecular generation with recurrent neural networks (rnns). arXiv preprint arXiv:1705.04612, 2017.
+
+[48] Marwin HS Segler, Thierry Kogej, Christian Tyrchan, and Mark P Waller. Generating focused molecule libraries for drug discovery with recurrent neural networks. ACS central science, 4(1):120–131, 2018.
+
+[49] Daniel Flam-Shepherd, Kevin Zhu, and Alán Aspuru-Guzik. Keeping it simple: Language models can learn complex molecular distributions. arXiv preprint arXiv:2112.03041, 2021.
+
+[50] Jiaxuan You, Bowen Liu, Zhitao Ying, Vijay Pande, and Jure Leskovec. Graph convolutional policy network for goal-directed molecular graph generation. Advances in neural information processing systems, 31, 2018.
+
+[51] Wengong Jin, Regina Barzilay, and Tommi Jaakkola. Multi-objective molecule generation using interpretable substructures. In International conference on machine learning, pages 4849–4859. PMLR, 2020.
+
+[52] Yibo Li, Jianxing Hu, Yanxing Wang, Jielong Zhou, Liangren Zhang, and Zhenming Liu. Deepscaffold: a comprehensive tool for scaffold-based de novo drug discovery using deep learning. Journal of chemical information and modeling, 60(1):77–91, 2019.
+
+[53] Jaechang Lim, Sang-Yeon Hwang, Seokhyun Moon, Seungsu Kim, and Woo Youn Kim. Scaffold-based molecular design with a graph generative model. Chemical science, 11(4):1153– 1164, 2020.
+
+[54] Rafael Gómez-Bombarelli, Jennifer N Wei, David Duvenaud, José Miguel Hernández-Lobato, Benjamín Sánchez-Lengeling, Dennis Sheberla, Jorge Aguilera-Iparraguirre, Timothy D Hirzel, Ryan P Adams, and Alán Aspuru-Guzik. Automatic chemical design using a data-driven continuous representation of molecules. ACS central science, 4(2):268–276, 2018.
+
+[55] Vitali Nesterov, Mario Wieser, and Volker Roth. 3dmolnet: a generative network for molecular structures. arXiv preprint arXiv:2010.06477, 2020.
+[56] Gregor Simm, Robert Pinsler, and José Miguel Hernández-Lobato. Reinforcement learning for molecular design guided by quantum mechanics. In International Conference on Machine Learning, pages 8959–8969. PMLR, 2020.
+[57] Emiel Hoogeboom, Victor Garcia Satorras, Clément Vignac, and Max Welling. Equivariant diffusion for molecule generation in 3d. In International Conference on Machine Learning, pages 8867–8887. PMLR, 2022.
+[58] Lemeng Wu, Chengyue Gong, Xingchao Liu, Mao Ye, and Qiang Liu. Diffusion-based molecule generation with informative prior bridges. arXiv preprint arXiv:2209.00865, 2022.
+[59] Muhammed Shuaibi, Adeesh Kolluru, Abhishek Das, Aditya Grover, Anuroop Sriram, Zachary Ulissi, and C Lawrence Zitnick. Rotation invariant graph neural networks using spin convolutions. arXiv preprint arXiv:2106.09575, 2021.
+[60] Chia-Tche Chang, Bastien Gorissen, and Samuel Melchior. Fast oriented bounding box optimization on the rotation group so (3, r). ACM Transactions on Graphics (TOG), 30(5):1–16, 2011.
+[61] Jerome Eberhardt, Diogo Santos-Martins, Andreas F Tillack, and Stefano Forli. Autodock vina 1.2. 0: New docking methods, expanded force field, and python bindings. Journal of Chemical Information and Modeling, 61(8):3891–3898, 2021.
+[62] Alexey Onufriev, Donald Bashford, and David A Case. Exploring protein native states and large-scale conformational changes with a modified generalized born model. Proteins: Structure, Function, and Bioinformatics, 55(2):383–394, 2004.
+[63] Yong Duan, Chun Wu, Shibasish Chowdhury, Mathew C Lee, Guoming Xiong, Wei Zhang, Rong Yang, Piotr Cieplak, Ray Luo, Taisung Lee, et al. A point-charge force field for molecular mechanics simulations of proteins based on condensed-phase quantum mechanical calculations. Journal of computational chemistry, 24(16):1999–2012, 2003.
+[64] Araz Jakalian, Bruce L Bush, David B Jack, and Christopher I Bayly. Fast, efficient generation of high-quality atomic charges. am1-bcc model: I. method. Journal of computational chemistry, 21(2):132–146, 2000.
+[65] Harrison Green and Jacob D Durrant. Deepfrag: An open-source browser app for deep-learning lead optimization. Journal of chemical information and modeling, 61(6):2523–2529, 2021.
+
+A VD-GEN DETAILS
+
+Table 3: Symbol in VD-Gen.
+
+
Symbol
Meaning
P
the set of atoms in the pocket
Vr
the set of virtual particles (VPs) that are generated at the r-th round in Equilibrium
Wr
the set of virtual particles (VPs) that are generated at the r-th round in Refinement
G
the set of ground-truth atoms
the i-th pocket atom's type (one-hot)
the i-th pocket atom's coordinate
the i-th ground-truth atom's type (one-hot)
the i-th ground-truth atom's coordinate
the i-th VP's type (one-hot) at the r-th round in Equilibrium
the i-th VP's coordinate at the r-th round in Equilibrium
predicted atom type distribution of i-th VP at the r-th round
ai
The index of assigned target atom for the i-th VP
di
the predicted distance of the i-th and j-th VP pair at the r-th round
the ground-truth distance of the i-th and j-th VP pair
the predicted (ground-truth) distance of the i-th VP and the j-th pocket atom at the r-th round
the ground-truth distance of the i-th VP and the j-th pocket atom.
xr
the i-th VP's type (one-hot) at the r-th round in Refinement
yi
the i-th VP's coordinate at the r-th round in in Refinement
the pair representation of VP pair
the pair representation of VP pair at l-th layer
the pair representation of pocket atom pair
the pair representation of VP and pocket pair
the predicted probability distribution of "success or" not for VP
r
predicted probability of merging type of VP pair
n
the predicted atom number
Wi
The indices of VPs in the i-th cluster in Extraction
h
the node representation of VP
h
the node representation of VP at l-th layer
hV
the node representation of VP in Equilibrium
qV
the pair representation of VP pair in Equilibrium
hW
the node representation of VP in Refinement
94
the pair representation of VP pair in Refinement
hP
the node representation of pocket atom
0eq
the model parameter in Equilibrium
0ex
the model parameter in Extraction
0re
the model parameter in Refinement
0co
the model parameter in Confidence
f
the SE(3) backbone model, return VP types and coordinates
L
the number of layers
+
+# A.1 VIRTUAL DYNAMICS
+
+# A.1.1 DETAILS OF THE BACKBONE MODEL
+
+In Fig 2 we show the structure of our backbone model, "Repr.", "Attn." and "Dist." are the abbreviations of "Representation", "Attention" and "Distance", respectively. On the left is the pocket encoder, which first uses an atom-type embedding to encode the pocket atom type and a Gaussian kernel to encode the pair-wise distances between pocket atom pairs. In each layer of the pocket encoder, a self-attention layer is used. On the right is the VP encoder, which also uses an atom-type embedding and a Gaussian kernel to encode the particle type and the pair-wise distances between VPs. To interact with the pocket encoder, another Gaussian kernel is used to encode the pair-wise distances between VPs and pocket atoms. In each layer of the VP encoder, before the self-attention layer, a particle-pocket attention layer is used to interact with the pocket encoder.
+
+We describe the components in the backbone model in the following paragraphs. Besides, we also describe the overall pipeline of the backbone model in the Alg. 2. For simplicity, layer normalization is not shown in the equations and algorithms.
+
+Gaussian kernel The pair-type aware Gaussian kernel [59; 28] is denoted as:
+
+$$
+p _ { i j } = \{ \mathcal { G } ( A ( d _ { i j } , t _ { i j } ; a , b ) , \mu ^ { k } , \sigma ^ { k } ) | k \in [ 1 , D ] \} , \quad \mathcal { A } ( d , r ; a , b ) = a _ { r } d + b _ { r } ,
+$$
+
+where $\begin{array} { r } { \mathcal { G } ( d , \mu , \sigma ) = \frac { 1 } { \sigma \sqrt { 2 \pi } } e ^ { - \frac { ( d - \mu ) ^ { 2 } } { 2 \sigma ^ { 2 } } } } \end{array}$ is a Gaussian density function with parameters $\mu$ and $\sigma , d _ { i j }$ is the Euclidean distance of atom pair $i j$ , and $t _ { i j }$ is the pair-type of atom pair $i j$ . $\mathcal { A } ( d _ { i j } , t _ { i j } ; \pmb { a } , \pmb { b } )$ is the affine transformation with parameters $\textbf { \em a }$ and $^ { b }$ , it affines $d _ { i j }$ corresponding to its pair-type $t _ { i j }$ .
+
+Pair representation Pair representation [28] is used to further enhance the 3D spatial encoding.
+The update of pair representation is via the multi-head Query-Key product results in self-attention.
+
+$$
+{ \pmb q } _ { i j } ^ { l + 1 } = { \pmb q } _ { i j } ^ { l } + \{ \frac { { \pmb h } _ { i } ^ { l } { \pmb W } _ { l , h } ^ { Q } ( { \pmb h } _ { j } ^ { l } { \pmb W } _ { l , h } ^ { K } ) ^ { T } } { \sqrt { d } } | h \in [ 1 , H ] \} ,
+$$
+
+where $h _ { i } ^ { l }$ is the atom/node representation of the $i$ -th atom at $l$ -th layer, $\pmb { q } _ { i j } ^ { l }$ is the pair representation of atom pair $i j$ in $l$ -th layer, $H$ is the number of attention heads, $d$ is the dimension of hidden representations, and $W _ { l , h } ^ { Q } ( W _ { l , h } ^ { K } )$ is the projection for Query (Key) of the $l$ -th layer $h$ -th head.
+
+To leverage 3D information in the atom representation, pair representation is used in self-attention.
+
+$$
+\begin{array} { r l } & { \pmb { h } _ { i } ^ { l + 1 , h } = \mathrm { s o f t m a x } ( \frac { h _ { i } ^ { l } W _ { l , h } ^ { Q } ( h _ { j } ^ { l } W _ { l , h } ^ { K } ) ^ { T } } { \sqrt { d } } + \pmb { q } _ { i j } ^ { l , h } ) \pmb { h } _ { j } ^ { l } W _ { l , h } ^ { V } , } \\ & { \quad \pmb { h } _ { i } ^ { l + 1 } = \mathrm { c o n c a t } _ { h } ( \pmb { h } _ { i } ^ { l + 1 , h } ) , } \end{array}
+$$
+
+where ${ W } _ { l , h } ^ { V }$ is the projection of Value of the $l$ -th layer $h$ -th head.
+
+Particle-Pocket Attention The Particle-Pocket Attention can be denoted as the following:
+
+$$
+\begin{array} { r l } & { { \pmb h } _ { i } ^ { l + 1 , h } = \mathrm { s o f t m a x } ( \frac { h _ { i } ^ { l } { \pmb W } _ { l , h } ^ { P , Q } ( { \pmb h } _ { j } ^ { P } { \pmb W } _ { l , h } ^ { P , K } ) ^ { T } } { \sqrt { d } } + { \pmb q } _ { i j } ^ { C , l , h } ) { \pmb h } _ { j } ^ { P } { \pmb W } _ { l , h } ^ { P , V } , } \\ & { { \pmb h } _ { i } ^ { l + 1 } = \mathrm { c o n c a t } _ { h } ( { \pmb h } _ { i } ^ { l + 1 , h } ) , } \\ & { { \pmb h } _ { i } ^ { l + 1 } = { \pmb h } _ { i } ^ { l } + g _ { 1 } \cdot { \pmb h } _ { i } ^ { l + 1 } + g _ { 2 } \cdot \mathrm { { M L P } } ( { \pmb h } _ { i } ^ { l + 1 } ) , } \end{array}
+$$
+
+where $g _ { 1 }$ and $g _ { 2 }$ are learned parameters with initialized value 0, $h _ { j } ^ { P }$ is the representation of the $j$ -th pocket atom, qC,ij $\mathbf { \mathfrak { q } } _ { i j } ^ { C , l , h }$ is the pair representation of particle-pocket pair $i j$ in $l$ -th layer $h$ -th head, MLP is a full-connected network with one hidden layer. W P,Ql,h , W P,Kl,h , and W P,Vl,h are learnable projections for Query, Key and Value.
+
+SE(3)-equivariance coordinate Following [28], the head could be denoted as:
+
+$$
+\pmb { y } _ { i } ^ { r + 1 } = \pmb { y } _ { i } ^ { r } + \sum _ { j = 1 } ^ { n } \frac { ( \pmb { y } _ { i } ^ { r } - \pmb { y } _ { j } ^ { r } ) z _ { i j } } { n } , \quad z _ { i j } = \mathrm { R e L U } ( ( \pmb { q } _ { i j } ^ { L } - \pmb { q } _ { i j } ^ { 0 } ) U _ { 1 } ) U _ { 2 } ,
+$$
+
+where $n$ is the number of total atoms, $L$ is the number of layers in model, $\pmb { y } _ { i } ^ { r } \in \mathbb { R } ^ { 3 }$ is the input coordinate of $i$ -th atom, and $\pmb { y } _ { i } ^ { r + 1 } \in \mathbb { R } ^ { 3 }$ is the output coordinate of $i$ -th atom, $U _ { 1 } \in \mathbb { R } ^ { H \times H }$ and $U _ { 2 } \in \mathbb { R } ^ { H \times 1 }$ are the projection matrices to convert pair representation to scalar.
+
+Atom Type Prediction Head We use a non-linear head with two layers to predict the atom type based on the atom representation in the last layer of the particle encoder:
+
+$$
+\bar { \mathbf { x } } _ { i } = \mathbf { M L P } ( h _ { i } ^ { L } )
+$$
+
+where $ { \boldsymbol { h } } _ { i } ^ { L }$ is the atom representation, $L$ is the number of layers of the particle encoder,
+
+# Algorithm 2 Backbone_Update
+
+Require: P: pocket atoms, ${ \mathbf V } _ { r }$ : virtual particles
+1: ${ \boldsymbol { h } } ^ { P , 0 } \gets$ rAtom_Type_Embedding $( \mathbf { P } )$ a ▷ Embeddings from atom types
+2: $\pmb q ^ { P , 0 } \gets$ Gaussian_Kernel(Dist_Matrix(P, P)) ▷ Get invariant spatial positional embedding
+3: for $l \in [ 1 , . . . , L )$ do ▷ Update Pocket Encoder
+4: $\pmb { h } ^ { P , l } , \pmb { q } ^ { P , l } \gets \mathrm { S e l f \_ A t t n } ( \pmb { h } ^ { P , l - 1 } , \pmb { q } ^ { P , l - 1 } ) )$ ▷ Update by self attention
+5: $\boldsymbol { h } ^ { P , l } \gets \mathrm { M L P } ( \boldsymbol { h } ^ { P , l } )$ ▷ Update by Feed-Forward-Network
+6: ${ h ^ { P } h ^ { P , L } }$
+7: ${ \mathbf { } } h ^ { 0 } $ Atom_Type_Embedding $\left( \mathbf { V } _ { r } \right)$ ▷ Embeddings from atom types
+8: $q ^ { 0 } \gets$ Gaussian_Kernel(Dist_Matrix(V0, V0)) $\triangleright$ Get invariant spatial positional embedding
+9: $\pmb q ^ { C , 0 } \gets$ Gaussian_Kernel(Dist_Matrix $( \mathbf { V } _ { 0 } , \mathbf { P } ) )$ ▷ Get invariant spatial positional embedding of
+particle-pocket pairs
+10: for $l \in [ 1 , . . . , L )$ do ▷ Update Particle Encoder
+11: $\pmb { h } ^ { l } , \pmb { q } ^ { l } \gets \mathrm { S e l f \_ A t t n } ( \pmb { h } ^ { l - 1 } , \pmb { q } ^ { l - 1 } ) )$ ▷ Update by self attention
+12: $\pmb { h } ^ { l } \gets \mathrm { M L P } ( \pmb { h } ^ { l } )$ ▷ Update by Feed-Forward-Network
+13: if l mod $4 = = 0$ then ▷ Only enabled at every 4-layer
+14: h l , $\pmb q ^ { C , l } \gets$ Particle_Pocket_Attn(hl, hP , qC,l−1)) ▷ Update by Particle-Pocket Attention
+15: $\bar { \pmb { x } } ^ { r + 1 } \mathrm { A t o m \_ T y p e \_ H e a d } ( \pmb { h } ^ { L } )$ $\triangleright$ Atom Type Prediction
+16: $\pmb { x } ^ { r + 1 } \mathrm { s a m p l e } ( \bar { \pmb { x } } ^ { r + 1 } )$ ▷ Sample an atom type based on predicted probability
+17: $\pmb { y } ^ { r + 1 } \gets \mathrm { S E } ( 3 ) \_ \mathrm { H e a d } ( \pmb { y } ^ { r } , \pmb { q } ^ { L } )$ $\triangleright$ Coordinate update
+18: return $\mathbf { V } _ { r + 1 } = \{ \pmb { x } ^ { r + 1 } , \pmb { y } ^ { r + 1 } \} , \pmb { h } ^ { L } , \pmb { q } ^ { L } , \pmb { h } ^ { P }$
+
+
+Figure 5: A case to show the detected pocket cavity.
+
+# A.1.2 POCKET CAVITY DISCOVERY
+
+Pocket cavity discovery is an essential component in ${ \tt V D - G e n }$ , as VPs need to scatter into the cavity. To find the pocket cavity, we first use OBB (oriented bounding box) [60] to determine a cubic box, denote as $\boldsymbol { B }$ , based on the pocket’s residue atoms. Then, we enlarge the box a little bit, increased by $4 \mathring \mathrm { A }$ . Then, we make the 3D grids with resolution $2 \textup { \AA }$ , for the whole protein, including the pocket, and mark the grids that contain protein atoms as "used". Then, starting from a given grid inside the cavity, a breadth-first search is used to find the grids inside the cavity. In particular, the grids marked as "used" or are not in $\boldsymbol { B }$ are not considered. We show an example in Fig 5, where the purple region indicates the pocket cavity we find.
+
+# A.2 EXTRACTION
+
+# Filtering Loss
+
+$$
+{ \mathcal { L } } _ { F i l t e r } = { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } { \mathrm { N L L } } ( { \bar { s } } _ { i } , s _ { i } )
+$$
+
+where $n$ is the number of virtual particles, $\bar { s } _ { i }$ is the predicted probability distribution of success or not, $\mathbf { \boldsymbol { s } } _ { i }$ is the target label. The target label is marked as "success" if the distances between VPs and their target positions after Equilibrium are smaller than $2 . 5 \mathring \mathrm { \ A }$ .
+
+# Merging Loss
+
+$$
+\mathcal { L } _ { M e r g e } = \frac { 1 } { l ^ { 2 } } \sum _ { i = 1 } ^ { l } \sum _ { j = 1 } ^ { l } \sum _ { k = 1 } ^ { 2 } - { r } _ { i j } ^ { k } \log \bar { { r } } _ { i j } ^ { k } \alpha _ { k } ( 1 - \bar { { r } } _ { i j } ^ { k } ) ^ { \gamma } ,
+$$
+
+where $l$ is the number of virtual particles predicted to be "success", $\boldsymbol { r } _ { i j }$ is the target merging type, $\bar { r } _ { i j }$ is the predicted probability of merging type, the blue part is from focal loss [32], and $\alpha _ { k }$ and $\gamma$ are
+
+hyper-parameters to balance classes. Here $\gamma$ is set to 2, the subscript 1 of $\alpha$ represents the True type and $\alpha _ { 1 }$ is set 10 while $\alpha _ { 0 }$ is set to 1.
+
+Atom number loss For atom number prediction, we bucket the number of atoms into different bins and transform the numerical problem into a classification problem to make the training more stable.
+
+$$
+\mathcal { L } _ { a t o m \_ n u m } = \mathrm { N L L } ( \bar { o } , o )
+$$
+
+where $\bar { \bf o }$ is the predicted probability distribution of bins, and $^ o$ represents the one-hot vector of the target bin.
+
+During inference, the predicted atomic number can be calculated from the predicted distribution over bins.
+
+$$
+\sum _ { k = 1 } ^ { n _ { b i n } } ( b i n _ { - } v a l _ { k } ) \bar { \pmb { o } } _ { k } ,
+$$
+
+where $b i n \_ v a l _ { k }$ is the bin value of the $k$ -th bin, $n _ { \mathrm { b i n } }$ is the number of bins, $l$ is the size of each bin and $\bar { o } _ { k }$ is the predicted probability of the $k$ -th bin. Notably, the bin value is not the bin boundary value, it is the average of left and right boundaries.
+
+Merge algorithm The detail of merging VPs into atoms are shown in Alg 3. In particular, a binary search is used to find a merging threshold. During training, teacher-forcing merging is used for reducing the training cost (without binary search). This is, rather than predicting pair-wise merge probabilities and the atom number, we directly used their ground truth values. During inference, the binary search is used. Besides, considering the error in atom number prediction, we try a range $( \pm 1 0 )$ of atom numbers, and select from them based on their confidence scores.
+
+# A.3 CONFIDENCE
+
+The confidence score is based on LDDT metric [33]:
+
+$$
+\begin{array} { l } { { \displaystyle { \mathrm { L D D T } } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \sum _ { j \neq i } \frac { 1 } { 4 } ( ( \operatorname { e r r } _ { i j } < 0 . 5 ) + ( \operatorname { e r r } _ { i j } < 1 . 0 ) + ( \operatorname { e r r } _ { i j } < 2 . 0 ) + ( \operatorname { e r r } _ { i j } ) < 4 . 0 ) , } } \\ { { \displaystyle \operatorname { e r r } _ { i j } = \mathrm { L } 1 ( \| \hat { y } _ { i } ^ { r } - \hat { y } _ { j } ^ { r } \| _ { 2 } , \| \hat { y } _ { i } ^ { g } - \hat { y } _ { j } ^ { g } \| _ { 2 } ) , } } \end{array}
+$$
+
+where $\hat { \mathbf { \pmb { y } } } _ { i } ^ { r }$ is the predicted coordinate of $i$ -th particle after Refinement, and $\hat { \pmb y } _ { i } ^ { g }$ is its ground truth coordinate. Then, a task is trained to predict the LDDT score. Here, we use the binning trick for training stability, bucketing the error of each VP into different bins, and using cross-entropy loss to train the task:
+
+$$
+{ \mathcal { L } } _ { C o n f i d e n c e } = { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } { \mathrm { N L L } } ( { \bar { e } } _ { i } , e _ { i } )
+$$
+
+where $\bar { e } _ { i }$ is the predicted error’s probability distribution of $i$ -th VP and $e _ { i }$ represents the one-hot vector of the real error.
+
+# A.4 PRETRAIN
+
+During pretraining, we remove atoms in a continuous spatial region, and VPs are initialized in the region. To find the atoms in a continuous region, we design a greedy algorithm. First, we initialize an empty atom set, then we randomly select an atom in the molecular to join the set. Starting from the atom set, we choose an atom closest to the atoms in the set and join it to the set. We repeat the process until the number of atoms in the set meets the requirements. And we use OBB (oriented bounding box) [60] to determine a cubic box by the removed atoms, and VPs are initialized inside the cubic box.
+
+# A.5 VD-GEN OVERALL ALGORITHM
+
+We also summarize the overall inference pipeline of VD-Gen in the Alg. 4. The algorithm mainly relies on the function "VD", which iteratively moves the VPs. Both Equilibrium and Refinement use
+
+# Algorithm 3 Filter_Merge_VPs
+
+
ability
Require: VR = {(xR,y)}ε=1: virtual particles at R-th rounds, n: the predicted atom num, r =
1: for iin [.,..,n] do 2:
Set the merge type between particles with the particle to be filtered to O
Si←argmax(si)
Get the filtering type
3:
if si=Othen
If the i-th particle should be filtered
4:
r[:,i]←0
Set{ri,j=1 to0 n
5:
r[i,:]←0
Set{rj=1to0 n
6:
high←max({((rij)}1,j=1) nxn
7: low ←min({(Tij)}²=i,j=1) nxn
8:mid ←low+high
9:
2 while low high do
>using the binary search to find the threshold
10:
Tij←rij >mid
11:
Wo↑,ω←[,m←0
12:
foriin random_perm(1,n) do
Greedy merge based a random order
13:
W←,
14:
for j in[1,..,n] do
15:
if rij= True then
the j-th particle should be merged
16:
r[:,j]←False
the merged particle will not be merged again
17:
Wi.add(j)
add the particle indices into the i-th cluster
18:
if len(wi)>O then
19:
> Sample atom type from the merging list
20:
m←Mean({ylk∈wi})
> the average position is atom position after merging
21:
Wo.add((xm,ym))
add the atom to the set
22:
m←m+1
Count the number of clusters
23:
if m=n then
find the threshold
24:
break
25:
else
26:
ifm<nthen
V too many particles are merged, the threshold needs to be increased
27:
low←mid
28:
else
29: return Wo
high ←mid
>Too few particles are merged, the threshold needs to be lowered
Return particle set after merging
+
+"VD". In Extraction, several heads are used to predict the filtered probability, the pair merge probability, and the number of atoms of the ligand molecule. Based on these predictions, "Filter_Merge_VPs" is used to extract the merged VPs.
+
+The training pipeline is very similar, except for the following differences:
+
+• For efficiency purposes, $R _ { 1 }$ and $R _ { 2 }$ are sampled during training, and the gradient backward is only enabled in the last round.
+• For efficiency purposes, in "Filter_Merge_VPs", teacher-forcing merging (without binary search) is used during training. This is, rather than predicting pair-wise merge probabilities and the atom number, we directly used their ground truth values.
+• The loss functions are enabled to get gradients to train models.
+
+# B EXPERIMENT DETAILS AND MORE RESULTS
+
+# B.1 TRAINING DETAILS
+
+The detailed configurations of VD-Gen are listed in Table 4. We did not tune these hyper-parameters for now, a better performance could be achieved with well-tuned hyper-parameters.
+
+# B.2 EVALUATION MERTIC
+
+• $3 D$ similarity. We use LIGSIFT [25] to calculate 3D similarity. However, by default, LIGSIFT will align the input molecules before calculating 3D similarity. But we want to evaluate the generated
+
+# Algorithm 4 VD-Gen Framework during Inference
+
+Require: $R _ { 1 }$ , $R _ { 2 }$ : max rounds in Equilibrium and Refinement, P: pocket atoms with types and positions, $_ n$ :
+number of VPs, $\pmb { \theta } _ { e q }$ , $\pmb { \theta } _ { e x }$ , $\pmb { \theta } _ { r e }$ , $\pmb { \theta } _ { c o }$ : model parameters in different stages
+1:
+2: # Virtual dynamics mechanism
+3: def $\mathrm { V D } ( R , { \bf V } _ { 0 } , { \bf P } , \theta )$ : ▷ Virtual dynamics mechanism
+4: for $k \in [ 1 , . . . , R ]$ do $\triangleright$ Iterative updates without gradients
+5: $\mathbf { V } _ { k } , h ^ { L } , q ^ { L } , h ^ { P } \longleftarrow \mathrm { B a c k b o n e \underline { { \mathbf { U } } } p d a t e } ( \mathbf { V } _ { k - 1 } , \mathbf { P } ; \theta )$ ▷ backbone model update as in Alg. 2
+return ${ \mathbf V } _ { R } , { \hbar } ^ { L } , { q } ^ { L } , { \hbar } ^ { P }$
+6:
+7: # Initialize VPs
+8: $\tilde { P } = \mathrm { C a v i t y \_ D i s c o v e r y } ( { \bf P } )$ ▷ Get the pocket cavity as in Appendix A.1.2
+9: for $i$ in [1,...,n] do
+10: $\pmb { x } _ { i } ^ { 0 } \gets \mathrm { o n e \_ h o t ( \mathrm { I M A S K } ] ) }$ ▷ The types of VPs are initialized as a meaningless [MASK] type
+11: ${ \pmb y } _ { i } ^ { 0 } \gets \mathrm { U n i f o r m } ( \tilde { P } )$ ▷ The initial coordinates of VPs are uniformly sampled from the cavity
+12: $\mathbf { V } _ { 0 } = \{ ( { \mathbf { x } } _ { i } ^ { 0 } , { \mathbf { y } } _ { i } ^ { 0 } ) \} _ { i = 1 } ^ { n }$
+13:
+14: # Equilibrium stage
+15: ${ \bf V } _ { R } \dot { \bf \Delta } _ { } h ^ { V } , \pmb { q } ^ { V } , \pmb { h } ^ { P ^ { \angle } } \nabla \mathrm { D } ( R _ { 1 } , { \bf V } _ { 0 } , { \bf P } , \pmb { \theta } _ { e q } )$ ▷ Predict coordinates and types with VD
+16:
+17: # Extraction stage
+18: $\bar { 3 } \mathrm { F i l t e r \_ H e a d } ( h ^ { V } ; \pmb \theta _ { e x } )$ ▷ Predict to filter the "not success" particles
+19: $\bar { r } \gets \mathsf { M e r g e \_ H e a d } ( \pmb { q } ^ { V } ; \pmb { \theta } _ { e x } )$ ▷ Predict merging matrix
+20: $\bar { n } \mathrm { A t o m \_ N u m \_ H e a d } ( h ^ { P } ; \pmb \theta _ { e x } )$ ▷ Predict the atom number
+21: ${ \bf W } _ { 0 } \gets \mathrm { F i l t e r \_ M e r g e \_ V P s } ( { \bf V } _ { R } , \bar { n } , \bar { r } , \bar { s } )$
+22: ▷ Filter and Merge VPs as in Alg. 3 using predicted merging matrix, atom number and filtering type
+23:
+24: # Refinement stage
+25: $\mathbf { W } _ { R } ^ { \check { \mathbf { \alpha } } } , \mathbf { \Phi } _ { } \mathbf { \Phi } _ { } \mathbf { \Phi } _ { } \mathbf { q } ^ { W } , \check { \mathbf { \alpha } } \check { h } ^ { P } \gets \mathrm { V D } ( R _ { 2 } , \mathbf { W } _ { 0 } , \mathbf { P } ; \mathbf { \theta } _ { r e } )$ ▷ Refine the coordinates and types
+26: # Confidence stage
+27: Pred_LDDT Confidence_Head(hW , θco) ▷ Predict LDDT
+28:
+29: return $\mathbf { W } _ { R }$ , Pred_LDDT ▷ Return the final positions and types, and the confidence score
+
+3D structure directly, to examine the end-to-end performance. Therefore, we remove the alignment in LIGSIFT.
+
+• Vina. We use AutoDock Vina1.2 [61] to get Vina score. In particular, the re-docking will be applied. That is, the binding pose and the conformation of the ligand molecule generated by the model will be ignored, and a new binding pose and a new molecular conformation will be re-calculated by AutoDock Vina1.2. We believe the re-docking in Vina cannot reflect the actual performance of the pocket-based 3D molecular generation. But to be consistent with previous works, we still use it as one of the metrics.
+
+• Vina\*. Vina\* is Vina without re-docking. In particular, we use the built-in energy optimization process based on Vina scoring function in AutoDock Vina1.2 [61] to minimize the energy of the binding pose of generated molecules, and then use the Vina scoring function to score the energy-minimized binding pose to get Vina\* score.
+
+• MM-PBSA. We take the default settings of parameters (i.e., solvation mode: GB-2[62], protein forcefield: amber03[63], ligand charge method: bcc[64], dielectric constant: 4.0) and workflow (i.e., force field building, structure optimization by energy minimization, MM/GB(PB)SA calculation) of [24] to calculate MM-PBSA score. Since the crystal structure indicates the preferred binding pose against a specific target, we filtered the generated molecules by 3D similarity to the molecule in crystal structure and take the molecules whose 3D similarity score is over 0.4 as effective molecules, and we only calculate the MM-PBSA score for the effective molecules. In Table 6 we show MM-PBSA S.R. (success rate), which calculates the proportion of effective MM-PBSA of the generated molecules. For MM-PBSA B.T. and MM-PBSA Rank we have:
+
+$$
+\begin{array} { r l } & { \displaystyle \mathbf { M M } \mathbf { \mathrm { \mathrm { - } P B S A } } \mathbf { \mathrm { B . T } } _ { - } = \frac { 1 } { n _ { p } } \displaystyle \sum _ { i = 1 } ^ { n _ { p } } \frac { \left| \left\{ g \in \mathcal { G } \big | \mathbf { M M } \mathbf { \mathrm { - } P B S A } ( g ) < \mathbf { M M } \mathbf { \mathrm { - } P B S A } ( \overline { { m } } _ { i } ) \right\} \right| } { | \mathcal { G } | } , } \\ & { \displaystyle \mathbf { M M } \mathbf { \mathrm { \mathrm { - } P B S A } } \mathbf { \mathrm { R a n k } } = \frac { 1 } { n _ { p } } \displaystyle \sum _ { i = 1 } ^ { n _ { p } } \mathbf { \mathrm { r a n k } } _ { i } , } \end{array}
+$$
+
+where $n _ { p }$ is the number of proteins in the test set, $\mathcal { G }$ represents the generated molecular set, $\overline { { m } } _ { i }$ represents the molecular in the crystal structure of the $i$ -th protein and $\mathrm { r a n k } _ { i }$ represents the ranking index of the current model among all of the compared models under the $i$ -th protein which is ranked by MM-PBSA.
+
+• Metric for ablation studies. We use 3D similarity between the generated molecules and the ground truth as the metric in ablation studies since it reflects the generative ability based on the pocket structure and there is a strong correlation between 3D similarity and binding affinity according to Table 1.
+
+Table 4: Settings for VD-Gen.
+
+
Pretrain
VP encoder layers Peak learning rate
12 1e-4
Batch size
128
Max training steps
1M
Warmup steps Attention heads
10K
FFN dropout
64
Attention dropout
0.1
Embedding dropout
0.1 0.1
Weight decay
1e-4
Embedding dim
512
FFN hidden dim Gaussian kernel channels
2048
Activation function
128
Learning rate decay
GELU Linear
Adams ∈
1e-6
Adams(βi, β2)
(0.9,0.99)
Gradient clip norm
1.0
Particle type prediction weight
1.0
Loss Weight forLvD of Equilibrium
1.0
Loss weight for LvD of Refinement
1.0
Loss weight for LFilter
1.0
Loss weight for LMerge Loss weight for Latom_num
5.0
Loss weight for Confidence
1.0
R,max round of iterative movement of Equilibrium and Refinement
1.0
numbers of virtual particles
4
T,the clip value for coordinate loss
8 ~ 9 times of the number of real atoms
δ,the threshold for coordinate regularization
2
Finetune
1
Batch size
Max training steps
64
R1,max round of iterative movement of Equilibrium
100K
4
R2,max round of iterative movement of Refinement
4
numbers of virtual particles Inference
16 ~18 times of the number of real atoms
R1,max round of iterativemovement of Equilibrium 4
R2,max round of iterative movement of Refinement
16
n,numbers of VPs
512
+
+# B.3 MORE RESULTS
+
+In Table 5, we report more percentile results for Vina, Vina\*. In Table 6, we report more percentile MM-PBSA results and MM-PBSA S.R. scores. The MM-PBSA S.R. scores in many baselines are very low. Thus, there are not enough effective MM-PBSA results to calculate percentile results in some baselines. Therefore, in each pocket, we replace the failed MM-PBSA result with the worst one generated by that baseline. And we calculated the percentile results after the replacement.
+
+Table 5: More results on Vina and Vina\*.
+
+
Model
5-th
10-th
25-th
50-th
Vina(↓)
Vina*(↓)
Vina(↓)
Vina*(↓)
Vina(↓)
Vina*(↓)
Vina(↓)
Vina*(↓)
LiGAN[17]
-6.724
-5.372
-6.324
-4.922
-5.740
-4.215
-5.065
-3.49
3DSBDD[18]
-8.662
-7.227
-8.296
-6.664
-7.557
-5.633
-6.474
-4.078
GraphBP[19]
-8.710
-3.689
-7.832
-2.774
-6.765
-1.169
-5.625
-1.2
Pocket2Mol[20]
-8.332
-6.525
-8.015
-5.399
-7.467
-3.513
-6.837
-1.808
VD-Gen
-9.047
-7.444
-8.652
-6.848
-7.958
-5.825
-7.146
-4.621
+
+Table 6: More MM-PBSA results.
+B.4 COMPARED WITH IMAGE GENERATION AND SOME EARLY ATTEMPTS
+
+
Model
5-th MM-PBSA(↓)
10-th MM-PBSA(↓)
25-th MM-PBSA(↓)
50-th MM-PBSA (↓)
MM-PBSA- S.R.(%↑)
LiGAN[17]
-17.865
-13.374
-8.775
-7.418
11.9
3DSBDD[18]
-30.221
-23.623
-13.544
-7.739
12.9
GraphBP[19]
-5.130
-4.894
-4.894
-4.894
0.2
Pocket2Mol[20]
-7.823
-5.945
-5.398
-5.398
1.8
VD-Gen
-51.258
-47.247
-39.984
-21.140
42.7
+
+
+Figure 6: Comparison for different training frameworks. "1:1 VD" is our early attempt, which is directly based on Virtual Dynamics, with 1:1 particle-atom assignment, and without the 4 stages in VD-Gen. The result indicates the effectiveness of the proposed VD-Gen framework.
+
+During inference, VD iteratively moves particles to more precious positions from random initialized positions. A similar idea of "coarse-to-fine" generation is widely used in image generative models, and images could be iteratively refined from noises.
+
+From this view, VD looks similar to the "coarse-to-fine" image generation. However, the training of VD is more challenging and very different from "coarse-to-fine" image generation.
+
+• In image generation, the training target for each pixel is straightforward to assign, since input pixels’ positions are the same as the ground-truth pixels’ position, i.e. there is a 1-to-1 mapping between input and ground-truth. For example, in an image with $3 2 \mathrm { x } 3 2 $ pixels, for an input pixel located at position $i , j$ , we can directly use the ground-truth pixel located at position $i , j$ as its training target. With the 1-to-1 assignment, the training of image generation is straightforward. • However, in the 3D molecular generation, the 1-to-1 assignment cannot simply be used, as the randomly initialized 3D positions of input particles are far different from the ground-truth atoms’ positions, so it is hard to have 1-to-1 mapping. Besides, the number of ground-truth atoms is unknown, which further increases the difficulty of 3D molecular generation.
+
+Table 7: Inference Efficiency.
+
+
Model
3DSBDD
GraphBP
Pocket2Mol
VD-Gen
Time(s)(↓)
14.153
1.660
3.476
3.678
+
+• In our early attempts, we also tried some 1-to-1 assignment methods (assuming the ground truth of the number of atoms is given). We first tried the random assignment, and found model training is hard to converge. We then optimized it by considering the total moving distance of all input particles in the target assignment. We call this method "1:1 VD", details are in the following paragraph. In particular, we assign each particle a unique target atom, by sub-optimal assignment (optimal assignment is NP-hard) to minimize the total moving distance. It is much better than random assignment, but the performance is still not good, and we think the reason is due to the large difficulty of the training task.
+
+• To further reduce the difficulty of the training task, we propose to use the many-to-1 assignment. That is, we first use many random-scattered particles to the pocket cavity, then for each particle, assign its nearest ground-truth atom as the training target. With this solution, the learning of movement is much easier, since particles only consider their nearest atoms. Besides, the unknown atom number is not a problem.
+
+• Besides, VD-Gen is not just VD. Simply using VD, we can only get a 3D density-like shape (formed by the positions of particles) of a 3D molecule. We may use some rule-based solutions, like clustering by distances, to extract 3D molecules from the shape. However, rule-based solutions are not end-to-end and could fail in various scenarios. To address this, we further propose VD-Gen, a more reliable framework with additional Extraction, Refinement and Confidence stages.
+
+1:1 VD In our early attempt, we tried a simple solution: use the same number of VPs as real atoms, and randomly scatter them; then, make an assignment so that each atom has a paired VP, and each VP has a paired atom. The optimal assignment with minimal moving distance is NP-hard, and we use a greedy algorithm to find a sub-optimal assignment. With the 1-to-1 assignment, the Extraction stage is not needed, since the number of VPs is the same as real atoms. We called this method "1:1 VD". For a fair comparison, pretraining is also used in "1:1 VD". We conduct the experiment to compare VD-Gen with "1:1 VD", the results are shown in Fig. 6. From the result, we find that VD-Gen largely outperforms "1:1 VD". Although its simplicity, the learning of "1:1 VD" is challenging, due to the ambiguous target assignment which violates the least action principle. As for VD-Gen, although it looks complicated with multiple stages, these stages are necessary for generating accurate 3D molecules end-to-end.
+
+# B.5 INFERENCE EFFICIENCY
+
+Experiment results have demonstrated the effectiveness of the proposed ${ \tt V D - G e n }$ , and we also check its efficiency here. In particular, we benchmark the inference speed of generating one molecule for 3DSDBB, GraphBP, Pocket2Mol, and our VD-Gen. The results are summarized the Table 7. 3DSBDD is the slowest one, due to the inefficient MCMC sampling. Although GraphBP is the fastest one, its generated molecules are the worst. VD-Gen and Pocket2Mol are similar in efficiency. But VD-Gen significantly outperforms Pocket2Mol in effectiveness. Due to the large number of VPs and several movement rounds, it is expected that VD-Gen is not the fastest one. We leave the efficiency improvement to future work.
+
+# B.6 ILLUSTRATION OF VPS’ MOVEMENT
+
+We show an example of VPs’ spatial position during the inference of VD-Gen in Fig 7. In the initial stage, the coordinates of VPs are randomly initialized. In Equilibrium stage, with the increase of movement rounds $\mathrm { { . 1 \sim 4 } }$ , VPs gradually gather together. Then in Extraction stage, after clustering, fewer VPs are extracted from gathered VPs. Then in Refinement stage, the extracted VPs continue the iterative movement, toward positions with better pLDDT scores.
+
+
+Figure 7: An example to show how the VPs moves at each iteration in Equilibrium and Refinement, r indicates the moving iterations and pLDDT can reflect the change of coordinates.
+
+Table 8: Training on CrossDocked Dataset.
+
+
Model
LiGAN
3DSBDD
GraphBP
Pocket2Mol
VD-Gen
3D Similarity(↑)
0.356
0.365
0.333
0.352
0.39
+
+# B.7 TRAINING ON THE CROSSDOCKED DATASET
+
+Since the baselines use the cross-docked dataset as training data, to analyze our model effect without pretrain, we conduct experiments on the cross-docked dataset. Results are shown in Table 8. We can see VD-Gen achieves 3D similarity with 0.39, outperforming other baselines. Besides, compared to VD-Gen with particle encoder pertaining in Table 2, the performance of using the cross-docked dataset is worse (0.39 v.s. 0.402). This result also indicates that pretraining is better than data augmentation in the cross-docked dataset.
+
+# B.8 MOLECULAR OPTIMIZATION TASK
+
+
+Figure 8: Extending VD-Gen to molecular optimization.
+
+Difference in training molecular optimization models To train the molecular optimization model, we make the following changes.
+
+• The remove ratio in pretraining is much smaller, only $2 5 \%$ to $40 \%$ are removed.
+• Rather than removing the whole molecule, during finetuning, only $2 5 \%$ to $40 \%$ of atoms are removed, like the pretraining.
+• During training, the number of VPs is also much smaller, only 8 times of the real atoms.
+• The VPs are not scattered in the whole pocket cavity, but scattered around the removed atoms.
+
+Experiment We compare our model with a traditional molecular fragments optimization model DeepFrag [65]. DeepFrag can replace molecular fragments based on SMILES, which is a 1D model without pocket information. The results are shown in Table 9 and Table 10. From them, it is clear that VD-Gen can outperform the baseline in molecular optimization.
+
+Table 9: Full percentile results on Vina and Vina\*, in molecular optimization tasks.
+
+
Model
5-th
10-th
25-th
50-th
Vina(↓)
Vina*(↓)
Vina(↓)
Vina*(↓)
Vina(↓)
Vina*(↓)
Vina(↓)
Vina*(↓)
DeepFrag[65]
-8.357
1
-8.132
-
-7.775
-
-7.372
1
VD-Gen
-9.040
-8.30
-8.775
-8.020
-8.333
-7.507
-7.880
-6.946
+
+Table 10: Full percentile results on MM-PBSA, in molecular optimization tasks.
+
+
Model
5-th MM-PBSA(↓)
10-th MM-PBSA(↓)
25-th MM-PBSA(↓)
50-th MM-PBSA (↓)
MM-PBSA B.T.(↑)
DeepFrag[65]
-51.783
-48.959
-39.786
-34.485
23.9
VD-Gen
-53.799
-52.120
-46.707
-41.788
38.3
\ No newline at end of file
diff --git a/md/dev/taQ64d2KBX/taQ64d2KBX.md b/md/dev/taQ64d2KBX/taQ64d2KBX.md
new file mode 100644
index 0000000000000000000000000000000000000000..88d2ff223629301b071304977be469375df36d5c
--- /dev/null
+++ b/md/dev/taQ64d2KBX/taQ64d2KBX.md
@@ -0,0 +1,530 @@
+# Learning Dynamical Systems from Noisy Data with Inverse-Explicit Integrators
+
+Anonymous Author(s)
+Affiliation
+Address
+email
+
+# Abstract
+
+1 We introduce the mean inverse integrator (MII), a novel approach to increase the
+2 accuracy when training neural networks to approximate vector fields of dynamical
+3 systems from noisy data. This method can be used to average multiple trajectories
+4 obtained by numerical integrators such as Runge–Kutta methods. We show that the
+5 class of mono-implicit Runge–Kutta methods (MIRK) has particular advantages
+6 when used in connection with MII. When training vector field approximations,
+7 explicit expressions for the loss functions are obtained when inserting the training
+8 data in the MIRK formulae, unlocking symmetric and high order integrators that
+9 would otherwise be implicit for initial value problems. The combined approach
+10 of applying MIRK within MII yields a significantly lower error compared to the
+11 plain use of the numerical integrator without averaging the trajectories. This is
+12 demonstrated with experiments using data from several (chaotic) Hamiltonian
+13 systems. Additionally, we perform a sensitivity analysis of the loss functions under
+14 normally distributed perturbations, supporting the favourable performance of MII.
+
+# 15 1 Introduction
+
+16 Recently, many deep learning methodologies have been introduced to increase the efficiency and
+17 quality of scientific computations [1, 2, 3, 4]. In physics-informed machine learning, deep neural
+18 networks are purposely built so to enforce physical laws. As an example, Hamiltonian neural networks
+19 (HNNs) [5] aim at learning the Hamiltonian function from temporal observations. The Hamiltonian
+20 formalism was derived within classical mechanics for modelling a wide variety of physical systems.
+21 The temporal evolution of such systems is fully determined when the Hamiltonian function is known,
+22 and it is characterized by geometric properties such as the preservation of energy, the symplectic
+23 structure and the time-reversal symmetry of the flow [6, 7].
+24 Numerical integrators that compute solutions preserving such properties are studied in the field of
+25 geometric numerical integration $\boxed { 7 } \boxed { 8 } \boxed { }$ . Thus, deep learning, classical mechanics and geometric
+26 numerical integration are all relevant to the development of HNNs. In this work, we try to identify
+27 the optimal strategy for using numerical integrators when constructing loss functions for HNNs that
+28 are trained on noisy and sparse data.
+29 Generally, we aim at learning autonomous systems of first-order ordinary differential equations
+30 (ODE)
+
+$$
+{ \frac { d } { d t } } y = f ( y ( t ) ) , \quad y : [ 0 , T ] \to \mathbb { R } ^ { n } .
+$$
+
+31 In the traditional setting, solving an initial value problem (IVP) means computing approximated
+32 solutions $y _ { n } \approx y ( t _ { n } )$ when the vector field $f ( y )$ and an initial value $y ( t _ { 0 } ) \stackrel { = } { = } y _ { 0 }$ are known. The
+33 focus of our study is the corresponding inverse problem; assuming knowledge of multiple noisy
+34 samples of the solution, $S _ { N } = \{ \tilde { y } _ { n } \} _ { n = 0 } ^ { N }$ , the aim is to approximate the vector field $f$ with a neural
+
+35 network model $f _ { \theta }$ . We will assume that the observations originate from a (canonical) Hamiltonian system, with a Hamiltonian 36 $H : \mathbb { R } ^ { 2 d } \mathbb { R }$ , where the vector field is given by
+
+$$
+f ( y ) = J \nabla H ( y ( t ) ) , \quad J : = \left[ \begin{array} { l l } { 0 } & { I } \\ { - I } & { 0 } \end{array} \right] \in \mathbb { R } ^ { 2 d \times 2 d } .
+$$
+
+37 This allows for learning the Hamiltonian function directly by setting $f _ { \theta } ( y ) = J \nabla H _ { \theta } ( y )$ , as proposed
+38 initially in $ { \mathbb { I } } ^ { { \left[ 5 \right] } }$ .
+39 Recently, many works highlight the benefit of using symplectic integrators when learning Hamiltonian
+40 neural networks [9, 10, 11, 12]. Here, we study what happens if, instead of using symplectic methods,
+41 efficient and higher-order MIRK methods are applied for inverse problems. We develop different
+42 approaches and apply them to learn highly oscillatory and chaotic dynamical systems from noisy data.
+43 The methods are general, they are not limited to separable Hamiltonian systems, and could indeed be
+44 used to learn any first-order ODE. However we focus our study on Hamiltonian systems, in order to
+45 build on the latest research on HNNs. Specifically, we compare our methods to the use of symplectic
+46 integrators to train Hamiltonian neural networks. Our contributions can be summarized as follows:
+
+• We introduce the mean inverse integrator (MII), which efficiently averages trajectories of MIRK methods in order to increase accuracy when learning vector fields from noisy data (Definition 5.1).
+• We present an analysis of the sensitivity of the loss function to perturbations giving insight into when the MII method yields improvement over a standard one-step scheme (Theorem 5.2).
+• We show that symplectic MIRK methods have at most order $p = 2$ (Theorem $\textcircled { 4 . 4 }$ . Particularly, the second-order implicit midpoint method is the symplectic MIRK method with minimal number of stages.
+
+56 Finally, numerical experiments on several Hamiltonian systems benchmark MII against one-step
+57 training and symplectic recurrent neural networks (SRNN) $\mathbb { \ m }$ , which rely on the Störmer–Verlet
+58 integrator. The structural difference between these three approached is presented in Figure $\mathscr { L }$ Ad
+59 ditionally, we demonstrate that substituting Störmer–Verlet with the classic Runge–Kutta method
+60 (RK4) in the SRNN framework yields significant reduction in error and allows accurate learning of
+61 non-separable Hamiltonian systems.
+
+# 62 2 Related work
+
+63 Hamiltonian neural networks was introduced in [5]. The numerical integration of Hamiltonian ODEs
+64 and the preservation of the symplectic structure of the ODE flow under numerical discretization
+65 have been widely studied over several decades [8, 7]. The symplecticity property is key and could
+66 inform the neural network architecture $\mathbb { \lVert \lambda \rVert }$ or guide the choice of numerical integrator, yielding a
+67 theoretical guarantee that the learning target is actually a (modified) Hamiltonian vector field [14, 9],
+68 building on the backward error analysis framework $\pmb { \mathbb { B } } ] \mathbf { l }$ . Discrete gradients is an approach to numerical
+69 integration that guarantees exact preservation of the (learned) Hamiltonian, and an algorithm for
+70 training Hamiltonian neural networks using discrete gradient integrators is developed in $\mathbb { \lVert 1 5 \rVert }$ and
+71 extended to higher order in $\mathbb { \left[ \left[ 1 6 \right] \right] }$ .
+72 Since we for the inverse problem want to approximate the time-derivative of the solution, $f$ , using
+73 only ${ \tilde { y } } _ { n }$ , we need to use a numerical integrator when specifying the neural network loss function.
+74 For learning dynamical systems from data, explicit methods such as RK4 are much used $\boxed { 5 } \boxed { 1 7 } \boxed { 1 8 }$ .
+75 However, explicit methods cannot in general preserve time-symmetry or symplecticity, and they often
+76 have worse stability properties compared to implicit methods [19]. Assuming that the underlying
+77 Hamiltonian is separable allows for explicit integration with the symplectic Störmer–Verlet method,
+78 which is exploited in $\mathbb { n o , 2 o }$ . Symplecticity could be achieved without the limiting assumption
+79 of separability by training using the implicit midpoint method $[ \mathbb { 1 2 } ]$ . As pointed out in $\mathbb { \lVert 1 2 \rVert }$ , this
+80 integrator could be turned into an explicit method in training by inserting sequential training data ${ \tilde { y } } _ { n }$
+81 and $\tilde { y } _ { n + 1 }$ . In fact, the MIRK class $\pm 2 1 1 2 2 1 1$ contains all Runge–Kutta (RK) methods (including the
+82 midpoint method) that could be turned into explicit schemes when inserting the training data. This
+83 is exploited in $\dot { \left[ \left| 2 3 \right| \right] }$ , where high-order MIRK methods are used to train HNNs, achieving accurate
+84 interpolation and extrapolation of a single trajectory with large step size, few samples and assuming
+85 zero noise.
+86 The assumption of noise-free data limits the potential of learning from physical measurements
+87 or applications on data sets from industry. This issue is addressed in $\mathbb { m }$ , presenting symplectic
+88 recurrent neural networks (SRNN). Here, Störmer–Verlet is used to integrate multiple steps and is
+89 combined with initial state optimization (ISO) before computing the loss. ISO is applied after training
+90 $f _ { \theta }$ a given number of epochs and aims at finding the optimal initial value $\hat { y } _ { 0 }$ , such that the distance
+91 to the subsequent observed points $\tilde { y } _ { 1 } , \dots , \tilde { y } _ { N }$ is minimized when integrating over $f _ { \theta }$ . While $\mathbb { \ m }$ i s
+92 limited by only considering separable systems, $\mathbb { \left[ \left[ 2 4 \right] \right] }$ aims at identifying the optimal combination of
+93 third order polynomial basis functions to approximate a cubic non-separable Hamiltonian from noisy
+94 data, using a Bayesian framework.
+
+# 95 3 Background on numerical integration
+
+96 Some necessary and fundamental concepts on numerical integration and the geometry of Hamiltonian
+97 systems are presented below to inform the discussion on which integrators to use in inverse problems.
+98 Further details could be found in Appendix C.
+99 Fundamental concepts: An important subclass of the general first-order ODEs $( 1 )$ is the class of
+100 Hamiltonian systems, as given by $( 2 )$ . Often, the solution is partitioned into the coordinates $y ( t ) =$
+101 $[ q ( t ) , p ( t ) ] ^ { T }$ , with $q ( t ) , p ( t ) \in { \mathbb { R } } ^ { d }$ . A separable Hamiltonian system is one where the Hamiltonian
+102 could be written as the sum of two scalar functions, often representing the kinetic and potential
+103 energy, that depend only on $q$ and $p$ respectively, this means we have $H ( q , p ) = H _ { 1 } ( q ) + H _ { 2 } ( p )$ .
+
+The 104 $h$ flow of an ODE is a map $\varphi _ { h , f } : \mathbb { R } ^ { n } \mathbb { R } ^ { n }$ sending an initial value $y ( t _ { 0 } )$ to the solution 105 of the ODE at time $t _ { 0 } + h$ , given by $\varphi _ { h , f } ( y ( t _ { 0 } ) ) : = y ( t _ { 0 } + h )$ . A numerical integration method 106 $\Phi _ { h , f } : \mathbb { R } ^ { n } \mathbb { R } ^ { n }$ is a map approximating the exact flow of the ODE, so that
+
+$$
+y ( t _ { 1 } ) \approx y _ { 1 } = \Phi _ { h , f } ( y _ { 0 } ) .
+$$
+
+107 Here, $y ( t _ { n } )$ represents the exact solution and we denote with $y _ { n }$ the approximation at time $t _ { n } =$
+108 $t _ { 0 } + n h$ . It should be noted that the flow map satisfies the following group property:
+
+$$
+\begin{array} { r } { \varphi _ { h _ { 1 } , f } \circ \varphi _ { h _ { 2 } , f } \bigl ( y ( t _ { 0 } ) \bigr ) = \varphi _ { h _ { 1 } , f } \bigl ( y ( t _ { 0 } + h _ { 2 } ) \bigr ) = \varphi _ { h _ { 1 } + h _ { 2 } , f } \bigl ( y ( t _ { 0 } ) \bigr ) . } \end{array}
+$$
+
+109 In other words, a composition of two flows with step sizes $h _ { 1 } , h _ { 2 }$ is equivalent to the flow map over $f$
+110 with step size $h _ { 1 } + h _ { 2 }$ . This property is not shared by numerical integrators for general vector fields.
+111 The order of a numerical integrator $\Phi _ { h , f }$ characterizes how the error after one step depends on the
+112 step size $h$ and is given by the integer $p$ such that the following holds:
+
+$$
+\left\| y _ { 1 } - y ( t _ { 0 } + h ) \right\| = \| \Phi _ { h , f } ( y _ { 0 } ) - \varphi _ { h , f } ( y ( t _ { 0 } ) ) \| = \mathcal { O } ( h ^ { p + 1 } ) .
+$$
+
+113 Mono-implicit Runge–Kutta methods: Given vectors $b , v \in \mathbb { R } ^ { s }$ and a strictly lower triangular
+114 matrix $D \in \mathbb { R } ^ { s \times s }$ , a MIRK method is a Runge–Kutta method where $A = D + v \dot { b } ^ { T } \mathbb { \lVert } 2 5 \mathbb { , } \mathbb { \lVert } 2 6 \rVert$ and we
+115 assume that $[ A ] _ { i j } = a _ { i j }$ is the stage-coefficient matrix. This implies that the MIRK method can be
+116 written on the form
+
+$$
+\begin{array} { c } { { y _ { n + 1 } = y _ { n } + h \displaystyle \sum _ { i = 1 } ^ { s } b _ { i } k _ { i } , } } \\ { { { } } } \\ { { k _ { i } = f \big ( y _ { n } + v _ { i } ( y _ { n + 1 } - y _ { n } ) + h \displaystyle \sum _ { j = 1 } ^ { s } d _ { i j } k _ { j } \big ) . } } \end{array}
+$$
+
+117 Specific MIRK methods and further details on Runge–Kutta schemes is discussed in Appendix C.2.
+
+118 Symplectic methods: The flow map of a Hamiltonian system is symplectic, meaning that its Jacobian
+119 $\begin{array} { r } { \dot { \Upsilon _ { \varphi } } : = \frac { \partial } { \partial y } \varphi _ { h , f } ( y ) } \end{array}$ satisfies $\Upsilon _ { \varphi } ^ { T } J \Upsilon _ { \varphi } = J$ , where $J$ is the same matrix as in $\textcircled { 2 }$ . As explained in $\mathbb { B } ,$ Ch.
+120 VI.2], this is equivalent to the preservation of a projected area in the phase space of $[ q , p ] ^ { T }$ . Similarly,
+121 a numerical integrator is symplectic if its Jacobian ⌥ := @@yn $\begin{array} { r } { \Upsilon _ { \Phi } : = \frac { \partial } { \partial y _ { n } } \Phi _ { h , f } ( y _ { n } ) } \end{array}$ satisfies $\Upsilon _ { \Phi } ^ { T } J \Upsilon _ { \Phi } = J$ . It is
+122 possible to prove $\mathbb { B } ,$ Ch. VI.4] that a Runge–Kutta method is symplectic if and only if the coeffients
+123 satisfy
+
+$$
+b _ { i } a _ { i j } + b _ { j } a _ { j i } - b _ { i } b _ { j } = 0 , \quad i , j = 1 , \ldots , s .
+$$
+
+125 We will now consider different ways to use numerical integrators when training Hamiltonian neural
+126 networks and present important properties of MIRK methods, a key component of the MII that is
+127 presented in Chapter 5.
+128 Inverse ODE problems in Hamiltonian form: We assume to have potentially noisy samples
+129 $S _ { N } = \{ \tilde { y } \} _ { n = 0 } ^ { N }$ of the solution of an ODE with vector field $f$ . The inverse problem can be formulated
+130 as the following optimization problem:
+
+$$
+\underset { \theta } { \arg \operatorname* { m i n } } \sum _ { n = 0 } ^ { N - 1 } \bigg \| \tilde { y } _ { n + 1 } - \Phi _ { h , f _ { \theta } } ( \tilde { y } _ { n } ) \bigg \| ,
+$$
+
+131 where $\begin{array} { r l r } { f _ { \theta } } & { { } = } & { J \nabla H _ { \theta } } \end{array}$ is a neural network approximation with parameters $\theta$ of a Hamiltonian vector field 132 $f$ , and $\Phi _ { h , f _ { \theta } }$ is a one-step integration method with step length $h$
+
+133 In the setting of inverse ODE problems, the availabil
+134 ity of sequential points $S _ { N }$ could be exploited when
+135 a numerical method is used to form interpolation
+136 conditions, for $f _ { \theta } \approx f$ for each $n$ in the optimiza
+137 tion problem $\textcircled{6}$ . For example, ${ \tilde { y } } _ { n }$ and $\tilde { y } _ { n + 1 }$ could
+138 be inserted in the implicit midpoint method, turning
+139 a method that is implicit for IVPs into an explicit
+140 method for inverse problems:
+
+$$
+\Phi _ { h , f _ { \theta } } ( \tilde { y } _ { n } , \tilde { y } _ { n + 1 } ) = \tilde { y } _ { n } + h f _ { \theta } \big ( \frac { \tilde { y } _ { n } + \tilde { y } _ { n + 1 } } { 2 } \big ) .
+$$
+
+141 We denote this as the inverse injection, which defines
+142 an inverse explicit property for numerical integrators.
+
+Definition 4.1 (Inverse injection). Assume that $\tilde { y } _ { n } , \tilde { y } _ { n + 1 } \in \ S _ { N }$ . Let the inverse injection for the integrator $\Phi _ { h , f } \mathopen { } \mathclose \bgroup \left( y _ { n } , y _ { n + 1 } \aftergroup \egroup \right)$ be given by the substitution $( { \tilde { y } } _ { n } , { \tilde { y } } _ { n + 1 } ) ( y _ { n } , y _ { n + 1 } )$ such that
+
+
+Figure 1: Venn diagram of Runge–Kutta (RK) subclasses: explicit RK (ERK), symplectic RK (SympRK), mono-implicit RK (MIRK) and symmetric RK (SymRK).
+
+$$
+\hat { y } _ { n + 1 } = \Phi _ { h , f } ( \tilde { y } _ { n } , \tilde { y } _ { n + 1 } ) .
+$$
+
+143 Definition 4.2 (Inverse explicit). A numerical one-step method $\Phi$ is called inverse explicit if it is
+144 explicit under the inverse injection.
+145 This procedure is utilized successfully by several authors when learning dynamical systems from
+146 data, see e.g. $\mathbb { \oplus 1 2 , \bigstar \bigstar }$ . However, this work is the first attempt at systematically exploring numerical
+147 integrators under the inverse injection, by identifying the MIRK methods as the class consisting of
+148 inverse explicit Runge–Kutta methods.
+
+149 Proposition 4.3. MIRK-methods are inverse explicit.
+
+150 Proof. Since the matrix $D$ in $( 4 )$ is strictly lower triangular, the stages are given by
+
+$$
+\begin{array} { l } { { k _ { 1 } = f \big ( y _ { n } + v _ { i } \big ( y _ { n + 1 } - y _ { n } \big ) \big ) } } \\ { { k _ { 2 } = f \big ( y _ { n } + v _ { i } \big ( y _ { n + 1 } - y _ { n } \big ) + h d _ { 2 1 } k _ { 1 } \big ) } } \\ { { \ } } \\ { { \quad \vdots } } \\ { { k _ { s } = f \big ( y _ { n } + v _ { i } \big ( y _ { n + 1 } - y _ { n } \big ) + h \displaystyle \sum _ { j = 1 } ^ { s - 1 } d _ { s j } k _ { j } \big ) } } \end{array}
+$$
+
+meaning that if 151 $y _ { n }$ and $y _ { n + 1 }$ are known, all stages, and thus the next step $\begin{array} { r } { \hat { y } _ { n + 1 } = y _ { n } + h \sum _ { i = 1 } ^ { s } b _ { i } k _ { i } } \end{array}$ , 152 could be computed explicitly. □
+
+153 Because of their explicit nature when applied to inverse ODE problems, MIRK methods are an
+154 attractive alternative to explicit Runge–Kutta methods; in contrast to explicit RK methods, they
+155 can be symplectic or symmetric, or both, without requiring the solution of systems of nonlinear
+156 equations, even when the Hamiltonian is non-separable. Figure $^ 1$ illustrates the relation between
+157 various subclasses and the specific methods are described in Table $\perp$ in Appendix $\boxed { \mathbf { C } }$ In addition,
+158 for $s$ -stage MIRK methods, it is possible to construct methods of order $p = s + 1 \ P \ 2 \|$ . This is
+159 in general higher order than what is possible to obtain with $s$ -stage explicit Runge–Kutta methods.
+160 Further computational gains could also be made by reusing evaluations of the vector field between
+161 multiple steps, which using MIRK methods allow for, as explained in Appendix $\mathrm { I } .$ The dependency
+162 structure on the data $S _ { N }$ of explicit RK (ERK) methods, MIRK methods and the SRNN method $\bar { \mathbb { m } }$
+163 is illustrated in Figure 2.
+164 Maximal order of symplectic MIRK methods: From the preceding discussion, it is clear that
+165 symplectic MIRK methods are of interest when learning Hamiltonian systems from data, since they
+166 combine computational efficiency with the ability to preserve useful, geometric properties. Indeed,
+167 symplectic integrators in the training of HNNs have been considered in [9, 10, 11, 12, 13]. The
+168 subclass of symplectic MIRK methods is represented by the middle, dark blue field in the Venn
+169 diagram of Figure $\bigstar$ The next result gives an order barrier for symplectic MIRK methods that was, to
+170 the best of our knowledge, not known up to this point.
+
+
+Figure 2: Differences of observation dependency, assuming $N = 2$ for explicit and mono-implicit one-step training, and explicit multi-step training with initial state optimization (green node $\hat { y } _ { 0 }$ ).
+
+Theorem 4.4. The maximum order of a symplectic MIRK method is $p = 2$ .
+
+172 Proof. This is a shortened version of the full proof, which can be found in Appendix $\mathrm { F } .$ A MIRK
+173 method is a Runge–Kutta method with coefficients $a _ { i j } = d _ { i j } + v _ { i } b _ { j }$ . Requiring $d _ { i j } , { \overline { { b _ { i } } } }$ and $v _ { i }$ to
+174 satisfy the symplecticity conditions of $( 5 )$ in addition to $D$ being strictly lower triangular, yields the
+175 following restrictions
+
+$$
+\begin{array} { r } { b _ { i } d _ { i j } + b _ { i } b _ { j } ( v _ { j } + v _ { i } - 1 ) = 0 , \quad \mathrm { i f ~ } i \neq j , } \\ { b _ { i } = 0 \mathrm { o r } v _ { i } = \cfrac { 1 } { 2 } , \quad \mathrm { i f ~ } i = j , } \\ { d _ { i j } = 0 , \quad \mathrm { i f ~ } i > j . } \end{array}
+$$
+
+176 These restrictions result in an RK method that could be reduced to choosing a coefficient vector
+177 $b \in \mathbb { R } ^ { s }$ and choosing stages on the form $\begin{array} { r } { k _ { i } = f \big ( y _ { n } + \frac { h } { 2 } \sum _ { j } ^ { s } b _ { j } k _ { j } \big ) } \end{array}$ for $i = 1 , \dots , s$ . It is then trivial
+178 to check that this method can only be of up to order $p = 2$ . Note that for $s = 1$ and $b _ { 1 } = 1$ we get the
+179 midpoint method. □
+180 Numerical integrators outside the RK class: While this paper is mainly concerned with MIRK
+181 methods, several other types of numerical integrators could be of interest for inverse problems.
+182 Partitioned Runge–Kutta methods are an extension and not a subclass of RK methods, and can
+183 be symplectic and symmetric, while also being explicit for separable Hamiltonian systems. The
+184 Störmer–Verlet integrator of order $p = 2$ is one example. Higher order methods of this type are
+185 derived in $\lVert \rVert$ and used for learning Hamiltonian systems in [29, 30]. Discrete gradient methods
+186 [31, $\textcircled { 3 2 } \textcircled { }$ are inverse explicit and well suited to train Hamiltonian neural networks using a modified
+187 automatic differentiation algorithm $\mathbb { \left. \boldsymbol { \cdot } \boldsymbol { \cdot } \right. }$ . This method could be extended to higher order methods as
+188 shown in $\mathbb { \lVert 1 6 \rVert }$ . In contrast to symplectic methods, discrete gradient methods preserve the Hamiltonian
+189 exactly up to machine precision. A third option is elementary differential Runge–Kutta methods $\pmb { \Vert 3 3 } \Vert$ ,
+190 where for instance $\bar { \big \| } \bar { 3 4 } \bar { \big \| }$ show how to use backward error analysis to construct higher order methods
+191 from modifications to the midpoint method. This topic is discussed further in Appendix $\mathbb { H } ,$ where we
+192 also present a novel, symmetric discrete gradient method of order $p = 4$ .
+
+# 5 Mean inverse integrator for handling noisy data
+
+94 Noisy ODE sample: It is often the case that the samples $S _ { N }$ are not exact measurements of the
+95 system, but perturbed by noise. In this paper, we model the noise as independent, normally distributed
+
+$$
+\tilde { y } _ { n } = y ( t _ { n } ) + \delta _ { n } , \quad \delta _ { n } \sim \mathcal { N } ( 0 , \sigma ^ { 2 } I ) ,
+$$
+
+197 where ${ \mathcal { N } } ( 0 , \sigma ^ { 2 } I )$ represents the multivariate normal distribution. With this assumption, a standard
+198 result from statistics tells us that the variance of a sample-mean estimator with $N$ samples converges
+199 to zero at the rate of $\textstyle { \frac { 1 } { N } }$ . That is, assuming that we have $N$ samples $\tilde { y } _ { n } ^ { ( 1 ) } , \dots , \tilde { y } _ { n } ^ { ( N ) }$ , then
+
+$$
+\mathrm { V a r } [ \overline { { y } } _ { n } ] = \mathrm { V a r } \bigg [ \frac { 1 } { N } \sum _ { j = 1 } ^ { N } \tilde { y } _ { n } ^ { ( j ) } \bigg ] = \frac { \sigma ^ { 2 } } { N } .
+$$
+
+200 Using the inverse injection with the midpoint method, the vector field is evaluated in the average of
+201 ${ \tilde { y } } _ { n }$ and $\tilde { y } _ { n + 1 }$ , reducing the variance of the perturbation by a factor of two, compared to evaluating the
+202 vector field in ${ \tilde { y } } _ { n }$ , as is done in all explicit RK methods. Furthermore, considering the whole data
+203 trajectory $S _ { N }$ , multiple independent approximations to the same point $y ( t _ { n } )$ can enable an even more
+204 accurate estimate. This is demonstrated in the analysis presented in Theorem $\underline { { \boldsymbol { \mathsf { F } } . 2 } }$ and in Figure 4.
+205 Averaging multiple trajectories: In the inverse ODE problem, we assume that there exists an exact
+206 vector field $f$ whose flow interpolates the discrete trajectories $S _ { N }$ , and the flow of this vector field
+207 satisfies the group property $( 3 )$ . The numerical flow $\Phi _ { h , f }$ for a method of order $p$ satisfies this
+208 property only up to an error $\mathcal { O } ( h ^ { p + 1 } )$ over one step. In the presence of noisy data, compositions of
+209 one-step methods can be used to obtain multiple different approximations to the same point $y ( t _ { n } )$ ,
+210 by following the numerical flow from different nearby initial values ${ \tilde { y } } _ { j } , j \neq n$ , and thus reduce the
+211 noise by averaging over these multiple approximations. Accumulation of the local truncation error is
+212 expected when relying on points further away from $t _ { n }$ . However, for sufficiently small step sizes $h$
+213 compared to the size of the noise $\sigma$ , one can expect increased accuracy when averaging over multiple
+214 noisy samples.
+215 As an example, assume that we know the points $\{ \tilde { y } _ { 0 } , \tilde { y } _ { 1 } , \tilde { y } _ { 2 } , \tilde { y } _ { 3 } \}$ . Then $y ( t _ { 2 } )$ can be approximated by
+216 computing the mean of the numerical flows $\Phi _ { h , f }$ starting from different initial values:
+
+$$
+\begin{array} { r l r } { { \overline { { y } } _ { 2 } = \frac { 1 } { 3 } \big ( \Phi _ { h , f } ( \tilde { y } _ { 1 } ) + \Phi _ { h , f } \circ \Phi _ { h , f } ( \tilde { y } _ { 0 } ) + \Phi _ { - h , f } ^ { * } ( \tilde { y } _ { 3 } ) \big ) } } \\ & { } & { \approx \frac { 1 } { 3 } \big ( \tilde { y } _ { 0 } + \tilde { y } _ { 1 } + \tilde { y } _ { 3 } + h ( \Psi _ { 0 , 1 } + 2 \Psi _ { 1 , 2 } - \Psi _ { 2 , 3 } ) \big ) , } \end{array}
+$$
+
+where we by 217 $\Phi ^ { * }$ mean the adjoint method of $\Phi$ , as defined in $\pmb { \Vert 8 }$ Ch. V], and we let $\Psi _ { n , n + 1 }$ be the 218 increment of an inverse-explicit numerical integrator, so that
+
+$$
+\Phi _ { h , f } ( \tilde { y } _ { n } , \tilde { y } _ { n + 1 } ) = \tilde { y } _ { n } + h \Psi _ { n , n + 1 } .
+$$
+
+219 For example, for the midpoint method, we have that $\begin{array} { r } { \Psi _ { n , n + 1 } = f ( \frac { \tilde { y } _ { n } + \tilde { y } _ { n + 1 } } { 2 } ) } \end{array}$ . When stepping in
+220 negative time in $( 1 0 )$ , we use the adjoint method in order to minimize the number of vector field
+221 evaluations, also when non-symmetric methods are used (which implies that we always use e.g. $\Psi _ { 1 , 2 }$
+222 and not $\Psi _ { 2 , 1 } )$ . Note that in order to derive the approximation in $\mathbf { \bar { \rho } } ( 1 0 )$ , repeated use of the inverse
+223 injection allows the known points ${ \tilde { y } } _ { n }$ to form an explicit integration procedure, where composition
+224 of integration steps are approximated by summation over increments $\Psi _ { n , n + 1 }$ . This approximation
+225 procedure is presented in greater detail in Appendix D.
+226 Mean inverse integrator: The mean approximation over the whole trajectory ${ \overline { { y } } } _ { n }$ , for $n = 0 , \ldots , N$ ,
+227 could be computed simultaneously, reusing multiple vector field evaluations in an efficient manner.
+228 This leads to what we call the mean inverse integrator. For example, when $N = 3$ we get
+
+$$
+\left[ \begin{array} { c } { \overline { { y } } _ { 0 } } \\ { \overline { { y } } _ { 1 } } \\ { \overline { { y } } _ { 2 } } \\ { \overline { { y } } _ { 3 } } \end{array} \right] = \frac { 1 } { 3 } \left[ \begin{array} { c c c c } { 0 } & { 1 } & { 1 } & { 1 } \\ { 1 } & { 0 } & { 1 } & { 1 } \\ { 1 } & { 1 } & { 0 } & { 1 } \\ { 1 } & { 1 } & { 1 } & { 0 } \end{array} \right] \left[ \begin{array} { c } { \widetilde { y } _ { 0 } } \\ { \widetilde { y } _ { 1 } } \\ { \widetilde { y } _ { 2 } } \\ { \widetilde { y } _ { 3 } } \end{array} \right] + \frac { h } { 3 } \left[ \begin{array} { c c c c } { - 3 } & { - 2 } & { - 1 } \\ { 1 } & { - 2 } & { - 1 } \\ { 1 } & { 2 } & { - 1 } \\ { 1 } & { 2 } & { 3 } \end{array} \right] \left[ \begin{array} { c } { \Psi _ { 0 , 1 } } \\ { \Psi _ { 1 , 2 } } \\ { \Psi _ { 2 , 3 } } \end{array} \right] ,
+$$
+
+229 and the same structure is illustrated in Figure 3.
+
+230 Definition 5.1 (Mean inverse integrator). For a sample $S _ { N }$ and an inverse-explicit integrator $\Psi _ { n , n + 1 }$ ,
+231 the mean inverse integrator is given by
+
+$$
+\overline { { Y } } = \frac { 1 } { N } \bigg ( U \tilde { Y } + h W \Psi \bigg )
+$$
+
+$$
+\tilde { Y } : = [ \tilde { y } _ { 0 } , \dotsc , \tilde { y } _ { N } ] ^ { T } \in \mathbb { R } ^ { ( N + 1 ) \times m } , \Psi : = [ \Psi _ { 0 , 1 } , \dotsc , \Psi _ { N - 1 , N } ] ^ { T } \in \mathbb { R } ^ { N \times m } .
+$$
+
+Finally, 233 $U \in \mathbb { R } ^ { ( N + 1 ) \times ( N + 1 ) }$ and $W \in \mathbb { R } ^ { ( N + 1 ) \times N }$ are given by
+
+$$
+[ U ] _ { i j } : = \left\{ \begin{array} { l l } { 0 } & { \mathrm { i f } \quad i = j } \\ { 1 } & { \mathrm { e l s e } } \end{array} \right. \qquad \mathrm { a n d } \qquad [ W ] _ { i j } : = \left\{ \begin{array} { l l } { j - 1 - N } & { \mathrm { i f } \quad j \geq i } \\ { j } & { \mathrm { e l s e } } \end{array} \right. .
+$$
+
+234 By substituting the known vector field $f$ with a neural network $f _ { \theta }$ and denoting the matrix containing
+235 vector field evaluations by $\Psi _ { \theta }$ such that $\begin{array} { r } { \overline { { Y } } _ { \theta } : = \frac { 1 } { N } ( U \tilde { Y } + h W \Psi _ { \theta } ) } \end{array}$ , we can formulate an analogue to
+236 the inverse problem $( 6 )$ by
+
+$$
+\operatorname { a r g m i n } _ { \theta } { \big \| } { \tilde { Y } } - { \overline { { Y } } } _ { \theta } { \big \| } .
+$$
+
+237 Analysis of sensitivity to noise: Consider the optimiza
+238 tion problems using integrators either as one-step methods
+239 or MII by $( 6 )$ resp. $( 1 \bar { 2 } )$ . We want to investigate how
+240 uncertainty in the data ${ \tilde { y } } _ { n }$ introduces uncertainty in the op
+241 timization problem. Assume, for the purpose of analysis,
+242 that the underlying vector field $f ( y )$ is known. Let
+
+$$
+\begin{array} { r l } & { \mathcal { T } _ { n } ^ { \mathrm { O S } } : = \tilde { y } _ { n } - \Phi _ { h , f } ( \tilde { y } _ { n - 1 } , \tilde { y } _ { n } ) , } \\ & { \mathcal { T } _ { n } ^ { \mathrm { M I I } } : = \tilde { y } _ { n } - [ \overline { { Y } } ] _ { n } } \end{array}
+$$
+
+243 be the optimization target or the expression one aims to
+244 minimize using a one-step method (OS) and the MII,
+245 where $\overline { { Y } }$ is given by Definition $\boxed { 5 . 1 }$ For a matrix $A$
+246 with eigenvalues $\lambda _ { i } ( A )$ , the spectral radius is given by
+
+
+Figure 3: Illustration of the structure of the mean inverse integrator for $N = 3$ .
+
+$\rho ( A ) : = \operatorname* { m a x } _ { i } | \lambda _ { i } ( A ) |$ . An analytic expression that approximates $\rho ( \mathcal { T } _ { n } ^ { \mathrm { o s } } )$ and $\rho ( \mathcal { T } _ { n } ^ { \mathrm { M I I } } )$ by linearization of $f$ for a general MIRK method is provided below.
+
+249 Theorem 5.2. Let $S _ { N } = \{ \tilde { y } _ { n } \} _ { n = 0 } ^ { N }$ be a set of noisy samples, equidistant in time with step size $h$
+250 with Gaussian perturbations as defined by $\textcircled { 9 }$ with variance $\sigma ^ { 2 }$ . Assume that a MIRK integrator
+251 $\Phi _ { h , f }$ is used as a one-step method. Then the spectral radius is approximated by
+
+$$
+\begin{array} { r l } & { \rho _ { n } ^ { o s } : = \rho \bigg ( V a r \big [ \mathcal { T } _ { n } ^ { o s } \big ] \bigg ) \approx \sigma ^ { 2 } \bigg \| 2 I + h b ^ { T } \big ( \mathbb { 1 } - 2 v \big ) \big ( f ^ { \prime } + f ^ { \prime T } \big ) + h ^ { 2 } Q ^ { o s } \bigg \| _ { 2 } , } \\ & { \rho _ { n } ^ { M I I } : = \rho \bigg ( V a r \big [ \mathcal { T } _ { n } ^ { M I I } \big ] \bigg ) \approx \frac { \sigma ^ { 2 } } { N } \bigg \| ( 1 + N ) I + h P _ { n n } + \frac { h } { N } \displaystyle \sum _ { j = 0 } ^ { s } P _ { n j } + \frac { h ^ { 2 } } { N } Q ^ { M I I } \bigg \| _ { 2 } , } \end{array}
+$$
+
+where 252 $f ^ { \prime } : = f ^ { \prime } ( y _ { n } )$ and $P _ { n j } , Q ^ { o s }$ and $Q ^ { M I I }$ (defined in (24) in Appendix G) are matrices independent 253 of the step size $h$ .
+
+254 The proof is found in Appendix $\boxed { \mathbf { G } }$ Let $\alpha : = b ^ { T } ( \mathbb { 1 } ^ { } -$
+255 $2 v$ ) denote the coefficients of the first order term in $h$
+256 of Equation $\textcircled { 1 3 }$ . For any explicit RK method we have
+257 that $v = 0$ and since $b ^ { T } \bar { 1 } = \bar { 1 }$ (method of at least order
+258 one) we find that $\alpha _ { \mathrm { E R K } } = 1$ . Considering the Butcher
+259 tableau of MIRK4 in Figure $9$ we find that $\alpha _ { \mathrm { M I R K 4 } } = 0$
+260 Thus, as $h 0$ we would expect quadratic convergence
+261 !of MIRK4 and linear convergence of RK4 for $\rho _ { n } ^ { \mathrm { { O S } } }$ to $2 \sigma ^ { 2 }$
+262 Considering MII $( 1 4 )$ one would expect linear convergence
+263 for $\rho _ { n } ^ { \mathrm { M I I } }$ to $\bar { \sigma } ^ { 2 }$ if $N$ is large, as $h 0$ .
+64 A numerical approximation of $\rho _ { n } ^ { \mathrm { { O S } } }$ and $\rho _ { n } ^ { \mathrm { M I I } }$ could be real
+65 ized by a Monte-Carlo estimate. We compute the spectral
+66 67 ${ \mathcal { T } } _ { n } ^ { \mathrm { M I I } }$ s b $\hat { \rho } _ { n }$ of the eampling $5 { \cdot } \mathrm { \dot { 1 } 0 ^ { 3 } }$ cal covariance matrix of normally distributed pert $\mathcal { T } _ { n } ^ { \mathrm { { 0 s } } }$ andtions
+268 $\delta _ { n }$ with $\sigma ^ { 2 } = 2 { \bar { . } } 5 \cdot 1 0 ^ { - 3 }$ to each point $y _ { n }$ in a trajectory
+69 of $N + 1$ points and step size $h$ . We then compute the
+270 trajectory average $\begin{array} { r } { \overline { { \rho } } = \frac { 1 } { N + 1 } \sum _ { n = 0 } ^ { N } \hat { \rho } _ { n } } \end{array}$ , fix the end time $T = 2 . 4$ , repeat the approximations for
+271 decreasing step sizes $h$ and increasing $N$ and compute the average of $\overline { \rho }$ for 10 randomly sampled
+272 trajectories $S _ { N }$ from the double pendulum system. The plot in Figure $^ 4$ corresponds well with what
+273 one would expect from Theorem $5 . 2$ and confirms that first MIRK (with $v \neq 0$ ) and secondly MII
+274 reduces the sensitivity to noise in the optimization target.
+
+
+Figure 4: Average of $\overline { { \rho } }$ over 10 trajectories. Shaded area represent one standard deviation.
+
+# 6 Experiments
+
+Methods and test problems: We train HNNs using different integrators and methods in the inverse problem $\textcircled{6}$ . We use MIRK4 together with the MII method and compare to the implicit midpoint method, RK4 and MIRK4 applied as one-step methods, as well as ISO followed by Störmer–Verlet and RK4 integrated over multiple time-steps. The latter strategy, illustrated in Figure $\bigtriangledown ,$ was suggested in [10], where Störmer–Verlet is used. Separable networks $H _ { \theta } ( q , p ) = H _ { 1 , \theta } ( q ) + H _ { 2 , \theta } ( p )$ are trained on data from the Fermi–Pasta–Ulam–Tsingou (FPUT) problem and the Hénon–Heiles system. For the double pendulum, which is non-separable, a fully connected Flow roll-out H´enon-Hnetwork is used for all methods except Störmer– Flow roll-out H´enon-Heiles h = 0.1, FVerlet, which requires separability in order to be explicit. The Hamiltonians are described in Appendix 0.2 0.0A and all systems have solutions $y ( t ) \not \in \mathbb { R } ^ { 4 }$ .
+
+0.2 0.0 0.0After using the specified integrators in training, a
+294 0.0 0.2proximated solutions are computed for each learned
+295 vector field $f _ { \theta }$ 0.2 0.4using the Scikit-learn implementation
+296 0.2 0.6of DOP853 [35], which is also used to generate
+297 0.0 2.5 5.0 7.5 training data. The error is averaged over $M = { \mathfrak { M } } =$
+298 0.0 2.5 5.0 7.5 10.0 12.5 15.0 17points and we find what we call the flow error by
+
+
+
+
+Flow roll-out Double pendulum $h = 0 . 1 .$ , $\sigma = 0 . 0 5$
+
+ISO RK4 MII MIRK4 Given datagure 5: Roll-out in time obtained by inteMIRK4MII MIRK4 Exact flowrating over the learned vector fields when Exact flow.0 12.5 15.0 17.5 20.0training on data from the double pendulum .0 17.5 20.05.0 7.5 10.0 tHamiltonian.
+
+$$
+\begin{array} { l } { \displaystyle { e \big ( f _ { \theta } \big ) = \frac { 1 } { M } \sum _ { n = 1 } ^ { M } \| \hat { y } _ { n } - y ( t _ { n } ) \| _ { 2 } , \quad y ( t _ { n } ) \in S _ { M } ^ { \mathrm { t e s t } } , } } \\ { \displaystyle { \hat { y } _ { n + 1 } = \Phi _ { h , f _ { \theta } } \big ( y _ { n } \big ) } . } \end{array}
+$$
+
+299 Trathat 300 g data is g. The data $N _ { 2 } = 3 0 0$ random initial values nd by integrating the $y _ { 0 }$ requiringtial values
+$0 . 3 \leq \| y _ { 0 } \| _ { 2 } \leq 0 . 6 .$ $S _ { N _ { 1 } , N _ { 2 } } = \bar { \{ y _ { n } ^ { ( j ) } \} } _ { n = 0 , j = 0 } ^ { N _ { 1 } , N _ { 2 } }$
+301 with DOP853 with a tolerance of $1 0 ^ { - 1 5 }$ for the following step sizes and number of steps: $\left( h , N _ { 1 } \right) =$
+302 (0.4, 4), (0.2, 8), (0.1, 16). The points in the flow are perturbed by noise where $\sigma \in \{ 0 , 0 . 0 5 \}$ . Error
+303 is measured in $M = 1 0$ random points in the flow, within the same domain as the initial values.
+304 Furthermore, experiments are repeated with a new random seed for the generation of data and
+305 initialization of neural network parameters five times in order to compute the standard deviation of
+306 the flow error. The flow error is shown in Figure $6 .$ Additional results are presented in Appendix B.
+
+Neural network architecture and optimization: For all test problems, the neural networks have 3 layers with a width of 200 neurons and tanh(·) as the activation function. The algorithms are implemented using PyTorch $\pmb { \mathbb { B } } 6 \|$ and the code for performing ISO is a modification of the implementation by $\mathbb { \underline { { \sf { I I O } } } } ! .$ Training is done using the quasi-Newton L-BFGS algorithm $\textcircled { 1 3 7 }$ for 20 epochs without batching. This optimization algorithm is often used to train physics-informed neural networks [1] and in this setting it proved to yield superior results in comparison to the often used Adam optimizer. Further details are provided in Appendix E.
+
+Results: As observed in Figure $\boxed { 6 }$ and supported by the analytical result illustrated in Figure $\boxed { 4 }$ the MII approach facilitates more accurate training from from noisy data than one-step methods. However, training with multiple integration steps in combination with ISO yields lower error when RK4 is used for the Hénon–Heiles problem and similar performance as MII on the double pendulum. We notice that the SRNN approach, i.e. ISO with Störmer–Verlet, is improved when switching to RK4, which means sacrificing symplecticity to achieve higher order. The results for FPUT stand out in Figure $6 ,$ since both ISO methods have large errors here. The roll-out in time of the learned vector fields is presented in Figure $8$ in Appendix $\boxed { \mathbf { B } }$ where the same can be observed. As also could be seen here, the FPUT Hamiltonian gives rise to highly oscillatory trajectories, and the errors observed in Figure 6 might indicate that ISO is ill-suited for this kind of dynamical systems.
+
+
+Figure 6: The flow error when learning vector fields using one-step methods directly (Midpoint, RK4 and MIRK4), ISO and multiple time-steps (ISO Störmer and ISO RK4) and MII (MII MIRK4). The error bars display the standard deviation after rerunning 5 experiments on data with $\sigma = 0 . 0 5$ . The right subplot shows the computational time used in training against the flow error.
+
+Two observations could be made regarding the one-step methods without averaging or ISO. First, it is likely that the midpoint method has weaker performance for large step sizes due to its lower order, compared to both RK4 and MIRK4, despite the fact that it is a symplectic method. The same is clear from Figure $\perp$ in Appendix $\bigstar _ { \mathbf { B } } \bigstar _ { \mathbf { \theta } }$ which display the flow error when training on data without noise. Secondly, building on the sensitivity analysis, we observe that MIRK4 consistently attains higher accuracy than RK4, as expected from the Monte-Carlo simulation found in Figure 4.
+
+# 7 Conclusion
+
+In this work we present the mean inverse integrator, which allows both chaotic and oscillatory dynamical systems to be learned with high accuracy from noisy data. Within this method, integrators of the MIRK class are a key component. To analyse how noise is propagated when training with MII and MIRK, compared to much used explicit methods such as RK4, we developed a sensitivity analysis that is verified both by a Monte-Carlo approximation and reflected in the error of the learned vector fields. Finally, we build on the SRNN $\mathbb { m }$ by replacing Störmer–Verlet with RK4, and observer increased performance. When also considering the weak performance of the implicit midpoint method, this tells us that order might be of greater importance than preserving the symplectic structure when training HNNs. Both the MIRK methods, the mean inverse integrator and initial state optimization form building blocks that could be combined to form novel approaches for solving inverse problems and learning from noisy data.
+
+Limitations: The experiments presented here assume that both the generalized coordinates $q _ { n }$ and the generalized momenta $p _ { n }$ could be observed. In a setting where HNNs are to model real and not simulated data, the observations might lack generalized momenta $\left[ \left[ 3 8 \right] \right]$ or follow Cartesian coordinates, requiring the enforcement of constraints $\boxed { 1 7 } \boxed { 3 9 }$ . Combining approaches that are suitable for data that is both noisy and follow less trivial coordinate systems is a subject for future research.
+
+References
+[1] Maziar Raissi, Paris Perdikaris, and George E Karniadakis. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational physics, 378:686–707, 2019.
+[2] Christopher Rackauckas, Yingbo Ma, Julius Martensen, Collin Warner, Kirill Zubov, Rohit Supekar, Dominic Skinner, Ali Ramadhan, and Alan Edelman. Universal differential equations for scientific machine learning. Aug 2020.
+[3] Ricky TQ Chen, Yulia Rubanova, Jesse Bettencourt, and David K Duvenaud. Neural ordinary differential equations. Advances in neural information processing systems, 31, 2018.
+[4] Zongyi Li, Nikola Kovachki, Kamyar Azizzadenesheli, Burigede Liu, Kaushik Bhattacharya, Andrew Stuart, and Anima Anandkumar. Fourier neural operator for parametric partial differential equations. arXiv preprint arXiv:2010.08895, 2020.
+[5] Sam Greydanus, Misko Dzamba, and Jason Yosinski. Hamiltonian neural networks. CoRR, abs/1906.01563, 2019.
+[6] Herbert Goldstein, Charles Poole, and John Safko. Classical Mechanics. Addison Wesley, 3 edition, 2001.
+[7] Benedict Leimkuhler and Sebastian Reich. Simulating Hamiltonian Dynamics. Cambridge Monographs on Applied and Computational Mathematics. Cambridge University Press, 2005.
+[8] Ernst Hairer, Christian Lubich, and Gerhard Wanner. Geometric Numerical Integration: Structure-Preserving Algorithms for Ordinary Differential Equations; 2nd ed. Springer, Dordrecht, 2006.
+[9] Christian Offen and Sina Ober-Blöbaum. Symplectic integration of learned Hamiltonian systems. Chaos: An Interdisciplinary Journal of Nonlinear Science, 32(1):013122, 2022.
+[10] Zhengdao Chen, Jianyu Zhang, Martin Arjovsky, and Léon Bottou. Symplectic recurrent neural networks. In International Conference on Learning Representations, 2020.
+[11] Aiqing Zhu, Pengzhan Jin, and Yifa Tang. Deep Hamiltonian networks based on symplectic integrators. arXiv preprint arXiv:2004.13830, 2020.
+[12] Marco David and Florian Méhats. Symplectic learning for Hamiltonian neural networks. arXiv preprint arXiv:2106.11753, 2021.
+[13] Pengzhan Jin, Zhen Zhang, Aiqing Zhu, Yifa Tang, and George Em Karniadakis. SympNets: Intrinsic structure-preserving symplectic networks for identifying Hamiltonian systems. Neural Networks, 132:166–179, 2020.
+[14] Aiqing Zhu, Pengzhan Jin, Beibei Zhu, and Yifa Tang. Inverse modified differential equations for discovery of dynamics. arXiv preprint arXiv:2009.01058, 2020.
+[15] Takashi Matsubara, Ai Ishikawa, and Takaharu Yaguchi. Deep energy-based modeling of discrete-time physics. Advances in Neural Information Processing Systems, 33:13100–13111, 2020.
+[16] Sølve Eidnes. Order theory for discrete gradient methods. BIT, 62(4):1207–1255, 2022.
+[17] Elena Celledoni, Andrea Leone, Davide Murari, and Brynjulf Owren. Learning Hamiltonians of constrained mechanical systems. J. Comput. Appl. Math., 417:Paper No. 114608, 12, 2023.
+[18] Alvaro Sanchez-Gonzalez, Victor Bapst, Kyle Cranmer, and Peter Battaglia. Hamiltonian Graph Networks with ODE Integrators.
+[19] Gerhard Wanner and Ernst Hairer. Solving ordinary differential equations II, volume 375. Springer Berlin Heidelberg, 1996.
+[20] Senwei Liang, Zhongzhan Huang, and Hong Zhang. Stiffness-aware neural network for learning Hamiltonian systems. 2022.
+[21] Jeff R Cash. A class of implicit Runge–Kutta methods for the numerical integration of stiff ordinary differential equations. Journal of the ACM (JACM), 22(4):504–511, 1975.
+[22] K Burrage, FH Chipman, and Paul H Muir. Order results for mono-implicit Runge–Kutta methods. SIAM journal on numerical analysis, 31(3):876–891, 1994.
+[23] Håkon Noren. Learning Hamiltonian systems with mono-implicit Runge–Kutta methods. arXiv preprint, arXiv:2303.03769, 2023.
+[24] Harsh Sharma, Nicholas Galioto, Alex A Gorodetsky, and Boris Kramer. Bayesian identification of nonseparable Hamiltonian systems using stochastic dynamic models. In 2022 IEEE 61st Conference on Decision and Control (CDC), pages 6742–6749. IEEE, 2022.
+[25] W. M. G. van Bokhoven. Efficient higher order implicit one-step methods for integration of stiff differential equations. BIT, 20(1):34–43, 1980.
+[26] J. R. Cash and A. Singhal. Mono-implicit Runge–Kutta formulae for the numerical integration of stiff differential systems. IMA J. Numer. Anal., 2(2):211–227, 1982.
+[27] Sølve Eidnes, Alexander J Stasik, Camilla Sterud, Eivind Bøhn, and Signe Riemer-Sørensen. Pseudo-Hamiltonian neural networks with state-dependent external forces. arXiv preprint, arXiv:2206.02660, 2022.
+[28] Haruo Yoshida. Construction of higher order symplectic integrators. Physics letters A, 150(5- 7):262–268, 1990.
+[29] Shaan A Desai, Marios Mattheakis, and Stephen J Roberts. Variational integrator graph networks for learning energy-conserving dynamical systems. Physical Review E, 104(3):035310, 2021.
+[30] Daniel DiPietro, Shiying Xiong, and Bo Zhu. Sparse symplectically integrated neural networks. Advances in Neural Information Processing Systems, 33:6074–6085, 2020.
+[31] GRW Quispel and Grant S Turner. Discrete gradient methods for solving ODEs numerically while preserving a first integral. Journal of Physics A: Mathematical and General, 29(13):L341, 1996.
+[32] Robert I McLachlan, G Reinout W Quispel, and Nicolas Robidoux. Geometric integration using discrete gradients. Philosophical Transactions of the Royal Society of London. Series A: Mathematical, Physical and Engineering Sciences, 357(1754):1021–1045, 1999.
+[33] Ander Murua. Métodos simplécticos desarrollables en $P$ -series. PhD thesis, PhD thesis. Valladolid: Universidad de Valladolid, 1995.
+[34] Philippe Chartier, Ernst Hairer, and Gilles Vilmart. Numerical integrators based on modified differential equations. Mathematics of Computation, 76(260):1941–1953, October 2007.
+[35] J.R. Dormand and P.J. Prince. A family of embedded Runge–Kutta formulae. Journal of Computational and Applied Mathematics, 6(1):19–26, 1980.
+[36] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. PyTorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32:8026–8037, 2019.
+[37] Jorge Nocedal and Stephen J Wright. Numerical optimization. Springer, 1999.
+[38] Yuhan Chen, Takashi Matsubara, and Takaharu Yaguchi. Neural symplectic form: learning hamiltonian equations on general coordinate systems. Advances in Neural Information Processing Systems, 34:16659–16670, 2021.
+[39] Marc Finzi, Ke Alexander Wang, and Andrew Gordon Wilson. Simplifying Hamiltonian and Lagrangian neural networks via explicit constraints. arXiv preprint arXiv:2010.13581, 2020.
+[40] Enrico Fermi, P Pasta, Stanislaw Ulam, and Mary Tsingou. Studies of the nonlinear problems. Technical report, Los Alamos National Lab.(LANL), Los Alamos, NM (United States), 1955.
+
+439 [41] E. Hairer, S. P. Nørsett, and G. Wanner. Solving ordinary differential equations. I, volume 8 of
+440 Springer Series in Computational Mathematics. Springer-Verlag, Berlin, second edition, 1993.
+441 Nonstiff problems.
+442 [42] P. H. Muir. Optimal discrete and continuous mono-implicit Runge-Kutta schemes for BVODEs.
+443 Adv. Comput. Math., 10(2):135–167, 1999.
+444 [43] J. R. Cash and D. R. Moore. A high order method for the numerical solution of two-point
+445 boundary value problems. BIT, 20(1):44–52, 1980.
+446 [44] Philippe Chartier. Symmetric Methods. In Björn Engquist, editor, Encyclopedia of Applied and
+447 Computational Mathematics, pages 1439–1448. Springer, Berlin, Heidelberg, 2015.
+448 [45] J. R. Cash and A. Singhal. High order methods for the numerical solution of two-point boundary
+449 value problems. BIT, 22(2):184–199, 1982.
+450 [46] Pauli Virtanen, Ralf Gommers, Travis E. Oliphant, Matt Haberland, Tyler Reddy, David
+451 Cournapeau, Evgeni Burovski, Pearu Peterson, Warren Weckesser, Jonathan Bright, Stéfan J.
+452 van der Walt, Matthew Brett, Joshua Wilson, K. Jarrod Millman, Nikolay Mayorov, Andrew
+453 R. J. Nelson, Eric Jones, Robert Kern, Eric Larson, C J Carey, ˙ Ilhan Polat, Yu Feng, Eric W.
+454 Moore, Jake VanderPlas, Denis Laxalde, Josef Perktold, Robert Cimrman, Ian Henriksen, E. A.
+455 Quintero, Charles R. Harris, Anne M. Archibald, Antônio H. Ribeiro, Fabian Pedregosa, Paul
+456 van Mulbregt, and SciPy 1.0 Contributors. SciPy 1.0: Fundamental Algorithms for Scientific
+457 Computing in Python. Nature Methods, 17:261–272, 2020.
+458 [47] Philippe Chartier, Ernst Hairer, and Gilles Vilmart. Numerical integrators based on modified
+459 differential equations. Math. Comp., 76(260):1941–1953, 2007.
+460 [48] Ge Zhong and Jerrold E. Marsden. Lie-Poisson Hamilton-Jacobi theory and Lie-Poisson
+461 integrators. Phys. Lett. A, 133(3):134–139, 1988.
+462 [49] Takashi Matsubara and Takaharu Yaguchi. FINDE: Neural differential equations for finding
+463 and preserving invariant quantities. arXiv preprint, arXiv:2210.00272, 2022.
\ No newline at end of file
diff --git a/md/dev/td6xbEOPLr/td6xbEOPLr.md b/md/dev/td6xbEOPLr/td6xbEOPLr.md
new file mode 100644
index 0000000000000000000000000000000000000000..815cd5c05ecdab28de249641076a2cf5a02f880b
--- /dev/null
+++ b/md/dev/td6xbEOPLr/td6xbEOPLr.md
@@ -0,0 +1,392 @@
+# FATE: Fairness Attacks on Graph Learning
+
+Anonymous Author(s)
+Affiliation
+Address
+email
+
+# Abstract
+
+1 We study fairness attacks on graph learning to answer the following question: How
+2 can we achieve poisoning attacks on a graph learning model to exacerbate the
+3 bias? We answer this question via a bi-level optimization problem and propose a
+4 meta learning-based attacking framework named FATE. The proposed framework
+5 is broadly applicable with respect to various fairness definitions and graph learning
+6 models,as well as arbitrary choices of manipulation operations.We further instanti
+7 ate FATE to attack statistical parity and individual fairness on graph neural networks.
+8 We conduct extensive experimental evaluations on real-world datasets in the task
+9 of semi-supervised node classification. The experimental results demonstrate that
+10 FATE could amplify the bias of graph neural networks with or without fairness
+11 consideration while maintaining the utility on the downstream task.We hope this
+12 paper provides insights into the adversarial robustness of fair graph learning and
+13 can shed light on designing robust and fair graph learning in future studies.
+
+# 141Introduction
+
+15 Algorithmic fairness in graph learning has received much research attention [5,20,24]. Despite
+16 its substantial progress,existing studies mostly assume the benevolence of input graphs and aim
+17 to ensure that the bias would not be perpetuated or amplified in the learning process.However,
+18 malicious activities in the real world are commonplace.For example,consider a financial fraud
+19 detection system which utilizes a transaction network to classify whether a bank account is fraudulent
+20 or not [49,45]. An adversary may manipulate the transaction network (e.g., malicious banker with
+21 access to the transaction data,theft of bank accounts to make malicious transactions), so that the
+22 graph-based fraud detection model would exhibit unfair classification results with respect to people
+23 of different demographic groups. Consequently,a biased fraud detection model may infringe civil
+24 liberty to certain financial activities and impact the well-being of an individual negatively [6]. It
+25 would also make the graph learning model fail to provide the same quality of service to people of
+26 certain demographic groups,causing the financial institutions to lose business in the communities
+27 of the corresponding demographic groups. Thus, it is critical to understand how resilient a graph
+28 learning model is with respect to adversarial attcks on fairness, which we term as fairness attacks.
+29 To date,fairness attack has not been well studied. Sporadic literature often follows two strategies:
+30 (1) adversarial data point injection, which is often designed for tabular data rather than graphs [38,
+31 33,8,44] or (2) adversarial edge injection, which only atacks the group fairness of a graph neural
+32 network [19]. It is thus crucial to study how to attck different fairness definitions for a variety of
+33 graph learning models.
+34 To achieve this goal, we study the Fairness attacks on graph learning (FATE) problem.We formulate
+35 it as a bi-level optimization, where the lower-level problem optimizes a task-specific loss function
+36 to make the fairness attacks deceptive and the upper-level problem leverages the supervision signal
+37 to modify the input graph and maximize the bias function corresponding to a user-defined fairness
+38 definition. To solve the bi-level optimization problem, we propose a meta learning-based solver
+39 (FATE),whose key idea is to compute the meta-gradient of the upper-level bias function with respect
+40 to the input graph to guide the fairness attacks. Compared with existing works,our proposed
+41 FATE framework has two major advantages.First, it is capable of attacking any fairness definition
+42 on any graph learning model,as long as the corresponding bias function and the task-specific loss
+43 function are differentiable.Second, it is equipped with the ability for either continuous or discretized
+44 poisoning atacks on the graph topology. We also briefly discuss its ability for poisoning attacks on
+45 node features in a later section.
+
+46The major contributions of this paper are summarized as follows.
+
+17· Problem definition. We formally define the problem of fairness attacks on graph learning (the
+18 FATE problem). Based on the definition, we formulate it as a bi-level optimization problem, whose
+19 key idea is to maximize a bias function in the upper level while minimizing a task-specific loss
+0 function for a graph learning task.
+
+· Attacking framework. We propose an end-to-end attcking framework named FATE. It learns a perturbed graph topology via meta learning,such that the bias with respect to the learning results trained with the perturbed graph will be amplified.
+
+· Empirical evaluation. We conduct experiments on three benchmark datasets to demonstrate the efficacy of our proposed FATE framework in amplifying the bias while being the most deceptive method (i.e.,achieving the highest micro F1 score) on semi-supervised node classification.
+
+# 572Preliminaries and Problem Definition
+
+A - Notations. Throughout the paper, we use bold upper-case letter for matrix (e.g.,A), bold lower-case letter for vector (e.g., x) and calligraphic letter for set (e.g., $\mathcal { G }$ ). We use superscript T to denote the transpose of a matrix/vector (e.g., $\mathbf { x } ^ { T }$ is the transpose of $\mathbf { x }$ ).Regarding matrix/vector indexing, we use conventions similar to NumPy in Python. For example, $\mathbf { A } [ i , j ]$ is the entry of $\mathbf { A }$ at the $i$ -th row and $j$ -th column; $\mathbf { x } [ i ]$ is the $i$ -th entry of x; $\mathbf { A } [ i , : ]$ and $\mathbf { A } [ j , : ]$ are the $i$ -th row and $j$ -th column of A, respectively.
+
+4 B- Algorithmic fairness. The general principle of algorithmic fairness is to ensure the learning
+5 results would not favor one side or another.1 Among several fairness definitions that follow this
+6 principle, group fairness [16,18] and individual fairness[15] are the most widely studied ones. Group
+7 fairness splits the entire population into multiple demographic groups by a sensitive attribute (e.g.,
+8 gender) and ensure the parity of a statistical property among learning results of those groups.For
+9 example,statistical parity,a classic group fairness definition, guarantees the statistical independence
+70 between the learning results (e.g., predicted labels of a classification algorithm) and the sensitive
+71 atribute [16]. Individual fairness suggests that similar individuals should be treated similarly. It is
+2 often formulated as a Lipschitz inequality such that distance between the learning results of two data
+73 points should be no larger than the difference between these two data points [15].
+74 C- Problem definition. Existing work [19] for fairness attacks on graphs randomly injects adversar
+75 ial edges so that the disparity between the learning results of two diferent demographic groups would
+76 be amplified.However, it suffers from three major limitations.(1) First, it only attacks statistical
+77 parity while overlooking other fairness definitions (e.g.,individual fairness [15]).(2) Second, it only
+78 considers adversarial edge injection, excluding other manipulations like edge deletion or reweighting.
+79 Hence, it is essential to investigate the possibility to attck other fairness definitions on real-world
+80 graphs with an arbitrary choice of manipulation operations. (3) Third, it does not consider the utility
+81 of graph learning models while achieving the fairness attacks,resulting in performance degradation
+82 in the downstream tasks. However, an institution that applies the graph learning models are often
+83 utility-maximizing [28,2]. Thus,a performance degradation in the utility would make the fairness
+84 attacks not deceptive from the perspective of a utility-maximizing institution.
+
+In this paper, we seek to overcome the aforementioned limitations.To be specific, given an input graph,an optimization-based graph learning model,and a user-defined fairness definition, we aim to learn a modified graph such that a bias function of the corresponding fairness definition would be maximized for effective fairness attacks, while minimizing the task-specific loss function with respect to the graph learning model for deceptive fairness attacks. Formally, we define the problem of fairness attacks on graph learning,which is referred to as the FATE problem.
+
+92 Given: (1) An undirected graph $\mathcal { G } = \{ \mathbf { A } , \mathbf { X } \}$ ; (2) a task-specific loss function $l ( \mathcal { G } , \mathcal { V } , \Theta , \theta )$ where $\mathcal { V }$
+93 is the graph learning results, $\Theta$ is the set of learnable variables and $\theta$ is the set of hyperparameters; (3)
+94 a bias function $b ( \mathbf { Y } , \Theta ^ { * } , \mathbf { F } , \theta )$ where $\Theta ^ { * } = \arg \operatorname* { m i n } _ { \Theta } l ( \mathcal { G } , \mathcal { V } , \Theta , \theta )$ and $\mathbf { F }$ is the matrix that contains
+95 auxiliary fairness-related information (e.g., sensitive attribute values of all nodes in $\mathcal { G }$ for group
+96 fairness,pairwise node similarity matrix for individual fairness); (4) an integer budget $B$
+97Find: a poisoned graph $\widetilde { \mathcal { G } } = \{ \widetilde { \bf A } , \widetilde { \bf X } \}$ which satisfies the following properties: (1) $d ( \mathcal { G } , \widetilde { \mathcal { G } } ) \leq B$
+98 where $d ( \mathcal { G } , \widetilde { \mathcal { G } } )$ is the distance between the input graph $\mathcal { G }$ and the poisoned graph $\widetilde { \mathcal G }$ (e.g., $\| \mathbf { A } , \widetilde { \mathbf { A } } \| _ { 1 , 1 } )$
+99 (2) the bias function $b \left( \mathbf { Y } , \Theta ^ { * } , \mathbf { F } \right)$ is maximized for effectiveness; (3) the task-specific loss function
+00 $l \left( \widetilde { \mathcal { G } } , \mathcal { Y } , \Theta , \theta \right)$ is minimized for deceptiveness.
+
+# 3Methodology
+
+In this section, we first formulate Problem 1 as a bi-level optimization problem,followed by a generic meta learning-based solver named FATE.
+
+# 3.1Problem Formulation
+
+5 Given an input graph $\mathcal { G } = \{ { \bf A } , { \bf X } \}$ with adjacency matrix A and node feature matrix $\mathbf { X }$ , an attacker
+6aims to learn a poisoned graph $\widetilde { \mathcal { G } } = \{ \widetilde { \bf A } , \widetilde { \bf X } \}$ such that the graph learning model will be maximally
+7biased when trained on $\widetilde { \mathcal G }$ . In this work, we consider the following settings for the attacker.
+08 The goal of the attacker. The atacker aims to amplify the bias of the graph learning results output
+09 by a victim graph learning model. And the bias to be amplifed is a choice made by the attacker based
+10on which fairness definition the attacker aims to attack.
+111 The knowledge of the attacker. Following similar settings in [19], we assume the attacker has
+112 access to the adjacency matrix,the feature matrix of the input graph,and the sensitive attribute of
+113 all nodes in the graph. For a (semi-)supervised learning problem, we assume that the ground-truth
+114 labels of the training nodes are also available to the atacker. For example,for a graph-based financial
+115 fraud detection problem, the malicious banker may have access to the demographic information (i.e,
+116 sensitive atribute)of the account holders and also know whether some bank accounts are fraudulent
+117 or not, which are the ground-truth labels for training nodes.Similar to [51,52,19], the attacker has
+118 no knowledge about the parameters of the victim model. Instead, the attcker will perform a gray-box
+119 attack by attacking a surrogate graph learning model.
+
+oThe capabilitiy of the attacker. The attacker is able to perturb up to $B$ edges/features in the graph 1 (i.e., $\| \mathbf { A } - \widetilde { \mathbf { A } } \| _ { 1 , 1 } \leq B$ 0r $\| \mathbf { X } - \widetilde { \mathbf { X } } \| _ { 1 , 1 } \leq B )$ :
+
+122Based on that, we formulate Problem 1 as a bi-level optimization problem as follows.
+
+$$
+\begin{array} { r l } & { \widetilde { \mathcal { G } } = \arg \operatorname* { m a x } _ { \mathcal { G } } b \left( \mathbf { Y } , \boldsymbol { \Theta } ^ { * } , \mathbf { F } \right) } \\ & { \quad \quad \mathrm { s . t . } \quad \boldsymbol { \Theta } ^ { * } = \arg \underset { \boldsymbol { \Theta } } { \operatorname* { m i n } } l \left( \mathcal { G } , \mathbf { Y } , \boldsymbol { \Theta } , \boldsymbol { \theta } \right) , d \left( \mathcal { G } , \widetilde { \mathcal { G } } \right) \leq B } \end{array}
+$$
+
+123 where the lower-level problem learns an optimal surrogate graph learning model $\Theta ^ { * }$ by minimizing
+124 $l \left( { \mathcal { G } } , \mathbf { Y } , \Theta , \theta \right)$ , the upper-level problem finds a poisoned graph $\widetilde { \mathcal { G } }$ that could maximize a bias function
+125 $b \left( \mathbf { Y } , \Theta ^ { * } , \mathbf { F } \right)$ for the victim graph learning model and the distance between the input graph and the
+126 poisoned graph $d \left( \mathcal { G } , \widetilde { \mathcal { G } } \right)$ is constrained to satisfy the seting about the budgeted attack. Note hat
+127 Eq. (1) is applicable to attack any fairness definition on any graph learning model,as long as the bias
+128 function $b \left( { \bar { \mathbf { Y } } } , \Theta ^ { * } , \mathbf { F } \right)$ and the loss function $l \left( { \mathcal { G } } , \mathbf { Y } , \Theta , \theta \right)$ are differentiable.
+129 A -Lower-level optimization problem. A wide spectrum of graph learning models are essentially
+130 solving an optimization problem. Take the graph convolutional network (GCN) [26] as an example.
+131 It learns the node representation by aggregating information from its neighborhood, i.e., message
+132 passing. Mathematically, for an $L$ -layer GCN,the hidden representation at $k$ -th layer can be
+133 represented as $\mathbf { E } ^ { ( k ) } = \sigma \left( \widehat { \mathbf { A } } \mathbf { E } ^ { ( k - 1 ) } \mathbf { W } ^ { ( k ) } \right)$ where $\sigma$ is a nonlinearactivation function (e.g.,ReLU),
+134 $\widehat { \mathbf { A } } = \mathbf { D } ^ { - 1 / 2 } \left( \mathbf { A } + \mathbf { I } \right) \mathbf { D } ^ { - 1 / 2 }$ with $\mathbf { D }$ being the degree matrix of $( \mathbf { A } + \mathbf { I } )$ and $\mathbf { W } ^ { ( k ) }$ is the learnable
+135 weight matrix of the $k$ -th layer. Then the lower-level optimization problem aims to learn the set
+136 of parameters $\boldsymbol { \Theta } ^ { * } = \{ \mathbf { W } ^ { ( k ) } | k = 1 , \dots , L \}$ that could minimize a task-specific loss function (e.g.,
+137 cross-entropy loss for semi-supervised node classification). For more examples of graph learning
+138 models from the optimization perspective, please refers to Appendix A.
+
+B - Upper-level optimization problem. To atack the fairness aspect of a graph learning model, we aim to maximize a differentiable bias function $b \left( \mathbf { Y } , \Theta ^ { * } , \mathbf { F } \right)$ with respect to a user-defined fairness definition in the upper-level optimization problem. For example,for statistical parity[16], the fairnessrelated auxiliary information matrix $\mathbf { F }$ can be defined as the one-hot demographic membership matrix, where $\mathbf { F } [ i , j ] = 1$ if and only if node $i$ belongs to $j$ -th demographic group. Then the statistical parity is equivalent to the statistical independence between the learning results $\mathbf { Y }$ and $\mathbf { F }$ .Based on that, existing studies propose several differentiable measurements of the statistical dependence between $\mathbf { Y }$ and $\mathbf { F }$ as the bias function. For example, Bose et al. [5] use mutual information $I ( \mathbf { Y } ; \mathbf { F } )$ as the bias function; Prost et al. [35] define the bias function as the Maximum Mean Discrepancy MMD $( \mathsf { y } _ { 0 } , \mathsf { y } _ { 1 } )$ (202 between the learning results of two different demographic groups $\mathcal { V } _ { 0 }$ and $\mathcal { \mathrm { V } } _ { 1 }$ :
+
+# 3.2The FATE Framework
+
+150 To solve Eq.(1), we propose a generic attcking framework named FATE to learn the poisoned graph.
+151 The key idea is to view Eq. (1) as a meta learning problem, which aims to find suitable hyperparameter
+152 setings for a learning task [3],and treat the graph $\mathcal { G }$ as a hyperparameter. With that, we learn the
+153 poisoned graph $\widetilde { \mathcal G }$ using the meta-gradient of the bias function $b \left( \mathbf { Y } , \Theta ^ { * } , \mathbf { F } \right)$ with respect to $\mathcal { G }$ . In the
+154 following, we introduce two key parts of FATE in details, including meta-gradient computation and
+155 graph poisoning with meta-gradient.
+156 A -Meta-gradient computation. The key term to learn the poisoned graph is the meta-gradient of
+157 the bias function with respect to the graph $\mathcal { G }$ . Before computing the meta-gradient, we assume that
+158 the lower-level optimization problem converges in $T$ epochs. Thus,we first pre-train the lower-level
+159 optimization problem by $T$ epochs to obtain the optimal model $\Theta ^ { * } = \Theta ^ { ( \bar { T } ) }$ before computing the
+160 meta-gradient. The training of the lower-level optimization problem can also be viewed as a dynamic
+161 system with the following updating rule
+
+$$
+\Theta ^ { ( t + 1 ) } = \operatorname { o p t } ^ { ( t + 1 ) } \left( \mathcal { G } , \Theta ^ { ( t ) } , \theta , \mathbf { Y } \right) , \forall t \in \{ 1 , \dots , T \}
+$$
+
+162 where $\Theta ^ { ( 1 ) }$ refers to $\Theta$ at initialization, $\mathrm { o p t } ^ { ( t + 1 ) } ( \cdot )$ is an optimizer that minimizes the lower-level
+163 loss function $l \left( \mathcal { G } , \mathbf { Y } , \Theta ^ { \left( t \right) } , \theta \right)$ at $( t + 1 )$ -th epoch. From the perspective of the dynamic system,
+164 by applying the chain rule and unrolling the training of lower-level problem with Eq.(2), the
+165 meta-gradient $\nabla _ { \boldsymbol { \mathcal { G } } } b$ can be written as
+
+$$
+\nabla _ { \mathcal { G } } b = \nabla _ { \mathcal { G } } b \left( \mathbf { Y } , \boldsymbol { \Theta } ^ { ( T ) } , \mathbf { F } \right) + \sum _ { t = 0 } ^ { T - 2 } A _ { t } B _ { t + 1 } \dots B _ { T - 1 } \nabla _ { \boldsymbol { \theta } ^ { ( T ) } } b \left( \mathbf { Y } , \boldsymbol { \Theta } ^ { ( T ) } , \mathbf { F } \right)
+$$
+
+166 where $A _ { t } = \nabla _ { \mathcal { G } } \Theta ^ { ( t + 1 ) }$ and $B _ { t } = \nabla _ { \Theta ^ { ( t ) } } \Theta ^ { ( t + 1 ) }$ . However, Eq. (3) is computationally expensive in
+167 both time and space. To further speed up the computation, we adopt a first-order approximation of
+168 the meta-gradient [17] and simplify the meta-gradient as
+
+$$
+\nabla _ { \mathcal { G } } b \approx \nabla _ { \Theta ^ { ( T ) } } b \left( \mathbf { Y } , \Theta ^ { ( T ) } , \mathbf { F } \right) \cdot \nabla _ { \mathcal { G } } \Theta ^ { ( T ) }
+$$
+
+169 Since the input graph is undirected, the derivative of the symmetric adjacency matrix A can be
+170computed as follows by applying the chain rule of a symmetric matrix [21].
+
+$$
+\nabla _ { \mathbf { A } } b \gets \nabla _ { \mathbf { A } } b + \left( \nabla _ { \mathbf { A } } b \right) ^ { T } - \mathrm { d i a g } \left( \nabla _ { \mathbf { A } } b \right)
+$$
+
+1For the node feature matrix $\mathbf { X }$ , its derivative is equal to the partial derivative $\nabla _ { \mathbf { X } } b$ since it is often an ‘2asymmetric matrix.
+
+73B-Graph poisoning with meta-gradient. After computing the meta-gradient of the bias function
+74 $\nabla _ { \boldsymbol { \mathcal { G } } } b$ , we aim to poison the input graph guided by $\nabla _ { \boldsymbol { \mathcal { G } } } b$ .We introduce two poisoning strategies: (1)
+75 continuous poisoning and (2) discretized poisoning.
+176 Continuous poisoning atack. The continuous poisoning attack is straightforward by reweighting
+177 edges in the graph.We first compute the meta-gradient of the bias function $\nabla _ { \mathbf { A } } b$ ,then use it to poison
+178 the input graph in a gradient descent-based updating rule as follows.
+
+$$
+\mathbf { A } \mathbf { A } - \eta \nabla _ { \mathbf { A } } b
+$$
+
+79where $\eta$ is a learning rate to control the magnitude of the poisoning attack. The learning rate should
+80satisfy n≤V11 to ensure that constraint on the budgeted attack.
+81Discretized poisoning attack. The discretized poisoning attack aims to select a set of edges to be
+82added/deleted. It is guided by a poisoning preference matrix defined as follows.
+
+$$
+\nabla _ { \mathbf { A } } = ( \mathbf { 1 } - 2 \mathbf { A } ) \circ \nabla _ { \mathbf { A } } b
+$$
+
+183 where 1 is an all-one matrix with the same dimension as $\mathbf { A }$ and $\bigcirc$ denotes the Hadamard product.
+184 A large positive $\nabla _ { \mathbf { A } } [ i , j ]$ indicates strong preference in adding an edge if nodes $i$ and $j$ are not
+185 connected (i.e., positive $\dot { \nabla } _ { \mathbf { A } } b [ i , j ]$ ,positive $( \mathbf { 1 } - 2 \mathbf { A } ) [ i , j ] )$ or deleting an edge if nodes $i$ and $j$ are
+186 connected (i.e., negative $\nabla _ { \mathbf { A } } b [ i , j ]$ ,negative $( \mathbf { 1 } - 2 \mathbf { A } ) [ i , j ] )$ . Then, a greedy selection strategy is
+187 applied to find the set of edges $\mathcal { E } _ { \mathrm { a t t a c k } }$ to be added/deleted.
+
+$$
+\mathcal { E } _ { \mathrm { a t t a c k } } = \mathrm { t o p k } ( \nabla _ { \mathbf { A } } , \delta )
+$$
+
+188 where $\mathrm { t o p k } ( \nabla _ { \mathbf { A } } , \delta )$ selects $\delta$ entries with highest preference score in $\nabla _ { \mathbf { A } }$ . Note that, if we only want
+189 to add edges without any deletion, all negative entries in $\nabla _ { \mathbf { A } } b$ should be zeroed out before computing
+190 Eq. (7).Likewise,if edges are only expected to be deleted,all positive entries should be zeroed out.
+91Remarks. Poisoning node feature matrix $\mathbf { X }$ follows the same steps as poisoning adjacency matrix A
+92without applying Eq. (5).
+193 C- Overal framework. FATE generally works as follows. (1) We first pre-train the surrogate graph
+194 learning model and get the corresponding learning model $\Theta ^ { ( T ) }$ as well as the learning results $\bar { \mathbf { Y } } ^ { ( T ) }$
+195 (2) Then we compute the meta gradient of the bias function using Eqs.(4) and (5). (3)Finall, we
+196 perform the discretized poisoning attack (Eqs.(7) and (8)) or continuous poisoning attack (Eq (6)).
+197 A detailed pseudo-code of FATE is provided in Appendix B.
+198 D -Limitations. Since FATE leverages the meta-gradient to poison the input graph, it requires the
+199 bias function $b \left( \mathbf { Y } , \Theta ^ { ( T ) } , \mathbf { F } \right)$ to be differentiable in order to calculate the meta-gradient $\nabla _ { \boldsymbol { \mathcal { G } } } b$ In
+200 Sections 4 and 5, we present a carefully chosen bias function for FATE. And we leave it for future
+201 work on exploring the ability of FATE in attcking other fairness definitions. Moreover, though the
+202 meta-gradient can be efciently computed via auto-differentiation in many deep learning packages
+203 (e.g., PyTorch², TensorFlow3), it requires $O ( n ^ { 2 } )$ space complexity to store the meta-gradient when
+204 attacking fairness via edge flipping. It is still a challenging open problem on how to efficiently
+205 compute the meta-gradient in terms of space. One possible remedy for discretized attck might be a
+206 low-rank approximation on the perturbation matrix formed by $\mathcal { E } _ { \mathrm { a t t a c k } }$ . Since the difference between
+207 the benign graph and poisoned graph are often small and budgeted $( d \left( \mathcal { G } , \widetilde { \mathcal { G } } \right) \leq B )$ , it is likely that
+208 the edge manipulations may be around a few set of nodes,which makes the perturbation matrix to be
+209 an (approximately) low-rank matrix.
+
+# 4Instantiation #1: Statistical Parity on Graph Neural Networks
+
+Here,we instantiate FATE framework by attacking statistical parity on graph neural networks in a binary node clasification problem with a binary sensitive attribute.We briefly discuss how to choose (1) the surrogate graph learning model used by the attacker, (2) the task-specific loss function in the lower-level optimization problem and (3) the bias function in the upper-level optimization problem.
+
+A - Surrogate graph learning model. We assume that the surrogate model to be used by the attacker is a 2-layer linear GCN [47] with diferent hidden dimensions and model parameters at initialization.
+
+B -Lower-level loss function. We consider a semi-supervised node classification task for the graph neural network to be attacked. Thus, the lower-level loss function is chosen as the cross entropy between the ground-truth label and the predicted label: $l \left( { \mathcal { G } } , \mathbf { Y } , \Theta , \theta \right) \ =$ Vn∑ieVi∑j=1yi,jlnyij,where Virain istheset of training nodes withground-truthlabels with $| \mathcal { V } _ { \mathrm { t r a i n } } |$ being its cardinality, $c$ is the number of classes, $y _ { i , j }$ is a binary indicator of whether node $i$ belongs to class $j$ and $\widehat { y } _ { i , j }$ is the prediction probability of node $i$ belonging to class $j$
+
+C- Upper-level bias function.We aim to attack statistical parity in the upper-level problem, which asks for $\mathrm { P } \left[ \hat { y } = 1 \right] = \mathrm { P } \left[ \hat { y } = 1 | s = 1 \right]$ . Suppose $p \left( \widehat { y } \right)$ is the probability density function (PDF) of $\widehat { y } _ { i , 1 }$ (202
+
+225 for any node $i$ and $p \left( \widehat { y } | s = 1 \right)$ is the PDF of $\widehat { y } _ { i , 1 }$ for any node $i$ belong to the demographic group
+226 with sensitive attribute value $s = 1$ . We observe that $\mathrm { ~ P ~ } [ \hat { y } = 1 ]$ and I $\bar { \boldsymbol { \vert \hat { y } } } = 1 \boldsymbol { \vert s = 1 \vert }$ are equivalent
+227 to the cumulative distribution functions (CDF) of $p \left( \widehat { y } < \frac { 1 } { 2 } \right)$ and $p$ $\begin{array} { r } { ( \widehat { y } < \frac { 1 } { 2 } | s = 1 ) } \end{array}$ ),respectively. To
+228 estimate both $\mathrm { ~ P ~ } [ \hat { y } = 1 ]$ and $\mathrm { P } [ \hat { y } = 1 | s = 1 ]$ with a differentiable function,we first estimate their
+229 probability density functions $\begin{array} { r } { ( p \left( \widehat { y } < \frac { 1 } { 2 } \right) } \end{array}$ and $p$ $\widehat { y } < \frac { 1 } { 2 } | s = 1 \big )$ ) with kernel density estimation (KDE,
+230 Definition 1).
+
+Definition1 (Kernel density estimation $I 7 J )$ Given a set of $n$ IID samples $\{ x _ { 1 } , \ldots , x _ { n } \}$ drawn from a distribution with an unknown probability density function $f$ ,the kernel density estimation of $f$ at point $\tau$ is defined as follows.
+
+$$
+{ \widetilde { f } } \left( \tau \right) = { \frac { 1 } { n a } } \sum _ { i = 1 } ^ { n } f _ { k } \left( { \frac { \tau - x _ { i } } { a } } \right)
+$$
+
+where $\widetilde { f }$ is the estimated probability density function, $f _ { k }$ is the kernel function and a is a non-negative bandwidth.
+
+236 Moreover, we assume the kernel function in KDE is the Gaussan kernel $\begin{array} { r } { f _ { k } \left( x \right) = \frac { 1 } { \sqrt { 2 \pi } } e ^ { - x ^ { 2 } / 2 } } \end{array}$
+237 However, computing the CDF of a Gaussian distribution is non-trivial. Following [9], we leverage a
+238 tractable approximation of the Gaussian Q-function as follows.
+
+$$
+Q ( \tau ) = F _ { k } \left( \tau \right) = \int _ { \tau } ^ { \infty } f _ { k } ( x ) d x \approx e ^ { - \alpha \tau ^ { 2 } - \beta \tau - \gamma }
+$$
+
+239where $\textstyle f _ { k } ( x ) = = { \frac { 1 } { \sqrt { 2 \pi } } } e ^ { - x ^ { 2 } / 2 }$ is a Gausindstrtionithoean $\alpha = 0 . 4 9 2 0$ $\beta = 0 . 2 8 8 7$ ,
+240 $\gamma = 1 . 1 8 9 3$ [30]. The overall workflow of estimating $\mathrm { ~ P ~ } [ \hat { y } = 1 ]$ is as follows.
+
+· For any node $i$ , get its prediction probability $\widehat { y } _ { i , 1 }$ with respect to class 1; ·Estimate the CDF $\mathrm { ~ P ~ } [ \hat { y } = 1 ]$ using a Gaussian KDE with bandwidth $a$ by $\mathrm { ~ P ~ } [ \hat { y } = 1 ] =$ $\begin{array} { r } { \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \exp \left( - \alpha \left( \frac { 0 . 5 - \widehat y _ { i , 1 } } { a } \right) ^ { 2 } - \beta \left( \frac { 0 . 5 - \widehat y _ { i , 1 } } { a } \right) - \gamma \right) } \end{array}$ where $\alpha ~ = ~ 0 . 4 9 2 0$ , $\beta ~ = ~ 0 . 2 8 8 7$ $\gamma =$ 1.1893 and $\exp ( x ) = e ^ { x }$ :
+
+Note that $\mathrm { P } [ \hat { y } = 1 | s = 1 ]$ can be estimated with a similar procedure with minor modifications. The only modifications needed are: (1) get the prediction probability of nodes with $s = 1$ and (2) compute the CDF using the Gaussian $\mathrm { Q }$ -function over nodes with $s = 1$ rather than all nodes in the graph.
+
+# 5Instantiation #2: Individual Fairness on Graph Neural Networks
+
+We provide another instantiation of FATE framework by attacking individual fairness on graph neural networks. Here, we consider the same surrogate graph learning model (i.e., 2-layer linear GCN) and the same lower-level loss function (i.e., cross entropy) as described in Section 4. To attack individual fairness,we define the upper-level bias function following the principles in [20]: the fairness-related auxiliary information matrix $\mathbf { F }$ is defined as the oracle symmetric pairwise node similarity matrix S (i.e., $\mathbf { F } = \mathbf { S } $ ),where ${ \bf S } [ i , j ]$ measures the similarity between node $i$ and node $j$ .Kang et al. [2O] define that the overall individual bias to be $\operatorname { T r } \left( \mathbf { Y } ^ { T } \mathbf { L } _ { \mathbf { S } } \mathbf { Y } \right)$ . Assuming that $\mathbf { Y }$ is the output of an optimization-based graph learning model, $\mathbf { Y }$ can be viewed as a function with respect to the input graph $\mathcal { G }$ , which makes $\mathbf { \dot { T r } } \left( \mathbf { Y } ^ { T } \mathbf { L } \mathbf { s } \mathbf { \check { Y } } \right)$ differentiable with respect to $\mathcal { G }$ . Thus, the bias function $b ( \cdot )$ can be naturally defined as the overall individual bias of the input graph $\mathcal { G }$ ,i.e., $b \left( \mathbf { Y } , \Theta ^ { * } , \mathbf { S } \right) = \mathrm { T r } \left( \mathbf { Y } ^ { T } \mathbf { L } _ { \mathbf { S } } \mathbf { Y } \right)$
+
+# 6Experiments
+
+# 6.1Attacking Statistical Parity on Graph Neural Networks
+
+Settings.We compare FATE with 4 baseline methods,i.e.,Random,DICE [46], FA-GNN [19],under the same setting as in Section 4. That is,(1) the fairness definition to be attacked is statistical parity; (2) the downstream task is binary semi-supervised node classification with binary sensitive attributes. The experiments are conducted on 3 real-world datasets,i.e., Pokec-n, Pokec-z and Bail. Similar to existing works, we use the $5 0 \% / 2 5 \% / 2 5 \%$ splits for train/validation/test sets. For all baseline
+
+Table 1: Effectiveness of attacking group fairness on GCN.FATE poisons the graph via both edge flipping (FATE-flip) and edge addition (FATE-add) while all other baselines poison the graph via edge addition. Higher is better $( \uparrow )$ for micro F1 score (Micro F1) and $\Delta _ { \mathrm { S P } }$ .Bold font indicates the success of fairness attack (i.e., $\Delta _ { \mathrm { S P } }$ is increased after fairness attack) with the highest micro F1 score. Underlined cell indicates the failure of fairness attack (i.e., $\Delta _ { \mathrm { S P } }$ is decreased after fairness attack).
+
+
Dataset
Ptb.
Random MicroF1(↑)
DICE
FA-GNN
FATE-flip
FATE-add
△sP(↑)
Micro F1(↑)
△sP(↑)
MicroF1(↑)
△sP()
MicroF1(↑
△sP()
MicroF1(↑)
△sP(↑)
Pokec-n
0.00
67.5± 0.3
7.1 ± 0.4
67.5±0.3
7.1 ±0.4
67.5± 0.3
7.1 ±0.4
67.5± 0.3
7.1 ± 0.4
67.5± 0.3
7.1 ± 0.4
0.05
68.0±0.3
6.2±0.8
67.6±0.2
6.8±0.3
67.8±0.1
3.3±0.4
67.9 ±0.4
9.3 ±1.2
67.9 ±0.4
9.3 ±1.2
0.10
66.8±0.8
7.3±0.7
66.1 ± 0.5
6.6 ±1.1
66.0±0.2
11.5± 0.6
68.2±0.6
9.8±1.5
68.2±0.6
9.8±1.5
0.15
66.7 ± 0.4
8.1 ± 0.4
65.6±0.4
7.7±0.8
66.0 ±0.4
15.6 ±3.0
68.0±0.3
11.5 ± 1.0
68.0±0.3
11.5 ± 1.0
0.20
66.3±0.7
8.6±1.8
64.2 ± 0.4
3.4±0.9
65.8± 0.1
18.4±0.7
68.2±0.5
12.0 ±1.8
68.2±0.5
12.0 ± 1.8
0.25
66.2±0.6
8.5±0.8
63.4 ±0.2
6.3±0.8
66.6±0.2
23.3 ±0.5
68.3±0.4
12.1 ± 2.1
68.3±0.4
12.1 ± 2.1
0.00
68.4±0.4
6.6±0.9
68.4 ± 0.4
6.6±0.9
68.4±0.4
6.6±0.9
68.4± 0.4
6.6±0.9
68.4±0.4
6.6±0.9
Pokec-z
0.05
68.8±0.4
6.4±0.6
67.4 ±0.5
6.6±0.3
68.1±0.3
2.2 ±0.4
68.7±0.4
6.7 ± 1.4
68.7±0.4
6.7 ± 1.4
0.10
68.7±0.3
8.0±0.6
66.5±0.2
6.3±0.8
67.7±0.4
13.5± 0.9
68.7±0.6
7.5±0.7
68.7±0.6
7.5±0.7
0.15
67.9 ±0.3
9.1 ±0.8
65.9 ±0.8
5.5±1.3
66.6 ±0.4
16.9 ± 2.6
69.0±0.8
8.5 ± 1.1
69.0±0.8
8.5 ± 1.1
0.20
68.5 ±0.4
9.3 ±1.0
62.9 ±0.7
8.7 ±1.0
66.1±0.2
25.4 ± 1.3
68.5±0.6
8.8 ±1.1
68.5±0.6
0.25
68.3± 0.5
7.3 ±0.5
63.9 ±0.4
6.0 ± 1.0
65.5± 0.6
22.3 ± 2.8
68.5 ± 1.1
8.6±2.5
68.5 ± 1.1
8.8 ±1.1
0.00
93.1 ±0.2
8.0±0.2
93.1 ±0.2
8.0 ±0.2
93.1± 0.2
8.0±0.2
93.1 ±0.2
8.6±2.5
0.05
8.1±0.0
91.6 ± 0.2
8.5±0.1
91.7 ± 0.1
10.0 ± 0.4
8.0±0.2
93.1 ± 0.2
8.0±0.2
Bail
0.10
92.7±0.2 92.2±0.2
7.8±0.2
90.3 ±0.1
8.5±0.1
90.5±0.0
10.3 ± 0.4
92.6 ± 0.1 92.4±0.1
8.6±0.1
92.5 ± 0.1
8.6±0.1
0.15
91.9±0.2
7.8±0.1
89.2±0.1
7.7±0.1
90.0±0.2
8.4±0.2
92.2±0.2
8.9±0.1
92.4 ± 0.1
8.6 ±0.1
91.6 ±0.2
7.8±0.1
88.3±0.1
8.3±0.1
89.7 ±0.1
7.4 ±0.4
92.2±0.2
9.1 ± 0.1
92.3 ±0.1
9.1 ± 0.1
0.20 0.25
91.4±0.1
8.3±0.1
87.8±0.0
7.8 ±0.1
89.8±0.2
5.2±0.2
92.1±0.1
9.3±0.1 9.1±0.2
92.3 ±0.1
9.3±0.2
92.1 ± 0.1
9.1 ±0.3
+
+267 methods,the victim models are set to GCN [26]. For each dataset, we use a fixed random seed to
+268 learn the poisoned graph corresponding to each baseline method. Then we train the victim model 5
+269 times with different random seeds.For fair comparison, we only attack the adjacency matrix in all
+270 experiments. Please refer to Appendix C for detailed experimental settings.
+
+Main results.For FATE, we conduct fairness attacks via both edge flipping (FATE-flip in Table 5) and edge addition (FATE-add in Table 1). For all other baseline methods, edges are only added. The effectiveness of fairness attacks on GCN are presented in Tables 5.From both tables, we have the following key observations: (1) FATE-flip and FATE-add are the only methods that consistently succeeds in fairness attcks,while allother baseline methods might fail in some cases (indicated by the underlined $\Delta _ { \mathrm { S P } }$ in both tables) because of the decrease in $\Delta _ { \mathrm { S P } }$ . (2)FATE-flip and FATE-add can not only amplify $\Delta _ { \mathrm { S P } }$ consistently, but also achieve the best micro F1 score on node classification, which makes FATE-flip and FATE-add more deceptive than all baseline methods. Notably,FATE-flip and FATE-add are able to even increase micro F1 score on alldatasets, while other baseline methods attck the graph neural networks at the expense of utility (micro F1 score). (3) Though FA-GNN could make the model more biased in some cases, it cannot guarantee consistent success in fairness attacks on all three datasets as shown by the underlined $\Delta _ { \mathrm { S P } }$ in both tables.All in all,our proposed FATE framework is the framework that consistently succeeds in fairness atacks while being the most deceptive (i.e., highest micro F1 score).
+
+Effect of the perturbation rate.From Table 1,we have the following observations. First, $\Delta _ { \mathrm { S P } }$ tends to increase when the perturbation rate increases, which demonstrates the effectiveness of FATE-flip and FATE-add for attacking fairness. Though in some cases $\Delta _ { \mathrm { S P } }$ might have a marginal decrease, FATE-flip and FATE-add still successfully attack the fairness compared with GCN trained on the benign graph by being larger to the $\Delta _ { \mathrm { S P } }$ when perturbation rate (Ptb.) is O. Second,FATE-flip and FATE-add are deceptive, meaning that the micro F1 scores is close to or even higher than the micro F1 scores on the benign graph compared with the corresponding metrics trained . In summary, across different perturbation rates,FATE-flip and FATE-add are both effective,i.e.,amplifying more bias with higher perturbation rate,and deceptive,i.e., achieving similar or even higher micro F1 score.
+
+
+Figure 1: Attacking statistical parity with FATE-flip. (a)Ratios of flipped edges that connect two nodes with same/different label or sensitive attribute (sens. atr.). (b) SL (abbreviation for same label) refers to the ratios of flipped edges whose two endpoints are both from the same class. SSA (abbreviation for same sensitive atribute)refers to the ratios of manipulated edges whose two endpoints are both from the same demographic group. Majority/minority classes are determined by spliting the training nodes based on their class labels. The protected group is the demographic group with fewer nodes.
+
+294 Analysis on the manipulated edges.Here, we aim to characterize the properties of edges that are
+295 flipped by FATE (i.e.,FATE-flip) in attcking statistical parity. The reason to only analyze FATE-flip is
+296 that the majority of edges manipulated by FATE-flip on al three datasets is by addition (i.e., flipping
+297 from non-existing to existing). Figure 1b suggests that, if the two endpoints of an manipulated edge
+298 share the same class label or same sensitive attribute value,these two endpoints are most likely from
+299 the minority class and protected group. Combining Figures la and 1b,FATE would significantly
+300 increase the number of edges that are incident to nodes in the minority class and/or protected group.
+
+More experimental results.Due to the space limitation, we defer more experimental results on atacking statistical parity on graph neural networks in Appendix D. More specifically, we present the performance evaluation under different metrics,i.e.,Macro F1 and AUC,as wellas the effectiveness of FATE with a different victim model, i.e., FairGNN[11], which ensures statistical parity.
+
+# 6.2Attacking Individual Fairness on Graph Neural Networks
+
+Settings.To showcase the ability of FATE on atacking the individual fairness (Section 5), we further compare FATE with the same set of baseline methods (Random, DICE [46],FA-GNN [19]) on the same set of datasets (Pokec-n, Pokec-z, Bail).We follow the setings as in Section 5. We use the $5 0 \% / 2 5 \% / 2 5 \%$ splits for train/validation/test sets with GCN [26] being the victim model. For each dataset, we use a fixed random seed to learn the poisoned graph corresponding to each baseline method.Then we train the victim model 5 times with different random seeds. And each entry in the oracle pairwise node similarity matrix is computed by the cosine similarity of the corresponding rows in the adjacency matrix. That is, ${ \bf S } [ i , j ] = \cos ^ { } ( { \bf A } [ i , : ] , A [ j , : ] )$ , where cos () is the function to compute cosine similarity. For fair comparison, we only attack the adjacency matrix in all experiments. Please refer to Appendix C for detailed experimental settings.
+
+Main results. Similarly,we test FATE with both edge flipping (FATE-flip in Table 2) and edge addition (FATE-add in Table 2), while all other baseline methods only add edges.From Table 2, we have two key observations.(1)FATE-flip and FATE-add are effective: theyare the only methods that could consistently attack individual fairness whereas all other baseline methods mostly fail to attack individual fairness.(2) FATE-flip and FATE-add are deceptive: they achieve comparable or even better utility on all datasets compared with the utility on the benign graph. Hence,FATE framework is able to achieve effective and deceptive attacks to exacerbate individual bias.
+
+Effect of the perturbation rate.From Table 2, we obtain similar observations as in Section 6.1 for Bail dataset. While for Pokec-n and Pokec-z, the correlation between the perturbation rate (Ptb.) and the individual bias is weaker. One possble reason is that: for Pokec-n and Pokec-z,the discrepancy between the oracle pairwise node similarity matrix and the benign graph is larger. Since the individual bias is computed using the oracle pairwise node similarity matrix rather than the benign/poisoned adjacency matrix, higher perturbation rate to poison the adjacency matrix may have less impact on the computation of individual bias.
+
+
+Figure 2: Attcking individual fairness with FATE-flip. (a) Ratios of flipped edges that connect two nodes with same/different label. (b) Ratios of flipped edges whose two endpoints are both from the majority/minority class. Majority/minority classes are formed by splitting the training nodes based on their class labels.
+
+30 Analysis on the manipulated edges. Similarly,since the majority of edges manipulated by FATE-flip
+31 is through addition, we only analyze FATE-flip here.From Figure 2, we can find out that FATE will
+32 manipulate edges from the same class (especially from the minority class). In this way,FATE would
+33 find edges that could increase individual bias and improve the utility of the minority class in order to
+34 make the fairness attack deceptive.
+
+More experimental results. Due to the space limitation, we defer more experimental results on attacking individual fairness on graph neural networks in Appendix E.More specifically, we present the performance evaluation under different metrics,i.e., Macro F1 and AUC,as well as the effectiveness of FATE with a diferent victim model, i.e., InFoRM-GNN [20], which mitigates individual bias.
+
+Table 2: Effectiveness of attcking individual fairness on GCN.FATE poisons the graph via both edge flipping (FATE-flip) and edge addition (FATE-add) while all other baselines poison the graph via edge addition.Higher is beter(↑) for micro F1 score (Micro F1) and InFoRM bias (Bias).Bold font indicates the success of fairness attack (i.e., bias is increased after attack) with the highest micro F1 score.Underlined cell indicates the failure of fairness attack (i.e., $\Delta _ { \mathrm { S P } }$ is decreased after attack).
+
+
Dataset
Ptb.
Random
DICE
FA-GNN
FATE-flip
FATE-add
Micro F1(↑)
Bias(↑)
Micro F1(↑)
Bias(↑)
Micro F1(↑)
Bias(↑)
Micro F1(↑)
Bias(↑)
Micro F1(↑)
Bias (↑)
Pokec-n
0.00
67.5± 0.3
0.9±0.2
67.5±0.3
0.9±0.2
67.5±0.3
0.9±0.2
67.5±0.3
0.9±0.2
67.5±0.3
0.9±0.2
0.05
67.6±0.3
1.6 ±0.3
66.9 ±0.3
1.6 ± 0.2
67.8±0.5
1.9 ±0.2
67.8±0.3
1.2 ±0.4
67.6 ± 0.3
1.5 ± 0.6
0.10
67.2±0.5
1.4 ± 0.3
65.3±0.7
1.1 ± 0.1
67.4 ± 0.4
1.2 ±0.2
67.9 ±0.4
1.3 ± 0.3
67.7 ± 0.4
1.6 ± 0.4
0.15
67.2 ± 0.3
1.2 ± 0.4
63.9± 0.6
1.1 ± 0.2
66.1 ± 0.3
1.5±0.3
67.8±0.4
1.2 ± 0.2
67.6 ± 0.2
1.1 ±0.3
0.20
66.6±0.3
1.1 ±0.2
63.8± 0.1
0.8±0.1
65.7±0.6
1.5 ± 0.3
67.3 ± 0.4
1.1 ± 0.3
68.2± 1.0
1.7 ±0.8
0.25
66.7±0.3
1.3 ± 0.4
62.5± 0.4
0.6±0.0
65.2 ±0.5
1.3 ± 0.4
67.8±0.8
1.4 ±0.7
67.9±0.9
1.4±0.7
0.00
68.4 ± 0.4
2.6±0.7
68.4±0.4
2.6 ± 0.7
68.4 ± 0.4
2.6± 0.7
68.4 ± 0.4
2.6±0.7
68.4 ± 0.4
2.6±0.7
Pokec-z
0.05
69.0±0.4
3.4±0.5
67.1±0.5
2.7±1.0
68.1 ± 0.4
2.9±0.3
68.7±0.5
2.9 ±0.5
68.7± 0.4
3.1 ± 1.0
0.10
68.7 ±0.1
2.4 ±0.5
66.3± 0.6
1.7 ± 0.6
68.2 ±0.5
1.7 ± 0.5
69.0±0.6
2.9 ±0.6
69.0 ± 0.5
3.0±0.6
0.15
67.9 ±0.3
2.8±0.3
65.5±0.3
1.4 ± 0.3
67.0±0.5
1.3±0.2
68.6±0.5
2.9 ±0.6
69.0 ±0.7
2.7 ±0.4
0.20
67.9 ±0.3
2.2±0.6
64.2±0.4
0.7±0.3
66.1±0.1
1.6 ±0.5
68.8 ± 0.4
3.0 ± 0.4
69.2± 0.4
2.9 ±0.3
0.25
67.6±0.3
1.9±0.3
64.2±0.3
0.5±0.1
65.1±0.3
1.9 ±0.6
69.1 ±0.3
2.9±0.7
69.3±0.3
2.7±0.6
0.00
93.1±0.2
7.2 ±0.6
93.1 ± 0.2
7.2 ±0.6
93.1 ± 0.2
7.2 ±0.6
93.1 ± 0.2
7.2 ±0.6
93.1±0.2
7.2±0.6
0.05
92.1± 0.3
8.0±1.9
91.8±0.1
7.1 ± 1.1
91.2 ±0.2
5.6±0.7
93.0±0.3
7.8±1.0
92.9± 0.2
7.7±1.0
Bail
0.10
91.6 ± 0.1
7.3 ±1.2
90.3±0.1
6.1 ±0.6
90.3±0.1
5.1±0.4
93.0±0.1
8.0±0.7
92.9±0.2
7.9 ±0.8
0.15
91.3±0.1
6.5±0.9
89.4±0.0
4.8 ±0.1
89.8 ±0.1
5.2 ±0.1
93.1± 0.1
8.2 ±0.6
93.0±0.2
7.8 ±0.8
0.20
91.2 ±0.2
6.6±0.6
88.5±0.1
4.0±0.4
89.3 ± 0.1
5.3±0.4
93.1±0.1
7.9 ±0.6
93.1 ± 0.1
8.2±0.6
0.25
90.9 ±0.1
6.8±0.8
87.4±0.3
3.6±0.5
88.9 ±0.1
5.4±0.3
92.9 ±0.1
7.6±0.5
93.0±0.2
7.8 ±0.7
+
+# 7Related Work
+
+Algorithmic fairness on graphs aims to obtain debiased graph learning results such that a predefined fairness definition can be satisfied with respect to the nodes/edges in the graph. Several definitions of the fairness has been studied so far. Group fairness in graph embedding can be ensured via several ways,including adversarial learning-based methods [5,11],random walk-based methods [36,25] and dropout-based methods [39]. Individual fairness on graphs can be ensured via Lipschitz regularization [20] and learning-to-rank [13]. Other than the aforementioned two fairness definitions, several other fairness definitions are studied in the context of graph learning, including counterfactual fairness [1,31],degree fairness [42,24,29],dyadic fairness [32,27]and max-min fairness [37, 43]. For a comprehensive review of related works, please refer to existing surveys [50,10,14]and tutorials [22,23]. It should be noted that our work aims to attack fairness (i.e., making the model more biased) rather than ensuring fairness as in the aforementioned literature.
+
+Adversarial attacks on graphs aim to exacerbate the utility of graph learning models by perturbing the input graph topology and/or node features. Several approaches have been proposed to attack graph learning models, including reinforcement learning [12], bi-level optimization [51, 52],projected gradient descent [40, 48] and edge rewiring/flipping [4,31]. Other than adversarial attacks that worsen the utility of a graph learning model,a few efforts have been made to attack the fairness of a machine learning model for IID tabular data via label flipping [33],adversarial data injection [38,8], adversarial sampling [44]. Different from [38,33,8,44], we aim to poison the input graph via structural modifications on the topology rather than injecting adversarial data sample(s). The most related work to our proposed method is by Hussain et al.[19], which degrade the group fairness of graph neural networks by randomly injecting edges for nodes in different demographic groups and with different class labels. In contrast,our proposed method could attck any fairness definition for any graph learning models via arbitrary edge manipulation operations, as long as the bias function and the utility loss are differentiable.
+
+# 8Conclusion
+
+We study the problem of fairness attacks on graph learning models, whose goal is to amplify the bias while maintaining the utility on the downstream task.We formally define the problem as a bi-level optimization problem, where the upper-level optimization problem maximizes the bias function with respect to a user-defined fairness definition and the lower-level optimization problem minimizes a task-specific loss function. We then propose a meta learning-based framework named FATE to poison the input graph using the meta-gradient of the bias function with respect to the input graph. We instantiate FATEby attcking statistical parity on graph neural networks in a binary node classification problem with binary sensitive attributes. Empirical evaluation demonstrates that FATE is effective (consistently amplifying bias) and deceptive (achieving the highest micro F1 score).
+
+75References [1] Chirag Agarwal, Himabindu Lakkaraju, and Marinka Zitnik. Towards a unified framework for fair and stable graph representation learning. In Uncertainty in Artificial Intelligence, pages 2114-2124.PMLR,2021. [2] Joachim Baumann, Anik6 Hannak,and Christoph Heitz. Enforcing group fairness in algorithmic decision making: Utility maximization under suficiency. In 2O22 ACM Conference on Fairness, Accountability, and Transparency, pages 2315-2326, 2022. [3] Yoshua Bengio. Gradient-based optimization of hyperparameters. Neural computation, 12(8):1889-1900,2000. [4] Aleksandar Bojchevski and Stephan Gunnemann. Adversarial attacks on node embeddings via graph poisoning. In International Conference on Machine Learning, pages 695-7O4. PMLR, 2019. [5] Avishek Bose and William Hamilton. Compositional fairness constraints for graph embeddings. In International Conference on Machine Learning, pages 715-724. PMLR, 2019. [6] Consumer Financial Protection Bureau. CFPB targets unfair discrimination in consumerfinance. https://www.consumerfinance.gov/about-us/newsroom/ cfpb-targets-unfair-discrimination-in-consumer-finance/, 2022. [Online; accessed 13-April-2023]. [7] Yen-Chi Chen. A tutorial on kernel density estimation and recent advances. Biostatistics & Epidemiology,1(1):161-187, 2017. [8] Anshuman Chhabra, Adish Singla, and Prasant Mohapatra. Fairness degrading adversarial attacks against clustering algorithms. arXiv preprint arXiv:2110.12020, 2021. [9] Jaewoong Cho, Gyeongjo Hwang, and Changho Suh. A fair classifier using kernel density estimation. Advances in neural information processing systems, 33:15088-15099,2020. [10] Manvi Choudhary, Charlotte Laclau,and Christine Largeron. A survey on fairness for machine learning on graphs. arXiv preprint arXiv:2205.05396, 2022. [11] Enyan Dai and Suhang Wang. Say no to the discrimination: Learning fair graph neural networks with limited sensitive atribute information. In Proceedings of the 14th ACM International Conference on Web Search and Data Mining, pages 680-688, 2021. [12] Hanjun Dai, Hui Li, Tian Tian, Xin Huang,Lin Wang, Jun Zhu, and Le Song. Adversarial attack on graph structured data. In International conference on machine learning, pages 1115-1124. PMLR,2018. [13] Yushun Dong, Jian Kang, Hanghang Tong,and Jundong Li. Individual fairness for graph neural networks: A ranking based approach. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, pages 300-310, 2021.
+10[14] Yushun Dong, Jing Ma, Chen Chen,and Jundong Li. Fairness in graph mining: A survey. arXiv preprint arXiv:2204.09888,2022. [15] Cynthia Dwork, Moritz Hardt, Toniann Pitass, Omer Reingold,and Richard Zemel. Fairness through awareness. In Proceedings of the 3rd innovations in theoretical computer science conference, pages 214-226,2012. [16]Michael Feldman, Sorelle A Friedler, John Moeller, Carlos Scheidegger, and Suresh Venkatasubramanian. Certifying and removing disparate impact. In proceedings of the 21th ACM SIGKDD international conference on knowledge discovery and data mining, pages 259-268, 2015.
+19[17] Chelsea Finn,Pieter Abbeel,and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International conference on machine learning, pages 1126-1135. PMLR,2017.
+[18] Moritz Hardt, Eric Price, and Nati Srebro. Equality of opportunity in supervised learning. Advances in neural information processing systems, 29,2016.
+[19] Hussain Hussain,Meng Cao, Sandipan Sikdar,Denis Helic, Elisabeth Lex,Markus Strohmaier, and Roman Kern. Adversarial inter-group link injection degrades the fairness of graph neural networks. arXiv preprint arXiv:2209.05957,2022.
+[20] Jian Kang, Jingrui He, Ross Maciejewski,and Hanghang Tong. Inform: Individual fairness on graph mining. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 379-389,2020.
+[21] Jian Kang and Hanghang Tong. N2n: Network derivative mining. In Proceedings of the 28th ACM International Conference on Information and Knowledge Management, pages 861-870, 2019.
+[22] Jian Kang and Hanghang Tong.Fair graph mining.In Proceedings ofthe 3Oth ACM International Conference on Information & Knowledge Management, pages 4849-4852,2021.
+[23] Jian Kang and Hanghang Tong. Algorithmic fairness on graphs: Methods and trends. In Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pages 4798-4799,2022.
+[24] Jian Kang, Yan Zhu, Yinglong Xia, Jiebo Luo,and Hanghang Tong. Rawlsgcn: Towards rawlsian difference principle on graph convolutional network. In Proceedings of the ACM Web Conference 2022, pages 1214-1225,2022.
+[25] Ahmad Khajehnejad,Moein Khajehnejad, Mahmoudreza Babaei, Krishna P Gummadi,Adrian Weler, and Baharan Mirzasoleiman. Crosswalk: Fairness-enhanced node representation learning. In Proceedings of the AAAl Conference on Artificial Intelligence, volume 36, pages 11963-11970,2022.
+[26] Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations,2017.
+[27] Peizhao Li, Yifei Wang, Han Zhao, Pengyu Hong,and Hongfu Liu. On dyadic fairness: Exploring and mitigating bias in graph connections. In International Conference on Learning Representations,2021.
+[28] Lydia TLiu, Sarah Dean, Esther Rolf, Max Simchowitz,and Moritz Hardt. Delayed impact of fair machine learning. In International Conference on Machine Learning, pages 3150-3158. PMLR,2018.
+[29] Zemin Liu, Trung-Kien Nguyen, and Yuan Fang. On generalized degree fairness in graph neural networks. arXiv preprint arXiv:2302.03881,2023.
+[30] Miguel López-Benitez and Fernando Casadevall. Versatile,accurate,and analytically tractable approximation for the gaussian q-function. IEEE Transactions on Communications,59(4):917- 922,2011.
+[31] Yao Ma, Suhang Wang,Tyler Derr,Lingfei Wu,and Jiliang Tang. Graph adversarial attack via rewiring. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, pages 1161-1169,2021.
+[32] Farzan Masrour, Tyler Wilson, Heng Yan, Pang-Ning Tan,and Abdol Esfahanian. Bursting the filter bubble: Fairness-aware network link prediction. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pages 841-848,2020.
+[33] Ninareh Mehrabi, Muhammad Naveed, Fred Morstatter, and Aram Galstyan.Exacerbating algorithmic bias through fairness attcks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 8930-8938,2021.
+[34] Lawrence Page, Sergey Brin, Rajeev Motwani,and Terry Winograd. The pagerank citation ranking: Bringing order to the web. Technical report, Stanford InfoLab,1999.
+169[35] Flavien Prost,Hai Qian, Qiuwen Chen,Ed HChi,Jilin Chen,and Alex Beutel. Toward a better trade-off between performance and fairness with kernel-based distribution matching. arXiv preprint arXiv:1910.11779,2019.
+172[36] Tahleen Rahman, Bartlomiej Surma, Michael Backes,and Yang Zhang. Fairwalk: Towards fair graph embedding. In Proceedings of the 28th International Joint Conference on Artificial Intelligence, pages 3289-3295,2019.
+175[37] Aida Rahmattalabi,Phebe Vayanos,Anthony Fulginiti,Eric Rice,Bryan Wilder,Amulya Yadav, and Milind Tambe. Exploring algorithmic fairness in robust graph covering problems. Advances in Neural Information Processing Systems,32, 2019. [38] David Solans, Battista Biggio,and Carlos Castillo. Poisoning attcks on algorithmic fairness. In Machine Learning and Knowledge Discovery in Databases: European Conference, ECML PKDD 2020, Ghent, Belgium, September 14-18,2020,Proceedings,Part I, pages 162-177. Springer, 2021. [39] Indro Spineli, Simone Scardapane, Amir Hussain,and Aurelio Uncini. Fairdrop: Biased edge dropout for enhancing fairness in graph representation learning. IEEE Transactions on Artificial Intelligence,3(3):344-354,2021. [40] Mingjie Sun, Jian Tang,Huichen Li,Bo Li, Chaowei Xiao, Yao Chen,and Dawn Song. Data poisoning attack against unsupervised node embedding methods. arXiv preprint arXiv:1810.12881, 2018. [41] Jian Tang, Meng Qu, Mingzhe Wang,Ming Zhang, Jun Yan,and Qiaozhu Mei. Line: Largescale information network embedding. In Proceedings of the 24th international conference on world wide web, pages 1067-1077,2015. [42] Xianfeng Tang, Huaxiu Yao, Yiwei Sun, Yiqi Wang, Jiliang Tang, Charu Aggarwal, Prasenjit Mitra, and Suhang Wang. Investigating and mitigating degree-related biases in graph convolutional networks. In Proceedings of the 29th ACM International Conference on Information & Knowledge Management, pages 1435-1444,2020. [43] Alan Tsang,Bryan Wilder, Eric Rice,Milind Tambe,and Yair Zick. Group-fairness in influence maximization. In Proceedings of the 28th International Joint Conference on Artificial Intelligence, pages 5997-6005,2019.
+198[44] Minh-Hao Van, Wei Du, Xintao Wu,and Aidong Lu. Poisoning attacks on fair machine learning. In International Conference on Database Systems for Advanced Applications, pages 370-386. Springer, 2022. [45] Daixin Wang, Jianbin Lin, Peng Cui, Quanhui Jia, Zhen Wang, Yanming Fang, Quan Yu, Jun Zhou, Shuang Yang,and Yuan Qi. A semi-supervised graph atentive network for financial fraud detection. In 2019 IEEE International Conference on Data Mining (ICDM), pages 598-607. IEEE,2019.
+505[46] Marcin Waniek, Tomasz_P Michalak,Michael J Wooldridge,and Talal Rahwan.Hiding individuals and communities in a social network. Nature Human Behaviour,2(2):139-147, 2018.
+508[47] Felix Wu, Amauri Souza, Tianyi Zhang, Christopher Fifty, Tao Yu, and Kilian Weinberger. Simplifying graph convolutional networks. In International conference on machine learning, pages 6861-6871. PMLR,2019. [48] Kaidi Xu, Hongge Chen, Sijia Liu, Pin-Yu Chen, Tsui-Wei Weng,Mingyi Hong,and Xue Lin. Topology attack and defense for graph neural networks: An optimization perspective. In Proceedings of the 28th International Joint Conference on Artificial Intelligence, pages 3961-3967,2019.
+;15[49] Si Zhang,Dawei Zhou, Mehmet Yigit Yildirim, Scot Alcorn,Jingrui He,Hasan Davulcu,and Hanghang Tong. Hidden: Hierarchical dense subgraph detection with application to financial fraud detection. In Proceedings of the 20l7 SIAM International Conference on Data Mining, pages 570-578. SIAM,2017.
+[50] Wenbin Zhang, Jeremy C Weiss,Shuigeng Zhou, and Toby Walsh. Fairness amidst non-iid graph data: A literature review. arXiv preprint arXiv:2202.07170, 2022.
+[51] Daniel Zügner, Amir Akbarnejad,and Stephan Gunnemann. Adversarial attacks on neural networks for graph data. In Proceedings of the 24th ACM SIGKDD international conference on knowledge discovery & data mining, pages 2847-2856,2018.
+[52] Daniel Zügner and Stephan Gunnemann. Adversarial attcks on graph neural networks via meta learning. In International Conference on Learning Representations, 2019.
\ No newline at end of file
diff --git a/md/dev/ti6fH3EhFkv/ti6fH3EhFkv.md b/md/dev/ti6fH3EhFkv/ti6fH3EhFkv.md
new file mode 100644
index 0000000000000000000000000000000000000000..1d5cee64325385f9b162d80e8ca2f4fdf59bb3c4
--- /dev/null
+++ b/md/dev/ti6fH3EhFkv/ti6fH3EhFkv.md
@@ -0,0 +1,283 @@
+# TOWARDS A UNIFIED VIEW ON VISUAL PARAMETEREFFICIENT TRANSFER LEARNING
+
+Anonymous authors Paper under double-blind review
+
+# ABSTRACT
+
+Since the release of various large-scale natural language processing (NLP) pretrained models, parameter efficient transfer learning (PETL) has become a popular paradigm capable of achieving impressive performance on various downstream tasks. PETL aims at making good use of the representation knowledge in the pretrained large models by fine-tuning a small number of parameters. Recently, it has also attracted increasing attention to developing various PETL techniques for vision tasks. Popular PETL techniques such as Prompt-tuning and Adapter have been proposed for high-level visual downstream tasks such as image classification and video recognition. However, Prefix-tuning remains under-explored for vision tasks. In this work, we intend to adapt large video-based models to downstream tasks with a good parameter-accuracy trade-off. Towards this goal, we propose a framework with a unified view of PETL called visual-PETL (V-PETL) to investigate the effects of different PETL techniques, data scales of downstream domains, positions of trainable parameters, and other aspects affecting the tradeoff. Specifically, we analyze the positional importance of trainable parameters and differences between NLP and vision tasks in terms of data structures and pretraining mechanisms while implementing various PETL techniques, especially for the under-explored prefix-tuning technique. Based on a comprehensive understanding of differences between NLP and video data, we propose a new variation of prefix-tuning module called parallel attention (PATT) for video-based downstream tasks. An extensive empirical analysis on two video datasets via different frozen backbones has been carried and the findings show that the proposed PATT can effectively contribute to other PETL techniques. An effective scheme SwinBAPAT derived from the proposed V-PETL framework achieves significantly better performance than the state-of-the-art AdaptFormer-Swin with slightly more parameters and outperforms full-tuning with far less parameters.
+
+# 1 INTRODUCTION
+
+Many vision tasks rely on fine-tuning pre-trained models to achieve good performance. One standard modus operandi of transfer learning consists of two steps: pre-train a model on a source domain and fine-tune the entire model on a target domain (Zhuang et al., 2020). Despite that prior works have achieved promising performance, such vanilla practice of fine-tuning is faced with challenges for adopting large models to downstream tasks. This full-tuning strategy requires one to update and store separate model parameters for different downstream tasks, which can be expensive and infeasible for the era of increasingly large models from EfficientNet-based (Pham et al., 2021) (480M parameters) to Transformer-based (Yu et al., 2022) (2, 100M parameters) ones. For such large models, making good use of shared parameter weights deployed on the cloud can be beneficial for edge devices such as autonomous vehicles, drones who are intensive in computing and battery resources (Yuan et al., 2022). Second, the full fine-tuning strategy relies on high-quality downstream data and can hardly adapt to unseen scenarios that have large distribution shift (Kumar et al., 2021), which is unlike the learning process of humans who can learn from few samples and generalize well to new circumstances. This issue has been researched in directions such as zero-shot learning, few-shot learning, and continual learning (Li et al., 2021a). Another popular strategy is fine-tuning the downstream task head, i.e., the last fully connected (FC) layer, to avoid tuning the whole backbone model, which usually leads to poor performance when the target domain is large in data scale (see Figure
+
+1). Given the paradigm of fine-tuning increasingly large models, how to transfer such large models with parameter-accuracy trade-off is a hot topic in various domains (Gusak et al., 2022; Sung et al., 2022; Lin et al., 2020; Houlsby et al., 2019).
+
+Taking the video-based action recognition task as an example, it can be inconvenient for deploying such large models to edge devices such as an autonomous driving (Liu et al., 2019) and unmanned aerial vehicle (Li et al., 2021b) as they can heavily rely on the interaction with cloud services for adapting to new environments via active learning (Wang et al., 2021) or continual learning (Li et al., 2021a). Re-training large models on the cloud are usually not cost-effective due to the expensive overheads of storage and computational resources. Furthermore, these resources are limited on edge devices such as autonomous vehicles and unmanned aerial vehicles, making the sense for developing effective fine-tuning methods with proper parameter-accuracy trade-off that can be fine-tuned on edge devices and interacting with the large models deployed on the cloud.
+
+There have been some pioneering works for the PETL of visual models such as AdaptFormer (Chen et al., 2022) and visual prompt tuning (VPT) (Jia et al., 2022). AdaptFormer is primarily proposed based on vision transformer (Zhai et al., 2022), representing one of the stateof-the-art large models for image-based tasks. The proposed adapter module directly brings from Houlsby et al. (2019) due to its convenience of being inserted to any models. Implementing with a large batch size of $1 , 0 2 4$ with 64 GPUs, Adaptformer shows promising parameter-accuracy trade-off on video data. However, such powerful computing resource is not realistic for the usage of edge devices. Meanwhile, whether the good trade-off can be maintained for small batch size remains under-explored. Inspired by the Prompting in NLP (Liu et al., 2021), VPT proposes visualprompt to fine-tune visual models for imagebased tasks. According to the empirical results in Chen et al. (2022), adapter modules achieves superior performance over VPT in the regimes of both self-supervised and supervised
+
+
+Figure 1: Parameter-accuracy trade-off. Adapting backbone Swin-B (Liu et al., 2022) pre-trained on Kinetics 400 via different fine-tuning methods on the something-something v2 (Goyal et al., 2017) dataset. Our methods perform significantly better than the state-of-the-art AdaptFormer-Swin (Chen et al., 2022) (our implementation with batch size 16) with slightly more tunable parameters, and outperform full-tuning with increasing margins when using larger values of $d _ { b o t t l e }$ .
+
+pre-training. Another concern of VPT is its modification to the original model parameters might affect the knowledge representation of backbone models. Hence, we do not continue to compare our method with VPT but comparing with the adapter on video-based downstream tasks.
+
+Taking the recent inspiration of the mix-and-match adapter (MAM adapter) (He et al., 2022a) in NLP, we aim to propose a unified model for the vision domain, especially for video-based downstream tasks. He et al. (2022a) analyzed the unified view among PETL techniques such as prefixtuning, low-rank (LoRA) adaptation, and adapter, pointing out the similarity between prefix-tuning and adapter in terms of calculating the attention. The difference is that the former performs weighted addition while the latter ones is unweighted. Note that prefix-tuning has not ever been applied to visual tasks in the form of pure visual models due to the intrinsic differences regarding pre-training methods of NLP and vision models. Another obstacle of directly applying prefix-tuning to visual tasks is the structural difference between text and vision data (we further discuss this in Section 2.3). Considering the video-based action recognition task, we propose a new variation of the prefixtuning module called parallel attention (PATT) to adapt video-based pre-trained large models to downstream domains with varied data scales. The differences of our method comparing the original prefix-tuning in NLP are twofold: prefix calculation and the manner of insertion (see Figure 2[b] and Figure 3). Regarding the backbone model, we focus on Video Swin Transformer (Liu et al., 2022), one of the state-of-the-art vision models that bring competitive performance on large-scale action recognition datasets such as Kinetics 400 and 600 Kay et al. (2017).
+
+Our main contributions can be threefold as follows:
+
+1. We analyze different PETL techniques using the backbone model Swin Video Transformer for video-based tasks, providing a unified view via our V-PETL framework and investigating the importance of the fine-tuning position.
+
+2. Based on the comprehensive understanding of intrinsic differences between NLP and video data regarding data structures and pre-training mechanisms, we leverage prefix-tuning to our V-PETL with a new variation called PATT.
+
+3. Upon extensive ablation experiments regarding various effect factors, we empirically validate the promising parameter-accuracy trade-off achieved by our adjustable and easy-to-use PATT module, contributing to the existing literature of PETL techniques.
+
+# 2 UNIFIED FRAMEWORK
+
+# 2.1 RECAP OF VIDEO SWIN TRANSFORMER
+
+Video Swin Transformer (Liu et al., 2022) is formed with Transformer layers (a.k.a. stages) that are consisted with 3D Video Swin Transformer blocks. With varied layers, blocks, and channel sizes, the model can be formed as Swin-T, Swin-S, Swin-B, and Swin-L. The basic architecture of a 3D Swin Transformer block is shown in Figure 2, which is mainly composed of a 3D shifted window-based multi-head self-attention (3DSW-MSA) module and a fully connected feed-forward network (FFN) implemented with a 2-layer MLP. Layer normalization (LN) and residual connection are respectively performed before and after both FFN and 3DSW-MSA modules. One such Video Swin Transformer block can be represented as:
+
+$$
+\begin{array} { r l } & { \hat { \boldsymbol Z } ^ { l } = 3 \mathrm { D S W } \mathrm { - } \boldsymbol { \mathrm { M S A } } ( \boldsymbol { \mathrm { L N } } ( \boldsymbol { \boldsymbol { Z } } ^ { l - 1 } ) ) + \boldsymbol { Z } ^ { l - 1 } , } \\ & { \boldsymbol { Z } ^ { l } = \mathrm { F F N } ( \boldsymbol { \mathrm { L N } } ( \hat { \boldsymbol { Z } } ^ { l } ) ) + \hat { \boldsymbol { Z } } ^ { l } , } \end{array}
+$$
+
+where $\hat { \boldsymbol { z } } ^ { l }$ and $Z ^ { l }$ respectively indicate the output of 3DSW-MSA and FNN modules.
+
+Given a video input sized $t \times w \times h \times 3$ , containing $t$ video frames with their heights and widths being $h$ and $w$ , respectively. The 3D patch for video data sized $2 \times 4 \times 4 \times 3$ is treated as a token. Then we will have ${ \begin{array} { l } { { \frac { t } { 2 } } \times { \frac { w } { 4 } } \times { \frac { h } { 4 } } } \end{array} }$ 3D tokens after a 3D patch partitioning layer. Given the 3D tokens sized $\begin{array} { r } { \frac { t } { 2 } \times \frac { w } { 4 } \times \frac { h } { 4 } } \end{array}$ and a 3D window with the size of $p \times m \times m$ , the self-attention module, using the regular window partition strategy, will partition the 3D tokens to $\begin{array} { r } { { \frac { t } { 2 p } } \times { \frac { w } { 4 m } } \times { \frac { h } { 4 m } } } \end{array}$ non-overlapping windows. For shifted 3D window, the partition is shifted along the temporal, height, and width dimensions by ${ \begin{array} { l } { { \frac { p } { 2 } } \times { \frac { m } { 2 } } \times { \frac { m } { 2 } } } \end{array} } $ . For example, if we have an input video sized $8 \times 2 2 4 \times 2 2 4 \times 3$ and a $8 \times 7 \times 7$ 3D window, after the patch embedding, we will have $4 \times 5 6 \times 5 6 ~ 3 \mathrm { D }$ tokens with each of them sized $2 \times 4 \times 4 \times 3$ . Without shifting, the non-overlapping window size will be $1 \times 8 \times 8 = 6 4 .$ Then through the 3D window shifted by $( 4 , 3 , 3 )$ , the number of 3D windows becomes $1 \times 9 \times 9 = 8 1$ .
+
+The 3DSW-MSA module is formed with a 3D relative position bias Rp2×m2×m2 , each of which can be represented as:
+
+$$
+A t t e n t i o n ( \mathbf { 0 } , \mathbf { K } , \mathbf { V } ) = S o f t M a x \big ( \frac { \mathbf { 0 } \mathbf { K } ^ { T } } { \sqrt { d } } + \mathbf { B } \big ) \mathbf { V } ,
+$$
+
+where $\pmb { \mathsf { Q } } , \pmb { \mathsf { K } } , \pmb { \mathsf { V } } \in \mathbb { R } ^ { p \times m \times m \times d }$ are the query, key, and value matrices, $p \times m \times m$ is the number of tokens and $d$ is the dimension of the tokens. MSA simultaneously performs the attention mechanism for $n _ { h e a d }$ heads, where the $i$ th head can be parameterized by $W _ { q } ^ { ( i ) } , W _ { k } ^ { ( i ) }$ , ${ W _ { v } ^ { ( i ) } \in \mathbb { R } ^ { d \times 3 d } }$ , projecting the input $Z ^ { l - 1 }$ to queries, keys, and values. Given a matrix $\boldsymbol { C } \in \mathbb { R } ^ { \tilde { m } \times d }$ , $\widetilde { \boldsymbol { m } } = \boldsymbol { p } \times \boldsymbol { m } \times \boldsymbol { m }$ , for performing attention, the 3DSW-MSA can be calculated as:
+
+$$
+\begin{array} { c } { { 3 \mathrm { D S W - M S A } ( Z ^ { l - 1 } , C ) = C o n c a t ( h e a d _ { 1 } , . . . , h e a d _ { n } ) { \cal W } _ { o } , } } \\ { { h e a d _ { i } = A t t e n t i o n ( Z ^ { l - 1 } { \cal W } _ { q } ^ { ( i ) } , C { \cal W } _ { k } ^ { ( i ) } , C { \cal W } _ { v } ^ { ( i ) } ) , } } \end{array}
+$$
+
+where $W _ { o }$ is the parameters of a linear project layer. The FNN module is composed of two linear layers with a GELU activation function in between, which can be computed as:
+
+$$
+\mathrm { F F N } ( \hat { \boldsymbol { Z } } ^ { l } ) = \mathrm { G E L U } ( \mathrm { L N } ( \hat { \boldsymbol { Z } } ^ { l } ) W _ { 1 } + b _ { 1 } ) W _ { 2 } + b _ { 2 } ,
+$$
+
+where $W _ { 1 } \in \mathbb { R } ^ { d _ { h i d d e n } \times d }$ , $W _ { 2 } \in \mathbb { R } ^ { d \times d _ { h i d d e n } }$ , $\pmb { b } _ { 1 } \in \mathbb { R } ^ { d _ { h i d d e n } }$ , and $b _ { 2 } \in \mathbb { R } ^ { d }$ . The value of $d _ { h i d d e n }$ usually takes a large value (e.g., $d _ { h i d d e n } = 4 d$ ).
+
+
+Figure 2: V-PETL: A unified view of visual PETL techniques. They bring trainable parameters to different positions of the backbone model with various manners. AdaptFormer and Prefix-tuning respectively perform at the MLP and 3DSW-MSA modules that can adjust the number of trainable parameters via the bottleneck size of down and up projections. While prompt-tuning performed at the layer-level can adjust the length of prompts to control the tuned parameters.
+
+Prefix-tuning (Li & Liang, 2021): The prefix-tuning approach prepends learnable prefix tokens to the keys and values of the MSA module of the model (see Figure 2[b]). Specifically, two prefix matrices $P _ { k } , P _ { v } \in \mathbb R ^ { d _ { t o k e n } \times d }$ that are randomly initialized with $d _ { t o k e n }$ tokens and transformed from two linear layers (with parameters $W _ { p k } ^ { ( i ) } \in \mathbb { R } ^ { d \times d _ { m i d d l e } }$ and $W _ { p v } ^ { ( i ) } \in \mathbb { R } ^ { d _ { m i d l e } \times d } )$ and a Tanh layer in between are concatenated to the original key and value, leading the calculation of $h e a d _ { i }$ in Eq. 3 to:
+
+$$
+h e a d _ { i } = A t t e n t i o n ( Z ^ { l - 1 } W _ { q } ^ { ( i ) } , c o n c a t ( P _ { k } ^ { ( i ) } , C W _ { k } ^ { ( i ) } ) , c o n c a t ( P _ { v } ^ { ( i ) } , C W _ { v } ^ { ( i ) } ) ) ,
+$$
+
+where the concat is the concatenation performed along the token dimension to mimic the prefixtuning in NLP tasks. Here, a question regarding whether this direct implementation will work for the vision domain is raised (results are in Table 4). This direct implementation is empirically invalid and we make further modification on it in Section2.3.
+
+Adapter (Chen et al., 2022): Inspired by the works of Houlsby et al. (2019); He et al. (2022a) for PETL in NLP tasks, adapter (Chen et al., 2022) has been directly used for vision tasks, showing promising performance using far less tunable parameters. The number of parameters of adapter is controlled by a parameter $d _ { b o t t l e }$ $\mathit { \check { d } } _ { b o t t l e } \ll d )$ ), adjusting the space size of a low-dimensional representation. The adapter module first uses a down-projection with $W _ { d o w n } \in \mathbb { R } ^ { d \times d _ { b o t t l e } }$ to project the feature to the lower-dimensional representation, followed by a ReLU activation function, and a up-projection with Wup ∈ Rdbottle×d.
+
+$$
+\begin{array} { r } { \widetilde { \pmb { Z } } ^ { l } = \mathrm { R e L U } ( \mathbf { L N } ( \hat { \pmb { Z } } ^ { l } ) \mathbf { W } _ { d o w n } ) \mathbf { W } _ { u p } , } \end{array}
+$$
+
+then two positions implementing adapter (parallel and sequential) can be respectively computed as:
+
+$$
+\begin{array} { r } { \pmb { Z } ^ { l } = \mathrm { F F N } ( \mathbf { L N } ( \hat { \pmb { Z } } ^ { l } ) ) + \hat { \pmb { Z } } ^ { l } + s \tilde { \pmb { Z } } ^ { l } , \qquad } \\ { a n d s \pmb { Z } ^ { l } = \mathrm { R e L U } ( \mathrm { F F N } ( \mathbf { L N } ( \hat { \pmb { Z } } ^ { l } ) ) \pmb { W } _ { d o w n } ) \pmb { W } _ { u p } + \hat { \pmb { Z } } ^ { l } , } \end{array}
+$$
+
+where $s$ is a scalar, controlling the effect of the adapter (will be ablated in experiments). According to Chen et al. (2022), the parallel implementation (see Figure 2[a]) empirically performs better.
+
+Prompt-tuning (Jia et al., 2022): Prompt-tuning (see Figure $2 [ \mathrm { c } ] ,$ is inspired by the success of prompt-tuning that adapts large scale models to varied downstream NLP tasks. The idea of VPT (Jia et al., 2022) is to fine-tune a learnable matrix P l−1prom $P _ { p r o m p t } ^ { l - 1 } \in \mathbb { R } ^ { d _ { p r o m p t } \times d }$ , ${ d _ { p r o m p t } } < { d _ { t o k e n } } - 1$ for
+
+the lth Transformer layer or all Transformer layers, which are known as shallow prompt and deep prompt, respectively.
+
+$$
+\begin{array} { r } { \hat { \boldsymbol { \mathsf { Z } } } ^ { l } = 3 \mathrm { D S W } \mathrm { - } \boldsymbol { \mathsf { M S A } } ( \mathrm { L N } ( [ \boldsymbol { x } ^ { l - 1 } , \boldsymbol { P } _ { p r o m p t } ^ { l - 1 } , \boldsymbol { \mathsf { Z } } ^ { l - 1 } ] ) ) + \boldsymbol { \mathsf { Z } } ^ { l - 1 } , } \end{array}
+$$
+
+where $x ^ { l - 1 } \in \mathbb { R } ^ { d }$ denotes the [CLS]’s embedding for the $l$ th layer’s input space, $P _ { p r o m p t } ^ { l - 1 }$ is implemented by overlapping the top $d _ { p r o m p t }$ tokens of $Z ^ { l - 1 }$ (Jia et al., 2022). While it has also been implemented in front of the $x ^ { l - 1 }$ (Chen et al., 2022).
+
+Others: Other PETL techniques include ST-Adapter Pan et al. (2022), LoRA (Hu et al., 2022), and BitFit (Zaken et al., 2022). ST-Adapter mainly adapts image-text models pre-trained on large scale datasets such as 400M image-text pair proposed by CLIP (Radford et al., 2021) and the IG-3.6B used by SWAG (Singh et al., 2022) to video understanding downstream tasks, which matches and even outperforms full-tuning. LoRA approximates the optimization process by injecting learnable low-rank matrices into the attention module. This method does not show superior performance for NLP tasks in terms of parameter efficiency. Hence, we do not prioritize this direction in this work. BitFit only tunes the bias terms of the backbone models, making it very parameter-efficient.
+
+# 2.3 REVISITING PREFIX-TUNING FOR VISUAL TASKS
+
+The prefix implementation in NLP Li & Liang (2021); He et al. (2022a) can be regarded as prepending contextual information for downstream tasks, which is similar with the pre-training process aiming to predict masked words in the process of an inner loop (Brown et al., 2020). Considering the pre-training process of pure vision models, such direct implementation might not make sense for visual tasks. Although such autoregressive pre-training has been conducted in visual domain (He et al., 2022b; Tong et al., 2022), but adding prefix for a sentence input in NLP can be structurally different with the visual domain. Specifically, masked pixels in image or video data cannot be regarded as some word level semantic information (e.g., a subject or an action) as in the NLP.
+
+Recall that the embedding state of prefix-tuning is randomly initiated, which is known as learnable prefix but can bring random noise that later turns out affecting the convergence of the fine-tuning downstream tasks. Hence, inspired by the connection between adapter and prefix (He et al., 2022a), we avoid such learnable prefix design with random initialization and propose a parallel attention (PATT) to the original attention module (see Figure 3). The adapter structure can effective control the number of trainable parameters via $d _ { b o t t l e }$ , which is similar with the effect of the middle dimension dmiddle of W (i)pk and $W _ { p v } ^ { ( i ) }$ for preparing the prefix. Specifically, for the lth layer, we use output of its previous layer $Z ^ { l - 1 }$ and project it to a pair of matrices $\boldsymbol { \dot { K _ { p } } } , \boldsymbol { V _ { p } } \in \mathbb { R } ^ { \tilde { m } \times d }$ via a similar mechanism of Eq. 6:
+
+$$
+K _ { p } , V _ { p } = \mathrm { T a n h } ( Z ^ { l - 1 } W _ { d o w n } ) W _ { u p } ,
+$$
+
+where Tanh is the activation function used for preparing the prefix, which can be replaced by other activation func
+
+
+Figure 3: Structure of PATT. Red parts are trainable parameters calculated by the same input for preparing query, key, and value (i.e., the output of the previous layer passing through a layer normalization layer $Z ^ { l - 1 }$ ).
+
+tions such as RELU and GELU. Here, we follow the original prefix implementation as its value ranges from $- 1$ to 1. Given $K _ { p }$ and $V _ { p }$ , Eq. 5 can be rewritten as:
+
+$$
+h e a d _ { i } = A t t e n t i o n ( \boldsymbol Z ^ { l - 1 } \boldsymbol W _ { q } ^ { ( i ) } , \boldsymbol s \boldsymbol K _ { p } + \boldsymbol C \boldsymbol W _ { k } ^ { ( i ) } , \boldsymbol s V _ { p } + \boldsymbol C \boldsymbol W _ { v } ^ { ( i ) } ) ,
+$$
+
+where $s$ is a scalar for adjusting the effect of PATT. Note that without considering the physical meaning of such design, for PETL purpose, one can perform similar practise for any combinations of $\mathbf { \alpha } _ { \mathbf { Q } , \mathbf { \alpha } } \kappa$ , and $\pmb { \nu }$ . This brings connection to the LoRA (Hu et al., 2022) method, which add parallel trainable parameters to $\mathbf { Q }$ and $\pmb { \nu }$ . Empirically, where to perform the PATT makes little difference, but the amount of trainable parameters brings larger effect for large scale downstream domains.
+
+# 2.4 V-PETL: UNIFIED VIEW ON VISUAL PETL
+
+Given the PETL techniques at hand, there can be many potential combinations leading to good parameteraccuracy trade-off. However, it is unrealistic to exhaustively test all the methods for a specific downstream task. Other than probing such solution via evolutionary search as in Zhang et al. (2022), we aim to propose more understandable models by empirically analyzing the effect of different designs independently. According to the preliminary results shwon in Figure 1, we argue that the position and amount of parameters are important for PETL techniques, especially when the target domain is not small.
+
+To verify the importance of position and tuned parameter amount, we independently tune different modules of the backbone model. Table 1 shows the results. We can see that the attention module’s QKV layer has 20.98M parameters while the MLP module has the most number of parameters of 55.90M. Tuning positions with more parameters, will lead to better performance for SSv2. Thanks to the bottleneck mechanism of adapter and prefix-tuning, one can effectively achieve a good parameter-accuracy trade-off. As such, we derive a model called Swin-B-adapter-PATT (Swin-BAPAT) from the V-PETL framework by using the parallel adapter and our PATT to leverage the adaption of pre-trained backbone model at the positions of attention and MLP modules, respectively. In addition to adapter and PATT, we also fine-tune the last fully connected layer as it has relatively smaller amount of tunable parameters (i.e, 0.18M) than adapter and PATT.
+
+Table 1: Comparison of independently fine-tuning varied positions of the video swin transformer block on SSv2.
+
+
Position
# Params
Top-1 (%)
Full-tuning Tune FC Layer
87.82M 0.18M
50.99 24.13
LayerNorm 1
0.02M
14.35
Attn,Proj
6.99M
47.58
Attn, QKV
20.98M
50.02
Attn, SoftMax
0.95M
27.67
LayerNorm 2
0.02M
14.62
MLP, FC1
27.97M
47.10
MLP,FC2
27.93M
45.32
DownSample
2.76M
27.53
+
+# 3 EXPERIMENTS
+
+# 3.1 EXPERIMENTAL SETTINGS
+
+Video Datasets: Something-something v2 (SSv2 (Goyal et al., 2017)) It has 108,499 short videos for 174 human-object interaction categories with durations between 2 to 6 seconds. The challenge of this dataset is that it contains 23, 137 distinct object names with an imbalanced distribution. The original dataset is split into train, validation, and test sets with a ratio of 8:1:1. The extended version (SSv2) of this dataset is consisted of 168, 913 training samples, 24, 777 validation samples, and 27, 157 testing samples with the sample number of action labels. The training and testing samples are used. HMDB51 (Kuehne et al., 2011) contains 6, 766 video samples for 51 action categories including videos of varied visible body parts, camera motion, camera view, and clip quality. All video samples have at least 101 clips and a minimum height of 60 pixels for actors. The original dataset has three splits of training and evaluation. We follow existing work Chen et al. (2022) by using the first training and evaluation split that has 3, 570 and 1, 530 samples, respectively. Image Datasets: Following the experimental set ups in AdaptFormer, three datasets CIFAIR-100 Krizhevsky et al. (2009), Street View House Numbers (SVHN) Goodfellow et al. (2013), and Food101 Bossard et al. (2014) are used. CIFAIR-100 has 50, 000 and 10, 000 training and validation images, respectively, with the resolution of $3 2 \times 3 2$ and 100 categories; SVHN is a digit classification dataset that has 73, 257 training sample and 26, 032 testing samples; Food-101 includes 101k images of 101 food categories with each of them has 750 training and 250 testing samples.
+
+Implementation details: It is worth noting that big batch size (i.e., 1, 024) and the number of input video frames (i.e., 32 frames) can greatly benefit good performance (Carreira & Zisserman, 2017; Liu et al., 2022; Chen et al., 2022), which usually requires GPU clusters to enable the training. AdaptFormer (Chen et al., 2022) uses such powerful GPU cluster to achieve good performance. However, good performance might not hold when the batch size is small. Following the more common hardware device setup, we use 4 GeForce 3090 GPUs for all experiments, leading to a batch size of 64. All the experiments are fine-tuned for 70 epochs. We use the Swin- $\mathbf { \cdot B } ^ { 1 }$ model pre-trained on Kinetics 400 and 600. For HMDB51, we report the results without tuning the FC layer due to the significant effect of the FC layer on relatively small scale dataset. Following Chen et al. (2022), we do not perform regularization strategies such as mixup, cutmix, color jittering, etc. Our PATT module is convenient to be applied to other Transformer-based models. Hence, we respectively adopt ViT-B models from MAE (He et al., 2022b) and VideoMAE (Tong et al., 2022) to conduct further comparison on video and image datasets, which follows the self-supervised pretraining setting2 in Chen et al. (2022) except that the batch size is set to 256 instead of 1, 024.
+
+Table 2: Comparison of Top-1 accuracy using varied amount of parameters adjusted by $d _ { b o t t l e }$ different pre-training domains, and the number of frames with other fine-tuning strategies.
+
+
Method
dbottle
Pre-training
#Frames
SSv2
HMDB51
# Params Top-1(%)# Params Top-1 (%)
Full-tuning
-
Kinetics 400
8
87.82M
50.99
87.69M
68.07
Tune FC Layer
Kinetics 400
8
0.18M
24.13
0.05M
71.28
BitFit (Zaken et al., 2022)
·
Kinetics 400
8
1.29M
45.94
1.11M
68.26
AdaptFormer-Swin (Chen et al., 2022)64
Kinetics 400
8
1.73M
40.80
1.61M
68.66
Prefix-tuning (Li& Liang,2021)
128
Kinetics 400
8
6.57M
39.46
6.40M
56.13
Our Swin-BAPAT (w/o Adapter)
32
Kinetics 400
8888
1.35M
46.26
1.17M
69.51
Our Swin-BAPAT (w/o Adapter)
64
Kinetics 400
2.51M
49.23
2.34M
71.34
Our Swin-BAPAT (w/o Adapter)
128
Kinetics 400
4.83M
52.57
4.65M
70.56
Our Swin-BAPAT (w/o Adapter)
256
Kinetics 400
9.45M
52.71
9.27M
70.23
Our Swin-BAPAT
32
Kinetics 400
8
2.91M
49.63
2.74M
68.20
Our Swin-BAPAT
64
Kinetics 400
8
4.07M
51.80
3.89M
70.10
Our Swin-BAPAT
128
Kinetics 400
8
6.38M
53.36
6.20M
71.93
Our Swin-BAPAT
256
Kinetics 400
8
11.00M
53.98
10.83M
69.64
Our Swin-BAPAT
256
Kinetics 400
8
11.00M
53.98
10.83M
69.64
Our Swin-BAPAT
256
Kinetics 600
8
11.00M
54.06
10.83M
69.90
Our Swin-BAPAT
256 ImageNet-22K
8
11.00M
43.56
10.83M
59.89
Our Swin-BAPAT
128
Kinetics 400
8
6.38M
53.36
6.20M
71.93
Our Swin-BAPAT
128
Kinetics 400
16
6.38M
63.14
6.20M
75.67
+
+Baselines: We mainly compare our method Swin-BAPAT with three baselines as follows: (1) Full-tuning: set all the parameters learnable and tune the whole model initiated with the pretrained weights. (2) Tune FC layer: tune the last fully connected layer and freeze pre-trained parameters of the whole backbone model. (3) AdaptFormer-Swin: method introduced by Chen et al. (2022) that adds a parallel adapter to the MLP module in each block of the backbone model. (4) Prefix-tuning: the direct implementation of prefix-tuning used in NLP as defined in Eq. 5. (5) BitFit: by tuning the bias of the backbone model together with the FC layer.
+
+# 3.2 THE EFFECT OF DIFFERENT PETL TECHNIQUES
+
+Table 2 shows the results of different PETL techniques. From the results of four baseline methods, full-tuning performs the best for the large-scale dataset SSv2, whereas tuning the FC layer achieves superior performance over other PETL techniques on HMDB51. This is due to the fact that downstream tasks with relatively larger scale datasets are more parameter hungry for good convergence. On the contrary, small datasets can make good use of the knowledge from the source domain with slight effort of adaption via an FC layer. Here, a question regarding the effect of this FC layer when using it together with other PETL techniques has not been investigated. As this FC layer having small amount of tunable parameters can already make a big difference, performing better than fulltuning and other PETL techniques and rendering them not effective for small-scale datasets. As such, we further examine this question in Section A.1.
+
+We test different amount of parameters adjusted by $s _ { b o t t l e }$ , taking its values to 32, 64, 128 and 256. The second and third groups (without or with Adapter, respectively) of results in Table 2 shows that larger values of $s _ { b o t t l e }$ can benefit the fine-tuning with slightly more overhead of parameters on large-scale datasets such as SSv2. All results of our Swin-BAPAT outperform the state-ofthe-art AdaptFormer-Swin with a big margin (using the smallest value $s _ { b o t t l e } = 3 2$ can improve AdaptFormer-Swin by almost $2 5 \%$ ). While without using Adapter, our method still outperforms baselines AdaptFormer-Swin and BitFit with roughly similar amount of parameters. When sbottle is larger than 64, our Swin-BAPAT starts to perform better than full-tuning on both datasets with proper parameter-accuracy trade-off, validating the effectiveness of our Swin-BAPAT for PETL.
+
+
+Figure 4: Top-1 accuracy of different settings on SSv2 throughout training process. F: frame, S: scalar, B: $d _ { b o t t l e }$ , K: pre-training domain.
+
+Table 3: Top-1 accuracy $( \% )$ using different scalar values on two datasets: SSv2 and HMDB51. The $d _ { b o t t l e }$ is set to 128; pretraining is based on Kinetics 400.
+
+
Scalar s
SSv2
HMDB51
Full-tuning
50.99
71.28
Tune FC Layer
24.13
68.07
AdaptFormer-Swin
40.80
68.66
s=0.2
47.46
69.38
s=0.5
52.84
71.87
s=0.8
53.36
71.93
s=1.0
53.29
70.89
+
+# 3.3 THE EFFECT OF DIFFERENT PRE-TRAINING DOMAINS
+
+The knowledge from the pre-trained model is learned from the source domain. We test two different models pre-trained on large-scale datasets: Kinetics 400, Kinetics 600, and ImageNet-22K. Findings show that both two models pre-trained on such large-scale datasets can benefit our proposed PETL strategy with the latter being slightly more significant (see the third group of comparison in Table 2). This is due to the fact that Kinectics 600 is larger than its 400 version and brings more knowledge to the pre-trained model, benefiting more downstream tasks. However, image-based pre-training cannot perform as good as video-based pre-training due to the larger domain gap.
+
+# 3.4 THE EFFECT OF DIFFERENT VIDEO INPUT SIZE
+
+We also test whether our method is robust to increased number of input video frames. It is worth noting that larger number of input video frames usually can bring more spatial temporal information, benefiting data-driven models to learn more distinguishable features while keeping the model size remaining the same. The last group of comparisons in Table 2 shows that using double-sized video input (i.e., 16 frames) can greatly improve the performance of action recognition on both small and large-scale datasets. The improvements (increased $9 . 7 8 \%$ from $5 3 . 3 6 \%$ to $6 3 . 1 4 \%$ on SSv2, and $3 . { \bar { 7 } } 4 \%$ from $7 1 . 9 3 \%$ to $7 5 . 6 7 \%$ on HMDB51) are more significant than other factors such as $d _ { b o t t l e }$ and pre-training domain (around $1 \%$ to $2 \%$ ). The top line in Figure 4 visualizes the significant effect of increasing the number of input video frames. These results suggest that our Swin-BAPAT can be promising for increased frames of video input.
+
+# 3.5 THE EFFECT OF DIFFERENT SCALE OF PATT
+
+Recall that the effect of our PATT on pretrained models can be adjusted by the variable $s$ in Eq. 10. Table 3 shows that adopting the value of 0.8 can deliver consistent best performances on both datasets SSv2 and HMDB51 under our experimental setting. Smaller values of $s$ will quantitatively reduce the effect of our PATT module on the knowledge transfer while large values will increase the effect of our PATT module. The good performance achieved via taking an effective scale of 0.8 indicates that our PATT module plays an important role in the knowledge transfer. However, even larger values over 0.8 can affect the importance of original knowledge thereof the pretrained model. Hence, proper valued scalar $s$ is essential for balancing the role of PATT and
+
+Table 4: Ablation of different implementation positions of PATT defined in Eq. 10, e.g., Ours (K, $\boldsymbol { \mathsf { V } }$ ) indicates inserting PATT to the query and key of 3DSW-MSA modules. Pre-training on Kinetics 600. $d _ { b o t t l e }$ is set to 128; Scalar $s$ is set to 0.8.
+
+
Method
SSv2
HMDB51
#Params
Top-1
# Params
Top-1
Full-tuning
87.82M
50.99
87.69M
68.07
Concat (K, V)
6.38M
15.61
6.20M
20.98
No Zl-1(K,V)
8.74M
51.06
8.56M
67.41
Ours (Q, K)
6.38M
45.49
6.20M
68.92
Ours (K, V)
6.38M
53.38
6.20M
71.41
Ours (Q, V)
6.38M
53.24
6.20M
71.74
Ours (Q, K, V)
7.93M
53.23
7.63M
69.57
+
+pre-trained backbone model. Note this can be a learnable parameter upon specific implementation, here we empirically verified the effect of the scalar.
+
+# 3.6 THE EFFECT OF DIFFERENT METHODS YIELD FROM V-PETL
+
+We have argued that, especially for relative large downstream datasets, the position and the amount of trainable parameters are important for parameter-efficient transfer learning in Section 2.4. The proposed Swin-BAPAT is one of instantiated models from the V-PETL framework regarding the insert position of our PATT. Other instantiations can be inserted into different positions such as query, key, and value of the attention module. We further instantiate other variations of our Swin-BAPAT by inserting PATT to different positions. Table 4 shows the results. Findings show that inserting to the value position of 3DSW-MSA can contribute more than inserting to other two positions. While inserting to query of key makes little difference for the performance. This is due to the fact that query and key make the calculation of the attention mask. Hence, inserting either one of them will lead to a similar effect. On one hand, these results, to some extent, justify the original design of prefix-tuning that bring learnable prefix to key and value of the attention module. On the other hand, it indicates that our claim regarding the unified view of PETL for visual tasks is reasonable. In Table 4, we also ablate the designs of PATT regarding concatenating $K _ { p }$ and $V _ { p }$ (i.e., Concat $[ \mathsf { K } , \mathsf { v } ] )$ , and using trainable parameters to generate $K _ { p }$ and $\boldsymbol { V _ { p } }$ (i.e., N ${ \bf \nabla } ) \ Z ^ { l - 1 } ( { \bf K } , { \bf V } ] )$ .
+
+# 3.7 COMPARISON ON VARIED TASKS VIA SELF-SUPERVISED PRE-TRAINED MODELS
+
+Table 5 shows the comparison with AdaptFormer-64 (Chen et al., 2022) and VPT (Jia et al., 2022) on both image- and video-based downstream tasks. Our method ViT-BAPAT still shows promising parameter-accuracy trade-off via much smaller batch size, which is more convenient for reproduction on the general single server with 8 GPUs. The underperformance on SSv2 (better than full-tuning) can be due to the smaller batch size as SSv2 is much larger than other compared datasets and can be more relying on larger batch size. In real-world application scenarios, small dataset can be the more common case, which confirms our contributions.
+
+Table 5: Comparison of Top-1 accuracy via ViT-B models from MAE and VideoMAE pre-trained with self-supervised learning for image and video datasets, respectively.
+
+
Method
Avg.
Image
Video
Params (M)
CIFAR-100
SVHN
Food-101
SSv2
HMDB51
Full-tuning
86.04 (100%)
85.90
97.67
90.09
53.97
46.41
Tune FC Layer
0.07 (0.08%)
69.83 (-16.07) 66.91 (-30.76) 69.74 (-20.35)
29.23 (-24.74)
)49.84 (+3.43)
VPT (Jia et al.,2022)
0.08 (0.09%)
82.44 (-3.46)
94.02 (-3.65)
82.98 (-7.11)
43.73 (-10.24)
52.67 (+6.26)
AdaptFormer-64
1.26 (1.46%)
85.90 (0.00)
96.89 (-0.78)
87.61 (-2.48)
59.02 (+5.05)
55.69 (+9.28)
Our ViT-BAPAT-32
2.13 (2.47%)
86.29 (+0.39)
97.18 (-0.49)
87.37 (-2.72)
57.78 (+3.81)
57.18 (+10.77)
Our ViT-BAPAT-64
3.02 (3.51%)
86.35 (+0.45)
97.18 (-0.49)
87.53 (-2.56)
57.55 (+3.58)
57.18 (+10.77)
Our ViT-BAPAT-128
4.79 (5.56%)
86.47 (+0.57)
97.28 (-0.39)
87.66 (-2.43)
56.97 (+3.00)
57.70 (+11.29)
Our ViT-BAPAT-256
8.33 (9.68%)
86.55 (+0.65)
97.24 (-0.43)
87.68 (-2.41)
56.53 (+2.56)
57.31 (+10.90)
+
+# 4 CONCLUSION
+
+In this paper, we introduced a V-PETL framework for exploiting good parameter-accuracy tradeoff around adapting video-based pre-trained large models to downstream tasks. Our Swin-BAPAT method derived from the V-PETL with a variation of prefix-tuning known as PATT can effectively bring good parameter-accuracy trade-off on downstream tasks. The proposed PATT can be easily plugged to the attention module of other transformer-like models. Meanwhile, the amount of trainable parameter can be easily adjusted by the parameter $d _ { b o t t l e }$ . With small amount overhead on trainable parameters, our method performs significantly better than state-of-the-art method AdapFormer-Swin and full-tuning on the datasets SSv2 and HMDB51 via small batch size, validating our contribution to the literature of PETL. In the future we will test our proposed model on more action recognition datasets surveyed in Sun et al. (2022) under more learning regimes such as zero/few-shot learning, active learning and continual learning with other pre-training methods such as visual-language models. We will also explore other backbone models, activation functions for PATT, and PETL techniques such as LoRA for visual tasks.
+
+# REFERENCES
+
+Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101–mining discriminative components with random forests. In European conference on computer vision, pp. 446–461. Springer, 2014.
+
+Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
+
+Joao Carreira and Andrew Zisserman. Quo vadis, action recognition? a new model and the kinetics dataset. In proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6299–6308, 2017.
+
+Shoufa Chen, Chongjian Ge, Zhan Tong, Jiangliu Wang, Yibing Song, Jue Wang, and Ping Luo. Adaptformer: Adapting vision transformers for scalable visual recognition. arXiv preprint arXiv:2205.13535, 2022.
+
+Ian J Goodfellow, Yaroslav Bulatov, Julian Ibarz, Sacha Arnoud, and Vinay Shet. Multi-digit number recognition from street view imagery using deep convolutional neural networks. arXiv preprint arXiv:1312.6082, 2013.
+
+Raghav Goyal, Samira Ebrahimi Kahou, Vincent Michalski, Joanna Materzynska, Susanne Westphal, Heuna Kim, Valentin Haenel, Ingo Fruend, Peter Yianilos, Moritz Mueller-Freitag, et al. The” something something” video database for learning and evaluating visual common sense. In Proceedings of the IEEE international conference on computer vision, pp. 5842–5850, 2017.
+
+Julia Gusak, Daria Cherniuk, Alena Shilova, Alexandr Katrutsa, Daniel Bershatsky, Xunyi Zhao, Lionel Eyraud-Dubois, Oleh Shliazhko, Denis Dimitrov, Ivan Oseledets, and Olivier Beaumont. Survey on efficient training of large neural networks. In Lud De Raedt (ed.), Proceedings of the Thirty-First International Joint Conference on Artificial Intelligence, IJCAI-22, pp. 5494–5501. International Joint Conferences on Artificial Intelligence Organization, 7 2022. doi: 10.24963/ ijcai.2022/769. URL https://doi.org/10.24963/ijcai.2022/769. Survey Track.
+
+Junxian He, Chunting Zhou, Xuezhe Ma, Taylor Berg-Kirkpatrick, and Graham Neubig. Towards a unified view of parameter-efficient transfer learning. In International Conference on Learning Representations, 2022a. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ 0RDcd5Axok.
+
+Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollar, and Ross Girshick. Masked au-´ toencoders are scalable vision learners. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16000–16009, 2022b.
+
+Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin De Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-efficient transfer learning for nlp. In International Conference on Machine Learning, pp. 2790–2799. PMLR, 2019.
+
+Edward J Hu, yelong shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum? id=nZeVKeeFYf9.
+
+Menglin Jia, Luming Tang, Bor-Chun Chen, Claire Cardie, Serge Belongie, Bharath Hariharan, and Ser-Nam Lim. Visual prompt tuning. arXiv preprint arXiv:2203.12119, 2022.
+
+Will Kay, Joao Carreira, Karen Simonyan, Brian Zhang, Chloe Hillier, Sudheendra Vijayanarasimhan, Fabio Viola, Tim Green, Trevor Back, Paul Natsev, et al. The kinetics human action video dataset. arXiv preprint arXiv:1705.06950, 2017.
+
+Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
+
+Hildegard Kuehne, Hueihan Jhuang, Est´ıbaliz Garrote, Tomaso Poggio, and Thomas Serre. Hmdb: a large video database for human motion recognition. In 2011 International conference on computer vision, pp. 2556–2563. IEEE, 2011.
+
+Ananya Kumar, Aditi Raghunathan, Robbie Matthew Jones, Tengyu Ma, and Percy Liang. Finetuning can distort pretrained features and underperform out-of-distribution. In International Conference on Learning Representations, 2021.
+
+Tianjiao Li, Qiuhong Ke, Hossein Rahmani, Rui En Ho, Henghui Ding, and Jun Liu. Else-net: Elastic semantic network for continual action recognition from skeleton data. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 13434–13443, 2021a.
+
+Tianjiao Li, Jun Liu, Wei Zhang, Yun Ni, Wenqian Wang, and Zhiheng Li. Uav-human: A large benchmark for human behavior understanding with unmanned aerial vehicles. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 16266–16275, 2021b.
+
+Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 4582–4597, 2021.
+
+Zhaojiang Lin, Andrea Madotto, and Pascale Fung. Exploring versatile generative language model via parameter-efficient transfer learning. In Findings of the Association for Computational Linguistics: EMNLP 2020, pp. 441–459, 2020.
+
+Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. Pretrain, prompt, and predict: A systematic survey of prompting methods in natural language processing. arXiv preprint arXiv:2107.13586, 2021.
+
+Shaoshan Liu, Liangkai Liu, Jie Tang, Bo Yu, Yifan Wang, and Weisong Shi. Edge computing for autonomous driving: Opportunities and challenges. Proceedings of the IEEE, 107(8):1697–1716, 2019.
+
+Ze Liu, Jia Ning, Yue Cao, Yixuan Wei, Zheng Zhang, Stephen Lin, and Han Hu. Video swin transformer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3202–3211, 2022.
+
+Junting Pan, Ziyi Lin, Xiatian Zhu, Jing Shao, and Hongsheng Li. St-adapter: Parameter-efficient image-to-video transfer learning for action recognition. arXiv preprint arXiv:2206.13559, 2022.
+
+Hieu Pham, Zihang Dai, Qizhe Xie, and Quoc V Le. Meta pseudo labels. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11557–11568, 2021.
+
+Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pp. 8748–8763. PMLR, 2021.
+
+Mannat Singh, Laura Gustafson, Aaron Adcock, Vinicius de Freitas Reis, Bugra Gedik, Raj Prateek Kosaraju, Dhruv Mahajan, Ross Girshick, Piotr Dollar, and Laurens van der Maaten. Revisiting ´ weakly supervised pre-training of visual perception models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 804–814, 2022.
+
+Zehua Sun, Qiuhong Ke, Hossein Rahmani, Mohammed Bennamoun, Gang Wang, and Jun Liu. Human action recognition from various data modalities: A review. IEEE transactions on pattern analysis and machine intelligence, 2022.
+
+Yi-Lin Sung, Jaemin Cho, and Mohit Bansal. Vl-adapter: Parameter-efficient transfer learning for vision-and-language tasks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5227–5237, 2022.
+
+Zhan Tong, Yibing Song, Jue Wang, and Limin Wang. Videomae: Masked autoencoders are dataefficient learners for self-supervised video pre-training. arXiv preprint arXiv:2203.12602, 2022.
+
+Xiaohan Wang, Linchao Zhu, Heng Wang, and Yi Yang. Interactive prototype learning for egocentric action recognition. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 8168–8177, 2021.
+
+Jiahui Yu, Zirui Wang, Vijay Vasudevan, Legg Yeung, Mojtaba Seyedhosseini, and Yonghui Wu. Coca: Contrastive captioners are image-text foundation models. arXiv preprint arXiv:2205.01917, 2022.
+
+Sha Yuan, Hanyu Zhao, Shuai Zhao, Jiahong Leng, Yangxiao Liang, Xiaozhi Wang, Jifan Yu, Xin Lv, Zhou Shao, Jiaao He, et al. A roadmap for big model. arXiv preprint arXiv:2203.14101, 2022.
+
+Elad Ben Zaken, Yoav Goldberg, and Shauli Ravfogel. Bitfit: Simple parameter-efficient fine-tuning for transformer-based masked language-models. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pp. 1–9, 2022.
+
+Xiaohua Zhai, Alexander Kolesnikov, Neil Houlsby, and Lucas Beyer. Scaling vision transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12104–12113, 2022.
+
+Yuanhan Zhang, Kaiyang Zhou, and Ziwei Liu. Neural prompt search. arXiv preprint arXiv:2206.04673, 2022.
+
+Fuzhen Zhuang, Zhiyuan Qi, Keyu Duan, Dongbo Xi, Yongchun Zhu, Hengshu Zhu, Hui Xiong, and Qing He. A comprehensive survey on transfer learning. Proceedings of the IEEE, 109(1): 43–76, 2020.
+
+# A APPENDIX
+
+A.1 THE EFFECT OF FC LAYER FOR SMALL SCALE DOWNSTREAM TASKS
+
+Table 6: Results of with or without tuning the FC layer on the small scale dataset HMDB51.
+
+
Method
dbottle
Pre-training
#Frames
with FC layer
without FC layer
#Params
Top-1 (%)
#Params
Top-1 (%)
Our Swin-BAPAT
32
Kinetics 400
8
2.79M
65.97
2.74M
68.20
Our Swin-BAPAT
64
Kinetics 400
8
3.94M
67.28
3.89M
70.10
Our Swin-BAPAT
128
Kinetics 400
8
6.25M
66.75
6.20M
71.93
Our Swin-BAPAT
256
Kinetics 400
8
10.88M
67.67
10.83M
69.64
Our Swin-BAPAT
256
Kinetics 400
8
10.88M
67.67
10.83M
69.64
Our Swin-BAPAT
256
Kinetics 600
8
10.88M
67.41
10.83M
69.90
Our Swin-BAPAT
128
Kinetics 400
8
6.25M
66.75
6.20M
71.93
Our Swin-BAPAT
128
Kinetics 400
16
6.25M
70.56
6.20M
75.67
Our Swin-BAPAT
128
Kinetics 400
32
6.25M
74.82
6.20M
76.46
+
+For the small dataset HMDB51, due to the good parameter-accuracy trade-off achieved by finetuning the FC layer only, adding the FC layer cannot bring extra improvement to our proposed method. Without sufficient taining data, full-tuning also cannot perform well (see results in Table 2). As such, small datasets do not need to rely on large models but can make use of large models with light transfer. Instead, without tuning the FC layer, our Swin-BAPAT can perform better than fine-tuning the FC layer with small amount of extra trainable parameters (see results in Table 6), validating the good parameter-accuracy trade-off of our method.
\ No newline at end of file
diff --git a/md/dev/tjFaqsSK2I3/tjFaqsSK2I3.md b/md/dev/tjFaqsSK2I3/tjFaqsSK2I3.md
new file mode 100644
index 0000000000000000000000000000000000000000..216a2a1748e0828c1b9d89bdd5d7025e54ff9833
--- /dev/null
+++ b/md/dev/tjFaqsSK2I3/tjFaqsSK2I3.md
@@ -0,0 +1,233 @@
+# A Unified Sequence Interface for Vision Tasks
+
+Ting Chen† Saurabh Saxena† Lala Li† Tsung-Yi Lin∗ David J. Fleet Geoffrey Hinton Google Research, Brain Team {iamtingchen,srbs,lala}@google.com
+
+# Abstract
+
+While language tasks are naturally expressed in a single, unified, modeling framework, i.e., generating sequences of tokens, this has not been the case in computer vision. As a result, there is a proliferation of distinct architectures and loss functions for different vision tasks. In this work we show that a diverse set of “core” computer vision tasks can also be unified if formulated in terms of a shared pixelto-sequence interface. We focus on four tasks, namely, object detection, instance segmentation, keypoint detection, and image captioning, all with diverse types of outputs, e.g., bounding boxes or dense masks. Despite that, by formulating the output of each task as a sequence of discrete tokens with a unified interface, we show that one can train a neural network with a single model architecture and loss function on all these tasks, with no task-specific customization. To solve a specific task, we use a short prompt as task description, and the sequence output adapts to the prompt so it can produce task-specific output. We show that such a model can achieve competitive performance compared to well-established task-specific models.
+
+# 1 Introduction
+
+Training a single neural network model capable of performing myriad tasks is a major step towards artificial general intelligence. In recent years, with the rise of big language models [34, 35, 2] using Transformers [41], many different language and related tasks are unified under a single modeling framework, where a language model is trained to predict the solution (in text tokens) given a prompt of a task description (also in text tokens). This is only possible because these tasks (both task description and solution) can be expressed in the same, rich language interface.
+
+This can be naturally extended to some vision tasks such as image captioning or visual question answering where the solution is given in natural language, but the majority of “core” computer vision tasks have diverse outputs that are not readily expressed in terms of natural language. The object detection task produces a set of bounding boxes and their corresponding class labels, often associated with scores for ranking. The output for instance segmentation is a set of segmentation masks corresponding to image regions. The output of keypoint detection is a set of keypoints in an image. As such, existing methods [13, 37, 15, 28, 4, 15] have developed specialized architectures and sophisticated loss functions for each of these complex tasks.
+
+An ambitious goal, in the pursuit of artificial general intelligence, is a simple interface that allows one to express seemingly disparate vision tasks in a unified framework. This would simplify the design of architectures and loss functions for new tasks. It would enable greater degrees of feature/representation sharing across many different tasks, thereby avoiding the need for a sophisticated output head for each task. It would also facilitate adapting of existing models to new tasks, and potentially unlock new capabilities with zero or few demonstrations.
+
+
+Figure 1: An illustration of the proposed framework. An image and a sequence of task prompt is given, the model produce a sequence of discrete tokens corresponding to the desired output.
+
+To this end, we propose an approach to unify four seemingly different vision tasks in a single pixel-to-sequence interface. In effect, this is an extension of Pix2Seq [7] for object detection to a broader set of tasks. As a proof of concept, we focus on four core vision tasks, namely, object detection, instance segmentation, human keypoint detection, and image captioning. We first show how to unify these tasks into a single shared interface, and then train a neural network with a shared architecture and objective function. To solve a specific task, instead of using a specific head for that task, we use a prompt to specify the task, and the sequence output adapts to the prompt so it can produce task-specific output given the task description. This makes multi-task learning more efficient and scalable. We conduct experiments on the challenging COCO dataset, and show that it can simultaneously solve all four tasks well, without specialized architectures or loss functions.
+
+# 2 Approach
+
+In our approach, we cast computer vision tasks as one of translating pixel inputs (along with some descriptions of the task) into sequences of discrete tokens (see Figure 1). As a proof of concept, we focus on four core vision tasks: object detection, instance segmentation, keypoint detection, and image captioning; but we believe it is relatively straightforward to include many more tasks.
+
+# 2.1 A unified interface with tokenization
+
+The vision tasks we consider are diverse, and traditionally have been formulated quite differently. Object detection requires the model to produce bounding boxes for all objects without duplication. Instance segmentation requires the model to produce a dense pixel-wise mask for each identified object instance. Human keypoint detection requires the model to generate points corresponding to specific positions of landmarks on body parts for person instances (e.g., head, eyes). Image captioning requires the model to produce a sequence of words corresponding to a natural language description of the image. Given the significant differences in the form of the outputs, customized models with specialized architectures and loss functions are designed for each task.
+
+To solve these tasks using a single model, we advocate the transformation/tokenization of task inputs and outputs into a unified interface. In this work, we propose a sequence interface for the purpose, where both task descriptions and outputs are expressed as sequences of discrete tokens:
+
+
+Figure 2: An illustration of sequence interface for four tasks. The model takes input image, task prompt tokens and produce task output tokens, which can be decoded/detokenized into required task output for visualization.
+
+- For object detection, we follow [7] and convert bounding boxes and object descriptions into a sequence of discrete tokens by quantizing the continuous image coordinates. Specifically, an object is represented as a sequence of five discrete tokens, i.e. $[ y _ { \mathrm { m i n } } , x _ { \mathrm { m i n } } , y _ { \mathrm { m a x } } , x _ { \mathrm { m a x } } , c ]$ , and multiple objects are randomly ordered each time a training image is sampled and serialized into a single sequence.
+
+- For instance segmentation, instead of per-pixel masks, we predict the polygon [5] corresponding to the instance masks as a sequence of image coordinates conditioned on a given object instance. Again, we quantize the coordinates into discrete tokens. And to turn polygon into a sequence, we randomly select a starting point for the start token each time a training image is sampled. If there are multiple polygons for the same instance, we concatenate sequences of individual polygons with a separator token in between, so that every instance has a single corresponding sequence.
+
+- For keypoint prediction, we predict a set of keypoints as a sequence of quantized image coordinates conditioned on a given person instance. Specifically, the sequence of keypoints can be encoded as [ykeypoint 1, xkeypoint 1, ykeypoint 2, $x _ { \mathrm { k e y p o i n t } 2 } , \cdot \cdot \cdot ]$ . One may also use a keypoint label (e.g., nose, let eye, right eye) before each $( y , x )$ -coordinates so their ordering does not need to be fixed but we opt for simplicity given that there are only a small fixed set of 14 person keypoints in the COCO dataset we consider. When certain keypoints are occluded, their coordinate tokens are replaced with a special occlusion token.
+
+- For captioning, we directly predict text tokens given a caption is a sequence of discrete tokens.
+
+It is worth noting that all four tasks share a single vocabulary. The specific prompts and output sequences are illustrated in Figure 2.
+
+# 2.2 Unified architecture and objective function
+
+We need a flexible and expressive architecture that can deal with image input and sequence output with complex semantics. Thus we follow [7] and use an encoder-decoder architecture, with an image encoder and sequence decoder. The image encoder perceives pixels and maps them into hidden representations, which can be instantiated as a ConvNet [23, 22, 14], Transformer [41, 11], or their combination [4]. The Transformers-based sequence decoder, widely used in modern language modeling [41, 33, 35], generates one token at a time, conditioned on the preceding tokens and the encoded image representation. This removes the complexity and customization in architectures of modern neural networks for these vision tasks (such as per-task specific heads or necks [15, 19, 30]).
+
+
+Figure 3: An illustration of our architecture and training objective. Note that Yconstructed seq encapsulates both task prompt tokens and task output tokens. Token weights are set to zero if the target token is within the prompt so the model is only trained to predict desired output tokens.
+
+Unlike [7] where the decoder produces the output tokens directly for the single object detection task, here it also conditions on a task prompt so that the model can produce outputs adapted to the task of interest. During training, we concatenate both prompt and desired output into a single sequence, but leverage a token weighting scheme to ensure that the decoder is only trained to predict the desired output but not the prompt tokens. During inference, the prompt is given and fixed, so the decoder only needs to produce the rest of the sequence. Similar to [7], the training objective is to maximize the likelihood of tokens conditioned on an image and preceding tokens, i.e.,
+
+$$
+\mathrm { m a x i m i z e } \sum _ { j = 1 } ^ { L } { \pmb w } _ { j } \log P ( { \pmb y } _ { j } | { \pmb x } , { \pmb y } _ { 1 : j - 1 } ) ~ ,
+$$
+
+where $_ { \textbf { \em x } }$ is the input image, $\textbf { { y } }$ is a length- $L$ sequence associated with $_ { \textbf { \em x } }$ . As mentioned, the initial part of the sequence $\textbf { { y } }$ is a prompt, for which we set the weight ${ \pmb w } _ { j }$ to zero so it is not included in the loss.
+
+# 2.3 Training
+
+Each task has its own paired image-sequence training data. There are two ways one can combine tasks and perform the joint training.
+
+Data mixing. We can create a dataset with mixed image-sequence pairs drawn from different tasks, balanced to account for different dataset sizes and task difficulties. This construction is extremely simple conceptually, but image augmentations can be difficult to incorporate as they may also require a change to their associated sequences in non-trivial ways.
+
+Batch mixing. For each batch, we can sample images with annotations for a single task, perform image augmentations appropriate for this task, and convert the augmented data into image-sequence pairs. The model computes the loss and gradient for each task separately, and we can combine gradients from task-specific batches with an appropriate weighting.
+
+# Algorithm 1 Training based on data mixing
+
+# Algorithm 2 Training based on batch mixing
+
+1: Tokenize annotation into sequences of tokens, 2: Mixing images and sequences from all tasks, 3: Sample a batch, compute the loss, and update the model.
+
+1: Sample batches of data from all tasks, 2: Tokenize annotation into sequences of tokens, 3: Compute the loss for each task, aggregate their gradients, and update the model.
+
+can be employed in the future to further simplify the pipeline and allow more tasks to be added straightforwardly.
+
+Both data mixing and batch mixing require that we specify the portion or weighting for each task. This is an empirical matter, and we use a greedy strategy by adding one task at a time. Every time when we add a task, we adjust the weighting of the new task while keeping the relative weighting among the existing task fixed. We fix the sum of the weights across all tasks to be one.
+
+# 2.4 Inference and de-tokenization
+
+At inference time, we sample tokens from the model likelihood, given a prompt at the start of the sequence, i.e., $P ( \pmb { y } _ { j } | \pmb { x } , \pmb { y } _ { 1 : j - 1 } )$ . We currently use nucleus sampling [16] but other techniques such as beam search could also be used. Once the tokens are generated, they can be decoded for each task. In the same way that different tasks require specific tokenization schemes to generate token sequences, the decoding (de-tokenization) process is also specific to each task. A more detailed description of inference decoding for each task is given below.
+
+- For bounding boxes, following [7], we split predicted sequences into tuples of 5 tokens to get coordinate tokens and a class token, and dequantize coordinate tokens to get the bounding boxes. - For instance segmentation, we dequantize the coordinate tokens corresponding to each polygon, and then convert them into dense masks. The model is not trained with any geometry-specific regularizers per se, and as such the output polygonal masks can be somewhat noisy. To reduce the noise we find it helpful to sample multiple sequences and then average the masks, followed by a simple threshold to obtain a single binary mask. - For keypoint detection, we directly dequantize the image coordinate tokens of the keypoints. - For captioning, we directly map the predicted discrete tokens into text.
+
+# 3 Experiments
+
+# 3.1 Experimental settings and implementation details
+
+We evaluate the proposed method on the widely used MS-COCO 2017 dataset [26], containing $1 1 8 \mathrm { k }$ training images and $5 \mathrm { k }$ validation images, spanning the four tasks we consider. An image in the dataset typically has annotations for object bounding boxes, segmentation masks for object instances, keypoint for person instances, and a few captions. Following [7], we use a Vision Transformer (ViT-B) encoder [11, 41], and a Transformer autoregressive decoder [41]. This model has a total of 132M parameters. To initialize the model, we use a pretrained checkpoint from [7] trained on the object detection task with the Objects365 dataset [39]; this is useful as COCO is relatively small and our model has less task-specific prior. For training on COCO, we use a batch size of 128 images, a learning rate of $1 e ^ { - 4 }$ , and we train the model for 100 epochs. We use a single vocabulary of 35K, with 32K text tokens, 1K coordinate quantization bins, and a few other class labels. We use a maximum sequence length of 512. Our backbone model is pretrained with $6 4 0 \times 6 4 0$ image size, and is fine-tuned in $6 4 0 \times 6 4 0$ or $1 0 2 4 \times 1 0 2 4$ resolutions.
+
+Object detection. We follow [7] and use sequence augmentation during training, and use class token probability at inference time for scoring. We also use scale jittering as in [7] (scaling images randomly without changing aspect ratio, crop a fixed size region randomly, and then pad to the maximum size).
+
+Instance segmentation. We set the maximum points of polygons to 128. We find that asking the model to generate multiple samples during the inference time and average the generated masks to be beneficial. More specifically, when multiple samples are independently drawn, we convert each of them into a semantic mask for the prompted object. We then average the masks by setting a $( 5 0 \% )$ threshold, and pixels with more than $50 \%$ times of being on will be selected for that instance. We find that 8 samples are sufficient to provide good performance ( ${ \sim } 6$ AP better than using a single sample), and beyond 12 samples we do not see performance boost. Additionally, during inference, we also evaluate on the cropped regions of the image containing the prompted object instance, by replacing the original input image with a new image only containing the cropped region. With smaller image size of $6 4 0 \times 6 4 0$ , this yields $1 . 3 \mathrm { \ A P }$ improvement, but with larger image size of $1 0 2 4 \times 1 0 2 4$ , this does not seem to help much.
+
+Keypoint detection. We train and evaluate on cropped regions of the image containing person instances (following the common practice in the community). During training, these regions are provided by ground-truth annotations, and during inference these regions are provided by the object detection model. We choose this region to be twice the size of the provided bounding box. We find that this works better than training with a larger crop size or cropping to the exact bounding box. Using our optimal crop we get ${ \sim } 9$ AP improvement over using an extremely large crop ( ${ \sim } 2 0$ times the box size which can be considered a close approximation to using the entire image). We also use a special token to represent invisible token coordinates in the quantized sequence. At training time we use a small loss weight of 0.1 for these tokens. While using a larger weight doesn’t affect AP much (lower by 1 at weight 1.0) using a weight of 0.0 does much worse (12 AP lower). At inference time invisible tokens are replaced with the model’s best guess of the keypoints’ coordinates.
+
+Four-tasks joint training. We use a mixed weighting of 0.1782, 0.7128, 0.099, 0.01 for object detection, instance segmentation, image captioning, and keypoint detection respectively. This set of weight is searched greedily by adding one task at a time (while keeping the weighting ratio of existing tasks unchanged). Ablations on task weighting are shown in the quantitative results below.
+
+Baselines. We compare with a few well-known task-specific baselines. For object detection we compare with a strong 2-stage detector, Faster R-CNN [37], and a more recent Transformer-based detector, DETR [4]. Both Faster R-CNN and DETR use task-specific priors in their design, such as non-maximum suppression in Faster R-CNN and bipartite graph matching with generalized intersection-over-union in DETR. Due to their customized architectures and loss functions, extending them to a wider spectrum of tasks is non-trivial and may require a new model design. Mask RCNN [15] advocates a design to extend Faster R-CNN to incorporate segmentation masks and keypoints. While Mask R-CNN is able to perform three out of our four tasks, it still requires the same set of task-based customizations as in Faster R-CNN. We also consider an improved version of Mask R-CNN with non-local architectures [43] which incorporates an attention mechanism, similar to Transformers. The above methods cannot do image captioning, so we train a Transformer-based caption model [40, 32] which is specialized for the task. This model is similar to the proposed method trained for caption single task but it is using self-supervised pretrained visual encoder [6] with a high dropout rate.
+
+# 3.2 Quantitative results
+
+Table 1: COCO results for object detection, instance segmentation and keypoint detection are expressed in terms of AP. For Image Captioning we report BLEU score. Single task results for instance segmentation and keypoint detection are based on detected bounding boxes from single task detection model. - indicates the model is not able to solve the task without modifications.
+
+
Object det.
Instance seg.
Keypoint det.
Captioning
Faster R-CNN[37]
42.0
Faster R-CNN+ [37]
44.0
DETR[4]
44.9
Mask R-CNN[15]
39.8
37.1
63.1
Mask R-CNN (non-local) [43]
45.0
40.3
66.5
=
Transformer-based captioner [41,32]
1
1
-
34.3
Pix2Seq v2 single task (640×640)
43.8
37.3
68.0
33.9
Pix2Seq v2 single task (1024×1024)
45.6
38.7
67.4
34.0
Pix2Seq v2 multi-tasks (640×640)
44.2
36.9
65.0
34.3
Pix2Seq v2 multi-tasks (1024×1024)
46.5
38.2
64.8
34.9
+
+Our main results are summarized in Table 1, where we report baselines and two variants of our model: (1) single task models where the model is trained on a single task (still with the same architecture and objective function), so each task has its own network weights; and (2) a multi-task model, where a single set of network weights is used for all four tasks. We can see that despite without task-specific priors in architecture and loss function, our model can still achieve competitive results for each individual task compared to strong specialized baselines (even with a smaller image size). When we train a single model on all tasks, our model is able to address these tasks relatively well, despite the model size being kept the same. We also observe that, with larger image sizes, the performances are generally improved. One exception is keypoint detection, which already uses a cropped region of interest for detecting key points, thus scaling up the image size is not necessarily helpful and can lead to overfitting in case of limited labeled data.
+
+
+Figure 4: Performance with different task weighting when a new task is added into an existing task mixes.
+
+Figure 4 shows how we select appropriate loss weighting for each task using a greedy strategy. More specifically, we first search the weight ratio between object detection and instance segmentation and results are shown in Figure 4a. We observe that for a relatively wide range of weighting ratios, the performance of both tasks are near their peak, so we simply choose the 2:8 weighting ratio for these two tasks. After that, we add image captioning task, and the performances under different weighting of the captioning task can be found in Figure 4b, where we find that the 9:1 weighting ratio for existing tasks and image captioning tasks to be appropriate. Finally, adding the keypoint detection task, in Figure 4c we find its weight can be set relatively small and we choose to use 0.01.
+
+# 3.3 Qualitative results
+
+To demonstrate the capability and performance of our model in a more visual and intuitive way, we show the outputs from our multi-task model on selected images from the COCO validation set, for each of the four tasks, i.e., object detection, instance segmentation, keypoint detection, and image captioning. Figure 5 shows results for the object detection task. The model successfully detects objects of different sizes in cluttered scenes with significant occlusion. Empirical results on instance segmentation and keypoint detection are shown in Figures 6 and 7. For both tasks, the multi-task model produces well localized and accurate predictions. We also demonstrate some captions generated by the model in Table 2. With these results, we note that our model has not been pre-trained using large-scale image-text datasets, which is expected to significantly improve the captioning performance of the model.
+
+# 4 Related work
+
+Decoding visual concepts: Image understanding involves extracting visual concepts from images. The formats of these concepts vary according to the given task. Image captioning uses a sequence of words to describe an image [9]. Object detection, on the other hand, represents objects with labels and bounding boxes. Depending on the granularity of localization, visual concepts can be expressed as boxes, pixel segmentation, or keypoints [26]. Decoding localized visual concepts often requires tailored methods. For example, image segmentation uses per-pixel classification. Object detection uses sliding window with non-maximum suppression to detect boxes. Person keypoint detection uses part models to assemble detected parts into whole body [3].
+
+Recently, DETR [4] is proposed as an end-to-end object detection approach based on a Transformer decoding scheme (removing complexity on bounding box proposal and non-maximum suppression). MaskFormer [10] further shows that object detection and segmentation can share the same decoding scheme. Pix2seq [7] demonstrates that boxes and labels can be treated as a sequence of discrete tokens, thereby sharing the same training and decoding interface as language models [33, 35]. In our work, we push the envelope further in the unification of language and different visual localization tasks to share the same interface, architecture and training objective.
+
+
+Figure 5: Visualization of the object detection results, with predicted bounding boxes on the input images.
+
+Generalist vision models: Learning a generalist model capable of performing multiple tasks is widely assumed to be a path toward general intelligence. In visual recognition, multi-task learning has shown great success by sharing a backbone model, followed by multiple independent heads [15, 19, 30]. Models with a shared backbone can learn general features which are transferable across tasks when scaling up with training tasks, model capacity and data [20, 24, 12]. Nevertheless, often the task specific backbone models are designed carefully, particularly for tasks that require accurate localization [38, 27].
+
+With the invention of Transformers [41], recently being adopted for image classification [11], the research community has seized on the opportunity to unify the backbone design for vision tasks [29, 8, 25]. Perceivers [18, 17] and OFA [42] demonstrate an architecture for multi-task and multimodal across vision and language. Notably, OFA designs a unified sequence-to-sequence decoding architecture for both language and object detection tasks. Flamingo [1] and related methods also focus on an universal API that produces a natural language output for a variety of tasks given image input. This line of work shares a common motivation to our work in this paper, however they focus on higher level tasks for which natural language is inherently the desired output. In this paper we demonstrate that one can express a variety of “core” computer vision tasks in a universal interface, and the learned model exhibits strong grounding capability of the tokens they produce to actual visual concepts. Concurrently to our work, Gato [36] unifies a series of vision and control tasks into a single sequential prediction problem, and UViM [21] and Unified-IO [31] propose using learned discrete codes for unifying a set of vision tasks.
+
+
+Figure 6: Visualization of the instance segmentation results, with predicted semantic masks overlaid on the input images.
+
+
+Figure 7: Visualization of the Human keypoint detection results, with predicted stick figures on the input images.
+
+Table 2: Image captioning results.
+
+
A group of teddy bears sitting next to each other. Three teddy bears sitting on a blanket. A group of teddy bears sitting on a blanket with bowls of food.
A herd of elephants standing inside of a fenced in area. A group of elephants standing in a fenced area. A herd of elephants standing behind a fence.
A man riding a skateboard over a block of cement. A man doing a trick on a skateboard in the street. A man flying through the air while riding a skateboard.
A row of motorcycles parked on a grass covered field. A motorcycle with a helmet on the side of it. A motorcycle parked in a grassy area with other motorcycles.
+
+# 5 Conclusion
+
+In this work, we explore a unified sequence interface for tackling a diverse set of “core” vision tasks, where both the task description (prompt) and task output are expressed as discrete sequences of tokens. This is a significant departure from conventional norms of multi-task vision models in that both architecture and loss functions are shared among the tasks. We show that such a model can achieve competitive performance compared to well-established task-specific models.
+
+Our work is not without limitations. Due to the significant departure from conventional approaches, we believe both architectures and other training techniques can be further improved to challenge the state-of-the-art of specialized systems. We also believe our model can significantly benefit from scaling up, both in pretraining on larger datasets (e.g., image-text pairs) and/or using larger model sizes. Another limitation is the inference speed can be potentially slower (for longer sequences particularly) compared to the specialized systems as our approach is based on autoregressive modeling. There are a few ways to improve the efficiency, including using non-autoregressive sequence modeling (which we leave as future work). In this work, we exploit parallel querying for speeding up our model inference. For example, predicting multi-person poses can be done independently by prompting the model with independent bounding boxes (detected by the model itself or pre-given), so the only sequential prediction is limited to a single person with a few keypoints. The same strategy can be applied to instance segmentation as well.
+
+While the optimal implementation of a unified interface still requires more research and the sequence interface explored in this work is only one potential implementation, we believe the interface of how different tasks are formulated would play an increasing important role in general-purpose intelligent systems going forward.
+
+# Acknowledgements
+
+We specially thank Wei Li for their helpful feedback on the initial draft. We also thank Xiaohua Zhai, Alexander Kolesnikov, Lucas Beyer, Neil Houlsby, Simon Kornblith and Mohammad Norouzi for some early discussions.
+
+# References
+
+[1] Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katie Millican, Malcolm Reynolds, Roman Ring, Eliza Rutherford, Serkan Cabi, Tengda Han, Zhitao Gong, Sina Samangooei, Marianne Monteiro, Jacob Menick, Sebastian Borgeaud, Andrew Brock, Aida Nematzadeh, Sahand Sharifzadeh, Mikolaj Binkowski, Ricardo Barreira, Oriol Vinyals, Andrew Zisserman, and Karen Simonyan. Flamingo: a visual language model for few-shot learning. arXiv preprint arXiv:2204.14198, 2022.
+[2] Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
+[3] Zhe Cao, Tomas Simon, Shih-En Wei, and Yaser Sheikh. Realtime multi-person 2d pose estimation using part affinity fields. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7291–7299, 2017.
+[4] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European Conference on Computer Vision, pages 213–229. Springer, 2020.
+[5] Lluis Castrejon, Kaustav Kundu, Raquel Urtasun, and Sanja Fidler. Annotating object instances with a polygon-rnn. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 5230–5238, 2017.
+[6] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International Conference on Machine Learning, pages 1597–1607. PMLR, 2020.
+[7] Ting Chen, Saurabh Saxena, Lala Li, David J Fleet, and Geoffrey Hinton. Pix2seq: A language modeling framework for object detection. arXiv preprint arXiv:2109.10852, 2021.
+[8] Wuyang Chen, Xianzhi Du, Fan Yang, Lucas Beyer, Xiaohua Zhai, Tsung-Yi Lin, Huizhong Chen, Jing Li, Xiaodan Song, Zhangyang Wang, et al. A simple single-scale vision transformer for object localization and instance segmentation. arXiv preprint arXiv:2112.09747, 2021.
+[9] Xinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325, 2015.
+[10] Bowen Cheng, Alex Schwing, and Alexander Kirillov. Per-pixel classification is not all you need for semantic segmentation. Advances in Neural Information Processing Systems, 34, 2021.
+[11] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2020.
+[12] Golnaz Ghiasi, Barret Zoph, Ekin D Cubuk, Quoc V Le, and Tsung-Yi Lin. Multi-task self-training for learning general representations. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 8856–8865, 2021.
+[13] Ross Girshick. Fast r-cnn. In Proceedings of the IEEE International Conference on Computer Vision, pages 1440–1448, 2015.
+[14] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 770–778, 2016.
+[15] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In Proceedings of the IEEE International Conference on Computer Vision, pages 2961–2969, 2017.
+[16] Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. arXiv preprint arXiv:1904.09751, 2019.
+[17] Andrew Jaegle, Sebastian Borgeaud, Jean-Baptiste Alayrac, Carl Doersch, Catalin Ionescu, David Ding, Skanda Koppula, Daniel Zoran, Andrew Brock, Evan Shelhamer, et al. Perceiver io: A general architecture for structured inputs & outputs. arXiv preprint arXiv:2107.14795, 2021.
+[18] Andrew Jaegle, Felix Gimeno, Andy Brock, Oriol Vinyals, Andrew Zisserman, and Joao Carreira. Perceiver: General perception with iterative attention. In International Conference on Machine Learning, pages 4651–4664. PMLR, 2021.
+[19] Iasonas Kokkinos. Ubernet: Training a universal convolutional neural network for low-, mid-, and highlevel vision using diverse datasets and limited memory. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 6129–6138, 2017.
+[20] Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (bit): General visual representation learning. In European conference on computer vision, pages 491–507. Springer, 2020.
+[21] Alexander Kolesnikov, André Susano Pinto, Lucas Beyer, Xiaohua Zhai, Jeremiah Harmsen, and Neil Houlsby. Uvim: A unified modeling approach for vision with learned guiding codes. arXiv preprint arXiv:2205.10337, 2022.
+[22] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in Neural Information Processing Systems, 25:1097–1105, 2012.
+[23] Yann LeCun, Bernhard Boser, John S Denker, Donnie Henderson, Richard E Howard, Wayne Hubbard, and Lawrence D Jackel. Backpropagation applied to handwritten zip code recognition. Neural computation, 1 (4):541–551, 1989.
+[24] Yanghao Li, Saining Xie, Xinlei Chen, Piotr Dollar, Kaiming He, and Ross Girshick. Benchmarking detection transfer learning with vision transformers. arXiv preprint arXiv:2111.11429, 2021.
+[25] Yanghao Li, Hanzi Mao, Ross Girshick, and Kaiming He. Exploring plain vision transformer backbones for object detection. arXiv preprint arXiv:2203.16527, 2022.
+[26] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European Conference on Computer Vision, pages 740–755. Springer, 2014.
+[27] Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In Proceedings of the IEEE Conference on Computer Vision and pattern recognition, pages 2117–2125, 2017.
+[28] Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollár. Focal loss for dense object detection. In Proceedings of the IEEE International Conference on Computer Vision, pages 2980–2988, 2017.
+[29] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 10012–10022, 2021.
+[30] Jiasen Lu, Vedanuj Goswami, Marcus Rohrbach, Devi Parikh, and Stefan Lee. 12-in-1: Multi-task vision and language representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10437–10446, 2020.
+[31] Jiasen Lu, Christopher Clark, Rowan Zellers, Roozbeh Mottaghi, and Aniruddha Kembhavi. Unified-io: A unified model for vision, language, and multi-modal tasks. arXiv preprint arXiv:2206.08916, 2022.
+[32] Yingwei Pan, Ting Yao, Yehao Li, and Tao Mei. X-linear attention networks for image captioning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10971– 10980, 2020.
+[33] Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. 2018.
+[34] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
+[35] 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. arXiv preprint arXiv:1910.10683, 2019.
+[36] Scott Reed, Konrad Zolna, Emilio Parisotto, Sergio Gomez Colmenarejo, Alexander Novikov, Gabriel Barth-Maron, Mai Gimenez, Yury Sulsky, Jackie Kay, Jost Tobias Springenberg, Tom Eccles, Jake Bruce, Ali Razavi, Ashley Edwards, Nicolas Heess, Yutian Chen, Raia Hadsell, Oriol Vinyals, Mahyar Bordbar, and Nando de Freitas. A generalist agent. arXiv arXiv:2205.06175, 2022.
+[37] Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. Advances in Neural Information Processing Systems, 28:91–99, 2015.
+[38] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 2015.
+[39] Shuai Shao, Zeming Li, Tianyuan Zhang, Chao Peng, Gang Yu, Xiangyu Zhang, Jing Li, and Jian Sun. Objects365: A large-scale, high-quality dataset for object detection. In Proceedings of the IEEE/CVF international conference on computer vision, pages 8430–8439, 2019.
+[40] Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2556–2565, 2018.
+[41] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, pages 5998–6008, 2017.
+[42] Peng Wang, An Yang, Rui Men, Junyang Lin, Shuai Bai, Zhikang Li, Jianxin Ma, Chang Zhou, Jingren Zhou, and Hongxia Yang. Unifying architectures, tasks, and modalities through a simple sequence-tosequence learning framework. arXiv preprint arXiv:2202.03052, 2022.
+[43] Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7794–7803, 2018.
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes] See Conclusion section
+(c) Did you discuss any potential negative societal impacts of your work? [No] Our work at its current form does not increase the risk of negative social impacts of those existing specialized systems.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We will opensource our code at https://github.com/google-research/pix2seq.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Some of the experiments are expensive to run multiple times, and the standard errors are usually pretty small.
+
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] It’s trained on 32-128 Cloud TPUs. Depending on architectures, and tasks, generally takes 4-12 hours.
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [No] It is pretty obvious from the dataset website, and it’s a well known dataset.
+(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/to3qCB3tOh9/to3qCB3tOh9.md b/md/dev/to3qCB3tOh9/to3qCB3tOh9.md
new file mode 100644
index 0000000000000000000000000000000000000000..0cdfbb954e3c965fe385f0f28fb30b1244e31b82
--- /dev/null
+++ b/md/dev/to3qCB3tOh9/to3qCB3tOh9.md
@@ -0,0 +1,672 @@
+# PROTEIN REPRESENTATION LEARNING BY GEOMETRIC STRUCTURE PRETRAINING
+
+Zuobai Zhang1,2, Minghao $\mathbf { X } \mathbf { u } ^ { 1 , 2 }$ , Arian Jamasb3, Vijil Chenthamarakshan4, Aurélie Lozano4, Payel Das4, Jian Tang1,5,6
+
+Mila - Québec AI Institute1, Université de Montréal2, University of Cambridge3 IBM Research4, HEC Montréal5, CIFAR AI Chair6 {zuobai.zhang, minghao.xu}@mila.quebec, arj39@cam.ac.uk {ecvijil,aclozano,daspa}@us.ibm.com, jian.tang@hec.ca
+
+# ABSTRACT
+
+Learning effective protein representations is critical in a variety of tasks in biology such as predicting protein function or structure. Existing approaches usually pretrain protein language models on a large number of unlabeled amino acid sequences and then finetune the models with some labeled data in downstream tasks. Despite the effectiveness of sequence-based approaches, the power of pretraining on known protein structures, which are available in smaller numbers only, has not been explored for protein property prediction, though protein structures are known to be determinants of protein function. In this paper, we propose to pretrain protein representations according to their 3D structures. We first present a simple yet effective encoder to learn the geometric features of a protein. We pretrain the protein graph encoder by leveraging multiview contrastive learning and different self-prediction tasks. Experimental results on both function prediction and fold classification tasks show that our proposed pretraining methods outperform or are on par with the state-of-the-art sequence-based methods, while using much less pretraining data. Our implementation is available at https://github.com/ DeepGraphLearning/GearNet.
+
+# 1 INTRODUCTION
+
+Proteins are workhorses of the cell and are implicated in a broad range of applications ranging from therapeutics to material. They consist of a linear chain of amino acids (residues) which fold into specific conformations. Due to the advent of low cost sequencing technologies (Ma & Johnson, 2012; Ma, 2015), in recent years a massive volume of protein sequences have been newly discovered. As functional annotation of a new protein sequence remains costly and time-consuming, accurate and efficient in silico protein function annotation methods are needed to bridge the existing sequence-function gap.
+
+Since a large number of protein functions are governed by their folded structures, several datadriven approaches rely on learning representations of the protein structures, which then can be used for a variety of tasks such as protein design (Ingraham et al., 2019; Strokach et al., 2020; Cao et al., 2021; Jing et al., 2021), structure classification (Hermosilla et al., 2021), model quality assessment (Baldassarre et al., 2021; Derevyanko et al., 2018), and function prediction (Gligorijevic´ et al., 2021). Due to the challenge of experimental protein structure determination, the number of reported protein structures is orders of magnitude lower than the size of datasets in other machine learning application domains. For example, there are 182K experimentally-determined structures in the Protein Data Bank (PDB) (Berman et al., 2000) vs 47M protein sequences in Pfam (Mistry et al., 2021) and vs 10M annotated images in ImageNet (Russakovsky et al., 2015).
+
+To address this gap, recent works have leveraged the large volume of unlabeled protein sequence data to learn an effective representation of known proteins (Bepler & Berger, 2019; Rives et al., 2021; Elnaggar et al., 2021). A number of studies have pretrained protein encoders on millions of sequences via self-supervised learning. However, these methods neither explicitly capture nor leverage the available protein structural information that is known to be the determinants of protein functions.
+
+To better utilize structural information, several structure-based protein encoders (Hermosilla et al., 2021; Hermosilla & Ropinski, 2022; Wang et al., 2022a) have been proposed. However, these models have not explicitly captured the interactions between edges, which are critical in protein structure modeling (Jumper et al., 2021). Besides, very few attempts (Hermosilla & Ropinski, 2022; Chen et al., 2022; Guo et al., 2022) have been made until recently to develop pretraining methods that exploit unlabeled 3D structures due to the scarcity of experimentally-determined protein structures. Thanks to recent advances in highly accurate deep learning-based protein structure prediction methods (Baek et al., 2021; Jumper et al., 2021), it is now possible to efficiently predict structures for a large number of protein sequences with reasonable confidence.
+
+Motivated by this development, we develop a protein encoder pretrained on the largest possible number1 of protein structures that is able to generalize to a variety of property prediction tasks. We propose a simple yet effective structure-based encoder called GeomEtry-Aware Relational Graph Neural Network (GearNet), which encodes spatial information by adding different types of sequential or structural edges and then performs relational message passing on protein residue graphs. Inspired by the design of triangle attention in Evoformer (Jumper et al., 2021), we propose a sparse edge message passing mechanism to enhance the protein structure encoder, which is the first attempt to incorporate edge-level message passing on GNNs for protein structure encoding.
+
+We further introduce a geometric pretraining method to learn the protein structure encoder based on the popular contrastive learning framework (Chen et al., 2020). We propose novel augmentation functions to discover biologically correlated protein substructures that co-occur in proteins (Ponting & Russell, 2002) and aim to maximize the similarity between the learned representations of substructures from the same protein, while minimizing the similarity between those from different proteins. Simultaeneously, we propose a suite of straightforward baselines based on self-prediction (Devlin et al., 2018). These pretraining tasks perform masked prediction of different geometric or physicochemical attributes, such as residue types, Euclidean distances, angles and dihedral angles. Through extensively benchmarking these pretraining techniques on diverse downstream property prediction tasks, we set up a solid starting point for pretraining protein structure representations.
+
+Extensive experiments on several benchmarks, including Enzyme Commission number prediction (Gligorijevic et al., 2021), Gene Ontology term prediction (Gligorijevi ´ c et al., 2021), fold ´ classification (Hou et al., 2018) and reaction classification (Hermosilla et al., 2021) verify our GearNet augmented with edge message passing can consistently outperform existing protein encoders on most tasks in a supervised setting. Further, by employing the proposed pretraining method, our model trained on fewer than a million samples achieves comparable or even better results than the state-of-the-art sequence-based encoders pretrained on million- or billion-scale datasets.
+
+# 2 RELATED WORK
+
+Previous works seek to learn protein representations based on different modalities of proteins, including amino acid sequences (Rao et al., 2019; Elnaggar et al., 2021; Rives et al., 2021), multiple sequence alignments (MSAs) (Rao et al., 2021; Biswas et al., 2021; Meier et al., 2021) and protein structures (Hermosilla et al., 2021; Gligorijevic et al., 2021; Somnath et al., 2021). These works share ´ the common goal of learning informative protein representations that can benefit various downstream applications, like predicting protein function (Rives et al., 2021) and protein-protein interaction (Wang et al., 2019), as well as designing protein sequences (Biswas et al., 2021).
+
+Compared with sequence-based methods, structure-based methods should be, in principle, a better solution to learning an informative protein representation, as the function of a protein is determined by its structure. This line of works seeks to encode spatial information in protein structures by 3D CNNs (Derevyanko et al., 2018) or graph neural networks (GNNs) (Gligorijevic et al., 2021; ´ Baldassarre et al., 2021; Jing et al., 2021; Wang et al., 2022a; Aykent & Xia, 2022). Among these methods, IEConv (Hermosilla et al., 2021) tries to fit the inductive bias of protein structure modeling, which introduced a graph convolution layer incorporating intrinsic and extrinsic distances between nodes. Another potential direction is to extract features from protein surfaces (Gainza et al., 2020; Sverrisson et al., 2021; Dai & Bailey-Kellogg, 2021). Somnath et al. (2021) combined the advantages of both worlds and proposed a parameter-efficient multi-scale model. Besides, there are also works that enhance pretrained sequence-based models by incorporating structural information in the pretraining stage (Bepler & Berger, 2021) or finetuning stage (Wang et al., 2022b).
+
+Despite progress in the design of structure-based encoders, there are few works focusing on structurebased pretraining for proteins. To the best of our knowledge, the only attempt is three concurrent works (Hermosilla & Ropinski, 2022; Chen et al., 2022; Guo et al., 2022), which apply contrastive learning, self-prediction and denoising score matching methods on a small set of tasks, respectively. Compared with these existing works, our proposed encoder is conceptually simpler and more effective on many different tasks, thanks to the proposed relational graph convolutional layer and edge message passing layer, which are able to efficiently capture both the sequential and structural information. Furthermore, we introduce a contrastive learning framework with novel augmentation functions to discover substructures in different proteins and four different self-prediction tasks, which can serve as a solid starting point for enabling self-supervised learning on protein structures.
+
+# 3 STRUCTURE-BASED PROTEIN ENCODER
+
+Existing protein encoders are either designed for specific tasks or cumbersome for pretraining due to the dependency on computationally expensive convolutions. In contrast, here we propose a simple yet effective protein structure encoder, named GeomEtry-Aware Relational Graph Neural Network (GearNet). We utilize sparse edge message passing to enhance the effectiveness of GearNet, which is novel and crucial in the field of protein structure modeling, whereas previous works (Hermosilla et al., 2021; Somnath et al., 2021) only consider message passing among residues or atoms.
+
+# 3.1 GEOMETRY-AWARE RELATIONAL GRAPH NEURAL NETWORK
+
+Given protein structures, our model aims to learn representations encoding their spatial and chemical information. These representations should be invariant under translations, rotations and reflections in 3D space. To achieve this requirement, we first construct our protein graph based on spatial features invariant under these transformations.
+
+Protein graph construction. We represent the structure of a protein as a residue-level relational graph $\mathcal { G } = ( \nu , \mathcal { E } , \mathcal { R } )$ , where $\nu$ and $\mathcal { E }$ denotes the set of nodes and edges respectively, and $\mathcal { R }$ is the set of edge types. We use $( i , j , r )$ to denote the edge from node $i$ to node $j$ with type $r$ . We use $n$ and $m$ to denote the number of nodes and edges, respectively. In this work, each node in the protein graph represents the alpha carbon of a residue with the 3D coordinates of all nodes $\mathbf { { x } } \in \mathbb { R } ^ { n \times 3 }$ . We use $f _ { i }$ and $\mathbf { \Delta } f _ { ( i , j , r ) }$ to denote the feature for node $i$ and edge $( i , j , r )$ , respectively, in which reside types, sequential and spatial distances are considered.
+
+Then, we add three different types of directed edges into our graphs: sequential edges, radius edges and $\mathbf { K }$ -nearest neighbor edges. Among these, sequential edges will be further divided into 5 types of edges based on the relative sequential distance $\bar { d ^ { \cdot } } \in \{ - 2 , - \bar { 1 } , 0 , 1 , 2 \}$ between two end nodes, where we add sequential edges only between the nodes within the sequential distance of 2. These edge types reflect different geometric properties, which all together yield a comprehensive featurization of proteins. More details of the graph and feature construction process can be found in Appendix C.1.
+
+Relational graph convolutional layer. Upon the protein graphs defined above, we utilize a GNN to derive per-residue and whole-protein representations. One simple example of GNNs is the GCN (Kipf & Welling, 2017), where messages are computed by multiplying node features with a convolutional kernel matrix shared among all edges. To increase the capacity in protein structure modeling, IEConv (Hermosilla et al., 2021) proposed to apply a learnable kernel function on edge features. In this way, $m$ different kernel matrices can be applied on different edges, which achieves good performance but induces high memory costs.
+
+To balance model capacity and memory cost, we use a relational graph convolutional neural network (Schlichtkrull et al., 2018) to learn graph representations, where a convolutional kernel matrix is shared within each edge type and there are $| \mathcal { R } |$ different kernel matrices in total. Formally, the relational graph convolutional layer used in our model is defined as
+
+$$
+h _ { i } ^ { ( 0 ) } = f _ { i } , \quad { \boldsymbol u } _ { i } ^ { ( l ) } = \sigma \left( \mathrm { B N } \left( \sum _ { r \in \mathcal { R } } W _ { r } \sum _ { j \in { \cal N } _ { r } ( i ) } { h } _ { j } ^ { ( l - 1 ) } \right) \right) , \quad h _ { i } ^ { ( l ) } = h _ { i } ^ { ( l - 1 ) } + { \boldsymbol u } _ { i } ^ { ( l ) } .
+$$
+
+Specifically, we use node features $f _ { i }$ as initial representations. Then, given the node representation h(l) for node $i$ at the $l$ -th layer, we compute updated node representation $\mathbf { \Delta } _ { \mathbf { \boldsymbol { u } } _ { i } ^ { ( l ) } }$ by aggregating features from neighboring nodes $\dot { \mathcal { N } _ { r } } ( i )$ , where $\bar { \mathcal { N } } _ { r } ( i ) \bar { = } \{ j \in \mathcal { V } | ( j , i , r ) \in \mathcal { E } \}$ denotes the neighborhood of node $i$ with the edge type $r$ , and $W _ { r }$ denotes the learnable convolutional kernel matrix for edge type $r$ . Here BN denotes a batch normalization layer and we use a ReLU function as the activation $\sigma ( \cdot )$ . Finally, we update ${ h } _ { i } ^ { ( l ) }$ with $\mathbf { \Delta } _ { \mathbf { \boldsymbol { u } } _ { i } ^ { ( l ) } }$ and add a residual connection from last layer.
+
+# 3.2 EDGE MESSAGE PASSING LAYER
+
+As in the literature of molecular representation learning, many geometric encoders show benefits from explicitly modeling interactions between edges. For example, DimeNet (Klicpera et al., 2020) uses a 2D spherical Fourier-Bessel basis function to represent angles between two edges and pass messages between edges. AlphaFold2 (Jumper et al., 2021) leverages the triangle attention designed for transformers to model pair representations. Inspired by this observation, we propose a variant of GearNet enhanced with an edge message passing layer, named as GearNet-Edge. The edge message passing layer can be seen as a sparse version of the pair representation update designed for graph neural networks. The main objective is to model the dependency between different interactions of a residue with other sequentially or spatially adjacent residues.
+
+Formally, we first construct a relational graph $\mathcal { G } ^ { \prime } = ( \mathcal { V } ^ { \prime } , \mathcal { E } ^ { \prime } , \mathcal { R } ^ { \prime } )$ among edges, which is also known as line graph in the literature (Harary $\&$ Norman, 1960). Each node in the graph $\mathcal { G } ^ { \prime }$ corresponds to an edge in the original graph. $\mathcal { G } ^ { \prime }$ links edge $( i , j , r _ { 1 } )$ in the original graph to edge $( w , k , r _ { 2 } )$ if and only if $j = w$ and $i \neq k$ . The type of this edge is determined by the angle between $( i , j , r _ { 1 } )$ and $( w , k , r _ { 2 } )$ . The angular information reflects the relative position between two edges that determines the strength of their interaction. For example, edges with smaller angles point to closer directions and thus are likely to share stronger interactions. To save memory costs for computing a large number of kernel matrices, we discretize the range $[ 0 , \pi ]$ into 8 bins and use the index of the bin as the edge type.
+
+Then, we apply a similar relational graph convolutional network on the graph $\mathcal { G } ^ { \prime }$ to obtain the message function for each edge. Formally, the edge message passing layer is defined as
+
+$$
+m _ { ( i , j , r _ { 1 } ) } ^ { ( 0 ) } = f _ { ( i , j , r _ { 1 } ) } , \ m _ { ( i , j , r _ { 1 } ) } ^ { ( l ) } = \sigma \left( \mathrm { B N } \left( \sum _ { r \in \mathcal { R } ^ { \prime } } W _ { r } ^ { \prime } \sum _ { ( w , k , r _ { 2 } ) \in \mathcal { N } _ { r } ^ { \prime } ( ( i , j , r _ { 1 } ) ) } m _ { ( w , k , r _ { 2 } ) } ^ { ( l - 1 ) } \right) \right) .
+$$
+
+Here we use m( $m _ { ( i , j , r _ { 1 } ) } ^ { ( l ) }$ to denote the message function for edge $( i , j , r _ { 1 } )$ in the $l$ -th layer. Similar as Eq. (1), the message function for edge $( i , j , r _ { 1 } )$ will be updated by aggregating features from its neighbors $\bar { \mathcal { N } } _ { r } ^ { \prime } \big ( ( i , j , r _ { 1 } ) \big )$ , where $\begin{array} { r } { \mathcal { N } _ { r } ^ { \prime } ( ( \bar { i } , j , r _ { 1 } ) ) = \{ ( w , k , r _ { 2 } ) \in \mathcal { V } ^ { \prime } | ( ( \bar { w } , \bar { k } , r _ { 2 } ) , ( i , j , r _ { 1 } ) , r ) \in \mathcal { E } ^ { \prime } \} } \end{array}$ denotes the set of incoming edges of $( i , j , r _ { 1 } )$ with relation type $r$ in graph $\mathcal { G } ^ { \prime }$ .
+
+Finally, we replace the aggregation function Eq. (1) in the original graph with the following one:
+
+$$
+\begin{array} { r } { \pmb { u } _ { i } ^ { ( l ) } = \sigma \left( \mathrm { B N } \left( \sum _ { r \in \mathcal { R } } \pmb { W } _ { r } \sum _ { j \in \mathcal { N } _ { r } ( i ) } ( \pmb { h } _ { j } ^ { ( l - 1 ) } + \mathrm { F C } ( \pmb { m } _ { ( j , i , r ) } ^ { ( l ) } ) \right) \right) , } \end{array}
+$$
+
+where $\operatorname { F C } ( \cdot )$ denotes a linear transformation upon the message function.
+
+Notably, it is a novel idea to use relational message passing to model different spatial interactions among residues. In addition, to the best of our knowledge, this is one of the first works that explore edge message passing for macromolecular representation learning (see a concurrent work (Morehead et al., 2022) for protein-protein interactions). Compared with the triangle attention in AlphaFold2, our method considers angular information to model different types of interactions between edges, which are more efficient for sparse edge message passing.
+
+Invariance of GearNet and GearNet-Edge. The graph construction process and input features of GearNet and GearNet-Edge only rely on features (distances and angles) invariant to translation, rotation and reflection. Besides, the message passing layers use pre-defined edge types and other 3D information invariantly. Therefore, GearNet and GearNet-Edge can achieve E(3)-invariance.
+
+# 4 GEOMETRIC PRETRAINING METHODS
+
+In this section, we study how to boost protein representation learning via self-supervised pretraining on a massive collection of unlabeled protein structures. Despite the efficacy of self-supervised pretraining in many domains, applying it to protein representation learning is nontrivial due to the difficulty of capturing both biochemical and spatial information in protein structures. To address the challenge, we first introduce our multiview contrastive learning method with novel augmentation functions to discover correlated co-occurrence of protein substructures and align their representations in the latent space. Furthermore, four self-prediction baselines are also proposed for pretraining structure-based encoders.
+
+
+Figure 1: Demonstration of multiview contrastive learning. For each protein, we first construct the residue graph $\mathcal { G }$ based on the structural information (some edges are omitted to save space). Next, two views $\mathcal { G } _ { x }$ and $\mathcal { G } _ { y }$ of the protein are generated by randomly choosing the sampling scheme and noise function. For $\mathcal { G } _ { x }$ , we first extract a subsequence and then perform random edge masking with dash lines indicating masked edges. For $\mathcal { G } _ { y }$ , we perform subspace cropping and then keep the subspace graph $\mathcal { G } _ { p , d } ^ { ( \mathrm { s p a c e } ) }$ unchanged. Finally, a contrastive learning loss is optimized to maximize the similarity between $\mathcal { G } _ { x }$ and $\mathcal { G } _ { y }$ in the latent space while minimizing its similarity with a negative sample .
+
+# 4.1 MULTIVIEW CONTRASTIVE LEARNING
+
+It is known that structural motifs within folded protein structures are biologically related (Mackenzie & Grigoryan, 2017) and protein substructures can reflect the evolution history and functions of proteins (Ponting & Russell, 2002). Inspired by recent contrastive learning methods (Chen et al., 2020; He et al., 2020), our framework aims to preserve the similarity between these correlated substructures before and after mapping to a low-dimensional latent space. Specifically, using a similarity measurement defined in the latent space, biologically-related substructures are embedded close to each other while unrelated ones are mapped far apart. Figure 1 illustrates the high-level idea.
+
+Constructing views that reflect protein substructures. Given a protein graph $\mathcal { G }$ , we consider two different sampling schemes for constructing views. The first one is subsequence cropping, which randomly samples a left residue $l$ and a right residue $r$ and takes all residues ranging from $l$ to $r$ . This sampling scheme aims to capture protein domains, consecutive protein subsequences that reoccur in different proteins and indicate their functions (Ponting & Russell, 2002). However, simply sampling protein subsequences cannot fully utilize the 3D structural information in protein data. Therefore, we further introduce a subspace cropping scheme to discover spatially correlated structural motifs. We randomly sample a residue $p$ as the center and select all residues within a Euclidean ball with a predefined radius the protein residue g $d$ . Faph $\mathcal { G } = ( \nu , \mathcal { E } , \mathcal { R } )$ pling schemes, we take the corresp. In specific, the subsequence graph $\mathcal { G } _ { l , r } ^ { ( \mathrm { s e q } ) }$ g subgraphs fromand the subspace graph $\mathcal { G } _ { p , d } ^ { ( \mathrm { s p a c e } ) }$ can be written as:
+
+$$
+\begin{array} { r l } & { \mathcal { V } _ { l , r } ^ { ( \mathrm { s e q . } ) } = \{ i | i \in \mathcal { V } , l \leq i \leq r \} , \mathcal { E } _ { l , r } ^ { ( \mathrm { s e q . } ) } = \{ ( i , j , r ) | ( i , j , r ) \in \mathcal { E } , i \in \mathcal { V } _ { l , r } ^ { ( \mathrm { s e q . } ) } , j \in \mathcal { V } _ { l , r } ^ { ( \mathrm { s e q . } ) } \} , } \\ & { \mathcal { V } _ { p , d } ^ { ( \mathrm { s p a c e . } ) } = \{ i | i \in \mathcal { V } , \| x _ { i } - x _ { p } \| _ { 2 } \leq d \} , \mathcal { E } _ { p , d } ^ { ( \mathrm { s p a c e . } ) } = \{ ( i , j , r ) | ( i , j , r ) \in \mathcal { E } , i \in \mathcal { V } _ { p , d } ^ { ( \mathrm { s p a c e } ) } , j \in \mathcal { V } _ { p , d } ^ { ( \mathrm { s p a c e } ) } \} } \end{array}
+$$
+
+$\mathcal { G } _ { l , r } ^ { ( \mathrm { s e q } ) } = ( \mathcal { V } _ { l , r } ^ { ( \mathrm { s e q } ) } , \mathcal { E } _ { l , r } ^ { ( \mathrm { s e q } ) } , \mathcal { R } )$ and $\mathcal { G } _ { p , d } ^ { ( \mathrm { s p a c e } ) } = ( \mathcal { V } _ { p , d } ^ { ( \mathrm { s p a c e } ) } , \mathcal { E } _ { p , d } ^ { ( \mathrm { s p a c e } ) } , \mathcal { R } ) .$
+
+After sampling the substructures, following the common practice in self-supervised learning (Chen et al., 2020), we apply a noise function to generate more diverse views and thus benefit the learned representations. Here we consider two noise functions: identity that applies no transformation and random edge masking that randomly masks each edge with a fixed probability 0.15.
+
+Contrastive learning. We follow SimCLR (Chen et al., 2020) to optimize a contrastive loss function and thus maximize the mutual information between these biologically correlated views. For each protein $\mathcal { G }$ , we sample two views $\mathcal { G } _ { x }$ and $\mathcal { G } _ { y }$ by first randomly choosing one sampling scheme for extracting substructures and then randomly selecting one of the two noise functions with equal probability. We compute the graph representations $h _ { x }$ and $h _ { y }$ of two views using our structurebased encoder. Then, a two-layer MLP projection head is applied to map the representations to a lower-dimensional space, denoted as $z _ { x }$ and $z _ { y }$ . Finally, an InfoNCE loss function is defined by distinguishing views from the same or different proteins using their similarities (Oord et al., 2018). For a positive pair $x$ and $y$ , we treat views from other proteins in the same mini-batch as negative pairs. Mathematically, the loss function for a positive pair of views $x$ and $y$ can be written as:
+
+$$
+\mathcal { L } _ { x , y } = - \log \frac { \exp ( \sin ( z _ { x } , z _ { y } ) / \tau ) } { \sum _ { k = 1 } ^ { 2 B } \mathbb { 1 } _ { [ k \neq x ] } \exp ( \sin ( z _ { y } , z _ { k } ) / \tau ) } ,
+$$
+
+where $B , \tau$ denotes the batch size and temperature, $\mathbb { 1 } _ { [ k \neq x ] } \in \{ 0 , 1 \}$ is an indicator function that is equal to 1 iff $k \neq x$ . The function $\sin ( { \boldsymbol { \mathbf { \mathit { u } } } } , { \boldsymbol { \mathbf { \mathit { v } } } } )$ is defined by the cosine similarity between $\textbf { \em u }$ and $\textbf { { v } }$ .
+
+Sizes of sampled substructures. The design of our random sampling scheme aims to extract biologically meaningful substructures for contrastive learning. To attain this goal, it is of critical importance to determine the sampling length $r - l$ for subsequence cropping and radius $d$ for subspace cropping. On the one hand, we need sufficiently long subsequences and large subspaces to ensure that the sampled substructures can meaningfully reflect the whole protein structure and thus share high mutual information with each other. On the other hand, if the sampled substructures are too large, the generated views will be so similar that the contrastive learning problem becomes trivial. Furthermore, large substructures limit the batch size used in contrastive learning, which has been shown to be harmful for the performance (Chen et al., 2020).
+
+To study the effect of sizes of sampled substructures, we show experimental results on Enzyme Commission (abbr. EC, details in Sec. 5.1) using Multiview Contrast with the subsequence and substructure cropping function, respectively. To prevent the influence of noise functions, we only consider identity transformation in both settings. The results are plotted in Figure 2. For both subsequence and subspace cropping, as the sampled substructures become larger, the results first rise and then drop from a certain threshold. This phenomenon agrees with our analysis above. In practice, we set 50 residues as the length for subsequence and 15 as the radius for subspace cropping, which are large enough to capture most structural motifs according to statistics in previous studies (Tateno et al., 1997).
+
+In Appendix J, we visualize the representations of the pretrained model with this method and assign familial labels based on domain annotations. We can observe clear separation based on the familial classification of the proteins in the dataset, which proves the effectiveness of our pretraining method.
+
+
+Figure 2: $\mathrm { F } _ { \mathrm { m a x } }$ on EC v.s. cropping sequence length (# residues) for Subsequence Cropping and spatial cutoff $( \mathring \mathrm { A } )$ for Subspace Cropping.
+
+4.2 STRAIGHTFORWARD BASELINES: SELF-PREDICTION METHODS
+
+Another line of model pre-training research is based on the recent progress of self-prediction methods in natural language processing (Devlin et al., 2018; Brown et al., 2020). Along that line, given a protein, our objective can be formulated as predicting one part of the protein given the remainder of the structure. Here, we propose four self-supervised tasks based on physicochemical or geometric properties: residue types, distances, angles and dihedrals.
+
+The four methods perform masked prediction on single residues, residue pairs, triplets and quadruples, respectively. Masked residue type prediction is widely used for pretraining protein language models (Bepler & Berger, 2021) and also known as masked inverse folding in the protein community (Yang et al., 2022). Distances, angles and dihedrals have been shown to be important features that reflect the relative position between residues (Klicpera et al., 2020). For angle and dihedral prediction, we sample adjacent edges to better capture local structual information. Since angular values are more sensitive to errors in protein structures than distances, we use discretized values for prediction. The four objectives are summarized in Table 1 and details will be discussed in Appendix. D.
+
+
Method
Loss function
Sampled items
Residue Type Prediction
Li=CE(fresidue(h'),fi)
Single residue
Distance Prediction
L(i,jr)=(fist(h)-|i-xi)²
Single edge
AnglePrediction
L(i,j,T1),G,kr)=CE(fage(h',h',h),i(∠j))
Adjacent edge pairs
Dihedral Prediction
L(i,j,r1),(j,kr),(kt,r)=CE(f(h,h',n,h),bin(∠ij))
Adjacent edge triplets
+
+Table 1: Self-prediction methods. We use $f _ { \mathrm { r e s i d u e } } ( \cdot ) , f _ { \mathrm { d i s t } } ( \cdot ) , f _ { \mathrm { a n g l e } } ( \cdot ) , f _ { \mathrm { d i h } } ( \cdot )$ to denote the MLP head in each task. $\operatorname { C E } ( { \mathrm { \cdot } } )$ denotes the cross entropy loss and $\mathrm { b i n } ( \cdot )$ is used to discretize the angle. $f _ { i }$ and $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ denote the residue type feature and coordinate of node $i$ , respectively. $ { \boldsymbol { h } } _ { i } ^ { \prime }$ denotes the representation of node $i$ after masking the corresponding sampled items in each task.
+
+# 5 EXPERIMENTS
+
+In this section, we first introduce our experimental setup for pretraining and then evaluate our models on four standard downstream tasks including Enzyme Commission number prediction, Gene Ontology term prediction, fold and reaction classification. More analysis can be found in Appendix F-K.
+
+# 5.1 EXPERIMENTAL SETUP
+
+Pretraining datasets. We use the AlphaFold protein structure database (CC-BY 4.0 License) (Varadi et al., 2021) for pretraining. This database contains protein structures predicted by AlphaFold2, and we employ both 365K proteome-wide predictions and 440K Swiss-Prot (Consortium, 2021) predictions. In Appendix F, we further report the results of pretraining on different datasets.
+
+Downstream tasks. We adopt two tasks proposed in Gligorijevic et al. (2021) and two tasks used ´ in Hermosilla et al. (2021) for downstream evaluation. Enzyme Commission (EC) number prediction seeks to predict the EC numbers of different proteins, which describe their catalysis of biochemical reactions. The EC numbers are selected from the third and fourth levels of the EC tree (Webb et al., 1992), forming 538 binary classification tasks. Gene Ontology (GO) term prediction aims to predict whether a protein belongs to some GO terms. These terms classify proteins into hierarchically related functional classes organized into three ontologies: molecular function (MF), biological process (BP) and cellular component (CC). Fold classification is first proposed in Hou et al. (2018), with the goal to predict the fold class label given a protein. Reaction classification aims to predict the enzyme-catalyzed reaction class of a protein, in which all four levels of the EC number are employed to depict the reaction class. Although this task is essentially the same with EC prediction, we include it to make a fair comparison with the baselines in Hermosilla et al. (2021).
+
+Dataset splits. For EC and GO prediction, we follow the multi-cutoff split methods in Gligorijevic´ et al. (2021) to ensure that the test set only contains PDB chains with sequence identity no more than $9 5 \%$ to the training set as used in Wang et al. (2022b) (See Appendix. F for results at lower identity cutoffs). For fold classification, Hou et al. (2018) provides three different test sets: Fold, in which proteins from the same superfamily are unseen during training; Superfamily, in which proteins from the same family are not present during training; and Family, in which proteins from the same family are present during training. For reaction classification, we adopt dataset splits proposed in Hermosilla et al. (2021), where proteins have less than $50 \%$ sequence similarity in-between splits.
+
+Baselines. Following Wang et al. (2022b) and Hermosilla et al. (2021), we compare our encoders with many existing protein representation learning methods, including four sequence-based encoders (CNN (Shanehsazzadeh et al., 2020), ResNet (Rao et al., 2019), LSTM (Rao et al., 2019) and Transformer (Rao et al., 2019)), six structure-based encoders (GCN (Kipf & Welling, 2017), GAT (Velickovi ˇ c et al., 2018), GVP (Jing et al., 2021), 3DCNN_MQA (Derevyanko et al., 2018), ´ GraphQA (Baldassarre et al., 2021) and New IEConv (Hermosilla & Ropinski, 2022)). We also include two models pretrained on large-scale sequence datasets (ProtBERT-BFD (Elnaggar et al.,
+
+Table 2: $\mathrm { F } _ { \mathrm { m a x } }$ on EC and GO prediction and Accuracy $( \% )$ on fold and reaction classification. [†] denotes results taken from Wang et al. (2022b) and $[ { ^ { * } } ]$ denotes results taken from Hermosilla et al. (2021) and Hermosilla & Ropinski (2022). Bold numbers indicate the best results under w/o pretraining and w/ pretraining settings. For pretraining, we select the model with the best performance when training from scratch, i.e., GearNet-Edge for EC, GO, Reaction and GearNet-Edge-IEConv for Fold Classification. We use the pretraining methods to name our pretrained models.
+
+
Method
Pretraining Dataset (Size)
EC
GO
Fold Classification
Reaction
BP
MF
CC
Fold
Super.
Fam.
Avg.
ResNet (Rao et al.,2019)
CNN (Shanehsazzadeh et al., 2020)
0.545
0.244
0.354
0.287
11.3
13.4 7.21
53.4
26.0
51.7 24.1
LSTM (Rao et al.,2019)
0.605
0.280 0.225
0.405 0.321
0.304 0.283
10.1 6.41
4.33
23.5
13.6 9.61
11.0
0.425
18.1
26.6
Transformer (Rao et al.,2019)
0.238
0.264
0.211
0.405
9.22
8.81
40.4
19.4
GCN (Kipf &Welling,2017)
0.320
0.252
0.195
0.329
16.8*
21.3*
82.8*
40.3*
67.3*
GAT (Velickovic et al.,2018)
0.368
0.284
0.317†
0.385
12.4
16.5
72.7
33.8
55.6
GVP (Jing et al.,2021)
0.489
0.326
0.426
0.420+
16.0
22.5
83.8
40.7
65.5
3DCNN_MQA (Derevyanko et al.,2018)
0.077
0.240
0.147
0.305
31.6*
45.4*
92.5*
56.5*
72.2*
GraphQA (Baldassarre et al.,2021) New IEConv (Hermosilla & Ropinski,2022)
0.509
0.308
0.329
0.413
23.7*
32.5*
84.4*
46.9*
60.8*
0.735
0.374
0.544
0.444
47.6*
70.2*
99.2*
72.3*
87.2*
GearNet
0.730
0.356
0.503
0.414
28.4
42.6
95.3
55.4
79.4
GearNet-IEConv
0.800
0.381
0.563
0.422
42.3
64.1
99.1
68.5
83.7
GearNet-Edge GearNet-Edge-IEConv
0.810
0.403
0.580
0.450
44.0
66.7
99.1
69.9
86.6
DeepFRI (Gligorijevic et al.,2021)
0.810
0.400
0.581
0.430
48.3
70.3
99.5
72.7
85.3
Pfam (10M)
0.631
0.399
0.465
0.460
15.3*
20.6*
73.2*
36.4*
63.3*
ESM-1b (Rives etal.,2021) ProtBERT-BFD (Elnaggar et al.,2021)
UniRef50 (24M)
0.864
0.452
0.657
0.477
26.8
60.1
97.8
61.5
83.1
BFD (2.1B)
0.838
0.279†
0.456
0.408†
26.6*
55.8*
97.6*
60.0*
72.2*
LM-GVP (Wang et al.,2022b) New IEConv (Hermosilla & Ropinski,2022)
UniRef100 (216M)
0.664
0.417+
0.545
0.527
=
=
=
PDB (476K)
-
=
-
=
50.3*
80.6*
99.7*
76.9*
87.6*
Residue Type Prediction
AlphaFoldDB (805K)
0.843
0.430
0.604
0.465
48.8
71.0
99.4
73.0
86.6
Distance Prediction
AlphaFoldDB (805K)
0.839
0.448
0.616
0.464
50.9
73.5
99.4
74.6
87.5
Angle Prediction
AlphaFoldDB (805K)
0.853
0.458
0.625
0.473
56.5
76.3
99.6
77.4
86.8
Dihedral Prediction
AlphaFoldDB (805K)
0.859
0.458
0.626
0.465
51.8
77.8
99.6
75.9
87.0
Multiview Contrast
AlphaFoldDB (805K)
0.874
0.490
0.654
0.488
54.1
80.5
99.9
78.1
87.5
+
+2021), ESM-1b (Rives et al., 2021)) and two models combining pretrained sequence-based encoders with structural information (DeepFRI (Gligorijevic et al., 2021) and LM-GVP (Wang et al., 2022b)). ´ For LM-GVP and New IEConv, we only include results reported in the original paper due to the computational burden and the lack of codes. We do not include MSA-based baselines, since these evolution-based methods require a lot of resources for the computation and storage of MSAs but have been shown to be inferior to ESM-1b on function prediction tasks in Hu et al. (2022).
+
+Training. On the four downstream tasks, we train GearNet and GearNet-Edge from scratch. As we find that the IEConv layer is important for predicting fold labels, we also enhance our model by incorporating this as an additional layer (see Appendix C.2). These models are referred as GearNetIEConv and GearNet-Edge-IEConv, respectively. Following Wang et al. (2022b) and Hermosilla & Ropinski (2022), the models are trained for 200 epochs on EC and GO prediction and for 300 epochs on fold and reaction classification. For pretraining, the models with the best performance when trained from scratch are selected, i.e., GearNet-Edge for EC, GO, Reaction and GearNet-Edge-IEConv for Fold Classification. The models are pretrained on the AlphaFold database with our proposed five methods for 50 epochs. All these models are trained on 4 Tesla A100 GPUs (see Appendix E.3).
+
+Evaluation. For EC and GO prediction, we evaluate the performance with the protein-centric maximum F-score $\mathrm { F } _ { \mathrm { m a x } }$ , which is commonly used in the CAFA challenges (Radivojac et al., 2013) (See Appendix E.2 for details). For fold and reaction classification, the performance is measured with the mean accuracy. Models with the best performance on validation sets are selected for evaluation.
+
+# 5.2 RESULTS
+
+We report results for four downstream tasks in Table 2, including all models with and without pretraining. The following conclusions can be drawn from the results:
+
+Our structure-based encoders outperform all baselines without pretraining on 7 of 8 datasets. By comparing the first three blocks, we find that GearNet can obtain competitive results against other baselines on three function prediction tasks (EC, GO, Reaction). After adding the edge message passing mechanism, GearNet-Edge significantly outperforms other baselines on EC, GO-BP and GO-MF and is competitive on GO-CC. Although no clear improvements are observed on function prediction (EC, GO, Reaction) by adding IEConv layers, GearNet-Edge-IEConv achieve the best results on fold classification. This can be understood since fold classification requires the encoder to capture sufficient structural information for determining the fold labels. Compared with GearNet
+
+Edge, which only includes the distance and angle information as features, the IEConv layer is better at capturing structural details by applying different kernel matrices dependent on relative positional features. These strong performance demonstrates the advantages of our structure-based encoders.
+
+Structure-based encoders benefit a lot from pretraining with unlabeled structures. Comparing the results in the third and last two blocks, it can be observed that models with all proposed pretraining methods show large improvements over models trained from scratch. Among these methods, Multiview Contrast is the best on 7 of 8 datasets and achieve the state-of-the-art results on EC, GO-BP, GO-MF, Fold and Reaction tasks. This proves the effectiveness of our pretraining strategies.
+
+Pretrained structure-based encoders perform on par with or even better than sequence-based encoders pretrained with much more data. The last three blocks show the comparision between pretrained sequence-based and structure-based models. It should be noted that our models are pretrained on a dataset with fewer than one million structures, whereas all sequence-based pretraining baselines are pretrained on million- or billion-scale sequence databases. Though pretrained with an order of magnitude less data, our model can achieve comparable or even better results against these sequence-based models. Besides, our model is the only one that can achieve good performance on all four tasks, given that sequence-based models do not perform well on fold classification. This again shows the potential of structure-based pretraining for learning protein representations.
+
+# 5.3 ABLATION STUDIES
+
+
Method
#layers
#params.
EC
Method
EC
GO-BP
GO-MF
GO-CC
GearNet-Edge
6
42M
0.810
Multiview Contrast
0.874
0.490
0.654
0.488
- w/o rel. conv.
6
23M
0.752
- subsequence + identity
0.866
0.477
0.627
0.473
- w/o rel. conv.
8
39M
0.754
- subspace+ identity
0.872 0.869
0.480
0.640
0.468
- w/o rel. conv.
10
60M
0.744
- subsequence + random edge masking - subspace + random edge masking
0.876
0.484 0.481
0.641 0.645
0.471 0.470
+
+Table 3: Ablation studies of GearNet-Edge and Multiview Contrast. Rel. conv. is the abbreviation for relational graph convolution. The numbers of layers and parameters in GearNet-Edge are reported.
+
+To analyze the contribution of different components in our proposed methods, we perform ablation studies on function prediction task. The results are shown in Table 3.
+
+Relational graph convolutional layers. To show the effects of relational convolutional layers, we replace it with graph convolutional layers that share a single kernel matrix among all edges. To make the number of learnable parameters comparable, we run the baselines with different number of layers. As reported in the table, results can be significantly improved by using relational convolution, which suggests the importance of treating edges as different types.
+
+Edge message passing layers. We also compare the results of GearNet with and without edge message passing layers, the results of which are shown in Table 2. It can be observed that the performance consistently increases after performing edge message passing. This demonstrates the effectiveness of our proposed mechanism.
+
+Different augmentations in Multiview Contrast. We investigate the contribution of each augmentation operation proposed in the Multiview Contrast method. Instead of randomly sampling cropping and noise functions, we pretrain our model with four deterministic combinations of augmentations, respectively. As shown in Table 3, all the four combinations can yield good results, which suggests that arbitrary combinations of the proposed cropping and noise schemes can yield informative partial views of proteins. Besides, by randomly choosing cropping and noise functions, we can generate more diverse views and thus benefit contrastive learning, as demonstrated in the table.
+
+# 6 CONCLUSIONS AND FUTURE WORK
+
+In this work, we propose a simple yet effective structure-based encoder for protein representation learning, which performs relational message passing on protein residue graphs. A novel edge message passing mechanism is introduced to explicitly model interactions between edges, which show consistent improvements. Moreover, five self-supervised pretraining methods are proposed following two standard frameworks: contrastive learning and self-prediction methods. Comprehensive experiments over multiple benchmark tasks verify that our model outperforms previous encoders when trained from scratch and achieve comparable or even better results than the state-of-the-art baselines while pretraining with much less data. We believe that our work is an important step towards adopting self-supervised learning methods on protein structure understanding.
+
+# ACKNOWLEDGMENTS
+
+The authors would like to thank Meng Qu, Zhaocheng Zhu, Shengchao Liu, Chence Shi, Minkai Xu and Huiyu Cai for their helpful discussions and comments.
+
+This project is supported by AIHN IBM-MILA partnership program, the Natural Sciences and Engineering Research Council (NSERC) Discovery Grant, the Canada CIFAR AI Chair Program, collaboration grants between Microsoft Research and Mila, Samsung Electronics Co., Ltd., Amazon Faculty Research Award, Tencent AI Lab Rhino-Bird Gift Fund, a NRC Collaborative R&D Project (AI4D-CORE-06) as well as the IVADO Fundamental Research Project grant PRF-2019-3583139727.
+
+# REFERENCES
+
+Mehmet Akdel, Douglas EV Pires, Eduard Porta Pardo, Jürgen Jänes, Arthur O Zalevsky, Bálint Mészáros, Patrick Bryant, Lydia L Good, Roman A Laskowski, Gabriele Pozzati, et al. A structural biology community assessment of alphafold 2 applications. bioRxiv, 2021.
+
+Ethan C Alley, Grigory Khimulya, Surojit Biswas, Mohammed AlQuraishi, and George M Church. Unified rational protein engineering with sequence-based deep representation learning. Nature methods, 16(12):1315–1322, 2019.
+
+Stephen F. Altschul, Thomas L. Madden, Alejandro A. Schäffer, J Zhang, Z Zhang, Webb Miller, and David J. Lipman. Gapped blast and psi-blast: a new generation of protein database search programs. Nucleic acids research, 25 17:3389–402, 1997.
+
+Sarp Aykent and Tian Xia. Gbpnet: Universal geometric representation learning on protein structures. Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, 2022.
+
+Minkyung Baek, Frank DiMaio, Ivan Anishchenko, Justas Dauparas, Sergey Ovchinnikov, Gyu Rie Lee, Jue Wang, Qian Cong, Lisa N Kinch, R Dustin Schaeffer, et al. Accurate prediction of protein structures and interactions using a three-track neural network. Science, 373(6557):871–876, 2021.
+
+Federico Baldassarre, David Menéndez Hurtado, Arne Elofsson, and Hossein Azizpour. Graphqa: protein model quality assessment using graph convolutional networks. Bioinformatics, 37(3): 360–366, 2021.
+
+Albert P Bartók, Mike C Payne, Risi Kondor, and Gábor Csányi. Gaussian approximation potentials: The accuracy of quantum mechanics, without the electrons. Physical review letters, 104(13): 136403, 2010.
+
+Albert P Bartók, Risi Kondor, and Gábor Csányi. On representing chemical environments. Physical Review B, 87(18):184115, 2013.
+
+Jörg Behler and Michele Parrinello. Generalized neural-network representation of high-dimensional potential-energy surfaces. Physical review letters, 98(14):146401, 2007.
+
+Tristan Bepler and Bonnie Berger. Learning protein sequence embeddings using information from structure. arXiv preprint arXiv:1902.08661, 2019.
+
+Tristan Bepler and Bonnie Berger. Learning the protein language: Evolution, structure, and function. Cell Systems, 12(6):654–669, 2021.
+
+Helen M Berman, John Westbrook, Zukang Feng, Gary Gilliland, Talapady N Bhat, Helge Weissig, Ilya N Shindyalov, and Philip E Bourne. The protein data bank. Nucleic acids research, 28(1): 235–242, 2000.
+
+Surojit Biswas, Grigory Khimulya, Ethan C Alley, Kevin M Esvelt, and George M Church. Low-n protein engineering with data-efficient deep learning. Nature Methods, 18(4):389–396, 2021.
+
+Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
+
+Yue Cao, Payel Das, Vijil Chenthamarakshan, Pin-Yu Chen, Igor Melnyk, and Yang Shen. Fold2seq: A joint sequence(1d)-fold(3d) embedding-based generative model for protein design. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 1261–1271. PMLR, 18–24 Jul 2021. URL https://proceedings.mlr.press/v139/cao21a.html.
+
+Can Chen, Jingbo Zhou, Fan Wang, Xue Liu, and Dejing Dou. Structure-aware protein self-supervised learning. arXiv preprint arXiv:2204.04213, 2022.
+
+Chi Chen, Weike Ye, Yunxing Zuo, Chen Zheng, and Shyue Ping Ong. Graph networks as a universal machine learning framework for molecules and crystals. Chemistry of Materials, 31(9):3564–3572, 2019.
+
+Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pp. 1597–1607. PMLR, 2020.
+
+Stefan Chmiela, Alexandre Tkatchenko, Huziel E Sauceda, Igor Poltavsky, Kristof T Schütt, and Klaus-Robert Müller. Machine learning of accurate energy-conserving molecular force fields. Science advances, 3(5):e1603015, 2017.
+
+The UniProt Consortium. Uniprot: the universal protein knowledgebase in 2021. Nucleic Acids Research, 49(D1):D480–D489, 2021.
+
+Bowen Dai and Chris Bailey-Kellogg. Protein interaction interface region prediction by geometric deep learning. Bioinformatics, 2021.
+
+Georgy Derevyanko, Sergei Grudinin, Yoshua Bengio, and Guillaume Lamoureux. Deep convolutional networks for quality assessment of protein folds. Bioinformatics, 34(23):4046–4053, 2018.
+
+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.
+
+Ahmed Elnaggar, Michael Heinzinger, Christian Dallago, Ghalia Rehawi, Wang Yu, Llion Jones, Tom Gibbs, Tamas Feher, Christoph Angerer, Martin Steinegger, Debsindhu Bhowmik, and Burkhard Rost. Prottrans: Towards cracking the language of lifes code through self-supervised deep learning and high performance computing. IEEE Transactions on Pattern Analysis and Machine Intelligence, pp. 1–1, 2021. doi: 10.1109/TPAMI.2021.3095381.
+
+Pablo Gainza, Freyr Sverrisson, Frederico Monti, Emanuele Rodola, D Boscaini, MM Bronstein, and BE Correia. Deciphering interaction fingerprints from protein molecular surfaces using geometric deep learning. Nature Methods, 17(2):184–192, 2020.
+
+Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In International conference on machine learning, pp. 1263–1272. PMLR, 2017.
+
+Vladimir Gligorijevic, P Douglas Renfrew, Tomasz Kosciolek, Julia Koehler Leman, Daniel Beren- ´ berg, Tommi Vatanen, Chris Chandler, Bryn C Taylor, Ian M Fisk, Hera Vlamakis, et al. Structurebased protein function prediction using graph convolutional networks. Nature communications, 12 (1):1–14, 2021.
+
+Yuzhi Guo, Jiaxiang Wu, Hehuan Ma, and Junzhou Huang. Self-supervised pre-training for protein embeddings using tertiary structures. In AAAI, 2022.
+
+William L Hamilton, Rex Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pp. 1025–1035, 2017.
+
+Frank Harary and Robert Z Norman. Some properties of line digraphs. Rendiconti del circolo matematico di palermo, 9(2):161–168, 1960.
+
+Kaveh Hassani and Amir Hosein Khasahmadi. Contrastive multi-view representation learning on graphs. In International Conference on Machine Learning, pp. 4116–4126. PMLR, 2020.
+
+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, pp. 9729–9738, 2020.
+
+Liang He, Shizhuo Zhang, Lijun Wu, Huanhuan Xia, Fusong Ju, He Zhang, Siyuan Liu, Yingce Xia, Jianwei Zhu, Pan Deng, et al. Pre-training co-evolutionary protein representation via a pairwise masked language model. arXiv preprint arXiv:2110.15527, 2021.
+
+Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
+
+Pedro Hermosilla and Timo Ropinski. Contrastive representation learning for 3d protein structures. In Submitted to The Tenth International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ VINWzIM6_6.
+
+Pedro Hermosilla, Marco Schäfer, Matej Lang, Gloria Fackelmann, Pere Pau Vázquez, Barbora ˇ Kozlíková, Michael Krone, Tobias Ritschel, and Timo Ropinski. Intrinsic-extrinsic convolution and pooling for learning on 3d protein structures. International Conference on Learning Representations, 2021.
+
+Liisa Holm. Benchmarking fold detection by dalilite v.5. Bioinformatics, 2019.
+
+Jie Hou, Badri Adhikari, and Jianlin Cheng. Deepsf: deep convolutional neural network for mapping protein sequences to folds. Bioinformatics, 34(8):1295–1303, 2018.
+
+Min Hu, Fajie Yuan, Kevin Kaichuang Yang, Fusong Ju, Jingyu Su, Hongya Wang, Fei Yang, and Qiuyang Ding. Exploring evolution-based & -free protein language models as protein function predictors. ArXiv, abs/2206.06583, 2022.
+
+Weihua Hu, Bowen Liu, Joseph Gomes, Marinka Zitnik, Percy Liang, Vijay Pande, and Jure Leskovec. Strategies for pre-training graph neural networks. arXiv preprint arXiv:1905.12265, 2019.
+
+John Ingraham, Vikas Garg, Regina Barzilay, and Tommi Jaakkola. Generative models for graphbased protein design. Advances in Neural Information Processing Systems, 32:15820–15831, 2019.
+
+Bowen Jing, Stephan Eismann, Pratham N. Soni, and Ron O. Dror. Learning from protein structure with geometric vector perceptrons. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id ${ . } = { }$ 1YLJDvSx6J4.
+
+Peter Bjørn Jørgensen, Karsten Wedel Jacobsen, and Mikkel N Schmidt. Neural message passing with edge updates for predicting properties of molecules and materials. arXiv preprint arXiv:1806.03146, 2018.
+
+John Jumper, Richard Evans, Alexander Pritzel, Tim Green, Michael Figurnov, Olaf Ronneberger, Kathryn Tunyasuvunakool, Russ Bates, Augustin Žídek, Anna Potapenko, et al. Highly accurate protein structure prediction with alphafold. Nature, 596(7873):583–589, 2021.
+
+Thomas N Kipf and Max Welling. Variational graph auto-encoders. arXiv preprint arXiv:1611.07308, 2016.
+
+Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations, 2017.
+
+Johannes Klicpera, Janek Groß, and Stephan Günnemann. Directional message passing for molecular graphs. In International Conference on Learning Representations (ICLR), 2020.
+
+Johannes Klicpera, Florian Becker, and Stephan Günnemann. Gemnet: Universal directional graph neural networks for molecules. arXiv preprint arXiv:2106.08903, 2021.
+
+Yi Liu, Limei Wang, Meng Liu, Xuan Zhang, Bora Oztekin, and Shuiwang Ji. Spherical message passing for 3d graph networks. arXiv preprint arXiv:2102.05013, 2021.
+
+Amy X Lu, Haoran Zhang, Marzyeh Ghassemi, and Alan M Moses. Self-supervised contrastive learning of protein representations by mutual information maximization. BioRxiv, 2020.
+
+Bin Ma. Novor: real-time peptide de novo sequencing software. Journal of the American Society for Mass Spectrometry, 26(11):1885–1894, 2015.
+
+Bin Ma and Richard Johnson. De novo sequencing and homology searching. Molecular & cellular proteomics, 11(2), 2012.
+
+Craig O. Mackenzie and Gevorg Grigoryan. Protein structural motifs in prediction and design. Current opinion in structural biology, 44:161–167, 2017.
+
+Leland McInnes, John Healy, and James Melville. Umap: Uniform manifold approximation and projection for dimension reduction. arXiv preprint arXiv:1802.03426, 2018.
+
+Joshua Meier, Roshan Rao, Robert Verkuil, Jason Liu, Tom Sercu, and Alexander Rives. Language models enable zero-shot prediction of the effects of mutations on protein function. bioRxiv, 2021.
+
+Jaina Mistry, Sara Chuguransky, Lowri Williams, Matloob Qureshi, Gustavo A Salazar, Erik LL Sonnhammer, Silvio CE Tosatto, Lisanna Paladin, Shriya Raj, Lorna J Richardson, et al. Pfam: The protein families database in 2021. Nucleic Acids Research, 49(D1):D412–D419, 2021.
+
+Bhaskar Mitra and Nick Craswell. Neural models for information retrieval. ArXiv, abs/1705.01509, 2017.
+
+Alex Morehead, Chen Chen, and Jianlin Cheng. Geometric transformers for protein interface contact prediction. In International Conference on Learning Representation, 2022.
+
+Alexey G Murzin, Steven E Brenner, Tim Hubbard, and Cyrus Chothia. Scop: a structural classification of proteins database for the investigation of sequences and structures. Journal of molecular biology, 247(4):536–540, 1995.
+
+Pascal Notin, Mafalda Dias, Jonathan Frazer, Javier Marchena-Hurtado, Aidan N. Gomez, Debora S. Marks, and Yarin Gal. Tranception: protein fitness prediction with autoregressive transformers and inference-time retrieval. In ICML, 2022.
+
+Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
+
+Chris Paul Ponting and Robert R Russell. The natural history of protein domains. Annual review of biophysics and biomolecular structure, 31:45–71, 2002.
+
+Jiezhong Qiu, Qibin Chen, Yuxiao Dong, Jing Zhang, Hongxia Yang, Ming Ding, Kuansan Wang, and Jie Tang. Gcc: Graph contrastive coding for graph neural network pre-training. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 1150–1160, 2020.
+
+Predrag Radivojac, Wyatt T Clark, Tal Ronnen Oron, Alexandra M Schnoes, Tobias Wittkop, Artem Sokolov, Kiley Graim, Christopher Funk, Karin Verspoor, Asa Ben-Hur, et al. A large-scale evaluation of computational protein function prediction. Nature methods, 10(3):221–227, 2013.
+
+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.
+
+Roshan Rao, Jason Liu, Robert Verkuil, Joshua Meier, John F Canny, Pieter Abbeel, Tom Sercu, and Alexander Rives. Msa transformer. bioRxiv, 2021.
+
+Alexander Rives, Joshua Meier, Tom Sercu, Siddharth Goyal, Zeming Lin, Jason Liu, Demi Guo, Myle Ott, C Lawrence Zitnick, Jerry Ma, et al. Biological structure and function emerge from scaling unsupervised learning to 250 million protein sequences. Proceedings of the National Academy of Sciences, 118(15), 2021.
+
+Yu Rong, Yatao Bian, Tingyang Xu, Weiyang Xie, Ying Wei, Wenbing Huang, and Junzhou Huang. Self-supervised graph transformer on large-scale molecular data. arXiv preprint arXiv:2007.02835, 2020.
+
+Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International journal of computer vision, 115(3):211–252, 2015.
+
+Victor Garcia Satorras, Emiel Hoogeboom, and Max Welling. E (n) equivariant graph neural networks. arXiv preprint arXiv:2102.09844, 2021.
+
+Michael Schlichtkrull, Thomas N Kipf, Peter Bloem, Rianne Van Den Berg, Ivan Titov, and Max Welling. Modeling relational data with graph convolutional networks. In European semantic web conference, pp. 593–607. Springer, 2018.
+
+Kristof T Schütt, Farhad Arbabzadah, Stefan Chmiela, Klaus R Müller, and Alexandre Tkatchenko. Quantum-chemical insights from deep tensor neural networks. Nature communications, 8(1):1–8, 2017a.
+
+Kristof T Schütt, Pieter-Jan Kindermans, Huziel E Sauceda, Stefan Chmiela, Alexandre Tkatchenko, and Klaus-Robert Müller. Schnet: A continuous-filter convolutional neural network for modeling quantum interactions. arXiv preprint arXiv:1706.08566, 2017b.
+
+Amir Shanehsazzadeh, David Belanger, and David Dohan. Is transfer learning necessary for protein landscape prediction? arXiv preprint arXiv:2011.03443, 2020.
+
+Ilya N. Shindyalov and Philip E. Bourne. Protein structure alignment by incremental combinatorial extension (ce) of the optimal path. Protein engineering, 11 9:739–47, 1998.
+
+Vignesh Ram Somnath, Charlotte Bunne, and Andreas Krause. Multi-scale representation learning on proteins. Advances in Neural Information Processing Systems, 34, 2021.
+
+Martin Steinegger and Johannes Söding. Mmseqs2 enables sensitive protein sequence searching for the analysis of massive data sets. Nature Biotechnology, 35:1026–1028, 2017.
+
+Martin Steinegger and Johannes Söding. Clustering huge protein sequence sets in linear time. Nature communications, 9(1):1–8, 2018.
+
+Martin Steinegger, Markus Meier, Milot Mirdita, Harald Voehringer, Stephan J. Haunsberger, and Johannes Soeding. Hh-suite3 for fast remote homology detection and deep protein annotation. BMC Bioinformatics, 20, 2019.
+
+Alexey Strokach, David Becerra, Carles Corbi-Verge, Albert Perez-Riba, and Philip M Kim. Fast and flexible protein design using deep graph neural networks. Cell Systems, 11(4):402–411, 2020.
+
+Haitian Sun, Tania Bedrax-Weiss, and William W. Cohen. Pullnet: Open domain question answering with iterative retrieval on knowledge bases and text. EMNLP, abs/1904.09537, 2019.
+
+Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. In International Conference on Machine Learning, pp. 3319–3328. PMLR, 2017.
+
+Baris E Suzek, Hongzhan Huang, Peter McGarvey, Raja Mazumder, and Cathy H Wu. Uniref: comprehensive and non-redundant uniprot reference clusters. Bioinformatics, 23(10):1282–1288, 2007.
+
+Freyr Sverrisson, Jean Feydy, Bruno E Correia, and Michael M Bronstein. Fast end-to-end learning on protein surfaces. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15272–15281, 2021.
+
+Y Tateno, K Ikeo, T Imanishi, H Watanabe, T Endo, Y Yamaguchi, Y Suzuki, K Takahashi, K Tsunoyama, M Kawai, et al. Evolutionary motif and its biological and structural significance. Journal of molecular evolution, 44(1):S38–S43, 1997.
+
+Michel van Kempen, Stephanie Kim, Charlotte Tumescheit, Milot Mirdita, Johannes Soeding, and Martin Steinegger. Foldseek: fast and accurate protein structure search. bioRxiv, 2022.
+
+Mihaly Varadi, Stephen Anyango, Mandar Deshpande, Sreenath Nair, Cindy Natassia, Galabina Yordanova, David Yuan, Oana Stroe, Gemma Wood, Agata Laydon, et al. Alphafold protein structure database: massively expanding the structural coverage of protein-sequence space with high-accuracy models. Nucleic acids research, 2021.
+
+Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
+
+Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua ´ Bengio. Graph Attention Networks. International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $=$ rJXMpikCZ. accepted as poster.
+
+Limei Wang, Haoran Liu, Yi Liu, Jerry Kurtin, and Shuiwang Ji. Learning protein representations via complete 3d graph networks. ArXiv, abs/2207.12600, 2022a.
+
+Yanbin Wang, Zhu-Hong You, Shan Yang, Xiao Li, Tong-Hai Jiang, and Xi Zhou. A high efficient biological language model for predicting protein–protein interactions. Cells, 8(2):122, 2019.
+
+Zichen Wang, Steven A Combs, Ryan Brand, Miguel Romero Calvo, Panpan Xu, George Price, Nataliya Golovach, Emmanuel O Salawu, Colby J Wise, Sri Priya Ponnapalli, et al. Lm-gvp: an extensible sequence and structure informed deep learning framework for protein property prediction. Scientific reports, 12(1):1–12, 2022b.
+
+Oren F Webb, Tommy J Phelps, Paul R Bienkowski, Philip M Digrazia, David C White, and Gary S Sayler. Enzyme nomenclature. 1992.
+
+Minghao Xu, Hang Wang, Bingbing Ni, Hongyu Guo, and Jian Tang. Self-supervised graph-level representation learning with local and global structure. arXiv preprint arXiv:2106.04113, 2021.
+
+Jinn-Moon Yang and Chi-Hua Tung. Protein structure database search and evolutionary classification. Nucleic Acids Research, 34:3646 – 3659, 2006.
+
+Kevin Kaichuang Yang, Niccol’o Zanichelli, and Hugh Yeh. Masked inverse folding with sequence transfer for protein representation learning. bioRxiv, 2022.
+
+Yuning You and Yang Shen. Cross-modality and self-supervised protein embedding for compound– protein affinity and contact prediction. Bioinformatics, 38(Supplement_2):ii68–ii74, 2022.
+
+Yuning You, Tianlong Chen, Yongduo Sui, Ting Chen, Zhangyang Wang, and Yang Shen. Graph contrastive learning with augmentations. Advances in Neural Information Processing Systems, 33: 5812–5823, 2020.
+
+Yang Zhang and Jeffrey Skolnick. Tm-align: a protein structure alignment algorithm based on the tm-score. Nucleic Acids Research, 33:2302 – 2309, 2005.
+
+Mengyao Zhao, Wan-Ping Lee, Erik P Garrison, and Gabor T. Marth. Ssw library: An simd smith-waterman $\mathrm { c / c } { + + }$ library for use in genomic applications. PLoS ONE, 8, 2013.
+
+Zhaocheng Zhu, Chence Shi, Zuobai Zhang, Shengchao Liu, Minghao Xu, Xinyu Yuan, Yangtian Zhang, Junkun Chen, Huiyu Cai, Jiarui Lu, et al. Torchdrug: A powerful and flexible machine learning platform for drug discovery. arXiv preprint arXiv:2202.08320, 2022.
+
+# A MORE RELATED WORK
+
+# A.1 SEQUENCE-BASED METHODS FOR PROTEIN REPRESENTATION LEARNING
+
+Sequence-based protein representation learning is mainly inspired by the methods of modeling natural language sequences. Recent methods aim to capture the biochemical and co-evolutionary knowledge underlying a large-scale protein sequence corpus by self-supervised pretraining, and such knowledge is then transferred to specific downstream tasks by finetuning. Typical pretraining objectives explored in existing methods include next amino acid prediction (Alley et al., 2019; Elnaggar et al., 2021), masked language modeling (MLM) (Rao et al., 2019; Elnaggar et al., 2021; Rives et al., 2021), pairwise MLM (He et al., 2021) and contrastive predictive coding (CPC) (Lu et al., 2020). Compared to sequence-based approaches that learn in the whole sequence space, MSA-based methods (Rao et al., 2021; Biswas et al., 2021; Meier et al., 2021) leverage the sequences within a protein family to capture the conserved and variable regions of homologous sequences, which imply specific structures and functions of the protein family.
+
+# A.2 STRUCTURE-BASED METHODS FOR BIOLOGICAL MOLECULES
+
+Following the early efforts (Behler & Parrinello, 2007; Bartók et al., 2010; 2013; Chmiela et al., 2017) of building machine learning systems for molecules by hand-crafted atomic features, recent works exploited end-to-end message passing neural networks (MPNNs) (Gilmer et al., 2017) to encode the structures of small molecules and macromolecules like proteins. Specifically, existing methods employed node/atom message passing (Gilmer et al., 2017; Schütt et al., 2017a;b), edge/bond message passing (Jørgensen et al., 2018; Chen et al., 2019) and directional information (Klicpera et al., 2020; Liu et al., 2021; Klicpera et al., 2021) to encode 2D or 3D molecular graphs.
+
+Compared to small molecules, structural representations of proteins are more diverse, including residue-level, atom-level graphs and protein surfaces. There are recent models designed for residuelevel graphs (Hermosilla et al., 2021; Hermosilla & Ropinski, 2022) and protein surfaces (Gainza et al., 2020; Sverrisson et al., 2021), which achieved impressive results on various tasks.
+
+# A.3 PRETRAINING GRAPH NEURAL NETWORKS
+
+Our work is also related to the recent efforts of pretraining graph neural networks (GNNs), which sought to learn graph representations in a self-supervised fashion. In this domain, various selfsupervised pretext tasks, like edge prediction (Kipf & Welling, 2016; Hamilton et al., 2017), context prediction (Hu et al., 2019; Rong et al., 2020), node/edge attribute reconstruction (Hu et al., 2019) and contrastive learning (Hassani & Khasahmadi, 2020; Qiu et al., 2020; You et al., 2020; Xu et al., 2021), are designed to acquire knowledge from unlabeled graphs. Besides, there is one recent work applying self-supervised learning for protein-ligand affinity prediction (You & Shen, 2022). In this work, we focus on learning representations of residue-level graphs of proteins in a self-supervised way. To attain this goal, we design novel protein-specific pretraining methods to learn the proposed structure-based encoder.
+
+# B POTENTIAL NEGATIVE IMPACT
+
+This research project focuses on learning effective protein representations via pretraining with a large number of unlabeled protein structures. Compared to the conventional sequence-based pretraining methods, our approach is able to leverage structural information and thus provide better representations. This merit enables more in-depth analysis of protein research and can potentially benefit many real-world applications, like protein function prediction and sequence design.
+
+Limitations. In this paper, we only use 805K protein structures for pretraining. As the AlphaFold Protein Structure Database now covers over 100 million proteins, it would be possible to train huge and more advanced structure-based models on larger datasets in the future. Scalability, however, should be kept in mind. Thanks to their simplicity, our models could readily accommodate larger datasets, while more cumbersome procedures might not. Besides, we only consider function and fold prediction tasks. Another promising direction is to apply our proposed methods on more tasks, e.g., protein-protein interaction modeling and protein-guided ligand molecule design, which underpins many important biological processes and applications.
+
+
+Figure 3: The pipeline for GearNet and GearNet-edge. First, we construct a relational protein residue graph with sequential, radius and knn edges (some edges are omitted in the figure to save space). Then, a relational graph convolutional layer is applied. Similar message passing layers can be applied on the edge graph to improve the model capacity. This figure shows the update iteration for node 4 and edge (4, 7, red), respectively.
+
+It cannot be denied that some harmful activities could be augmented by powerful pretrained models, e.g., designing harmful drugs. We expect future studies will mitigate these issues.
+
+# C MORE DETAILS OF GEARNET
+
+In this section, we describe more details about the implementation of our GearNet. The whole pipeline of our structure-based encoder is depicted in Figure 3.
+
+# C.1 PROTEIN GRAPH CONSTRUCTION
+
+For graph construction, we use three different ways to add edges:
+
+1. Sequential edges. The $i$ -th residue and the $j$ -th residue will be linked by an edge if the sequential distance between them is below a predefined threshold $d _ { \mathrm { s e q } }$ , i.e., $| j - i | < d _ { \mathrm { s e q } }$ The type of each sequential edge is determined by their relative position $d = j - i$ in the sequence. Hence, there are $2 d _ { \mathrm { s e q } } - 1$ types of sequential edges.
+2. Radius edges. Following previous works, we also add edges between two nodes $i$ and $j$ when the Euclidean distance between them is smaller than a threshold $d _ { \mathrm { r a d i u s } }$ .
+3. K-nearest neighbor edges. Since the scales of spatial coordinates may vary among different proteins, a node will be also connected to its $\mathbf { k }$ -nearest neighbors based on the Euclidean distance. In this way, the density of spatial edges are guaranteed to be comparable among different protein graphs.
+
+Since we are not interested in spatial edges between residues close with each other in the sequence, we further add a filter to the latter two kinds of edges. Specifically, for a radius or KNN edge connecting the $i$ -th residue and $j$ -th residue, it will be removed if the sequential distance between them is lower than a long range interaction cutoff $d _ { \mathrm { l o n g } }$ , i.e., $| i - j | < d _ { \mathrm { l o n g } }$ .
+
+In this paper, we set the sequential distance threshold $d _ { \mathrm { s e q } } = 3$ , the radius $d _ { \mathrm { r a d i u s } } = 1 0 . 0$ , the number of neighbors $k = 1 0$ and the long range interaction cutoff $d _ { \mathrm { l o n g } } = 5$ . By regarding radius edges and KNN edges as two separate edge types, there will be totally $2 \bar { d } _ { \mathrm { s e q } } + 1 = 7$ different types of edges.
+
+Necessity of spatial edges. Here we explain the necessity of radius and KNN edges by statistics and intuitions. These two kinds of edges result in very different degree distributions. In Figure 4, we plot the average degree distribution over all proteins in AlphaFold Database v1. If we only consider KNN edges, the node degrees in protein graphs are close to a constant, which makes it difficult to capture those areas with dense interactions between residues. If we only consider radius edges, then there will be about 45,000 proteins with average degrees lower than two. In these sparse graphs, pretraining cannot capture structural information effectively, e.g., Angle Prediction with limited edge pairs and Dihedral Prediction with limited edge triplets. Such sparsity can be hard to overcome by tuning radius cutoff, for the various scales of average distance on different proteins. By simply combining two kinds of edges, we can overcome these issues.
+
+
+Figure 4: The average degree distribution on AlphaFold Database.
+
+Node and edge features. Most previous structure-based encoders designed for biological molecules (Baldassarre et al., 2021; Hermosilla et al., 2021) used many chemical and spatial features, some of which are difficult to obtain or time-consuming to calculate. In contrast, we only use the one-hot encoding of residue types with one additional dimension for unknown types as node features, denoted as $\mathbf { \bar { f } } \in \{ 0 , 1 \} ^ { n \times 2 1 }$ , which is enough to learn good representation as shown in our experiments.
+
+The feature $\mathbf { \Delta } f _ { ( i , j , r ) }$ for an edge $( i , j , r )$ is the concatenation of the node features of two end nodes, the one-hot encoding of the edge type, and the sequential and spatial distances between them:
+
+$$
+\begin{array} { r } { \pmb { f } _ { ( i , j , r ) } = \mathrm { C a t } \left( \pmb { f } _ { i } , \pmb { f } _ { j } , \mathrm { o n e h o t } ( r ) , | i - j | , \| \pmb { x } _ { i } - \pmb { x } _ { j } \| _ { 2 } \right) , } \end{array}
+$$
+
+where $\mathrm { C a t } ( \cdot )$ denotes the concatenation operation.
+
+# C.2 ENHANCE GEARNET WITH IECONV LAYERS
+
+In our experiments, we find that IEConv layers are useful for predicting fold labels in spite of their relatively poor performance on function prediction tasks. Therefore, we enhance our models by adding a simplified IEConv layer as an additional layer, which achieve better results than the original IEConv. Next, we describe how to simplify the IEConv layer and how to combine it with our model.
+
+Simplify the IEConv layer. The original IEConv layer relies on intrinsic and extrinsic distances between two nodes, which are computationally expensive. Hence, we follow the modifications proposed in Hermosilla & Ropinski (2022), which show improvements as reported in their experiments. We briefly describe these modifications for completeness.
+
+In the IEConv layer, we keep the edges in our graph $\mathcal { G }$ and use $\tilde { h } _ { i } ^ { ( l ) }$ to denote the hidden representation for node $i$ in the $l$ -th layer. The update equation for node $i$ is defined as:
+
+$$
+\tilde { \begin{array} { r } { \tilde { \mathbf { h } } _ { i } ^ { ( l ) } = \sum _ { j \in \mathcal { N } ( i ) } k _ { o } ( f ( \mathcal { G } , i , j ) ) \cdot \mathbf { h } _ { j } ^ { ( l - 1 ) } , } \end{array} }
+$$
+
+where $\mathcal { N } ( i )$ is the set of neighbors of $i$ , $f ( \mathscr { G } , i , j )$ is the edge feature between $i$ and $j$ and $k _ { o } ( \cdot )$ is an MLP mapping the feature to a kernel matrix. Instead of intrinsic and extrinsic distances in the original IEConv layer, we follow New IEConv, which adopts three relative positional features proposed in Ingraham et al. (2019) and further augments them with additional input functions.
+
+We aim to apply this layer on our constructed protein residue graph instead of the radius graph in the original paper. Therefore, we simply remove the dynamically changed receptive fields, pooling layer and smoothing tricks in our setting.
+
+Combine IEConv with GearNet. Our model is very flexible to incorporate other message passing layers. To incorporate IEConv layers, we use our graph and hidden representations as input and replace the update equation Eq. (1) with
+
+$$
+\pmb { h } _ { i } ^ { ( l ) } = \pmb { h } _ { i } ^ { ( l - 1 ) } + \pmb { u } _ { i } ^ { ( l ) } + \tilde { \pmb { h } } _ { i } ^ { ( l ) } .
+$$
+
+# D SELF-PREDICTION METHODS
+
+The high-level ideas of the four self-prediction methods are demonstrated in Figure 5.
+
+Residue Type Prediction is based on the masked language modeling objective, which has been widely used in pretraining large protein language models (Bepler & Berger, 2021). For each protein, we randomly mask node features of some residues and then predict these masked residue types via structure-based encoders. This method is also known as Attribute Masking in the literature of molecules (Hu et al., 2019) and Masked Inverse Folding in the protein community (Yang et al., 2022).
+
+Distance Prediction aims to learn local spatial structures by predicting the Euclidean distance between two nodes connected in the protein graph. A fixed number of edges are randomly selected and masked from the original graph. Then, the representations of two end nodes will be used to predict the distances between them.
+
+Besides, angles and dihedrals between adjacent edges are also important features that reflect the relative position between residues Klicpera et al. (2021). Similarly, we can define the masked geometric losses Angle Prediction and Dihedral Prediction by randomly selecting and masking adjacent edge pairs and triplets. Here we discretize the angles and dihedrals by cutting the range $[ 0 , \pi ]$ into 8 bins. Then, the representations of end nodes in the masked graph will be used to predict which bin the angles between them will belong to.
+
+
+Figure 5: Illustration of self-prediction methods.
+
+# E EXPERIMENTAL DETAILS
+
+# E.1 DATASET STATISTICS
+
+Table 4: Dataset statistics for downstream tasks.
+
+
Dataset
#Proteins
#Train
# Validation
#Test
Enzyme Commission
15,550
1,729
1,919
Gene Ontology
29,898
3,322
3,415
Fold Classification - Fold
12.312
736
718
Fold Classification- Superfamily
12,312
736
1,254
Fold Classification-Family
12.312
736
1,272
Reaction Classification
29,215
2,562
5,651
+
+Dataset statistics of downstream tasks are summarized in Table 4. Details are introduced as follows.
+
+Enzyme Commission and Gene Ontology. Following DeepFRI (Gligorijevic et al., 2021), the EC ´ numbers are selected from the third and fourth levels of the EC tree, forming 538 binary classification tasks, while the GO terms with at least 50 and no more than 5000 training samples are selected. The non-redundant sets are partitioned into training, validation and test sets according to the sequence identity. We retrieve all protein chains from PDB with the code in their codebase and remove those with obsolete pdb ids, so the statistics will be slightly different from that in the original paper.
+
+Fold Classification. We directly use the dataset in Hermosilla et al. (2021), which consolidated 16,712 proteins with 1,195 different folds from the SCOPe 1.75 database (Murzin et al., 1995).
+
+Reaction Classification. The dataset comprises 37,428 proteins categorized into 384 reaction classes. The split methods are described in Hermosilla et al. (2021), where they cluster protein chains via sequence similarities and ensure that protein chains from the same cluster are in the same split.
+
+# E.2 EVALUATION METRICS
+
+Now we introduce the details of evaluation metrics for EC and GO prediction. These two tasks aim to answer the question: whether a protein has some particular functions, which can be seen as multiple binary classification tasks.
+
+The first metric, protein-centric maximum F-score $\mathrm { F } _ { \mathrm { m a x } }$ , is defined by first calculating the precision and recall for each protein and then taking the average score over all proteins. More specifically, for a given target protein $i$ and a decision threshold $t \in [ 0 , 1 ]$ , the precision and recall are computed as:
+
+$$
+\mathrm { p r e c i s i o n } _ { i } ( t ) = \frac { \sum _ { f } \mathbb { 1 } [ f \in P _ { i } ( t ) \cap T _ { i } ] } { \sum _ { f } \mathbb { 1 } [ f \in P _ { i } ( t ) ] } ,
+$$
+
+and
+
+$$
+\mathrm { r e c a l l } _ { i } ( t ) = \frac { \sum _ { f } { \mathbb { 1 } [ f \in P _ { i } ( t ) \cap T _ { i } ] } } { \sum _ { f } { \mathbb { 1 } [ f \in T _ { i } ] } } ,
+$$
+
+where $f$ is a function term in the ontology, $T _ { i }$ is a set of experimentally determined function terms for protein $i$ , $P _ { i } ( t )$ denotes the set of predicted terms for protein $i$ with scores greater than or equal to $t$ and $\mathbb { 1 } [ \cdot ] \in \{ 0 , 1 \}$ is an indicator function that is equal to 1 iff the condition is true.
+
+Then, the average precision and recall over all proteins at threshold $t$ is defined as:
+
+$$
+\operatorname { p r e c i s i o n } ( t ) = { \frac { 1 } { M ( t ) } } \sum _ { i } \operatorname { p r e c i s i o n } _ { i } ( t ) ,
+$$
+
+and
+
+$$
+\mathrm { r e c a l l } ( t ) = \frac { 1 } { N } \sum _ { i } \mathrm { r e c a l l } _ { i } ( t ) ,
+$$
+
+where we use $N$ to denote the number of proteins and $M ( t )$ to denote the number of proteins on which at least one prediction was made above threshold $t$ , i.e., $| P _ { i } ( t ) | > 0$ .
+
+Combining these two measures, the maximum F-score is defined as the maximum value of $\mathrm { F }$ -measure over all thresholds. That is,
+
+$$
+\mathrm { F } _ { \mathrm { m a x } } = \operatorname* { m a x } _ { t } \left\{ \frac { 2 \cdot \mathrm { p r e c i s i o n } ( t ) \cdot \mathrm { r e c a l l } ( t ) } { \mathrm { p r e c i s i o n } ( t ) + \mathrm { r e c a l l } ( t ) } \right\} .
+$$
+
+The second metric, pair-centric area under precision-recall curve $\mathrm { \Delta A U P R _ { p a i r } }$ , is defined as the average precision scores for all protein-function pairs, which is exactly the micro average precision score for multiple binary classification.
+
+# E.3 IMPLEMENTATION DETAILS
+
+In this subsection, we describe implementation details of all baselines and our methods. For all models, the outputs will be fed into a three-layer MLP to make final prediction. The dimension of hidden layers in the MLP is equal to the dimension of model outputs.
+
+CNN (Shanehsazzadeh et al., 2020). Following the finding in Shanehsazzadeh et al. (2020), we employ a convolutional neural network (CNN) to encode protein sequences. Specifically, 2 convolutional layers with 1024 hidden dimensions and kernel size 5 constitute this baseline model.
+
+ResNet (Rao et al., 2019). We also adopt a deep CNN model, i.e., the ResNet for protein sequences proposed by Rao et al. (2019), in our benchmark. This model is with 12 residual blocks and 512 hidden dimensions, and it uses the GELU (Hendrycks & Gimpel, 2016) activation function.
+
+LSTM (Rao et al., 2019). The bidirectional LSTM model proposed by Rao et al. (2019) is another baseline for protein sequence encoding. It is composed of three bidirectional LSTM layers with 640 hidden dimensions.
+
+Transformer (Rao et al., 2019). The self-attention-based Transformer encoder (Vaswani et al., 2017) is a strong model in natural language processing (NLP), Rao et al. (2019) adapts this model into the field of protein sequence modeling. We also adopt it as one of our baselines. This model has a comparable size with BERT-Small (Devlin et al., 2018), which contains 4 Transformer blocks with 512 hidden dimensions and 8 attention heads, with activation GELU (Hendrycks & Gimpel, 2016).
+
+GCN (Kipf & Welling, 2017). We take GCN as a baseline to encode the residue graph derived by our graph construction scheme. We adopt the implementation in TorchDrug (Zhu et al., 2022), where 6 GCN layers with the hidden dimension of 512 are used. We run the results of GCN on EC and GO by ourselves and take its results on Fold and Reaction classification from Hermosilla et al. (2021).
+
+GAT (Velickovi ˇ c et al., 2018). ´ We adopt another popular graph neural network, GAT, as a structurebased baseline. We follow the implementation in TorchDrug and use 6 GAT layers with the hidden dimension of 512 and 1 attention head per layer for encoding. The results on EC, Fold and Reaction classification are based on our runs, and the results on GO are taken from Wang et al. (2022b).
+
+GVP (Jing et al., 2021). The GVP model (Jing et al., 2021) is a decent protein structure encoder. It iteratively updates the scalar and vector representations of a protein, and these representations possess the merit of invariance and equivariance. In our benchmark, we evaluate this baseline method following the official source code. In specific, 3 GVP layers with 32 feature dimensions (20 scalar and 4 vector channels) constitute the GVP model.
+
+3DCNN_MQA (Derevyanko et al., 2018). We implement the 3DCNN model from the paper (Derevyanko et al., 2018) with a box width of 40.0 and input resolution of $1 2 0 \times 1 2 0 \times 1 2 0$ . The model has 6 residual blocks and 128 hidden dimensions with ELU activation function.
+
+GraphQA (Baldassarre et al., 2021). Following hyperparameters in the original paper, we construct residue graphs based on bond and spatial information and re-implement the graph neural network. The best model has 4 layers with 128 node features, 32 edge features and 512 global features.
+
+New IEConv (Hermosilla & Ropinski, 2022). Since the code for New IEConv has not been made public when the paper is written, we reproduce the method according to the description in the paper and achieve similar results on Fold and Reaction classification tasks. Then, we evaluate the method on EC and GO prediction tasks with the default hyperparameters reported in the original paper and follow the standard training procedure on these two tasks.
+
+DeepFRI (Gligorijevic et al., 2021). ´ We also evaluate DeepFRI (Gligorijevic et al., 2021) in our ´ benchmark, which is a popular structure-based encoder for protein function prediction. DeepFRI employs an LSTM model to extract residue features and further constructs a residue graph to propagate messages among residues, in which a 3-layer graph convolutional network (GCN) (Kipf & Welling, 2017) is used. We directly utilize the official model checkpoint for baseline evaluation.
+
+ESM-1b (Rives et al., 2021). Besides the from-scratch sequence encoders above, we also compare with two state-of-the-art pretrained protein language models. ESM-1b (Rives et al., 2021) is a huge Transformer encoder model whose size is larger than BERT-Large (Devlin et al., 2018), and it is pretrained on 24 million protein sequences from UniRef50 (Suzek et al., 2007) by masked language modeling (MLM) (Devlin et al., 2018). In our evaluation, we finetune the ESM-1b model with the learning rate that is one-tenth of that of the MLP prediction head.
+
+ProtBERT-BFD (Elnaggar et al., 2021). The other protein language model evaluated in our benchmark is ProtBERT-BFD (Elnaggar et al., 2021) whose size also excesses BERT-Large (Devlin et al., 2018). This model is pretrained on 2.1 billion protein sequences from BFD (Steinegger & Söding, 2018) by MLM (Devlin et al., 2018). The evaluation of ProtBERT-BFD uses the same learning rate configuration as ESM-1b.
+
+LM-GVP (Wang et al., 2022b). To further enhance the effectiveness of GVP (Jing et al., 2021), Wang et al. (2022b) proposed to prepend a protein language model, i.e. ProtBERT (Elnaggar et al.,
+
+Table 5: Hyperparameter configurations of our model on different datasets. The batch size reported in the table refers to the batch size on each GPU. All the hyperparameters are chosen by the performance on the validation set.
+
+
Hyperparameter
EC
GO
Fold
Reaction
GNN
#layer
6
6
6
6
hidden dim.
512
512
512
512
dropout
0.1
0.1
0.2
0.2
Learning
optimizer
Adam
Adam
SGD
SGD
learning rate
1e-4
1e-4
1e-3
1e-3
weight decay
0
0
5e-4
5e-4
batch size
2
2
2
2
# epoch
200
200
300
300
+
+Table 6: $\mathrm { F } _ { \mathrm { m a x } }$ on EC and GO tasks under different sequence cutoffs ( $30 \%$ / 40% / 50% / 70% / 95%).
+
+
Method
EC
GO-BP
GO-MF
GO-CC
CNN
0.366/0.361/0.372/0.429/0.545
0.197/0.195/0.197/0.211/0.244
0.238/0.243/0.256/0.292/0.354
0.258/0.257/0.260/0.263/0.387
ResNet
0.409/0.412/0.450/0.526/0.605
0.230/0.230/0.234/0.249/0.280
0.282/0.288/0.308/0.347/0.405
0.277/0.273/0.280/0.278/0.304
LSTM
0.247/0.249/0.270/0.333/0.425
0.194/0.192/0.195/0.205/0.225
0.223/0.229/0.245/0.276/0.321
0.263/0.264/0.269/0.270/0.283
Transformer
0.167/0.173/0.175/0.197/0.238
0.267/0.265/0.262/0.262/0.264
0.184/0.187/0.195/0.204/0.211
0.378/0.382/0.388/0.395/0.405
GCN
0.245/0.246/0.246/0.280 /0.320
0.251/0.250/0.248/0.248/0.252
0.180/0.183/0.187/0.194/0.195
0.318/0.318/0.320/0.323/0.329
GearNet
0.557 /0.570/0.615/0.693/0.730
0.309/0.309/0.315/0.336/0.356
0.382/0.397 /0.425/0.474/0.503
0.381/0.385/0.393 /0.398/0.414
GearNet-edge
0.625/0.646/0.694/0.757/0.810
0.345/0.347/0.354/0.378/0.403
0.444/0.461/0.490 /0.537/0.580
0.394/0.394/0.401/0.408/0.450
DeepFRI
0.470 /0.505 /0.545/0.600 /0.631
0.361/0.362/0.371/0.391/0.399
0.374/0.383 /0.409 /0.446/0.465
0.440/0.441/0.444/0.451/ 0.460
ESM-1b
0.737/0.764/0.797/0.839 /0.864
0.394/0.399/0.407/0.429/0.452
0.546/0.562/0.588/0.625/0.657
0.462/0.465/0.468/0.465/0.477
Multiview Contrast
0.744/0.769/0.808/0.848/0.874
0.436/0.442/0.449/0.471/0.490
0.533/0.548/0.573/0.612/0.654
0.459/0.460/0.467/0.469/0.488
+
+2021), before GVP to additionally utilize protein sequence representations. We also adopt this hybrid model as one of our baselines, and its implementation follows the official source code.
+
+Our methods. For pretraining, we use Adam optimizer with learning rate 0.001 and train a model for 50 epochs. Then, the pretrained model will be finetuned on downstream datasets.
+
+For Multiview Contrast, we set the cropping length of subsequence operation as 50, the radius of subspace operation as 15, the mask rate of random edge masking operation as 0.15. The temperature $\tau$ in the InfoNCE loss function is set as 0.07. When pretraining GearNet-Edge and GearNet-EdgeIEConv, we use 96 and 24 as batch sizes, respectively.
+
+For Distance Prediction, we set the number of sampled residue pairs as 256. The batch size will be set as 128 and 32 for GearNet-Edge and GearNet-Edge-IEConv, respectively. For Residue Type, Angle and Dihedral Prediction, we set the number of sampled residues, residue triplets and residue quadrants as 512. The batch size will be set as 96 and 32 for GearNet-Edge and GearNet-Edge-IEConv, respectively.
+
+For downstream evaluation, the hidden representations in each layer of GearNet will be concatenated for the final prediction. Table 5 lists the hyperparameter configurations for different downstream tasks. For the four tasks, we use the same optimizer and number of epochs as in the original papers to make fair comparison. For EC and GO prediction, we use ReduceLROnPlateau scheduler with factor 0.6 and patience 5, while we use StepLR scheduler with step size 50 and gamma 0.5 for fold and reaction classification.
+
+# F ADDITIONAL EXPERIMENTAL RESULTS ON EC AND GO PREDICTION
+
+Results under different sequence identity cutoffs. Besides the experiments in Section 5, where $9 5 \%$ is used as the sequence identity cutoff for EC and GO dataset splitting, we also test our models and several important baselines under four lower sequence identity cutoffs and show the experimental results in Table 6. The aim of this experiment is to test the robustness of different models under different hold-out test sets, with lowering cutoff indicating lower similarity between training and test sets. It can be observed that, at lower cutoffs, our model can still achieve the best performance among models without pretraining and get comparable or better results against ESM-1b after pretraining.
+
+Table 7: AUPR on EC and GO prediction. [†] denotes results taken from Wang et al. (2022b). For pretraining, we select the model with the best performance when training from scratch, i.e., GearNet-Edge. We omit the model name and use pretraining methods to name our pretrained models.
+
+
Method
Pretraining Dataset (Size)
EC
GO
BP
MF
CC
CNN (Shanehsazzadeh et al., 2020)
0.526
0.159
0.351
0.204
ResNet (Rao et al.,2019)
0.590
0.205
0.434
0.214
LSTM (Rao et al., 2019)
0.414
0.156
0.334
0.192
Transformer (Rao et al.,2019)
0.218
0.156
0.177
0.210
Wfrienirecnn GCN (Kipf & Welling,2017)
0.319
0.136
0.147
0.175
GAT (Velickovic et al.,2018)
0.320
0.171
0.329†
0.249†
GVP (Jing et al.,2021)
0.482
0.224
0.458†
0.279†
3DCNN_MQA (Derevyanko et al.,2018)
0.029
0.132
0.075
0.144
GraphQA (Baldassarre et al.,2021)
0.543
0.199
0.347
0.265
New IEConv (Hermosilla & Ropinski,2022)
0.775
0.273
0.572
0.316
GearNet
0.751
0.211
0.490
0.276
GearNet-IEConv
0.835
0.231
0.547
0.259
GearNet-Edge
0.835
0.251
0.570
0.303
GearNet-Edge-IEConv
0.843
0.244
0.561
0.284
DeepFRI(Gligorijevic et al.,2021)
Pfam (10M)
0.547
0.282
0.462
0.363
ESM-1b (Rives et al.,2021) Wreaed n
UniRef50 (24M)
0.889
0.332
0.639
0.324
ProtBERT-BFD (Elnaggar et al.,2021)
BFD (2.1B)
0.859
0.188
0.464†
0.234
LM-GVP (Wang et al., 2022b)
UniRef100 (216M)
0.710
0.302†
0.580
0.423†
Residue Type Prediction
AlphaFoldDB (805K)
0.870
0.267
0.583
0.311
Distance Prediction
AlphaFoldDB (805K)
0.863
0.274
0.586
0.327
Angle Prediction
AlphaFoldDB (805K)
0.880
0.291
0.603
0.331
Dihedral Prediction
AlphaFoldDB (805K)
0.881
0.304
0.603
0.338
Multiview Contrast
AlphaFoldDB (805K)
0.892
0.292
0.596
0.336
+
+AUPR on EC and GO prediction. We have reported experimental results on EC and GO prediction with $\mathrm { F } _ { \mathrm { m a x } }$ as the metric in Section 5. Here we report another popular metric AUPR in Table 7. Note that we still use the best model selected by $\mathrm { F } _ { \mathrm { m a x } }$ on validation sets. It can be observed that our model can still achieve the best performance on EC prediction in both from scratch and pretrained settings. However, there are still non-trivial gaps between our models with the state-of-the-art results. This probably is because of the inconsistency between the two evaluation metrics. It would be interesting to study the relationship between these two metrics and develop a model good at both in future works.
+
+Sampling schemes in self-prediction methods. Different sampling schemes may lead to different results for self-prediction methods. We study the effects of sampling schemes using Dihedral Prediction as an example. Instead of sampling dihedral angles formed by three consecutive edges, we try to predict the dihedrals formed by four randomly sampled nodes. We observe that the $\mathrm { F } _ { \mathrm { m a x } }$ decreases from 0.859 to 0.821. This suggests that it is better of learning residue representations to capture local spatial information instead of global information. The change of sampling schemes will make self-prediction tasks more difficult to solve, which even brings negative effects after pretraining.
+
+Pretraining on different datasets. We use the AlphaFold protein structure database as our pretraining database, because it contains the largest number of protein structures and is planned to cover over 100 million proteins. However, the structures in this database are not experimentally determined but predicted by AlphaFold2. Therefore, it is interesting to see the performance of our methods when pretraining on different datasets.
+
+To study the effects of the choice of pretraining dataset, we build another dataset using structures extracted from Protein Data Bank (PDB) (Berman et al., 2000). Specifically, we extract 123,505 experimentally-determined protein structures from PDB whose resolutions are between 0.0 and 2.5 angstroms, and we further extract 305,265 chains from these proteins to construct the final dataset.
+
+Next, we pretrain our five methods on AlphaFold Database v1 (proteome-wide structure predictions), AlphaFold Database v2 (Swiss-Prot structure predictions) and Protein Data Bank and then evaluate the pretrained models on the EC prediction task. The results are reported in Table 8. As can be seen in the table, our methods can achieve comparable performance on different pretraining datasets. Consequently, our methods are robust to the choice of pretraining datasets.
+
+Table 8: Results of GearNet-Edge pretrained on different pretraining datasets with different methods. Models are evaluated on the EC prediction task.
+
+
Dataset
# Proteins
Multivew Contrast Fmax
Residue Type Prediction
Distance Prediction
Angle Prediction
Dihedral Prediction
AUPRpair
AUPRpair
Fmax
AUPRpair
Fmax
AUPRpair
Fmax
AUPRpair
Fmax
AlphaFold Database (v1 + v2)
804,872
0.892
0.874
0.870
0.834
0.863
0.839
0.880
0.853
0.881
0.859
AlphaFold Database (v1)
365,198
0.890
0.874
0.869
0.842
0.871
0.843
0.879
0.854
0.877
0.852
AlphaFold Database (v2)
439,674
0.890
0.874
0.868
0.838
0.868
0.846
0.881
0.853
0.883
0.861
Protein Data Bank
305,265
0.881
0.859
0.870
0.841
0.865
0.847
0.880
0.857
0.886
0.858
+
+# G STRUCTURE PRETRAINING ON EGNN
+
+To verify the effectiveness of our proposed methods, we choose another common backbone model, equivariant graph neural network (EGNN) (Satorras et al., 2021), for pretraining. We follow the experimental setup in Appendix E.3 for pretraining and finetuning the model. The results on the EC dataset are reported in Table 9. It can be seen that the performance of the EGNN is improved by a large margin with all the five pretraining methods. Among them, Distance Prediction and Multiview Contrast are the top two methods. The ranks of these five methods are quite different from the ranks in the main paper. This is probably because the capacity of EGNN limits
+
+
Method
Fmax
EGNN
0.640
Residue Type Prediction Distance Prediction
0.729 0.761
Angle Prediction Dihedral Prediction
0.718
Multiview Contrast
0.662 0.752
+
+Table 9: Pretraining results on EC with EGNN as backbone models.
+
+its performance on some pretraining tasks and thus reduces their benefits.
+
+# H COMBINE SEQUENCE- AND STRUCTURE-BASED ENCODERS
+
+In the main paper, we compare the pretrained sequence- and structure-based encoder and show that geometric structure pretraining can achieve competitive results with much less data. To further show the benefit of incorporating structural information, here we choose ESM-1b as a baseline and build a structure-based encoder based on its output. Specifically, we replace the raw node features in GearNet with pretrained sequence representations. We train the model on EC with the same configurations for GearNet and finetune the ESM-1b model with learn
+
+
Method
EC
GO
BP
MF
CC
GearNet
0.730
0.356
0.503
0.414
GearNet-Edge
0.810
0.403
0.580
0.450
-w/ Multiview Contrast
0.874
0.490
0.654
0.488
ESM-1b
0.864
0.452
0.657
0.477
ESM-1b+GearNet
0.883
0.491
0.677
0.501
+
+Table 10: Results $\left( \mathrm { F } _ { \operatorname* { m a x } } \right)$ for combining seuqence- and structure-based encoders.
+
+ing rate 1e-5. The results are shown in Table 10. It can be observed that the ESM- $^ { 1 \mathrm { b } + }$ GearNet model can achieve SOTA performance even without structure-based pretraining, which suggests the importance of utilizing protein structures. Also, it is promising to explore pretraining methods on the combined encoder. We leave this direction for future work.
+
+# I COMBINE NEURAL AND RETRIEVAL-BASED METHODS
+
+Searching a database to retrieve similar proteins is a popular method used in the biological community when predicting properties of a target protein, e.g., searching multiple sequence alignments and templates for structure prediction (Jumper et al., 2021). There have been a large amount of tools proposed for aligning protein sequences (Altschul et al., 1997; Steinegger & Söding, 2017; Steinegger et al., 2019) and structures (Yang & Tung, 2006; Zhang & Skolnick, 2005; van Kempen et al., 2022; Holm, 2019). In this section, we first compare our neural representation-based method with retrieval-based methods on function and fold classification tasks and then showcase the potential of our proposed methods on structure-based search tasks.
+
+Comparison with retrieval-based methods. We select a structure alignment tool, Foldseek (van Kempen et al., 2022), as our retrieval-based baseline. The method trains a VQ-VAE on SCOPe40 to discretize structural units into an alphabet of twenty 3Di states and then transforms the problem to 3Di sequence alignment, which is done by MMseqs2 (Steinegger & Söding, 2017). When using
+
+
Method
EC
GO-BP
GO-MF
GO-CC
Fold Classification
AUPRpair
Fmax
AUPRpair
Fmax
AUPRpair
Fmax
AUPRpair
Fmax
Fold
Super.
Fam.
Avg.
Foldseek (van Kempen et al., 2022)
0.778
0.888
0.168
0.440
0.462
0.649
0.159
0.321
2.78
7.57
65.4
25.2
GearNet-Edge(-IEConv)
0.835
0.810
0.251
0.403
0.570
0.580
0.303
0.450
48.3
70.3
99.5
72.7
w/Multiview Contrast
0.892
0.874
0.292
0.490
0.596
0.654
0.336
0.488
54.1
80.5
99.9
78.1
w/Multiview Contrast + Foldseek
0.908
0.903
0.314
0.500
0.615
0.673
0.319
0.467
-
-
-
-
+
+Table 11: Comparison between neural and retrieval-based methods on EC, GO and fold classification tasks. As in Table 2, we use GearNet-Edge on EC and GO prediction and GearNet-Edge-IEConv on fold classification as backbone models. The results w/o and w/ pretraining and those ensembled with Foldseek are reported on EC and GO. We omit the ensemble results on fold classification due to the poor performance of Foldseek.
+
+Foldseek, we follow the parameters provided in their github repo2. For each protein in the test set of our benchmark tasks, we use Foldseek to retrieve the most similar protein in the training set, the label of which will be used for prediction.
+
+We report the results of retrieval-based and our proposed neural methods in Table 11. First, we find that Foldseek achieves very good performance on EC and GO prediction. In terms of $\mathrm { F } _ { \mathrm { m a x } }$ , it is better than GearNet-Edge on all tasks and competitive with the pretrained GearNet-Edge on EC and GO-MF. The accuracy of Foldseek makes it a strong baseline for proteins with similar structures in the training set. However, when the dataset is split by structural similarities, e.g., fold classification, the structural alignment tool fails to retrieve similar proteins and get accurate prediction as shown in the table. This can be attributed to the inherent limitation of retrieval-based methods, i.e., the lack of generalization ability to novel data points.
+
+Furthermore, to utilize the advantages from both worlds, we combine neural and retrieval-based methods via ensemble. As shown in the last row of Table 11, both metrics are significantly improved on EC, GO-BP, GO-MF compared with the separate neural and retrieval-based methods. Consequently, it would be interesting to explore the combination of these two kinds of methods in the future, as have done in many machine learning tasks (Mitra & Craswell, 2017; Sun et al., 2019; Notin et al., 2022).
+
+Results on structure-based search tasks. To show the potential of structure-based modeling for biological applications, we test our model on the $\mathrm { S C O P e 4 0 }$ benchmark proposed in van Kempen et al. (2022). The authors cluster the SCOPe 2.0198 at $40 \%$ sequence identity and obtain 11,211 non-redundant protein sequences. They perform an all-versus-all search on the dataset and test the ability of structure alignment tools for finding proteins of the same SCOPe family, superfamily, and fold. For each query, they measure the fraction of TPs (true positive matches) out of all correct matches until the first FP (false positive) that matches to a different fold. The sensitivity is calculated by the area under the curve of the cumulative ROC curve up to the first FP.
+
+Table 12: Sensitivity of searching proteins of the same family, superfamily and fold on SCOPe40. Results are evaluated with the scripts and predictions provided in (van Kempen et al., 2022).
+
+
Method
Fold
Super.
Fam.
Avg.
MMseqs2 (Steinegger & Soding, 2017)
0.001
0.082
0.542
0.208
3D-BLAST (Yang & Tung,2006)
0.009
0.126
0.572
0.235
CLE-SW (Zhao et al., 2013)
0.021
0.293
0.763
0.359
CE (Shindyalov & Bourne,1998)
0.131
0.529
0.885
0.515
TMalign-fast (Zhang& Skolnick,2005)
0.188
0.618
0.906
0.571
TMalign (Zhang & Skolnick,2005)
0.188
0.610
0.901
0.566
Foldseek (van Kempen et al., 2022)
0.155
0.593
0.914
0.554
DALI (Holm,2019)
0.310
0.751
0.942
0.667
GearNet-Edge-IEConv
0.474
0.722
0.936
0.710
GearNet-Edge-IEConv+DALI
0.481
0.779
0.963
0.741
+
+
+Figure 6: Latent space visualization of GearNet-Edge (Multiview Contrast) on AlphaFold Database v1.
+
+We report the results of seven structure alignment tools and a sequence search tool evaluated in van Kempen et al. (2022). For comparison, we use the GearNet-Edge-IEConv model trained on fold classification to extract representations for proteins and use the cosine similarity between representations to retrieve similar proteins. The sensitivity of these methods is reported in Table 12. It can be observed that our method achieves the best performance on average among all baselines. Compared with DALI, though finding fewer proteins of the same family and superfamily, our method can achieve higher sensitivity at the fold level. This can be explained by the better generalization ability to novel structures of neural methods. With the ensemble of neural and retrieval-based methods, we can achieve the SOTA performance at all levels. This again demonstrates the effectiveness of our proposed method and the potential of combining neural and retrieval-based methods.
+
+# J LATENT SPACE VISUALIZATION
+
+For qualitatively evaluating the quality of the protein embeddings learned by our pretraining method, we visualize the latent space of the GearNet-Edge model pretrained by Multiview Contrast. Specifically, we utilize the pretrained model to extract the embeddings of all the proteins in AlphaFold Database v1, and these embeddings are mapped to the two-dimensional space by UMAP (McInnes et al., 2018) for visualization. Following Akdel et al. (2021), we highlight the 20 most common superfamilies within the database by different colors. The visualization results are shown in Fig. 6. It can be observed that our pretrained model tends to group the proteins from the same superfamily together and divide the ones from different superfamilies apart. In particular, it succeeds in clearly separating three superfamilies, i.e., Protein kinase superfamily, Cytochrome P450 family and TRAFAC class myosin-kinesin ATPase superfamily. Such a decent capability of discriminating protein superfamilies, to some degree, interprets our model’s superior performance on Fold Classification.
+
+
+Figure 7: Identification of active sites on proteins responsible for binding based on attribution scores. Two proteins binding to specific targets are selected for illustration (1NYR-A for ATP binding and 1B85-A for Heme binding). For these two complexes, ligands are shown in yellow spheres while the residues of the receptors are colored based on attribution scores. Residues with higher attribution scores are colored in red while those with lower scores are colored in blue.
+
+# K RESIDUE-LEVEL EXPLANATION
+
+Protein functions are often reflected by specific regions on the 3D protein structures. For example, the binding ability of a protein to a ligand is highly related to the binding interface between them. Hence, to better interpret our prediction, we apply Integrated Gradients (IG) (Sundararajan et al., 2017), a model-agnostic attribution method, on our model to obtain residue-level interpretation. Specifically, we first select two molecular functions, ATP binding (GO:0005524) and Heme binding (GO:0020037), from GO terms that are related to ligand binding. For each functional term, we pick one protein and feed it into the best model trained on the GO-MF dataset. Then, we use IG to generate the feature attribution scores for each protein. The method will integrate the gradient along a straight-line path between a baseline input and the original input. Here the original input and baseline input are the node feature $f$ and a zero vector, respectively. The final attribution score for each protein will be obtained by summing over the feature dimension. The normalized score distribution over all residues are visualized in Figure 7. As can be seen, our model is able to identify the active sites around the ligand, which are likely to be responsible for binding. Note that these attributions are directly generated from our model without any supervision, which suggests the decent interpretability of our model.
\ No newline at end of file
diff --git a/md/dev/toR64fsPir/toR64fsPir.md b/md/dev/toR64fsPir/toR64fsPir.md
new file mode 100644
index 0000000000000000000000000000000000000000..87b7f13851a53a48bd19e7167c2421a71613fe57
--- /dev/null
+++ b/md/dev/toR64fsPir/toR64fsPir.md
@@ -0,0 +1,496 @@
+# Structure-Preserving Embedding of Multi-layer Networks
+
+Anonymous Author(s)
+Affiliation
+Address
+email
+
+# Abstract
+
+1 This paper investigates structure-preserving embedding for multi-layer networks
+2 with community structure. We propose a novel generative tensor-based latent space
+3 model (TLSM) that allows heterogeneity among vertices. It embeds vertices into
+4 a low-dimensional latent space so that vertices within the same community are
+5 close to each other in the ambient space, and captures layer heterogeneity through
+6 a layer-effect factor matrix. With a general and flexible tensor decomposition
+7 on the expected network adjacency tensor, TLSM is dedicated to preserving the
+8 original vertex relations and layer-specific effects in the network embedding. An
+9 efficient alternative updating scheme is developed to estimate the model parameters
+10 and conduct community detection simultaneously. Theoretically, we establish the
+11 asymptotic consistencies of TLSM in terms of both multi-layer network estimation
+12 and community detection. The theoretical results are supported by extensive
+13 numerical experiments on both synthetic and real-life multi-layer networks.
+
+# 14 1 Introduction
+
+15 Network has arisen as one of the most common structures to represent the relations among entities.
+16 In many complex systems, entities can be multi-relational in that they may interact with each other
+17 under various circumstances. A multi-layer network, which consists of a common vertex set across all
+18 network layers representing the entities and an edge set at each layer to characterize a particular type
+19 of relation among entities, is faithful to represent these relations. Examples of multi-layer networks
+20 include social networks of multiple interaction channels [42, 15], biological networks of different
+21 collaboration schemes [49, 31, 29] and world trading networks [1, 37] of various goods.
+22 In this paper, we propose a structure-preserving embedding framework for multi-layer networks
+23 via a tensor-based latent space model. Specifically, TLSM utilizes the factorization of network
+24 adjacency tensor as a building block, embeds the vertices into a low dimensional latent space, and
+25 captures the heterogeneity among different layers through a layer-effect factor matrix. Consequently,
+26 the community structure of the multi-layer network can be detected from a network embedding
+27 perspective, such that vertices within the same community are closer to one another in the ambient
+28 space than those in different communities. In addition, one key feature of TLSM is that it introduces
+29 a sparsity factor into the vanilla logit transformation of the network adjacency tensor, which allows
+30 TLSM to model sparse multi-layer networks in a more explicit fashion and accommodate relatively
+31 sparser multi-layer networks as the ones considered in literature [22]. More importantly, this sparsity
+32 factor can be estimated from the network adjacency tensor directly.
+33 The main contribution of this paper is three-fold. First, the proposed TLSM is flexible and general
+34 in that it includes many popular network models as special cases. It also relaxes the layer-wise
+35 positive semi-definite condition that has been frequently employed in literature [6, 35]. Second, a
+36 joint modeling framework is constructed for TLSM, consisting of the multi-layer network likelihood
+37 and a clustering type penalty, to estimate the multi-layer network and conduct community detection
+38 simultaneously. Its advantages are supported by extensive numerical experiments on both synthetic
+39 and real-life multi-layer networks. Third, the asymptotic consistencies of TLSM are established in
+40 terms of both multi-layer network estimation and community detection. Notably, the established
+41 theoretical results imply that the proposed methods can accommodate the sparsest multi-layer
+42 networks considered in literature.
+43 The rest of the paper is organized as follows. The remaining of Section 1 discusses related works and
+44 introduces necessary notations. Section 2 presents the proposed TLSM and its estimation scheme with
+45 an efficient algorithm. In Section 3, we establish the asymptotic consistencies of TLSM. Extensive
+46 numerical performance of TLSM on synthetic and real-life multi-layer networks as well as ablation
+47 studies on two novel components of the proposed method are carried out in Section 4. Section 5
+48 concludes the paper. The supplementary materials contains technique proofs and necessary lemmas,
+49 additional simulation studies, detailed parameter tuning process, among others.
+
+# 50 1.1 Related work
+
+51 While there is a growing number of literature focusing on community detection in single-layer
+52 network [48, 28, 13], community detection in multi-layer network is still in its infancy. One classical
+53 approach is to detect community structure in each layer separately [4, 5], which fails to leverage
+54 the homogeneity across different layers. Another approach is to aggregate multi-layer networks
+55 into a single-layer one [41, 12, 35], which heavily relies on the assumption of homogeneous linking
+56 pattern across multiple layers. Recently, [26] proposed to aggregate the biased-adjusted version of
+57 the squared adjacency matrix in each layer to alleviate the information loss in aggregation. yet it
+58 requires the average node degree to grow at a sub-optimal order.
+59 In terms of multi-layer network generative models, [34] extended the seminal stochastic block
+60 model (SBM; 19) to the multi-layer stochastic block model (MLSBM; 34), where the probability for
+61 any two vertices to form an edge in a given layer depends only on their community memberships.
+62 Clearly, MLSBM heavily relies on the assumption of homogeneous vertices within communities.
+63 The framework of MLSBM has also been incorporated in degree-corrected network estimation [36],
+64 spectral clustering [6, 35, 26], least square estimation [27] and likelihood-based approaches [45]. In
+65 addition, network response regression model [46] and tensor factorization methods [8, 22] have also
+66 been proposed to detect community structures in multi-layer networks.
+67 To allow heterogeneous vertices, the latent space model [18] and random dot product graph model
+68 [3] have been extended to multi-layer networks[47, 32, 2]. In addition, graph neural network and
+69 graph convolutional networks has been extended to multi-layer network for learning the multi-layer
+70 network embedding [14, 23, 17, 39].
+
+# 71 1.2 Notations
+
+72 Throughout the paper, we use boldface calligraphic Euler scripts $( A )$ to denote tensors, boldface
+73 capital letters $( A )$ or Greece letters $( \alpha , \beta )$ to denote matrices, boldface lowercase letters $( a )$ to
+74 denote vectors, and regular letters $( a )$ to denote scalars. For an order three tensor $\pmb { \mathcal { A } } \in \mathbb { R } ^ { I _ { 1 } \times I _ { 2 } \times I _ { 3 } }$ ,
+75 $\mathcal { A } _ { i , . , . } \in \mathbb { R } ^ { I _ { 2 } \times I _ { 3 } } , \mathcal { A } _ { . , j , \cdot } \in \mathbb { R } ^ { I _ { 1 } \times I _ { 3 } }$ , and $\pmb { \mathscr { A } } _ { . , . , m } \in \mathbb { R } ^ { I _ { 1 } \times I _ { 2 } }$ are the $i$ -th horizontal slide, $j$ -th lateral slide
+76 and $m$ -th frontal slide of $\mathcal { A }$ , respectively. Similarly, for a matrix $\pmb { A }$ , $A _ { i , }$ . denotes its $i$ -th row and $A _ { . , j }$
+77 denotes its $j$ -th column. For a vector $\textbf { \em a }$ , $\mathrm { d i a g } ( a )$ stands for the diagonal matrix whose diagonal is $\textbf { \em a }$ .
+78 We use $| | \cdot | | , | | \cdot | | _ { \infty }$ , and $| | \cdot | | _ { F }$ to denote the $l _ { 2 }$ -norm, $l _ { \infty }$ -norm of a vector, and the Frobenius norm
+79 of matrix or tensor, respectively. For any integer $n$ , denote $[ n ] = \{ 1 , 2 , . . . , n \}$ .
+
+80 81 1 product betsuch that its or -th $\pmb { \mathcal { A } } \in \mathbb { R } ^ { I _ { 1 } \times I _ { 2 } \times I _ { 3 } }$ an as $U \in \mathbb { R } ^ { J _ { 1 } \times I _ { 1 } }$ $\pmb { A } \times _ { 1 } \pmb { U } \in$ $\mathbb { R } ^ { J _ { 1 } \times I _ { 2 } \times I _ { 3 } }$ $( j _ { 1 } , i _ { 2 } , i _ { 3 } )$ $\begin{array} { r } { ( \pmb { \mathscr { A } } \times _ { 1 } \pmb { U } ) _ { j _ { 1 } , i _ { 2 } , i _ { 3 } } = \sum _ { i _ { 1 } = 1 } ^ { I _ { 1 } } \pmb { \mathscr { A } } _ { i _ { 1 } , i _ { 2 } , i _ { 3 } } U _ { j _ { 1 } , i _ { 1 } } } \end{array}$ The mode-2 or mode-3 product between $\pmb { A }$ and any matrix of appropriate dimension are defined 83 similarly. The CANDECOMP/PARAFAC (CP) decomposition of $\pmb { A }$ has the form
+
+$$
+\pmb { \mathcal { A } } = \sum _ { r = 1 } ^ { R } \pmb { a } ^ { ( r ) } \circ \pmb { b } ^ { ( r ) } \circ \pmb { c } ^ { ( r ) } ,
+$$
+
+where 84 $\pmb { a } ^ { ( r ) } \in \mathbb { R } ^ { I _ { 1 } }$ , $\boldsymbol { b } ^ { ( r ) } \in \mathbb { R } ^ { I _ { 2 } }$ , and $\boldsymbol { c } ^ { ( r ) } \in \mathbb { R } ^ { I _ { 3 } }$ for $r \in [ R ]$ , and $\circ$ stands for the vector outer product. The CP-rank [24] of the tensor 85 $\pmb { a } ^ { ( r ) } \circ \pmb { b } ^ { ( r ) } \circ \pmb { c } ^ { ( r ) }$ is defined to be 1, for $r \in [ R ]$ . The minimal number
+
+86 of rank-1 tensors in the CP decomposition of $\pmb { A }$ is called the CP-rank of $\pmb { A }$ . Let $\pmb { \mathcal { T } } \in \{ 0 , 1 \} ^ { R \times R \times R }$
+87 be the identity tensor such that $\pmb { \mathcal { T } } _ { i _ { 1 } , i _ { 2 } , i _ { 3 } } = 1$ if $i _ { 1 } = i _ { 2 } = i _ { 3 }$ and 0 otherwise, and let $\pmb { A } \in \mathbb { R } ^ { I _ { 1 } \times R }$ ,
+88 $\boldsymbol { B } \in \mathbb { R } ^ { I _ { 2 } \times R }$ , and $C \in \mathbb { R } ^ { I _ { 3 } \times R }$ such that $\mathbf { \boldsymbol { A } } _ { \cdot , r } = \mathbf { \boldsymbol { a } } ^ { ( r ) }$ , $\mathbf { \delta } _ { B _ { \cdot , r } } = \mathbf { \delta } _ { \mathbf { \delta } } \mathbf { \delta } _ { B _ { \cdot , r } } ^ { ( r ) }$ , and $\boldsymbol { C } _ { \cdot , r } = \boldsymbol { c } ^ { ( r ) }$ . Equation (1)
+89 then can be equivalently written as $\pmb { \mathcal { A } } = \pmb { \mathcal { T } } \times _ { 1 } \pmb { A } \times _ { 2 } \pmb { B } \times _ { 3 } \pmb { C }$ .
+
+# 90 2 Structure-preserving embedding
+
+91 In this paper, we consider multi-layer networks that can be represented as an undirected and un
+92 weighted $M$ -layer graph $\mathcal { G } = ( V , \mathcal { E } )$ , where $V = [ n ]$ consists of the common $n$ vertices across
+93 different layers, and $\mathcal { E } = \{ E ^ { ( m ) } \} _ { m = 1 } ^ { M }$ with $E ^ { ( m ) } \subset V \times V$ representing the $m$ -th relation network
+94 among vertices. A order three adjacency tensor $\pmb { \mathcal { A } } = ( a _ { i , j , m } ) \in \{ 0 , 1 \} ^ { n \times n \times M }$ is then defined to
+95 represent $\mathcal { G }$ with entries $a _ { i , j , m } = 1$ if $( i , j ) \in E ^ { ( m ) }$ and 0 otherwise.
+
+# 2.1 Tensor-based latent space model
+
+97 To fully characterize the multi-layer network structure, we propose the following generative tensor
+8 based latent space model (TLSM). For any $i \leq j \in [ n ]$ , and $m \in [ M ]$ ,
+
+$$
+\begin{array} { r l } & { a _ { i , j , m } = a _ { j , i , m } \overset { i n d . } { \sim } \mathrm { B e r n o u l l i } ( p _ { i , j , m } ) , \mathrm { ~ w i t h ~ } } \\ & { \theta _ { i , j , m } = \log \Big ( \frac { p _ { i , j , m } } { s _ { n } - p _ { i , j , m } } \Big ) , \mathrm { ~ a n d ~ } } \\ & { \Theta = \mathbb { Z } \times _ { 1 } \alpha \times _ { 2 } \alpha \times _ { 3 } \beta , \alpha \in \Omega _ { \alpha } , \beta \in \Omega _ { \beta } , } \end{array}
+$$
+
+99 where $\boldsymbol { \mathscr { x } }$ is the order three $R$ -dimensional identity tensor. Basically, (2) follows the standard routine
+100 in the multi-layer network literature [34, 35, 27, 22] to model that $a _ { i , j , m } = a _ { j , i , m }$ are independently
+101 generated from a Bernoulli distribution, for $i \leq j \in [ n ]$ and $m \in [ M ]$ . Denote $\pmb { \mathcal { P } } = ( p _ { i , j , m } ) \in$
+102 $\mathbb { R } ^ { n \times n \times M }$ as the network underlying probability tensor, and then $\Theta = ( \theta _ { i , j , m } ) \in \mathbb { R } ^ { n \times n \times M }$ is
+103 the entry-wise transformation of $\mathcal { P }$ by (3). We call the transformation (3) as the modified logit
+104 transformation in that the constant 1 in the standard logit transformation is replaced by a sparsity
+105 factor $s _ { n }$ , which may vanish with $n$ and $M$ . We further assume all entries of $\mathcal { P }$ are of the order $s _ { n }$ ; that
+106 is, there exists a constant $\textstyle { \frac { 1 } { 2 } } \leq \xi < 1$ such that $( 1 - \xi ) s _ { n } \leq p _ { i , j , m } \leq \xi s _ { n }$ , for $i , j \in [ n ]$ and $m \in [ M ]$
+107 Thus, the in $s _ { n }$ essval $\begin{array} { r } { [ - \log \frac { \xi } { 1 - \xi } , \log \frac { \xi } { 1 - \xi } ] } \end{array}$ overall network sparsity and the entries of . More importantly, (4) models the CP d $\Theta$ are ensured toomposition of $\Theta$ cate inby the
+109 factor matrices $\pmb { \alpha } \in \mathbb { R } ^ { n \times R }$ and $\mathbf { \boldsymbol { \beta } } \in \mathbb { R } ^ { M \times R }$ with CP-rank $R$ , which can greatly reduce the number of
+110 free parameters from $n ( n + 1 ) M / 2$ to $( n + M ) R$ . Throughout the paper, the CP-rank $R$ is allowed
+111 to diverge with $n$ . In the CP decomposition of $\Theta$ , $_ \alpha$ is the vertex latent position matrix with each row
+112 $\alpha _ i , $ . serving as the embedding of vertex $i$ , and $\beta$ captures heterogeneity across different layers. Herein,
+113 we define the constraint sets for $_ { \pmb { \alpha } }$ and $\beta$ as $\begin{array} { r } { \Omega _ { \alpha } = \{ \alpha \in \mathbb { R } ^ { n \times R } : | | \alpha _ { i , \cdot } | | \leq \sqrt { \log \frac { \xi } { 1 - \xi } } } \end{array}$ , for $i \in [ n ] \}$
+114 and $\Omega _ { \beta } = \{ \beta \in \mathbb { R } ^ { M \times R } : | | \beta _ { \cdot , r } | | = 1 , r \in [ R ] \}$ . Note that the constraint on $\beta$ is necessary for
+115 model identification, and detailed discussion will be presented shortly. The constraint set $\Omega _ { \alpha } \times \Omega _ { \beta }$
+116 is sufficient to maintain the bounded condition of $\Theta$ since a general Hölder inequality yields that
+117 $\begin{array} { r } { | \theta _ { i , j , m } | = | \pmb { \mathcal { Z } } \times _ { 1 } \pmb { \alpha } _ { i , . } ^ { T } \times _ { 2 } \pmb { \alpha } _ { j , . } ^ { T } \times _ { 3 } \beta _ { m , . } ^ { T } | \le | | \pmb { \alpha } _ { i , . } | | | | \pmb { \alpha } _ { j , . } | | | | \beta _ { m , . } | | _ { \infty } \le \log \frac { \xi } { 1 - \xi } } \end{array}$ . To conclude this
+118 paragraph, we remake that the parameter $\xi$ is introduced for theoretical purpose and it is not treated as
+119 a tuning parameter. One can choose $\xi$ sufficiently close to 1 in empirical studies so that the restriction
+120 on $_ { \pmb { \alpha } }$ will be alleviated.
+121 We make several essential observations of the proposed TLSM. First and foremost, TLSM is flexible
+122 and general. It includes the celebrated MLSBM [34, 43, 35, 27, 26, 36, 22] as special case. Specif
+123 ically, suppose the vertices comes form $K$ disjoint communities, the standard MLSBM assumes
+124 that the underlying network probability tensor ${ \pmb { \mathcal { P } } } = { \pmb { \mathcal { B } } } \times _ { 1 } { \pmb { Z } } \times _ { 2 } { \pmb { Z } }$ , where $\pmb { \mathscr { B } } \in \mathbb { R } ^ { K \times K \times M }$ is a
+125 semi-symmetric core probability tensor with $\pmb { \mathscr { B } } _ { k _ { 1 } , k _ { 2 } , m } = \pmb { \mathscr { B } } _ { k _ { 2 } , k _ { 1 } , m }$ for $k _ { 1 } , k _ { 2 } \in [ K ]$ and $m \in [ M ]$ ,
+126 and $Z \in \{ 0 , 1 \} ^ { n \times K }$ is the community membership matrix with $Z _ { i , k } = 1$ if vertex $i$ comes from the
+127 $k$ -th community and 0 otherwise. That is, the probability of any vertex pair to form an edge in a
+128 particular layer depends only on their community memberships. Equivalently, under the modified
+129 logit transformation (3), we have $\Theta = \widetilde { \pmb { \mathscr { B } } } \times _ { 1 } { Z } \times _ { 2 } { Z }$ , where $\widetilde { B }$ is the entry-wise transformation
+130 of $_ { \pmb { B } }$ under (3). Taking $R$ to be the CP-rank of $\widetilde { B }$ , the CP-decomposition of $\widetilde { B }$ then has the form
+131 $\widetilde { \pmb { \mathscr { B } } } = \pmb { \mathscr { T } } \times _ { 1 } \pmb { C } \times _ { 2 } \pmb { C } \times _ { 3 } \ \pmb { \beta }$ for some matrix $C \in \mathbb { R } ^ { K \times R }$ and $\beta \in \mathbb { R } ^ { M \times R }$ due to semi-symmetry.
+132 This leads to the CP decomposition of $\Theta$ has the form (4) with $\mathbf { \alpha } _ { \alpha } = Z C$ . It is clear that MLSBM
+133 requires vertices within the same community are homogeneous and exchangeable, while TLSM
+134 allows vertices to have different embeddings even when they are in the same community.
+135 Second, TLSM is identifiable when both $_ { \pmb { \alpha } }$ and $\beta$ have full column ranks. When both $_ { \pmb { \alpha } }$ and $\beta$
+136 have full column ranks, the Kruskal’s $\mathbf { k }$ -ranks [25] of $_ { \pmb { \alpha } }$ and $\beta$ satisfy $k _ { \alpha } = k _ { \beta } = R$ , then $\Theta$ has
+137 CP-rank $R$ . Hence, $k _ { \alpha } + k _ { \alpha } + k _ { \beta } \geq 2 R + 2$ as long as $R \geq 2$ . By Theorem 1 of [40], the fixed
+138 column $l _ { 2 }$ -norm constraint of $\beta$ implies that the tensor factorization in (4) is unique up to column
+139 permutations of $_ { \pmb { \alpha } }$ and $\beta$ and column sign flip of $_ \alpha$ . It is important to remark that the community
+140 structure encoded in $_ { \pmb { \alpha } }$ remains unchanged under any column permutation or sign flip.
+141 Third, introducing a sparsity factor $s _ { n }$ via a modified logit transformation into the TLSM is non
+142 trivial. We take a single-layer network as an example to illustrate the limitation of the standard
+143 logit transformation in handling sparse network. Suppose a vanilla logit link is used to connect
+144 the network underlying probability matrix $_ { r }$ and its transformation $\Theta$ , and the latent space model
+145 usually assumes that $\breve { \Theta } = \alpha \alpha ^ { T }$ . A sparse network requires the entries of $\Theta$ diverge to negative
+146 infinite due to the small magnitude of edge probability, which leads to unstable estimation of $_ { \pmb { \alpha } }$ in
+147 numerical experiments. Moreover, this may conflict with the assumption that vertices within the same
+148 community tend to be close in the embedding space and their inner product is likely to be positive.
+149 These difficulties can be naturally circumvented when an appropriate $s _ { n }$ is chosen in (3).
+
+# 150 2.2 Regularized likelihood
+
+Given a network adjacency tensor $\mathcal { A }$ and number of communities $K$ , our goal is to estimate the multi-layer network embedding $( \alpha , \beta )$ and conduct community detection on the vertices. Throughout this paper, we assume the number of potential communities $K$ is given and may diverge with $n$ . Under the TLSM framework, with slight abuse of notation, we denote the average negative log-likelihood function of the multi-layer network $\mathcal { G }$ is $\mathcal { L } ( \alpha , \beta ; \mathcal { A } ) = \mathcal { L } ( \Theta ; \mathcal { A } )$ with
+
+$$
+\mathcal { L } ( \Theta ; \pmb { A } ) = \frac { 1 } { \varphi ( n , M ) } \sum _ { m = 1 } ^ { M } \sum _ { i \leq j } L ( \theta _ { i , j , m } ; a _ { i , j , m } ) ,
+$$
+
+where 151 $\varphi ( n , M ) = { \textstyle { \frac { 1 } { 2 } } } n ( n { + } 1 ) M$ is the number of potential edges, and $\begin{array} { r } { L ( \theta ; a ) = \log \left( 1 + \frac { s _ { n } } { 1 - s _ { n } + e ^ { - \theta } } \right) - } \end{array}$ 152 $\begin{array} { r } { a \log \left( \frac { s _ { n } } { 1 - s _ { n } + e ^ { - \theta } } \right) } \end{array}$ is a negative log-density of a Bernoulli random variable $a$ . We now introduce a 153 novel regularization term to detect the potential communities in $\mathcal { G }$ ,
+
+$$
+J ( \alpha ) = \operatorname* { m i n } _ { Z \in \Gamma , C \in \mathbb { R } ^ { K \times R } } \frac { 1 } { n } \| \alpha - Z C \| _ { F } ^ { 2 } ,
+$$
+
+154 where $C$ encodes the vertex embedding centers and ${ \Gamma } ~ \subset ~ \{ 0 , 1 \} ^ { n \times K }$ is the set of all possible
+155 community membership matrices; that is, for any $Z \in \Gamma$ , each row of $z$ consists of only one 1
+156 indicating the community membership and all others entries being 0. This leads to the proposed
+157 regularized cost function,
+
+$$
+\begin{array} { r } { \mathcal L _ { \lambda } ( \boldsymbol { \alpha } , \beta ; \boldsymbol { \mathcal { A } } ) = \mathcal L ( \boldsymbol { \alpha } , \beta ; \boldsymbol { \mathcal { A } } ) + \lambda _ { n } J ( \boldsymbol { \alpha } ) , } \end{array}
+$$
+
+158 where $\lambda _ { n }$ is a positive tuning parameter that strikes the balance between network estimation and
+159 community detection in the cost function. It is clear that the embeddings of vertices with similar
+160 linking pattern will be pushed towards the same center, and thus close to each other in the ambient
+161 space, leading to the desired community structure in $\mathcal { G }$ .
+
+# 2.3 Projected gradient descent algorithm
+
+163 We develop a scalable projected gradient descent (PGD) algorithm to optimize the penalized cost
+164 function (6), which is highly non-convex and can be solved only locally. PGD, which alternatively
+165 conducts gradient step and projection step, is one of the most popular and computationally fast
+166 algorithm in tackling non-convex optimization problem [7, 33, 47, 9].
+
+To compute the gradients of 167 $_ \alpha$ and $\beta$ , we introduce the following notations. Define $\pmb { \mathcal { T } } \in \mathbb { R } ^ { n \times n \times M }$ with entries 168 $\begin{array} { r } { \pmb { \mathcal { T } } _ { i , j , m } = \frac { \exp ( - \theta _ { i , j , m } ) } { 1 - s _ { n } + \exp ( - \theta _ { i , j , m } ) } ( p _ { i , j , m } - a _ { i , j , m } ) } \end{array}$ , and $\boldsymbol { X } _ { \mathcal { T } ( 2 , 3 ) } ^ { \alpha , \beta } \in \mathbb { R } ^ { n \times R }$ whose $i$ -th row
+
+169 170 al elements of the slic. Similarly, we define $( \mathcal { T } \times _ { 2 } \alpha ^ { T } \times _ { 3 } \beta ^ { T } ) _ { i , . , . }$ $X _ { \mathcal { T } ( 2 , 3 ) } ^ { \alpha , \beta } ( i , r ) ~ =$ $( \pmb { \mathcal { T } } \times _ { 2 } \pmb { \alpha } ^ { T } \times _ { 3 } \beta ^ { T } ) _ { i , r , r }$ $X _ { \mathcal { T } ( 1 , 2 ) } ^ { \alpha , \alpha } \in \mathbb { R } ^ { R \times M }$ $\boldsymbol { X } _ { \mathcal { T } ( 3 ) } ^ { \beta } \in \mathbb { R } ^ { n \times R }$ $X _ { T ( 1 , 2 ) } \in$ 171 $\mathbb { R } ^ { n \times M }$ , such that $X _ { \mathcal { T } ( 1 , 2 ) } ^ { \alpha , \alpha } ( r , m ) = ( \mathcal { T } \times _ { 1 } \alpha ^ { T } \times _ { 2 } \alpha ^ { T } ) _ { r , r , m }$ , $X _ { \mathcal { T } ( 3 ) } ^ { \beta } ( i , r ) = ( \mathcal { T } \times _ { 3 } \beta ^ { T } ) _ { i , i , r }$ , and 172 $X _ { \mathcal { T } ( 1 , 2 ) } ( i , m ) = \mathcal { T } _ { i , i , m }$ . Consequently, when the vertex membership matrix $z$ and the community 173 center matrix $C$ are fixed, we can derive the gradients of $\mathcal { L } _ { \lambda } ( \alpha , \beta ; \mathcal { A } )$ with respect to $_ { \pmb { \alpha } }$ and $\beta$ , as $\frac { 1 } { \varphi ( n , M ) } \big ( X _ { \mathcal { T } ( 2 , 3 ) } ^ { \alpha , \beta } + X _ { \mathcal { T } ( 3 ) } ^ { \beta } \ast \alpha \big ) + 2 \lambda _ { n } ( \alpha - Z C )$ and $\frac { 1 } { 2 \varphi ( n , M ) } \big ( ( X _ { \mathcal { T } ( 1 , 2 ) } ^ { \alpha , \alpha } ) ^ { T } + X _ { \mathcal { T } ( 1 , 2 ) } ^ { T } ( \alpha * \alpha ) \big ) ,$ 174 respectively. Herein, \* denotes the Hadamard product (entry-wise product) between two matrices.
+
+Let 175 $( { \tilde { \alpha } } , { \tilde { \beta } } )$ denote the solution given by one-step gradient descent, we then project $( { \tilde { \alpha } } , { \tilde { \beta } } )$ onto 176 $\Omega _ { \alpha } \times \Omega _ { \beta }$ in the following steps.
+
+Step 1. Multiply the $r$ -th column of $\tilde { \alpha } _ { . , r }$ by $| | \tilde { \beta } _ { . , r } | | ^ { 1 / 2 }$ for $r \in [ R ]$ . Denote the resultant matrix as $\tilde { \alpha } ^ { \prime }$
+
+Step 2. Regularize each row of $_ { \pmb { \alpha } }$ as $\begin{array} { r } { \pmb { \alpha } _ { i , . } = \tilde { \pmb { \alpha } } _ { i , . } ^ { \prime } \operatorname* { m i n } \{ \sqrt { \log \frac { \xi } { 1 - \xi } } , | | \tilde { \pmb { \alpha } } _ { i , . } ^ { \prime } | | \} / | | \tilde { \pmb { \alpha } } _ { i , . } ^ { \prime } | | , \mathbf { f } } \end{array}$ or $i \in [ n ]$ .
+
+Step 3. Normalize the columns of 179 $\beta$ as $\beta _ { . , r } = \tilde { \beta } _ { . , r } / | | \tilde { \beta } _ { . , r } | |$ , for $r \in [ R ]$ .
+
+Next, when $( \alpha , \beta )$ are given, we apply a $( 1 + \delta )$ -approximation K-means algorithm on $\tilde { \alpha }$ to update the vertex community membership matrix $z$ and community center matrix $C$ .
+
+182 The above steps will be alternatively conducted until convergence or reaching the maximum number
+183 of iterations. We further summarized the developed alternative updated scheme in Algorithm 1 in
+184 Appendix A of the supplementary materials
+185 Several remarks on the algorithm are in order. First, Algorithm 1 can only be guaranteed to converge
+186 to a stationary point but not any local minimizer. We hence employ a transformed higher order
+187 orthogonal iteration (HOOI) algorithm for warm initialization in all the numerical experiments in
+188 Section 4 and 5. Specifically, given a user-specific value $\tau$ , we define $\widetilde { \Theta }$ to mimic the magnitude
+189 of $\Theta$ such that $\widetilde { \Theta } _ { i , j , m } = - \tau$ if $a _ { i , j , m } = 0$ and $\widetilde { \Theta } _ { i , j , m } = \tau$ otherwise. A standard HOOI algorithm
+190 [11] is applied to $\Theta$ to obtain $\pmb { \alpha } ^ { ( 0 ) }$ and $\beta ^ { ( 0 ) }$ . We set $\tau = 1 0 0$ in all the numerical experiments.
+191 Second, the sparsity factor $s _ { n }$ is an intrinsic quantity of the multi-layer network data, and it should be
+192 estimated from the network directly. Note that the minimal and maximal probabilities for any vertex
+193 pair to form an edge in any layer are $p _ { \operatorname* { m i n } } = ( 1 - \xi ) s _ { n }$ and $p _ { \operatorname* { m a x } } = \xi s _ { n }$ , respectively. Interestingly,
+194 $p _ { \operatorname* { m i n } } + p _ { \operatorname* { m a x } } = s _ { n }$ , which does not depend on $\xi$ any more. Therefore, we propose to estimate $s _ { n }$ as
+
+$$
+\hat { s } _ { n } = \operatorname* { m i n } _ { i \in [ n ] } \frac { 1 } { n M } \sum _ { m = 1 } ^ { M } \sum _ { j = 1 } ^ { n } a _ { i , j , m } + \operatorname* { m a x } _ { i \in [ n ] } \frac { 1 } { n M } \sum _ { m = 1 } ^ { M } \sum _ { j = 1 } ^ { n } a _ { i , j , m } ,
+$$
+
+195 which is the sum of the minimal and maximal frequencies of a vertex to form edges with all other
+196 vertices in all layers. Third, to optimally choose $\lambda _ { n }$ , we extend the network cross-validation by
+197 edge sampling scheme in [30] to multi-layer networks. The detailed tuning procedure is relegated to
+198 Appendix B in the supplementary materials.
+
+# 3 Asymptotic theory
+
+# 3.1 Consistency in estimating $\Theta ^ { * }$
+
+201 Let $\begin{array} { r } { \lambda = \left\{ \Theta = \mathbb { Z } \times _ { 1 } { \pmb \alpha } \times _ { 2 } { \pmb \alpha } \times _ { 3 } \beta : { \pmb \alpha } \in \Omega _ { \pmb { \alpha } } , \beta \in \Omega _ { \beta } \right\} } \end{array}$ } be the parameter space of the problem and
+202 203 $\Theta ^ { * } = \mathcal { T } \times _ { 1 } \pmb { \alpha } ^ { * } \times _ { 2 } \pmb { \alpha } ^ { * } \times _ { 3 } \beta ^ { * }$ $\begin{array} { r } { K L ( \boldsymbol { \Theta } ^ { * } | | \boldsymbol { \Theta } ) = \varphi ^ { - 1 } ( n , M ) \sum _ { m = 1 } ^ { M } \sum _ { i \leq j } E \bigl ( L ( \theta _ { i , j , m } ; a _ { i , j , m } ) - L ( \theta _ { i , j , m } ^ { * } ; a _ { i , j , m } ) \bigr ) } \end{array}$ ty tensor. Denote be the averaged
+204 Kullback–Leibler divergence of the network generation distributions parametrized by and , for
+205 any $\mathbf { \Theta } \Theta \in \Omega$ . The following large deviation inequality is derived to quantify the behavior of $\mathcal { L } _ { \lambda } ( \Theta ; \mathbf { \mathcal { A } } )$
+206 for any $\Theta$ in the neighborhood of $\Theta ^ { * }$ defined by $\dot { K } L ( \Theta ^ { * } | | \Theta )$ .
+
+Proposition 1. Suppose 207 $\lambda _ { n } J ( \alpha ^ { * } ) \leq \epsilon _ { n }$ , and $( n + M ) R \varphi ^ { - 1 } ( n , M ) \epsilon _ { n } ^ { - 1 } \log ( \epsilon _ { n } ^ { - 1 / 2 } ) \leq c _ { 1 }$ for some constant 208 $c _ { 1 }$ . Then with probability at lease $\begin{array} { r } { 1 - 2 \exp \Big ( - \frac { \varphi ( n , M ) \epsilon _ { n } } { 1 5 6 \frac { \xi } { 1 - \xi } + 2 8 \log 2 } \Big ) } \end{array}$ , we have
+
+$$
+\mathcal { L } _ { \lambda } ( \Theta ^ { * } ; \mathcal { A } ) \leq \operatorname* { i n f } _ { \substack { \{ \Theta \in \Omega \vert K L ( \Theta ^ { * } \vert \vert \Theta ) \geq 4 \epsilon _ { n } \} } } \mathcal { L } _ { \lambda } ( \Theta ; \mathcal { A } ) - \epsilon _ { n } .
+$$
+
+209 Proposition 1 basically states that any estimators with sufficiently small objective value should
+210 be close enough to $\Theta ^ { * }$ in terms of $K \dot { L } ( \Theta ^ { * } | | \Theta )$ . We next study the asymptotic behavior of these
+211 estimators more precisely. Let $( \hat { \alpha } , \hat { \beta } ) \in \Omega _ { \alpha } \times \Omega _ { \beta }$ be any estimator of $( \alpha ^ { * } , \beta ^ { * } )$ such that
+
+$$
+\begin{array} { r } { \mathcal L _ { \lambda } ( \hat { \alpha } , \hat { \beta } ; \mathcal A ) \le \mathcal L _ { \lambda } ( \alpha ^ { * } , \beta ^ { * } ; \mathcal A ) + \epsilon _ { n } , } \end{array}
+$$
+
+and denote 212 $\widehat { \Theta } = \mathcal { T } \times _ { 1 } \hat { \alpha } \times _ { 2 } \hat { \alpha } \times _ { 3 } \hat { \beta }$ . we have the following theorem.
+
+Theorem 1. Under the condition of Proposition $^ { l }$ , $i f \left( { \hat { \alpha } } , { \hat { \beta } } \right)$ satisfies (8), then with probability at least $\begin{array} { r } { 1 - 2 \exp \Big ( - \frac { \varphi ( n , M ) \epsilon _ { n } } { 1 5 6 \frac { \xi } { 1 - \xi } + 2 8 \log 2 } \Big ) } \end{array}$ , we have
+
+$$
+\frac { 1 } { n \sqrt { M } } \| \widehat { \Theta } - \Theta ^ { * } \| _ { F } \leq \frac { 4 \sqrt { 2 } \sqrt { \epsilon _ { n } } } { ( 1 - \xi ) \sqrt { \xi s _ { n } } } .
+$$
+
+213 The condition that $\lambda _ { n } J ( \Theta ^ { * } ) ~ \le ~ \epsilon _ { n }$ in Proposition 1 is mild. It implies that the true em
+214 beddings of vertices within the same community are close to one another. We remark that
+215 $\lambda _ { n } J ( \Theta ^ { * } )$ exactly equals to zero under the MLSBM discussed in Section 2.2. The condition that
+216 $( n + M ) R \varphi ^ { - 1 } ( n , M ) \epsilon _ { n } ^ { - 1 } \log ( \epsilon _ { n } ^ { - 1 / 2 } )$ vanishes with $n$ is also mild. When $R = O ( 1 )$ , we can take any
+217 ϵn such that ϵn ≫ log nn min{n,M} . Consequently, to ensure $\widehat { \Theta }$ converges to $\Theta ^ { * }$ , Theorem 1 implies the
+218 smallest sparsity factor one can take is $\begin{array} { r } { s _ { n } \gg \epsilon _ { n } \gg \frac { \log n } { n \operatorname* { m i n } \{ n , M \} } } \end{array}$ log nn min{n,M} , which means that the average degree
+219 of a vertex in any particular layer can be as small as $n s _ { n }$ . We remark that a common assumption
+220 $M = O ( n )$ that appears in literature, such as [27] and [22], is not necessary in our theory. If we
+221 further assume $\bar { M } \stackrel { } { = } O ( n )$ , we find that the average degree of a vertex in any layer under the
+222 proposed TLSM set up can be smaller than that in [27] by a factor $( M \log n ) ^ { - 1 / 2 }$ and in [22] by a
+223 factor $( \log n ) ^ { - 3 }$ , showing that our theoretical result accommodates sparser multi-layer networks.
+
+# 3.2 Consistency in community detection
+
+We now turn to establish the consistency of community detection in multi-layer network $\mathcal { G }$ . Let $\psi ^ { * } : [ n ] \ \longrightarrow \ [ K ]$ be the true community assignment function such that $\begin{array} { r l } { \psi ^ { * } } & { { } = } \end{array}$ $\begin{array} { r l } & { \arg \operatorname* { m i n } _ { \psi } \operatorname* { m i n } _ { C _ { 1 } , \ldots , C _ { K } } \sum _ { i = 1 } ^ { n } \| \pmb { \alpha } _ { i } ^ { * } - C _ { \psi _ { i } } \| ^ { 2 } } \end{array}$ , and then the community detection error of any estimated community assignment function $\hat { \psi }$ can be evaluated by the minimum scaled Hamming distance between $\hat { \psi }$ and $\psi ^ { * }$ under permutations, which is defined as
+
+$$
+\operatorname { e r r } ( \psi ^ { * } , \hat { \psi } ) = \operatorname* { m i n } _ { \pi \in S _ { K } } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathbf { 1 } \{ \psi _ { i } ^ { * } \neq \pi ( \hat { \psi } _ { i } ) \} ,
+$$
+
+230 where $\mathbf { 1 } \{ \cdot \}$ is the indicator function and $S _ { K }$ is the symmetric group of degree $K$ . Such a scaled
+231 or unscaled Hamming distance has become a popular metric in quantifying the performance of
+232 community detection [21, 22].
+233 Denote $N _ { k } ^ { * } = \{ i : \psi _ { i } ^ { * } = k \}$ be the $k$ -th true underlying community whose cardinality is $n _ { k }$ . Let
+234 $C ^ { * } \in \mathbb { R } ^ { K \times R }$ be the true underlying community centers of the network embedding with $C _ { k . } ^ { * } =$
+235 $\begin{array} { r } { \frac { 1 } { n _ { k } } \sum _ { \psi _ { i } ^ { * } = k } \alpha _ { i . } ^ { * } } \end{array}$ , and let $\pmb { \mathcal { B } } ^ { \ast } = \pmb { \mathcal { T } } \times _ { 1 } \pmb { C } ^ { \ast } \times _ { 2 } \pmb { C } ^ { \ast } \times _ { 3 } \pmb { \beta } ^ { \ast }$ . The following assumptions are made to ensure
+236 that communities within the multi-layer networks are asymptotically identifiable.
+
+Assumption A. Assume the difference between any two distinct horizontal slides of 37 ${ \pmb { \beta } } ^ { * }$ satisfies that
+
+$$
+\operatorname* { m i n } _ { k , k ^ { \prime } \in [ K ] , k \neq k ^ { \prime } } \frac { 1 } { \sqrt { K M } } \| \pmb { \mathscr { B } } _ { k , . , . } ^ { * } - \pmb { \mathscr { B } } _ { k ^ { \prime } , . , . } ^ { * } \| _ { F } \geq \gamma _ { n } ,
+$$
+
+238 where $\gamma _ { n } > 0$ may vanish with $n$
+
+Assumption B. Assume the tuning parameter $\lambda _ { n }$ satisfies that
+
+$$
+\begin{array} { r } { \lambda _ { n } \epsilon _ { n } s _ { n } ^ { - 2 } ( \log s _ { n } ^ { - 1 } ) ^ { - 1 } \geq c _ { 2 } , } \end{array}
+$$
+
+for an absolute constant $c _ { 2 }$ that does not depend on any model parameter.
+
+Assumption C. Denote $n _ { \mathrm { m i n } } = \mathrm { m i n } _ { k \in [ K ] } n _ { k }$ as the minimal community size. Assume
+
+$$
+\frac { \gamma _ { n } n _ { \mathrm { m i n } } \sqrt { \cal K } } { n } \geq c _ { \xi } \sqrt { \frac { \epsilon _ { n } } { s _ { n } } } ,
+$$
+
+where cξ =240 $\begin{array} { r } { c _ { \xi } = \frac { 4 \sqrt 2 } { ( 1 - \xi ) \sqrt \xi } + c _ { 3 } \sqrt { \frac { ( 1 + \delta ) \operatorname* { m i n } \{ M , R \} } { M } } } \end{array}$ and $c _ { 3 }$ is a constant that depends on $\xi$ only.
+
+241 Assumption A is the minimal community separation requirement, and similar assumption has been
+242 employed in [27] with a constant $\gamma _ { n }$ . Together with the condition $\lambda _ { n } J ( \alpha ^ { * } ) \leq \epsilon _ { n }$ in Proposition 1,
+243 Assumption B gives a feasible interval for $\lambda _ { n }$ . Assumption $\textrm { C }$ allows for unbalanced communities
+244 with vanishing $n _ { \mathrm { m i n } } / n$ if the network is not too sparse. Note that $c _ { \xi }$ can be further bounded by
+245 $\begin{array} { r } { \frac { 4 \sqrt { 2 } } { ( 1 - \xi ) \sqrt { \xi } } + c _ { 3 } \sqrt { 1 + \delta } } \end{array}$ , and the first term of $c _ { \xi }$ will dominate the second term if $R = o ( M )$ .
+
+Theorem 2. Suppose all the assumptions in Theorem $^ { l }$ as well as Assumptions $A , B$ and $C$ are satisfied, it holds true that
+
+$$
+e r r ( \psi ^ { * } , \hat { \psi } ) \leq \frac { c _ { \xi } ^ { 2 } n \epsilon _ { n } } { n _ { \mathrm { m i n } } K \gamma _ { n } ^ { 2 } s _ { n } } ,
+$$
+
+with probability at least 246 $\begin{array} { r } { 1 - \frac { 1 } { n ^ { 2 } } - 2 \exp \Big ( - \frac { \varphi ( n , M ) \epsilon _ { n } } { 1 5 6 \frac { \xi } { 1 - \xi } + 2 8 \log 2 } \Big ) . } \end{array}$
+
+Theorem 2 assures that the community structure in a multi-layer network can be consistently recovered by the proposed TLSM. As a theoretical example, we consider a sparse case with $\begin{array} { r } { s _ { n } = \dot { \frac { ( \log n ) ^ { 1 + \tau _ { 1 } } } { n \operatorname* { m i n } \{ n , M \} } } } \end{array}$ , where $0 < \tau _ { 1 } < 1$ , $n _ { \mathrm { m a x } } = O ( n _ { \mathrm { m i n } } )$ , $\begin{array} { r } { \frac { 1 } { \sqrt { n } } | | \alpha ^ { * } - Z ^ { * } C ^ { * } | | _ { F } \leq ( \log n ) ^ { - 3 / 2 } } \end{array}$ , and both $\gamma _ { n }$ , $R$ and $K$ are of constant orders. With $\begin{array} { r } { \lambda _ { n } = \frac { ( \log n ) ^ { 2 + 2 \tau _ { 1 } } } { n \operatorname* { m i n } \{ n , M \} } } \end{array}$ , Theorems 1 and 2 imply that $\begin{array} { r } { \epsilon _ { n } = \frac { ( \log n ) ^ { 1 + \tau _ { 2 } } } { n \operatorname* { m i n } \{ n , M \} } } \end{array}$ with $0 < \tau _ { 2 } < \tau _ { 1 }$ and $e r r ( \psi ^ { * } , \hat { \psi } ) = o _ { p } ( 1 )$ .
+
+# 52 4 Numerical experiments
+
+In this section, we evaluate the numerical performance of the proposed TLSM in a variety of synthetic as well as real-life multi-layer networks, compare it against four competitors in literature, including the mean adjacency spectral embeddings (MASE; 16), least square estimation (LSE; 27), Tucker decomposition with HOSVD initialization (HOSVD-Tucker; 22), and spectral kernel (SPECK; 35), and conduct some ablation studies. The implementations of LSE and SPECK are available at the authors’ personal websites, HOSVD-Tucker is implemented in the routine “tucker" of the Python package “tensorly", and TLSM and MASE are implemented in Python by ourselves.
+
+# 4.1 Synthetic networks
+
+The multi-layer network $\mathcal { A } = ( a _ { i , j , m } ) \in \{ 0 , 1 \} ^ { n \times n \times M }$ is generated as follows. First, we randomly select $K = 4$ elements uniformly from $\{ 2 . 5 * ( b _ { 1 } , b _ { 2 } , \ldots , b _ { R } ) : b _ { r } \in \{ - 1 , 1 \} , r \in [ R ] \}$ as community centers, which are denoted as $c _ { k }$ , $k \in [ K ]$ . Second, the latent space embedding of vertex $i$ is generated as $\pmb { \alpha } _ { i } = \pmb { c } _ { \psi _ { i } } + \pmb { e } _ { i }$ with $\pmb { e } _ { i } \sim N ( \mathbf { 0 } _ { R } , 1 . 5 * I _ { R } )$ , and $\psi _ { i } \in [ K ]$ are independently drawn from the multinomial distribution $\mathbf { M u l t i } ( 1 ; \frac { 1 } { K } \mathbf { 1 } _ { K } )$ . Third, we generate $\beta = [ \beta _ { 1 } , \ldots , \beta _ { M } ] ^ { T }$ with $\beta _ { m , r }$ being independent standard normal random varibeles, for $m \in [ M ]$ and $r \in [ R ]$ . We then rescale the column norms of $\beta$ to be 1 for model identifiability. Finally, we generate $\mathcal { A }$ according to the proposed TLSM with $s _ { n } = 0 . 1$ . For the sake of fair comparisons, the embedding dimension $R$ is set as $K$ in all scenarios. We aim to illustrate the community detection performance of all methods as the number of vertices and number of layers increase. To this end, we consider $( n , M ) \in \{ 2 0 0 , 4 0 0 , 6 0 0 , 8 0 0 \} \times \{ 5 , 1 0 , 1 5 , 2 0 \}$ . The averaged hamming errors and their standard errors over 50 independent experiments of all methods are reported in Table 1.
+
+273 It is evident that TLSM consistently outperforms its competitors, and the performances of LSE
+274 and HOSVD-Tucker are better than those of MASE and SPECK. This is expected since TLSM,
+275 LSE and HOSVD-Tucker work on the multi-layer network adjacency tensor directly, while MASE
+276 and SPECK are matrix aggregation methods that suffer form information loss. Furthermore, as the
+277 number of vertices and number of layers increase, the community detection errors of all methods
+278 decrease rapidly. Notably, TLSM and LSE converge faster than the other methods, and attain stable
+279 performance even for relatively small $n$ and $M$ . Additional simulation studies for various network
+280 sparsity and unbalanced community sizes are relegated to Appendix C in the supplementary materials.
+
+# 4.2 Real-life networks
+
+282 We also apply the proposed TLSM method to analyze three real-life multi-layer networks, including
+283 a social network in the department of Computer Science at Aarhus University (AUCS) [38], a yeast
+284 Saccharomyces cerevisiae gene co-expression (YSCGC) network [44], and a worldwide agriculture
+285 trading network (WAT) [10]. Specifically, we conduct community detection on the first two networks
+286 whose vertex community memberships are available, and carry out a link prediction task on the third
+287 network whose vertex community memberships are unavailable.
+
+Table 1: The averaged hamming errors of various methods with their standard errors in Scenario I. The best performer in each case is bold-faced.
+
+
n
M
TLSM
LSE
MASE
HOSVD-Tucker
SPECK
200
5
0.1180(0.0147)
0.1405(0.0118)
0.5086(0.0136)
0.1623(0.0126)
0.4254(0.0138)
10
0.0585(0.0046)
0.0751(0.0050)
0.4949(0.0131)
0.1148(0.0106)
0.2996(0.0141)
15
0.0551(0.0067)
0.0593(0.0045)
0.4910(0.0176)
0.1040(0.0115)
0.2505(0.0142)
20
0.0510(0.0037)
0.0588(0.0043)
0.4977(0.0161)
0.1023(0.0110)
0.1942(0.0156)
400
5
0.0653(0.0066)
0.1019(0.0087)
0.3845(0.0193)
0.1220(0.0106)
0.3766(0.0195)
10
0.0608(0.0063)
0.0636(0.0037)
0.3859(0.0160)
0.1012(0.0092)
0.2244(0.0191)
15
0.0511(0.0031)
0.0595(0.0036)
0.3844(0.0221)
0.0787(0.0051)
0.1490(0.0123)
20
0.0536(0.0047)
0.0551(0.0036)
0.3985(0.0185)
0.0795(0.0063)
0.1409(0.0131)
600
5
0.0607(0.0029)
0.0909(0.0040)
0.3665(0.0186)
0.1221(0.0108)
0.3038(0.0193)
10
0.0567(0.0029)
0.0688(0.0031)
0.3726(0.0179)
0.1003(0.0081)
0.1651(0.0127)
15
0.0558(0.0027)
0.0630(0.0030)
0.3803(0.0167)
0.0918(0.0076)
0.1231(0.0076)
20
0.0548(0.0028)
0.0586(0.0029)
0.3814(0.0185)
0.0883(0.0078)
0.1150(0.0088)
800
5
0.0556(0.0056)
0.0768(0.0055)
0.3012(0.0194)
0.1003(0.0103)
0.2733(0.0171)
10
0.0560(0.0063)
0.0583(0.0034)
0.3004(0.0177)
0.0788(0.0065)
0.1424(0.0127)
15
0.0498(0.0030)
0.0539(0.0033)
0.3179(0.0195)
0.0812(0.0068)
0.1146(0.0098)
20
0.0485(0.0031)
0.0516(0.0032)
0.3184(0.0218)
0.0803(0.0075)
0.0979(0.0078)
+
+The AUCS dataset is publicly available at http://multilayer.it.uu.se/datasets.html, and it is a $6 1 \times 6 1 \times 5$ multi-layer network that records pairwise relationships of 5 types among 61 persons in AUCS, including current working relationships, repeated leisure activities, regularly eating lunch together, co-authorship of a publication, and friendship on Facebook. Since 54 persons in the dataset come from 7 research groups and the other 7 persons do not belong to any group, the dataset consists of 8 communities corresponding to 7 research groups and an outlier community. Applying TLSM and its competitors to the dataset, the number of misclassified vertices by TLSM, LSE, MASE, HOSVD-Tucker and SPECK, are 8, 21, 19, 23, 18, respectively. Clearly, TLSM significantly outperforms its competitors by at least reducing $1 6 . 3 9 \%$ of community detection error.
+
+The YSCGC dataset is publicly available at https://www.ncbi.nlm.nih.gov/pmc/articles/ $\mathtt { P M C 1 5 6 5 9 0 } /$ , and contains 205 genes of 4 functional categories, including protein metabolism and modification, carbohydrate metabolism and catabolism, nucleobase, nucleoside, nucleotide and nucleic acide metabolism, as well as transportation. We regard these four functional category labels as the community memberships of the genes. Further, the gene expression responses are measured by 20 systematic perturbations with varying genetic and environmental conditions in 4 replicated hybridizations. We thus constructed a gene co-expression network $\mathcal { A } = ( a _ { i , j , m } ) \in$ $\mathbb { R } ^ { 2 0 \bar { 5 } \times 2 0 5 \times 4 }$ based on the similarities of their expressions, where each layer represents one replicated hybridization. Specifically, the similarity between genes $i$ and $j$ in the $m$ -th replication is measured by $w _ { i , j , m } = \mathrm { e x p } \big ( - \| \pmb { x } _ { i } ^ { ( m ) } - \pmb { x } _ { j } ^ { ( m ) } \| \big )$ , where $\pmb { x } _ { i } ^ { ( m ) } \in \mathbb { R } ^ { 2 0 }$ contains the expression levels of 20 perturbations in the $m$ -th replicated hybridization for $i \in [ 2 0 5 ]$ and $m \in [ 4 ]$ . The binary value $a _ { i , j , m }$ is obtained by thresholding $w _ { i , j , m }$ with the thresholding value being the $60 \%$ quantile of all elements in $\{ w _ { i , j , m } : i \le j \in [ 2 0 5 ] , m \in [ 4 ] \}$ . Applying TLSM and its competitors to this dataset, the number of misclassified vertices by TLSM, LSE, MASE, HOSVD-Tucker and SPECK, are 6, 9, 12, 48, 13, respectively. TLSM again outperforms its competitors in this YSCGC dataset.
+
+312 The WAT dataset is publicly available at http://www.fao.org, and includes 364 agriculture
+313 product trading relationships among 214 countries in 2010. To process the data, we extract 130 major
+314 countries whose average degrees are greater than 9 from the 32 densest connected agriculture product
+315 trading relations, leading to a $1 3 0 \times 1 3 0 \times 3 2$ multi-layer network. Investigating the eigen-structure
+316 of the mode-1 matricization of the network adjacency tensor, we identify an elbow point [20] at the
+317 7th largest eigen-value, suggesting there are 6 potential communities among the countries, and thus
+318 we set $K = 6$ . The corresponding eigen-value plot is attached in Appendex D of the supplementary
+319 materials. We then randomly selected $8 0 \%$ of the entries of the adjacency tensor as the training set,
+320 and conduct link prediction on the remaining $2 0 \%$ of the entries. Specifically, we employ TLSM
+321 and the adaptations of its competitors to estimate the network expected tensor $\mathcal { P }$ and generate
+322 estimations for the missing entries by independent Bernoulli random variables accordingly. The
+323 averaged link prediction accuracy of TLSM, LSE, MASE, HOSVD-Tucker and SPECK over 50
+324 independent replications are $7 9 . 6 0 \%$ , $7 6 . 6 6 \%$ , $7 5 . 9 6 \%$ , $7 7 . 7 8 \%$ and $7 9 . 0 8 \%$ , respectively, where the
+325 link prediction accuracy is defined as the percentile of the correctly predicted entries. Clearly, all 5
+326 methods are comparative in terms of link prediction, while TLSM still deliver highest averaged link
+327 prediction accuracy.
+
+# 328 4.3 Ablation studies
+
+In this subsection, we carry out some ablation studies on two novel components of the proposed method, namely the sparsity factor $s _ { n }$ and the community-inducing regularizer $J ( \alpha )$ . To study the effectiveness of $s _ { n }$ , we generate a $3 0 0 \times 3 0 0 \times 5$ multi-layer network with 3 communities and the true network sparsity $s _ { n } = 0 . 3$ . The blue curve in the left panel of Figure 1 shows the average Hamming error of 50 independent replications given by the proposed method when employing $\hat { s } _ { n } \in \{ 0 . 0 5 i : i \in [ 2 0 ] \}$ in the optimization algorithm, and the red line indicates the averaged Hamming error of the proposed method with $\hat { s } _ { n }$ estimated via the proposed data-adapted estimation scheme. It is clear that the Hamming error at $s _ { n } = 1$ is much larger than that when $s _ { n }$ is close to 0.3, showing the advantages of the modified logit transformation by $s _ { n }$ over the standard logit transformation when the network indeed reveals sparse pattern. Moreover, we observe that the red line is even lower than the minimum Hamming error in the blue curve. This further confirms the effectiveness of the proposed data-adapted estimation scheme for estimating $s _ { n }$ .
+
+
+Figure 1: Ablation studies on $s _ { n }$ (left) and community-inducing regularizer (right).
+
+341 To study the effectiveness of the community-inducing regularizer in the proposed objective function,
+342 we generate an $n \times n \times 5$ multi-layer network with 2 communities, for $\overline { { n } } \in \{ 5 0 , 1 0 \mathrm { { 0 } } , 2 0 0 , 4 0 0 \}$ . In
+343 the right panel of Figure 1, the black pillars indicate the network estimation error $\frac { 1 } { n \sqrt { 5 } } \| \widehat { \Theta } - \Theta ^ { * } \| _ { F }$
+344 given by the proposed method with $\lambda _ { n } = 0$ which corresponds to the absence of $J ( \alpha )$ , while the
+345 red ones indicate the counterparts given by the proposed method with $\lambda _ { n }$ is selected by network
+346 cross-validation. There is a clear improvement when the community-inducing regularizer is enforced
+347 in all scenarios, particularly for small $n$ . This showcases the helpfulness of the community-inducing
+348 regularizer in detecting network community structure.
+
+# 349 5 Conclusions
+
+50 In this paper, we propose a novel tensor-based latent space model for community detection in
+51 multi-layer networks. The model embeds vertices into a low-dimensional latent space and views
+52 the community structure from an network embedding perspective, so that heterogeneous structures
+53 in different network layers can be properly integrated. The proposed model is formulated as a
+54 regularization framework, which conducts multi-layer network estimation and community detection
+55 simultaneously. The advantages of the proposed method are supported by extensive numerical
+56 experiments and theoretical results. Particularly, the asymptotic consistencies of the proposed method
+57 are established in terms of both multi-layer network estimation and community detection, even for
+58 relatively sparse networks.
+
+359 References [1] Luiz GA Alves, Giuseppe Mangioni, Isabella Cingolani, Francisco Aparecido Rodrigues, Pietro Panzarasa, and Yamir Moreno. The nested structural organization of the worldwide trade multi-layer network. Scientific reports, 9(1):1–14, 2019. [2] Jesús Arroyo, Avanti Athreya, Joshua Cape, Guodong Chen, Carey E Priebe, and Joshua T Vogelstein. Inference for multiple heterogeneous networks with a common invariant subspace. Journal of Machine Learning Research, 22(142):1–49, 2021. [3] Avanti Athreya, Donniell E Fishkind, Minh Tang, Carey E Priebe, Youngser Park, Joshua T Vogelstein, Keith Levin, Vince Lyzinski, and Yichen Qin. Statistical inference on random dot product graphs: a survey. The Journal of Machine Learning Research, 18(1):8393–8484, 2017. [4] Matteo Barigozzi, Giorgio Fagiolo, and Giuseppe Mangioni. Identifying the community structure of the international-trade multi-network. Physica A: statistical mechanics and its applications, 390(11):2051–2066, 2011. [5] Michele Berlingerio, Fabio Pinelli, and Francesco Calabrese. Abacus: frequent pattern miningbased community discovery in multidimensional networks. Data Mining and Knowledge Discovery, 27(3):294–320, 2013. [6] Sharmodeep Bhattacharyya and Shirshendu Chatterjee. Spectral clustering for multiple sparse networks: I. arXiv preprint arXiv:1805.10594, 2018. [7] Han Chen, Garvesh Raskutti, and Ming Yuan. Non-convex projected gradient descent for generalized low-rank tensor regression. Journal of Machine Learning Research, 20:1–37, 2019. [8] Zitai Chen, Chuan Chen, Zibin Zheng, and Yi Zhu. Tensor decomposition for multilayer networks clustering. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 3371–3378, 2019. [9] Eric C Chi, Brian R Gaines, Will Wei Sun, Hua Zhou, and Jian Yang. Provable convex co-clustering of tensors. Journal of Machine Learning Research, 21(214):1–58, 2020. [10] Manlio De Domenico, Vincenzo Nicosia, Alexandre Arenas, and Vito Latora. Structural reducibility of multilayer networks. Nature communications, 6(1):1–9, 2015.
+386 [11] Lieven De Lathauwer, Bart De Moor, and Joos Vandewalle. On the best rank-1 and rank-(r 1, r 2,..., rn) approximation of higher-order tensors. SIAM journal on Matrix Analysis and Applications, 21(4):1324–1342, 2000. [12] Xiaowen Dong, Pascal Frossard, Pierre Vandergheynst, and Nikolai Nefedov. Clustering with multi-layer graphs: A spectral perspective. IEEE Transactions on Signal Processing, 60(11):5820–5831, 2012. [13] Junxian Geng, Anirban Bhattacharya, and Debdeep Pati. Probabilistic community detection with unknown number of communities. Journal of the American Statistical Association, 114(526):893–905, 2019.
+395 [14] Mahsa Ghorbani, Mahdieh Soleymani Baghshah, and Hamid R Rabiee. Mgcn: semi-supervised classification in multi-layer graphs with graph convolutional networks. In Proceedings of the 2019 IEEE/ACM International Conference on Advances in Social Networks Analysis and Mining, pages 208–211, 2019. [15] Derek Greene and Pádraig Cunningham. Producing a unified graph representation from multiple social network views. In Proceedings of the 5th annual ACM web science conference, pages 118–121, 2013. [16] Qiuyi Han, Kevin Xu, and Edoardo Airoldi. Consistent estimation of dynamic and multi-layer block models. In International Conference on Machine Learning, pages 1511–1520. PMLR, 2015. [17] Xin He, Qiong Liu, and You Yang. Mv-gnn: Multi-view graph neural network for compression artifacts reduction. IEEE Transactions on Image Processing, 29:6829–6840, 2020.
+[18] Peter D Hoff, Adrian E Raftery, and Mark S Handcock. Latent space approaches to social network analysis. Journal of the American Statistical Association, 97(460):1090–1098, 2002.
+[19] Paul W Holland, Kathryn Blackmond Laskey, and Samuel Leinhardt. Stochastic blockmodels: First steps. Social networks, 5(2):109–137, 1983.
+[20] Pengsheng Ji and Jiashun Jin. Coauthorship and citation networks for statisticians. The Annals of Applied Statistics, 10(4):1779–1812, 2016.
+[21] Jiashun Jin. Fast community detection by score. Ann. Statist., 43(1):57–89, 02 2015.
+[22] Bing-Yi Jing, Ting Li, Zhongyuan Lyu, and Dong Xia. Community detection on mixture multilayer networks via regularized tensor decomposition. The Annals of Statistics, 49(6):3181– 3205, 2021.
+[23] Muhammad Raza Khan and Joshua E Blumenstock. Multi-gcn: Graph convolutional networks for multi-view networks, with applications to global poverty. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 606–613, 2019.
+[24] Tamara G. Kolda and Brett W. Bader. Tensor decompositions and applications. SIAM Review, 51:455–500, 2009.
+[25] Joseph B Kruskal. Three-way arrays: rank and uniqueness of trilinear decompositions, with application to arithmetic complexity and statistics. Linear algebra and its applications, 18(2):95– 138, 1977.
+[26] Jing Lei. Tail bounds for matrix quadratic forms and bias adjusted spectral clustering in multi-layer stochastic block models. arXiv preprint arXiv:2003.08222, 2020.
+[27] Jing Lei, Kehui Chen, and Brian Lynch. Consistent community detection in multi-layer network data. Biometrika, 107(1):61–73, 2020.
+[28] Jing Lei and Alessandro Rinaldo. Consistency of spectral clustering in stochastic block models. The Annals of Statistics, 43(1):215–237, 2015.
+[29] Dong Li, Zhisong Pan, Guyu Hu, Graham Anderson, and Shan He. Active module identification from multilayer weighted gene co-expression networks: a continuous optimization approach. IEEE/ACM transactions on computational biology and bioinformatics, 2020.
+[30] Tianxi Li, Elizaveta Levina, and Ji Zhu. Network cross-validation by edge sampling. Biometrika, 107(2):257–276, 2020.
+[31] Xueming Liu, Enrico Maiorino, Arda Halu, Kimberly Glass, Rashmi B Prasad, Joseph Loscalzo, Jianxi Gao, and Amitabh Sharma. Robustness and lethality in multilayer biological molecular networks. Nature communications, 11(1):1–12, 2020.
+[32] Zhongyuan Lyu, Dong Xia, and Yuan Zhang. Latent space model for higher-order networks and generalized tensor decomposition. arXiv preprint arXiv:2106.16042, 2021.
+[33] Zhuang Ma, Zongming Ma, and Hongsong Yuan. Universal latent space model fitting for large networks with edge covariates. Journal of Machine Learning Research, 21(4):1–67, 2020.
+[34] Subhadeep Paul and Yuguo Chen. Consistent community detection in multi-relational data through restricted multi-layer stochastic blockmodel. Electronic Journal of Statistics, 10(2):3807–3870, 2016.
+[35] Subhadeep Paul and Yuguo Chen. Spectral and matrix factorization methods for consistent community detection in multi-layer networks. Ann. Statist., 48(1):230–250, 02 2020.
+[36] Subhadeep Paul and Yuguo Chen. Null models and community detection in multi-layer networks. Sankhya A, pages 1–55, 2021.
+[37] Zhuo-Ming Ren, An Zeng, and Yi-Cheng Zhang. Bridging nestedness and economic complexity in multilayer world trade networks. Humanities and Social Sciences Communications, 7(1):1–8, 2020.
+[38] Luca Rossi and Matteo Magnani. Towards effective visual analytics on multiplex and multilayer networks. Chaos, Solitons & Fractals, 72:68–76, 2015.
+[39] Uday Shankar Shanthamallu, Jayaraman J Thiagarajan, Huan Song, and Andreas Spanias. Gramme: Semisupervised learning using multilayered graph attention models. IEEE transactions on neural networks and learning systems, 31(10):3977–3988, 2019.
+[40] Nicholas D Sidiropoulos and Rasmus Bro. On the uniqueness of multilinear decomposition of n-way arrays. Journal of Chemometrics: A Journal of the Chemometrics Society, 14(3):229–239, 2000.
+[41] Wei Tang, Zhengdong Lu, and Inderjit S Dhillon. Clustering with multiple graphs. In 2009 Ninth IEEE International Conference on Data Mining, pages 1016–1021. IEEE, 2009.
+[42] Edwin JCG Van Den Oord and Ronan Van Rossem. Differences in first graders’ school adjustment: The role of classroom characteristics and social structure of the group. Journal of School Psychology, 40(5):371–394, 2002.
+[43] James D Wilson, John Palowitch, Shankar Bhamidi, and Andrew B Nobel. Community extraction in multilayer networks with heterogeneous community structure. The Journal of Machine Learning Research, 18(1):5458–5506, 2017.
+[44] Ka Yee Yeung, Mario Medvedovic, and Roger E Bumgarner. Clustering gene-expression data with repeated measurements. Genome biology, 4(5):1–17, 2003.
+[45] Yubai Yuan and Annie Qu. Community detection with dependent connectivity. The Annals of Statistics, 49(4):2378–2428, 2021.
+[46] Jingfei Zhang, Will Wei Sun, and Lexin Li. Network response regression for modeling population of networks with covariates. arXiv preprint arXiv:1810.03192, 2018.
+[47] Xuefei Zhang, Songkai Xue, and Ji Zhu. A flexible latent space model for multilayer networks. In International Conference on Machine Learning, pages 11288–11297. PMLR, 2020.
+[48] Yunpeng Zhao, Elizaveta Levina, and Ji Zhu. Consistency of community detection in networks under degree-corrected stochastic block models. The Annals of Statistics, 40(4):2266–2292, 2012.
+[49] Wei Zheng, Dingjie Wang, and Xiufen Zou. Control of multilayer biological networks and applied to target identification of complex diseases. BMC bioinformatics, 20(1):1–12, 2019.
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] See the abstract and the third paragrath of the introduction.
+(b) Did you describe the limitations of your work? [Yes] The optimization algorithm can only be guaranteed to converge to a stationary point.
+(c) Did you discuss any potential negative societal impacts of your work? [No] There should be no negative societal impacts.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 3. (b) Did you include complete proofs of all theoretical results? [Yes] All technical proofs are provided in Appendix E of the supplementary materials.
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] The URLs for data are included in Section 4.2, and codes with instructions are included in the supplementary materials.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 2.3 and Appendix B in the supplementary materials.
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] We show the standard erros in Table 1 and $9 5 \%$ confident intervals of additional simulation studies in Appendix C in the supplementary materials.
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [No]
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes] We used publicly available datasets and cite the creators.
+(b) Did you mention the license of the assets? [Yes] All datasets we used are publicly available.
+(c) Did you include any new assets either in the supplemental material or as a URL? [No]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] All data we used do not contains personally identifiable information or offensive content.
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/tq_J_MqB3UB/tq_J_MqB3UB.md b/md/dev/tq_J_MqB3UB/tq_J_MqB3UB.md
new file mode 100644
index 0000000000000000000000000000000000000000..39ff3ced56fbcd99af466ac2c7c0fb54da70c444
--- /dev/null
+++ b/md/dev/tq_J_MqB3UB/tq_J_MqB3UB.md
@@ -0,0 +1,337 @@
+# Diverse Weight Averaging for Out-of-Distribution Generalization
+
+Alexandre Ramé1,\*, Matthieu Kirchmeyer1,2,\*
+Thibaud Rahier2, Alain Rakotomamonjy2,4, Patrick Gallinari1,2, Matthieu Cord1,3
+1Sorbonne Université, CNRS, ISIR, F-75005 Paris, France 2Criteo AI Lab, Paris, France 3Valeo.ai, Paris, France 4Université de Rouen, LITIS, France \*Equal contribution
+
+# Abstract
+
+Standard neural networks struggle to generalize under distribution shifts in computer vision. Fortunately, combining multiple networks can consistently improve out-of-distribution generalization. In particular, weight averaging (WA) strategies were shown to perform best on the competitive DomainBed benchmark; they directly average the weights of multiple networks despite their nonlinearities. In this paper, we propose Diverse Weight Averaging (DiWA), a new WA strategy whose main motivation is to increase the functional diversity across averaged models. To this end, DiWA averages weights obtained from several independent training runs: indeed, models obtained from different runs are more diverse than those collected along a single run thanks to differences in hyperparameters and training procedures. We motivate the need for diversity by a new bias-variance-covariancelocality decomposition of the expected error, exploiting similarities between WA and standard functional ensembling. Moreover, this decomposition highlights that WA succeeds when the variance term dominates, which we show occurs when the marginal distribution changes at test time. Experimentally, DiWA consistently improves the state of the art on DomainBed without inference overhead.
+
+# 1 Introduction
+
+Learning robust models that generalize well is critical for many real-world applications [1, 2]. Yet, the classical Empirical Risk Minimization (ERM) lacks robustness to distribution shifts [3, 4, 5]. To improve out-of-distribution (OOD) generalization in classification, several recent works proposed to train models simultaneously on multiple related but different domains [6]. Though theoretically appealing, domain-invariant approaches [7] either underperform [8, 9] or only slightly improve [10, 11] ERM on the reference DomainBed benchmark [12]. The state-of-the-art strategy on DomainBed is currently to average the weights obtained along a training trajectory [13]. [14] argues that this weight averaging (WA) succeeds in OOD because it finds solutions with flatter loss landscapes.
+
+In this paper, we show the limitations of this flatness-based analysis and provide a new explanation for the success of WA in OOD. It is based on WA’s similarity with ensembling [15], a well-known strategy to improve robustness [16, 17], that averages the predictions from various models. Based on [18], we present a bias-variance-covariance-locality decomposition of WA’s expected error. It contains four terms: first the bias that we show increases under shift in label posterior distributions (i.e., correlation shift [19]); second, the variance that we show increases under shift in input marginal distributions (i.e., diversity shift [19]); third, the covariance that decreases when models are diverse; finally, a locality condition on the weights of averaged models.
+
+Based on this analysis, we aim at obtaining diverse models whose weights are averageable with our Diverse Weight Averaging (DiWA) approach. In practice, DiWA averages in weights the models obtained from independent training runs that share the same initialization. The motivation is that those models are more diverse than those obtained along a single run [20, 21]. Yet, averaging the weights of independently trained networks with batch normalization [22] and ReLU layers [23] may be counter-intuitive. Such averaging is efficient especially when models can be connected linearly in the weight space via a low loss path. Interestingly, this linear mode connectivity property [24] was empirically validated when the runs start from a shared pretrained initialization [25]. This insight is at the heart of DiWA but also of other recent works [26, 27, 28], as discussed in Section 6.
+
+In summary, our main contributions are the following:
+
+• We propose a new theoretical analysis of WA for OOD based on a bias-variance-covariancelocality decomposition of its expected error (Section 2). By relating correlation shift to its bias and diversity shift to its variance, we show that WA succeeds under diversity shift. • We empirically tackle the covariance term by increasing the diversity across models averaged in weights. In our DiWA approach, we decorrelate their training procedures: in practice, these models are obtained from independent runs (Section 3). We then empirically validate that diversity improves OOD performance (Section 4) and show that DiWA is state of the art on all real-world datasets from the DomainBed benchmark [12] (Section 5).
+
+# 2 Theoretical insights
+
+Under the setting described in Section 2.1, we introduce WA in Section 2.2 and decompose its expected OOD error in Section 2.3. Then, we separately consider the four terms of this bias-variancecovariance-locality decomposition in Section 2.4. This theoretical analysis will allow us to better understand when WA succeeds, and most importantly, how to improve it empirically in Section 3.
+
+# 2.1 Notations and problem definition
+
+Notations. We denote $\mathcal { X }$ the input space of images, $\mathcal { V }$ the label space and $\ell : \mathcal { V } ^ { 2 } \to \mathbb { R } _ { + }$ a loss function. $S$ is the training (source) domain with distribution $p _ { S }$ , and $T$ is the test (target) domain with distribution $p _ { T }$ . For simplicity, we will indistinctly use the notations $p _ { S }$ and $p _ { T }$ to refer to the joint, posterior and marginal distributions of $( X , Y )$ . We note $f _ { S } , f _ { T } : \mathcal { X } \to \mathcal { Y }$ the source and target labeling functions. We assume that there is no noise in the data: then $f _ { S }$ is defined on $\mathcal { X } _ { S } \ \triangleq \ \{ x \ \in \ \mathcal { X } / p _ { S } ( x ) \ > \ 0 \}$ by $\forall ( x , y ) \sim p _ { S } , f _ { S } ( x ) = y$ and similarly $f _ { T }$ is defined on $\mathcal { X } _ { T } \triangleq \{ x \in \mathcal { X } / p _ { T } ( x ) > 0 \}$ by $\forall ( x , y ) \sim p _ { T } , f _ { T } ( x ) = y$ .
+
+Problem. We consider a neural network (NN) $f ( \cdot , \theta ) : \mathcal { X } \to \mathcal { Y }$ made of a fixed architecture $f$ with weights $\theta$ . We seek $\theta$ minimizing the target generalization error:
+
+$$
+\mathcal { E } _ { T } ( \theta ) = \mathbb { E } _ { ( x , y ) \sim p _ { T } } [ \ell ( f ( x , \theta ) , y ) ] .
+$$
+
+$f ( \cdot , \theta )$ should approximate $f _ { T }$ on $\mathcal { X } _ { T }$ . However, this is complex in the OOD setup because we only have data from domain $S$ in training, related yet different from $T$ . The differences between $S$ and $T$ are due to distribution shifts (i.e., the fact that $p _ { S } ( X , Y ) \neq p _ { T } ( X , Y ) )$ which are decomposed per [19] into diversity shift (a.k.a. covariate shift), when marginal distributions differ (i.e., $p _ { S } ( { \bar { X } } ) \not = { \bar { p } } _ { T } ( X ) )$ , and correlation shift (a.k.a. concept shift), when posterior distributions differ (i.e., $p _ { S } ( Y | X ) \neq$ $p _ { T } ( Y | X )$ and $f _ { S } \neq f _ { T } ,$ ). The weights are typically learned on a training dataset $d _ { S }$ from $S$ (composed of $n _ { S }$ i.i.d. samples from $p _ { S } ( X , Y ) )$ with a configuration $c$ , which contains all other sources of randomness in learning (e.g., initialization, hyperparameters, training stochasticity, epochs, etc.). We call $l _ { S } = \{ d _ { S } , c \}$ a learning procedure on domain $S$ , and explicitly write $\theta ( l _ { S } )$ to refer to the weights obtained after stochastic minimization of $1 / n _ { S } \sum _ { ( x , y ) \in d _ { S } } \ell ( f ( x , \theta ) , y )$ w.r.t. $\theta$ under $l _ { S }$ .
+
+# 2.2 Weight averaging for OOD and limitations of current analysis
+
+Weight averaging. We study the benefits of combining $M$ individual member weights $\{ \theta _ { m } \} _ { m = 1 } ^ { M } \triangleq$ $\{ \theta ( l _ { S } ^ { ( m ) } ) \} _ { m = 1 } ^ { M }$ obtained from $M$ (potentially correlated) identically distributed (i.d.) learning procedures , {l (m)S }Mm=1 . Under conditions discussed in Section 3.2, these $M$ weights can be averaged despite nonlinearities in the architecture $f$ . Weight averaging (WA) [13], defined as:
+
+$$
+\begin{array} { r } { f _ { \mathrm { { W A } } } \triangleq f ( \cdot , \theta _ { \mathrm { { W A } } } ) , \mathrm { { w h e r e } } \theta _ { \mathrm { { W A } } } \triangleq \theta _ { \mathrm { { W A } } } ( L _ { S } ^ { M } ) \triangleq 1 / M \sum _ { m = 1 } ^ { M } \theta _ { m } , } \end{array}
+$$
+
+is the state of the art [14, 29] on DomainBed [12] when the weights $\lbrace \theta _ { m } \rbrace _ { m = 1 } ^ { M }$ are sampled along a single training trajectory (a description we refine in Remark 1 from Appendix C.2).
+
+Limitations of the flatness-based analysis. To explain this success, Cha et al. [14] argue that flat minima generalize better; indeed, WA flattens the loss landscape. Yet, as shown in Appendix B, this analysis does not fully explain WA’s spectacular results on DomainBed. First, flatness does not act on distribution shifts thus the OOD error is uncontrolled with their upper bound (see Appendix B.1). Second, this analysis does not clarify why WA outperforms Sharpness-Aware Minimizer (SAM) [30] for OOD generalization, even though SAM directly optimizes flatness (see Appendix B.2). Finally, it does not justify why combining WA and SAM succeeds in IID [31] yet fails in OOD (see Appendix B.3). These observations motivate a new analysis of WA; we propose one below that better explains these results.
+
+# 2.3 Bias-variance-covariance-locality decomposition
+
+We now introduce our bias-variance-covariance-locality decomposition which extends the biasvariance decomposition [32] to WA. In the rest of this theoretical section, $\ell$ is the Mean Squared Error for simplicity: yet, our results may be extended to other losses as in [33]. In this case, the expected error of a model with weights $\theta ( l _ { S } )$ w.r.t. the learning procedure $l _ { S }$ was decomposed in [32] into:
+
+$$
+\begin{array} { r } { \mathbb { E } _ { l _ { S } } \mathcal { E } _ { T } ( \theta ( l _ { S } ) ) = \mathbb { E } _ { ( x , y ) \sim p _ { T } } [ \mathrm { b i a s } ^ { 2 } ( x , y ) + \mathrm { v a r } ( x ) ] , } \end{array}
+$$
+
+where $\mathrm { b i a s } ( x , y ) , \mathrm { v a r } ( x )$ are the bias and variance of the considered model w.r.t. a sample $( x , y )$ , defined later in Equation (BVCL). To decompose WA’s error, we leverage the similarity (already highlighted in [13]) between WA and functional ensembling (ENS) [15, 34], a more tra$\begin{array} { r } { f _ { \mathrm { E N S } } \triangleq f _ { \mathrm { E N S } } ( \cdot , \{ \theta _ { m } \} _ { m = 1 } ^ { M } ) \triangleq 1 / M \sum _ { m = 1 } ^ { M } f ( \cdot , \theta _ { m } ) } \end{array}$ More precisely, ENS avera. Lemma 1 establishes that the weight space. $f _ { \mathrm { W A } }$ he predictions,is a first-order $f _ { \mathrm { E N S } }$ $\lbrace \theta _ { m } \rbrace _ { m = 1 } ^ { M }$
+
+Lemma 1 (WA and ENS. Proof in Appendix C.1. Adapted from [13, 28].). Given $\lbrace \theta _ { m } \rbrace _ { m = 1 } ^ { M }$ with learning procedures $L _ { S } ^ { M } \triangleq \{ l _ { S } ^ { ( m ) } \} _ { m = 1 } ^ { M }$ . Denoting $\Delta _ { L _ { S } ^ { M } } = \mathrm { m a x } _ { m = 1 } ^ { M } \| \theta _ { m } - \theta _ { W A } \| _ { 2 } , \forall ( x , y ) \in \mathcal { X } \times \mathcal { Y }$
+
+$$
+f _ { W A } ( x ) = f _ { E N S } ( x ) + O ( \Delta _ { L _ { S } ^ { M } } ^ { 2 } ) a n d \ell ( f _ { W A } ( x ) , y ) = \ell ( f _ { E N S } ( x ) , y ) + O ( \Delta _ { L _ { S } ^ { M } } ^ { 2 } ) .
+$$
+
+This similarity is useful since Equation (BV) was extended into a bias-variance-covariance decomposition for ENS in [18, 35]. We can then derive the following decomposition of WA’s expected test error. To take into account the $M$ averaged weights, the expectation is over the joint distribution describing the $M$ identically distributed (i.d.) learning procedures $L _ { S } ^ { M } \triangleq \{ l _ { S } ^ { ( m ) } \} _ { m = 1 } ^ { \tilde { M } }$ .
+
+Proposition 1 (Bias-variance-covariance-locality decomposition of the expected generalization error of WA in OOD. Proof in Appendix C.2.). Denoting $\hat { f } _ { S } ( x ) = \mathbb { E } _ { l _ { S } } [ f ( x , \cdot \theta ( l _ { S } ) ) ]$ , under identically distributed learning procedures $L _ { S } ^ { M } \triangleq \{ l _ { S } ^ { ( m ) } \} _ { m = 1 } ^ { M }$ S , the expected generalization error on domain $T$ of $\begin{array} { r } { \theta _ { W A } ( L _ { S } ^ { M } ) \triangleq \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \theta _ { m } } \end{array}$ over the joint distribution of $L _ { S } ^ { M }$ is:
+
+$$
+\begin{array} { r l } & { \mathbb { E } _ { L _ { S } ^ { \scriptscriptstyle M } } \mathcal { E } _ { T } \big ( \theta _ { W \mathrm { A } } ( L _ { S } ^ { \scriptscriptstyle M } ) \big ) = \mathbb { E } _ { ( x , y ) \sim p _ { T } } \Big [ \mathrm { b i a s } ^ { 2 } ( x , y ) + \frac { 1 } { M } \mathrm { v a r } ( x ) + \frac { M - 1 } { M } \mathrm { c o v } ( x ) \Big ] + O ( \bar { \Delta } ^ { 2 } ) , } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \end{array}
+$$
+
+cov is the prediction covariance between two member models whose weights are averaged. The locality term $\bar { \Delta } ^ { 2 }$ is the expected squared maximum distance between weights and their average.
+
+Equation (BVCL) decomposes the OOD error of WA into four terms. The bias is the same as that of each of its i.d. members. WA’s variance is split into the variance of each of its i.d. members divided by $M$ and a covariance term. The last locality term constrains the weights to ensure the validity of our approximation. In conclusion, combining $M$ models divides the variance by $M$ but introduces the covariance and locality terms which should be controlled along bias to guarantee low OOD error.
+
+# 2.4 Analysis of the bias-variance-covariance-locality decomposition
+
+We now analyze the four terms in Equation (BVCL). We show that bias dominates under correlation shift (Section 2.4.1) and variance dominates under diversity shift (Section 2.4.2). Then, we discuss a trade-off between covariance, reduced with diverse models (Section 2.4.3), and the locality term, reduced when weights are similar (Section 2.4.4). This analysis shows that WA is effective against diversity shift when $M$ is large and when its members are diverse but close in the weight space.
+
+# 2.4.1 Bias and correlation shift (and support mismatch)
+
+We relate OOD bias to correlation shift [19] under Assumption 1, where $\bar { f } _ { S } ( x ) \triangleq \mathbb { E } _ { l _ { S } } [ f ( x , \theta ( l _ { S } ) ) ]$ . As discussed in Appendix C.3.2, Assumption 1 is reasonable for a large NN trained on a large dataset representative of the source domain $S$ . It is relaxed in Proposition 4 from Appendix C.3.
+
+Assumption 1 (Small IID bias). $\exists \epsilon > 0$ small s.t. $\forall x \in \mathcal { X } _ { S } , | f _ { S } ( x ) - \bar { f } _ { S } ( x ) | \leq \epsilon .$
+
+Proposition 2 (OOD bias and correlation shift. Proof in Appendix C.3). With a bounded difference between the labeling functions $f _ { T } - f _ { S }$ on $\mathcal { X } _ { T } \cap \mathcal { X } _ { S }$ , under Assumption $\cdot$ , the bias on domain $T$ is:
+
+$$
+\begin{array} { r l } & { \mathbb { E } _ { ( x , y ) \sim p _ { T } } [ \mathrm { b i a s } ^ { 2 } ( x , y ) ] = C o r r e l a t i o n \ s h i f t + S u p p o r t \ m i s m a t c h + O ( \epsilon ) , } \\ & { w h e r e \ C o r r e l a t i o n \ s h i f t = \displaystyle \int _ { \mathbb { X } _ { T } \cap \mathbb { X } _ { S } } \big ( f _ { T } ( x ) - f _ { S } ( x ) \big ) ^ { 2 } p _ { T } ( x ) d x , } \\ & { a n d S u p p o r t \ m i s m a t c h = \displaystyle \int _ { \mathbb { X } _ { T } \setminus \mathbb { X } _ { S } } \big ( f _ { T } ( x ) - \bar { f } _ { S } ( x ) \big ) ^ { 2 } p _ { T } ( x ) d x . } \end{array}
+$$
+
+We analyze the first term by noting that $f _ { T } ( x ) \triangleq \mathbb { E } _ { p _ { T } } [ Y | X = x ]$ and $f _ { S } ( x ) \triangleq \mathbb { E } _ { p _ { S } } [ Y | X = x ]$ , $\forall x \in \mathcal { X } _ { T } \cap \mathcal { X } _ { S }$ . This expression confirms that our correlation shift term measures shifts in posterior distributions between source and target, as in [19]. It increases in presence of spurious correlations: e.g., on ColoredMNIST [8] where the color/label correlation is reversed at test time. The second term is caused by support mismatch between source and target. It was analyzed in [36] and shown irreducible in their “No free lunch for learning representations for DG”. Yet, this term can be tackled if we transpose the analysis in the feature space rather than the input space. This motivates encoding the source and target domains into a shared latent space, e.g., by pretraining the encoder on a task with minimal domain-specific information as in [36].
+
+This analysis explains why WA fails under correlation shift, as shown on ColoredMNIST in Appendix H. Indeed, combining different models does not reduce the bias. Section 2.4.2 explains that WA is however efficient against diversity shift.
+
+# 2.4.2 Variance and diversity shift
+
+Variance is known to be large in OOD [5] and to cause a phenomenon named underspecification, when models behave differently in OOD despite similar test IID accuracy. We now relate OOD variance to diversity shift [19] in a simplified setting. We fix the source dataset $d _ { S }$ (with input support $X _ { d _ { S } }$ ), the target dataset $d _ { T }$ (with input support $X _ { d _ { T } }$ ) and the network’s initialization. We get a closed-form expression for the variance of $f$ over all other sources of randomness under Assumptions 2 and 3.
+
+Assumption 2 (Kernel regime). $f$ is in the kernel regime [37, 38].
+
+This states that $f$ behaves as a Gaussian process (GP); it is reasonable if $f$ is a wide network [37, 39]. The corresponding kernel $K$ is the neural tangent kernel (NTK) [37] depending only on the initialization. GPs are useful because their variances have a closed-form expression (Appendix C.4.1). To simplify the expression of variance, we now make Assumption 3.
+
+Assumption 3 (Constant norm and low intra-sample similarity on $d _ { S }$ ). $\exists ( \lambda _ { S } , \epsilon )$ with $0 \le \epsilon \ll \lambda _ { S }$ such that $\forall x _ { S } \in X _ { d _ { S } } , K ( x _ { S } , x _ { S } ) = \lambda _ { S }$ and $\mathsf { \bar { H } } x _ { S } ^ { \prime } \neq x _ { S } \in \dot { X } _ { d s } , | K ( x _ { S } , x _ { S } ^ { \prime } ) | \leq \epsilon$ .
+
+This states that training samples have the same norm (following standard practice [39, 40, 41, 42]) and weakly interact [43, 44]. This assumption is further discussed and relaxed in Appendix C.4.2. We are now in a position to relate variance and diversity shift when $\epsilon 0$ .
+
+Proposition 3 (OOD variance and diversity shift. Proof in Appendix C.4). Given $f$ trained on source dataset $d _ { S }$ (of size $n _ { S }$ ) with NTK $K$ , under Assumptions 2 and $^ 3$ , the variance on dataset $d _ { T }$ is:
+
+$$
+\mathbb { E } _ { x _ { T } \in X _ { d _ { T } } } [ \mathrm { v a r } ( x _ { T } ) ] = \frac { n _ { S } } { 2 \lambda _ { S } } M M D ^ { 2 } ( X _ { d _ { S } } , X _ { d _ { T } } ) + \lambda _ { T } - \frac { n _ { S } } { 2 \lambda _ { S } } \beta _ { T } + O ( \epsilon ) ,
+$$
+
+where MMD is the empirical Maximum Mean Discrepancy in the RKHS of $K ^ { 2 } ( x , y ) \ =$ $( K ( x , y ) ) ^ { 2 } ; \lambda _ { T } \triangleq \mathbb { E } _ { x _ { T } \in X _ { d _ { T } } } K ( x _ { T } , x _ { T } )$ and $\beta _ { T } \ \triangleq \ \mathbb { E } _ { ( x _ { T } , x _ { T } ^ { \prime } ) \in X _ { d _ { T } } ^ { 2 } , x _ { T } \neq x _ { T } ^ { \prime } } K ^ { 2 } ( x _ { T } , x _ { T } ^ { \prime } )$ are the empirical mean similarities respectively measured between identical $( w . r . t . \ K )$ and different $( w . r . t . ~ K ^ { 2 } )$ samples averaged over $X _ { d _ { T } }$ .
+
+The MMD empirically estimates shifts in input marginals, i.e., between $p _ { S } ( X )$ and $p _ { T } ( X )$ . Our expression of variance is thus similar to the diversity shift formula in [19]: MMD replaces the $L _ { 1 }$ divergence used in [19]. The other terms, $\lambda _ { T }$ and $\beta _ { T }$ , both involve internal dependencies on the target dataset $d _ { T }$ : they are constants w.r.t. $X _ { d _ { T } }$ and do not depend on distribution shifts. At fixed $d _ { T }$ and under our assumptions, Equation (4) shows that variance on $d _ { T }$ decreases when $X _ { d _ { S } }$ and $X _ { d _ { T } }$ are closer (for the MMD distance defined by the kernel $K ^ { 2 }$ ) and increases when they deviate. Intuitively, the further $X _ { d _ { T } }$ is from $X _ { d _ { S } }$ , the less the model’s predictions on $X _ { d _ { T } }$ are constrained after fitting $d _ { S }$
+
+This analysis shows that WA reduces the impact of diversity shift as combining $M$ models divides the variance per $M$ . This is a strong property achieved without requiring data from the target domain.
+
+# 2.4.3 Covariance and diversity
+
+The covariance term increases when the predictions of $\{ f ( \cdot , \theta _ { m } ) \} _ { m = 1 } ^ { M }$ are correlated. In the worst case where all predictions are identical, covariance equals variance and WA is no longer beneficial. On the other hand, the lower the covariance, the greater the gain of WA over its members; this is derived by comparing Equations (BV) and (BVCL), as detailed in Appendix C.5. It motivates tackling covariance by encouraging members to make different predictions, thus to be functionally diverse. Diversity is a widely analyzed concept in the ensemble literature [15], for which numerous measures have been introduced [45, 46, 47]. In Section 3, we aim at decorrelating the learning procedures to increase members’ diversity and reduce the covariance term.
+
+# 2.4.4 Locality and linear mode connectivity
+
+To ensure that WA approximates ENS, the last locality term $O ( \bar { \Delta } ^ { 2 } )$ constrains the weights to be close. Yet, the covariance term analyzed in Section 2.4.3 is antagonistic, as it motivates functionally diverse models. Overall, to reduce WA’s error in OOD, we thus seek a good trade-off between diversity and locality. In practice, we consider that the main goal of this locality term is to ensure that the weights are averageable despite the nonlinearities in the NN such that WA’s error does not explode. This is why in Section 3, we empirically relax this locality constraint and simply require that the weights are linearly connectable in the loss landscape, as in the linear mode connectivity [24]. We empirically verify later in Figure 1 that the approximation $f _ { \mathrm { W A } } \approx f _ { \mathrm { E N S } }$ remains valid even in this case.
+
+# 3 DiWA: Diverse Weight Averaging
+
+# 3.1 Motivation: weight averaging from different runs for more diversity
+
+Limitations of previous WA approaches. Our analysis in Sections 2.4.1 and 2.4.2 showed that the bias and the variance terms are mostly fixed by the distribution shifts at hand. In contrast, the covariance term can be reduced by enforcing diversity across models (Section 2.4.3) obtained from learning procedur es {l (m)S }Mm=1 · Yet, previous methods [14, 29] only average weights obtained along a single run. This corresponds to highly correlated procedures sharing the same initialization, hyperparameters, batch orders, data augmentations and noise, that only differ by the number of training steps. The models are thus mostly similar: this does not leverage the full potential of WA.
+
+DiWA. Our Diverse Weight Averaging approach seeks to reduce the OOD expected error in Equation (BVCL) by decreasing covariance across predictions: DiWA decorrelates the learning procedures {l (m)S }Mm=1 . Our weights are obtained from $M \gg 1$ different runs, with diverse learning procedures:
+
+Require: $\theta _ { 0 }$ pretrained encoder and initialized classifier; $\{ h _ { m } \} _ { m = 1 } ^ { H }$ hyperparameter configurations.
+Training: $\forall m = 1$ to $H , \theta _ { m } \triangleq { \mathrm { F i n e T u n e } } ( \theta _ { 0 } , h _ { m } )$
+Weight selection: Uniform: $\overline { { \mathcal { M } } } = \{ 1 , \cdots , H \}$ .
+Res R $\lbrace \theta _ { m } \rbrace _ { m = 1 } ^ { H }$ by decreasing $\mathrm { V a l A c c } ( \theta _ { m } )$ . $M \gets \emptyset$ . $m = 1$ $H$ If $\mathrm { V a l A c c } ( \theta _ { \mathcal { M } \cup \{ m \} } ) \geq \mathrm { V a l A c c } ( \theta _ { \mathcal { M } } )$ ${ \mathcal { M } } \gets { \mathcal { M } } \cup \{ m \}$
+Inference: with $f ( \cdot , \theta _ { \mathcal { M } } )$ , where $\begin{array} { r } { \theta _ { \mathcal { M } } = \sum _ { m \in \mathcal { M } } \theta _ { m } / | \mathcal { M } | } \end{array}$ .
+
+these have different hyperparameters (learning rate, weight decay and dropout probability), batch orders, data augmentations (e.g., random crops, horizontal flipping, color jitter, grayscaling), stochastic noise and number of training steps. Thus, the corresponding models are more diverse on domain $T$ per [21] and reduce the impact of variance when $M$ is large. However, this may break the locality requirement analyzed in Section 2.4.4 if the weights are too distant. Empirically, we show that DiWA works under two conditions: shared initialization and mild hyperparameter ranges.
+
+# 3.2 Approach: shared initialization, mild hyperparameter search and weight selection
+
+Shared initialization. The shared initialization condition follows [25]: when models are fine-tuned from a shared pretrained model, their weights can be connected along a linear path where error remains low [24]. Following standard practice on DomainBed [12], our encoder is pretrained on ImageNet [48]; this pretraining is key as it controls the bias (by defining the feature support mismatch, see Section 2.4.1) and variance (by defining the kernel $K$ , see Appendix C.4.4). Regarding the classifier initialization, we test two methods. The first is the random initialization, which may distort the features [49]. The second is Linear Probing (LP) [49]: it first learns the classifier (while freezing the encoder) to serve as a shared initialization. Then, LP fine-tunes the encoder and the classifier together in the $M$ subsequent runs; the locality term is smaller as weights remain closer (see [49]).
+
+Mild hyperparameter search. As shown in Figure 5, extreme hyperparameter ranges lead to weights whose average may perform poorly. Indeed, weights obtained from extremely different hyperparameters may not be linearly connectable; they may belong to different regions of the loss landscape. In our experiments, we thus use the mild search space defined in Table 7, first introduced in SWAD [14]. These hyperparameter ranges induce diverse models that are averageable in weights.
+
+Weight selection. The last step of our approach (summarized in Algorithm 1) is to choose which weights to average among those available. We explore two simple weight selection protocols, as in [28]. The first uniform equally averages all weights; it is practical but may underperform when some runs are detrimental. The second restricted (greedy in [28]) solves this drawback by restricting the number of selected weights: weights are ranked in decreasing order of validation accuracy and sequentially added only if they improve DiWA’s validation accuracy.
+
+In the following sections, we experimentally validate our theory. First, Section 4 confirms our findings on the OfficeHome dataset [50] where diversity shift dominates [19] (see Appendix E.2 for a similar analysis on PACS [51]). Then, Section 5 shows that DiWA is state of the art on DomainBed [12].
+
+# 4 Empirical validation of our theoretical insights
+
+We consider several collections of weights $\lbrace \theta _ { m } \rbrace _ { m = 1 } ^ { M }$ $( 2 \leq M < 1 0 )$ trained on the “Clipart”, “Product” and “Photo” domains from OfficeHome [50] with a shared random initialization and mild hyperparameter ranges. These weights are first indifferently sampled from a single run (every 50 batches) or from different runs. They are evaluated on “Art”, the fourth domain from OfficeHome.
+
+WA vs. ENS. Figure 1 validates Lemma 1 and that $f _ { \mathbf { W A } } \approx f _ { \mathbf { E N S } }$ . More precisely, $f _ { \mathrm { W A } }$ slightly but consistently improves $f _ { \mathrm { E N S } }$ : we discuss this in Appendix D. Moreover, a larger $M$ improves the
+
+
+Figure 1: Each dot displays the accuracy (") of weight averaging (WA) vs. accuracy $( \uparrow )$ of prediction averaging (ENS) for $M$ models.
+
+
+Figure 2: Each dot displays the accuracy (") gain of WA over its members vs. the prediction diversity [46] ( ) for $M$ models.
+
+results; in accordance with Equation (BVCL), this motivates averaging as many weights as possible.
+In contrast, large $M$ is computationally impractical for ENS at test time, requiring $M$ forwards.
+
+Diversity and accuracy. We validate in Figure 2 that $f _ { \mathrm { W A } }$ benefits from diversity. Here, we measure diversity with the ratio-error [46], i.e., the ratio $N _ { \mathrm { d i f f } } / N _ { \mathrm { s i m u l } }$ between the number of different errors $N _ { \mathrm { d i f f } }$ and of simultaneous errors $N _ { \mathrm { s i m u l } }$ in test for a pair in $\{ f ( \cdot , \theta _ { m } ) \} _ { m = 1 } ^ { M }$ . A higher average over the $\binom { M } { 2 }$ pairs means that members are less likely to err on the same inputs. Specifically, the gain of $\operatorname { A c c } ( \theta _ { \operatorname { W A } } )$ over the mean individual accuracy $\begin{array} { r } { \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \operatorname { A c c } ( \theta _ { m } ) } \end{array}$ increases with diversity. Moreover, this phenomenon intensifies for larger $M$ : the linear regression’s slope (i.e., the accuracy gain per unit of diversity) increases with $M$ . This is consistent with the $( M - 1 ) / M$ factor of $\operatorname { c o v } ( x )$ in Equation (BVCL), as further highlighted in Appendix E.1.2. Finally, in Appendix E.1.1, we show that the conclusion also holds with CKAC [47], another established diversity measure.
+
+Increasing diversity thus accuracy via different runs. Now we investigate the difference between sampling the weights from a single run or from different runs. Figure 3 first shows that diversity increases when weights come from different runs. Second, in Figure 4, this is reflected on the accuracies in OOD. Here, we rank by validation accuracy the 60 weights obtained (1) from 60 different runs and (2) along 1 well-performing run. We then consider the WA of the top $M$ weights as $M$ increases from 1 to 60. Both have initially the same performance and improve with $M$ ; yet, WA of weights from different runs gradually outperforms the single-run WA. Finally, Figure 5 shows that this holds only for mild hyperparameter ranges and with a shared initialization. Otherwise, when hyperparameter distributions are extreme (as defined in Table 7) or when classifiers are not similarly initialized, DiWA may perform worse than its members due to a violation of the locality condition. These experiments confirm that diversity is key as long as the weights remain averageable.
+
+
+Figure 3: Frequencies of predic- Figure 4: WA accuracy $( \uparrow )$ as $M$ tion diversities ( ) [46] across 2 increases, when the $M$ weights weights obtained along a single are obtained along a single run run or from different runs. or from different runs.
+
+
+Figure 5: Each dot displays the accuracy ( ) gain of WA over its members vs. prediction diversity $( \uparrow )$ for $2 \leq M < 1 0$ models.
+
+# 5 Experimental results on the DomainBed benchmark
+
+Datasets. We now present our evaluation on DomainBed [12]. By imposing the code, the training procedures and the ResNet50 [52] architecture, DomainBed is arguably the fairest benchmark for OOD generalization. It includes 5 multi-domain real-world datasets: PACS [51], VLCS [53], OfficeHome [50], TerraIncognita [54] and DomainNet [55]. [19] showed that diversity shift dominates in these datasets. Each domain is successively considered as the target $T$ while other domains are merged into the source $S$ . The validation dataset is sampled from $S$ , i.e., we follow DomainBed’s training-domain model selection. The experimental setup is further described in Appendix G.1. Our code is available at https://github.com/alexrame/diwa.
+
+Baselines. ERM is the standard Empirical Risk Minimization. Coral [10] is the best approach based on domain invariance. SWAD (Stochastic Weight Averaging Densely) [14] and MA (Moving Average) [29] average weights along one training trajectory but differ in their weight selection strategy. SWAD [14] is the current state of the art (SoTA) thanks to it “overfit-aware” strategy, yet at the cost of three additional hyperparameters (a patient parameter, an overfitting patient parameter and a tolerance rate) tuned per dataset. In contrast, MA [29] is easy to implement as it simply combines all checkpoints uniformly starting from batch 100 until the end of training. Finally, we report the scores obtained in [29] for the costly Deep Ensembles (DENS) [15] (with different initializations): we discuss other ensembling strategies in Appendix D.
+
+Our runs. ERM and DiWA share the same training protocol in DomainBed: yet, instead of keeping only one run from the grid-search, DiWA leverages $M$ runs. In practice, we sample 20 configurations from the hyperparameter distributions detailed in Table 7 and report the mean and standard deviation across 3 data splits. For each run, we select the weights of the epoch with the highest validation accuracy. ERM and MA select the model with highest validation accuracy across the 20 runs, following standard practice on DomainBed. Ensembling (ENS) averages the predictions of all $M = 2 0$ models (with shared initialization). DiWA-restricted selects $1 \leq M \leq 2 0$ weights with Algorithm 1 while DiWA-uniform averages all $M = 2 0$ weights. DiWA† averages uniformly the $M = 3 \times 2 0 = 6 0$ weights from all 3 data splits. DiWA† benefits from larger $M$ (without additional inference cost) and from data diversity (see Appendix E.1.3). However, we cannot report standard deviations for DiWA† for computational reasons. Moreover, DiWA† cannot leverage the restricted weight selection, as the validation is not shared across all 60 weights that have different data splits.
+
+# 5.1 Results on DomainBed
+
+We report our main results in Table 1, detailed per domain in Appendix G.2. With a randomly initialized classifier, DiWA†-uniform is the best on PACS, VLCS and OfficeHome: DiWA-uniform is the second best on PACS and OfficeHome. On TerraIncognita and DomainNet, DiWA is penalized by some bad runs, filtered in DiWA-restricted which improves results on these datasets. Classifier initialization with linear probing (LP) [49] improves all methods on OfficeHome, TerraIncognita and DomainNet. On these datasets, DiWA† increases MA by 1.3, 0.5 and 1.1 points respectively. After averaging, DiWA† with LP establishes a new SoTA of $6 8 . 0 \%$ , improving SWAD by 1.1 points.
+
+Table 1: Accuracy $( \% , \uparrow )$ on DomainBed with ResNet50 (best in bold and second best underlined).
+
+
Algorithm
Weight selection
Init
PACS
VLCS
OfficeHome
TerraInc
DomainNet
Avg
ERM
N/A
Random
85.5±0.2 86.2±0.3
77.5 ± 0.4 78.8 ±0.6
66.5 ± 0.3 68.7 ±0.3
46.1 ± 1.8 47.6 ± 1.0
40.9 ± 0.1 41.5 ± 0.1
63.3 64.6
Coral[10]
N/A
SWAD[14]
Overfit-aware
88.1 ±0.1
79.1 ± 0.1
70.6± 0.2
50.0± 0.3
46.5 ± 0.1
66.9
MA [29]
Uniform
87.5 ± 0.2
78.2 ±0.2
70.6 ± 0.1
50.3 ± 0.5
46.0 ± 0.1
66.5
DENS [15,29]
Uniform: M=6
87.6
78.5
70.8
49.2
47.7
66.8
sun.I .ino
ERM
Random
85.5± 0.5
77.6± 0.2
67.4±0.6
48.3±0.8
44.1 ± 0.1
64.6
MA [29]
N/A Uniform
87.9 ± 0.1
78.4 ± 0.1
70.3 ± 0.1
49.9 ± 0.2
46.4 ± 0.1
66.6
ENS
Uniform:M= 20
88.0±0.1
78.7 ± 0.1
70.5 ± 0.1
51.0 ± 0.5
47.4 ± 0.2
67.1
DiWA
Restricted: M≤20
87.9±0.2
79.2 ± 0.1
70.5 ± 0.1
50.5 ± 0.5
46.7 ± 0.1
67.0
DiWA
Uniform:M= 20
88.8±0.4
79.1 ± 0.2
71.0 ± 0.1
48.9 ± 0.5
46.1 ± 0.1
66.8
DiWAt
Uniform: M= 60
89.0
79.4
71.6
49.0
46.3
67.1
ERM
N/A
85.9 ± 0.6
MA [29]
Uniform
LP [49]
87.8±0.3
78.1 ± 0.5 78.5 ± 0.4
69.4 ± 0.2 71.5 ± 0.3
50.4 ± 1.8 51.4 ± 0.6
44.3 ± 0.2 46.6 ± 0.0
65.6 67.1
ENS
Uniform:M= 20
88.1±0.3
78.5 ± 0.1
71.7 ± 0.1
50.8 ± 0.5
47.0±0.2
67.2
DiWA
Restricted: M≤20
88.0±0.3
78.5 ± 0.1
71.5 ± 0.2
51.6 ± 0.9
47.7 ± 0.1
67.5
DiWA
Uniform: M= 20
88.7±0.2
78.4± 0.2
72.1 ± 0.2
51.4 ± 0.6
47.4 ± 0.2
67.6
DiWAt
Uniform: M= 60
89.0
78.6
72.8
51.9
47.7
68.0
+
+DiWA with different objectives. So far we used ERM that does not leverage the domain information. Table 2 shows that DiWA-uniform benefits from averaging weights trained with Interdomain Mixup [56] and Coral [10]: accuracy gradually improves as we add more objectives. Indeed, as highlighted in Appendix E.1.3, DiWA benefits from the increased diversity brought by the various objectives. This suggests a new kind of linear connectivity across models trained with different objectives; the full analysis of this is left for future work.
+
+Table 2: Accuracy $( \% , \uparrow )$ on OfficeHome domain “Art” with various objectives.
+
+
Algorithm
No WA
MA
DiWA
DiWA†
ERM
62.9 ±1.3
65.0±0.2
67.3±0.2
67.7
Mixup
63.1 ±0.7
66.2 ± 0.3
67.8 ±0.6
68.4
Coral
64.4± 0.4
64.4 ± 0.4
67.7 ±0.2
68.2
ERM/Mixup
N/A
N/A
67.9 ± 0.7
68.9
ERM/Coral
N/A
N/A
68.1± 0.3
68.7
ERM/Mixup/Coral
N/A
N/A
68.4 ± 0.4
69.1
+
+# 5.2 Limitations of DiWA
+
+Despite this success, DiWA has some limitations. First, DiWA cannot benefit from additional diversity that would break the linear connectivity between weights — as discussed in Appendix D. Second, DiWA (like all WA approaches) can tackle diversity shift but not correlation shift: this property is explained for the first time in Section 2.4 and illustrated in Appendix H on ColoredMNIST.
+
+# 6 Related work
+
+Generalization and ensemble. To generalize under distribution shifts, invariant approaches [8, 9, 11, 10, 57, 58] try to detect the causal mechanism rather than memorize correlations: yet, they do not outperform ERM on various benchmarks [12, 19, 59]. In contrast, ensembling of deep networks [15, 60, 61] consistently increases robustness [16] and was successfully applied to domain generalization [29, 62, 63, 64, 65, 66]. As highlighted in [18] (whose analysis underlies our Equation (BVCL)), ensembling works due to the diversity among its members. This diversity comes primarily from the randomness of the learning procedure [15] and can be increased with different hyperparameters [67], data [68, 69, 70], augmentations [71, 72] or with regularizations [73, 65, 66, 74, 75].
+
+Weight averaging. Recent works [13, 76, 77, 78] combine in weights (rather than in predictions) models collected along a single run. This was shown suboptimal in IID [17] but successful in OOD [14, 29]. Following the linear mode connectivity [24, 79] and the property that many independent models are connectable [80], a second group of works average weights with fewer constraints [26, 27, 28, 81, 82, 83]. To induce greater diversity, [84] used a high constant learning rate; [80] explicitly encouraged the weights to encompass more volume in the weight space; [83] minimized cosine similarity between weights; [85] used a tempered posterior. From a loss landscape perspective [20], these methods aimed at “explor[ing] the set of possible solutions instead of simply converging to a single point”, as stated in [84]. The recent “Model soups” introduced by Wortsman et al. [28] is a WA algorithm similar to Algorithm 1; yet, the theoretical analysis and the goals of these two works are different. Theoretically, we explain why WA succeeds under diversity shift: the bias/correlation shift, variance/diversity shift and diversity-based findings are novel and are confirmed empirically. Regarding the motivation, our work aims at combining more diverse weights: it may be analyzed as a general framework to average weights obtained in various ways. In contrast, [28] challenges the standard model selection after a grid search. Regarding the task, [28] and our work complement each other: while [28] demonstrate robustness on several ImageNet variants with distribution shift, we improve the SoTA on the multi-domain DomainBed benchmark against other established OOD methods after a thorough and fair comparison. Thus, DiWA and [28] are theoretically complementary with different motivations and applied successfully for different tasks.
+
+# 7 Conclusion
+
+In this paper, we propose a new explanation for the success of WA in OOD by leveraging its ensembling nature. Our analysis is based on a new bias-variance-covariance-locality decomposition for WA, where we theoretically relate bias to correlation shift and variance to diversity shift. It also shows that diversity is key to improve generalization. This motivates our DiWA approach that averages in weights models trained independently. DiWA improves the state of the art on DomainBed, the reference benchmark for OOD generalization. Critically, DiWA has no additional inference cost — removing a key limitation of standard ensembling. Our work may encourage the community to further create diverse learning procedures and objectives — whose models may be averaged in weights.
+
+# Acknowledgements
+
+We would like to thank Jean-Yves Franceschi for his helpful comments and discussions on our paper. This work was granted access to the HPC resources of IDRIS under the allocation AD011011953 made by GENCI. We acknowledge the financial support by the French National Research Agency (ANR) in the chair VISA-DEEP (project number ANR-20-CHIA-0022-01) and the ANR projects DL4CLIM ANR-19-CHIA-0018-01, RAIMO ANR-20-CHIA-0021-01, OATMIL ANR-17-CE23- 0012 and LEAUDS ANR-18-CE23-0020.
+
+# References
+
+[1] John R. Zech, Marcus A. Badgeley, Manway Liu, Anthony B. Costa, Joseph J. Titano, and Eric Karl Oermann. Variable generalization performance of a deep learning model to detect pneumonia in chest radiographs: A cross-sectional study. PLOS Medicine, 2018. (pp. 1 and 17)
+[2] Alex J DeGrave, Joseph D Janizek, and Su-In Lee. Ai for radiographic covid-19 detection selects shortcuts over signal. Nature Machine Intelligence, 2021. (pp. 1 and 17)
+[3] Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In ICLR, 2019. (p. 1)
+[4] Harshay Shah, Kaustav Tamuly, Aditi Raghunathan, Prateek Jain, and Praneeth Netrapalli. The pitfalls of simplicity bias in neural networks. In NeurIPS, 2020. (p. 1)
+[5] Alexander D’Amour, Katherine Heller, Dan Moldovan, Ben Adlam, Babak Alipanahi, Alex Beutel, Christina Chen, Jonathan Deaton, Jacob Eisenstein, Matthew D Hoffman, et al. Underspecification presents challenges for credibility in modern machine learning. JMLR, 2020. (pp. 1 and 4)
+[6] Krikamol Muandet, David Balduzzi, and Bernhard Schölkopf. Domain generalization via invariant feature representation. In ICML, 2013. (p. 1)
+[7] Jonas Peters, Peter Bühlmann, and Nicolai Meinshausen. Causal inference by using invariant prediction: identification and confidence intervals. JSTOR, 2016. (p. 1)
+[8] Martin Arjovsky, Léon Bottou, Ishaan Gulrajani, and David Lopez-Paz. Invariant risk minimization. arXiv preprint, 2019. (pp. 1, 4, 9, and 36)
+[9] David Krueger, Ethan Caballero, Joern-Henrik Jacobsen, Amy Zhang, Jonathan Binas, Dinghuai Zhang, Remi Le Priol, and Aaron Courville. Out-of-distribution generalization via risk extrapolation (rex). In ICML, 2021. (pp. 1 and 9)
+[10] Baochen Sun, Jiashi Feng, and Kate Saenko. Return of frustratingly easy domain adaptation. In AAAI, 2016. (pp. 1, 8, 9, 29, 33, 34, 35, and 36)
+[11] Alexandre Rame, Corentin Dancette, and Matthieu Cord. Fishr: Invariant gradient variances for out-of-distribution generalization. In ICML, 2022. (pp. 1, 9, and 36)
+[12] Ishaan Gulrajani and David Lopez-Paz. In search of lost domain generalization. In ICLR, 2021. (pp. 1, 2, 3, 6, 8, 9, 16, 17, 18, 27, 32, 33, and 36)
+[13] Pavel Izmailov, Dmitrii Podoprikhin, Timur Garipov, Dmitry Vetrov, and Andrew Gordon Wilson. Averaging weights leads to wider optima and better generalization. In UAI, 2018. (pp. 1, 2, 3, 9, and 20)
+[14] Junbum Cha, Sanghyuk Chun, Kyungjae Lee, Han-Cheol Cho, Seunghyun Park, Yunsung Lee, and Sungrae Park. Swad: Domain generalization by seeking flat minima. In NeurIPS, 2021. (pp. 1, 3, 5, 6, 8, 9, 17, 18, 19, 20, 23, 32, 33, 34, and 35)
+[15] Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In NeurIPS, 2017. (pp. 1, 3, 5, 8, 9, 18, 28, 34, and 35)
+[16] Yaniv Ovadia, Emily Fertig, Jie Ren, Zachary Nado, David Sculley, Sebastian Nowozin, Joshua Dillon, Balaji Lakshminarayanan, and Jasper Snoek. Can you trust your model’s uncertainty? evaluating predictive uncertainty under dataset shift. In NeurIPS, 2019. (pp. 1 and 9)
+[17] Arsenii Ashukha, Alexander Lyzhov, Dmitry Molchanov, and Dmitry Vetrov. Pitfalls of in-domain uncertainty estimation and ensembling in deep learning. In ICLR, 2020. (pp. 1 and 9)
+[18] Naonori Ueda and Ryohei Nakano. Generalization error of ensemble estimators. In ICNN, 1996. (pp. 1, 3, 9, and 21)
+[19] Nanyang Ye, Kaican Li, Lanqing Hong, Haoyue Bai, Yiting Chen, Fengwei Zhou, and Zhenguo Li. Ood-bench: Benchmarking and understanding out-of-distribution generalization datasets and algorithms. CVPR, 2022. (pp. 1, 2, 4, 5, 6, 8, 9, 23, 33, and 36)
+[20] Stanislav Fort, Huiyi Hu, and Balaji Lakshminarayanan. Deep ensembles: A loss landscape perspective. arXiv preprint, 2019. (pp. 2 and 9)
+[21] Raphael Gontijo-Lopes, Yann Dauphin, and Ekin Dogus Cubuk. No one representation to rule them all: Overlapping features of training methods. In ICLR, 2022. (pp. 2, 6, 29, and 30)
+[22] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015. (p. 2)
+[23] Abien Fred Agarap. Deep learning using rectified linear units (relu). arXiv preprint, 2018. (p. 2)
+[24] Jonathan Frankle, Gintare Karolina Dziugaite, Daniel M. Roy, and Michael Carbin. Linear mode connectivity and the lottery ticket hypothesis. In ICML, 2020. (pp. 2, 5, 6, and 9)
+[25] Behnam Neyshabur, Hanie Sedghi, and Chiyuan Zhang. What is being transferred in transfer learning? In NeurIPS, 2020. (pp. 2, 6, 28, and 30)
+[26] Mitchell Wortsman, Gabriel Ilharco, Jong Wook Kim, Mike Li, Hanna Hajishirzi, Ali Farhadi, Hongseok Namkoong, and Ludwig Schmidt. Robust fine-tuning of zero-shot models. In CVPR, 2022. (pp. 2, 9, and 28)
+[27] Michael Matena and Colin Raffel. Merging models with fisher-weighted averaging. In NeurIPS, 2022. (pp. 2 and 9)
+[28] Mitchell Wortsman, Gabriel Ilharco, Samir Yitzhak Gadre, Rebecca Roelofs, Raphael GontijoLopes, Ari S. Morcos, Hongseok Namkoong, Ali Farhadi, Yair Carmon, Simon Kornblith, and Ludwig Schmidt. Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time. In ICML, 2022. (pp. 2, 3, 6, 9, 20, and 28)
+[29] Devansh Arpit, Huan Wang, Yingbo Zhou, and Caiming Xiong. Ensemble of averages: Improving model selection and boosting performance in domain generalization. In NeurIPS, 2022. (pp. 3, 5, 8, 9, 18, 19, 20, 23, 28, 33, 34, 35, and 36)
+[30] Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware minimization for efficiently improving generalization. In ICLR, 2021. (pp. 3, 18, and 19)
+[31] Jean Kaddour, Linqing Liu, Ricardo Silva, and Matt J. Kusner. When do flat minima optimizers work? In NeurIPS, 2022. (pp. 3 and 19)
+[32] Ron Kohavi, David H Wolpert, et al. Bias plus variance decomposition for zero-one loss functions. In ICML, 1996. (pp. 3, 21, and 27)
+[33] Pedro Domingos. A unified bias-variance decomposition. In ICML, 2000. (p. 3)
+[34] Thomas G Dietterich. Ensemble methods in machine learning. In MCS, 2000. (p. 3)
+[35] Gavin Brown, Jeremy Wyatt, and Ping Sun. Between two extremes: Examining decompositions of the ensemble objective function. In MCS, 2005. (pp. 3 and 21) [36] Yangjun Ruan, Yann Dubois, and Chris J. Maddison. Optimal representations for covariate shift. In ICLR, 2022. (pp. 4, 23, and 27) [37] Arthur Jacot, Franck Gabriel, and Clement Hongler. Neural tangent kernel: Convergence and generalization in neural networks. In NeurIPS, 2018. (pp. 4, 25, and 27) [38] Amit Daniely. Sgd learns the conjugate kernel class of the network. In NeurIPS, 2017. (p. 4) [39] Jaehoon Lee, Yasaman Bahri, Roman Novak, Samuel S Schoenholz, Jeffrey Pennington, and Jascha Sohl-Dickstein. Deep neural networks as gaussian processes. In ICLR, 2017. (pp. 4 and 25) [40] Julien Ah-Pine. Normalized kernels as similarity indices. In PAKDD, 2010. (pp. 4 and 25) [41] Benyamin Ghojogh, Ali Ghodsi, Fakhri Karray, and Mark Crowley. Reproducing kernel hilbert space, mercer’s theorem, eigenfunctions, nystrom method, and use of kernels in machine learning: Tutorial and survey. arXiv preprint, 2021. (pp. 4 and 25) [42] Jason Rennie. How to normalize a kernel matrix. MIT Computer Science - Artificial Intelligence Lab Tech Rep, 2005. (pp. 4 and 25) [43] Hangfeng He and Weijie Su. The local elasticity of neural networks. In ICLR, 2020. (pp. 4 and 25) [44] Mariia Seleznova and Gitta Kutyniok. Neural tangent kernel beyond the infinite-width limit: Effects of depth and initialization. ICML, 2022. (pp. 4 and 25) [45] Ludmila I Kuncheva and Christopher J Whitaker. Measures of diversity in classifier ensembles and their relationship with the ensemble accuracy. Machine learning, 2003. (p. 5) [46] Matti Aksela. Comparison of classifier selection methods for improving committee performance. In MCS, 2003. (pp. 5, 7, 19, 28, 29, 30, and 31) [47] Simon Kornblith, Mohammad Norouzi, Honglak Lee, and Geoffrey E. Hinton. Similarity of neural network representations revisited. In ICML, 2019. (pp. 5, 7, 28, 29, and 30) [48] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In NeurIPS, 2012. (pp. 6 and 27) [49] Ananya Kumar, Aditi Raghunathan, Robbie Matthew Jones, Tengyu Ma, and Percy Liang. Fine-tuning can distort pretrained features and underperform out-of-distribution. In ICLR,
+2022. (pp. 6, 8, 27, 32, 33, 34, and 35) [50] Hemanth Venkateswara, Jose Eusebio, Shayok Chakraborty, and Sethuraman Panchanathan. Deep hashing network for unsupervised domain adaptation. In CVPR, 2017. (pp. 6, 8, 18, and 33) [51] Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy M Hospedales. Deeper, broader and artier domain generalization. In ICCV, 2017. (pp. 6, 8, and 33) [52] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. (pp. 8 and 33) [53] Chen Fang, Ye Xu, and Daniel N Rockmore. Unbiased metric learning: On the utilization of multiple datasets and web images for softening bias. In ICCV, 2013. (pp. 8 and 33) [54] Sara Beery, Grant Van Horn, and Pietro Perona. Recognition in terra incognita. In ECCV,
+2018. (pp. 8 and 33) [55] Xingchao Peng, Qinxun Bai, Xide Xia, Zijun Huang, Kate Saenko, and Bo Wang. Moment matching for multi-source domain adaptation. In ICCV, 2019. (pp. 8, 33, and 36) [56] Shen Yan, Huan Song, Nanxiang Li, Lincan Zou, and Liu Ren. Improve unsupervised domain adaptation with mixup training. arXiv preprint, 2020. (pp. 9, 29, and 33)
+[57] Shiori Sagawa, Pang Wei Koh, Tatsunori B. Hashimoto, and Percy Liang. Distributionally robust neural networks. In ICLR, 2020. (pp. 9 and 17)
+[58] Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. JMLR, 2016. (p. 9)
+[59] Pang Wei Koh, Shiori Sagawa, Henrik Marklund, Sang Michael Xie, Marvin Zhang, Akshay Balsubramani, Weihua Hu, Michihiro Yasunaga, Richard Lanas Phillips, Irena Gao, Tony Lee, Etienne David, Ian Stavness, Wei Guo, Berton Earnshaw, Imran Haque, Sara M Beery, Jure Leskovec, Anshul Kundaje, Emma Pierson, Sergey Levine, Chelsea Finn, and Percy Liang. Wilds: A benchmark of in-the-wild distribution shifts. In ICML, 2021. (p. 9)
+[60] Lars Kai Hansen and Peter Salamon. Neural network ensembles. IEEE transactions on pattern analysis and machine intelligence, 1990. (p. 9)
+[61] Anders Krogh and Jesper Vedelsby. Neural network ensembles, cross validation, and active learning. In NeurIPS, 1995. (p. 9)
+[62] Kowshik Thopalli, Sameeksha Katoch, Jayaraman J. Thiagarajan, Pavan K. Turaga, and Andreas Spanias. Multi-domain ensembles for domain generalization. In NeurIPS Workshop, 2021. (p. 9)
+[63] Yusuf Mesbah, Youssef Youssry Ibrahim, and Adil Mehood Khan. Domain generalization using ensemble learning. In ISWA, 2022. (p. 9)
+[64] Ziyue Li, Kan Ren, Xinyang Jiang, Bo Li, Haipeng Zhang, and Dongsheng Li. Domain generalization using pretrained models without fine-tuning. arXiv preprint, 2022. (p. 9)
+[65] Yoonho Lee, Huaxiu Yao, and Chelsea Finn. Diversify and disambiguate: Learning from underspecified data. arXiv preprint, 2022. (p. 9)
+[66] Matteo Pagliardini, Martin Jaggi, François Fleuret, and Sai Praneeth Karimireddy. Agree to disagree: Diversity through disagreement for better transferability. arXiv preprint, 2022. (p. 9)
+[67] Florian Wenzel, Jasper Snoek, Dustin Tran, and Rodolphe Jenatton. Hyperparameter ensembles for robustness and uncertainty quantification. In NeurIPS, 2020. (p. 9)
+[68] Leo Breiman. Bagging predictors. Machine learning, 1996. (pp. 9 and 29)
+[69] Jeremy Nixon, Balaji Lakshminarayanan, and Dustin Tran. Why are bootstrapped deep ensembles not better? In NeurIPS Workshop, 2020. (p. 9)
+[70] Teresa Yeo, Oguzhan Fatih Kar, and Amir Roshan Zamir. Robustness via cross-domain ensembles. In ICCV, 2021. (p. 9)
+[71] Yeming Wen, Ghassen Jerfel, Rafael Muller, Michael W Dusenberry, Jasper Snoek, Balaji Lakshminarayanan, and Dustin Tran. Combining ensembles and data augmentation can harm your calibration. In ICLR, 2021. (p. 9)
+[72] Alexandre Rame, Remy Sun, and Matthieu Cord. Mixmo: Mixing multiple inputs for multiple outputs via deep subnetworks. In ICCV, 2021. (pp. 9 and 28)
+[73] Alexandre Rame and Matthieu Cord. Dice: Diversity in deep ensembles via conditional redundancy adversarial estimation. In ICLR, 2021. (pp. 9 and 28)
+[74] Tianyu Pang, Kun Xu, Chao Du, Ning Chen, and Jun Zhu. Improving adversarial robustness via promoting ensemble diversity. In ICML, 2019. (p. 9)
+[75] Damien Teney, Ehsan Abbasnejad, Simon Lucey, and Anton van den Hengel. Evading the simplicity bias: Training a diverse set of models discovers solutions with superior ood generalization. arXiv preprint, 2021. (p. 9)
+[76] Felix Draxler, Kambis Veschgini, Manfred Salmhofer, and Fred Hamprecht. Essentially no barriers in neural network energy landscape. In ICML, 2018. (p. 9)
+[77] Hao Guo, Jiyong Jin, and Bin Liu. Stochastic weight averaging revisited. arXiv preprint, 2022. (p. 9)
+[78] Michael Zhang, James Lucas, Jimmy Ba, and Geoffrey E Hinton. Lookahead optimizer: k steps forward, 1 step back. NeurIPS, 32, 2019. (p. 9)
+[79] Vaishnavh Nagarajan and J Zico Kolter. Uniform convergence may be unable to explain generalization in deep learning. NeurIPS, 2019. (p. 9)
+[80] Gregory Benton, Wesley Maddox, Sanae Lotfi, and Andrew Gordon Wilson. Loss surface simplexes for mode connecting volumes and fast ensembling. In ICML, 2021. (p. 9)
+[81] Vipul Gupta, Santiago Akle Serrano, and Dennis DeCoste. Stochastic weight averaging in parallel: Large-batch training that generalizes well. In ICLR, 2020. (p. 9)
+[82] Leshem Choshen, Elad Venezian, Noam Slonim, and Yoav Katz. Fusing finetuned models for better pretraining. arXiv preprint, 2022. (p. 9)
+[83] Mitchell Wortsman, Maxwell Horton, Carlos Guestrin, Ali Farhadi, and Mohammad Rastegari. Learning neural network subspaces. ICML, 2021. (p. 9)
+[84] Wesley J Maddox, Pavel Izmailov, Timur Garipov, Dmitry P Vetrov, and Andrew Gordon Wilson. A simple baseline for bayesian uncertainty in deep learning. In NeurIPS, 2019. (p. 9)
+[85] Pavel Izmailov, Wesley Maddox, Polina Kirichenko, Timur Garipov, Dmitry Vetrov, and Andrew Gordon Wilson. Subspace inference for bayesian deep learning. In UAI, 2019. (p. 9)
+[86] Polina Kirichenko, Pavel Izmailov, and Andrew Gordon Wilson. Last layer re-training is sufficient for robustness to spurious correlations. In ICML SCIS Workshop, 2022. (pp. 17 and 37)
+[87] Su Lin Blodgett, Lisa Green, and Brendan O’Connor. Demographic dialectal variation in social media: A case study of african-american english. In EMNLP, 2016. (p. 17)
+[88] Solon Barocas and Andrew D Selbst. Big data’s disparate impact. Calif. L. Rev., 2016. (p. 17)
+[89] Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp minima can generalize for deep nets. In ICML, 2017. (p. 18)
+[90] Henning Petzka, Michael Kamp, Linara Adilova, Cristian Sminchisescu, and Mario Boley. Relative flatness and generalization. In NeurIPS, 2021. (p. 18)
+[91] Zhewei Yao, Amir Gholami, Kurt Keutzer, and Michael W Mahoney. Pyhessian: Neural networks through the lens of the hessian. In Big Data, 2020. (p. 18)
+[92] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint, 2022. (p. 19)
+[93] Carl Edward Rasmussen. Gaussian processes in machine learning. In Summer school on machine learning, 2003. (p. 24)
+[94] Fernando Pérez-Cruz, Steven Van Vaerenbergh, Juan José Murillo-Fuentes, Miguel LázaroGredilla, and Ignacio Santamaria. Gaussian processes for nonlinear signal processing: An overview of recent advances. EEE Signal Process. Mag., 2013. (p. 25)
+[95] Greg Yang and Hadi Salman. A fine-grained spectral perspective on neural networks. arXiv preprint, 2019. (p. 25)
+[96] Damien Brain and Geoffrey I Webb. On the effect of data set size on bias and variance in classification learning. In AKAW, 1999. (p. 25)
+[97] Arthur Gretton, Karsten M. Borgwardt, Malte J. Rasch, Bernhard Schölkopf, and Alexander Smola. A kernel two-sample test. Journal of Machine Learning Research, 13(25):723–773, 2012. (p. 26) [98] Jan R Magnus and Heinz Neudecker. Matrix differential calculus with applications in statistics and econometrics. John Wiley & Sons, 2019. (p. 26) [99] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In ICML, 2021. (p. 27) [100] Saurabh Singh, Derek Hoiem, and David Forsyth. Swapout: Learning an ensemble of deep architectures. In NeurIPS, 2016. (p. 28) [101] Bradley Efron. Bootstrap methods: another look at the jackknife. In Breakthroughs in statistics.
+1992. (p. 29) [102] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR,
+2015. (p. 33) [103] Yann LeCun, Corinna Cortes, and Chris Burges. Mnist handwritten digit database, 2010. (p. 36) [104] Elan Rosenfeld, Pradeep Ravikumar, and Andrej Risteski. Domain-adjusted regression or: Erm may already learn features sufficient for out-of-distribution generalization. 2022. (p. 37)
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes] In Section 5.2.
+(c) Did you discuss any potential negative societal impacts of your work? [Yes] In Appendix A
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [Yes] Assumption 1 discussed in Appendix C.3.2 and Assumptions 2 and 3 discussed in Appendix C.4.2. (b) Did you include complete proofs of all theoretical results? [Yes] In Appendix C
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Our code is available at https://github.com/alexrame/diwa.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 5 and Appendix G.1
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] Defined by different data splits when possible.
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] Approximately 20000 hours of GPUs (Nvidia V100) on an internal cluster, mostly for the 2640 runs needed in Table 1.
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes] DomainBed benchmark [12] and its datasets.
+(b) Did you mention the license of the assets? [Yes] DomainBed is under “The MIT License”.
+(c) Did you include any new assets either in the supplemental material or as a URL? [No]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/tro0_OqIVde/tro0_OqIVde.md b/md/dev/tro0_OqIVde/tro0_OqIVde.md
new file mode 100644
index 0000000000000000000000000000000000000000..8b709295eb2a59a71b6934bd183f58b4b9d6eb73
--- /dev/null
+++ b/md/dev/tro0_OqIVde/tro0_OqIVde.md
@@ -0,0 +1,306 @@
+# HorNet: Efficient High-Order Spatial Interactions with Recursive Gated Convolutions
+
+Yongming Rao1∗ Wenliang Zhao1∗ Yansong Tang1 Jie Zhou1† Ser-Nam Lim2† Jiwen Lu1† 1Tsinghua University 2Meta AI
+
+# Abstract
+
+Recent progress in vision Transformers exhibits great success in various tasks driven by the new spatial modeling mechanism based on dot-product self-attention. In this paper, we show that the key ingredients behind the vision Transformers, namely input-adaptive, long-range and high-order spatial interactions, can also be efficiently implemented with a convolution-based framework. We present the Recursive Gated Convolution $( g ^ { n } \mathbf { C } \mathbf { o n v } )$ that performs high-order spatial interactions with gated convolutions and recursive designs. The new operation is highly flexible and customizable, which is compatible with various variants of convolution and extends the two-order interactions in self-attention to arbitrary orders without introducing significant extra computation. $g ^ { n } \mathbf { C } \mathbf { o n v }$ can serve as a plug-and-play module to improve various vision Transformers and convolution-based models. Based on the operation, we construct a new family of generic vision backbones named HorNet. Extensive experiments on ImageNet classification, COCO object detection and ADE20K semantic segmentation show HorNet outperform Swin Transformers and ConvNeXt by a significant margin with similar overall architecture and training configurations. HorNet also shows favorable scalability to more training data and a larger model size. Apart from the effectiveness in visual encoders, we also show $g ^ { n } \mathbf { C } \mathbf { o n v }$ can be applied to task-specific decoders and consistently improve dense prediction performance with less computation. Our results demonstrate that $g ^ { n } \mathbf { C o n v }$ can be a new basic module for visual modeling that effectively combines the merits of both vision Transformers and CNNs. Code is available at https://github.com/raoyongming/HorNet.
+
+# 1 Introduction
+
+Convolutional neural networks (CNN) have driven remarkable progress in deep learning and computation vision since the introduction of AlexNet [31] in the last decade. There are quite a few nice properties of CNNs making them naturally suitable for a wide range of vision applications. Translation equivariance introduces useful inductive biases to major vision tasks and enables transferability across different input resolutions. The highly optimized implementation makes it efficient on both high-performance GPUs and edge devices. The evolution of architectures [32, 31, 49, 50, 22, 24, 51] further increases its popularity on various vision tasks.
+
+The emergence of Transformer-based architectures [16, 52, 42] greatly challenges the dominance of CNNs. By combining some successful designs in CNN architectures and the new self-attention mechanism, vision Transformers have shown leading performance on various vision tasks such as image classification [12, 42, 48], object detection [70, 41], semantic segmentation [6, 8] and video understanding [64, 18]. What makes vision Transformers more powerful than CNNs? Some efforts have been made to improve the CNN architectures by learning from the new designs in vision
+
+
+Figure 1: Illustration of our main idea. We show representative spatial modeling operations that perform different orders of interactions. In this paper, we focus on studying explicit spatial interactions between a feature (red) and its neighboring region (light gray). (a) The standard convolution operation does not explicitly consider the spatial interaction. (b) Dynamic convolution [28, 4] and SE [25] introduce the dynamic weights to improve the modeling power of convolutions with extra spatial interactions. (c) The self-attention operation [56] performs two-order spatial interactions with two successive matrix multiplications. (d) $g ^ { n } \mathbf { C o n v }$ realizes arbitrary-order spatial interactions using a highly efficient implementation with gated convolutions and recursive deigns.
+
+Transformers. [43] presents a thorough study to adopt the meta architecture of vision Transformer to improve CNNs and proposes to use a large $7 \times 7$ kernel to construct a modern CNN. [46] and [14] propose to use even larger kernels to learn long-range relations with global filters and up to $3 1 \times 3 1$ convolutions, respectively. [20] shows that the input-adaptive weights play a key role in vision Transformers and achieve similar performance with Swin Transformers with dynamic convolutions [4, 28]. However, the effectiveness of dot-product self-attention in vision tasks has not been analyzed from the prospective of high-order spatial interactions.
+
+While there exists complex and often high-order interactions between two spatial locations in a deep model due to the non-linearity, the success of self-attention and other dynamic networks suggests that the explicit and high-order spatial interactions introduced by the architectural designs are beneficial to improving the modeling power of vision models. As illustrated in Figure 1, the plain convolution operation does not explicitly consider the spatial interactions between a spatial location (i.e., the red feature) and its neighboring region (i.e., the light gray region). Enhanced convolution operations like dynamic convolution [4, 28, 20] introduce explicit spatial interaction by generating dynamic weights. The dot-product self-attention operation in Transformers [56] consists of two successive spatial interactions by performing matrix multiplication among queries, keys and values. The trend of the basic operations for visual modeling indicates that the network capacity can be improved by increasing the order of spatial interactions.
+
+In this paper, we summarize that the key ingredient behind the success of vision Transformers is the new way of spatial modeling with input-adaptive, long-range and high-order spatial interactions performed by the self-attention operation. While previous work has successfully migrated the meta architecture [43, 20, 46, 14], input-adaptive weight generation strategy [20] and large-range modeling ability [46, 14] of vision Transformers to CNN models, a higher-order spatial interaction mechanism has not been studied. We show that all the three key ingredients can be efficiently implemented using a convolution-based framework. We propose the Recursive Gated Convolution $( g ^ { n } \mathbf { C } \mathbf { o n v } )$ that performs high-order spatial interactions with gated convolutions and recursive deigns. Instead of simply imitating the successful designs in self-attention, $g ^ { n } \mathbf { C } \mathbf { o n v }$ has several extra favorable properties: 1) Efficient. The convolution-based implementation avoids the quadratic complexity of self-attention. The design that progressively increases the channel width during performing spatial interactions also enables us to achieve higher-order interactions with bounded complexity; 2) Extendable. We extend the two-order interaction in self-attention to arbitrary orders to further improve the modeling power. Since we do not make assumptions on the type of spatial convolution, $g ^ { n } \mathbf { C } \mathbf { o n v }$ is compatible with various kernel size and spatial mixing strategies like [46, 14]; 3) Translation-equivariant. $g ^ { n } \mathbf { C o n v }$ fully inherits the translation equivariance of the standard convolution, which introduces beneficial inductive biases to major vision tasks and avoids the asymmetry brought by local attention [42, 34].
+
+Based on $g ^ { n } \mathbf { C o n v }$ , we construct a new family of generic vision backbones named HorNet. We conduct extensive experiments on ImageNet classification [13], COCO object detection [38] and ADE20K semantic segmentation [71] to verify the effectiveness of our models. With the same $7 \times 7$ kernel/window and similar overall architecture and training configurations, HorNet outperforms Swin and ConvNeXt by a large margin on all tasks at different levels of complexity. The gap can be further enlarged by using a global kernel size [46]. HorNet also shows favorable scalability to more training data and larger model size, attaining $8 7 . 7 \%$ top-1 accuracy on ImageNet, $5 7 . 9 \%$ mIoU on ADE20K val and $5 9 . 2 \%$ bounding box AP on COCO val with ImageNet-22K pre-training. Apart from applying $g ^ { n } \mathbf { C } \mathbf { o n v }$ in visual encoders, we further test the generality of our designs on task-specific decoders. By adding $g \mathrm { C o n v }$ to the widely used feature fusion model FPN [36], we develop HorFPN to model the high-order spatial relationships of features from different hierarchical levels. We observe that HorFPN can also consistently improve various dense prediction models with lower computational costs. Our results demonstrate that $g ^ { n } \mathbf { C } \mathbf { o n v }$ can be a promising alternative to self-attention for visual modeling and effectively combine the merits of both vision Transformers and CNNs.
+
+# 2 Related Work
+
+Vision Transformers. The Transformer architecture [56] is originally designed for the natural language processing tasks. Since Dosovitskiy et al. [16] show that vision models constructed only by the Transformer blocks and a patch embedding layer can also achieve competitive performance to CNNs, many new models have been proposed to modify the Transformer-based architecture and make it more suitable for various vision tasks [42, 58, 60, 9, 66, 55]. Different from the original designs in [16], state-of-the-art vision Transformers usually utilize a CNN-like hierarchical architecture and change the global self-attention among all patches to local self-attention to avoid the quadratic complexity. In this paper, we follow the overall architecture of the previous hierarchical vision Transformers [42] and replace the self-attention sub-layer with our proposed $g ^ { n } \mathbf { C } \mathbf { o n v }$ to fairly compare with the previous Transformer-based models.
+
+Convolution-based models. Inspired by the recent success of vision Transformers, several papers propose to adopt the Transformer-style architecture and spatial convolutions with a large kernel size to improve the performance of CNNs. Han et al. [20] replace the window self-attention in Swin Transformers with large-kernel dynamic convolutions and achieve better performance. GFNet [46] proposes to perform the global spatial interactions like vision Transformers with global filters in the frequency domain, which are equivalent to depth-wise convolutions with a global kernel size and circular padding. ConvNeXt [43] thoroughly analyzes the designs in recent vision Transformers and presents a strong convolutional model with $7 \times 7$ depth-wise convolutions. RepLKNet [14] explores CNN models with very large kernels (up to $3 1 \times 3 1$ ), showing good scalability as vision Transformers. VAN [19] and FocalNet [65] use gated convolutions to perform input-adaptive attention and adopts large-kernel dilated convolutions and multiple successive $3 \times 3$ convolutions respectively to produce the weights. Previous work focuses on the meta architecture [67], large-kernel designs and inputadaptive weights to improve CNNs by learning from vision Transformers. In this paper, we offer a new perspective of high-order spatial attention to analyze the merits of vision Transformers. We show that the proposed HorNet that combines the advantages of both CNNs and vision Transformers is a better architecture for various vision tasks.
+
+Hybrid models. Combining vision Transformers and CNNs to develop hybrid architectures is a new direction in various visual recognition problems. Recently, several efforts have been made to integrate the two types of blocks into a unified model with a sequential [12, 29, 68, 63] or parallel [45, 11] design. Many enhanced vision Transformers also use lightweight convolutions in the basic building block to efficiently capture neighboring patterns [15, 60, 17] or relax the quadratic complexity of self-attention [9, 58, 18]. Different from these hybrid models, we aim to develop a self-attention free model while combining the favorable properties of both vision Transformers and CNNs.
+
+# 3 Method
+
+# 3.1 ${ \pmb { g } } ^ { n } { \bf C } { \bf 0 } { \bf n } { \bf v }$ : Recursive Gated Convolutions
+
+In this section, we will present $g ^ { n } \mathbf { C } \mathbf { o n v }$ , an efficient operation to achieve long-term and high-order spatial interactions. The $g ^ { n } \mathbf { C } \mathbf { o n v }$ is built with standard convolutions, linear projections and elementwise multiplications, but has a similar function of input-adaptive spatial mixing to self-attention.
+
+Input-adaptive interactions with gated convolution. Recent success in vision Transformers mainly depends on the proper modeling of the spatial interactions in visual data. Unlike CNNs that simply use the static convolution kernel to aggregate neighboring features, vision Transformers apply multi-head self-attention to dynamically generate the weights to mix spatial tokens. However, the quadratic complexity w.r.t. the input size of the self-attention largely hinders the application of vision Transformers, especially on downstream tasks including segmentation and detection where higher-resolution feature maps are required. In this work, instead of reducing the complexity of self-attention like previous methods [42, 9, 57], we seek a more efficient and effective way to perform spatial interactions with simple operations like convolution and fully-connected layers.
+
+The basic operation of our method is the gated convolution $( g \mathbf { C o n v } )$ . Let $\mathbf { x } \in \mathbb { R } ^ { H W \times C }$ be the input feature, the output of the gated convolution $\mathbf { y } = g \mathbf { C o n v } ( \mathbf { x } )$ can be written as:
+
+$$
+\begin{array} { r } { [ \mathbf { p } _ { 0 } ^ { H W \times C } , \mathbf { q } _ { 0 } ^ { H W \times C } ] = \phi _ { \mathrm { i n } } ( \mathbf { x } ) \in \mathbb { R } ^ { H W \times 2 C } , } \\ { \mathbf { p } _ { 1 } = f ( \mathbf { q } _ { 0 } ) \odot \mathbf { p } _ { 0 } \in \mathbb { R } ^ { H W \times C } , \quad \mathbf { y } = \phi _ { \mathrm { o u t } } ( \mathbf { p } _ { 1 } ) \in \mathbb { R } ^ { H W \times C } , } \end{array}
+$$
+
+where $\phi _ { \mathrm { i n } } , \phi _ { \mathrm { o u t } }$ are linear projection layers to perform channel mixing and $f$ is a depth-wise convolution. Note that $\begin{array} { r } { p _ { 1 } ^ { ( i , c ) } = \sum _ { j \in \Omega _ { i } } { w _ { i \to j } ^ { c } q _ { 0 } ^ { ( j , c ) } \bar { p _ { 0 } ^ { ( i , c ) } } } } \end{array}$ , where $\Omega _ { i }$ is the local window centered at $i$ and $w$ represents the convolution weight of $f$ . Therefore, the above formulation explicitly introduce interactions among the neighboring features $\mathbf { p } _ { 0 } ^ { ( i ) }$ and $\mathbf { q } _ { 0 } ^ { ( j ) }$ through the element-wise multiplication. We consider the interaction in $g \mathrm { C o n v }$ as $I$ -order interaction as each $\mathbf { p } _ { 0 } ^ { ( i ) }$ has interacted with its neighbor feature $\mathbf { q } _ { 0 } ^ { ( j ) }$ only once.
+
+High-order interactions with recursive gating. After achieving an efficient 1-order spatial interactions with the $g \mathrm { C o n v }$ , we then design the $g ^ { n } \mathbf { C } \mathbf { o n v }$ , a recursive gated convolution to further enhance the model capacity by introducing higher-order interactions. Formally, we first use $\phi _ { \mathrm { i n } }$ to obtain a set of projected features p0 and {qk}n−1k=0 :
+
+$$
+\left[ \mathbf { p } _ { 0 } ^ { H W \times C _ { 0 } } , \mathbf { q } _ { 0 } ^ { H W \times C _ { 0 } } , \dots , \mathbf { q } _ { n - 1 } ^ { H W \times C _ { n - 1 } } \right] = \phi _ { \mathrm { i n } } ( \mathbf { x } ) \in \mathbb { R } ^ { H W \times ( C _ { 0 } + \sum _ { 0 \leq k \leq n - 1 } C _ { k } ) } .
+$$
+
+We then perform the gated convolution recursively by
+
+$$
+\mathbf { p } _ { k + 1 } = f _ { k } ( \mathbf { q } _ { k } ) \odot g _ { k } ( \mathbf { p } _ { k } ) / \alpha , \qquad k = 0 , 1 , \ldots , n - 1 ,
+$$
+
+where we scale the output by $1 / \alpha$ to stabilize the training. $\{ f _ { k } \}$ are a set of depth-wise convolution layers and $\left\{ g _ { k } \right\}$ are used to match the dimension in different orders:
+
+$$
+g _ { k } = \Big \{ \mathrm { I d e n t i t y } , \quad k = 0 ,
+$$
+
+Finally, we feed the output of the last recursion step $\mathbf { q } _ { n }$ to the projection layer $\phi _ { \mathrm { o u t } }$ to obtain the result of the $g ^ { n } \mathbf { C } \mathbf { o n v }$ . From the recursive formula Equation (3.3), it is easy to show that the interaction-order of $\mathbf { p } _ { k }$ will be increased by 1 after each step. As a result, we can see that the $g ^ { n } \mathbf { C o n v }$ achieves $n$ -order spatial interactions. It is also worth noting that we need only a single $f$ to perform depthwise convolution to the concatenation of the features $\scriptstyle \{ \mathbf { q } _ { k } \} _ { k = 0 } ^ { n - 1 }$ together instead of computing the convolution in each recursive step as in Equation (3.3), which can further simplify the implementation and improve the efficiency on GPUs. To ensure that the high-order interactions do not introduce too much computational overhead, we set the channel dimension in each order as:
+
+$$
+C _ { k } = { \frac { C } { 2 ^ { n - k - 1 } } } , \qquad 0 \leq k \leq n - 1 .
+$$
+
+This design indicates that we perform the interactions in a coarse-to-fine manner, where lower orders are computed with fewer channels. Besides, the channel dimension of $\phi _ { \mathrm { i n } } ( \mathbf { x } )$ is exactly $2 C$ and the total FLOPs can be strictly bounded even with $n$ increasing. It can be proved that (see Appendix A):
+
+$$
+\mathrm { F L O P s } ( g ^ { n } \mathrm { C o n v } ) < H W C ( 2 K ^ { 2 } + 1 1 / 3 \times C + 2 ) ,
+$$
+
+where $K$ is the kernel size of the depth-wise convolution. Therefore, our $g ^ { n } \mathbf { C } \mathbf { o n v }$ achieves high-order interactions with a similar computational cost to a convolutional layer.
+
+Long-term interactions with large kernel convolutions. Another difference between vision Transformers and conventional CNNs is the receptive field. Conventional CNNs [49, 22] often use $3 \times 3$ convolution through the whole network, while vision Transformers calculate self-attention on the whole feature maps [16, 52] or inside a relatively large local window (e.g., $7 \times 7$ ). The large receptive field in vision Transformers makes it easier to capture long-term dependencies, which is also recognized as one of the key advantages of vision Transformers. Inspired by this design, there are some efforts to introduce large kernel convolutions to CNNs recently [14, 43, 46]. To make our $g ^ { n } \mathbf { C } \mathbf { o n v }$ capable of capturing long-term interactions, we adopt two implementations for the depth-wise convolution $f$ :
+
+
+Figure 2: Overview of the basic building block in HorNet with $g ^ { n } \mathbf { C o n v } .$ We adopt the block design of Transformers [56] and replace the self-attention sub-layer with $g ^ { n } \mathbf { C o n v }$ to develop our HorNet (left). We also provide the detailed implementation of $g ^ { 3 } \mathrm { C o n v }$ (middle) and the Pytorch-style code for an arbitrary order (right).
+
+• $7 \times 7$ Convolution. $7 \times 7$ is the default window/kernel size of Swin Transformers [42] and ConvNext [43]. Studies in [43] show that the kernel size produces good performance on ImageNet classification and various downstream tasks. We follow this configuration to fairly compare with representative work of vision Transformers and modern CNNs. Global Filter $( G F )$ . The GF layer [46] multiplies the frequency domain features with learnable global filters, which is equivalent to a convolution in the spatial domain with a global kernel size and circular padding. We use a modified version of the GF layer by processing half of the channels with the global filter and the other half with $3 \times 3$ depth-wise convolutions and only use GF layers in late stages to preserve more local details.
+
+Spatial interactions in vision models. We review some representative vision model designs from the perspective of spatial interactions, as shown in Figure 1. Specifically, we are interested in the interactions between a feature $\mathbf { x } _ { i }$ and its neighboring feature $\mathbf { x } _ { j } , j \in \Omega _ { i }$ . By using the tool designed for explaining the interaction effect (IE) in [33, 1], we provide an intuitive analysis of the order of explicit spatial interactions in Appendix B. Our analysis reveals a key difference between vision Transformers and previous architectures from a new view, i.e., vision Transformers have higher-order spatial interactions in each basic block. The result inspires us to explore an architecture that can realize more efficient and effective spatial interactions with more than two orders. As discussed above, our proposed $g ^ { n } \mathbf { C } \mathbf { o n v }$ can achieve arbitrary-order interactions with bounded complexity. It is also worth noting that similar to other scaling factors in deep models like width [69] and depth [22], simply increasing the order of spatial interactions without considering the overall model capacity will not lead to a good trade-off [51]. In this paper, we focus on developing a stronger visual modeling architecture based on the analysis of the spatial interaction orders of well-designed models. We believe a more thorough and formal discussion on the high-order spatial interactions can be an important future direction.
+
+Relation to dot-product self-attention. Although the computation of our $g ^ { n } \mathbf { C } \mathbf { o n v }$ largely differs from dot-product self-attention, we will show that $g ^ { n } \mathbf { C } \mathbf { o n v }$ also accomplishes the goal of inputadaptive spatial mixing. Let $\mathbf { M }$ be the attention matrix obtained by multi-head self-attention (MHSA), we write $\mathbf { M }$ as $( m _ { i j } ^ { c } )$ since the mixing weight may vary across the channels. The spatial mixing result (before the final channel mixing projection) of the $c$ -th channel at location $i$ is
+
+$$
+x _ { \mathrm { M H S A } } ^ { ( i , c ) } = \sum _ { j \in \Omega _ { i } } m _ { i j } ^ { c } v ^ { ( i , j ) } = \sum _ { j \in \Omega _ { i } } \sum _ { c ^ { \prime } = 1 } ^ { C } \underline { { m _ { i j } ^ { c } } } w _ { V } ^ { ( c ^ { \prime } , c ) } x ^ { ( j , c ^ { \prime } ) } ,
+$$
+
+where $w _ { V }$ is the weight of the V-projection layer. Note that $m _ { i j }$ obtained by the dot-product operation contains 1-order interaction. On the other hand, the output of our $g ^ { n } \mathbf { C } \mathbf { o n v }$ (before the $\phi _ { \mathrm { o u t } }$ ) can be written as
+
+$$
+x _ { g ^ { n } \mathrm { C o n v } } ^ { ( i , c ) } = p _ { n } ^ { ( i , c ) } = \sum _ { j \in \Omega _ { i } } \sum _ { c ^ { \prime } = 1 } ^ { C } \underline { { w _ { n - 1 , i \to j } ^ { c } } } \underline { { \mathbf { g } _ { n - 1 } ^ { ( i , c ) } } } w _ { \phi _ { \mathrm { i n } } } ^ { ( c ^ { \prime } , c ) } x ^ { ( j , c ^ { \prime } ) } \triangleq \sum _ { j \in \Omega _ { i } } \sum _ { c ^ { \prime } = 1 } ^ { C } \underline { { h _ { i j } ^ { c } } } w _ { \phi _ { \mathrm { i n } } } ^ { ( c ^ { \prime } , c ) } x ^ { ( j , c ^ { \prime } ) } ,
+$$
+
+where $w _ { n - 1 }$ is the convolutional weight for $f _ { n - 1 } , w _ { \phi _ { \mathrm { i n } } }$ is the linear weight of $\phi _ { \mathrm { i n } }$ , and $\mathbf { g } _ { n - 1 } =$ $g _ { n - 1 } ( \mathbf { p } _ { n - 1 } )$ is a projection of $\mathbf { p } _ { n - 1 }$ . From the formulation in Equation (3.8) we find our $g ^ { n } \mathbf { C } \mathbf { o n v }$ also achieves input-adaptive spatial mixing with $\{ h _ { i j } ^ { c } \}$ as the weights. Observing that $h _ { i j }$ is computed from $\mathbf { p } _ { n - 1 }$ which contains $n - 1$ order interactions, we can regard our $g ^ { n } \mathbf { C o n v }$ as an extension of the self-attention in terms of the order of the spatial mixing weight. Therefore, our $g ^ { n } \mathbf { C o n v }$ can better model more complex spatial interactions.
+
+The details of $g ^ { n } \mathbf { C } \mathbf { o n v }$ and our implementation are summarized in Figure 2.
+
+# 3.2 Model Architectures
+
+HorNet. The $g ^ { n } \mathbf { C } \mathbf { o n v }$ can be a drop-in replacement of the spatial mixing layer in vision Transformers [52, 42] or modern CNNs [43]. We follow the same meta-architecture as [56, 42] to construct HorNet, where the basic block contains a spatial mixing layer and a feed-forward network (FFN). Depending on the model size and the implementation of the depth-wise convolution $f _ { k }$ in our $g ^ { n } \mathbf { C } \mathbf { o n v }$ we have two series of model variants named HorNet-T/S/B/L $7 \times 7$ and HorNet-T/S/B/LGF. We consider the popular Swin Transformer [42] and ConvNeXt [43] as the vision Transformer and CNN baselines since our models are implemented based on a convolution-based framework while having high-order interactions like vision Transformers. To fairly compare with the baselines, we directly follow the number of blocks of Swin Transformers-S/B/L [42] but insert an extra block to the stage 2 to make the overall complexity close, resulting in [2, 3, 18, 2] blocks in each stage in all of the model variants. We simply adjust the base number of channels $C$ to construct models with different sizes and set the number of channels in 4 stages as $[ C , 2 C , 4 C , 8 C ]$ following common practice. We use $C = 6 4$ , 96, 128, 192 for HorNet-T/S/B/L, respectively. We set the interaction orders (i.e., the $n$ in $g ^ { n } \mathbf { C } \mathbf { o n v } )$ for each stage as 2,3,4,5 by default, such that the channels of the coarsest order $C _ { 0 }$ is the same across different stages.
+
+HorFPN. Apart from using $g ^ { n } \mathbf { C o n v }$ in visual encoders, we find our $g ^ { n } \mathbf { C } \mathbf { o n v }$ can be an enhanced alternative for standard convolution that considers higher-order spatial interactions in a wide range of convolution-based models. Thus, we replace spatial convolutions for feature fusion in the FPN [37] with our $g ^ { n } \mathbf { C } \mathbf { o n v }$ to improve spatial interactions for downstream tasks. Specifically, we add our $g ^ { n } \mathbf { C } \mathbf { o n v }$ after the fusion of features from different pyramid levels. For object detection, we replace the $3 \times 3$ convolution after the top-down pathway with the $g ^ { n } \mathbf { C } \mathbf { o n v }$ in each level. For semantic segmentation, we simply replace the $3 \times 3$ convolution after the concatenation of the multi-level feature maps with $g ^ { n } \mathbf { C } \mathbf { o n v }$ since the final results are directly predicted from this concatenated feature. We also have two implementations called $\mathrm { H o r F P N } _ { 7 \times 7 }$ and $\mathrm { H o r F P N } _ { \mathrm { G F } }$ decided by the choice of $f _ { k }$ .
+
+# 4 Experiments
+
+We conduct extensive experiments to verify the effectiveness of our method. We present the main results on ImageNet [13] and compare them with various architectures. We also test our models on the downstream dense prediction tasks on commonly used semantic segmentation benchmark ADE20K [71] and object detection dataset COCO [38]. Lastly, we provide ablation studies of our designs and analyze the effectiveness of $g ^ { n } \mathbf { C o n v }$ on a wide range of models.
+
+# 4.1 ImageNet Classification
+
+Setups. We conduct image classification experiments on the widely used ImageNet [13] dataset. We train our HorNet-T/S/B models using the standard ImageNet-1K dataset following common practice. To fairly compare with previous work, we directly use the training configurations of [43, 42, 52] to train our models. We train the models for 300 epochs with $2 2 4 \times 2 2 4$ input. To evaluate the scaling ability of our designs, we further train the HorNet-L models on the ImageNet-22K dataset that contains over $1 0 \times$ images and more categories. We follow previous practice [42, 43] to train our models for 90 epochs and use a similar data augmentation strategy as ImageNet-1K experiments.
+
+Table 1: ImageNet classification results. We compare our models with state-of-the-art vision Transformers and CNNs that have comparable FLOPs and parameters. We report the top-1 accuracy on the validation set of ImageNet as well as the number of parameters and FLOPs. We also show the improvements over Swin Trasnformers that have similar overall architectures and training configurations to our models. “ $\uparrow 3 8 4 ^ { \circ }$ indicates that the model is fine-tuned on $3 8 4 \times 3 8 4$ images for 30 epochs. Our models are highlighted in gray.
+
+
Model
Image Size
(M)
Params FLOPs Top-1 (G)
Acc.(%)
ImageNet-1K trained models
EfficientNet-B4 [51]
3802
19
4.2
82.9
EfficientNet-B5[51]
4562
30
9.9
83.6
EfficientNet-B6 [51]
5282
43
19.0
84.0
EfficientNetV2-S[51]
3002
24
8.8
83.9
RepLKNet-31B [14]
2242
79
15.3
83.5
VAN-B [19]
2242
27
5.0
82.8
VAN-L [19]
2242
45
9.0
83.9
CSWin-T[15]
224²
23
4.3
82.7
CSWin-S[15]
2242
35
6.9
83.6
CSWin-B[15]
2242
78
15.0
84.2
Swin-T[42]
2242
28
4.5
81.3
ConvNeXt-T[43]
2242
29
4.5
82.1(+0.7)
HorNet-T7×7
224²
22
4.0
82.8(+1.5)
HorNet-TGF
2242
23
3.9
83.0(+1.7)
Swin-S [42]
2242
50
8.7
83.0
ConvNeXt-S [43]
2242
50
8.7
83.1(+0.1)
HorNet-S7×7
224²
50
8.8
83.8(+0.8)
HorNet-SGF
224²
50
8.7
84.0(+1.0)
Swin-B [42]
224²
89
15.4
83.5
ConvNeXt-B [43]
2242
88
15.4
83.8(+0.3)
HorNet-B7×7
2242
87
15.6
84.2(+0.7)
HorNet-BGF
224²
88
15.5
84.3(+0.8)
+
+
Model
Image Size
(M)
Params FLOPs Top-1 (G)
Acc. (%)
ImageNet-1K trained models (fine-tuned at 384×384)
Swin-B↑384 [42]
3842
89
47.1
84.5
ConvNeXt-B↑384 [43]
384²
88
45.0
85.1(+0.6)
HorNet-B7×7↑384
3842
87
45.8
85.3(+0.8)
HorNet-BGF↑384
3842
92
45.4
85.6(+1.1)
ImageNet-22K trained models (fine-tuned to ImageNet-1K)
R-101x3 [30]
3842
388
204.6
84.4
R-152x4 [30]
4802
937
840.5
85.4
ViT-B/16 [16]
3842
87
55.5
84.0
ViT-L/16 [16]
3842
305
191.1
85.2
EfficientNetV2-L [51]
3802
121
53.0
86.8
CSWin-L[15]
3842
173
96.8
87.5
SwinV2-L [41]
3842
197
115.4
87.6
RepLKNet-31L [14]
3842
172
96.0
86.6
Swin-L [42]
224²
197
34.5
86.3
ConvNeXt-L [43]
2242
198
34.4
86.6(+0.3)
HorNet-L7×7
224²
195
34.8
86.8(+0.5)
HorNet-LGF
224²
196
34.6
87.0(+0.7)
Swin-L↑384 [42]
3842
197
103.9
87.3
ConvNeXt-L↑384 [43]
3842
198
101.0
87.5(+0.2)
HorNet-L7×7↑384
384²
195
102.3
87.6(+0.3)
HorNet-LGF↑384
3842
202
101.8
87.7(+0.4)
+
+We fine-tune the models pre-trained on ImageNet-22K or at the $2 2 4 \times 2 2 4$ resolution to ImageNet-1K or/and $3 8 4 \times 3 8 4$ resolution for 30 epochs following [43]. When adapting the ImageNet-22K models to ImageNet-1K, we initialize the classifier with the pre-trained class centers to stabilize the training process. More details can be found in Appendix C.
+
+Results. The results of our ImageNet classification experiments are summarized in Table 1. We see that our models achieve very competitive performance with state-of-the-art vision Transformers and CNNs. Notably, HorNet surpasses Swin Transformers and ConvNeXt which have similar overall architectures and training configurations by a healthy margin on various model sizes and settings. Our models also generalize well to a larger image resolution, larger model sizes and more training data. These results clearly demonstrate the effectiveness and generality of our designs.
+
+# 4.2 Dense Prediction Tasks
+
+HorNet for semantic segmentation. We evaluate our HorNet for semantic segmentation task on ADE20K [71] dataset using the commonly used UperNet [62] framework. All the models are trained for 160k iterations using AdamW [44] optimizer with a global batch size of 16. The image size during training is $5 1 2 \times 5 1 2$ for ImagNet-1k (HorNet-T/S/B) pre-trained models and $6 4 0 \times 6 4 0$ for the ImageNet-22K pre-trained models (HorNet-L). The results are summarized in the left part of Table 2, where we report both the single-scale (SS) and multi-scale (MS) mIoU on the validation set. Both our $\mathrm { H o r N e t } _ { 7 \times 7 }$ and HorNetGF models outperform Swin [42] and ConvNeXt [43] models with similar model sizes and FLOPs. Specifically, HorNetGF models achieve better results than $\mathrm { H o r N e t } _ { 7 \times 7 }$ and ConvNeXt series by large margins in single-scale mIoU, indicating the global interactions captured by the global filter are helpful for semantic segmentation. Notably, we find both our HorNet- $\mathbf { \cdot L } _ { \mathbf { \nabla } \times \mathbf { 7 } }$ and HorNet-LGF even outperform ConvNeXt-XL with ${ \sim } 2 5 \%$ fewer FLOPs. These results clearly demonstrate the effectiveness and scalability of our HorNet on semantic segmentation.
+
+HorNet for object detection. We also evaluate our models on the COCO [38] dataset. We adopt the cascade Mask R-CNN framework [21, 2] to perform object detection and instance segmentation using HorNet-T/S/B/L backbones. Following Swin [42] and ConvNeXt [43], we use $3 \times$ schedule with multi-scale training. The right part of Table 2 compares the box AP and mask AP of our HorNet models and Swin/ConvNeXt models. Similarly, we show our HorNet models achieve consistently and significantly better performance than the Swin/ConvNeXt counterparts, in both box AP and mask AP. The HorNetGF series obtain $+ 1 . 2 { \sim } 2 . 0$ box AP and $+ 1 . 0 { \sim } 1 . 9$ mask AP compared with ConvNeXt.
+
+Table 2: Object detection and semantic segmentation results with different backbones. We use UperNet [62] for semantic segmentation and Cascade Mask R-CNN [2] for object detection. ‡ indicates that the model is pre-trained on ImageNet-22K. For semantic segmentation, we report both single-scale (SS) and multi-scale (MS) mIoU. The FLOPs are calculated with image size (2048, 512) for ImageNet-1K pre-trained models and (2560, 640) for ImageNet-22K pre-trained models. For object detection, we report the box AP and the mask AP. FLOPs are measured on input sizes of (1280, 800). Our models are highlighted in gray.
+
+
Backbone
Semantic Segmentation with UperNet 160K
Object Detection with Cascade Mask R-CNN 3×
mIoUss
mIoUms
Params
FLOPs
APbox
Apmask
Params
FLOPs
Swin-T[42]
44.5
45.8
60M
945G
50.4
43.7
86M
745G
ConvNeXt-T[43]
46.0
46.7
60M
939G
50.4
43.7
86M
741G
HorNet-T7×7
48.1
48.9
52M
926G
51.7
44.8
80M
730G
HorNet-TGF
49.2
49.3
55m
924G
52.4
45.6
80M
728G
Swin-S [42]
47.6
49.5
81M
1038G
51.9
45.0
107M
838G
ConvNeXt-S[43]
48.7
49.6
82M
1027G
51.9
45.0
108M
827G
HorNet-S7×7
49.2
49.8
81M
1030G
52.7
45.6
107M
830G
HorNet-SGF
50.0
50.5
85M
1027G
53.3
46.3
108M
827G
Swin-B [42]
48.1
49.7
121M
1188G
51.9
45.0
145M
982G
ConvNeXt-B [43]
49.1
49.9
122M
1170G
52.7
45.6
146M
964G
HorNet-B7×7
50.0
50.5
121M
1174G
53.3
46.1
144M
969G
HorNet-BGF
50.5
50.9
126M
1171G
54.0
46.9
146M
965G
Swin-L [42]
52.1
53.5
234M
2468G
53.9
46.7
253M
1382G
ConvNeXt-L [43]
53.2
53.7
235M
2458G
54.8
47.6
255M
1354G
ConvNeXt-XL+ 43]
53.6
54.0
391M
3335G
55.2
47.7
407M
1898G
HorNet-L×7
54.1
54.5
232M
2473G
55.4
48.0
251M
1363G
HorNet-LGF
55.0
55.2
239M
2465G
56.0
48.6
259M
1358G
+
+Table 3: Comparisons of HorFPN with standard FPN on different backbones. We use UperNet 160K and Mask R-CNN $1 \times$ schedule for semantic segmentation and object detection, respectively. We find our HorFPN consistently outperforms standard FPN with various of backbones on both the two tasks.
+
+
Backbone
Fusion Module
Semantic Segmentation with UperNet 160K
Object Detection with Mask R-CNN 1×
mIoUss
mIoUms
Params
FLOPs
Apbox
Apmask
Params
FLOPs
ResNet-50 [22]
FPN [37]
40.7
41.8
66M
947G
38.2
34.7
44M
260G
HorFPN7×7
41.8
44.1
60M
499G
38.7
35.1
43M
226G
HorFPNGF
43.2
44.5
60M
497G
39.1
35.5
43M
224G
ResNet-101 [22]
FPN[37]
42.9
44.0
85M
1025G
40.0
36.1
63M
336G
HorFPN7×7
44.1
45.5
79M
577G
40.3
36.4
62M
302G
HorFPNGF
44.5
46.4
79M
574G
40.5
36.7
62M
300G
Swin-S [42]
FPN [37]
47.6
49.5
81M
1038G
45.5
40.9
69M
354G
HorFPN7×7
48.0
49.2
74M
580G
46.3
41.1
68M
325G
HorFPNGF
49.0
49.9
75M
578G
46.8
41.9
69M
323G
HorNet-S
FPN [37]
49.2
49.8
81M
1030G
47.1
42.2
69M
351G
HorFPN7×7
49.4
50.1
74M
577G
47.4
42.3
68M
322G
HorFPNGF
49.7
50.3
75M
575G
47.7
42.4
68M
321G
+
+Again, our large model HorNet- $\mathbf { { \cdot } } \mathbf { L } _ { 7 \times 7 }$ and HorNetGF can outperform ConvNeXt-XL, which further validates the favorable transferability with a larger model size and larger pre-trained dataset.
+
+HorFPN for dense prediction. We now show another application of the proposed $g ^ { n } \mathbf { C } \mathbf { o n v }$ , i.e., to serve as a better fusion module that can better capture the higher-order interactions among different levels of features in dense prediction tasks. Specifically, we directly modify the FPN [37] as described in Section 3.2 in UperNet [62] and Mask R-CNN [21] for semantic segmentation and object detection, respectively.We show the results in Table 3, where we compare the performance of our HorFPN and standard FPN on different backbones including ResNet-50/101 [22], Swin-S [42] and HorNet- $\mathbf { S } _ { 7 \times 7 }$ . For semantic segmentation, we find our HorFPN can
+
+Table 4: Object detection results with recent state-of-the-art frameworks. We report the single-scale $\mathbf { A P } ^ { \mathrm { b o x } }$ and $\mathbf { A P } ^ { \mathrm { m a s k } }$ on the validation set of COCO. Our models are highlighted in gray.
+
+
Backbone
Framework
APbox
Apmask
Swin-L [42]
HTC++ [3]
57.1
49.5
ViT-Adapter-L [5]
HTC++ [3]
57.9
50.2
HorNet-LGF
HTC++ [3]
58.1
50.5
Swin-L [42]
DINO [70]
58.5
=
HorNet-LGF
DINO [70]
59.2
+
+Table 5: Semantic Segmentation results with recent state-of-theart frameworks. We report the single-scale (SS) and multi-scale (MS) mIoU on the validation set of ADE20K. Our models are highlighted in gray.
+
+
Backbone
Framework
mIoUss
mIoUms
Swin-L [42]
Mask2Former [7]
56.1
57.3
Swin-L-FaPN[27]
Mask2Former [7]
56.4
57.7
HorNet-LGF
Mask2Former [7]
57.5
57.9
+
+significantly reduce the FLOPs $( \sim 5 0 \% )$ while achieving better validation mIoU. For object detection,
+
+Table 6: Ablation study and results of applying ${ \pmb { g } } ^ { n } { \bf C o n v }$ to other models/operations. We provide the ablation study of our designs in (a). $[ { ^ { * } } ]$ indicates the baseline of our model. The baseline and our final models are highlighted in gray. In (b) and (c), we apply the proposed $g ^ { n } \mathbf { C } \mathbf { o n v }$ to isotropic models that have a similar level of complexity with ViT/DeiT-S [16, 52] and other spatial mixing operations including the $3 \times 3$ depth-wise convolution and $3 \times 3$ pooling used in [67].
+(a) Ablation study.
+
+
Model
Params
FLOPs
Acc. (%)
Swin-T[42]
28M
4.5G
81.3(+0.1)
- Self-Attention + DWConv7×7 [*]
29M
4.5G
81.2
+ SE [25]
30M
4.5G
81.5(+0.3)
- SE+g{1,1,1,1)Conv
28M
4.3G
81.7(+0.5)
+ g12.22.Conv
28M
4.3G
82.2(+1.0)
+ g(3.3Conv
28M
4.3G
82.5(+1.3)
+ g14.4.Conv
28M
4.3G
82.5(+1.3)
+g(1,2,3.)Conv
28M
4.3G
82.5(+1.3)
+ g2.34.5/Conv
28M
4.3G
82.6(+1.4)
+ Deeper & Narrower (HorNet-T7×7)
22M
4.0G
82.8(+1.6)
+ Global Filters [46] (HorNet-TGF)
23M
3.9G
83.0(+1.8)
ConvNeXt [43]
28M
4.5G
82.1(+0.9)
+
+(b) Results on isotropic models.
+
+
Model
FLOPs
Acc. (%)
DeiT-S[52]
4.6G
79.8
ConvNeXt-S (iso.) [43]
4.3G
79.7
HorNet-S7×7 (iso.) HorNet-SGF (iso.)
4.5G 4.5G
80.6 81.0
(c) g"Conv for other operations.
Model
FLOPs
Acc. (%)
DWConV3×3
4.0G
80.7
g"ConV3x3
3.9G
82.1
Pool [67]
3.9G
78.1
g"Convpool
3.8G
79.3
+
+
+Figure 3: Comparisons of trade-offs of Swin, ConvNeXt and HorNet. We compare the trade-offs of the models via the top-1 accuracy on ImageNet w.r.t. (a) number of parameters; (b) FLOPs; (c) latency. The latency is measured with a single NVIDIA RTX 3090 GPU with a batch size of 128.
+
+our HorFPN can also outperform standard FPN in terms of both box AP and mask AP on different backbones with about 30G fewer FLOPs. Besides, we observe that the $_ \mathrm { H o r F P N _ { G F } }$ is consistently better than $\mathrm { H o r F P N } _ { 7 \times 7 }$ , indicating that global interactions are also important when fusing hierarchical features.
+
+Results with state-of-the-art frameworks. To further show the effectiveness our backbone, we conduct experiments to combine our large HorNet model with recent state-of-the-art dense prediction frameworks including $\mathrm { H T C + + }$ [3], DINO [70] and Mask2Former [7]. For $\mathrm { H T C + + }$ and DINO, we train our models on COCO for 36 epochs $3 \times$ schedule) and does not introduce extra pre-training data like Object365 in [70]. We report the single-scale performance on the validation set and compared with several state-of-the-art methods in Table 4. For Mask2Former, we train our models on ADE20K with $6 4 0 \times 6 4 0$ . We report the mIoU of both single-scale and multi-scale testing on the validation set in Table 5.
+
+# 4.3 Analysis
+
+Ablation study. We provide detailed ablation studies of the $g ^ { n } \mathbf { C } \mathbf { o n v }$ and our HorNet in Table 6. We first study the model designs of our HorNet in Table 6a. Our baseline $( [ ^ { * } ] )$ is obtained by simply replacing the self-attention with $7 \times 7$ depth-wise convolution in Swin-T [42]. We first show that both SE [25] and our $g ^ { n } \mathbf { C } \mathbf { o n v }$ with $n = 1$ $( g ^ { \{ 1 , 1 , 1 , 1 \} } \mathrm { C o n v } )$ can improve over the baseline model $[ { ^ { * } } ]$ and $g ^ { \{ 1 , 1 , \bar { 1 } , 1 \} } \mathrm { \bar { C } o n v }$ is slightly better. We then perform ablations on the interaction order $n$ for each stage and find: (1) if $n$ is shared across the 4 stages, the accuracy will increase with larger $n$ but saturate at 82.5 when $n = 4$ ; (2) progressively increased order $( g ^ { \{ 2 , 3 , 4 , 5 \} } \mathrm { C o n v } )$ can further improve the accuracy. Our final models are built on $g ^ { \{ 2 , 3 , 4 , 5 \} }$ Conv by adjusting the depth and width of the networks $( \mathrm { H o r N e t - T } _ { 7 \times 7 } )$ and applying Global Filter [46] for the depth-wise convolution (HorNet-TGF). These results clearly show that our $g ^ { n } \mathbf { C } \mathbf { o n v }$ is an efficient and extendable operation that can better capture high-order spatial interactions than both self-attention and depth-wise convolution.
+
+
+Figure 4: Visualization of the adaptive weights generated by $g ^ { n } \mathbf { C o n v }$ . We see that the spatial mixing weights of our $g ^ { n } \mathbf { C o n v }$ are adaptive both to input samples and spatial locations, which further indicates that $g ^ { n } \mathbf { C o n v }$ shares these two desirable characteristics with the self-attention operation.
+
+$\pmb { g } ^ { n } \mathbf { C _ { 0 n v } }$ for isotropic models. We also evaluate $g ^ { n } \mathbf { C o n v }$ on isotropic architectures (with constant spatial resolutions). We replace the self-attention in DeiT-S [52] with our $g ^ { n } \mathbf { C o n v }$ and adjust the number of blocks to 13 to obtain the isotropic HorNet- $S _ { 7 \times 7 }$ and HorNet- $S _ { \mathrm { G F } }$ . We compare DeiT-S, isotropic ConvNeXt-S and isotropic HorNet-S in Table 6b. While isotropic ConvNeXt-S cannot improve DeiT-S, our isotropic HorNet surpasses DeiT-S by a large margin. These results indicate that our $g ^ { n } \mathbf { C } \mathbf { o n v }$ can better realize the functions of self-attention compared to plain convolutions and have better ability to model the complex spatial interactions.
+
+$\pmb { g } ^ { n } \mathbf { C _ { 0 n v } }$ for other operations. To further demonstrate the universality of $g ^ { n } \mathbf { C } \mathbf { o n v }$ , we use $3 \times 3$ depth-wise convolution and $3 \times 3$ pooling [67] as the basic operation in the $g ^ { n } \mathbf { C o n v }$ . The results in Table 6c show that $g ^ { n } \mathbf { C } \mathbf { o n v }$ can also improve these two operations by large margins, indicating our $g ^ { n } \mathbf { C } \mathbf { o n v }$ is potentially more powerful when equipped with some better basic operations.
+
+Accuracy-complexity trade-offs. We visualize accuracy-complexity trade-offs of Swin, ConvNeXt and HorNet series in Figure 3. For fair comparisons, we fix the input image size to $2 2 4 \times 2 2 4$ and use $\mathrm { H o r N e t } _ { 7 \times 7 }$ such that all the compared models are based on $7 \times 7$ local window. We see HorNet can achieve better trade-offs than the representative vision Transformers and modern CNNs with regards to model size, FLOPs and GPU latency.
+
+Visualization. We provide some visualizations of the adaptive weights learned by $g ^ { n } \mathbf { C o n v }$ in Figure 4. For each sample, we show the value of c $\textstyle { \frac { 1 } { C } } \sum _ { c = 1 } ^ { C } h _ { i j } ^ { c }$ (see Equation (3.8) or the definition $h _ { i j . } ^ { c }$ from layer $\{ 1 , \stackrel { - } { 3 } , \stackrel { \cdot } { 5 } , 7 , 8 , 1 2 \}$
+model. Figure 4 demonstrates that the spatial mixing weights of our $g ^ { n } \mathbf { C } \mathbf { o n v }$ are adaptive both to input samples and spatial locations, which further indicates that $g ^ { n } \mathbf { C } \mathbf { o n v }$ shares these two desirable characteristics with the self-attention operation.
+
+Limitations. While HorNet shows better overall latency-accuracy trade-offs, we notice that HorNet is slower than ConvNeXt with similar FLOPs on GPU, which may be caused by the more complex designs to perform the high-order interactions. We think that developing a more hardware-friendly operation for high-order spatial interactions is an interesting future direction to improve our work.
+
+# 5 Conclusion
+
+We have presented the Recursive Gated Convolution $( g ^ { n } \mathbf { C } \mathbf { o n v } )$ that performs efficient, extendable, and translation-equivariant high-order spatial interactions with gated convolutions and recursive deigns. $g ^ { n } \mathbf { C } \mathbf { o n v }$ can serve as a drop-in replace of the spatial mixing layer in various vision Transformers and convolution-based models. Based on the operation, we have constructed a new family of generic vision backbones HorNet. Extensive experiments demonstrate the effectiveness of $g ^ { n } \mathbf { C o n v }$ and HorNet on commonly used visual recognition benchmarks. We hope our attempt can inspire future work to further explore the high-order spatial interactions in vision models.
+
+# Acknowledgments
+
+Jiwen Lu was supported in part by the National Key Research and Development Program of China under Grant 2017YFA0700802, the National Natural Science Foundation of China under Grant 62125603 and Grant U1813218, and a grant from the Beijing Academy of Artificial Intelligence (BAAI).
+
+References
+[1] Chunrong Ai and Edward C Norton. Interaction terms in logit and probit models. Economics letters, 80(1):123–129, 2003. 5, 15
+[2] Zhaowei Cai and Nuno Vasconcelos. Cascade r-cnn: Delving into high quality object detection. In CVPR, pages 6154–6162, 2018. 7, 8, 17
+[3] Kai Chen, Jiangmiao Pang, Jiaqi Wang, Yu Xiong, Xiaoxiao Li, Shuyang Sun, Wansen Feng, Ziwei Liu, Jianping Shi, Wanli Ouyang, et al. Hybrid task cascade for instance segmentation. In CVPR, pages 4974–4983, 2019. 8, 9
+[4] Yinpeng Chen, Xiyang Dai, Mengchen Liu, Dongdong Chen, Lu Yuan, and Zicheng Liu. Dynamic convolution: Attention over convolution kernels. In CVPR, pages 11030–11039, 2020. 2
+[5] Zhe Chen, Yuchen Duan, Wenhai Wang, Junjun He, Tong Lu, Jifeng Dai, and Yu Qiao. Vision transformer adapter for dense predictions. arXiv preprint arXiv:2205.08534, 2022. 8
+[6] Bowen Cheng, Ishan Misra, Alexander G Schwing, Alexander Kirillov, and Rohit Girdhar. Maskedattention mask transformer for universal image segmentation. arXiv preprint arXiv:2112.01527, 2021. 1
+[7] Bowen Cheng, Ishan Misra, Alexander G Schwing, Alexander Kirillov, and Rohit Girdhar. Maskedattention mask transformer for universal image segmentation. In CVPR, pages 1290–1299, 2022. 8, 9
+[8] Bowen Cheng, Alex Schwing, and Alexander Kirillov. Per-pixel classification is not all you need for semantic segmentation. NeurIPS, 34, 2021. 1
+[9] Xiangxiang Chu, Zhi Tian, Yuqing Wang, Bo Zhang, Haibing Ren, Xiaolin Wei, Huaxia Xia, and Chunhua Shen. Twins: Revisiting the design of spatial attention in vision transformers. NeurIPS, 34, 2021. 3, 4
+[10] Ekin D Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V Le. Randaugment: Practical automated data augmentation with a reduced search space. In CVPRW, pages 702–703, 2020. 16
+[11] Yutao Cui, Jiang Cheng, Limin Wang, and Gangshan Wu. Mixformer: End-to-end tracking with iterative mixed attention. CVPR, 2022. 3
+[12] Zihang Dai, Hanxiao Liu, Quoc V Le, and Mingxing Tan. Coatnet: Marrying convolution and attention for all data sizes. NeurIPS, 34:3965–3977, 2021. 1, 3
+[13] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, pages 248–255, 2009. 2, 6, 16, 17
+[14] Xiaohan Ding, Xiangyu Zhang, Yizhuang Zhou, Jungong Han, Guiguang Ding, and Jian Sun. Scaling up your kernels to 31x31: Revisiting large kernel design in cnns. CVPR, 2022. 2, 3, 5, 7
+[15] Xiaoyi Dong, Jianmin Bao, Dongdong Chen, Weiming Zhang, Nenghai Yu, Lu Yuan, Dong Chen, and Baining Guo. Cswin transformer: A general vision transformer backbone with cross-shaped windows. CVPR, 2022. 3, 7
+[16] 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. arXiv preprint arXiv:2010.11929, 2020. 1, 3, 4, 7, 9
+[17] Stéphane d’Ascoli, Hugo Touvron, Matthew L Leavitt, Ari S Morcos, Giulio Biroli, and Levent Sagun. Convit: Improving vision transformers with soft convolutional inductive biases. In ICML, pages 2286–2296, 2021. 3
+[18] Haoqi Fan, Bo Xiong, Karttikeya Mangalam, Yanghao Li, Zhicheng Yan, Jitendra Malik, and Christoph Feichtenhofer. Multiscale vision transformers. In ICCV, pages 6824–6835, 2021. 1, 3
+[19] Meng-Hao Guo, Cheng-Ze Lu, Zheng-Ning Liu, Ming-Ming Cheng, and Shi-Min Hu. Visual attention network. arXiv preprint arXiv:2202.09741, 2022. 3, 7
+[20] Qi Han, Zejia Fan, Qi Dai, Lei Sun, Ming-Ming Cheng, Jiaying Liu, and Jingdong Wang. Demystifying local vision transformer: Sparse connectivity, weight sharing, and dynamic weight. arXiv preprint arXiv:2106.04263, 2021. 2, 3
+[21] Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross Girshick. Mask r-cnn. In ICCV, 2017. 7, 8
+[22] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, pages 770–778, 2016. 1, 4, 5, 8, 16
+[23] Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997. 16
+[24] 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 arXiv:1704.04861, 2017. 1
+[25] Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In CVPR, pages 7132–7141, 2018. 2, 9, 18
+[26] Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In ECCV, pages 646–661, 2016. 17
+[27] Shihua Huang, Zhichao Lu, Ran Cheng, and Cheng He. Fapn: Feature-aligned pyramid network for dense image prediction. In ICCV, pages 864–873, 2021. 8
+[28] Xu Jia, Bert De Brabandere, Tinne Tuytelaars, and Luc V Gool. Dynamic filter networks. NeurIPS, 29, 2016. 2
+[29] Zihang Jiang, Qibin Hou, Li Yuan, Daquan Zhou, Xiaojie Jin, Anran Wang, and Jiashi Feng. Token labeling: Training a $8 5 . 5 \%$ top-1 accuracy vision transformer with 56m parameters on imagenet. arXiv preprint arXiv:2104.10858, 2021. 3
+[30] Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (bit): General visual representation learning. In ECCV, pages 491–507. Springer, 2020. 7
+[31] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. NeurIPS, 25:1097–1105, 2012. 1
+[32] Yann LeCun, Bernhard Boser, John S Denker, Donnie Henderson, Richard E Howard, Wayne Hubbard, and Lawrence D Jackel. Backpropagation applied to handwritten zip code recognition. Neural computation, 1(4):541–551, 1989. 1
+[33] Samuel Lerman, Charles Venuto, Henry Kautz, and Chenliang Xu. Explaining local, global, and higherorder interactions in deep learning. In ICCV, pages 1224–1233, 2021. 5, 15
+[34] Yanghao Li, Hanzi Mao, Ross Girshick, and Kaiming He. Exploring plain vision transformer backbones for object detection. arXiv preprint arXiv:2203.16527, 2022. 2
+[35] Yanghao Li, Chao-Yuan Wu, Haoqi Fan, Karttikeya Mangalam, Bo Xiong, Jitendra Malik, and Christoph Feichtenhofer. Mvitv2: Improved multiscale vision transformers for classification and detection. In CVPR, pages 4804–4814, 2022. 17, 18
+[36] Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In CVPR, pages 2117–2125, 2017. 3
+[37] Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In CVPR, pages 2117–2125, 2017. 6, 8
+[38] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, pages 740–755. Springer, 2014. 2, 6, 7
+[39] Hanxiao Liu, Zihang Dai, David So, and Quoc V Le. Pay attention to mlps. NeurIPS, 34:9204–9215, 2021. 16
+[40] Kai Liu, Tianyi Wu, Cong Liu, and Guodong Guo. Dynamic group transformer: A general vision transformer backbone with dynamic group attention. IJCAI, 2022. 18
+[41] Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, et al. Swin transformer v2: Scaling up capacity and resolution. arXiv preprint arXiv:2111.09883, 2021. 1, 7
+[42] 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. arXiv preprint arXiv:2103.14030, 2021. 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 17
+[43] Zhuang Liu, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer, Trevor Darrell, and Saining Xie. A convnet for the 2020s. CVPR, 2022. 2, 3, 5, 6, 7, 8, 9, 16, 17
+[44] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. 7, 17
+[45] Xuran Pan, Chunjiang Ge, Rui Lu, Shiji Song, Guanfu Chen, Zeyi Huang, and Gao Huang. On the integration of self-attention and convolution. arXiv preprint arXiv:2111.14556, 2021. 3
+[46] Yongming Rao, Wenliang Zhao, Zheng Zhu, Jiwen Lu, and Jie Zhou. Global filter networks for image classification. In NeurIPS, 2021. 2, 3, 5, 9
+[47] Tal Ridnik, Emanuel Ben-Baruch, Asaf Noy, and Lihi Zelnik-Manor. Imagenet-21k pretraining for the masses. arXiv:2104.10972, 2021. 17
+[48] Carlos Riquelme, Joan Puigcerver, Basil Mustafa, Maxim Neumann, Rodolphe Jenatton, André Susano Pinto, Daniel Keysers, and Neil Houlsby. Scaling vision with sparse mixture of experts. NeurIPS, 34, 2021. 1
+[49] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. 1, 4
+[50] Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In CVPR, pages 1–9, 2015. 1
+[51] Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In ICML, pages 6105–6114, 2019. 1, 5, 7
+[52] 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. 1, 4, 6, 9, 10
+[53] Hugo Touvron, Matthieu Cord, Alexandre Sablayrolles, Gabriel Synnaeve, and Hervé Jégou. Going deeper with image transformers. arXiv preprint arXiv:2103.17239, 2021. 16
+[54] Zhengzhong Tu, Hossein Talebi, Han Zhang, Feng Yang, Peyman Milanfar, Alan Bovik, and Yinxiao Li. Maxim: Multi-axis mlp for image processing. In CVPR, pages 5769–5780, 2022. 16
+[55] Zhengzhong Tu, Hossein Talebi, Han Zhang, Feng Yang, Peyman Milanfar, Alan Bovik, and Yinxiao Li. Maxvit: Multi-axis vision transformer. ECCV, 2022. 3
+[56] 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, pages 5998–6008, 2017. 2, 3, 5, 6
+[57] Sinong Wang, Belinda Z Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768, 2020. 4
+[58] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In ICCV, 2021. 3
+[59] Yan Wang, Lingxi Xie, Chenxi Liu, Siyuan Qiao, Ya Zhang, Wenjun Zhang, Qi Tian, and Alan L. Yuille. SORT: second-order response transform for visual recognition. In IEEE International Conference on Computer Vision, ICCV 2017, Venice, Italy, October 22-29, 2017, pages 1368–1377. IEEE Computer Society, 2017. 16
+[60] 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. 3
+[61] Sitong Wu, Tianyi Wu, Haoru Tan, and Guodong Guo. Pale transformer: A general vision transformer backbone with pale-shaped attention. In AAAI, volume 36, pages 2731–2739, 2022. 18
+[62] Tete Xiao, Yingcheng Liu, Bolei Zhou, Yuning Jiang, and Jian Sun. Unified perceptual parsing for scene understanding. In ECCV, pages 418–434, 2018. 7, 8, 17
+[63] Tete Xiao, Mannat Singh, Eric Mintun, Trevor Darrell, Piotr Dollár, and Ross Girshick. Early convolutions help transformers see better. NeurIPS, 34:30392–30400, 2021. 3
+[64] Shen Yan, Xuehan Xiong, Anurag Arnab, Zhichao Lu, Mi Zhang, Chen Sun, and Cordelia Schmid. Multiview transformers for video recognition. arXiv preprint arXiv:2201.04288, 2022. 1
+[65] Jianwei Yang, Chunyuan Li, and Jianfeng Gao. Focal modulation networks. arXiv preprint arXiv:2203.11926, 2022. 3
+[66] Jianwei Yang, Chunyuan Li, Pengchuan Zhang, Xiyang Dai, Bin Xiao, Lu Yuan, and Jianfeng Gao. Focal attention for long-range interactions in vision transformers. NeurIPS, 34, 2021. 3
+[67] Weihao Yu, Mi Luo, Pan Zhou, Chenyang Si, Yichen Zhou, Xinchao Wang, Jiashi Feng, and Shuicheng Yan. Metaformer is actually what you need for vision. arXiv preprint arXiv:2111.11418, 2021. 3, 9, 10
+[68] 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 on imagenet. arXiv:2101.11986, 2021. 3
+[69] Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016. 5
+[70] Hao Zhang, Feng Li, Shilong Liu, Lei Zhang, Hang Su, Jun Zhu, Lionel M Ni, and Heung-Yeung Shum. Dino: Detr with improved denoising anchor boxes for end-to-end object detection. arXiv preprint arXiv:2203.03605, 2022. 1, 8, 9
+[71] Bolei Zhou, Hang Zhao, Xavier Puig, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Scene parsing through ade20k dataset. In CVPR, pages 633–641, 2017. 2, 6, 7
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes] See our analysis in Section 4.3.
+(c) Did you discuss any potential negative societal impacts of your work? [N/A] We propose a general framework for visual recognition. Our method is not for specific applications, which does not directly involve societal issues.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes]
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We follow the common practice in previous papers, where they didn’t report the error bars.
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See our implementation details provided in the supplemental material.
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [N/A]
+(c) Did you include any new assets either in the supplemental material or as a URL? [No]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/tyrJsbKAe6/tyrJsbKAe6.md b/md/dev/tyrJsbKAe6/tyrJsbKAe6.md
new file mode 100644
index 0000000000000000000000000000000000000000..61d420f0c992e967a57da8dbc113e197042e543a
--- /dev/null
+++ b/md/dev/tyrJsbKAe6/tyrJsbKAe6.md
@@ -0,0 +1,1609 @@
+# PESSIMISTIC MODEL-BASED OFFLINE REINFORCEMENT LEARNING UNDER PARTIAL COVERAGE
+
+Masatoshi Uehara, Wen Sun Department of Computer Science Cornell University, Ithaca, NY 14850, USA $\{ \mathtt { m u } 2 2 3 , \mathtt { w s } 4 5 5 \} ($ @cornell.edu
+
+# ABSTRACT
+
+We study model-based offline Reinforcement Learning with general function approximation without a full coverage assumption on the offline data distribution. We present an algorithm named Constrained Pessimistic Policy Optimization (CPPO) which leverages a general function class and uses a constraint over the model class to encode pessimism. Under the assumption that the ground truth model belongs to our function class (i.e., realizability in the function class), CPPO has a PAC guarantee with offline data only providing partial coverage, i.e., it can learn a policy that competes against any policy that is covered by the offline data. We then demonstrate the flexibility of CPPO: it can be seamlessly applied to many specialized Markov Decision Processes where additional structural assumptions further refine the concept of partial coverage. Two notable examples are: (1) lowrank MDP with representation learning where the partial coverage condition is defined using a relative condition number measured by the unknown ground truth feature representation; (2) factored MDP where the partial coverage condition is defined using density ratios associated with individual factors.
+
+# 1 INTRODUCTION
+
+Offline Reinforcement Learning (RL) is one of the important areas of RL where the learner is presented with a static dataset consisting of transition-related information (state, action, reward, and next state) collected by some behavior policy, and needs to learn purely from the offline data without any future online interaction with the environment. Offline RL is used in a number of applications where online random experimentation is costly or dangerous such as health care (Kosorok & Laber, 2019), digital marketing (Chen et al., 2019) and robotics (Levine et al., 2020).
+
+The performance guarantees of offline RL often rely on two quantities: the coverage of the offline data and the property of the function approximation used in the algorithms. For instance, for the classic Fitted-Q-iteration (FQI) algorithm (Ernst et al., 2005; Munos & Szepesvari, 2008), it requires ´ (a) full coverage in the offline data, i.e., $\begin{array} { r } { \operatorname* { m a x } _ { ( s , a ) } d ^ { \pi } ( s , a ) / \rho ( s , a ) < \infty } \end{array}$ for any stochastic policies $\pi$ including history-dependent non-Markovian policies, where $d ^ { \pi } ( s , a )$ is a state-action occupancy distribution of a policy $\pi$ and $\rho ( s , a )$ is an offline distribution, (b) realizability in a Q function class, i.e., the optimal Q function belongs to the function class, and (c) Bellman completeness, i.e., applying the Bellman operator on any function in the function class results in a new function that also belongs to the function class (see the first row in Table 1). Among these three assumptions, the full coverage and the Bellman completeness are particularly strong. The full coverage means that the behavior policy needs to be exploratory enough, although figuring out an exploratory policy itself is an extremely hard problem for large-scale MDPs. The Bellman completeness assumption does not have a monotonic property, i.e., even starting with a function class that originally permits Bellman completeness, slightly increasing the capacity of the function class could result in a new class that does not have Bellman completeness anymore. Thus, we aim to relax the assumptions on the offline data and the function class. Particularly, we are interested in the following question:
+
+Given a realizable function class and an offline distribution that only provides partial coverage, can we learn a policy that is able to compete with any policy that is covered by the offline distribution?
+
+We study this question from a model-based learning perspective and provide an affirmative answer to the question. More specifically, different from FQI, we start with a realizable model class, i.e., the ground truth transition falls into the model class. We further abandon the strong full coverage assumption, and instead, assume partial coverage which means the offline data distribution only covers a state-action distribution of some high-quality comparator policy $\pi ^ { * }$ $\pi ^ { * }$ is not necessarily
+
+
+
+Table 1: Comparison among existing works regarding their type, coverage, and additional structural assumptions on the function class or MDPs. Type $\mathbf { F }$ means model-free and type $\mathbf { B }$ means modelbased. Partial coverage means 2that the offline distribution $\rho$ covers a state-action distribution of a comparator policy $\pi ^ { * }$ . $\dagger$ means it assumes an accurate density estimator for $\rho ( s , a )$ . $^ { \dag \dag }$ means although the analysis in Jin et al. (2020a) is done under the full coverage for linear MDPs, based on the argument (Zhang et al., 2021b), we can show the algorithm has the PAC guarantee under partial coverage in terms of the relative condition number for linear MDPs. $\dag \dag \dag$ means that we can refine it to a more adaptive quantity using the model class (i.e., Definition 1). All the methods in the table require realizability in the function class.
+
+the optimal policy, and $\pi ^ { * }$ could be non-Markovian), i.e., $\begin{array} { r } { \operatorname* { m a x } _ { s , a } { d ^ { \pi ^ { * } } ( s , a ) } / { \rho ( s , a ) } < \infty } \end{array}$ , We design an algorithm — Constrained Pessimistic Policy Optimization (CPPO), which can learn a policy that is as good as any comparator policy $\pi ^ { * }$ that is covered by the offline data. The fact that CPPO can learn to compete against history-dependent policies is meaningful in offline RL when the offline data does not cover the optimal policy.
+
+While one could assume density ratio based concentrability coefficient $\begin{array} { r } { ( \operatorname* { m a x } _ { s , a } { d ^ { \pi ^ { * } } ( s , a ) } / { \rho ( s , a ) } ) } \end{array}$ to be under control for small size MDPs, in large-scale MDPs (e.g. continuous state space), the density ratio could quickly become an extremely large quantity which makes the performance guarantee vacuous. When applying CPPO to MDPs with additional structural assumptions, we can seamlessly refine the density ratio based concentrability coefficient to more natural and tighter quantities. Notably, we consider the offline representation learning setting where the underlying MDPs permit a low-rank structure (unlikely linear MDPs (Jin et al., 2020a; Yang & Wang, 2020), we do not assume the ground truth state-action feature representation $\phi ^ { \star }$ is known, and instead we need to learn $\phi ^ { \star }$ ) and we show that we can refine the density ratio to a relative condition number that is defined using the unknown true state-action feature representation $\phi ^ { \star }$ . Intuitively this means that as long as there exists a high-quality comparator policy that only visits the subspace (defined using the true representation $\phi$ ) that is covered by the offline data, CPPO can compete against such a policy, even without knowing the true $\phi ^ { \star }$ . Such bounded relative condition number assumption is much weaker than the bounded density ratio assumption.3 While the concept of relative condition number was originally introduced in the online RL setting (e.g., Agarwal et al. (2020c;a) with a known linear feature $\phi _ { , }$ ), and later was introduced in offline RL (Zhang et al. (2021b); Chang et al. (2021)), these prior works all rely on the fact that the feature representation $\phi$ is known to the learner a priori (see Table 1 for the comparison). Another interesting example is factored MDPs (Kearns & Koller, 1999) where we show CPPO refines the density ratios to be density ratio associated with individual factors, which leverages the factored structure and is provably tighter. We also give examples on linear MDPs (Yang & Wang, 2020), kernelized nonlinear regulator (KNRs) (Kakade et al., 2020), where we again show that CPPO enjoys problem specific quantities for measuring the coverage.
+
+Our contributions. Our contributions are two folds, which we summarize below:
+
+1. We show that in the model-based setting, realizability and partial coverage is enough to learn a high-quality comparator policy (Theorem 1). Notably, (1) this result holds for any MDPs with realizable model classes, (2) we can compete against even history-dependent policies. This is in sharp contrast to the state-of-art provable model-free offline RL results: see Table 1 on page 2 for detailed comparisons to prior works.
+
+2. Under additional structural assumptions (e.g., KNRs, linear MDPs (Yang & Wang, 2020), linear mixture MDPs (Ayoub et al., 2020), low-rank MDPs, factored MDPs), we show that we can seamlessly refine the density ratio based concentrability coefficients to problem specific quantities. This flexibility to adapt to problem specific coverage measuring quantities is in sharp contrast to other model-free offline RL algorithms such as minimax based approaches (Uehara et al., 2020) which, to the best of our knowledge, cannot leverage MDP’s structures (e.g., linear MDPs) to refine its density ratio based concentrability coefficients.
+
+While we focus on the model-based setting and have demonstrated advantages of our approach over model-free ones (i.e., no more Bellman completeness assumption on function classes, being able to compete against a larger pool of policies, and the ability to seamlessly adapt to problem dependent structures), it is worth noting that realizability in the model-based setting is usually considered stronger than the one in the model-free setting. On the empirical side, model-based offline RL algorithms are the state-of-art (e.g., Yu et al. (2020); Kidambi et al. (2020); Matsushima et al. (2020); Cang et al. (2021); Chang et al. (2021)). Our theoretical results provide a sharp contrast between model-based and model-free approaches in offline RL.
+
+# 2 RELATED WORK
+
+We discuss two families of related works of offline RL. In Appendix C, we discuss related works about representation learning in RL.
+
+Insufficient coverage of the dataset due to the lack of online exploration is known as the main challenge in offline RL (Wang et al., 2020). To deal with this problem, a number of methods have been recently proposed from both model-free (Wu et al., 2019; Touati et al., 2020; Kumar et al., 2020; Liu et al., 2020; Rezaeifar et al., 2021; Fujimoto et al., 2019; Fakoor et al., 2021; Ghasemipour et al., 2021; Buckman et al., 2020) and model-based perspectives (Yu et al., 2020; Kidambi et al., 2020; Matsushima et al., 2020; Yin et al., 2021). More or less, their methods rely on the idea of pessimism and its variants in the sense that the learned policy can avoid uncertain regions not covered by offline data. As a theoretical side, Munos & Szepesvari (2008); Duan et al. (2020; ´ 2021); Fan et al. (2020) proved FQI has a PAC (probably approximately correct) guarantee under realizability, the global coverage, and Bellman completeness conditions. Other offline model-free RL methods such as minimax offline RL methods also require realizability and the global coverage (Chen & Jiang, 2019; Antos et al., 2008; Uehara et al., 2021; Duan et al., 2021; Zhang et al., 2020; Nachum et al., 2019). Recently, by leveraging the aforementioned the pessimism idea, Jin et al. (2020a); Rajaraman et al. (2020) showed that pessimistic FQI can be applied to partial coverage setting for linear and tabular MDPs. Comparing to their works, our analysis focuses on modelbased approaches with general function approximation. The offline model-based method is known to have a PAC guarantee under the realizability and the global coverage (Ross & Bagnell, 2012; Chen & Jiang, 2019). As the most closely related work, Chang et al. (2021) proved a model-based method with an additional penalty term can weaken the assumption from the global coverage to the partial coverage for structured MDPs such as KNRs and Gaussian Processes models (Deisenroth & Rasmussen, 2011). In this work, we consider arbitrary MDPs with a realizable model class and aim for PAC bounds under a partial coverage condition.
+
+# 3 PRELIMINARIES
+
+We consider a Markov Decision process (MDP) $\mathcal { M } = \{ \boldsymbol { S } , \mathcal { A } , P , \gamma , r , d _ { 0 } \}$ where $P : \mathcal { S } \times \mathcal { A } \Delta ( \mathcal { S } )$ is the transition, $r : \mathcal { S } \times \mathcal { A } [ 0 , 1 ]$ is the reward function, $\gamma \in [ 0 , 1 )$ is the discount factor, and $d _ { 0 } \in \Delta ( S )$ is the initial state distribution. A policy $\pi$ maps from state (or history) to distribution over actions. Given a policy $\pi$ and a transition distribution $P$ , $V _ { P } ^ { \pi }$ denotes the expected cumulative reward of $\pi$ under $P , d _ { 0 }$ and $r$ . Similarly, $Q _ { P } ^ { \pi } : S \times { \mathcal { A } } \to \mathbb { R } , A _ { P } ^ { \pi } : S \times { \mathcal { A } } \to \mathbb { R }$ are a $\mathrm { Q } \mathrm { \mathrm { . } }$ - function and advantage-function under $P$ and $\pi$ . Given a transition $P$ , we denote $\pi ( P )$ as the optimal policy associated with moaverage state-action distribution of l u $P$ under reward er the transiti $r$ . We a model den, i.e, $d _ { P } ^ { \pi } \subset \Delta ( S \times \mathcal { A } )$ $\pi$ $P$ $\begin{array} { r } { d _ { P } ^ { \pi } \overset { } { = } ( 1 - \gamma ) \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } d _ { P , t } ^ { \pi } } \end{array}$ where $d _ { P , t } ^ { \pi } \in \Delta ( S \times \mathcal { A } )$ is the distribution of $( s _ { t } , a _ { t } )$ under $\pi$ and $P$ at a time-step $t$ . We denote the true transition distribution as $P ^ { \star }$ , which we do not know in advance. For simplicity, we suppose $r$ is known. The extension to the unknown reward is straightforward.
+
+In the offline RL setting, we have an offline distribution $\rho \in \Delta ( S \times \mathcal { A } )$ , and an offline dataset $\mathcal { D } = \{ s ^ { ( i ) } , a ^ { ( i ) } , r ^ { ( i ) } , s ^ { \prime ( \bar { i } ) } \} _ { i = 1 } ^ { n }$ which is sampled in the following way: $s , a \sim \rho , r = r ( s , a ) , s ^ { \prime } \sim$ $P ^ { \star } ( \cdot | s , a )$ . We hope to obtain $\pi ( P ^ { \star } ) = \arg \operatorname* { m a x } _ { \pi } V _ { P ^ { \star } } ^ { \pi }$ from this offline dataset without any further interaction with the environment. We often denote $\begin{array} { r } { ^ { \mathbb { E } } _ { \mathcal { D } } [ f ( s , a , s ^ { \prime } ) ] = 1 / n \sum _ { ( s , a , s ^ { \prime } ) \in \mathcal { D } } f \big ( s , a , s ^ { \prime } \big ) } \end{array}$ . Our goal is to construct an offline RL algorithm $\mathrm { A l g }$ , which maps from $\mathcal { D }$ to $\pi$ so that the suboptimality gap V π∗P ? − V Alg(D)P ? for any comparator policy $\pi ^ { * } \in \Pi$ is minimized, where $\Pi$ in this work can be an unrestricted policy class (e.g., including non-Markovian policies). Hereafter, $c , c _ { 1 } , c _ { 2 } , \cdots$ are always universal constants.
+
+Partial coverage. Throughout this work, we do not assume $\rho$ has global coverage. The global coverage in this work means that the density ratio based concentrability coefficient $d _ { P ^ { \star } } ^ { \pi } ( s , \bar { a } ) / \rho ( s , a )$ is upper-bounded by some constant $C \in \mathbb { R } ^ { + }$ for all polices $\pi \in \Pi$ , or the feature covariance matrix corresponding to the offline distribution $\mathbb { E } _ { s , a \sim \rho } \boldsymbol { \phi } ( \bar { s } , a ) \boldsymbol { \phi } ( s , a ) ^ { \top }$ $( \phi \in \mathcal { S } \times \mathcal { A } \mathbb { R }$ is a feature representation) is full rank and has a non-zero minimum eigenvalue, which are commonly used assumptions in offline RL (Munos, 2005; Antos et al., 2008; Chen & Jiang, 2019; Duan et al., 2020). Under the full coverage, they show the output policy can compete with the globally optimal policy $\pi ( P ^ { \star } )$ . However, this assumption may not be true in practice as computing an exploratory policy itself is a challenging task for large-scale RL problems. Instead, we are interested in the partial coverage setting such as $d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s , a ) / \rho ( s , a ) \leq C$ , which means the state-action occupancy measure under some comparator policy $\pi ^ { * }$ is covered by the offline dataset. We want to design an algorithm that can compete against any policy $\pi ^ { * }$ that is covered by the offline data. This assumption is much weaker than the global coverage.
+
+# 4 PESSIMISTIC MODEL-BASED OFFLINE RL
+
+We first introduce a general model-based algorithm that has a PAC guarantee of the suboptimality gap under partial coverage defined with a newly introduced concentrability coefficient. The algorithm takes a realizable model class as input and outputs a policy that is as good as any comparator policy that is covered by the offline data in the sense of the bounded concentrability coefficient.
+
+Our algorithm, Constrained Pessimistic Policy Optimization (CPPO) (Algorithm 1), takes a realizable hypothesis class $\mathcal { M }$ (with $P ^ { \star } \in { \mathcal { M } }$ ) consisting of $| { \mathcal { M } } |$ candidate models as input, computes the maximum likelihood estimator (MLE) $\widehat { P } _ { \mathrm { M L E } }$ using the given offline data $\mathcal { D } = \{ s , a , s ^ { \prime } \}$ . It then forms a min-max objective subject to a constraint. The min-max objective introduces pessimism via searching for the least favorable model $P$ (in terms of its policy’s value $V _ { P } ^ { \pi }$ ) that is feasible with respect to the constraint. We can also express the constrained optimization procedure using a version space $\mathcal { M } _ { \mathcal { D } }$ and a policy optimization procedure defined below:
+
+$$
+\operatorname* { m a x } _ { \pi \in \Pi } \operatorname* { m i n } _ { P \in \mathcal { M } _ { \mathcal { D } } } V _ { P } ^ { \pi } , \mathrm { w h e r e } \mathcal { M } _ { \mathcal { D } } = \left\{ P \bigm | P \in \mathcal { M } , \mathbb { E } _ { \mathcal { D } } \left[ \mathrm { T V } ( \widehat { P } _ { \mathrm { M L E } } ( \cdot | s , a ) , P ( \cdot | s , a ) ) ^ { 2 } \right] \leq \xi \right\} ,
+$$
+
+where $\mathrm { T V } ( P _ { 1 } , P _ { 2 } )$ is a total variation (TV) distance between two distributions $P _ { 1 }$ and $P _ { 2 }$ . The version space $\mathcal { M } _ { \mathcal { D } }$ contains models that are not far away from $\widehat { P } _ { \mathrm { M L E } }$ in terms of the average TV distance under $\mathcal { D }$ . The version space is constructed such that with high probability $P ^ { \star } \in \mathcal { M } _ { \mathcal { D } }$ .
+
+Below we state the algorithm’s performance guarantee. Assuming for now that $P ^ { \star } \in \mathcal { M } _ { \mathcal { D } }$ holds with high probability, then, $\begin{array} { r } { \hat { V } ^ { \pi } : = \operatorname* { m i n } _ { P \in \mathcal { M } _ { D } } V _ { P } ^ { \pi } } \end{array}$ is a pessimistic policy evaluation estimator, which satisfies $\hat { V } ^ { \pi } \leq V _ { P ^ { \star } } ^ { \pi }$ for all $\pi \in \Pi$ . Using the idea of pessimism, we have the following observation:
+
+$$
+\begin{array} { r } { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } = V _ { P ^ { \star } } ^ { \pi ^ { * } } - \hat { V } ^ { \pi ^ { * } } + \hat { V } ^ { \pi ^ { * } } - V _ { P ^ { * } } ^ { \hat { \pi } } \leq V _ { P ^ { \star } } ^ { \pi ^ { * } } - \hat { V } ^ { \pi ^ { * } } + \hat { V } ^ { \hat { \pi } } - V _ { P ^ { * } } ^ { \hat { \pi } } \leq V _ { P ^ { * } } ^ { \pi ^ { * } } - \hat { V } ^ { \pi ^ { * } } , } \end{array}
+$$
+
+where the first inequality uses $\hat { \pi } = \arg \operatorname* { m a x } _ { \pi \in \Pi } \hat { V } ^ { \pi }$ and the second inequality uses $\hat { V } ^ { \pi } \leq V _ { P ^ { \star } } ^ { \pi }$ for all $\pi \in \Pi$ . Thus, the final error only incurs the policy evaluation error for the comparator policy $\pi ^ { * }$ , which leads to the error only depending on the concentrability coefficient for the comparator policy.
+
+We define the following new concentrability coefficient that uses the model class $\mathcal { M }$ :
+
+
1: Require: Models M, dataset D, parameter $, policy class I (note I could be unrestricted) 2: Obtain the estimator PMLE by MLE: PMLE = arg maX p∈M ED[ln P(s' | s, a)].
+
+Definition 1 (Model-based Concentrability Coefficient). For a comparator policy $\pi ^ { * }$ , we define the concentrability coefficient $C _ { \pi ^ { * } } ^ { \dagger }$ as follows:
+
+$$
+\begin{array} { r } { C _ { \pi ^ { * } } ^ { \dagger } = \operatorname* { s u p } _ { P ^ { \prime } \in \mathcal { M } } \frac { \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { * } } ^ { \pi ^ { * } } } [ \mathrm { T V } ( P ^ { \prime } ( \cdot | s , a ) , P ^ { \star } ( \cdot | s , a ) ) ^ { 2 } ] } { \mathbb { E } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ^ { \prime } ( \cdot | s , a ) , P ^ { \star } ( \cdot | s , a ) ) ^ { 2 } ] } . } \end{array}
+$$
+
+The following theorem shows CPPO learns a policy that competes against $\pi ^ { * }$ when $C _ { \pi ^ { * } } ^ { \dagger } < \infty$
+
+Theorem 1 (PAC Bound for CPPO with general function class). Assume $P ^ { \star } \in { \mathcal { M } }$ . We set $\xi =$ c 1 ln(c2|M|/δ)n . Then, with probability 1 − δ, for any comparator policy π∗ ∈ Π (Π can be the unrestricted policy class containing non-Markovian policies),
+
+$$
+\begin{array} { r } { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } \leq c _ { 3 } ( 1 - \gamma ) ^ { - 2 } \sqrt { \frac { C _ { \pi ^ { * } } ^ { \dagger } \ln ( c _ { 2 } | \mathcal { M } | / \delta ) } { n } } . } \end{array}
+$$
+
+To the best of our knowledge, this is the first algorithm that achieves a PAC guarantee for any $M D P s$ under the partial coverage assumption $C _ { \pi ^ { * } } ^ { \dagger } < \infty$ with only a realizable hypothesis class. We emphasize that the inequality in the above uniformly holds for all policies with probability $1 - \delta$ including history-dependent non-Markovian policies (see Remark 2). Note that the ability to compete against non-Markovian policies in offline RL is meaningful when the offline data does not cover the optimal policy $\pi ^ { \star }$ (i.e., there could be a high-quality history-dependent policy that is covered by the offline data against which we want to compete). In model-free approaches, this type of result generally cannot be obtained. Indeed, the model-free approach from Xie et al. (2021) requires $\Pi$ to be a restricted Markovian policy class, since their bound contains poly $( \ln ( | \Pi | ) )$ dependence. For the detailed discussion, refer to Remark 1.
+
+The quantity $C _ { \pi ^ { * } } ^ { \dagger }$ adaptively captures the discrepancy between the offline data and the state-action occupancy measure under a comparator policy $\pi ^ { * }$ depending on the model class $\mathcal { M }$ . For example, $C _ { \pi ^ { * } } ^ { \dagger }$ can be reduced to a relative condition number in KNRs. Besides, it is always upper bounded by the density ratio based concentrability coefficient:
+
+$$
+\begin{array} { r } { C _ { \pi ^ { * } , \infty } : = \operatorname* { s u p } _ { ( s , a ) } \frac { { d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s , a ) } } { \rho ( s , a ) } . } \end{array}
+$$
+
+One extreme case is that functions in $\mathcal { M }$ are all the same, which implies $C _ { \pi ^ { * } } ^ { \dagger } = 1$ regardless.
+
+Theorem 1 consider the case where the hypothesis class $\mathcal { M }$ is finite. When the hypothesis class is infinite, we can still obtain the PAC guarantee by utilizing the generalized result in Section A for any realizable model class with valid statistical complexity (e.g., localized Rademacher complexity).
+
+Prior works that achieve PAC guarantees with only realizable model classes rely on much stronger global coverage $\operatorname* { s u p } _ { \pi } C _ { \pi , \infty } < \infty$ (Chen & Jiang, 2019). Even when the comparator policy is the optimal policy $\pi ( P ^ { \star } )$ , the partial coverage condition $C _ { \pi ( P ^ { \star } ) , \infty } < \infty$ is weaker. Existing pessimistic model-based algorithms and their theoretical results (Chang et al., 2021) often assume that a point-wise model uncertainty measure is given as a by-product of model fitting, which limits the applicability to special linear models such as KNRs/GPs. CPPO can work for any MDPs with the realizable function class having a valid statistical complexity such that the MLE properly works.
+
+Remark 1 (Comparison to the model-free approach from Xie et al. (2021); Zanette et al. (2021) ). Xie et al. (2021) study the model-free setting where the function class $\mathcal { Q }$ models $Q$ functions assumed to be Bellman complete for any Markovian policy in Π. While directly comparing modelbased approaches to model-free approaches is hard as they use different inductive biases in function classes, we can leverage the approach from Chen & Jiang (2019, Corollary 6) to convert a model class $\mathcal { M }$ to a pair of $\mathcal { Q }$ and $\Pi$ class. Specifically, we can convert a model class $\mathcal { M }$ to a pair of $\mathcal { Q }$ class and Π class such that $\mathcal { Q }$ will be realizable and also Bellman complete with respect to all $\pi \in \operatorname { I I }$ . After such conversion from the model-based setting to the model-free setting, running the algorithm from Xie et al. (2021) using $\mathcal { Q }$ and Π achieves $V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } = \sqrt { C ^ { \diamond } \ln ( \vert \mathcal { M } \vert \vert \Pi \vert / n ) } , \forall \pi ^ { * } \in \Pi$ , where $C ^ { \circ }$ is some concentrability coefficient. For the detailed derivation, we refer readers to Appendix D. Since the suboptimality gap from such conversion incurs $\log | \Pi |$ , a policy class $\Pi$ cannot be too large. Especially, unlike our results, it cannot take the unrestricted policy class as Π. This restriction cannot be fixed even if we use natural policy gradient (NPG) algorithms unless models have special structures (Xie et al., 2021; Zanette et al., 2021). The details are given in Section $D$ .
+
+Thus, our theorem indicates two advantages of model-based approaches: (1) realizability in function class is enough to ensure a PAC guarantee under a partial coverage condition, (2) it can compete against a larger pool of candidate policies including history-dependent non-Markovian policies, which is a meaningful property when the offline data does not cover the globally optimal policy. Next, we demonstrate another key advantage of our approach which is its flexibility to be seamlessly applied to MDPs with special structures.
+
+# 5 EXAMPLES WITH REFINED CONCENTRABILITY COEFFICIENTS
+
+In the previous section, our results apply to any MDP as long as its true transition belongs to a function class $\mathcal { M }$ . In this section, we consider several concrete MDPs with additional structural conditions. We show that by leveraging the additional structural conditions, we can refine the modelbased concentrability coefficient to more natural quantities. The examples that we discuss here are: (1) linear mixture MDPs which generalize linear MDPs from Yang & Wang (2020) and tabular MDPs, (2) KNRs which generalize LQRs, (3) low-rank MDPs, and (4) factored MDPs.
+
+Before proceeding, we clarify CPPO cannot capture linear MDPs in Jin et al. (2020a) that is different from the one (Yang & Wang, 2020) we use, and linear Bellman-complete MDPs (Duan et al., 2020) without any modification since MLE-based model learning is no longer applicable to them. However, other objective functions for learning models could be applied to these models (e.g., see the nonparametric model-based learning approach from Lykouris et al. (2021); Neu & Pike-Burke (2020) in the online setting), which we leave it as a future work.
+
+# 5.1 TABULAR MDPS AND LINEAR MIXTURE MDPS
+
+Tabular MDPs Tabular MDPs are MDPs where the state and action spaces are finite. Although the corresponding hypothesis class for tabular MDPs is infinite, we can still run MLE, that is, estimating $P ^ { \star }$ by the empirical distribution. Then, Algorithm 1 has the following guarantee.
+
+Corobility 1 (PAC, for all or tabular MDP). We set , $\begin{array} { r } { \xi = c _ { 1 } \frac { | S | ^ { 2 } | \mathcal { A } | \ln ( n | S | \mathcal { A } | c _ { 2 } / \delta ) } { n } } \end{array}$ . Then with proba$1 - \delta _ { : }$ $\pi ^ { * } \in \Pi$
+
+$$
+\begin{array} { r } { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } \leq c _ { 3 } ( 1 - \gamma ) ^ { - 2 } \left\{ \sqrt { \frac { C _ { \pi ^ { * } , \infty } | S | ^ { 2 } | A | \ln ( n | S | | A | c _ { 4 } / \delta ) } { n } } \right\} . } \end{array}
+$$
+
+Here, for tabular MDPs with $\mathcal { M } = \{ P : P ( \cdot | s , a ) \in \Delta ( S ) , \forall s , a \}$ , the model-based concentrability coefficient in Definition 1 is equal to the density ratio based concentrability coefficient $C _ { \pi ^ { * } , \infty }$ which is the right quantity for small-size tabular MDPs.
+
+Linear mixture MDPs We define linear mixture MDPs (Ayoub et al., 2020; Modi et al., 2020). Definition 2 (Linear mixture MDPs). Given a feature vector $\psi : ( \mathcal { S } , \mathcal { A } , \mathcal { S } ) \mathbb { R } ^ { d }$ , a linear mixture MDP is an MDP where the ground truth transition is $\begin{array} { r } { P ^ { \star } ( s ^ { \prime } | s , a ) : = \theta ^ { \star \top } \psi ( s , a , s ^ { \prime } ) , \theta ^ { \star } \in \mathbb { R } ^ { d } } \end{array}$ .
+
+By setting, $\psi ( s , a , s ^ { \prime } ) = \mu ( s ^ { \prime } ) \otimes \phi ( s , a )$ ( $\otimes$ denotes the Kronecker product), linear mixture MDPs include the following linear MDPs (Yang & Wang, 2020):
+
+Definition 3 (Linear MDPs). Linear MDP has $\begin{array} { r } { P ^ { \star } ( s ^ { \prime } | s , a ) : = \sum _ { i = 1 } ^ { d _ { 1 } } \sum _ { j = 1 } ^ { d _ { 2 } } M _ { i j } ^ { \star } \mu _ { i } ( s ^ { \prime } ) \phi _ { j } ( s , a ) } \end{array}$ with $\mu : { \mathcal { S } } \mathbb { R } ^ { d _ { 1 } }$ and $\phi : \mathcal { S } \times \mathcal { A } \mathbb { R } ^ { d _ { 2 } }$ are known features, and $M ^ { \star } \subset \mathbb { R } ^ { d _ { 1 } \times d _ { 2 } }$ .
+
+We use CPPO to learn on linear mixture MDPs. The corresponding $\mathcal { M }$ is
+
+$$
+\begin{array} { r } { \mathcal { M } _ { \mathrm { M i x } } = \left\{ \theta ^ { \top } \psi ( s , a , s ^ { \prime } ) | \theta \in \Theta \subset \mathbb { R } ^ { d } , \int \theta ^ { \top } \psi ( s , a , s ^ { \prime } ) \mathrm { d } ( s ^ { \prime } ) = 1 \quad \forall ( s , a ) \right\} . } \end{array}
+$$
+
+Given a function $V ~ : ~ { \mathcal { S } } ~ \to ~ \mathbb { R }$ , define the state-action feature indexed by $V$ as $\psi _ { V } ( s , a ) : = \quad$ $\begin{array} { r l } { \int \psi ( s , a , s ^ { \prime } ) V ( s ^ { \prime } ) \mathrm { d } ( s ^ { \prime } ) } \end{array}$ , we have the following PAC guarantee.
+
+Corollary 2 (PAC bound for linear mixture MDPs). Suppose $\begin{array} { r } { \operatorname* { i n f } _ { s , a , s ^ { \prime } } P ^ { \star } ( s ^ { \prime } \mid s , a ) \ \geq \ c _ { 3 } > 0 } \end{array}$ , $\Theta = \{ \theta : \| \theta \| _ { 2 } \leq R \}$ , $\| \psi _ { V } ( s , a ) \| _ { 2 } \ \leq \ 1 , \forall V \in \mathcal { S } \ { \overset { \left. } { \right. } } \ [ 0 , 1 ]$ and $P ^ { \star } \in \mathcal { M } _ { M i x }$ . We set $\xi \ =$ $c _ { 1 } d \ln ^ { 2 } ( c _ { 2 } n R / \delta ) / n$ . Then, with probability $1 - \delta$ , for any $\pi ^ { * }$ in $\Pi$ (again $\Pi$ can be the unrestricted policy class), CPPO outputs a policy $\hat { \pi }$ such that:
+
+$$
+{ V _ { P ^ { * } } ^ { \pi ^ { * } } - V _ { P ^ { * } } ^ { \hat { \pi } } \leq c _ { 4 } ( 1 - \gamma ) ^ { - 2 } \sqrt { \operatorname* { m i n } ( d C _ { \pi ^ { * } } ^ { \dagger } , d ^ { 2 } \bar { C } _ { \pi ^ { * } , \mathrm { m i x } } ) \frac { \ln ^ { 2 } ( c _ { 5 } n R / \delta ) } { n } } } ,
+$$
+
+where the concentrability coefficient $\bar { C } _ { \pi ^ { * } , \operatorname* { m i x } }$ is defined as:
+
+$$
+\bar { C } _ { \pi ^ { * } , \mathrm { m i x } } : = \operatorname* { s u p } _ { P \in \mathcal { Z } _ { P ^ { \star } } } \operatorname* { s u p } _ { x \in \mathbb { R } ^ { d } } \left( \frac { x ^ { \top } \Sigma _ { \pi ^ { * } , \psi _ { V _ { P } ^ { \pi ^ { * } } } } x } { x ^ { \top } \Sigma _ { \rho , \psi _ { V _ { P } ^ { \pi ^ { * } } } } x } \right)
+$$
+
+with the localized class ZP ? := {P : E(s,a)∼ρ[TV(P (· | s, a), P ?(· | s, a))2] ≤ ξ}, Σρ,ψV π∗ $\mathbb { E } _ { ( s , a ) \sim \rho } [ \psi _ { V _ { P } ^ { \pi ^ { * } } } ( s , a ) \psi _ { V _ { P } ^ { \pi ^ { * } } } ( s , a ) ^ { \top } ] ,$ , and $\begin{array} { r } { \Sigma _ { \pi ^ { * } , \psi _ { V _ { P } ^ { \pi ^ { * } } } } = \mathbb { E } _ { s , a \sim d _ { P ^ { \star } } ^ { \pi ^ { * } } } [ \psi _ { V _ { P } ^ { \pi ^ { * } } } ( s , a ) \psi _ { V _ { P } ^ { \pi ^ { * } } } ( s , a ) ^ { \top } } \end{array}$ >].
+
+When specializing to linear $M D P s$ , the above bound still holds with $\bar { C } _ { \pi ^ { * } , \operatorname* { m i x } }$ being replaced by the relative condition number $\bar { C } _ { \pi ^ { * } }$ :
+
+$$
+\bar { C } _ { \pi ^ { * } } : = \operatorname* { s u p } _ { x \in \mathbb R ^ { d } } \frac { x ^ { T } \Sigma _ { \pi ^ { * } } x } { x ^ { \top } \Sigma _ { \rho } , x } , w h e r e \Sigma _ { \rho } = \mathbb E _ { ( s , a ) \sim \rho } [ \phi ( s , a ) \phi ( s , a ) ^ { \top } ] , \Sigma _ { \pi ^ { * } } = \mathbb E _ { ( s , a ) \sim d _ { P ^ { * } } ^ { \pi ^ { * } } } [ \phi ( s , a ) \phi ( s , a ) ^ { \top } ] .
+$$
+
+This is the first PAC-guarantee result in the offline setting under partial coverage $\bar { C } _ { \pi ^ { * } , \mathrm { m i x } } < \infty$ for linear mixture MDPs. $\bar { C } _ { \pi ^ { * } , \operatorname* { m i x } }$ is a newly-introduced concentrability coefficient for linear mixture MDPs. This coefficient is measured on the integrated feature vectors $\phi _ { V } ( s , a )$ for $V : S [ 0 , 1 ]$ . Note the class of $V$ is localized, i.e., we consider state-value functions $V _ { P } ^ { \pi ^ { * } } ( s )$ for all $P$ centered around $P ^ { \star }$ under data distribution $\rho$ (i.e., ${ \cal P } ~ \in ~ { \mathcal Z } _ { { \cal P } ^ { \star } }$ ). Such localization property ensures that $\bar { C } _ { \pi ^ { * } , \mathrm { m i x } } \leq C _ { \pi ^ { \star } } ^ { \dagger }$ (see Lemma 10 in Section F).
+
+Note that these relative condition number based quantifiers are always tighter than the density ratio based concentrability coefficients (i.e., $\operatorname* { m a x } \{ \bar { C } _ { \pi ^ { * } } , \bar { C } _ { \pi ^ { * } , \mathrm { m i x } } \} \le { C _ { \pi ^ { * } , \infty } } )$ . For the special case where $\phi ( s , a )$ is a one-hot encoding vector, then they are reduced to the density ratio based concentrability coefficient. In a non-tabular setting, even if when the density ratio is infinite, the relative condition number can be still finite. Intuitively, the bounded relative condition number implies that the offline data covers the subspace that the comparator policy $\pi ^ { * }$ visits.
+
+We remark $P ^ { \star } ( s ^ { \prime } \mid s , a ) \ge c _ { 3 } > 0$ in Corollary 2 is a technical condition that allows us to calculate the entropy integral of the hypothesis class easily. It can be potentially discarded by a more careful argument following (van de Geer, 2000, Chapter 7). The norm assumption $\| \psi _ { V } ( s , a ) \| _ { 2 } < 1$ is commonly assumed in the online setting (Zhou et al., 2021).
+
+# 5.2 KERNELIZED NOLINEAR REGULATORS
+
+We consider the example of KNRs in this section. A kernelized Nonlinear Regulator (KNR) (Kakade et al., 2020) is a model where the ground truth transition $P ^ { \star } ( s ^ { \prime } | s , a )$ is defined as $s ^ { \prime } = W ^ { \star } \phi ( s , a ) + \epsilon ,$ $\epsilon \sim \mathcal { N } ( 0 , \zeta ^ { 2 } \mathbf { I } )$ , with $\phi : \mathcal { S } \times \bar { \mathcal { A } } \mathbb { R } ^ { d }$ being a possibly nonlinear feature mapping. We denote the corresponding model on $W$ by $P ( W )$ . We can apply Algorithm 1 and obtain its guarantee. Especially, since $\mathrm { T V } ( P ( W ) ( \cdot \mid s , a ) , P ( W ^ { \star } ) ( \cdot \mid s , a ) ) ^ { 2 } = \bar { \Theta } ( \| ( W - W ^ { \star } ) \phi ( s , a ) \| _ { 2 } ^ { 2 } )$ (Devroye et al., 2018), $C _ { \pi ^ { * } } ^ { \dagger }$ is upper-bounded by the relative condition number $\bar { C } _ { \pi ^ { * } }$ .
+
+Then, we can also recover the result of Chang et al. (2021) which proposes a reward penalty-based pessimistic offline RL algorithm. The detail is given in Section B. In summary, we can show
+
+$$
+\begin{array} { r } { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } \leq c _ { 1 } ( 1 - \gamma ) ^ { - 2 } \operatorname* { m i n } ( d ^ { 1 / 2 } , \bar { R } ) \sqrt { \bar { R } } \sqrt { \frac { d _ { S } \bar { C } _ { \pi ^ { * } } \ln ( 1 + n ) } { n } } , . } \end{array}
+$$
+
+where $\bar { R } : = \mathrm { r a n k } [ \Sigma _ { \rho } ] \{ \mathrm { r a n k } [ \Sigma _ { \rho } ] + \ln ( c _ { 2 } / \delta ) \}$ and $d _ { S }$ is the dimension of the state.
+
+This implies CPPO can learn a policy that can compete against $\pi ^ { * }$ with partial coverage $\bar { C } _ { \pi ^ { * } } < \infty$ . Note that the condition $\bar { C } _ { \pi ^ { * } } < \infty$ does not require $\Sigma _ { \rho }$ to be full-rank. Also the bound uses rank $[ \Sigma _ { \rho } ]$ instead of $d$ , which means that our bound is distribution dependent and is still valid even when $d = \infty$ as long as the offline data only concentrate on a low-dimensional subspace.
+
+# 5.3 LOW-RANK MDPS WITH REPRESENTATION LEARNING
+
+We consider the representation learning in offline RL. Following FLAMBE (Agarwal et al., 2020b), we study low-rank MDPs but in the offline setting. Note that low-rank MDPs here are a more generalized model of the aforementioned linear MDPs (Yang & Wang, 2020) since the true feature representation $\phi ^ { \star }$ in a low-rank MDP is unknown.
+
+Definition 4 (Low rank MDPs). The ground-truth model $P ^ { \star }$ admits a low rank decomposition with a dimension $d$ if there exists two embedding functions $\mu ^ { * } : \mathcal { S } \mathbb { R } ^ { d } , \phi ^ { * } : \mathcal { S } \times \mathcal { \bar { A } } \mathbb { R } ^ { d } s . t .$ $P ^ { \star } ( s ^ { \prime } \mid s , a ) = \bar { \mu } ^ { * } ( s ^ { \prime } ) ^ { \top } \phi ^ { * } ( s , a )$ . Neither $\mu ^ { * }$ nor $\phi ^ { * }$ is known to the learner.
+
+One interesting special case of a low-rank MDP is the following latent variable model (see Agarwal et al. (2020b) for more details).
+
+Definition 5 (Latent variable models). There exists a latent space $\mathcal { Z }$ along with functions $\mu ^ { * } : \mathcal { Z } $ $\Delta ( S )$ and $\phi ^ { * } : S \times A \Delta ( \mathcal { Z } )$ s.t. $\begin{array} { r } { P ^ { \star } ( { \cdot } \mid s , a ) = \sum _ { z \in { \mathcal Z } } \mu ^ { * } ( { \cdot } \mid z ) \phi ^ { * } ( z \mid s , a ) } \end{array}$ .
+
+To tackle representation learning under partial coverage on low-rank MDPs, we setup function classes as follows: given two function classes $\Psi \subset \mathcal { S } \mathbb { R } ^ { d } , \Phi \subset \mathcal { S } \times \mathcal { A } \mathbb { R } ^ { d }$ (both are realizable in the sense that $\mu ^ { * } \in \Psi$ and $\phi ^ { * } \in \Phi ,$ ), we consider a hypothesis class $\{ \mu ( s ^ { \prime } ) ^ { \top } \phi ( s , a ) ; \mu \in$ $\Psi , \phi \in \Phi \}$ . Then, CPPO (Algorithm 1) and Theorem 1 still work under this setting. Note that this function class setup is exactly the same as the one from FLAMBE.
+
+Here we show that by leveraging the low-rankness, we can refine the concentrability coefficient to a relative condition number defined by the unknown true representation $\phi ^ { * }$ . We emphasize that this does not depend on the other features. Particularly, given a comparator policy $\pi ^ { * }$ , we define $\bar { C } _ { \pi ^ { * } , \phi ^ { \star } }$ :
+
+$$
+\begin{array} { r } { \tilde { \zeta } _ { \pi ^ { * } , \phi ^ { * } } = \underset { x \in \mathbb { R } ^ { d } } { \operatorname* { s u p } } \frac { x ^ { \top } \Sigma _ { \pi ^ { * } } x } { x ^ { \top } \Sigma _ { \rho } x } , \quad \Sigma _ { \pi ^ { * } } : = \mathbb { E } _ { s , a \sim d _ { p ^ { * } } ^ { \pi ^ { * } } } \phi ^ { * } ( s , a ) \phi ^ { * } ( s , a ) ^ { \top } , \quad \Sigma _ { \rho } : = \mathbb { E } _ { s , a \sim \rho } \phi ^ { * } ( s , a ) \phi ^ { * } ( s , a ) ^ { \top } . } \end{array}
+$$
+
+We can show CPPO learns a policy that can compete against $\pi ^ { * }$ as long as $\bar { C } _ { \pi ^ { * } , \phi ^ { \star } } < \infty$ .
+
+Theorem 2 (PAC bound for low-rank MDP). We set $\begin{array} { r c l } { \xi } & { = } & { c _ { 1 } \frac { \ln \left( | \Phi | | \Psi | c _ { 2 } / \delta \right) } { n } } \end{array}$ ln(|Φ||Ψ|c2/δ) . Suppose (a): $\| \phi ( s , a ) \| _ { 2 } \leq 1 , \forall ( s , a ) \in S \times A , \forall \phi \in \Phi$ , $\begin{array} { r } { \int \mu ( s ^ { \prime } ) ^ { \top } \phi ( s , a ) \mathrm { d } ( s ^ { \prime } ) = 1 } \end{array}$ and $\begin{array} { r } { \int \| \mu ( s ) \| _ { 2 } \mathrm { d } s \leq \sqrt { d } , \forall \mu \in } \end{array}$ $\Psi , \phi \in \Phi$ , (b) $\rho ( s , a ) = d _ { P ^ { \star } } ^ { \pi _ { b } } ( s , a )$ , (c) $P ^ { \star } ( s ^ { \prime } | s , a ) = \mu ^ { * } ( s ^ { \prime } ) ^ { \top } \phi ^ { * } ( s , a )$ for some $\mu ^ { * } \in \Psi , \phi ^ { * } \in \Phi$ . With probability at least $1 - \delta$ , for all $\pi ^ { * } \in \Pi$ (again $\Pi$ can be an unrestricted policy class), CPPO (Algorithm $^ { l }$ ) finds $\hat { \pi }$ such that:
+
+$$
+\begin{array} { r } { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } \leq c _ { 3 } \sqrt { \bar { C } _ { \pi ^ { * } , \phi ^ { \star } } \omega _ { \pi ^ { * } } \mathrm { r a n k } ( \Sigma _ { \rho } ) \frac { \ln ( | \Psi | | \Phi | c _ { 4 } / \delta ) } { ( 1 - \gamma ) ^ { 4 } n } } , \omega _ { \pi ^ { * } } = \left( \operatorname* { m a x } _ { ( s , a ) } \frac { \pi ^ { * } ( a | s ) } { \pi _ { b } ( a | s ) } \right) } \end{array}
+$$
+
+To the best of our knowledge, this is the first established PAC result under the partial coverage condition $\bar { C } _ { \pi ^ { * } , \phi ^ { \star } } < \infty , \omega _ { \pi ^ { * } } < \infty$ for low-rank MDPs in the offline setting. We also emphasize that our bound in Theorem 2 is distribution dependent, i.e., it depends on $\operatorname { r a n k } ( \Sigma _ { \rho } )$ rather than the exact rank $d$ . Note that $\operatorname { r a n k } ( \Sigma _ { \rho } ) \leq d$ , and $\operatorname { r a n k } ( \Sigma _ { \rho } )$ could be much smaller than $d$ when the offline distribution only concentrates on a low-dimensional subspace (defined using $\phi ^ { * }$ ). Note that the assumption that $\omega _ { \pi ^ { * } } < \infty$ does not imply the state-action density ratio $C _ { \pi ^ { * } , \infty }$ is small. Indeed, $\omega _ { \pi ^ { * } } < \infty$ is much weaker than $C _ { \pi ^ { * } , \infty } < \infty$ .
+
+# 5.4 FACTORED MDPS
+
+The last example we include is the factored MDP (Kearns & Koller, 1999) defined as follows:
+
+Definition 6 (Factored MDPs). Let $d \in \mathbb { N } ^ { + }$ and $\mathcal { O }$ being a small finite set. The state space $S = \mathcal { O } ^ { d }$ , and for each state s, we denote $s [ i ] \in \mathcal { O }$ as the $i$ -th variable of the state s. For each $i \in [ 1 , \cdots , d ]$ , the parents of $i$ , $\mathrm { p a } _ { i } \subset [ 1 , \cdots , d ]$ , is the subset of state variables that directly influences $i .$ , i.e., the transition is defined as follows:
+
+$$
+\begin{array} { r } { \forall s , a , s ^ { \prime } : P ^ { \star } ( s ^ { \prime } | s , a ) = \prod _ { i = 1 } ^ { d } P _ { i } ^ { \star } ( s ^ { \prime } [ i ] | s [ \mathrm { p a } _ { i } ] , a ) . } \end{array}
+$$
+
+We will denote $S _ { i } = \mathcal { O } ^ { \left| \mathrm { p a } _ { i } \right| }$ , and given $s \in S$ , we will have $s [ \mathrm { p a } _ { i } ] \in S _ { i }$
+
+Due to the factorization, the transition operator $P ^ { \star }$ can be described with $\begin{array} { r } { L : = \sum _ { i = 1 } ^ { d } | \mathcal { A } | | \mathcal { O } | ^ { 1 + | \mathrm { p a } _ { i } | } } \end{array}$ many parameters. In contrast, the non-factored transition will need $O ( | O | ^ { d } )$ parameters. When $| \mathrm { p a } _ { i } | \ll d \forall i$ , it is expected that we can learn this model with lower sample complexity by leveraging the factorization which has been demonstrated in the online setting (Kearns $\&$ Koller, 1999). We remark a factored MDP is an example where model-based approaches are necessary as neither the optimal policy nor the $\mathrm { Q }$ functions are factored (Koller & Parr, 2000).
+
+We will slightly modify Algorithm 1 to take the factorization into consideration. First, we perform MLE for model learning: each factor $P _ { i } ^ { \star }$ is independently learned via MLE:
+
+$$
+\begin{array} { r } { \forall i \in [ d ] , \widehat { P } _ { \mathrm { M L E } , i } = \arg \operatorname* { m a x } _ { P } \mathbb { E } _ { \mathcal { D } } [ \ln { P ( s ^ { \prime } [ i ] | s [ \mathrm { p a } _ { i } ] , a ) } ] , \quad \widehat { P } = \prod _ { i } \widehat { P } _ { \mathrm { M L E } , i } . } \end{array}
+$$
+
+Next, the constrained policy optimization procedure is defined as
+
+$$
+\hat { \pi } = \arg \operatorname* { m a x } _ { \pi } \operatorname* { m i n } _ { P : = \prod _ { i } P _ { i } } V _ { P } ^ { \pi } , \mathrm { ~ s . t . , } \mathbb { E } _ { \mathcal { D } } [ \mathrm { T V } ( P _ { i } ( \cdot \mid s , a ) , \widehat { P } _ { \mathrm { M L E } , i } ( \cdot \mid s , a ) ) ^ { 2 } ] \leq \xi _ { i } \left( \forall i \in [ 1 , \cdot \cdot \cdot , d ] \right) .
+$$
+
+Note that in the above objective, there is no restriction on the policy, i.e., the arg max operator searches over all possible policies including non-Markovian ones.
+
+To analyze the performance of the above modified CPPO, we introduce a specialized concentration coefficient for factored MDPs that utilizes the factored structure. We focus on density ratio based concentrability coefficients since in a factored MDP with the function class $\begin{array} { r } { \mathcal { M } : = \{ P = \prod _ { i } P _ { i } : P _ { i } \in \mathring S _ { i } \times \mathcal { A } \Delta ( \mathcal { O } ) \} } \end{array}$ , the concentrability coefficient associated with $\mathcal { M }$ in Definition 1 will be reduced to the density ratio. For any $\pi ^ { * }$ , we define the concentrability coefficients for the factored MDP as follows:
+
+$$
+\ddot { C } _ { \pi ^ { * } , \infty } : = \operatorname* { m a x } _ { j \in [ 1 , \cdots , d ] } \operatorname* { m a x } _ { s _ { j } \in S _ { j } , a \in \mathcal { A } } \frac { d _ { P ^ { \star } } ^ { \pi ^ { * } } \left( s _ { j } , a \right) } { \rho ( s _ { j } , a ) } ,
+$$
+
+where for $s _ { j } \in S _ { j }$ , we denote $\begin{array} { r } { \nu ( s _ { j } , a ) : = \sum _ { s \in S : s [ \mathrm { p a } _ { j } ] = s _ { j } } \nu ( s , a ) } \end{array}$ for any distribution $\nu \in \Delta ( S \times \mathcal { A } )$ . Comparing to $C _ { \pi ^ { * } , \infty }$ defined on the original state space $s$ , here $\ddot { C } _ { \pi ^ { * } , \infty }$ is defined over each state space $S _ { j }$ associated with each factor $j$ . Note that when $| \mathbf { p } \mathbf { a } _ { j } | = \Theta ( 1 )$ , $| { \cal { S } } _ { j } |$ is exponentially smaller than $| S |$ . One can verify that $\ddot { C } _ { \pi ^ { * } , \infty } \leq C _ { \pi ^ { * } , \infty }$ (see Appendix E.7), where $C _ { \pi ^ { * } , \infty }$ ignores the factored structure and treat $s$ as a whole single space. This formally demonstrates the benefit of the factored structure in terms of the coverage condition in offline $R L$ .
+
+With the new definition of the concentrability coefficients, now we are ready to state the PAC bound of CPPO for factored MDPs. Recall $\begin{array} { r } { L : = \sum _ { i = 1 } ^ { d } L _ { i } , L _ { i } = | \ r { A } | | \ r { O } | ^ { 1 + | \mathrm { p a } _ { i } | } } \end{array}$ .
+
+rem 3 (PAC bound fo, CPPO finds a policy factored MDP). We set such that for all compar $\begin{array} { r } { \xi _ { i } = c _ { 1 } \frac { L _ { i } \ln ( L _ { i } c _ { 2 } d / \delta ) } { n } } \end{array}$ . Then with probabilityΠ can be unrestricted), $1 - \delta$ $\hat { \pi }$ $\pi ^ { * } \in \Pi$
+
+$$
+\begin{array} { r } { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } \leq c _ { 3 } ( 1 - \gamma ) ^ { - 2 } \sqrt { \frac { d \ddot { C } _ { \pi ^ { * } , \infty } L \cdot \ln ( n L c _ { 4 } d / \delta ) } { n } } . } \end{array}
+$$
+
+Note that our sub-optimality gap scales polynomially with respect to $L$ , i.e., the complexity of the factored MDP, rather than $| S |$ which can be $\Omega ( \exp ( { { d } } ) )$ .
+
+# 6 CONCLUSION
+
+We study model-based offline RL with function approximation under partial coverage. We show that for the model-based setting, realizability in function class and partial coverage together are enough to learn a policy that is comparable to any policies (including history-dependent policies) covered by the offline distribution. Our result demonstrates a sharp contrast to model-free offline RL approaches which often require additional structural conditions in the function class (e.g., Bellman completion) and have restrictions on the pool of candidate policies that they can compete against.
+
+Some readers might wonder whether CPPO is computationally efficient. The minimax optimization problem arg $\operatorname* { m a x } _ { \pi \in \Pi } \operatorname* { m i n } _ { P \in M } V _ { P } ^ { \pi }$ fits into a framework of planning on robust MDPs (Nilim & El Ghaoui, 2005; Iyengar, 2005). By introducing a robust Bellman equation, they proposed value iteration and policy iteration algorithms, and showed that algorithms are practically tractable in the tabular setting. In the non-tabular setting, Lim $\&$ Autef (2019); Tamar et al. (2014) propose the extension using function approximation. Thus, we can apply their methods to approximately solve the minimax optimization problem in a model-free fashion. We leave the formal theoretical justification when using these approximation planning algorithms as an important direction for future work.
+
+# ACKNOWLEDGEMENT
+
+The authors would like to thank Nan Jiang, Tengyang Xie for valuable feedback.
+
+Masatoshi Ueharra is partially supported by Masason foundation.
+
+# REFERENCES
+
+Alekh Agarwal, Mikael Henaff, Sham Kakade, and Wen Sun. Pc-pg: Policy cover directed exploration for provable policy gradient learning. In Advances in Neural Information Processing Systems, volume 33, pp. 13399–13412, 2020a.
+
+Alekh Agarwal, Sham Kakade, Akshay Krishnamurthy, and Wen Sun. Flambe: Structural complexity and representation learning of low rank mdps. In Advances in Neural Information Processing Systems, volume 33, pp. 20095–20107, 2020b.
+
+Alekh Agarwal, Sham M Kakade, Jason D Lee, and Gaurav Mahajan. Optimality and approximation with policy gradient methods in markov decision processes. In Proceedings of Thirty Third Conference on Learning Theory, volume 125 of Proceedings of Machine Learning Research, pp. 64–66, 2020c.
+
+Andras Antos, Csaba Szepesv ´ ari, and R ´ emi Munos. Learning near-optimal policies with bellman- ´ residual minimization based fitted policy iteration and a single sample path. Machine Learning, 71:89–129, 2008.
+
+Alex Ayoub, Zeyu Jia, Csaba Szepesvari, Mengdi Wang, and Lin Yang. Model-based reinforcement learning with value-targeted regression. In International Conference on Machine Learning, pp. 463–474. PMLR, 2020.
+
+Jacob Buckman, Carles Gelada, and Marc G Bellemare. The importance of pessimism in fixeddataset policy optimization. arXiv preprint arXiv:2009.06799, 2020.
+
+Catherine Cang, Aravind Rajeswaran, Pieter Abbeel, and Michael Laskin. Behavioral priors and dynamics models: Improving performance and domain transfer in offline rl. arXiv preprint arXiv:2106.09119, 2021.
+
+Jonathan D Chang, Masatoshi Uehara, Dhruv Sreenivas, Rahul Kidambi, and Wen Sun. Mitigating covariate shift in imitation learning via offline data without great coverage. 2021.
+
+Jinglin Chen and Nan Jiang. Information-theoretic considerations in batch reinforcement learning. In Proceedings of the 36th International Conference on Machine Learning, volume 97, pp. 1042– 1051, 2019.
+
+Minmin Chen, Alex Beutel, Paul Covington, Sagar Jain, Francois Belletti, and Ed Chi. Top-k off-policy correction for a reinforce recommender system. In Proceedings of the Twelfth ACM International Conference on web search and data mining, WSDM ’19, pp. 456–464, 2019.
+
+Marc Deisenroth and Carl E Rasmussen. Pilco: A model-based and data-efficient approach to policy search. In Proceedings of the 28th International Conference on machine learning (ICML-11), pp. 465–472. Citeseer, 2011.
+
+Luc Devroye, Abbas Mehrabian, and Tommy Reddad. The total variation distance between highdimensional gaussians. arXiv preprint arXiv:1810.08693, 2018.
+
+Yaqi Duan, Zeyu Jia, and Mengdi Wang. Minimax-optimal off-policy evaluation with linear function approximation. In Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 2701–2709, 2020.
+
+Yaqi Duan, Chi Jin, and Zhiyuan Li. Risk bounds and rademacher complexity in batch reinforcement learning. arXiv preprint arXiv:2103.13883, 2021.
+
+Damien Ernst, Pierre Geurts, and Louis Wehenkel. Tree-based batch mode reinforcement learning. Journal of Machine Learning Research, 6:503–556, 2005.
+
+Rasool Fakoor, Jonas Mueller, Pratik Chaudhari, and Alexander J Smola. Continuous doubly constrained batch reinforcement learning. arXiv preprint arXiv:2102.09225, 2021.
+
+Jianqing Fan, Zhaoran Wang, Yuchen Xie, and Zhuoran Yang. A theoretical analysis of deep qlearning. In Proceedings of the 2nd Conference on Learning for Dynamics and Control, volume 120 of Proceedings of Machine Learning Research, pp. 486–489, 2020.
+
+Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. In International Conference on Machine Learning, pp. 2052–2062. PMLR, 2019.
+
+Seyed Kamyar Seyed Ghasemipour, Dale Schuurmans, and Shixiang Shane Gu. Emaq: Expectedmax q-learning operator for simple yet effective offline and online rl. In International Conference on Machine Learning, pp. 3682–3691. PMLR, 2021.
+
+Botao Hao, Yaqi Duan, Tor Lattimore, Csaba Szepesvari, and Mengdi Wang. Sparse feature selec- ´ tion makes batch reinforcement learning more sample efficient. In International Conference on Machine Learning, pp. 4063–4073. PMLR, 2021.
+
+Garud N Iyengar. Robust dynamic programming. Mathematics of Operations Research, 30(2): 257–280, 2005.
+
+Chi Jin, Zhuoran Yang, Zhaoran Wang, and Michael I Jordan. Provably efficient reinforcement learning with linear function approximation. In Proceedings of Thirty Third Conference on Learning Theory, volume 125 of Proceedings of Machine Learning Research, pp. 2137–2143, 2020a.
+
+Ying Jin, Zhuoran Yang, and Zhaoran Wang. Is pessimism provably efficient for offline rl? arXiv preprint arXiv:2012.15085, 2020b.
+
+Sham Kakade, Akshay Krishnamurthy, Kendall Lowrey, Motoya Ohnishi, and Wen Sun. Information theoretic regret bounds for online nonlinear control. In Advances in Neural Information Processing Systems, volume 33, pp. 15312–15325, 2020.
+
+Michael Kearns and Daphne Koller. Efficient reinforcement learning in factored mdps. In IJCAI, volume 16, pp. 740–747, 1999.
+
+Rahul Kidambi, Aravind Rajeswaran, Praneeth Netrapalli, and Thorsten Joachims. Morel: Modelbased offline reinforcement learning. In Advances in Neural Information Processing Systems, volume 33, pp. 21810–21823. Curran Associates, Inc., 2020.
+
+Daphne Koller and Ronald Parr. Policy iteration for factored mdps. In Proceedings of the Sixteenth conference on Uncertainty in artificial intelligence, pp. 326–334, 2000.
+
+Michael R. Kosorok and Eric B. Laber. Precision medicine. 6:263–286, 2019.
+
+Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative q-learning for offline reinforcement learning. arXiv preprint arXiv:2006.04779, 2020.
+
+Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020.
+
+Shiau Hong Lim and Arnaud Autef. Kernel-based reinforcement learning in robust markov decision processes. In International Conference on Machine Learning, pp. 3973–3981. PMLR, 2019.
+
+Yao Liu, Adith Swaminathan, Alekh Agarwal, and Emma Brunskill. Provably good batch off-policy reinforcement learning without great exploration. In Advances in Neural Information Processing Systems, volume 33, pp. 1264–1274, 2020.
+
+Thodoris Lykouris, Max Simchowitz, Alex Slivkins, and Wen Sun. Corruption-robust exploration in episodic reinforcement learning. In Conference on Learning Theory, pp. 3242–3245. PMLR, 2021.
+
+Tatsuya Matsushima, Hiroki Furuta, Yutaka Matsuo, Ofir Nachum, and Shixiang Gu. Deploymentefficient reinforcement learning via model-based offline optimization. ICLR, 2020.
+
+Aditya Modi, Nan Jiang, Ambuj Tewari, and Satinder Singh. Sample complexity of reinforcement learning using linearly combined model ensembles. In International Conference on Artificial Intelligence and Statistics, pp. 2010–2020. PMLR, 2020.
+
+Aditya Modi, Jinglin Chen, Akshay Krishnamurthy, Nan Jiang, and Alekh Agarwal. Model-free representation learning and exploration in low-rank mdps. arXiv preprint arXiv: 2102.07035, 2021.
+
+Remi Munos. Error bounds for approximate value iteration. In ´ Proceedings of the National Conference on Artificial Intelligence, volume 20, pp. 1006. Menlo Park, CA; Cambridge, MA; London; AAAI Press; MIT Press; 1999, 2005.
+
+Remi Munos and Csaba Szepesv ´ ari. Finite-time bounds for fitted value iteration. ´ Journal of Machine Learning Research, 9(May):815–857, 2008.
+
+Ofir Nachum, Bo Dai, Ilya Kostrikov, Yinlam Chow, Lihong Li, and Dale Schuurmans. Algaedice: Policy gradient from arbitrary experience. arXiv preprint arXiv:1912.02074, 2019.
+
+Gergely Neu and Ciara Pike-Burke. A unifying view of optimism in episodic reinforcement learning. arXiv preprint arXiv:2007.01891, 2020.
+
+Chengzhuo Ni, Anru Zhang, Yaqi Duan, and Mengdi Wang. Learning good state and action representations via tensor decomposition. arXiv preprint arXiv:2105.01136, 2021.
+
+Arnab Nilim and Laurent El Ghaoui. Robust control of markov decision processes with uncertain transition matrices. Operations Research, 53(5):780–798, 2005.
+
+Matteo Papini, Andrea Tirinzoni, Marcello Restelli, Alessandro Lazaric, and Matteo Pirotta. Leveraging good representations in linear contextual bandits. arXiv preprint arXiv:2104.03781, 2021.
+
+Nived Rajaraman, Lin F Yang, Jiantao Jiao, and Kannan Ramachandran. Toward the fundamental limits of imitation learning. arXiv preprint arXiv:2009.05990, 2020.
+
+Paria Rashidinejad, Banghua Zhu, Cong Ma, Jiantao Jiao, and Stuart Russell. Bridging offline reinforcement learning and imitation learning: A tale of pessimism. arXiv preprint arXiv:2103.12021, 2021.
+
+Shideh Rezaeifar, Robert Dadashi, Nino Vieillard, Leonard Hussenot, Olivier Bachem, Olivier ´ Pietquin, and Matthieu Geist. Offline reinforcement learning as anti-exploration. arXiv preprint arXiv:2106.06431, 2021.
+
+Stephane Ross and J Andrew Bagnell. Agnostic system identification for model-based reinforcement ´ learning. In Proceedings of the 29th International Coference on International Conference on Machine Learning, pp. 1905–1912, 2012.
+
+Wen Sun, Nan Jiang, Akshay Krishnamurthy, Alekh Agarwal, and John Langford. Model-based rl in contextual decision processes: Pac bounds and exponential improvements over model-free approaches. In Proceedings of the Thirty-Second Conference on Learning Theory, volume 99 of Proceedings of Machine Learning Research, pp. 2898–2933, 2019.
+
+Aviv Tamar, Shie Mannor, and Huan Xu. Scaling up robust mdps using function approximation. In International conference on machine learning, pp. 181–189. PMLR, 2014.
+
+Ahmed Touati, Amy Zhang, Joelle Pineau, and Pascal Vincent. Stable policy optimization via offpolicy divergence regularization. arXiv preprint arXiv:2003.04108, 2020.
+
+Masatoshi Uehara, Jiawei Huang, and Nan Jiang. Minimax weight and q-function learning for offpolicy evaluation. In Proceedings of the 37th International Conference on Machine Learning, pp. 9659–9668, 2020.
+
+Masatoshi Uehara, Masaaki Imaizumi, Nan Jiang, Nathan Kallus, Wen Sun, and Tengyang Xie. Finite sample analysis of minimax offline reinforcement learning: Completeness, fast rates and first-order efficiency. arXiv preprint arXiv:2102.02981, 2021.
+
+S van de Geer. Empirical Processes in M-Estimation. Cambridge Series in Statistical and Probabilistic Mathematics. Cambridge University Press, 2000.
+
+Martin J Wainwright. High-Dimensional Statistics : A Non-Asymptotic Viewpoint. Cambridge University Press, New York, 2019.
+
+Ruosong Wang, Dean P. Foster, and Sham M. Kakade. What are the statistical limits of offline rl with linear function approximation?. arXiv preprint arXiv:2010.11895, 2020.
+
+Yifan Wu, George Tucker, and Ofir Nachum. Behavior regularized offline reinforcement learning. arXiv preprint arXiv:1911.11361, 2019.
+
+Tengyang Xie and Nan Jiang. Batch value-function approximation with only realizability. arXiv preprint arXiv:2008.04990, 2020.
+
+Tengyang Xie, Ching-An Cheng, Nan Jiang, Paul Mineiro, and Alekh Agarwal. Bellman-consistent pessimism for offline reinforcement learning. arXiv preprint arXiv:2106.06926, 2021.
+
+Lin Yang and Mengdi Wang. Reinforcement learning in feature space: Matrix bandit, kernels, and regret bound. In Proceedings of the 37th International Conference on Machine Learning, pp. 10746–10756, 2020.
+
+Ming Yin, Yu Bai, and Yu-Xiang Wang. Near-optimal offline reinforcement learning via double variance reduction. arXiv preprint arXiv:2102.01748, 2021.
+
+Tianhe Yu, Garrett Thomas, Lantao Yu, Stefano Ermon, James Y Zou, Sergey Levine, Chelsea Finn, and Tengyu Ma. Mopo: Model-based offline policy optimization. In Advances in Neural Information Processing Systems, volume 33, pp. 14129–14142, 2020.
+
+Andrea Zanette, Martin J Wainwright, and Emma Brunskill. Provable benefits of actor-critic methods for offline reinforcement learning. arXiv preprint arXiv:2108.08812, 2021.
+
+Ruiyi Zhang, Bo Dai, Lihong Li, and Dale Schuurmans. Gendice: Generalized offline estimation of stationary values. In International Conference on Learning Representations, 2020.
+
+Weitong Zhang, Jiafan He, Dongruo Zhou, Amy Zhang, and Quanquan Gu. Provably efficient representation learning in low-rank markov decision processes. arXiv preprint arXiv:2106.11935, 2021a.
+
+Xuezhou Zhang, Yiding Chen, Jerry Zhu, and Wen Sun. Corruption-robust offline reinforcement learning. arXiv preprint arXiv:2106.06630, 2021b.
+
+Dongruo Zhou, Quanquan Gu, and Csaba Szepesvari. Nearly minimax optimal reinforcement learning for linear mixture markov decision processes. In Conference on Learning Theory, pp. 4532– 4576. PMLR, 2021.
+
+# A GENERALIZATION OF THEOREM 1
+
+We present the generalized version of Theorem 1 when the hypothesis class is infinite. We define the modified function class of $\mathcal { M }$ :
+
+$$
+\mathcal { H } = \left\{ \sqrt { \frac { P + P ^ { * } } { 2 } } \mid P \in \mathcal { M } \right\} .
+$$
+
+Given a function class $\mathcal { F }$ , let $\mathcal { N } _ { [ ] } ( \delta , \mathcal { F } , d )$ be the bracketing number of $\mathcal { F }$ w.r.t the metric $d ( a , b )$ given by
+
+$$
+d ( a , b ) = \mathbb { E } _ { ( s , a ) \sim \rho } \left[ \int ( a ( s ^ { \prime } \mid s , a ) - b ( s ^ { \prime } \mid s , a ) ) ^ { 2 } \mathbf { d } ( s ^ { \prime } ) \right] ^ { 1 / 2 } .
+$$
+
+Then, the entropy integral of $\mathcal { F }$ is given by
+
+$$
+J _ { B } ( \delta , \mathcal { F } , d ) = \operatorname* { m a x } \left( \int _ { \delta ^ { 2 } / 2 } ^ { \delta } ( \log \mathcal { N } _ { \mathbb { I } } ( u , \mathcal { F } , d ) ) ^ { 1 / 2 } \mathrm { d } u , \delta \right) .
+$$
+
+We also define the localized class of $\mathcal { H }$ :
+
+$$
+\mathcal { H } ( \delta ) = \{ h \in \mathcal { H } : \mathbb { E } _ { ( s , a ) \sim \rho } [ h ^ { 2 } ( P ( \cdot \mid s , a ) \| P ^ { \star } ( \cdot \mid s , a ) ) ] \leq \delta ^ { 2 } \} ,
+$$
+
+where $h ( P ( \cdot \mid s , a ) \| P ^ { \star } ( \cdot \mid s , a ) )$ denotes Hellinger distance defined by
+
+$$
+\left( 0 . 5 \int \{ \sqrt { P ( s ^ { \prime } \mid s , a ) } - \sqrt { P ^ { \star } ( s ^ { \prime } \mid s , a ) } \} ^ { 2 } \mathrm { d } ( s ^ { \prime } ) \right) ^ { 1 / 2 } .
+$$
+
+Based on Theorem 7.4 (van de Geer, 2000), the MLE has the following guarantee.
+
+Theorem 4 (MLE guarantee with general function approximation). We take a function $G ( \epsilon ) : \pentagon$ $[ 0 , 1 ] \mathbb { R }$ s.t. $G ( \bar { \epsilon } ) \geq J _ { B } [ \epsilon , \mathcal { H } ( \bar { \epsilon } ) , d ]$ and $G ( \epsilon ) / \epsilon ^ { 2 }$ is a non-increasing function w.r.t . Then, letting $\xi _ { n }$ be a solution to ${ \sqrt { n } } { \dot { \epsilon } } ^ { 2 } \geq { \dot { c } } G ( { \dot { \epsilon } } ) w .$ .r.t . With probability $1 - \delta$ , we have
+
+$$
+\begin{array} { r } { \mathbb { E } _ { ( s , a ) \sim \rho } [ \| \hat { P } _ { \mathrm { M L E } } ( \cdot \mid s , a ) - P ( \cdot \mid s , a ) \| _ { 1 } ^ { 2 } ] \leq c _ { 1 } \left\{ \xi _ { n } + \sqrt { \log ( c _ { 2 } / \delta ) / n } \right\} ^ { 2 } . } \end{array}
+$$
+
+We remark that the original guarantee in (van de Geer, 2000) is given for the estimation of unconditional distributions. The adaption to the conditional case is straightforward. For more details, refer to Section A.1. Besides, when we assume the convexity of the function class, the entropy integral with bracketing (4) can be replaced with the entropy integral with covering number (Wainwright, 2019, Chapter 14).
+
+By using the above notation and the MLE guarantee, we can generalize Theorem 1.
+
+Theorem 5 (Finite sample error bound of CPPO with an infinite hypothesis class). Assume $P ^ { \star } \in$ $\mathcal { M }$ . Let $f ( P ) ( s , a ) = \bar { \mathrm { T V } } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } .$ . Define
+
+$$
+\begin{array} { r l } & { { \mathcal M } _ { 1 } = \left\{ P : \mathbb { E } _ { ( s , a ) \sim \rho } \left[ f ( P ) ( s , a ) \right] \le c \left( \xi _ { n } ^ { 2 } + \frac { \ln ( c / \delta ) } { n } \right) \right\} , } \\ & { { \mathcal M } _ { 2 } = \left\{ P : \mathbb { E } _ { ( s , a ) \sim \mathcal D } [ f ( P ) ( s , a ) ] \le c \left( G ( { \mathcal M } _ { 1 } ) + \xi _ { n } ^ { 2 } + \frac { \ln ( c / \delta ) } { n } \right) \right\} , } \\ & { G ( { \mathcal M } _ { 1 } ) = \mathbb { E } [ \underset { P \in { \mathcal M } _ { 1 } } { \operatorname* { s u p } } | ( \mathbb { E } _ { \mathcal D } - \mathbb { E } _ { \rho } ) [ f ( P ) ] | ] , G ( { \mathcal M } _ { 2 } ) = \mathbb { E } [ \underset { P \in { \mathcal M } _ { \mathcal D } } { \operatorname* { s u p } } | ( \mathbb { E } _ { \mathcal D } - \mathbb { E } _ { \rho } ) [ f ( P ) ] | ] . } \end{array}
+$$
+
+Here, in $c \left( { \frac { \ln ( c / \delta ) } { n } } \right)$ $G ( \mathcal { M } _ { 1 } )$ . Then, for all and $G ( { \cal M } _ { 2 } )$ $\pi ^ { * } \in \Pi$ , the expectation is taken over the data. We set , we have $\xi = c G ( \mathcal { M } _ { 1 } ) + c \xi _ { n } ^ { 2 } +$
+
+$$
+V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } \leq ( 1 - \gamma ) ^ { - 2 } c _ { 1 } \sqrt { C _ { \pi ^ { * } } ^ { \dagger } } \sqrt { G ( \mathcal { M } _ { 2 } ) + G ( \mathcal { M } _ { 1 } ) + \xi _ { n } ^ { 2 } + \frac { \ln ( c / \delta ) } { n } } .
+$$
+
+This theorem shows once we can calculate $\mathcal { G } _ { M _ { 1 } } , \mathcal { G } _ { M _ { 2 } }$ and $\xi _ { n }$ , we can obtain the tight rate. Importantly, $\mathcal { G } _ { \mathcal { M } _ { 1 } }$ and $\mathcal { G } _ { M _ { 2 } }$ are upper-bounded by the localized versions of Rademacher complexities based on symmetrization argument. Hence, their rates are faster than the ones of the nonlocalized versions.
+
+For example, when $| { \mathcal { M } } |$ is finite, we first have $\xi _ { n } = \sqrt { \ln ( | \mathcal { M } | c / \delta ) / n }$ . Then, from Bernstein’s inequality (Wainwright, 2019, Exercise 2.8) and union bound, $G ( \mathcal { M } _ { 1 } )$ is upper-bounded by
+
+$$
+G ( \mathcal { M } _ { 1 } ) \lesssim \underbrace { \xi _ { n } } _ { \mathrm { V a r i a n c e t e r m } } \times \underbrace { \sqrt { \ln ( | \mathcal { M } | c / \delta ) / n } } _ { \mathrm { U n i o n b o u n d } } \lesssim \xi _ { n } ^ { 2 } .
+$$
+
+Similarly, from empirical Bernstein’s inequality,
+
+$$
+G ( \mathcal { M } _ { 2 } ) \lesssim \underbrace { \xi _ { n } } _ { \mathrm { V a r i a n c e t e r m } } \times \underbrace { \sqrt { \ln ( | \mathcal { M } | c / \delta ) / n } } _ { \mathrm { U n i o n b o u n d } } \lesssim \xi _ { n } ^ { 2 } .
+$$
+
+Then, we can obtain the result of Theorem 1:
+
+$$
+V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } \leq ( 1 - \gamma ) ^ { - 2 } c _ { 1 } \sqrt { C _ { \pi ^ { * } } ^ { \dagger } } \sqrt { \frac { \ln ( | { \cal M } | c / \delta ) } { n } } , \quad \forall \pi ^ { * } \in \Pi .
+$$
+
+We stress if we use Hoeffeding’s inequality above, we would immediately get the slower rate $O ( n ^ { - 1 / 4 } )$ . To calculate $G ( \mathcal { M } _ { 1 } )$ and $G ( { \cal M } _ { 2 } )$ in a tight manner, we need to leverage the knowledge that the variance of each element in $\mathcal { M } _ { 1 }$ and $\mathcal { M } _ { 2 }$ is controlled from the restriction $P \in \mathcal { M } _ { 1 }$ or $P \in \mathcal { M } _ { 2 }$ .
+
+A.1 RATE OF CONVERGENCE OF MAXIMUM LIKELIHOOD ESTIMATION WITH INFINITE HYPOTHESIS CLASS
+
+We aim for obtaining a PAC guarantee of MLE following (van de Geer, 2000). We explain how we should modify the proof of van de Geer (2000) for unconditional density estimation to conditional density estimation. For simplicity, we assume $P ^ { \star } > 0$ .
+
+We first introduce the notation:
+
+$$
+\bar { P } = ( P + P ^ { \star } ) / 2 , g _ { P } = 0 . 5 \log \frac { \bar { P } } { P ^ { \star } } , ( \bar { \mathcal { M } } ) ^ { 1 / 2 } = \Big \{ \sqrt { \bar { P } } \mid P \in \mathcal { M } \Big \} .
+$$
+
+Recall
+
+$$
+h ^ { 2 } ( P _ { 1 } ( \cdot \mid s , a ) , P _ { 2 } ( \cdot \mid s , a ) ) = \left( 0 . 5 \int P _ { 1 } ^ { 1 / 2 } ( s ^ { \prime } \mid s , a ) - P ^ { 1 / 2 } ( s ^ { \prime } \mid s , a ) \mathsf { d } ( s ^ { \prime } ) \right) ^ { 0 . 5 } .
+$$
+
+Here, from Lemma 4.2 (van de Geer, 2000), the following holds:
+
+Lemma 1 (Some property of Hellinger distance).
+
+$$
+\begin{array} { r l } & { \mathbb { E } _ { ( s , a ) \sim \rho } [ h ^ { 2 } ( \bar { P } _ { 1 } ( \cdot \mid s , a ) , \bar { P } _ { 2 } ( \cdot \mid s , a ) ) ] \le 0 . 5 \mathbb { E } _ { ( s , a ) \sim \rho } [ h ^ { 2 } ( P _ { 1 } ( \cdot \mid s , a ) , P _ { 2 } ( \cdot \mid s , a ) ) ] , } \\ & { \mathbb { E } _ { ( s , a ) \sim \rho } [ h ^ { 2 } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ] \le \mathbb { E } _ { ( s , a ) \sim \rho } [ 1 6 h ^ { 2 } ( \bar { P } ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ] . } \end{array}
+$$
+
+We also recall Hellinger distance is stronger than TV distance:
+
+Lemma 2 (Relation of Hellinger distance and TV distance ).
+
+$$
+\mathrm { T V } ( P _ { 1 } ( \cdot \mid s , a ) , P _ { 2 } ( \cdot \mid s , a ) ) \leq \sqrt { 2 } h ( P _ { 1 } ( \cdot \mid s , a ) , P _ { 2 } ( \cdot \mid s , a ) ) .
+$$
+
+The following lemma is useful to connect the log-loss and the Hellinger distance.
+
+Lemma 3 (Basic Inequality for MLE).
+
+$$
+\begin{array} { r } { \mathbb { E } _ { ( s , a ) \sim \rho } [ h ^ { 2 } ( \hat { P } _ { \mathrm { M L E } } ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ] \leq ( \mathbb { E } _ { \mathcal { D } } - \mathbb { E } _ { ( s , a ) \sim \rho , s ^ { \prime } \sim P ^ { \star } ( \cdot \mid s , a ) } ) [ g _ { P } ( s , a , s ^ { \prime } ) ] . } \end{array}
+$$
+
+This is proved by Lemma 4.1 (van de Geer, 2000). To simplify the notation, we define
+
+$$
+H ^ { 2 } ( P _ { 1 } , P _ { 2 } ) = \mathbb { E } _ { ( s , a ) \sim \rho } [ h ^ { 2 } ( P _ { 1 } ( \cdot \mid s , a ) , P _ { 2 } ( \cdot \mid s , a ) ) ] .
+$$
+
+Here, our goal is showing with probability $1 - \delta$ ,
+
+$$
+H ^ { 2 } ( \hat { P } _ { \mathrm { M L E } } , P ^ { \star } ) \leq \{ \xi _ { n } + \sqrt { \log ( c _ { 2 } / \delta ) / n } \} ^ { 2 } .
+$$
+
+This is proved by showing for $x \geq \xi _ { n }$ ,
+
+$$
+\begin{array} { r } { \mathrm { P } ( H ^ { 2 } ( \hat { P } _ { \mathrm { M L E } } , P ^ { \star } ) \geq x ^ { 2 } ) \leq c \exp ( - n x ^ { 2 } / c ^ { 2 } ) . } \end{array}
+$$
+
+This corresponds to the statement in Theorem 7.4 (van de Geer, 2000). To prove the above, we first use
+
+$$
+\begin{array} { r } { \mathrm { P } ( H ^ { 2 } ( \hat { P } _ { \mathrm { M L E } } , P ^ { \star } ) \ge x ^ { 2 } ) \le \mathrm { P } ( 1 6 H ^ { 2 } ( \bar { \hat { P } } _ { \mathrm { M L E } } , P ^ { \star } ) \ge x ^ { 2 } ) , } \end{array}
+$$
+
+from Lemma 1. Then, from Lemma 3, this is upper-bounded by
+
+$$
+{ \mathrm { P } } \big ( \operatorname* { s u p } _ { P \in \mathcal { M } , H ^ { 2 } ( \bar { P } , P ^ { \star } ) \geq x ^ { 2 } / 1 6 } \nu _ { n } ( g _ { P } ) - \sqrt { n } H ^ { 2 } ( P , P ^ { \star } ) \geq 0 \big )
+$$
+
+where $\nu _ { n } = \sqrt { n } ( \mathbb { E } _ { \mathcal { D } } - \mathbb { E } _ { ( s , a ) \sim \rho , s ^ { \prime } \sim P ^ { \star } ( \cdot | s , a ) } )$ . To prove the term 5 is less than $c \exp ( - n \delta ^ { 2 } / c ^ { 2 } )$ , we use Theorem 5.11 (van de Geer, 2000), that is, some uniform inequality based on entropy with bracketing. The rest of the proof is the same as Theorem 7.4 (van de Geer, 2000). In summary, the only difference is we use the distance $H ( a , b )$ tailored to the conditional density estimation instead of unconditional density estimation.
+
+# B MORE DETAILS FOR KNRS
+
+We explain the algorithm and present the PAC guaranteed for KNRs. Here, we denote the dimension of $s$ by $d _ { S }$ .
+
+We tailor Algorithm 1 to KNRs as follows to obtain a tighter guarantee. First, MLE procedure is replaced with $\hat { W } _ { \mathrm { M L E } }$ by regularized MLE:
+
+$$
+\hat { W } _ { \mathrm { M L E } } = \underset { W \in \mathbb { R } ^ { d _ { S } \times d } } { \arg \operatorname* { m i n } } \ \mathbb { E } _ { \mathcal { D } } [ \| W \phi ( s , a ) - s ^ { \prime } \| _ { 2 } ^ { 2 } ] + \lambda \| W \| _ { F } ^ { 2 } ,
+$$
+
+where $\| \cdot \| _ { F }$ is a Frobenius norm. Then, the final policy optimization procedure is
+
+$$
+\begin{array} { r } { \hat { \boldsymbol \pi } = \arg \operatorname* { m a x } _ { \boldsymbol \pi \in \Pi } \operatorname* { m i n } _ { W \in \mathcal W _ { D } } V _ { P ( W ) } ^ { \boldsymbol \pi } , \mathrm { s . t . } , \boldsymbol \mathcal W _ { \mathcal D } = \{ { W \in \mathbb R } ^ { d _ { \boldsymbol S } \times d } : \| ( \hat { W } _ { \mathrm { M L E } } - W ) ( \Sigma _ { n } ) ^ { 1 / 2 } \| _ { 2 } \leq \xi \} } \end{array}
+$$
+
+where $\begin{array} { r } { \Sigma _ { n } = \sum _ { i = 1 } ^ { n } \phi ( s _ { i } , a _ { i } ) \phi ^ { \top } ( s _ { i } , a _ { i } ) } \end{array}$ . We state the theoretical guarantee for KNRs below.
+
+Corollary 3 (PAC bound for KNRs). Assume $\| \phi ( s , a ) \| _ { 2 } \leq 1 , \forall ( s , a ) \in S \times \mathcal { A }$ . We set
+
+$$
+\xi = \sqrt { 2 \lambda | | W ^ { \star } | | _ { 2 } ^ { 2 } + 8 \zeta ^ { 2 } \big ( d _ { S } \ln ( 5 ) + \ln ( 1 / \delta ) + \bar { \mathcal { T } } _ { n } \big ) } , \quad \bar { \mathcal { T } } _ { n } = \ln \big ( \operatorname* { d e t } ( \Sigma _ { n } ) / \operatorname* { d e t } ( \lambda \mathbf { I } ) \big ) .
+$$
+
+Suppose the KNR model is well-specified. By letting $\| W ^ { \star } \| _ { 2 } ^ { 2 } = O ( 1 ) , \zeta ^ { 2 } = O ( 1 ) , \lambda = O ( 1 ) ,$ , with probability $1 - \delta _ { : }$ , for all $\pi ^ { * }$ , we have
+
+$$
+\gamma _ { \scriptscriptstyle { R ^ { * } } } ^ { \pi ^ { * } } - V _ { \scriptscriptstyle { P ^ { * } } } ^ { \bar { \pi } } \leq c _ { 1 } H ^ { 2 } \operatorname* { m i n } ( d ^ { 1 / 2 } , \bar { R } ) \sqrt { \bar { R } } \sqrt { \frac { d _ { s } \bar { C } _ { \pi ^ { * } , P ^ { * } } \ln ( 1 + n ) } { n } } , \quad w h e r e \ \bar { R } : = \mathrm { r a n k } [ \Sigma _ { \rho } ] \{ \mathrm { r a n k } [ \Sigma _ { \rho } ] + 1 / \bar { \lambda } \}
+$$
+
+The proof is deferred to Section E.5.
+
+# C MORE RELATED WORKS
+
+We discuss literature related to representation learning in RL.
+
+Representation learning for low-rank MDPs (ground truth feature representation is unknown) in online learning is studied from a model-based perspective (Agarwal et al., 2020b) and model-free perspective (Modi et al., 2021). In the online setting, Zhang et al. (2021a); Papini et al. (2021) also study representation learning under different model assumptions. Comparing with these works, since our setting is offline, the algorithm and analysis are totally different.
+
+In the offline setting, Ni et al. (2021) study dimensionality reduction in a given kernel space, and Hao et al. (2021) study feature selection in sparse linear MDPs. Their focus is different as they do not study PAC guarantees under partial coverage. Ni et al. (2021) assumes the transition operator can be properly embedded into predefined Reproducing Kernel Hilbert Spaces and learns low-dimensional state-action representations via kernelized embedding and low-rank tensor decomposition. However, they did not study the errors for policy optimization after using these learned features. Regarding offline distribution coverage, Ni et al. (2021) assumes that the feature covariance matrix (feature associated with the pre-defined kernel) of the offline distribution is full rank. Hao et al. (2021) studies an OPE problem on sparse linear Bellman complete MDPs in the offline learning setting where they assume all covariance matrices (covariance matrices that correspond to all possible subsets of features) under the offline distribution are full rank as well. We study policy optimization in lowrank MDPs (with unknown feature representation), and we do not assume full coverage, i.e., we do not assume the feature covariance matrix is full rank, and indeed our result is distribution-dependent since it scales with respect to the rank of the covariance matrix that is defined using the ground truth feature representation.
+
+# D COMPARISON TO XIE ET AL. (2021)
+
+We compare a result in (Xie et al., 2021) to our result in detail. Let $\mathcal { F }$ be a function class for $Q$ - functions. Here, we consider a more general version of their algorithm by replacing the original $\mathcal { E } ( f , \pi ; \mathcal { D } )$ in their algorithm with
+
+$$
+\mathcal { E } ( f , \pi ; \mathcal { D } ) : = \mathcal { L } ( f , f ; \pi , \mathcal { D } ) - \operatorname* { m i n } _ { g \in \mathcal { G } } \mathcal { L } ( g , f ; \pi , \mathcal { D } ) .
+$$
+
+In their original algorithm, they set $\mathcal { G } = \mathcal { F }$ . Here, we consider the version such that a discriminator class $\mathcal { G }$ can be different from $\mathcal { F }$ .
+
+They show the PAC result under partial coverage as follows. Here, $\mathcal { T } _ { P ^ { \star } } ^ { \pi }$ is a Bellman operator under $\pi$ and $P ^ { \star }$ :
+
+$$
+\begin{array} { r } { T _ { P ^ { \star } } ^ { \pi } : \{ \mathcal { S } \times \mathcal { A } \to \mathbb { R } \} \ni f \mapsto r ( s , a ) + \mathbb { E } _ { P ^ { \star } ( s ^ { \prime } \mid s , a ) } [ f ( s ^ { \prime } , \pi ) ] \in \{ \mathcal { S } \times \mathcal { A } \to \mathbb { R } \} . } \end{array}
+$$
+
+Theorem 6 (Extension of Result in (Xie et al., 2021) ). Suppose realizaibility $Q _ { P ^ { \star } } ^ { \pi } \in { \mathcal { F } } , \forall \pi \in \Pi$ and closeness $\begin{array} { r } { \operatorname* { m a x } _ { f \in \mathcal { F } } \operatorname* { m i n } _ { { g } \in \mathcal { G } } \mathbb { E } _ { s , a \sim { \rho } } [ ( g - \mathcal { T } _ { P ^ { \star } } ^ { \pi } f ) ^ { 2 } ( s , a ) ] \stackrel { } { = } 0 , \forall \pi \in \Pi } \end{array}$ . Then, with $1 - \delta$ , for any $\pi ^ { * } \in \Pi$ , we have
+
+$$
+V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \widehat { \pi } } = O ( \sqrt { C ^ { \diamond } \ln ( | \Pi | | \mathcal { F } | | \mathcal { G } | / \delta ) / n } ) , \quad C ^ { \diamond } = \operatorname* { s u p } _ { f \in \mathcal { F } } \frac { \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi ^ { * } } } [ ( f - \mathcal { T } f ) ^ { 2 } ( s , a ) ] } { \mathbb { E } _ { ( s , a ) \sim \rho } [ ( f - \mathcal { T } f ) ^ { 2 } ( s , a ) ] } .
+$$
+
+By combining this result with the conversion from model-free results to model-based results in (Chen & Jiang, 2019, Corollary 6), we can obtain the following result under partial coverage.
+
+Theorem 7 (PAC guarantee from the direct application of (Xie et al., 2021) to mode-based RL ). Assume $P ^ { \star } \in { \mathcal { M } }$ . Then, there exists an algorithm s.t. with $1 - \delta$ , for any policy $\pi ^ { \star } \in \Pi$ ,
+
+$$
+V _ { P ^ { \star } } ^ { \pi ^ { \star } } - V _ { P ^ { \star } } ^ { \hat { \pi } } = O ( \sqrt { C ^ { \diamond } \ln ( | \Pi | | \mathcal { M } | / \delta ) / n } ) .
+$$
+
+As we mentioned, this is worse than our result since it includes $\lvert \Pi \rvert$ . Besides, the algorithm can only compete against policies restricted in $\Pi$ , while our algorithm works for the unrestricted policy class $\Pi$ which could even include history dependent policies. For completeness, we give the proof as follows.
+
+We remark that their results (Theorem 4.1) with NPG that can possibly compete with any stochastic policies, are not applicable here. This is because they need an assumption that the comparator policy $\pi ^ { * }$ needs to satisfy $Q _ { P ^ { \star } } ^ { \pi ^ { * } } \in { \mathcal { F } }$ and $\begin{array} { r } { \operatorname* { m a x } _ { f \in \mathcal { F } } \operatorname* { m i n } _ { g \in \mathcal { G } } \mathbb { E } _ { s , a \sim \rho } [ ( g - \mathcal { T } _ { P ^ { \star } } ^ { \pi ^ { * } } f ) ^ { 2 } ( s , a ) ] = 0 , } \end{array}$ , which does not hold for the corresponding Q-function class $\mathcal { F }$ after the conversion. As a notable exception, when the model is a linear Bellman-complete MDP (Zanette et al., 2021), any stochastic policies satisfy the Bellman completeness for the linear $\mathrm { Q }$ -function class; then, their algorithms can learn policies that can compete with any stochastic policies satisfying partial coverage.
+
+Proof of Theorem 7. Given a model class $\mathcal { M }$ , consider the following reduction. We define a $Q$ - function class:
+
+$$
+{ \mathcal { F } } = \{ q _ { P } ^ { \pi } \ | \ \pi \in \Pi , P \in { \mathcal { M } } \} .
+$$
+
+Then, we define a discriminator class $\mathcal { G }$ :
+
+$$
+\mathcal { G } = \{ T _ { P ^ { \prime } } ^ { \pi ^ { \prime } } q _ { P } ^ { \pi } \ | \ \pi \in \Pi , \pi ^ { \prime } \in \Pi , P \in \mathcal { M } , P ^ { \prime } \in \mathcal { M } \} .
+$$
+
+The above satisfies the realizability $Q _ { P ^ { \star } } ^ { \pi } \in \mathcal { F } , \forall \pi \in \Pi$ and the closedness $\mathcal T _ { P ^ { \star } } ^ { \pi } \mathcal F \subset \mathcal G , \forall \pi \in \Pi$ . Thus, the assumptions in Theorem 6 are satisfied. Then, we have
+
+$$
+\begin{array} { r } { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } = O ( \sqrt { C ^ { \diamond } \ln ( \vert \Pi \vert \vert \mathcal { F } \vert \vert \mathcal { G } \vert / \delta ) / n } ) } \\ { = O ( \sqrt { C ^ { \diamond } \ln ( \vert \Pi \vert \vert \mathcal { M } \vert / \delta ) / n } ) , } \end{array}
+$$
+
+noting $| { \mathcal { F } } | = | \Pi | | { \mathcal { M } } |$ and $| \mathcal { G } | = | \Pi | ^ { 2 } | \mathcal { M } | ^ { 2 }$ .
+
+# E MISSING PROOFS
+
+Below we use $c , c _ { 1 } , c _ { 2 } , \cdots$ to denote universal constants. For a $d$ -dimensional vector $a$ and a matrix $A \in \mathbb { R } ^ { d \times d }$ , we denote $\| a \| _ { A } ^ { 2 } = a ^ { \top } A a$ . Here, $a \lesssim B$ means $a \leq c B$ for some universal constant. $c$
+
+# E.1 PROOFS FOR GENERAL FUNCTION APPROXIMATION
+
+Proof of Theorem $^ { l }$ . From Lemma 6, the MLE guarantee gives us the following generalization bound: with probability $1 - \delta$ ,
+
+$$
+\mathbb { E } _ { s , a \sim \rho } [ \mathrm { T V } ( \widehat { P } _ { \mathrm { M L E } } ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] \lesssim \frac { \ln ( \vert M \vert / \delta ) } { n } .
+$$
+
+Letting
+
+$$
+A ( P ) : = | \mathbb { E } _ { s , a \sim \rho } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] | .
+$$
+
+with probability $1 - \delta$ , from union bound and Bernstein’s inequality, we also have
+
+$$
+A ( P ) \leq \sqrt { \frac { c _ { 1 } \operatorname { v a r } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] \ln ( \mid M \mid / \delta ) } { n } } + \frac { c _ { 2 } \ln ( \mid M \mid / \delta ) } { n } , \forall P \in \mathcal { M } .
+$$
+
+Hereafter, we condition on the above two events. Recall that we construct the version space using $\mathcal { D }$ and $\widehat { P } _ { \mathrm { M L E } }$ as follows:
+
+$$
+\mathcal { M } _ { \mathcal { D } } : = \left\{ P \in \mathcal { M } : \mathbb { E } _ { \mathcal { D } } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , \hat { P } _ { \mathrm { M L E } } ( \cdot \mid s , a ) ) ^ { 2 } ] \leq \xi \right\} .
+$$
+
+First Step: Show above two events $P ^ { \star } \in \mathcal { M } _ { \mathcal { D } }$ in high-probabili) and (7), we prove t . $\xi = c \frac { \ln ( | \mathcal { M } | / \delta ) } { n }$ . Conditioning on they $P ^ { \star } \in \mathcal { M } _ { \mathcal { D } }$
+
+$$
+\begin{array} { r l } & { \mathbb { E } \mathbb { P } [ \mathrm { T V } ( \hat { \mathcal { R } } _ { 1 \mathrm { H E } } ( \cdot \ \left\{ s , \alpha \right\} , P ^ { * } ( \cdot \ \ | s , \alpha ) ) ^ { 2 } ] } \\ & { = \mathbb { E } _ { P } [ \mathrm { T V } ( \hat { \mathcal { R } } _ { 1 \mathrm { H E } } ( \cdot \left\{ s , \alpha \right\} , P ^ { * } ( \cdot \ | s , \alpha ) ) ^ { 2 } ] - \mathbb { E } _ { ( s , \alpha ) \sim \beta } [ \mathrm { T V } ( \hat { \mathcal { R } } _ { 1 \mathrm { H E } } ( \cdot \left\{ s , \alpha \right\} , P ^ { * } ( \cdot \ \ | s , \alpha ) ) ^ { 2 } ] } \\ & { + \mathbb { E } _ { ( s , \alpha ) \sim \beta } [ \mathrm { T V } ( \hat { \mathcal { R } } _ { 1 \mathrm { H E } } ( \cdot \left\{ s , \alpha \right\} , P ^ { * } ( \cdot \ \ | s , \alpha ) ) ^ { 2 } ] - \mathbb { E } _ { ( s , \alpha ) \sim \beta } [ \mathrm { T V } ( \hat { \mathcal { R } } _ { 1 \mathrm { H E } } ( \cdot \left\{ s , \alpha \right\} , P ^ { * } ( \cdot \ \ | s , \alpha ) ) ^ { 2 } ] } \\ & { = \mathbb { E } _ { \mathbb { E } \mathrm { P } } [ \mathrm { T V } ( \hat { \mathcal { R } } _ { 1 \mathrm { H E } } ( \cdot \left\{ s , \alpha \right\} , P ^ { * } ( \cdot \ \ | s , \alpha ) ) ^ { 2 } ] - \mathbb { E } _ { ( s , \alpha ) \sim \beta } [ \mathrm { T V } ( \hat { \mathcal { R } } _ { 1 \mathrm { H E } } ( \cdot \left\{ s , \alpha \right\} , P ^ { * } ( \cdot \ | s , \alpha ) ) ^ { 2 } ] + \frac { c _ { 1 } \ln ( \alpha ) } { \beta } , } \\ & \lesssim \sqrt \frac { \mathrm { V a r } _ { ( s , \alpha ) \sim \beta } [ \mathrm { T V } ( \hat { \mathcal { R } } _ { 1 \mathrm { H E } } ( \cdot \left\{ s , \alpha \right\} , P ^ { * } ( \cdot \ | s , \alpha ) ) ^ { 2 } ] - \mathbb { E } _ { ( s , \alpha ) \sim \beta } [ \mathrm { T V } ( \hat { \mathcal { R } } ) ( \cdot \left\{ s , \alpha \right\} , P ^ { * } ( \cdot \| s , \alpha ) ) ^ { 2 } { \mathrm { I m } } ( | s | / \delta ) } \\ & \lesssim \sqrt \end{array}
+$$
+
+Second Step: Show $\begin{array} { r } { \mathbb { E } _ { s , a \sim \rho } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] \le c \xi , \quad \forall P \in \mathcal { M } _ { \mathcal { D } } } \end{array}$ in high probability. We show for any $P \in \mathcal { M } _ { \mathcal { D } }$ , the distance between $P ^ { \star }$ is sufficiently controlled in terms of TV distance. More concretely (conditioning on the above two events (6) and (7) ), we show
+
+$$
+\begin{array} { r } { \mathbb { E } _ { s , a \sim \rho } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] \lesssim \xi , \quad \forall P \in \mathcal { M } _ { \mathcal { D } } . } \end{array}
+$$
+
+In order to observe this, for any $P \in \mathcal { M } _ { \mathcal { D } }$ , we have
+
+$$
+\begin{array} { r l } & { \mathbb { E } _ { \mathcal { D } } [ \mathrm { T V } ( P ( \cdot \ \vert \ s , a ) , P ^ { \star } ( \cdot \ \vert \ s , a ) ) ^ { 2 } ] } \\ & { \leq 2 \mathbb { E } _ { \mathcal { D } } [ \mathrm { T V } ( \widehat { P } _ { \mathrm { M L E } } ( \cdot \ \vert \ s , a ) , P ( \cdot \ \vert \ s , a ) ) ^ { 2 } ] + 2 \mathbb { E } _ { \mathcal { D } } [ \mathrm { T V } ( \widehat { P } _ { \mathrm { M L E } } ( \cdot \ \vert \ s , a ) , P ^ { \star } ( \cdot \ \vert \ s , a ) ) ^ { 2 } ] \leq 4 \xi } \\ & { \qquad ( \mathrm { F r o m } \ ( a + b ) ^ { 2 } \leq 2 a ^ { 2 } + 2 b ^ { 2 } . ) } \end{array}
+$$
+
+Thus, we have:
+
+$$
+\begin{array} { r l } & { \mathfrak { L } _ { s , a \sim \rho } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] } \\ & { = \mathbb { E } _ { s , a \sim \rho } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] + \mathbb { E } _ { \mathcal { D } } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ( \cdot \mid s , a ) ) ^ { 2 } ] } \\ & { \le A ( P ) + c \xi . } \end{array}
+$$
+
+Here, from (7), we have
+
+$$
+A ( P ) \leq \sqrt { \frac { c _ { 1 } \mathrm { v a r } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] ] \ln ( \vert \mathcal { M } \vert / \delta ) } { n } } + \frac { c _ { 2 } \ln ( \vert \mathcal { M } \vert / \delta ) } { n } , \forall P \in \mathcal { M } _ { \mathcal { D } } .
+$$
+
+Then, for any $P \in \mathcal { M } _ { \mathcal { D } }$ , we have
+
+$$
+\begin{array} { r l } & { A ( P ) \leq \sqrt { \frac { c _ { 1 } \mathrm { E } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 4 } ] \ln ( \vert { \cal M } \vert / \delta ) } { n } } + \frac { c _ { 2 } \ln ( \vert { \cal M } \vert / \delta ) } { n } } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad ( \mathrm { I T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] \leq 4 . ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \ \end{array}
+$$
+
+From $( a + b ) ^ { 2 } \leq 2 a ^ { 2 } + 2 b ^ { 2 }$ ,
+
+$$
+\begin{array} { r l } & { 4 ^ { 2 } ( P ) \lesssim \left( \sqrt { \frac { c ( A ( P ) + \xi ) \ln ( \lvert M \rvert / \delta ) } { n } } + \frac { c \ln ( \lvert M \rvert / \delta ) } { n } \right) ^ { 2 } \lesssim \frac { ( A ( P ) + \xi ) \ln ( \lvert M \rvert / \delta ) } { n } + \left\{ \frac { c \ln ( \lvert M \rvert / \delta ) } { n } \right. } \\ & { \qquad \lesssim \frac { ( A ( P ) + \xi ) \ln ( \lvert M \rvert / \delta ) } { n } } & { ( \xi \mathrm { i n c l u d e s ~ l n } ( \lvert M \rvert / \delta ) ) } \\ & { \qquad \lesssim \frac { ( A ( P ) + 1 / n \ln ( \lvert M \rvert / \delta ) ) \ln ( \lvert M \rvert / \delta ) } { n } . } \end{array}
+$$
+
+Then, we have
+
+$$
+A ^ { 2 } ( P ) - B _ { 1 } A ( P ) - B _ { 2 } \leq 0 , \quad B _ { 1 } = c \ln ( | { \mathcal { M } } | / \delta ) / n , \quad B _ { 2 } = c ( 1 / n ) ^ { 2 } \ln ( | { \mathcal { M } } | / \delta ) ^ { 2 } .
+$$
+
+This concludes
+
+$$
+0 \leq A ( P ) \leq \frac { B _ { 1 } + \sqrt { B _ { 1 } ^ { 2 } + 4 B _ { 2 } } } { 2 } \leq c ( B _ { 1 } + \sqrt { B _ { 2 } } ) \leq c \frac { \ln ( | \mathcal { M } | / \delta ) } { n } \lesssim \xi .
+$$
+
+Thus, by using the above $A ( P ) \lesssim \xi ( P \in \mathcal { M } _ { D } )$ and (8), with probability $1 - \delta$ , we have:
+
+$$
+\begin{array} { r } { \mathbb { E } _ { s , a \sim \rho } [ \mathrm { T V } ( P ( \cdot { \mid } s , a ) , P ^ { \star } ( \cdot { \mid } s , a ) ) ^ { 2 } ] \le A ( P ) + c \xi \lesssim \xi , \quad P \in \mathcal { M } _ { \mathcal { D } } . } \end{array}
+$$
+
+Third Step: Calculate the final error bound taking the distribution shift into account For any $P \in \mathcal { M } _ { \mathcal { D } }$ , we prove
+
+$$
+V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P } ^ { \pi ^ { * } } \leq ( 1 - \gamma ) ^ { - 2 } c \sqrt { C _ { \pi ^ { * } } ^ { \dagger } } \sqrt { \frac { \ln ( | \mathcal { M } | / \delta ) } { n } } .
+$$
+
+For any $P \in \mathcal { M } _ { \mathcal { D } }$ , this is proved as follows:
+
+$$
+\begin{array} { r l r } { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P } ^ { \pi ^ { * } } \leq ( 1 - \gamma ) ^ { - 2 } \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { * } } ^ { \pi ^ { * } } } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ] } & \\ & { } & { \mathrm { ( S i m u ~ } } \\ & { } & { \leq ( 1 - \gamma ) ^ { - 2 } \sqrt { \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { * } } ^ { \pi ^ { * } } } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] } } \\ & { } & { \leq ( 1 - \gamma ) ^ { - 2 } \sqrt { C _ { \pi ^ { * } } ^ { \dagger } \mathbb { E } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] } } \\ & { } & { \leq c ( 1 - \gamma ) ^ { - 2 } \sqrt { C _ { \pi ^ { * } } ^ { \dagger } } \sqrt { \frac { \ln ( | \mathrm { M } | / \delta ) } { n } } . \quad \mathrm { ( B a s e d ~ o n ~ t h e ~ c o n s e q u ~ } } \end{array}
+$$
+
+Combining all things together, with probability $1 - \delta$ , for any $\pi ^ { * } \in \Pi$ , we have
+
+$$
+\begin{array} { r l } & { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } \leq V _ { P ^ { \star } } ^ { \pi ^ { * } } - \underset { P \in \mathcal { M } _ { \mathcal { D } } } { \operatorname* { m i n } } V _ { P } ^ { \pi ^ { * } } + \underset { P \in \mathcal { M } _ { \mathcal { D } } } { \operatorname* { m i n } } V _ { P } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } } \\ & { \qquad \leq V _ { P ^ { \star } } ^ { \pi ^ { * } } - \underset { P \in \mathcal { M } _ { \mathcal { D } } } { \operatorname* { m i n } } V _ { P } ^ { \pi ^ { * } } + \underset { P \in \mathcal { M } _ { \mathcal { D } } } { \operatorname* { m i n } } V _ { P } ^ { \hat { \pi } } - V _ { P ^ { \star } } ^ { \hat { \pi } } } \\ & { \qquad \leq V _ { P ^ { \star } } ^ { \pi ^ { * } } - \underset { P \in \mathcal { M } _ { \mathcal { D } } } { \operatorname* { m i n } } V _ { P } ^ { \pi ^ { * } } } \\ & { \qquad \lesssim ( 1 - \gamma ) ^ { - 2 } c _ { 1 } \sqrt { C _ { \pi ^ { * } } ^ { \dagger } } \sqrt { \frac { \ln ( | \mathcal { M } | c _ { 2 } / \delta ) } { n } } . } \end{array}
+$$
+
+Remark 2 (To compete with all history-dependent polices). Consider the case where $\Pi$ is all Markovian polices. We want to show we can compete with all history-dependent non-Markovian polices:
+
+$$
+{ \bar { \Pi } } = \left\{ \prod _ { i = 1 } ^ { \infty } \pi _ { i } \mid \pi _ { i } \in \left[ \left( \prod _ { k = 1 } ^ { i - 1 } S \times { \mathcal { A } } \right) \to \Delta ( A ) \right] \right\} .
+$$
+
+We take an element $\pi ^ { * }$ from $\bar { \Pi }$ . Then, $V _ { P ^ { \star } } ^ { \pi ^ { * } }$ and $d _ { P ^ { \star } } ^ { \pi ^ { * } }$ are still well-defined. Then, every step in the proof still holds. The only step we need to check carefully is this line:
+
+$$
+\begin{array} { r l r } & { } & { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } \leq V _ { P ^ { \star } } ^ { \pi ^ { * } } - \underset { P \in \mathcal { M } _ { \mathcal { D } } } { \operatorname* { m i n } } V _ { P } ^ { \pi ^ { * } } + \underset { P \in \mathcal { M } _ { \mathcal { D } } } { \operatorname* { m i n } } V _ { P } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } } \\ & { } & { \qquad \leq V _ { P ^ { \star } } ^ { \pi ^ { * } } - \underset { P \in \mathcal { M } _ { \mathcal { D } } } { \operatorname* { m i n } } V _ { P } ^ { \pi ^ { * } } + \underset { P \in \mathcal { M } _ { \mathcal { D } } } { \operatorname* { m i n } } V _ { P } ^ { \hat { \pi } } - V _ { P ^ { \star } } ^ { \hat { \pi } } . } \end{array}
+$$
+
+This is proved by $\operatorname* { m a x } _ { \pi \in \bar { \Pi } } V _ { P } ^ { \pi } = \operatorname* { m a x } _ { \pi \in \Pi } V _ { P } ^ { \pi }$ for any $P$ .
+
+# E.2 PROOFS FOR GENERAL FUNCTION APPROXIMATION WITH INFINITE HYPOTHESIS CLASS
+
+Proof of Theorem 5. From Theorem 4, the MLE guarantee gives us the following generalization bound: with probability $1 - \delta$ ,
+
+$$
+\mathbb { E } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( \widehat { P } _ { \mathrm { M L E } } ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] \lesssim \left( \xi _ { n } ^ { 2 } + \frac { \ln ( c / \delta ) } { n } \right) .
+$$
+
+We define
+
+$$
+\mathcal { M } _ { 1 } = \left\{ P \in \mathcal { M } : \mathbb { E } _ { ( s , a ) \sim \rho } \left[ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } \right] \leq c \left( \xi _ { n } ^ { 2 } + \sqrt { \frac { \ln ( c / \delta ) } { n } } \right) \right\} .
+$$
+
+for some large $c$ . From a functional Bernstein’s inequality (Lemma 12), by defining
+
+$$
+f ( P ) ( s , a ) = \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } , G ( \mathcal { M } _ { 1 } ) = \mathbb { E } [ \operatorname* { s u p } _ { P \in \mathcal { M } _ { 1 } } | ( \mathbb { E } _ { \mathcal { D } } - \mathbb { E } _ { \rho } ) [ f ( P ) ] | ] .
+$$
+
+with probability $1 - \delta$ , we have
+
+$$
+\begin{array} { r l r } { \displaystyle \operatorname* { s u p } _ { \tau \in \mathcal { M } _ { 1 } } | ( \mathbb { E } _ { \mathcal { D } } - \mathbb { E } _ { \rho } ) [ f ( P ) ] | \lesssim G ( \mathcal { M } _ { 1 } ) + \{ G ( \mathcal { M } _ { 1 } ) + \underset { P \in \mathcal { M } _ { 1 } } { \operatorname* { s u p } } \mathbb { E } _ { \rho } [ f ( P ) ^ { 2 } ] \} ^ { 1 / 2 } \sqrt { \frac { \log ( c _ { 1 } / \delta ) } { n } } + \frac { \log ( c _ { 1 } / \delta ) } { n } } & \\ { \displaystyle } & { \lesssim G ( \mathcal { M } _ { 1 } ) + \{ G ( \mathcal { M } _ { 1 } ) + \underset { P \in \mathcal { M } _ { 1 } } { \operatorname* { s u p } } \mathbb { E } _ { \rho } [ f ( P ) ] \} ^ { 1 / 2 } \sqrt { \frac { \log ( c _ { 1 } / \delta ) } { n } } + \frac { \log ( c _ { 1 } / \delta ) } { n } } & \\ { \displaystyle } & { \lesssim G ( \mathcal { M } _ { 1 } ) + \xi _ { n } ^ { 2 } + \left( \frac { \ln ( c / \delta ) } { n } \right) . } & { \quad { \mathrm { ( 1 1 ) } } } \end{array}
+$$
+
+Similarly, by defining
+
+$$
+\begin{array} { r } { \mathcal { M } _ { 2 } = \Bigg \{ P : \mathbb { E } _ { ( s , a ) \sim \mathcal { D } } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] \leq c G ( \mathcal { M } _ { 1 } ) + c \xi _ { n } ^ { 2 } + c \left( \cfrac { \ln ( c / \delta ) } { n } \right) \Bigg \} , } \\ { G ( \mathcal { M } _ { 2 } ) = \mathbb { E } [ \underset { P \in \mathcal { M } _ { \mathcal { D } } } { \operatorname* { s u p } } \mid ( \mathbb { E } _ { \mathcal { D } } - \mathbb { E } _ { \rho } ) [ f ( P ) ] \mid ] , } \\ { Z _ { n } = \underset { P \in \mathcal { M } _ { 2 } } { \operatorname* { s u p } } \mathbb { E } _ { ( s , a ) \sim \rho } [ f ( P ) ( s , a ) ] . } \end{array}
+$$
+
+from a functional Bernstein’s inequality, with probability $1 - \delta$ , we have
+
+$$
+\begin{array} { r l r } { { \operatorname* { s u p } _ { P \in \mathcal { M } _ { 2 } } | ( \mathbb { E } _ { \mathcal { D } } - \mathbb { E } _ { \rho } ) [ f ( P ) ] | \lesssim G ( \mathcal { M } _ { 2 } ) + \{ G ( \mathcal { M } _ { 2 } ) + Z _ { n } \} ^ { 1 / 2 } \sqrt { \frac { \log ( c _ { 1 } / \delta ) } { n } } + \frac { \log ( c _ { 1 } / \delta ) } { n } } } \\ & { } & { \lesssim G ( \mathcal { M } _ { 2 } ) + \sqrt { Z _ { n } \frac { \ln ( c / \delta ) } { n } } + \frac { \ln ( c / \delta ) } { n } } \end{array}
+$$
+
+Hereafter, we condition on the above three events:(10), (11) and (12).
+
+First step: Show $P ^ { * } \in \mathcal { M } _ { \mathcal { D } }$ in high probability. From (10), we have
+
+$$
+\mathbb { E } _ { ( s , a ) \sim \rho } [ f ( \hat { P } _ { \mathrm { M L E } } ) ( s , a ) ] \leq \xi _ { n } ^ { 2 } + \frac { \ln ( c / \delta ) } { n } .
+$$
+
+Thus, $P ^ { \star } \in { \mathcal { M } } _ { 1 }$ . Then, from (11) and (10),
+
+$$
+\begin{array} { r l } & { \mathbb { E } _ { ( s , a ) \sim \mathcal { D } } [ f ( \hat { P } _ { \mathrm { M L E } } ) ( s , a ) ] } \\ & { = | \mathbb { E } _ { ( s , a ) \sim \mathcal { D } } [ f ( \hat { P } _ { \mathrm { M L E } } ) ( s , a ) ] - \mathbb { E } _ { ( s , a ) \sim \rho } [ f ( \hat { P } _ { \mathrm { M L E } } ) ( s , a ) ] | + \mathbb { E } _ { ( s , a ) \sim \rho } [ f ( \hat { P } _ { \mathrm { M L E } } ) ( s , a ) ] } \\ & { \lesssim G ( \mathcal { M } _ { 1 } ) + \xi _ { n } ^ { 2 } + \frac { \ln ( c / \delta ) } { n } . } \end{array}
+$$
+
+Thus, $P ^ { \star } \in \mathcal { M } _ { \mathcal { D } }$ recalling the definition of $\mathcal { M } _ { \mathcal { D } }$ (we set $\begin{array} { r } { \xi = G ( \mathcal { M } _ { 1 } ) + \xi _ { n } ^ { 2 } + \frac { \ln ( c / \delta ) } { n } ) } \end{array}$
+
+Second step: Show the upper bound of $\mathbb { E } _ { ( s , a ) \sim \rho } [ f ( P ) ( s , a ) ]$ for any $P \in \mathcal { M } _ { \mathcal { D } }$ . For any $P \in \mathcal { M } _ { \mathcal { D } }$ , as the proof of Theorem 1, we can prove $P \in \mathcal { M } _ { 2 }$ . Thus,
+
+$$
+\operatorname* { s u p } _ { P \in { \mathcal { M } } _ { \mathcal { D } } } \mathbb { E } _ { ( s , a ) \sim \rho } [ f ( P ) ( s , a ) ] \le Z _ { n } .
+$$
+
+Thus, we will hereafter analyze $Z _ { n }$ . Here from (12), for any $P \in \mathcal { M } _ { 2 }$ , we have
+
+$$
+\begin{array} { r l } & { \Xi _ { ( s , a ) \sim \rho } [ f ( P ) ( s , a ) ] \le \underset { P \in { \cal M } _ { 2 } } { \operatorname* { s u p } } \left( | ( \mathbb { E } _ { ( s , a ) \sim \mathcal { D } } - \mathbb { E } _ { ( s , a ) \sim \rho } ) [ f ( P ) ( s , a ) ] | \right) + \underset { P \in { \cal M } _ { 2 } } { \operatorname* { s u p } } \mathbb { E } _ { ( s , a ) \sim \mathcal { D } } [ f ( P ) ( s , a ) ] } \\ & { \qquad \lesssim G ( { \cal M } _ { 2 } ) + \sqrt { Z _ { n } \frac { \ln ( c / \delta ) } { n } } + G ( { \cal M } _ { 1 } ) + \xi _ { n } ^ { 2 } + \frac { \ln ( c / \delta ) } { n } . } \end{array}
+$$
+
+Hence,
+
+$$
+Z _ { n } \leq G ( \mathcal { M } _ { 2 } ) + \sqrt { Z _ { n } \frac { \ln ( c / \delta ) } { n } } + G ( \mathcal { M } _ { 1 } ) + \xi _ { n } ^ { 2 } + \frac { \ln ( c / \delta ) } { n } .
+$$
+
+This shows
+
+$$
+Z _ { n } \leq G ( \mathcal { M } _ { 2 } ) + G ( \mathcal { M } _ { 1 } ) + \xi _ { n } ^ { 2 } + \frac { \ln ( c / \delta ) } { n } .
+$$
+
+Third step: Calculate the final error bound. Following the proof of Theorem 1, we can prove
+
+$$
+V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } \leq ( 1 - \gamma ) ^ { - 2 } c _ { 1 } \sqrt { C _ { \pi ^ { * } } ^ { \dagger } } \sqrt { G ( \mathcal { M } _ { 2 } ) + G ( \mathcal { M } _ { 1 } ) + \xi _ { n } ^ { 2 } + \frac { \ln ( c / \delta ) } { n } } .
+$$
+
+# E.3 PROOFS FOR TABULAR MDPS
+
+Proof of Corollary $^ { l }$ . We prove in a similar way as Theorem 1.
+
+First stepcan show $\begin{array} { r } { \xi = c \frac { | S | ^ { 2 } | A | \ln ( n | S | A | c _ { 2 } / \delta ) \} } { n } } \end{array}$ . Then, from Lemma 7, with probability $1 - \delta$ , we $P ^ { \star } \in \mathcal { M } _ { \mathcal { D } }$
+
+$$
+\begin{array} { r } { \mathbb { E } _ { s , a \sim \mathcal { D } } \left[ \mathrm { T V } ( \widehat { P } _ { \mathrm { M L E } } ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } \right] \leq \xi . } \end{array}
+$$
+
+Hereafter, we condition on the above event.
+
+Second step. Following the second step in the proof of Theorem 1 based on (8), for any $P \in \mathcal { M } _ { \mathcal { D } }$ , we have
+
+$$
+\begin{array} { r } { \mathbb { E } _ { s , a \sim \rho } \left[ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } \right] \leq c \xi + A ( P ) } \end{array}
+$$
+
+where
+
+$$
+A ( P ) : = | \mathbb { E } _ { s , a \sim \rho } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] | .
+$$
+
+Our goal here is showing with probability $1 - \delta$ ,
+
+$$
+A ( P ) \lesssim \xi , \forall P \in { \mathcal { M } } _ { \mathcal { D } } .
+$$
+
+To prove (14), consider an $\epsilon$ -net $\{ P _ { 1 } ( s , a ) , \cdot \cdot \cdot , P _ { K } ( s , a ) \}$ covering a simplex in terms of $\Vert \cdot \Vert _ { 1 } ^ { 4 }$ for each fixed pair $( s , a ) \in \mathcal { S } \times \mathcal { A }$ . We take $\epsilon = 1 / n$ . Since the covering number $K$ is upper-bounded by $( c / \epsilon ) ^ { | s | }$ (Wainwright, 2019, Lemma 5.7), we can obtain $\bar { M } = \{ P _ { 1 } , \cdot \cdot \cdot , P _ { K ^ { | { \cal S } | \times | { \cal A } | } } \}$ s.t. for any possible $P \subset { \mathcal { S } } \times { \mathcal { A } } \to \Delta ( { \mathcal { S } } )$ , there exists $P _ { i }$ s.t.
+
+$$
+\mathrm { T V } ( P _ { i } ( \cdot \mid s , a ) , P ( \cdot \mid s , a ) ) \leq \epsilon , \forall ( s , a ) .
+$$
+
+This implies for any $P \subset { \mathcal { S } } \times { \mathcal { A } } \to \Delta ( { \mathcal { S } } )$ , there exists $P _ { i } ( \cdot \mid s , a )$ s.t. $\forall ( s , a )$ ,
+
+$$
+\begin{array} { r l r } & { | \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } - \mathrm { T V } ( P _ { i } ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } | } \\ & { \le 4 | \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) - \mathrm { T V } ( P _ { i } ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) | } & { ( a ^ { 2 } - b ^ { 2 } = ( a - b ) ( a + b ) ) } \\ & { \le 4 \mathrm { T V } ( P \cdot \mid s , a ) , P _ { i } ( \cdot \mid s , a ) ) } & { ( | | a | | - | | b | | \le | | a - b | | ) } \\ & { < A \epsilon } \end{array}
+$$
+
+We often use this property (15) hereafter.
+
+Next, we define $\mathcal { M } ^ { \prime } \subset \bar { M }$ so that it covers $\mathcal { M } _ { \mathcal { D } }$ . Concretely, we define $\mathcal { M } ^ { \prime }$ :
+
+$$
+\mathcal { M } ^ { \prime } = \{ P \in \bar { M } : \exists P ^ { \prime \prime } \in \mathcal { M } _ { \mathcal { D } } , \mathrm { T V } \big ( P ( \cdot \mid s , a ) , P ^ { \prime \prime } ( \cdot \mid s , a ) \big ) \leq \epsilon \quad \forall ( s , a ) \} .
+$$
+
+The construction is illustrated in Figure 1. Here, from the definition, for any $P \in \mathcal { M } _ { \mathcal { D } }$ , we can also find $P ^ { \prime } \in \mathcal { M } ^ { \prime }$ s.t.
+
+$$
+\mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \prime } ( \cdot \mid s , a ) ) \leq \epsilon , \forall ( s , a ) .
+$$
+
+This is because from the definition of $\bar { M }$ , we can always find $P \in \bar { \mathcal { M } }$ satisfying the above. Such $P$ belongs to $\mathcal { M } ^ { \prime }$ from the definition of $\mathcal { M } ^ { \prime }$ . We use this fact later.
+
+Then, from (16) and recalling (13), we have
+
+$$
+\begin{array} { r } { \mathbb { E } _ { s , a \sim \rho } \left[ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } \right] \lesssim \xi + A ( P ) , \quad \forall P \in \mathcal { M ^ { \prime } } . } \end{array}
+$$
+
+
+Figure 1: $\mathcal { M } _ { \mathcal { D } }$ is colored in gray. $\mathcal { M } ^ { \prime }$ corresponds to the set of black dots. Orange dots correspond to $\bar { \mathcal { M } }$ , which do not belong to $\mathcal { M } ^ { \prime }$ .
+
+because
+
+$$
+\begin{array} { r l r } & { \mathbb { E } _ { s , a \sim \rho } \left[ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } \right] } \\ & { \leq \mathbb { E } _ { s , a \sim \rho } \left[ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \prime \prime } ( \cdot \mid s , a ) ) ^ { 2 } \right] + \mathbb { E } _ { s , a \sim \rho } \left[ \mathrm { T V } ( P ^ { \prime \prime } ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } \right] } \\ & { \leq \mathbb { E } _ { s , a \sim \rho } \left[ \mathrm { T V } ( P ^ { \prime \prime } ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } \right] + \epsilon ^ { 2 } } & { ( \mathrm { T a k e ~ s o m e ~ } P ^ { \prime \prime } \in \mathcal { M } _ { \mathcal D } \mathrm { \ n o t i n g } ) } \\ & { \leq c \xi + A ( P ) . } & { \mathrm { ( F r o m ) } } \end{array}
+$$
+
+Then, with probability $1 - \delta$ , from Bernstein’s inequality, we have
+
+$$
+A ( P ) \leq \sqrt { c \frac { \mathrm { v a r } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] \ln ( K ^ { \mid S \mid \times \mid A \mid } / \delta ) } { n } } + \frac { c \ln ( K ^ { \mid S \mid \times \mid A \mid } / \delta ) } { n } , \forall P \in \mathcal { M } .
+$$
+
+Hereafter, we condition on the above event. Based on (17), we can state
+
+$\begin{array} { r } { \mathrm { v a r } [ \mathrm { T V } ( P ( \cdot { | } s , a ) , P ^ { \star } ( \cdot { | } s , a ) ) ^ { 2 } ] \lesssim \mathrm { E } [ \mathrm { T V } ( P ( \cdot { | } s , a ) , P ^ { \star } ( \cdot { | } s , a ) ) ^ { 2 } ] \lesssim \xi + A ( P ) , \quad \forall P \in \mathcal { M ^ { \prime } } , } \end{array}$ with probability $1 - \delta$ . Following the argument of Theorem 1, for $P \in { \mathcal { M } } ^ { \prime }$ , we have
+
+$$
+4 ^ { 2 } ( P ) - A ( P ) B _ { 1 } - B _ { 2 } \leq 0 , \quad B _ { 1 } = \frac { \ln ( K ^ { | \mathcal { S } | \times | A | } / \delta ) } { n } , \quad B _ { 2 } = \xi \frac { \ln ( K ^ { | \mathcal { S } | \times | A | } / \delta ) } { n } + \left( \frac { \ln ( K ^ { | \mathcal { S } | \times | A | } / \delta ) } { n } \right) ^ { n } .
+$$
+
+Then, with probability $1 - \delta$ , we have
+
+$$
+A ( P ) \leq \frac { \ln ( K ^ { | \mathcal { S } | \times | A | } / \delta ) } { n } + \sqrt { \frac { \ln ( K ^ { | \mathcal { S } | \times | A | } / \delta ) } { n } } \xi ^ { 1 / 2 } \lesssim \xi , \quad \forall P \in \mathcal { M ^ { \prime } } .
+$$
+
+This shows for any $P \in \mathcal { M } _ { \mathcal { D } }$ , we have
+
+$$
+\begin{array} { r l r } & { | \{ \mathbb { E } _ { \mathcal { D } } - \mathbb { E } _ { ( s , a ) \sim \rho } \} [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] | } & \\ & { \le | \{ \mathbb { E } _ { \mathcal { D } } - \mathbb { E } _ { ( s , a ) \sim \rho } \} [ \mathrm { T V } ( P ^ { \prime } ( \cdot \mid s , a ) , P ( \cdot \mid s , a ) ) ^ { 2 } + \mathrm { T V } ( P ^ { \prime } ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] | } & \\ & { \qquad ( \mathrm { W e ~ t a k e ~ } P ^ { \prime } \in \mathcal { M ^ { \prime } ~ } \mathrm { s u c h ~ t h a t ~ } ( } & \\ & { \le | \{ \mathbb { E } _ { \mathcal { D } } - \mathbb { E } _ { ( s , a ) \sim \rho } \} [ \mathrm { T V } ( P ^ { \prime } ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] + 8 \epsilon } & { ( \mathrm { F r o m ~ t h e ~ d e f i n i t i o n ~ o f ~ } . } \\ & { \lesssim \xi . } & { ( \mathrm { F r o m ~ } ( 1 8 ) \mathrm { ~ a n d ~ } P ^ { \prime } \in \mathcal { A } . } \end{array}
+$$
+
+Thus, (14) is proved.
+
+Third step. We follow the third step of Theorem 1:
+
+$$
+\begin{array} { r } { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } \lesssim ( 1 - \gamma ) ^ { - 2 } \sqrt { C _ { \pi ^ { * } } ^ { \dagger } \xi } . } \end{array}
+$$
+
+# E.4 PROOFS FOR LINEAR MIXTURE MDPS
+
+Proof of Corollary 2. Here, letting $P ( \theta ) = \theta ^ { \top } \psi ( s , a , s ^ { \prime } )$ , recall
+
+$$
+{ \cal M } _ { \mathrm { M i x } } = \left\{ P ( \theta ) \ | \ \theta \in \Theta \subset \mathbb { R } ^ { d } , \int \theta ^ { \top } \psi ( s , a , s ^ { \prime } ) \mathrm { d } ( s ^ { \prime } ) = 1 \quad \forall ( s , a ) \right\} , \ \mathcal { H } = \left\{ \sqrt { \frac { P + P ^ { \star } } { 2 } } \ | \ P \in \mathcal { M } _ { \mathrm { M i x } } ( s , a ) | \ \mathrm { d } ( s , s ) \right\} .
+$$
+
+Upper-bounding $\mathbb { E } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \hat { \theta } _ { \mathrm { M L E } } ) ( \cdot \mid s , a ) ) ^ { 2 } ]$ . By invoking Theorem 4, we first show
+
+$$
+\begin{array} { r } { \mathbb { E } _ { ( s , a ) \sim \rho } [ \mathrm { T V } \big ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \hat { \theta } _ { \mathrm { M L E } } ) ( \cdot \mid s , a ) \big ) ^ { 2 } ] \le c \{ ( d / n ) \ln ^ { 2 } ( n R ) + \ln ( c / \delta ) / n \} . } \end{array}
+$$
+
+To do that, we calculate the entropy integral with bracketing. First, we have
+
+$$
+\mathcal { N } _ { \mathbb { I } } ( \epsilon , \mathcal { H } , d ) \leq \mathcal { N } _ { \mathbb { I } } ( \epsilon , \mathcal { M } _ { \mathrm { M i x } } , d ^ { \prime } ) .
+$$
+
+where
+
+$$
+\begin{array} { l } { { \displaystyle d ^ { \prime } ( a , b ) = \mathbb { E } _ { ( s , a ) \sim \rho } \left[ \int ( a ( s , a , s ^ { \prime } ) - b ( s , a , s ^ { \prime } ) ) ^ { 2 } \mathrm { d } ( s ^ { \prime } ) \right] ^ { 1 / 2 } , } } \\ { { \displaystyle d ( a , b ) = \mathbb { E } _ { ( s , a ) \sim \rho } \left[ \int ( \sqrt { a ( s , a , s ^ { \prime } ) } - \sqrt { b ( s , a , s ^ { \prime } ) } ) ^ { 2 } \mathrm { d } ( s ^ { \prime } ) \right] ^ { 1 / 2 } . } } \end{array}
+$$
+
+Here, we use two observations. The first observation is
+
+$$
+d ^ { 2 } \left( \sqrt { \frac { P ( \theta ^ { \prime } ) + P ^ { \star } } { 2 } } , \sqrt { \frac { P ( \theta ^ { \prime \prime } ) + P ^ { \star } } { 2 } } \right) \leq c _ { 1 } d ^ { \prime 2 } ( P ( \theta ^ { \prime } ) , P ( \theta ^ { \prime \prime } ) )
+$$
+
+due to the mean-value theorem
+
+$$
+\sqrt { a } - \sqrt { b } \leq \operatorname* { m a x } ( 1 / \sqrt { a } , 1 / \sqrt { b } ) ( a - b )
+$$
+
+and assumption $P ^ { \star } ( s ^ { \prime } \mid s , a ) \ge c _ { 0 } > 0$ . The second observation is when we have $P ^ { \prime } < g < P ^ { \prime \prime }$ , we also have $\sqrt { ( P ^ { \prime } + P ^ { \star } ) / 2 } < \sqrt { ( g + P ^ { \star } ) / 2 } < \sqrt { ( P ^ { \prime \prime } + P ^ { \star } ) / 2 }$ . Then, (19) is concluded.
+
+Next, by letting $\theta ^ { ( 1 ) } , \cdot \cdot \cdot , \theta ^ { ( K ) }$ be an $\epsilon$ -cover of the $d$ -dimensional ball with a radius $R$ , i.e, $B _ { d } ( R )$ , we have the brackets $\{ [ P ( \theta ^ { ( i ) } ) - \epsilon , P ( \theta ^ { ( i ) } ) + \epsilon ] \} _ { i = 1 } ^ { K }$ which cover $\mathcal { M } _ { m i x }$ . This is because for any $P ( \theta ) \in \mathcal { M } _ { m i x }$ , we can take $\theta ^ { ( i ) }$ s.t. $\lVert \theta - \theta ^ { ( i ) } \rVert _ { 2 } \leq \epsilon$ , then,
+
+$$
+P ( \theta ^ { ( i ) } ) - \epsilon < P ( \theta ) < P ( \theta ^ { ( i ) } ) + \epsilon , \quad \forall ( s , a , s ^ { \prime } )
+$$
+
+noting
+
+$$
+| P ( \theta ) ( s , a , s ^ { \prime } ) - P ( \theta ^ { ( i ) } ) ( s , a , s ^ { \prime } ) | \leq \| \theta - \theta ^ { ( i ) } \| _ { 2 } \leq \epsilon , \quad \forall ( s , a , s ^ { \prime } )
+$$
+
+The last equality is from Lemma 10.
+
+The brackets above are size of $\epsilon$ . Therefore, we have
+
+$$
+\begin{array} { r } { \mathcal { N } _ { [ ] } ( \epsilon , \mathcal { M } _ { m i x } , \| \cdot \| _ { 2 } ) \leq \mathcal { N } ( \epsilon , B _ { d } ( c R ) , \| \cdot \| _ { 2 } ) , } \end{array}
+$$
+
+where $\mathcal { N } ( \epsilon , B _ { d } ( c R ) , \| \cdot \| _ { 2 } )$ is a covering number of $B _ { d } ( c R )$ w.r.t $\| \cdot \| _ { 2 }$ . This is upper-bounded by $( c R / \epsilon ) ^ { d }$ (Wainwright, 2019, Lemma 5.7). Thus, we can calculate the upper bound of the entropy integral $J _ { B } ( \delta , \mathcal { M } _ { m i x } , \| \cdot \| _ { 2 } )$ :
+
+$$
+\begin{array} { r l r } { { \int _ { 0 } ^ { \delta } d ^ { 1 / 2 } \ln ^ { 1 / 2 } ( c R / u ) \mathrm { d } u \leq \int _ { 0 } ^ { \delta } d ^ { 1 / 2 } \ln ( 1 / u ) \mathrm { d } u + \delta d ^ { 1 / 2 } \ln ( c _ { 1 } R ) } } \\ & { } & { = c d ^ { 1 / 2 } ( \delta + \delta \ln ( 1 / \delta ) ) + \delta d ^ { 1 / 2 } \ln ( c R ) } \\ & { } & { \leq c d ^ { 1 / 2 } \delta \ln ( c R / \delta ) . } \end{array}
+$$
+
+By taking $G ( x ) = d ^ { 1 / 2 } x \ln ( c R / x )$ in Theorem 4, $\delta _ { n } = ( d / n ) ^ { 1 / 2 } \ln ( n R )$ satisfies the critical inequality
+
+$$
+\sqrt { n } \delta _ { n } ^ { 2 } \geq d ^ { 1 / 2 } \delta _ { n } \ln ( c R / \delta _ { n } ) .
+$$
+
+Finally, with probability $1 - \delta$
+
+$\begin{array} { r } { \mathbb { E } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \hat { \theta } _ { \mathrm { M L E } } ) ( \cdot \mid s , a ) ) ^ { 2 } ] \le \xi ^ { \prime } , \quad \xi ^ { \prime } : = \{ ( d / n ) \ln ^ { 2 } ( n R ) + \ln ( c / \delta ) / n \} . } \end{array}$ (23)
+
+Hereafter, we condition on this event.
+
+Upper bounding $\mathbb { E } _ { \mathcal { D } } [ \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \hat { \theta } _ { \mathrm { M L E } } ) ( \cdot \mid s , a ) ) ^ { 2 } ]$ . We take an $\epsilon$ -cover of the ball $B _ { d } ( R )$ in terms of $\| \cdot \| _ { 2 }$ , i.e., $\bar { M } = \{ \theta ^ { ( 1 ) } , \cdot \cdot \cdot , \theta ^ { ( K ) } \}$ , where $K = ( c R / \epsilon ) ^ { d }$ . We take $\epsilon = 1 / n$ . Then, for any $\theta \in B _ { d } ( R )$ , there exists $\theta ^ { ( i ) }$ s.t. $\forall ( s , a )$ ,
+
+$$
+\begin{array} { r l r } & { | \mathrm { T V } ( P ( \theta ) ( \cdot \mid s , a ) , P ( \hat { \theta } _ { \mathrm { M L E } } ) ( \cdot \mid s , a ) ) ^ { 2 } - \mathrm { T V } ( P ( \theta ^ { ( i ) } ) ( \cdot \mid s , a ) , P ( \hat { \theta } _ { \mathrm { M L E } } ) ( \cdot \mid s , a ) ) ^ { 2 } | } & \\ & { \leq 4 | \mathrm { T V } ( P ( \theta ) ( \cdot \mid s , a ) , P ( \hat { \theta } _ { \mathrm { M L E } } ) ( \cdot \mid s , a ) ) - \mathrm { T V } ( P ( \theta ^ { ( i ) } ) ( \cdot \mid s , a ) , P ( \hat { \theta } _ { \mathrm { M L E } } ) ( \cdot \mid s , a ) ) | } & \\ & { \quad \quad \quad \quad \quad ( a ^ { 2 } - b ^ { 2 } = ( a - b ) ( a + b ) ) } & \\ & { \leq 4 \mathrm { T V } ( P ( \theta ) ( \cdot \mid s , a ) , P ( \theta ^ { ( i ) } ) ( \cdot \mid s , a ) ) } & { ( | \| a \| - \| b \| | \leq \| a - b \| ) } \\ & { \leq 4 \| \theta - \theta ^ { ( i ) } \| _ { 2 } } & { ( \mathrm { F r o m ~ L e m m a ~ 1 0 . } ) } \end{array}
+$$
+
+Hereafter, we condition on the event:
+
+$$
+\begin{array} { r l } & { | ( \mathbb { E } _ { \mathcal { D } } - \mathbb { E } _ { ( s , a ) \sim \rho } ) [ \mathrm { T V } ( P ( \theta ) ( \cdot \mid s , a ) , P ( \theta ^ { \star } ) ( \cdot \mid s , a ) ) ^ { 2 } ] | } \\ & { \lesssim \sqrt { \frac { \mathrm { v a r } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ( \theta ) ( \cdot \mid s , a ) , P ( \theta ^ { \star } ) ( \cdot \mid s , a ) ) ^ { 2 } ] \ln ( K / \delta ) } { n } } + \frac { \ln ( K / \delta ) } { n } , \quad \forall \theta \in \bar { M } . } \end{array}
+$$
+
+This event holds with probability $1 - \delta$ from Bernstein’s inequality.
+
+Here, note for $ { \hat { \theta } } _ { \mathrm { M L E } }$ , we have $\theta ^ { ( i ) }$ s.t. $\| \hat { \theta } _ { \mathrm { M L E } } - \theta ^ { ( i ) } \| _ { 2 } \leq \epsilon$ . Then, following the first step of Theorem 1,
+
+$$
+\begin{array} { r l } & { \widehat { \gamma } _ { ( s , \alpha ) \sim \mathcal { P } } \mathrm { T V } ( P ( \theta ^ { * } ) \langle \ \ \cdot \ \vert s , \alpha ) , P ( \widehat { \theta } _ { \mathrm { A L E } } ) ( \cdot \ \vert s , \alpha ) ) ^ { 2 } } \\ & { \le \operatorname { \mathbb P } ( \varepsilon _ { \mathrm { s } , \alpha } , \ldots , \gamma \mathrm { T V } ( P ( \theta ^ { * } ) \langle \ \ \cdot \ \vert s , \alpha ) , P ( \theta ^ { ( 4 ) } \rangle \langle \ \ \cdot \ \vert s , \alpha ) ) ^ { 2 } + \epsilon } \\ & { \le \operatorname { \mathbb P } ( \mathbb { E } _ { \mathfrak { D } } - \operatorname { E } _ { ( s , \alpha ) \sim \mathcal { P } } \mathrm { T V } ( P ( \theta ^ { * } ) \langle \ \ \cdot \ \vert s , \alpha ) , P ( \theta ^ { ( 4 ) } \rangle \langle \ \ \cdot \ \vert s , \alpha ) ) ^ { 2 } + \epsilon + \frac { 1 } { \mathrm { E } } ( s , \alpha ) \sim \mathcal { P } \mathrm { T V } ( P ( \theta ^ { * } ) \langle \ \ \cdot \ \vert s , \alpha ) , P ( \theta ^ { ( 6 ) } \rangle ) } \\ & { \le \sqrt { \frac { \operatorname { v a r } ( s , \alpha ) - s \rho } { n } \mathrm { T V } ( P ( \theta ^ { * } ) \langle \ \ \cdot \ \vert s , \alpha ) , P ( \theta ^ { ( 4 ) } \rangle \langle \ \cdot \ \ \vert s , \alpha ) ) ^ { 2 } | \mathrm { n } ( K / \delta ) } + \frac { \ln ( K / \delta ) } { n } } \\ & { + \epsilon + \frac { \operatorname { \mathbb P } ( s , \alpha ) - \rho } { n } \mathrm { T V } ( P ( \theta ^ { * } ) \langle \ \ \cdot \ \vert s , \alpha ) , P ( \theta ^ { ( 4 ) } \rangle \langle \ \cdot \ \ \vert s , \alpha ) ) ^ { 2 } } \\ & { \le \sqrt { \frac { \operatorname { E } ( s , \alpha ) - \rho } { n } \mathrm { T V } ( P ( \theta ^ { * } ) \langle \ \ \cdot \ \vert s , \alpha ) , P ( \theta ^ { ( 4 ) } \rangle \langle \ \cdot \ \vert s , \alpha ) ) ^ { 2 } | \mathrm { n } ( K / \delta ) } + \frac { \ln ( K / \delta ) } { n } } \\ & + \operatorname { \mathbb P } ( s , \alpha ) , P ( \theta ^ { * } ) \langle \ \cdot \ \vert s , \alpha \rangle \end{array}
+$$
+
+Then, we have
+
+$$
+\begin{array} { r l r } & { \mathbb { E } _ { \mathcal { D } } [ \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \hat { \theta } _ { \mathrm { M L E } } ) ( \cdot \mid s , a ) ) ^ { 2 } ] } \\ & { } & { \lesssim \sqrt { \frac { \{ \mathbb { E } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \hat { \theta } _ { \mathrm { M L E } } ) ( \cdot \mid s , a ) ) ^ { 2 } ] + \epsilon \} \ln ( K / \delta ) } { n } } + \frac { \ln ( K / \delta ) } { n } } \\ & { } & { + \epsilon + \mathbb { E } _ { ( s , a ) \sim \rho } \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \hat { \theta } _ { \mathrm { M L E } } ) ( \cdot \mid s , a ) ) ^ { 2 } } \\ & { } & { \lesssim \sqrt { \frac { \{ \xi ^ { \prime } + \epsilon \} \ln \left( K / \delta \right) } { n } } + \frac { \ln ( K / \delta ) } { n } + \epsilon + \xi ^ { \prime } . } \end{array}
+$$
+
+In the end, by taking $\epsilon = 1 / n$ , we have with probability $1 - \delta$ ,
+
+$$
+\mathbb { E } _ { \mathcal { D } } \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \hat { \theta } _ { \mathrm { M L E } } ) ( \cdot \mid s , a ) ) ^ { 2 } \le \xi , \quad \xi = c \{ ( d / n ) \ln ^ { 2 } ( n R ) + \ln ( c / \delta ) / n \} .
+$$
+
+This also implies with probability $1 - \delta , P ^ { \star } \in \mathcal { M } _ { D }$ .
+
+Show $\begin{array} { r } { \mathbb { E } _ { ( s , a ) \sim \rho } \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \theta ) ( \cdot \mid s , a ) ) ^ { 2 } \lesssim \xi , \forall P ( \theta ) \in \mathcal { M } _ { D } . } \end{array}$ .
+
+We show for any $P \in \mathcal { M } _ { \mathcal { D } }$ , the distance between $P ^ { \star }$ is controlled in terms of TV distance. Our goal is showing
+
+$$
+\mathbb { E } _ { ( s , a ) \sim \rho } \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \theta ) ( \cdot \mid s , a ) ) ^ { 2 } \lesssim \xi , \quad \forall P ( \theta ) \in \mathcal { M } _ { \mathcal { D } } .
+$$
+
+First, following the second step of Theorem 1 based on equation 8, we have
+
+$$
+\begin{array} { r } { \mathbb { E } _ { ( s , a ) \sim \rho } \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \theta ) ( \cdot \mid s , a ) ) ^ { 2 } \le A ( \theta ) + c \xi , \quad \forall P ( \theta ) \in \mathcal { M } _ { \mathcal { D } } } \end{array}
+$$
+
+where
+
+$$
+A ( \theta ) : = | ( \mathbb { E } _ { \mathcal { D } } - \mathbb { E } _ { ( s , a ) \sim \rho } ) \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \theta ) ( \cdot \mid s , a ) ) ^ { 2 } | .
+$$
+
+From now on, we again consider an $\epsilon$ -cover of the ball $B _ { d } ( R )$ in terms of $\| \cdot \| _ { 2 }$ , i.e., $\bar { M } \ =$ $\{ \theta ^ { ( 1 ) } , \cdots , \theta ^ { ( K ) } \}$ , where $K = ( c _ { 1 } R / \epsilon ) ^ { d }$ $( \epsilon = 1 / n )$ . This also covers the space $\mathcal { M } _ { \mathcal { D } }$ . We take $\mathcal { M } ^ { \prime } = \{ \theta ^ { ( i _ { 1 } ) } , \theta ^ { ( i _ { 2 } ) } \cdot \cdot \cdot , \} \subset \mathcal { M }$ which covers $\mathcal { M } _ { \mathcal { D } }$ , that is,
+
+$$
+\mathcal { M } ^ { \prime } = \left\{ \theta \in \bar { \mathcal { M } } | \exists \theta ^ { \prime } \mathrm { s . t . } P ( \theta ^ { \prime } ) \in \mathcal { M } _ { \mathcal { D } } , \lVert \theta - \theta ^ { \prime } \rVert _ { 2 } \leq \epsilon \right\} .
+$$
+
+Recall Figure 1, which illustrates this definition. Here, for any $\theta$ s.t. $\forall P ( \theta ) \in \mathcal { M } _ { \mathcal { D } }$ , we can take $\theta ^ { \prime } \in \mathcal { M } ^ { \prime }$ s.t. $\| \theta - \theta ^ { \prime } \| _ { 2 } \leq 1 / n$ . This is because we can take $\theta \doteq \bar { \mathcal { M } }$ s.t. $\| \theta - \theta ^ { \prime } \| _ { 2 } \leq \epsilon$ noting $\bar { \mathcal { M } }$ is an $\epsilon$ -net, but such $\theta$ belongs to $\mathcal { M } ^ { \prime }$ from the definition of $\mathcal { M } ^ { \prime }$ .
+
+Then, we have
+
+$$
+\begin{array} { r } { \mathbb { E } _ { ( s , a ) \sim \rho } \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \theta ) ( \cdot \mid s , a ) ) ^ { 2 } \le A ( \theta ) + c \xi , \quad \forall \theta \in \mathcal { M } ^ { \prime } . } \end{array}
+$$
+
+This is because for any $\theta ^ { ( i ) } \in \mathcal { M } ^ { \prime }$ , we can take $P ( \theta ) \in \mathcal { M } _ { \mathcal { D } }$ such that
+
+$$
+\begin{array} { r l r } { { \mathbb { E } _ { ( s , a ) \sim \rho } \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \theta ^ { ( i ) } ) ( \cdot \mid s , a ) ) ^ { 2 } } } \\ & { \le \mathbb { E } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \theta ^ { ( i ) } ) ( \cdot \mid s , a ) ) ^ { 2 } - \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \theta ) ( \cdot \mid s , a ) ) ^ { 2 } ] } \\ & { + \mathbb { E } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \theta ) ( \cdot \mid s , a ) ) ^ { 2 } ] } \\ & { \le 4 \epsilon + \mathbb { E } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \theta ) ( \cdot \mid s , a ) ) ^ { 2 } ] } & { ( \| \theta - \theta ^ { ( i ) } \| _ { 2 } \le \epsilon \mathrm { a n d f r o m } ( 2 \pi ) ) ^ { 2 } } \\ & { \lesssim A ( \theta ) + \xi . } & { ( \mathrm { F r o m ~ } ( 2 \pi ) ) ^ { 2 } } \end{array}
+$$
+
+Here, from (25), we have
+
+$$
+A ( \theta ) \leq \sqrt { c \frac { \operatorname { v a r } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \theta ) ( \cdot \mid s , a ) ) ^ { 2 } ] \ln ( K / \delta ) } { n } } + \frac { c \ln ( K / \delta ) } { n } , \quad \forall \theta \in \mathcal { M } ^ { \prime } .
+$$
+
+Based on the construction of $\mathcal { M } ^ { \prime }$ and (27), we have
+
+$$
+\begin{array} { r } { \operatorname { v a r } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \theta ) ( \cdot \mid s , a ) ) ^ { 2 } ] \lesssim A ( \theta ) + \xi , \quad \forall \theta \in \mathcal { M } ^ { \prime } . } \end{array}
+$$
+
+Then, following the second step of Theorem 1, $A ( \theta )$ satisfies
+
+$$
+A ^ { 2 } ( \theta ) - A ( \theta ) B _ { 1 } - B _ { 2 } \leq 0 , \quad B _ { 1 } = \frac { \ln ( K / \delta ) } { n } , B _ { 2 } = \xi \frac { \ln ( K / \delta ) } { n } + \left( \frac { \ln ( K / \delta ) } { n } \right) ^ { 2 } .
+$$
+
+Then, we have
+
+$$
+A ( \theta ) \leq \frac { \ln ( K / \delta ) } { n } + \xi ^ { 1 / 2 } \sqrt { \frac { \ln ( K / \delta ) } { n } } \lesssim \xi , \quad \forall \theta \in \mathcal { M } ^ { \prime } .
+$$
+
+We combine all steps. Recall for any $\forall P ( \theta ) \in \mathcal { M } _ { \mathcal { D } }$ , we can take $\theta ^ { \prime } \in \mathcal { M } ^ { \prime }$ s.t. $\| \theta - \theta ^ { \prime } \| _ { 2 } \leq 1 / n$ . Then, for any $\bar { P ( \theta ) } \overset { \mathbf { \bar { \mathbf { \theta } } } } { \in } \mathcal { M } _ { \mathcal { D } }$ , we have
+
+$$
+\begin{array} { r l r } { { 4 ( \theta ) = | ( \mathbb E _ { \mathcal { D } } - \mathbb E _ { ( s , a ) \sim \rho } ) \mathrm { T V } ( P ( \theta ) ( \cdot \mid s , a ) , P ( \theta ^ { \star } ) ( \cdot \mid s , a ) ) ^ { 2 } } } \\ & { } & { \leq | ( \mathbb E _ { \mathcal { D } } - \mathbb E _ { ( s , a ) \sim \rho } ) [ \mathrm { T V } ( P ( \theta ) ( \cdot \mid s , a ) , P ( \theta ^ { \star } ) ( \cdot \mid s , a ) ) ^ { 2 } - \mathrm { T V } ( P ( \theta ^ { \prime } ) ( \cdot \mid s , a ) , P ( \theta ^ { \star } ) ( \cdot \mid s , a ) ) ^ { 2 } } \\ & { } & { + ( \mathbb E _ { \mathcal { D } } - \mathbb E _ { ( s , a ) \sim \rho } ) [ \mathrm { T V } ( P ( \theta ^ { \prime } ) ( \cdot \mid s , a ) , P ( \theta ^ { \star } ) ( \cdot \mid s , a ) ) ^ { 2 } ] } \\ & { } & { \leq 8 \epsilon + | ( \mathbb E _ { \mathcal { D } } - \mathbb E _ { ( s , a ) \sim \rho } ) [ \mathrm { T V } ( P ( \theta ^ { \prime } ) ( \cdot \mid s , a ) , P ( \theta ^ { \star } ) ( \cdot \mid s , a ) ) ^ { 2 } ] } \end{array}
+$$
+
+(From equation 28 and $\theta ^ { \prime } \in \mathcal { M } ^ { \prime }$ )
+
+Then, we have with probability $1 - \delta$
+
+$$
+A ( \theta ) \lesssim \xi , \quad \forall P ( \theta ) \in { \mathcal { M } } _ { \mathcal { D } } .
+$$
+
+Finally, for any $P ( \theta ) \in \mathcal { M } _ { \mathcal { D } }$ , with probability $1 - \delta$ , we have
+
+$$
+\begin{array} { r l r } { { \mathbb { E } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \theta ) ( \cdot \mid s , a ) ) ^ { 2 } ] \leq A ( \theta ) + c \xi } } \\ & { } & { \lesssim \xi . } \end{array}
+$$
+
+Distribution shift part Here, for $P \in \mathcal { M } _ { \mathcal { D } }$ we prove
+
+$$
+\begin{array} { r l } & { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P } ^ { \pi ^ { * } } \lesssim ( 1 - \gamma ) ^ { - 2 } \sqrt { d C _ { \pi ^ { * } , \operatorname* { m i x } } \xi } , } \\ & { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P } ^ { \pi ^ { * } } \lesssim ( 1 - \gamma ) ^ { - 2 } \sqrt { C _ { \pi ^ { * } } ^ { \dagger } \xi } . } \end{array}
+$$
+
+Following the third step of the proof of Theorem 5, this immediately concludes the bound
+
+$$
+\begin{array} { r l } & { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } \lesssim ( 1 - \gamma ) ^ { - 2 } \sqrt { d C _ { \pi ^ { * } , \operatorname* { m i x } } \xi } , } \\ & { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } \lesssim ( 1 - \gamma ) ^ { - 2 } \sqrt { C _ { \pi ^ { * } } ^ { \dagger } \xi } . } \end{array}
+$$
+
+Since (31) is obvious from simulation lemma, we only prove (30). To prove (30), we take a distribution $P ( \theta ) \in \mathcal { M } _ { \mathcal { D } }$ . First, recall for $P ( \theta ) \in \mathcal { M } _ { \mathcal { D } }$ , we have
+
+$$
+\begin{array} { r } { \mathbb { E } _ { ( s , a ) \sim \rho } \mathrm { T V } ( P ( \theta ^ { \star } ) ( \cdot \mid s , a ) , P ( \theta ) ( \cdot \mid s , a ) ) ^ { 2 } \lesssim \xi . } \end{array}
+$$
+
+From the third statement of Lemma 10, for any $V : { \mathcal { S } } [ 0 , 1 ]$ , we have
+
+$$
+\begin{array} { r } { \mathbb { E } _ { ( s , a ) \sim \rho } [ | ( \theta - \theta ^ { * } ) ^ { \top } \psi _ { V } ( s , a ) | ^ { 2 } ] \lesssim \xi . } \end{array}
+$$
+
+Thus,
+
+$$
+\forall V : \mathcal S [ 0 , 1 ] , \quad ( \theta - \theta ^ { * } ) ^ { \top } \Sigma _ { \rho , V } ( \theta - \theta ^ { * } ) \lesssim \xi , \quad \Sigma _ { \rho , V } = \mathbb E _ { ( s , a ) \sim \rho } [ \psi _ { V } ( s , a ) \psi _ { V } ^ { \top } ( s , a ) ] .
+$$
+
+Here, we have
+
+$$
+\begin{array} { r } { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P } ^ { \pi ^ { * } } \leq ( 1 - \gamma ) ^ { - 1 } \left| \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi ^ { * } } } \left[ \int \{ P ( s ^ { \prime } \mid s , a ) - P ^ { \star } ( s ^ { \prime } \mid s , a ) \} V _ { P } ^ { \pi ^ { * } } ( s ^ { \prime } ) \mathrm { d } ( s ^ { \prime } ) \right] \right| } \end{array}
+$$
+
+(Simulation lemma, Lemma 5)
+
+$$
+\begin{array} { r l } & { \leq ( 1 - \gamma ) ^ { - 1 } \left| \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi ^ { * } } } \left[ ( \theta - \theta ^ { * } ) \psi _ { V _ { P } ^ { \pi ^ { * } } } ( s , a ) \right] \right| } \\ & { \qquad \quad ( \mathrm { R e c a l l } \ \psi _ { V } = \int \psi ( s , a , s ^ { \prime } ) V _ { P } ^ { \pi ^ { * } } ( s ^ { \prime } ) \mathrm { d } ( s ^ { \prime } ) ) } \\ & { \leq ( 1 - \gamma ) ^ { - 1 } \underbrace { \| \theta - \theta ^ { * } \| _ { \lambda I + \Sigma _ { \rho , V _ { P } ^ { \pi ^ { * } } } } } _ { ( a ) } \underbrace { \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi ^ { * } } } \left[ \| \psi _ { V _ { P } ^ { \pi ^ { * } } } ( s , a ) \| _ { ( \Sigma _ { \rho , V _ { P } ^ { \pi ^ { * } } } + \lambda I ) ^ { - 1 } } \right] } _ { ( b ) } . } \end{array}
+$$
+
+(CS inequality)
+
+The first term (a) is upper-bounded by $\sqrt { \{ ( 1 - \gamma ) ^ { - 2 } \xi + \lambda R ^ { 2 } \} }$ noting $0 \leq V _ { P } ^ { \pi ^ { * } } \leq ( 1 - \gamma ) ^ { - 1 }$ . The term (b) is upper-bounded by
+
+$$
+\begin{array} { r l } { \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { * } } ^ { \pi ^ { * } } } \left[ \left\| \psi _ { V _ { P } ^ { \pi ^ { * } } } ( s , a ) \right\| _ { ( \Sigma _ { \rho , V _ { P } ^ { \pi ^ { * } } } + \lambda I ) ^ { - 1 } } \right] \leq \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { * } } ^ { \pi } } \left[ \left\| \psi _ { V _ { P } ^ { \pi ^ { * } } } ( s , a ) \right\| _ { ( \Sigma _ { \rho , V _ { P } ^ { \pi ^ { * } } } + \lambda I ) ^ { - 1 } } ^ { 2 } \right] ^ { 1 / 2 } } & { } \\ { = \sqrt { \mathrm { T r } ( \Sigma _ { d _ { P ^ { * } } ^ { \pi ^ { * } } , V _ { P } ^ { \pi ^ { * } } } ( \lambda I + \Sigma _ { \rho , V _ { P } ^ { \pi ^ { * } } } ) ^ { - 1 } ) } } & { } \\ { \leq \sqrt { C _ { \pi ^ { * } , \operatorname* { m i x } } \mathrm { T r } ( \Sigma _ { \rho , V _ { P } ^ { \pi ^ { * } } } ( \lambda I + \Sigma _ { \rho , V _ { P } ^ { \pi ^ { * } } } ) ^ { - 1 } ) } } & { ( \mathrm { F r o m ~ L e m m a ~ 1 1 } ) } \\ { \leq \sqrt { C _ { \pi ^ { * } , \operatorname* { m i x } } \mathrm { { r a n k } } ( \Sigma _ { \rho , V _ { P } ^ { \pi ^ { * } } } ) } \leq \sqrt { C _ { \pi ^ { * } , \operatorname* { m i x } } d } . } & { } \end{array}
+$$
+
+By taking $\lambda$ s.t. $\lambda R ^ { 2 } \lesssim ( 1 - \gamma ) ^ { - 2 } \xi$ , (30) is proved.
+
+For linear MDPs, from the fourth statement of Lemma 10, $C _ { \pi ^ { * } , \mathrm { m i x } } \leq \bar { C } _ { \pi ^ { * } }$ . Then, the statement is concluded.
+
+# E.5 PROOFS FOR KNRS
+
+Proof of Corollary 3. We prove in a similar way as Theorem 1.
+
+# First Step Recall
+
+$$
+\xi = \sqrt { 2 \lambda \| { \cal W } ^ { \star } \| _ { 2 } ^ { 2 } + 8 \zeta ^ { 2 } \big ( d _ { \cal S } \ln ( 5 ) + \ln ( 1 / \delta ) + \bar { \cal Z } _ { n } \big ) } , \quad \bar { \mathcal { T } } _ { n } = \ln \big ( \operatorname* { d e t } ( \Sigma _ { n } ) / \operatorname* { d e t } ( \lambda \mathbf { I } ) \big ) .
+$$
+
+Thus, from Lemma 8, with probability $1 - \delta$ , we can show $W ^ { \ast } \in \mathcal { W } _ { D }$ since
+
+$$
+\begin{array} { r } { \left\| \left( \widehat { W } _ { \mathrm { M L E } } - W ^ { \star } \right) \left( \Sigma _ { n } \right) ^ { 1 / 2 } \right\| _ { 2 } \leq \xi . } \end{array}
+$$
+
+Hereafter, we condition on this event.
+
+Second step For any $W \in \mathcal { W } _ { D }$ , with probability $1 - \delta$ , we have
+
+$$
+\left\| \left( W - W ^ { \star } \right) ( \Sigma _ { n } ) ^ { 1 / 2 } \right\| _ { 2 } \leq \left\| \left( W - \widehat W \right) ( \Sigma _ { n } ) ^ { 1 / 2 } \right\| _ { 2 } + \left\| \left( W ^ { * } - \widehat W \right) ( \Sigma _ { n } ) ^ { 1 / 2 } \right\| _ { 2 } \leq \xi .
+$$
+
+Third step Note $P ^ { \star } = P ( W ^ { * } )$ . Then,
+
+$$
+\begin{array} { r l } & { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } \leq V _ { P ^ { \star } } ^ { \pi ^ { * } } - \underset { W \in \mathcal { W _ { D } } } { \operatorname* { m i n } } V _ { P ( W ) } ^ { \pi ^ { * } } + \underset { W \in \mathcal { W _ { D } } } { \operatorname* { m i n } } V _ { P ( W ) } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } } \\ & { \qquad \leq V _ { P ^ { \star } } ^ { \pi ^ { * } } - \underset { W \in \mathcal { W _ { D } } } { \operatorname* { m i n } } V _ { P ( W ) } ^ { \pi ^ { * } } + \underset { W \in \mathcal { W _ { D } } } { \operatorname* { m i n } } V _ { P ( W ) } ^ { \hat { \pi } } - V _ { P ^ { \star } } ^ { \hat { \pi } } } \\ & { \qquad \leq V _ { P ^ { \star } } ^ { \pi ^ { * } } - \underset { W \in \mathcal { W _ { D } } } { \operatorname* { m i n } } V _ { P ( W ) } ^ { \pi ^ { * } } . } \end{array}
+$$
+
+Then, by setting $\begin{array} { r } { W ^ { \prime } = \arg \operatorname* { m i n } _ { W \in \mathcal { M } _ { \mathcal { D } } } { V _ { P ( W ) } ^ { \pi ^ { * } } } } \end{array}$ , we have
+
+$$
+\begin{array} { r l r } { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } \leq ( 1 - \gamma ) ^ { - 2 } \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi ^ { * } } } [ \| P ^ { \prime } ( s , a ) - P ^ { \star } ( s , a ) \| _ { \mathrm { T V } } ] } \\ & { } & { \leq \frac { ( 1 - \gamma ) ^ { - 2 } } { \zeta } \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi ^ { * } } } [ \| ( W ^ { \prime } - W ^ { \star } ) \phi ( s , a ) \| _ { 2 } ] \qquad \mathrm { ( L e m m a ~ 9 ) } } \\ & { } & { \leq \frac { ( 1 - \gamma ) ^ { - 2 } } { \zeta } \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi ^ { * } } } \left[ \Big \| ( W ^ { \prime } - W ^ { \star } ) ( \Sigma _ { n } ) ^ { 1 / 2 } \Big \| _ { 2 } \left\| \phi ( s , a ) \right\| _ { \Sigma _ { n } ^ { - 1 } } \right] \quad \mathrm { ( C S ~ i n e q u a l i t y ) } } \\ & { } & { \leq \frac { ( 1 - \gamma ) ^ { - 2 } } { \zeta } \xi \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi ^ { * } } } [ \left\| \phi ( s , a ) \right\| _ { \Sigma _ { n } ^ { - 1 } } ] \qquad \mathrm { ( S e c o n d ~ s t e p ) } } \end{array}
+$$
+
+From Chang et al. (2021, Theorem 20), with probability $1 - \delta$ , we have
+
+$$
+\begin{array} { r } { \xi \leq c _ { 1 } \sqrt { \| W ^ { * } \| _ { 2 } + d _ { S } \operatorname* { m i n } ( \mathrm { r a n k } ( \Sigma _ { \rho } ) \{ \mathrm { r a n k } ( \Sigma _ { \rho } ) + \ln ( c _ { 2 } / \delta ) \} , d ) \ln ( 1 + n ) } . } \end{array}
+$$
+
+In addition, from Chang et al. (2021, Theorem 21), with probability $1 - \delta$ , we also have
+
+$$
+\mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi ^ { * } } } [ \| \phi ( s , a ) \| _ { \Sigma _ { n } ^ { - 1 } } ] \le c _ { 1 } \sqrt { \frac { \bar { C } _ { \pi ^ { * } } \mathrm { r a n k } [ \Sigma _ { \rho } ] \{ \mathrm { r a n k } [ \Sigma _ { \rho } ] + \ln ( c _ { 2 } / \delta ) \} } { n } } .
+$$
+
+Finally, by combining all things, we have
+
+$$
+\gamma _ { \scriptscriptstyle { R ^ { * } } } ^ { \pi ^ { * } } - V _ { \scriptscriptstyle { P ^ { * } } } ^ { \bar { \pi } } \leq c _ { 1 } ( 1 - \gamma ) ^ { - 2 } \operatorname* { m i n } ( d ^ { 1 / 2 } , \bar { R } ) \sqrt { \bar { R } } \sqrt { \frac { d _ { \scriptscriptstyle { S } } \bar { C } _ { \pi ^ { * } } \ln ( 1 + n ) } { n } } , \bar { R } = \mathrm { r a n k } [ \Sigma _ { \rho } ] \{ \mathrm { r a n k } [ \Sigma _ { \rho } ] + \ln ( c _ { 2 } / \tau ) \} .
+$$
+
+# E.6 PROOFS FOR LOW-RANK MDPS
+
+Proof of Theorem 2. Until the second step, we can perform the same analysis as Theorem 1. More concretely, with probability $1 - \delta$ , we have $P ^ { \star } \in \mathcal { M } _ { \mathcal { D } }$ and
+
+$$
+\mathbb { E } _ { s , a \sim \rho } [ \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) ) ^ { 2 } ] \le \xi , \quad \forall P \in \mathcal { M } _ { \mathcal { D } } , \xi : = c \frac { \ln ( \vert \mathcal { M } \vert / \delta ) } { n } .
+$$
+
+Hereafter, we condition on the above event.
+
+Letting $f ( s , a ) = \mathrm { T V } ( P ( \cdot \mid s , a ) , P ^ { \star } ( \cdot \mid s , a ) )$ , we use Lemma 4. Then,
+$\begin{array} { r } { \Xi _ { ( s , a ) \sim d _ { P ^ { * } } ^ { m } } [ f ( s , a ) ] \leq \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { * } } ^ { m } } [ \| \phi ^ { \star } ( s , a ) \| _ { \Sigma _ { \rho , \phi ^ { * } } ^ { - 1 } } ] \sqrt { n \gamma \omega _ { \pi } \mathbb { E } _ { \rho } [ f ^ { 2 } ( s , a ) ] + 4 \gamma ^ { 2 } \lambda d } + \sqrt { ( 1 - \gamma ) \omega _ { \pi } \mathbb { E } _ { \rho } [ \Lambda _ { \lambda } ( \lambda ) ] + 4 \gamma ^ { 2 } \lambda d } . } \end{array}$ 2(s, a)]
+where $\Sigma = n \mathbb { E } _ { \rho } [ \phi ^ { \star } \phi ^ { \star } ] + \lambda I$ . We consider how to bound $\mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi } } \left[ \| \phi ^ { \star } ( s , a ) \| _ { \Sigma _ { \rho , \phi ^ { \star } } ^ { - 1 } } \right]$ . This is
+upper-bounded by
+
+$$
+\begin{array} { r l } & { \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi } } [ \| \phi ^ { \star } ( s , a ) \| _ { \Sigma _ { \rho , \phi ^ { \star } } ^ { - 1 } } ] \leq \sqrt { \mathrm { t r } ( \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi } } [ \phi ^ { \star } { \phi ^ { \star } } ^ { \top } ] \Sigma _ { \rho , \phi ^ { \star } } ^ { - 1 } ) } } \\ & { \qquad \leq \sqrt { \bar { C } _ { \pi ^ { * } , \phi ^ { \star } } \mathrm { t r } ( \mathbb { E } _ { ( s , a ) \sim \rho } [ \phi ^ { \star } { \phi ^ { \star } } ^ { \top } ] \Sigma _ { \rho , \phi ^ { \star } } ^ { - 1 } ) } } \\ & { \qquad \leq \sqrt { \bar { C } _ { \pi ^ { * } , \phi ^ { \star } } \mathrm { r a n k } ( \Sigma _ { \rho } ) / n } . } \end{array}
+$$
+
+Here, in the last line, by letting the SVD of $\Sigma _ { \rho } = \mathbb { E } _ { \rho } [ \phi \phi ^ { \top } ]$ be $U \tilde { \Sigma } _ { \rho } U ^ { \top }$ where $\tilde { \Sigma } _ { \rho }$ is a $d \times d$ diagonal matrix and $U$ is a $d \times d$ orthogonal matrix , we use
+
+$$
+\begin{array} { r l } & { \mathrm { t r } \left( \Sigma _ { \rho } \Sigma _ { \rho , \phi ^ { \star } } ^ { - 1 } \right) = \mathrm { t r } ( U \tilde { \Sigma } _ { \rho } U ^ { \top } \{ n U \tilde { \Sigma } _ { \rho } U ^ { \top } + \lambda I \} ^ { - 1 } ) = \mathrm { t r } ( \tilde { \Sigma } _ { \rho } U ^ { \top } \{ n U \tilde { \Sigma } _ { \rho } U ^ { \top } + \lambda I \} ^ { - 1 } U ) } \\ & { \qquad = \mathrm { t r } ( \tilde { \Sigma } _ { \rho } U ^ { \top } \{ U \{ n \tilde { \Sigma } _ { \rho } + \lambda I \} U ^ { \top } \} ^ { - 1 } U ) } \\ & { \qquad = \mathrm { t r } ( \tilde { \Sigma } _ { \rho } U ^ { \top } U \{ n \tilde { \Sigma } _ { \rho } + \lambda I \} ^ { - 1 } U ^ { \top } U ) } \\ & { \qquad = \mathrm { t r } ( \tilde { \Sigma } _ { \rho } \{ n \tilde { \Sigma } _ { \rho } + \lambda I \} ^ { - 1 } \leq \mathrm { r a n k } ( \Sigma _ { \rho } ) / n . } \end{array}
+$$
+
+Hence, when $P \in \mathcal { M } _ { \mathcal { D } }$ , by setting $\lambda$ s.t. $\lambda d \lesssim n \omega _ { \pi } \xi$ , we have
+
+$$
+\mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi } } [ f ( s , a ) ] \le \sqrt { \frac { \gamma \bar { C } _ { \pi ^ { \star } , \phi ^ { \star } } \mathrm { r a n k } ( \Sigma _ { \rho } ) \omega _ { \pi } \ln ( | { \mathcal M } | / \delta ) } { n } } + \sqrt { \frac { ( 1 - \gamma ) \omega _ { \pi } \ln ( | { \mathcal M } | / \delta ) } { n } } .
+$$
+
+We use (32) here.
+
+Finally,
+
+$$
+\begin{array} { r l } & { V _ { P ^ { \star } } ^ { \pi ^ { * } } - V _ { P ^ { \star } } ^ { \hat { \pi } } } \\ & { \leq V _ { P ^ { \star } } ^ { \pi ^ { * } } - \underset { P \in \mathcal { M } _ { D } } { \operatorname* { m i n } } V _ { P } ^ { \pi ^ { * } } \qquad \quad \scriptstyle ( \mathrm { R e c a l l ~ t h e ~ p r o o f ~ o f ~ t h e ~ t h i r d ~ s t e p ~ i n ~ t h e ~ p r o o f ~ o f ~ T h e o r e m ~ 1 ) } } \\ & { \leq ( 1 - \gamma ) ^ { - 2 } \mathbb { E } _ { s , a \sim d _ { P ^ { \star } } ^ { \pi ^ { * } } } \mathrm { T V } ( P ^ { \prime } ( s , a ) , P ^ { \star } ( \cdot \vert ~ s , a ) ) } \\ & { \lesssim \sqrt { \frac { \tilde { C } _ { \pi ^ { * } , \phi ^ { \star } } \operatorname { r a n k } ( \sum _ { \rho } ) \omega _ { \pi ^ { * } } \ln ( \vert M \vert / \delta ) } { n ( 1 - \gamma ) ^ { 4 } } } . } \end{array}
+$$
+
+The following inequality is an important lemma to connect $\mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi } } \left\{ f ( s , a ) \right\}$ with an elliptical potential $\mathbb { E } _ { ( \tilde { s } , \tilde { a } ) \sim d _ { P ^ { \star } } ^ { \pi } } \| \phi ^ { \star } ( \tilde { s } , \tilde { a } ) \| _ { \Sigma _ { \rho , \phi ^ { \star } } ^ { - 1 } }$
+
+Lemma 4 (One-step back inequality). Take any $f \subset { \mathcal { S } } \times { \mathcal { A } } \to \mathbb { R }$ s.t. $\| f \| _ { \infty } \leq B$ and $0 < \lambda \in \mathbb { R }$ Letting $\omega = \mathrm { m a x } _ { s , a } ( \pi ( { \boldsymbol a } \mid s ) / \bar { \pi } _ { b } ( { \boldsymbol a } { \dot { \mid } } s ) )$ , for any policy $\pi$ , we have
+
+$$
+\begin{array} { r l } & { | \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { * } } ^ { \pi } } \left\{ f ( s , a ) \right\} | \leq \mathbb { E } _ { ( \tilde { s } , \tilde { a } ) \sim d _ { P ^ { * } } ^ { \pi } } \| \phi ^ { \star } ( \tilde { s } , \tilde { a } ) \| _ { \Sigma ^ { - 1 } } \sqrt { \{ n \omega _ { \pi } \gamma \mathbb { E } _ { ( s , a ) \sim \rho } [ f ^ { 2 } ( s , a ) ] \} + \gamma ^ { 2 } \lambda d B ^ { 2 } } } \\ & { \phantom { \times \ } + \sqrt { ( 1 - \gamma ) \omega _ { \pi } \mathbb { E } _ { ( s , a ) \sim \rho } [ f ^ { 2 } ( s , a ) ] } . } \end{array}
+$$
+
+where $\Sigma = n \mathbb { E } _ { ( s , a ) \sim \rho } [ \phi ^ { \star } ( s , a ) \phi ^ { \star ^ { \top } } ( s , a ) ] + \lambda I .$
+
+Proof of Lemma 4. First, we have an equality:
+
+$$
+\begin{array} { r } { \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi } } \left\{ f ( s , a ) \right\} = \gamma \mathbb { E } _ { ( \tilde { s } , \tilde { a } ) \sim d _ { P ^ { \star } } ^ { \pi } , s \sim P ^ { \star } \left( \tilde { s } , \tilde { a } \right) } \left\{ f ( s , a ) \right\} + ( 1 - \gamma ) \mathbb { E } _ { s \sim d _ { 0 } , a \sim \pi ( s _ { 0 } ) } \left\{ f ( s , a ) \right\} . } \end{array}
+$$
+
+The second term in (33) is upper-bounded by
+
+$$
+\begin{array} { r } { \mathbb { E } _ { s \sim d _ { 0 } , a \sim \pi ( s _ { 0 } ) } \left\{ f ( s , a ) \right\} \le \mathbb { E } _ { s \sim d _ { 0 } , a \sim \pi ( s _ { 0 } ) } \left\{ f ^ { 2 } ( s , a ) \right\} \} ^ { 1 / 2 } = \sqrt { \omega _ { \pi } } \mathbb { E } _ { ( s , a ) \sim \rho } \left[ f ^ { 2 } ( s , a ) \right] / ( 1 - \gamma ) . } \end{array}
+$$
+
+Next we consider the first term in (33). By CS inequality, we have
+
+$$
+\begin{array} { r l } & { \left| \mathbb { E } _ { ( \tilde { s } , \tilde { a } ) \sim d _ { P ^ { \star } } ^ { \pi } , s \sim P ^ { \star } ( \tilde { s } , \tilde { a } ) } \left\{ f ( s , a ) \right\} \right| = \left| \mathbb { E } _ { ( \tilde { s } , \tilde { a } ) \sim d _ { P ^ { \star } } ^ { \pi } } \phi ^ { \star } ( \tilde { s } , \tilde { a } ) ^ { \top } \int \hat { \mu } ( s ) \pi ( a \mid s ) f ( s , a ) d ( s , a ) \right| } \\ & { \leq \mathbb { E } _ { ( \tilde { s } , \tilde { a } ) \sim d _ { P ^ { \star } } ^ { \pi } } \left\| \phi ^ { \star } ( \tilde { s } , \tilde { a } ) \right\| _ { \Sigma _ { \rho , \phi ^ { \star } } ^ { - 1 } } \| \int \hat { \mu } ( s ) \pi ( a \mid s ) f ( s , a ) d ( s , a ) \| _ { \Sigma _ { \rho , \phi ^ { \star } } } . } \end{array}
+$$
+
+Then,
+
+$$
+\begin{array} { r l r } & { \| \int \hat { \mu } ( s ) \pi ( a \mid s ) f ( s , a ) d ( s , a ) \| _ { \mathcal { D } _ { p , \phi ^ { * } } } ^ { 2 } } \\ & { } & { \leq \left\{ \displaystyle \int \hat { \mu } ( s ) \pi ( a \mid s ) f ( s , a ) d ( s , a ) \right\} ^ { \top } \left\{ \displaystyle \pi \mathbb { E } _ { ( s , a ) \sim \rho } [ \phi ^ { * } \phi ^ { * \top } ] + \lambda I \right\} \left\{ \displaystyle \int \hat { \mu } ( s ) \pi ( a \mid s ) f ( s , a ) d ( s , a ) \right\} } \\ & { } & { \leq n \left\{ \mathbb { E } _ { ( \tilde { s } , \tilde { a } ) \sim \rho } \left[ \displaystyle \int \hat { \mu } ( s ) ^ { \top } \phi ^ { * } ( \tilde { s } , \tilde { a } ) \pi ( a \mid s ) f ( s , a ) d ( s , a ) \right] \right\} ^ { 2 } + B ^ { 2 } \lambda d } \\ & { } & { \quad \quad \quad \quad \quad ( \mathrm { U s e t h e ~ a s s u m p t i o n ~ \| f ( s , a ) \| _ \infty \leq B ~ a n d ~ \| ~ \int ~ } \hat { \mu } ( s ) \mathrm { d } ( s ) \| _ { 2 } \leq \sqrt d } \\ & { } & { = n \left\{ \mathbb { E } _ { ( \tilde { s } , \tilde { a } ) \sim \rho , s \sim P ^ { * } } ( \tilde { s } , \tilde { a } ) _ { a } \sim w ( s ) \left[ f ( s , a ) \right] \right\} ^ { 2 } + B ^ { 2 } \lambda d } \\ & { } & { \quad \quad \quad \quad ( \mathrm { J e n s e n ~ \rho ~ } ) \| f ^ { 2 } ( s , a ) \| _ { \mathcal { H } } . } \end{array}
+$$
+
+Finally, the the first term in (33) is upper-bounded by
+
+$$
+\begin{array} { r l } & { n \left. \mathbb { E } _ { ( \tilde { s } , \tilde { a } ) \sim \rho , s \sim P ^ { \star } ( \tilde { s } , \tilde { a } ) , a \sim \pi ( s ) } \left[ f ^ { 2 } ( s , a ) \right] \right. + \lambda d B ^ { 2 } } \\ & { \leq n \omega _ { \pi } \left. \mathbb { E } _ { ( \tilde { s } , \tilde { a } ) \sim \rho , s \sim P ^ { \star } ( \tilde { s } , \tilde { a } ) , a \sim \pi _ { b } ( s ) } \left[ f ^ { 2 } ( s , a ) \right] \right. + \lambda d B ^ { 2 } } \\ & { \leq n \omega _ { \pi } \left. \frac { 1 } { \gamma } \mathbb { E } _ { ( s , a ) \sim \rho } \left[ f ^ { 2 } ( s , a ) \right] \right. + \lambda d B ^ { 2 } . } \end{array}
+$$
+
+(Importance sampling)
+
+The final statement is immediately concluded.
+
+# E.7 PROOFS FOR FACTORED MDPS
+
+Proof of Theorem 3. We denote the constrained set as $\mathcal { M } _ { \mathcal { D } }$ :
+
+$$
+\mathcal { M } _ { \mathcal { D } } = \left\{ P = \prod _ { i } P _ { i } \mid \mathbb { E } _ { \mathcal { D } } \left[ \mathrm { T V } ( \widehat { P } _ { \mathrm { M L E } , i } ( \cdot \mid s [ p a _ { i } ] , a ) , P _ { i } ( \cdot \mid s [ p a _ { i } ] , a ) ) ^ { 2 } \right] \leq \xi _ { i } , \forall i \in [ 1 , \cdots , d ] \right\} .
+$$
+
+Following the first step in the proof of Corollary 1, with probability $1 - \delta$ , the product $\Pi _ { i } P _ { i } ^ { \star }$ is in $\mathcal { M } _ { \mathcal { D } }$ , i.e.,
+
+$$
+\begin{array} { r } { z _ { s , a \sim \mathcal { D } } \left[ \mathrm { T V } ( \widehat { P } _ { \mathrm { M L E } , i } ( \cdot \mid s [ p a _ { i } ] , a ) , P _ { i } ^ { \star } ( \cdot \mid s [ p a _ { i } ] , a ) ) ^ { 2 } \right] \leq \xi _ { i } , \forall i \in [ 1 , \cdots , d ] , \quad \xi _ { i } = \sqrt { \frac { L _ { i } \log ( L _ { i } d / \delta ) } { n } } . } \end{array}
+$$
+
+Note $d$ comes from the union bound. Besides, following the second step in the proof of Corollary 1, for any $P \in \mathcal { M } _ { \mathcal { D } }$ , with probability $1 - \delta$ ,
+
+$$
+\begin{array} { r } { \mathbb E _ { s , a \sim \rho } \left[ T V ( \widehat { P } _ { i } ( \cdot \vert s [ p a _ { i } ] , a ) , P _ { i } ^ { \star } ( \cdot \vert s [ p a _ { i } ] , a ) ) ^ { 2 } \right] \leq \xi _ { i } , \forall i \in [ 1 , \cdots , d ] . } \end{array}
+$$
+
+After conditioning on the above two events, then, for any $P \in \mathcal { M } _ { \mathcal { D } }$ and $\pi ^ { \star } \in \Pi$ , we have
+
+$$
+\begin{array} { l } { \displaystyle \leq ( 1 - \gamma ) ^ { - 2 } \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi ^ { * } } } [ \sum _ { i } \mathrm { T V } ( P _ { i } ( \cdot \mid s [ p a _ { i } ] , a ) , P _ { i } ^ { \star } ( \cdot \mid s [ p a _ { i } ] , a ) ) ] } \\ { \displaystyle \leq ( 1 - \gamma ) ^ { - 2 } \sum _ { i } \sqrt { \mathbb { E } _ { ( s , a ) \sim \rho } \left[ \left( \frac { d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s [ p a _ { i } ] , a ) } { \rho ( s [ p a _ { i } ] , a ) } \right) ^ { 2 } \right] \mathbb { E } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P _ { i } ( \cdot \mid s [ p a _ { i } ] , a ) , P _ { i } ^ { \star } ( \cdot \mid s [ p a _ { i } ] , a ) ) ] } } \\ { \displaystyle \qquad \quad \qquad \quad \qquad \quad \qquad \quad \qquad \quad \qquad \quad \qquad \quad \qquad \mathrm { ~ } } \end{array}
+$$
+
+$$
+\begin{array} { r l } & { \leq \left( 1 - \gamma \right) ^ { - 2 } \displaystyle \sum _ { i } \sqrt { \mathbb { E } _ { \left( s , a \right) \sim \rho } \left[ \left( \frac { d \vec { r } _ { + } ^ { \infty } \left( s \left| p a _ { i } \right| , a \right) } { \rho \left( s \left| p a _ { i } \right| , a \right) } \right) ^ { 2 } \right] \mathbb { E } _ { \left( s , a \right) \sim \rho } \big [ \mathrm { T V } \big ( P _ { \downarrow } \big ( \cdot \ \left| s \left| p a _ { i } \right| , a \big ) , P _ { i } ^ { \star } \big ( \cdot \ \left| s \left| p a _ { i } \right| , a \big ) \right) ^ { 2 } \right] } } \\ & { \leq \left( 1 - \gamma \right) ^ { - 2 } \displaystyle \sum _ { i } \sqrt { \tilde { C } _ { \pi ^ { * } , \infty } \mathbb { E } _ { \left( s , a \right) \sim \rho } \big [ \mathrm { T V } \big ( P _ { i } \big ( \cdot \left| s , a \right) , P _ { i } ^ { \star } \big ( \cdot \left| s , a \right) \big ) ^ { 2 } \big ] } \leq \left( 1 - \gamma \right) ^ { - 2 } \displaystyle \sum _ { i } \sqrt { \tilde { C } _ { \pi ^ { * } , \infty } \xi _ { i } } } \\ & { \leq \left( 1 - \gamma \right) ^ { - 2 } \displaystyle \sqrt { d \tilde { C } _ { \pi ^ { * } , \infty } \sum _ { i } \xi _ { i } } \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \leq c ( 1 - \gamma ) ^ { - 2 } \displaystyle \sqrt { d \tilde { C } _ { \pi ^ { * } , \infty } \frac { L _ { 1 } \ln \left( L n d / \delta \right) } { n } } . } \end{array}
+$$
+
+Here, recall
+
+$$
+\ddot { C } _ { \pi ^ { * } , \infty } = \operatorname* { m a x } _ { i \in [ 1 , \cdots , d ] } \mathbb { E } _ { ( s , a ) \sim \rho } \left[ \left( \frac { d _ { P ^ { * } } ^ { \pi ^ { * } } ( s [ p a _ { i } ] , a ) } { \rho ( s [ p a _ { i } ] , a ) } \right) ^ { 2 } \right] .
+$$
+
+Following the third step in the proof of Corollary 1, the statement is concluded.
+
+Next, we show that $\begin{array} { r } { \ddot { C } _ { \pi ^ { * } , \infty } \leq C _ { \pi ^ { * } , P ^ { \star } } = \operatorname* { m a x } _ { s , a } \frac { { d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s , a ) } } { \rho ( s , a ) } . } \end{array}$
+
+Proposition 1 (Comparison of $L ^ { \infty }$ -density-ratio based concentrabiliity coefficient between factored MDPs and non-factored MDPs ). For any $\pi ^ { * }$ , we have:
+
+$$
+\ddot { C } _ { \pi ^ { * } , \infty } \leq C _ { \pi ^ { * } , \infty } .
+$$
+
+Proof. From now on, for any $i \in [ 1 , \cdots , d ]$ , by defining $\mathbf { \mathcal { S } } _ { i } ^ { \prime }$ s.t. $S = S _ { i } \times S _ { i } ^ { \prime }$ , we prove
+
+$$
+\operatorname* { m a x } _ { s _ { i } \in S _ { i } , a \in \mathcal { A } } \frac { d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s _ { i } , a ) } { \rho ( s _ { i } , a ) } \leq \operatorname* { m a x } _ { s \in S _ { i } , s _ { i } ^ { \prime } \in S _ { i } , a \in \mathcal { A } } \frac { d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s _ { i } , s _ { i } ^ { \prime } , a ) } { \rho ( s _ { i } , s _ { i } ^ { \prime } , a ) } = C _ { \pi ^ { * } , \infty } .
+$$
+
+Then, (34) is easily proved.
+
+First, for any $s _ { i } \in S _ { i } , a \in \mathcal { A }$ , we have
+
+$$
+\underset { s _ { i } ^ { \prime } } { \mathrm { n a x } } \frac { d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s _ { i } , s _ { i } ^ { \prime } , a ) } { \rho ( s _ { i } , s _ { i } ^ { \prime } , a ) } = \underset { s _ { i } ^ { \prime } } { \mathrm { m a x } } \frac { d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s _ { i } , a ) d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s _ { i } ^ { \prime } \mid s _ { i } , a ) } { \rho ( s _ { i } , a ) \rho ( s _ { i } ^ { \prime } \mid s _ { i } , a ) } = \frac { d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s _ { i } , a ) } { \rho ( s _ { i } , a ) } \underset { s _ { i } ^ { \prime } } { \mathrm { m a x } } \frac { d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s _ { i } ^ { \prime } \mid s _ { i } , a ) } { \rho ( s _ { i } ^ { \prime } \mid s _ { i } , a ) } \geq \frac { d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s _ { i } , a ) } { \rho ( s _ { i } , a ) }
+$$
+
+Here, we use
+
+$$
+1 \leq \operatorname* { m a x } _ { s _ { i } ^ { \prime } } \frac { d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s _ { i } ^ { \prime } \mid s _ { i } , a ) } { \rho ( s _ { i } ^ { \prime } \mid s _ { i } , a ) } ,
+$$
+
+which is proved by the contradiction argument, that is, if $\begin{array} { r } { 1 > \operatorname* { m a x } _ { s _ { i } ^ { \prime } } \frac { d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s _ { i } ^ { \prime } | s _ { i } , a ) } { \rho ( s _ { i } ^ { \prime } | s _ { i } , a ) } } \end{array}$ , both $\rho$ and $d _ { P ^ { \star } } ^ { \pi ^ { * } }$ cannot be probability mass functions since we would get
+
+$$
+1 = \sum _ { s _ { i } ^ { \prime } } d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s _ { i } ^ { \prime } \mid s _ { i } , a ) \leq \operatorname* { m a x } _ { s _ { i } ^ { \prime } } \left( \frac { d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s _ { i } ^ { \prime } \mid s _ { i } , a ) } { \rho ( s _ { i } ^ { \prime } \mid s _ { i } , a ) } \right) \sum _ { s _ { i } ^ { \prime } } \rho ( s _ { i } ^ { \prime } \mid s _ { i } , a ) < \sum _ { s _ { i } ^ { \prime } } \rho ( s _ { i } ^ { \prime } \mid s _ { i } , a ) .
+$$
+
+Then, by taking the maximum over $s _ { i } \in S _ { i } , a \in \mathcal { A }$ for both sides on (35), we have
+
+$$
+\operatorname* { m a x } _ { s _ { i } , a } \frac { d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s _ { i } , a ) } { \rho ( s _ { i } , a ) } \leq \operatorname* { m a x } _ { s _ { i } , s _ { i } ^ { \prime } , a } \frac { d _ { P ^ { \star } } ^ { \pi ^ { * } } ( s _ { i } , s _ { i } ^ { \prime } , a ) } { \rho ( s _ { 1 } , s _ { i } ^ { \prime } , a ) } .
+$$
+
+# F AUXILIARY LEMMAS
+
+Lemma 5 (Simulation Lemma). Consider any two transitions $P$ and $\widehat { P }$ , and any policy $\pi : { \mathcal { S } } $ $\Delta ( \mathcal { A } )$ . We have:
+
+$$
+\begin{array} { r l } & { | V _ { P } ^ { \pi } - V _ { \widehat { P } } ^ { \pi } | \leq | ( 1 - \gamma ) ^ { - 1 } \mathbb { E } _ { s , a \sim d _ { P } ^ { \pi } } [ \mathbb { E } _ { s ^ { \prime } \sim P ( s , a ) } [ V _ { \widehat { P } } ^ { \pi } ( s ^ { \prime } ) ] - \mathbb { E } _ { s ^ { \prime } \sim P ( s , a ) } [ V _ { \widehat { P } } ^ { \pi } ( s ^ { \prime } ) ] ] | } \\ & { \qquad \leq ( 1 - \gamma ) ^ { - 2 } \mathbb { E } _ { s , a \sim d _ { P } ^ { \pi } } \left[ \mathrm { T V } ( P ( \cdot | s , a ) , \widehat { P } ( \cdot | s , a ) ) \right] . } \end{array}
+$$
+
+Proof. Such simulation lemma is standard in model-based RL literature and the derivation can be found, for instance, in the proof of Lemma 10 from Sun et al. (2019). □
+
+Lemma 6 (MLE guarantee). Given a set of models $\mathcal { M } = \{ P : \mathcal { S } \times \mathcal { A } \Delta ( \mathcal { S } ) \}$ with $P ^ { \star } \in { \mathcal { M } }$ , and a dataset $\mathcal { D } = \{ s _ { i } , a _ { i } , s _ { i } ^ { \prime } \} _ { i = 1 } ^ { n }$ with $s _ { i } , a _ { i } \sim \rho _ \mathrm $ , and $s _ { i } ^ { \prime } \sim P ^ { \star } ( s _ { i } , a _ { i } )$ , let $\widehat { P } _ { \mathrm { M L E } } \ : b e$
+
+$$
+{ \widehat P } _ { \mathrm { M L E } } = \underset { P \in \mathcal { M } } { \arg \operatorname* { m i n } } \sum _ { i = 1 } ^ { n } - \ln P ( s _ { i } ^ { \prime } | s _ { i } , a _ { i } ) .
+$$
+
+With probability at least $1 - \delta$ , we have:
+
+$$
+\mathbb { E } _ { s , a \sim \rho } \mathrm { T V } ( \widehat { P } _ { \mathrm { M L E } } ( \cdot | s , a ) , P ^ { \star } ( \cdot | s , a ) ) ^ { 2 } \lesssim \frac { \ln ( | \mathcal { M } | / \delta ) } { n } .
+$$
+
+Proof. Refer to (Agarwal et al., 2020b, Section E)
+
+Lemma 7 (MLE guarantee for tabular models).
+
+$$
+\mathbb { E } _ { \mathcal { D } } \left[ \mathrm { T V } ( P ( \cdot | s , a ) , \widehat { P } _ { \mathrm { M L E } } ( \cdot | s , a ) ) ^ { 2 } \right] \leq \frac { | { \cal S } | { \cal A } | \{ | { \cal S } | \ln 2 + \ln ( 2 | { \cal S } | | { \cal A } | / \delta ) \} } { 2 n } .
+$$
+
+Proof. From Chang et al. (2021, Lemma 12) , with probability $1 - \delta$ ,
+
+$$
+\mathrm { T V } ( P ( \cdot | s , a ) , \widehat { P } _ { \mathrm { M L E } } ( \cdot | s , a ) ) ^ { 2 } \leq \frac { | S | \ln 2 + \ln ( 2 | S | | A | / \delta ) } { 2 N ( s , a ) } \quad \forall ( s , a ) \in { \mathcal S } \times { \mathcal A } ,
+$$
+
+where $N ( s , a )$ is the number of visiting times for $( s , a )$ . Then,
+
+$$
+\begin{array} { r l r } & { } & { { \mathbb E } _ { \mathcal { D } } \left[ \mathrm { T V } ( P ( \cdot | s , a ) , \widehat { P } _ { \mathrm { M L E } } ( \cdot | s , a ) ) ^ { 2 } \right] \leq { \mathbb E } _ { \mathcal { D } } \left[ \frac { | S | \ln 2 + \ln ( 2 | S | | A | / \delta ) } { 2 N ( s , a ) } \right] } \\ & { } & { \qquad \leq \displaystyle \sum _ { ( s , a ) } \left[ \frac { | S | \ln 2 + \ln ( 2 | S | | A | / \delta ) } { 2 n } \right] } \\ & { } & { \qquad = \frac { | S | A | \{ | S | \ln 2 + \ln ( 2 | S | | A | / \delta ) \} } { 2 n } . } \end{array}
+$$
+
+Lemma 8 (MLE guarantee for KNRs).
+
+$$
+\begin{array} { r } { \left\| \left( \widehat { W } _ { \mathrm { M L E } } - W ^ { \star } \right) \left( \Sigma _ { n } \right) ^ { 1 / 2 } \right\| _ { 2 } \leq \beta _ { n } . } \end{array}
+$$
+
+Proof. The proof directly follows the confidence ball construction and proof from (Kakade et al., 2020). □
+
+Lemma 9 $\ell _ { 1 }$ Distance between two Gaussians). Consider two Gaussian distributions $P _ { 1 } : =$ $\mathcal { N } ( \mu _ { 1 } , \zeta ^ { 2 } \mathbf { I } )$ and $P _ { 2 } : = \mathcal { N } ( \mu _ { 2 } , \zeta ^ { 2 } \mathbf { I } )$ . We have:
+
+$$
+\mathrm { T V } ( P _ { 1 } , P _ { 2 } ) \leq \frac { 1 } { \zeta } \left\| \mu _ { 1 } - \mu _ { 2 } \right\| _ { 2 } .
+$$
+
+Proof. This lemma is proved by Pinsker’s inequality and the closed-form of the $\mathrm { K L }$ divergence between $P _ { 1 }$ and $P _ { 2 }$ . Refer to (Kakade et al., 2020).
+
+Lemma 10 (Property of linear mixture MDPs). Let $P ( \theta ) = \theta ^ { \top } \psi ( s , a , s ^ { \prime } )$ . Suppose $P ( \theta ) \in { \mathcal { S } } \times$ $\mathcal { A } \to \Delta ( \mathcal { S } )$ . For any function $V \in { \cal S } \to [ 0 , 1 ] ,$ , letting $\begin{array} { r } { \psi _ { V } ( s , a ) = \int \psi ( s , a , s ^ { \prime } ) V ( s ^ { \prime } ) \mathrm { d } ( s ^ { \prime } ) } \end{array}$ , we suppose $\| \psi _ { V } ( s , a ) \| _ { 2 } \leq 1 .$ . The following theorems hold:
+
+1. For any $( s , a , s ^ { \prime } )$ , we have $\begin{array} { r } { | P ( \theta ) ( s , a , s ^ { \prime } ) - P ( \theta ^ { \prime } ) ( s , a , s ^ { \prime } ) | \leq \| \theta - \theta ^ { \prime } \| _ { 2 } . } \end{array}$
+
+2. For any $( s , a )$ , we have $\mathrm { T V } ( P ( \theta ) ( s , a , \cdot ) , P ( \theta ^ { \prime } ) ( s , a , \cdot ) ) \leq \| \theta - \theta ^ { \prime } \| _ { 2 }$ . Besides, for any $V : \mathcal { S } [ 0 , 1 ]$ , we have
+
+$$
+| ( \theta - \theta ^ { \prime } ) \psi _ { V } ( s , a ) | \le \mathrm { T V } \big ( P ( \theta ) ( s , a , \cdot ) , P ( \theta ^ { \prime } ) ( s , a , \cdot ) \big ) .
+$$
+
+3.
+
+$$
+\begin{array} { r l } & { C _ { \pi ^ { \star } , P ^ { \star } } ^ { \dagger } = \underset { x } { \operatorname* { s u p } } \frac { x ^ { \top } \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi ^ { * } } } [ \psi _ { V _ { ( s , a , x ) } } ( s , a ) \psi _ { V _ { ( s , a , x ) } } ^ { \top } ( s , a ) ] x } { x ^ { \top } \mathbb { E } _ { ( s , a ) \sim \rho } [ \psi _ { V _ { ( s , a , x ) } } ( s , a ) \psi _ { V _ { ( s , a , x ) } } ^ { \top } ( s , a ) ] x } , } \\ & { V _ { ( s , a , x ) } = \underset { V : \mathcal { S } [ 0 , 1 ] } { \operatorname { a r g m a x } } | x ^ { \top } \int \phi ( s , a , s ^ { \prime } ) V ( s ^ { \prime } ) \mathrm { d } ( s ^ { \prime } ) | . } \end{array}
+$$
+
+4. In linear MDPs (i.e., $\psi ( s , a , s ^ { \prime } ) = \phi ( s , a ) \otimes \mu ( s ^ { \prime } ) )$ , we have
+
+$$
+\operatorname* { s u p } _ { V \in \{ S [ 0 , 1 ] \} } \operatorname* { s u p } _ { x } \frac { x ^ { \top } \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { \pi } } [ \psi _ { V } ( s , a ) \psi _ { V } ^ { \top } ( s , a ) ] x } { x ^ { \top } \mathbb { E } _ { ( s , a ) \sim \rho } [ \psi _ { V } ( s , a ) \psi _ { V } ^ { \top } ( s , a ) ] x } = \operatorname* { s u p } _ { x } \frac { x ^ { \top } \mathbb { E } _ { d _ { P ^ { \star } } ^ { \pi } } [ \phi ( s , a ) \phi ( s , a ) ^ { \top } ] x } { x ^ { \top } \mathbb { E } _ { \rho } [ \phi ( s , a ) \phi ( s , a ) ^ { \top } ] x } .
+$$
+
+Proof. We prove the first statement. This is proved by
+
+$$
+\begin{array} { r } { \vert P ( \theta ) - P ( \theta ^ { \prime } ) \vert = \vert ( \theta - \theta ^ { \prime } ) \psi ( s , a , s ^ { \prime } ) \vert \le \Vert \theta - \theta ^ { \prime } \Vert _ { 2 } \Vert \psi ( s , a , s ^ { \prime } ) \Vert _ { 2 } \le \Vert \theta - \theta ^ { \prime } \Vert _ { 2 } , } \end{array}
+$$
+
+Here, we use $\| \psi ( s , a , s ^ { \prime } ) \| _ { 2 } \leq 1$ which is proved by the assumption by setting $V ( s ) = I ( s ^ { \prime } = s )$ for any $s ^ { \prime }$ .
+
+Next, we prove the second statement. For fixed $\theta \in \mathbb { R } ^ { d }$ and $( s , a ) \in S \times A$ , we have
+
+$$
+\begin{array} { l } { \mathrm { T V } ( P ( \theta ) ( s , a , \cdot ) , P ( \theta ^ { \star } ) ( s , a , \cdot ) ) = \underset { V : S [ 0 , 1 ] } { \operatorname* { s u p } } | \int ( \theta - \theta ^ { \star } ) ^ { \top } \psi ( s , a , s ^ { \prime } ) V ( s ^ { \prime } ) \mathrm { d } ( s ^ { \prime } ) | } \\ { = \underset { V : S [ 0 , 1 ] } { \operatorname* { s u p } } | ( \theta - \theta ^ { \star } ) ^ { \top } \int \psi ( s , a , s ^ { \prime } ) V ( s ^ { \prime } ) \mathrm { d } ( s ^ { \prime } ) | } \\ { = | ( \theta - \theta ^ { \star } ) ^ { \top } \int \psi ( s , a , s ^ { \prime } ) V _ { ( s , a , \theta ) } ( s ^ { \prime } ) \mathrm { d } ( s ^ { \prime } ) | } \\ { = | ( \theta - \theta ^ { \star } ) ^ { \top } \psi _ { V _ { ( s , a , \theta ) } } ( s , a ) | . } \end{array}
+$$
+
+In the third line, we define $\begin{array} { r } { V ( s , a , \theta ) = \arg \operatorname* { m a x } _ { V : S \to [ 0 , 1 ] } | ( \theta - \theta ^ { \star } ) ^ { \top } \int \psi ( s , a , s ^ { \prime } ) V ( s ^ { \prime } ) \mathrm { d } ( s ^ { \prime } ) | . } \end{array}$ Then, from CS inequality,
+
+$$
+\mathrm { T V } ( P ( \theta ) ( s , a , \cdot ) , P ( \theta ^ { \star } ) ( s , a , \cdot ) ) \leq \| ( \theta - \theta ^ { \star } \| _ { 2 } \| \psi _ { V _ { ( s , a , \theta ) } } ( s , a ) \| _ { 2 } \leq \| \theta - \theta ^ { \star } \| _ { 2 } .
+$$
+
+We use the assumption $\| \psi _ { V _ { ( s , a , \theta ) } } ( s , a ) \| _ { 2 } \leq 1$ . This concludes the second statement. Besides, for any $V : { \mathcal { S } } [ 0 , 1 ]$ , we have
+
+$$
+\begin{array} { r l } & { | ( \theta - \theta ^ { \prime } ) \psi _ { V } ( s , a ) | \leq | ( \theta - \theta ^ { \star } ) ^ { \top } \psi _ { V _ { ( s , a , \theta ) } } ( s , a ) | } \\ & { \qquad \leq \mathrm { T V } ( P ( \theta ) ( s , a , \cdot ) , P ( \theta ^ { \prime } ) ( s , a , \cdot ) ) . } \end{array}
+$$
+
+The third statement is immediately concluded by
+
+$$
+\frac { \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { * } } ^ { \pi } } [ \mathrm { T V } ( P ( \theta ) ( s , a , \cdot ) , P ( \theta ^ { \star } ) ( s , a , \cdot ) ) ^ { 2 } ] } { \mathbb { E } _ { ( s , a ) \sim \rho } [ \mathrm { T V } ( P ( \theta ) ( s , a , \cdot ) , P ( \theta ^ { \star } ) ( s , a , \cdot ) ) ^ { 2 } ] } = \frac { \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { * } } ^ { \pi } } [ | ( \theta - \theta ^ { \star } ) ^ { \top } \psi _ { V _ { ( s , a , \theta ) } } ( s , a ) | ^ { 2 } ] } { \mathbb { E } _ { ( s , a ) \sim \rho } [ | ( \theta - \theta ^ { \star } ) ^ { \top } \psi _ { V _ { ( s , a , \theta ) } } ( s , a ) | ^ { 2 } ] } .
+$$
+
+Finally, we prove the fourth statement. Suppose $\psi ( s , a , s ^ { \prime } ) = \phi ( s , a ) \otimes \mu ( s ^ { \prime } )$ ( $\otimes$ denotes kronerker product). Then, $\begin{array} { r } { \phi _ { V } ( s , a , s ^ { \prime } ) = \phi ( s , a ) \otimes \bar { \int } \mu ( s ^ { \prime } ) V ( s ^ { \prime } ) \mathrm { d } ( s ^ { \prime } ) } \end{array}$ . Then, by defining a vector $\mu ( V ) =$ $\begin{array} { r } { \int \mu ( s ^ { \prime } ) V ( s ^ { \prime } ) \mathrm { d } ( s ^ { \prime } ) } \end{array}$ , we immediately have
+
+$$
+\begin{array}{c} \begin{array} { r l } & { x ^ { \top } \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { n ^ { \star } } } [ \psi _ { V } ( s , a ) \psi _ { V } ^ { \top } ( s , a ) ] x } \\ & { \quad x ^ { \top } \mathbb { E } _ { ( s , a ) \sim \rho } [ \psi _ { V } ( s , a ) \psi _ { V } ^ { \top } ( s , a ) ] x } \end{array} = \operatorname* { s u p } _ { x } \frac { x ^ { \top } \mathbb { E } _ { ( s , a ) \sim d _ { P ^ { \star } } ^ { n ^ { \star } } } [ ( \phi ( s , a ) \otimes \mu ( V ) ) ( \phi ( s , a ) \otimes \mu ( V ) ) ^ { \top } ] x } { x ^ { \top } \mathbb { E } _ { ( s , a ) \sim \rho } [ ( \phi ( s , a ) \otimes \mu ( V ) ) ( \phi ( s , a ) \otimes \mu ( V ) ) ^ { \top } ] x } . \end{array}
+$$
+
+Here, we have
+
+$$
+\begin{array} { r l } & { \mathbb { E } _ { \rho } [ ( \phi ( s , a ) \otimes \mu ( V ) ) ( \phi ( s , a ) \otimes \mu ( V ) ) ^ { \top } ] = \mathbb { E } _ { \rho } [ ( \phi ( s , a ) \otimes \mu ( V ) ) ( \phi ( s , a ) ^ { \top } \otimes \mu ( V ) ^ { \top } ) ] } \\ & { \qquad = \mathbb { E } _ { \rho } [ ( \phi ( s , a ) \phi ( s , a ) ^ { \top } ) ] \otimes ( \mu ( V ) \mu ( V ) ^ { \top } ) . } \end{array}
+$$
+
+We notice
+
+$$
+\{ { { \mathbb E } } _ { \rho } [ ( \phi ( s , a ) \phi ( s , a ) ^ { \top } ) ] \otimes ( \mu ( V ) \mu ( V ) ^ { \top } ) \} ^ { 1 / 2 } = { { \mathbb E } } _ { \rho } [ \phi ( s , a ) \phi ( s , a ) ^ { \top } ] ^ { 1 / 2 } \otimes ( \mu ( V ) \mu ( V ) ^ { \top } ) ^ { 1 / 2 } .
+$$
+
+This is because the square root of a matrix is unique and we have $( A ^ { 1 / 2 } \otimes B ^ { 1 / 2 } ) ( A ^ { 1 / 2 } \otimes B ^ { 1 / 2 } ) =$ $A B$ for symmetric matrices $A$ and $B$ . Then, by denoting $F _ { \rho } = \mathbb { E } _ { \rho } [ \phi ( s , a ) \phi ( s , a ) ^ { \top } ] , F _ { d _ { P ^ { \star } } ^ { \pi } } =$ $\mathbb { E } _ { d _ { P ^ { \star } } ^ { \pi } } [ \phi ( s , a ) \phi ( s , a ) ^ { \top } ]$ and denoting the pseudo inverse of $F$ as $F ^ { + }$ , we can see (37) is equal to
+
+$$
+\begin{array} { r l } & { \{ F _ { \rho } ^ { 1 / 2 } \otimes ( \mu ( V ) \mu ( V ) ^ { \top } ) ^ { 1 / 2 } \} ^ { + } \{ F _ { d _ { P ^ { \star } } ^ { - } } \otimes ( \mu ( V ) \mu ( V ) ^ { \top } ) \} \{ F _ { \rho } ^ { 1 / 2 } \otimes ( \mu ( V ) \mu ( V ) ^ { \top } ) ^ { 1 / 2 } \} ^ { + } } \\ & { = \{ F _ { \rho } ^ { - 1 / 2 } \otimes ( \mu ( V ) \mu ( V ) ^ { \top } ) ^ { - 1 / 2 } \} \{ F _ { d _ { P ^ { \star } } ^ { - } } \otimes ( \mu ( V ) \mu ( V ) ^ { \top } ) \} \{ F _ { \rho } ^ { - 1 / 2 } \otimes ( \mu ( V ) \mu ( V ) ^ { \top } ) ^ { - 1 / 2 } \} } \\ & { = \{ F _ { \rho } ^ { - 1 / 2 } F _ { d _ { P ^ { \star } } ^ { - } } F _ { \rho } ^ { - 1 / 2 } \} \otimes \{ ( \mu ( V ) \mu ( V ) ^ { \top } ) ^ { - 1 / 2 } ( \mu ( V ) \mu ( V ) ^ { \top } ) ( \mu ( V ) \mu ( V ) ^ { \top } ) ^ { - 1 / 2 } \} } \\ & { = \{ F _ { \rho } ^ { - 1 / 2 } F _ { d _ { P ^ { \star } } ^ { - } } F _ { \rho } ^ { - 1 / 2 } \} \otimes I _ { k } \left( k = \mathrm { r a n k } ( \mu ( V ) \mu ( V ) ^ { \top } ) \right) . } \end{array}
+$$
+
+Here, $I _ { k }$ is a diagonal matrix s.t. $k \in \mathbb { N } ^ { + }$ values in the diagonal entries are 1 and the rest of values are 0. Then, the maximum singular value of $\{ F _ { \rho } ^ { - 1 / 2 } F _ { d _ { P } ^ { \pi } \star } \overline { { F } } _ { \rho } ^ { - 1 / 2 } \} \otimes I _ { k }$ is equal to the one of $\{ F _ { \rho } ^ { - 1 / 2 } F _ { d _ { P } ^ { \pi } \star } F _ { \rho } ^ { - 1 / 2 } \}$ . This is equal to
+
+$$
+\operatorname* { s u p } _ { x } { \frac { x ^ { \top } F _ { d _ { P } ^ { \pi } \star } x } { x ^ { \top } F _ { \rho } x } }
+$$
+
+Hence, the fourth statement is concluded.
+
+Lemma 11 (Distribution shift lemma). Suppose $A _ { 1 } , A _ { 2 } , A _ { 3 }$ are semipositive definite matrices:
+
+$$
+\mathrm { T r } ( A _ { 1 } A _ { 2 } ) \le \sigma _ { \mathrm { m a x } } ( A _ { 3 } ^ { - 1 / 2 } A _ { 1 } A _ { 3 } ^ { - 1 / 2 } ) \mathrm { T r } ( A _ { 3 } A _ { 2 } ) .
+$$
+
+Note
+
+$$
+\sigma _ { \operatorname* { m a x } } ( A _ { 3 } ^ { - 1 / 2 } A _ { 1 } A _ { 3 } ^ { - 1 / 2 } ) = \operatorname* { s u p } _ { x \in \mathbb { R } ^ { d } } \frac { x ^ { \top } A _ { 1 } x } { x ^ { \top } A _ { 3 } x } .
+$$
+
+Proof.
+
+$$
+\begin{array} { r l } & { \mathrm { T r } ( A _ { 1 } A _ { 2 } ) = \mathrm { T r } ( A _ { 1 } ^ { 1 / 2 } A _ { 2 } A _ { 1 } ^ { 1 / 2 } ) = \mathrm { T r } ( A _ { 1 } ^ { 1 / 2 } A _ { 3 } ^ { - 1 / 2 } A _ { 3 } ^ { 1 / 2 } A _ { 2 } A _ { 3 } ^ { 1 / 2 } A _ { 3 } ^ { - 1 / 2 } A _ { 1 } ^ { 1 / 2 } ) } \\ & { = \mathrm { T r } ( A _ { 3 } ^ { - 1 / 2 } A _ { 1 } A _ { 3 } ^ { - 1 / 2 } A _ { 3 } ^ { 1 / 2 } A _ { 2 } A _ { 3 } ^ { 1 / 2 } ) . } \end{array}
+$$
+
+In addition, for any semipositive definite matrices $A , B$ we have
+
+$$
+\mathrm { T r } ( A B ) = \mathrm { T r } ( U \Lambda U ^ { \top } B ) = \mathrm { T r } ( \Lambda U ^ { \top } B U ) \le \sigma _ { \operatorname* { m a x } } ( \Lambda ) \mathrm { T r } ( U ^ { \top } B U ) = \sigma _ { \operatorname* { m a x } } ( A ) \mathrm { T r } ( B ) ,
+$$
+
+where $U \Lambda U ^ { \top }$ is the SVD decomoposition of $A$ . This concludes that
+
+$$
+\mathrm { T r } ( A _ { 1 } A _ { 2 } ) \le \sigma _ { \mathrm { m a x } } ( A _ { 3 } ^ { - 1 / 2 } A _ { 1 } A _ { 3 } ^ { - 1 / 2 } ) \mathrm { T r } ( A _ { 3 } A _ { 2 } ) .
+$$
+
+The following lemma is useful to obtain the generalized result of Theorem 1. The proof is given in (Wainwright, 2019, Theorem 3.27). We first define
+
+$$
+\begin{array} { r l } & { Z = \underset { f \in \mathcal { F } } { \operatorname* { s u p } } \left| \{ \mathbb { E } _ { \mathcal { D } } - \mathbb { E } _ { \rho } \} [ f ] \right. } \\ & { \Sigma ^ { 2 } = \underset { f \in \mathcal { F } } { \operatorname* { s u p } } \mathbb { E } _ { \mathcal { D } } [ \{ f ( s , a ) - \mathbb { E } _ { \rho } [ f ( s , a ) ] \} ^ { 2 } ] , \sigma ^ { 2 } = \underset { f \in \mathcal { F } } { \operatorname* { s u p } } \mathrm { v a r } [ f ( s , a ) ] . } \end{array}
+$$
+
+Lemma 12 (Functional Bernstein’s inequality: Talagrand concentration inequality for empirical process). Suppose $\| f \| _ { \infty } \leq B$ . With probability $1 - \delta$ ,
+
+$$
+| Z - \mathbb { E } [ Z ] | \leq \Sigma ^ { 2 } { \sqrt { \frac { \log ( c / \delta ) } { n } } } + { \frac { B \log ( c / \delta ) } { n } } .
+$$
+
+As an immediate corollary,
+
+$$
+| Z - \mathbb { E } [ Z ] | \leq \{ \sigma ^ { 2 } + B \mathbb { E } [ Z ] \} \sqrt { \frac { \log ( c / \delta ) } { n } } + \frac { B \log ( c / \delta ) } { n } .
+$$
\ No newline at end of file
diff --git a/md/dev/u03xn1COsO/u03xn1COsO.md b/md/dev/u03xn1COsO/u03xn1COsO.md
new file mode 100644
index 0000000000000000000000000000000000000000..84d5313c0c57557475c7d955affdb5eb655acfef
--- /dev/null
+++ b/md/dev/u03xn1COsO/u03xn1COsO.md
@@ -0,0 +1,1375 @@
+# Is ChatGPT a General-Purpose Natural Language Processing Task Solver?
+
+Chengwei $\mathbf { Q } \mathbf { i n } ^ { \dag } ;$ ∗, Aston Zhang, Zhuosheng Zhang♣, Jiaao Chen♠, Michihiro Yasunaga♦, Diyi Yang♦
+
+†Nanyang Technological University,♣Shanghai Jiao Tong University Georgia Institute of Technology, ♦ Stanford University
+
+# Abstract
+
+Spurred by advancements in scale, large language models (LLMs) have demonstrated the ability to perform a variety of natural language processing (NLP) tasks zero-shot—i.e., without adaptation on downstream data. Recently, the debut of ChatGPT 1 has drawn a great deal of attention from the natural language processing (NLP) community due to the fact that it can generate high-quality responses to human input and self-correct previous mistakes based on subsequent conversations. However, it is not yet known whether ChatGPT can serve as a generalist model that can perform many NLP tasks zero-shot. In this work, we empirically analyze the zero-shot learning ability of ChatGPT by evaluating it on 20 popular NLP datasets covering 7 representative task categories. With extensive empirical studies, we demonstrate both the effectiveness and limitations of the current version of ChatGPT. We find that ChatGPT performs well on many tasks favoring reasoning capabilities (e.g., arithmetic reasoning) while it still faces challenges when solving specific tasks such as sequence tagging. We additionally provide in-depth analysis through qualitative case studies.
+
+# 1 Introduction
+
+Large language models (LLMs) have been shown to be able to solve a variety of natural language processing (NLP) tasks zero shot—i.e., without relying on any training data for a given downstream task—by conditioning the model on appropriate prompts (Brown et al., 2020; Chowdhery et al., 2022a). The ability to perform new tasks based on instructions can be seen as an important step towards artificial general intelligence (Goertzel, 2014). Despite achieving reasonable performance in some cases, current LLMs are still prone to various mistakes in zero-shot learning. In addition, the format of the prompt can have a substantial impact—for example, simply adding “Let’s think step by step” (Kojima et al., 2022) has been shown to significantly improve the performance of InstructGPT (Ouyang et al., 2022) on reasoning tasks. These limitations illustrate that current LLMs are not truly general-purpose language systems.
+
+Recently, the ChatGPT LLM released by OpenAI has attracted a great deal of attention from the NLP community. ChatGPT was created by training a GPT-3.5 series model through reinforcement learning from human feedback (RLHF) (Christiano et al., 2017) (similarly to InstructGPT). RLHF mainly includes three steps: training a language model with supervised learning, collecting comparison data based on human preferences and training a reward model, and optimizing the language model against the reward model using reinforcement learning (Ouyang et al., 2022). Through RLHF training, ChatGPT has been observed to have impressive capabilities in various aspects, including generating high-quality responses to human input, rejecting inappropriate questions, and self-correcting previous errors based on subsequent conversations (Guo et al., 2023).
+
+While ChatGPT shows strong dialogic capabilities, it still remains unclear to the NLP community whether ChatGPT attains better zero-shot generalization compared with existing LLMs. To fill in this research gap, we systematically study the zeroshot learning capability of ChatGPT by evaluating it on a large collection of NLP datasets covering 7 representative task categories, including reason$\mathrm { i n g } ^ { 2 }$ , natural language inference, question answering (reading comprehension), dialogue, summarization, named entity recognition, and sentiment analysis. With extensive experiments, we aim to answer the following research questions:
+
+
+Figure 1: Performance of ChatGPT, GPT-3.5, and models fine-tuned with task-specific data for 20 different datasets. For each reasoning dataset, the better result between zero-shot and zero-shot chain-of-thought is shown. Measures of SAMsum, CoNLL03, and the rest are ROUGE-1/2/L average, F1, accuracy, respectively.
+
+• Is ChatGPT a general-purpose NLP task solver? On what types of tasks does ChatGPT perform well?
+• If ChatGPT fell behind other models on certain tasks, why?
+
+To answer these questions, we empirically compare the performance of ChatGPT (gpt-3.5-turbo) and the previous GPT-3.5 model (text-davinci003). In addition, we report zero-shot, fine-tuned, or few-shot fine-tuned results from recent work such as FLAN (Wei et al., 2021), T0 (Sanh et al., 2021b), and PaLM (Chowdhery et al., 2022b).
+
+Key takeaways To the best of our knowledge, this is the first study of the ChatGPT’s zero-shot capabilities on a diverse range of NLP tasks, aiming to provide a profile of ChatGPT. The key findings and insights are summarized as follows:
+
+• Although ChatGPT shows some capability as a generalist model that can perform multiple tasks (Zhang et al., 2021), it often performs worse than models that are fine-tuned on a given task (Section 4.3 and Figure 1).
+
+• The superior reasoning capability of ChatGPT is empirically substantiated in arithmetic reasoning tasks (Section 4.2.1). However, ChatGPT often underperforms GPT-3.5 in commonsense, symbolic, and logical reasoning tasks.
+
+• ChatGPT outperforms GPT-3.5 for natural language inference tasks (Section 4.2.3) and question answering (reading comprehension) tasks (Section 4.2.4) that favor reasoning capabilities, such as in determining logical relationships within text pairs. Specifically, ChatGPT is better at handling factually consistent text (i.e., better at classifying entailment rather than nonentailment).
+
+• ChatGPT is superior to GPT-3.5 for dialogue tasks (Section 4.2.5).
+
+• ChatGPT generates longer summaries and performs worse than GPT-3.5 for summarization tasks. However, explicitly limiting summary length in the zero-shot instruction harms the summarization quality, leading to even worse performance (Section 4.2.6).
+
+• Despite showing promise as generalist models, both ChatGPT and GPT-3.5 face challenges on certain tasks such as sequence tagging (Sec
+
+tion 4.2.7).
+
+• ChatGPT’s sentiment analysis ability is better than that of GPT-3.5 (Section 4.2.8).
+
+# 2 Related Work
+
+This work mainly explores the zero-shot learning capability of ChatGPT on a diverse collection of datasets including reasoning and classic NLP tasks. In light of this, we review three lines of research that form the basis of this work: large language models, zero-shot learning, and chain-of-thought prompting for reasoning.
+
+# 2.1 Large Language Models
+
+Ever since Brown et al. (2020); Radford et al. (2019) demonstrated that language models can perform a variety of tasks without any gradient updates by providing the model with a textual instruction (zero-shot) and/or a few examples (fewshot), a great deal of work has focused on developing better large language models (LLMs). One line of work has aimed to explore the benefits of scaling up LLMs, including Megatron-turing NLG (Smith et al., 2022) with 530 billion parameters, Gopher (Rae et al., 2021) with 280 billion parameters, and PaLM Chowdhery et al. (2022b) with 540 billion parameters. The benefits of this scale have born out on stronger performance on more difficult tasks, e.g. the finding that PaLM outperformed average humans on the challenging BIGbench benchmark (Srivastava et al., 2022). These LLMs also form the basis of better models, such as Minerva (Lewkowycz et al., 2022) which achieved state-of-the-art performance on various technical benchmarks. Rather than scaling up model size alone, a separate line of research aims to attain better performance with smaller models through longer training (Hoffmann et al., 2022) or alternative objectives Tay et al. (2022). One particularly fruitful direction has been training LLMs with supervision (Sanh et al., 2021b; Wei et al., 2021; Mishra et al., 2022; Chung et al., 2022) and/or human feedback (Ouyang et al., 2022). The strong performance of LLMs has led to a significant amount of work analyzing the abilities and behaviors of LLMs (Webson and Pavlick, 2022; Min et al., 2022; Liang et al., 2022).
+
+# 2.2 Zero-Shot Learning
+
+Zero-shot learning aims to solve unseen tasks without labeled training examples. It results in a big challenge for models as they typically rely on large amounts of training data. Prior methods to solve zero-shot learning can be mainly divided into two categories: (i) model-based methods focused on how to directly learn a model for unseen samples (Fu et al., 2017; Wang et al., 2018); and $( i i )$ instance-based methods tried to obtain labeled instances for unseen tasks to improve model learning (Zhang et al., 2017; Ye and Guo, 2017). More recent work has demonstrated the superiority of LLMs for zero-shot learning (Brown et al., 2020; Wei et al., 2021; Chowdhery et al., 2022b). The most recent breakthrough of LLMs is the debut of ChatGPT, which has shown amazing ability in various aspects related to dialogue. Going a step further, we explore the zero-shot learning capability of ChatGPT on different tasks beyond dialogue in this work.
+
+# 2.3 Chain-of-Thought Prompting
+
+Chain-of-thought (CoT) prompting induces LLMs to generate intermediate reasoning steps before answering (Wei et al., 2022). According to whether there are manual demonstrations, current CoT prompting methods can be divided into two main categories: manual-CoT and zero-Shot-CoT. In manual-CoT, LLMs perform CoT reasoning with manually designed demonstrations (Wei et al., 2022). Least-to-most prompting (Zhou et al., 2022) decomposed complex problems into subproblems and then sequentially solved the subproblems. Wang et al. (2022b) introduced selfconsistency to sample multiple reasoning paths, and then conducted a majority vote to determine the final answer. To generate more diverse outputs, Li et al. (2022a) and Wang et al. (2022a) explored applying randomness in the input space. In zero-Shot-CoT, Kojima et al. (2022) demonstrated that LLMs are decent zero-shot reasoners by leveraging self-generated rationales. The effectiveness of self-generated rationales was also verified by STaR (Zelikman et al., 2022), which enabled the model to self-improve through its own generated rationales. Zhang et al. (2023a) proposed AutoCoT to automatically generate rationales from test questions. Most recent studies mainly focused on how to improve manual-CoT, including optimizing the demonstration selection (Rubin et al., 2022; Fu et al., 2022; Lu et al., 2022b) and optimizing the quality of reasoning chains (Khot et al., 2022; Chen et al., 2022). In addition, researchers also studied the feasibility of adopting CoT in multilingual scenarios (Shi et al., 2022) and in smaller language models (Magister et al., 2022; Ho et al., 2022). More recently, Zhang et al. (2023b) proposed Multimodal-CoT that incorporates vision features in CoT reasoning, with the model under 1 billion parameters outperforming GPT-3.5 by $16 \%$ and even surpassing human performance on the ScienceQA benchmark (Lu et al., 2022a).
+
+
+Figure 2: Instructions and input formats of six different categories of tasks (sentiment analysis, natural language inference, named entity recognition, question answering, dialogue, and summarization). The task instructions are taken from or inspired by Brown et al. (2020), Ouyang et al. (2022), Zhang et al. (2023a) and Ding et al. (2022). We color the instructions in blue. After reading the entire input (circled by the green dashed box), the model generates an answer.
+
+
+Figure 3: Illustration of reasoning tasks. We show the instruction of AQUA-RAT (Ling et al., 2017) in this figure. Other reasoning tasks have similar instructions, e.g., “The answer (arabic numerals) is” for MultiArith (Roy and Roth, 2015). Note that we also conduct zero-shot chain-of-thought (zero-shot-CoT) experiments with ChatGPT and GPT-3.5 for reasoning tasks (right part).
+
+# 3 Methodology
+
+As mentioned in Section 1, we mainly compare the zero-shot learning performance of ChatGPT (gpt-3.5-turbo) and GPT-3.5 (text-davinci-003) on different tasks. Given a task instruction $P$ and a test problem $X$ that are concatenated as the input, the model $f$ is expected to generate a target text $Y ~ = ~ f ( P , X )$ to address the test problem. The instructions and input formats of different tasks are shown in Figure 2 and 3. For example, when the model performs sentiment analysis tasks, the task instruction $P$ is “For each snippet of text, label the sentiment of the text as positive or negative. The answer should be exact ‘positive’ or ‘negative’.”. After reading the instruction $P$ and the input $X$ “it ’s a stunning lyrical work of considerable force and truth.”, the model is expected to generate the output $Y$ “positive”.
+
+Different from this single-stage prompting method, we use the same two-stage prompting as Kojima et al. (2022) for zero-shot-CoT. In the first stage, we adopt “Let’s think step by step.” as the instruction $P _ { 1 }$ to induce the model to generate the rationale $R$ . In the second stage, we use the selfgenerated rationale $R$ along with the original input $X$ and the instruction $P _ { 1 }$ as the new input to guide the model to generate the final answer. A new instruction $P _ { 2 }$ , e.g., “Therefore, among A through E, the answer is”, serves as the trigger sentence for extracting the answer. All task instructions are taken from or inspired by Brown et al. (2020), Ouyang et al. (2022), Zhang et al. (2023a) and Ding et al. (2022).
+
+# 4 Experiments
+
+In this section, we first describe the tasks and datasets, and then present the experimental results.
+
+# 4.1 Tasks and Datasets
+
+We evaluate ChatGPT and GPT-3.5 with 20 different datasets covering 7 representative task categories: reasoning (MultiArith (Roy and Roth, 2015), GSM8K (Cobbe et al., 2021), AddSub (Hosseini et al., 2014), AQUA-RAT (Ling et al., 2017), SingleEq (Koncel-Kedziorski et al., 2015), SVAMP (Patel et al., 2021), CSQA (Talmor et al., 2019), StrategyQA (Geva et al., 2021), COPA (Roemmele et al., 2011), Last Letter Concatenation (Wei et al., 2022), Coin Flip (Wei et al., 2022), Date Understanding, and Tracking Shuffled Objects (Srivastava et al., 2022)), natural language inference (RTE (Dagan et al., 2006) and CB (De Marneffe et al., 2019)), question answering (BoolQ (Clark et al., 2019)), dialogue (MuTual (Cui et al., 2020)), summarization (SAMSum (Gliwa et al., 2019)), named entity recognition (CoNLL03 (Sang and De Meulder, 2003)), and sentiment analysis (SST2 (Socher et al., 2013)). Among these datasets, there are 4 categories of reasoning tasks: arithmetic, commonsense, symbolic, and logical reasoning. The information of different datasets is shown in Table 1. By default we use the test split for all datasets if the labels are available for evaluation. For COPA and CommonsenseQA, we use the validation split. For StrategyQA, we use the open-domain setting (question-only set) from BIG-bench collaboration (2021) following Wei et al. (2022); Zhang et al. (2023a); Kojima et al. (2022).
+
+
Arithmetic
Commonsense
Symbolic
MultiArith GSM8K AddSub AQuA SingleEq
SVAMP CSQA
StrategyQA
COPA
Letter
Coin
Measure
Accuracy
# Samples
600
1319
395
254
508
1000
1221
2290
100
500
500
Logical
NLI
QA
Dialogue
Sum
NER
Sentiment
Date
Object
RTE
CB
BoolQ
MuTual
SAMSum
CoNLL
SST2
Measure
Accuracy
ROUGE
F1
Accuracy
#Samples
369
750
277
56
3270
886
819
3453
872
+
+Table 1: Information of different datasets. # Samples refers to the number of test samples.
+
+
+Figure 4: A case where ChatGPT corrects the mistake made by GPT-3.5. We color the correct and wrong responses in green and red, respectively.
+
+# 4.2 Experimental Results
+
+We now present and analyze the empirical results of different categories of tasks.
+
+# 4.2.1 Arithmetic Reasoning
+
+The accuracy of ChatGPT and GPT-3.5 without or with chain-of-thought (CoT) on six arithmetic reasoning datasets is shown in Table 2. ChatGPT outperforms GPT-3.5 on five out of six datasets without CoT, demonstrating its strong arithmetic reasoning ability. Figure 4 shows a case where GPT-3.5 gives a wrong answer. On the left part of the figure, ChatGPT accurately understands “lost 8 lives” and “got 39 more lives”, resulting in the correct answer “74 lives”. However, GPT-3.5 generates a wrong answer “120 lives” that is irrelevant to the information provided, indicating that GPT3.5 does not understand the input question. Furthermore, ChatGPT achieves much better performance than GPT-3.5 when using CoT in all cases.
+
+# 4.2.2 Commonsense, Symbolic, and Logical Reasoni ng
+
+Table 3 reports the accuracy of ChatGPT compared with popular LLMs on seven commonsense, symbolic and logical reasoning datasets. We make two key observations as follows:
+
+First, using CoT may not always provide better performance in commonsense reasoning tasks. According to the analysis in Kojima et al. (2022), CoT methods often produce flexible and reasonable rationales but the final prediction is not correct in commonsense reasoning tasks. The results imply that commonsense reasoning tasks may require more fine-grained background knowledge and the issue can be mitigated by scaling model size (Wei et al., 2022), mixture of denoisers (Tay et al., 2022), and majority voting on multiple predictions (selfconsistency) (Wang et al., 2022b).
+
+Second, different from arithmetic reasoning, ChatGPT performs worse than GPT-3.5 in many cases, indicating that the corresponding capabilities of GPT-3.5 are stronger.
+
+# 4.2.3 Natural Language Inference
+
+It is worth mentioning that different from sentiment analysis tasks (Section 4.2.8), after specifying the desired output format (“entail” or “not entail”) of natural language inference in task instructions, ChatGPT and GPT-3.5 can produce responses that exactly follow the requirement. Table 4 presents the results of different models on two natural language inference tasks: RTE and CB. We can see that ChatGPT can achieve much better performance than GPT-3.5, FLAN, T0, and PaLM under the zero-shot setting. This demonstrates the superior zero-shot capability of ChatGPT to infer sentence relations.
+
+To take a closer look at why ChatGPT outperforms GPT-3.5 by a large margin, we report the per-class accuracy of both models in Table 5. Chat
+
+Table 2: Accuracy $( \% )$ of different models without CoT (N/A) and with CoT on arithmetic reasoning datasets. Few-shot results are from Wei et al. (2022). We compare ChatGPT with popular techniques including UL2-20B, LaMDA-137B, PaLM-540B, and the different GPT-3.5 variants.
+
+
Model
MultiArith
GSM8K
AddSub
AQUA-RAT
SingleEq
SVAMP
N/A
CoT
N/A
CoT
N/A
CoT
N/A
CoT
N/A
CoT
N/A
CoT
Zero-Shot Performance
text-davinci-002
22.7
78.7
12.5
40.7
77.0
74.7
22.4
33.5
78.7
78.7
58.8
63.7
text-davinci-003
24.2
83.7
12.6
59.5
87.3
81.3
28.0
40.6
82.3
86.4
64.7
73.6
ChatGPT
79.8
95.8
23.8
78.9
88.6
83.5
28.0
53.5
89.4
91.5
74.8
77.5
Few-Shot Performance
UL2
5.0
10.7
4.1
4.4
18.5
18.2
20.5
23.6
18.0
20.2
10.1
12.5
LaMDA
7.6
44.9
6.5
14.3
43.0
51.9
25.5
20.6
48.8
58.7
29.5
37.5
text-davinci-002
33.8
91.7
15.6
46.9
83.3
81.3
24.8
35.8
82.7
86.6
65.7
68.9
Codex
44.0
96.2
19.7
63.1
90.9
90.9
29.5
45.3
86.8
93.1
69.9
76.4
PaLM
42.2
94.7
17.9
56.9
93.9
91.9
25.2
35.8
86.5
92.3
69.4
79.0
+
+Table 3: Accuracy $( \% )$ of different models without CoT (N/A) and with CoT on commonsense, symbolic and logical reasoning datasets. Few-shot results are from Wei et al. (2022). We compare ChatGPT with popular techniques including UL2-20B, LaMDA-137B, PaLM-540B, and the different GPT-3.5 variants.
+
+
Model
Commonsense
Symbolic
Logical
CSQA
StrategyQA
COPA
Last Letter
Coin Flip
Date
Object
N/A
CoT
N/A
CoT
N/A
CoT
N/A
CoT
N/A
CoT
N/A
CoT
N/A
CoT
Zero-Shot Performance
text-davinci-002
72.6
64.6
54.3
54.8
74.0
85.0
0.2
57.6
53.8
91.4
49.3
67.5
31.3
52.9
text-davinci-003
74.9
70.0
57.2
61.1
93.0
64.0
0.0
54.4
49.0
97.8
56.6
77.0
27.1
39.7
ChatGPT
73.7
71.5
61.1
55.5
78.0
82.0
0.4
70.2
21.8
65.8
48.0
72.6
31.6
58.7
Few-Shot Performance
UL2
34.2
51.4
59.0
53.3
0.6
18.8
70.4
67.1
13.5
14.0
LaMDA
53.6
57.9
62.4
65.4
5.8
77.5
49.0
99.6
21.5
26.8
text-davinci-002
79.5
73.5
65.9
65.4
=
0.2
59.0
57.2
97.2
43.8
52.1
Codex
82.3
77.9
67.1
73.2
1
-
1
-
49.0
64.8
PaLM
78.1
79.9
68.6
77.8
95.0
-
7.6
99.4
98.1
100.0
49.0
65.3
23.9
+
+Table 4: Accuracy $( \% )$ of different models on natural language inference tasks (RTE and CB). We compare zero-shot ChatGPT with recent models including GPT-3.5 (zero-shot) (Brown et al., 2020), FLAN (zeroshot) (Wei et al., 2021), T0 (zero-shot) (Sanh et al., 2021a), PaLM (zero-shot) (Chowdhery et al., 2022b) and PaLM-540B (fine-tuned) (Chowdhery et al., 2022b).
+
+
Model
Zero-Shot
Fine-Tuned
ChatGPT
GPT-3.5
FLAN
TO
PaLM
PaLM
RTE
85.9
80.1
84.1
80.8
72.9
95.8
CB
89.3
83.9
83.9
70.1
51.8
100.0
+
+Table 6: Accuracy of different models on question answering (BoolQ). We compare ChatGPT with popular methods including (i) zero-shot methods: Gopher (Rae et al., 2021), Chinchilla (Hoffmann et al., 2022), GPT3.5, FLAN (Wei et al., 2021), and PaLM (Chowdhery et al., 2022b); (ii) fine-tuned models: CompassMTL (Zhang et al., 2022), T5 (Raffel et al., 2020), DeBERTa (He et al., 2020).
+
+
Model
Zero-Shot
Fine-Tuned
ChatGPT
GPT-3.5
Gopher
Chinchilla
FLAN
PaLM
CompassMTL
T5-11B
DeBERTa
Accuracy(%)
87.3
84.7
79.3
83.7
82.9
88.0
88.3
91.2
90.4
+
+Table 5: Per-class accuracy $( \% )$ of ChatGPT and GPT3.5 on RTE.
+
+
Model ChatGPT
GPT-3.5
Entailment
92.5
70.6
Not Entailment
78.6
90.8
+
+GPT performs much better than GPT-3.5 when the premise does entail the hypothesis $( + 2 1 . 9 \% )$ . However, it underperforms GPT-3.5 on the class “Not Entailment” $( - 1 2 . 2 \% )$ . So we can see that ChatGPT is better at handling factual input (also favored by humans in general), which might be related to the preference of the human feedback in its own RLHF design during model training.
+
+# 4.2.4 Question Answering
+
+We report the accuracy of different models on the BoolQ dataset (reading comprehension) in Table 6. ChatGPT outperforms GPT-3.5 by over $2 \%$ . This is consistent with the results on natural language inference. As illustrated in Clark et al. (2019), the questions in BoolQ require difficult entailment-like inference to solve. Therefore, ChatGPT can better handle tasks favoring reasoning capabilities.
+
+Table 7: Per-class accuracy $( \% )$ of ChatGPT and GPT3.5 on BoolQ. The number in parentheses indicates the improvement over GPT-3.5.
+
+
Model
ChatGPT
GPT-3.5
Yes
88.9 (+7.8)
81.1
No
84.6 (-6.0)
90.6
+
+
+Figure 5: A case where ChatGPT answers correctly while GPT-3.5 makes mistakes. The correct and wrong responses are colored in green and red, respectively. GPT-3.5 appends irrelevant information $^ { 6 6 } \$ 2$ discount for two tickets” which is not mentioned in the context.
+
+Table 7 shows the per-class accuracy of ChatGPT and GPT-3.5. We can see that ChatGPT significantly outperforms GPT-3.5 on the class “Yes”, indicating that ChatGPT prefers handling factual input. In addition, although we require ChatGPT to output “Yes” or “No” via task instructions, it still generates some other responses, e.g., “It is unclear”, which could be one of the reasons why ChatGPT performs worse than PaLM.
+
+
+Figure 6: Comparison of summaries generated by GPT3.5 and ChatGPT.
+
+verbose than those from GPT-3.5, resulting in lower ROUGE scores.
+
+To tes t our hyp othesis , we calculate the aver age number of words for ground truth (20.0), GPT-3.5’s responses (23.3), and ChatGPT’s responses (36.6). Obviously, ChatGPT’s responses are much longer. This may result from its RLHF design. Figure 6 shows several cases where the output of ChatGPT is much longer than that of GPT-3.5. We can observe that there is much redundant information in the output of ChatGPT.
+
+Furthermore, we conduct controlled experiments with a new instruction that explicitly limits the output length: “Please summarize the given conversation in no more than 25 words.” Although the average number of words in ChatGPT’s answers is reduced to 22.8, the average score of ROUGE$1 / 2 / \mathrm { L }$ drops from 31.0 to 30.6. So we conclude that controlling the length of summaries via zero-shot instructions may harm ChatGPT’s summarization ability.
+
+# 4.2.5 Dialogue
+
+We show the accuracy of ChatGPT and GPT-3.5 on the MuTual dataset (multi-turn dialogue reasoning) in Table 8. As expected, ChatGPT achieves better performance than GPT-3.5—this is consistent with the impressive dialogue ability of ChatGPT that has already been observed in the community.
+
+As a concrete example, Figure 5 shows a case where ChatGPT answers correctly while GPT-3.5 is struggling. We can see that ChatGPT is able to reason more effectively about the given context without adding irrelevant information. This reiterates the superior reasoning capability of ChatGPT.
+
+# 4.2.6 Summarization
+
+For the summarization task, the ROUGE scores of ChatGPT and GPT-3.5 on the SAMSum dataset are reported in Table 9. Surprisingly, ChatGPT underperforms GPT-3.5 across all measures. We hypothesize that this is due to the fact that we do not explicitly control the output length of ChatGPT. The responses from ChatGPT are usually more
+
+# 4.2.7 Named Entity Recognition
+
+Table 10 reports the zero-shot performance of ChatGPT and GPT-3.5 on CoNLL03, a widely-used named entity recognition dataset. We can see that the overall performance of ChatGPT and GPT-3.5 is quite similar. Unfortunately, they fail to achieve satisfactory results on each named entity type compared to previous fine-tuning methods. This shows that current LLMs, although deemed as generalist models, still face challenges in solving specific tasks, such as sequence tagging.
+
+Specifically, ChatGPT outperforms GPT-3.5 for classes “Per” (“Person”) and “Org” (“Organization”) while performing worse than GPT-3.5 on the class “Loc” (“Location”). Neither model shows practical value in identifying the “Misc” (“Miscellaneous Entity”) class. Figure 7 illustrates several failure cases of “Misc”. On the left part of the figure, LLMs recognize “Bowling” as a miscellaneous entity while the ground truth is ‘None’. However, “Bowling” does belong to the entity type “ball”, which can be regarded as a miscellaneous type.
+
+Table 8: Accuracy on the dialogue task (MuTual). Besides GPT-3.5, we also compare ChatGPT with previous popular methods including (i) unsupervised method: TF-IDF (Lowe et al., 2015); (ii) fine-tuned models: Dual LSTM (Lowe et al., 2015), DAM (Zhou et al., 2018), SMN (Wu et al., 2017), BERT (Devlin et al., 2019), RoBERTa (Liu et al., 2019), fine-tuned GPT-2 (GPT-2-FT) (Radford et al., 2019), MDFN (Liu et al., 2021), and BiDeN (Li et al., 2022b).
+
+
Model
Zero-Shot ChatGPT
Unsupervised TF-IDF
Fine-Tuned
GPT-3.5
|Dual LSTM DAM SMN BERT RoBERTa
GPT-2-FT MDFN BiDeN
Accuracy (%)
76.2
75.2
27.6
26.6
23.9
27.4
65.7
69.5
39.8
92.3
93.5
+
+Table 9: ROUGE scores of different models on the summarization dataset: SAMSum. We compare zeroshot ChatGPT with GPT-3.5 (Zero-Shot), BART-large (Fine-Tuned) (Lewis et al., 2019), and CODA (finetuned) (Chen and Yang, 2021).
+
+
Model
zero-shot
fine-tuned
ChatGPT
GPT-3.5
BART
CODA
ROUGE-1
42.4
44.0
49.1
50.1
ROUGE-2
17.6
18.5
24.3
24.6
ROUGE-L
33.0
34.7
45.8
46.9
+
+Table 10: F1 scores of different models on named entity recognition (CoNLL03). “Loc”, “Per”, “Org”, and “Misc” stand for “Location”, “Person”, “Organization”, and “Miscellaneous Entity”, respectively. We also compare the zero-shot ChatGPT with GPT3.5 (zero-shot) and recent state-of-the-art named entity recognition models including Flair (Akbik et al., 2018), LUKE (fine-tuned) (Yamada et al., 2020), and ACE (fine-tuned) (Wang et al., 2020).
+
+
Model
Zero-Shot
Fine-Tuned
ChatGPT
GPT-3.5
Flair
LUKE
ACE
All
53.2
53.5
93.0
93.9
94.6
Loc
66.7
67.1
94.0
-
=
Per
87.2
78.0
97.4
=
Org
51.4
50.0
91.9
Misc
4.1
4.8
83.0
=
=
+
+On the right part, although “AMERICAN FOOTBALL CONFERENCE” is indeed an organization, it is not recognized by the ground truth annotation, indicating that the ground truth annotation might need cleaning (although in rare cases). Therefore, the poor performance on the class “Miscellaneous Entity” may be partly due to the different understanding on the scope of entities between LLMs and the ground truth annotation of the specific task dataset.
+
+In addition, we design new instructions that guide GPT-3.5 to generate different types of entities separately, leading to a much lower F1 score (34.8). This reiterates the challenges faced by LLMs in solving sequence tagging tasks.
+
+
+Figure 7: Example failure cases for the “Miscellaneous Entity” class (left for ChatGPT and right for GPT-3.5).
+
+# 4.2.8 Sentiment Analysis
+
+Table 12 compares the accuracy of different models on the sentiment analysis dataset: SST2. ChatGPT achieves much better performance than GPT-3.5. To look into why ChatGPT outperforms GPT-3.5, we calculate the per-class accuracy of both models. We can observe that the performance of ChatGPT on different classes is unbalanced. It outperforms GPT-3.5 by a large margin on negative samples while the performance on positively-labeled data comes close to that of GPT-3.5. We hypothesize that this difference is caused by the different training data of ChatGPT and GPT-3.5. In addition, although we explicitly specified that the answer should be exact “positive” or “negative” in task instructions (Figure 2), ChatGPT and GPT-3.5 still output some other answers, e.g., “neutral” and “mixed”, which partly explains why they perform much worse than FLAN.
+
+# 4.3 ChatGPT v.s. Full-Set or Few-Shot Fine-Tuning
+
+Table 11 shows the performance comparison between ChatGPT and the best previous full-set or few-shot fine-tuning method (among those reported in this work) for each individual task. ChatGPT underperforms previous fine-tuning methods in most cases, indicating that ChatGPT is still far from a perfect generalist.
+
+# 5 Conclusion
+
+We have empirically studied the zero-shot learning capabilities of ChatGPT on a large, diverse collection of datasets covering representative task categories. Extensive experimental results and analysis demonstrated the effectiveness and current limitations of ChatGPT in different types of NLP tasks. For example, as a powerful generalist model, on one hand, ChatGPT is good at reasoning and dialogue tasks; on the other hand, ChatGPT still faces challenges when solving specific tasks, such as sequence tagging. We hope that this study can inspire future works, such as leveraging the reasoning and dialogue capabilities of ChatGPT in NLP tasks and addressing limitations of generalist models in tasks where they currently struggle with.
+
+Table 11: Performance of ChatGPT, GPT-3.5 and the best previous full-set or few-shot fine-tuning method (among those investigated in this work) on different tasks. For each reasoning dataset, the better result between zero-shot and zero-shot chain-of-thought is shown.
+
+
Model MultiArith
GSM8K
Arithmetic
SingleEq
SVAMP
Symbolic
Logical
AddSub AQUA-RAT Accuracy
Last Letter Coin Flip Accuracy
DateObject Accuracy
ChatGPT
95.8
78.9
88.6
53.5
91.5 77.5
70.2
65.8
72.6
58.7
GPT-3.5
83.7
59.5
87.3
40.6
86.4
73.6
54.4 97.8
77.0
39.7
Fine-tuning
96.2
63.1
93.9
45.3
93.1
79.0
99.4 100.0
65.3
23.9
Model
Commonsense
NLI
QA
Dialogue
Summarization
NER
Sentiment
CSQA
StrategyQA
COPA
RTE CB
BoolQ
MuTual
SAMsum
CoNLL03
SST2
Accuracy
Accuracy
Accuracy
Accuracy
ROUGE
F1
Accuracy
ChatGPT
73.7
61.1
82.0
85.9
89.3
87.3
76.2
31.0
53.2
93.7
GPT-3.5
74.9
61.1
93.0
80.1
83.9
84.7
75.2
32.4
53.5
88.8
Fine-tuning
82.3
77.8
95.0
95.8
100.0
91.2
93.5
40.5
94.6
97.5
+
+Table 12: Accuracy $( \% )$ of different models on sentiment analysis (SST2). We compare zero-shot ChatGPT with recent models including GPT-3.5 (zeroshot) (Brown et al., 2020), FLAN (zero-shot) (Wei et al., 2021), and T5-11B (fine-tuned) (Raffel et al., 2019).
+
+
Model
Zero-Shot
Fine-Tuned
ChatGPT
GPT-3.5
FLAN
T5-11B
All
93.7
88.8
94.6
97.5
Pos
90.8
88.1
1
1
Neg
96.7
89.5
1
-
+
+# Limitations
+
+This work is an empirical study on the zero-shot learning ability of $\operatorname { C h a t G P T } ^ { 3 }$ , and it has several limitations. First, due to the cost of ChatGPT, this work excludes larger-scale datasets and more task categories, which might prevent further insights. Besides, we report the best result in the corresponding paper for models that are not publicly available (e.g., PaLM) and report the result based on the best prompt found for public models, which is consistent with the previous work (Wei et al., 2022; Kojima et al., 2022; Tay et al., 2022). A further improvement could be to explore more diverse prompt templates. Finally, it still remains unclear to us how ChatGPT’s few-shot in-context learning capability compares with its zero-shot learning ability across different tasks.
+
+# References
+
+Alan Akbik, Duncan Blythe, and Roland Vollgraf. 2018. Contextual string embeddings for sequence labeling. In Proceedings of the 27th international conference on computational linguistics, pages 1638–1649.
+
+BIG-bench collaboration BIG-bench collaboration. 2021. Beyond the imitation game: Measuring and extrapolating the capabilities of language models. https://github.com/google/BIG-bench. "Accessed: 2022-05-07".
+
+Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020. Language models are few-shot learners. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual.
+
+Jiaao Chen and Diyi Yang. 2021. Simple conversational data augmentation for semi-supervised abstractive dialogue summarization. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 6605–6616, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics.
+
+Wenhu Chen, Xueguang Ma, Xinyi Wang, and William W Cohen. 2022. Program of thoughts prompting: Disentangling computation from reasoning for numerical reasoning tasks. arXiv preprint arXiv:2211.12588.
+
+Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek Rao, Parker Barnes, Yi Tay, Noam Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Ben Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier Garcia, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Diaz, Orhan Firat, Michele Catasta, Jason Wei, Kathy Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. 2022a. Palm: Scaling language modeling with pathways.
+
+Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. 2022b. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311.
+
+Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. 2017. Deep reinforcement learning from human preferences. Advances in neural information processing systems, 30.
+
+Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, et al. 2022. Scaling instruction-finetuned language models. arXiv preprint arXiv:2210.11416.
+
+Christopher Clark, Kenton Lee, Ming-Wei Chang, Tom Kwiatkowski, Michael Collins, and Kristina Toutanova. 2019. BoolQ: Exploring the surprising difficulty of natural yes/no questions. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 2924–2936, Minneapolis, Minnesota. Association for Computational Linguistics.
+
+Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jerry Tworek, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. 2021. Training verifiers to solve math word problems.
+
+Leyang Cui, Yu Wu, Shujie Liu, Yue Zhang, and Ming Zhou. 2020. MuTual: A dataset for multi-turn dialogue reasoning. In Proceedings of the 58th Annual
+
+Meeting of the Association for Computational Linguistics, pages 1406–1416, Online. Association for Computational Linguistics.
+
+Ido Dagan, Oren Glickman, and Bernardo Magnini. 2006. The pascal recognising textual entailment challenge. In Machine Learning Challenges. Evaluating Predictive Uncertainty, Visual Object Classification, and Recognising Tectual Entailment: First PASCAL Machine Learning Challenges Workshop, MLCW 2005, Southampton, UK, April 11-13, 2005, Revised Selected Papers, pages 177–190. Springer.
+
+Marie-Catherine De Marneffe, Mandy Simons, and Judith Tonhauser. 2019. The commitmentbank: Investigating projection in naturally occurring discourse. In proceedings of Sinn und Bedeutung, volume 23, pages 107–124.
+
+Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis, Minnesota. Association for Computational Linguistics.
+
+Bosheng Ding, Chengwei Qin, Linlin Liu, Lidong Bing, Shafiq Joty, and Boyang Li. 2022. Is gpt-3 a good data annotator? arXiv preprint arXiv:2212.10450.
+
+Yao Fu, Hao Peng, Ashish Sabharwal, Peter Clark, and Tushar Khot. 2022. Complexity-based prompting for multi-step reasoning. arXiv preprint arXiv:2210.00720.
+
+Zhenyong Fu, Tao Xiang, Elyor Kodirov, and Shaogang Gong. 2017. Zero-shot learning on semantic class prototype graph. IEEE transactions on pattern analysis and machine intelligence, 40(8):2009–2022.
+
+Mor Geva, Daniel Khashabi, Elad Segal, Tushar Khot, Dan Roth, and Jonathan Berant. 2021. Did aristotle use a laptop? a question answering benchmark with implicit reasoning strategies. Transactions of the Association for Computational Linguistics, 9:346– 361.
+
+Bogdan Gliwa, Iwona Mochol, Maciej Biesek, and Aleksander Wawer. 2019. Samsum corpus: A humanannotated dialogue dataset for abstractive summarization. arXiv preprint arXiv:1911.12237.
+
+Ben Goertzel. 2014. Artificial general intelligence: concept, state of the art, and future prospects. Journal of Artificial General Intelligence, 5(1):1.
+
+Biyang Guo, Xin Zhang, Ziyuan Wang, Minqi Jiang, Jinran Nie, Yuxuan Ding, Jianwei Yue, and Yupeng Wu. 2023. How close is chatgpt to human experts? comparison corpus, evaluation, and detection. arXiv preprint arXiv:2301.07597.
+
+Pengcheng He, Xiaodong Liu, Jianfeng Gao, and Weizhu Chen. 2020. Deberta: Decoding-enhanced bert with disentangled attention. arXiv preprint arXiv:2006.03654.
+
+Namgyu Ho, Laura Schmid, and Se-Young Yun. 2022. Large language models are reasoning teachers. arXiv preprint arXiv:2212.10071.
+
+Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, et al. 2022. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556.
+
+Mohammad Javad Hosseini, Hannaneh Hajishirzi, Oren Etzioni, and Nate Kushman. 2014. Learning to solve arithmetic word problems with verb categorization. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 523–533, Doha, Qatar. Association for Computational Linguistics.
+
+Tushar Khot, Harsh Trivedi, Matthew Finlayson, Yao Fu, Kyle Richardson, Peter Clark, and Ashish Sabharwal. 2022. Decomposed prompting: A modular approach for solving complex tasks. arXiv preprint arXiv:2210.02406.
+
+Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. 2022. Large language models are zero-shot reasoners. In Thirty-sixth Conference on Neural Information Processing Systems (NeurIPS 2022).
+
+Rik Koncel-Kedziorski, Hannaneh Hajishirzi, Ashish Sabharwal, Oren Etzioni, and Siena Dumas Ang. 2015. Parsing algebraic word problems into equations. Transactions of the Association for Computational Linguistics, 3:585–597.
+
+Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. 2019. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension.
+
+Aitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, et al. 2022. Solving quantitative reasoning problems with language models. arXiv preprint arXiv:2206.14858.
+
+Yifei Li, Zeqi Lin, Shizhuo Zhang, Qiang Fu, Bei Chen, Jian-Guang Lou, and Weizhu Chen. 2022a. On the advance of making language models better reasoners. arXiv preprint arXiv:2206.02336.
+
+Yiyang Li, Hai Zhao, and Zhuosheng Zhang. 2022b. Back to the future: Bidirectional information decoupling network for multi-turn dialogue modeling. In The 2022 Conference on Empirical Methods in Natural Language Processing (EMNLP 2022).
+
+Percy Liang, Rishi Bommasani, Tony Lee, Dimitris Tsipras, Dilara Soylu, Michihiro Yasunaga, Yian Zhang, Deepak Narayanan, Yuhuai Wu, Ananya Kumar, et al. 2022. Holistic evaluation of language models. ArXiv preprint, abs/2211.09110.
+
+Wang Ling, Dani Yogatama, Chris Dyer, and Phil Blunsom. 2017. Program induction by rationale generation: Learning to solve and explain algebraic word problems. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 158–167, Vancouver, Canada. Association for Computational Linguistics.
+
+Longxiang Liu, Zhuosheng Zhang, Hai Zhao, Xi Zhou, and Xiang Zhou. 2021. Filling the gap of utteranceaware and speaker-aware representation for multiturn dialogue. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 13406–13414.
+
+Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692.
+
+Ryan Lowe, Nissan Pow, Iulian Vlad Serban, and Joelle Pineau. 2015. The ubuntu dialogue corpus: A large dataset for research in unstructured multi-turn dialogue systems. In Proceedings of the 16th Annual Meeting of the Special Interest Group on Discourse and Dialogue, pages 285–294.
+
+Pan Lu, Swaroop Mishra, Tony Xia, Liang Qiu, KaiWei Chang, Song-Chun Zhu, Oyvind Tafjord, Peter Clark, and Ashwin Kalyan. 2022a. Learn to explain: Multimodal reasoning via thought chains for science question answering. ArXiv preprint, abs/2209.09513.
+
+Pan Lu, Liang Qiu, Kai-Wei Chang, Ying Nian Wu, Song-Chun Zhu, Tanmay Rajpurohit, Peter Clark, and Ashwin Kalyan. 2022b. Dynamic prompt learning via policy gradient for semi-structured mathematical reasoning. arXiv preprint arXiv:2209.14610.
+
+Lucie Charlotte Magister, Jonathan Mallinson, Jakub Adamek, Eric Malmi, and Aliaksei Severyn. 2022. Teaching small language models to reason. ArXiv preprint, abs/2212.08410.
+
+Sewon Min, Xinxi Lyu, Ari Holtzman, Mikel Artetxe, Mike Lewis, Hannaneh Hajishirzi, and Luke Zettlemoyer. 2022. Rethinking the role of demonstrations: What makes in-context learning work? arXiv preprint arXiv:2202.12837.
+
+Swaroop Mishra, Daniel Khashabi, Chitta Baral, and Hannaneh Hajishirzi. 2022. Cross-task generalization via natural language crowdsourcing instructions. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 3470–3487.
+
+Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. 2022. Training language models to follow instructions with human feedback. arXiv preprint arXiv:2203.02155.
+
+Arkil Patel, Satwik Bhattamishra, and Navin Goyal. 2021. Are NLP models really able to solve simple math word problems? In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2080–2094, Online. Association for Computational Linguistics.
+
+Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. 2019. Language models are unsupervised multitask learners. OpenAI blog, page 9.
+
+Jack W Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, Francis Song, John Aslanides, Sarah Henderson, Roman Ring, Susannah Young, et al. 2021. Scaling language models: Methods, analysis & insights from training gopher. arXiv preprint arXiv:2112.11446.
+
+Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2019. Exploring the limits of transfer learning with a unified text-to-text transformer.
+
+Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. JMLR, 21(140):1–67.
+
+Melissa Roemmele, Cosmin Adrian Bejan, and Andrew S Gordon. 2011. Choice of plausible alternatives: An evaluation of commonsense causal reasoning. In AAAI spring symposium: logical formalizations of commonsense reasoning, pages 90–95.
+
+Subhro Roy and Dan Roth. 2015. Solving general arithmetic word problems. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 1743–1752, Lisbon, Portugal. Association for Computational Linguistics.
+
+Ohad Rubin, Jonathan Herzig, and Jonathan Berant. 2022. Learning to retrieve prompts for in-context learning. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2655–2671.
+
+Erik F Sang and Fien De Meulder. 2003. Introduction to the conll-2003 shared task: Language-independent named entity recognition. arXiv preprint cs/0306050.
+
+Victor Sanh, Albert Webson, Colin Raffel, Stephen H. Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, Manan Dey, M Saiful Bari, Canwen Xu, Urmish
+
+Thakker, Shanya Sharma Sharma, Eliza Szczechla, Taewoon Kim, Gunjan Chhablani, Nihal Nayak, Debajyoti Datta, Jonathan Chang, Mike Tian-Jian Jiang, Han Wang, Matteo Manica, Sheng Shen, Zheng Xin Yong, Harshit Pandey, Rachel Bawden, Thomas Wang, Trishala Neeraj, Jos Rozen, Abheesht Sharma, Andrea Santilli, Thibault Fevry, Jason Alan Fries, Ryan Teehan, Tali Bers, Stella Biderman, Leo Gao, Thomas Wolf, and Alexander M. Rush. 2021a. Multitask prompted training enables zero-shot task generalization.
+
+Victor Sanh, Albert Webson, Colin Raffel, Stephen H Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, et al. 2021b. Multitask prompted training enables zero-shot task generalization. arXiv preprint arXiv:2110.08207.
+
+Freda Shi, Mirac Suzgun, Markus Freitag, Xuezhi Wang, Suraj Srivats, Soroush Vosoughi, Hyung Won Chung, Yi Tay, Sebastian Ruder, Denny Zhou, et al. 2022. Language models are multilingual chain-of-thought reasoners. arXiv preprint arXiv:2210.03057.
+
+Shaden Smith, Mostofa Patwary, Brandon Norick, Patrick LeGresley, Samyam Rajbhandari, Jared Casper, Zhun Liu, Shrimai Prabhumoye, George Zerveas, Vijay Korthikanti, et al. 2022. Using deepspeed and megatron to train megatron-turing nlg 530b, a large-scale generative language model. arXiv preprint arXiv:2201.11990.
+
+Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, A. Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In Conference on Empirical Methods in Natural Language Processing.
+
+Aarohi Srivastava, Abhinav Rastogi, Abhishek Rao, Abu Awal Md Shoeb, Abubakar Abid, Adam Fisch, Adam R Brown, Adam Santoro, Aditya Gupta, Adrià Garriga-Alonso, et al. 2022. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models. arXiv preprint arXiv:2206.04615.
+
+Alon Talmor, Jonathan Herzig, Nicholas Lourie, and Jonathan Berant. 2019. CommonsenseQA: A question answering challenge targeting commonsense knowledge. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4149–4158, Minneapolis, Minnesota. Association for Computational Linguistics.
+
+Yi Tay, Mostafa Dehghani, Vinh Q Tran, Xavier Garcia, Dara Bahri, Tal Schuster, Huaixiu Steven Zheng, Neil Houlsby, and Donald Metzler. 2022. Unifying language learning paradigms. arXiv preprint arXiv:2205.05131.
+
+Xiaolong Wang, Yufei Ye, and Abhinav Gupta. 2018. Zero-shot recognition via semantic embeddings and knowledge graphs. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 6857–6866.
+
+Xinyu Wang, Yong Jiang, Nguyen Bach, Tao Wang, Zhongqiang Huang, Fei Huang, and Kewei Tu. 2020. Automated concatenation of embeddings for structured prediction.
+
+Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. 2022a. Rationaleaugmented ensembles in language models. arXiv preprint arXiv:2207.00747.
+
+Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. 2022b. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171.
+
+Albert Webson and Ellie Pavlick. 2022. Do promptbased models really understand the meaning of their prompts? In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2300–2344, Seattle, United States. Association for Computational Linguistics.
+
+Jason Wei, Maarten Bosma, Vincent Y Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M Dai, and Quoc V Le. 2021. Finetuned language models are zero-shot learners. arXiv preprint arXiv:2109.01652.
+
+Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Quoc Le, and Denny Zhou. 2022. Chain of thought prompting elicits reasoning in large language models. In Thirty-sixth Conference on Neural Information Processing Systems (NeurIPS 2022).
+
+Yu Wu, Wei Wu, Chen Xing, Ming Zhou, and Zhoujun Li. 2017. Sequential matching network: A new architecture for multi-turn response selection in retrievalbased chatbots. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 496–505.
+
+Ikuya Yamada, Akari Asai, Hiroyuki Shindo, Hideaki Takeda, and Yuji Matsumoto. 2020. Luke: Deep contextualized entity representations with entity-aware self-attention.
+
+Meng Ye and Yuhong Guo. 2017. Zero-shot classification with discriminative semantic representation learning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7140–7148.
+
+Eric Zelikman, Yuhuai Wu, and Noah D Goodman. 2022. Star: Bootstrapping reasoning with reasoning. arXiv preprint arXiv:2203.14465.
+
+Aston Zhang, Zachary C Lipton, Mu Li, and Alexander J Smola. 2021. Dive into deep learning. arXiv preprint arXiv:2106.11342.
+
+Li Zhang, Tao Xiang, and Shaogang Gong. 2017. Learning a deep embedding model for zero-shot learning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2021–2030.
+
+Zhuosheng Zhang, Shuohang Wang, Yichong Xu, Yuwei Fang, Wenhao Yu, Yang Liu, Hai Zhao, Chenguang Zhu, and Michael Zeng. 2022. Task compass: Scaling multi-task pre-training with task prefix. In Findings of The 2022 Conference on Empirical Methods in Natural Language Processing (EMNLP 2022).
+
+Zhuosheng Zhang, Aston Zhang, Mu Li, and Alex Smola. 2023a. Automatic chain of thought prompting in large language models. In The Eleventh International Conference on Learning Representations (ICLR 2023).
+
+Zhuosheng Zhang, Aston Zhang, Mu Li, Hai Zhao, George Karypis, and Alex Smola. 2023b. Multimodal chain-of-thought reasoning in language models. arXiv preprint arXiv:2302.00923.
+
+Denny Zhou, Nathanael Schärli, Le Hou, Jason Wei, Nathan Scales, Xuezhi Wang, Dale Schuurmans, Olivier Bousquet, Quoc Le, and Ed Chi. 2022. Least-to-most prompting enables complex reasoning in large language models. arXiv preprint arXiv:2205.10625.
+
+Xiangyang Zhou, Lu Li, Daxiang Dong, Yi Liu, Ying Chen, Wayne Xin Zhao, Dianhai Yu, and Hua Wu. 2018. Multi-turn response selection for chatbots with deep attention matching network. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1118–1127.
+
+# A Appendix
+
+A.1 Example Input and Output Pairs of ChatGPT
+
+Q: Bianca had 45 coloring books. If she gave away 6 of them, but then bought 20 more, how many would she have total?
+
+A: The answer (arabic numerals) is 59.
+
+Q: Janet was playing a video game and had 47 lives. In a hard part of the game she lost 23 lives. If she got 46 more lives in the next level, how many lives would she have?
+
+A: The answer (arabic numerals) is 70 lives. You can find this by starting with the number of lives she had at the beginning (47) and subtracting the number of lives she lost (23). Then add the number of lives she gained (46) to that number: $4 7 - 2 3 + 4 6 = 7 0$ .
+
+Q: A toy store had 17 giant stuffed bears in stock when they got another shipment with 10 bears in it. The put the bears onto shelves with 9 on each shelf. How many shelves did they use?
+
+A: The answer (arabic numerals) is 3. Explanation: The toy store started with 17 bears, and got another 10, for a total of $1 7 + 1 0 = 2 7$ bears. To put these bears on shelves, they need 27 bears / 9 bears per shelf $= 3$ shelves.
+
+Q: A group of 3 friends went into a restaurant. The chef already had 6 chicken wings cooked but cooked 3 more for the group. If they each got the same amount how many would each person get?
+
+A: The answer (arabic numerals) is 3 chicken wings per person.
+
+Q: George had 28 socks. If he threw away 4 old ones that didn’t fit and bought 36 new ones, how many socks would he have?
+
+A: The answer (arabic numerals) is 60. George would have 60 socks. $( 2 8 + 3 6 = 6 0$ )
+
+Q: At the town carnival Billy rode the ferris wheel 7 times and the bumper cars 3 times. If each ride cost 5 tickets, how many tickets did he use?
+
+A: The answer (arabic numerals) is 40 tickets.
+
+Q: Kaleb had saved up 21 dollars. If he received another 15 dollars for his allowance, how many 6 dollar toys could he buy?
+
+A: The answer (arabic numerals) is 5. He would have a total of $2 1 + 1 5 = 3 6$ dollars, and could buy $3 6 / 6 = 6$ toys.
+
+Q: Tom was putting his spare change into piles. He had 2 piles of quarters and 4 piles of dimes. If each pile had 5 coins in it, how many coins did he have total?
+
+A: The answer (arabic numerals) is 50 coins. (2 piles of quarters $\cdot$ coins per pile $\cdot$ quarters) $\cdot$ piles of dimes $\cdot$ coins per pile $\cdot$ dimes) $\cdot$ coins.
+
+Q: Isabel uploaded 25 pictures to Facebook. She put 10 pics into one album and put the rest into 5 different albums. How many pictures were in each album?
+
+A: The answer (arabic numerals) is 10 in one album and 5 in each of the other 5 albums.
+
+Q: For homework Faye had 13 math problems and 2 spelling problems. If she can finish 3 problems in an hour how long will it take her to finish all the problems?
+
+A: The answer (arabic numerals) is 8 hours. You can get this by adding the number of math problems (13) and spelling problems (2) to get a total of 15 problems. Then divide the total number of problems (15) by the number of problems Faye can finish in an hour (3) to get 5. Finally, divide 5 by 1 hour to get the answer of 5 hours.
+
+Table 14: Example input and output pairs for MultiArith with chain-of-thought (arithmetic reasoning).
+
+Q: Bianca had 45 coloring books. If she gave away 6 of them, but then bought 20 more, how many would she have total?
+
+A: Let’s think step by step. First, Bianca had 45 coloring books. Then, she gave away 6 of them, so she had $4 5 - 6 = 3 9$ coloring books. Finally, she bought 20 more, so she has $3 9 + 2 0 = 5 9$ coloring books. Therefore, the answer (arabic numerals) is 59
+
+Q: Janet was playing a video game and had 47 lives. In a hard part of the game she lost 23 lives. If she got 46 more lives in the next level, how many lives would she have?
+
+A: Let’s think step by step. Janet had 47 lives, then lost 23, so she had $4 7 - 2 3 = 2 4$ lives. Then, she got 46 more lives, so she had $2 4 + 4 6 = 7 0$ lives. Therefore, the answer (arabic numerals) is 70
+
+Q: A toy store had 17 giant stuffed bears in stock when they got another shipment with 10 bears in it. The put the bears onto shelves with 9 on each shelf. How many shelves did they use?
+
+A: Let’s think step by step. $1 7 + 1 0 = 2 7$ bears. 27 bears / 9 bears/shelf $= 3$ shelves. Therefore, the answer (arabic numerals) is 3
+
+Q: A group of 3 friends went into a restaurant. The chef already had 6 chicken wings cooked but cooked 3 more for the group. If they each got the same amount how many would each person get?
+
+A: Let’s think step by step. Each person would get 3 chicken wings. Therefore, the answer (arabic numerals) is 3
+
+Q: George had 28 socks. If he threw away 4 old ones that didn’t fit and bought 36 new ones, how many socks would he have?
+
+A: Let’s think step by step. George had 28 socks, then threw away 4, so he has $2 8 - 4 = 2 4$ . Then he bought 36 new ones, so he has $2 4 + 3 6 = 6 0$ socks. Therefore, the answer (arabic numerals) is 60.
+
+Q: At the town carnival Billy rode the ferris wheel 7 times and the bumper cars 3 times. If each ride cost 5 tickets, how many tickets did he use?
+
+A: Let’s think step by step. Billy rode the ferris wheel 7 times, so he used $7 \ast 5 = 3 5$ tickets. He also rode the bumper cars 3 times, so he used $3 * 5 = 1 5$ tickets. Therefore, Billy used $3 5 + 1 5 = 5 0$ tickets. Therefore, the answer (arabic numerals) is 50
+
+Q: Kaleb had saved up 21 dollars. If he received another 15 dollars for his allowance, how many 6 dollar toys could he buy?
+
+A: Let’s think step by step. Kaleb had $2 1 + 1 5 = 3 6$ dollars. He can buy $3 6 / 6 = 6$ toys. Therefore, the answer (arabic numerals) is 6
+
+Q: Tom was putting his spare change into piles. He had 2 piles of quarters and 4 piles of dimes. If each pile had 5 coins in it, how many coins did he have total?
+
+A: Let’s think step by step. Tom had 2 piles of quarters, which means he had $2 ^ { * } 5 = 1 0$ quarters. He also had 4 piles of dimes, so he had $4 * 5 = 2 0$ dimes. The total number of coins he had is $1 0 + 2 0 =$ 30 coins. Therefore, the answer (arabic numerals) is 30
+
+Q: Isabel uploaded 25 pictures to Facebook. She put 10 pics into one album and put the rest into 5 different albums. How many pictures were in each album?
+
+A: Let’s think step by step. Isabel put 10 pics into one album, so each of the 5 other albums had $2 5 \mathrm { - } 1 0 { = } 1 5$ pics. Answer: 15 pics/album. Therefore, the answer (arabic numerals) is 15.
+
+Q: For homework Faye had 13 math problems and 2 spelling problems. If she can finish 3 problems in an hour how long will it take her to finish all the problems?
+
+A: Let’s think step by step. 13 math problems $^ { + 2 }$ spelling problems $= 1 5$ problems. 15 problems / 3 problems per hour $= 5$ hours. Therefore, the answer (arabic numerals) is 5 hours.
+
+Q: A store offers sandwiches in 3 different package sizes: the first package with 2 sandwiches for $\$ 3$ , the second with 4 sandwiches for $\$ 6$ , and a third with 8 sandwiches, but the price is not indicated. Knowing that the prices are proportional, how much will the package with 8 sandwiches cost?
+
+A: The answer (arabic numerals) is 12 dollars.
+
+Q: The ratio of the electric poles and electric wires needed to connect and supply the electricity in a certain neighborhood is 1:3. If the total number of electric wires needed to connect the electricity in the neighborhood is 45, calculate the total number of electric poles required by an electric company to supply the electricity in the neighborhood.
+
+A: The answer (arabic numerals) is 15 electric poles are required. This is calculated by dividing the total number of electric wires (45) by the ratio of electric poles to electric wires (1:3). $4 5 / \left( 1 / 3 \right) = 4 5$ $^ { * } 3 = 1 3 5$ , and 45 electric poles are needed.
+
+Q: My kitchen floor has a total area of $2 0 0 \mathrm { S q F t }$ . I want to install new square floor tiles that cost $\$ 12$ each, and each tile side is 1ft in length. How much will it cost me to renovate my kitchen floor?
+
+A: The answer (arabic numerals) is 2400 dollars. Explanation: The area of the kitchen floor is 200 sq ft, and each tile is 1 sq ft in area (1 ft $\texttt { X 1 }$ ft $= 1$ sq ft). So the number of tiles needed to cover the kitchen floor is 200 sq ft / 1 sq ft/tile $= 2 0 0$ tiles. At a cost of $\$ 12$ per tile, the total cost to cover the kitchen floor with these tiles would be 200 tiles $\mathrm { ~ x ~ } \$ 12/ \mathrm { t i l e } = \ S 2400$ .
+
+Q: Jeff and Brad are trying to divide 100 dollars between them. Jeff gets 4 times as much as Brad. How much does Jeff get in dollars?
+
+A: The answer (arabic numerals) is 80 dollars.
+
+Q: To fund his store, Mr. Josue solicited money from two banks. The first bank gave him $\$ 4000$ , and the second company gave him twice as much. If he initially had $\$ 5000$ in capital, how much capital does he have now?
+
+A: The answer (arabic numerals) is $\$ 12000$ . The second bank gave him $-$ , so in total he received $\$ 4000+$ from the banks. Adding this to his initial capital of $\$ 5000$ he now has a total of $\$ 12000$ .
+
+Q: John drives for 3 hours at a speed of $6 0 \mathrm { m p h }$ and then turns around because he realizes he forgot something very important at home. He tries to get home in 4 hours but spends the first 2 hours in standstill traffic. He spends the next half-hour driving at a speed of $3 0 \mathrm { { m p h } }$ , before being able to drive the remaining time of the 4 hours going at $8 0 \mathrm { m p h }$ . How far is he from home at the end of those 4 hours?
+
+A: The answer (arabic numerals) is It is not possible to determine the distance John is from home at the end of the 4 hours based on the information provided. This is because the information provided only describes the time and speed of John’s travel, but not the distance.
+
+Q: Mazie has 52 marbles and gives them to twins, Dallas and Darla. If Dallas has a total of 21 marbles after dropping 4 of them in the playground, how many did Mazie give to Darla?
+
+A: The answer (arabic numerals) is 31 marbles.
+
+Q: There are 96 fourth-graders at Small Tree School. 43 of them are girls. On Friday, 5 fourth-grade girls and 4 fourth-grade boys were absent. How many fourth grade boys were at Small Tree School on Friday?
+
+A: The answer (arabic numerals) is 43 boys. To find out, you can start with the total number of fourth-graders (96) and subtract the number of girls (43) to find the number of boys. Then subtract the number of absent boys (4) from that number to find the number of boys present on Friday. 96 fourth-graders - $\cdot$ boys. 53 boys - 4 absent boys $= 4 9$ present boys.
+
+Q: A store offers sandwiches in 3 different package sizes: the first package with 2 sandwiches for $\$ 3$ , the second with 4 sandwiches for $\$ 6$ , and a third with 8 sandwiches, but the price is not indicated. Knowing that the prices are proportional, how much will the package with 8 sandwiches cost?
+
+A: Let’s think step by step. The first package costs $\$ 3$ for 2 sandwiches, so each sandwich costs $\$ 3/2$ $= \$ 1.50$ . The second package costs $\$ 6$ for 4 sandwiches, so each sandwich costs $\$ 6/4=91.50$ . Since the price of each sandwich is the same, the third package with 8 sandwiches will cost $8 * \$ 1.50=\$ 512$ . Therefore, the answer (arabic numerals) is $\$ 12$
+
+Q: Jeff and Brad are trying to divide 100 dollars between them. Jeff gets 4 times as much as Brad. How much does Jeff get in dollars?
+
+A: Let’s think step by step. First, let’s call Brad’s share $" \mathbf { X } "$ . If Jeff gets 4 times as much as Brad, then Jeff gets $4 \mathbf { x }$ dollars. So, we know that $\mathrm { x } + 4 \mathrm { x } = 1 0 0$ dollars. Combining like terms, we get $5 \mathrm { x } =$ 100 dollars. Dividing both sides by 5, we find that $\mathbf { X } = 2 0$ dollars. So, Jeff gets $4 * 2 0 = 8 0$ dollars. Therefore, the answer (arabic numerals) is Jeff gets 80 dollars.
+
+Q: To fund his store, Mr. Josue solicited money from two banks. The first bank gave him $\$ 4000$ , and the second company gave him twice as much. If he initially had $\$ 5000$ in capital, how much capital does he have now?
+
+A: Let’s think step by step. The first bank gave Mr. Josue $\$ 4000$ . The second bank gave him twice as much, which is $2 ^ { \ast } \$ 400 0 = \$ 8000$ . So Mr. Josue received a total of $\$ 4000$ from the two banks. Adding this to his initial capital of $\$ 5000$ , he now has a total of $\$ 12000$ in capital. Therefore, the answer (arabic numerals) is 17000.
+
+Q: John drives for 3 hours at a speed of 60 mph and then turns around because he realizes he forgot something very important at home. He tries to get home in 4 hours but spends the first 2 hours in standstill traffic. He spends the next half-hour driving at a speed of $3 0 \mathrm { { m p h } }$ , before being able to drive the remaining time of the 4 hours going at $8 0 \mathrm { m p h }$ . How far is he from home at the end of those 4 hours?
+
+A: Let’s think step by step. First, John drove for 3 hours at $6 0 ~ \mathrm { { m p h } }$ , so he covered a distance of $3 ^ { * } 6 0 = 1 8 0$ miles. Then, he turned around and drove for 2 hours in standstill traffic, which covered no distance. After that, he drove for 0.5 hours at $3 0 \mathrm { m p h }$ , covering a distance of $0 . 5 ^ { * } 3 0 = 1 5$ miles. Finally, he drove for 1.5 hours at $8 0 \mathrm { m p h }$ , covering a distance of $1 . 5 ^ { * } 8 0 = 1 2 0$ miles. So in total, he covered a distance of $1 8 0 + 0 + 1 5 + 1 2 0 = 3 1 5$ miles. Therefore, the answer (arabic numerals) is 315 miles.
+
+Q: Mazie has 52 marbles and gives them to twins, Dallas and Darla. If Dallas has a total of 21 marbles after dropping 4 of them in the playground, how many did Mazie give to Darla?
+
+A: Let’s think step by step. Dallas originally had $2 1 + 4 = 2 5$ marbles. So, the total number of marbles Mazie gave to both twins is $^ { 2 5 + }$ (total number of marbles Darla has) $= 5 2$ . Therefore, Darla has 52 - $2 5 = 2 7$ marbles. Therefore, the answer (arabic numerals) is 27.
+
+Q: There are 96 fourth-graders at Small Tree School. 43 of them are girls. On Friday, 5 fourth-grade girls and 4 fourth-grade boys were absent. How many fourth grade boys were at Small Tree School on Friday?
+
+A: Let’s think step by step. First, we know that there are 43 girls in the fourth grade at Small Tree School. If 5 of them were absent on Friday, then there were $4 3 - 5 = 3 8$ girls present. Next, we know that there are 96 fourth-graders total, and we know that 43 of them are girls. So, $9 6 - 4 3 = 5 3$ fourth-grade boys. Finally, if 4 of the 53 fourth-grade boys were absent on Friday, then $5 3 - 4 = 4 9$ fourth-grade boys were present on Friday. Therefore, the answer (arabic numerals) is 49.
+
+Q: Shannon and her family use up a lot of strawberry and blueberry jelly , since they eat toast every morning . At the moment , they have a combined total of 6310 grams of jelly . If they have 4518 grams of blueberry jelly , how many grams of strawberry jelly do they have ?
+
+A: The answer (arabic numerals) is 1792 grams.
+
+Q: Students at Arcadia schools are participating in a coat drive . 9437 coats have been collected so far . 6922 coats were collected from the high schools , and the rest from the elementary schools . How many coats were collected at the elementary schools ?
+
+A: The answer (arabic numerals) is 2515 coats were collected at the elementary schools. This can be found by subtracting the number of coats collected from the high schools (6922) from the total number of coats collected (9437). $9 4 3 7 - 6 9 2 2 = 2 5 1 5$ .
+
+Q: An oil pipe in the sea broke . Before engineers started to fix the pipe , 6522 liters of oil leaked into the water . While the engineers worked , the pipe leaked 5165 liters of oil . In all , how many liters of oil leaked into the water ?
+
+A: The answer (arabic numerals) is 11,687 liters of oil leaked into the water. This can be determined by adding the initial amount of oil leaked (6522 liters) to the amount leaked while the engineers worked (5165 liters).
+
+Q: Tim ’s cat had kittens . He gave 3 to Jessica and 6 to Sara . He now has 9 kittens . How many kittens did he have to start with ?
+
+A: The answer (arabic numerals) is 18. Tim gave away 3 kittens to Jessica and 6 kittens to Sara, which totals 9 kittens. To find out how many kittens he had to start with, you add the number of kittens he gave away to the number he still has, which is $9 + 9 = 1 8$ kittens.
+
+Q: Mike went to 15 basketball games this year , but missed 41 . He went to 39 games last year . How many basketball games did Mike go to in total ?
+
+A: The answer (arabic numerals) is 53 games. (Mike went to 15 games this year $\cdot$ games last year $= 5 4$ games - the 1 game he missed $\cdot$ games total)
+
+Q: A waitress put leftover tarts into the fridge on Thursday night . She noticed that the restaurant had 0.08333333333333333 tart filled with cherries , 0.75 tart filled with blueberries , and 0.08333333333333333 tart filled with peaches . How many leftover tarts did the restaurant have in all ?
+
+A: The answer (arabic numerals) is 1.0833333333333333 tarts total.
+
+Q: There are 7 crayons in the drawer and 6 crayons on the desk . Sam placed 4 crayons and 8 scissors on the desk . How many crayons are now there in total ?
+
+A: The answer (arabic numerals) is 15 crayons.
+
+Q: Bonnie ’s science class recorded the rainfall each day . They recorded 0.16666666666666666 centimeter of rain on Monday , 0.4166666666666667 centimeter of rain on Tuesday , and 0.08333333333333333 centimeter of rain on Wednesday . How many centimeters of rain did the class record in all ?
+
+A: The answer (arabic numerals) is 0.7 centimeters of rain.
+
+Q: Shannon and her family use up a lot of strawberry and blueberry jelly , since they eat toast every morning . At the moment , they have a combined total of 6310 grams of jelly . If they have 4518 grams of blueberry jelly , how many grams of strawberry jelly do they have ?
+
+A: Let’s think step by step. The total amount of jelly they have is 6310 grams, and of that, 4518 grams is blueberry jelly. To find out how much strawberry jelly they have, we can subtract the amount of blueberry jelly from the total amount of jelly: 6310 grams (total jelly) - 4518 grams (blueberry jelly) $= 1 7 9 2$ grams (strawberry jelly). Therefore, the answer (arabic numerals) is 1792.
+
+Q: Students at Arcadia schools are participating in a coat drive . 9437 coats have been collected so far . 6922 coats were collected from the high schools , and the rest from the elementary schools . How many coats were collected at the elementary schools ?
+
+A: Let’s think step by step. Coats collected at elementary schools $=$ Total coats collected - Coats collected at high schools $= 9 4 3 7 \cdot 6 9 2 2 = 2 5 1 5$ . Answer: 2515. Therefore, the answer (arabic numerals) is 2515.
+
+Q: Tim ’s cat had kittens . He gave 3 to Jessica and 6 to Sara . He now has 9 kittens . How many kittens did he have to start with ?
+
+A: Let’s think step by step. Tim had 9 kittens remaining after giving 3 to Jessica and 6 to Sara. To find out how many kittens he had to start with, we need to add the number of kittens he gave away to the number of kittens he still has. 9 (remaining kittens) $^ { + 3 }$ (kittens given to Jessica) $+ 6$ (kittens given to Sara) $= 1 8$ total kittens. Therefore, Tim had 18 kittens to start with. Therefore, the answer (arabic numerals) is 18.
+
+Q: Mike went to 15 basketball games this year , but missed 41 . He went to 39 games last year . How many basketball games did Mike go to in total ?
+
+A: Let’s think step by step. Mike went to 15 games this year $+ \ 3 9$ games last year $= 5 4$ total games.
+Therefore, the answer (arabic numerals) is 54.
+
+Q: There are 7 crayons in the drawer and 6 crayons on the desk . Sam placed 4 crayons and 8 scissors on the desk . How many crayons are now there in total ?
+
+A: Let’s think step by step. There were 7 crayons in the drawer and 6 crayons on the desk, for a total of $7 + 6 = 1 3$ crayons. Sam placed 4 crayons and 8 scissors on the desk, bringing the total number of crayons on the desk to $6 + 4 = 1 0$ . Therefore, there are now a total of 13 (initial total) $+ 1 0$ (new crayons on the desk) $= 2 3$ crayons in total. Therefore, the answer (arabic numerals) is 23 crayons.
+
+Q: Bonnie ’s science class recorded the rainfall each day . They recorded 0.16666666666666666 centimeter of rain on Monday , 0.4166666666666667 centimeter of rain on Tuesday , and 0.08333333333333333 centimeter of rain on Wednesday . How many centimeters of rain did the class record in all ?
+
+A: Let’s think step by step. Monday: 0.16666666666666666 cm. Tuesday: 0.4166666666666667 cm. Wednesday: 0.08333333333333333 cm. Total: 0.6666666666666666 cm. Therefore, the answer (arabic numerals) is $\cdot$ .
+
+A: Among A through E, the answer is C) 120 kmph.
+
+Q: Q is as much younger than R as he is older than T. If the sum of the ages of R and T is 50 years. What is definitely the difference between R and Q’s age? Answer Choices: (A) 22 (B) 27 (C) 29 (D) Cannot be determined (E) None of the above
+
+A: Among A through E, the answer is (D) Cannot be determined. The information provided does not give enough information to determine the specific difference between R and Q’s age.
+
+Q: What is $60 \%$ of $30 \%$ of 1400 grams? Answer Choices: (A) 450 gms (B) 100 gms (C) 252 gms (D) $2 4 0 ~ \mathrm { g m s }$ (E) None of these
+
+A: Among A through E, the answer is (C) 252 gms. To calculate this, first calculate $30 \%$ of 1400 grams which is $( 3 0 / 1 0 0 ) ^ { * } 1 4 0 0 = 4 2 0$ grams. Then take $60 \%$ of 420 grams which is $( 6 0 / 1 0 0 ) ^ { * } 4 2 0 =$ 252 grams.
+
+Q: An electric pole, 14 metres high, casts a shadow of 10 metres. Find the height of a tree that casts a shadow of 15 metres under similar conditions. Answer Choices: (A) 21 (B) 22 (C) 20 (D) 23 (E) 24 A: Among A through E, the answer is (B) 22. This is a similar triangles problem. If we let "x" be the height of the tree, then we can set up the following proportion: $( 1 4 / 1 0 ) = ( \mathrm { x } / 1 5 )$ Solving for $\mathbf { X }$ , we get: $-$ Therefore, the height of the tree is $2 2 \mathrm { m }$ .
+
+Q: Alice wants to put up fencing around three sides of her rectangular yard and leave one side of 10 meters unfenced. If the yard has an area of 240 square meters, how many meters of fencing does she need? Answer Choices: (A) 58 (B) 62 (C) 66 (D) 70 (E) 74
+A: Among A through E, the answer is (C) 66 meters of fencing.
+
+Q: At my favorite fruit stand, an orange costs 18 dollars, a pineapple costs 27 dollars, and a grape costs 15 dollars. Using the same logic, can you tell how much a mango costs? Answer Choices: (A) 22 dollars (B) 15 dollars (C) 20 dollars (D) 18 dollars (E) 10 dollars
+
+A: Among A through E, the answer is I’m sorry, I am not able to determine the cost of a mango based on the given information. The prices of the orange, pineapple, and grape do not provide enough information to infer the cost of a mango.
+
+Q: A rectangle has a length of 8 centimeters and a width of 3 centimeters. Find the perimeter. Answer Choices: (A) $1 8 \mathrm { c m }$ (B) $2 2 \mathrm { c m }$ (C) $2 0 \mathrm { c m }$ (D) 30cm (E) $2 8 \mathrm { c m }$
+
+A: Among A through E, the answer is (E) $2 8 \mathrm { c m }$ . To find the perimeter of a rectangle, you add up the lengths of all four sides. In this case, the two sides of length $8 \mathrm { c m }$ and the two sides of width 3cm, so: $\mathrm { 8 c m } + \mathrm { 8 c m } + 3 \mathrm { c m } + 3 \mathrm { c m } = 2 8 \mathrm { c m }$
+
+Q: A car finishes a journey in 20 hours at the speed of $6 0 \mathrm { k m / h r }$ . If the same distance is to be covered in 10 hours, how much speed does the car gain? Answer Choices: (A) 80 kmph (B) 50 kmph (C) 120 kmph (D) 70 kmph (E) 80 kmph
+
+A: Let’s think step by step. We know that the car’s original speed is $6 0 \mathrm { k m / h r }$ and it took 20 hours to complete the journey. To find the distance the car traveled, we can use the formula: distance $=$ speed x time. So, distance $= 6 0 \mathrm { k m } / \mathrm { h r } \mathrm { x } 2 0$ hours $= 1 2 0 0 \mathrm { k m }$ . Now, we know that the car wants to cover the same distance in 10 hours. To find the new speed, we can use the same formula, but with the new time: speed $=$ distance $/ \mathrm { t i m e } = 1 2 0 0 \mathrm { k m } / 1 0 \mathrm { h o u r s } = 1 2 0 \mathrm { k m / h r } .$ Therefore, the car gains a speed of $1 2 0 \ \mathrm { k m / h r } - 6 0 \ \mathrm { k m / h r } = 6 0 \ \mathrm { k m / h r }$ . So, the answer is (C) $1 2 0 \mathrm { k m p h }$ . Therefore, among A through E, the answer is $\mathrm { ( C ) 1 2 0 k m p h }$ .
+
+Q: Last year, a Home Appliance Store sold an average(arithmetic mean) of 42 microwave ovens per month. In the first 10 months of this year,the store has sold an average(arithmetic mean) of only 20 microwave ovens per month. What was the average number of microwave ovens sold per month during the entire 22 months period ? Answer Choices: (A) 21 (B) 30 (C) 31 (D) 32 (E) None of the above
+
+A: Let’s think step by step. The total number of microwave ovens sold in the first 10 months of this year is $2 0 ^ { * } 1 0 = 2 0 0$ . The total number of microwave ovens sold last year is $4 2 ^ { * } 1 2 = 5 0 4$ . The total number of months is $1 0 + 1 2 = 2 2$ . So, the average number of microwave ovens sold per month during the entire 22 months period is $( 5 0 4 + 2 0 0 ) / 2 2 = 7 0 4 / 2 2 = 3 2$ . Therefore, the answer is (D) 32. Therefore, among A through E, the answer is (D) 32.
+
+Q: An electric pole, 14 metres high, casts a shadow of 10 metres. Find the height of a tree that casts a shadow of 15 metres under similar conditions. Answer Choices: (A) 21 (B) 22 (C) 20 (D) 23 (E) 24 A: Let’s think step by step. We can use the proportion of the shadow lengths to determine the height of the tree. We know that the electric pole’s shadow is $1 4 / 1 0 = 7 / 5$ the length of the electric pole’s height. So, if the tree’s shadow is 15 metres, and we assume the same ratio of shadow to height as the electric pole, we can set up the equation: (Tree’s height) $/ 1 5 =$ (Electric pole’s height) / (Electric pole’s shadow) Cross-multiplying and solving for the tree’s height, we get: (Tree’s height) $= ( 1 5$ \* Electric pole’s height) / (Electric pole’s shadow) $= ( 1 5 ^ { * } 1 4 )$ / $1 0 = 2 1$ So the answer is (A) 21. Therefore, among A through E, the answer is (A) 21.
+
+Q: At my favorite fruit stand, an orange costs 18 dollars, a pineapple costs 27 dollars, and a grape costs 15 dollars. Using the same logic, can you tell how much a mango costs? Answer Choices: (A) 22 dollars (B) 15 dollars (C) 20 dollars (D) 18 dollars (E) 10 dollars
+
+A: Let’s think step by step. It is not possible to determine the cost of a mango based on the given information alone. The prices of the orange, pineapple, and grape do not provide any information about how the cost of a mango might be determined. Additional information would be needed to make an estimate. Therefore, among A through E, the answer is none of the above.
+
+Q: A rectangle has a length of 8 centimeters and a width of 3 centimeters. Find the perimeter. Answer Choices: (A) $1 8 \mathrm { c m }$ (B) $2 2 \mathrm { c m }$ (C) $2 0 \mathrm { c m }$ (D) 30cm (E) 28cm A: Let’s think step by step. Perimeter is the sum of all sides of a shape. In the case of a rectangle, it is the sum of the length and width multiplied by 2. So, the perimeter of a rectangle with a length of 8 centimeters and a width of 3 centimeters would be $( 8 + 3 ) \times 2 = 1 1 \times 2 = 2 2$ centimeters. Therefore, the answer is (B) $2 2 \mathrm { c m }$ . Therefore, among A through E, the answer is (B) $2 2 \mathrm { c m }$ .
+
+Table 21: Example input and output pairs for SingleEq (arithmetic reasoning).
+
+Q: Wendy ran 19.833333333333332 miles and walked 9.166666666666666 miles. How much farther did Wendy run than walk?
+
+A: The answer (arabic numerals) is 10.666666666666666 miles.
+
+Q: The junior ranger asked Christian to help him place 420 seedlings in packets. If every packet needs to contain 7 seeds, how many packets do they need?
+
+A: The answer (arabic numerals) is 60 packets. This can be found by dividing the total number of seedlings (420) by the number of seeds per packet (7), which equals 60.
+
+Q: In Shannon’s apartment complex, 0.16666666666666666 of the apartments are one-bedroom apartments and 0.3333333333333333 are two-bedroom apartments. What fraction of the apartments are either one- or two-bedroom apartments?
+
+A: The answer (arabic numerals) is 0.5 (or $50 \%$ ). To get this answer, you add the fractions of one-bedroom and two-bedroom apartments: $0 . 1 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 + 0 . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 = 0 . 5$ . This represents half of the apartments in the complex.
+
+Q: Maria needs 21 cartons of berries to make a berry cobbler. She already has 4 cartons of strawberries and 8 cartons of blueberries. How many more cartons of berries should Maria buy?
+
+A: The answer (arabic numerals) is 9 cartons. Maria already has 4 cartons of strawberries and 8 cartons of blueberries for a total of $4 { + } 8 = 1 2$ cartons. To make the cobbler she needs 21 cartons, so she needs to buy $2 1 - 1 2 = 9$ more cartons of berries.
+
+Q: During a visit to an orchard, Charlie picked 0.16666666666666666 of a bag of Golden Delicious apples, 0.16666666666666666 of a bag of Macintosh apples, and 0.3333333333333333 of a bag of Cortland apples. How many bags of fruit did Charlie pick in total?
+
+A: The answer (arabic numerals) is 1 bag. You can add the fractions of each bag of fruit together to ge $-$ which simplifies to 1 bag.
+
+Q: For his long distance phone service Milan pays a 2 dollars monthly fee plus 12 cents per minute. Last month , Milan ’s long distance bill was 23.36 dollars. For how many minutes was Milan billed for ?
+
+A: The answer (arabic numerals) is 194 minutes.
+
+Q: When Joan was visited by the toothfairy, she received 14 each of quarters, half-dollars, and dimes. How much money did the toothfairy leave Joan?
+
+A: The answer (arabic numerals) is $\cdot$ . Explanation: The toothfairy left Joan 14 quarters, which is $1 4 \mathrm { ~ x ~ } \$ 0.25 = \$ 3.50$ The toothfairy left Joan 14 half-dollars, which is $-$ The toothfairy left Joan 14 dimes, which is $-$ So in total, the toothfairy left Joan $\_$ $\_$ .
+
+Q: In one week, an airplane pilot flew 1134 miles on Tuesday and 1475 miles on Thursday. If the pilot flies the same number of miles 3 weeks in a row, how many miles does the pilot fly in all?
+
+A: The answer (arabic numerals) is 9408 miles. This can be calculated by taking the number of miles flown on Tuesday and Thursday $( 1 1 3 4 + 1 4 7 5 = 2 6 0 9 )$ and multiplying it by 3 $\_$ .
+
+Table 22: Example input and output pairs for SingleEq with chain-of-thought (arithmetic reasoning).
+
+Q: Wendy ran 19.833333333333332 miles and walked 9.166666666666666 miles. How much farther did Wendy run than walk?
+
+A: Let’s think step by step. Wendy ran 19.833333333333332 miles and walked 9.166666666666666 miles. To find the difference between the two, we can subtract the number of miles walked from the number of miles ran: $1 9 . 8 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 \cdot 9 . 1 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 \times \frac { 1 } { 2 } . 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 4$ miles. So Wendy ran 10.666666666666664 miles farther than she walked. Therefore, the answer (arabic numerals) is 10.67 miles.
+
+Q: The junior ranger asked Christian to help him place 420 seedlings in packets. If every packet needs to contain 7 seeds, how many packets do they need?
+
+A: Let’s think step by step. They need to place 420 seedlings in packets. To find out how many packets they need, we need to divide 420 by 7 (the number of seeds per packet). 420 divided by 7 is 60. So they need 60 packets. Therefore, the answer (arabic numerals) is 60.
+
+Q: In Shannon’s apartment complex, 0.16666666666666666 of the apartments are one-bedroom apartments and 0.3333333333333333 are two-bedroom apartments. What fraction of the apartments are either one- or two-bedroom apartments?
+
+A: Let’s think step by step. $0 . 1 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 + 0 . 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 = 0 . 5$ , so 0.5 of the apartments are either one- or two-bedroom apartments. Therefore, the answer (arabic numerals) is 0.5.
+
+Q: Maria needs 21 cartons of berries to make a berry cobbler. She already has 4 cartons of strawberries and 8 cartons of blueberries. How many more cartons of berries should Maria buy?
+
+A: Let’s think step by step. Maria has $4 + 8 = 1 2$ cartons of berries already. She needs $2 1 - 1 2 = 9$ more cartons of berries. Therefore, the answer (arabic numerals) is 9.
+
+Q: For his long distance phone service Milan pays a 2 dollars monthly fee plus 12 cents per minute. Last month , Milan ’s long distance bill was 23.36 dollars. For how many minutes was Milan billed for ?
+
+A: Let’s think step by step. First, we can subtract the monthly fee from the total bill to find the cost of the minutes: $\$ 23.36-\$ 52=821.36$ . Next, we can divide this amount by the cost per minute to find the number of minutes: $\$ 21.36 ⁄ \ S 0.12/ \mathrm { m i n u t e } =178$ minutes. Therefore, Milan was billed for 178 minutes. Therefore, the answer (arabic numerals) is 178 minutes.
+
+Q: When Joan was visited by the toothfairy, she received 14 each of quarters, half-dollars, and dimes. How much money did the toothfairy leave Joan?
+
+A: Let’s think step by step. The toothfairy left Joan 14 quarters, which is $1 4 \ast \$ 50.25 = \ S 3 .5 0$ . She also left 14 half-dollars, which is $1 4 \ast \$ 50.50= \ S 7 .0 0$ . And 14 dimes, which is $1 4 * \ S 0 . 1 0 = \ S 1 . 4 0$ . Adding all these amounts, the total amount of money the toothfairy left Joan is $\$ 3.50+57.00+51.40$ $= \$ 12.00$ . Therefore, the answer (arabic numerals) is 12.00.
+
+Q: In one week, an airplane pilot flew 1134 miles on Tuesday and 1475 miles on Thursday. If the pilot flies the same number of miles 3 weeks in a row, how many miles does the pilot fly in all?
+
+A: Let’s think step by step. The pilot flew 1134 miles on Tuesday and 1475 miles on Thursday, so in one week they flew a total of $1 1 3 4 + 1 4 7 5 = 2 6 0 9$ miles. If the pilot flies the same number of miles 3 weeks in a row, they would fly a total of 2609 miles x $: 3 = 7 8 2 7$ miles. Therefore, the answer (arabic numerals) is 7827.
+
+Q: Because of the decision Sofia asked the students to suggest specific types of food. If 479 students suggested adding mashed potatoes while 489 suggested adding bacon to the menu How many more students suggested bacon than those that suggested mashed potatoes?
+
+A: The answer (arabic numerals) is 10 more students suggested bacon than those that suggested mashed potatoes.
+
+Q: Matthew gave equal numbers of crackers to his 18 friends. If he had 36 crackers How many crackers did each person eat?
+
+A: The answer (arabic numerals) is 2 crackers per person. (Matthew divided 36 crackers equally among 18 friends, so each person received $3 6 / 1 8 = 2$ crackers.)
+
+Q: Josh had some marbles in his collection. He lost 21 marbles. If he has 12 marbles now How many marbles did he have in his collection?
+
+A: The answer (arabic numerals) is 33 marbles. (Josh had 12 marbles $+ 2 1$ marbles lost $= 3 3$ marbles total in his collection)
+
+Q: Because of the decision Sofia asked the students to suggest specific types of food. 457 students suggested adding mashed potatoes while others suggested adding bacon to the menu. If 63 more students suggested adding mashed potatoes than those that suggested bacon How many students suggested bacon?
+
+A: The answer (arabic numerals) is 194 students suggested adding bacon to the menu. You can use algebra to solve this problem: Let x be the number of students who suggested adding bacon. We know that $\_$ (because 63 more students suggested mashed potatoes than bacon) So $\mathrm { x } = 4 5 7 - 6 3$ $\cdot$
+
+Q: For Gwen’s birthday she received 2 dollars from her mom. Her dad gave her 4 more dollars. If she spent 3 dollars. How much money did she still have?
+
+A: The answer (arabic numerals) is 5 dollars. Explanation: Gwen starts with 2 dollars from her mom $\cdot$ dollars from her dad $\cdot$ dollars. Then she spent 3 dollars, so she still has 6 dollars - 3 dollars $= 5$ dollars left.
+
+Q: Rachel had to complete 8 pages of math homework. If she had to complete 3 more pages of math homework than reading homework How many pages did she have to complete in all?
+
+A: The answer (arabic numerals) is unknown, as the number of pages of reading homework that Rachel had to complete is not provided.
+
+Q: In a school there are 868 girls and the rest are boys. If there are 281 more girls than boys How many pupils are there in that school?
+
+A: The answer (arabic numerals) is 1247 pupils. To find out, you can use the information given in the problem to set up an equation: $\cdot$ number of boys. $8 6 8 =$ number of girls. $\ x + 8 6 8 =$ total number of pupils. You also know that there are 281 more girls than boys: $\_$ . You can substitute the second equation into the first equation: $\mathrm { x } + 8 6 8 = \mathrm { x } + 8 6 8 + 2 8 1$ . Solving for x gives you the number of boys, which you can then add to the number of girls to find the total number of pupils. $\mathbf { \boldsymbol { x } } = 8 6 8$ - 281. $\mathtt { X } = 5 8 7$ . $8 6 8 + 5 8 7 = 1 2 5 5$
+
+Q: Because of the decision Sofia asked the students to suggest specific types of food. If 479 students suggested adding mashed potatoes while 489 suggested adding bacon to the menu How many more students suggested bacon than those that suggested mashed potatoes?
+
+A: Let’s think step by step. The difference in the number of students who suggested adding bacon and those who suggested adding mashed potatoes is $4 8 9 - 4 7 9 = 1 0$ students. So, 10 more students suggested adding bacon than those that suggested mashed potatoes. Therefore, the answer (arabic numerals) is 10.
+
+Q: Matthew gave equal numbers of crackers to his 18 friends. If he had 36 crackers How many crackers did each person eat?
+
+A: Let’s think step by step. Matthew had 36 crackers and gave them to 18 friends, so we can divide 36 by 18 to find out how many crackers each person received. $3 6 \div 1 8 = 2$ . So, each person ate 2 crackers. Therefore, the answer (arabic numerals) is 2.
+
+Q: Mary is baking a cake. The recipe calls for 11 cups of sugar 6 cups of flour and 9 cups of salt. She already put in 12 cups of flour. How many more cups of sugar than cups of salt does she need to add now?
+
+A: Let’s think step by step. She needs 6 cups of flour - 12 cups of flour $= - 6$ cups of flour. So, she does not need to add any more flour. She needs to add 11 cups of sugar - the amount she already added $= 1 1$ cups of sugar. She needs to add 9 cups of salt - the amount she already added $= 9$ cups of salt. Therefore, she needs 11 cups of sugar - 9 cups of salt $= 2$ more cups of sugar than salt. Therefore, the answer (arabic numerals) is 2.
+
+Q: Josh had some marbles in his collection. He lost 21 marbles. If he has 12 marbles now How many marbles did he have in his collection?
+
+A: Let’s think step by step. Josh originally had $2 1 + 1 2 = 3 3$ marbles in his collection before he lost any. Therefore, the answer (arabic numerals) is 33.
+
+Q: For Gwen’s birthday she received 2 dollars from her mom. Her dad gave her 4 more dollars. If she spent 3 dollars. How much money did she still have?
+
+A: Let’s think step by step. Gwen received 2 dollars from her $\mathrm { m o m } + 4$ dollars from her dad $= 6$ dollars total. Then if she spent 3 dollars, she would have 6 dollars - 3 dollars $= 3$ dollars remaining. Therefore, the answer (arabic numerals) is 3 dollars.
+
+Q: Rachel had to complete 8 pages of math homework. If she had to complete 3 more pages of math homework than reading homework How many pages did she have to complete in all?
+
+A: Let’s think step by step. Rachel had to complete 3 more pages of math homework than reading homework, so if we let $\mathbf { X }$ be the number of pages of reading homework she had to complete, then the number of pages of math homework she had to complete is $_ { \mathrm { X } + 3 }$ . Therefore, the total number of pages she had to complete is $\mathbf { x } + \left( \mathbf { x } { + } 3 \right) = 8$ pages. So, $2 \mathrm { x } + 3 = 8$ . Solving for $\mathbf { X }$ , we get $\mathbf { X } = 2 . 5$ . So Rachel had to complete 2.5 pages of reading homework and 5.5 pages of math homework (3 more than reading homework) in all. Therefore, the answer (arabic numerals) is 10 pages.
+
+Q: In a school there are 868 girls and the rest are boys. If there are 281 more girls than boys How many pupils are there in that school?
+
+A: Let’s think step by step. The number of boys in the school is 868 girls - $2 8 1 \ \mathrm { g i r l s } = 5 8 7$ boys. The total number of pupils in the school is 868 girls $+ 5 8 7$ boys $= 1 4 5 5$ pupils. Therefore, the answer (arabic numerals) is 1455.
+
+Q: What are candles good for eliminating? Answer Choices: (A) shelf (B) board (C) church (D) table (E) dark
+
+A: Among A through E, the answer is E) dark. Candles are often used to provide light in dark places, such as during power outages or in camping situations.
+
+Q: How does going jogging generally affect one’s self esteem? Answer Choices: (A) feel better (B) feel pride (C) sweating (D) ocean (E) arthritis
+
+A: Among A through E, the answer is A) feel better. Going jogging can have a positive impact on one’s self esteem as it can release endorphins, also known as "feel-good" chemicals, which can improve mood and reduce stress. It also can help to improve the physical appearance and overall physical health, which can boost self-confidence and self-esteem.
+
+Q: James know that committing murder was wrong, but he thought that he could get away with it. He was really troubled and fearful because of what? Answer Choices: (A) happiness (B) problems (C) prosecution (D) distress (E) misery
+A: Among A through E, the answer is (C) prosecution.
+
+Q: How can someone die from eating hamburger? Answer Choices: (A) gas (B) getting full (C) mad cow disease (D) death (E) feel full
+
+A: Among A through E, the answer is (C) mad cow disease. Mad cow disease, also known as bovine spongiform encephalopathy (BSE), is a rare but serious condition that can occur in cattle. When a person eats meat from a cow infected with BSE, they can develop a similar disease called variant Creutzfeldt-Jakob disease (vCJD). vCJD is a fatal neurological disorder.
+
+Q: If there is a pond with trees around it, where it it likely located? Answer Choices: (A) ground (B) bathroom (C) forest (D) countryside (E) rural area
+
+A: Among A through E, the answer is (D) countryside or (E) rural area. A pond with trees around it is most likely found in a natural setting such as the countryside or a rural area, rather than in a man-made structure like a bathroom or indoors on the ground.
+
+Q: Why would a woman kill a stranger she met in a dark alley? Answer Choices: (A) being raped (B) get rid of (C) they didn’t know the passcode (D) get revenge (E) were evil
+
+A: Among A through E, the answer is D) get revenge. The woman may have felt that the stranger had wronged her in some way and wanted to take revenge. However, it is important to note that without more information, it is impossible to say for certain why the woman killed the stranger. Additionally, it should be noted that violence is not an acceptable form of revenge and there are other ways to resolve conflicts.
+
+Q: What would you do if you have curiosity but are blind and paralyzed? Answer Choices: (A) hear news (B) analyse (C) go somewhere (D) examine thing (E) see favorite show A: Among A through E, the answer is A and B. I would hear news and analyze it as I am a language model, and I can process and understand spoken or written information.
+
+Q: You should watch out for snakes if floating down what African body of water? Answer Choices: (A) wet grass (B) western texas (C) high grass (D) amazon river (E) tree A: Among A through E, the answer is (C) high grass. Snakes are often found in tall grass and can be a danger if floating down a body of water that has a lot of high grass along the banks.
+
+A: Let’s think step by step. Candles are commonly used to provide light, so (E) dark is a good answer choice. Therefore, among A through E, the answer is (E) dark.
+
+Q: James know that committing murder was wrong, but he thought that he could get away with it. He was really troubled and fearful because of what? Answer Choices: (A) happiness (B) problems (C) prosecution (D) distress (E) misery
+
+A: Let’s think step by step. James committed murder and was aware that it was wrong. He thought he could get away with it, but was troubled and fearful. Based on this information, the answer would be (C) prosecution. Therefore, among A through E, the answer is (C) prosecution.
+
+Q: How can someone die from eating hamburger? Answer Choices: (A) gas (B) getting full (C) mad cow disease (D) death (E) feel full
+
+Q: If there is a pond with trees around it, where it it likely located? Answer Choices: (A) ground (B) bathroom (C) forest (D) countryside (E) rural area
+A: Let’s think step by step. (D) countryside or (E) rural area. Therefore, among A through E, the answer is (D) countryside or (E) rural area.
+
+Q: What would you do if you have curiosity but are blind and paralyzed? Answer Choices: (A) hear news (B) analyse (C) go somewhere (D) examine thing (E) see favorite show
+
+A: Let’s think step by step. Option A: Hear news - this is a good choice as it would allow you to stay informed and engaged with current events. Option B: Analyze - This could also be a good choice as it would allow you to engage your mind and think critically. Option C: Go somewhere - This may not be a feasible option as you are paralyzed. Option D: Examine things - This may not be a feasible option as you are blind. Option E: See favorite show - This may not be a feasible option as you are blind. Considering the limitations you have, options A and B may be the most feasible for you to satisfy your curiosity. Therefore, among A through E, the answer is A and B: Hear news and Analyze.
+
+Q: You should watch out for snakes if floating down what African body of water? Answer Choices: (A) wet grass (B) western texas (C) high grass (D) amazon river (E) tree
+A: Let’s think step by step. The answer is (D) the Nile River. Therefore, among A through E, the answer is (E) tree, as this is the only one that is not a body of water. Q: Did mercenaries fight for England in the Glorious Revolution?
+A: The answer (Yes or No) is No. The Glorious Revolution of 1688-1689 in England was primarily fought by English and Scottish troops, and did not involve the use of mercenaries. It was a relatively bloodless conflict that saw the overthrow of King James II and the replacement of the Catholic monarchy with the Protestant monarchy of William and Mary. The revolution was primarily driven by political and religious motives and was not fought for mercenary gain.
+
+Q: Does a sea otter eat spiders?
+
+A: The answer (Yes or No) is No. Sea otters are carnivorous marine mammals and primarily eat fish, crustaceans, and mollusks. Spiders are not a part of their diet.
+
+Q: Did Modern Family win a Slammy award?
+
+A: The answer (Yes or No) is No, Modern Family did not win a Slammy award. The Slammy Awards are an annual awards show presented by the professional wrestling promotion WWE, and Modern Family is a television sitcom.
+
+Q: Did Ice make people rich?
+
+A: The answer (Yes or No) is Yes, the Ice trade has made people rich. The Ice trade refers to the commercial harvesting, transport and sale of natural ice, and it was a major industry in the 19th century. Ice was harvested from frozen rivers and lakes during the winter, and then stored in ice houses for use during the summer. The ice was then transported by ship or train to cities and towns, where it was sold to individuals and businesses for use in refrigeration. The ice trade was particularly profitable for those who controlled the ice harvesting and transportation operations.
+
+Q: Are the headquarters of All Nippon Airways near a beach?
+
+A: The answer (Yes or No) is No. The headquarters of All Nippon Airways (ANA) is located in Tokyo, Japan, which is not near a beach.
+
+Q: Would a baby gray whale fit in a tractor-trailer?
+
+A: The answer (Yes or No) is No, a baby gray whale would not fit in a tractor-trailer as they typically measure around 15-20 feet in length and weigh around 2,000-3,000 pounds at birth. Tractor-trailers are not designed to hold such large animals.
+
+Q: Is Tange Sazen hypothetically an ideal choice for a secretary job?
+
+A: The answer (Yes or No) is unknown as Tange Sazen is a fictional character and it is not clear what qualifications or abilities they possess that would make them a suitable candidate for a secretary job.
+
+Q: Would JPEG be a good format for saving an image of Da Vinci’s Vitruvian Man?
+
+A: The answer (Yes or No) is Yes, JPEG is a good format for saving an image of Da Vinci’s Vitruvian Man. It is a lossy compression format that is well-suited for photographs and other images with many colors and subtle gradations. It can reduce the file size of an image without significantly degrading its quality. Additionally, JPEG is a widely supported format that can be opened by most image editing software and web browsers.
+
+Q: Does Pantheon in Paris have a unique name?
+
+A: The answer (Yes or No) is Yes. The Pantheon in Paris is officially known as the "Pantheon of Paris" or the "Pantheon in the Latin Quarter." It is a famous landmark and tourist destination in the city, known for its architectural significance and historical importance.
+
+Q: Did mercenaries fight for England in the Glorious Revolution?
+A: Let’s think step by step. Yes, mercenaries fought for England in the Glorious Revolution of 1688. Therefore, the answer (Yes or No) is Yes.
+
+Q: Does a sea otter eat spiders?
+
+A: Let’s think step by step. No, sea otters primarily feed on shellfish and other marine animals, not spiders. Therefore, the answer (Yes or No) is No
+
+Q: Did Modern Family win a Slammy award?
+
+A: Let’s think step by step. Modern Family is a popular TV show that aired from 2009 to 2020. The Slammy Awards are annual awards given by the professional wrestling promotion WWE. It is unlikely that Modern Family won a Slammy Award. Therefore, the answer (Yes or No) is No.
+
+Q: Did Ice make people rich?
+
+A: Let’s think step by step. ICE (Intercontinental Exchange) is a financial and commodity market operator, it does not directly make people rich. The financial market’s performance and individual investments determine an individual’s wealth. However, ICE operates various marketplaces, including stock exchanges, which provide opportunities for investors to potentially grow their wealth. Therefore, the answer (Yes or No) is No.
+
+Q: Are the headquarters of All Nippon Airways near a beach?
+
+A: Let’s think step by step. No, the headquarters of All Nippon Airways (ANA) is located in Shiodome City Center, Minato-ku, Tokyo, Japan, which is not near a beach. Therefore, the answer (Yes or No) is No.
+
+Q: Would a baby gray whale fit in a tractor-trailer?
+
+A: Let’s think step by step. Gray whales reach up to 50 feet in length and can weigh up to 40 tons. A standard tractor-trailer is about 53 feet long and typically has a capacity of around 40-45 feet in length, so no, a baby gray whale would not fit in a tractor-trailer. Therefore, the answer (Yes or No) is No.
+
+Q: Is Tange Sazen hypothetically an ideal choice for a secretary job?
+
+A: Let’s think step by step. Tange Sazen is a fictional character and therefore, it is not possible to determine if they would be an ideal choice for a secretary job. Additionally, as a language model AI, I do not have any personal opinions on the matter. Therefore, the answer (Yes or No) is Not applicable.
+
+Q: Is a cory catfish likely to eat another living fish?
+
+A: Let’s think step by step. Yes, cory catfish may eat other living fish if they are small enough and can fit in their mouth. It is important to consider the size of the tank, the size of the fish, and their feeding habits when keeping them together. Therefore, the answer (Yes or No) is Yes.
+
+Q: Does Pantheon in Paris have a unique name?
+
+A: Let’s think step by step. The Pantheon in Paris is officially known as the "Pantheon of Paris" or simply "The Pantheon." It is not known by a unique name. Therefore, the answer (Yes or No) is No.
+
+premise: The pair of students came under scrutiny by the teacher. What is the cause?
+
+choice1: The students both received excellent grades.
+
+choice2: Their responses on the assignment were identical.
+
+answer: Choice 2: Their responses on the assignment were identical.
+
+premise: The boy threw a temper tantrum.
+What is the cause? choice1: His brother took his toys from him.
+choice2: He shared his toys with his brother.
+answer: choice1: His brother took his toys from him. premise: The woman read the newspaper.
+What is the effect? choice1: She discovered the outcome of the election.
+choice2: She casted a vote in the election.
+answer: choice1: She discovered the outcome of the election. premise: The woman was in a bad mood.
+What is the effect? choice1: She engaged in small talk with her friend.
+choice2: She told her friend to leave her alone.
+answer: choice2: She told her friend to leave her alone.
+
+premise: The woman banished the children from her property.
+
+What is the cause?
+
+choice1: The children hit a ball into her yard.
+
+choice2: The children trampled through her garden.
+
+answer: It is not specified in the premise what the cause of the woman banishing the children from her property is. The choices "The children hit a ball into her yard" and "The children trampled through her garden" are possible causes, but without more information it is not possible to determine which, if either, is correct.
+
+premise: The woman retired. What is the effect? choice1: She received her pension. choice2: She paid off her mortgage.
+
+answer: The effect of the woman retiring is not specified in the premise, so it is not possible to determine if either choice is correct. More information is needed to determine the specific effects of her retirement.
+
+premise:The computer was expensive to fix.
+What is the effect?
+choice1: I got it repaired.
+choice2: I bought a new one.
+answer: The effect of the computer being expensive to fix is either choice1: getting it repaired or choice2: buying a new one.
+
+premise: The boy threw a temper tantrum.
+
+What is the cause?
+
+choice1: His brother took his toys from him.
+
+choice2: He shared his toys with his brother.
+
+Let’s think step by step. The cause of the boy’s temper tantrum is not specified in the premise, so it is unclear whether the cause is choice 1 or choice 2. More information is needed to determine the cause. Therefore, between choice1 and choice2, the answer is unclear.
+
+premise: The woman read the newspaper.
+
+What is the effect?
+
+choice1: She discovered the outcome of the election.
+
+choice2: She casted a vote in the election.
+
+Let’s think step by step. The effect of the woman reading the newspaper is choice1: She discovered the outcome of the election. Reading the newspaper would provide her with information, such as the results of an election. Choice 2: She casted a vote in the election is not a direct effect of reading the newspaper as it is not mentioned in the premise. Therefore, between choice1 and choice2, the answer is choice1: She discovered the outcome of the election.
+
+premise: The woman banished the children from her property.
+
+What is the cause?
+
+choice1: The children hit a ball into her yard.
+
+choice2: The children trampled through her garden.
+
+Let’s think step by step. The cause of the woman banishing the children from her property is not specified in the premise. The choices provided, "The children hit a ball into her yard" and "The children trampled through her garden," are potential causes but they are not confirmed. Therefore, between choice1 and choice2, the answer is unknown.
+
+premise: The woman retired.
+
+What is the effect?
+
+choice1: She received her pension.
+
+choice2: She paid off her mortgage.
+
+Let’s think step by step. The effect of the woman retiring is that she is no longer actively working and may be eligible for retirement benefits such as a pension or social security. Choice 1, "She received her pension," is a potential outcome of her retirement. Choice 2, "She paid off her mortgage," is not directly related to her retirement and would likely have been affected by other factors such as income and savings. Therefore, between choice1 and choice2, the answer is choice1: She received her pension.
+
+premise:The computer was expensive to fix.
+
+What is the effect?
+
+choice1: I got it repaired.
+
+choice2: I bought a new one.
+
+Let’s think step by step. Choice 1: The effect of "I got it repaired" would likely be that the computer is now functional again, but the cost of the repair may have been significant. Choice 2: The effect of "I bought a new one" would likely be that you now have a functioning computer, but the cost of the new one plus the cost of repairing the old one may have been significant. Additionally, you would no longer have the old computer. Therefore, between choice1 and choice2, the answer is that both options result in a functioning computer, but both options may have significant costs and choice 2 would mean that you no longer have the old computer.
+
+Q: Take the last letters of each words in "Skyler Oliver Cristy Sierra" and concatenate them. A: The answer is "r r y a"
+Q: Take the last letters of each words in "Felipe Heidi Nino Bradley" and concatenate them. A: The answer is "e i o y"
+Q: Take the last letters of each words in "Nico Lorenzo Johanna Teresita" and concatenate them. A: The answer is "o o a a"
+Q: Take the last letters of each words in "Jason Betty Elisa Jay" and concatenate them.
+A: The answer is "n y a y"
+Q: Take the last letters of each words in "Bob Aman Richie Sana" and concatenate them. A: The answer is bncieana
+Q: Take the last letters of each words in "Marian Joanne Darrin Rohit" and concatenate them. A: The answer is "nntrh"
+Q: Take the last letters of each words in "Justin Neal Jt Lucia" and concatenate them.
+A: The answer is "ntljtcia"
+Q: Take the last letters of each words in "Carla Dolores Cooper Damion" and concatenate them. A: The answer is "lrcprdmn" Q: Take the last letters of each words in "Skyler Oliver Cristy Sierra" and concatenate them. A: Let’s think step by step. A: yroiverstyreri. Therefore, the answer is yroiverstyreri.
+Q: Take the last letters of each words in "Felipe Heidi Nino Bradley" and concatenate them. A: Let’s think step by step. A: "Felipe Heidi Nino Bradley" $- >$ "eipeideinradley" Therefore, the answer is "eipeideinradley".
+Q: Take the last letters of each words in "Nico Lorenzo Johanna Teresita" and concatenate them. A: Let’s think step by step. "Nico Lorenzo Johanna Teresita" $- >$ "oc ozenro hannajo atesiti" $- >$ "colojhatesit". Therefore, the answer is "colojhatesit".
+Q: Take the last letters of each words in "Jason Betty Elisa Jay" and concatenate them.
+A: Let’s think step by step. The last letters of each word are: "n", "y", "a", "y". Concatenating them results in "nyay". Therefore, the answer is "nyay"
+Q: Take the last letters of each words in "Bob Aman Richie Sana" and concatenate them.
+A: Let’s think step by step. "Bob Aman Richie Sana" $- >$ "bob" "aman" "richie" "sana" $- >$ "b" "n" "e" "a" $- >$ "bnea" Therefore, the answer is "bnea".
+Q: Take the last letters of each words in "Marian Joanne Darrin Rohit" and concatenate them. A: Let’s think step by step. A: ntnhtjrdro. Therefore, the answer is ntnhtjrdro.
+Q: Take the last letters of each words in "Justin Neal Jt Lucia" and concatenate them.
+A: Let’s think step by step. "Justin Neal Jt Lucia" $- >$ "niatn leaJ ttJ acilu" $- >$ "naltjtacilu". Therefore, the answer is "naltjtacilu".
+Q: Take the last letters of each words in "Carla Dolores Cooper Damion" and concatenate them. A: Let’s think step by step. Last letters of each word: "alr ores ooper amion". Concatenated result: "alroresooperamion". Therefore, the answer is "alroresooperamion". Q: A coin is heads up. Wilmer flips the coin. Valerie does not flip the coin. Melissa flips the coin.
+Eloisa flips the coin. Is the coin still heads up? Note that "flip" here means "reverse".
+
+A: The answer (Yes or No) is No, if the coin is flipped four times, the probability that it will be heads up is very low. Each flip has a $50 \%$ chance of resulting in the coin landing heads up or tails up. The coin is likely to end up in a tails up position after four flips.
+
+Q: A coin is heads up. Katia does not flip the coin. Mina does not flip the coin. Cam does not flip the coin. Ronda does not flip the coin. Is the coin still heads up? Note that "flip" here means "reverse".
+
+A: The answer (Yes or No) is Yes. Since none of the individuals (Katia, Mina, Cam, and Ronda) flipped the coin, the coin would still be heads up.
+
+Q: A coin is heads up. Forrest does not flip the coin. Juanito does not flip the coin. Allan does not flip the coin. Candice does not flip the coin. Is the coin still heads up? Note that "flip" here means "reverse".
+
+A: The answer (Yes or No) is Yes, the coin is still heads up.
+
+Q: A coin is heads up. Tomas does not flip the coin. Nic flips the coin. Zoila flips the coin. Calvin does not flip the coin. Is the coin still heads up? Note that "flip" here means "reverse"
+
+A: The answer (Yes or No) is Yes, the coin is still heads up. Since Tomas and Calvin did not flip the coin, it remains in its original state. Nic and Zoila flipping the coin would only change the current state of the coin.
+
+Q: A coin is heads up. Jeff does not flip the coin. Jen flips the coin. Giselle flips the coin. Noel does not flip the coin. Is the coin still heads up? Note that "flip" here means "reverse".
+
+A: The answer (Yes or No) is unknown without additional information about the outcome of Jen and Giselle flipping the coin. If both Jen and Giselle flipped the coin and it landed heads up each time, then it would still be heads up. If either of them flipped the coin and it landed tails up, then the coin would no longer be heads up.
+
+Q: A coin is heads up. Amy flips the coin. Ella does not flip the coin. Amilcar does not flip the coin.
+Roman does not flip the coin. Is the coin still heads up? Note that "flip" here means "reverse".
+
+A: The answer (Yes or No) is Yes, the coin is still heads up. Since Amy, Ella, Amilcar, and Roman did not flip the coin, the coin’s initial state of being heads up remains unchanged.
+
+Q: A coin is heads up. Lara does not flip the coin. Greg does not flip the coin. Ethan flips the coin.
+Terrence flips the coin. Is the coin still heads up? Note that "flip" here means "reverse".
+
+A: The answer (Yes or No) is unknown, as we do not know the outcome of Ethan and Terrence flipping the coin. If Ethan and Terrence both flipped the coin and it landed heads up each time, then the coin would still be heads up. If either of them flipped the coin and it landed tails up, then the coin would no longer be heads up.
+
+Q: A coin is heads up. Ronnie flips the coin. Kiki flips the coin. Alan flips the coin. Remy flips the coin. Is the coin still heads up? Note that "flip" here means "reverse".
+
+A: The answer (Yes or No) is No. Each flip of the coin has a $50 \%$ chance of resulting in the coin being heads up or tails up. Since the coin was initially heads up and each flip has a $50 \%$ chance of reversing the current state of the coin, it is likely that the coin will end up as tails up after multiple flips.
+
+Table 34: Example input and output pairs for Coin Flip with chain-of-thought (symbolic reasoning).
+
+Q: A coin is heads up. Wilmer flips the coin. Valerie does not flip the coin. Melissa flips the coin.
+Eloisa flips the coin. Is the coin still heads up? Note that "flip" here means "reverse".
+
+A: Let’s think step by step. At the start, the coin is heads up. When Wilmer flips the coin, it will be tails up. When Valerie does not flip the coin, it remains tails up. When Melissa flips the coin, it will be heads up again. Finally, when Eloisa flips the coin, it will be tails up again. Therefore, after all four flips, the coin is tails up. Therefore, the answer (Yes or No) is No.
+
+Q: A coin is heads up. Katia does not flip the coin. Mina does not flip the coin. Cam does not flip the coin. Ronda does not flip the coin. Is the coin still heads up? Note that "flip" here means "reverse". A: Let’s think step by step. Yes, the coin is still heads up. None of the individuals mentioned (Katia, Mina, Cam, Ronda) flipped the coin, so its original state (heads up) remains unchanged. Therefore, the answer (Yes or No) is Yes.
+
+Q: A coin is heads up. Forrest does not flip the coin. Juanito does not flip the coin. Allan does not flip the coin. Candice does not flip the coin. Is the coin still heads up? Note that "flip" here means "reverse".
+
+A: Let’s think step by step. Yes, the coin is still heads up as long as none of the individuals flip the coin, the coin’s current state will remain the same. Therefore, the answer (Yes or No) is Yes.
+
+Q: A coin is heads up. Tomas does not flip the coin. Nic flips the coin. Zoila flips the coin. Calvin does not flip the coin. Is the coin still heads up? Note that "flip" here means "reverse"
+
+A: Let’s think step by step. First, the coin is heads up before any flipping occurs. When Nic flips the coin, the coin will now be tails up. Then, when Zoila flips the coin, the coin will be heads up again. Finally, since Calvin does not flip the coin, the coin remains heads up. So, the final answer is yes, the coin is still heads up. Therefore, the answer (Yes or No) is Yes.
+
+Q: A coin is heads up. Jeff does not flip the coin. Jen flips the coin. Giselle flips the coin. Noel does not flip the coin. Is the coin still heads up? Note that "flip" here means "reverse".
+
+A: Let’s think step by step. If Jeff does not flip the coin, it remains heads up. Then, when Jen flips the coin, it would become tails up. Finally, when Giselle flips the coin, it would become heads up again. So, the final state of the coin after all these actions is heads up. Therefore, the answer (Yes or No) is Yes.
+
+Q: A coin is heads up. Amy flips the coin. Ella does not flip the coin. Amilcar does not flip the coin.
+Roman does not flip the coin. Is the coin still heads up? Note that "flip" here means "reverse".
+
+A: Let’s think step by step. Yes, the coin is still heads up, as none of the people mentioned flipped the coin, meaning it remained in its original state. Therefore, the answer (Yes or No) is Yes.
+
+Q: A coin is heads up. Lara does not flip the coin. Greg does not flip the coin. Ethan flips the coin.
+Terrence flips the coin. Is the coin still heads up? Note that "flip" here means "reverse".
+
+A: Let’s think step by step. Initially, the coin is heads up. If Lara and Greg do not flip the coin, then the coin remains heads up. However, if Ethan and Terrence both flip the coin, the coin will now be tails up. So, the final state of the coin will depend on whether Ethan and Terrence flipped it or not. Therefore, the answer (Yes or No) is No.
+
+Q: A coin is heads up. Ronnie flips the coin. Kiki flips the coin. Alan flips the coin. Remy flips the coin. Is the coin still heads up? Note that "flip" here means "reverse".
+
+A: Let’s think step by step. The initial state of the coin is heads up. When Ronnie flips the coin, it becomes tails up. When Kiki flips the coin, it becomes heads up again. When Alan flips the coin, it becomes tails up. And when Remy flips the coin, it becomes heads up again. So, the final state of the coin is heads up. Therefore, the answer (Yes or No) is Yes.
+
+Q: Today is Christmas Eve of 1937. What is the date tomorrow in MM/DD/YYYY? Answer Choices: (A) 12/25/2006 (B) 12/11/1937 (C) 12/25/1937 (D) 12/04/1937 (E) 07/25/1937 (F) 01/04/1938
+
+A: Among A through F, the answer is C) 12/25/1937 as Christmas Eve is December 24th and the next day is Christmas Day December 25th.
+
+Q: The day before yesterday was 11/23/1933. What is the date yesterday in MM/DD/YYYY? Answer Choices: (A) 11/25/1933 (B) 11/24/2020 (C) 12/22/1933 (D) 10/27/1933 (E) 11/24/1933 (F) 12/27/1933
+
+A: Among A through F, the answer is (E) 11/24/1933. The day before yesterday was 11/23/1933 and yesterday would be one day later, which is 11/24/1933.
+
+Q: Jane visits the bookstore on the 16th of each month starting from the October of 2009. It is her 5th visit to the bookstore today. What is the date 24 hours later in MM/DD/YYYY? Answer Choices: (A) 02/16/2010 (B) 02/17/2010 (C) 02/21/2010 (D) 03/27/2010 (E) 02/23/2010 (F) 02/03/2010
+
+A: Among A through F, the answer is B) 02/17/2010. Explanation: Since Jane visits the bookstore on the 16th of each month and today is her 5th visit, it is currently February 16th 2010. 24 hours later would be February 17th 2010.
+
+Q: The concert was scheduled to be on 06/01/1943, but was delayed by one day to today. What is the date 10 days ago in MM/DD/YYYY? Answer Choices: (A) 10/23/1942 (B) 05/21/1943 (C) 07/01/1943 (D) 05/23/1943 (E) 05/24/1943
+
+A: Among A through F, the answer is (D) 05/23/1943. The concert was delayed by one day, so 10 days ago from 06/01/1943 would be 05/23/1943.
+
+Q: On May 9th, 2017 Jane bought 40 eggs. She ate one per day. Today she ran out of eggs. What is the date 10 days ago in MM/DD/YYYY? Answer Choices: (A) 06/08/1933 (B) 06/14/2017 (C) 06/08/2017 (D) 06/22/2017 (E) 06/06/2017 (F) 05/15/2017
+
+A: Among A through F, the answer is (B) 06/14/2017. If Jane ate one egg per day and today she ran out of eggs, then 10 days ago is when she would have finished her 40th egg, and the date 10 days ago would be June 14th, 2017.
+
+Q: On May 9th, 2017 Jane bought 40 eggs. She ate one per day. Today she ran out of eggs. What is the date tomorrow in MM/DD/YYYY? Answer Choices: (A) 06/25/2017 (B) 08/05/2017 (C) 06/19/2017 (D) 06/13/2017 (E) 06/18/2017 (F) 06/21/2017
+
+A: Among A through F, the answer is D) 06/13/2017. Since Jane ate one egg per day, and she ran out of eggs on the day you asked the question, and it is the day she ran out of eggs, the date would be 40 days from the date she bought the eggs, which is May 9th $+ 4 0$ days $=$ June 13th, 2017.
+
+Q: Jane was born on the last day of February in 2000. Today is her 16-year-old birthday. What is the date 10 days ago in MM/DD/YYYY? Answer Choices: (A) 02/19/1979 (B) 02/12/2016 (C) 02/19/2105 (D) 01/09/2016 (E) 02/20/2016 (F) 02/19/2016 A: Among A through F, the answer is D) 01/09/2016. Since Jane is 16 years old today and was born on the last day of February in 2000, 10 days ago would be January 9th, 2016.
+
+Q: Today’s meeting is rescheduled to 11 am tomorrow, 10/16/1924. What is the date today in MM/DD/YYYY? Answer Choices: (A) 10/15/1835 (B) 10/14/1924 (C) 09/17/1924 (D) 10/15/1924 (E) 10/29/1924
+
+A: Among A through F, the answer is None of the above. The date today is not October 16th, 1924 as stated in the question. It is the present day, which is January 27th, 2023.
+
+Q: Today is Christmas Eve of 1937. What is the date tomorrow in MM/DD/YYYY? Answer Choices: (A) 12/25/2006 (B) 12/11/1937 (C) 12/25/1937 (D) 12/04/1937 (E) 07/25/1937 (F) 01/04/1938 A: Let’s think step by step. Today is Christmas Eve, which means tomorrow is Christmas Day. The current year is 1937. So the date tomorrow is 12/25/1937. Therefore, among A through F, the answer is (C) 12/25/1937.
+
+Q: The day before yesterday was 11/23/1933. What is the date yesterday in MM/DD/YYYY? Answer Choices: (A) 11/25/1933 (B) 11/24/2020 (C) 12/22/1933 (D) 10/27/1933 (E) 11/24/1933 (F) 12/27/1933
+
+A: Let’s think step by step. The day before yesterday was 11/23/1933. So yesterday would be 11/24/1933. So the answer is (E) 11/24/1933. Therefore, among A through F, the answer is $\mathrm { ( E ) }$ 11/24/1933.
+
+Q: The concert was scheduled to be on 06/01/1943, but was delayed by one day to today. What is the date 10 days ago in MM/DD/YYYY? Answer Choices: (A) 10/23/1942 (B) 05/21/1943 (C) 07/01/1943 (D) 05/23/1943 (E) 05/24/1943
+
+A: Let’s think step by step. The concert was delayed by one day, so if today is 06/01/1943, the original scheduled date would be 06/01/1943 - 1 day $=$ 05/31/1943. 10 days ago from 06/01/1943 would be 06/01/1943 - 10 days $=$ 05/22/1943. So, the answer is (B) 05/21/1943. Therefore, among A through F, the answer is (B) 05/21/1943.
+
+Q: On May 9th, 2017 Jane bought 40 eggs. She ate one per day. Today she ran out of eggs. What is the date 10 days ago in MM/DD/YYYY? Answer Choices: (A) 06/08/1933 (B) 06/14/2017 (C) 06/08/2017 (D) 06/22/2017 (E) 06/06/2017 (F) 05/15/2017
+
+A: Let’s think step by step. If Jane ate one egg per day, and she ran out of eggs today, then the number of days since she bought the eggs is equal to the number of eggs she bought, which is 40. If today is the day she ran out of eggs, then ten days ago would be 40 days - 10 days $= 3 0$ days. So the date 10 days ago would be May 9th, $2 0 1 7 + 3 0$ days $=$ June 8th, 2017. Therefore, the correct answer is (C) 06/08/2017. Therefore, among A through F, the answer is (C) 06/08/2017.
+
+Q: On May 9th, 2017 Jane bought 40 eggs. She ate one per day. Today she ran out of eggs. What is the date tomorrow in MM/DD/YYYY? Answer Choices: (A) 06/25/2017 (B) 08/05/2017 (C) 06/19/2017 (D) 06/13/2017 (E) 06/18/2017 (F) 06/21/2017
+
+A: Let’s think step by step. (D) 06/13/2017 is the correct answer. If Jane bought 40 eggs on May 9th and ate one per day, then 40 days later on June 18th she would have no eggs left. The next day would be June 13th. Therefore, among A through F, the answer is (D) 06/13/2017.
+
+Q: Jane was born on the last day of Feburary in 2000. Today is her 16-year-old birthday. What is the date 10 days ago in MM/DD/YYYY? Answer Choices: (A) 02/19/1979 (B) 02/12/2016 (C) 02/19/2105 (D) 01/09/2016 (E) 02/20/2016 (F) 02/19/2016
+
+A: Let’s think step by step. Today is Jane’s 16th birthday, so that means she was born 16 years ago. Since the year 2000 is a leap year, February has 29 days. So, her birthday is on 02/29/2000. If we go back 10 days from her birthday, that would be 02/19/2016. Therefore, the correct answer is (F) 02/19/2016. Therefore, among A through F, the answer is (F) 02/19/2016.
+
+Q: Alice, Bob, and Claire are friends and avid readers who occasionally trade books. At the start of the semester, they each buy one new book: Alice gets Moby Dick, Bob gets The Great Gatsby, and Claire gets Lolita. As the semester proceeds, they start trading around the new books. First, Claire and Bob swap books. Then, Alice and Claire swap books. Finally, Alice and Bob swap books. At the end of the semester, Bob has
+Which choice is true ? Answer Choices: (A) Moby Dick. (B) The Great Gatsby. (C) Lolita. A: Among A through C, the answer is (B) The Great Gatsby.
+
+Q: Alice, Bob, and Claire are playing a game. At the start of the game, they are each holding a ball: Alice has a green ball, Bob has a purple ball, and Claire has a blue ball. As the game progresses, pairs of players trade balls. First, Bob and Alice swap balls. Then, Claire and Bob swap balls. Finally, Bob and Alice swap balls. At the end of the game, Bob has the
+
+A: Among A through C, the answer is B) purple ball.
+
+Q: Alice, Bob, and Claire are holding a white elephant gift exchange. At the start of the event, they are each holding a present of a different color: Alice has a yellow present, Bob has a white present, and Claire has a purple present. As the event progresses, pairs of people swap gifts. First, Alice and Bob swap their gifts. Then, Bob and Claire swap their gifts. Finally, Bob and Alice swap their gifts. At the end of the event, Bob has the
+Which choice is true ? Answer Choices: (A) yellow present. (B) white present. (C) purple present. A: Among A through C, the answer is (B) white present. Q: Alice, Bob, and Claire are friends and avid readers who occasionally trade books. At the start of the semester, they each buy one new book: Alice gets Catch-22, Bob gets Lolita, and Claire gets Hound of the Baskervilles. As the semester proceeds, they start trading around the new books. First, Bob and Alice swap books. Then, Bob and Claire swap books. Finally, Alice and Claire swap books. At the end of the semester, Claire has
+Which choice is true ? Answer Choices: (A) Catch-22. (B) Lolita. (C) Hound of the Baskervilles. A: Among A through C, the answer is (C) Hound of the Baskervilles. Q: Alice, Bob, and Claire are playing a game. At the start of the game, they are each holding a ball: Alice has a purple ball, Bob has a yellow ball, and Claire has a orange ball. As the game progresses, pairs of players trade balls. First, Claire and Bob swap balls. Then, Bob and Alice swap balls. Finally, Claire and Bob swap balls. At the end of the game, Alice has the
+Which choice is true ? Answer Choices: (A) purple ball. (B) yellow ball. (C) orange ball.
+A: Among A through C, the answer is B) yellow ball. Q: Alice, Bob, and Claire are friends and avid readers who occasionally trade books. At the start of the semester, they each buy one new book: Alice gets Hound of the Baskervilles, Bob gets Catch-22, and Claire gets The Pearl. As the semester proceeds, they start trading around the new books. First, Claire and Bob swap books. Then, Bob and Alice swap books. Finally, Claire and Alice swap books. At the end of the semester, Claire has
+Which choice is true ? Answer Choices: (A) Hound of the Baskervilles. (B) Catch-22. (C) The Pearl. A: Among A through C, the answer is (A) Hound of the Baskervilles.
+
+
Table 38: Example input and output pairs for Tracking Shufed Objects with chain-of-thought (logical reasoning)
Q: Alice, Bob,and Claire are friends and avid readers who occasionally trade books.At the start of the semester, they each buy one new book: Alice gets Moby Dick, Bob gets The Great Gatsby, and Claire gets Lolita. As the semester proceeds, they start trading around the new books. First, Claire and Bob swap books. Then, Alice and Claire swap books. Finally, Alice and Bob swap books. At the end of the semester, Bob has Which choice is true ? Answer Choices: (A) Moby Dick. (B) The Great Gatsby. (C) Lolita. A: Let's think step by step. At the start of the semester, Bob has (B) The Great Gatsby. After the first trade, Claire and Bob swap books, so Bob now has (C) Lolita. After the second trade,Alice and Claire swap books, so Bob now has (A) Moby Dick. After the final trade, Alice and Bob swap books,so Bob now has (B) The Great Gatsby. Therefore, the correct answer is (B) The Great Gatsby. Therefore, among A through C, the answer is (B) The Great Gatsby.
Q: Alice, Bob,and Claire are playing a game. At the start of the game, they are each holding a ball: Alice has a green ball,Bob has a purple ball,and Claire has a blue ball. As the game progresses, pairs of players trade balls. First,Bob and Alice swap balls.Then, Claire and Bob swap balls.Finally, Bob and Alice swap balls. At the end of the game, Bob has the Which choice is true ? Answer Choices: (A) green ball. (B) purple ball. (C) blue ball. A: Let's think step by step. At the start of the game,Bob has a purple ball. In the first trade, Bob and Alice swap balls, so Bob now has a green ball. In the second trade, Claire and Bob swap balls, so Bob
now has a blue ball In the final trade,Bob and Alice swap balls again, so Bob ends the game with the green ball. Therefore, the correct answer is (A) green ball. Therefore, among A through C, the answer is (A) green ball. Q: Alice,Bob,and Claire are holding a white elephant gift exchange. At the start of the event, they are each holding a present of a different color: Alice has a yellow present, Bob has a white present, and Claire has a purple present. As the event progresses, pairs of people swap gifts. First, Alice and Bob swap their gifts. Then, Bob and Claire swap their gifts. Finally, Bob and Alice swap their gifts. At the end of the event,Bob has the Which choice is true ? Answer Choices: (A) yellow present. (B) white present. (C) purple present.
+
+Please identify whether the premise entails the hypothesis. The answer should be exact ’entail’ or ’not entail’.
+
+premise: Dana Reeve, the widow of the actor Christopher Reeve, has died of lung cancer at age 44, according to the Christopher Reeve Foundation.
+
+hypothesis: Christopher Reeve had an accident.
+
+answer: Not entail.
+
+Please identify whether the premise entails the hypothesis. The answer should be exact ’entail’ or ’not entail’.
+
+premise: Security forces were on high alert after an election campaign in which more than 1,000 people, including seven election candidates, have been killed.
+
+hypothesis: Security forces were on high alert after a campaign marred by violence.
+
+answer: Entail.
+
+Please identify whether the premise entails the hypothesis. The answer should be exact ’entail’ or ’not entail’.
+
+premise: Steve Jobs was attacked by Sculley and other Apple executives for not delivering enough hot new products and resigned from the company a few weeks later.
+
+hypothesis: Steve Jobs worked for Apple.
+
+answer: Entail.
+
+Please identify whether the premise entails the hypothesis. The answer should be exact ’entail’ or ’not entail’.
+
+premise: Nokia, Texas Instruments and other leading makers of mobile phones have formally complained to Brussels that Qualcomm, the US mobile chipmaker, has unfairly used its patents on 3G technologies.
+
+hypothesis: Texas Instruments produces mobile phones.
+
+answer: Not entail.
+
+Please identify whether the premise entails the hypothesis. The answer should be exact ’entail’ or ’not entail’.
+
+premise: Ssangyong Motor was taken over by creditors after it collapsed under heavy debts during the 1997-98 Asian financial crisis.
+
+hypothesis: Asian financial crisis takes over Ssangyong Motor
+
+answer: Entail
+
+Please identify whether the premise entails the hypothesis. The answer should be exact ’entail’ or ’not entail’.
+
+premise: At the same time the Italian digital rights group, Electronic Frontiers Italy, has asked the nation’s government to investigate Sony over its use of anti-piracy software.
+
+hypothesis: Italy’s government investigates Sony.
+answer: Entail.
+
+Please identify whether the premise entails the hypothesis. The answer should be exact ’yes’, ’no’ or ’neutral’.
+
+premise: Valence the void-brain, Valence the virtuous valet. Why couldn’t the figger choose his own portion of titanic anatomy to shaft? Did he think he was helping?
+
+hypothesis: Valence was helping
+
+answer: No.
+
+Please identify whether the premise entails the hypothesis. The answer should be exact ’yes’, ’no’ or ’neutral’.
+
+premise: And I don’t want to have to lie to them. The kidnappers have given us until October the eleventh to deliver the document and I haven’t despaired of finding it before then. But if the police learn I ’ve been to America they ’ll ask why.
+
+hypothesis: he’s been to America
+
+answer: yes
+
+Please identify whether the premise entails the hypothesis. The answer should be exact ’yes’, ’no’ or ’neutral’.
+
+premise: B: how’d you like to own a piece of property where your lake is going sour because of acid rain. A: Right. Right. B: It’s, uh, really a serious issue for those of us up in this, uh, sector up here. A: um, or do you hypothesize that most of the, uh, smog or air pollution comes from vehicles
+
+hypothesis: most of the smog or air pollution comes from vehicles
+
+answer: neutral
+
+Please identify whether the premise entails the hypothesis. The answer should be exact ’yes’, ’no’ or ’neutral’.
+
+premise: A: and that rolling kind of, uh, B: Terrain. A: Yeah. is fairly famili-,. The thing that I thought was interesting was that the critics, apparently it’s going to win everything. B: Really? A: Uh, and I had been told, you know, you wouldn’t notice that it was three hours long, and all this, kind of,
+
+hypothesis: it was three hours long
+
+answer: neutral
+
+Please identify whether the premise entails the hypothesis. The answer should be exact ’yes’, ’no’ or ’neutral’.
+
+premise: A: I do too, so she couldn’t possibly turn them out like some of these popular writers, B:
+
+uh-uh. A: but oh, her books are just incredible. I don’t think they’ve ever made a movie, do y
+
+hypothesis: they’ve ever made a movie
+
+answer: neutral
+
+Please identify whether the premise entails the hypothesis. The answer should be exact ’yes’, ’no’ or ’neutral’.
+
+premise: What had brought Gharr and Ten-huc and Pulvidon to the planet at the same time? Why were all of them so interested in why I was there? And if they somehow suspected that I was picking up something valuable why would any of them try to kill me before the pick-up?
+
+hypothesis: she was picking up something valuable answer: neutral
+
+Please answer the given question based on the context. The answer should be exact ’yes’ or ’no’.
+
+context: Phantom pain – Phantom pain sensations are described as perceptions that an individual experiences relating to a limb or an organ that is not physically part of the body. Limb loss is a result of either removal by amputation or congenital limb deficiency. However, phantom limb sensations can also occur following nerve avulsion or spinal cord injury.
+
+question: is pain experienced in a missing body part or paralyzed area
+
+answer: Yes.
+
+Please answer the given question based on the context. The answer should be exact ’yes’ or ’no’.
+
+context: American entry into Canada by land – Persons driving into Canada must have their vehicle’s registration document and proof of insurance.
+
+question: can u drive in canada with us license
+
+answer: Yes.
+
+Please answer the given question based on the context. The answer should be exact ’yes’ or ’no’.
+
+context: Gambling in Australia – Gamblers’ winnings in Australia are not taxed . There are 3 main reasons for that:
+
+question: do you pay tax on gambling winnings in australia
+
+answer: No.
+
+Please answer the given question based on the context. The answer should be exact ’yes’ or ’no’.
+
+context: Cloak – Ladies may wear a long (over the shoulders or to ankles) cloak usually called a cape, or a full-length cloak. Gentlemen wear an ankle-length or full-length cloak. Formal cloaks often have expensive, colored linings and trimmings such as silk, satin, velvet and fur.
+
+question: is a cape and a cloak the same
+
+answer: No
+
+Please answer the given question based on the context. The answer should be exact ’yes’ or ’no’.
+
+context: Donna Pinciotti – In the final episode, Eric returns to Point Place for the New Year and he and Donna kiss. It is presumed that they end up together again at the end of the series and the end of the 1970s.
+
+question: do donna and eric end up getting married answer: It is not specified if Donna and Eric end up getting married in the series "That ’70s Show."
+
+Please answer the given question based on the context. The answer should be exact ’yes’ or ’no’.
+
+context: Cold Case – Due to the use of contemporary music in each episode, none of the seasons are presently available on DVD, due to music licensing issues. However, the entire series, incorporating the contemporary music, was previously released on DVD as Cold Case: The Complete Edition, by CBS Productions (ISBN 8-5857-9659-6), on 44 dual-layer disks, in a single boxed set. This set is out of print.
+
+question: will cold case ever be released on dvd answer: It is unclear if Cold Case will ever be released on DVD again.
+
+Q: f : why all the candles ? is the electricity out or something ? m : no , i just thought it would make the place smell nice . f : it does smell nice , but it ’s still awfully dark . Which choice is correct ? Answer Choices: (A) m : yes . the candles smell terrible . (B) m : yes . the candles are not bright enough and they smells bad . (C) m : yes . the room is still dark even the candles were lit . (D) m : yes . the candles are better than electricity because they are very bright .
+
+A: Among A through D, the answer is C: m : yes . the room is still dark even the candles were lit .
+
+Q: m : is it ok if i pay for this book by visa ? i have n’t got much cash on me . f : we ca n’t really take cards for amounts under 5 pounds . that one ’s only 3.99 pounds , is n’t it ? Which choice is correct ? Answer Choices: (A) m : yes . why do you have to use a credit card ? (B) m : yes . you need to pay by cash . (C) m : yes . you pay 3.99 pounds by check ? (D) m $:$ yes . you need to pay for this t-shirt by cash .
+
+A: Among A through D, the answer is (B) m : yes . you need to pay by cash .
+
+Q: m : what color should we paint the walls of the babies room , red ? f : i do n’t like the color red . what about blue or yellow $? \textrm { m : i }$ do n’t like yellow very much . i ’m sorry , but the first one you mentioned sounds fine . Which choice is correct ? Answer Choices: (A) f : okay , then we will pick blue . (B) f : as your wish , we will choose your favorite color yellow . (C) f : same as you , i prefer red . (D) f $:$ blue for the ceiling ? do n’t be ridiculous .
+
+A: Among A through D, the answer is A: f : okay, then we will pick blue.
+
+Q: f : dad , can i go out tonight ? m : no , i ’m sorry . you ca n’t . f : can i ask nancy for dinner $\smash { ? \mathrm { ~ m ~ } }$ : ok , but you ca n’t let your brother alone . Which choice is correct ? Answer Choices: (A) f : ok. then i will ask nancy for dinner tonight . (B) f : i will stay at home alone because i do n’t want ask nancy for dinner . (C) f : ok. so i can ask nancy for dinner tonight if i do n’t have to have my brother companied . (D) f : i have to stay home with me brother because i will not ask nancy to have dinner . A: Among A through D, the answer is (C) f : ok. so i can ask nancy for dinner tonight if i do n’t have to have my brother companied .
+
+Q: f : i ’m very disappointed at the new house . i expected it to be much better . m : you ca n’t say that , rose . i think it ’s much better than mine . Which choice is correct ? Answer Choices: (A) f : why do you think my house is astonishing but still not better than yours ? (B) f : why do you think my house is much better than yours ? you are so satisfying with my house . (C) f $:$ why do you think my house is disappointing ? (D) f : why do you think your house is much better than mine ? you are so satisfying with your house .
+
+A: Among A through D, the answer is C) f : why do you think my house is disappointing?
+
+Q: f : you mistook the salt for sugar ? i told you the salt was in the black container and the sugar was in the white one . m : yes , that was so silly of me . i forgot that you told me and i could n’t tell the difference at the time . this coffee is terrible now . Which choice is correct ? Answer Choices: (A) f : i ’m sorry . i gave you the wrong information . (B) f $:$ you put the sugar in the black container . my god . (C) f : you added salt to your coffee . oh , no . (D) f : you added salt to you coffee . no ! you added salt to mine ?
+
+A: Among A through D, the answer is (D) f: you added salt to you coffee. no! you added salt to mine?
+
+Eric: MACHINE! Rob: That’s so gr8! Eric: I know! And shows how Americans see Russian ;) Rob: And it’s really funny! Eric: I know! I especially like the train part! Rob: Hahaha! No one talks to the machine like that! Eric: Is this his only stand-up? Rob: Idk. I’ll check. Eric: Sure. Rob: Turns out no! There are some of his stand-ups on youtube. Eric: $\mathrm { G r } 8 !$ I’ll watch them now! Rob: Me too! Eric: MACHINE! Rob: MACHINE! Eric: TTYL? Rob: Sure :)
+
+TL;DR: Eric and Rob are discussing a stand-up comedy routine involving a machine, and they find it funny. They plan to watch more of the comedian’s stand-up on YouTube and say "TTYL" before ending the conversation.
+
+Beatrice: I am in town, shopping. They have nice scarfs in the shop next to the church. Do you want one? Leo: No, thanks Beatrice: But you don’t have a scarf. Leo: Because I don’t need it. Beatrice: Last winter you had a cold all the time. A scarf could help. Leo: I don’t like them. Beatrice: Actually, I don’t care. You will get a scarf. Leo: How understanding of you! Beatrice: You were complaining the whole winter that you’re going to die. I’ve had enough. Leo: Eh.
+
+TL;DR: Leo is shopping in town with Beatrice and a friend. The friend suggests buying a scarf, but Leo does not want one because he does not like them. Beatrice insists on buying him one despite his reluctance, citing that he was constantly cold last winter and complained about it.
+
+Jeff: Should we go to the village party? Lia: I’m too tired after hiking Mico: I’d like to go, there may be some hot boys! Lia: I doubt Jim: like a real village boy? Jim: who doesn’t even speak English? Mico: yes, the dummer, the better Jim: haha, stupid fucks good, they say Mico: I confirm! Lia: not my cup of tea Mico: I’ll go there, who wants to join? Jeff: I’ll go as well Mico: wanna drive? Jeff: so you could drink? Mico: would be nice, hahah Jeff: not excited, but ok Mico: thanks!
+
+TL;DR: Mico and Jeff want to go to a village party, Lia is tired from hiking and not interested, Jim makes a derogatory comment about the village people and Mico agrees. Mico wants to drink at the party and asks Jeff to drive.
+
+Lisa: Hello Peter. What have you been doing off late? Peter: Bit busy with work. Lisa: Too much of work, huh? Peter: Not really, I’ve been working out Lisa: Ohh, trying to get in shape? Peter: Nah, I don’t have much of weight to lose, just want to improve my health. Lisa: That’s a good thought. I was also thinking of working out a bit. What do you do? Do you go to a Gym? Peter: Yes, I hold a membership with the one near our office. Lisa: Which exercises do you do regularly? Peter: I do weights and run on the treadmill. Lisa: Besides exercises, I think I need to eat better to help me keep in shape. Peter: Another major requirement for good health is sleep. On an average one requires at least 7-8 hours of sleep. Lisa: There are a lot of things we can do to stay healthy. Peter: Yes. One needs to maintain a regime to stay healthy for a long term.
+
+TL;DR: Peter and Lisa are discussing their recent activities, with Peter mentioning that he has been busy with work but also working out to improve his health. He holds a membership at a gym near their office and regularly does weights and runs on the treadmill. Lisa also expresses interest in working out and eating better to stay in shape. Peter also mentions that getting enough sleep is important for overall health and that maintaining a regime is key to long-term health.
+
+Please identify Person, Organization, Location and Miscellaneous Entity from the given text.
+
+Text: State Street Bank and Trust Company
+
+Entity:
+
+Person: None
+
+Organization: State Street Bank and Trust Company
+
+Location: None
+
+Miscellaneous: None
+
+Please identify Person, Organization, Location and Miscellaneous Entity from the given text.
+
+Text: Fourteen years after he bludgeoned and shot a man whose trailer home he robbed in 1982 , John Mills Jr .
+
+Entity: Person: John Mills Jr. Organization: None Location: None Miscellaneous: None
+
+Please identify Person, Organization, Location and Miscellaneous Entity from the given text.
+
+Text: Voeks , who was already on probation for prior pig thefts , pleaded that he was trying to pay bills for his ex-wife and children .
+
+Entity:
+Person: Voeks
+Organization: None
+Location: None
+Miscellaneous: pig thefts, probation, ex-wife, children, bills
+
+Please identify Person, Organization, Location and Miscellaneous Entity from the given text.
+
+Text: NYMEX natgas ends sharply lower on weather outlook .
+
+Entity:
+
+- Person: None
+- Organization: NYMEX (New York Mercantile Exchange)
+- Location: None
+- Miscellaneous: natgas (natural gas), weather outlook
+
+Please identify Person, Organization, Location and Miscellaneous Entity from the given text.
+
+Text: He was fined and ordered to pay a total of 175 pounds to two members of staff injured in the fracas in an east London restaurant in October .
+
+Entity:
+Person: He
+Organization: None
+Location: east London Miscellaneous: None
+
+Please identify Person, Organization, Location and Miscellaneous Entity from the given text.
+
+Text: Offerings light .
+
+# Entity:
+
+I’m sorry, I cannot identify any entities from the given text as it is not a complete sentence and does not contain enough context to make any determinations. Can you please provide more information or a more complete sentence?
+
+For each snippet of text, label the sentiment of the text as positive or negative. The answer should be exact ’positive’ or ’negative’.
+
+Text: it ’s played in the most straight-faced fashion , with little humor to lighten things up .
+
+Label: Negative
+
+For each snippet of text, label the sentiment of the text as positive or negative. The answer should be exact ’positive’ or ’negative’.
+
+Text: although german cooking does not come readily to mind when considering the world ’s best cuisine , mostly martha could make deutchland a popular destination for hungry tourists .
+
+Label: positive
+
+For each snippet of text, label the sentiment of the text as positive or negative. The answer should be exact ’positive’ or ’negative’.
+
+Text: at times , the suspense is palpable , but by the end there ’s a sense that the crux of the mystery hinges on a technicality that strains credulity and leaves the viewer haunted by the waste of potential .
+
+Label: Negative
+
+For each snippet of text, label the sentiment of the text as positive or negative. The answer should be exact ’positive’ or ’negative’.
+
+Text: ramsay , as in ratcatcher , remains a filmmaker with an acid viewpoint and a real gift for teasing chilly poetry out of lives and settings that might otherwise seem drab and sordid .
+
+Label: positive
+
+For each snippet of text, label the sentiment of the text as positive or negative. The answer should be exact ’positive’ or ’negative’.
+
+Text: may be far from the best of the series , but it ’s assured , wonderfully respectful of its past and thrilling enough to make it abundantly clear that this movie phenomenon has once again reinvented itself for a new generation .
+
+Label: Negative
+
+For each snippet of text, label the sentiment of the text as positive or negative. The answer should be exact ’positive’ or ’negative’.
+
+Text:american chai encourages rueful laughter at stereotypes only an indian-american would recognize
+
+# Label: positive
+
+For each snippet of text, label the sentiment of the text as positive or negative. The answer should be exact ’positive’ or ’negative’.
+
+Text: whether you like rap music or loathe it , you ca n’t deny either the tragic loss of two young men in the prime of their talent or the power of this movie .
+
+Label: Negative
+
+For each snippet of text, label the sentiment of the text as positive or negative. The answer should be exact ’positive’ or ’negative’.
+
+Text: so , too , is this comedy about mild culture clashing in today ’s new delhi .
+
+Label: It is not clear from this text snippet alone whether the sentiment expressed is positive or negative. The text is simply describing the subject of a comedy. Additional context would be needed to determine the sentiment.
\ No newline at end of file
diff --git a/md/dev/u3vEuRr08MT/u3vEuRr08MT.md b/md/dev/u3vEuRr08MT/u3vEuRr08MT.md
new file mode 100644
index 0000000000000000000000000000000000000000..00e33c60694379e424d069bf4ae4063b9d931a2d
--- /dev/null
+++ b/md/dev/u3vEuRr08MT/u3vEuRr08MT.md
@@ -0,0 +1,364 @@
+# Memorization Without Overfitting: Analyzing the Training Dynamics of Large Language Models
+
+Kushal Tirumala⇤ Aram H. Markosyan⇤ Luke Zettlemoyer Armen Aghajanyan
+
+Meta AI Research {ktirumala,amarkos,lsz,armenag}@fb.com
+
+# Abstract
+
+Despite their wide adoption, the underlying training and memorization dynamics of very large language models is not well understood. We empirically study exact memorization in causal and masked language modeling, across model sizes and throughout the training process. We measure the effects of dataset size, learning rate, and model size on memorization, finding that larger language models memorize training data faster across all settings. Surprisingly, we show that larger models can memorize a larger portion of the data before over-fitting and tend to forget less throughout the training process. We also analyze the memorization dynamics of different parts of speech and find that models memorize nouns and numbers first; we hypothesize and provide empirical evidence that nouns and numbers act as a unique identifier for memorizing individual training examples. Together, these findings present another piece of the broader puzzle of trying to understand what actually improves as models get bigger.
+
+# 1 Introduction
+
+The rate and extent to which a model memorizes its training data are key statistics that provide evidence about how it is likely to generalize to new test instances. Classical frameworks, such as bias-variance tradeoff $\textcircled { \left| 3 1 \right| }$ , argued for fitting a training set without full memorization. However, recent work has established a more symbiotic relationship between memorization and generalization in deep learning [13, 26, 28]. This paper empirically studies memorization in causal and masked language modeling, across model sizes and throughout the training process.
+
+Much of the recent performance gains for language models have come from scale, with the most recent models reaching up to $1 0 ^ { 1 1 }$ parameters $\frac { \sim } { 1 2 2 } , \boxed { 7 3 } \boxed { 8 3 }$ . Larger models are also known to memorize more training data $\boxed { 1 6 }$ , which is a crucial component of their improved generalization. However, perhaps surprisingly, relatively little work has been done in understanding the impact of scale on the dynamics of language model memorization over training. Existing work focuses on analyzing memorization post-training [16, 47, 88, 95]. In this work, we study the memorization and forgetting dynamics in language models, with a focus on better measuring how they change as we scale up model size. Our primary contributions include:
+
+1. We measure the dependence of memorization dynamics over training on model size (and other factors such as dataset size, overfitting, and learning rate). We find that larger language models memorize training data faster $( \ S 4 )$ .
+
+2. We design controlled experiments that allow us to characterize the forgetting curves in language models (i.e., how language models naturally forget memories throughout training).
+
+Our empirical studies show that forgetting curves have lower bounds — we coin this as the forgetting baseline — and that this baseline increases with model scale, i.e., increasing model scale mitigates forgetting $( \ S \ S )$ .
+
+3. We analyze the rates of memorization of different parts of speech, finding that nouns and numbers are memorized much more quickly than other parts of speech $( \ S \ 4 . 4 )$ We hypothesize this is because the set of nouns and numbers can be seen as a unique identifier for a particular sample. We provide evidence to this hypothesis by analyzing the rates of memorization in the setting of an existing unique identifier $( \ S \boxed { 4 . 3 } )$
+
+Together, these findings present another piece of the broader puzzle of trying to understand the unique training dynamics that emerge as models grow in size.
+
+# 2 Background and Related Work
+
+Memorization in Language Models: Unintended memorization is a known challenge for language models [14, 85], which makes them open to extraction attacks [15, 89] and membership inference attacks [41, 64], although there has been work on mitigating these vulnerabilities [51, 88]. Recent work has argued that memorization is not exclusively harmful, and can be crucial for certain types of generalization (e.g., on QA tasks) [11, 46, 87], while also allowing the models to encode significant amounts of world or factual knowledge [4, 35, 71]. There is also a growing body of work analyzing fundamental properties of memorization in language models [16, 47, 60, 95]. Most related to our work Carlini et al. $\boxed { 1 6 }$ analyzes memorization of fully trained language models and observes a dependence on model scale, training data duplication, and prompting context length. While we also study scaling behavior, our focus instead is on the memorization dynamics throughout training.
+
+Language Model Training Dynamics: Previous work has extensively analyzed training dynamics to understand how neural models acquire information over training [1, 30, 34, 66, 74]. Saphra and Lopez $\overline { { [ 8 0 ] } }$ were the first to analyze training dynamics for language modeling, focusing on the evolution of internal representations over pre-training. This inspired a line of work analyzing how neural language models learn linguistic structure/world knowledge $[ \overline { { 2 0 } } ] [ 2 1 ] [ 5 3 ]$ , individual words $\pmb { \mathbb { \left[ 1 7 \right] } }$ , and cross-lingual structure $\tilde { \left\| 1 0 \right\| }$ over pre-training. This analysis has been extended to many downstream tasks, including text summarization $\pmb { \mathbb { B 3 } }$ , machine/speech translation [81, 86, 92], and various NLP tasks [36, 61].
+
+Forgetting in Language Models: There has also been work studying memory degradation (forgetting) in language models. Catastrophic forgetting or catastrophic interference, first reported in $\frac { 1 } { 1 5 9 } [ \overbrace { 7 7 } ]$ , studies how neural networks tend to forget the information from previous trained tasks or training batches, when trained on new data. This provides a key challenge for continual learning (or life-long learning) [19], where the goal is to gradually learn from a single pass over a, typically very large, stream of data. A number of mechanisms have been proposed for increasing robustness against catastrophic forgetting [2, 18, 24, 49, 58, 82]. There is also a growing body of work demonstrating that both model and dataset scale can make models more resistant to forgetting $\pm \pm \pm \pm \pm$ , as well as work characterizing how forgetting naturally occurs in image classifiers $\boxed { 9 0 }$ and how forgetting can improve training efficiency [5]. Machine unlearning is a technique that forces a trained model to forget a previously learned sample [12, 54], which is primarily motivated by data protection and privacy regulations [37, 57, 78, 91]. Our work is unique in its focus on measuring forgetting during training, and quantifying how it varies with scale.
+
+Scaling Laws: We have consistently seen performance gains by scaling model size [3, 22, 73, 76, 83], and scale itself has been known to push internal model behavior away from classical bias-variance regimes $\lVert \overline { { 6 7 } } \rVert$ . Recent efforts have focused on trying to model the scaling laws for language models, including data and model size $\textcircled { 1 4 4 } , \textcircled { 7 9 } \textcircled { }$ , applications to transfer learning $\overline { { \vert 4 0 \vert } }$ , routing networks $\pm \pmb { \left[ 2 3 \right] }$ , and various autoregressive generative tasks $\textcircled { \ 3 9 }$ . While the bulk of work in scaling laws has been empirical, an interesting line of work focuses on theoretically explaining neural scaling laws $\pmb { \mathbb { B } } ] |$ . Most scaling laws focus only on cross-entropy loss, while we study memorization (defined in $\ S \ O 3 )$ .
+
+# 3 Experimental Setup
+
+In order to perform a large-scale study of the dynamics of memorization over training, our memorization metric must be reasonably easy to compute but also precise enough to tell us how much the model will actually remember from the training data. Label memorization $\mathbb { I } \mathbb { Z } \mathbb { P } \mathbb { \underline { { 9 4 } } } \mathbb { I } \mathbb { Z }$ is an ideal candidate, because it has consistently provided theoretical insight into underlying properties of neural networks, remains applicable in empirical settings, and is relatively cheap to compute. We formulate our metric as an analog of label memorization for self-supervised settings.
+
+Definition 1 Let $V$ denote the vocabulary size. Let $C$ denote a set of contexts, which can be thought of as a list of tuples $( s , y )$ where $s$ is an input context (incomplete block of text) and $y$ is the index of the ground truth token in the vocabulary that completes the block of text. Let $S$ denote the set of input contexts, and let $f : S \to \mathbb { R } ^ { V }$ denote a language model. A context $c = ( s , y ) \in C$ is memorized $i f$ $\operatorname { a r g m a x } ( f ( s ) ) = y .$ .
+
+Note that a single word can appear as the ground-truth token for multiple contexts. For a given set of contexts $C$ (i.e a given training dataset), we can then analyze the proportion of memorized contexts
+
+$$
+M ( f ) = { \frac { \sum _ { ( s , y ) \in C } 1 \left\{ \operatorname { a r g m a x } ( f ( s ) ) = y \right\} } { | C | } }
+$$
+
+We refer to this as exact memorization, although it can also be seen as accuracy since we measure how often the argmax of the language model matches the ground truth token. Throughout this work, when we refer to memorization, we will be referring to Definition 1 unless we specify otherwise.
+
+We define $\tau$ to be a threshold value for $M ( f )$ , and denote $T ( N , \tau )$ as the minimal number of times a language model $f$ with $N$ parameter needs to see each training datapoint in order to satisfy $M ( f ) \geq { \bar { \tau } }$ . When leveraging bigger datasets, models are unable to train for multiple epochs, so we instead consider memorization on a per-update basis. We introduce $M _ { u p d a t e } ( f , U )$ as the memorization on the batch of data on which the model performs the $U$ ’th gradient descent update, and define $T _ { u p d a t e } ( N , \tau )$ as the minimal number of gradient descent updates a language model with $N$ parameters needs to perform, to satisfy $M _ { u p d a t e } ( { \bar { f } } , U ) \geq \tau$ .
+
+Previous work analyzing language modeling memorization defines memorization differently. Motivated by privacy concerns, both $\mathbf { \bar { \Pi } }$ and $\boxed { 1 6 }$ define memorization from a training data extraction standpoint, in which a string $s$ is extractable if it can be produced by interacting with the language model. More specifically, $\boxed { 1 5 }$ defines a string $s$ as being $k$ -eidetic memorized if it is extractable and appears in at most $k$ training examples. [16] defines a string $s$ as $k$ -memorized if the language model can produce it via prompting with $k$ tokens of context from training data. This definition only works for causal language modeling because of the dependence on prompting with training data; for masked language modeling $\boxed { 1 6 }$ uses Definition $\bigstar$ above. Note that if an example is exactly memorized, it is extractable by definition. In other words, both the set of $k$ -eidetic memorized tokens and the set of $k$ -memorized tokens contain the set of exactly memorized tokens (formally, different exactly memorized tokens may be contained in different sets, depending on $k$ ). Therefore, analyzing exact memorization gives a type of lower bound on the $k$ -eidetic memorization and $k$ -memorization. In a different line of work motivated by estimating the influence of individual training examples, $\mathbf { \| 9 5 \| }$ defines a training example $x$ as memorized if the difference in expected model performance (where model performance is defined as $M ( f )$ above) over subsets of data including $x$ and subsets of data not including $x$ , is sufficiently large. This definition pulls from previous work in theoretically analyzing label memorization in classification settings $\pmb { \left[ 2 7 \right] }$ .
+
+Model Architectures: We replicate publicly available references for Transformer language model architectures $\mathbb { D } \mathbb { D } \mathbb { 6 } ]$ . We use the 125M, 355M, 1.3B, 2.7B, 6.7B, and 13B model configurations (see $\ S \ A . 4$ for more architectural and training details). We study both causal and masked language models. We train using the FairSeq framework $\lVert \overline { { 6 9 } } \rVert$ with PyTorch $\mathbf { \dot { \textmu } }$ as the underlying framework. For our larger models, we use the fully sharded data-parallel implementation available in FairScale $\bigstar$ and use Aim experiment tracking $\boxed { 6 }$ .
+
+Datasets: We use two existing datasets across all our experiments: the WIKITEXT-103 benchmark containing around 103 million tokens $\lVert \overline { { 6 2 } } \rVert$ , and the RoBERTa corpus $\lVert \overline { { 5 5 } } \rVert$ used to train the original
+
+RoBERTa model, containing around 39 billion tokens (we refer to this as the ROBERTA dataset). We use both datasets in section 4, and primarily use WIKITEXT-103 in other sections due to computational restrictions.
+
+# 4 Larger Language Models Memorize Faster
+
+Larger neural language models are known to be more sample efficient and require fewer optimization steps to reach the same performance $\pm \pm$ while also converging faster $| | \overline { { 5 2 } } | |$ , where performance is usually defined as test perplexity. In this section, we study $T ( N , \tau )$ on the training set as a function of $N$ to answer this question.
+
+
+Figure 1: We show $T ( N , \tau )$ , which is the number of times a language model needs to see each training example before memorizing $\tau$ fraction of the training data, as a function of model size $N$ . Result are for causal language modeling on WIKITEXT103, right plot is on log-log scale. Note that generally larger models memorize faster, regardless of $\tau$ .
+
+In the left plot of Figure 1, we fix a memorization threshold $\tau = 0 . 9$ and examine $T ( N , \tau )$ as we increase $N$ . The larger language models need to see each training datapoint fewer times to achieve $9 0 \%$ exact memorization of the training set; in other words, $T ( N , 0 . 9 )$ is monotonically decreasing in $N$ . When we vary $\tau$ between 0.4 and 0.95 in the right plot of Figure 1, we still observe that $T ( N , \tau )$ is generally decreasing with $N . ^ { 3 }$ For fixed $N$ , $T ( \bar { N } , \bar { \tau } )$ is increasing in $\tau$ , which is expected since memorizing more of the training set requires training the model for more epochs. More interestingly, increasing $\tau$ smoothly transitions $T ( N , \bar { \tau } )$ from constant in $N$ , to exponentially decreasing in $N$ (the axes are on a log-log scale).
+
+
+Figure 2: $T ( N , \tau )$ as a function of $N$ (shown on log-log scale), for various values of $\tau$ in masked language modeling on WIKITEXT103. We show that larger models initially memorize training data slower, but reach high proportions of training data memorization faster.
+
+# 4.1 Dependence on Language Modeling Task and Dataset Size
+
+To investigate the dependence of our observations on the particular language modeling task, we repeat this analysis for the masked language modeling task on WIKITEXT103 with mask probability 0.15. Unlike in causal language modeling, Figure 2 shows that $T ( N , \tau )$ is not monotonically decreasing in $N$ for lower values of $\tau$ , and is monotonically decreasing in $N$ for higher values of $\tau$ , where the phase transition4 between these two regimes occurs between $\tau = 0 . 6$ and $\tau = 0 . 7$ . Smaller models memorize the training data quicker initially and slower in the long run (e.g., right plot of Figure 11)
+
+
+Figure 3: We show $T _ { u p d a t e } ( N , \tau )$ , which is the number of gradient descent updates $U$ a language model needs to perform before memorizing $\tau$ fraction of the data given on the $U$ ’th update, as a function of model size $N$ . Result are for causal (Left) and masked (Right) language modeling on the ROBERTA dataset, on a log-log scale. We show that larger models memorize faster, regardless of $\tau$ .
+
+Language model training is heavily dependent on the dataset size $\pm \pm$ , and therefore we expect $M ( f )$ to be similarly impacted. In Figure $\textcircled { 3 }$ we analyze training set memorization on the much bigger ROBERTA dataset for both masked and causal language modeling. With large datasets such as ROBERTA dataset, it becomes infeasible to perform multiple epochs and evaluate memorization on the entire training set, especially when training larger models. Consequently, we focus on smaller values of $\tau$ and investigate the number of gradient descent updates it takes to reach memorization thresholds, i.e., $T _ { u p d a t e } ( N , \tau )$ . In Figure $3$ we observe a similar trend as Figure $^ { 1 , }$ where $T _ { u p d a t e } ( N , \tau )$ is monotonically decreasing with $N$ for various $\tau$ , in both masked and causal language modeling. Unlike with WIKITEXT103, masked language modeling does not have a phase transition for $\tau$ .
+
+# 4.2 Why Do Larger Models Memorize Faster?
+
+A natural question at this point is to ask why larger models memorize faster? Typically, memorization is associated with overfitting, which offers a potentially simple explanation. In order to disentangle memorization from overfitting, we examine memorization before overfitting occurs, where we define overfitting occurring as the first epoch when the perplexity of the language model on a validation set increases. Surprisingly, we see in Figure 4 that as we increase the number of parameters, memorization before overfitting generally increases, indicating that overfitting by itself cannot completely explain the properties of memorization dynamics as model scale increases.
+
+The learning rate is not constant across our training configurations. Intuitively, larger learning rates should lead to quicker memorization. To investigate to what extent our results can be explained by learning rate, we take a subset of the architectures available above and train on the WIKITEXT103 dataset across a standard range of learning rates while measuring memorization, in Figure $\boxed { 5 }$ Even if we fix a learning rate, larger models reach 0.9 memorization faster, suggesting that our results are not caused solely by differences in learning rates. Interestingly, sensitivity to learning rate generally decreases as we increase the model size. We also notice in Figure $\boxed { 5 }$ that $T ( N , \tau )$ goes down initially (for low LRs) and eventually rises (for high LRs), and as the long as the chosen learning rate places us near the lowest point on the curve, the memorization dynamics do not change significantly (note that axes are on log-scale). This result is consistent with the growing intuition that for neural language models past a particular scale, the learning rate is not a significant hyperparameter $[ \textcircled { 4 4 } ]$
+
+
+Figure 4: Proportion of training data memorized $M ( f )$ before overfitting, as a function of model size $N$ (plotted on a log scale). Results are for causal (left) and masked (right) language modeling on WIKITEXT103. Note that larger models memorize more before overfitting.
+
+
+Figure 5: Examining the effect of learning rate (LR) on number of times model needs to see each training example in order to reach 0.9 proportion of training data memorization $T ( N , 0 . 9 )$ . Each line corresponds to a different model size performing causal language modeling on WIKITEXT103. We demonstrate that larger models memorize faster for a fixed learning rate.
+
+Exhaustively searching all such possible factors is intractable, and providing a complete explanation for why larger models memorize faster is outside the scope of this work. Instead, in the following sections, we present studies that we hope will expand the toolkit for answering such questions.
+
+# 4.3 Memorization via. Unique Identifiers
+
+Recent work studies how to use external memory to improve performance [11, 35, 46, 87]. In this subsection, we question whether such architecture changes are necessary. Motivated by information retrieval systems, we take a simple approach — we prepend a unique identifier to every example in the training set and examine whether memorization speed increases. Specifically, we fix the language modeling task as causal language modeling on WIKITEXT103 with the 125M parameter model, and in front of every training example, we insert the string document ID where unique_id is a unique integer, one for each training context. In order to utilize all these unique integers, we must add them to the dictionary of tokens, which causes a significant increase in the model size since the last layer in the language model must have an output dimension equal to the size of the dictionary. Therefore, any change in $M ( f )$ dynamics could be attributed to the extra parameters we add from increasing dictionary size. To control for this, we first examine the effect of just increasing dictionary size (without using any of the added tokens). Then, we utilize those added tokens to prepend every training example and observe the change in $M ( f )$ dynamics. In Figure 6, we see that increasing the dictionary size does improve the speed of memorization. Even though we previously demonstrated that larger models memorize faster, this is still surprising considering that we do not increase parameter size in a significant way — we are effectively adding fake tokens to the dictionary. Moreover, when we leverage those added tokens to identify training examples uniquely, we see yet another gain in memorization, although prompting using a document ID shifts memorization dynamics away from being monotonically increasing over time.
+
+
+Figure 6: The impact of adding unique identifiers to training examples on memorization $M ( f )$ training dynamics for causal language modeling (125M) on WIKITEXT103. The green line is the original 125M model. The orange line is the model after adding unique identifiers to the dictionary (which increases model size). The blue line prepends these unique identifiers for each training example. Note that adding unique identifiers leads to faster memorization of training data.
+
+# 4.4 Memorization Through the Lens of Parts of Speech
+
+
+Figure 7: The ratios $R ( p )$ (Left) and $R _ { m e m } ( p )$ (Right) over training. $R ( p )$ represents proportion of POS correctly memorized (the language model outputs the right POS, but not necessarily the correct word). $R _ { m e m } ( p )$ represents the proportion of exactly memorized tokens for a particular POS $p$ . Results are for causal language modeling (355M) on WIKITEXT103. In both plots, we consider numerals, proper nouns, verbs, nouns, and adjectives as potential parts of speech (i.e., values for $p$ ). We show that nouns and numerals are memorized faster than other parts of speech.
+
+In the previous section, we showed that a unique identifier enhances memorization. Regular text also contains strong proxies to unique identifiers in the form of numerals and proper nouns. Motivated by this, we study syntactic features of memories using part-of-speech (POS) tagging.5 We track the ratio $R ( p )$ of the number of positions for which the part of speech $p$ was correctly predicted to the total number of tokens in the ground truth tagged with that part-of-speech $p$ (left plot in Figure $7 . \dot { }$ . In the right plot of Figure $^ { 7 }$ we show a similar ratio, denoted $R _ { m e m } ( p )$ , but the numerator only considers the tokens that are also exactly memorized. The correctly predicted part of speech does not necessarily imply exact memorization, which is clearly illustrated by Figure 7 where we see the language model memorizing parts of speech faster than the exact value of the token. While all parts of speech are eventually memorized, some parts of speech are memorized faster, which aligns with previous work $\pmb { \mathbb { Z } } 0$ . However, unlike previous work6, we find that nouns, proper nouns, and numerals are memorized noticeably faster than verbs and adjectives, both in terms of $R ( p )$ and $R _ { m e m } ( p )$ . This has potential implications for privacy, since sensitive information is likely to be a noun/proper noun/numeral. Our findings also very loosely align with work studying child language acquisition $\lVert 2 9 \rVert$ .
+
+# 5 Forgetting Curves in Language Models
+
+This section studies the dual of memorization — forgetting in language models. Inspired by the forgetting curve hypothesis, according to which human memory declines over time when there is no attempt to retain it $\boxed { \boxed { 5 6 } }$ , we are interested in understanding the dynamics of memory degradation in language models.
+
+We first choose a batch of data not available in the training set, i.e. a batch of data from a validation set. We refer to this batch of data as the special batch. We then take a checkpoint from model training, plug in the special batch so that the model can train on it, and resume standard training on the training set. We then evaluate how memorization degrades on the special batch and analyze the various factors the forgetting curve may depend on. We use the entire validation set as the special batch throughout this section. The special batch is only seen once when it is immediately introduced.7
+
+
+Figure 8: Left: forgetting curve for causal language modeling (2.7B) on WIKITEXT103. The dashed horizontal line indicates the lowest proportion of special batch data memorized throughout training, i.e., the forgetting baseline. Right: forgetting baseline as a function of model size $N$ (plotted on log scale). We show that as model scale increases, the forgetting baseline value increases.
+
+In the left plot of Figure 8, we show the forgetting curve for the 2.7B model. Exact memorization on the special batch degrades quickly at first, but slows down exponentially as we continue training (see Figure 15 in $\ S [ \bar { \mathrm { A } } . 2 . 2 ]$ . In other words, the forgetting curve on the special batch seems to approach a baseline — we refer to this trend as the forgetting baseline. We approximate the forgetting baseline by looking at the lowest memorization value on the special batch throughout training.
+
+We show the forgetting baseline as a function of the model scale in the right plot of Figure $\textcircled { 8 }$ We see that the numerical value for the baseline is monotonically increasing with the model scale. This implies that larger models forget less, aligning with recent work studying catastrophic forgetting on image classification tasks $\overline { { \| 7 5 \| } }$ . This is beneficial because larger models can leverage more information from previous tasks; however, from a privacy perspective, this is not ideal because it implies larger models may be potentially retaining more sensitive information from training data.
+
+We also investigate the sensitivity of the forgetting baseline on data batch order. In Figure 9, we perform the same forgetting curve analysis described above but start the analysis at different training checkpoints (we start at the 14th, 39th, and 63rd epochs). This way, we alter the order of the data batches given to the model (since the special batch will appear in a different place in the global order of data batches given to the model) without drastically changing the experimental setup. We observe that the forgetting baseline is not sensitive to data batch order9.
+
+
+Figure 9: We empirically show that the forgetting baseline does not depend on data batch ordering. We inject the special batch into the training set at the 14th, 39th, and 63rd epochs, and evaluate proportion of special batch data memorized as we continue training. Results are for causal language modeling (125M) on WIKITEXT103.
+
+Motivated by replay methods from continual learning (see $\mathbb { \lVert 2 4 \rVert }$ for a survey) and work in promoting retention memories through repetition in both humans $\boxed { 4 5 } \boxed { 6 8 } \boxed { 8 4 }$ and neural models $\boxed { 5 }$ , in Figure $\checkmark$ we study the effect of repetition (left) and spaced repetition (right) on the forgetting baseline. In the left plot, we inject the special batch into the training set multiple times before continuing training on the training set alone. We observe that the forgetting baseline is monotonically increasing as a function of repetition frequency (differences in the baseline value are on the order of $1 0 ^ { - 2 }$ ). To study the spaced repetition, we periodically inject the held-out set into the training set, train on it once, and then continue training on the training set alone. We see in the right plot of Figure $1 0$ that spaced repetition incurs minimal effect on the forgetting baseline (on the order of $1 0 ^ { - 3 }$ ), independent of the length of spacing between the repetitions.
+
+
+Figure 10: Effect of repeated injection (Left) and spaced repetition (Right) on special batch memorization. Results are for causal language modeling (125M) on WIKITEXT103. The solid upper curve represents the training set memorization. We show that repeated injection increases the forgetting baseline, whereas spaced repetition has minimal effect.
+
+An exciting direction for future work will be to understand the structure of the baseline — for example, understanding what types of tokens (parts of speech, synonyms, facts, syntax) are memorized in the baseline and the overlap of tokens memorized in the baseline with tokens in the training set.
+
+# 6 Conclusions and Discussion
+
+We study the properties of memorization dynamics over language model training and demonstrate that larger models memorize faster. We also measure the properties of forgetting curves and surprisingly find that forgetting reaches a baseline, which again increases with the model scale. Combined with memorization analyses that expose the unintuitive behavior of language models, we hope to motivate considering memorization as a critical metric when increasing language model scale.
+
+Most work studying memorization in language modeling is primarily motivated by privacy (see $\ S 2 )$ While theoretically, there are well-established frameworks to quantify privacy such as differential privacy $\lVert 2 5 \rVert$ , empirical privacy in language modeling is not well-defined — does memorizing common knowledge count as information leakage? Does outputting a synonym count as harmful memorization? As per our Definition $\bigtriangledown$ we implicitly focus on information that is sensitive if outputted verbatim (phone numbers, SSNs, addresses, medical diagnoses, etc.), rather than capturing all aspects of privacy. It is also known that text data used for training language models contain certain biases and stereotypes (e.g., $\left[ 3 2 \right] ) ,$ ); therefore, our work has similar implications for how long language models can train before they definitively memorize these biases from training data.
+
+We also hope our work highlights the importance of analyzing memorization dynamics as we scale up language models, instead of only reporting cross entropy. Cross-entropy loss and memorization capture different behavior — for example, in many of our memory degradation experiments, even though memorization approaches a baseline, we observe that perplexity is still increasing (see Figure $^ { 1 4 }$ in $\ S \ \mathbf { A } . 2$ for an example). This implies that the model is becoming unconfident about its exact predictions, which we can only conclude because we inspect both loss and memorization. More importantly, the forgetting baseline behavior would be entirely obscured if we did not inspect memorization dynamics. Similarly, there are multiple instances where we uncover interesting behavior because we focus on memorization dynamics (§ 4.4, § 4.3, $\ S \boxed { \mathbf { A } . 3 }$ , rather than focusing only on cross-entropy loss.
+
+# 7 Acknowledgements
+
+The authors would like to thank Adina Williams, Chuan Guo, Alex Sablayrolles, and Pierre Stock, for helpful discussions throughout the course of this project. The authors would also like to researchers at FAIR who commented on or otherwise supported this project, including Shashank Shekhar, Candace Ross, Rebecca Qian, Dieuwke Hupkes, and Gargi Ghosh.
+
+# References
+
+[1] Alessandro Achille, Matteo Rovere, and Stefano Soatto. Critical learning periods in deep networks. In International Conference on Learning Representations, 2018.
+[2] Armen Aghajanyan, Akshat Shrivastava, Anchit Gupta, Naman Goyal, Luke Zettlemoyer, and Sonal Gupta. Better fine-tuning by reducing representational collapse. arXiv preprint arXiv:2008.03156, 2020.
+[3] Armen Aghajanyan, Bernie Huang, Candace Ross, Vladimir Karpukhin, Hu Xu, Naman Goyal, Dmytro Okhonko, Mandar Joshi, Gargi Ghosh, Mike Lewis, et al. Cm3: A causal masked multimodal model of the internet. arXiv preprint arXiv:2201.07520, 2022.
+[4] Badr AlKhamissi, Millicent Li, Asli Celikyilmaz, Mona Diab, and Marjan Ghazvininejad. A review on language models as knowledge bases. arXiv preprint arXiv:2204.06031, 2022.
+[5] Hadi Amiri, Timothy Miller, and Guergana Savova. Repeat before forgetting: Spaced repetition for efficient and effective training of neural networks. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2401–2410, 2017.
+[6] Gor Arakelyan, Gevorg Soghomonyan, and The Aim team. Aim, 6 2020. URL https: //github.com/aimhubio/aim.
+[7] Mikel Artetxe, Shruti Bhosale, Naman Goyal, Todor Mihaylov, Myle Ott, Sam Shleifer, Xi Victoria Lin, Jingfei Du, Srinivasan Iyer, Ramakanth Pasunuru, et al. Efficient large scale language modeling with mixtures of experts. arXiv preprint arXiv:2112.10684, 2021.
+[8] Yasaman Bahri, Ethan Dyer, Jared Kaplan, Jaehoon Lee, and Utkarsh Sharma. Explaining neural scaling laws. arXiv preprint arXiv:2102.06701, 2021.
+[9] Mandeep Baines, Shruti Bhosale, Vittorio Caggiano, Naman Goyal, Siddharth Goyal, Myle Ott, Benjamin Lefaudeux, Vitaliy Liptchinsky, Mike Rabbat, Sam Sheiffer, Anjali Sridhar, and Min Xu. Fairscale: A general purpose modular pytorch library for high performance and large scale training. https://github.com/facebookresearch/fairscale, 2021.
+
+[10] Terra Blevins, Hila Gonen, and Luke Zettlemoyer. Analyzing the mono-and cross-lingual pretraining dynamics of multilingual language models. arXiv preprint arXiv:2205.11758, 2022.
+
+[11] Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George van den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, et al. Improving language models by retrieving from trillions of tokens. arXiv preprint arXiv:2112.04426, 2021.
+
+[12] Lucas Bourtoule, Varun Chandrasekaran, Christopher A Choquette-Choo, Hengrui Jia, Adelin Travers, Baiwu Zhang, David Lie, and Nicolas Papernot. Machine unlearning. In 2021 IEEE Symposium on Security and Privacy (SP), pages 141–159. IEEE, 2021.
+
+[13] Gavin Brown, Mark Bun, Vitaly Feldman, Adam Smith, and Kunal Talwar. When is memorization of irrelevant training data necessary for high-accuracy learning? In Proceedings of the 53rd Annual ACM SIGACT Symposium on Theory of Computing, pages 123–132, 2021.
+
+[14] Nicholas Carlini, Chang Liu, Úlfar Erlingsson, Jernej Kos, and Dawn Song. The secret sharer: Evaluating and testing unintended memorization in neural networks. In 28th USENIX Security Symposium (USENIX Security 19), pages 267–284, 2019.
+
+[15] Nicholas Carlini, Florian Tramer, Eric Wallace, Matthew Jagielski, Ariel Herbert-Voss, Katherine Lee, Adam Roberts, Tom Brown, Dawn Song, Ulfar Erlingsson, et al. Extracting training data from large language models. In 30th USENIX Security Symposium (USENIX Security 21), pages 2633–2650, 2021.
+
+[16] Nicholas Carlini, Daphne Ippolito, Matthew Jagielski, Katherine Lee, Florian Tramer, and Chiyuan Zhang. Quantifying memorization across neural language models. arXiv preprint arXiv:2202.07646, 2022.
+
+[17] Tyler A. Chang and Benjamin K. Bergen. Word acquisition in neural language models. Transactions of the Association for Computational Linguistics, 10:1–16, 2022. doi: 10.1162/tacl_a_00444. URL https://aclanthology.org/2022.tacl-1.1.
+
+[18] Sanyuan Chen, Yutai Hou, Yiming Cui, Wanxiang Che, Ting Liu, and Xiangzhan Yu. Recall and learn: Fine-tuning deep pretrained language models with less forgetting. arXiv preprint arXiv:2004.12651, 2020.
+
+[19] Zhiyuan Chen and Bing Liu. Lifelong machine learning. Synthesis Lectures on Artificial Intelligence and Machine Learning, 12(3):1–207, 2018.
+
+[20] Cheng-Han Chiang, Sung-Feng Huang, and Hung-yi Lee. Pretrained language model embryology: The birth of albert. arXiv preprint arXiv:2010.02480, 2020.
+
+[21] Leshem Choshen, Guy Hacohen, Daphna Weinshall, and Omri Abend. The grammar-learning trajectories of neural language models. arXiv preprint arXiv:2109.06096, 2021.
+
+[22] Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
+
+[23] Aidan Clark, Diego de las Casas, Aurelia Guy, Arthur Mensch, Michela Paganini, Jordan Hoffmann, Bogdan Damoc, Blake Hechtman, Trevor Cai, Sebastian Borgeaud, et al. Unified scaling laws for routed language models. arXiv preprint arXiv:2202.01169, 2022.
+
+[24] Matthias Delange, Rahaf Aljundi, Marc Masana, Sarah Parisot, Xu Jia, Ales Leonardis, Greg Slabaugh, and Tinne Tuytelaars. A continual learning survey: Defying forgetting in classification tasks. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021.
+
+[25] Cynthia Dwork, Frank McSherry, Kobbi Nissim, and Adam Smith. Calibrating noise to sensitivity in private data analysis. In Theory of cryptography conference, pages 265–284. Springer, 2006.
+
+[26] Vitaly Feldman. Does learning require memorization. A short tale about a long tail. CoRR, abs/1906.05271, 2019.
+
+[27] Vitaly Feldman. Does Learning Require Memorization? A Short Tale about a Long Tail. arXiv:1906.05271 [cs, stat], January 2021. URL http://arxiv.org/abs/1906.05271. arXiv: 1906.05271.
+
+[28] Vitaly Feldman and Chiyuan Zhang. What neural networks memorize and why: Discovering the long tail via influence estimation. Advances in Neural Information Processing Systems, 33: 2881–2891, 2020.
+
+[29] Michael Fleischman and Deb Roy. Why verbs are harder to learn than nouns: Initial insights from a computational model of intention recognition in situated word learning. In 27th Annual Meeting of the Cognitive Science Society, Stresa, Italy, 2005.
+
+[30] Jonathan Frankle, David J Schwab, and Ari S Morcos. The early phase of neural network training. arXiv preprint arXiv:2002.10365, 2020.
+
+[31] James Franklin. The elements of statistical learning: data mining, inference and prediction. The Mathematical Intelligencer, 27(2):83–85, 2005.
+
+[32] Samuel Gehman, Suchin Gururangan, Maarten Sap, Yejin Choi, and Noah A Smith. Realtoxicityprompts: Evaluating neural toxic degeneration in language models. arXiv preprint arXiv:2009.11462, 2020.
+
+[33] Tanya Goyal, Jiacheng Xu, Junyi Jessy Li, and Greg Durrett. Training dynamics for text summarization models. arXiv preprint arXiv:2110.08370, 2021.
+
+[34] Guy Gur-Ari, Daniel A Roberts, and Ethan Dyer. Gradient descent happens in a tiny subspace. arXiv preprint arXiv:1812.04754, 2018.
+
+[35] Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Realm: Retrieval-augmented language model pre-training. arXiv preprint arXiv:2002.08909, 2020.
+
+[36] Yaru Hao, Li Dong, Furu Wei, and Ke Xu. Investigating learning dynamics of BERT finetuning. In Proceedings of the 1st Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics and the 10th International Joint Conference on Natural Language Processing, pages 87–92, Suzhou, China, December 2020. Association for Computational Linguistics. URL https://aclanthology.org/2020.aacl-main.11.
+
+[37] Elizabeth Liz Harding, Jarno J Vanto, Reece Clark, L Hannah Ji, and Sara C Ainsworth. Understanding the scope and impact of the california consumer privacy act of 2018. Journal of Data Protection & Privacy, 2(3):234–253, 2019.
+
+[38] Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
+
+[39] Tom Henighan, Jared Kaplan, Mor Katz, Mark Chen, Christopher Hesse, Jacob Jackson, Heewoo Jun, Tom B Brown, Prafulla Dhariwal, Scott Gray, et al. Scaling laws for autoregressive generative modeling. arXiv preprint arXiv:2010.14701, 2020.
+
+[40] Danny Hernandez, Jared Kaplan, Tom Henighan, and Sam McCandlish. Scaling laws for transfer. arXiv preprint arXiv:2102.01293, 2021.
+
+[41] Sorami Hisamoto, Matt Post, and Kevin Duh. Membership inference attacks on sequence-tosequence models. arXiv preprint arXiv:1904.05506, 2019.
+
+[42] Matthew Honnibal and Ines Montani. spaCy 3: Natural language understanding with Bloom embeddings, convolutional neural networks and incremental parsing. To appear, 2022.
+
+[43] Ziwei Ji, Nayeon Lee, Rita Frieske, Tiezheng Yu, Dan Su, Yan Xu, Etsuko Ishii, Yejin Bang, Andrea Madotto, and Pascale Fung. Survey of hallucination in natural language generation. arXiv preprint arXiv:2202.03629, 2022.
+
+[44] Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling Laws for Neural Language Models. arXiv:2001.08361 [cs, stat], January 2020. URL http://arxiv.org/abs/2001. 08361. arXiv: 2001.08361.
+
+[45] Jeffrey D Karpicke and Henry L Roediger III. Expanding retrieval practice promotes short-term retention, but equally spaced retrieval enhances long-term retention. Journal of experimental psychology: learning, memory, and cognition, 33(4):704, 2007.
+
+[46] Urvashi Khandelwal, Omer Levy, Dan Jurafsky, Luke Zettlemoyer, and Mike Lewis. Generalization through memorization: Nearest neighbor language models. arXiv preprint arXiv:1911.00172, 2019.
+
+[47] Eugene Kharitonov, Marco Baroni, and Dieuwke Hupkes. How bpe affects memorization in transformers. arXiv preprint arXiv:2110.02782, 2021.
+
+[48] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
+
+[49] James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521–3526, 2017.
+
+[50] Katherine Lee, Daphne Ippolito, Andrew Nystrom, Chiyuan Zhang, Douglas Eck, Chris Callison-Burch, and Nicholas Carlini. Deduplicating training data makes language models better. arXiv preprint arXiv:2107.06499, 2021.
+
+[51] Xuechen Li, Florian Tramer, Percy Liang, and Tatsunori Hashimoto. Large language models can be strong differentially private learners. arXiv preprint arXiv:2110.05679, 2021.
+
+[52] Zhuohan Li, Eric Wallace, Sheng Shen, Kevin Lin, Kurt Keutzer, Dan Klein, and Joey Gonzalez. Train big, then compress: Rethinking model size for efficient training and inference of transformers. In International Conference on Machine Learning, pages 5958–5968. PMLR, 2020.
+
+[53] Leo Z Liu, Yizhong Wang, Jungo Kasai, Hannaneh Hajishirzi, and Noah A Smith. Probing across time: What does roberta know and when? arXiv preprint arXiv:2104.07885, 2021.
+
+[54] Yang Liu, Zhuo Ma, Ximeng Liu, Jian Liu, Zhongyuan Jiang, Jianfeng Ma, Philip Yu, and Kui Ren. Learn to forget: Machine unlearning via neuron masking. arXiv preprint arXiv:2003.10933, 2020.
+
+[55] Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. RoBERTa: A Robustly Optimized BERT Pretraining Approach. arXiv e-prints, July 2019. URL https://arxiv.org/abs/ 1907.11692v1.
+
+[56] Geoffrey R Loftus. Evaluating forgetting curves. Journal of Experimental Psychology: Learning, Memory, and Cognition, 11(2):397, 1985.
+
+[57] Alessandro Mantelero. The eu proposal for a general data protection regulation and the roots of the ‘right to be forgotten’. Computer Law & Security Review, 29(3):229–235, 2013.
+
+[58] Wojciech Masarczyk, Kamil Deja, and Tomasz Trzcinski. On robustness of generative representations against catastrophic forgetting. In International Conference on Neural Information Processing, pages 325–333. Springer, 2021.
+
+[59] Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of learning and motivation, volume 24, pages 109–165. Elsevier, 1989.
+
+[60] R Thomas McCoy, Paul Smolensky, Tal Linzen, Jianfeng Gao, and Asli Celikyilmaz. How much do language models copy from their training data? evaluating linguistic novelty in text generation using raven. arXiv preprint arXiv:2111.09509, 2021.
+
+[61] Amil Merchant, Elahe Rahimtoroghi, Ellie Pavlick, and Ian Tenney. What happens to BERT embeddings during fine-tuning? In Proceedings of the Third BlackboxNLP Workshop on Analyzing and Interpreting Neural Networks for NLP, pages 33–44, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.blackboxnlp-1.4. URL https://aclanthology.org/2020.blackboxnlp-1.4.
+
+[62] Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. ArXiv, abs/1609.07843, 2017.
+
+[63] Paulius Micikevicius, Sharan Narang, Jonah Alben, Gregory Diamos, Erich Elsen, David Garcia, Boris Ginsburg, Michael Houston, Oleksii Kuchaiev, Ganesh Venkatesh, et al. Mixed precision training. arXiv preprint arXiv:1710.03740, 2017.
+
+[64] Fatemehsadat Mireshghallah, Kartik Goyal, Archit Uniyal, Taylor Berg-Kirkpatrick, and Reza Shokri. Quantifying privacy risks of masked language models using membership inference attacks. arXiv preprint arXiv:2203.03929, 2022.
+
+[65] Seyed Iman Mirzadeh, Arslan Chaudhry, Huiyi Hu, Razvan Pascanu, Dilan Gorur, and Mehrdad Farajtabar. Wide neural networks forget less catastrophically. arXiv preprint arXiv:2110.11526, 2021.
+
+[66] Ari Morcos, Maithra Raghu, and Samy Bengio. Insights on representational similarity in neural networks with canonical correlation. Advances in Neural Information Processing Systems, 31, 2018.
+
+[67] Preetum Nakkiran, Gal Kaplun, Yamini Bansal, Tristan Yang, Boaz Barak, and Ilya Sutskever. Deep double descent: Where bigger models and more data hurt. Journal of Statistical Mechanics: Theory and Experiment, 2021(12):124003, 2021.
+
+[68] Shiri Oren, Charlene Willerton, and Jeff Small. Effects of spaced retrieval training on semantic memory in alzheimer’s disease: A systematic review. Journal of Speech, Language and Hearing Research (Online), 57(1):247, 2014.
+
+[69] Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, and Michael Auli. fairseq: A fast, extensible toolkit for sequence modeling. arXiv preprint arXiv:1904.01038, 2019.
+
+[70] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32:8026–8037, 2019.
+
+[71] Fabio Petroni, Tim Rocktäschel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H Miller, and Sebastian Riedel. Language models as knowledge bases? arXiv preprint arXiv:1909.01066, 2019.
+
+[72] Vinaychandran Pondenkandath, Michele Alberti, Sammer Puran, Rolf Ingold, and Marcus Liwicki. Leveraging random label memorization for unsupervised pre-training. arXiv preprint arXiv:1811.01640, 2018.
+
+[73] Jack W Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, Francis Song, John Aslanides, Sarah Henderson, Roman Ring, Susannah Young, et al. Scaling language models: Methods, analysis & insights from training gopher. arXiv preprint arXiv:2112.11446, 2021.
+
+[74] Maithra Raghu, Justin Gilmer, Jason Yosinski, and Jascha Sohl-Dickstein. Svcca: Singular vector canonical correlation analysis for deep learning dynamics and interpretability. Advances in neural information processing systems, 30, 2017.
+
+[75] Vinay Venkatesh Ramasesh, Aitor Lewkowycz, and Ethan Dyer. Effect of scale on catastrophic forgetting in neural networks. In International Conference on Learning Representations, 2021.
+
+[76] Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In International Conference on Machine Learning, pages 8821–8831. PMLR, 2021.
+
+[77] Roger Ratcliff. Connectionist models of recognition memory: Constraints imposed by learning and forgetting functions. Psychological Review, pages 285–308, 1990.
+
+[78] General Data Protection Regulation. General data protection regulation (gdpr). Intersoft Consulting, Accessed in October, 24(1), 2018.
+
+[79] Jonathan S Rosenfeld, Amir Rosenfeld, Yonatan Belinkov, and Nir Shavit. A constructive prediction of the generalization error across scales. arXiv preprint arXiv:1909.12673, 2019.
+
+[80] Naomi Saphra and Adam Lopez. Understanding learning dynamics of language models with svcca. arXiv preprint arXiv:1811.00225, 2018.
+
+[81] Beatrice Savoldi, Marco Gaido, Luisa Bentivogli, Matteo Negri, and Marco Turchi. On the dynamics of gender learning in speech translation. In Proceedings of the 4th Workshop on Gender Bias in Natural Language Processing (GeBNLP), pages 94–111, Seattle, Washington, July 2022. Association for Computational Linguistics. URL https://aclanthology.org/ 2022.gebnlp-1.12.
+
+[82] Chenze Shao and Yang Feng. Overcoming catastrophic forgetting beyond continual learning: Balanced training for neural machine translation. arXiv preprint arXiv:2203.03910, 2022.
+
+[83] Shaden Smith, Mostofa Patwary, Brandon Norick, Patrick LeGresley, Samyam Rajbhandari, Jared Casper, Zhun Liu, Shrimai Prabhumoye, George Zerveas, Vijay Korthikanti, et al. Using deepspeed and megatron to train megatron-turing nlg 530b, a large-scale generative language model. arXiv preprint arXiv:2201.11990, 2022.
+
+[84] Paul Smolen, Yili Zhang, and John H Byrne. The right time to learn: mechanisms and optimization of spaced learning. Nature Reviews Neuroscience, 17(2):77–88, 2016.
+
+[85] Congzheng Song and Vitaly Shmatikov. Auditing data provenance in text-generation models. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 196–206, 2019.
+
+[86] Patrick Stadler, Vivien Macketanz, and Eleftherios Avramidis. Observing the learning curve of nmt systems with regard to linguistic phenomena. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing: Student Research Workshop, pages 186–196, 2021.
+
+[87] Yi Tay, Vinh Q Tran, Mostafa Dehghani, Jianmo Ni, Dara Bahri, Harsh Mehta, Zhen Qin, Kai Hui, Zhe Zhao, Jai Gupta, et al. Transformer memory as a differentiable search index. arXiv preprint arXiv:2202.06991, 2022.
+
+[88] Om Thakkar, Swaroop Ramaswamy, Rajiv Mathews, and Françoise Beaufays. Understanding unintended memorization in federated learning. arXiv preprint arXiv:2006.07490, 2020.
+
+[89] Aleena Thomas, David Ifeoluwa Adelani, Ali Davody, Aditya Mogadala, and Dietrich Klakow. Investigating the impact of pre-trained word embeddings on memorization in neural networks. In International Conference on Text, Speech, and Dialogue, pages 273–281. Springer, 2020.
+
+[90] Mariya Toneva, Alessandro Sordoni, Remi Tachet des Combes, Adam Trischler, Yoshua Bengio, and Geoffrey J Gordon. An empirical study of example forgetting during deep neural network learning. arXiv preprint arXiv:1812.05159, 2018.
+
+[91] Paul Voigt and Axel Von dem Bussche. The eu general data protection regulation (gdpr). A Practical Guide, 1st Ed., Cham: Springer International Publishing, 10(3152676):10–5555, 2017.
+
+[92] Elena Voita, Rico Sennrich, and Ivan Titov. Analyzing the source and target contributions to predictions in neural machine translation. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 1126–1140, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.91. URL https://aclanthology.org/2021.acl-long.91.
+[93] Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. arXiv preprint arXiv:2201.11903, 2022.
+[94] Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv:1611.03530 [cs], February 2017. URL http://arxiv.org/abs/1611.03530. arXiv: 1611.03530.
+[95] Chiyuan Zhang, Daphne Ippolito, Katherine Lee, Matthew Jagielski, Florian Tramèr, and Nicholas Carlini. Counterfactual Memorization in Neural Language Models. arXiv:2112.12938 [cs], December 2021. URL http://arxiv.org/abs/2112.12938. arXiv: 2112.12938 version: 1.
+[96] Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, et al. Opt: Open pre-trained transformer language models. arXiv preprint arXiv:2205.01068, 2022.
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] The main claims in both the introduction and abstract are that (1) larger models memorize faster (where memorization is defined as per Definition $\textcircled { 3 }$ , (2) larger models memorize more before overfitting, (3) larger models forget less, and (4) models memorize nouns and numbers quicker than other parts of speech. (1) and (2) are supported by the beginning subsections in $\ S \boxed { 4 }$ (3) is supported by $\ S 5 ,$ and (4) is supported by $\ S [ \dot { 4 . 4 } ]$ Moreover, as mentioned in the introduction and abstract of this work the scope of this work includes analyzing large language models which we accomplish by analyzing language models up to 13B parameters.
+
+(b) Did you describe the limitations of your work? [Yes] In $\ S \ 4 ,$ we discuss that while we find that larger models memorize faster, we are unable to completely explain why this is the case (although we rule out certain reasons). In $\ S \ : 5 ,$ we discuss how we are approximate the numerical value for the baseline depending however long a particular model is trained for i.e. that actual numerical values for the baseline may change slightly if training for longer; however we provide evidence that the further changes to the numerical value will be relatively small in $\ S [ \underline { { \mathbf { A } . 2 . 2 } } ]$ In $\ S [ \underline { { \mathbf { A . l . l } } } ] ,$ below where we define memorization, we discuss the limitations of the memorization definition.
+
+(c) Did you discuss any potential negative societal impacts of your work? [Yes] This work does not develop new methods $/$ models $/$ datasets in any way, and therefore has minimal potential negative societal impacts. However, in section $6$ we discuss the implications of our analysis for privacy and ethical AI. We explain that, since our work deals with memorization dynamics over training of training data, it implicitly studies how long it takes language models memorize sensitive information (privacy perspective) or bias/stereotypes (ethical AI perspective) from training data.
+
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] The authors have read the ethics review guidelines and ensured that this work conforms to them.
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No] Unfortunately, the exact code used to produce results is proprietary. However, all model configurations and training details are directly pulled from publicly available references, and described in detail in section $\ S [ \underline { { \mathbf { A . 4 } } } ]$ Similarly, while for most of our experiments we use WIKITEXT103 benchmark which is publicly available, some of our experiments run on the ROBERTA dataset which is not publicly available, and therefore, we are unable to release the exact data to re-create those experiments.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] For all our of experiments, we use publicly available references to define model architectures and hyperparameters, which we describe in full detail in section $\ S [ \underline { { \mathbf { A . 4 } } } ]$
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Due to the scale of experiments we run (up to 13B parameter models experiments), many experiments are incredibly computationally expensive and we are unable to run each experiment for multiple seeds. However, since we deal with large datasets, random seed most probably has minimal effect on final model output.
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] In $\mathbf { \hat { \ S } } \mathbf { \boxed { A . 4 } }$ we describe the type of GPUS and the amount of GPUs used to train different model sizes. We also provide estimates of the total training time across all our experiments.
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes] Since we use existing datasets to conduct experiments, we cite the creators in $\ S \bar { 3 }$ at in the Datasets section; similarly, we use the existing Transformer architecture (which we also cite in $\ S \boxed { 3 }$ in the Model Architecture section); similarly we pull most of our hyperparameter configurations from existing public resources, which we cite in $\ S \boxed { 3 }$ in the Model Architecture section.
+(b) Did you mention the license of the assets? [Yes] In $\ S \ A . 4$ we mention the licenses of all assets we use.
+(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] We create no new assets as part of this work.
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] Since we do not create or curate any new datasets/assets as part of this work, we do not discuss whether and how consent was obtained from people whose data we are using.
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] In $\mathbf { \check { \ S } } \mathbf { \boxed { A . 4 } }$ we mention that it is completely plausible the underlying data we use has sensitive or offensive information. However, analyzing the extent to which this is the case is outside the scope of the work, since we just aim to understand memorization dynamics of language models over training rather than analyze the underlying text in datasets
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] We do not crowdsource or conduct research with human subjects in this work
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] We do not crowdsource or conduct research with human subjects in this work
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] We do not crowdsource or conduct research with human subjects in this work
\ No newline at end of file
diff --git a/md/dev/u6Xv3FuF8N/u6Xv3FuF8N.md b/md/dev/u6Xv3FuF8N/u6Xv3FuF8N.md
new file mode 100644
index 0000000000000000000000000000000000000000..a452a65081071164d81ffabaa857e163acd2ae4a
--- /dev/null
+++ b/md/dev/u6Xv3FuF8N/u6Xv3FuF8N.md
@@ -0,0 +1,332 @@
+# Flocks of Stochastic Parrots: Differentially Private Prompt Learning for Large Language Models
+
+Haonan Duan∗ †, Adam Dziedzic†, Nicolas Papernot, Franziska Boenisch University of Toronto and Vector Institute
+
+# Abstract
+
+Large language models (LLMs) are excellent in-context learners. However, the sensitivity of data contained in prompts raises privacy concerns. Our work first shows that these concerns are valid: we instantiate a simple but highly effective membership inference attack against the data used to prompt LLMs. To address this vulnerability, one could forego prompting and resort to fine-tuning LLMs with known algorithms for private gradient descent. However, this comes at the expense of the practicality and efficiency offered by prompting. Therefore, we propose to privately learn to prompt. We first show that soft prompts can be obtained privately through gradient descent on downstream data. However, this is not the case for discrete prompts. Thus, we orchestrate a noisy vote among an ensemble of $L L M s$ presented with different prompts, i.e., a flock of stochastic parrots. The vote privately transfers the flock’s knowledge into a single public prompt. We show that LLMs prompted with our private algorithms closely match the non-private baselines. For example, using GPT3 as the base model, we achieve a downstream accuracy of $9 2 . 7 \%$ on the sst2 dataset with $( \varepsilon = 0 . 1 4 7 , \delta = 1 0 ^ { - 6 } )$ -differential privacy vs. $9 5 . 2 \%$ for the non-private baseline. Through our experiments, we also show that our prompt-based approach is easily deployed with existing commercial APIs.
+
+# 1 Introduction
+
+Large language models (LLMs) exhibit strong capabilities for in-context learning [6, 40]. By prepending the adequate prompt to an LLM’s input, the model can perform a myriad of natural language downstream tasks without any modifications to its parameters [41]. While the data used to train an LLM is usually assumed to be public, downstream data used in the prompt is often more sensitive. This can elicit confidentiality issues, for instance, if prompts contain information that represents valuable intellectual property [34]. At the same time, it also raises privacy concerns when the data involves personal information about individuals.
+
+In this paper, our first contribution is to show that these concerns are valid. We are the first to instantiate a highly effective membership inference attack (MIA) [7, 45] against prompts. Our attack is able to determine if a given data point was used within the prompt of the LLM. The only existing solution to mitigate this privacy risk would be to forego prompting and instead fine-tune the LLM with a privacy-preserving training algorithm [25, 54]. Yet, fine-tuning lacks the efficiency and practicality of prompting. Indeed, fine-tuning requires significantly more data [42], computational resources [25], and storage space [26]. Additionally, fine-tuning requires access to the LLM parameters. However, many of the state-of-the-art LLMs are proprietary models deployed behind an API which only allows its users to query the LLMs [3, 6, 10, 17, 35].
+
+
+Figure 1: Our methods for private prompt learning. Left: PromptDPSGD obtains the input gradients from the LLM, and performs DPSGD to update the soft prompt embedding while keeping the LLM frozen. Right: PromptPATE creates a noisy ensemble of private discrete prompts, and then transfers knowledge by selecting a student prompt that can be publicly released. PromptPATE only needs black-box access of the LLM and, thus, can be easily deployed with commercial APIs.
+
+To leverage the benefits of prompting while at the same time protecting the data contained in prompts, we propose the first algorithms for prompt learning with privacy. Our algorithms offer rigorous guarantees expressed using differential privacy [15]. Perhaps closest to existing work on fine-tuning, we propose to leverage the canonical DPSGD algorithm [1] to learn soft promptswith differential privacy guarantees. Our PromptDPSGD algorithm performs a private gradient descent on the soft prompt embeddings prepended to the LLM’s private input. Since these embeddings have very few parameters in comparison to LLMs, our PromptDPSGD is efficient and yields competitive privacy utility trade-offs at a fraction of the training complexity of private fine-tuning.
+
+However, learning soft prompts with DPSGD may not always be possible because it requires computing gradients with respect to the prompt input. As mentioned previously, current APIs [3, 6, 10, 17, 35] usually do not provide these gradients. We thus turn to discrete prompts which consist of natural language tokens. Discrete prompts address the aforementioned limitations while being more data-efficient. Our insight is to observe that LLMs with discrete prompts naturally lend themselves to another canonical approach of differentially private learning known as the private aggregation of teacher ensembles (PATE) [37]. We introduce PromptPATE, which creates an ensemble of LLMs with different discrete prompts from the private dataset which we refer to as a flock of stochastic parrots [5]. Since interacting with the flock directly can leak private information about the prompts, as we demonstrate with our MIA, PromptPATE additionally performs a knowledge transfer. Therefore, each model in the flock generates a next token prediction for a short input sequence of some public data. By performing a noisy majority vote over all models’ token output, we generate a single output that, due to the noise addition, implements differential privacy guarantees while incorporating knowledge from the flock. The public input together with the noisy aggregated output form a new single example for the discrete student prompt that can be prepended to the LLM in lieu of the individual prompts which contain private information. In addition to providing rigorous privacy guarantees, our PromptPATE is highly efficient, since, instead of having to query every model from the flock at inference time, it suffices to query the LLM prepended with the student prompt once.
+
+We perform extensive experiments against multiple popular LLMs, such as GPT3 [6] and Claude [3], that are deployed behind commercial black-box APIs. Our results highlight that PromptPATE provides high downstream performance that matches the one of non-private prompting even at very strong privacy guarantees. On the sst2 dataset with GPT3, for instance, we reach an accuracy of $9 2 . 7 \%$ with privacy costs as little as $( \varepsilon = 0 . 1 4 7 , \delta = 1 0 ^ { - 6 } )$ -differential privacy, even when the public data used during PromptPATE’s knowledge transfer stem from a different distribution than sst2. Our results closely matches the non-private baseline accuracy $( 9 5 . 2 \% )$ . Thus, we conclude that prompt learning for LLMs is not only more efficient and practical than fine-tuning but can also achieve high utility even with strong and practical privacy protection in place.
+
+In summary, we make the following contributions:
+
+• We instantiate the first MIA on prompted LLMs and show that we can effectively infer membership of the prompted data points with high success. • We propose a lightweight alternative to DP fine-tuning, namely PromptDPSGD, which optimizes orders of magnitude fewer parameters while keeping the original LLM frozen. • We propose PromptPATE, the first method for DP learning with LLMs that requires only black-box access to the model—making it easily deployable for commercial LLM APIs. • Our experiments on multiple state-of-the-art commercial APIs [6, 3] highlight that our methods achieve both high utility and strong privacy protections in various setups.
+
+# 2 Background and Related Work
+
+Prompts for LLMs. The success of LLMs, such as BERT, Claude, OPT, or different versions of GPT and their exceptional in-context learning capacities gave rise to prompt-based learning [14, 6, 39, 40, 35, 56]. Prompts serve as demonstrations of the downstream task, which the model can then generalize from. There are two paradigms for LLM prompting, namely discrete and soft prompts.
+
+Discrete prompts [6, 16, 18, 27, 44] are natural-language instructions that contain examples from the downstream task in a well-crafted template. Tuning discrete prompts is often done by prompting the model with different combination of examples, assessing their performance on the downstream task, and choosing the combination that yields the highest performance as the final prompt.
+
+In contrast to discrete prompts, soft prompts [24, 27] prepend trainable continuous embeddings to the inputs of LLMs. These embeddings are initialized either at random or with embedding vectors that correspond to tokens from the dictionary. During tuning, the embeddings are updated through gradient descent to minimize the loss of the prompted model on the private downstream task. To increase performance further, trainable embeddings can be prepended not only to the input but also to every LLM layer, a technique known as prefix [26, 28, 29].
+
+Both soft prompts and prefix train end-to-end without any human involvement through backpropagation over the LLM. On the other hand, discrete prompts have to be designed manually through careful prompt engineering. Yet, prompt engineering only needs inference passes over the LLM which makes discrete prompt more computationally lightweight. Our work provides privacy protection for all of these paradigms: discrete prompts, as well as for soft prompts, and prefix.
+
+Privacy Leakage in LLMs. LLMs have been shown to memorize data both from their original large training corpora [8, 20, 23, 32, 48, 55] and from smaller private datasets used to fine-tune them for downstream tasks [33]. The only prior work around privacy leakage in prompt-based learning utilizes prompts to extract knowledge from trained LLMs [13, 22, 38]. In contrast, we study the privacy of the prompting data itself. To do so, we investigate the canonical privacy attack known as membership inference attacks (MIA) [7, 45]. Its use as a practical means to demonstrate leakage of private information in ML was recently popularized by a line of work on quantifying memorization [9, 43, 47]. While prior work utilizes MIAs to assess whether a given data point was used to train an LLM, we instantiate a MIA to assess whether a given data point was used within the prompt prepended to the inputs of a trained LLM.
+
+Defending Against Privacy Leakage in LLMs. Prior work either focuses on training [2, 19] or fine-tuning [25, 54] LLMs with privacy guarantees. These approaches rely on the mathematical framework of differential privacy (DP) [15] and in particular the DPSGD algorithm for private stochastic gradient descent [1]. Here, DPSGD is applied to guarantee that one outputs approximately the same model parameters whether or not any given data point was used to train or fine-tune the model. To achieve this, DPSGD clips the per-example gradients that are computed during training and adds well-calibrated noise to each model update. These two operations typically increase the computational complexity of training and decrease the utility of the resulting model [1, 4, 49]. To counteract these effects, state-of-the-art methods for full DP-fine tuning in LLMs require extensive hyperparameter tuning and vast computational resources [25]. Alternative approaches refrain from updating the large number of model parameters and instead introduce additional layers into the model architecture and only fine-tune these layers with DPSGD [54]. To the best of our knowledge, no prior work attempted to provide DP guarantees for prompt data in LLMs.
+
+
+Figure 2: MIA Risk. We study GPT3 prompted with 100 different one-shot examples (dbpedia). left: We present the prediction probabilities at the correct class for members (the one-shot example) and non-members (50 randomly sampled private points). The output probability for members is significantly higher than for non-member data points. right: We present the AUC-ROC curves of our MIA against the 100 prompts (gray lines) and the blue line as an average over all attacks. Given that each prompt has only one member, the resulting TPRs can only be $0 \%$ or $100 \%$ which leads to the step-shape of the gray curves. The result indicates that our attack is significantly more successful than random guessing (the red dashed line).
+
+Setup and Notation. We denote by $P$ the soft or discrete prompt that is prepended to any input sequence $x _ { i }$ when querying the language model $L$ . For brevity, we denote $\bar { L } ( [ P , x _ { i } ] )$ by $\bar { L _ { P } ( x _ { i } ) }$ . 3 The output $y _ { i }$ of $L _ { P } ( x _ { i } )$ is an $M$ -dimensional probability vector, with $M$ being the size of the model’s vocabulary. Each component of $y _ { i }$ corresponds to the probability that the $L _ { P }$ assigns to the respective token for being the next token in the sequence $x _ { i }$ . The semantic meaning of the next token varies depending on the given downstream task. For instance, for classification, the index with the highest probability indicates the token of the class that $L _ { P }$ assigns to $x _ { i }$ .
+
+# 3 Private Information about Prompt Data Leaks from Prompted LLMs
+
+By instantiating a MIA against prompted LLMs, we want to highlight that the private data used within a prompt (which we refer to as prompt data from hereon) can be subject to a substantial privacy risk. We showcase this risk at the example of LLMs that are prompted with discrete prompts $P$ containing tuples of demonstrations from classification downstream tasks as prompt data $p = \{ ( p _ { x } , p _ { y } ) \}$ . For example, in a prompt with one demonstration (one-shot learning), the prompt data $p$ may be specified as $p = \{ ($ ("The movie was great.", "positive")}. Our prompts are provided in a consistent template where one or multiple demonstrations are combined with instructions as $P = l$ [Instruction, (text sequence $p _ { x }$ , class-label token $p _ { y } ) , \ldots I$ .
+
+For our MIA, we consider an adversary who aims at inferring whether a given private demonstration $( p _ { x } , p _ { y } )$ was used within the prompt data $p$ . The adversary holds $n$ candidate demonstrations of text sequences and corresponding labels $l _ { i }$ and queries the text sequences $( x _ { 1 } , \cdots , x _ { n } )$ to $L _ { P }$ with black-box access. The prompted model $L _ { P }$ then returns the output probability vectors $( y _ { 1 } , \cdots , y _ { n } )$ . Following prior work [21, 53], we analyze the model’s output probability at token $y _ { i , l _ { i } }$ that corresponds to the correct target class label of every $x _ { i }$ . The intuition to distinguish between members and non-members is that the output probabilities at the correct class $l _ { i }$ will be significantly higher for demonstrations that were used within the prompt, i.e., members with $\left( p _ { x } , p _ { y } \right) { \overset { \cdot } { = } } \left( x _ { i } , l _ { i } \right)$ . We show that even with this simple MIA, we can reliably determine membership for the prompt data.
+
+Experimental Setup. We prompt GPT3-Babbage [6] with multiple one-shot examples to solve four standard downstream text classification tasks, namely dbpedia [57], sst2 [46], agnews [57] and trec [50]. The template of our prompts follows [58]. To evaluate our MIAs, we consider the single data point used within the prompt as a members and 50 other randomly selected data points from the respective task’s training dataset as non-members. This skewed distribution between members and non-members (1 vs 50) corresponds to a realistic scenario where only a small proportion of the candidate data targeted by the adversary are members [21]. To quantify the success of our attack, we report the AUC-ROC curves of 100 random trials.
+
+Results. Before evaluating the success of the MIA, we analyze the probability output from GPT3 for the correct target class between member and non-member data points. Figure 2a shows for the dbpedia dataset that the prediction probabilities for non-members are significantly lower than for members. Figure 2b shows that this leads to a high MIA risk in terms of an average AUC score of 0.84 for the prompt data. Similar results for other datasets and models are presented in Appendix D. These results highlight that private information can leak from prompt data easily and thus motivate the urgent need for defenses which we develop in the rest of this paper.
+
+# 4 Methods for Privacy Preserving Prompts
+
+As of now, if we want to protect the private downstream data, we have to forego prompting altogether because, to the best of our knowledge, no algorithms for private prompt learning exist. The only alternative to privately adapt the LLM would be to perform DP fine-tuning [25, 54]. However, this approach is only feasible when we have direct access to the LLM to update its parameters with DPSGD [25] or to even change the model architecture to insert additional parameters—fine-tuned with DPSGD [54]. This is prohibitively expensive and mostly impossible with the commercial API, thus we propose the first algorithms that enable differentially private prompt learning.
+
+We consider two main paradigms of prompting: soft prompts and discrete prompts. To learn private soft prompts, we introduce PromptDPSGD. PromptDPSGD is a parameter-efficient alternative to DP fine-tuning that does not need modifying the parameters or architectures of the LLM. However, many popular APIs [3, 6, 10, 17, 35] do not support soft prompts yet as it requires gradients with respect to the input. Therefore, we propose PromptPATE for discrete prompts. PromptPATE requires only black-box access to an LLM without any knowledge of the LLM’s architecture or mode of operation. Instead, the algorithm only needs the next-token prediction of the LLM. This, to our knowledge represents the first solution for privately adapting LLMs in restricted API setups.
+
+# 4.1 PromptDPSGD: DPSGD for Private Soft Prompt Learning
+
+In general, all discrete input tokens to LLMs are internally transformed into continuous input embeddings that the LLM then operates on. Soft prompts are just additional continuous input embeddings that can be prepended to the original input embeddings before passing them through the LLM. To train (or tune) soft prompts, we require training data from a potentially private downstream task. After prepending the continuous soft prompt embeddings to input examples from the training data, we can calculate the gradients for the loss of the prompted LLM with respect to these soft prompt embeddings. The gradients provide information about how the soft prompt should be updated in order to minimize the loss on the training data.
+
+If we can obtain the gradients for soft prompts, we can learn these prompts with privacy guarantees by applying the canonical DPSGD algorithm [1]. The same applies to prefix, therefore, when we talk about soft prompts in the following, we implicitly also include prefix. We call this approach PromptDPSGD. The algorithm yields soft prompts with DP guarantees that can be deployed with the LLM to solve the respective downstream task. The privacy analysis of PromptDPSGD follows the one of the standard DPSGD. Note, however, that while conceptually similar to fine-tuning the LLM’s parameters with DPSGD [54, 25], PromptDPSGD differs in a crucial aspect. In DP-SGD fine-tuning, we require the gradients with respect to all or a subset of the model parameters and update these parameters to minimize the loss. In contrast, in PromptDPSGD, we use the gradients with respect to the soft prompt embeddings and only alter these. We highlight this difference in our PromptDPSGD-algorithm that we present in Appendix C.
+
+While this difference seems subtle, it has far-reaching consequences. First, there are orders of magnitude fewer parameters that need to be updated which increases training efficiency. Second, and most importantly, it allows us to keep operating on the original LLM. We discuss the resulting advantages, such as storage efficiency, and the ability to process multiple different tasks simultaneously at the end of this section (in 4.3). These advantages make PromptDPSGD conceptually superior to private fine-tuning. At the same time, as we show in our evaluation, despite the small number of trainable parameters, PromptDPSGD, for simpler tasks, matches the performance of private fine-tuning. Yet, current APIs [3, 6, 10, 17, 35] do not support soft prompting, prefix, or private fine-tuning and only provide black-box access through discrete prompts. For these setups, we propose PromptPATE.
+
+# 4.2 PromptPATE: PATE for Privacy Preserving Discrete Prompts
+
+PATE [36, 37] enables learning classifiers with DP guarantees. It first trains an ensemble of teacher models on disjoint subsets of the private data. Second, through a noisy labeling process, the ensemble privately transfers its knowledge to an unlabeled public dataset. Finally, a separate student model is trained on this labeled public dataset for release. The noisy knowledge transfer in the second step relies on the Confident GNMAX algorithm [37] that we detail in Appendix C. It consists of three main parts: for any input data point from the public unlabeled dataset, each teacher votes for the most likely class. Then, the consensus over the teachers’ votes is determined and queries with low consensus are rejected to avoid revealing too much information about the private decision boundary. Finally, the returned class label for any non-rejected data point is determined as a noisy argmax over all teachers’ vote counts—where the added noise is sampled from a Gaussian distribution to implement the DP guarantees. For each rejected or labeled data point from the public dataset, privacy costs are accumulated and the ensemble stops labeling once a target privacy budget is reached.
+
+Our PromptPATE follows the general flow of standard PATE: training the teacher models, private knowledge transfer, and training a student model. However, due to the significant differences between in-context learning for LLMs and supervised learning in the original PATE and how these different paradigms leverage private and public data, we had to redesign each of these building blocks. This allows to leverage both the data-efficiency of prompts and the rigorous privacy protection from PATE. In the following, we present the building blocks in our PromptPATE.
+
+Teacher Models (Flock of Stochastic Parrots). Instead of training teacher models on disjoint partitions of the private data, we use the private data to create disjoint prompts for the LLM. More specifically, we use examples, for instance {("The movie was great.", "positive"), ...}, from the private training data to create prompts that can then be deployed with the LLM as teachers.
+
+Private Knowledge Transfer. During the private knowledge transfer, the teachers label public data sequences, such as ("I did enjoy it.", _). Each teacher votes with the most likely class labels for the private downstream task. In Appendix D, we show that PromptPATE can also operate directly on pure next token predictions from Claude [3] without access to per-token probabilities—enabling full black-box private prompts. By performing the private voting process according to standard PATE with the Confident GNMAX algorithm, we turn our per-teacher predictions into a final class label token that will be appended to the sequence, e.g., ("I did enjoy it", "positive"). The privacy accounting and analysis of our PromptPATE exactly follows the one of standard PATE [37].
+
+Student. The most naive way to obtain a student model following standard PATE would be to label many public sequences and train a language classifier using supervised learning on this data. However, due to the relatively high number of data needed for supervised learning, and the fact that each query to the private teachers consumes privacy, this process would incur high privacy costs. We propose a better approach building on the data-efficiency of prompting [42] by using labeled public sequences to create new discrete student prompts. The selected prompt can then be deployed with the LLM as the PromptPATE student model.
+
+In theory, labeling one public sequence by the ensemble would be sufficient to create such a prompt. This approach yields negligible privacy costs, but the resulting prompt might not have good utility due to the high variance in the performance of prompts [58]. Therefore, we generate multiple prompts based on different labeled public sequences and perform prompt tuning to select the best student prompt. Care must be taken during selection: utility cannot be evaluated on the private data anymore given that the prompt will be publicly deployed and selecting based on the private data would incur additional privacy costs. We solve this tension by using parts of the newly-labeled public data as validation data to assess utility of the student prompts. By selecting the prompt with the highest validation accuracy, we deploy the student prompt that most resembles the private teachers.
+
+# 4.3 Advantages of (Private) Prompting over (Private) Fine-Tuning
+
+Our private prompt learning enables us to leverage the general advantages of prompting over finetuning while preserving privacy. Private prompting requires significantly less storage than private fine-tuning. While fine-tuning requires storing a separate copy of the LLM model for each downstream task [24], prompts operate only on the input level of LLMs without adapting model parameters, such that only a small task-specific prompt needs to be stored for each downstream task. For example, each copy of the fine-tuned RoBERTa base model requires 125M parameters $\sim 5 0 0 \mathbf { M B }$ ). This becomes prohibitively expensive, especially as the number of parameters for state-of-the-art LLMs rapidly increases. In contrast, soft-prompts and prefix, as the one generated by PromptDPSGD (using implementation from [29]) with the standard prompt length of 10 tokens require less than 10K parameters (40KB) for the soft-prompt and 100K parameters (400KB) for the prefix. A discrete prompt, such as the one generated in PromptPATE, requires less than 1 KB of prepended text. Prompts also enable processing many examples from different tasks in a single batch [26], called mixed-task inference. This allows more efficient use of LLMs since we do not have to wait for a sufficient number of requests for a single task before processing them. This is not possible with any form of fine-tuning, where the fine-tuned model can serve solely a single task.
+
+
Dataset
M P
Soft-Prompt (Our)
Prefix (Our)
Full-Tuning [25]
LoRA-Tuning [54]
<10K
<100K
125M
1.2M
G
m=8
m=8
m=8
m=8
m=8
m=8
m=8
m=8
sst2
92.31
95.64
91.97
96.33
85.89
96.40
92.97
96.60
qnli
84.11
89.48
87.17
94.84
84.81
94.70
88.59
94.70
qqp
81.52
86.56
82.58
91.42
86.15
92.20
86.26
92.20
mnli
75.15
82.49
80.57
90.34
83.30
90.20
82.92
90.20
+
+Table 1: Performance of PromptDPSGD. We report the accuracy values $( \% )$ for each dataset. All $\varepsilon$ values are reported as standard DP guarantees. We run the experiment on RoBERTa [30]. The first row M: the type of the private Method, the second row P: the number of Parameters tuned for the method, and the third row G: DP Guarantee. We also present results for $\varepsilon = 3$ in Appendix D.
+
+# 5 Experimental Evaluation
+
+We evaluate both PromptDPSGD and PromptPATE and show that they match the performance of non-private prompting while providing strong privacy guarantees.
+
+# 5.1 PromptDPSGD
+
+Experimental Setup. To train soft-prompts and prefix, we follow the experimental setup from prior work on DP fine-tuning. Specifically, we use differentially-private optimization engines for transformers, such as models from the BERT family for the language understanding tasks. The experimental results for classification were performed on the RoBERTa models [30], using the standard NLP datasets, namely sst2, qnli, qqp, and mnli, from the GLUE benchmark [51]. Our implementation for soft-prompt and prefix is based on P-Tuning v2 [29]. To tune the (hyper)parameters for PromptDPSGD, we adjust the length of the soft-prompt or prefix in the private setting (with the default value of 10, which commonly yields good performance). For the privacy parameters, we set the $\delta = 1 / N$ , where $N$ is the number of data points in a given dataset, The clipping threshold of per-example gradients is set to 0.1 in most cases. We use a batch size of 1024. The detailed selection of (hyper-)parameters is presented in Appendix E.
+
+Results. We compare our PromptDPSGD against state-of-the-art approaches for private finetuning on multiple private downstream datasets. Our results are shown in Table 1. We highlight that both soft prompts and prefix provide competitive privacy utility trade-offs. For example, the difference in accuracy values between the non-private baseline and the private soft prompt ranges from $3 \%$ (for the simplest sst2 dataset) and up to $7 \%$ (for the most difficult mnli dataset). This mirrors results for other private methods, such as the private fine-tuning of LoRA [54]. We also observe that, similarly, for simple tasks, such as sst2 or qnli, the performance of soft prompt or prefix matches the one of fine-tuning. For the more difficult tasks, namely qqp and mnli, the performance of prefix and soft prompts is also relatively close to fine-tuning. The results obtained for these methods are highly influenced by the number of optimized parameters. For example, for the SST2 task and the RoBERTa-Base model, the prefix requires 19970 additional parameters while soft prompt adds solely 2306 parameters. On the other hand, the number of privately tuned parameters is a few orders of magnitude bigger for fine-tuning and equal to the size of the trained model, namely 125M for the method proposed in [25], while the fine-tuning approach from [54] optimizes around 1.2M parameters. Our results reflect a general trend, where prompts are suited for small downstream tasks while fine-tuning with its bigger number of parameters can also cater to more complex tasks with larger training data sets.
+
+Table 2: Performance of PromptPATE. We compare PromptPATE with three baselines: zero-shot (Lower Bound), the ensemble’s accuracy (Ens. Acc), and the non-private baseline (Upper Bound) on four classification benchmarks. We study two settings, (IID Transfer) when the public dataset is from the same and (OOD Transfer) different distribution than the private data. We find that PromptPATE achieves strong privacy protection $\varepsilon < 0 . 3$ at $\delta = 1 0 ^ { - 6 }$ ) and utility close to the non-private and significantly higher than the zero-shot. Unless otherwise specified, the experiments are performed on GPT3-Babbage with one-shot prompts. Additionally, we also run experiments on GPT3-Curie for sst2 (C) and 4-shot prompts for agnews (4).
+
+
Private
Lower Bound
Ens. Acc.
Upper Bound
Our PromptPATE
ID Transfer
OOD Transfer
m=0
m=8
m=8
Public
E
Test acc
Public
m
Test acc
sst2
76.3
90.0
93.8
sst2
0.178
88.8±2.3
imdb
0.187
87.2±1.9
agnews
62.0
72.8
78.2
agnews
0.248
71.7±0.8
arisetv
0.258
67.9±1.7
trec
40.7
57.6
58.7
trec
0.281
52.8 ±1.5
qqp
0.293
50.9±3.5
dbpedia
44.2
81.6
85.6
dbpedia
0.194
80.3 ±1.3
agnews
0.203
74.6±1.4
sst2(C)
82.0
94.0
95.2
sst2
0.147
92.3 ±1.1
imdb
0.154
92.7±0.8
agnews (4)
62.0
75.8
81.0
agnews
0.145
73.5 ±1.2
arisetv
0.145
69.6 ±1.8
+
+# 5.2 PromptPATE
+
+Experimental Setup. Teachers: Unless otherwise specified, we rely on GPT3-Babbage as the base LLM and select one-shot examples randomly without replacement from the private downstream task as prompt data. Our prompt template follows Zhao et al. [58]. For each setting, we deploy 200 teacher prompts. Private knowledge transfer: We use the implementation of PATE’s Confident GNMAX algorithm and the privacy accounting from [12] and report our algorithm’s hyperparameters in Appendix E. Student: For each private downstream task, we experiment with two setups (1) selecting public input sequences from the same (IID) and (2) from a different distribution (OOD) as the private data. We introduce three new datasets for the OOD setup: imdb [31], arisetv [11] and qqp [52]. The details of preprocessing these datasets can be found in Appendix E. In both the IID and OOD setup, we limit the size of the public dataset to 500 input sequences from the respective datasets. After the ensemble finishes labelling, we select the best labeled public sequence as prompt data based on the validation accuracy on the labeled public set. We repeat the process three times and report average and standard deviation of the test accuracy for the selected student prompt on the private test set. To improve utility, both teachers’ and students’ output probabilities from GPT3 are recalibrated using contexual calibration [58].
+
+Results. We compare PromptPATE against three baselines: the lower bound baseline represented by a zero-shot prediction $( \varepsilon = 0$ ), i.e., when the LLM is only prompted with an instruction, the private ensemble accuracy $\varepsilon = \infty$ ), and the upper bound as a non-private one-shot prediction $\varepsilon = \infty$ ) using the best example from the private data as prompt data. (To save costs, we select from 200 candidates.) Table 2 shows that, over all setups, PromptPATE achieves similar utility to the non-private baseline and significantly improves over zero-shot predictions—even at very strong privacy protection $\varepsilon < 0 . 3$ , $\delta \stackrel { - } { = } 1 0 ^ { - 6 }$ ). Our results also highlight that the distribution of the public data does not need to be very close to the distribution of the private data to yield high-utility student prompts. For example, they can be collected from different domains (dbpedia holds extracts from wikipedia while its public data agnews contains news articles) and for different tasks (trec aims to classify the topic of a given answer while qqp serves to measure the similarity of two questions). Still, with dbpedia being the private downstream data and agnews as public, we achieve an accuracy of $7 4 . 6 \%$ , which is significantly higher than the zero-shot baseline with $4 4 . 2 \%$ .
+
+We also provide further insights into the privacy-utility trade-offs that can be achieved with PromptPATE in Figure 3b. Our results highlight that with more public sequences queried to the ensemble, the privacy consumption increases while, after roughly 100 queries, with even $\varepsilon < 0 . 2$ , the student model’s test accuracy saturates. This yields very favorable privacy-utility trade-offs which we attribute mainly to the data efficiency of discrete prompts: Even from within as little as 100 labeled examples, a high-performing student prompt can be derived. Additionally, we observe that the per-query privacy costs of PromptPATE are relatively low, further benefiting the privacy-utility trade-off. The small privacy costs result from the high consensus between the teacher predictions4, see Figure 3a—that might result from all teachers relying on the same underlying LLM, just with different prompts.
+
+
+Figure 3: Additional Insights of PromptPATE. We perform ablation studies on GPT3-Babbage and use dbpedia as private and agnews as public data. Left: Teacher consensus as the fraction of teachers who vote for the correct class over 500 public input sequences. PromptPATE achieves overall high consensus. Right: Student accuracy as a function of the public query set’s size. Already with as few as 100 queries, we observe a plateau in accuracy which highlights PromptPATE’s data efficiency.
+
+Scalability. Finally, we also study how PromptPATE scales with larger LLMs and more examples in the prompt. We experiment with a more performant LLM (GPT3-Currie) for sst2. Due to the higher per-query costs, we are not able to repeat this experiment for all datasets. Our results show that the performance of our private prompt increases together with the performance of the public prompt $( 9 2 . 7 \%$ accuracy on Curie vs. $8 7 . 2 \%$ on Babbage) while the privacy budget $\epsilon$ decreases (from 0.178 to 0.147). To investigate flexibility in terms of numbers of private examples provided as prompt data, we also experiment for agnews with 4-shot teachers. Similar to the non-private study [58] that reports improvements for agnews in the 4-shot setting over 1-shot, we observe that this improvement also translates to the private prompt. Our results indicate that with increasingly more powerful LLMs and larger context windows, private prompting will increase further in terms of privacy-utility trade-offs.
+
+# 6 Conclusions and Outlook
+
+By instantiating the first simple yet effective membership inference attack against prompted LLMs, we show that they leak private information about their prompt data. We propose private prompt learning as a holistic and broadly applicable new approach to mitigate this risk. We first introduce PromptDPSGD that enables to train soft-prompts with privacy guarantees. In contrast to finetuning, soft prompts optimize significantly fewer parameters and do not require any update of LLM parameters or changes to its architecture. As the first solution to private downstream learning with LLMs in black-box access scenarios, we propose PromptPATE. PromptPATE builds on the highly data-efficient discrete prompts and implements privacy through a noisy knowledge transfer. Through our evaluation against two popular LLMs deployed behind commercial black-box APIs (GPT3 and Claude) [6, 3], we highlight that this method yields downstream performance that matches the one of non-private prompting at very strong privacy guarantees. As LLMs rapidly improve and increase in size, prompts are achieving consistently higher performance while fine-tuning becomes more challenging at this scale. This suggests that privacy protections for prompts will become even more important, especially as context sizes expand.
+
+# Acknowledgments
+
+We would like to acknowledge our sponsors, who support our research with financial and in-kind contributions: Amazon, Apple, CIFAR through the Canada CIFAR AI Chair, DARPA through the
+
+GARD project, Intel, Meta, NSERC through a Discovery Grant, the Ontario Early Researcher Award, and the Sloan Foundation. 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. We also thank members of the CleverHans Lab for their feedback.
+
+# References
+
+[1] M. Abadi, A. Chu, I. Goodfellow, H. B. McMahan, I. Mironov, K. Talwar, and L. Zhang. Deep learning with differential privacy. In Proceedings of the 2016 ACM SIGSAC conference on computer and communications security, pages 308–318, 2016.
+[2] R. Anil, B. Ghazi, V. Gupta, R. Kumar, and P. Manurangsi. Large-scale differentially private bert. arXiv preprint arXiv:2108.01624, 2021.
+[3] Antropic. Introducing claude. Antropic Website. 2023-03-14, https://www.anthropic. com/index/introducing-claude.
+[4] R. Bassily, A. Smith, and A. Thakurta. Private empirical risk minimization: Efficient algorithms and tight error bounds. In 2014 IEEE 55th annual symposium on foundations of computer science, pages 464–473. IEEE, 2014.
+[5] E. M. Bender, T. Gebru, A. McMillan-Major, and S. Shmitchell. On the dangers of stochastic parrots: Can language models be too big? In Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency, FAccT ’21, page 610–623, New York, NY, USA, 2021. Association for Computing Machinery.
+[6] T. Brown, B. Mann, N. Ryder, M. Subbiah, J. D. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
+[7] N. Carlini, S. Chien, M. Nasr, S. Song, A. Terzis, and F. Tramer. Membership inference attacks from first principles. In 2022 IEEE Symposium on Security and Privacy (SP), pages 1897–1914. IEEE, 2022.
+[8] N. Carlini, D. Ippolito, M. Jagielski, K. Lee, F. Tramer, and C. Zhang. Quantifying memorization across neural language models. arXiv preprint arXiv:2202.07646, 2022.
+[9] N. Carlini, F. Tramer, E. Wallace, M. Jagielski, A. Herbert-Voss, K. Lee, A. Roberts, T. Brown, D. Song, U. Erlingsson, et al. Extracting training data from large language models. In 30th USENIX Security Symposium (USENIX Security 21), pages 2633–2650, 2021.
+[10] H.-T. Cheng and R. Thoppilan. Lamda: Towards safe, grounded, and high-quality dialog models for everything. Google Blog Post. 2023-05-09, https://ai.googleblog.com/2022/01/ lamda-towards-safe-grounded-and-high.html.
+[11] O. chimaobi Samuel. news-data. Huggingface, 2022.
+[12] C. A. Choquette-Choo, N. Dullerud, A. Dziedzic, Y. Zhang, S. Jha, N. Papernot, and X. Wang. Capc learning: Confidential and private collaborative learning. In International Conference on Learning Representations, 2021.
+[13] J. Davison, J. Feldman, and A. M. Rush. Commonsense knowledge mining from pretrained models. In Proceedings of the 2019 conference on empirical methods in natural language processing and the 9th international joint conference on natural language processing (EMNLPIJCNLP), pages 1173–1178, 2019.
+[14] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
+[15] C. Dwork. Differential privacy. In Automata, Languages and Programming: 33rd International Colloquium, ICALP 2006, Venice, Italy, July 10-14, 2006, Proceedings, Part II 33, pages 1–12. Springer, 2006.
+[16] T. Gao, A. Fisch, and D. Chen. Making pre-trained language models better few-shot learners. arXiv preprint arXiv:2012.15723, 2020.
+[17] Google. Lamda: Towards safe, grounded, and high-quality dialog models for everything. Website, 2023. 2023, https://bard.google.com/.
+[18] H. Guo, B. Tan, Z. Liu, E. Xing, and Z. Hu. Efficient (soft) q-learning for text generation with limited good data. In Findings of the Association for Computational Linguistics: EMNLP 2022, pages 6969–6991, 2022.
+[19] S. Hoory, A. Feder, A. Tendler, S. Erell, A. Peled-Cohen, I. Laish, H. Nakhost, U. Stemmer, A. Benjamini, A. Hassidim, et al. Learning and evaluating a differentially private pre-trained language model. In Findings of the Association for Computational Linguistics: EMNLP 2021, pages 1178–1189, 2021.
+[20] D. Ippolito, F. Tramèr, M. Nasr, C. Zhang, M. Jagielski, K. Lee, C. A. Choquette-Choo, and N. Carlini. Preventing verbatim memorization in language models gives a false sense of privacy. arXiv preprint arXiv:2210.17546, 2022.
+[21] B. Jayaraman, L. Wang, K. Knipmeyer, Q. Gu, and D. Evans. Revisiting membership inference under realistic assumptions. Proceedings on Privacy Enhancing Technologies, 2021(2), 2021.
+[22] Z. Jiang, F. F. Xu, J. Araki, and G. Neubig. How can we know what language models know? Transactions of the Association for Computational Linguistics, 8:423–438, 2020.
+[23] E. Kharitonov, M. Baroni, and D. Hupkes. How bpe affects memorization in transformers. arXiv preprint arXiv:2110.02782, 2021.
+[24] B. Lester, R. Al-Rfou, and N. Constant. The power of scale for parameter-efficient prompt tuning. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, Nov. 2021.
+[25] X. Li, F. Tramer, P. Liang, and T. Hashimoto. Large language models can be strong differentially private learners. In International Conference on Learning Representations, 2022.
+[26] X. L. Li and P. Liang. Prefix-tuning: Optimizing continuous prompts for generation. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 4582–4597, 2021.
+[27] J. Liu, D. Shen, Y. Zhang, B. Dolan, L. Carin, and W. Chen. What makes good in-context examples for gpt-3? arXiv preprint arXiv:2101.06804, 2021.
+[28] X. Liu, K. Ji, Y. Fu, W. Tam, Z. Du, Z. Yang, and J. Tang. P-tuning: Prompt tuning can be comparable to fine-tuning across scales and tasks. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 61–68, Dublin, Ireland, May 2022. Association for Computational Linguistics.
+[29] X. Liu, K. Ji, Y. Fu, W. L. Tam, Z. Du, Z. Yang, and J. Tang. P-tuning v2: Prompt tuning can be comparable to fine-tuning universally across scales and tasks. arXiv preprint arXiv:2110.07602, 2021.
+[30] Y. Liu, M. Ott, N. Goyal, J. Du, M. Joshi, D. Chen, O. Levy, M. Lewis, L. Zettlemoyer, and V. Stoyanov. Ro{bert}a: A robustly optimized {bert} pretraining approach, 2020.
+[31] A. Maas, R. E. Daly, P. T. Pham, D. Huang, A. Y. Ng, and C. Potts. Learning word vectors for sentiment analysis. In Proceedings of the 49th annual meeting of the association for computational linguistics: Human language technologies, pages 142–150, 2011.
+[32] R. T. McCoy, P. Smolensky, T. Linzen, J. Gao, and A. Celikyilmaz. How much do language models copy from their training data? evaluating linguistic novelty in text generation using raven. arXiv preprint arXiv:2111.09509, 2021.
+[33] F. Mireshghallah, A. Uniyal, T. Wang, D. Evans, and T. Berg-Kirkpatrick. Memorization in nlp fine-tuning methods. arXiv preprint arXiv:2205.12506, 2022.
+
+[34] R. Mitchell. Samsung fab data leak: How chatgpt exposed sensitive information. electropages.
+
+[35] OpenAI. Gpt-4 technical report, 2023.
+
+[36] N. Papernot, M. Abadi, Ú. Erlingsson, I. Goodfellow, and K. Talwar. Semi-supervised knowledge transfer for deep learning from private training data. In International Conference on Learning Representations, 2017.
+
+[37] N. Papernot, S. Song, I. Mironov, A. Raghunathan, K. Talwar, and U. Erlingsson. Scalable private learning with pate. In International Conference on Learning Representations, 2022.
+
+[38] F. Petroni, T. Rocktäschel, P. Lewis, A. Bakhtin, Y. Wu, A. H. Miller, and S. Riedel. Language models as knowledge bases? arXiv preprint arXiv:1909.01066, 2019.
+
+[39] A. Radford, K. Narasimhan, T. Salimans, I. Sutskever, et al. Improving language understanding by generative pre-training. 2018.
+
+[40] A. Radford, J. Wu, R. Child, D. Luan, D. Amodei, I. Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
+
+[41] C. Raffel, N. Shazeer, A. Roberts, K. Lee, S. Narang, M. Matena, Y. Zhou, W. Li, and P. J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. The Journal of Machine Learning Research, 21(1):5485–5551, 2020.
+
+[42] T. L. Scao and A. M. Rush. How many data points is a prompt worth? arXiv preprint arXiv:2103.08493, 2021.
+
+[43] V. Shejwalkar, H. A. Inan, A. Houmansadr, and R. Sim. Membership inference attacks against NLP classification models. In NeurIPS 2021 Workshop Privacy in Machine Learning, 2021.
+
+[44] T. Shin, Y. Razeghi, R. L. Logan IV, E. Wallace, and S. Singh. Autoprompt: Eliciting knowledge from language models with automatically generated prompts. arXiv preprint arXiv:2010.15980, 2020.
+
+[45] R. Shokri, M. Stronati, C. Song, and V. Shmatikov. Membership inference attacks against machine learning models. In 2017 IEEE symposium on security and privacy $( S P )$ , pages 3–18. IEEE, 2017.
+
+[46] R. Socher, A. Perelygin, J. Wu, J. Chuang, C. D. Manning, A. Y. Ng, and C. Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pages 1631–1642, 2013.
+
+[47] C. Song and V. Shmatikov. Auditing data provenance in text-generation models. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 196–206, 2019.
+
+[48] K. Tirumala, A. H. Markosyan, L. Zettlemoyer, and A. Aghajanyan. Memorization without overfitting: Analyzing the training dynamics of large language models. arXiv preprint arXiv:2205.10770, 2022.
+
+[49] F. Tramer and D. Boneh. Differentially private learning needs better features (or much more data). In International Conference on Learning Representations, 2021.
+
+[50] E. M. Voorhees and D. M. Tice. Building a question answering test collection. In Proceedings of the 23rd annual international ACM SIGIR conference on Research and development in information retrieval, pages 200–207, 2000.
+
+[51] A. Wang, A. Singh, J. Michael, F. Hill, O. Levy, and S. R. Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In International Conference on Learning Representations, 2019.
+
+[52] Z. Wang, W. Hamza, and R. Florian. Bilateral multi-perspective matching for natural language sentences. In Proceedings of the 26th International Joint Conference on Artificial Intelligence, pages 4144–4150, 2017.
+
+[53] S. Yeom, I. Giacomelli, M. Fredrikson, and S. Jha. Privacy risk in machine learning: Analyzing the connection to overfitting. In 2018 IEEE 31st computer security foundations symposium (CSF), pages 268–282. IEEE, 2018.
+[54] D. Yu, S. Naik, A. Backurs, S. Gopi, H. A. Inan, G. Kamath, J. Kulkarni, Y. T. Lee, A. Manoel, L. Wutschitz, S. Yekhanin, and H. Zhang. Differentially private fine-tuning of language models. In International Conference on Learning Representations, 2022.
+[55] C. Zhang, D. Ippolito, K. Lee, M. Jagielski, F. Tramèr, and N. Carlini. Counterfactual memorization in neural language models. arXiv preprint arXiv:2112.12938, 2021.
+[56] S. Zhang, S. Roller, N. Goyal, M. Artetxe, M. Chen, S. Chen, C. Dewan, M. Diab, X. Li, X. V. Lin, et al. Opt: Open pre-trained transformer language models. arXiv preprint arXiv:2205.01068, 2022.
+[57] X. Zhang, J. Zhao, and Y. LeCun. Character-level convolutional networks for text classification. Advances in neural information processing systems, 28, 2015.
+[58] Z. Zhao, E. Wallace, S. Feng, D. Klein, and S. Singh. Calibrate before use: Improving few-shot performance of language models. In International Conference on Machine Learning, pages 12697–12706. PMLR, 2021.
+
+# A Broader Impacts
+
+The growing importance of in-context learning as a paradigm for leveraging LLMs on private downstream tasks has significant implications for privacy. We present the first approaches for obtaining prompts with privacy guarantees, thereby enabling the use of this learning paradigm on sensitive data. This advancement has the potential to increase trust and acceptance of LLM-based systems for private applications. Our approach PromptPATE is the first viable technique for private downstream adaptation of black-box LLMs, which enables integrations into the state-of-the-art commercial LLM APIs. We acknowledge that—as with any application that relies on DP—care must be taken when choosing the privacy parameters $\varepsilon$ and $\delta$ since setting these incorrectly can lead to a false sense of privacy. Therefore, our work orientates at the privacy parameters that have been shown to provide reasonable protection in prior work. Thereby, we also ensure consistency and comparability in evaluations between the different appraoches.
+
+# B Limitations
+
+Tuning Instructions and Templates. For our discrete prompts, we did not tune the instructions or templates but instead relied on a template from prior work [58]. The effectiveness and performance of our PromptPATE could potentially be further improved by tuning the instructions and templates.
+
+Privacy Risk of Pretrained LLM: We build on pretrained LLMs to learn and deploy our private prompts. Our methods solely target the protection of the private data used for these prompts. However, it is also important to acknowledge the inherent privacy risks for data used to pretrain the LLM. We leave the pretrainig of LLMs with privacy guarantees to an orthogonal line of work.
+
+Limited Monetary Budget for our Experiments. Due to cost limitations, we were unable to experiment with the latest and best available model, GPT4. Our experiments with GPT3-Curie in comparison to less powerful GPT3-Babbage however indicate the clear trend the our private prompts improve in performance as the non-private baseline improves due to better models. Furthermore, again due to the cost limitation, we were not able to incorporate a larger number of teachers in our experiments for PromptPATE. Therefore, the best non-private teacher baseline that we report might not be the best achievable if one had more teachers to choose from. We chose from 200 and note that with more (and potentially better teachers), not only the baseline but also the teacher ensemble’s performance would get better.
+
+Hyperparameter Tuning. To save computation costs, we did not exhaustively tune all hyperparameters in our experiments. While our approach still achieves high utility and good privacy-utility trade-offs, we acknowledge that with more hyperparameter tuning the performance together with the understanding of optimal configurations for private prompt learning could increase.
+
+Assumption of a Trusted LLM API Provider. In our work, the API provider gets to interact with the private data, for example, through the teachers’ prompts in PromptPATE. Therefore, we have to assume trust in the API provider. The privacy guarantees through our private prompt learning protect the privacy of the prompt data against users that interact with the prompted LLM. In practice, companies that are concerned about the privacy of their data with respect to the API provider could make contracts with the API providers on the use of their data or buy access plans that guarantee that data queried to the API is treated privately. We leave implementing cryptographic approaches that could relief the assumption on trusting the API provider entirely, for example, by enabling the LLM to run inference on encrypted private data to future work.
+
+# C Additional Insights into our Methods
+
+# C.1 PromptDPSGD
+
+We present the full PromptDPSGD algorithm in Algorithm 1.
+
+Algorithm 1: PromptDPSGD. In contrast to the standard DPSGD algorithm that updates model parameters during private training or fine-tuning, our PromptDPSGD privately updates the soft prompt parameters. We highlight these changes with respect to standard DPSGD training or fine-tuning in blue.
+
+Require: Private downstream data $D = \{ ( x _ { i } , y _ { i } ) \mid i \in [ N ] \}$ , prompt sequence length $s$ , embedding dimensionality $e$ , trained LLM $L$ with frozen parameters, loss function $\ell ( L _ { p } , x )$ for prompted LLM, Params: learning rate $\eta _ { t }$ , noise scale $\sigma$ , sampling rate $q$ , max gradient norm $c$ , training iterations $T$ . 1: Initialize $P _ { 0 } \in \bar { \mathbb { R } ^ { s \times e } }$ at random
+2: for $t \in [ T ]$ do
+3: Sample mini-batch $B _ { t }$ according to sampling rate $q$ from $D$ {Poisson sampling}
+4: For each $i \in | B _ { t } |$ , compute $\mathbf { g } _ { t } ( x _ { i } ) \gets \bar { \nabla } _ { P _ { t } } \ell ( L _ { P } , x _ { i } )$ {Compute per sample gradient w.r.t. $p _ { t }$ } 5: $\begin{array} { r } { \bar { \bf g } _ { t } ( x _ { i } ) { \bf g } _ { t } ( x _ { i } ) / \operatorname* { m a x } ( 1 , \frac { \| { \bf g } _ { t } ( x _ { i } ) \| _ { 2 } } { c } ) } \end{array}$ {Clip gradient}
+6: $\begin{array} { r } { \tilde { \mathbf { g } } _ { t } \frac { 1 } { \mid B _ { t } \mid } ( \sum _ { i } \bar { \mathbf { g } } _ { t } ( x _ { i } ) + \mathcal { N } ( 0 , \sigma ^ { 2 } c ^ { 2 } \mathbf { I } ) ) } \end{array}$ {Add noise}
+7: $P _ { t + 1 } \gets P _ { t } - \eta _ { t } \tilde { \mathbf { g } } _ { t }$ {Update soft prompt}
+8: end for
+9: Output $p _ { T }$ and compute the overall privacy cost $( \varepsilon , \delta )$ .
+
+# C.2 PromptPATE
+
+Extended Background on PATE. We include the standard Confident-GNMax Aggregator Algorithm from [37] below.
+
+# Algorithm 2: Confident-GNMax Aggregator by [37]
+
+Require: input $x$ , threshold $T$ , noise parameters $\sigma _ { 1 }$ and $\sigma _ { 2 }$
+1: if $\textstyle \operatorname* { m a x } _ { j } \{ \sum _ { i \in [ E ] } n _ { i , j } ( x ) \} + \mathcal { N } ( 0 , \sigma _ { 1 } ^ { 2 } ) \geq T$ then
+2: Output arg $\begin{array} { r } { \operatorname* { m a x } _ { j } \{ \sum _ { i \in [ E ] } n _ { i , j } ( \mathbf x ) + \mathcal { N } ( 0 , \sigma _ { 2 } ^ { 2 } ) \} } \end{array}$
+3: else
+4: Output ⊥
+5: end if
+
+# C.3 Privacy Analysis
+
+PromptDPSGD. Our PromptDPSGD can be seen as a repeated sampled Gaussian mechanism [1], with sampling performed over the entirety of the private prompt dataset. The difference to standard DPSGD for training or fine-tuning is that we do not update the model parameters, but the trainable embeddings for the soft prompts. This is conceptually different from standard DPSGD in terms of which parameters are updated. The privacy guarantees of the training mechanism still follow Abadi et al. [1], but with respect to the soft prompt embeddings: whether or not a particular data point will be included in the private training set used for tuning the prompt, the resulting soft prompt embeddings after training will be roughly the same. Especially by applying the clipping operation at every step, each mechanism’s sensitivity is bounded by $c$ . Privacy is then implemented as the trainable soft prompt embeddings are updated while adding noise noise drawn from ${ \mathcal { N } } ( 0 , c ^ { 2 } \sigma ^ { 2 } I )$ .
+
+Theorem 1 (Privacy of PromptDPSGD). Let $T$ be the total number of repetitions (training iterations) of our PromptDPSGD and the sampling rate be denoted by $q$ . Then, there exist two constants $c _ { 1 }$ and $c _ { 2 }$ , such that for any $\varepsilon < c _ { 1 } q ^ { 2 } T$ our PromptDPSGD guarantees √ $( \varepsilon , \delta )$ -DP, if for any $\delta > 0$ , we choose the noise according to $\sigma \ge c _ { 2 } \frac { q c \sqrt { T \log { 1 / \delta } } } { \varepsilon }$ .
+
+Proof. The proof follows the one by Abadi et al. [1], using their moments accountant that models the privacy loss as a random variable dependent on the stochastic noise added. □
+
+PromptPATE. Our PromptPATE relies entirely on the Confident GNMAX algorithm from Papernot et al. [37]. We preserve the assumption underlying the algorithm and the respective privacy analysis that the sensitivity during the voting mechanism equals one. This is done in PromptPATE by assigning disjoint data points from the private prompt downstream dataset to all teachers. As a consequence, the privacy analysis of our PromptPATE entirely follows Papernot et al. [37].
+
+Both our PromptDPSGD and PromptPATE experience the post-processing properties of DP, i.e., once trained, the privacy guarantee $( \varepsilon , \delta )$ sets an upper bound on privacy leakage for the prompt data, independent on the number and type of queries that will be posed to the final prompted LLM.
+
+# D Additional Results
+
+# D.1 Membership Inference Attacks
+
+We present the full results of MIA against GPT3 with one-shot prompts on 4 datasets in SCW: Section4.
+
+
+Figure 4: MIA Risk over Multiple Datasets on GPT3. We study GPT3-babbage prompted with 100 different one-shot examples on four datasets. Top: We present the prediction probabilities at the correct class for members (the one-shot example) and non-members (50 randomly sampled private points). The output probability for members is significantly higher than for non-member data points. Bottom: We present the AUC-ROC curves of our MIA against the 100 prompts (gray lines) and the blue line as an average over all attacks. Given that each prompt has only one member, the resulting TPRs can only be $0 \%$ or $100 \%$ which leads to the step-shape of the gray curves. The result indicates that our attack is significantly more successful than random guessing (the red dashed line).
+
+In addition, we also perform similar experiments on GPT2-xl with four-shot examples, with results presented in Figure 5. We replace dbpedia with cb because the input in dbpedia is usually longer than the context length of GPT2.
+
+# D.2 PromptPATE on Claude
+
+We present the experiment results of PromptPATE on Claude [3]. Different from GPT3 that outputs logits over the whole vocabulary, Claude only gives us access to the next most likely token.
+
+Experimental Setup. Teachers: We rely on Claude-v1 as the base LLM. We use 2-shot prompts for sst2 and agnews, 4-shot for trec and 1-shot for dbpedia. We set the maximum generated tokens to 1 and temperatures to 0. We also create an "other" category in case the moel’s output does not fall under any specified categories. For each setting, we deploy 400 teacher prompts. Private knowledge transfer: We use the implementation of PATE’s Confident GNMAX algorithm and the privacy accounting from [12] and report our algorithm’s hyperparameters in Appendix E. Student: We limit the size of the public dataset to 200 input sequences from the respective datasets. The number of shots for students corresponds with the teachers.
+
+# D.3 More results for PromptDPSGD
+
+We present the additional results for PromptDPSGD with $\varepsilon = 3$ on the classification tasks in Table 5.
+
+
+Figure 5: MIA Risk over Multiple Datasets on GPT2-xl (4 shot). We study GPT2-xl prompted with 100 different four-shot examples on four datasets. top: We present the prediction probabilities at the correct class for members (the one-shot example) and non-members (50 randomly sampled private points). The output probability for members is significantly higher than for non-member data points. bottom: We present the AUC-ROC curves of our MIA against the 100 prompts (gray lines) and the blue line as an average over all attacks. Given that each prompt has only one member, the resulting TPRs can only be $0 \%$ , $2 5 \%$ , $50 \%$ , $7 5 \%$ or $100 \%$ which leads to the step-shape of the gray curves. The result indicates that our attack is significantly more successful than random guessing (the red dashed line).
+
+
Lower Bound
Ens. Acc.
Upper Bound
Our PromptPATE
Private
m=0
m=8
m=8
Public
m
Test acc
sst2
92.7
96.0
98.0
sst2
0.048
95.7 ± 1.4
agnews
72.4
79.1
82.7
agnews
0.056
74.6 ± 1.5
trec
69.0
79.9
82.2
trec
0.068
79.3 ± 1.2
dbpedia
88.0
92.4
93.5
dbpedia
0.042
90.9 ± 0.6
+
+Table 3: Performance of PromptPATE on Claude. We compare PromptPATE with three baselines: zero-shot (Lower Bound), the ensemble’s accuracy (Ens. Acc), and the non-private baseline (Upper Bound) on four classification benchmarks. We find that PromptPATE achieves strong privacy protection $\varepsilon < 0 . 1$ at $\delta = 1 0 ^ { - 6 }$ ) and utility close to the non-private and significantly higher than the zero-shot.
+
+# E Additional Setup
+
+# E.1 PromptDPSGD
+
+We train PromptDPSGD on NVIDIA A100 GPUs. We execute (hyper-)parameter search that takes into account learning rate (LR), max grad norm (GRAD), number of epochs (Epochs), the token length of prefix and prompt. In general, we find that the prompt and prefix token length of 10 is close to the optimal value in most cases. For the private (hyper-)parameters, in most cases we tune for $\varepsilon = 8$ and use similar (or even the same) parameters for other $\varepsilon$ values. We set the max grad norm to 0.1 in most cases and then adjust the number of epochs (the more the better, for example, 100), and the learning rate $[ 5 4 ] ^ { 5 }$ . The batch size is set by default to 1024.
+
+We show the specific parameters chosen for PromptDPSGD in Table 6.
+
+Table 4: Private classification with soft prompts and prefix for $\begin{array} { c c l } { \varepsilon } & { = } & { \{ 3 , \infty \} } \end{array}$ and the RoBERTaBASE model. We use the same setup and notation as in Table 1.
+
+
Dataset
M P
Soft-Prompt (Our)
Prefix (Our)
Full-Tuning [25]
LoRA-Tuning [54]
<10K
<100K
125M
1.2M
G
=3
m=8
m=3
m=8
ε=3
m=8
m=3
m=8
SST2
90.48
95.64
90.37
96.33
91.86
96.40
92.60
96.60
QNLI
83.62
89.48
86.05
94.84
87.42
94.70
86.97
94.70
QQP
80.29
86.56
80.89
91.42
85.56
92.20
85.12
92.20
MNLI
73.97
82.49
80.10
90.34
82.99
90.20
82.08
90.20
+
+
Dataset
M
Soft-Prompt (Our)
Prefix (Our)
Full-Tuning [25]
P
<10K
<100K
125M
SST2
91.05
93.58
90.94
QNLI
87.62
89.45
89.42
QQP
82.29
83.50
87.49
MNLI
76.05
86.71
86.28
+
+Table 5: Private classification with soft prompts and prefix for $\varepsilon = 8$ and the RoBERTaLARGE model. We use the same setup and notation as in Table 1.
+
+# E.2 PromptPATE
+
+# E.2.1 Hyperparameters for Confident-GNMax
+
+We present our hyperparameters for Confident-GNMax in Table 7.
+
+# E.2.2 Dataset Preprocessing
+
+sst2, trec, agnews, dbpedia and cb are taken from the repo of [58]. All other public datasets are downloaded from huggingface. To reduce the cost of quering APIs, we randomly sample 300 points from the test set to report the test accuracy. For imdb, we random select one sentence from each entry and also remove the ${ \tt { \ c b r / > } }$ tag. For qqp, we only take the column of "question $1 "$ in the public set.
+
+Table 6: Detailed parameters for soft prompts and prefix. Type is the type of training, BS represents the batch size, LR denotes the learning rate, $\varepsilon$ is the DP guarantee, P-Length is the token length of soft-prompt or prefix.
+
+
Dataset
Method
RoBERTa
BS
LR
m
GRAD
Epochs
P-Length Accuracy (%)
SST2
Prompt
Base
1024
0.005
8
N/A
60
100
93.23
SST2
Prompt
Base
900
0.05
8
0.01
21
9
92.32
SST2
Prompt
Base
1024
0.005
3
0.05
100
10
86.35
SST2
Prompt
Large
2048
0.005
8
4
100
10
91.05
SST2
Prefix
Base
32
0.01
8
N/A
60
20
94.61
SST2
Prefix
Base
1000
0.05
8
4
22
1
91.97
SST2
Prefix
Base
1024
0.01
3
0.2
100
50
90.37
SST2
Prefix
Large
2048
0.05
8
4
22
1
93.58
QNLI
Prompt
Base
1024
0.005
8
N/A
60
128
89.48
QNLI
Prompt
Base
1024
0.005
8
0.05
100
10
84.11
QNLI
Prompt
Base
1024
0.005
3
0.1
100
50
83.62
QNLI
Prompt
Large
2048
0.01
8
0.05
100
10
87.62
QNLI
Prefix
Base
1024
0.005
8
N/A
60
20
94.84
QNLI
Prefix
Base
1000
0.03
8
0.07
22
10
88.77
QNLI
Prefix
Base
1024
0.01
3
0.2
100
50
85.78
QNLI
Prefix
Large
2048
0.03
8
0.07
22
10
89.45
Prompt
Base
1024
0.005
8
N/A
60
50
86.64
Prompt
Base
1024
0.05
8
0.1
10
7
82.58
Prompt
Base
1024
0.001
3
0.01
100
15
80.29
Prompt
Large
2048
0.005
8
0.05
100
10
82.29
Prefix
Base
1024
0.005
8
N/A
60
20
91.42
Prefix
Base
1024
0.05
8
0.1
10
7
82.59
Prefix
Base
1024
0.05
3
1
15
2
80.89
QP
Prefix
Large
2048
0.05
8
0.1
10
7
83.50
MNLI
Prompt
Base
32
0.001
8
N/A
60
20
82.49
MNLI
Prompt
Base
1024
0.005
8
0.05
60
10
75.01
MNLI
Prompt
Base
1024
0.005
3
0.05
100
10
73.97
MNLI
Prompt
Large
2048
0.005
8
0.2
60
10
76.05
MNLI
Prefix
Base
32
0.001
8
N/A
60
20
82.49
MNLI
Prefix
Base
1024
0.005
8
0.05
60
50
80.42
MNLI
Prefix
Base
1024
0.005
3
0.2
100
50
80.10
MNLI
Prefix
Large
2048
0.01
8
0.1
100
10
86.71
+
+
LLM
Dataset
T
01
02
GPT3
sst2
180
1
20
GPT3
agnews
180
5
20
GPT3
trec
180
1
20
GPT3
dbpedia
170
1
20
Claude
sst2
390
1
50
Claude
agnews
360
1
50
Claude
trec
320
1
50
Claude
dbpedia
320
5
50
+
+Table 7: Detailed parameters for Confident-GNMax.
+
+
+Figure 6: MIA against the public prompts of PromptPATE. We depict the AUC-ROC curve of MIA against the public prompts of PromptPATE. The member data is the examples from the prompts of all private teachers, and the non-members are randomly-selected data from the training set. Each blue curve corresponds to a different public prompt selected in one random trail. All curves are very close to the red dash line (random guess), which show that our PromptPATE is effective against MIA.
\ No newline at end of file
diff --git a/md/dev/uCXNOeL0TG/uCXNOeL0TG.md b/md/dev/uCXNOeL0TG/uCXNOeL0TG.md
new file mode 100644
index 0000000000000000000000000000000000000000..de20e04eb0ef44326eb706191dbfcf8865303e5e
--- /dev/null
+++ b/md/dev/uCXNOeL0TG/uCXNOeL0TG.md
@@ -0,0 +1,444 @@
+# Fairness for Workers Who Pull the Arms: An Index Based Policy for Allocation of Restless Bandit Tasks
+
+Anonymous Author(s)
+Affiliation
+Address
+email
+
+# Abstract
+
+1 Motivated by applications such as machine repair, project monitoring, and anti
+2 poaching patrol scheduling, we study intervention planning of stochastic processes
+3 under resource constraints. This planning problem has previously been modeled as
+4 restless multi-armed bandits (RMAB), where each arm is an intervention-dependent
+5 Markov Decision Process. However, the existing literature assumes all intervention
+6 resources belong to a single uniform pool, limiting their applicability to real-world
+7 settings where interventions are carried out by a set of workers, each with their own
+8 costs, budgets, and intervention effects. In this work, we consider a novel RMAB
+9 setting, called multi-worker restless bandits (MWRMAB) with heterogeneous
+10 workers. The goal is to plan an intervention schedule that maximizes the expected
+11 reward while satisfying budget constraints on each worker as well as fairness in
+12 terms of the load assigned to each worker. Our contributions are two-fold: (1) we
+13 provide a multi-worker extension of the Whittle index to tackle heterogeneous
+14 costs and per-worker budget and (2) we develop an index-based scheduling policy
+15 to achieve fairness. Further, we evaluate our method on various cost structures and
+16 show that our method significantly outperforms other baselines in terms of fairness
+17 without sacrificing much in reward accumulated.
+
+# 18 1 Introduction
+
+19 Restless multi-armed bandits (RMABs) Whittle [1988] have been used for sequential planning, where
+20 a planner allocates a limited set of $M$ intervention resources across $N$ independent heterogeneous
+21 arms (Markov Decision processes) at each time step in order to maximize the long-term expected
+22 reward. The term restless denotes that the arms undergo state-transitions even when they are not
+23 acted upon (with a different probability than when they are acted upon). RMABs have been receiving
+24 increasing attention across a wide range of applications such as maintenance [Abbou and Makis,
+25 2019], recommendation systems Meshram et al. [2015], anti-poaching patrolling [Qian et al., 2016b],
+26 and adherence monitoring [Akbarzadeh and Mahajan, 2019; Mate et al., 2020]. Although, rangers
+27 in anti-poaching, healthcare workers in health intervention planning, and supervisors in machine
+28 maintenance are all commonly cited examples of human workforce used as intervention resources, the
+29 literature has so far ignored one key reality that the human workforce is heterogeneous—each worker
+30 has their own workload constraints and needs to commit a dedicated time duration for intervening on
+31 an arm. Thus, it is critical to restrict intervention workload for each worker and balance the workload
+32 across them, while also ensuring high effectiveness (reward) of the planning policy.
+33 RMAB literature does not consider this heterogeneity and mostly focuses on selecting best arms
+34 assuming that all intervention resources (workers) are interchangeable, i.e., as from a single pool
+35 (homogeneous). However, planning with human workforce requires more expressiveness in the
+36 model, including heterogeneity in costs and intervention effects, worker-specific load constraints, and
+37 balanced work allocation. One concrete example is anti-poaching intervention planning Qian et al.
+38 $\pm \pm { \sqrt { 2 0 1 6 \mathrm { a } } } ]$ with $N$ areas in a national park where timely interventions (patrols) are required to detect as
+39 many snares as possible across all the areas. These interventions are carried out by a small set of $M$
+40 ranger. The problem of selecting a subset of areas at each time step (say, daily) has been modeled as
+41 an RMAB problem. However, each ranger may incur heterogeneous cost (e.g., distance travelled,
+42 when assigned to intervene on a particular area) and the total cost incurred by any ranger (e.g., total
+43 distance traveled) must not exceed a given budget. Additionally, it is important to ensure that tasks
+44 are allocated fairly across rangers so that, for e.g., some rangers are not required to walk far greater
+45 distances than others. Adding this level of expressiveness to existing RMAB models is non-trivial.
+46 To address this, we introduce the multi-worker restless multi-armed bandits (MWRMAB) problem.
+47 Since MWRMABs are more general than the classical RMABs, they are at least PSPACE hard to
+48 solve optimally [Papadimitriou and Tsitsiklis, 1994]. RMABs with $k$ -state arms require solving a
+49 combined MDP with $\overline { { k ^ { N } } }$ states and $| M + 1 | ^ { N }$ actions constrained by a budget, and thus suffers from
+50 the curse of dimensionality. A typical approach is to compute Whittle indices [Whittle, 1988] for
+51 each arm and choose $M$ arms with highest index values—an asymptotically optimal solution under
+52 the technical condition indexability [Weber and Weiss, 1990]. However, this approach is limited to
+53 instances a single type of intervention resource incurring one unit cost upon intervention. A few papers
+54 on RMABs [Glazebrook et al., 2011; Meshram and Kaza, $\boxed { 2 0 2 0 }$ study multiple interventions and
+55 non-unitary costs but assumes one global budget (instead of per-worker budget). Existing solutions
+56 aim at maximizing reward by selecting arms with highest index values that may not guarantee fairness
+57 towards the workers who are in charge of providing interventions.
+58 To the best of our knowledge, we are the first to introduce and formalize the multi-worker restless
+59 multi-armed bandit (MWRMAB) problem and a related worker-centric fairness constraint. We
+60 develop a novel framework for solving the MWRMAB problem. Further, we empirically evaluate our
+61 algorithm to show that it is fair and scalable across a range of experimental settings.
+
+# 62 2 Related Work
+
+63 Multi-Action RMABs and Weakly Coupled MDPs Glazebrook et al. [2011] develop closed-form
+64 solutions for multi-action RMABs using Lagrangian relaxation. Meshram and Kaza [2020] build
+65 simulation-based policies that rely on monte-carlo estimation of state-action values. However,
+66 critically, these approaches rely on actions being constrained by a single budget, failing to capture the
+67 heterogeneity of workforce. On the other hand, weakly coupled MDPs (WCMDPs) Hawkins [2003]
+68 allow for such multiple budget constraints; this is the baseline we compare against. Other theoretical
+69 works Adelman and Mersereau $\mathbb { \underline { { \left. 2 0 0 8 \right. } } }$ ; Gocgun and Ghate $\mathbb { \underline { { \left. 2 0 1 2 \right. } } }$ have developed solutions in terms
+70 of the reward accumulated, but may not scale well with increasing problem size. These papers do not
+71 consider fairness, a crucial component of MWRMABs, which our algorithm addresses.
+72 Fairness in stochastic and contextual multi-armed bandits (MABs) [Patil et al., 2020; Joseph et al.,
+73 2016; Chen et al., 2020] has been receiving significant attention. However, fairness in RMABs has
+74 been less explored. Recent work by Herlihy et al. [2021] considered quota-based fairness of RMAB
+75 arms assuming that arms correspond to human beneficiaries (for example, patients). However, in our
+76 work, we consider an orthogonal problem of satisfying the fairness among intervention resources
+77 (workers) instead of arms (tasks).
+78 Fair allocation of discrete items among a set of agents has been a well studied topic [Brandt et al.,
+79 2016]. Fairness notions such as envy-freeness up to one item [Budish, 2011] and their budgeted
+80 settings [Wu et al., 2021; Biswas and Barman, 2018] align with the fairness notion we consider.
+81 However, these papers do not consider non-stationary (MDP) items. Moreover, these papers assume
+82 that each agent has a value for every item; both fairness and efficiency are defined with respect to this
+83 valuation. In contrast, in MWRMAB, efficiency is defined based on reward accumulated and fairness
+84 and budget feasibility are defined based on the cost incurred.
+
+# 85 3 The Model
+
+86 There are $M$ workers for providing interventions on $N$ independent arms that follow Markov Decision
+87 Processes (MDPs). Each MDP $i \in [ N ]$ is a tuple $\langle S _ { i } , A _ { i } , C _ { i } , P _ { i } , R _ { i } \rangle$ , where $S _ { i }$ is a finite set of states.
+88 We represent each worker as an action, along with an additional action called no-intervention. Thus,
+
+action set is 89 $A _ { i } \subseteq [ M ] \cup \{ 0 \}$ . $C _ { i }$ is a vector of costs $c _ { i j }$ incurred when an action $j \in [ A _ { i } ]$ is taken on an arm 90 $i \in [ N ]$ , and $c _ { i j } = 0$ when $j = 0$ . $P _ { i j } ^ { s s ^ { \prime } }$ is the probability of transitioning from state $s$ to state 91 $s ^ { \prime }$ when arm $i$ is allocated to worker $j$ . $R _ { i } ( s )$ is the reward obtained in state $s \in S _ { i }$ .
+
+92 The goal $( \mathrm { E q . } \bigcirc \bigcirc )$ is to allocate a subset of arms to each worker such that the expected reward is
+93 maximized while ensuring that each worker incurs a cost of at most a fixed value $B$ . Additionally,
+94 the disparity in the costs incurred between any pair of workers does not exceed a fairness threshold $\epsilon$
+95 at a given time step. Let us denote a policy $\pi : \times _ { i } S _ { i } \mapsto \times _ { i } A _ { i }$ that maps the current state profile of
+96 arms to an action profile. $x _ { i j } ^ { \pi } ( s ) \in \{ 0 , 1 \}$ indicates whether worker $j$ intervenes on arm $i$ at state $s$
+97 under policy $\pi$ . The total cost incurred by $j$ at a time step $t$ is given by $\begin{array} { r } { \overline { { C } } _ { j } ^ { \pi } ( t ) : = \sum _ { i \in N } c _ { i j } x _ { i j } ^ { \pi } ( s _ { i } ( t ) ) } \end{array}$
+98 where $s _ { i } ( t )$ is the current state. $\epsilon \geq c ^ { m } : = \operatorname* { m a x } _ { i j } c _ { i j }$ ensures feasibility of the fairness constraints.
+
+$$
+\begin{array} { l } { \displaystyle \operatorname* { m a x } _ { \pi } \displaystyle \operatorname* { l i m s u p } _ { T \infty } \frac { 1 } { T } \sum _ { i \in [ N ] } \mathbb { E } [ \sum _ { t = 1 } ^ { T } R _ { i } ( s _ { i } ( t ) ) x _ { i j } ^ { \pi } ( s _ { i } ( t ) ) ] } \\ { \mathrm { s . t . } \displaystyle \sum _ { i \in N } x _ { i j } ^ { \pi } ( s _ { i } ( t ) ) c _ { i j } \leq B , \quad \quad \forall j \in [ M ] , \forall t \in \{ 1 , 2 , \ldots \} } \\ { \displaystyle \sum _ { j \in A _ { i } } x _ { i j } ^ { \pi } ( s _ { i } ( t ) ) = 1 , \quad \quad \forall i \in [ N ] , \forall t \in \{ 1 , 2 , \ldots \} } \\ { \displaystyle \operatorname* { m a x } _ { j } \overline { { C } } _ { j } ^ { \pi } ( t ) - \operatorname* { m i n } \overline { { C } } _ { j } ^ { \pi } ( t ) \leq \epsilon , \quad \forall t \in \{ 1 , 2 , \ldots \} } \\ { \displaystyle x _ { i j } ^ { \pi } ( s _ { i } ( t ) ) \in \{ 0 , 1 \} , \quad \quad \forall i , \forall j , \forall t . } \end{array}
+$$
+
+99 When $M = 1$ and $c _ { i 1 } = 1$ , Problem $\mathbb { \underline { { ( 1 ) } } }$ becomes classical RMAB problem (with two actions,
+100 active and passive) that can be solved via Whittle Index method [Whittle, 1988] by considering a
+101 time-averaged relaxed version of the budget constraint and then decomposing the problem into $N$
+102 subproblems—each subproblem finds a charge $\lambda _ { i } ( s )$ on active action that makes passive action as
+103 valuable as the active action at state $s$ . It then selects top $B$ arms according to $\lambda _ { i }$ values at their
+104 current states. However, the challenges involved in solving a general MWRMAB (Eq. 1) are (i) index
+105 computation becomes non-trivial with $M > 1$ workers and (ii) selecting top arms based on indices
+106 may not satisfy fairness. To tackle these challenges, we propose a framework in the next section.
+
+# 107 4 Methodology
+
+108 Step 1: Decompose the combinatorial MWRMAB problem to $N \times M$ subproblems, and compute
+109 Whittle indices ${ \lambda } _ { i j } ^ { \star }$ for each subproblem. We tackle this in Sec. 4.1.This step assumes that, for each
+110 arm $i$ , MDPs corresponding to any pair of workers are mutually independent. However, the expected
+111 value of each arm may depend on interventions taken by multiple workers at different timesteps.
+
+Step 2: Adjust the decoupled indices ${ \lambda } _ { i j } ^ { * }$ to create $\lambda _ { i j } ^ { a d j , * }$ , detailed in Sec. 4.2.
+
+Step 3: The adjusted indices are used for allocating the arms to workers while ensuring fairness and per-timestep budget feasibility among workers, detailed in Sec. 4.3.
+
+# 15 4.1 Identifying subproblem structure
+
+116 To arrive at a solution strategy, we relax the per-timestep budget constraints of Eq. $\perp$ to time
+117 averaged constraints, as follows: $\begin{array} { r } { \frac { 1 } { T } \sum _ { i \in [ N ] } \mathbb { E } \sum _ { t = 1 } ^ { \hat { T } } x _ { i j } ^ { \pi } \big ( s _ { i } ( t ) \big ) c _ { i j } \leq B , \forall j \in [ M ] . } \end{array}$ The optimization
+118 problem $\mathbb { D }$ can be rewritten as:
+
+$$
+\begin{array} { r l } { \displaystyle \underset { \{ \lambda _ { j } \geq 0 \} } { \operatorname* { m i n } } \underset { \pi } { \operatorname* { m a x } } } & { \displaystyle \operatorname* { l i m } _ { T \to \infty } \frac { 1 } { T } \underset { i \in [ N ] } { \sum } \mathbb { E } \left[ \underset { t = 1 } { \overset { T } { \sum } } \left( R _ { i } ( s _ { i } ( t ) ) x _ { i j } ^ { \pi } ( s _ { i } ( t ) ) + \underset { j \in [ M ] } { \sum } \lambda _ { j } ( B - c _ { i j } x _ { i j } ^ { \pi } ( s _ { i } ( t ) ) \right) \right] } \\ & { \mathrm { s . t . } \displaystyle \sum _ { j \in A _ { i } } x _ { i j } ^ { \pi } ( s _ { i } ( t ) ) = 1 , } \\ & { \displaystyle \underset { j } { \operatorname* { m a x } } \widetilde { C } _ { j } ^ { \pi } ( t ) - \underset { j } { \operatorname* { m i n } } \overline { { C } } _ { j } ^ { \pi } ( t ) \leq \epsilon , } \\ & { \displaystyle x _ { i j } ^ { \pi } ( s _ { i } ( t ) ) \in \{ 0 , 1 \} , \forall i , \forall t } \end{array}
+$$
+
+119 Here, $\lambda _ { j } \mathbf { s }$ are Lagrangian multipliers corresponding to each relaxed budget constraint $j \in [ M ]$ .
+120 Furthermore, as mentioned in $\boxed { \mathrm { G l a z e b r o o k } \ e t a \dot { l } . } \boxed { 2 0 1 1 }$ , if an arm $i$ is indexable, then the optimization
+121 objective $( 2 )$ can be decomposed into $N$ independent subproblems, and separate index functions can
+122 be defined for each arm $i$ . Leveraging this, we decompose our problem to $N \times M$ subproblems, each
+123 finding the minimum $\lambda _ { i j }$ that maximizes the following:
+
+$$
+\operatorname* { l i m } _ { T \to \infty } \frac { 1 } { T } \mathbb { E } \biggl [ \sum _ { t = 1 } ^ { T } \left( R _ { i } ( s _ { i } ( t ) ) - \lambda _ { i j } c _ { i j } \right) x _ { i j } ^ { \pi } ( s _ { i } ( t ) ) \biggr ]
+$$
+
+124 Note that, the maximization subproblem $\underline { { \mathbb { ( 3 ) } } }$ does not have the term $\lambda _ { i j } B$ since the term does not
+125 depend on the decision $x _ { i j } ^ { \pi } ( s _ { i } ( t ) )$ . Considering a 2-action MDP with action space $\mathcal { A } _ { i j } = \{ 0 , j \}$ for
+126 an arm-worker pair, the maximization problem $\textcircled { 3 }$ can be solved by dynamic programming methods
+127 using Bellman’s equations for each state to decide whether to take an active action $( x _ { i j } ( s ) = 1 )$ when
+128 the arm is currently at state $s$ :
+
+$$
+V _ { i , j } ^ { t } ( s , \lambda _ { i j } , x _ { i j } ( t ) ) = \left\{ \begin{array} { l l } { { R _ { i } ( s ) - \lambda _ { i j } c _ { i j } \displaystyle + \sum _ { s ^ { \prime } \in S _ { i } } P _ { s s ^ { \prime } } ^ { i j } V _ { i , j } ^ { t + 1 } ( s ^ { \prime } , \lambda _ { i j } ) \mathrm { , ~ i f ~ } x _ { i j } ( t ) = 1 } } \\ { { \displaystyle R _ { i } ( s ) + \sum _ { s ^ { \prime } \in S _ { i } } P _ { s s ^ { \prime } } ^ { i 0 } V _ { i , j } ^ { t + 1 } ( s ^ { \prime } , \lambda _ { i j } ) \mathrm { , ~ i f ~ } x _ { i j } ( t ) = 0 } } \end{array} \right.
+$$
+
+129
+
+$$
+\lambda _ { i j } ^ { \star } ( s ) = \arg \operatorname* { m i n } \{ \lambda : V _ { i , j } ^ { t } ( s , \lambda , j ) = = V _ { i , j } ^ { t } ( s , \lambda , 0 ) \}
+$$
+
+We compute the Whittle indices 130 ${ \lambda } _ { i j } ^ { \star }$ (Eq. 5) [Qian et al., 2016b] (the algorithm is in Appendix $\mathbf { A } )$
+
+131 Additionally, we establish that the Whittle indices of multiple workers are related when the costs
+132 and transition probabilities possess certain characteristics, enabling simplification of Whittle Index
+133 computation for multiple workers when there are certain structures in the MWRMAB problem.
+
+Theorem 1. For an arm 34 $i$ , and a pair of workers $j$ and $j ^ { \prime }$ such that $c _ { i j } \neq c _ { i j ^ { \prime } }$ and $P _ { s s ^ { \prime } } ^ { i j } = P _ { s s ^ { \prime } } ^ { i j ^ { \prime } }$ P ij0ss0 for every 35 $s , s ^ { \prime } \in S _ { i }$ , then their Whittle Indices are inversely proportional to their costs.
+
+$$
+\frac { { \lambda } _ { i j } ^ { \star } ( s ) } { { \lambda } _ { i j ^ { \prime } } ^ { \star } ( s ) } = \frac { c _ { i j ^ { \prime } } } { c _ { i j } } f o r e a c h s t a t e s \in \mathcal { S } _ { i }
+$$
+
+136 Proof. Let us consider an arm $i$ and a pair of workers $j$ and $j ^ { \prime }$ such that $P _ { s s ^ { \prime } } ^ { i j } = P _ { s s ^ { \prime } } ^ { i j ^ { \prime } }$ . By definition
+137 of Whittle Index $\lambda _ { j } ( s )$ for a worker $j$ , it is the minimum value at a state $s$ such that,
+
+$$
+V _ { i j } ( s , \lambda _ { j } ( s ) , j ) - V _ { i j } ( s , \lambda _ { j } ( s ) , 0 ) = 0
+$$
+
+138 Eq. $\boxed { 6 }$ can be rewritten by expanding the value functions as:
+
+$$
+\begin{array} { r l } & { R _ { i } ( s ) - \lambda _ { j } ( s ) c _ { i j } + \displaystyle \sum _ { s ^ { \prime } \in S _ { i } } P _ { s s ^ { \prime } } ^ { i j } V _ { i } ( s ^ { \prime } , \lambda _ { j } ( s ) ) - R _ { i } ( s ) + \displaystyle \sum _ { s ^ { \prime } \in S _ { i } } P _ { s s ^ { \prime } } ^ { i 0 } V _ { i } ( s ^ { \prime } , \lambda _ { j } ( s ) ) = 0 } \\ { \Longrightarrow \quad } & { - \lambda _ { j } ( s ) c _ { i j } + \displaystyle \sum _ { s ^ { \prime } \in S _ { i } } P _ { s s ^ { \prime } } ^ { i j } V _ { i } ( s ^ { \prime } , \lambda _ { j } ( s ) ) - \displaystyle \sum _ { s ^ { \prime } \in S _ { i } } P _ { s s ^ { \prime } } ^ { i 0 } V _ { i } ( s ^ { \prime } , \lambda _ { j } ( s ) ) = 0 } \\ { , V _ { i } ( s ^ { \prime } , \lambda _ { j } ( s ^ { \prime } ) ) = \displaystyle \operatorname* { m a x } _ { a = \{ 0 , j \} } R _ { i } ( s ) - a \lambda _ { j } ( s ) c _ { i j } + \mathbb { E } _ { s ^ { \prime \prime } } [ V _ { i } ( s ^ { \prime \prime } , \lambda ( s ) ) ] . } \end{array}
+$$
+
+Next, we substitute all 140 $\lambda _ { j } ( s )$ terms by $\frac { x } { c _ { i j } }$ . After substitution, Eq. $^ { 7 }$ is a function of $x$ only, i.e., no 141 $\lambda ( s )$ or $c _ { i j }$ terms remain after substitution. We can rewrite Eq. 7 as:
+
+$$
+- x + \sum _ { s ^ { \prime } \in S _ { i } } P _ { s s ^ { \prime } } ^ { i j } V _ { i } ( s ^ { \prime } , x ) - \sum _ { s ^ { \prime } \in S _ { i } } P _ { s s ^ { \prime } } ^ { i 0 } V _ { i } ( s ^ { \prime } , x ) = 0
+$$
+
+142 Note that $x ^ { * }$ that minimizes Eq. $8$ corresponds to $\lambda _ { j } ( s ) c _ { i j }$ for any $j$ , where $\lambda _ { j } ( s )$ is the Whittle index 143 for worker $j$ . Therefore, for any two workers $j$ and $j ^ { \prime }$ with corresponding Whittle Indices as $\lambda _ { j } ( s )$ and 144 $\lambda _ { j ^ { \prime } } ( s )$ , we obtain $\lambda _ { j } ( s ) c _ { i j } = \lambda _ { j ^ { \prime } } ( s ) c _ { i j ^ { \prime } }$ whenever $P _ { s s ^ { \prime } } ^ { i j } = P _ { s s ^ { \prime } } ^ { i j ^ { \prime } }$ . This completes the proof.
+
+45 Theorem $\mathbb { L }$ also implies that, when the costs and effectiveness of two workers are equal, then their
+46 Whittle indices are also equal, stated formally in Corollary 1.
+147 Corollary 1. For an arm $i$ , and a pair of workers $j$ and $j ^ { \prime }$ such that $c _ { i j } = c _ { i j { ' } }$ and $P _ { s s ^ { \prime } } ^ { i j } = P _ { s s ^ { \prime } } ^ { i j ^ { \prime } }$ P ij0ss0 for
+148 every $s , s ^ { \prime } \in S _ { i }$ , then their Whittle Indices are the same.
+
+The indices obtained using Alg. $\begin{array} { l } { 3 } \\ { . } \end{array}$ are not indicative of the true long-term value of taking that action in the MWRMAB problem. This is because, for a given arm, the value of an intervention by worker $j$ in general depends on interventions by other workers $j ^ { \prime }$ at different timesteps.
+
+53 Consider a 2-worker MWRMAB corresponding to an anti-poaching patrol planning problem, where
+154 each worker is a type of “specialist” with different equipment (detailed in Fig. 1).
+
+The first ranger (worker), $a _ { 1 }$ , has special equipment for clearing overgrown brush, and the second ranger, $a _ { 2 }$ , has specialized equipment for detecting snares, e.g., a metal detector. Assume 3 states for each patrol area $i$ as “overgrown and snared” $( s = 0$ ), “clear and snared” $( s = 1 )$ ), and “clear and not snared” $s = 2 ,$ ). Assume that reward is received only for arms in state $s = 2$ , and that snares cannot be cleared from areas with overgrown brush, i.e., $P _ { i j } ^ { 0 2 } = 0 \forall j \in$ $[ M ]$ . If we assume that each worker is a “true” specialist— so, ranger 1’s equipment is ineffective at detecting snares, i.e., $\mathbf { \dot { P } } _ { i 1 } ^ { 1 2 } = 0$ , and ranger 2’s equipment is ineffective at clearing overgrown brush, i.e., $P _ { i 2 } ^ { 0 1 } = 0$ — then the opti
+
+
+Figure 1: Specialist domain: where specific actions are required in each state to advance to the rewardgiving state. Decoupled indices lead to sub-optimal policies, whereas adjusted indices perform well.
+
+170 mal policy is for ranger 1 to act on the arm in state “overgrown and snared” and ranger 2 to act on the
+171 arm in state “clear and snared”. However, the fully decoupled index computation for each ranger $j$
+172 would reason about restricted MDPs that only have passive action and ranger type $j$ available. So
+173 when computing, e.g., the index for ranger 1 in $s = 0$ , the restricted MDP would have 0 probability
+174 of reaching state “clear and not snared”, since it does not include ranger 2 in its restricted MDP. This
+175 would correspond to an MDP that always gives 0 reward, and thus would artificially force the index
+176 for ranger 1 to be 0, despite ranger 1 being the optimal action for $s = 0$ .
+177 To address this, we define a new index notion that accounts for such inter-action effects. The key idea
+178 is that, when computing the index for a given worker, we will consider actions of all other workers
+179 in future time steps. So in our poaching example, the new index value for ranger 1 in $s = 0$ will
+180 increase compared to its decoupled index value, because the new index will take into account the
+181 value of ranger 2’s actions when the system progresses to $s = 1$ in the future. Note that the methods
+182 we build generalize to any number of workers $M$ . However, the manner in which we incorporate the
+183 actions of other workers must be done carefully, We propose an approach and provide theoretical
+184 results explaining why. Finally, we give the full algorithm for computing the new indices.
+185 New index notion: For a given arm, to account for the inter-worker action effects, we define the
+186 new index for an action $j$ as the minimum charge that makes an intervention by $j$ on that arm
+187 as valuable as any other worker $j ^ { \prime }$ in the combined MDP, with $M + 1$ actions. That is, we seek
+188 the minimum charge for action $j$ that makes us indifferent between taking action $j$ and not taking
+189 action $j$ , a multi-worker extension Whittle’s index notion. To capture this, we define an augmented
+190 reward function $R _ { \lambda } ^ { \dagger } ( s , j ) = R ( s ) - \lambda _ { j } c _ { j }$ . Let $\lambda$ is the vector of $\{ \lambda _ { j } \} _ { j \in [ M ] }$ charges. We define this
+191 expanded MDP as $\mathcal { M } _ { \lambda } ^ { \dagger }$ and the corresponding value function as $V _ { \lambda } ^ { \dagger }$ . We now find adjusted index
+192 $\lambda _ { j , \lambda _ { - j } } ^ { a d j , \ast }$ using the following expression:
+
+$$
+\operatorname* { m i n } _ { j ^ { \prime } \in [ M ] \setminus \{ j \} } \arg \operatorname* { m i n } _ { \lambda _ { j } } \{ \lambda _ { j } \colon V _ { \lambda _ { - j } } ^ { \dagger } ( s , \lambda _ { j } , j ) = V _ { \lambda _ { - j } } ^ { \dagger } ( s , \lambda _ { j } , j ^ { \prime } ) \}
+$$
+
+193 where $\lambda _ { - j }$ is a vector of fixed charges for all $j ^ { \prime } \ne j$ , and the outer min over $j ^ { \prime }$ simply captures the
+194 specific action $j ^ { \prime }$ that the optimal planner is indifferent to taking over action $j$ at the new index value.
+195 Note, this is the natural extension of the decoupled two-action index definition, Eq. $( 5 )$ , which defines
+196 the index as the charge on $j$ that makes the planner indifferent between acting and, the only other
+197 option, being passive. Our new adjusted index algorithm is given in Alg. 1.
+198 We use a binary search procedure to compute the adjusted indices since $V _ { \lambda _ { - j } } ^ { \dagger } ( s , \lambda _ { j } , j )$ is convex in
+199 $\lambda _ { j }$ . The most important consideration of the adjusted index computation is how to set the charges
+200 $\lambda _ { j ^ { \prime } }$ of the other action types $j ^ { \prime }$ when computing the index for action $j$ . We show that a reasonable
+
+# Algorithm 1 Adjusted Index Computation
+
+Input: An arm: MDP $\mathcal { M } ^ { \dagger }$ , costs $c _ { j }$ , state $s$ , and indices $\lambda _ { j } ^ { * } ( s )$
+
+1: for $j = 1$ to $M$ do
+2: $\lambda _ { j } = \lambda _ { j } ^ { * } ( s ) \left\{ { \mathrm { i n i t } } \lambda \right\} .$ }
+3: for 4: $j = 1$ to te $M$ {via binary search on Eq. 9}
+$\lambda _ { j , \lambda _ { - j } } ^ { a d j , * } ( s )$
+5: return $\lambda _ { j , \lambda _ { - j } } ^ { a d j , * } ( s )$ for all workers $j \in [ M ]$
+
+choice for $\lambda _ { j ^ { \prime } }$ is the Whittle Indices $\lambda _ { j ^ { \prime } } ^ { * } ( s )$ which were pre-computed using Alg. $\bigstar$ The intuition is that $\lambda _ { j ^ { \prime } } ^ { * } ( s )$ provides a lower bound on how valuable the given action $j ^ { \prime }$ is, since it was computed against no-action in the restricted two-action MDP. In Observation $\bigstar$ and Theorem $\bigtriangledown$ we describe the problem’s structure to motivate these choices.
+
+The following observation explicitly connects decoupled indices and adjusted indices.
+
+holds: Observation 1. For each worker $\lambda _ { j , \lambda _ { - j } } ^ { a d j , * } \to \lambda _ { j } ^ { * }$ . $j$ , when $\lambda _ { - j } \to \infty$ , i.e., $\lambda _ { j ^ { \prime } } \infty \ \forall j ^ { \prime } \neq j$ , then the following
+
+This can be seen by considering the rewards $R _ { \lambda } ^ { \dagger } ( s , j ^ { \prime } ) = R ( s ) - \lambda _ { j ^ { \prime } } c _ { j ^ { \prime } }$ for taking action $j ^ { \prime }$ in any state $s$ . As the charge $\lambda _ { j ^ { \prime } } \to \infty$ , $R _ { \lambda } ^ { \dagger } ( s , j ^ { \prime } ) \ - \infty$ , making it undesirable to take action $j ^ { \prime }$ in the optimal policy. Thus, the optimal policy would only consider actions $\{ 0 , j \}$ , which reduces to the restricted MDP of the decoupled index computation.
+
+Next we analyze a potential naive choice for $\lambda _ { - j }$ when computing the indices for each $j$ , namely, $\lambda _ { - j } = 0$ . Though it may seem a natural heuristic, this corresponds to planning without considering the costs of other actions, which we show below can lead to arbitrarily low values of the indices, which subsequently can lead to poorly performing policies.
+
+Theorem 2. As $\lambda _ { j ^ { \prime } } 0 \forall j ^ { \prime } \neq j$ , $\lambda _ { j } ^ { a d j , * }$ will monotonically decrease, $i f ( l ) \ V _ { \lambda _ { j ^ { \prime } } } ^ { \dagger } ( s , \lambda _ { j } , j ^ { \prime } ) \ \geq$ $V _ { \lambda _ { j ^ { \prime } } } ^ { \dagger } ( s , \lambda _ { j } , 0 )$ for $O \le \lambda _ { j ^ { \prime } } \le \epsilon$ and (2) if the average cost of worker $j ^ { \prime }$ under the optimal policy starting with action $j ^ { \prime }$ is greater than the average cost of worker $j ^ { \prime }$ under the optimal policy starting with action $j$ .
+
+Thm. $2$ (proof in Appendix $\boxed { \mathbf { B } }$ confirms that, although setting $\lambda _ { j ^ { \prime } } = 0$ for all $j ^ { \prime }$ may seem like a natural option, in many cases it will artificially reduce the index value for action $j$ . This is because $\lambda _ { j ^ { \prime } } = 0$ corresponds to planning as if action $j ^ { \prime }$ comes with no charge. Naturally then, as we try to determine the non-zero charge $\lambda _ { j }$ we are willing to pay for action $j$ , i.e., the index of action $j$ , we will be less willing to pay higher charges, since there are free actions $j ^ { \prime }$ . Note that conditions (1) and (2) of the above proof are not restrictive. The first is a common epsilon-neighborhood condition, which requires that value functions do not change in arbitrarily non-smooth ways with $\lambda$ values near 0. The second requires that a policy’s accumulated costs of action $j ^ { \prime }$ are greater when starting with action $j ^ { \prime }$ , than starting from any other action— this is same as assuming that the MDPs do not have arbitrarily long mixing times. That is to say that Thm. $2$ applies to a wide range of problems that we care about.
+
+The key question then is: what are reasonable values of charges for other actions $\lambda _ { - j }$ , when computing the index for action $j ^ { \check { \mathbf { \ell } } }$ ? We propose that a good choice is to set each $\lambda _ { j ^ { \prime } } \in \lambda _ { - j }$ to its corresponding decoupled index value for the current state, i.e., $\lambda _ { j ^ { \prime } } ^ { * } ( s )$ . The reason relies on the following key idea: we know that at charge $\lambda _ { j ^ { \prime } } ^ { * } ( s )$ , the optimal policy is indifferent between choosing that action $j ^ { \prime }$ and the passive action, at least when $j ^ { \prime }$ is the only action available. Now, assume we are computing the new adjusted index for action $j$ , when combined in planning with the aforementioned action $j ^ { \prime }$ at charge $\lambda _ { j ^ { \prime } } ^ { * } ( s )$ . Since the charge for $j ^ { \prime }$ is already set at a level that makes the planner indifferent between $j ^ { \prime }$ and being passive, if adding $j ^ { \prime }$ to the planning space with $j$ does not provide any additional benefit over the passive action, then the new adjusted index for $j$ will be the same as the decoupled index for $j$ , which only planned with $j$ and the passive action. This avoids the undesirable effect of getting artificially reduced indices due to under-charging for other actions $j ^ { \prime }$ , i.e., Thm. $2 .$ The ideas follow similarly for whether the adjusted index for $j$ should increase or decrease relative to its decoupled index value. I.e., if higher reward can be achieved when planning with $j$ and $j ^ { \prime }$ together compared to planning with either action alone, as in the specialist anti-poaching example
+
+244 then we will become more willing to pay a charge $\lambda _ { j }$ now to help reach states where the action $j ^ { \prime }$ will
+245 let us achieve that higher reward. On the other hand, if $j ^ { \prime }$ dominates $j$ in terms of intervention effect,
+246 then even at a reasonable charge for $j ^ { \prime }$ , we will be less willing to pay for action $j$ when both options
+247 are available, and so the adjusted index will decrease. We give our new adjusted index algorithm in
+248 Alg. 1, and provide experimental results demonstrating its effectiveness.
+
+# 4.3 Allocation Algorithm
+
+We provide a method called Balanced Allocation $( \operatorname { A l g } . 2 )$ to tackle the problem of allocating intervention tasks to each worker in a balanced way. At each time step, given the current states of all the arms $\{ s _ { i } ^ { t } \} _ { i \in [ N ] }$ , Alg. $2$ creates an ordered list $\sigma$ among workers based on their highest Whittle Indices $\operatorname* { m a x } _ { i } \lambda _ { i j } ( s _ { i } ^ { t } )$ . It then allocates the best possible (in terms of Whittle Indices) available arm to each worker according to the order $\sigma$ in a round-robin way (allocate one arm to a worker and move on to the next worker until the stopping criterion is met). Note that this satisfies the constraint that the same arm cannot be allocated to more than one worker. In situations where the best possible available arm leads to the budget violation $B$ , an attempt is made to allocate the next best. This process is repeated until there are no more arms left to be allocated. If no available arms could be allocated to a worker $j$ because of budget violation, then worker $j$ is removed from the future round-robin allocations and are allocated all the arms in their bundle $D _ { j }$ . Thus, the budget constraints are always satisfied. Moreover, in the simple setting, when costs and transition probabilities of all workers are equal, this heuristic obtain optimal reward and perfect fairness.
+
+# Algorithm 2 Balanced Allocation
+
+Input: Current states of each arm $\{ s _ { i } \} _ { i \in [ N ] }$ , index values for each arm-worker $( i , j )$ pair $\lambda _ { i j } ( s _ { i } )$ , costs $\overline { { \{ c _ { i j } \} } }$
+budget $B$ , fairness threshold $\epsilon = c _ { m a x }$ .
+Output: balanced allocation $\{ D _ { j } \} _ { j \in [ M ] }$ where $D _ { j } \subseteq [ N ]$ $. D _ { j } \cap D _ { j ^ { \prime } } = \emptyset \forall j , j ^ { \prime } \in [ M ] .$
+1: Initiate allocation $D _ { j } \emptyset$ for all $j \in [ M ]$
+2: Let $L \gets \{ 1 , \ldots , N \}$ be the set of all unallocated arms
+3: while true do
+4: Let $\tau _ { j }$ be the ordering over $\lambda _ { i j }$ values from highest to lowest: $\lambda [ \tau _ { j } [ 1 ] ] [ j ] \ge \dots \ge \lambda [ \tau _ { j } [ N ] ] [ j ] \ge 0$
+5: Let $\sigma$ be the ordering over workers based on their highest indices: $\lambda [ \tau _ { 1 } [ 1 ] ] [ 1 ] \ge \lambda [ \tau _ { 2 } [ 1 ] ) ] [ 2 ]$ ] and so on
+6: for $j = 1$ to $M$ do
+7: if $\tau _ { \sigma _ { j } } \cap L \neq \emptyset$ then
+8: $x ^ { ' } \mathrm { t o p } ( \tau _ { j } ) \cap L$
+9: while cxj + P h2D chj > B do
+10: ⌧j ⌧j \ {x}
+11: if ⌧j \ L = ; then
+12: break
+13: else
+14 $\begin{array} { r l r } { } & { \colon { \mathrm { t o p } } ( \tau _ { \sigma _ { j } } ) \cap L } & \\ { \vdots } & { \quad { \mathrm { i f } } \tau _ { \sigma _ { j } } \cap L \neq \emptyset { \mathrm { t h e n } } } \\ { } & { \quad \quad D _ { \sigma _ { j } } D _ { \sigma _ { j } } \cup \{ x \} ; } & { L L \setminus \{ x \} ; } & { \tau _ { \sigma _ { j } } \tau _ { \sigma _ { j } } \setminus \{ x \} } \\ { } & { \colon { \mathrm { r e t u r n } } \{ D _ { j } \} _ { j \in [ M ] } } & \end{array}$
+15
+16
+263 Theorem 3. When all workers are homogeneous (same costs and transition probabilities on arms
+264 after intervention) and satisfy indexability, then our framework outputs the optimal policy while being
+265 exactly fair to the workers.
+
+Proof sketch. The proof consists of two components: (1) optimality, which can be proved using Corollary 1 (Whittle Indices for homogeneous workers are the same), and the fact that the same costs lead to considering all workers from the same pool of actions, and (2) perfect fairness, using the fact that, when costs are equal, Step 3 of our algorithm divides the arms among workers in a way such that the difference between the number of allocations between two workers differs by at most 1 (see complete proof in Appendix D).
+
+# 5 Empirical Evaluation
+
+273 We evaluate our framework on three domains, namely constant unitary costs, ordered workers,
+274 and specialist domain, each highlighting various challenging dimensions of the MWRMAB problem
+275 (detailed in Appendix $\mathbf { C } )$ . In the first domain, the cost associated with all worker-arm pairs is the
+276 same, but transition probabilities differ; the main challenge is in finding optimal assignments, though
+277 fairness is still considered. In the second domain, there exists an ordering among the workers such
+278 that the highest (or lowest) ranked worker has the highest (or lowest) probability of transitioning any
+279 arm to “good” state; which makes balancing optimal assignments with fair assignments challenging.
+280 The final domain highlights the need to consider inter-action effects via Step 2.
+281 We run experiments by varying the number of arms for each domain. For the first and third domains
+282 that consider unit costs, we use $B = 4$ budget per worker, and for the second domain where costs are
+283 in the range [1, 10], we use budget $B = 1 8$ . We ran all the experiments on Apple M1 with $3 . 2 \mathrm { G H z }$
+284 Processor and 16 GB RAM. We evaluate the average reward per arm over a fixed time horizon of
+285 100 steps and averaged over 50 epochs with random or fixed transition probabilities that follow the
+286 characteristics of each domain.
+
+Baselines We compare our approach, $\mathbf { C W I + B A }$ (Combined Whittle Index with Balanced Alloca8 tion), against:
+
+• $\mathbf { P W I + B A }$ (Per arm-worker Whittle Index with Balanced Allocation) that combines Steps 1 and 3 of our approach, skipping Step 2 (adjusted index algorithm)
+
+• $\mathbf { C W I + G A }$ (Combined arm-worker Whittle Index with Greedy Allocation) that combines Steps 1 and 2 and, instead of Step 3 (balanced allocation), the highest values of indices are used for allocating arms to workers while ensuring budget constraint per timestep
+
+• Hawkins $\underline { { \| 2 0 0 3 \| } }$ solves a discounted version of Eq. $2$ without the fairness constraint, to compute values of $\lambda _ { j }$ , then solves a knapsack over $\lambda _ { j }$ -adjusted Q-values
+
+• OPT computes optimal solutions by running value iteration over the combinatorially-sized exact problem $( \bar { 1 } )$ without The fairness constraint.
+
+• OPT-fair follows OPT, but adds the fairness constraints. These optimal algorithms are exponential in the number of arms, states, and workers, and thus, could only be executed on small instances.
+
+• Random takes random actions $j \in [ M ] \cup \{ 0 \}$ on every arm while maintaining budget feasibility for every worker at each timestep
+
+302 Results Figure $2$ shows that reward obtained using our framework $\mathrm { ( C W I + B A ) }$ is comparable to that
+303 of the reward maximizing baselines (Hawkins and OPT) across all the domains. We observe at most
+304 $1 8 . 9 5 \%$ reduction in reward compared to OPT, where the highest reduction occurs for ordered workers
+305 in Fig. 2(b). In terms of fairness, Figs. $2 ( \mathbf { a } )$ and (c) show that $\mathrm { C W I + B A }$ achieves fair allocation among
+306 workers at all timesteps. In Figure $\boxed { 2 } ( 6 )$ $\mathbf { C W I + B A }$ achieves fair allocation in almost all timesteps. The
+307 fraction of timesteps where fairness is attained by $\mathrm { C W I + B A }$ is significantly higher than Hawkins and
+308 OPT. In fact, $\mathrm { F i g } \bigstar \bigstar ( \mathsf { b } )$ also shows that Hawkins obtains unfair solutions at every timesteps (0 fairness)
+309 when ${ \Nu } { = } 5$ and $_ { \mathrm { B = } 1 8 }$ , and, when ${ \Nu } { = } 1 0$ and $_ { \mathrm { N = 1 5 } }$ , Hawkins is fair only 0.41 and 0.67 fractions of
+310 the time, respectively. Thus, compared to reward maximizing baselines (Hawkins and OPT),
+311 $\mathbf { C W I + B A }$ achieves the highest fairness. We also compare against two versions of our solution
+312 approach, namely, $\mathrm { P W I + B A }$ and $\mathrm { C W I + G A }$ . We observe that $\mathrm { P W I + B A }$ accumulates marginally lower
+313 reward while $\mathrm { C W I + G A }$ performs poorly in terms of fairness, hence asserting the importance of using
+314 $\mathrm { C W I + B A }$ for the MWRAMB problem.
+
+Fig 3 shows that $\mathbf { C W I + B A }$ is significantly faster than OPT-fair (the optimal MWRMAB solution), with an execution time improvement of $3 3 \%$ , $7 8 \%$ and $8 3 \%$ for the three domains, respectively, when ${ \Nu } { = } 5$ . Moreover, for instances with ${ \Nu } { = } 1 0$ onwards, both OPT and OPT-fair ran out of memory because the execution of the optimal algorithms required exponentially larger memory. However, we observe that $\mathrm { C W I + B A }$ scales well even for $N = 1 0$ and $N = 1 5$ and runs within a few seconds, on an average.
+
+Fig. 4 further demonstrates that our $\mathbf { C W I + B A }$ scales well and consistently outputs fair solution for higher values of $N$ and $B$ . On larger instances, with $N \in \{ 5 0 , 1 0 0 , 1 5 0 \}$ , our approach achieves up to $3 7 4 . 9 2 \%$ improvement in fairness with only $6 . 0 6 \%$ reduction in reward, when compared against the reward-maximizing solution $\widetilde { \mathbb { H } \mathrm { a w k i n s } } \mathbb { | } \widetilde { \underline { { 2 0 0 3 } } } \mathbb { | }$
+
+325 In summary, $\mathbf { C W I + B A }$ is fairer than reward-maximizing algorithms (Hawkins and OPT) and
+326 much faster and scalable compared to the optimal fair solution (OPT fair), while accumulating
+327 reward comparable to Hawkins and OPT across all domains. Therefore, $\mathrm { C W I + B A }$ is shown to
+328 be a fair and efficient solution for the MWRMAB problem.
+
+
+Figure 2: Mean reward (top row) and fraction of time steps with fair allocation (bottom row) for $N = 5$ , 10, 15 arms. $\mathrm { C W I + B A }$ (blue) achieves highest fraction of fair allocations than Hawkins (white) algorithm while attaining almost similar reward as the reward-maximizing baselines.
+
+
+Figure 3: Execution time averaged over 50 epochs for $N = 5 , 1 0 , 1 5$ . For a fixed time horizon of 100 steps, $\mathrm { C W I + B A }$ run faster than Hawkins (white), OPT (dark gray), and OPT fair (light gray) for all instances in each of the three domains evaluated.
+
+
+Figure 4: The plot shows mean reward (left), fairness (middle), and run time (right) for $N =$ 50, 100, 150 arms on constant unitary costs domain. $\mathrm { C W I + G A }$ scales well for larger instances, and even for $\mathrm { N } { = } 1 5 0$ arms, the average runtime is 10 seconds.
+
+# 6 Conclusion
+
+We are the first to introduce multi-worker restless multi-armed bandit (MWRMAB) problem with worker-centric fairness. Our approach provides a scalable solution for the computationally hard MWRMAB problem. On comparing our approach against the (non-scalable) optimal fair policy on smaller instances, we find almost similar reward and fairness.
+
+334 Our problem formulation provides a more general model for the intervention planning problem
+335 capturing heterogeneity of intervention resources, and thus it is useful to appropriately model real
+336 world domains such as anti-poaching patrolling and machine maintenance, where the interventions
+337 are provided by a human workforce.
+
+338 References
+339 Abderrahmane Abbou and Viliam Makis. Group maintenance: A restless bandits approach. INFORMS Journal on Computing, 31(4):719–731, 2019.
+341 Daniel Adelman and Adam J. Mersereau. Relaxations of weakly coupled stochastic dynamic programs. Operations Research, 56(3):712–727, 2008.
+343 N. Akbarzadeh and A. Mahajan. Restless bandits with controlled restarts: Indexability and computation of whittle index. In 2019 IEEE Conference on Decision and Control. IEEE, 2019.
+345 Arpita Biswas and Siddharth Barman. Fair division under cardinality constraints. In Proceedings of the 27th International Joint Conference on Artificial Intelligence, pages 91–97, 2018.
+347 Felix Brandt, Vincent Conitzer, Ulle Endriss, Jérôme Lang, and Ariel D Procaccia. Handbook of computational social choice, Chapter 12. Cambridge University Press, 2016. Eric Budish. The combinatorial assignment problem: Approximate competitive equilibrium from equal incomes. Journal of Political Economy, 119(6):1061–1103, 2011. Yifang Chen, Alex Cuellar, Haipeng Luo, Jignesh Modi, Heramb Nemlekar, and Stefanos Nikolaidis. Fair contextual multi-armed bandits: Theory and experiments. In Conference on Uncertainty in Artificial Intelligence, pages 181–190. PMLR, 2020. Kevin D. Glazebrook, David J. Hodge, and Christopher Kirkbride. General notions of indexability for queueing control and asset management. The Annals of Applied Probability, 21(3):876–907, 2011.
+Yasin Gocgun and Archis Ghate. Lagrangian relaxation and constraint generation for allocation and advanced scheduling. Computers & Operations Research, 39(10):2323–2336, 2012.
+358 Jeffrey Thomas Hawkins. A Langrangian decomposition approach to weakly coupled dynamic optimization problems and its applications. PhD thesis, Massachusetts Institute of Technology, 2003.
+361 Christine Herlihy, Aviva Prins, Aravind Srinivasan, and John Dickerson. Planning to fairly allocate: Probabilistic fairness in the restless bandit setting. arXiv preprint arXiv:2106.07677, 2021.
+63 Matthew Joseph, Michael Kearns, Jamie H Morgenstern, and Aaron Roth. Fairness in learning: Classic and contextual bandits. Advances in Neural Information Processing Systems, 29:325–333, 2016. Aditya Mate, Jackson A Killian, Haifeng Xu, Andrew Perrault, and Milind Tambe. Collapsing bandits and their application to public health interventions. In Advances in Neural Information Processing Systems, 2020.
+369 Rahul Meshram and Kesav Kaza. Simulation based algorithms for markov decision processes and multi-action restless bandits. arXiv preprint arXiv:2007.12933, 2020. Rahul Meshram, D Manjunath, and Aditya Gopalan. A restless bandit with no observable states for recommendation systems and communication link scheduling. In 2015 54th IEEE Conference on Decision and Control (CDC), pages 7820–7825. IEEE, 2015. Christos H Papadimitriou and John N Tsitsiklis. The complexity of optimal queueing network control. In Proceedings of IEEE 9th Annual Conference on Structure in Complexity Theory, pages 318–322. IEEE, 1994. Vishakha Patil, Ganesh Ghalme, Vineet Nair, and Y Narahari. Achieving fairness in the stochastic multi-armed bandit problem. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 5379–5386, 2020.
+380 Y. Qian, C. Zhang, B. Krishnamachari, and B. Tambe. Restless poachers: Handling explorationexploitation tradeoffs in security domains. In International Joint Conference on Autonomous Agents and Multi-Agent Systems, AAMAS. IFAAMAS, 2016.
+Yundi Qian, Chao Zhang, Bhaskar Krishnamachari, and Milind Tambe. Restless poachers: Handling exploration-exploitation tradeoffs in security domains. In Proceedings of the 2016 International Conference on Autonomous Agents & Multiagent Systems, pages 123–131, 2016.
+Richard R Weber and Gideon Weiss. On an index policy for restless bandits. J. Appl. Probab., 27(3):637–648, 1990.
+Peter Whittle. Restless bandits: Activity allocation in a changing world. Journal of applied probability, pages 287–298, 1988.
+Xiaowei Wu, Bo Li, and Jiarui Gan. Budget-feasible maximum nash social welfare is almost envyfree. In The 30th International Joint Conference on Artificial Intelligence (IJCAI 2021), pages 1–16, 2021.
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes] (see Appendix E)
+(c) Did you discuss any potential negative societal impacts of your work? [Yes] (see Appendix E)
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes]
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes]
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes]
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [N/A]
+(c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/uKiE0VIluA-/uKiE0VIluA-.md b/md/dev/uKiE0VIluA-/uKiE0VIluA-.md
new file mode 100644
index 0000000000000000000000000000000000000000..8a38a2ac727bcd3540191e3c23de6154897a86b5
--- /dev/null
+++ b/md/dev/uKiE0VIluA-/uKiE0VIluA-.md
@@ -0,0 +1,693 @@
+# GFLOWNETS AND VARIATIONAL INFERENCE
+
+Nikolay Malkin∗, Salem Lahlou∗, Tristan Deleu∗ Mila, Universite de Montr´ eal´
+
+Xu Ji, Edward Hu Mila, Universite de Montr´ eal´
+
+Katie Everett Google Research
+
+Dinghuai Zhang Mila, Universite de Montr´ eal´
+
+Yoshua Bengio Mila, Universite de Montr´ eal, CIFAR´
+
+# ABSTRACT
+
+This paper builds bridges between two families of probabilistic algorithms: (hierarchical) variational inference (VI), which is typically used to model distributions over continuous spaces, and generative flow networks (GFlowNets), which have been used for distributions over discrete structures such as graphs. We demonstrate that, in certain cases, VI algorithms are equivalent to special cases of GFlowNets in the sense of equality of expected gradients of their learning objectives. We then point out the differences between the two families and show how these differences emerge experimentally. Notably, GFlowNets, which borrow ideas from reinforcement learning, are more amenable than VI to off-policy training without the cost of high gradient variance induced by importance sampling. We argue that this property of GFlowNets can provide advantages for capturing diversity in multimodal target distributions.
+
+Code: https://github.com/GFNOrg/GFN_vs_HVI.
+
+# 1 INTRODUCTION
+
+Many probabilistic generative models produce a sample through a sequence of stochastic choices. Non-neural latent variable models (e.g., Blei et al., 2003), autoregressive models, hierarchical variational autoencoders (Sønderby et al., 2016), and diffusion models (Ho et al., 2020) can be said to rely upon a shared principle: richer distributions can be modeled by chaining together a sequence of simple actions, whose conditional distributions are easy to describe, than by performing generation in a single sampling step. When many intermediate sampled variables could generate the same object, making exact likelihood computation intractable, hierarchical models are trained with variational objectives that involve the posterior over the sampling sequence (Ranganath et al., 2016b).
+
+This work connects variational inference (VI) methods for hierarchical models (i.e., sampling through a sequence of choices conditioned on the previous ones) with the emerging area of research on generative flow networks (GFlowNets; Bengio et al., 2021a). GFlowNets have been formulated as a reinforcement learning (RL) algorithm – with states, actions, and rewards – that constructs an object by a sequence of actions so as to make the marginal likelihood of producing an object proportional to its reward. While hierarchical VI is typically used for distributions over real-valued objects, GFlowNets have been successful at approximating distributions over discrete structures for which exact sampling is intractable, such as for molecule discovery (Bengio et al., 2021a), for Bayesian posteriors over causal graphs (Deleu et al., 2022), or as an amortized learned sampler for approximate maximum-likelihood training of energy-based models (Zhang et al., 2022b). Although GFlowNets appear to have different foundations (Bengio et al., 2021b) and applications than hierarchical VI algorithms, we show here that the two are closely connected.
+
+As our main theoretical contribution, we show that special cases of variational algorithms and GFlowNets coincide in their expected gradients. In particular, hierarchical VI (Ranganath et al., 2016b) and nested VI (Zimmermann et al., 2021) are related to the trajectory balance and detailed balance objectives for GFlowNets (Malkin et al., 2022; Bengio et al., 2021b). We also point out the differences between VI and GFlowNets: notably, that GFlowNets automatically perform gradient variance reduction by estimating a marginal quantity (the partition function) that acts as a baseline and allow off-policy learning without the need for reweighted importance sampling.
+
+Our theoretical results are accompanied by experiments that examine what similarities and differences emerge when one applies hierarchical VI algorithms to discrete problems where GFlowNets have been used before. These experiments serve two purposes. First, they supply a missing hierarchical VI baseline for problems where GFlowNets have been used in past work. The relative performance of this baseline illustrates the aforementioned similarities and differences between VI and GFlowNets. Second, the experiments demonstrate the ability of GFlowNets, not shared by hierarchical VI, to learn from off-policy distributions without introducing high gradient variance. We show that this ability to learn with exploratory off-policy sampling is beneficial in discrete probabilistic modeling tasks, especially in cases where the target distribution has many modes.
+
+# 2 THEORETICAL RESULTS
+
+# 2.1 GFLOWNETS: NOTATION AND BACKGROUND
+
+We consider the setting of Bengio et al. (2021a). We are given a pointed1 directed acyclic graph (DAG) $\boldsymbol { \mathcal { G } } = ( \boldsymbol { S } , \mathbb { A } )$ , where $s$ is a finite set of vertices (states), and ${ \big \mathrm { ~ \text A ~ } } \subset S \times S$ is a set of directed edges (actions). If $s \mathrm { \longrightarrow } s ^ { \prime }$ is an action, we say $s$ is a parent of $s ^ { \prime }$ and $s ^ { \prime }$ is a child of $s$ . There is exactly one state that has no incoming edge, called the initial state $s _ { 0 } \in S$ . States that have no outgoing edges are called terminating. We denote by $\chi$ the set of terminating states. A complete trajectory is a sequence $\tau = ( s _ { 0 } { } \dotsm { } s _ { n } )$ such that each $s _ { i } \longrightarrow s _ { i + 1 }$ is an action and $s _ { n } \in \mathcal { X }$ . We denote by $\dot { \mathcal T }$ the set of complete trajectories and by $x _ { \tau }$ the last state of a complete trajectory $\tau$ .
+
+GFlowNets are a class of models that amortize the cost of sampling from an intractable target distribution over $\chi$ by learning a functional approximation of the target distribution using its unnormalized density or reward function, $R : X \stackrel { \textstyle \blacktriangledown } { } \mathbb { R } ^ { + }$ . While there exist different parametrizations and loss functions for GFlowNets, they all define a forward transition probability function, or a forward policy, $P _ { F } ( - \mid s )$ , which is a distribution over the children of every state $s \in S$ . The forward policy is typically parametrized by a neural network that takes a representation of $s$ as input and produces the logits of a distribution over its children. Any forward policy $P _ { F }$ induces a distribution over complete trajectories $\tau \in \mathcal { T }$ (denoted by $P _ { F }$ as well), which in turn defines a marginal distribution over terminating states $x \in \chi$ (denoted by $P _ { F } ^ { \top }$ ):
+
+$$
+\begin{array} { r l } { P _ { F } ( \tau = ( s _ { 0 } . . . s _ { n } ) ) = \displaystyle \prod _ { i = 0 } ^ { n - 1 } P _ { F } ( s _ { i + 1 } \mid s _ { i } ) } & { \qquad \forall \tau \in \mathcal { T } , } \\ { P _ { F } ^ { \top } ( x ) = \displaystyle \sum _ { \tau \in \mathcal { T } : x _ { \tau } = x } P _ { F } ( \tau ) } & { \qquad \forall x \in \mathcal { X } . } \end{array}
+$$
+
+Given a forward policy $P _ { F }$ , terminating states $x \in \chi$ can be sampled from $P _ { F } ^ { \top }$ by sampling trajectories $\tau$ from $P _ { F } ( \bar { \tau } )$ and taking their final states $x _ { \tau }$ .
+
+GFlowNets aim to find a forward policy $P _ { F }$ for which $P _ { F } ^ { \top } ( x ) \propto R ( x )$ . Because the sum in (2) is typically intractable to compute exactly, training objectives for GFlowNets introduce auxiliary objects into the optimization. For example, the trajectory balance objective (TB; Malkin et al., 2022) introduces an auxiliary backward policy $P _ { B }$ , which is a learned distribution $P _ { B } ( - \mid s )$ over the parents of every state $s \in S$ , and an estimated partition function $Z$ , typically parametrized as $\exp ( \log Z )$ where $\log Z$ is the learned parameter. The TB objective for a complete trajectory $\tau$ is defined as
+
+$$
+\mathcal { L } _ { \mathrm { T B } } ( \tau ; P _ { F } , P _ { B } , Z ) = \left( \log \frac { Z \cdot P _ { F } ( \tau ) } { R ( x _ { \tau } ) P _ { B } ( \tau \mid x _ { \tau } ) } \right) ^ { 2 } ,
+$$
+
+where $\begin{array} { r } { P _ { B } ( \tau \mid x _ { \tau } ) = \prod _ { ( s s ^ { \prime } ) \in \tau } P _ { B } ( s \mid s ^ { \prime } ) } \end{array}$ . If $\mathcal { L } _ { \mathrm { T B } }$ is made equal to 0 for every complete trajectory $\tau$ , then $P _ { F } ^ { \top } ( x ) \propto R ( x )$ for all $x \in \chi$ and $Z$ is the inverse constant of proportionality: $\begin{array} { r } { Z = \sum _ { x \in X } R ( x ) } \end{array}$ . The objective (3) is minimized by sampling trajectories $\tau$ from some distribution and making gradient steps on (3) with respect to the parameters of $P _ { F } , P _ { B }$ , and $\log Z$ . The distribution from which $\tau$ is sampled amounts to a choice of scalarization weights for the multi-objective problem of minimizing (3) over all $\tau \in \mathcal { T }$ . If $\tau$ is sampled from $P _ { F } ( \tau )$ – note that this is a nonstationary scalarization – we say the algorithm runs on-policy. If $\tau$ is sampled from another distribution, the algorithm runs off-policy; typical choices are to sample $\tau$ from a tempered version of $P _ { F }$ to encourage exploration (Bengio et al., 2021a; Deleu et al., 2022) or to sample $\tau$ from the backward policy $P _ { B } { \left( \tau \vert x \right) }$ starting from given terminating states $x$ (Zhang et al., 2022b). By analogy with the RL nomenclature, we call the behavior policy the one that samples $\tau$ for the purpose of obtaining a stochastic gradient, e.g, the gradient of the objective $\mathcal { L } _ { \mathrm { T B } }$ in (3) for the sampled $\tau$ .
+
+Other objectives have been studied and successfully used in past works, including detailed balance (DB; proposed by Bengio et al. (2021b) and evaluated by Malkin et al. (2022)) and subtrajectory balance (SubTB; Madan et al., 2022). In the next sections, we will show how the TB objective relates to hierarchical variational objectives. In $\ S C$ , we generalize this result to the SubTB loss, of which both TB and DB are special cases.
+
+# 2.2 HIERARCHICAL VARIATIONAL MODELS AND GFLOWNETS
+
+Variational methods provide a way of sampling from distributions by means of learning an approximate probability density. Hierarchical variational models (HVMs; Ranganath et al., 2016b; Sobolev & Vetrov, 2019; Vahdat $\&$ Kautz, 2020; Zimmermann et al., 2021)) typically assume that the sample space is a set of sequences $\left( z _ { 1 } , \ldots , z _ { n } \right)$ of fixed length, with an assumption of conditional independence between $z _ { i - 1 }$ and $z _ { i + 1 }$ conditioned on $z _ { i }$ , i.e., the likelihood has a factorization $q ( z _ { 1 } , \ldots , \bar { z _ { n } } ) = q ( z _ { 1 } ) q ( z _ { 2 } | z _ { 1 } ) \ldots q ( z _ { n } | z _ { n - 1 } )$ . The marginal likelihood of $z _ { n }$ in a hierarchical model involves a possibly intractable sum,
+
+$$
+q ( z _ { n } ) = \sum _ { z _ { 1 } , \ldots , z _ { n - 1 } } q ( z _ { 1 } ) q ( z _ { 2 } | z _ { 1 } ) \ldots q ( z _ { n } | z _ { n - 1 } ) .
+$$
+
+The goal of VI algorithms is to find the conditional distributions $q$ that minimize some divergence between the marginal $q ( z _ { n } )$ and a target distribution. The target is often given as a distribution with intractable normalization constant: a typical setting is a Bayesian posterior (used in VAEs, variational EM, and other applications), for which we desire $q ( z _ { n } ) \overset { \cdot } { \propto } p _ { \mathrm { l i k e l i h o o d } } ( x | z _ { n } ) p _ { \mathrm { p r i o r } } ( z _ { n } )$ .
+
+The GFlowNet corresponding to a HVM: Sampling sequences $( z _ { 1 } , \ldots , z _ { n } )$ from a hierarchical model is equivalent to sampling complete trajectories in a certain pointed DAG $\mathcal { G }$ . The states of $\mathcal { G }$ at a distance of $i$ from the initial state are in bijection with possible values of the variable $z _ { i }$ , and the action distribution is given by $q$ . Sampling from the HVM is equivalent to sampling trajectories from the policy $P _ { F } ( z _ { i + 1 } \bar { | } z _ { i } ) = \bar { q } ( \bar { z } _ { i + 1 } \vert z _ { i } ) \bar $ (and $P _ { F } ( z _ { 1 } | s _ { 0 } ) = q ( z _ { 1 } ) \bar { ) }$ , and the marginal distribution $q ( z _ { n } )$ is the terminating distribution $P _ { F } ^ { \top }$ .
+
+The HVM corresponding to a GFlowNet: Conversely, suppose $\boldsymbol { \mathcal { G } } = ( \boldsymbol { S } , \mathbb { A } )$ is a graded pointed $\mathrm { D A G } ^ { 2 }$ and that a forward policy $P _ { F }$ on $\mathcal { G }$ is given. Sampling trajectories $\tau = ( s _ { 0 } { } s _ { 1 } { } \dots { } s _ { L } )$ in $\mathcal { G }$ is equivalent to sampling from a HVM in which the random variable $z _ { i }$ is the identity of the $( i + 1 )$ -th state $s _ { i }$ in $\tau$ and the conditional distributions $q ( z _ { i + 1 } | z _ { i } )$ are given by the forward policy $P _ { F } { \left( { { s _ { i + 1 } } \left| { s _ { i } } \right. } \right) }$ . Specifying an approximation of the target distribution in a hierarchical model with $n$ layers is thus equivalent to specifying a forward policy $P _ { F }$ in a graded DAG.
+
+The correspondence can be extended to non-graded DAGs. Every pointed DAG $\mathscr { G } = ( S , \mathbb { A } )$ can be canonically transformed into a graded pointed DAG by the insertion of dummy states that have one child and one parent. To be precise, every edge $s \to s ^ { \prime } \in \mathbb { A }$ is replaced with a sequence of $\ell ^ { \prime } - \ell ( s )$ edges, where $\ell ( s )$ is the length of the longest trajectory from $s _ { 0 }$ to $s$ , $\ell ^ { \prime } = \ell ( s ^ { \prime } )$ if $s ^ { \prime } \notin \chi$ , and $\ell ^ { \prime } = \mathrm { { m a x } } _ { s ^ { \prime \prime } \in S } \ell ( s ^ { \prime \prime } )$ otherwise. This process is illustrated in $\ S \mathrm { A }$ . We thus restrict our analysis in this section, without loss of generality, to graded DAGs.
+
+The meaning of the backward policy: Typically, the target distribution is over the objects $\chi$ of the last layer of a graded DAG, rather than over complete sequences or trajectories. Any backward policy $P _ { B }$ on the DAG turns an unnormalized target distribution $R$ over $\chi$ into an unnormalized distribution over complete trajectories $\mathcal { T }$ :
+
+$$
+\forall \tau \in { \mathcal T } P _ { B } ( \tau ) \propto R ( x _ { \tau } ) P _ { B } ( \tau \mid x _ { \tau } ) , \quad \mathrm { w i t h ~ u n k n o w n ~ p a r t i t i o n ~ f u n c t i o n ~ } \hat { Z } = \sum _ { x \in \mathcal X } R ( x ) .
+$$
+
+The marginal distribution of $P _ { B }$ over terminating states is equal to $R ( x ) / \hat { Z }$ by construction. Therefore, if $P _ { F }$ is a forward policy that equals $P _ { B }$ as a distribution over trajectories, then $P _ { F } ^ { \top } ( x ) =$ $R ( x ) / \hat { Z } \propto R ( x )$ .
+
+VI training objectives: In its most general form, the hierarchical variational objective (‘HVI objective’ in the remainder of the paper) minimizes a statistical divergence $D _ { f }$ between the learned and the target distributions over trajectories:
+
+$$
+\mathcal { L } _ { \mathrm { H V I } , f } ( P _ { F } , P _ { B } ) = D _ { f } ( P _ { B } \Vert P _ { F } ) = \mathbb { E } _ { \tau \sim P _ { F } } \left[ f \left( \frac { P _ { B } ( \tau ) } { P _ { F } ( \tau ) } \right) \right] .
+$$
+
+Two common objectives are the forward and reverse Kullback-Leibler (KL) divergences (Mnih & Gregor, 2014), corresponding to $f : t \mapsto t \log t$ for $D _ { \mathrm { K L } } ( P _ { B } \Vert P _ { F } )$ and $f : t \mapsto - \log t$ for $D _ { \mathrm { K L } } ( P _ { F } \Vert P _ { B } )$ , respectively. Other $f$ -divergences have been used, as discussed in Zhang et al. (2019b); Wan et al. (2020). Note that, similar to GFlowNets, (5) can be minimized with respect to both the forward and backward policies, or can be minimized using a fixed backward policy.
+
+Divergences between two distributions over trajectories and divergences between their two marginal distributions over terminating states distributions are linked via the data processing inequality, assuming $f$ is convex (see e.g. Zhang et al. (2019b)), making the former a sensible surrogate objective for the latter:
+
+$$
+D _ { f } ( R / \hat { Z } \| P _ { F } ^ { \top } ) \leq D _ { f } ( P _ { B } \| P _ { F } )
+$$
+
+Table 1: A comparison of algorithms for approximating a target distribution in a hierarchical variational model or a GFlowNet. The gradients used to update the parameters of the sampling distribution and of the auxiliary backward policy approximate the gradients of various divergences between distributions over trajectories.
+
+
Algorithm
Surrogate loss
PF (sampler)
PB (posterior)
REVERSE KL
DKL(PFIIPB)
DKL(PFIIPB)
FORWARD KL
DKL(PBlIPF)
DKL(PBlIPF)
WAKE-SLEEP (WS)
DKL(PBl|PF)
DKL(PFlIPB)
REVERSE WAKE-SLEEP
DKL(PFIIPB)
DKL(PBI|PF)
On-policy TB
DKL(PFIIPB)
see 2.3
+
+When both $P _ { B }$ and $P _ { F }$ are learned, the divergences with respect to which they are optimized need not be the same, as long as both objectives are 0 if and only if $P _ { F } = P _ { B }$ . For example, wake-sleep algorithms (Hinton et al., 1995) optimize the generative model $P _ { F }$ using
+
+$D _ { \mathrm { K L } } ( P _ { B } | | P _ { F } )$ and the posterior $P _ { B }$ using $\bar { D _ { \mathrm { K L } } ( P _ { F } \Vert P _ { B } ) }$ . A summary of common combinations is shown in Table 1.
+
+We remark that tractable unbiased gradient estimators for objectives such as (5) may not always exist, as we cannot exactly sample from or compute the density of $P _ { B } ( \tau )$ when its normalization constant $\hat { Z }$ is unknown. For example, while the REINFORCE estimator gives unbiased estimates of the gradient with respect to $P _ { F }$ when the objective is REVERSE KL (see $\ S 2 . 3 \AA$ ), other objectives, such as FORWARD KL, require importance-weighted estimators. Such estimators approximate sampling from $P _ { B }$ by sampling a batch of trajectories $\left\{ \tau _ { i } \right\}$ from another distribution $\pi$ (which may equal $P _ { F }$ ) and weighting a loss computed for each $\tau _ { i }$ by a scalar proportional to $\frac { P _ { B } ( \tau _ { i } ) } { \pi ( \tau _ { i } ) }$ . Such reweighted importance sampling is helpful in various variational algorithms, despite its bias when the number of samples is finite (e.g., Bornschein & Bengio, 2015; Burda et al., 2016), but it may also introduce variance that increases with the discrepancy between $P _ { B }$ and $\pi$ .
+
+# 2.3 ANALYSIS OF GRADIENTS
+
+The following proposition summarizes our main theoretical claim, relating the GFN objective of (3) and the variational objective of (5). In $\ S C$ , we extend this result by showing an equivalence between the subtrajectory balance objective (introduced in Malkin et al. (2022) and empirically evaluated in Madan et al. (2022)) and a natural extension of the nested variational objective (Zimmermann et al., 2021) to subtrajectories. A special case of this equivalence is between the Detailed Balance objective (Bengio et al., 2021b) and the nested VI objective (Zimmermann et al., 2021).
+
+Proposition 1 Given a graded DAG $\mathcal { G }$ , and denoting by $\theta , \phi$ the parameters of the forward and backward policies $P _ { F } , P _ { B }$ respectively, the gradients of the $T B$ objective (3) satisfy:
+
+$$
+\begin{array} { r l } & { \dot { \nabla } _ { \phi } D _ { \mathrm { K L } } ( P _ { B } \| P _ { F } ) = \cfrac { 1 } { 2 } \mathbb { E } _ { \tau \sim P _ { B } } [ \nabla _ { \phi } \mathcal { L } _ { \mathrm { T B } } ( \tau ) ] , } \\ & { \nabla _ { \theta } D _ { \mathrm { K L } } ( P _ { F } \| P _ { B } ) = \cfrac { 1 } { 2 } \mathbb { E } _ { \tau \sim P _ { F } } [ \nabla _ { \theta } \mathcal { L } _ { \mathrm { T B } } ( \tau ) ] . } \end{array}
+$$
+
+The proof of the extended result appears in $\ S C$ . An alternative proof is provided in $\ S \mathbf { B }$ .
+
+While (8) is the on-policy TB gradient with respect to the parameters of $P _ { F }$ , (7) is not the on-policy TB gradient with respect to the parameters of $P _ { B }$ , as the expectation is taken over $P _ { B }$ , not $P _ { F }$ . The on-policy TB gradient can however be expressed through a surrogate loss
+
+$$
+\begin{array} { r } { \mathbb { E } _ { \tau \sim P _ { F } } [ \nabla _ { \phi } \mathcal { L } _ { \mathrm { T B } } ( \tau ) ] = \nabla _ { \phi } \left[ D _ { \log ^ { 2 } } ( P _ { B } \| P _ { F } ) + 2 ( \log Z - \log \hat { Z } ) D _ { \mathrm { K L } } ( P _ { F } \| P _ { B } ) \right] , } \end{array}
+$$
+
+where $\begin{array} { r } { \hat { Z } = \sum _ { x \in { \mathcal { X } } } R ( x ) } \end{array}$ , the unknown true partition function. Here $D _ { \log ^ { 2 } }$ is the pseudo- $f$ -divergence defined by $f ( x ) = \log ( x ) ^ { 2 }$ , which is not convex for large $x$ . (Proof in $\ S \mathbf { B }$ .)
+
+The loss in (7) is not possible to optimize directly unless using importance weighting (cf. the end of $\ S 2 . 2 )$ ), but optimization of $P _ { B }$ using (7) and $P _ { F }$ using (8) would yield the gradients of REVERSE WAKE-SLEEP in expectation.
+
+Score function estimator and variance reduction: Optimizing the reverse KL loss $D _ { \mathrm { K L } } ( P _ { F } \Vert P _ { B } )$ with respect to $\theta$ , the parameters of $P _ { F }$ , requires a likelihood ratio (also known as REINFORCE) estimator of the gradient (Williams, 1992), using a trajectory $\tau$ (or a batch of trajectories), which takes the form:
+
+$$
+\Delta ( \tau ) = \nabla _ { \theta } \log P _ { F } ( \tau ; \theta ) c ( \tau ) , \quad \mathrm { w h e r e } \ c ( \tau ) = \log \frac { P _ { F } ( \tau ) } { R ( x _ { \tau } ) P _ { B } ( \tau \mid x _ { \tau } ) }
+$$
+
+(Note that the term $\nabla _ { \boldsymbol { \theta } } c ( \tau )$ that is typically present in the REINFORCE estimator is 0 in expectation, $\begin{array} { r } { \mathbb { E } _ { \tau \sim P _ { F } } [ \nabla _ { \theta } \log P _ { F } ( \tau ) ] = \sum _ { \tau } \frac { P _ { F } ( \tau ) } { P _ { F } ( \tau ) } \nabla _ { \theta } P _ { F } ( \tau ) = 0 . } \end{array}$ ) The estimator of (10) is known to exhibit high variance norm, thus slowing down learning. A common workaround is to subtract a baseline $b$ from $c ( \tau )$ , which does not bias the estimator. The value of the baseline $^ b$ (also called control variate) that most reduces the trace of the covariance matrix of the gradient estimator is
+
+$$
+b ^ { * } = \frac { \mathbb { E } _ { \tau \sim P _ { F } } [ c ( \tau ) \lVert \nabla _ { \theta } \log P _ { F } ( \tau ; \theta ) \rVert ^ { 2 } ] } { \mathbb { E } _ { \tau \sim P _ { F } } [ \lVert \nabla _ { \theta } \log P _ { F } ( \tau ; \theta ) \rVert ^ { 2 } ] } ,
+$$
+
+commonly approximated with $\mathbb { E } _ { \tau \sim P _ { F } } [ c ( \tau ) ]$ (see, e.g., Weaver & Tao (2001); $\mathrm { W u }$ et al. (2018)). This approximattrajectories $\{ \tau _ { i } \} _ { i = 1 } ^ { B }$ tself often approximated with a batch-dependent local baseline, from a batch of:
+
+$$
+b ^ { \mathrm { l o c a l } } = \frac { 1 } { B } \sum _ { i = 1 } ^ { B } c ( \tau _ { i } )
+$$
+
+A better approximation of the expectation $\mathbb { E } _ { \tau \sim P _ { F } } [ c ( \tau ) ]$ can be obtained by maintaining a running average of the values $c ( \tau )$ , leading to a global baseline. After observing each batch of trajectories, the running average is updated with step size $\eta$ :
+
+$$
+b ^ { \mathrm { g l o b a l } } ( 1 - \eta ) b ^ { \mathrm { g l o b a l } } + \eta b ^ { \mathrm { l o c a l } } .
+$$
+
+This coincides with the update rule of $\log Z$ in the minimization of $\mathcal { L } _ { \mathrm { T B } } ( P _ { F } , P _ { B } , Z )$ with a learning rate $\frac { \eta } { 2 }$ for the parameter $\log Z$ (with respect to which the TB objective is quadratic). Consequently, (8) of Prop. 1 shows that the update rule for the parameters of $P _ { F }$ , when optimized using the REVERSE KL objective, with (12) as a control variate for the score function estimator of its gradient, is the same as the update rule obtained by optimizing the TB objective using on-policy trajectories.
+
+While learning a backward policy $P _ { B }$ can speed up convergence (Malkin et al., 2022), the TB objective can also be used with a fixed backward policy, in which case the REVERSE KL objective and the TB objective differ only in how they reduce the variance of the estimated gradients, if the trajectories are sampled on-policy. In $\ S 4$ , we experimentally explore the differences between the two learning paradigms that arise when $P _ { B }$ is learned, or when the algorithms run off-policy.
+
+# 3 RELATED WORK
+
+(Hierarchical) VI: Variational inference (Zhang et al., 2019a) techniques originate from graphical models (Saul et al., 1996; Jordan et al., 2004), which typically include an inference machine and a generative machine to model the relationship between latent variables and observed data. The line of work on black-box VI (Ranganath et al., 2014) focuses on learning the inference machine given a data generating process, i.e., inferring the posterior over latent variables. Hierarchical modeling exhibits appealing properties under such settings as discussed in Ranganath et al. (2016b); Yin & Zhou (2018); Sobolev & Vetrov (2019). On the other hand, works on variational auto-encoders (VAEs) (Kingma & Welling, 2014; Rezende et al., 2014) focus on generative modeling, where the inference machine – the estimated variational posterior – is a tool to assist optimization of the generative machine or decoder. Hierarchical construction of multiple latent variables has also been shown to be beneficial (Sønderby et al., 2016; Maaløe et al., 2019; Child, 2021).
+
+While earlier works simplify the variational family with mean-field approximations (Bishop, 2006), modern inference methods rely on amortized stochastic optimization (Hoffman et al., 2013). One of the oldest and most commonly used ideas is REINFORCE (Williams, 1992; Paisley et al., 2012) which gives unbiased gradient estimation. Follow-up work (Titsias & Lazaro-Gredilla, 2014; Gre- ´ gor et al., 2014; Mnih & Gregor, 2014; Mnih & Rezende, 2016) proposes advanced estimators to reduce the high variance of REINFORCE. The log-variance loss proposed by Richter et al. (2020) is equivalent in expected gradient of $P _ { F }$ to the on-policy TB loss for a GFlowNet with a batch-optimal value of log ??. On the other hand, path-wise gradient estimators (Kingma & Welling, 2014) have much lower variance, but have limited applicability. Later works combine these two approaches for particular distribution families (Tucker et al., 2017; Grathwohl et al., 2018).
+
+Beyond the evidence lower bound (ELBO) objective used in most variational inference methods, more complex objectives have been studied. Tighter evidence bounds have proved beneficial to the learning of generative machines (Burda et al., 2016; Domke & Sheldon, 2018; Rainforth et al., 2018; Masrani et al., 2019). As KL divergence optimization suffers from issues such as mean-seeking behavior and posterior variance underestimation (Minka, 2005), other divergences are adopted as in expectation propagation (Minka, 2001; Li et al., 2015), more general $f$ -divergences (Dieng et al., 2017; Wang et al., 2018; Wan et al., 2020), their special case $\alpha$ -divergences (Hernandez-Lobato ´ et al., 2016), and Stein discrepancy (Liu & Wang, 2016; Ranganath et al., 2016a). GFlowNets could be seen as providing a novel pseudo-divergence criterion, namely TB, as discussed in this work.
+
+Wake-sleep algorithms: Another branch of work, starting with Hinton et al. (1995), proposes to avoid issues from stochastic optimization (such as REINFORCE) by alternatively optimizing the generative and inference (posterior) models. Modern versions extending this framework include reweighted wake-sleep Bornschein & Bengio (2015); Le et al. (2019) and memoised wakesleep (Hewitt et al., 2020; Le et al., 2022). It was shown in Le et al. (2019) that wake-sleep algorithms behave well for tasks involving stochastic branching.
+
+GFlowNets: GFlowNets have been used successfully in settings where RL and MCMC methods have been used in other work, including molecule discovery (Bengio et al., 2021a; Malkin et al., 2022; Madan et al., 2022), biological sequence design (Malkin et al., 2022; Jain et al., 2022; Madan et al., 2022), and Bayesian structure learning (Deleu et al., 2022). A connection of the theoretical foundations of GFlowNets (Bengio et al., 2021a;b) with variational methods was first mentioned by Malkin et al. (2022) and expanded in Zhang et al. (2022a; 2023).
+
+A concurrent and closely related paper (Zimmermann et al., 2022) theoretically and experimentally explores interpolations between forward and reverse KL objectives.
+
+# 4 EXPERIMENTS
+
+The goal of the experiments is to empirically investigate two main observations consistent with the above theoretical analysis:
+
+Observation 1. On-policy VI and TB (GFlowNet) objectives can behave similarly in some cases, when both can be stably optimized, while in others on-policy TB strikes a better compromise than either the (mode-seeking) REVERSE KL or (mean-seeking) FORWARD KL VI objectives. This claim is supported by the experiments on all three domains below.
+
+However, in all cases, notable differences emerge. In particular, HVI training becomes more stable near convergence and is sensitive to learning rates, which is consistent with the hypotheses about gradient variance in $\ S 2 . 3$ .
+
+Observation 2. When exploration matters, off-policy TB outperforms both on-policy TB and VI objectives, avoiding the possible high variance induced by importance sampling in off-policy VI. GFlowNets are capable of stable off-policy training without importance sampling. This claim is supported by experiments on all domains, but is especially well illustrated on the realistic domains in $\ S 4 . 2$ and $\bar { \ S } 4 . \bar { 3 }$ . This capability provides advantages for capturing a more diverse set of modes.
+
+Observation 1 and Observation 2 provide evidence that off-policy TB is the best method among those tested in terms of both accurately fitting the target distribution and effectively finding modes, where the latter is particularly important for the challenging molecule graph generation and causal graph discovery problems studied below.
+
+# 4.1 HYPERGRID: EXPLORATION OF LEARNING OBJECTIVES
+
+In this section, we comparatively study the ability of the variational objectives and the GFlowNet objectives to learn a multimodal distribution given by its unnormalized density, or reward function, $R$ . We use the synthetic hypergrid environment introduced by Bengio et al. (2021a) and further explored by Malkin et al. (2022). The states form a $D$ -dimensional hypergrid with side length $H$ , and the reward function has $2 ^ { D }$ flat modes near the corners of the hypergrid. The states form a pointed DAG, where the source state is the origin $s _ { 0 } = \mathbf { 0 }$ , and each edge corresponds to the action of incrementing one coordinate in a state by 1 (without exiting the grid). More details about the environment are provided in $\ S _ { \mathrm { { D . 1 } } }$ . We focus on the case where $P _ { B }$ is learned, which has been shown to accelerate convergence (Malkin et al., 2022).
+
+In Fig. 1, we compare how fast each learning objective discovers the 4 modes of a $1 2 8 \times 1 2 8$ grid, with an exploration parameter $R _ { 0 } ~ = ~ 0 . 0 0 1$ in the reward function. The gap between the learned distribution $P _ { F } ^ { \top }$ and the target distribution is measured by the Jensen-Shannon divergence (JSD)
+
+
+Figure 1: Top: The evolution of the JSD between the learned sampler $P _ { F } ^ { \top }$ and the target distribution on the $1 2 8 \times 1 2 8$ grid, as a function of the number of trajectories sampled. Shaded areas represent the standard error evaluated across 5 different runs (on-policy left, off-policy right). Bottom: The average (across 5 runs) final learned distribution $P _ { F } ^ { \top }$ for the different algorithms, along with the target distribution. To amplify variation, the plot intensity at each grid position is resampled from the Gaussian approximating the distribution over the 5 runs. Although WS, FORWARD KL, and REVERSE WS (off-policy) find the 4 target modes, they do not model them with high precision, and produce a textured pattern at the modes, where it should be flat.
+
+between the two distributions, to avoid giving a preference to one KL or the other. Additionally, we show graphical representations of the learned 2D terminating states distribution, along with the target distribution. We provide in $\ S \mathrm { E }$ details on how $P _ { F } ^ { \top }$ and the JSD are evaluated and how hyperparameters were optimized separately for each learning algorithm.
+
+Exploration poses a challenge in this environment, given the distance that separates the different modes. We thus include in our analysis an off-policy version of each objective, where the behavior policy is different from, but related to, the trained sampler $P _ { F } ( \tau )$ . The GFlowNet behavior policy used here encourages exploration by reducing the probability of terminating a trajectory at any state of the grid. This biases the learner towards sampling longer trajectories and helps with faster discovery of farther modes. When off-policy, the HVI gradients are corrected using importance sampling weights.
+
+For the algorithms that use a score function estimator of the gradient (FORWARD KL, REVERSE WS, and REVERSE KL), we found that using a global baseline, as explained in $\ S 2 . 2$ , was better than using the more common local baseline in most cases (see Fig. D.1). This brings the VI methods closer to GFlowNets and thus factors out this issue from the comparison with the GFlowNet objectives.
+
+We see from Fig. 1 that while FORWARD KL and WS – the two algorithms that use $D _ { \mathrm { K L } } ( P _ { B } \Vert P _ { F } )$ as the objective for $P _ { F }$ – discover the four modes of the distribution faster, they converge to a local minimum and do not model all the modes with high precision. This is due to the mean-seeking behavior of the forward KL objective, requiring that $\dot { P _ { F } ^ { \intercal } }$ puts non-zero mass on terminating states $x$ where $R ( x ) > 0$ . Objectives that use the reverse KL to train the forward policy (REVERSE KL and REVERSE WS) are mode-seeking and can thus have a low loss without finding all the modes. The TB GFlowNet objective offers the best of both worlds, as it converges to a lower value of the JSD, discovers the four modes, and models them with high precision. This supports Observation 1. Additionally, in support of Observation 2, while both the TB objective and the HVI objectives benefit from off-policy sampling, TB benefits more, as convergence is greatly accelerated.
+
+We supplement this study with a comparative analysis of the algorithms on smaller grids in $\ S _ { \mathrm { { D . 1 } } }$
+
+# 4.2 MOLECULE SYNTHESIS
+
+We study the molecule synthesis task from Bengio et al. (2021a), in which molecular graphs are generated by sequential addition of subgraphs from a library of blocks (Jin et al., 2020; Kumar et al., 2012). The reward function is expressed in terms of a fixed, pretrained graph neural network $f$ that estimates the strength of binding to the soluble epoxide hydrolase protein (Trott & Olson, 2010). To be precise, $R ( x ) = f ( x ) ^ { \beta }$ , where $f ( x )$ is the output of the binding model on molecule $x$ and $\beta$ is a parameter that can be varied to control the entropy of the sampling model.
+
+
+Figure 2: Correlation between marginal sampling log-likelihood and log-reward on the molecule generation task for different learning algorithms, showing the advantage of off-policy TB (red) against on-policy TB (orange) and both on-policy (blue) and off-policy HVI (green). For each hyperparameter setting on the $x$ -axis $\overset { \cdot } { \alpha }$ or $\beta$ ), we take the optimal choice of the other hyperparameter $\beta$ or $\alpha$ , respectively) and plot the mean and standard error region over three random seeds.
+
+Because the number of terminating states is too large to make exact computation of the target distribution possible, we use a performance metric from past work on this task (Bengio et al., 2021a) to evaluate sampling agents. Namely, for each molecule $x$ in a held-out set, we compute log $P _ { F } ^ { \top } ( x )$ , the likelihood of $x$ under the trained model (computable by dynamic programming, see $\ S \operatorname { E }$ ), and evaluate the Pearson correlation of $\log P _ { F } ^ { \top } ( x )$ and $\ \bar { \log \cal R } ( x )$ . This value should equal 1 for a perfect sampler, as $\log P _ { F } ^ { \top } ( x )$ and $\log R ( x )$ would differ by a constant, the log-partition function $\log { \hat { Z } }$ .
+
+In Malkin et al. (2022), GFlowNet samplers using the DB and TB objectives, with the backward policy $P _ { B }$ fixed to a uniform distribution over the parents of each state, were trained off-policy. Specifically, the trajectories used for DB and TB gradient updates were sampled from a mixture of the (online) forward policy $P _ { F }$ and a uniform distribution at each sampling step, with a special weight depending on the trajectory length used for the termination action.
+
+We wrote an extension of the published code of Malkin et al. (2022) with an implementation of the HVI (REVERSE KL) objective, using a reweighted importance sampling correction. We compare the off-policy TB from past work with the off-policy REVERSE KL, as well as on-policy TB and REVERSE KL objectives. (Note that on-policy TB and REVERSE KL are equivalent in expectation in this setting, since the backward policy is fixed.) Each of the four algorithms was evaluated with four values of the inverse temperature parameter $\beta$ and of the learning rate $\alpha$ , for a total of $4 \times 4 \times 4 =$ 64 settings. (We also experimented with the off-policy FORWARD KL / WS objective for optimizing $P _ { F }$ , but none of the hyperparameter settings resulted in an average correlation greater than 0.1.)
+
+The results are shown in Fig. 2, in which, for each hyperparameter ( $\alpha$ or $\beta$ ), we plot the performance for the optimal value of the other hyperparameter. We make three observations:
+
+• In support of Observation 2, off-policy REVERSE KL performs poorly compared to its on-policy counterpart, especially for smoother distributions (smaller values of $\beta$ ) where more diversity is present in the target distribution. Because the two algorithms agree in the expected gradient, this suggests that importance sampling introduces unacceptable variance into HVI gradients. • In support of Observation 1, the difference between on-policy REVERSE KL and on-policy TB is quite small, consistent with their gradients coinciding in the limit of descent along the full-batch gradient field. However, REVERSE KL algorithms are more sensitive to the learning rate. In support of Observation 2, off-policy TB gives the best and lowest-variance fit to the target distribution, showing the importance of an exploratory training policy, especially for sparser reward landscapes (higher $\beta$ ).
+
+Table 2: Comparison of the Jensen-Shannon divergence for Bayesian structure learning, showing the advantage of off-policy TB over on-policy TB and on-policy or off-policy HVI. The JSD is measured between the true posterior distribution $p ( G \mid { \mathcal { D } } )$ and the learned approximation $P _ { F } ^ { \top } ( G )$ .
+
+
Objective
Number of nodes
3
4
5
(Modified) Detailed Balance
5.32 ± 4.15 × 10-6
2.05 ± 0.70 × 10-5
4.65 ± 1.08 × 10-4
Off-Policy Trajectory Balance
3.70 ± 2.51 × 10-7
9.35 ± 2.99 × 10-6
5.44 ± 2.47 × 10-4
On-Policy Trajectory Balance
0.022 ± 0.007
0.123 ± 0.028
0.277 ± 0.040
On-Policy REVERSE KL (HVI)
0.022 ± 0.007
0.125 ± 0.027
0.306 ± 0.042
Off-Policy REVERSE KL (HVI)
0.014 ± 0.008
0.605 ± 0.019
0.656 ± 0.009
+
+# 4.3 GENERATION OF DAGS IN BAYESIAN STRUCTURE LEARNING
+
+Finally, we consider the problem of learning the (posterior) distribution over the structure of Bayesian networks, as studied in Deleu et al. (2022). The goal of Bayesian structure learning is to approximate the posterior distribution $p ( G \mid { \mathcal { D } } )$ over DAGs $G$ , given a dataset of observations $\mathcal { D }$ . Following Deleu et al. (2022), we treat the generation of a DAG as a sequential decision problem, where directed edges are added one at a time, starting from the completely disconnected graph. Since our goal is to approximate the posterior distribution $p ( G \mid { \mathcal { D } } )$ , we use the joint probability $R ( G ) = \hat { p ( G , \mathcal { D } ) }$ as the reward function, which is proportional to the former up to a normalizing constant. Details about how this reward is computed, as well as the parametrization of the forward policy $P _ { F }$ , are available in $\ S _ { \mathrm { D } . 3 }$ . Note that similarly to $\ S 4 . 2$ , and following Deleu et al. (2022), we leave the backward policy $P _ { B }$ fixed to uniform.
+
+We only consider settings where the true posterior distribution $p ( G \mid { \mathcal { D } } )$ can be computed exactly by enumerating all the possible DAGs $G$ over $d$ nodes (for $d \leq 5$ ). This allows us to exactly compare the posterior approximations, found either with the GFlowNet objectives or HVI, with the target posterior distribution. The state space grows rapidly with the number of nodes (e.g., there are $2 9 \mathrm { k }$ DAGs over $d = 5$ nodes). For each experiment, we sampled a dataset $\mathcal { D }$ of 100 observations from a randomly generated ground-truth graph $G ^ { \star }$ ; the size of $\mathcal { D }$ was chosen to obtain highly multimodal posteriors. In addition to the (Modified) DB objective introduced by Deleu et al. (2022), we also study the TB (GFlowNet) and the REVERSE KL (HVI) objectives, both on-policy and off-policy.
+
+In Table 2, we compare the posterior approximations found using these different objectives in terms of their Jensen-Shannon divergence (JSD) to the target posterior distribution $P ( G \mid { \mathcal { D } } )$ . We observe that on the easiest setting (graphs over $d = 3$ nodes), all methods accurately approximate the posterior distribution. But as we increase the complexity of the problem (with larger graphs), we observe that the accuracy of the approximation found with Off-Policy REVERSE KL degrades significantly, while the ones found with the off-policy GFlowNet objectives ((Modified) DB & TB) remain very accurate. We also note that the performance of On-Policy TB and On-Policy REVERSE KL degrades too, but not as significantly; furthermore, both of these methods achieve similar performance across all experimental settings, confirming our Observation 1, and the connection highlighted in $\ S 2 . 2$ . The consistent behavior of the off-policy GFlowNet objectives compared to the on-policy objectives (TB & REVERSE KL) as the problem increases in complexity (i.e., as the number of nodes $d$ increases, requiring better exploration) also supports our Observation 2. These observations are further confirmed when comparing the edge marginals $P ( X _ { i } \to X _ { j } \mid { \mathcal { D } } )$ in Fig. D.3 $( \ S _ { \mathrm { D } . 3 } )$ , computed either with the target posterior distribution or with the posterior approximations.
+
+# 5 DISCUSSION AND CONCLUSIONS
+
+The theory and experiments in this paper place GFlowNets, which had been introduced and motivated as a reinforcement learning method, in the family of variational methods. They suggest that off-policy GFlowNet objectives may be an advantageous replacement to previous VI objectives, especially when the target distribution is highly multimodal, striking an interesting balance between the mode-seeking (REVERSE KL) and mean-seeking (FORWARD KL) VI variants. This work should prompt more research on how best to choose the behavior policy in off-policy GFlowNet training, seen as a means to efficiently explore and discover modes.
+
+Whereas the experiments performed here focused on the realm of discrete variables, future work should also investigate GFlowNets for continuous action spaces as potential alternatives to VI in continuous-variable domains. We make some first steps in this direction in the Appendix $( \ S \mathrm { F } )$ . While this paper was under review, Lahlou et al. (2023) introduced theory for continuous GFlowNets and showed that some of our claims extend to continuous domains.
+
+# AUTHOR CONTRIBUTIONS
+
+N.M., X.J., D.Z., and Y.B. observed the connection between GFlowNets and variational inference, providing motivation for the main ideas in this work. N.M., X.J., and T.D. did initial experimental exploration. S.L., N.M., and D.Z. contributed to the theoretical analysis. S.L. and N.M. extended the theoretical analysis to subtrajectory objectives. D.Z. reviewed the related work. S.L. performed experiments on the hypergrid domain. N.M. performed experiments on the molecule domain and the stochastic control domain. T.D., E.H., and K.E. performed experiments on the causal graph domain. All authors contributed to planning the experiments, analyzing their results, and writing the paper.
+
+# ACKNOWLEDGMENTS
+
+The authors thank Moksh Jain for valuable discussions about the project.
+
+This research was enabled in part by computational resources provided by the Digital Research Alliance of Canada. All authors are funded by their primary institution. We also acknowledge funding from CIFAR, Genentech, Samsung, and IBM.
+
+# REFERENCES
+
+Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint 1806.01261, 2018.
+
+Emmanuel Bengio, Moksh Jain, Maksym Korablyov, Doina Precup, and Yoshua Bengio. Flow network based generative models for non-iterative diverse candidate generation. Neural Information Processing Systems (NeurIPS), 2021a.
+
+Yoshua Bengio, Salem Lahlou, Tristan Deleu, Edward Hu, Mo Tiwari, and Emmanuel Bengio. GFlowNet foundations. arXiv preprint 2111.09266, 2021b.
+
+Christopher M. Bishop. Pattern Recognition and Machine Learning. Springer, 2006.
+
+David M. Blei, Michael I. Jordan, Thomas L. Griffiths, and Joshua B. Tenenbaum. Hierarchical topic models and the nested Chinese restaurant process. Neural Information Processing Systems (NIPS), 2003.
+
+Jorg Bornschein and Yoshua Bengio. Reweighted wake-sleep. ¨ International Conference on Learning Representations (ICLR), 2015.
+
+Yuri Burda, Roger Baker Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. International Conference on Learning Representations (ICLR), 2016.
+
+Rewon Child. Very deep VAEs generalize autoregressive models and can outperform them on images. International Conference on Learning Representations (ICLR), 2021.
+
+Tristan Deleu, Antonio G ´ ois, Chris Emezue, Mansi Rankawat, Simon Lacoste-Julien, Stefan Bauer, ´ and Yoshua Bengio. Bayesian structure learning with generative flow networks. Uncertainty in Artificial Intelligence (UAI), 2022.
+
+Adji Bousso Dieng, Dustin Tran, Rajesh Ranganath, John William Paisley, and David M. Blei. Variational inference via $\chi$ upper bound minimization. Neural Information Processing Systems (NIPS), 2017.
+
+Justin Domke and Daniel Sheldon. Importance weighting and variational inference. Neural Information Processing Systems (NeurIPS), 2018.
+
+Dan Geiger and David Heckerman. Learning Gaussian networks. In Uncertainty Proceedings 1994, pp. 235–243. Elsevier, 1994.
+
+Will Grathwohl, Dami Choi, Yuhuai Wu, Geoffrey Roeder, and David Kristjanson Duvenaud. Backpropagation through the void: Optimizing control variates for black-box gradient estimation. International Conference on Learning Representations (ICLR), 2018.
+
+Karol Gregor, Ivo Danihelka, Andriy Mnih, Charles Blundell, and Daan Wierstra. Deep AutoRe gressive networks. International Conference on Machine Learning (ICML), 2014.
+
+Jose Miguel Hern´ andez-Lobato, Yingzhen Li, Mark Rowland, Thang D. Bui, Daniel Hern´ andez-´ Lobato, and Richard E. Turner. Black-box alpha divergence minimization. International Conference on Machine Learning (ICML), 2016.
+
+Luke B. Hewitt, Tuan Anh Le, and Joshua B. Tenenbaum. Learning to learn generative programs with memoised wake-sleep. Uncertainty in Artificial Intelligence (UAI), 2020.
+
+Geoffrey E. Hinton, Peter Dayan, Brendan J. Frey, and R M Neal. The “wake-sleep” algorithm for unsupervised neural networks. Science, 268 5214:1158–61, 1995.
+
+Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Neural Information Processing Systems (NeurIPS), 2020.
+
+Matthew D. Hoffman, David M. Blei, Chong Wang, and John William Paisley. Stochastic variational inference. Journal of Machine Learning Research (JMLR), 14:1303–1347, 2013.
+
+Moksh Jain, Emmanuel Bengio, Alex Hernandez-Garcia, Jarrid Rector-Brooks, Bonaventure F.P. Dossou, Chanakya Ekbote, Jie Fu, Tianyu Zhang, Micheal Kilgour, Dinghuai Zhang, Lena Simine, Payel Das, and Yoshua Bengio. Biological sequence design with GFlowNets. International Conference on Machine Learning (ICML), 2022.
+
+Wengong Jin, Regina Barzilay, and Tommi Jaakkola. Chapter 11. junction tree variational autoencoder for molecular graph generation. Drug Discovery, pp. 228–249, 2020. ISSN 2041-3211.
+
+Michael I. Jordan, Zoubin Ghahramani, Tommi Jaakkola, and Lawrence K. Saul. An introduction to variational methods for graphical models. Machine Learning, 37:183–233, 2004.
+
+Diederik P. Kingma and Max Welling. Auto-encoding variational Bayes. International Conference on Learning Representations (ICLR), 2014.
+
+Jack Kuipers, Giusi Moffa, and David Heckerman. Addendum on the scoring of Gaussian directed acyclic graphical models. The Annals of Statistics, 42(4):1689–1691, 2014.
+
+Ashutosh Kumar, Arnout Voet, and Kam Y.J. Zhang. Fragment based drug design: from experimental to computational approaches. Current medicinal chemistry, 19(30):5128–5147, 2012.
+
+Salem Lahlou, Tristan Deleu, Pablo Lemos, Dinghuai Zhang, Alexandra Volokhova, Alex Hernandez-Garc ´ ´ıa, Lena N ´ ehale Ezzine, Yoshua Bengio, and Nikolay Malkin. A theory of con- ´ tinuous generative flow networks. arXiv preprint 2301.12594, 2023.
+
+Tuan Anh Le, Adam R. Kosiorek, N. Siddharth, Yee Whye Teh, and Frank Wood. Revisiting reweighted wake-sleep for models with stochastic control flow. Uncertainty in Artificial Intelligence (UAI), 2019.
+
+Tuan Anh Le, Katherine M. Collins, Luke B. Hewitt, Kevin Ellis, N. Siddharth, Samuel J. Gershman, and Joshua B. Tenenbaum. Hybrid memoised wake-sleep: Approximate inference at the discretecontinuous interface. International Conference on Learning Representations (ICLR), 2022.
+
+Yingzhen Li, Jose Miguel Hern ´ andez-Lobato, and Richard E. Turner. Stochastic expectation propa- ´ gation. Neural Information Processing Systems (NIPS), 2015.
+
+Qiang Liu and Dilin Wang. Stein variational gradient descent: A general purpose Bayesian inference algorithm. Neural Information Processing Systems (NIPS), 2016.
+
+Ilya Loshchilov and Frank Hutter. SGDR: stochastic gradient descent with warm restarts. International Conference on Learning Representations (ICLR), 2017.
+
+Lars Maaløe, Marco Fraccaro, Valentin Lievin, and Ole Winther. BIVA: A very deep hierarchy ´ of latent variables for generative modeling. Neural Information Processing Systems (NeurIPS), 2019.
+
+Kanika Madan, Jarrid Rector-Brooks, Maksym Korablyov, Emmanuel Bengio, Moksh Jain, Andrei Nica, Tom Bosc, Yoshua Bengio, and Nikolay Malkin. Learning GFlowNets from partial episodes for improved convergence and stability. arXiv preprint 2209.12782, 2022.
+
+Nikolay Malkin, Moksh Jain, Emmanuel Bengio, Chen Sun, and Yoshua Bengio. Trajectory balance: Improved credit assignment in GFlowNets. Neural Information Processing Systems (NeurIPS), 2022.
+
+Vaden Masrani, Tuan Anh Le, and Frank D. Wood. The thermodynamic variational objective. Neural Information Processing Systems (NeurIPS), 2019.
+
+Thomas P. Minka. Expectation propagation for approximate Bayesian inference. arXiv preprint 1301.2294, 2001.
+
+Thomas P. Minka. Divergence measures and message passing. 2005.
+
+Andriy Mnih and Karol Gregor. Neural variational inference and learning in belief networks. International Conference on Machine Learning (ICML), 2014.
+
+Andriy Mnih and Danilo Jimenez Rezende. Variational inference for Monte Carlo objectives. International Conference on Machine Learning (ICML), 2016.
+
+John William Paisley, David M. Blei, and Michael I. Jordan. Variational Bayesian inference with stochastic search. International Conference on Machine Learning (ICML), 2012.
+
+Tom Rainforth, Adam R. Kosiorek, Tuan Anh Le, Chris J. Maddison, Maximilian Igl, Frank Wood, and Yee Whye Teh. Tighter variational bounds are not necessarily better. International Conference on Machine Learning (ICML), 2018.
+
+Rajesh Ranganath, Sean Gerrish, and David Blei. Black box variational inference. Artificial Intelligence and Statistics (AISTATS), 2014.
+
+Rajesh Ranganath, Dustin Tran, Jaan Altosaar, and David M. Blei. Operator variational inference. Neural Information Processing Systems (NIPS), 2016a.
+
+Rajesh Ranganath, Dustin Tran, and David Blei. Hierarchical variational models. International Conference on Machine Learning (ICML), 2016b.
+
+Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. International Conference on Machine Learning (ICML), 2014.
+
+Lorenz Richter, Ayman Boustati, Nikolas Nusken, Francisco J. R. Ruiz, and ¨ Omer Deniz Akyildiz. ¨ VarGrad: A low-variance gradient estimator for variational inference. Neural Information Processing Systems (NeurIPS), 2020.
+
+Lawrence K. Saul, T. Jaakkola, and Michael I. Jordan. Mean field theory for sigmoid belief networks. Journal of Artificial Intelligence Research, 4:61–76, 1996.
+
+Artem Sobolev and Dmitry Vetrov. Importance weighted hierarchical variational inference. Neural Information Processing Systems (NeurIPS), 2019.
+
+Casper Kaae Sønderby, Tapani Raiko, Lars Maaløe, Søren Kaae Sønderby, and Ole Winther. Ladder variational autoencoders. Neural Information Processing Systems (NIPS), 2016.
+
+Michalis K. Titsias and Miguel Lazaro-Gredilla. Doubly stochastic variational Bayes for non- ´ conjugate inference. International Conference on Machine Learning (ICML), 2014.
+
+Oleg Trott and Arthur J Olson. AutoDock Vina: improving the speed and accuracy of docking with a new scoring function, efficient optimization, and multithreading. Journal of Computational Chemistry, 31(2):455–461, 2010.
+
+George Tucker, Andriy Mnih, Chris J. Maddison, John Lawson, and Jascha Narain Sohl-Dickstein. REBAR: Low-variance, unbiased gradient estimates for discrete latent variable models. Neural Information Processing Systems (NIPS), 2017.
+
+Arash Vahdat and Jan Kautz. Nvae: A deep hierarchical variational autoencoder. Neural Information Processing Systems (NeurIPS), 2020.
+
+Neng Wan, Dapeng Li, and Naira Hovakimyan. f-divergence variational inference. Neural Information Processing Systems (NeurIPS), 2020.
+
+Dilin Wang, Hao Liu, and Qiang Liu. Variational inference with tail-adaptive f-divergence. Neural Information Processing Systems (NeurIPS), 2018.
+Lex Weaver and Nigel Tao. The optimal reward baseline for gradient-based reinforcement learning. Uncertainty in Artificial Intelligence (UAI), 2001.
+Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning, 8(3):229–256, 1992.
+Cathy Wu, Aravind Rajeswaran, Yan Duan, Vikash Kumar, Alexandre M. Bayen, Sham M. Kakade, Igor Mordatch, and Pieter Abbeel. Variance reduction for policy gradient with action-dependent factorized baselines. International Conference on Learning Representations (ICLR), 2018.
+Mingzhang Yin and Mingyuan Zhou. Semi-implicit variational inference. International Conference on Machine Learning (ICML), 2018.
+Cheng Zhang, Judith Butepage, Hedvig Kjellstr ¨ om, and Stephan Mandt. Advances in variational in- ¨ ference. IEEE Transactions on Pattern Analysis and Machine Intelligence, 41:2008–2026, 2019a.
+Dinghuai Zhang, Ricky T. Q. Chen, Nikolay Malkin, and Yoshua Bengio. Unifying generative models with GFlowNets. arXiv preprint 2209.02606v1, 2022a.
+Dinghuai Zhang, Nikolay Malkin, Zhen Liu, Alexandra Volokhova, Aaron Courville, and Yoshua Bengio. Generative flow networks for discrete probabilistic modeling. International Conference on Machine Learning (ICML), 2022b.
+Dinghuai Zhang, Ricky T. Q. Chen, Nikolay Malkin, and Yoshua Bengio. Unifying generative models with GFlowNets and beyond. arXiv preprint 2209.02606, 2023.
+Mingtian Zhang, Thomas Bird, Raza Habib, Tianlin Xu, and David Barber. Variational f-divergence minimization. arXiv preprint 1907.11891, 2019b.
+Heiko Zimmermann, Hao Wu, Babak Esmaeili, Sam Stites, and Jan-Willem van de Meent. Nested variational inference. Neural Information Processing Systems (NeurIPS), 2021.
+Heiko Zimmermann, Fredrik Lindsten, Jan-Willem van de Meent, and Christian A. Naesseth. A variational perspective on generative flow networks. arXiv preprint 2210.07992, 2022.
+
+
+Figure A.1: Illustration of the process by which a DAG (left) can turn into a graded DAG (right). Nodes with a double border represent terminating states. Nodes with a dashed border represent dummy states added to make the DAG graded.
+
+Fig. A.1 shows the canonical conversion of a DAG into a graded DAG as described in $\ S 2 . 2$ . Note that this operation is idempotent: applying it to a graded DAG yields the same graded DAG.
+
+# B PROOFS
+
+We prove Prop. 1.
+
+Proof For a complete trajectory $\tau \in \mathcal { T }$ , denote by $\begin{array} { r } { c ( \tau ) = \log \frac { P _ { F } ( \tau ) } { R ( x _ { \tau } ) P _ { B } ( \tau | x _ { \tau } ) } } \end{array}$ . We have the following:
+
+$$
+\begin{array} { r l } & { \nabla _ { \theta } c ( \tau ) = \nabla _ { \theta } \log P _ { F } ( \tau ) } \\ & { \nabla _ { \phi } c ( \tau ) = - \nabla _ { \phi } \log P _ { B } ( \tau \mid x _ { \tau } ) = - \nabla _ { \phi } \log P _ { B } ( \tau ) } \end{array}
+$$
+
+Denoting by $f _ { 1 } : t \mapsto t \log t$ and $f _ { 2 } : t \mapsto - \log t$ , which correspond to the forward and reverse KL divergences respectively, and starting from
+
+$$
+\begin{array} { r l } & { \mathcal { L } _ { \mathrm { H V I } , f _ { 2 } } ( P _ { F } , P _ { B } ) = D _ { K L } ( P _ { F } \| P _ { B } ) = \mathbb { E } _ { \tau \sim P _ { F } } \left[ \log \frac { P _ { F } ( \tau ) } { P _ { B } ( \tau ) } \right] = \mathbb { E } _ { \tau \sim P _ { F } } \left[ c ( \tau ) \right] + \log \hat { Z } , } \\ & { \mathcal { L } _ { \mathrm { H V I } , f _ { 1 } } ( P _ { F } , P _ { B } ) = D _ { K L } ( P _ { B } \| P _ { F } ) = \mathbb { E } _ { \tau \sim P _ { B } } \left[ \log \frac { P _ { B } ( \tau ) } { P _ { F } ( \tau ) } \right] = - \left( \mathbb { E } _ { \tau \sim P _ { B } } \left[ c ( \tau ) \right] + \log \hat { Z } \right) , } \end{array}
+$$
+
+we obtain:
+
+$$
+\begin{array} { r } { \nabla _ { \theta } \mathcal { L } _ { \mathrm { H V I } , f _ { 2 } } ( P _ { F } , P _ { B } ) = \nabla _ { \theta } \mathbb { E } _ { \tau \sim P _ { F } } \left[ c ( \tau ) \right] = \mathbb { E } _ { \tau \sim P _ { F } } \left[ \nabla _ { \theta } \log P _ { F } ( \tau ) c ( \tau ) + \nabla _ { \theta } c ( \tau ) \right] , } \\ { \nabla _ { \phi } \mathcal { L } _ { \mathrm { H V I } , f _ { 1 } } ( P _ { F } , P _ { B } ) = - \nabla _ { \phi } \mathbb { E } _ { \tau \sim P _ { B } } \left[ c ( \tau ) \right] = - \mathbb { E } _ { \tau \sim P _ { B } } \left[ \nabla _ { \phi } \log P _ { B } ( \tau ) c ( \tau ) + \nabla _ { \phi } c ( \tau ) \right] . } \end{array}
+$$
+
+From (13) and (14), we obtain:
+
+$$
+\mathbb { E } _ { \tau \sim P _ { F } } [ \nabla _ { \theta } c ( \tau ) ] = \mathbb { E } _ { \tau \sim P _ { F } } [ \nabla _ { \theta } \log P _ { F } ( \tau ) ] = \sum _ { \tau \in \mathcal { T } } P _ { F } ( \tau ) \nabla _ { \theta } \log P _ { F } ( \tau ) = \sum _ { \tau \in \mathcal { T } } \nabla _ { \theta } P _ { F } ( \tau ) = \nabla _ { \theta } 1 = 0
+$$
+
+Hence, for any scalar $Z > 0$ , we can write:
+
+$$
+\begin{array} { r } { \mathbb { E } _ { \tau \sim P _ { F } } [ \nabla _ { \theta } c ( \tau ) ] = 0 = \mathbb { E } _ { \tau \sim P _ { F } } [ \nabla _ { \theta } \log P _ { F } ( \tau ) \log Z ] } \end{array}
+$$
+
+and similarly
+
+$$
+\begin{array} { r } { \mathbb { E } _ { \phi \sim P _ { F } } [ \nabla _ { \phi } c ( \tau ) ] = 0 = \mathbb { E } _ { \tau \sim P _ { B } } [ \nabla _ { \phi } \log P _ { B } ( \tau ) \log Z ] . } \end{array}
+$$
+
+Plugging these two equalities back in the HVI gradients above, we obtain:
+
+$$
+\begin{array} { r l r } & { } & { \nabla _ { \theta } \mathcal { L } _ { \mathrm { H V I } , f _ { 2 } } ( P _ { F } , P _ { B } ) = \mathbb { E } _ { \tau \sim P _ { F } } [ \nabla _ { \theta } \log P _ { F } ( \tau ) \log \frac { Z P _ { F } ( \tau ) } { R ( x _ { \tau } ) P _ { B } ( \tau \mid x _ { \tau } ) } ] } \\ & { } & { \nabla _ { \phi } \mathcal { L } _ { \mathrm { H V I } , f _ { 1 } } ( P _ { F } , P _ { B } ) = - \mathbb { E } _ { \tau \sim P _ { B } } [ \nabla _ { \theta } \log P _ { B } ( \tau ) \log \frac { Z P _ { F } ( \tau ) } { R ( x _ { \tau } ) P _ { B } ( \tau \mid x _ { \tau } ) } ] } \end{array}
+$$
+
+The last two equalities hold for any scalar $Z$ (that does not depend on the parameters of $P _ { F } , P _ { B }$ , and that does not depend on any trajectory). In particular, the equations hold for the parameter $Z$ of the Trajectory Balance objective. It thus follows that:
+
+$$
+\begin{array} { l } { { \nabla _ { \theta } \mathcal { L } _ { { \mathrm { H V I } } , f _ { 2 } } ( P _ { F } , P _ { B } ) = \displaystyle \frac { 1 } { 2 } \mathbb { E } _ { \tau \sim P _ { F } } \left[ \nabla _ { \theta } \left( \log \frac { Z P _ { F } ( \tau ) } { R ( x _ { \tau } ) P _ { B } ( \tau \mid x _ { \tau } ) } \right) ^ { 2 } \right] = \displaystyle \frac { 1 } { 2 } \mathbb { E } _ { \tau \sim P _ { B } } \left[ \nabla _ { \theta } \mathcal { L } _ { \mathrm { T B } } ( \tau ; P _ { F } , P _ { B } , Z ) \right] } } \\ { \nabla _ { \phi } \mathcal { L } _ { { \mathrm { H V I } } , f _ { 1 } } ( P _ { F } , P _ { B } ) = \displaystyle \frac { 1 } { 2 } \mathbb { E } _ { \tau \sim P _ { B } } \left[ \nabla _ { \theta } \left( \log \frac { Z P _ { F } ( \tau ) } { R ( x _ { \tau } ) P _ { B } ( \tau \mid x _ { \tau } ) } \right) ^ { 2 } \right] = \displaystyle \frac { 1 } { 2 } \mathbb { E } _ { \tau \sim P _ { B } } \left[ \nabla _ { \phi } \mathcal { L } _ { \mathrm { T B } } ( \tau ; P _ { F } , P _ { B } , Z ) \right] } \end{array}
+$$
+
+As an immediate corollary, we obtain that the expected on-policy TB gradient does not depend on the estimated partition function $Z$ .
+
+Next, we will prove the identity (9), which we restate here:
+
+$$
+\begin{array} { r } { \mathbb { E } _ { \tau \sim P _ { F } } [ \nabla _ { \phi } \mathcal { L } _ { \mathrm { T B } } ( \tau ) ] = \nabla _ { \phi } \left[ D _ { \log ^ { 2 } } ( P _ { B } \| P _ { F } ) + 2 ( \log Z - \log \hat { Z } ) D _ { \mathrm { K L } } ( P _ { F } \| P _ { B } ) \right] . } \end{array}
+$$
+
+Proof The RHS of (15) equals
+
+$$
+\begin{array} { r l } & { \nabla _ { \phi } [ \log \frac { P _ { B } ( \tau \mid x _ { \tau } ) R ( x _ { \tau } ) } { \tilde { Z } P _ { F } ( \tau ) } ) ^ { 2 } + 2 ( \log Z - \log \hat { Z } ) \log \frac { P _ { F } ( \tau ) \hat { Z } } { P _ { B } ( \tau \mid x _ { \tau } ) R ( x _ { \tau } ) } ] } \\ & { = \mathbb { E } _ { \tau \sim P _ { F } } [ \nabla _ { \phi } ( ( \log \frac { P _ { B } ( \tau \mid x _ { \tau } ) R ( x _ { \tau } ) } { \tilde { Z } P _ { F } ( \tau ) } ) ^ { 2 } + 2 ( \log Z - \log \hat { Z } ) \log \frac { P _ { F } ( \tau ) \hat { Z } } { P _ { B } ( \tau \mid x _ { \tau } ) R ( x _ { \tau } ) } ) ] } \\ & { = \mathbb { E } _ { \tau \sim P _ { F } } [ 2 \nabla _ { \phi } \log P _ { B } ( \tau \mid x _ { \tau } ) \log \frac { P _ { B } ( \tau \mid x _ { \tau } ) R ( x _ { \tau } ) } { \tilde { Z } P _ { F } ( \tau ) } - 2 ( \log Z - \log \hat { Z } ) \nabla _ { \phi } \log P _ { B } ( \tau \mid x _ { \tau } ) ] } \\ & { = 2 \mathbb { E } _ { \tau \sim P _ { F } } [ \nabla _ { \phi } \log P _ { B } ( \tau \mid x _ { \tau } ) \log \frac { P _ { B } ( \tau \mid x _ { \tau } ) R ( x _ { \tau } ) } { Z P _ { F } ( \tau ) } ] } \\ & { = \mathbb { E } _ { \tau \sim P _ { F } } [ \nabla _ { \phi } \mathcal { L } _ { \mathrm { T R } } ( \tau ) ] } \end{array} ,
+$$
+
+# C A VARIATIONAL OBJECTIVE FOR SUBTRAJECTORIES
+
+In this section, we extend the claim made in Prop. 1 to connect alternative GFlowNet losses to other variational objectives. Prop. 1 is thus a partial case of Prop. 2. This provides an alternative proof to Prop. 1.
+
+The detailed balance objective (DB): The loss proposed in (Bengio et al., 2021b) parametrizes a GFlowNet using its forward and backward policies $P _ { F }$ and $P _ { B }$ respectively, along with a state flow function $F$ , which is a positive function of the states, that matches the target reward function on the terminating states. It decomposes as a sum of transition-dependent losses:
+
+$$
+\forall s \to s ^ { \prime } \in \mathbb { A } \quad \mathcal { L } _ { \mathrm { D B } } ( s \to s ^ { \prime } ; P _ { F } , P _ { B } , F ) = \left( \log \frac { F ( s ) P _ { F } ( s ^ { \prime } \mid s ) } { F ( s ^ { \prime } ) P _ { B } ( s \mid s ^ { \prime } ) } \right) ^ { 2 } , \mathrm { w h e r e ~ } F ( s ^ { \prime } ) = R ( s ^ { \prime } ) \mathrm { ~ i f ~ } s ^ { \prime } \in \mathcal { X } .
+$$
+
+The subtrajectory balance objective (SubTB): Both the DB and TB objectives can be seen as special instances of the subtrajectory balance objective (Malkin et al., 2022; Madan et al., 2022). Malkin et al. (2022) suggested instead of defining the state flow function $F$ for every state $s$ , a state flow function could be defined on a subset of the state space $s$ , called the hub states. The loss can be decomposed into a sum of subtrajectory-dependent losses:
+
+$$
+\forall \tau = ( s _ { 1 } , \dots , s _ { n } ) \in \mathcal { T } ^ { \mathrm { p a r i a l } } \quad \mathcal { L } _ { \mathrm { S u b T B } } ( \tau ; P _ { F } , P _ { B } , F ) = \left( \log \frac { F ( s _ { 1 } ) P _ { F } ( \tau ) } { F ( s _ { n } ) P _ { B } ( \tau \mid s _ { t } ) } \right) ^ { 2 } ,
+$$
+
+where $P _ { F } ( \tau )$ is defined for partial trajectories similarly to complete trajectories (2), $P _ { B } ( \tau \mid s ) =$ $\prod _ { * } ( s \to s ^ { \prime } ) \in \tau \ P _ { B } ( s \mid s ^ { \prime } )$ , and we again fix $F ( x ) = R ( x )$ for terminating states $x \in \chi$ ). The SubTB objective reduces to the DB objective for subtrajectories of length 1 and to the TB objective for complete trajectories, in which case we use $Z$ to denote $F ( s _ { 0 } )$ .
+
+A variational objective for transitions: From now on, we work with a graded DAG $\mathcal { G } = ( S , \mathbb { A } )$ , in which the state space $s$ is decomposed into layers: $\begin{array} { r } { S = \bigcup _ { l = 0 } ^ { L } S _ { l } } \end{array}$ , with $S _ { 0 } = \{ s _ { 0 } \}$ and $S _ { L } = X$ .
+
+HVI provides a class of algorithms to learn forward and backward policies on $\mathcal { G }$ . Rather than learning these policies $P _ { F }$ and $P _ { B }$ ) using a variational objective requiring distributions over complete trajectories, nested variational inference (NVI; Zimmermann et al., 2021)), which combines nested importance sampling and variational inference, defines an objective dealing with distributions over transitions, or edges. To this end, it makes use of positive functions $F _ { k }$ of the states $s _ { k } \in S _ { k }$ , for $k = 0 , \ldots , L - 1$ , to define two sets of distributions $\check { p } _ { k }$ and $\hat { p } _ { k }$ over edges from $S _ { k }$ to $S _ { k + 1 }$ :
+
+$$
+{ \hat { p } } _ { k } ( s _ { k } \to s _ { k + 1 } ) \propto F _ { k } ( s _ { k } ) P _ { F } ( s _ { k + 1 } \mid s _ { k } ) \quad { \check { p } } _ { k } ( s _ { k } \to s _ { k + 1 } ) \propto { \left\{ \begin{array} { l l } { R ( s _ { L } ) P _ { B } ( s _ { k } \mid s _ { L } ) } & { k = L - 1 } \\ { F _ { k + 1 } ( s _ { k + 1 } ) P _ { B } ( s _ { k } \mid s _ { k + 1 } ) } & { { \mathrm { o t h e r w i s e } } } \end{array} \right. }
+$$
+
+Learning the policies $P _ { F } , P _ { B }$ and the functions $F _ { k }$ is done by minimizing losses of the form:
+
+$$
+\mathcal { L } _ { \mathrm { N V I } } ( P _ { F } , P _ { B } , F ) = \sum _ { k = 0 } ^ { L - 1 } D _ { f } ( \check { p } _ { k } \| \hat { p } _ { k } )
+$$
+
+The positive function $F _ { k }$ plays the same role as the state flow function in GFlowNets (in the DB objective in particular). Before drawing the links between DB and NVI, we first propose a natural extension of NVI to subtrajectories.
+
+# C.1 A VARIATIONAL OBJECTIVE FOR SUBTRAJECTORIES
+
+Consider a graded DAG $\mathscr { G } = ( S , \mathbb { A } )$ where $S = \bigsqcup _ { l = 0 } ^ { L } S _ { l } , S _ { 0 } = \{ s _ { 0 } \} , S _ { L } = \chi$ . Amongst the $L + 1$ layers $l = 0 , \ldots , L$ , we consider $K + 1 \ \leq \ L + 1$ special layers, that we call junction layers, of which the states are called hub states. We denote by $m _ { 0 } , \ldots , m _ { K }$ the indices of these layers, and we constrain $m _ { 0 } = 0$ to represent the layer comprised of the source state only, and $m _ { K } = L$ representing the terminating states $\chi$ . On each non-terminating junction layer $m _ { k } \neq L$ , we define a state flow function $F _ { k } : S _ { m _ { k } } \to \mathbb { R } _ { + } ^ { * }$ . Given any forward and backward policies $P _ { F }$ and $P _ { B }$ respectively, consistent with the DAG $\mathcal { G }$ , the state flow functions define two sets of distributions $\check { p } _ { k }$ and $\hat { p } _ { k }$ over partial trajectories starting from a state $s _ { m _ { k } } \in S _ { m _ { k } }$ and ending in a state $s _ { m _ { k + 1 } } \in S _ { m _ { k + 1 } }$ (we denote by $\mathcal { T } _ { k }$ the set comprised of these partial trajectories, for $k = 0 \ldots K - 1 ,$ :
+
+$$
+\begin{array} { r l } & { \forall \tau _ { k } = ( s _ { m _ { k } } \to . . . \to s _ { m _ { k + 1 } } ) \in \mathcal { T } _ { k } \quad \hat { p } _ { k } ( \tau _ { k } ) \propto F _ { k } ( s _ { m _ { k } } ) P _ { F } ( \tau _ { k } ) , } \\ & { \forall \tau _ { k } = ( s _ { m _ { k } } \to . . . \to s _ { m _ { k + 1 } } ) \in \mathcal { T } _ { k } \quad \check { p } _ { k } ( \tau _ { k } ) \propto F _ { k + 1 } ( s _ { m _ { k + 1 } } ) P _ { B } ( \tau _ { k } \mid s _ { m _ { k + 1 } } ) , } \end{array}
+$$
+
+where $F _ { K }$ is fixed to the target reward function $R$ .
+
+Lemma 1 If $\hat { p } _ { k } = \check { p } _ { k }$ for all $k = 0 \dots K - 1$ , then the forward policy $P _ { F }$ induces a terminating state distribution $P _ { F } ^ { \top }$ that matches the target unnormalized distribution (or reward function) $R$ .
+
+Proof Consider a complete trajectory $\tau = ( s _ { m _ { 0 } } \to . . . \to s _ { m _ { 1 } } \to . . . \to . . . s _ { m _ { 2 } } \to . . . \to . . . \to s _ { m _ { K } } ) .$ And let $\tau _ { k } = ( s _ { m _ { k } } \mathrm { . . . } \mathrm { . . } \mathrm { . . } ) s _ { m _ { k + 1 } } )$ , for every $k < K$ .
+
+Denote by $\hat { Z } _ { k }$ and $\check { Z } _ { k }$ the partition functions (constant of proportionality in (18)) of $\hat { p } _ { k }$ and $\check { p } _ { k }$ respectively, for every $k < K$ . It is straightforward to see that for every $0 < k < K$ :
+
+$$
+\hat { Z } _ { k + 1 } = \check { Z } _ { k } = \sum _ { s _ { m _ { k + 1 } } \in S _ { m _ { k + 1 } } } F _ { k + 1 } ( s _ { m _ { k + 1 } } )
+$$
+
+$$
+\prod _ { k = 0 } ^ { K - 1 } \hat { p } _ { k } ( \tau _ { k } ) = \frac { \prod _ { k = 0 } ^ { K - 1 } F _ { k } ( s _ { m _ { k } } ) } { \prod _ { k = 0 } ^ { K - 1 } \hat { Z } _ { k } } P _ { F } ( \tau ) ,
+$$
+
+$$
+\prod _ { k = 0 } ^ { K - 1 } \check { p } _ { k } ( \tau _ { k } ) = \frac { \prod _ { k = 0 } ^ { K - 1 } F _ { k + 1 } ( s _ { m _ { k + 1 } } ) } { \prod _ { k = 0 } ^ { K - 1 } \check { Z } _ { k } } P _ { B } ( \tau \mid s _ { m _ { K } } ) .
+$$
+
+Because $\hat { p } _ { k } = \check { p } _ { k }$ for all $k = 0 \dots K - 1$ , then both right-hand sides of (23) and (24) are equal. Combining this with (22), we obtain:
+
+$$
+\forall \tau \in \mathcal { T } \quad \underbrace { \frac { F _ { 0 } ( s _ { 0 } ) } { \hat { Z } _ { 0 } } } _ { = 1 } P _ { F } ( \tau ) = \frac { R ( x _ { \tau } ) } { \sum _ { x \in \mathcal { X } } R ( x ) } P _ { B } ( \tau \mid x ) ,
+$$
+
+which implies the TB constraint is satisfied for all $\tau \in \mathcal { T }$ . Malkin et al. (2022) shows that this is a sufficient condition for the terminating state distribution induced by $P _ { F }$ to match the target reward function $R$ , which completes the proof.
+
+Similar to NVI, we can use Lemma 1 to define objective functions for $P _ { F } , P _ { B } , F _ { k }$ , of the form:
+
+$$
+\mathcal { L } _ { \mathrm { S u b N V I } , f } ( P _ { F } , P _ { B } , F _ { 0 : K - 1 } ) = \sum _ { k = 1 } ^ { K - 1 } D _ { f } ( \check { p } _ { k } \| \hat { p } _ { k } )
+$$
+
+Note that the SubNVI objective of (26) matches the NVI objective (Zimmermann et al., 2021) when all layers are junction layers (i.e. $K = L$ , and $m _ { k } = k$ for all $k \leq L$ ), and matches the HVI objective of (5) when only the first and last layers are junction layers (i.e. $K = 1$ , $m _ { 0 } = 0$ , and $m _ { 1 } = L$ ).
+
+# C.2 AN EQUIVALENCE BETWEEN THE SUBNVI AND THE SUBTB OBJECTIVES
+
+Proposition 2 Given a graded DAG $\mathcal { G }$ as in $\ S 2 . I$ , with junction layers $m _ { 0 } = 0 , m _ { 1 } , \ldots , m _ { K } = L$ as in $\ S { C . I }$ . For any forward and backward policies, and for any positive function $F _ { k }$ defined for the hubs, consider $\hat { p } _ { k }$ and $\check { p } _ { k }$ defined in (20) and (21). The subtrajectory variational objectives of (26) are equivalent to the subtrajectory balance objective (17) for specific choices of the $f$ -divergences. Namely, denoting by $\theta , \phi$ the parameters of $P _ { F } , P _ { B }$ respectively:
+
+$$
+\begin{array} { r l } & { \mathbb { E } _ { \tau _ { k } \sim \check { p } _ { k } } [ \nabla _ { \phi } \mathcal { L } _ { \mathrm { S u b T B } } ( \tau _ { k } ; P _ { F } , P _ { B } , F ) ] = 2 \nabla _ { \phi } D _ { f _ { 1 } } ( \check { p } _ { k } \| \hat { p } _ { k } ) } \\ & { \mathbb { E } _ { \tau _ { k } \sim \hat { p } _ { k } } [ \nabla _ { \theta } \mathcal { L } _ { \mathrm { S u b T B } } ( \tau _ { k } ; P _ { F } , P _ { B } , F ) ] = 2 \nabla _ { \theta } D _ { f _ { 2 } } ( \check { p } _ { k } \| \hat { p } _ { k } ) } \end{array}
+$$
+
+where $F = F _ { 0 : K - 1 }$ , and $f _ { 1 } : t \mapsto t \log t$ and $f _ { 2 } : t \mapsto - \log t .$ .
+
+Proof For a subtrajectory ???? = (?????? → . . . →??????+1 ) ∈ T?? , let ??(???? ) = log ???? (?????? ) ???? ( ???? )????+1 (?????? ) ???? ( ???? |?????? ) . First, note that because $\hat { Z } _ { k }$ and $\check { Z } _ { k }$ are not functions of $\phi , \theta$ ((23)):
+
+$$
+\begin{array} { l } { { \nabla _ { \phi } c ( \tau _ { k } ) = - \nabla _ { \phi } \log \frac { F _ { k + 1 } ( s _ { m _ { k + 1 } } ) P _ { B } ( \tau _ { k } \mid s _ { m _ { k + 1 } } ) } { \check { Z } _ { k } } = - \nabla _ { \phi } \log \check { p } _ { k } ( \tau _ { k } ) } } \\ { { \nabla _ { \theta } c ( \tau _ { k } ) = \nabla _ { \theta } \log \frac { F _ { k } ( s _ { m _ { k } } ) P _ { F } ( \tau _ { k } ) } { \hat { Z } _ { k } } = \nabla _ { \phi } \log \hat { p } _ { k } ( \tau _ { k } ) } } \end{array}
+$$
+
+We will prove (27). The proof of (28) follows the same reasoning, and is left as an exercise for the reader.
+
+$$
+\begin{array} { r l } & { = - \underset { \tau \in \mathcal { P } _ { k } } { \sum } ( \nabla _ { \Phi } \phi _ { k } ( \tau _ { k } ) e ( \tau _ { k } ) + \tilde { \phi } _ { k } ( \tau _ { k } ) \nabla _ { \Phi } \epsilon ( \tau _ { k } ) ) , } \\ & { = - \underset { \tau \in \mathcal { P } _ { k } } { \sum } ( \phi _ { k } ( \tau _ { k } ) \nabla _ { \Phi } \epsilon ( \tau _ { k } ) e ( \tau _ { k } ) e ( \tau _ { k } ) + \tilde { \phi } _ { k } ( \tau _ { k } ) \nabla _ { \Phi } \epsilon ( \tau _ { k } ) ) } \\ & { = - \underset { \tau \in \mathcal { P } _ { k } } { \sum } ( \phi _ { k } ( \tau _ { k } ) \nabla _ { \Phi } \epsilon ( \tau _ { k } ) e ( \tau _ { k } ) e ( \tau _ { k } ) ) + \underset { \tau \in \mathcal { P } _ { k } } { \sum } ( \phi _ { \tau } ( \tau _ { k } ) \nabla _ { \Phi } \epsilon ( \tau _ { k } ) ) } \\ & { = - \underset { \tau \in \mathcal { P } _ { k } \setminus \mathcal { P } _ { k } } { \sum } [ \nabla _ { \Phi } \epsilon ] \nabla _ { \Phi } \epsilon ( \tau _ { k } ) \hat { \epsilon } ( \tau _ { k } ) , \quad \mathrm { R e t e r w h } ~ \tau _ { k } } \\ & { = - \underset { \tau \in \mathcal { P } _ { k } \setminus \mathcal { P } _ { k } } { \sum } [ \nabla _ { \Phi } \epsilon ] \nabla _ { \Phi } \hat { \epsilon } ( \tau _ { k } ) \hat { \epsilon } ( \tau _ { k } ) \hat { \epsilon } ( \tau _ { k } ) ] + \underset { \tau \in \mathcal { P } _ { k } \setminus \mathcal { P } _ { k } } { \sum } \hat { \phi } _ { k } ( \tau _ { k } ) } \\ & { = \mathrm { E } _ { \tau \to \Phi _ { k } } [ \nabla _ { \Phi } \mathrm { E } _ { \tau } ( \tau _ { k } ) \hat { \epsilon } _ { \mathrm { B o u t } } ] \underset { \tau \in \mathcal { P } _ { k } } { \sum } [ \nabla _ { \Phi } \epsilon _ { \tau _ { k } } ^ { ( 1 ) } ] , } \\ & = \mathrm { E } _ { \tau \to \Phi _ { k } } [ \nabla _ { \Phi } \mathrm { E } _ { \tau } ( \tau _ { k } ) \hat { \epsilon } _ { \mathrm { B o u t } } \end{array}
+$$
+
+As a special case of Prop. 2, when the state flow function is defined for $s _ { 0 }$ only (and for the terminating states, at which it equals the target reward function), i.e. when $K = 1$ , the distribution $\hat { p } _ { 0 } ( \tau )$ and $\bar { P } _ { F } ( \tau )$ are equal, and so are the distributions $\check { p } _ { 0 } ( \tau )$ and $P _ { B } ( \tau )$ . We thus obtain the first two equations of Prop. 1 as a consequence of Prop. 2.
+
+# D ADDITIONAL EXPERIMENTAL DETAILS
+
+# D.1 HYPERGRID EXPERIMENTS
+
+Details about the environment For completeness, we provide more details about the environment, as explained in Malkin et al. (2022). In a $D$ -dimension hypergrid of side length $H$ , the state space $s$ is partitioned into the non-terminating states $S ^ { o } = \{ 0 , \dots , H - 1 \} ^ { D }$ and terminating states $\bar { \chi } = S ^ { \top } = \{ 0 , \dots , H - 1 \} ^ { D }$ . The initial state is ${ \bf 0 } _ { \mathbb { R } ^ { D } } = ( 0 , \ldots , 0 ) \in S ^ { o }$ , and in addition to the transitions from a non-terminating state to another (by incrementing one coordinate of the state), an “exit” action is available for all $s \in S ^ { o }$ , that leads to a terminating state $s ^ { \top } \in S ^ { \top }$ . The reward at a terminating state $s ^ { \top } = ( s ^ { 1 } , \ldots , s ^ { D } ) ^ { \top }$ is:
+
+$$
+R ( s ^ { \top } ) = R _ { 0 } + 0 . 5 \prod _ { d = 1 } ^ { D } \mathbf { 1 } \left[ \left| \frac { s ^ { d } } { H - 1 } - 0 . 5 \right| \in ( 0 . 2 5 , 0 . 5 ] \right] + 2 \prod _ { d = 1 } ^ { D } \mathbf { 1 } \left[ \left| \frac { s ^ { d } } { H - 1 } - 0 . 5 \right| \in ( 0 . 3 , 0 . 4 ) \right] ,
+$$
+
+where $R _ { 0 }$ is an exploration parameter (lower values indicate harder exploration).
+
+Architectural details The forward and backward policies are parametrized as neural networks with 2 hidden layers of 256 units each. The neural networks take as input a one-hot representation of a a state (also called K-hot, or multi-hot representations), which is a $H { \times } D$ vector including exactly $D$ ones and $( H - 1 ) D$ zeros, and output the logits of $P _ { F }$ and $P _ { B }$ respectively. Forbidden actions (e.g. when a coordinate is already maxed out at $H - 1$ ) are masked out by setting the corresponding logits to $- \infty$ after the forward pass. Unlike Malkin et al. (2022), we do not tie the parameters of $P _ { F }$ and $P _ { B }$ .
+
+
+Figure D.1: A comparison of the the type of baseline used (local or global) for the three HVI algorithms that use a score function estimator of the gradient.
+
+Behavior policy The behavior policy is obtained from the forward policy $P _ { F }$ by subtracting a scalar $\epsilon$ from the logits output by the forward policy neural network. The value of $\epsilon$ is decayed from $\epsilon _ { i n i t }$ to 0 following a cosine annealing schedule (Loshchilov $\&$ Hutter, 2017), and the value $\epsilon = 0$ is reached at an iteration $T _ { m a x }$ . The values of $\epsilon _ { i n i t }$ and $T _ { m a x }$ were treated as hyperparamters.
+
+Hyperparameter optimization Our experiments have shown that HVI objectives were brittle to the choice of hyperparameters (mainly learning rates), and that the ones used for Trajectory Balance in Malkin et al. (2022) do not perform as well in the larger $1 2 8 \times 1 2 8$ grid we considered. To obtain a fair comparison between GFlowNets and HVI methods, a particular care was given to the optimization of hyperparameters in this domain. The optimization was performed in two stages:
+
+1. We use a batch size of 64 for all learning objectives, whether on-policy or off-policy, and the Adam optimizer with secondary parameters set to their default values, for the parameters of $P _ { F }$ , the parameters of $P _ { B }$ , and $\log Z$ (which is initialized at 0). The learning rates of $P _ { F } , P _ { B } , \log Z$ , along with a schedule factor $\gamma ~ < ~ 1$ by which they are multiplied when the JSD plateaus for more than 500 iterations (i.e. $5 0 0 \times 6 4$ trajectories sampled), were sought after separately for each combination of learning objective and sampling method (on-policy or off-policy), using a Bayesian search with the JSD evaluated at $2 0 0 K$ trajectories as an optimization target. The choice of the baseline for HVI methods (except WS, that does not have a score function estimator of the gradient) was treated as a hyperparameter as well.
+2. All objectives were then trained for $1 0 ^ { 6 }$ trajectories using all the combinations of hyperparameters found in the first stage, for 5 seeds each. The final set of hyperparameters for each objective and sampling mode was then chosen as the one that leads to the lowest area under the JSD curve (approximated with the trapezoids method).
+
+For off-policy runs, $T _ { m a x }$ was defined as a fraction $1 / n$ of the total number of iterations (which is equal to $1 0 ^ { 6 } / 6 4 $ ). The value of $n$ and $\epsilon _ { i n i t }$ was optimized the same way as the learning rate and the schedule, as described above.
+
+In Fig. D.1, we illustrate the differences between the two types of baselines considered (global and local) for the 3 algorithms that use a score function estimator of the gradient, both on-policy and off-policy.
+
+Smaller environments: The environment studied in the main body of text ( $1 2 8 \times 1 2 8$ , with $R _ { 0 } = 1 0 ^ { - 3 }$ ) already illustrates some key differences between the Forward and Reverse KL objectives. As a sanity check for the HVI methods that failed to converge in this challenging environment, we consider two alternative grids: $6 4 \times 6 4$ and $8 \times 8 \times 8 \times 8$ , both with an easier exploration parameter $( R _ { 0 } = 0 . 1 )$ , and compare the 5 algorithms on-policy on these two extra domains. Additionally, for the two-dimensional domain $( 6 4 \times 6 4 )$ , we illustrate in Fig. D.2 a visual representation of the average distribution obtained after sampling $1 0 ^ { 6 }$ trajectories, for each method separately. Interestingly, unlike the hard exploration domain, the two algorithms with the mode-seeking KL (REVERSE KL and REVERSE WS) converge to a lower JSD than the mean-seeking KL algorithms (FORWARD KL and WS), and are on par with TB.
+
+# D.2 MOLECULE EXPERIMENTS
+
+Most experiment settings were identical to those of Malkin et al. (2022), in particular, the reward model $f$ the held-out set of molecules used to compute the performance metric, the GFlowNet model architecture (a graph neural network introduced by by Bengio et al. (2021a)), and the off-policy exploration rate. All models were trained with the Adam optimizer and batch size 4 for a maximum of 50000 batches. The metric was computed after every 5000 batches and the last computed value of the metric was reported, which was sometimes not the value after 50000 batches when the training runs terminated early because of numerical errors.
+
+
+Figure D.2: Top: The evolution of the JSD between the learned sampler $P _ { F } ^ { \top }$ and the target distribution on the $\phantom { + } 8 \times \phantom { + } 8 \times 8 \times 8$ grid left and the $6 4 \times 6 4$ grid right. Trajectories are sampled on-policy. Shaded areas represent the standard error evaluated across 5 different runs Bottom: The average (across 5 runs) final learned distribution $P _ { F } ^ { \top }$ for the different algorithms, along with the target distribution. To amplify variation, the plot intensity at each grid position is resampled from the Gaussian approximating the distribution over the 5 runs.
+
+# D.3 BAYESIAN STRUCTURE LEARNING EXPERIMENTS
+
+Bayesian Networks A Bayesian Network is a probabilistic model where the joint distribution over $d$ random variables $\{ X _ { 1 } , \ldots , X _ { d } \}$ factorizes according to a directed acyclic graph (DAG) $G$ :
+
+$$
+p ( X _ { 1 } , \dots , X _ { d } ) = \prod _ { i = 1 } ^ { d } p ( X _ { i } \mid \operatorname { P a } _ { G } ( X _ { i } ) ) ,
+$$
+
+where $\mathrm { P a } _ { G } ( X _ { i } )$ is the set of parent variables of $X _ { i }$ in the graph $G$ . Each conditional distribution in the factorization above is also associated with a set of parameters $\theta \in \Theta$ . The structure $G$ of the Bayesian Network is often assumed to be known. However, when the structure is unknown, we can learn it based on a dataset of observation $\mathcal { D }$ : this is called structure learning.
+
+Structure of the state space We use the same structure of graded DAG $\mathcal { G }$ as the one described in (Deleu et al., 2022), where each state of $\mathcal { G }$ is itself a DAG $G$ , and where actions correspond to adding one edge to the current graph $G$ to transition to a new graph $G ^ { \prime }$ . Only the actions maintaining the acyclicity of $G ^ { \prime }$ are considered valid; this ensures that all the states are well-defined DAGs, meaning that all the states are terminating here (we define a distribution over DAGs). Similar to the hypergrid environment, the action space also contains an extra action “stop” to terminate the generation process, and return the current graph as a sample of our distribution; this “stop” action is denoted $G \stackrel { \cdot } { \to } G ^ { \top }$ , to follow the notation introduced in $\ S 2 . 1$ .
+
+Reward function Our objective in Bayesian structure learning is to approximate the posterior distribution over DAGs $p ( \boldsymbol { \dot { G } } \mid \boldsymbol { \mathcal { D } } )$ , given a dataset of observations $\mathcal { D }$ . Since our goal is to find a forward policy $P _ { F }$ for which $P _ { \cal F } ^ { \top } ( G ) \propto R ( G )$ (see $\ S 2 . 1 )$ , we can define the reward function as the joint distribution $R ( G ) = p ( G , { \overset { \cdot } { \mathcal { D } } } ) = p ( { \mathcal { D } } \mid G ) p ( G )$ , where $p ( G )$ is a prior over graphs (assumed to be uniform throughout the paper), and $p ( \mathcal { D } \mid G )$ is the marginal likelihood. Since the marginal likelihood involves marginalizing over the parameters of the Bayesian Network
+
+$$
+p ( { \mathcal { D } } \mid G ) = \int _ { \Theta } p ( { \mathcal { D } } \mid \theta , G ) p ( \theta \mid G ) d \Theta ,
+$$
+
+it is in general intractable. We consider here a special class of models, called linear-Gaussian models, where the marginal likelihood can be computed in closed form; for this class of models, the log-marginal likelihood is also called the BGe score (Geiger & Heckerman, 1994; Kuipers et al., 2014) in the structure learning literature.
+
+
+Figure D.3: Comparison of edge marginals computed using the target posterior distribution and using the posterior approximations found either with the GFlowNet objectives, or REVERSE KL. Performance is reported as the Root Mean Square Error (RMSE) between the marginals (lower is better).
+
+For each experiment, we sampled a dataset $\mathcal { D }$ of 100 samples from a randomly generated Bayesian network. The (ground truth) structure of the Bayesian Network was generated following an Erdos- ˝ Renyi model, with about ´ $d$ edges on average (to encourage sparsity on such small graphs with $d \leq 5$ ). Once the structure is known, the parameters of the linear-Gaussian model were sampled randomly from a standard Normal distribution $N ( 0 , 1 )$ . See (Deleu et al., 2022) for more details about the data generation process. For each setting (different values of $d$ ) and each objective, we repeated the experiment over 20 different seeds.
+
+Forward policy Deleu et al. (2022) parametrized the forward policy $P _ { F }$ using a linear transformer, taking all the $d ^ { 2 }$ possible edges in the graph $G$ as an input, and returning a probability distribution over those edges, where the invalid actions were masked out. We chose to parametrize $P _ { F }$ using a simpler neural network architecture, based on a graph neural network (Battaglia et al., 2018). The GNN takes the graph $G$ as an input, where each node of the graph is associated with a (learned) embedding, and it returns for each node $X _ { i }$ a pair of embeddings $\pmb { u } _ { i }$ and $\nu _ { i }$ . The probability of adding an edge $X _ { i } X _ { j }$ to transition from $G$ to $G ^ { \prime }$ (given that we do not terminate in $G$ ) is then given by
+
+$$
+P _ { F } ( G ^ { \prime } \mid G , \neg G ^ { \top } ) \propto \exp ( \pmb { u } _ { i } ^ { \top } \pmb { \nu } _ { j } ) ,
+$$
+
+assuming that $X _ { i } ~ ~ X _ { j }$ is a valid action (i.e., it doesn’t introduce a cycle in $G$ ), and where the normalization depends only on all the valid actions. We then use a hierarchical model to obtain the forward policy $P _ { F } ( G ^ { \prime } \mid G )$ , following (Deleu et al., 2022):
+
+$$
+P _ { F } ( G ^ { \prime } \mid G ) = ( 1 - P _ { F } ( G ^ { \top } \mid G ) ) P _ { F } ( G ^ { \prime } \mid G , \neg G ^ { \top } ) .
+$$
+
+Recall that the backward policy $P _ { B }$ is fixed here, as the uniform distribution over the parents of $G$ (i.e. all the graphs were exactly one edge has been removed from $G$ ).
+
+(Modified) Detailed Balance objective For completeness, we recall here the modified Detailed Balance (DB) objective (Deleu et al., 2022) as a special case of the DB objective (Bengio et al., 2021b; see also (16)) when all the states of $\mathcal { G }$ are terminating (which is the case in our Bayesian structure learning experiments):
+
+$$
+\mathcal { L } _ { ( M ) D B } ( G \to G ^ { \prime } ; P _ { F } , P _ { B } ) = \left( \log \frac { R ( G ^ { \prime } ) P _ { B } ( G \mid G ^ { \prime } ) P _ { F } ( G ^ { \top } \mid G ) } { R ( G ) P _ { F } ( G ^ { \prime } \mid G ) P _ { F } ( G ^ { \top } \mid G ) } \right) ^ { 2 } .
+$$
+
+Optimization Following (Deleu et al., 2022), we used a replay buffer for all our off-policy objectives ((Modified) DB, TB, and REVERSE KL). All the objectives were optimized using a batch size of 256 graphs sampled either on-policy from $P _ { F }$ , or from the replay buffer. We used the Adam optimizer, with the best learning rate found among $\{ 1 0 ^ { - 6 } , 3 \times 1 0 ^ { - 6 } , 1 0 ^ { - 5 } , 3 \times 1 0 ^ { - 5 } , 1 0 ^ { - 4 } \}$ . For the TB objective, we learned $\log Z$ using SGD with a learning rate of 0.1 and momentum 0.8.
+
+Edge marginals In addition to the Jensen-Shannon divergence (JSD) between the true posterior distribution $p ( G \mid { \mathcal { D } } )$ and the posterior approximation $P _ { F } ^ { \top } \bar { ( G ) }$ (see $\ S \mathrm { E }$ for details about how this divergence is computed), we also compare the edge marginals computed with both distributions. That is, for any edge $X _ { i } \to X _ { j }$ in the graph, we compare
+
+$$
+p ( X _ { i } \to X _ { j } \mid \mathcal D ) = \sum _ { G \mid X _ { i } \in \mathrm { P a } _ { G } ( X _ { j } ) } p ( G \mid \mathcal D ) \mathrm { ~ a n d ~ } P _ { F } ^ { \top } ( X _ { i } \to X _ { j } ) = \sum _ { G \mid X _ { i } \in \mathrm { P a } _ { G } ( X _ { j } ) } P _ { F } ^ { \top } ( G ) .
+$$
+
+The edge marginal quantifies how likely an edge $X _ { i } X _ { j }$ is to be present in the structure of the Bayesian Network, and is of particular interest in the (Bayesian) structure learning literature. To measure how accurate the posterior approximation $P _ { F } ^ { \top }$ is for the different objectives considered here, we use the Root Mean Square Error (RMSE) between $p ( X _ { i } \to X _ { j } \mid \mathcal { D } )$ and $P _ { F } ^ { \top } ( X _ { i } X _ { j } )$ , for all possible pairs of nodes $( X _ { i } , X _ { j } )$ in the graph.
+
+Fig. D.3 shows the RMSE of the edge marginals, for different GFlowNet objectives and REVERSE KL (denoted as HVI here for brevity). The results on the edge marginals largely confirm the observations made in $\ S 4 . 3$ : the off-policy GFlowNet objectives ((Modified) DB & TB) consistently perform well across all experimental settings; On-Policy TB & On-Policy REVERSE KL perform similarly and degrade as the complexity of the experiment increases (as $d$ increases); and Off-Policy REVERSE KL has a performance that degrades the most as the complexity increases, where the edge marginals given by $P _ { F } ^ { \top } ( X _ { i } X _ { j } )$ do not match the true edge marginals $p ( X _ { i } \mid \mid X _ { j } \mid \mathcal { D } )$ accurately.
+
+# E METRICS
+
+Evaluation of the terminating state distribution $P _ { F } ^ { \top }$ : When the state space is small enough (e.g. graphs with $d \leq 5$ nodes in the Structure learning experiments, or a 2-D hypergrid with length 128, as in the Hypergrid experiments), we can propagate the flows in order to compute the terminating state distribution $P _ { F } ^ { \top }$ from the forward policy $P _ { F }$ . This is done using a flow function $F$ defined recursively:
+
+$$
+F ( s ^ { \prime } ) = { \left\{ \begin{array} { l l } { 1 } & { { \mathrm { i f ~ } } s ^ { \prime } = s _ { 0 } } \\ { \sum _ { s \in P a r ( s ^ { \prime } ) } F ( s ) P _ { F } ( s ^ { \prime } \mid s ) } & { { \mathrm { o t h e r w i s e } } } \end{array} \right. }
+$$
+
+$P _ { F } ^ { \top }$ is then given by:
+
+$$
+P _ { F } ^ { \top } ( s ^ { \top } ) \propto F ( s ) P _ { F } ( s ^ { \top } \mid s ) ,
+$$
+
+The recursion can be carried out by dynamic programming, by enumerating the states in any topological ordering consistent with the graded DAG $\mathcal { G }$ . In particular, computation of the flow at a given terminating state $s$ is linear in the number of states and actions that lie on trajectories leading to $s$ and computation of the full distribution $P _ { F } ^ { \top }$ is linear in $| S | + | \mathbb { A } |$ .
+
+Evaluation of the Jensen-Shannon divergence (JSD) Similarly, when the state space is small enough, the target distribution $P ^ { \top } = R / Z ^ { * }$ can be evaluated exactly, given that the marginalization is over $\chi$ only. The JSD is a symmetric divergence, thus motivating our choice. The JSD can directly be evaluated as:
+
+$$
+\begin{array} { l } { { \displaystyle J S D ( P ^ { \top } \| P _ { F } ^ { \top } ) = \frac { 1 } { 2 } \left( D _ { \mathrm { K L } } ( P ^ { \top } \| M ) + D _ { \mathrm { K L } } ( P _ { F } ^ { \top } \| M ) \right) \quad \mathrm { w h e r e ~ } M = ( P ^ { \top } + P _ { F } ^ { \top } ) / 2 } } \\ { { \displaystyle \qquad = \frac { 1 } { 2 } \sum _ { s \in S ^ { o } } \left( P ^ { \top } ( s ) \log \frac { 2 P ^ { \top } ( s ) } { P ^ { \top } ( s ) + P _ { F } ^ { \top } ( s ) } + P _ { F } ^ { \top } ( s ) \log \frac { 2 P _ { F } ^ { \top } ( s ) } { P ^ { \top } ( s ) + P _ { F } ^ { \top } ( s ) } \right) } } \end{array}
+$$
+
+# F EXTENSION TO CONTINUOUS DOMAINS
+
+As a first step towards understanding GFlowNets with continuous action spaces, we perform an experiment on a stochastic control problem. The goal of this experiment is to explore whether the observations in the main text may hold in continuous settings as well.
+
+We consider an environment in which an agent begins at the point $\mathbf { x } _ { 0 } = \mathbf { \left( 0 , 0 \right) }$ in the plane and makes a sequence of $K = 1 0$ steps over the time interval [0, 1], through points $\mathbf { x } _ { 0 . 1 } , \mathbf { x } _ { 0 . 2 } , \ldots , \mathbf { x } _ { 1 }$ . Each step from $\mathbf { X } _ { t }$ to ${ \bf X } _ { t + 0 . 1 }$ is Gaussian with learned mean depending on $\mathbf { X } _ { t }$ and $t$ and with fixed variance; the variance is isotropic with standard deviatio n 12√?? . Equivalently, the agent samples the Euler-Maruyama discretization with interval $\begin{array} { r } { \Delta t { } = \frac { 1 } { K } } \end{array}$ of the Ito stochastic differential equation ˆ
+
+$$
+d \mathbf x _ { t } = f ( \mathbf x _ { t } , t ) d t + \frac 1 2 d \mathbf w _ { t } ,
+$$
+
+where $\mathbf { w } _ { t }$ is the two-dimensional Wiener process.
+
+The choice of the drift function $f$ determines the marginal density of the final point, $\mathbf { X } _ { 1 }$ . We aim to find $f$ such that this marginal density is proportional to a given reward function, in this case a quantity proportional to the density function of the standard 8gaussians distribution, shown in Fig. F.2. We scale the distribution so that the modes of the 8 Gaussian components are at a distance of 2 from the origin and their standard deviations are 0.25.
+
+In GFlowNet terms, the set of states is $S = \{ ( \mathbf { 0 } , 0 ) \} \cup \{ ( \mathbf { x } , t ) : \mathbf { x } \in \mathbb { R } ^ { 2 } , t \in \{ 0 . 1 , 0 . 2 , \dots , 1 \} \}$ . States with $t = 1$ are terminating. There is an action from $\mathbf { \Psi } ( \mathbf { x } , t )$ to $( \mathbf { x } ^ { \prime } , t ^ { \prime } )$ if and only if $t ^ { \prime } = t + \Delta t$ . The forward policy is given by a conditional Gaussian:
+
+$$
+P _ { F } ( ( \mathbf { x } ^ { \prime } , t + \Delta t ) \mid ( \mathbf { x } , t ) ) = N \left( \mathbf { x } ^ { \prime } - \mathbf { x } ; f ( \mathbf { x } , t ) \Delta t , \left( \frac { \sqrt { \Delta t } } { 2 } \right) ^ { 2 } \right) .
+$$
+
+We impose a conditional Gaussian assumption on the backward policy as well, i.e.,
+
+$$
+P _ { B } ( ( \mathbf { x } , t ) \mid ( \mathbf { x ^ { \prime } } , t + \Delta t ) ) = \left\{ \begin{array} { l l } { N \left( \mathbf { x } - \mathbf { x ^ { \prime } } ; \mu _ { B } ( \mathbf { x ^ { \prime } } , t + \Delta t ) \Delta t , \sigma _ { B } ^ { 2 } ( \mathbf { x ^ { \prime } } , t + \Delta t ) \Delta t \right) } & { t \neq 0 } \\ { 1 } & { t = 0 } \end{array} \right. ,
+$$
+
+where $\mu _ { B }$ and $\log \sigma _ { B } ^ { 2 }$ are learned. Notice that all the policies, except the backward policy from time $\frac { 1 } { K }$ to time 0, now represent probability densities; states can have uncountably infinite numbers of children and parents.
+
+We parametrize the three functions $f , \mu _ { B } , \log \sigma _ { B } ^ { 2 }$ as small (two hidden layers, 64 units per layer) MLPs taking as input the position $\mathbf { X }$ and an embedding of the time $t$ . Their parameters can be optimized using any of the five algorithms in Table 1 of the main text.3 Fig. F.1 shows the marginal densities of $\mathbf { X } _ { t }$ (estimated using KDE) for different $t$ in one well-trained model, as well as some sampled points and paths.
+
+In addition to training on policy, we consider exploratory training policies that add Gaussian noise to the mean of each transition distribution. We experiment with adding standard normal noise scaled by $\sigma _ { \mathrm { e x p } }$ , where $\sigma _ { \mathrm { e x p } } \in \{ 0 , 0 . 1 , 0 . 2 \}$ .
+
+Fig. F.2 compares the marginal densities obtained using different algorithms with on-policy and offpolicy training. The algorithms that use a forward KL objective to learn $P _ { B }$ – namely, REVERSE WS and FORWARD KL – are not shown because they encounter NaN values in the gradients early in training, even when using a $1 0 \times$ lower learning rate than that used for all other algorithms $1 0 ^ { - 3 }$ for the parameters of $f , \mu _ { B } , \log \sigma _ { B } ^ { 2 }$ and $1 0 ^ { - 1 }$ for the $\log Z$ parameter of the GFlowNet).
+
+These results suggest that the observations made for discrete-space GFlowNets in the main text may continue to hold in continuous settings. The first two rows of Fig. F.2 show that off-policy exploration is essential for finding the modes and that TB achieves a better fit to the target distribution. Just as in Fig. 1, although all modes are found by WAKE-SLEEP, they are modeled with lower precision, appearing off-centre and having an oblong shape, which is reflected in the slightly higher MMD.
+
+
+Figure F.1: Above: KDE (2560 samples, bandwidth 0.25) of the agent’s position after $i$ steps for $i = 0$ , 1, . . . , 10 $( t = 0 , 0 . 1 , \ldots , 1 )$ ) for a model trained with off-policy TB, showing a close match to the target distribution (also convolved with the KDE kernel for fair comparison). Below: A sample of 2560 points from the trained model and the trajectories taken by 128 of the points.
+
+
+Figure F.2: KDE of learned marginal distributions with various algorithms and exploration policies and MMD with Gaussian kernel exp $( - \| \mathbf x - \mathbf y \| ^ { 2 } )$ estimated using 2560 samples.
\ No newline at end of file
diff --git a/md/dev/uLYc4L3C81A/uLYc4L3C81A.md b/md/dev/uLYc4L3C81A/uLYc4L3C81A.md
new file mode 100644
index 0000000000000000000000000000000000000000..7f1ffa62dfab494c5bd7497c1a1c85788cd0a6d1
--- /dev/null
+++ b/md/dev/uLYc4L3C81A/uLYc4L3C81A.md
@@ -0,0 +1,418 @@
+# Confident Adaptive Language Modeling
+
+Tal Schuster1,⇤ Adam Fisch2,⇤ Jai Gupta1
+
+Mostafa Dehghani1 Dara Bahri1 Vinh Q. Tran1 Yi Tay1 Donald Metzler1
+
+1Google Research 2CSAIL, MIT
+
+# Abstract
+
+Recent advances in Transformer-based large language models (LLMs) have led to significant performance improvements across many tasks. These gains come with a drastic increase in the models’ size, potentially leading to slow and costly use at inference time. In practice, however, the series of generations made by LLMs is composed of varying levels of difficulty. While certain predictions truly benefit from the models’ full capacity, other continuations are more trivial and can be solved with reduced compute. In this work, we introduce Confident Adaptive Language Modeling (CALM), a framework for dynamically allocating different amounts of compute per input and generation timestep. Early exit decoding involves several challenges that we address here, such as: (1) what confidence measure to use; (2) connecting sequence-level constraints to local per-token exit decisions; and (3) attending back to missing hidden representations due to early exits in previous tokens. Through theoretical analysis and empirical experiments on three diverse text generation tasks, we demonstrate the efficacy of our framework in reducing compute—speedup of up to $\times 3 .$ —while provably maintaining high performance.
+
+# 1 Introduction
+
+Recent advances in Large Language Models (LLMs) have led to breakthroughs in language understanding and language generation across almost every widely-used Natural Language Processing (NLP) task considered in the field today [5; 15; 17; 20; 51; 52; 53; 75; 89; 73]. Autoregressive language modeling provides a flexible framework for solving complex tasks with a unified natural language input and output format, while also relaxing the need for large-scale task-specific data collection and training [67; 15; 17; 58; 80]. The large size of LLMs, however, results in massive computational load that might be limiting for certain real-world applications (e.g., machine translation) [9; 30; 42; 49; 59; 63; 71]. This is especially pronounced in the autoregressive decoding process where the full stack of Transformer layers is repeatedly computed for each output token [37; 40; 86].
+
+While large models do better in general, the same amount of computation may not be required for every input to achieve similar performance (e.g., depending on if the input is easy or hard) [66]. Early exiting is a promising approach to decreasing the computational cost of multilayered architectures such as those used in Transformer-based LLMs, where the number of layers used by the model is dynamically decided on an input-by-input basis [18; 23; 57; 60; 70]. In this setting, an LLM can choose to generate a new token based off the representation at an intermediate layer instead of using the full model, and save computation as a result. A natural question that arises, however, is when is it a good decision to exit early, as opposed to wait? Naively choosing when to exit can be suboptimal in terms of saving computation time, and also result in unpredictable degradations to model performance, especially when predictions depend on each other, as in autoregressive language generation.
+
+
+Figure 1: Illustration of CALM generation (see Figure 4 for the full example) with local per-token early exiting decisions that provably satisfy global user-defined constraints on the full sequence.
+
+In this work, we analyze the early exiting paradigm for LLMs, and present a principled method for increasing model efficiency while remaining confident in the quality of the resulting predictions. Specifically, we develop a method for calibrating local, per-token, exit decisions such that global, sequence-level constraints—as determined by lexical or semantic sequence-level metrics like ROUGE or BLEURT score—are provably maintained with arbitrarily high probability (e.g., $9 5 \%$ ). This process, which we call Confident Adaptive Language Modeling (CALM), is illustrated in Figure 1.
+
+Our approach leverages recent techniques in distribution-free risk control in order to create confident generations with strong statistical guarantees [2; 3; 10]. Concretely, suppose we have been given a calibration set $S _ { \mathrm { c a l } } : = \{ P _ { i } \} _ { i = 1 } ^ { n } \in \mathcal { P } ^ { n }$ of independent and identically distributed (i.i.d.) prompts to our LLM (e.g., paragraphs to be summarized, sentences to be translated, or questions to be answered via language modeling). Let $P _ { \mathrm { t e s t } }$ be a new i.i.d. test prompt to our LLM, where $Y _ { \mathrm { e a r l y } } : =$ $\mathbf { L L M } _ { \mathrm { e a r l y } } ( P _ { \mathrm { t e s t } } )$ and $Y _ { \mathrm { f u l l } } : = \mathrm { L L M } _ { \mathrm { f u l l } } ( P _ { \mathrm { t e s t } } )$ are the adaptive and standard outputs of our LLM, respectively. In order to be satisfied with $Y _ { \mathrm { e a r l y } }$ , we might require it to be textually consistent with $Y _ { \mathrm { f u l l } }$ . Given any bounded text dissimilarity function $\mathcal { D }$ , we aim to calibrate the early-exiting LLM such that its predictions agree to a tolerance $\delta$ with the full model in expectation with high probability,
+
+$$
+\begin{array} { r } { \mathbb { P } \Big ( \mathbb { E } \big [ \mathcal { D } ( Y _ { \mathrm { e a r l y } } , Y _ { \mathrm { f u l l } } ) \big ] \leq \delta \mid \mathcal { S } _ { \mathrm { c a l } } \Big ) \geq 1 - \epsilon , } \end{array}
+$$
+
+where the randomness is over draws of $ { S _ { \mathrm { c a l } } }$ , and $\epsilon \in ( 0 , 1 )$ . Eq. (1) has the significant advantage of being achievable using only unlabeled calibration data $ { S _ { \mathrm { c a l } } }$ (a quality that is critical for fewshot tasks, for example). Enforcing textual consistency with the original $Y _ { \mathrm { f u l l } }$ , however, may be unnecessarily strict for certain tasks, especially where multiple generations may be acceptable. As an alternative, given a calibration set of prompts paired with a set of (potentially multiple) target references, $\bar { S _ { \mathrm { c a l } } } : = \{ ( P _ { i } , Z _ { i } ) \} _ { i = 1 } ^ { n } \in ( \mathcal { P } \times 2 ^ { \mathcal { V } } ) ^ { \bar { n } }$ , and any bounded risk function $\mathcal { R }$ , we also consider an objective that enforces risk consistency by limiting the relative increase in risk of the predictions $Y _ { \mathrm { e a r l y } }$ compared to $Y _ { \mathrm { f u l l } }$ , with respect to the set of test-time references $Z _ { \mathrm { t e s t } }$ , i.e.,
+
+$$
+\mathbb { P } \Big ( \mathbb { E } \big [ \mathcal { R } ( Y _ { \mathrm { e a r l y } } , Z _ { \mathrm { t e s t } } ) - \mathcal { R } ( Y _ { \mathrm { f u l l } } , Z _ { \mathrm { t e s t } } ) \big ] \leq \delta \big | \ S _ { \mathrm { c a l } } \Big ) \geq 1 - \epsilon .
+$$
+
+Within the constraints of either Eq. (1) or Eq. (2), the goal of our work is to find the most computationally efficient $Y _ { \mathrm { e a r l y } }$ , i.e., generations that exit as early as possible while still maintaining our desired performance guarantees. In order to achieve this, it is necessary to develop a reliable signal for how likely local, per-token early-exit decisions are to disrupt the global properties of the complete sequence. Here, we first analyze how errors are propagated in Transformer-based LLMs, and then present an effective and efficient scoring mechanism for assigning “consistent early-exit” confidence scores after each layer used during the generation of a new token. The decision to exit or not is based on these scores, and is carefully calibrated using $ { S _ { \mathrm { c a l } } }$ such that our performance bounds are provably satisfied.
+
+Finally, we empirically validate our method on multiple, diverse NLP generation tasks, including text summarization, machine translation, and question answering. Our experiments demonstrate the potential of CALM in reducing the average complexity of the model and accelerating inference by about $\times 3$ while reliably controlling for high performance.
+
+Contributions. In summary, our main contributions are as follows:
+
+• A framework (CALM) for reliably accelerating Transformer-based LLM generations. • A systematic analysis of the token-wise early exit mechanism that motivates a simple-but-effective class of confidence measures and threshold functions that are used as part of the CALM framework. • An empirical demonstration of CALM’s efficiency gains on three diverse generation datasets.
+
+# 2 Related Work
+
+Improving inference-time efficiency of LLMs has been an ongoing effort of the research community over the past several years [49; 72; 85], leveraging techniques such as knowledge distillation [6; 32; 36; 69; 69; 78; 56], floating point quantization [71; 65], layer pruning [24], vector dropping [38], and others [41]. Another line of work involves conditional computation to train larger models that only use a sparser subset of the full network during inference, for example by routing over mixture-ofexperts [9; 22; 39; 91], recurring modules [18; 29; 35], or accessing external memory [82]. These models, however, still use the same amount of compute for all input examples.
+
+Here, we focus on adaptive compute, a specific kind of conditional compute that aims to dynamically allocate different computational power per example, with the goal of reducing the overall complexity while maintaining high performance. This approach, often referred to as early-exiting [16; 25; 47; 74; 79; 87], is complementary to many of the solutions above and can potentially be combined with them. Multiple early-exit techniques for encoder-only Transformers (e.g., BERT [20]) have been recently proposed [8; 34; 43; 44; 45; 60; 68; 83; 90; 92]. Most of these methods rely on intrinsic confidence measures (e.g., based on the softmax distribution), while others try to predict the routing in advance [46; 70], or train a small early-exit classifier [57; 84], as we also examine here. These measures can be calibrated to reliably guarantee consistency of the early prediction with the full model [57]. However, the techniques used for encoder-only classifiers are unsuitable for global consistency constraints with a sequence of dependent predictions, which are inherent in the decoding process of autoregressive language models, which we address here.
+
+Our work is also motivated by recent findings on the existence of saturation events in LMs, where the top-ranked prediction is unchanged after some layer and is propagated upward. Geva et al. [28] examined interactions of the hidden-state with feed-forward layers to predict these events. However, they only consider local single predictions and do not address the challenges involved with sequence generation. Our early-exit LM architecture most closely relates to Elbayad et al. [23], who found a tokenlevel early-exit classifier to provide the best efficiency-performance tradeoffs on machine translation. Here, we introduce a theoretically-grounded calibration method for provably controlling the quality of the full sequence. By doing so, we provide reliable efficiency gains—deriving local early exiting decisions from the global desirable constraints. Moreover, we introduce several model improvements and empirical analyses, including (1) analyzing the primary sources of performance degradation, leading us to propose a decaying threshold function for better tradeoff control without inflating the search space; (2) improving the early-exit classifier training; and (3) experimenting with two new tasks.
+
+Our calibration procedure for connecting global constraints to local decisions, relates to recent research around distribution-free uncertainty quantification [1; 62; 77]. Several methods were developed in recent studies to expand and adjust the theoretical framework for obtaining practical efficiency gains on target applications [4; 7; 21; 26; 27; 48; 88]. Here, we frame our consistency requirements around the Learn then Test (LTT) framework [3], and leverage the approximately monotonic behavior of our confidence measures and the nested structure of our problem, that by definition guarantees consistency with large enough threshold, to form tight and effective bounds.
+
+# 3 Early Exiting for Adaptive Language Modeling
+
+In the following, we describe and analyze the early-exiting Transformer LM. We begin with a brief recap of the Transformer architecture (§3.1) and early exiting (§3.2) for convenience, following previous work [23; 70; 76]. We then investigate the effects of early exiting on model performance, and identify primary sources of performance degradation and how to alleviate them (§3.3)—which guide our architecture and training design (§3.4) and proposed per-token confidence measures (§3.5).
+
+# 3.1 The Transformer architecture
+
+We use the Transformer sequence-to-sequence model, based on the T5x implementation [55]. Here, we only review simplified details of the Transformer architecture relevant to early-exiting, and refer the reader to Vaswani et al. [76] for full details. At a high level, both encoder and decoder networks contain $L$ stacked layers, where each layer is composed of a multi-head self-attention sub-layer, followed by a feedforward sub-layer, each with residual connections and layer normalization. The decoder network has an additional multi-head attention sub-layer that attends to the encoder states.
+
+Consider a prompt $\boldsymbol { x } = ( x _ { 1 } , \dots , x _ { p } )$ , processed by the encoder to yield encoder states $( e _ { 1 } , \ldots , e _ { p } )$ , and the current, partially generated response $( y _ { 1 } , \dots , y _ { t } )$ . When generating the next token $y _ { t + 1 }$ , the decoder computes a decoder state $d _ { t } ^ { i }$ for layer $i$ out of $L$ as:
+
+$$
+\begin{array} { r } { h _ { t } ^ { i } : = \mathrm { A t t e n t i o n } ( d _ { t } ^ { i - 1 } , d _ { 1 : t - 1 } ^ { i - 1 } ) ; \quad a _ { t } ^ { i } : = \mathrm { A t t e n t i o n } ( h _ { t } ^ { i } , e _ { 1 : p } ) ; \quad d _ { t } ^ { i } : = \mathrm { F e e d F o r w a r d } ( a _ { t } ^ { i } ) . } \end{array}
+$$
+
+Internal to each of the attention mechanisms, written as $\mathrm { A t t e n t i o n } ( x , z _ { 1 : m } )$ for some input $x$ and sequence of $m$ states $z _ { 1 : m }$ , $x$ is first projected to a query vector $q : = \mathbf { W } _ { Q } x \in \mathbb { R } ^ { \dim _ { k } }$ , while $z$ is projected to a matrix of key-value vectors, $\mathbf { K } : = \mathbf { W } _ { K } z _ { 1 : m } \in \mathbb { R } ^ { m \times \mathrm { d i m } _ { k } }$ and $\mathbf { V } : = \mathbf { W } _ { V } z _ { 1 : m } \in$ $\mathbf { \mathbb { R } } ^ { m \times \dim _ { v } }$ . The output $o$ is then computed as o := softmax $\left( q \mathbf { K } ^ { \top } / \sqrt { \mathrm { d i m } _ { k } } \right) \mathbf { V }$ .
+
+Multi-head and normalization components are omitted for brevity. Each layer uses different projections $\mathbf { W } _ { Q } ^ { i } , \mathbf { W } _ { K } ^ { i }$ , and $\mathbf { W } _ { V } ^ { i }$ (which are also unique for computing $h _ { t } ^ { i }$ versus $\dot { a } _ { t } ^ { i \cdot }$ ).
+
+Finally, after layer $L$ , a distribution over vocabulary tokens $y _ { t + 1 } \in \mathcal { D }$ is computed via a softmaxnormalized linear classifier $\mathbf { W } _ { L }$ , where $p ( y _ { t + 1 } \mid d _ { t } ^ { L } ) = \mathrm { s o f t m a x } ( \mathbf { W } _ { L } d _ { t } ^ { L } )$ .
+
+# 3.2 Decoding with early exiting
+
+Instead of always making a prediction based on the representation at the final layer, $d _ { t } ^ { L }$ , the key idea in early-exiting is to choose $y _ { t + 1 }$ more quickly, if confident, by computing $p ( y _ { t + 1 } \mid d _ { t } ^ { i } ) =$ softmax $( \dot { W _ { i } } \dot { d _ { t } ^ { i } } )$ for some intermediate layer $i < L$ . Concretely, let $\bar { c } _ { t } ^ { i } \in [ \bar { 0 } , 1 ]$ denote some local confidence score for layer $i$ while processing token $t$ , where higher values indicate a higher propensity to exit early (we will propose effective instantiations of $c _ { t } ^ { i }$ in $\ S 3 . 5 )$ . Let $\lambda _ { t } ^ { i } \in [ 0 , 1 ]$ denote some local early-exiting threshold, where the model exits early if $c _ { t } ^ { i } \geq \lambda _ { t } ^ { i }$ , or otherwise proceeds to compute the next representation, $d _ { t } ^ { i + 1 }$ . The (greedily chosen) prediction $y _ { t + 1 }$ can then be written as:
+
+$$
+y _ { t + 1 } : = \left\{ \begin{array} { l l } { \arg \operatorname* { m a x } p ( y _ { t + 1 } \mid d _ { t } ^ { 1 } ) \quad } & { \mathrm { i f } c _ { t } ^ { 1 } \geq \lambda _ { t } ^ { 1 } , } \\ { \arg \operatorname* { m a x } p ( y _ { t + 1 } \mid d _ { t } ^ { 2 } ) \quad } & { \mathrm { i f } c _ { t } ^ { 2 } \geq \lambda _ { t } ^ { 2 } , } \\ { \quad } & { \ \vdots } \\ { \arg \operatorname* { m a x } p ( y _ { t + 1 } \mid d _ { t } ^ { L } ) \quad } & { \mathrm { o t h e r w i s e } . } \end{array} \right.
+$$
+
+Note that due to the self-attention mechanism of the Transformer, computing the input hidden state $h _ { t } ^ { i }$ for layer $i$ depends on $d _ { 1 : t - 1 } ^ { i - 1 }$ , i.e., the output hidden states of the previous layer for all the tokens that have been generated so far.2 Therefore, if the model has early exited at some layer $j < i - 1$ for a token $s < t$ , then $d _ { s } ^ { i - 1 }$ is not available. As an approximation, we set $d _ { s } ^ { k } = d _ { s } ^ { j }$ for all layers $k > j$ following Elbayad et al. [23], with the understanding that this will introduce some error. In the next section, in addition to other factors, we will analyze the impact of this copied state on performance.
+
+# 3.3 The effects of early exiting on error propagation
+
+We perform several controlled experiments to investigate the behavior and the potential of earlyexiting during decoding. We use an 8-layer T5 encoder-decoder and the CNN/DM dataset for these experiments. See $\ S 5$ for more details on this model and data.
+
+# 3.3.1 State propagation
+
+First, we control for the correctness of the predicted tokens to examine the effect of state copying (§3.2), and also measure an approximate upper bound for compute reduction. We use an oracle confidence measure that exits at the earliest layer that agrees with the top prediction (i.e., replacing the conditions in Eq. 4 with arg max $p ( y _ { t + 1 } \mid \bar { d } _ { t } ^ { i } ) = \arg \operatorname* { m a x } p ( y _ { t + 1 } \mid { \dot { d } } _ { t } ^ { \hat { L } } ) )$ . Hence, the only factor that can cause divergence in the generation is the state copying mechanism for skipped layers. The results of this experiment are highly encouraging. This oracle achieves an ROUGE-L score of 38.24, compared to 38.32 with the full model, while only using an average of 1.53 layers per token. We also try an oracle that always uses $d _ { 1 : t - 1 } ^ { 1 }$ and it reaches 38.31 ROUGE-L. These results indicate that (1) the model is robust to state copying from lower layers, and (2) there is remarkable potential for saving compute—by up to $\times 5 . 2$ —while preserving performance, given a good confidence measure.
+
+We also experiment with copying the projected states $\mathbf { K } ^ { j } , \mathbf { V } ^ { j }$ to skipped layers $k > j$ . This version of the oracle results in a significant drop in performance to 23.02 ROUGE-L. Overall, we conjecture that the self-attention at layer $i$ for token $t$ can safely use hidden-states $d _ { s } ^ { j }$ for $j < i - 1$ as key-values of tokens $s < t$ , as long as the projections $\mathbf { W } _ { K / V } ^ { i }$ of layer $i$ are used. Notably, this projection can now be computed concurrently for all skipped layers as they all use the same $d$ from the exited layer.
+
+
+Figure 2: Earlier noise in the decoding process has greater effect on the overall output (a), though in practice the affect of early exits is minor due to high performance of early layers. A decaying confidence threshold (b) allows finer control over the performance-efficiency tradeoff (c).
+
+# 3.3.2 Sensitivity to local errors
+
+Next, we examine the impact of local token modifications—which might occur due to early exits—on the whole generated sequence. We experiment with two kinds of perturbations: sampling-based, where we select the 10th-ranked token according to layer $L$ ; and layer-based, where we select the the first layer’s prediction at timestep $t$ . All other tokens are predicted greedily by layer $L$ . As shown in Figure 2a, earlier perturbations result in lower sequence-level scores as there are more tokens that might suffer from the divergence. The degradation, though, is much smaller with layer- compared to sampling-based perturbations since, in practice, the early exit predictions are mostly accurate.
+
+Decaying threshold. Following the above observation, we introduce a decaying early-exiting threshold that is more permissive towards exiting as the decoding process continues. Motivated by the logarithmic behavior in Figure 2a, we use an exponential function with a user-defined temperature $\tau$ :
+
+$$
+\lambda ^ { \prime } ( \lambda , t ) : = \mathrm { c l i p } _ { [ 0 , 1 ] } \left( \frac { 9 } { 1 0 } \lambda + \frac { 1 } { 1 0 } e ^ { - \tau \cdot t / N } \right) ,
+$$
+
+where $N$ is the maximum output length. Figure 2b illustrates this function. Essentially, this function presents an effective compromise between simply using the same threshold for all tokens, and searching over a huge space of per-position different thresholds. Practically, it supports finer and better control over the performance-efficiency tradeoff compared to a single threshold. Figure $2 \mathrm { c }$ presents the outcomes of a search over $\lambda$ with steps of 0.01 and softmax-based confidence $( \ S 3 . 5 )$ . With the single threshold variant $( \tau = 0$ ), attempting to improve the efficiency will lead to a drastic drop of more than 10 points in the textual similarity against the full model’s prediction. In contrast, the decaying thresholds reveal several intermediate points with desirable tradeoffs to consider.
+
+# 3.4 Training early exit classifiers for local consistency
+
+While our goal is to preserve the quality of the complete output sequence, we note that this doesn’t necessarily demand local token-level consistency. Consider the target sequence “the concert was wonderful and long.” An output that switches the order of adjectives to “the concert was long and wonderful” would be called consistent by most semantic measures (and obtain 100 token- $F _ { 1 }$ score). Yet, the sentences diverge at the first adjective long which is semantically different from wonderful.
+
+Training for global consistency, however, could be challenging [81] as it depends on possibly noisy signals that might affect the learning, and also breaks the efficient teacher-forcing training strategy of LMs that relies on local-decisions. On the other hand, perfect local consistency implies global consistency. Therefore, we opt to train for local consistency, which requires minimal changes to the training procedure, and relax the local requirement to a global one during inference.
+
+Specifically, similar to Elbayad et al. [23], we average losses for each layer to obtain the objective
+
+$$
+\mathcal { L } = \sum _ { i = 1 } ^ { L } \omega _ { i } \mathcal { L } _ { i } , \quad \mathrm { w h e r e } \quad \sum _ { i = 1 } ^ { L } \omega _ { i } = 1 .
+$$
+
+$\mathcal { L }$ is the negative log-likelihood loss. We set $\begin{array} { r } { \omega _ { i } = i / \sum _ { j = 1 } ^ { L } j } \end{array}$ to favor higher layers, and find this objective to mostly preserve the full model’s performance compared to regular training. We note that there is some misalignment between this training and inference behavior due to the hidden states of skipped layers. However, as discussed in $\ S 3 . 3 . 1$ , the performance is not affected if the hidden-state is copied.
+
+# 3.5 Local confidence measures
+
+We experiment with three confidence measures for Eq. (4) that differ in their parameter and compute operation efficiencies. Our experiments (§6) will also show that they differ in their predictive power.
+
+Softmax response. We take the difference between the top two values of Softmax $( \mathbf { W _ { i } } d _ { t } ^ { i } )$ . With a large output vocabulary, this results in many floating point operations (FLOPs)—though, the next layer $i + 1$ can start its computation in parallel, avoiding additional runtime.
+
+Hidden-state saturation. As a simple parameter-free and fast to compute alternative, we take the cosine similarity $\mathrm { s i m } ( d _ { t } ^ { i } , d _ { t } ^ { i - 1 } )$ for $i > 1$ . By definition, the first possible exit is at the second layer (unless $\lambda = 0$ ). This measure tries to identify early saturation events of the hidden-state [28].
+
+Early exit classifier. We train a dedicated linear classifier $\mathcal { M }$ to predict the likelihood of exiting with local consistency given the current hidden-state: $c _ { t } ^ { i } = \mathcal { M } ( \bar { d } _ { t } ^ { i } )$ . This measure is very fast to compute at inference, and adds only $| d | + 1$ new parameters. To avoid any impact on the core model’s performance, we train it as a second step where we freeze all parameters other than $\mathcal { M }$ . We simply use a per-layer independent cross-entropy loss against a consistency oracle $\mathbb { 1 } [ \operatorname { a r g m a x } ( p ( y _ { t + 1 } | d _ { t } ^ { i } ) \bar { = }$ ar $\mathrm { g } \operatorname* { m a x } ( p ( y _ { t + 1 } | d _ { t } ^ { L } ) ]$ , and average across the $L - 1$ layers. We also experimented with the geometriclike training of Elbayad et al. [23], but find it to be less effective here (see App. D). The two objectives are closely related, but the geometric one ignores any signal from the states post the first oracle exit.
+
+# 4 Calibrating Local Early Exits from Global Constraints
+
+We now describe our calibration procedure for finding a shared exit threshold $\lambda \in [ 0 , 1 ]$ that can be used directly in Eq. (4), or via Eq. (5), such that we provably satisfy our desired global constraints over the fully generated sequences. At a high level, our approach uses the following basic recipe:
+
+1. We specify a grid of possible values of $\boldsymbol { \Lambda } = \left( \lambda _ { 1 } , \ldots , \lambda _ { k } \right)$ that may result in acceptable generations;
+2. We choose the lowest valid $\lambda \in \Lambda$ that we can identify with rigorous statistical testing tools.
+
+Let $P _ { \mathrm { t e s t } }$ be an i.i.d. prompt given to the LLM at test time, and let $Y _ { \mathrm { f u l l } } : = \mathrm { L L M } _ { \mathrm { f u l l } } ( P _ { \mathrm { t e s t } } ) \in \mathcal { V }$ and $Y _ { \mathrm { e a r l y } } : = \mathrm { L L M } _ { \mathrm { e a r l y } } ( P _ { \mathrm { t e s t } } , \lambda ) \in \mathcal { Y }$ denote the full and adaptive responses, respectively. Optionally, let $\dot { Z } _ { \mathrm { t e s t } }$ be a set of gold references for our task, if assumed. Our goal, as introduced in $\ S 1$ , is to find a valid $\lambda$ using $ { S _ { \mathrm { c a l } } }$ such that we satisfy either of two types of global “consistency” constraints:
+
+Definition 1 (Textual consistency). An adaptive LLM is textually consistent if given any bounded text dissimilarity function, $\mathcal { D } \colon \mathcal { V } \times \mathcal { V } \to \mathbb { R }$ , and tolerance $\delta \in \mathbb { R }$ , $\mathbb { E } \big [ { \cal D } ( Y _ { \mathrm { e a r l y } } , \tilde { Y _ { \mathrm { f u l l } } } ) \big ] \leq \dot { \delta }$ .
+
+Definition 2 (Risk consistency). An adaptive LLM is risk consistent if given any bounded risk function, $\mathcal { R } : \mathcal { V } \times 2 ^ { \mathcal { V } } \to \mathbb { R } ,$ , and tolerance $\delta \in \mathbb { R } ,$ $\mathbb { E } [ \mathcal { R } ( Y _ { \mathrm { e a r l y } } , Z _ { \mathrm { t e s t } } ) ] \le \mathbb { E } [ \mathcal { R } ( Y _ { \mathrm { f u l l } } , Z _ { \mathrm { t e s t } } ) ] + \delta$ .
+
+Without loss of generality, we will assume that $\mathcal { D }$ and $\mathcal { R }$ are always normalized to the unit interval $[ 0 , 1 ]$ , and therefore will only be considering tolerances $\delta \in ( 0 , 1 )$ . At a glance, to find a $\lambda$ that produces a consistent $\mathbf { L L M } _ { \mathrm { e a r l y } }$ , we cast our problem as a multiple hypothesis testing problem over a large array of $k$ candidate classifier exit thresholds, $\boldsymbol { \Lambda } = \left( \lambda _ { 1 } , \ldots , \lambda _ { k } \right)$ , and apply the Learn then Test (LTT) framework of Angelopoulos et al. [3] to identify a subset of statistically valid, constraint-satisfying thresholds $\Lambda _ { \mathrm { v a l i d } } \subset \Lambda$ . Our final $\lambda$ is then chosen as $\lambda : = \operatorname* { m i n } ( \Lambda _ { \mathrm { v a l i d } } \cup \dot { \{ 1 \} } )$ .
+
+# 4.1 The Learn then Test calibration framework
+
+Choosing a value of $\lambda$ that rigorously satisfies our consistency objectives is challenging, as the performance impact of increasing or decreasing $\lambda$ is not necessarily monotonic. Naively setting $\lambda$ , for example, based simply on average calibration set performance, can lead to statistically invalid results in our finite-sample, distribution-free setting. The LTT framework proposed by Angelopoulos et al. [3] solves this problem by reframing hyper-parameter selection as a multiple testing problem.
+
+Let $\boldsymbol { \Lambda } = \left( \lambda _ { 1 } , \ldots , \lambda _ { k } \right)$ be a finite grid of hyper-parameter values that may, or may not, obtain valid consistency. For example, when searching for a value of $\lambda \in [ 0 , 1 ]$ , we might consider the evenly spaced set $\begin{array} { r } { \dot { \Lambda } = \{ \frac { i } { k + 1 } : \stackrel { \cdot } { i } = 1 , \dots , k \} } \end{array}$ . LTT then identifies a subset of values, $\Lambda _ { \mathrm { v a l i d } } \subset \Lambda$ , where
+
+$$
+\mathbb { P } \Big ( \exists \lambda \in \Lambda _ { \mathrm { v a l i d } } \colon \mathbf { L L M _ { \mathrm { e a r l y } } } ( P _ { \mathrm { t e s t } } , \lambda ) \mathrm { ~ a n d ~ } \mathbf { L L M _ { \mathrm { f u l l } } } ( P _ { \mathrm { t e s t } } ) \mathrm { ~ a r e ~ } \mathbf { n o t } \mathrm { ~ c o n s i s t e n t } \Big ) \le \epsilon .
+$$
+
+Here, we are using consistency to refer to either textual consistency or risk consistency. Eq. (7) can be satisfied by applying standard multiple hypothesis testing techniques as long as super-uniform p-values, $p _ { j }$ , are supplied for each value $\lambda _ { j } \in \Lambda$ that support the null hypothesis
+
+$$
+H _ { j } \colon \mathbf { L } \mathbf { L } \mathbf { M } _ { \mathrm { e a r l y } } ( P _ { \mathrm { t e s t } } , \lambda _ { j } ) \ \mathrm { a n d } \ \mathbf { L } \mathbf { L } \mathbf { M } _ { \mathrm { f u l l } } ( P _ { \mathrm { t e s t } } ) \ \mathrm { a r e } \ \mathbf { n o t } \ \mathrm { c o n s i s t e n t } .
+$$
+
+$\lambda _ { j }$ is placed in $\Lambda _ { \mathrm { v a l i d } }$ if $H _ { j }$ is rejected, and discarded otherwise. This yields a consistent $\mathbf { L L M } _ { \mathrm { e a r l y } }$ . Proposition 1 (LTT for CALM). Suppose $p _ { j }$ is super-uniform for all $j$ under $H _ { j }$ for some specified tolerance $\delta \in ( 0 , 1 )$ . Let $\mathcal { A }$ be any family-wise error rate (FWER) controlling procedure at a level $\epsilon \in ( 0 , 1 )$ , where $\mathcal { A } ( p _ { 1 } , \ldots , p _ { k } )$ selects $H _ { j }$ to reject. Choosing $\lambda : = \operatorname* { m i n } ( \Lambda _ { \mathrm { v a l i d } } \cup \{ 1 \} )$ then yields a consistent $L L M _ { \mathrm { e a r l y } }$ with probability at least $1 - \epsilon$ .
+
+Note that a FWER-controlling procedure at a level $\epsilon$ is an algorithm that decides to accept or reject hypotheses $\{ H _ { i } \} _ { i = 1 } ^ { k }$ , while ensuring that the probability of falsely rejecting any $H _ { j }$ is less than $\epsilon$ . The proof of Proposition 1, given in Appendix A.1, follows directly from Theorem 1 of Angelopoulos et al. [3], and the fact that $\mathbf { L L M _ { \mathrm { e a r l y } } } ( P _ { \mathrm { t e s t } } ^ { - } , 1 ) = \mathbf { L L M _ { \mathrm { f u l l } } } ( P _ { \mathrm { t e s t } } )$ by construction per Eq. (4), so that we can always use $\lambda = 1$ as a valid fallback if we fail to identify non-empty $\Lambda _ { \mathrm { v a l i d } }$ . In the next sections, we describe how we calculate valid $\mathsf { p }$ -values using $ { S _ { \mathrm { c a l } } }$ , and our choice of FWER-controlling procedure.
+
+# 4.2 Defining p-values for consistent early-exiting
+
+LTT relies on valid $\mathfrak { p }$ -values $p _ { j }$ , where $p _ { j }$ is a random variable satisfying $\mathbb { P } ( p _ { j } \leq u ) \leq u$ under $H _ { j }$ for all $u \in [ 0 , 1 ]$ . For our purposes, we can obtain valid $\mathsf { p }$ -values from the empirical consistency of $\mathrm { L L M } _ { \mathrm { e a r l y } } ( P _ { i } , \lambda )$ measured over the random calibration sample, $ { S _ { \mathrm { c a l } } }$ . Since we have assumed w.l.o.g. that either of our bounded consistency functions $\mathcal { D }$ and $\mathcal { R }$ from Defs. 1 and 2 have been normalized to lie in $[ 0 , 1 ]$ , we can, for example, obtain a valid $\mathfrak { p }$ -value by simply inverting Hoeffding’s inequality:3
+
+$$
+p _ { j } ^ { \mathrm { H o e f f d i n g } } : = e ^ { - 2 n ( \operatorname* { m a x } ( 0 , \delta - \widehat { E } ( \lambda _ { j } ) ) ) ^ { 2 } } ,
+$$
+
+where $\begin{array} { r } { \widehat { E } ( \lambda _ { j } ) : = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } L _ { i } ( \lambda _ { j } ) } \end{array}$ is the empirical average of random variable $L _ { i } ( \lambda _ { j } ) \in [ 0 , 1 ]$ , with
+
+$$
+\mathsf { \Pi } _ { \mathsf { L } _ { i } } ( \lambda _ { j } ) : = \mathcal { D } ( \mathrm { L L M } _ { \mathrm { e a r l y } } ( P _ { i } , \lambda _ { j } ) , \mathrm { L L M } _ { \mathrm { f u l l } } ( P _ { i } ) ) \quad \mathrm { o r }
+$$
+
+$$
+L _ { i } ( \lambda _ { j } ) : = \operatorname* { m a x } \left( 0 , \mathcal { R } ( \operatorname { L L M } _ { \mathrm { e a r l y } } ( P _ { i } , \lambda _ { j } ) , Z _ { i } ) - \mathcal { R } ( \operatorname { L L M } _ { \mathrm { f u l l } } ( P _ { i } ) , Z _ { i } ) \right) ,
+$$
+
+for textual consistency versus risk consistency, respectively. Note that, as a technicality of enforcing the r.v. $L _ { i } ( \lambda _ { j } )$ to be within $[ 0 , 1 ]$ , Eq. (11) computes a conservative estimate of the difference in the empirical risk that doesn’t reward instances in which the risk of the early-exit model is lower.
+
+# 4.3 Efficient fixed sequence testing
+
+The more values of $\lambda$ we test, the higher the chance that we might accidentally choose a $\lambda$ that does not in fact result in consistent generations, despite whatever misleading performance we might have measured by chance on $ { S _ { \mathrm { c a l } } }$ . As part of LTT, we must select a multiple testing procedure that corrects for this (i.e., that controls the FWER at level $\epsilon$ ). Though the precise dependence between the early-exit LLM’s performance and $\lambda$ is unknown, in practice we find that it tends to be fairly smooth and roughly monotonic. That is, nearby thresholds $\bar { \lambda } \approx \lambda ^ { \prime }$ tend to perform similarly, whereas $\lambda > \lambda ^ { \prime }$ tends to result in relatively more consistent performance. Taking advantage of this structure, we choose to employ fixed sequence testing (FST) as our FWER-controlling procedure [3; 11].
+
+Here we define a sequence of descending thresholds $\lambda _ { 1 } > \lambda _ { 2 } > . . . \lambda _ { k }$ with a relatively coarse step size (e.g., increments of 0.05). For each $\lambda _ { j }$ in order, we compute $p _ { j }$ , and reject $H _ { j }$ if $p _ { j } \leq \epsilon$ . The first time we fail to reject $H _ { j }$ , we immediately terminate our search, and return $\lambda _ { j - 1 }$ to use as our calibrated threshold (or 1, if we fail to reject $H _ { 1 }$ ). An Algorithm of the full procedure is provided in Appendix E.
+
+
+Figure 3: Validation empirical performance-efficiency tradeoffs for different confidence measures, compared to static baselines and a local oracle measure with state propagation for skipped layers.
+
+# 5 Experimental Setting
+
+We empirically evaluate our methods on three popular text generation tasks that vary in their target generation length and extractive degrees against the input. CNN/DM [31] is a collection of news articles to be summarized in few sentences. WMT15 EN-FR [13] contains English sentences (one per example) to be machine translated to French. Open-book SQUAD 1.1 [54] is a QA dataset with Wikipedia paragraphs paired with questions, where the target answer is a text span from the input. Length statistics of the validation sets are summarized in Table 1.
+
+Table 1: Average number of tokens in reference targets of evaluation datasets (5/95th percentiles in parenthesis).
+
+
Dataset
Output length
CNN/DM
82 (42 - 141)
WMTEN-FR
39 (10 -82)
SQUAD
5 (1-13)
+
+Model. We implement CALM on top of the T5 encoder-decoder model that showed good performance on the tasks above [53], using the T5X framework [55]. We use the 8 layers T5 1.1 model that doesn’t share input and output embeddings. We share all output embeddings for the softmax predictions, and the early-exit classifier across all decoder layers. Based on validation results, we set the temperature of our decaying threshold to $\tau = 4$ for the softmax and classifier measures of CNN/DM and WMT. In other settings, we use $\tau = 0$ . See App. C for more details, and App. B.3 for a 12 layers T5 model.
+
+Evaluation metrics. We use the standard metrics for each task: ROUGE-L for CNN/DM, BLEU [50] for WMT, and Token-F1 [54] for SQUAD. We rely on the same metrics for computing the risk and textual distance, other than BLEU which is a corpus-level metric that doesn’t directly enable expectation control. Instead, we use the BLEURT learned metric [61]. For a given metric $m ( y _ { \mathrm { e a r l y } } , y _ { \mathrm { f u l l ~ o r } } z _ { \mathrm { t e s t } } ) \in [ 0 , 1 ]$ , we use $1 - m$ for distance or risk computation, respectively.
+
+Our main efficiency metric is the average number of decoder layers used per output token, as it directly measures complexity reduction without conflating with implementation or infrastructure specific details [19]. For reference, we also report the average decoder FLOPs reduction per token [23]. Also, we compute an estimated speedup of the whole encoder-decoder model for generating the full sequence, based on TPUv3 benchmarking with 200 examples in Colab (see App. C for details).
+
+Calibration experiments. For each task, we use the validation and test sets to evaluate our calibration method (§4) (for SQUAD we only use the validation set as the test answers are hidden). We run 50 random trials per target tolerance $\delta$ and consistency objective (textual or risk), where we partition the data to $80 \%$ calibration $( S _ { \mathrm { c a l } } )$ and $20 \%$ test $( P _ { \mathrm { t e s t } } )$ . We set $\epsilon = 0 . 0 5$ for all experiments.
+
+Baselines. We emphasize that the CALM framework is general for any autoregressive multi-layered LM with any confidence measure, allowing controlled consistency by Eq. (1) or Eq. (2). To empirically evaluate the efficiency gains enabled by our proposed confidence measures, we compare with static baselines that use the same number of layers for all tokens. We also compare our early-exit classifier training with the geometric method of [23] in Appendix D. Also, we compute an oracle local measure (§3.3.1) as an upper-bound estimate of the performance-efficiency tradeoff.
+
+# 6 Experimental Results
+
+We first report the empirical performance-efficiency tradeoff achieved with each confidence measure.
+For each task and measure, we evaluate the full range of $\lambda$ on the validation set, with steps of 0.05.
+
+Table 2: Test efficiency gains per choice of $\delta$ , consistency objective, and confidence measure. $\epsilon$ is set to 0.05. For plots of the full range of $\delta$ with standard deviation, see Appendix B.
+
+
8
Measure
CNN/DM
WMT
SQUAD
layers
FLOPs r.
speedup
layers
FLOPs r.
speedup
layers
FLOPs r.
speedup
sisuos[enxəL 5
1
softmax state
5.73 8.00
×0.44 ×1.00
×1.41 ×1.00
3.35
×0.66
×2.01
1.65
×3.15
×1.63
7.68
×1.01
×1.00
2.00
×3.65
×1.68
classifier
7.16
×1.03
×1.42
5.50
×1.06
×2.05
2.59
×2.37
×1.10
softmax
2.62
×0.49
×2.57
1.76
×0.91
×2.83
1.03
×5.68
×1.88
state
7.97
×1.00
×1.01
2.84
×1.93
×1.55
2.00
×3.65
×1.68
classifier
4.51
×1.15
×2.04
2.97
×1.22
×2.00
1.37
×5.09
×1.11
Prrsrorssrr 00
0
softmax
3.75
×0.47
×1.96
3.19
×0.67
×2.10
1.65
×3.15
×1.63
state
7.97
×1.00
×1.01
7.68
×1.01
×1.00
3.13
×2.11
×1.68
classifier
6.49
×1.06
×1.71
5.05
×1.08
×1.97
3.36
×1.55
×1.11
softmax
1.73
×0.50
×3.53
1.96
×0.85
×2.73
1.65
×3.15
×1.63
state
5.22
×1.11
×1.64
2.72
×2.01
×1.58
2.00
×3.65
×1.68
classifier
2.30
×1.25
×2.09
3.08
×1.21
×1.98
2.59
×2.37
×1.10
+
+The results, presented in Figure 3, show the power of the softmax response measure, allowing only minor performance loss while reducing more than half of the layers in all three tasks. The early-exit classifier, that is more FLOP-efficient, is also effective, mostly when targeting high performance (right hand side of plots). The simple and parameter-free state saturation measure is competitive, but often falls bellow the static baseline, despite enabling per-token exit decisions.
+
+The dynamic oracle obtains compelling efficiency gains, using only 1.5, 1.3, and 1.2 layers on average for summarization, WMT, and QA, respectively, without losing any performance. This illustrates the full potential of CALM and leaves further room for improvements with better confidence measures. It also shows the effectiveness of inference-time state propagation for skipped layers (§3.3.1).
+
+# 6.1 Calibrated performance with guaranteed textual or risk consistency
+
+Next, we examine the outcomes of the calibration process. Since the obtained risk is guaranteed to be valid (i.e., $\leq \delta$ at least $9 5 \%$ of the time), we focus here on efficiency gains per chosen $\delta$ . We refer the reader to Appendix B for empirical validation and for additional results and qualitative examples.
+
+Table 2 presents the efficiency gains per choice of $\delta$ for each consistency objective and confidence measure. We examine larger $\delta$ values for textual consistency as this is generally a stricter requirement since the full model’s error is not considered.
+
+Across all, the softmax confidence measure leads to the greatest decrease in number of decoder layers required. Accordingly, softmax mostly enables the highest speedup gains of up to about three times faster than running through all the model’s layers. The very lightweight early-exit classifier sometimes provides better gains than softmax, even if more decoding layers are used. Since the speedup is computed over the full generated output, we see more gains on the longer outputs of summarization and translation where the decoding takes most of the time, compared to the short QA outputs where the whole decoding time is not much longer than the encoding time.
+
+These encouraging efficiency gains are enabled even with the rigorous performance guarantees that are sometimes conservative (e.g., Eq. (11)). We note that relaxing these constraints, or tightening the confidence intervals (e.g., with larger calibration sets), can further improve the empirical gains.
+
+The softmax operation over the full output vocabulary is FLOPs heavy (though, this compute can potentially be paralleled), sometime leading to increased total FLOPs, even with fewer used layers. The state-based and early-exit classifier measures require minimal FLOPs and provide a good alternative with compelling efficiency gains, if total (parallelizable, or not) FLOPs is of concern.
+
+# 6.2 Example output: effectively distributing the model’s capacity across timesteps
+
+Figure 4 presents two CALM summary generations for an article from the CNN/DM dataset, compared to the output of the full model (See Figure B.5 in the Appendix for examples from the other tasks) . Y (2) y uses a lower confidence threshold for early exiting compared to Y (1)early . The colors, depicting the number of decoder layers used per output token, illustrate how CALM obtains the
+
+
test
SouthAfrica-bGntotiatig84tiilackCapscdfrstCufiiElit'sutiatei Eliot,6,adotpadinteaialcketfor14montsenedinisindicaiofrteacigrandplaedunderdon McCullum.New Zealand play the winner of the semi-final between Australia or India.
Yfull:
GrantElititZaadrougoteordCupfal.6yedaiSouthAutaturaldKltwil surely never playanotherinningslike his 84.New Zealandwilltake oneither Australiaor India in the finalon Sunday.
Exit layer-colormapping:12345678 D and R are computed with ROUGE-L
+
+Figure 4: CALM accelerates the generation by early exiting when possible, and selectively using the full decoder’s capacity only forsoftmax-based confidence measure. $Y _ { \mathrm { e a r l y } } ^ { ( 1 ) }$ Y (2) kenand onstrated here on a CNN/DM example withuse different confidence thresholds for early exiting. Bellow the text, we report the measured textual and risk consistency of each of the two outputs, along with efficiency gains. The colors represent the number of decoding layers used for each token—light green shades indicate less than half of the total layers.
+
+efficiency gains. Only a few selected tokens use the full capacity of the model (colored in red), while for most tokens the model exits after one or few decoding layers (colored in green).
+
+The example in Figure 4 also demonstrates one difference between the two types of consistency constraints, given a reference output $Z _ { \mathrm { t e s t } }$ . Textual consistency $D ( Y _ { \mathrm { e a r l y } } , Y _ { \mathrm { f u l l } } )$ generally (though, not always) degrades (i.e., increases) when decreasing the confidence threshold as the outputs tend to more significantly diverge from $Y _ { \mathrm { f u l l } }$ . The trend of risk consistency, however, depends also on the reference output $Z _ { \mathrm { t e s t } }$ . If $Y _ { \mathrm { f u l l } } \approx Z _ { \mathrm { t e s t } }$ then the two constraints are nearly the same. In this example, they are sufficiently different that Y (2)early obtained better (lower) risk even though the textual distance from $Y _ { \mathrm { f u l l } }$ is higher. On the one hand, given the availability of reference outputs for calibration, this suggests that for an imperfect model, risk consistency could lead to more aggressive early-exiting while maintaining the quality of generations. On the other hand, since the Relu in Eq. (11) doesn’t reward negative risk differences, the benefits might not fully materialize. Overall, the two constraints provide different alternatives for the user to choose from depending on the availability of reference outputs, the performance of the full model, and the exact desired performance guarantees.
+
+# 7 Conclusion
+
+We present confident adaptive language modeling (CALM) for dynamically allocating different amounts of compute per generated token, following explicitly defined tolerance levels on the full generation output. This paper covers both modeling solutions and analyses towards this goal, as well as a theoretically-grounded framework for provably controlling the quality of the full output to meet the user-specified tolerance levels. We investigate the effects of local early exiting during decoding on the final output, leading us to propose a decaying function over the initial threshold that enables finer control over the performance-efficiency tradeoffs without inflating the search space. We also study different solutions for addressing missing computations of early-exited tokens that are dependent upon for future tokens. Overall, our complete adaptive compute framework for LMs requires minimal modifications to the underlying model and enables efficiency gains while satisfying rigorous quality guarantees for the output. Also, our oracle experiments and runtime analysis demonstrates the full potential of this framework and leave room for future research to further improve the efficiency in a controllable way.
+
+# Acknowledgements
+
+We thank Ionel Gog for significantly improving the implementation after submission. We also thank Anselm Levskaya, Hyung Won Chung, Seungyeon Kim, Tao Wang, Paul Barham, and Michael Isard for great discussions and code suggestions. We thank Orhan Firat, Carlos Riquelme, Aditya Menon, Zhifeng Chen, Sanjiv Kumar, and Jeff Dean for helpful discussions and feedback on the project.
+
+# References
+
+[1] Anastasios N. Angelopoulos and Stephen Bates. A gentle introduction to conformal prediction and distribution-free uncertainty quantification. 2021. doi: 10.48550/ARXIV.2107.07511. URL https://arxiv.org/abs/2107.07511. [2] Anastasios Nikolas Angelopoulos and Stephen Bates. A gentle introduction to conformal prediction and distribution-free uncertainty quantification, 2021. URL https://arxiv. org/abs/2107.07511.
+[3] Anastasios Nikolas Angelopoulos, Stephen Bates, Emmanuel J. Candès, Michael I. Jordan, and Lihua Lei. Learn then test: Calibrating predictive algorithms to achieve risk control. ArXiv preprint: 2110.01052, 2021.
+[4] Anastasios Nikolas Angelopoulos, Amit Kohli, Stephen Bates, Michael I. Jordan, Jitendra Malik, Thayer Alshaabi, Srigokul Upadhyayula, and Yaniv Romano. Image-to-image regression with distribution-free uncertainty quantification and applications in imaging. ArXiv, abs/2202.05265, 2022.
+[5] Vamsi Aribandi, Yi Tay, Tal Schuster, Jinfeng Rao, Huaixiu Steven Zheng, Sanket Vaibhav Mehta, Honglei Zhuang, Vinh Q. Tran, Dara Bahri, Jianmo Ni, Jai Gupta, Kai Hui, Sebastian Ruder, and Donald Metzler. Ext5: Towards extreme multi-task scaling for transfer learning. In International Conference on Learning Representations, 2022. URL https://openreview. net/forum?id $\equiv$ Vzh1BFUCiIX.
+[6] Haoli Bai, Wei Zhang, Lu Hou, Lifeng Shang, Jing Jin, Xin Jiang, Qun Liu, Michael Lyu, and Irwin King. Binarybert: Pushing the limit of bert quantization. arXiv preprint arXiv:2012.15701, 2020.
+[7] Yu Bai, Song Mei, Haiquan Wang, Yingbo Zhou, and Caiming Xiong. Efficient and differentiable conformal prediction with general function classes. ArXiv, abs/2202.11091, 2022. [8] Aaron Baier-Reinio and Hans De Sterck. N-ode transformer: A depth-adaptive variant of the transformer using neural ordinary differential equations. ArXiv, abs/2010.11358, 2020. [9] Ankur Bapna, Naveen Arivazhagan, and Orhan Firat. Controlling computation versus quality for neural sequence models. 2020. doi: 10.48550/ARXIV.2002.07106. URL https://arxiv. org/abs/2002.07106.
+[10] Stephen Bates, Anastasios Nikolas Angelopoulos, Lihua Lei, Jitendra Malik, and Michael I. Jordan. Distribution free, risk controlling prediction sets. ArXiv preprint: 2101.02703, 2020.
+[11] Peter Bauer. Multiple testing in clinical trials. Statistics in medicine, 10 6:871–89; discussion 889–90, 1991.
+[12] Vidmantas Bentkus. On hoeffding’s inequalities. Annals of Probability, 32:1650–1673, 2004.
+[13] Ondˇrej Bojar, Rajen Chatterjee, Christian Federmann, Barry Haddow, Matthias Huck, Chris Hokamp, Philipp Koehn, Varvara Logacheva, Christof Monz, Matteo Negri, Matt Post, Carolina Scarton, Lucia Specia, and Marco Turchi. Findings of the 2015 workshop on statistical machine translation. In Proceedings of the Tenth Workshop on Statistical Machine Translation, pages 1–46, Lisbon, Portugal, September 2015. Association for Computational Linguistics. doi: 10.18653/v1/W15-3001. URL https://aclanthology.org/W15-3001.
+[14] 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.
+[15] 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 H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 1877–1901. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/ file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf.
+
+[16] Berkant Barla Cambazoglu, Hugo Zaragoza, Olivier Chapelle, Jiang Chen, Ciya Liao, Zhaohui Zheng, and Jon Degenhardt. Early exit optimizations for additive machine learned ranking systems. In WSDM ’10, 2010.
+
+[17] Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek Rao, Parker Barnes, Yi Tay, Noam Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Ben Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier Garcia, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Diaz, Orhan Firat, Michele Catasta, Jason Wei, Kathy Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. Palm: Scaling language modeling with pathways. 2022.
+
+[18] Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Lukasz Kaiser. Universal transformers. In International Conference on Learning Representations (ICLR), 2019.
+
+[19] Mostafa Dehghani, Yi Tay, Anurag Arnab, Lucas Beyer, and Ashish Vaswani. The efficiency misnomer. In International Conference on Learning Representations, 2022. URL https: //openreview.net/forum?id $=$ iulEMLYh1uR.
+
+[20] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423. URL https://aclanthology.org/N19-1423.
+
+[21] Neil Dey, Jing Ding, Jack G. Ferrell, Carolina Kapper, Maxwell Lovig, Emiliano Planchon, and Jonathan P Williams. Conformal prediction for text infilling and part-of-speech prediction. ArXiv, abs/2111.02592, 2021.
+
+[22] Nan Du, Yanping Huang, Andrew M. Dai, Simon Tong, Dmitry Lepikhin, Yuanzhong Xu, Maxim Krikun, Yanqi Zhou, Adams Wei Yu, Orhan Firat, Barret Zoph, Liam Fedus, Maarten Bosma, Zongwei Zhou, Tao Wang, Yu Emma Wang, Kellie Webster, Marie Pellat, Kevin Robinson, Kathy Meier-Hellstern, Toju Duke, Lucas Dixon, Kun Zhang, Quoc V Le, Yonghui Wu, Zhifeng Chen, and Claire Cui. Glam: Efficient scaling of language models with mixtureof-experts. 2021.
+
+[23] Maha Elbayad, Jiatao Gu, Edouard Grave, and Michael Auli. Depth-adaptive transformer. In International Conference on Learning Representations, 2020. URL https://openreview. net/forum?id $\equiv$ SJg7KhVKPH.
+
+[24] Angela Fan, Edouard Grave, and Armand Joulin. Reducing transformer depth on demand with structured dropout. arXiv preprint arXiv:1909.11556, 2019.
+
+[25] Michael Figurnov, Artem Sobolev, and Dmitry P. Vetrov. Probabilistic adaptive computation time. ArXiv, abs/1712.00386, 2017.
+
+[26] Adam Fisch, Tal Schuster, Tommi Jaakkola, and Regina Barzilay. Efficient conformal prediction via cascaded inference with expanded admission. In International Conference on Learning Representations (ICLR), 2021.
+
+[27] Adam Fisch, Tal Schuster, T. Jaakkola, and Regina Barzilay. Conformal prediction sets with limited false positives. ArXiv, abs/2202.07650, 2022.
+
+[28] Mor Geva, Avi Caciularu, Kevin Ro Wang, and Yoav Goldberg. Transformer feed-forward layers build predictions by promoting concepts in the vocabulary space. 2022.
+
+[29] Alex Graves. Adaptive computation time for recurrent neural networks. 2016.
+
+[30] Caglar Gulcehre, Orhan Firat, Kelvin Xu, Kyunghyun Cho, and Yoshua Bengio. On integrating a language model into neural machine translation. Computer Speech & Language, 45:137– 148, 2017. ISSN 0885-2308. doi: https://doi.org/10.1016/j.csl.2017.01.014. URL https: //www.sciencedirect.com/science/article/pii/S0885230816301395.
+
+[31] Karl Moritz Hermann, Tomas Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. In C. Cortes, N. Lawrence, D. Lee, M. Sugiyama, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 28. Curran Associates, Inc., 2015. URL https://proceedings.neurips.cc/paper/2015/file/ afdec7005cc9f14302cd0474fd0f3c96-Paper.pdf.
+
+[32] Geoffrey E. Hinton, Oriol Vinyals, and Jeffrey Dean. Distilling the knowledge in a neural network. ArXiv, abs/1503.02531, 2015.
+
+[33] Wassily Hoeffding. Probability inequalities for sums of bounded random variables. Journal of the American Statistical Association, 58:13–30, 1963.
+
+[34] Lu Hou, Zhiqi Huang, Lifeng Shang, Xin Jiang, Xiao Chen, and Qun Liu. Dynabert: Dynamic bert with adaptive width and depth. Advances in Neural Information Processing Systems, 33: 9782–9793, 2020.
+
+[35] Yacine Jernite, Edouard Grave, Armand Joulin, and Tomas Mikolov. Variable computation in recurrent neural networks. arXiv preprint arXiv:1611.06188, 2016.
+
+[36] Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, and Qun Liu. Tinybert: Distilling bert for natural language understanding. arXiv preprint arXiv:1909.10351, 2019.
+
+[37] Jungo Kasai, Nikolaos Pappas, Hao Peng, James Cross, and Noah Smith. Deep encoder, shallow decoder: Reevaluating non-autoregressive machine translation. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum? id $\equiv$ KpfasTaLUpq.
+
+[38] Gyuwan Kim and Kyunghyun Cho. Length-adaptive transformer: Train once with length drop, use anytime with search. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 6501–6511, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.508. URL https://aclanthology.org/2021.acl-long.508.
+
+[39] Sneha Kudugunta, Yanping Huang, Ankur Bapna, Maxim Krikun, Dmitry Lepikhin, MinhThang Luong, and Orhan Firat. Beyond distillation: Task-level mixture-of-experts for efficient inference. In Findings of the Association for Computational Linguistics: EMNLP 2021, pages 3577–3599, Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.findings-emnlp.304. URL https://aclanthology. org/2021.findings-emnlp.304.
+
+[40] Imad Lakim, Ebtesam Almazrouei, Ibrahim Abualhaol, Merouane Debbah, and Julien Launay. A holistic assessment of the carbon footprint of noor, a very large Arabic language model. In Proceedings of BigScience Episode #5 – Workshop on Challenges & Perspectives in Creating Large Language Models, pages 84–94, virtual+Dublin, May 2022. Association for Computational Linguistics. URL https://aclanthology.org/2022.bigscience-1.8.
+
+[41] Tao Lei. When attention meets fast recurrence: Training language models with reduced compute. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 7633–7648, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.emnlp-main.602. URL https://aclanthology.org/2021.emnlp-main.602.
+
+[42] Dmitry Lepikhin, HyoukJoong Lee, Yuanzhong Xu, Dehao Chen, Orhan Firat, Yanping Huang, Maxim Krikun, Noam Shazeer, and Zhifeng Chen. {GS}hard: Scaling giant models with conditional computation and automatic sharding. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ qrwe7XHTmYb.
+
+[43] Lei Li, Yankai Lin, Deli Chen, Shuhuai Ren, Peng Li, Jie Zhou, and Xu Sun. Cascadebert: Accelerating inference of pre-trained language models via calibrated complete models cascade. arXiv preprint arXiv:2012.14682, 2020.
+
+[44] Weijie Liu, Peng Zhou, Zhe Zhao, Zhiruo Wang, Haotang Deng, and Qi Ju. Fastbert: a self-distilling bert with adaptive inference time. arXiv preprint arXiv:2004.02178, 2020.
+
+[45] Xiangyang Liu, Tianxiang Sun, Junliang He, Lingling Wu, Xinyu Zhang, Hao Jiang, Zhao Cao, Xuanjing Huang, and Xipeng Qiu. Towards efficient nlp: A standard evaluation and a strong baseline. arXiv preprint arXiv:2110.07038, 2021.
+
+[46] Yijin Liu, Fandong Meng, Jie Zhou, Yufeng Chen, and Jinan Xu. Faster depth-adaptive transformers. In AAAI, 2021.
+
+[47] Zhuang Liu, Zhiqiu Xu, Hung-Ju Wang, Trevor Darrell, and Evan Shelhamer. Anytime dense prediction with confidence adaptivity. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $\equiv$ kNKFOXleuC.
+
+[48] Charles Lu and Jayasheree Kalpathy-Cramer. Distribution-free federated learning with conformal predictions. ArXiv, abs/2110.07661, 2021.
+
+[49] Nafise Sadat Moosavi, Angela Fan, Vered Shwartz, Goran Glavaš, Shafiq Joty, Alex Wang, and Thomas Wolf, editors. Proceedings of SustaiNLP: Workshop on Simple and Efficient Natural Language Processing, Online, November 2020. Association for Computational Linguistics. URL https://aclanthology.org/2020.sustainlp-1.0.
+
+[50] Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics, pages 311–318, Philadelphia, Pennsylvania, USA, July 2002. Association for Computational Linguistics. doi: 10.3115/1073083.1073135. URL https: //aclanthology.org/P02-1040.
+
+[51] Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 2227–2237, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-1202. URL https://aclanthology.org/N18-1202.
+
+[52] Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019.
+
+[53] 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. 2019.
+
+[54] Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. SQuAD: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2383–2392, Austin, Texas, November 2016. Association for Computational Linguistics. doi: 10.18653/v1/D16-1264. URL https://aclanthology.org/D16-1264.
+
+[55] Adam Roberts, Hyung Won Chung, Anselm Levskaya, Gaurav Mishra, James Bradbury, Daniel Andor, Sharan Narang, Brian Lester, Colin Gaffney, Afroz Mohiuddin, Curtis Hawthorne, Aitor Lewkowycz, Alex Salcianu, Marc van Zee, Jacob Austin, Sebastian Goodman, Livio Baldini Soares, Haitang Hu, Sasha Tsvyashchenko, Aakanksha Chowdhery, Jasmijn Bastings, Jannis Bulian, Xavier Garcia, Jianmo Ni, Andrew Chen, Kathleen Kenealy, Jonathan H. Clark, Stephan Lee, Dan Garrette, James Lee-Thorp, Colin Raffel, Noam Shazeer, Marvin Ritter, Maarten Bosma, Alexandre Passos, Jeremy Maitin-Shepard, Noah Fiedel, Mark Omernick, Brennan Saeta, Ryan Sepassi, Alexander Spiridonov, Joshua Newlan, and Andrea Gesmundo. Scaling up models and data with $\pm 5 \mathrm { x }$ and seqio. arXiv preprint arXiv:2203.17189, 2022. URL https://arxiv.org/abs/2203.17189.
+
+[56] Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108, 2019.
+
+[57] Tal Schuster, Adam Fisch, Tommi Jaakkola, and Regina Barzilay. Consistent accelerated inference via confident adaptive transformers. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 4962–4979, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021. emnlp-main.406. URL https://aclanthology.org/2021.emnlp-main.406.
+
+[58] Tal Schuster, Ashwin Kalyan, Alex Polozov, and Adam Tauman Kalai. Programming puzzles. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 1), 2021. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ fe_hCc4RBrg.
+
+[59] Roy Schwartz, Jesse Dodge, Noah A. Smith, and Oren Etzioni. Green ai. Communications of the ACM, 63(12):54–63, Nov 2020. ISSN 1557-7317. doi: 10.1145/3381831. URL http://dx.doi.org/10.1145/3381831.
+
+[60] Roy Schwartz, Gabriel Stanovsky, Swabha Swayamdipta, Jesse Dodge, and Noah A. Smith. The right tool for the job: Matching model and instance complexities. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 6640–6651, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.593. URL https://aclanthology.org/2020.acl-main.593.
+
+[61] Thibault Sellam, Dipanjan Das, and Ankur Parikh. BLEURT: Learning robust metrics for text generation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7881–7892, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.704. URL https://aclanthology.org/2020. acl-main.704.
+
+[62] Glenn Shafer and Vladimir Vovk. A tutorial on conformal prediction. Journal of Machine Learning Research (JMLR), 9:371–421, June 2008.
+
+[63] Or Sharir, Barak Peleg, and Yoav Shoham. The cost of training nlp models: A concise overview. arXiv preprint: arXiv 2006.06138, 2020.
+
+[64] Noam Shazeer and Mitchell Stern. Adafactor: Adaptive learning rates with sublinear memory cost. 2018. doi: 10.48550/ARXIV.1804.04235. URL https://arxiv.org/abs/1804. 04235.
+
+[65] Sheng Shen, Zhen Dong, Jiayu Ye, Linjian Ma, Zhewei Yao, Amir Gholami, Michael W Mahoney, and Kurt Keutzer. Q-bert: Hessian based ultra low precision quantization of bert. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 8815–8821, 2020.
+
+[66] Antoine Simoulin and Benoit Crabbé. How many layers and why? An analysis of the model depth in transformers. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing: Student Research Workshop, pages 221–228, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-srw.23. URL https://aclanthology.org/2021.acl-srw.23.
+
+[67] Aarohi Srivastava, Abhinav Rastogi, Abhishek Rao, Abu Awal Md Shoeb, Abubakar Abid, Adam Fisch, Adam R. Brown, Adam Santoro, Aditya Gupta, and Garriga-Alonso et al. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models. 2022. doi: 10.48550/ARXIV.2206.04615. URL https://arxiv.org/abs/2206.04615.
+
+[68] Asa Cooper Stickland and Iain Murray. Bert and pals: Projected attention layers for efficient adaptation in multi-task learning. In International Conference on Machine Learning, pages 5986–5995. PMLR, 2019.
+
+[69] Siqi Sun, Yu Cheng, Zhe Gan, and Jingjing Liu. Patient knowledge distillation for bert model compression. arXiv preprint arXiv:1908.09355, 2019.
+
+[70] Tianxiang Sun, Xiangyang Liu, Wei Zhu, Zhichao Geng, Lingling Wu, Yilong He, Yuan Ni, Guotong Xie, Xuanjing Huang, and Xipeng Qiu. A simple hash-based early exiting approach for language understanding and generation. In Findings of the Association for Computational Linguistics: ACL 2022, pages 2409–2421, Dublin, Ireland, May 2022. Association for Computational Linguistics. URL https://aclanthology.org/2022.findings-acl.189.
+
+[71] Zhiqing Sun, Hongkun Yu, Xiaodan Song, Renjie Liu, Yiming Yang, and Denny Zhou. Mobilebert: a compact task-agnostic bert for resource-limited devices. arXiv preprint arXiv:2004.02984, 2020.
+
+[72] Yi Tay, Mostafa Dehghani, Dara Bahri, and Donald Metzler. Efficient transformers: A survey. ACM Computing Surveys (CSUR), 2022.
+
+[73] Yi Tay, Mostafa Dehghani, Vinh Q Tran, Xavier Garcia, Dara Bahri, Tal Schuster, Huaixiu Steven Zheng, Neil Houlsby, and Donald Metzler. Unifying language learning paradigms. arXiv preprint arXiv:2205.05131, 2022.
+
+[74] Surat Teerapittayanon, Bradley McDanel, and H. T. Kung. Branchynet: Fast inference via early exiting from deep neural networks. 2016 23rd International Conference on Pattern Recognition (ICPR), pages 2464–2469, 2016.
+
+[75] Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam M. Shazeer, Apoorv Kulshreshtha, Heng-Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, Yaguang Li, Hongrae Lee, Huaixiu Zheng, Amin Ghafouri, Marcelo Menegali, Yanping Huang, Maxim Krikun, Dmitry Lepikhin, James Qin, Dehao Chen, Yuanzhong Xu, Zhifeng Chen, Adam Roberts, Maarten Bosma, Yanqi Zhou, Chung-Ching Chang, I. A. Krivokon, Willard James Rusch, Marc Pickett, Kathleen S. Meier-Hellstern, Meredith Ringel Morris, Tulsee Doshi, Renelito Delos Santos, Toju Duke, Johnny Hartz Søraker, Ben Zevenbergen, Vinodkumar Prabhakaran, Mark Diaz, Ben Hutchinson, Kristen Olson, Alejandra Molina, Erin Hoffman-John, Josh Lee, Lora Aroyo, Ravindran Rajakumar, Alena Butryna, Matthew Lamm, V. O. Kuzmina, Joseph Fenton, Aaron Cohen, Rachel Bernstein, Ray Kurzweil, Blaise Aguera-Arcas, Claire Cui, Marian Croak, Ed Chi, and Quoc Le. Lamda: Language models for dialog applications. ArXiv, abs/2201.08239, 2022.
+
+[76] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems (NeurIPS), 2017.
+
+[77] Vladimir Vovk, Alex Gammerman, and Glenn Shafer. Algorithmic Learning in a Random World. Springer-Verlag, Berlin, Heidelberg, 2005.
+
+[78] Wenhui Wang, Furu Wei, Li Dong, Hangbo Bao, Nan Yang, and Ming Zhou. Minilm: Deep self-attention distillation for task-agnostic compression of pre-trained transformers. Advances in Neural Information Processing Systems, 33:5776–5788, 2020.
+
+[79] Xin Wang, Fisher Yu, Zi-Yi Dou, and Joseph Gonzalez. Skipnet: Learning dynamic routing in convolutional networks. ArXiv, abs/1711.09485, 2018.
+
+[80] Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. 2022.
+
+[81] John Wieting, Taylor Berg-Kirkpatrick, Kevin Gimpel, and Graham Neubig. Beyond BLEU:training neural machine translation with semantic similarity. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4344–4355, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1427. URL https://aclanthology.org/P19-1427.
+[82] Yuhuai Wu, Markus Norman Rabe, DeLesley Hutchins, and Christian Szegedy. Memorizing transformers. In International Conference on Learning Representations, 2022. URL https: //openreview.net/forum?id $= ^ { \prime }$ TrjbxzRcnf-.
+[83] Ji Xin, Raphael Tang, Jaejun Lee, Yaoliang Yu, and Jimmy Lin. Deebert: Dynamic early exiting for accelerating bert inference. arXiv preprint arXiv:2004.12993, 2020.
+[84] Ji Xin, Raphael Tang, Yaoliang Yu, and Jimmy Lin. BERxiT: Early exiting for BERT with better fine-tuning and extension to regression. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 91–104, Online, April 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.eacl-main.8. URL https://aclanthology.org/2021.eacl-main.8.
+[85] Jingjing Xu, Wangchunshu Zhou, Zhiyi Fu, Hao Zhou, and Lei Li. A survey on green deep learning. ArXiv, abs/2111.05193, 2021.
+[86] Linting Xue, Aditya Barua, Noah Constant, Rami Al-Rfou, Sharan Narang, Mihir Kale, Adam Roberts, and Colin Raffel. Byt5: Towards a token-free future with pre-trained byte-to-byte models. 2021. doi: 10.48550/ARXIV.2105.13626. URL https://arxiv.org/abs/ 2105.13626.
+[87] Hongxu Yin, Arash Vahdat, José Manuel Álvarez, Arun Mallya, Jan Kautz, and Pavlo Molchanov. Adavit: Adaptive tokens for efficient vision transformer. ArXiv, abs/2112.07658, 2021.
+[88] Margaux Zaffran, Aymeric Dieuleveut, Olivier F’eron, Yannig Goude, and Julie Josse. Adaptive conformal predictions for time series. ArXiv, abs/2202.07282, 2022.
+[89] Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, Todor Mihaylov, Myle Ott, Sam Shleifer, Kurt Shuster, Daniel Simig, Punit Singh Koura, Anjali Sridhar, Tianlu Wang, and Luke Zettlemoyer. Opt: Open pre-trained transformer language models. 2022.
+[90] Wangchunshu Zhou, Canwen Xu, Tao Ge, Julian McAuley, Ke Xu, and Furu Wei. Bert loses patience: Fast and robust inference with early exit. Advances in Neural Information Processing Systems, 33:18330–18341, 2020.
+[91] Yanqi Zhou, Tao Lei, Hanxiao Liu, Nan Du, Yanping Huang, Vincent Zhao, Andrew Dai, Zhifeng Chen, Quoc Le, and James Laudon. Mixture-of-experts with expert choice routing. 2022. doi: 10.48550/ARXIV.2202.09368. URL https://arxiv.org/abs/2202.09368.
+[92] Wei Zhu. Leebert: Learned early exit for bert with cross-level optimization. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 2968–2980, 2021.
\ No newline at end of file
diff --git a/md/dev/uRTW_PgXvc7/uRTW_PgXvc7.md b/md/dev/uRTW_PgXvc7/uRTW_PgXvc7.md
new file mode 100644
index 0000000000000000000000000000000000000000..0eded1d123585083105700ec4c4dcf94e245c58b
--- /dev/null
+++ b/md/dev/uRTW_PgXvc7/uRTW_PgXvc7.md
@@ -0,0 +1,306 @@
+# ST-Adapter: Parameter-Efficient Image-to-Video Transfer Learning
+
+Junting $\mathbf { P a n } ^ { 1 * }$ , Ziyi $\mathbf { L i n ^ { 1 * } }$ , Xiatian $\mathbf { Z } \mathbf { h } \mathbf { u } ^ { 2 }$ , Jing Shao1, Hongsheng Li1,3 1Multimedia Laboratory, The Chinese University of Hong Kong 2Surrey Institute for People-Centred Artificial Intelligence, CVSSP, University of Surrey 3Centre for Perceptual and Interactive Intelligence Limited
+
+# Abstract
+
+Capitalizing on large pre-trained models for various downstream tasks of interest have recently emerged with promising performance. Due to the ever-growing model size, the standard full fine-tuning based task adaptation strategy becomes prohibitively costly in terms of model training and storage. This has led to a new research direction in parameter-efficient transfer learning. However, existing attempts typically focus on downstream tasks from the same modality (e.g., image understanding) of the pre-trained model. This creates a limit because in some specific modalities, (e.g., video understanding) such a strong pre-trained model with sufficient knowledge is less or not available. In this work, we investigate such a novel cross-modality transfer learning setting, namely parameter-efficient image-to-video transfer learning. To solve this problem, we propose a new SpatioTemporal Adapter (ST-Adapter) for parameter-efficient fine-tuning per video task. With a built-in spatio-temporal reasoning capability in a compact design, STAdapter enables a pre-trained image model without temporal knowledge to reason about dynamic video content at a small $( \sim 8 \% )$ per-task parameter cost, requiring approximately 20 times fewer updated parameters compared to previous work. Extensive experiments on video action recognition tasks show that our ST-Adapter can match or even outperform the strong full fine-tuning strategy and state-of-theart video models, whilst enjoying the advantage of parameter efficiency. Code and model are available at https://github.com/linziyi96/st-adapter
+
+# 1 Introduction
+
+In the NLP field, almost all the state-of-arts across a wide range of downstream tasks have been achieved by adapting from large pretrained models (a.k.a. foundation models [7]) such as BERT [15] and GPT [54, 8]. The de facto standard approach to adapting a pretrained model to down-stream tasks is fine-tuning either fully or partially (e.g., linear probing by training the newly added multi-layer perceptron layers on the top alone), subject to the condition of adopting a similar network architecture as the pretrained model. Nonetheless, given increasingly larger whilst ever stronger foundation models (e.g., GPT-3 with 175B parameters), fully fine-tuning the whole model for every single downstream task would become prohibitively expensive and infeasible in terms of training cost and model storage. This could significantly restrict their deployment and usability in real-world applications. In this context, a series of NLP works has been introduced towards efficient transfer learning with better trade-offs between parameter and accuracy [25, 24, 39, 36].
+
+This trend has recently motivated the computer vision community. For example, the CLIP model [55], trained with 400 million web image-text pairs, achieves promising performances on a variety of image recognition and generation tasks. In the video domain, with significantly more computational cost and resources, Xu et al. [79] trained a video variant of CLIP but excelled on a smaller number of downstream video tasks. This is partly attributed to two orders of magnitude more minor training data and limited availability of computing resources, as large video data is notoriously more difficult to collect, manage, and process than image data. Under these restrictions, large pre-trained image models are arguably still favorable in the selection of model initialization for video tasks.
+
+
+Figure 1: Image-to-video transfer learning strategies. (a) The state-of-the-art methods for adapting a pre-trained image model (e.g., ViT [16] in this example) to video tasks (e.g., action recognition) usually adopt the paradigm of first designing a temporal learning module and then fine-tuning the whole network fully [2, 6, 9]. This is parameter-inefficient since a specific instance of such a large model is resulted for each downstream task. In contrast, (b) we propose to only train a lightweight Spatio-Temporal Adapter with much fewer parameters for each individual downstream task at a significantly smaller computational cost. Surprisingly, our method can match or even surpasses the full fine-tuning based methods (including prior art video models in terms of accuracy), whist enjoying higher parameter efficiency and cheaper training cost.
+
+In this work, we investigate a novel, critical problem of efficiently adapting large pre-trained image models for video downstream tasks, with a focus on the widely influential action recognition task. Considering that training video models is drastically more expensive in both computing resource and time than image models [19], this problem becomes particularly more useful and valuable in practice. On the other hand, it is also more challenging and non-trivial due to the extra necessity of overcoming the big gap between image and video in transfer learning. Especially, pre-trained image models lack the ability to infer temporal structured information, which however is critical in video understanding. In fact, the key design with state-of-the-art video models [10, 41, 6, 9] is usually about learning the temporal dimension based on contemporary image models. Although model initialization is still important, they largely go beyond the fine-tuning strategy, as architectural modification is often imposed in addition to full model training/fine-tuning per downstream task.
+
+Given that this is a new problem, we first conduct a comprehensive benchmark using both various fine-tuning methods for image-to-video transfer learning and state-of-the-art video models [6, 9]. Regarding the pretrained image model, we select two Vision Transformer (ViT) [16] models, with one from CLIP pre-training [55] and the other pre-trained on ImageNet-21K [14]. ViT is representative in terms of network architecture, pre-training algorithm, and training data scale. Crucially, we further propose an efficient yet effective Space-Time Adapter (ST-Adapter), capable of extracting and leveraging the pre-trained knowledge of a large image model to achieve superior video understanding at a small parameter cost. Specifically, ST-Adapter is formulated based on a novel parameter-efficient bottleneck with a sequence of operations including feature dimension reduction, spatial-temporal modeling, and feature dimension recovery. It is easy to implement and scalable for deployment since all the primitive steps are realized with standard operators (e.g., fully-connected layer, depth-wise 3D convolution). With such a lightweight design, our bottleneck can be cheaply integrated throughout the base network for enabling stronger layer-wise spatio-temporal learning. As a result, our model can be more rapidly optimized using fewer training epochs for significant convergence advantage.
+
+We summarize the contributions as follows. (1) We investigate a new problem of parameterefficient image-to-video transfer learning. Our motivation is to advocate the usability and deployment of increasingly larger whilst ever more powerful pre-trained image models in benefiting more challenging video understanding tasks. (2) We establish a benchmark for action recognition tasks by comprehensively experimenting with a variety of fine-tuning strategies and several state-of-the-art video understanding models. (3) We introduce a novel parameter-efficient Spatio-Temporal Adapter (ST-Adapter) for more effectively capitalizing a large pre-trained image model in video understanding. By grounding all the primitives on standard operators, ST-Adaptor is easy to implement and friendly to deployment. (4) Extensive experiments on action recognition datasets show that our ST-Adapter outperforms not only existing parameter-efficient alternatives and the full fine-tuning strategy, but also state-of-the-art video methods with the same network architecture and model initialization.
+
+# 2 Related Work
+
+Parameter-efficient transfer learning Driven by the wider application of large pre-trained language models across a diversity of downstream tasks, the topic of efficient tuning has received increasing attention in NLP. Existing efficient tuning methods fall broadly into three categories. The first category is to introduce task-specific adapters [25, 24, 51, 50]. Specifically, an adapter consists of lightweight modules inserted between layers of a pre-trained model. To be parameter-efficient, only those newly added adapter modules need to be updated during task fine-tuning, whilst all the parameters of the large pre-trained model, which takes the majority proportion of the whole solution, are frozen. The second category is prompt tuning [39, 52, 31, 62, 42]. Instead of manipulating the network architecture, these methods prepend a set of learnable tokens at the input point of the model or intermediate layers. Similarly, only these added tokens need to be optimized for each downstream task. The third category is learning weight approximation [27]. In particular, only the low-rank matrices for approximating the weights need to be updated during training.
+
+Early works for efficient transfer learning in vision focus on parameter sharing in the context of multitask learning [83, 57, 56]. Recently, there are several works for extending the efficient tuning idea from NLP to vision tasks. CoOp [85] and CoCoOp [86] apply prefix tuning for adapting the CLIP model to various image recognition tasks. VL-Adapter [65] achieves the performance comparable to full fine-tuning on challenging vision-language tasks. Commonly, their design focuses are all restricted to the text encoder of the CLIP model. More recently, [29, 4, 84] introduce the idea of prompt learning to visual backbones. They obtained favorable results on various image recognition benchmarks. Moving a step further, in this work, we consider the more challenging adaptation problem from a pre-trained image model without temporal knowledge to video understanding tasks.
+
+Video action recognition Action recognition in the unconstrained video has largely been dominated by deep learning methods, thanks to the availability of large video datasets, e.g., Kinetics [10–12] and Something-Something [22]. As a key component, the model architectures adopted by existing video methods has expanded from CNNs [32, 68, 19, 18, 77, 69, 72, 48, 41, 45] to Transformers [17, 40, 38, 44, 2, 6]. As temporal information is important for modeling the dynamics, a variety of motion learning techniques has been introduced [75, 30, 49]. Further, different training methods have also been explored, e.g., unsupervised learning [67, 20, 76], and video-text contrastive learning [64, 79, 78, 66]. New opportunities for stronger video models are created following the introduction of large pretrained foundation models [55, 28, 81]. For example, Wang et al. [74] equipped the CLIP with temporal modules and good performance can be achieved after the model is fully fine-tuned on video datasets. Ju et al. [31] adopted the CLIP model for video recognition tasks by learning videospecific prompts. In contrast, in this work, we explore the potential of the large pre-trained image models with the parameter-efficient adapter strategy. Importantly, despite the simplicity, we bring about more significant advantages in performance along with a new benchmark on parameter-efficient image-to-video transfer learning.
+
+# 3 Methodology
+
+To capitalize a large pre-trained image model for more challenging video understanding such as action recognition in a cross-modality manner, it is necessary to fill the intrinsic gap between image and video. For easier understanding, we start with an intuitive baseline based on temporal aggregation.
+
+Temporal aggregation A straightforward baseline method of exploiting a pre-trained image model for video understanding is to temporally aggregate per-frame feature representations (e.g., average pooling). Concretely, given an input video clip $\mathbf { V } \in \mathbb { R } ^ { T \times H \times W }$ , where $T , H , W$ are the number of frames, height and width respectively. Following [16], we first split each frame into $N = H \times W / P ^ { 2 }$ patches of size $P \times P$ . Then, we flatten these patches and project them into a sequence of patch tokens $\mathbf Z _ { t } = [ \mathbf z _ { 1 } , . . . \mathbf z _ { s } , . . . , \mathbf z _ { N } ] , \mathbf z _ { s } \in \mathbb { R } ^ { d }$ where $d = 3 \times P ^ { \dot { 2 } }$ with $t = 1 , . . . , T$ . The sequence of feature vectors is then enhanced with the positional embedding by element-wise addition, along with a trainable class token concatenated. Subsequently, we feed each sequence with $N + 1$ tokens to a stack of self-attention based blocks individually. For each sequence we keep only the classification token ${ \bf z } _ { t } ^ { c l s }$ . We further perform temporal average pooling on the class tokens $\begin{array} { r } { \dot { \bf z } _ { f i n a l } = \frac { 1 } { T } \sum _ { t } { \bf z } _ { t } ^ { c l s } } \end{array}$ to yield a compact representation for the whole clip. We obtain the prediction by passing $\mathbf { z } _ { f i n a l }$ through a classifier. As the sptial information is only naively averaged over time, it is also known as Space-Only TimeSformer [6].
+
+Spatio-temporal attention For more dedicated structural modeling in the time dimension with ViTs, a mainstream approach in the video domain is to develop various spatio-temporal attention mechanisms by further imposing temporal attention on top [6, 2, 3, 9, 82, 23]. We choose two representative video ViT models, TimeSformer [6] and XViT [9], in our performance benchmark. However, state-of-the-art video ViT models often need to fully fine-tuned per task, which is parameterinefficient, given that in this way we have to keep a separate copy of the whole fine-tuned model parameters for every single task.
+
+# 3.1 Preliminaries
+
+Our method is inspired by the Adapter [25] designed for parameter-efficient transfer learning in NLP. Specifically, the adapter module is composed of a down-projection linear layer followed by a non-linear activation function and an up-projection linear layer. Formally, given an input feature matrix $\mathbf { X } \in \mathbb { R } ^ { N \times d }$ at the $i$ -th layer, the feature adaptation process can be written as:
+
+$$
+\mathsf { A d a p t e r } ( \mathbf { X } ) = \mathbf { X } + f ( \mathbf { X } \mathbf { W } _ { d o w n } ) \mathbf { W } _ { u p } ,
+$$
+
+where $\mathbf { W } _ { d o w n } \in \mathbb { R } ^ { d \times r }$ refers to the down projection layer, $\mathbf { W } _ { u p } \in \mathbb { R } ^ { r \times d }$ the up-projection layer, and $f ( \cdot )$ the activation function. Note, that a residual summation is applied for preserving the information in input as required. The idea of Adapter has been remarkably successful in NLP due to several advantages: (1) High parameter efficiency across tasks since only a small number of parameters are task-specific; (2) Reaching on-par performance compared to full fine-tuning; (3) Taking significantly small training costs; (4) Avoiding the catastrophic forgetting limitation of full fine-tuning.
+
+We aim to propagate the success of Adapter from NLP to computer vision particularly the imageto-video transfer learning problem as discussed earlier. To that end, we introduce a novel Adapter tailored specially for spatio-temporal reasoning – a key capability for video understanding which, however, existing NLP Adapter variants lack.
+
+# 3.2 Spatio-Temporal Adapter (ST-Adapter)
+
+Typically, an image model only considers the ability of spatial modeling. The objective of our Spatio-Temporal Adapter (ST-Adapter) is to enable a pre-trained image model to reason about spatial and temporal information of video in a parameter efficient principle. In design, we consider a couple of practically-crucial criteria: (1) Smaller parameter size: The parameter cost for each downstream task should be small – the essential criterion for parameter efficiency. (2) Development friendliness: This is critical for real-world development and deployment. In practice, it is necessary that a model can be easily implemented using the standard highly optimized deep learning toolboxes (e.g., PyTorch, TensorFlow, TensorRT, and TorchScript), without tedious per-toolbox specialization.
+
+This also facilitates the realization of high inference efficiency across a diversity of running platforms due to the best usage of built-in software and hardware resources.
+
+Under these considerations, we formulate the proposed ST-Adapter by sticking to commonly-adopted primitive operators alone. Starting with the above Adapter (Eq. (1)) originally developed for NLP tasks, we further introduce a spatio-temporal operator realized by a standard depth-wise 3Dconvolution layer [18] between the bottlenecks (Figure 1). In particular, our spatio-temporal operator enables layer-wise temporal inference efficiently, because it only operates in a compressed lowdimensional (e.g., 128D) feature space and the depth-wise convolution is highly efficient both in parameter and computation [26]. As a result, this yields an introduction of tiny extra $( \sim 2 \% )$ parameters and $( \sim 0 . 3 \% )$ computation. Formally, our ST-Adapter can be expressed as:
+
+$$
+\mathrm { S T - A d a p t e r ( { \mathbf { X } } ) } = { \mathbf { X } } + f \Bigl ( \mathrm { D W C o n v 3 D } ( { \mathbf { X } } { \mathbf { W } } _ { d o w n } ) \Bigr ) { \mathbf { W } } _ { u p } ,
+$$
+
+where DWConv3D denotes the depth-wise 3D-convolution for spatio-temporal reasoning we introduce. It is noteworthy that before applying DWConv3D, the down-projected feature representations will be first reshaped from $\mathbf { X } ^ { \prime } \in \mathbb { R } ^ { T \times N \times d }$ to ${ \bf X } ^ { \prime \prime } \in \mathbb { R } ^ { T \times h \times w \times d }$ (where $N = h \times w ,$ ) to have the spatial and temporal dimensions prepared for reasoning. With this highly integrated design, our ST-Adapter enjoys the same efficiency and flexibility as the NLP Adapter, while uniquely being able to conduct spatio-temporal modeling. l.
+
+# 3.3 ST-Adapter Integration
+
+For proper adaptation, the adapter modules are often integrated between layers of a Transformer. In NLP, a variety of integrating designs have been investigated. For example, [25] deploys two adapter modules per layer with one following the Multi-Head Self-Attention (MHSA) and the other following the Feed-Forward Networks (FFN) [25]. On the other hand, [63, 5] suggest that adding only one adapter after the FNN suffices. Similarly, our ST-Adapter can be also integrated generally at distinctive positions. Empirically, we find that a decent performance can be achieved in case a single ST-Adapter is placed before the MHSA of each transformer block (Figure 1(a) and Table 5c).
+
+# 4 Experiments
+
+# 4.1 Experiments Setup
+
+Datasets For the benchmark experiments, we use two popular video action recognition datasets.
+
+Kinetics-400 (K400): The K400 [33] dataset contains ${ \sim } 2 4 0 \mathrm { k }$ training videos and $2 0 \mathrm { k }$ validation videos labeled with 400 action categories. Most videos have a length of 10s or about 300 frames. While there is a great diversity in these videos, they are largely biased to spatial appearance [60].
+
+Something-Something- $\cdot \nu 2$ $( S S \nu 2 )$ : The SSv2 [22] dataset consists of 220,487 videos covering 174 human actions. The video length ranges from 2 to 6 seconds. In contrast to K400, SSv2 presents richer temporal information with much higher significance [60].
+
+Epic-Kitchens-100 (EK100): The EK100 [13] dataset consists of 100 hours of video in egocentric perspective recording a person interacting with a variety of objects in the kitchen. Each video sample is labeled with a verb and a noun. We report top-1 verb and noun classification accuracy.
+
+Pre-trained models In all experiments, we use the standard ViT [16] as our base backbone model. We conduct most of our experiments with the ViT-B/16 variant with 12 layers and 86M parameters, taking as input a sequence of patches at size $1 6 \times 1 6$ .
+
+What was learned during pre-training directly decides the knowledge that can be transferred to downstream tasks, thus also the effectiveness upper bound of transfer learning methods. To this end, we benchmark the same backbone under two different pre-training strategies: pre-training with web-scale raw data that has been recently proposed by CLIP [55] (400M image-text pair) and classical supervised pre-training on annotated data from ImageNet-21K (21k classes and 14M images).
+
+Implementation details. All details, including training and testing settings and module instantiation details, are provided in the appendix.
+
+Competitors We provide several transfer learning approaches in our benchmark for efficient imageto-video transfer learning. Note that the parameters of the linear classifier are always updated during training for all approaches.
+
+(1) Full Fine-tuning: Fully updating all the parameters when adapting for a specific target task.
+(2) Partial Fine-tuning: Only update the last ViT layer while keeping the rest of the parameter fixed.
+(3) Temporal Fine-tuning: We only tune the temporal attention modules (i.e., TA) in the $\mathrm { S A } { + } \mathrm { T A }$ architecture.
+(4) Linear Probing: Freezing all the parameters except those in the linear classification layer.
+(5) Adapter [25]: Adding small sub-networks between layers of a pre-trained model. During fine-tuning, we only update the newly added parameters introduced by the adapters.
+(6) Prompt Tuning [29]: Prepending a sequence of learnable prompt tokens to the input visual patch tokens. During fine-tuning, only these newly added prompts are updated.
+(7) Attention Pooling Head: Replacing the original temporal average pooling with a temporal attention pooling layer (similar to the one used in [9]) before the classification head.
+
+These approaches above do not incorporate temporal modeling to the image ViT. Hence, we further consider temporally augmented ViT architectures as introduced in state-of-the-art video methods:
+
+(a) Spatial Attention Only (SA): Space-Only TimeSformer [6].
+(b) Spatial Attention $^ +$ Temporal Attention $( S A + T A )$ : The default TimeSformer [6] with divided space-time attention (Fig. 1a).
+(c) Spatial Attention $^ +$ Temporal Shift $( S A + T S )$ : XViT [9].
+
+Note that not all fine-tuning protocols are compatible with each of these video ViT variants. Take $\mathrm { S A } { + } \mathrm { T S }$ for example, the original model behavior is altered with channel shift, as a result, it is not compatible with Linear Probing that requires freezing all the parameters of the backbone.
+
+# 4.2 Main Results and Analysis
+
+Cross-modality fine-tuning benchmark. Table 1 presents the results of fine-tuning a ViT-B/16 pre-trained with CLIP and ImageNet-21K. All baselines are built by combining existing efficient fine-tuning methods with three state-of-the-art ViT-based action recognition models. From the results we can see that:
+
+(i) For CLIP pre-trained model, ST-Adapter performs on par with Full Fine-tuning (82.0 vs. 81.7 for K400 and 66.3 vs. 66.1 for SSv2) while updating far less parameters (7.2M vs. 121.57M). ST-Adapter significantly outperforms all other efficient fine-tuning methods. We see that baselines like Prompt Tuning and Partial Fine-tuning can provide non-trivial gain in performance compared to Linear Probe, but are still behind our ST-Adapter.
+
+(ii) Our ST-Adapter can generalize across different pre-training datasets and methods. We can see that CLIP pre-train models dominate over ImageNet-21K pre-train ones. These results well match the shift of paradigm in current AI research [7], where pre-training no longer needs limiting to curated data and annotations to deliver good performance on downstream tasks, but can take advantage of broader scale web raw data.
+
+Interestingly, we observe that SSv2, a motion-centric dataset in design, also benefits from stronger appearance (image) pre-training. We think this may attribute to that raw textual description can provide a much richer description (i.e., human-object relations) of the image than curated limited categorical labels. Full fine-tuning on $\mathrm { S A } { + } \mathrm { T S }$ (XViT) performs slightly worse with CLIP pretrain than ImageNet-21k pretrain. We conjecture this is because the channel shift operation breaks the knowledge in the pre-training weights, and thus does not benefit much from stronger pre-training like CLIP.
+
+Comparison to the state-of-the-art models. We compare ViT with ST-Adapter to other state-of-thearts methods on both K400 dataset [33] in Table 2, SSv2 dataset [22] in Table 3 and EK100 dataset [13] in Table 4. We can observe that:
+
+(i) With the proper adaptation method, we can simply turn a large image foundation model into a good video model by only tuning a few parameters. Our results are comparable to or better than previous methods tailored for such tasks. Our largest model with ViT-L backbone set a new state-of-the-art in K400 by achieving $8 6 . 7 \%$ top-1 accuracy.
+
+Table 1: Benchmark results on Kinetics-400 and Something-Something-v2. We evaluate all the approaches on two datasets with ViT-B/16 pretrained with CLIP and ImageNet-21K. For each entry, we report the top1 action recognition accuracy and the number of fine-tuned parameters. All methods introduce extra parameters beside parameters of the ViT backbone and linear classifier. Our ST-Adapter achieves the best trade-off between accuracy and training efficiency. It is the only efficient fine-tuning method that can match the performance of full fine-tuning. The TM? column shows whether the method includes temporal modelling, i.e., a temporal aggregation method other than average pooling. All models are trained using 8 frames and tested with 3 views.
+
+
Fine-tuning Methods
Architecture TM?
Fine-tuned Params (M)
CLIP
ImageNet-21K
K400
SSv2
K400
SSv2
Full Fine-tuning
SA
86.11
81.0
44.0
76.9
40.0
SA + TA [6] SA + TS [9]
:
121.57 93.79
817
66.1
78.0
59.5
Partial Fine-tuning
78.0
62.0
78.5
64.4
SA SA + TA
√
7.40 10.36
80.1 80.3
37.6 57.5
61.7 63.1
20.4 29.3
Temporal Fine-tuning
SA + TA
√
35.8
81.3
59.4
76.5
51.9
Prompt Tuning
SA
1.18
79.3
39.3
71.4
26.3
Attentional Pooling
SA
√
2.36
75.3
21.5
59.1
15.1
Linear Probe
SA
0.31
76.6
21.9
60.1
14.8
Adapter [25]
SA
6.77
81.6
46.2
76.2
40.5
SA
一√
7.20
82.0
66.3
76.6
ST-Adapter (ours)
62.8
+
+(ii) It is noteworthy that, our method takes significantly fewer frames as input compared to other methods (8 vs. 16, 32, 64, 96). It is also reflected in terms of GFlops. Saying that the ViT was not designed for efficiency purposes like [38, 9, 43, 17] but the adapted CLIP ViT has achieved similar accuracy-efficiency trade-offs.
+
+(iii) The paradigm of pre-training and fine-tuning has been widely adopted in most state-of-art methods to achieve good performance. Between them, most of the approaches start from image pre-trained models, and only a few can afford video pre-training. Note that for the SomethingSomething dataset, except MViT [17] pre-trained on video data from scratch, the rest of methods are still initialized from image pre-trained weights. A good image pre-trained model with rich appearance information can facilitate temporal modeling in temporally challenging datasets like SSv2.
+
+(iii) It is evident in Table 4 that our ST-Adapter consistently brings a big margin on egocentric videos. Also, we found that without our ST-Adapter, it is much more difficult to directly adapt CLIP pre-trained ViT on the domain of egocentric video with high sensitivity to the hyper-parameter setting. ST-Adapter eases the training process. It is worthy to note that, all current transformer based approaches need to be pre-trained first on image dataset and then fine-tuned on Kinetics dataset before fine-tuned with egocentric videos. In contrast, our ST-Adapter can be directly applied to an image model and trained with target egocentric video alone.
+
+# 4.3 Ablations
+
+Unless otherwise specified, we use ViT-B/16 backbone and 8 input frames in all ablation experiments, and we use one ST-Adapter with bottleneck width 384 before MHSA in each Transformer block.
+
+Where to insert ST-Adapter By default, we insert a ST-Adapter to every Transformer block in the backbone, but we also show the performance impact of using fewer ST-Adapters. As shown in Table 5b, while more ST-Adapters tend to do better, ST-Adapters at deeper layers boost performance more than those at shallower layers. This observation is useful when we insert ST-Adapters into deeper models and having an Adapter for each block might be too expensive. We also show the performance when inserting ST-Adapters to different positions within a block. As shown in Table 5c, while the performance is relatively insensitive to the position of the Adapters, using multiple adapters in one block may substantially boost performance on some datasets, like SSv2 in our case.
+
+Table 2: Results on Kinetics-400 validation set. “Frames” denotes the total number of frames used during inference which is: # frames per clip $\times$ # temporal clip $\times$ # spatial crop. “GFlops” means $1 0 ^ { 9 }$ Flops. Our ViT w/ ST-Adapter achieves new state-of-the-art performances on K400 at similar GFlops.
+
+
Model
Pretrain
#Frames
GFlops
Top-1
Top-5
Methods with full-finetuning
LGD[53]
IN-1K
128×N/A
N/A
79.4
94.4
SlowFast+NL[19]
=
16×3×10
7020
79.8
93.9
ip-CSN[70]
Sports1M
32×3×10
3270
79.2
93.8
CorrNet[71]
Sports1M
32×3×10
6720
81.0
=
X3D-XL[18]
16×3×10
1452
79.1
93.9
MoViNet-A6[34]
1
120×1×1
386
81.5
95.3
ViT-B-VTN [47]
IN21K
250×1×1
3992
78.6
93.7
TimeSformer-L[6]
IN21K
96×3×1
7140
80.7
94.7
STAM [61]
IN21K
64×1×1
1040
79.2
1
X-ViT[9]
IN21K
16×3×1
850
80.2
94.7
Mformer-HR[49]
IN-21K
16×3×10
28764
81.1
95.2
MViT-B,32×3[17]
-
32×1×5
850
80.2
94.4
ViViT-L[2]
JFT300M
16×3×4
17352
82.8
95.3
Swin-B[44]
IN1K
32×3×4
3384
80.6
94.6
Swin-L(384)[44]
IN21K
32×5×10
105350
84.9
96.7
UniFormer-B[38]
IN1K
32×1×4
1036
82.9
95.4
VATT-Large(320)[1]
HowTo100M
32×3×4
29800
82.1
95.5
TokenLearner[58]
JFT300M
64×3×4
48912
85.4
96.3
OMNIVORE(Swin-L)[21]
IN22K+SUN
32×3×4
7248
84.1
96.3
MTV-H[80]
WTS-280
32×3×4
73570
89.9
98.3
ViT-B w/o ST-Adapter
CLIP
8×3×1
419
81.0
95.5
ViT-L w/o ST-Adapter
CLIP
8×3×1
1941
85.8
97.2
Methodswith frozen backbone
Our ViT-B w/ST-Adapter
CLIP
8×3×1
455
82.0
95.7
Our ViT-B w/ ST-Adapter
CLIP
16×3×1
911
82.5
96.0
Our ViT-B w/ ST-Adapter
CLIP
32×3×1
1821
82.7
96.2
Our ViT-L w/ST-Adapter
CLIP
8×3×1
2062
86.7
97.5
Our ViT-L w/ ST-Adapter
CLIP
16×3×1
4124
86.9
97.6
Our ViT-L w/ ST-Adapter
CLIP
32×3×1
8248
87.2
97.6
+
+Training parameter efficiency We experiment with a different number of channels in the middle of the bottleneck design. As shown in Table 5a and Fig. 2a, our method is effective with a wide range of bottleneck width: even with a channel reduction to 64, our ST-Adapters still obtain relatively good performance, outperforming all baselines in Table 1 except for Full Fine-tuning $\mathrm { ( S A + T A ) }$ . Even with a bottleneck width of 768, our ST-Adapters are still very parameter efficient, introducing only about 1/6 new parameters to a Transformer encoder block. In contrast to the inverted bottleneck design commonly used with depthwise convolutions [59], ST-Adapters work best with regular bottlenecks. The success of transfer learning with such low-rank projections again shows the rich knowledge and strong potential of modern foundation models.
+
+Training time efficiency In Fig. 2b we show an enlarged difference between full fine-tuned models and our ST-Adapters with low training budgets. When we reduce the number of training steps, the accuracy of full fine-tuned models drops significantly faster than models with ST-Adapters. This shows the advantage of our proposed modules when backbone models are large or computational resources are limited. We also report the total training GPU-hours and peak memory usage for three models: TimeSformer, ViT-B/16, ViT-B/16 with ST-Adapter (8 input frames, 16 samples per GPU on 8 V100 GPUs) in Table 6.
+
+Table 3: Results on Something-Something-v2 validation set. “Frames” denotes the total number of frames used during inference which is: # frames per clip $\times$ # temporal clip $\times \#$ spatial crop. “GFlops” means $1 0 ^ { 9 }$ Flops. Our ViT w/ ST-Adapter outperforms most of the current methods by only fine-tuning a very small set of parameters. Here the ViT-B w/ ST-Adapter result is reported using 2 ST-Adapters per block.
+
+
+
+Table 4: Results on Epic-Kitchens-100 validation set. “Frames” denotes the total number of frames used during inference which is: # frames per clip $\times$ # temporal clip $\times \#$ spatial crop.
+
+
Model
Pre-train data
#Frames
Verb
Noun
Methods with full-finetuning
ViViT-L [2]
IN21K+K400
16×3×10
66.4
56.8
MFormer-B [49]
IN21K+K400
16 ×3×10
66.7
56.5
XViT(8x) [9]
IN21K+K400
8×3×1
66.7
53.3
ViT-B/16 w/o ST-Adapter
CLIP
8×3×1
54.8
50.4
Methods with frozen backbone
Our ViT-B/16 w/ ST-Adapter
CLIP
8×3×1
67.6
55.0
+
+Table 5: Ablation study on K-400 and SSv2. (a) We show the performance with different channel numbers in the bottleneck. (b) We evenly divide the 12 blocks of ViT-B/16 into 3 groups. Block no. 1 is closest to input and no. 12 is closest to output. (c) Effect of where to put the ST-Adapter inside a block, whose diagram is shown in Fig. 1.
+
+
(a) Bottleneck width
width K400
SSv2
64
81.4 64.4
128 81.6
64.9
256 81.8
65.5
384
82.0 65.6
768 81.9
65.5
+
+(c) Local position
+
+
position
K400
SSv2
before MHSA
82.0
65.6
after MHSA
81.9
65.7
afterFFN
81.9
65.9
before&after MHSA
82.0
67.0
+
+
(b) Global position
1-4
5-8
9-12
K400
SSv2
√
77.7
45.9
!
√
80.0
60.9
√
81.3
62.8
√
81.8
65.6
√
82.0
65.6
+
+
+Figure 2: Ablation study on efficiency (a) Parameter efficiency: ST-Adapter (with different bottleneck width) is compared with efficient fine-tuning methods in Table 1. (b) Training efficiency: We compare ST-Adapter with Full fine-tuning under different training schedules. Batch size is aligned and their original schedules are shortened proportionally. (c) Data efficiency: Performance comparison on different training data scales. The same ViT-B/16 with CLIP pre-training is used for all experiments.
+
+Training data efficiency Fig. 2c showcases the impact of training data size on action recognition accuracy. Even with the same pre-trained weights, ST-Adapters tend to obtain higher performance than full fine-tuning especially on smaller datasets: the margin between the two models increases with the shrinkage of data. This shows that ST-Adapters are powerful tools to transfer to downstream tasks where only a small amount of labeled data is available.
+
+Effects of kernel shape We ablate the effect of kernel size in the depth-wise convolutions inside our proposed ST-Adapter. It is shown in Table 7 that the temporal span is most sensitive, suggesting the significance of temporal structural modeling as we focus on in this work.
+
+Table 6: Training time and memory. For full-finetuning we used the recipes in [6].
+
+
Model
Training GPU-hours (K400)
Peak mem ( (MB)
TimeSformer[6] (Full Fine-tune)
60 (+161%)
21694 (+52%)
ViT-B/16 (Full Fine-tune)
40 (+74%)
17275 (+21%)
ViT-B/16 w/ ST-Adapter
23
14238
+
+# 5 Conclusions
+
+Table 7: Effects of kernel shape. Kernel size is denoted as $k _ { T } \times k _ { H } \times$ $k _ { W }$ for time, height and width.
+
+
Kernel Size
K400
SSv2
1×1×1
81.6
46.2
1×3×3
81.4
46.2
3×1×1
82.0
66.3
3×3×3
82.0
65.6
+
+In this work, we have presented a simple yet effective SpatioTemporal Adapter (ST-Adapter) for enabling a less studied parameter-efficient image-to-video transfer learning. Fully using commonly adopt primitive operators, ST-Adapter is particularly designed to be both lightweight and easy to implement for friendly usability and deployment. This cross-modality adaptation is a practically critical capability considering that it is dramatically challenging and more costly to build a sufficiently strong large video model in reality. Encouragingly, extensive experiments on video action recognition show that our ST
+
+Adapter can match or surpass both the full fine-tuning strategy as well as fully trained state-of-the-art video models, whilst having the benefit of (20 times less updated parameters) parameter-efficiency. Further, our method is also faster to train and consumes less computing resources with economic and environmental superiority. We believe this work is inspiring for the research of other video understanding tasks such as action localization and video summarization.
+
+Acknowledgement This work is supported in part by Centre for Perceptual and Interactive Intelligence Limited, in part by the General Research Fund through the Research Grants Council of Hong Kong under Grants (Nos. 14204021, 14207319).
+
+# References
+
+[1] 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. Advances in Neural Information Processing Systems, 34, 2021.
+[2] Anurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun, Mario Luciˇ c, and Cordelia Schmid. Vivit: A ´ video vision transformer. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6836–6846, 2021.
+[3] Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
+[4] Hyojin Bahng, Ali Jahanian, Swami Sankaranarayanan, and Phillip Isola. Visual prompting: Modifying pixel space to adapt pre-trained models. arXiv preprint arXiv:2203.17274, 2022.
+[5] Ankur Bapna, Naveen Arivazhagan, and Orhan Firat. Simple, scalable adaptation for neural machine translation. arXiv preprint arXiv:1909.08478, 2019.
+[6] Gedas Bertasius, Heng Wang, and Lorenzo Torresani. Is space-time attention all you need for video understanding? arXiv preprint arXiv:2102.05095, 2021.
+[7] Rishi Bommasani, Drew A Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, et al. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258, 2021.
+[8] 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. volume 33, pages 1877–1901. Curran Associates, Inc., 2020.
+[9] Adrian Bulat, Juan Manuel Perez Rua, Swathikiran Sudhakaran, Brais Martinez, and Georgios Tzimiropoulos. Space-time mixing attention for video transformer. Advances in Neural Information Processing Systems, 34, 2021.
+[10] Joao Carreira and Andrew Zisserman. Quo vadis, action recognition? a new model and the kinetics dataset. In proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6299–6308, 2017.
+[11] Joao Carreira, Eric Noland, Andras Banki-Horvath, Chloe Hillier, and Andrew Zisserman. A short note about kinetics-600. arXiv preprint arXiv:1808.01340, 2018.
+[12] Joao Carreira, Eric Noland, Chloe Hillier, and Andrew Zisserman. A short note on the kinetics-700 human action dataset. arXiv preprint arXiv:1907.06987, 2019.
+[13] Dima Damen, Hazel Doughty, Giovanni Maria Farinella, , Antonino Furnari, Jian Ma, Evangelos Kazakos, Davide Moltisanti, Jonathan Munro, Toby Perrett, Will Price, and Michael Wray. Rescaling egocentric vision: Collection, pipeline and challenges for epic-kitchens-100. International Journal of Computer Vision (IJCV), 130:33–55, 2022. URL https://doi.org/10.1007/s11263-021-01531-2.
+[14] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. 2009.
+[15] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics.
+[16] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. 2020.
+[17] Haoqi Fan, Bo Xiong, Karttikeya Mangalam, Yanghao Li, Zhicheng Yan, Jitendra Malik, and Christoph Feichtenhofer. Multiscale vision transformers. arXiv preprint arXiv:2104.11227, 2021.
+[18] Christoph Feichtenhofer. X3d: Expanding architectures for efficient video recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 203–213, 2020.
+[19] Christoph Feichtenhofer, Haoqi Fan, Jitendra Malik, and Kaiming He. Slowfast networks for video recognition. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6202–6211, 2019.
+[20] Christoph Feichtenhofer, Haoqi Fan, Bo Xiong, Ross Girshick, and Kaiming He. A large-scale study on unsupervised spatiotemporal representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3299–3309, 2021.
+[21] Rohit Girdhar, Mannat Singh, Nikhila Ravi, Laurens van der Maaten, Armand Joulin, and Ishan Misra. Omnivore: A single model for many visual modalities. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 16102–16112, 2022.
+[22] Raghav Goyal, Samira Ebrahimi Kahou, Vincent Michalski, Joanna Materzynska, Susanne Westphal, Heuna Kim, Valentin Haenel, Ingo Fruend, Peter Yianilos, Moritz Mueller-Freitag, et al. The" something something" video database for learning and evaluating visual common sense. In Proceedings of the IEEE International Conference on Computer Vision, pages 5842–5850, 2017.
+[23] Ryota Hashiguchi and Toru Tamaki. Vision transformer with cross-attention by temporal shift for efficient action recognition. arXiv preprint arXiv:2204.00452, 2022.
+[24] Junxian He, Chunting Zhou, Xuezhe Ma, Taylor Berg-Kirkpatrick, and Graham Neubig. Towards a unified view of parameter-efficient transfer learning. 2022.
+[25] Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin De Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-efficient transfer learning for nlp. In ICML, pages 2790–2799. PMLR, 2019.
+[26] 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 arXiv:1704.04861, 2017.
+[27] Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. Lora: Low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685, 2021.
+[28] Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc Le, Yun-Hsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. In International Conference on Machine Learning, pages 4904–4916. PMLR, 2021.
+[29] Menglin Jia, Luming Tang, Bor-Chun Chen, Claire Cardie, Serge Belongie, Bharath Hariharan, and Ser-Nam Lim. Visual prompt tuning. arXiv preprint arXiv:2203.12119, 2022.
+[30] Boyuan Jiang, MengMeng Wang, Weihao Gan, Wei Wu, and Junjie Yan. Stm: Spatiotemporal and motion encoding for action recognition. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 2000–2009, 2019.
+[31] Chen Ju, Tengda Han, Kunhao Zheng, Ya Zhang, and Weidi Xie. Prompting visual-language models for efficient video understanding. arXiv preprint arXiv:2112.04478, 2021.
+[32] Andrej Karpathy, George Toderici, Sanketh Shetty, Thomas Leung, Rahul Sukthankar, and Li Fei-Fei. Large-scale video classification with convolutional neural networks. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pages 1725–1732, 2014.
+[33] Will Kay, Joao Carreira, Karen Simonyan, Brian Zhang, Chloe Hillier, Sudheendra Vijayanarasimhan, Fabio Viola, Tim Green, Trevor Back, Paul Natsev, et al. The kinetics human action video dataset. arXiv preprint arXiv:1705.06950, 2017.
+[34] D. Kondratyuk, Liangzhe Yuan, Yandong Li, Li Zhang, Mingxing Tan, Matthew A. Brown, and Boqing Gong. Movinets: Mobile video networks for efficient video recognition. ArXiv, abs/2103.11511, 2021.
+[35] Heeseung Kwon, Manjin Kim, Suha Kwak, and Minsu Cho. Motionsqueeze: Neural motion feature learning for video understanding. In ECCV, 2020.
+[36] Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 3045–3059, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics.
+[37] Kunchang Li, Xianhang Li, Yali Wang, Jun Wang, and Y. Qiao. Ct-net: Channel tensorization network for video classification. ArXiv, abs/2106.01603, 2021.
+[38] Kunchang Li, Yali Wang, Junhao Zhang, Peng Gao, Guanglu Song, Yu Liu, Hongsheng Li, and Yu Qiao. Uniformer: Unifying convolution and self-attention for visual recognition. arXiv preprint arXiv:2201.09450, 2022.
+[39] Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 4582– 4597, Online, August 2021. Association for Computational Linguistics.
+[40] Yanghao Li, Chao-Yuan Wu, Haoqi Fan, Karttikeya Mangalam, Bo Xiong, Jitendra Malik, and Christoph Feichtenhofer. Improved multiscale vision transformers for classification and detection. arXiv preprint arXiv:2112.01526, 2021.
+[41] Ji Lin, Chuang Gan, and Song Han. Tsm: Temporal shift module for efficient video understanding. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 7083–7093, 2019.
+[42] Xiao Liu, Kaixuan Ji, Yicheng Fu, Zhengxiao Du, Zhilin Yang, and Jie Tang. P-tuning v2: Prompt tuning can be comparable to fine-tuning universally across scales and tasks. arXiv preprint arXiv:2110.07602, 2021.
+[43] 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. 2021.
+[44] Ze Liu, Jia Ning, Yue Cao, Yixuan Wei, Zheng Zhang, Stephen Lin, and Han Hu. Video swin transformer. arXiv preprint arXiv:2106.13230, 2021.
+[45] Zhaoyang Liu, Limin Wang, Wayne Wu, Chen Qian, and Tong Lu. Tam: Temporal adaptive module for video recognition. arXiv preprint arXiv:2005.06803, 2020.
+[46] Chenxu Luo and Alan L. Yuille. Grouped spatial-temporal aggregation for efficient action recognition. 2019 IEEE International Conference on Computer Vision (ICCV), pages 5511–5520, 2019.
+[47] Daniel Neimark, Omri Bar, Maya Zohar, and Dotan Asselmann. Video transformer network. ArXiv, abs/2102.00719, 2021.
+[48] Junting Pan, Siyu Chen, Mike Zheng Shou, Yu Liu, Jing Shao, and Hongsheng Li. Actor-context-actor relation network for spatio-temporal action localization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 464–474, June 2021.
+[49] Mandela Patrick, Dylan Campbell, Yuki Asano, Ishan Misra, Florian Metze, Christoph Feichtenhofer, Andrea Vedaldi, and João F Henriques. Keeping your eye on the ball: Trajectory attention in video transformers. Advances in Neural Information Processing Systems, 34, 2021.
+[50] Jonas Pfeiffer, Aishwarya Kamath, Andreas Rücklé, Kyunghyun Cho, and Iryna Gurevych. Adapterfusion: Non-destructive task composition for transfer learning. arXiv preprint arXiv:2005.00247, 2020.
+[51] Jonas Pfeiffer, Andreas Rücklé, Clifton Poth, Aishwarya Kamath, Ivan Vulic, Sebastian Ruder, Kyunghyun ´ Cho, and Iryna Gurevych. Adapterhub: A framework for adapting transformers. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP 2020): Systems Demonstrations, pages 46–54, Online, 2020. Association for Computational Linguistics.
+[52] Guanghui Qin and Jason Eisner. Learning how to ask: Querying lms with mixtures of soft prompts. arXiv preprint arXiv:2104.06599, 2021.
+[53] Zhaofan Qiu, Ting Yao, C. Ngo, Xinmei Tian, and Tao Mei. Learning spatio-temporal representation with local and global diffusion. 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 12048–12057, 2019.
+[54] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
+[55] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pages 8748–8763. PMLR, 2021.
+[56] Sylvestre-Alvise Rebuffi, Hakan Bilen, and Andrea Vedaldi. Learning multiple visual domains with residual adapters. 30, 2017.
+[57] Sylvestre-Alvise Rebuffi, Hakan Bilen, and Andrea Vedaldi. Efficient parametrization of multi-domain deep neural networks. pages 8119–8127, 2018.
+[58] Michael Ryoo, AJ Piergiovanni, Anurag Arnab, Mostafa Dehghani, and Anelia Angelova. Tokenlearner: Adaptive space-time tokenization for videos. Advances in Neural Information Processing Systems, 34, 2021.
+[59] Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4510–4520, 2018.
+[60] Laura Sevilla-Lara, Shengxin Zha, Zhicheng Yan, Vedanuj Goswami, Matt Feiszli, and Lorenzo Torresani. Only time can tell: Discovering temporal data for temporal modeling. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 535–544, 2021.
+[61] Gilad Sharir, Asaf Noy, and Lihi Zelnik-Manor. An image is worth 16x16 words, what is a video worth? ArXiv, abs/2103.13915, 2021.
+[62] Taylor Shin, Yasaman Razeghi, Robert L Logan IV, Eric Wallace, and Sameer Singh. Autoprompt: Eliciting knowledge from language models with automatically generated prompts. arXiv preprint arXiv:2010.15980, 2020.
+[63] Asa Cooper Stickland and Iain Murray. Bert and pals: Projected attention layers for efficient adaptation in multi-task learning. In International Conference on Machine Learning, pages 5986–5995. PMLR, 2019.
+[64] Chen Sun, Austin Myers, Carl Vondrick, Kevin Murphy, and Cordelia Schmid. Videobert: A joint model for video and language representation learning. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 7464–7473, 2019.
+[65] Yi-Lin Sung, Jaemin Cho, and Mohit Bansal. Vl-adapter: Parameter-efficient transfer learning for visionand-language tasks. arXiv preprint arXiv:2112.06825, 2021.
+[66] Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. In European conference on computer vision, pages 776–794. Springer, 2020.
+[67] Zhan Tong, Yibing Song, Jue Wang, and Limin Wang. Videomae: Masked autoencoders are data-efficient learners for self-supervised video pre-training. arXiv preprint arXiv:2203.12602, 2022.
+[68] Du Tran, Lubomir Bourdev, Rob Fergus, Lorenzo Torresani, and Manohar Paluri. Learning spatiotemporal features with 3d convolutional networks. In Proceedings of the IEEE international conference on computer vision, pages 4489–4497, 2015.
+[69] Du Tran, Heng Wang, Lorenzo Torresani, Jamie Ray, Yann LeCun, and Manohar Paluri. A closer look at spatiotemporal convolutions for action recognition. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pages 6450–6459, 2018.
+[70] Du Tran, Heng Wang, L. Torresani, and Matt Feiszli. Video classification with channel-separated convolutional networks. 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pages 5551–5560, 2019.
+[71] Heng Wang, Du Tran, L. Torresani, and Matt Feiszli. Video modeling with correlation networks. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 349–358, 2020.
+[72] Limin Wang, Yuanjun Xiong, Zhe Wang, Yu Qiao, Dahua Lin, Xiaoou Tang, and Luc Van Gool. Temporal segment networks for action recognition in videos. IEEE transactions on pattern analysis and machine intelligence, 41(11):2740–2755, 2018.
+[73] Limin Wang, Zhan Tong, Bin Ji, and Gangshan Wu. Tdn: Temporal difference networks for efficient action recognition. ArXiv, abs/2012.10071, 2020.
+[74] Mengmeng Wang, Jiazheng Xing, and Yong Liu. Actionclip: A new paradigm for video action recognition. arXiv preprint arXiv:2109.08472, 2021.
+[75] Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7794–7803, 2018.
+[76] Chen Wei, Haoqi Fan, Saining Xie, Chao-Yuan Wu, Alan Yuille, and Christoph Feichtenhofer. Masked feature prediction for self-supervised visual pre-training. arXiv preprint arXiv:2112.09133, 2021.
+[77] Saining Xie, Chen Sun, Jonathan Huang, Zhuowen Tu, and Kevin Murphy. Rethinking spatiotemporal feature learning: Speed-accuracy trade-offs in video classification. In Proceedings of the European conference on computer vision (ECCV), pages 305–321, 2018.
+[78] Hu Xu, Gargi Ghosh, Po-Yao Huang, Prahal Arora, Masoumeh Aminzadeh, Christoph Feichtenhofer, Florian Metze, and Luke Zettlemoyer. Vlm: Task-agnostic video-language model pre-training for video understanding. arXiv preprint arXiv:2105.09996, 2021.
+[79] Hu Xu, Gargi Ghosh, Po-Yao Huang, Dmytro Okhonko, Armen Aghajanyan, Florian Metze, Luke Zettlemoyer, and Christoph Feichtenhofer. Videoclip: Contrastive pre-training for zero-shot video-text understanding. In EMNLP, 2021.
+[80] Shen Yan, Xuehan Xiong, Anurag Arnab, Zhichao Lu, Mi Zhang, Chen Sun, and Cordelia Schmid. Multiview transformers for video recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3333–3343, 2022.
+[81] Jiahui Yu, Zirui Wang, Vijay Vasudevan, Legg Yeung, Mojtaba Seyedhosseini, and Yonghui Wu. Coca: Contrastive captioners are image-text foundation models. arXiv preprint arXiv:2205.01917, 2022.
+[82] Hao Zhang, Yanbin Hao, and Chong-Wah Ngo. Token shift transformer for video classification. In Proceedings of the 29th ACM International Conference on Multimedia, pages 917–925, 2021.
+[83] Jeffrey O Zhang, Alexander Sax, Amir Zamir, Leonidas Guibas, and Jitendra Malik. Side-tuning: a baseline for network adaptation via additive side networks. pages 698–714. Springer, 2020.
+[84] Yuanhan Zhang, Kaiyang Zhou, and Ziwei Liu. Neural prompt search. arXiv preprint arXiv:2206.04673, 2022.
+[85] Kaiyang Zhou, Jingkang Yang, Chen Change Loy, and Ziwei Liu. Learning to prompt for vision-language models. arXiv preprint arXiv:2109.01134, 2021.
+[86] Kaiyang Zhou, Jingkang Yang, Chen Change Loy, and Ziwei Liu. Conditional prompt learning for vision-language models. In CVPR, 2022.
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [No]
+(c) Did you discuss any potential negative societal impacts of your work? [No]
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs‘ of all theoretical results? [N/A]
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Code will be provided on GitHub after blind review.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See ??
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] The experiments are too expensive to repeat many times.
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See ??
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes] All are mentioned in 4
+(b) Did you mention the license of the assets? [No]
+(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Code will be provided on GitHub after blind review.
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/uYLFoz1vlAC/uYLFoz1vlAC.md b/md/dev/uYLFoz1vlAC/uYLFoz1vlAC.md
new file mode 100644
index 0000000000000000000000000000000000000000..e8d61b7456c25fc08fa76b641c3e832fc12aad26
--- /dev/null
+++ b/md/dev/uYLFoz1vlAC/uYLFoz1vlAC.md
@@ -0,0 +1,841 @@
+# EFFICIENTLY MODELING LONG SEQUENCES WITH STRUCTURED STATE SPACES
+
+Albert Gu & Karan Goel & Christopher Re´
+Department of Computer Science, Stanford University
+{albertgu,krng}@stanford.edu, chrismre@cs.stanford.edu
+
+# ABSTRACT
+
+A central goal of sequence modeling is designing a single principled model that can address sequence data across a range of modalities and tasks, particularly on long-range dependencies. Although conventional models including RNNs, CNNs, and Transformers have specialized variants for capturing long dependencies, they still struggle to scale to very long sequences of 10000 or more steps. A promising recent approach proposed modeling sequences by simulating the fundamental state space model (SSM) $x ^ { \prime } ( t ) = A x ( t ) + \bar { B } u ( t ) , y ( \bar { t } ) = C x ( t ) \bar { + } D u ( t )$ , and showed that for appropriate choices of the state matrix $A$ , this system could handle longrange dependencies mathematically and empirically. However, this method has prohibitive computation and memory requirements, rendering it infeasible as a general sequence modeling solution. We propose the Structured State Space (S4) sequence model based on a new parameterization for the SSM, and show that it can be computed much more efficiently than prior approaches while preserving their theoretical strengths. Our technique involves conditioning $A$ with a low-rank correction, allowing it to be diagonalized stably and reducing the SSM to the well-studied computation of a Cauchy kernel. S4 achieves strong empirical results across a diverse range of established benchmarks, including (i) $91 \%$ accuracy on sequential CIFAR-10 with no data augmentation or auxiliary losses, on par with a larger 2-D ResNet, (ii) substantially closing the gap to Transformers on image and language modeling tasks, while performing generation $6 0 \times$ faster (iii) SoTA on every task from the Long Range Arena benchmark, including solving the challenging Path-X task of length 16k that all prior work fails on, while being as efficient as all competitors.1
+
+# 1 INTRODUCTION
+
+A central problem in sequence modeling is efficiently handling data that contains long-range dependencies (LRDs). Real-world time-series data often requires reasoning over tens of thousands of time steps, while few sequence models address even thousands of time steps. For instance, results from the long-range arena (LRA) benchmark (Tay et al., 2021) highlight that sequence models today perform poorly on LRD tasks, including one (Path-X) where no model performs better than random guessing.
+
+Since LRDs are perhaps the foremost challenge for sequence models, all standard model families such as continuous-time models (CTMs), RNNs, CNNs, and Transformers include many specialized variants designed to address them. Modern examples include orthogonal and Lipschitz RNNs (Arjovsky et al., 2016; Erichson et al., 2021) to combat vanishing gradients, dilated convolutions to increase context size (Bai et al., 2018; Oord et al., 2016), and an increasingly vast family of efficient Transformers that reduce the quadratic dependence on sequence length (Katharopoulos et al., 2020; Choromanski et al., 2020). Despite being designed for LRDs, these solutions still perform poorly on challenging benchmarks such as LRA (Tay et al., 2021) or raw audio classification (Gu et al., 2021).
+
+An alternative approach to LRDs was recently introduced based on the state space model (SSM) (Fig. 1). SSMs are a foundational scientific model used in fields such as control theory, computational neuroscience, and many more, but have not been applicable to deep learning for concrete theoretical reasons. In particular, Gu et al. (2021) showed that deep SSMs actually struggle even on simple tasks, but can perform exceptionally well when equipped with special state matrices $\pmb { A }$ recently derived to solve a problem of continuous-time memorization (Voelker et al., 2019; Gu et al., 2020a). Their Linear State Space Layer (LSSL) conceptually unifies the strengths of CTM, RNN and CNN models, and provides a proof of concept that deep SSMs can address LRDs in principle.
+
+
+Figure 1: (Left) State Space Models (SSM) parameterized by matrices $A , B , C , D$ map an input signal $u ( t )$ to output $y ( t )$ through a latent state $x ( t )$ . (Center) Recent theory on continuous-time memorization derives special $\pmb { A }$ matrices that allow SSMs to capture LRDs mathematically and empirically. (Right) SSMs can be computed either as a recurrence (left) or convolution (right). However, materializing these conceptual views requires utilizing different representations of its parameters (red, blue, green) which are very expensive to compute. S4 introduces a novel parameterization that efficiently swaps between these representations, allowing it to handle a wide range of tasks, be efficient at both training and inference, and excel at long sequences.
+
+Unfortunately, the LSSL is infeasible to use in practice because of prohibitive computation and memory requirements induced by the state representation. For state dimension $N$ and sequence length $L$ , computing the latent state requires $\Dot { O (} N ^ { 2 } L )$ operations and $O ( N L )$ space – compared to a $\Omega ( L + N )$ lower bound for both. Thus for reasonably sized models (e.g. $N = 2 5 6$ in Gu et al. (2021)), the LSSL uses orders of magnitude more memory than comparably-sized RNNs or CNNs. Although theoretically efficient algorithms for the LSSL were proposed, we show that these are numerically unstable. In particular, the special $\pmb { A }$ matrix is highly non-normal in the linear algebraic sense, which prevents the application of conventional algorithmic techniques. Consequently, although the LSSL showed that SSMs have strong performance, they are currently computationally impractical as a general sequence modeling solution.
+
+In this work, we introduce the Structured State Space (S4) sequence model based on the SSM that solves the critical computational bottleneck in previous work. Technically, S4 reparameterizes the structured state matrices $\pmb { A }$ appearing in Voelker et al. (2019); Gu et al. (2020a) by decomposing them as the sum of a low-rank and skew-symmetric term. Additionally, instead of expanding the standard SSM in coefficient space, we compute its truncated generating function in frequency space, which can be simplified into a multipole-like evaluation. Combining these two ideas, we show that the low-rank term can be corrected by the Woodbury identity while the skew-symmetric term can be diagonalized stably, ultimately reducing to a well-studied and theoretically stable Cauchy kernel (Pan, 2001; 2017). This results in $\tilde { O } ( N + \bar { L } )$ computation and $O ( N + L )$ memory usage, which is essentially tight for sequence models. Compared to the LSSL, S4 is up to $3 0 \times$ faster with $4 0 0 \times$ less memory usage, while exceeding the LSSL’s performance empirically.
+
+Empirically, S4 significantly advances the state-of-the-art for LRD. On the LRA benchmark for efficient sequence models, S4 is as fast as all baselines while outperforming them by $2 0 +$ points on average. S4 is the first model to solve the difficult LRA Path-X task (length-16384), achieving $88 \%$ accuracy compared to $50 \%$ random guessing for all prior work. On speech classification with length-16000 sequences, S4 halves the test error $( 1 . 7 \% )$ of specialized Speech CNNs – by contrast, all RNN and Transformer baselines fail to learn $\ge 7 0 \%$ error).
+
+Towards a general-purpose sequence model. Beyond LRD, a broad goal of machine learning is to develop a single model that can be used across a wide range of problems. Models today are typically specialized to solve problems from a particular domain (e.g. images, audio, text, time-series), and enable a narrow range of capabilities (e.g. efficient training, fast generation, handling irregularly sampled data). This specialization is typically expressed via domain-specific preprocessing, inductive biases, and architectures. Sequence models provide a general framework for solving many of these problems with reduced specialization – e.g. Vision Transformers for image classification with less
+
+2D information (Dosovitskiy et al., 2020). However, most models such as Transformers generally still require substantial specialization per task to achieve high performance.
+
+Deep SSMs in particular have conceptual strengths that suggest they may be promising as a general sequence modeling solution. These strengths include a principled approach to handling LRDs, as well as the ability to move between continuous-time, convolutional, and recurrent model representations, each with distinct capabilities (Fig. 1). Our technical contributions enable SSMs to be applied successfully to a varied set of benchmarks with minimal modification:
+
+• Large-scale generative modeling. On CIFAR-10 density estimation, S4 is competitive with the best autoregressive models (2.85 bits per dim). On WikiText-103 language modeling, S4 substantially closes the gap to Transformers (within 0.8 perplexity), setting SoTA for attention-free models. • Fast autoregressive generation. Like RNNs, S4 can use its latent state to perform $6 0 \times$ faster pixel/token generation than standard autoregressive models on CIFAR-10 and WikiText-103. • Sampling resolution change. Like specialized CTMs, S4 can adapt to changes in time-series sampling frequency without retraining, e.g. at $0 . 5 \times$ frequency on speech classification. • Learning with weaker inductive biases. With no architectural changes, S4 surpasses Speech CNNs on speech classification, outperforms the specialized Informer model on time-series forecasting problems, and matches a 2-D ResNet on sequential CIFAR with over $9 0 \%$ accuracy.
+
+# 2 BACKGROUND: STATE SPACES
+
+Sections 2.1 to 2.4 describe the four properties of SSMs in Fig. 1: the classic continuous-time representation, addressing LRDs with the HiPPO framework, the discrete-time recurrent representation, and the parallelizable convolution representation. In particular, Section 2.4 introduces the SSM convolution kernel $\overline { { \kappa } }$ , which is the focus of our theoretical contributions in Section 3.
+
+# 2.1 STATE SPACE MODELS: A CONTINUOUS-TIME LATENT STATE MODEL
+
+The state space model is defined by the simple equation (1). It maps a 1-D input signal $u ( t )$ to an $N$ -D latent state $x ( t )$ before projecting to a 1-D output signal $y ( t )$ .
+
+$$
+\begin{array} { r } { x ^ { \prime } ( t ) = A x ( t ) + B u ( t ) } \\ { y ( t ) = C x ( t ) + D u ( t ) } \end{array}
+$$
+
+SSMs are broadly used in many scientific disciplines and related to latent state models such as Hidden Markov Models (HMM). Our goal is to simply use the SSM as a black-box representation in a deep sequence model, where $A , B , C , D$ are parameters learned by gradient descent. For the remainder of this paper, we will omit the parameter $_ D$ for exposition (or equivalently, assume $\pmb { D } = 0$ ) because the term $\ b { D u }$ can be viewed as a skip connection and is easy to compute.
+
+# 2.2 ADDRESSING LONG-RANGE DEPENDENCIES WITH HIPPO
+
+Prior work found that the basic SSM (1) actually performs very poorly in practice. Intuitively, one explanation is that linear first-order ODEs solve to an exponential function, and thus may suffer from gradients scaling exponentially in the sequence length (i.e., the vanishing/exploding gradients problem (Pascanu et al., 2013)). To address this problem, the LSSL leveraged the HiPPO theory of continuous-time memorization (Gu et al., 2020a). HiPPO specifies a class of certain matrices $\pmb { A } \in \mathbb { R } ^ { N \times N }$ that when incorporated into (1), allows the state $x ( t )$ to memorize the history of the input $u ( t )$ . The most important matrix in this class is defined by equation (2), which we will call the HiPPO matrix. For example, the LSSL found that simply modifying an SSM from a random matrix $\pmb { A }$ to equation (2) improved its performance on the sequential MNIST benchmark from $6 0 \%$ to $9 8 \%$ .
+
+$$
+\mathrm { ( H i p P O ~ M a t r i x ) } \qquad A _ { n k } = - \left\{ { \begin{array} { l l } { ( 2 n + 1 ) ^ { 1 / 2 } ( 2 k + 1 ) ^ { 1 / 2 } } & { { \mathrm { i f ~ } } n > k } \\ { n + 1 } & { { \mathrm { i f ~ } } n = k { \mathrm { ~ . } } } \\ { 0 } & { { \mathrm { i f ~ } } n < k } \end{array} } \right. .
+$$
+
+# 2.3 DISCRETE-TIME SSM: THE RECURRENT REPRESENTATION
+
+To be applied on a discrete input sequence $( u _ { 0 } , u _ { 1 } , \ldots )$ instead of continuous function $u ( t )$ , (1) must be discretized by a step size $\Delta$ that represents the resolution of the input. Conceptually, the inputs $u _ { k }$ can be viewed as sampling an implicit underlying continuous signal ${ \bf \bar { \boldsymbol { u } } } ( t )$ , where $u _ { k } \overset { \cdot } { = } u ( k \overset { \cdot } { \Delta } )$ .
+
+To discretize the continuous-time SSM, we follow prior work in using the bilinear method (Tustin, 1947), which converts the state matrix $\pmb { A }$ into an approximation $\overline { { A } }$ . The discrete SSM is
+
+$$
+\begin{array} { l l l } { \displaystyle x _ { k } = \overline { A } x _ { k - 1 } + \overline { B } u _ { k } } & { \overline { A } = ( I - \Delta / 2 \cdot A ) ^ { - 1 } ( I + \Delta / 2 \cdot A ) } \\ { \displaystyle y _ { k } = \overline { C } x _ { k } } & { \overline { B } = ( I - \Delta / 2 \cdot A ) ^ { - 1 } \Delta B } & { \overline { C } = C . } \end{array}
+$$
+
+Equation (3) is now a sequence-to-sequence map $u _ { k } \mapsto y _ { k }$ instead of function-to-function. Moreover the state equation is now a recurrence in $x _ { k }$ , allowing the discrete SSM to be computed like an RNN. Concretely, $\boldsymbol { x } _ { k } \in \mathbb { R } ^ { N }$ can be viewed as a hidden state with transition matrix $\overline { { A } }$ .
+
+Notationally, throughout this paper we use ${ \overline { { A } } } , { \overline { { B } } } , \ldots$ to denote discretized SSM matrices defined by (3). Note that these matrices are a function of both $\pmb { A }$ as well as a step size $\Delta$ ; we suppress this dependence for notational convenience when it is clear.
+
+# 2.4 TRAINING SSMS: THE CONVOLUTIONAL REPRESENTATION
+
+The recurrent SSM (3) is not practical for training on modern hardware due to its sequentiality. Instead, there is a well-known connection between linear time-invariant (LTI) SSMs such as (1) and continuous convolutions. Correspondingly, (3) can actually be written as a discrete convolution.
+
+For simplicity let the initial state be $x _ { - 1 } = 0$ . Then unrolling (3) explicitly yields
+
+$$
+\begin{array} { l l l l l } { x _ { 0 } = \overline { { B } } u _ { 0 } } & { } & { x _ { 1 } = \overline { { A } } \overline { { B } } u _ { 0 } + \overline { { B } } u _ { 1 } } & { } & { x _ { 2 } = \overline { { A } } ^ { 2 } \overline { { B } } u _ { 0 } + \overline { { A } } \overline { { B } } u _ { 1 } + \overline { { B } } u _ { 2 } } & { \mathrm { . . . } } \\ { y _ { 0 } = \overline { { C } } \overline { { B } } u _ { 0 } } & { } & { y _ { 1 } = \overline { { C } } \overline { { A } } \overline { { B } } u _ { 0 } + \overline { { C } } \overline { { B } } u _ { 1 } } & { } & { y _ { 2 } = \overline { { C } } \overline { { A } } ^ { 2 } \overline { { B } } u _ { 0 } + \overline { { C } } \overline { { A } } \overline { { B } } u _ { 1 } + \overline { { C } } \overline { { B } } u _ { 2 } } & { } & { . . . } \end{array}
+$$
+
+This can be vectorized into a convolution (4) with an explicit formula for the convolution kernel (5).
+
+$$
+\begin{array} { r l } & { y _ { k } = \overline { { C A } } ^ { k } \overline { { B } } u _ { 0 } + \overline { { C A } } ^ { k - 1 } \overline { { B } } u _ { 1 } + \cdot \cdot \cdot + \overline { { C A } } \overline { { B } } u _ { k - 1 } + \overline { { C B } } u _ { k } } \\ & { \ y = \overline { { K } } * u . } \end{array}
+$$
+
+$$
+{ \overline { { \mathbf { K } } } } \in \mathbb { R } ^ { L } : = K _ { L } ( { \overline { { \mathbf { A } } } } , { \overline { { B } } } , { \overline { { C } } } ) : = \left( { \overline { { C A } } } ^ { i } { \overline { { B } } } \right) _ { i \in [ L ] } = ( { \overline { { C B } } } , { \overline { { C A B } } } , . . . , { \overline { { C A } } } ^ { L - 1 } { \overline { { B } } } ) .
+$$
+
+In other words, equation (4) is a single (non-circular) convolution and can be computed very efficiently with FFTs, provided that $\overline { { \kappa } }$ is known. However, computing $\overline { { \kappa } }$ in (5) is non-trivial and is the focus of our technical contributions in Section 3. We call $\overline { { \kappa } }$ the SSM convolution kernel or filter.
+
+# 3 METHOD: STRUCTURED STATE SPACES (S4)
+
+Our technical results focus on developing the S4 parameterization and showing how to efficiently compute all views of the SSM (Section 2): the continuous representation $( A , B , { \bar { C } } )$ (1), the recurrent representation $( \overline { { A } } , \overline { { B } } , \overline { { C } } )$ (3), and the convolutional representation $\overline { { \kappa } }$ (4).
+
+Section 3.1 motivates our approach, which is based on the linear algebraic concepts of conjugation and diagonalization, and discusses why the naive application of this approach does not work. Section 3.2 gives an overview of the key technical components of our approach and formally defines the S4 parameterization. Section 3.3 sketches the main results, showing that S4 is asymptotically efficient (up to log factors) for sequence models. Proofs are in Appendices B and C.
+
+# 3.1 MOTIVATION: DIAGONALIZATION
+
+The fundamental bottleneck in computing the discrete-time SSM (3) is that it involves repeated matrix multiplication by $\overline { { A } }$ . For example, computing (5) naively as in the LSSL involves $L$ successive multiplications by $\overline { { A } }$ , requiring $O ( N ^ { 2 } L )$ operations and $O ( N L )$ space.
+
+To overcome this bottleneck, we use a structural result that allows us to simplify SSMs.
+
+# Algorithm 1 S4 CONVOLUTION KERNEL (SKETCH)
+
+Input: S4 parameters $\Lambda , P , Q , B , C \in \mathbb { C } ^ { N }$ and step size $\Delta$ Output: SSM convolution kernel $\overline { { \boldsymbol { K } } } = \mathcal { K } _ { L } ( \overline { { \boldsymbol { A } } } , \overline { { \boldsymbol { B } } } , \bar { \vec { C } } )$ for $\pmb { A } = \pmb { \Lambda } - \pmb { P } \pmb { Q } ^ { * }$ (equation (5)) 1: $\widetilde { C } \gets \left( I - \overline { { A } } ^ { L } \right) ^ { * } \overline { { C } }$ $\triangleright$ Truncate SSM generating function (SSMGF) to length $L$ 2: $\begin{array} { r l } & { [ k _ { 0 0 } ( \omega ) \quad k _ { 0 1 } ( \omega ) ] [ \widetilde { C } Q ] ^ { * } ( \frac { 2 } { \Delta } \frac { 1 - \omega } { 1 + \omega } - \Lambda ) ^ { - 1 } [ B P ] \qquad \mathrm { \triangleright ~ B l a c } } \\ & { \widehat { \mathbf { K } } ( \omega ) \frac { 2 } { 1 + \omega } [ k _ { 0 0 } ( \omega ) - k _ { 0 1 } ( \omega ) ( 1 + k _ { 1 1 } ( \omega ) ) ^ { - 1 } k _ { 1 0 } ( \omega ) ] } \\ & { \widehat { \mathbf { K } } = \{ \widehat { \mathbf { K } } ( \omega ) : \omega = \exp ( 2 \pi i \frac { k } { L } ) \} \qquad \mathrm { \triangleright ~ E v a l u a t e ~ S S M G F ~ a t ~ a l l ~ r ~ } } \end{array}$ k-box Cauchy kernel 3: . Woodbury Identity 4: oots of unity $\boldsymbol { \omega } \in \Omega _ { L }$ 5: $\overline { { \boldsymbol { K } } } \gets \mathsf { i F F T } ( \hat { \boldsymbol { K } } )$ $\triangleright$ Inverse Fourier Transform
+
+Lemma 3.1. Conjugation is an equivalence relation on SSMs $( A , B , C ) \sim ( V ^ { - 1 } A V , V ^ { - 1 } B , C V ) .$
+
+Proof. Write out the two SSMs with state denoted by $x$ and $\tilde { x }$ respectively:
+
+$$
+\begin{array} { c c } { { x ^ { \prime } = A x + B u ~ } } & { { ~ \tilde { x } ^ { \prime } = V ^ { - 1 } A V \tilde { x } + V ^ { - 1 } B u } } \\ { { y = C x ~ } } & { { ~ y = C V \tilde { x } } } \end{array}
+$$
+
+After multiplying the right side SSM by $V$ , the two SSMs become identical with $x = V \tilde { x }$ . Therefore these compute the exact same operator $u \mapsto y$ , but with a change of basis by $V$ in the state $x$ . □
+
+Lemma 3.1 motivates putting $\pmb { A }$ into a canonical form by conjugation2, which is ideally more structured and allows faster computation. For example, if $\pmb { A }$ were diagonal, the resulting computations become much more tractable. In particular, the desired $\overline { { \kappa } }$ (equation (4)) would be a Vandermonde product which theoretically only needs $O ( ( N + L ) \log ^ { 2 } ( N + L ) )$ arithmetic operations (Pan, 2001).
+
+Unfortunately, the naive application of diagonalization does not work due to numerical issues. First, Vandermonde multiplication is itself a famously ill-conditioned problem (Pan, 2016). Furthermore, we derive the explicit diagonalization for the HiPPO matrix (2) and show it has entries exponentially large in the state size $N$ , rendering the diagonalization numerically infeasible (e.g. $C V$ in Lemma 3.1 would not be computable). We note that Gu et al. (2021) proposed a different (unimplemented) algorithm to compute $\overline { { \kappa } }$ faster than the naive algorithm. In Appendix B, we prove that it is also numerically unstable for related reasons.
+
+Lemma 3.2. The HiPPO matrix $\pmb { A }$ in equation (2) is diagonalized by the matrix $\begin{array} { r } { V _ { i j } = \binom { i + j } { i - j } } \end{array}$ . In particular, $\begin{array} { r } { V _ { 3 i , i } = { \binom { 4 i } { 2 i } } \approx 2 ^ { 4 i } } \end{array}$ . Therefore $V$ has entries of magnitude up to $2 ^ { 4 N / 3 }$ .
+
+# 3.2 THE S4 PARAMETERIZATION: NORMAL PLUS LOW-RANK
+
+The previous discussion implies that we should only conjugate by well-conditioned matrices $V$ . The ideal scenario is when the matrix $\pmb { A }$ is diagonalizable by a perfectly conditioned (i.e., unitary) matrix. By the Spectral Theorem of linear algebra, this is exactly the class of normal matrices. However, this class of matrices is restrictive; in particular, it does not contain the HiPPO matrix (2).
+
+We make the observation that although the HiPPO matrix is not normal, it can be decomposed as the sum of a normal and low-rank matrix. However, this is still not useful by itself: unlike a diagonal matrix, powering up this sum (in (5)) is still slow and not easily optimized. We overcome this bottleneck by simultaneously applying three new techniques.
+
+• Instead of computing $\overline { { \kappa } }$ directly, we compute its spectrum by evaluating its truncated generating function $\textstyle \sum _ { j = 0 } ^ { L - 1 } { \overline { { K } } } _ { j } \zeta ^ { j }$ at the roots of unity $\zeta$ . $\overline { { \kappa } }$ can then be found by applying an inverse FFT. • This generating function is closely related to the matrix resolvent, and now involves a matrix inverse instead of power. The low-rank term can now be corrected by applying the Woodbury identity which reduces $( A + P Q ^ { * } ) ^ { - 1 }$ in terms of $A ^ { - 1 }$ , truly reducing to the diagonal case. • Finally, we show that the diagonal matrix case is equivalent to the computation of a Cauchy kernel 1ωj−ζk , a well-studied problem with stable near-linear algorithms (Pan, 2015; 2017).
+
+Our techniques apply to any matrix that can be decomposed as Normal Plus Low-Rank (NPLR). Theorem 1. All HiPPO matrices from (Gu et al., 2020a) have a NPLR representation
+
+$$
+\pmb { A } = V \pmb { \Lambda } V ^ { \ast } - P \pmb { Q } ^ { \top } = V \left( \pmb { \Lambda } - ( V ^ { \ast } \pmb { P } ) ( V ^ { \ast } \pmb { Q } ) ^ { \ast } \right) V ^ { \ast }
+$$
+
+for unitary $V \in \mathbb { C } ^ { N \times N }$ , diagonal $\pmb { \Lambda }$ , and low-rank factorization $P , Q \in \mathbb { R } ^ { N \times r }$ . These matrices HiPPO- LegS, LegT, LagT all satisfy $r = 1$ or $r = 2$ . In particular, equation (2) is NPLR with $r = 1$ .
+
+# 3.3 S4 ALGORITHMS AND COMPUTATIONAL COMPLEXITY
+
+By equation (6), note that NPLR matrices can be conjugated into diagonal plus low-rank (DPLR) form (now over $\mathbb { C }$ instead of $\mathbb { R }$ ). Theorems 2 and 3 describe the complexities of SSMs where $\pmb { A }$ is in DPLR form. S4 is optimal or near-optimal for both recurrent and convolutional representations.
+
+Theorem 2 (S4 Recurrence). Given any step size $\Delta$ , computing one step of the recurrence (3) can be done in $O ( N )$ operations where $N$ is the state size.
+
+Theorem 2 follows from the fact that the inverse of a DPLR matrix is also DPLR (e.g. also by the Woodbury identity). This implies that the discretized matrix $\overline { { A } }$ is the product of two DPLR matrices and thus has $O ( N )$ matrix-vector multiplication. Appendix C.2 computes $\overline { { A } }$ in closed DPLR form.
+
+Theorem 3 (S4 Convolution). Given any step size $\Delta$ , computing the SSM convolution filter $\overline { { \kappa } }$ can be reduced to 4 Cauchy multiplies, requiring only $\widetilde O ( N + L )$ operations and $O ( N + L )$ space.
+
+Appendix C, Definition 3 formally defines Cauchy matrices, which are related to rational interpolation problems. Computing with Cauchy matrices is an extremely well-studied problem in numerical analysis, with both fast arithmetic and numerical algorithms based on the famous Fast Multipole Method (FMM) (Pan, 2001; 2015; 2017). The computational complexities of these algorithms under various settings are described in Appendix C, Proposition 5.
+
+We reiterate that Theorem 3 is our core technical contribution, and its algorithm is the very motivation of the NPLR S4 parameterization. This algorithm is formally sketched in Algorithm 1.
+
+# 3.4 ARCHITECTURE DETAILS OF THE DEEP S4 LAYER
+
+Concretely, an S4 layer is parameterized as follows. First initialize a SSM with $\pmb { A }$ set to the HiPPO matrix (2). By Lemma 3.1 and Theorem 1, this SSM is unitarily equivalent to some $( \pmb { \Lambda } -$ $P Q ^ { * } , B , C )$ for some diagonal $\pmb { \Lambda }$ and vectors $P , Q , B , C \in \mathbb { C } ^ { N \times 1 }$ . These comprise S4’s $5 N$ trainable parameters.
+
+The overall deep neural network (DNN) architecture of S4 is similar to prior work. As defined above, S4 defines a map from $\mathbb { R } ^ { L } \to \mathbb { R } ^ { L }$ , i.e. a 1-D sequence map. Typically, DNNs operate on feature maps of size $H$ instead of 1. S4 handles multiple features by simply defining $H$ independent copies of itself, and then mixing the $H$ features with a position-wise linear layer for a total of $\dot { O } ( H ^ { 2 } ) { + } \dot { O ( H N ) }$ parameters per layer. Nonlinear activation functions are also inserted between these layers. Overall, S4 defines a sequence-to-sequence map of shape (batch size, sequence length, hidden dimension), exactly the same as related sequence models such as Transformers, RNNs, and CNNs.
+
+# 4 EXPERIMENTS
+
+Section 4.1 benchmarks S4 against the LSSL and efficient Transformer models. Section 4.2 validates S4 on LRDs: the LRA benchmark and raw speech classification. Section 4.3 investigates whether S4 can be used as a general sequence model to perform effectively and efficiently in a wide variety of settings including image classification, image and text generation, and time series forecasting.
+
+# 4.1 S4 EFFICIENCY BENCHMARKS
+
+We benchmark that S4 can be trained quickly and efficiently, both compared to the LSSL, as well as efficient Transformer variants designed for long-range sequence modeling. As outlined in Section 3, S4 is theoretically much more efficient than the LSSL, and Table 1 confirms that the S4 is orders of magnitude more speed- and memory-efficient for practical layer sizes. In fact, S4’s speed and memory use is competitive with the most efficient Transformer variants benchmarked by Tay et al. (2021)— Linear Transformer (Katharopoulos et al., 2020) and Performer (Choromanski et al., 2020)—in a parameter-matched setting (Table 2, following the protocol of Tay et al. (2021)).
+
+
TRAINING STEP (MS)
MEMORY ALLOC. (MB)
Dim.
128
256
512
128
256
512
LSSL
9.32
20.6
140.7
222.1
1685
13140
S4
4.77
3.07
4.75
5.3
12.6
33.5
Ratio
1.9×
6.7×
29.6×
42.0×
133×
392×
+
+Table 1: Deep SSMs: The S4 parameterization with Algorithm 1 is asymptotically more efficient than the LSSL.
+Table 2: Benchmarks vs. efficient Transformers
+
+
LENGTH 1024
LENGTH 4096
Speed
Mem.
Speed
Mem.
Transformer
1×
1×
1×
1×
Performer
1.23×
0.43x
3.79×
0.086×
Linear Trans.
1.58×
0.37×
5.35×
0.067×
S4
1.58×
0.43×
5.19×
0.091×
+
+
+Figure 2: Visualizations of a trained S4 model on LRA Path-X. SSM convolution kernels $\overline { { K } } \in \mathbb { R } ^ { 1 6 3 8 4 }$ are reshaped into a $1 2 8 \times 1 2 8$ image. (Left) Example from the Path-X task, which involves deducing if the markers are connected by a path $( T o p )$ Filters from the first layer (Bottom) Filters from the last layer.
+
+Table 3: (Long Range Arena) Accuracy on full suite of LRA tasks. (Top) Original Transformer variants in LRA. Full results in Appendix D.2. (Bottom) Other models reported in the literature.
+
+
MODEL
LISTOPS
TEXT
RETRIEVAL
IMAGE
PATHFINDER
PATH-X
AVG
Transformer
36.37
64.27
57.46
42.44
71.40
X
53.66
Reformer
37.27
56.10
53.40
38.07
68.50
×
50.56
BigBird
36.05
64.02
59.29
40.83
74.87
X
54.17
Linear Trans.
16.13
65.90
53.09
42.34
75.30
×
50.46
Performer
18.01
65.40
53.82
42.77
77.05
X
51.18
FNet
35.33
65.11
59.61
38.67
77.80
X
54.42
Nystromformer
37.15
65.52
79.56
41.58
70.94
X
57.46
Luna-256
37.25
64.57
79.29
47.38
77.72
×
59.37
S4
58.35
76.02
87.09
87.26
86.05
88.10
80.48
+
+# 4.2 LEARNING LONG RANGE DEPENDENCIES
+
+As described in Sections 2.2 and 3.1, S4 uses a principled approach to address LRDs based on the HiPPO theory of continuous-time memorization. Our goal in this section is to validate that S4 achieves high performance on difficult tasks that require long-range reasoning. We focus here on two problems: (i) the Long-Range Arena, a well-known benchmark designed to test efficient sequence models on LRDs, and (ii) a speech classification problem as a real-world test of LRDs.
+
+Long Range Arena (LRA). LRA (Tay et al., 2021) contains 6 tasks with lengths 1K-16K steps, encompassing modalities and objectives that require similarity, structural, and visuospatial reasoning. Table 3 compares S4 against the 11 Transformer variants from Tay et al. (2021) as well as follow-up work. S4 substantially advances the SoTA, outperforming all baselines on all tasks and averaging $8 0 . 4 8 \%$ compared to less than $6 0 \%$ for every baseline. Notably, S4 solves the Path-X task, an extremely challenging task that involves reasoning about LRDs over sequences of length $1 2 8 \times 1 2 8 =$ 16384. All previous models have failed (i.e. random guessing) due to memory or computation bottlenecks, or simply being unable to learn such long dependencies.
+
+We analyze S4’s performance on Path-X by visualizing its learned representations, in particular 1-D convolution kernels $\overline { { \kappa } }$ which are the focus of our technical results in Section 3. Fig. 2 shows that S4 learns a variety of filters that display spatially consistent structure and demonstrate awareness of the 2-D nature of the data. In particular, the lower layers learn simple kernels that extract features from just a few rows of local context while ignoring the rest of the image. On the other hand, higher layers aggregate information globally across full columns of the image at varying spatial frequencies. Filters in these higher layers span the entire context (16384 pixels), confirming S4’s ability to learn LRDs.
+
+Raw Speech Classification. Speech is a typical real-world time series domain, involving signals sampled from an underlying physical process at high frequency. We perform speech classification using the Speech Commands dataset (Warden, 2018). While most sequence models for speech rely on extensive preprocessing (e.g. to MFCC features), we classify raw speech (length-16000) following Romero et al. (2021). S4 achieves $9 8 . 3 \%$ accuracy, higher than all baselines that use the $1 0 0 \times$ shorter MFCC features, and validates that a powerful LRD model is able to extract more information from the raw data and outperform hand-crafted pre-processing. Additionally, we include a baseline CNN specifically designed for raw speech, the discriminator from the WaveGAN model (Donahue et al., 2019), which performs worse than S4 while having $9 0 \times$ more parameters and incorporating many more architectural heuristics (Appendix D.2).
+
+# 4.3 S4 AS A GENERAL SEQUENCE MODEL
+
+A key goal of sequence modeling research is to develop a single model that can be applied in many domains (e.g. images, audio, text, time-series) with a broad range of capabilities (e.g. efficient training, fast generation, handling irregularly sampled data). As a fundamental scientific model, SSMs are a promising candidate that come with a range of capabilities, and S4’s strong results on LRD benchmarks spanning images, text, and speech are evidence of S4’s potential as a general sequence model. In this section, we focus on understanding this question in more depth by highlighting key strengths of S4 in settings that usually require specialized models. The tasks we focus on (generative modeling, image classification, time-series forecasting) are considered as LRD tasks in the literature, and serve as additional validation that S4 handles LRDs efficiently.
+
+Large-scale generative modeling. We investigate two well-studied image and text benchmarks to validate the scalability, flexibility, and efficiency of S4. These tasks require much larger models than our previous tasks – up to 250M parameters.
+
+First, CIFAR density estimation is a popular benchmark for autoregressive models, where images are flattened into a sequence of 3072 RGB subpixels that are predicted one by one. Table 6 shows that with no $2 D$ inductive bias, S4 is competitive with the best models designed for this task.
+
+Second, WikiText-103 is an established benchmark for language modeling, an important task for large-scale sequence models where tokens are predicted sequentially based on past context. Although RNNs were the model of choice for many years, Transformers are now the dominant model in such applications that contain data that is inherently discrete. We show that alternative models to Transformers can still be competitive in these settings. By simply taking a strong Transformer baseline (Baevski & Auli, 2018) and replacing the self-attention layers, S4 substantially closes the gap to Transformers (within $0 . 8 \mathrm { p p l }$ ), setting SoTA for attention-free models by over 2 ppl.
+
+Table 4: (Speech classification) Transformer, CTM, RNN, CNN, and SSM models. (MFCC) Standard pre-processed MFCC features (length-161). (Raw) Unprocessed signals (length-16000). $( \it 0 . 5 \times )$ Frequency change at test time. $\pmb { \chi }$ denotes not applicable or computationally infeasible on single GPU.
+
+
MFCC
RAW
0.5×
Transformer
90.75
X
×
Performer
80.85
30.77
30.68
ODE-RNN
65.9
X
X
NRDE
89.8
16.49
15.12
ExpRNN
82.13
11.6
10.8
LipschitzRNN
88.38
X
×
CKConv
95.3
71.66
65.96
WaveGAN-D
X
96.25
X
LSSL
93.58
X
X
S4
93.96
98.32
96.30
+
+Table 5: (Pixel-level 1-D image classification) Transformer, RNN, CNN, and SSM models. Extended results $^ +$ citations in Appendix D.
+
+
SMNIST
PMNIST
SCIFAR
Transformer
98.9
97.9
62.2
LSTM
98.9
95.11
63.01
r-LSTM
98.4
95.2
72.2
UR-LSTM
99.28
96.96
71.00
UR-GRU
99.27
96.51
74.4
HiPPO-RNN
98.9
98.3
61.1
LMU-FFT
=
98.49
■
LipschitzRNN
99.4
96.3
64.2
TCN
99.0
97.2
=
TrellisNet
99.20
98.13
73.42
CKConv
99.32
98.54
63.74
LSSL
99.53
98.76
84.65
S4
99.63
98.70
91.13
+
+Table 6: (CIFAR-10 density estimation) As a generic Table 7: (WikiText-103 language modeling) S4 apsequence model, S4 is competitive with previous autore-proaches the performance of Transformers with much gressive models (in bits per dim.) while incorporating no faster generation. (Top) Transformer baseline which 2D inductive bias, and has fast generation through its recur-our implementation is based on, with attention rerence mode. placed by S4. (Bottom) Attention-free models (RNNs
+
+
Model
bpd
2D bias
Images /sec
Transformer
3.47
None
0.32 (1×)
Linear Transf.
3.40
None
17.85 (56×)
PixelCNN
3.14
2D conv.
RowPixelRNN
3.00
2DBiLSTM
PixelCNN++
2.92
2D conv.
19.19 (59.97×)
Image Transf.
2.90
2D local attn.
0.54 (1.7x)
PixelSNAIL
2.85
2D conv.+attn.
0.13 (0.4×)
Sparse Transf.
2.80
2D sparse attn.
=
S4 (base)
2.92
None
20.84 (65.1×)
S4 (large)
2.85
None
3.36 (10.5×)
+
+
Model
Params
Test ppl.
Tokens /sec
Transformer
247M
20.51
0.8K(1×)
GLU CNN
229M
37.2
=
AWD-QRNN
151M
33.0
=
LSTM+ Hebb.
29.2
TrellisNet
180M
29.19
Dynamic Conv.
255M
25.0
=
TaLK Conv.
240M
23.3
S4
249M
21.28
48K (60×)
+
+Fast autoregressive inference. A prominent limitation of autoregressive models is inference speed (e.g. generation), since they require a pass over the full context for every new sample. Several methods have been specifically crafted to overcome this limitation such as the Linear Transformer, a hybrid Transformer/RNN that switches to a stateful, recurrent view at inference time for speed.
+
+As a stateful model, SSMs automatically have this ability (Fig. 1). By switching to its recurrent representation (Section 2.3), S4 requires constant memory and computation per time step – in contrast to standard autoregressive models which scale in the context length. On both CIFAR-10 and WikiText103, we report the throughput of various models at generation time, with S4 around $6 0 \times$ faster than a vanilla Transformer on both tasks (details in Appendix D.3.3).
+
+Sampling resolution change. As a continuous-time model, S4 automatically adapts to data sampled at different rates, a challenging setting for time series with a dedicated line of work (Rubanova et al., 2019; De Brouwer et al., 2019; Romero et al., 2021). Without re-training, S4 achieves $9 6 . 3 \%$ accuracy at $0 . 5 \times$ the frequency on Speech Commands (Table 4), simply by changing its internal step size $\Delta$ (Section 2.3).
+
+Learning with weaker inductive bias. Beyond our results on speech (Section 4.2), we further validate that S4 can be applied with minimal modifications on two domains that typically require specialized domain-specific preprocessing and architectures. First, we compare S4 to the Informer (Zhou et al., 2021), a new Transformer architecture that uses a complex encoder-decoder designed for time-series forecasting problems. A simple application of S4 that treats forecasting as a masked sequence-to-sequence transformation (Fig. 3) outperforms the Informer and other baselines on $4 0 / 5 0$ settings across 5 forecasting tasks. Notably, S4 is better on the longest setting in each task, e.g. reducing MSE by $3 7 \%$ when forecasting 30 days of weather data (Appendix D.3.5).
+
+Finally, we evaluate S4 on pixel-level sequential image classification tasks (Table 5), popular benchmarks which were originally LRD tests for RNNs (Arjovsky et al., 2016). Beyond LRDs, these benchmarks point to a recent effort of the ML community to solve vision problems with reduced domain knowledge, in the spirit of models such as Vision Transformers (Dosovitskiy et al., 2020) and MLP-Mixer (Tolstikhin et al., 2021) . Sequential CIFAR is a particularly challenging dataset where outside of SSMs, all sequence models have a gap of over $2 5 \%$ to a simple 2-D CNN. By contrast, S4 is competitive with a larger ResNet18 (7.9M vs. 11.0M parameters), both with $( 9 3 . 1 6 \%$ vs. $9 5 . 6 2 \%$ ) or without $( 9 1 . 1 2 \%$ vs. $8 9 . 4 6 \%$ ) data augmentation. Moreover, it is much more robust to other architectural choices (e.g. $9 0 . 4 6 \%$ vs. $7 9 . 5 2 \%$ when swapping BatchNorm for LayerNorm).
+
+# 5 CONCLUSION
+
+We introduce S4, a sequence model that uses a new parameterization for the state space model’s continuous-time, recurrent, and convolutional views to efficiently model LRDs in a principled manner. Results across established benchmarks evaluating a diverse range of data modalities and model capabilities suggest that S4 has the potential to be an effective general sequence modeling solution.
+
+# REFERENCES
+
+Martin Arjovsky, Amar Shah, and Yoshua Bengio. Unitary evolution recurrent neural networks. In The International Conference on Machine Learning (ICML), pp. 1120–1128, 2016.
+
+Alexei Baevski and Michael Auli. Adaptive input representations for neural language modeling. arXiv preprint arXiv:1809.10853, 2018.
+
+Shaojie Bai, J Zico Kolter, and Vladlen Koltun. An empirical evaluation of generic convolutional and recurrent networks for sequence modeling. arXiv preprint arXiv:1803.01271, 2018.
+
+Shaojie Bai, J Zico Kolter, and Vladlen Koltun. Trellis networks for sequence modeling. In The International Conference on Learning Representations (ICLR), 2019.
+
+Shiyu Chang, Yang Zhang, Wei Han, Mo Yu, Xiaoxiao Guo, Wei Tan, Xiaodong Cui, Michael Witbrock, Mark Hasegawa-Johnson, and Thomas S Huang. Dilated recurrent neural networks. In Advances in Neural Information Processing Systems (NeurIPS), 2017.
+
+Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019.
+
+Narsimha Chilkuri and Chris Eliasmith. Parallelizing legendre memory unit training. The International Conference on Machine Learning (ICML), 2021.
+
+Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, et al. Rethinking attention with performers. In The International Conference on Learning Representations (ICLR), 2020.
+
+Yann N Dauphin, Angela Fan, Michael Auli, and David Grangier. Language modeling with gated convolutional networks. In International conference on machine learning, pp. 933–941. PMLR, 2017.
+
+Edward De Brouwer, Jaak Simm, Adam Arany, and Yves Moreau. Gru-ode-bayes: Continuous modeling of sporadically-observed time series. In Advances in Neural Information Processing Systems (NeurIPS), 2019.
+
+Chris Donahue, Julian McAuley, and Miller Puckette. Adversarial audio synthesis. In ICLR, 2019.
+
+Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020.
+
+N Benjamin Erichson, Omri Azencot, Alejandro Queiruga, Liam Hodgkinson, and Michael W Mahoney. Lipschitz recurrent neural networks. In International Conference on Learning Representations, 2021.
+
+Gene H Golub and Charles F Van Loan. Matrix computations, volume 3. JHU press, 2013.
+
+Albert Gu, Tri Dao, Stefano Ermon, Atri Rudra, and Christopher Re. Hippo: Recurrent memory with ´ optimal polynomial projections. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, MariaFlorina Balcan, and Hsuan-Tien Lin (eds.), Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020a. URL https://proceedings.neurips.cc/paper/2020/ hash/102f0bb6efb3a6128a3c750dd16729be-Abstract.html.
+
+Albert Gu, Caglar Gulcehre, Tom Le Paine, Matt Hoffman, and Razvan Pascanu. Improving the gating mechanism of recurrent neural networks. In The International Conference on Machine Learning (ICML), 2020b.
+
+Albert Gu, Isys Johnson, Karan Goel, Khaled Saab, Tri Dao, Atri Rudra, and Christopher Re.´ Combining recurrent, convolutional, and continuous-time models with the structured learnable linear state space layer. In Advances in Neural Information Processing Systems (NeurIPS), 2021.
+
+Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
+
+Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and Franc¸ois Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. In International Conference on Machine Learning, pp. 5156–5165. PMLR, 2020.
+
+Mario Lezcano-Casado and David Mart´ınez-Rubio. Cheap orthogonal constraints in neural networks: A simple parametrization of the orthogonal and unitary group. In The International Conference on Machine Learning (ICML), 2019.
+
+Shuai Li, Wanqing Li, Chris Cook, Ce Zhu, and Yanbo Gao. Independently recurrent neural network (IndRNN): Building a longer and deeper RNN. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5457–5466, 2018.
+
+Vasileios Lioutas and Yuhong Guo. Time-aware large kernel convolutions. In International Conference on Machine Learning, pp. 6172–6183. PMLR, 2020.
+
+Stephen Merity, Nitish Shirish Keskar, James Bradbury, and Richard Socher. Scalable language modeling: Wikitext-103 on a single gpu in 12 hours. SysML, 2018.
+
+Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016.
+
+Victor Pan. Structured matrices and polynomials: unified superfast algorithms. Springer Science & Business Media, 2001.
+
+Victor Pan. Fast approximate computations with cauchy matrices and polynomials. Mathematics of Computation, 86(308):2799–2826, 2017.
+
+Victor Y Pan. Transformations of matrix structures work again. Linear Algebra and Its Applications, 465:107–138, 2015.
+
+Victor Y Pan. How bad are vandermonde matrices? SIAM Journal on Matrix Analysis and Applications, 37(2):676–694, 2016.
+
+Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. In International conference on machine learning, pp. 1310–1318, 2013.
+
+Jack Rae, Chris Dyer, Peter Dayan, and Timothy Lillicrap. Fast parametric learning with activation memorization. The International Conference on Machine Learning (ICML), 2018.
+
+Prajit Ramachandran, Tom Le Paine, Pooya Khorrami, Mohammad Babaeizadeh, Shiyu Chang, Yang Zhang, Mark A Hasegawa-Johnson, Roy H Campbell, and Thomas S Huang. Fast generation for convolutional autoregressive models. arXiv preprint arXiv:1704.06001, 2017.
+
+David W Romero, Anna Kuzina, Erik J Bekkers, Jakub M Tomczak, and Mark Hoogendoorn. Ckconv: Continuous kernel convolution for sequential data. arXiv preprint arXiv:2102.02611, 2021.
+
+Yulia Rubanova, Tian Qi Chen, and David K Duvenaud. Latent ordinary differential equations for irregularly-sampled time series. In Advances in Neural Information Processing Systems, pp. 5321–5331, 2019.
+
+T Konstantin Rusch and Siddhartha Mishra. Unicornn: A recurrent model for learning very long time dependencies. The International Conference on Machine Learning (ICML), 2021.
+
+Tim Salimans, Andrej Karpathy, Xi Chen, and Diederik P Kingma. Pixelcnn $^ { + + }$ : Improving the pixelcnn with discretized logistic mixture likelihood and other modifications. arXiv preprint arXiv:1701.05517, 2017.
+
+Yi Tay, Mostafa Dehghani, Samira Abnar, Yikang Shen, Dara Bahri, Philip Pham, Jinfeng Rao, Liu Yang, Sebastian Ruder, and Donald Metzler. Long range arena $:$ A benchmark for efficient transformers. In International Conference on Learning Representations, 2021. URL https: //openreview.net/forum?id=qVyeW-grC2k.
+
+Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, et al. Mlp-mixer: An all-mlp architecture for vision. arXiv preprint arXiv:2105.01601, 2021.
+
+Trieu H Trinh, Andrew M Dai, Minh-Thang Luong, and Quoc V Le. Learning longer-term dependencies in RNNs with auxiliary losses. In The International Conference on Machine Learning (ICML), 2018.
+
+Arnold Tustin. A method of analysing the behaviour of linear systems in terms of time series. Journal of the Institution of Electrical Engineers-Part IIA: Automatic Regulators and Servo Mechanisms, 94(1):130–142, 1947.
+
+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 (NeurIPS), 2017.
+
+Aaron Voelker, Ivana Kajic, and Chris Eliasmith. Legendre memory units: Continuous-time represen- ´ tation in recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 15544–15553, 2019.
+
+Aaron Russell Voelker. Dynamical systems in spiking neuromorphic hardware. PhD thesis, University of Waterloo, 2019.
+
+Pete Warden. Speech commands: A dataset for limited-vocabulary speech recognition. ArXiv, abs/1804.03209, 2018.
+
+Max A Woodbury. Inverting modified matrices. Memorandum report, 42:106, 1950.
+
+Felix Wu, Angela Fan, Alexei Baevski, Yann N Dauphin, and Michael Auli. Pay less attention with lightweight and dynamic convolutions. In The International Conference on Learning Representations (ICLR), 2019.
+
+Haoyi Zhou, Shanghang Zhang, Jieqi Peng, Shuai Zhang, Jianxin Li, Hui Xiong, and Wancai Zhang. Informer: Beyond efficient transformer for long sequence time-series forecasting. In The ThirtyFifth AAAI Conference on Artificial Intelligence, AAAI 2021, Virtual Conference, volume 35, pp. 11106–11115. AAAI Press, 2021.
+
+# A DISCUSSION
+
+Related Work. Our work is most closely related to a line of work originally motivated by a particular biologically-inspired SSM, which led to mathematical models for addressing LRDs. Voelker (2019); Voelker et al. (2019) derived a non-trainable SSM motivated from approximating a neuromorphic spiking model, and Chilkuri & Eliasmith (2021) showed that it could be sped up at train time with a convolutional view. Gu et al. (2020a) extended this special case to a general continuous-time function approximation framework with several more special cases of $\pmb { A }$ matrices designed for long-range dependencies. However, instead of using a true SSM, all of these works fixed a choice of $\pmb { A }$ and built RNNs around it. Most recently, Gu et al. (2021) used the full (1) explicitly as a deep SSM model, exploring new conceptual views of SSMs, as well as allowing $\pmb { A }$ to be trained. As mentioned in Section 1, their method used a naive instantiation of SSMs that suffered from an additional factor of $N$ in memory and $N ^ { 2 }$ in computation.
+
+Beyond this work, our technical contributions (Section 3) on the S4 parameterization and algorithms are applicable to a broader family of SSMs including these investigated in prior works, and our techniques for working with these models may be of independent interest.
+
+Implementation. The computational core of S4’s training algorithm is the Cauchy kernel discussed in Sections 3.2 and 3.3 and Appendix C.3. As described in Appendix C.3 Proposition 5, there are many algorithms for it with differing computational complexities and sophistication. Our current implementation of S4 actually uses the naive $O ( N L )$ algorithm which is easily parallelized on GPUs and has more easily accessible libraries allowing it to be implemented; we leverage the pykeops library for memory-efficient kernel operations. However, this library is a much more general library that may not be optimized for the Cauchy kernels used here, and we believe that a dedicated CUDA implementation can be more efficient. Additionally, as discussed in this work, there are asymptotically faster and numerically stable algorithms for the Cauchy kernel (Proposition 5). However, these algorithms are currently not implemented for GPUs due to a lack of previous applications that require them. We believe that more efficient implementations of these self-contained computational kernels are possible, and that S4 (and SSMs at large) may have significant room for further improvements in efficiency.
+
+Limitations and Future Directions. In this work, we show that S4 can address a wide variety of data effectively. However, it may not necessarily be the most suitable model for all types of data. For example, Table 7 still found a gap compared to Transformers for language modeling. An interesting future direction is exploring combinations of S4 with other sequence models to complement their strengths. We are excited about other directions, including continuing to explore the benefits of S4 on audio data (e.g. pre-training or generation settings), and generalizing HiPPO and S4 to higher-dimensional data for image and video applications.
+
+# B NUMERICAL INSTABILITY OF LSSL
+
+This section proves the claims made in Section 3.1 about prior work. We first derive the explicit diagonalization of the HiPPO matrix, confirming its instability because of exponentially large entries. We then discuss the proposed theoretically fast algorithm from (Gu et al., 2021) (Theorem 2) and show that it also involves exponentially large terms and thus cannot be implemented.
+
+# B.1 HIPPO DIAGONALIZATION
+
+Proof of Lemma 3.2. The HiPPO matrix (2) is equal, up to sign and conjugation by a diagonal matrix, to
+
+$$
+\scriptstyle A = \left[ \begin{array} { l l l l l l l l l } { 1 } & { } & { } & { } & { } & { } & { } & { } & { } & { } \\ { - 1 } & \begin{array} { l l l l l l l l l } { 1 } & \begin{array} { l l l l l l l l l } { 1 } & \begin{array} { l } { 2 } & { } & { } & { } & { } & { } & { } & { } & { } & { } & { } & { } \\ { 1 } & { - 3 } & { 3 } & { } { } & { } & { } & { } & { } & { } & { } & { } & { } & { } \\ { - 1 } & { { 3 } & { - 5 } & { } { } & { 4 } & { } & { } & { } & { } & { } & { } & { } & { } \\ { 1 } & { { - 3 } & { 5 } & { } { } & { - 7 } & { } { 5 } & { } & { } & { } & { } & { } & { } \\ { - 1 } & { { 3 } & { - 5 } & { } { } & { 7 } & { } { - 9 } & { } { } & { 6 } & { } & { } & { } \\ { 1 } & { { - 3 } & { 5 } & { } { - 7 } & { } { } & { 9 } & { - 1 1 } & { } { } & { 7 } & { } & { } \\ { - 1 } & { 3 } & { - 5 } & { } { } & { 7 } & { - 9 } & { 1 1 } & { - 1 3 } & { 8 } & { } \\ { \vdots } & { } & { } & { } & { } & { } & { } & { } & { \ddots } & { } & { } & { } \end{array} } } \end{array} \right] } } \end{array} \end{array}
+$$
+
+$$
+A _ { n k } = { \left\{ \begin{array} { l l } { ( - 1 ) ^ { n - k } ( 2 k + 1 ) } & { n > k } \\ { k + 1 } & { n = k } \\ { 0 } & { n < k } \end{array} \right. } .
+$$
+
+Our goal is to show that this $\pmb { A }$ is diagonalized by the matrix
+
+$$
+V = { \binom { i + j } { i - j } } _ { i j } = { \left[ \begin{array} { l l l l l l l } { 1 } & { } & { } & { } & { } & { } & { } \\ { 1 } & { 1 } & { } & { } & { } & { } & { } \\ { 1 } & { 3 } & { 1 } & { } & { } & { } & { } \\ { 1 } & { 6 } & { 5 } & { 1 } & { } & { } & { } \\ { 1 } & { 1 0 } & { 1 5 } & { 7 } & { 1 } & { } & { } \\ { 1 } & { 1 5 } & { 3 5 } & { 2 8 } & { 9 } & { 1 } & { } \\ { \vdots } & { } & { } & { } & { } & { \ddots } \end{array} \right] } ,
+$$
+
+or in other words that columns of this matrix are eigenvectors of $\pmb { A }$ .
+
+Concretely, we will show that the $j$ -th column of this matrix $\mathbf { \pmb { v } } ^ { ( j ) }$ with elements
+
+$$
+{ \pmb v } _ { i } ^ { ( j ) } = \left\{ \begin{array} { l l } { 0 } & { i < j } \\ { \binom { i + j } { i - j } = \binom { i + j } { 2 j } } & { i \geq j } \end{array} \right.
+$$
+
+is an eigenvector with eigenvalue $j + 1$ . In other words we must show that for all indices $k \in [ N ]$
+
+$$
+( A v ^ { ( j ) } ) _ { k } = \sum _ { i } A _ { k i } v _ { i } ^ { ( j ) } = ( j + 1 ) v _ { k } ^ { ( j ) } .
+$$
+
+If $k < j$ , then for all $i$ inside the sum, either $k < i$ or $i < j$ . In the first case $\boldsymbol { A } _ { k i } = 0$ and in the second case $\pmb { v } _ { i } ^ { ( j ) } = 0$ , so both sides of equation (7) are equal to 0.
+
+It remains to show the case $k \geq j$ , which proceeds by induction on $k$ . Expanding equation (7) using the formula for $\pmb { A }$ yields
+
+$$
+( \pmb { A } \pmb { v } ) _ { k } ^ { ( j ) } = \sum _ { i } \pmb { A } _ { k i } \pmb { v } _ { i } ^ { ( j ) } = \sum _ { i = j } ^ { k - 1 } ( - 1 ) ^ { k - i } ( 2 i + 1 ) \binom { i + j } { 2 j } + ( k + 1 ) \binom { k + j } { 2 j } .
+$$
+
+In the base case $k = j$ , the sum disappears and we are left with $( A v ^ { ( j ) } ) _ { j } = ( j + 1 ) \binom { 2 j } { 2 j } = ( j + 1 ) v _ { j } ^ { ( j ) } ,$ as desired.
+
+Otherwise, the sum for edge terms. The result $( A v ) _ { k } ^ { ( j ) }$ is the same as the sum for from applying the inductiv $( A v ) _ { k - 1 } ^ { ( j ) }$ but with sign reversed and a fewsis and algebraic simplification:
+
+$$
+\begin{array} { r l } & { ( A \boldsymbol { v } ) _ { k } ^ { ( j ) } - ( \boldsymbol { A } \boldsymbol { u } ) _ { k - 1 } ^ { ( j ) } - ( 2 \boldsymbol { u } - 1 ) ( \begin{array} { l } { \boldsymbol { A } - 1 + j } \\ { \boldsymbol { \cdot } } \\ { \boldsymbol { \cdot } } \\ { \boldsymbol { \cdot } } \end{array} ) + \kappa ( \begin{array} { l } { \boldsymbol { A } - 1 - j } \\ { 2 , j } \end{array} ) + ( \boldsymbol { k } - 1 ) ( \begin{array} { l } { \boldsymbol { A } - 1 } \\ { 2 , j } \end{array} ) } \\ & { \qquad = - ( j + 1 ) ( \begin{array} { l } { \boldsymbol { A } - 2 j } \\ { 2 , j } \end{array} ) - ( \boldsymbol { A } - 1 ) ( \begin{array} { l } { \boldsymbol { A } - 1 + j } \\ { 2 , j } \end{array} ) - ( \boldsymbol { A } + 1 ) ( \begin{array} { l } { \boldsymbol { A } - 1 } \\ { 2 , j } \end{array} ) } \\ & { \qquad = - ( j + 1 ) ( \begin{array} { l } { \boldsymbol { A } - 1 + j } \\ { 2 , j } \end{array} ) + ( \boldsymbol { A } + 1 ) ( \begin{array} { l } { \boldsymbol { A } - 1 + j } \\ { 2 , j } \end{array} ) } \\ & { \qquad = - ( j + 1 ) ( \begin{array} { l } { \boldsymbol { A } - 1 + j 1 } \\ { 2 , j } \end{array} ) + ( \boldsymbol { A } + 1 ) ( \begin{array} { l } { \boldsymbol { A } + 1 } \\ { 2 , j } \end{array} ) } \\ & { \qquad = - ( j + 1 ) ( \begin{array} { l } { \boldsymbol { A } - 1 + j 1 } \\ { 2 , j } \end{array} ) + ( \boldsymbol { A } + 1 ) ( \begin{array} { l } { \boldsymbol { A } + j } \\ { 2 , j } \end{array} ) } \\ & { \qquad = - \frac { j } { ( k - 1 ) ( j + 2 ) } + ( \boldsymbol { A } - 1 ) ( \begin{array} { l } { \boldsymbol { A } + j } \\ { 2 , j } \end{array} ) } \\ & { \qquad = - ( j + 1 ) \frac { ( j + 1 ) ! } { ( k - 2 ) ! ( j + 2 ) ! } + ( k + 1 ) ( \begin{array} { l } { \boldsymbol { A } - 1 + j } \\ { 2 , j } \end{array} ) } \\ & \qquad = - ( j - k ) \frac { ( j + 1 ) ! } { ( k - 2 ) ! ( j + 2 ) ! } + ( k + 1 ) ( \begin{array} { l } \ \end{array} \end{array}
+$$
+
+# B.2 FAST BUT UNSTABLE LSSL ALGORITHM
+
+Instead of diagonalization, Gu et al. (2021, Theorem 2) proposed a sophisticated fast algorithm to compute
+
+$$
+K _ { L } ( { \overline { { A } } } , { \overline { { B } } } , { \overline { { C } } } ) = ( { \overline { { C } } } { \overline { { B } } } , { \overline { { C } } } { \overline { { A } } } { \overline { { B } } } , \ldots , { \overline { { C } } } { \overline { { A } } } ^ { L - 1 } { \overline { { B } } } ) .
+$$
+
+This algorithm runs in $O ( N \log ^ { 2 } N + L \log L )$ operations and $O ( N + L )$ space. However, we now show that this algorithm is also numerically unstable.
+
+There are several reasons for the instability of this algorithm, but most directly we can pinpoint a particular intermediate quantity that they use.
+
+Definition 1. The fast LSSL algorithm computes coefficients of $p ( x )$ , the characteristic polynomial of $A$ , as an intermediate computation. Additionally, it computes the coefficients of its inverse, $p ( x ) ^ { - 1 }$ (mod $x ^ { L }$ ).
+
+We now claim that this quantity is numerically unfeasible. We narrow down to the case when ${ \overline { { A } } } = I$ is the identity matrix. Note that this case is actually in some sense the most typical case: when discretizing the continuous-time SSM to discrete-time by a step-size $\Delta$ , the discretized transition matrix $\overline { { A } }$ is brought closer to the identity. For example, with the Euler discretization ${ \overline { { A } } } = I + \Delta A$ , we have ${ \overline { { A } } } \to I$ as the step size $\Delta \to 0$ .
+
+Lemma B.1. When ${ \overline { { A } } } = I$ , the fast LSSL algorithm requires computing terms exponentially large in $N$ .
+
+Proof. The characteristic polynomial of $\pmb { I }$ is
+
+$$
+p ( x ) = \mathsf { d e t } | I - x I | = ( 1 - x ) ^ { N } .
+$$
+
+These coefficients have size up to $\begin{array} { r } { \left( \frac { N } { 2 } \right) \approx \frac { 2 ^ { N } } { \sqrt { \pi N / 2 } } } \end{array}$
+
+The inverse of $p ( x )$ has even larger coefficients. It can be calculated in closed form by the generalized binomial formula:
+
+$$
+( 1 - x ) ^ { - N } = \sum _ { k = 0 } ^ { \infty } { \binom { N + k - 1 } { k } } x ^ { k } .
+$$
+
+Taking this (mod $x ^ { L }$ ), the largest coefficient is
+
+$$
+{ \binom { N + L - 2 } { L - 1 } } = { \binom { N + L - 2 } { N - 1 } } = { \frac { ( L - 1 ) ( L - 2 ) \ldots ( L - N + 1 ) } { ( N - 1 ) ! } } .
+$$
+
+When $L = N - 1$ this is
+
+$$
+\binom { 2 ( N - 1 ) } { N - 1 } \approx \frac { 2 ^ { 2 N } } { \sqrt { \pi N } }
+$$
+
+already larger than the coefficients of $( 1 - x ) ^ { N }$ , and only increases as $L$ grows.
+
+# C S4 ALGORITHM DETAILS
+
+This section proves the results of Section 3.3, providing complete details of our efficient algorithms for S4.
+
+Appendices C.1 to C.3 prove Theorems 1 to 3 respectively.
+
+# C.1 NPLR REPRESENTATIONS OF HIPPO MATRICES
+
+We first prove Theorem 1, showing that all HiPPO matrices for continuous-time memory fall under the S4 normal plus low-rank (NPLR) representation.
+
+Proof of Theorem 1. We consider each of the three cases HiPPO-LagT, HiPPO-LegT, and HiPPOLegS separately. Note that the primary HiPPO matrix defined in this work (equation (2)) is the HiPPO-LegT matrix.
+
+HiPPO-LagT. The HiPPO-LagT matrix is simply
+
+$$
+\begin{array} { r } { A _ { n k } = \left\{ \begin{array} { l l } { 0 } & { n < k } \\ { - \frac { 1 } { 2 } } & { n = k } \\ { - 1 } & { n > k } \end{array} \right. \qquad } \\ { A = - \left[ \begin{array} { l l l l l } { \frac { 1 } { 2 } } & { } & { } & { \cdots } \\ { 1 } & { \frac { 1 } { 2 } } & { } & { } \\ { 1 } & { 1 } & { \frac { 1 } { 2 } } & { } \\ { 1 } & { 1 } & { 1 } & { \frac { 1 } { 2 } } & { } \\ { \vdots } & { } & { } & { } & { \ddots } \end{array} \right] . } \end{array}
+$$
+
+Adding the matrix of all $\begin{array} { l } { { \frac { 1 } { 2 } } } \end{array}$ , which is rank 1, yields
+
+$$
+- \left[ { \begin{array} { r r r r r } { - { \frac { 1 } { 2 } } } & { - { \frac { 1 } { 2 } } } & { - { \frac { 1 } { 2 } } } & { - { \frac { 1 } { 2 } } } \\ { { \frac { 1 } { 2 } } } & { - { \frac { 1 } { 2 } } } & { - { \frac { 1 } { 2 } } } \\ { { \frac { 1 } { 2 } } } & { { \frac { 1 } { 2 } } } & & { - { \frac { 1 } { 2 } } } \\ { { \frac { 1 } { 2 } } } & { { \frac { 1 } { 2 } } } & { { \frac { 1 } { 2 } } } \end{array} } \right] .
+$$
+
+This matrix is now skew-symmetric. Skew-symmetric matrices are a particular case of normal matrices with pure-imaginary eigenvalues.
+
+Gu et al. (2020a) also consider a case of HiPPO corresponding to the generalized Laguerre polynomials that generalizes the above HiPPO-LagT case. In this case, the matrix $\pmb { A }$ (up to conjugation by a diagonal matrix) ends up being close to the above matrix, but with a different element on the diagonal. After adding the rank-1 correction, it becomes the above skew-symmetric matrix plus a multiple of the identity. Thus after diagonalization by the same matrix as in the LagT case, it is still reduced to diagonal plus low-rank (DPLR) form, where the diagonal is now pure imaginary plus a real constant.
+
+HiPPO-LegS. We restate the formula from equation (2) for convenience.
+
+$$
+\begin{array} { r } { A _ { n k } = - \left\{ \begin{array} { l l } { ( 2 n + 1 ) ^ { 1 / 2 } ( 2 k + 1 ) ^ { 1 / 2 } } & { \mathrm { i f } n > k } \\ { n + 1 } & { \mathrm { i f } n = k } \\ { 0 } & { \mathrm { i f } n < k } \end{array} \right. . } \end{array}
+$$
+
+Adding $\frac { 1 } { 2 } ( 2 n + 1 ) ^ { 1 / 2 } ( 2 k + 1 ) ^ { 1 / 2 }$ to the whole matrix gives
+
+$$
+- \left\{ \begin{array} { l l } { \frac { 1 } { 2 } ( 2 n + 1 ) ^ { 1 / 2 } ( 2 k + 1 ) ^ { 1 / 2 } } & { \mathrm { i f ~ } n > k } \\ { \frac { 1 } { 2 } } & { \mathrm { i f ~ } n = k } \\ { - \frac { 1 } { 2 } ( 2 n + 1 ) ^ { 1 / 2 } ( 2 k + 1 ) ^ { 1 / 2 } } & { \mathrm { i f ~ } n < k } \end{array} \right.
+$$
+
+Note that this matrix is not skew-symmetric, but is ${ \frac { 1 } { 2 } } I + S$ where $\pmb { S }$ is a skew-symmetric matrix.
+This is diagonalizable by the same unitary matrix that diagonalizes $_ { s }$ .
+
+# HiPPO-LegT.
+
+Up to the diagonal scaling, the LegT matrix is
+
+$$
+A = - \left[ { \begin{array} { c c c c c } { 1 } & { - 1 } & { 1 } & { - 1 } & { \ldots } \\ { 1 } & { 1 } & { - 1 } & { 1 } & \\ { 1 } & { 1 } & { 1 } & { - 1 } & \\ { 1 } & { 1 } & { 1 } & { 1 } & \\ { \vdots } & & & & { \ddots } \end{array} } \right] .
+$$
+
+By adding $- 1$ to this matrix and then the matrix
+
+$$
+\left[ { \begin{array} { l l l l } { 2 } & { } & { 2 } & { } \\ { 2 } & { } & { 2 } & { } \end{array} } \right]
+$$
+
+the matrix becomes
+
+$$
+\left[ { \begin{array} { l l l l } { } & { - 2 } & { } & { - 2 } \\ { 2 } & { } & { } & { } \\ { } & { } & { } & { - 2 } \\ { 2 } & { } & { } & { 2 } \end{array} } \right]
+$$
+
+which is skew-symmetric. In fact, this matrix is the inverse of the Chebyshev Jacobi.
+
+An alternative way to see this is as follows. The LegT matrix is the inverse of the matrix
+
+$$
+\begin{array} { r } { \left[ \begin{array} { l l l l } { - 1 } & { 1 } & { } & { 0 } \\ { - 1 } & { } & { 1 } & { } \\ { } & { - 1 } & { } & { 1 } \\ { } & { } & { - 1 } & { - 1 } \end{array} \right] } \end{array}
+$$
+
+This can obviously be converted to a skew-symmetric matrix by adding a rank 2 term. The inverses of these matrices are also rank-2 differences from each other by the Woodbury identity.
+
+A final form is
+
+$$
+{ \left[ \begin{array} { l l l l } { - 1 } & { 1 } & { - 1 } & { 1 } \\ { - 1 } & { - 1 } & { 1 } & { - 1 } \\ { - 1 } & { - 1 } & { - 1 } & { 1 } \\ { - 1 } & { - 1 } & { - 1 } & { - 1 } \end{array} \right] } + { \left[ \begin{array} { l l l l } { 1 } & { 0 } & { 1 } & { 0 } \\ { 0 } & { 1 } & { 0 } & { 1 } \\ { 1 } & { 0 } & { 1 } & { 0 } \\ { 0 } & { 1 } & { 0 } & { 1 } \end{array} \right] } = { \left[ \begin{array} { l l l l } { 0 } & { 1 } & { 0 } & { 1 } \\ { - 1 } & { 0 } & { 1 } & { 0 } \\ { 0 } & { - 1 } & { 0 } & { 1 } \\ { - 1 } & { 0 } & { - 1 } & { 0 } \end{array} \right] }
+$$
+
+This has the advantage that the rank-2 correction is symmetric (like the others), but the normal skew-symmetric matrix is now 2-quasiseparable instead of 1-quasiseparable.
+
+# C.2 COMPUTING THE S4 RECURRENT VIEW
+
+We prove Theorem 2 showing the efficiency of the S4 parameterization for computing one step of the recurrent representation (Section 2.3).
+
+Recall that without loss of generality, we can assume that the state matrix $\pmb { A } = \pmb { \Lambda } - \pmb { P } \pmb { Q } ^ { * }$ is diagonal plus low-rank (DPLR), potentially over $\mathbb { C }$ . Our goal in this section is to explicitly write out a closed form for the discretized matrix $\overline { { A } }$ .
+
+Recall from equation (3) that
+
+$$
+\begin{array} { r l } & { \overline { { \pmb { A } } } = ( \pmb { I } - \Delta / 2 \cdot \pmb { A } ) ^ { - 1 } ( \pmb { I } + \Delta / 2 \cdot \pmb { A } ) } \\ & { \overline { { \pmb { B } } } = ( \pmb { I } - \Delta / 2 \cdot \pmb { A } ) ^ { - 1 } \Delta \pmb { B } . } \end{array}
+$$
+
+We first simplify both terms in the definition of $\overline { { A } }$ independently.
+
+Forward discretization. The first term is essentially the Euler discretization motivated in Section 2.3.
+
+$$
+\begin{array} { l } { { \displaystyle I + \frac { \Delta } { 2 } A = I + \frac { \Delta } { 2 } ( \Lambda - P Q ^ { * } ) } } \\ { { \displaystyle \quad \quad = \frac { \Delta } { 2 } \left[ \frac { 2 } { \Delta } I + ( \Lambda - P Q ^ { * } ) \right] } } \\ { { \displaystyle \quad \quad = \frac { \Delta } { 2 } A _ { 0 } } } \end{array}
+$$
+
+where $\mathbf { A _ { 0 } }$ is defined as the term in the final brackets.
+
+Backward discretization. The second term is known as the Backward Euler’s method. Although this inverse term is normally difficult to deal with, in the DPLR case we can simplify it using Woodbury’s Identity (Proposition 4).
+
+$$
+\begin{array} { r l } { { ( I - \frac { \Delta } { 2 } A ) ^ { - 1 } = ( I - \frac { \Delta } { 2 } ( \Lambda - P Q ^ { * } ) ) ^ { - 1 } } \quad } & { } \\ & { = \frac { 2 } { \Delta } [ \frac { 2 } { \Delta } - \Lambda + P Q ^ { * } ] ^ { - 1 } } \\ & { = \frac { 2 } { \Delta } [ D - D P ( I + Q ^ { * } D P ) ^ { - 1 } Q ^ { * } D ] } \\ & { = \frac { 2 } { \Delta } A _ { 1 } } \end{array}
+$$
+
+where $\begin{array} { r } { D = \left( \frac { 2 } { \Delta } - \Delta \right) ^ { - 1 } } \end{array}$ and $\pmb { A _ { 1 } }$ is defined as the term in the final brackets. Note that $( 1 + Q ^ { * } D P )$ is actually a scalar in the case when the low-rank term has rank 1.
+
+S4 Recurrence. Finally, the full bilinear discretization can be rewritten in terms of these matrices as
+
+$$
+\begin{array} { l } { \overline { { A } } = A _ { 1 } A _ { 0 } } \\ { \overline { { B } } = \displaystyle \frac { 2 } { \Delta } A _ { 1 } \Delta B = 2 A _ { 1 } B . } \end{array}
+$$
+
+The discrete-time SSM (3) becomes
+
+$$
+\begin{array} { r l } & { x _ { k } = \overline { { A } } x _ { k - 1 } + \overline { { B } } u _ { k } } \\ & { \quad \quad = A _ { 1 } A _ { 0 } x _ { k - 1 } + 2 A _ { 1 } B u _ { k } } \\ & { \quad \quad y _ { k } = C x _ { k } . } \end{array}
+$$
+
+Note that $\mathbf { A _ { 0 } } , \mathbf { A _ { 1 } }$ are accessed only through matrix-vector multiplications. Since they are both DPLR, they have $O ( N )$ matrix-vector multiplication, showing Theorem 2.
+
+# C.3 COMPUTING THE CONVOLUTIONAL VIEW
+
+The most involved part of using SSMs efficiently is computing $\overline { { \kappa } }$ . This algorithm was sketched in Section 3.2 and is the main motivation for the S4 parameterization. In this section, we define the necessary intermediate quantities and prove the main technical result.
+
+The algorithm for Theorem 3 falls in roughly three stages, leading to Algorithm 1. Assuming $\pmb { A }$ has been conjugated into diagonal plus low-rank form, we successively simplify the problem of computing $\overline { { \kappa } }$ by applying the techniques outlined in Section 3.2.
+
+Remark C.1. We note that for the remainder of this section, we transpose $C$ to be a column vector of shape $\mathbb { C } ^ { N }$ or $\mathbb { C } ^ { N \times 1 }$ instead of matrix or row vector $\mathbb { C } ^ { 1 \times N }$ as in (1). In other words the SSM is
+
+$$
+\begin{array} { c } { { x ^ { \prime } ( t ) = A x ( t ) + B u ( t ) } } \\ { { y ( t ) = C ^ { * } x ( t ) + D u ( t ) . } } \end{array}
+$$
+
+This convention is made so that $C$ has the same shape as $B , P , Q$ and simplifies the implementation of $S 4$ .
+
+Reduction 0: Diagonalization By Lemma 3.1, we can switch the representation by conjugating with any unitary matrix. For the remainder of this section, we can assume that $\pmb { A }$ is (complex) diagonal plus low-rank (DPLR).
+
+Note that unlike diagonal matrices, a DPLR matrix does not lend itself to efficient computation of $\overline { { \kappa } }$ . The reason is that $\overline { { \kappa } }$ computes terms $\overline { { C } } ^ { * } \overline { { A } } ^ { i } \overline { { B } }$ which involve powers of the matrix $\overline { { A } }$ . These are trivially computable when $\overline { { A } }$ is diagonal, but is no longer possible for even simple modifications to diagonal matrices such as DPLR.
+
+Reduction 1: SSM Generating Function To address the problem of computing powers of $\overline { { A } }$ , we introduce another technique. Instead of computing the SSM convolution filter $\overline { { \kappa } }$ directly, we introduce a generating function on its coefficients and compute evaluations of it.
+
+Definition 2 (SSM Generating Function). We define the following quantities:
+
+• The SSM convolution function is ${ \mathcal { K } } ( { \overline { { A } } } , { \overline { { B } } } , { \overline { { C } } } ) = ( { \overline { { C } } } ^ { * } { \overline { { B } } } , { \overline { { C } } } ^ { * } { \overline { { A B } } } , \dots )$ and the (truncated) SSM filter of length $L$
+
+$$
+{ \mathcal { K } } _ { L } ( \overline { { \pmb { A } } } , \overline { { \pmb { B } } } , \overline { { \pmb { C } } } ) = ( \overline { { \pmb { C } } } ^ { * } \overline { { \pmb { B } } } , \overline { { \pmb { C } } } ^ { * } \overline { { \pmb { A } } } \overline { { \pmb { B } } } , \ldots , \overline { { \pmb { C } } } ^ { * } \overline { { \pmb { A } } } ^ { L - 1 } \overline { { \pmb { B } } } ) \in \mathbb { R } ^ { L }
+$$
+
+• The SSM generating function at node $z$ is
+
+$$
+\hat { K } ( z ; \overline { { A } } , \overline { { B } } , \overline { { C } } ) \in \mathbb { C } : = \sum _ { i = 0 } ^ { \infty } \overline { { C } } ^ { * } \overline { { A } } ^ { i } \overline { { B } } z ^ { i } = \overline { { C } } ^ { * } ( I - \overline { { A } } z ) ^ { - 1 } \overline { { B } }
+$$
+
+and the truncated SSM generating function at node $z$ is
+
+$$
+\hat { K } _ { L } ( z ; \overline { { \boldsymbol A } } , \overline { { \boldsymbol B } } , \overline { { \boldsymbol C } } ) ^ { * } \in \mathbb { C } : = \sum _ { i = 0 } ^ { L - 1 } \overline { { \boldsymbol C } } ^ { * } \overline { { \boldsymbol A } } ^ { i } \overline { { \boldsymbol B } } z ^ { i } = \overline { { \boldsymbol C } } ^ { * } ( I - \overline { { \boldsymbol A } } ^ { L } z ^ { L } ) ( I - \overline { { \boldsymbol A } } z ) ^ { - 1 } \overline { { \boldsymbol B } }
+$$
+
+• The truncated SSM generating function at nodes $\Omega \in \mathbb { C } ^ { M }$ is
+
+$$
+\hat { K } _ { L } ( \Omega ; \overline { { A } } , \overline { { B } } , \overline { { C } } ) \in \mathbb { C } ^ { M } : = \left( \hat { K } _ { L } ( \omega _ { k } ; \overline { { A } } , \overline { { B } } , \overline { { C } } ) \right) _ { k \in [ M ] }
+$$
+
+Intuitively, the generating function essentially converts the SSM convolution filter from the time domain to frequency domain. Importantly, it preserves the same information, and the desired SSM convolution filter can be recovered from evaluations of its generating function.
+
+Lemma C.2. The SSM function $\mathcal { K } _ { L } ( \overline { { A } } , \overline { { B } } , \overline { { C } } )$ can be computed from the SSM generating function $\hat { K } _ { L } ( \Omega ; \overline { { A } } , \overline { { B } } , \overline { { C } } )$ at the roots of unity $\Omega = \{ \exp ( - 2 \pi i \frac { k } { L } : k \in [ L ] \}$ stably in $O ( L \log L )$ operations.
+
+Proof. For convenience define
+
+$$
+\begin{array} { c } { { { \overline { { { \cal K } } } = \mathcal { K } _ { L } ( \overline { { { \cal A } } } , \overline { { { \cal B } } } , \overline { { { \cal C } } } ) } } } \\ { { { { } } } } \\ { { { \hat { \cal K } = \hat { \cal K } _ { L } ( \Omega ; \overline { { { \cal A } } } , \overline { { { \cal B } } } , \overline { { { \cal C } } } ) } } } \\ { { { { } } } } \\ { { { \hat { \cal K } ( z ) = \hat { \cal K } _ { L } ( z ; \overline { { { \cal A } } } , \overline { { { \cal B } } } , \overline { { { \cal C } } } ) . } } } \end{array}
+$$
+
+Note that
+
+$$
+\hat { \pmb { K } } _ { j } = \sum _ { k = 0 } ^ { L - 1 } \overline { { \pmb { K } } } _ { k } \exp \left( - 2 \pi i \frac { j k } { L } \right) .
+$$
+
+Note that this is exactly the same as the Discrete Fourier Transform (DFT):
+
+$$
+\hat { K } = \mathcal { F } _ { L } K .
+$$
+
+Therefore $\kappa$ can be recovered from $\hat { K }$ with a single inverse DFT, which requires $O ( L \log L )$ operations with the Fast Fourier Transform (FFT) algorithm.
+
+Reduction 2: Woodbury Correction The primary motivation of Definition 2 is that it turns powers of $\overline { { A } }$ into a single inverse of $\overline { { A } }$ (equation (10)). While DPLR matrices cannot be powered efficiently due to the low-rank term, they can be inverted efficiently by the well-known Woodbury identity.
+
+Proposition 4 (Binomial Inverse Theorem or Woodbury matrix identity Woodbury (1950); Golub & Van Loan (2013)). Over a commutative ring ${ \mathcal { R } } ,$ let $\pmb { A } \in \mathcal { R } ^ { N \times N }$ and $U , V \in \dot { \mathcal { R } } ^ { N \times p }$ . Suppose $\pmb { A }$ and $A + U V ^ { * }$ are invertible. Then $I _ { p } + V ^ { \bar { * } } A ^ { - 1 } U \in \mathscr { R } ^ { p \times p }$ is invertible and
+
+$$
+( \pmb { A } + \pmb { U } \pmb { V } ^ { * } ) ^ { - 1 } = \pmb { A } ^ { - 1 } - \pmb { A } ^ { - 1 } \pmb { U } ( \pmb { I } _ { p } + \pmb { V } ^ { * } \pmb { A } ^ { - 1 } \pmb { U } ) ^ { - 1 } \pmb { V } ^ { * } \pmb { A } ^ { - 1 }
+$$
+
+With this identity, we can convert the SSM generating function on a DPLR matrix $\pmb { A }$ into one on just its diagonal component.
+
+Lemma C.3. Let $\pmb { A } = \pmb { \Lambda } - \pmb { P } \pmb { Q } ^ { * }$ be a diagonal plus low-rank representation. Then for any root of unity $z \in \Omega$ , the truncated generating function satisfies
+
+$$
+\begin{array} { l } { { \displaystyle \hat { \cal K } ( z ) = \frac { 2 } { 1 + z } \left[ \tilde { C } ^ { * } R ( z ) B - \tilde { C } ^ { * } R ( z ) P \left( 1 + Q ^ { * } R ( z ) P \right) ^ { - 1 } Q ^ { * } R ( z ) B \right] } } \\ { { \displaystyle \qquad \tilde { C } = C ( I - \overline { { { \cal A } } } ^ { L } ) } } \\ { { \displaystyle R ( z ; \Lambda ) = \left( \frac { 2 } { \Delta } \frac { 1 - z } { 1 + z } - \Lambda \right) ^ { - 1 } . } } \end{array}
+$$
+
+Proof. Directly expanding Definition 2 yields
+
+$$
+\begin{array} { r l } & { { \mathcal { K } } _ { L } ( z ; \overline { { A } } , \overline { { B } } , \overline { { C } } ) = \overline { { C } } ^ { * } \overline { { B } } + \overline { { C } } ^ { * } \overline { { A } } \overline { { B } } z + \cdot \cdot \cdot + \overline { { C } } ^ { * } \overline { { A } } ^ { L - 1 } \overline { { B } } z ^ { L - 1 } } \\ & { \qquad = \overline { { C } } ^ { * } \left( I - \overline { { A } } ^ { L } \right) \left( I - \overline { { A } } z \right) ^ { - 1 } \overline { { B } } } \\ & { \qquad = \tilde { C } ^ { * } \left( I - \overline { { A } } z \right) ^ { - 1 } \overline { { B } } } \end{array}
+$$
+
+where $\tilde { C } ^ { \ast } = C ^ { \ast } \left( I - \overline { { A } } ^ { L } \right)$
+
+We can now explicitly expand the discretized SSM matrices $\overline { { A } }$ and $\overline { B }$ back in terms of the original SSM parameters $\pmb { A }$ and $\textbf { { B } }$ . Lemma C.4 provides an explicit formula, which allows further simplifying
+
+$$
+\begin{array} { r l } & { \tilde { C } ^ { * } \left( I - \overline { { A } } z \right) ^ { - 1 } \overline { { B } } = \displaystyle \frac { 2 } { 1 + z } \tilde { C } ^ { * } \left( \frac { 2 } { \Delta } \frac { 1 - z } { 1 + z } - A \right) ^ { - 1 } B } \\ & { \quad \quad \quad = \displaystyle \frac { 2 } { 1 + z } \tilde { C } ^ { * } \left( \frac { 2 } { \Delta } \frac { 1 - z } { 1 + z } - \Lambda + P Q ^ { * } \right) ^ { - 1 } B } \\ & { \quad \quad \quad = \displaystyle \frac { 2 } { 1 + z } \left[ \tilde { C } ^ { * } R ( z ) B - \tilde { C } ^ { * } R ( z ) P \left( 1 + Q ^ { * } R ( z ) P \right) ^ { - 1 } Q ^ { * } R ( z ) B \right] . } \end{array}
+$$
+
+The last line applies the Woodbury Identity (Proposition 4) where $\begin{array} { r } { \pmb { R } ( z ) = \left( \frac { 2 } { \Delta } \frac { 1 - z } { 1 + z } - \pmb { \Lambda } \right) ^ { - 1 } } \end{array}$
+
+The previous proof used the following self-contained result to back out the original SSM matrices from the discretization.
+
+Lemma C.4. Let ${ \overline { { A } } } , { \overline { { B } } }$ be the SSM matrices $A , B$ discretized by the bilinear discretization with step size $\Delta$ . Then
+
+$$
+C ^ { * } \left( I - \overline { { A } } z \right) ^ { - 1 } \overline { { B } } = \frac { 2 \Delta } { 1 + z } C ^ { * } \left[ 2 \frac { 1 - z } { 1 + z } - \Delta A \right] ^ { - 1 } B
+$$
+
+Proof. Recall that the bilinear discretization that we use (equation (3)) is
+
+$$
+\begin{array} { l } { \displaystyle \overline { { A } } = \left( I - \frac { \Delta } { 2 } A \right) ^ { - 1 } \left( I + \frac { \Delta } { 2 } A \right) } \\ { \displaystyle \overline { { B } } = \left( I - \frac { \Delta } { 2 } A \right) ^ { - 1 } \Delta B } \end{array}
+$$
+
+The result is proved algebraic manipulations.
+
+$$
+\begin{array} { r l } & { C ^ { \star } \left( I - \overline { { A } } z \right) ^ { - 1 } \overline { { B } } = C ^ { \star } \left[ \left( I - \frac { \Delta } { 2 } A \right) ^ { - 1 } \left( I - \frac { \Delta } { 2 } A \right) - \left( I - \frac { \Delta } { 2 } A \right) ^ { - 1 } \left( I + \frac { \Delta } { 2 } A \right) z \right] ^ { - 1 } \overline { { B } } } \\ & { \qquad = C ^ { \star } \left[ \left( I - \frac { \Delta } { 2 } A \right) - \left( I + \frac { \Delta } { 2 } A \right) z \right] ^ { - 1 } \left( I - \frac { \Delta } { 2 } A \right) \overline { { B } } } \\ & { \qquad = C ^ { \star } \left[ I ( 1 - z ) - \frac { \Delta } { 2 } A ( 1 + z ) \right] ^ { - 1 } \Delta B } \\ & { \qquad = \frac { \Delta } { 1 - z } C ^ { \star } \left[ I - \frac { \Delta A } { 2 \frac { 1 + z } { 1 + z } } \right] ^ { - 1 } B } \\ & { \qquad = \frac { 2 \Delta } { 1 + z } C ^ { \star } \left[ \frac { 2 1 - z } { 1 + z } I - \Delta A \right] ^ { - 1 } B } \end{array}
+$$
+
+Note that in the S4 parameterization, instead of constantly computing $\tilde { C } = C \left( I - \overline { { \boldsymbol { A } } } ^ { L } \right)$ , we can simply reparameterize our parameters to learn $\tilde { C }$ directly instead of $C$ , saving a minor computation cost and simplifying the algorithm.
+
+Reduction 3: Cauchy Kernel We have reduced the original problem of computing $\overline { { \kappa } }$ to the problem of computing the SSM generating function $\hat { \mathcal { K } } _ { L } ( \Omega ; \overline { { A } } , \overline { { B } } , \overline { { C } } )$ in the case that $\overline { { A } }$ is a diagonal matrix. We show that this is exactly the same as a Cauchy kernel, which is a well-studied problem with fast and stable numerical algorithms.
+
+Definition 3. A Cauchy matrix or kernel on nodes $\Omega = ( \omega _ { i } ) \in \mathbb { C } ^ { M }$ and $\Lambda = ( \lambda _ { j } ) \in \mathbb { C } ^ { N }$ is
+
+$$
+M \in \mathbb { C } ^ { M \times N } = M ( \Omega , \Lambda ) = ( M _ { i j } ) _ { i \in [ M ] , j \in [ N ] } \qquad M _ { i j } = \frac { 1 } { \omega _ { i } - \lambda _ { j } } .
+$$
+
+The computation time of a Cauchy matrix-vector product of size $M \times N$ is denoted by $\mathcal { C } ( M , N )$
+
+Computing with Cauchy matrices is an extremely well-studied problem in numerical analysis, with both fast arithmetic algorithms and fast numerical algorithms based on the famous Fast Multipole Method (FMM) (Pan, 2001; 2015; 2017).
+
+Proposition 5 (Cauchy). A Cauchy kernel requires $O ( M + N )$ space, and operation count
+
+$$
+\mathcal { C } ( M , N ) = \left\{ \begin{array} { l l } { O \left( M N \right) } & { n a i v e l y } \\ { O \left( \left( M + N \right) \log ^ { 2 } ( M + N ) \right) } & { i n \ e x a c t \ a r i t h m e t i c } \\ { O \left( \left( M + N \right) \log ( M + N ) \log \frac { 1 } { \varepsilon } \right) } & { n u m e r i c a l l y \ t o p r e c i s i o n \ \varepsilon . } \end{array} \right.
+$$
+
+Corollary C.5. Evaluating $Q ^ { * } R ( \Omega ; \Lambda ) P$ (defined in Lemma $C . 3$ ) for any set of nodes $\Omega \in \mathbb { C } ^ { L }$ , diagonal matrix $\Lambda$ , and vectors $P , Q$ can be computed in $\mathcal { C } ( L , N )$ operations and $O ( L + N )$ space, where $\mathcal { C } ( L , N ) = \tilde { O } ( L + N )$ is the cost of a Cauchy matrix-vector multiplication.
+
+Proof. For any fixed ω ∈ Ω, we want to compute Pj q∗j pjω−λj . Computing this over all $\omega _ { i }$ is therefore exactly a Cauchy matrix-vector multiplication. □
+
+This completes the proof of Theorem 3. In Algorithm 1, note that the work is dominated by Step 2, which has a constant number of calls to a black-box Cauchy kernel, with complexity given by Proposition 5.
+
+# D EXPERIMENT DETAILS AND FULL RESULTS
+
+This section contains full experimental procedures and extended results and citations for our experimental evaluation in Section 4. Appendix D.1 corresponds to benchmarking results in Section 4.1, Appendix D.2 corresponds to LRD experiments (LRA and Speech Commands) in Section 4.2, and Appendix D.3 corresponds to the general sequence modeling experiments (generation, image classification, forecasting) in Section 4.3.
+
+# D.1 BENCHMARKING
+
+Benchmarking results from Table 1 and Table 2 were tested on a single A100 GPU.
+
+Benchmarks against LSSL For a given dimension $H$ , a single LSSL or S4 layer was constructed with $H$ hidden features. For LSSL, the state size $N$ was set to $H$ as done in (Gu et al., 2021). For S4, the state size $N$ was set to parameter-match the LSSL, which was a state size of $\frac { N } { \frac { 4 } { \alpha } }$ due to differences in the parameterization. Table 1 benchmarks a single forward+backward pass of a single layer.
+
+Benchmarks against Efficient Transformers Following (Tay et al., 2021), the Transformer models had 4 layers, hidden dimension 256 with 4 heads, query/key/value projection dimension 128, and batch size 32, for a total of roughly $6 0 0 k$ parameters. The S4 model was parameter tied while keeping the depth and hidden dimension constant (leading to a state size of $N = 2 5 6$ ).
+
+We note that the relative orderings of these methods can vary depending on the exact hyperparameter settings.
+
+# D.2 LONG-RANGE DEPENDENCIES
+
+This section includes information for reproducing our experiments on the Long-Range Arena and Speech Commands long-range dependency tasks.
+
+Long Range Arena Table 8 contains extended results table with all 11 methods considered in (Tay et al., 2021).
+
+For the S4 model, hyperparameters for all datasets are reported in Table 9. For all datasets, we used the AdamW optimizer with a constant learning rate schedule with decay on validation plateau. However, the learning rate on HiPPO parameters (in particular $\Lambda , P , Q , B , C , \Delta )$ were reduced to a maximum starting LR of 0.001, which improves stability since the HiPPO equation is crucial to performance.
+
+The S4 state size was always fixed to $N = 6 4$ .
+
+As S4 is a sequence-to-sequence model with output shape (batch, length, dimension) and LRA tasks are classification, mean pooling along the length dimension was applied after the last layer.
+
+We note that most of these results were trained for far longer than what was necessary to achieve SotA results (e.g., the Image task reaches SotA in 1 epoch). Results often keep improving with longer training times.
+
+Hardware. All models were run on single GPU. Some tasks used an A100 GPU (notably, the Path-X experiments), which has a larger max memory of 40Gb. To reproduce these on smaller GPUs, the batch size can be reduced or gradients can be accumulated for two batches.
+
+Path-X. We remark that an earlier version of this paper reported a higher score for Path-X. This earlier version used a different variant of the dataset, due to a misunderstanding of the properties of the dataset. More specifically, we found that S4 scored $9 3 . 6 8 \%$ accuracy on a version that involved
+
+Table 8: Full results for the Long Range Arena (LRA) benchmark for long-range dependencies in sequence models. (Top): Original Transformer variants in LRA. (Bottom): Other models reported in the literature.
+
+
Model
LISTOPS
TEXT
RETRIEVAL
IMAGE
PATHFINDER
PATH-X
AVG
Random
10.00
50.00
50.00
10.00
50.00
50.00
36.67
Transformer
36.37
64.27
57.46
42.44
71.40
X
53.66
Local Attention
15.82
52.98
53.39
41.46
66.63
X
46.71
Sparse Trans.
17.07
63.58
59.59
44.24
71.71
X
51.03
Longformer
35.63
62.85
56.89
42.22
69.71
X
52.88
Linformer
35.70
53.94
52.27
38.56
76.34
X
51.14
Reformer
37.27
56.10
53.40
38.07
68.50
X
50.56
Sinkhorn Trans.
33.67
61.20
53.83
41.23
67.45
X
51.23
Synthesizer
36.99
61.68
54.67
41.61
69.45
X
52.40
BigBird
36.05
64.02
59.29
40.83
74.87
X
54.17
Linear Trans.
16.13
65.90
53.09
42.34
75.30
X
50.46
Performer
18.01
65.40
53.82
42.77
77.05
X
51.18
FNet
35.33
65.11
59.61
38.67
77.80
X
54.42
Nystromformer
37.15
65.52
79.56
41.58
70.94
X
57.46
Luna-256
37.25
64.57
79.29
47.38
77.72
X
59.37
S4
58.35
76.02
87.09
87.26
86.05
88.10
80.48
+
+Table 9: The values of the best hyperparameters found for classification datasets; LRA (Top) and images/speech (Bottom). LR is learning rate and WD is weight decay. BN and LN refer to Batch Normalization and Layer Normalization.
+
+
Depth
Features H
Norm
Pre-norm
Dropout
LR
Batch Size
Epochs
WD
Patience
ListOps
6
128
BN
False
0
0.01
100
50
0.01
5
Text
4
64
BN
True
0
0.001
50
20
0
5
Retrieval
6
256
BN
True
0
0.002
64
20
0
20
Image
6
512
LN
False
0.2
0.004
50
200
0.01
20
Pathfinder
6
256
BN
True
0.1
0.004
100
200
0
10
Path-X
6
256
BN
True
0.0
0.0005
32
100
0
20
CIFAR-10
6
1024
LN
False
0.25
0.01
50
200
0.01
20
Speech Commands (MFCC)
4
256
LN
False
0.2
0.01
100
50
0
5
Speech Commands (Raw)
6
128
BN
True
0.1
0.01
20
150
0
10
+
+taking the $2 5 6 \times 2 5 6$ resolution version of the Pathfinder dataset and averaging every $2 \times 2$ square;
+we erroneously thought that this version of the dataset was equivalent to the original Path-X.
+
+After discussions with the LRA authors, we discovered that this is not equivalent to the $1 2 8 \times 1 2 8$ resolution Pathfinder dataset (the correct Path-X), which is in fact much harder. In fact, Path-X is so difficult that a 2D CNN without global receptive field (e.g. ResNet-18 or ResNet-34) also cannot achieve above chance. This fact led to the original misunderstanding, as we could not solve this image classification task even with a ResNet and thought the data might have errors.
+
+Speech Commands We provide details of sweeps run for baseline methods run by us—numbers for all others method are taken from Gu et al. (2021). The best hyperparameters used for S4 are included in Table 9.
+
+Transformer (Vaswani et al., 2017) For MFCC, we swept the number of model layers $\{ 2 , 4 \}$ , dropout $\{ 0 , 0 \dot { . } 1 \}$ and learning rates $\{ 0 . 0 0 1 , 0 . 0 0 0 5 \}$ . We used 8 attention heads, model dimension 128, prenorm, positional encodings, and trained for 150 epochs with a batch size of 100. For Raw, the Transformer model’s memory usage made training impossible.
+
+Performer (Choromanski et al., 2020) For MFCC, we swept the number of model layers $\{ 2 , 4 \}$ , dropout $\{ 0 , 0 . 1 \}$ and learning rates $\{ 0 . 0 0 1 , 0 . 0 0 0 5 \}$ . We used 8 attention heads, model dimension 128, prenorm, positional encodings, and trained for 150 epochs with a batch size of 100. For Raw, we used a model dimension of 128, 4 attention heads, prenorm, and a batch size of 16. We reduced the number of model layers to 4, so the model would fit on the single GPU. We trained for 100 epochs with a learning rate of 0.001 and no dropout.
+
+ExpRNN (Lezcano-Casado & Mart´ınez-Rubio, 2019) For MFCC, we swept hidden sizes $\{ 2 5 6 , 5 1 2 \}$ and learning rates $\{ 0 . 0 0 1 , 0 . 0 0 2 , 0 . 0 0 0 5 \}$ . Training was run for 200 epochs, with a single layer model using a batch size of 100. For Raw, we swept hidden sizes $\{ 3 2 , 6 4 \}$ and learning rates $\{ 0 . 0 0 1 , 0 . 0 \bar { 0 } 0 5 \}$ (however, ExpRNN failed to learn).
+
+Lipschitz RNN (Erichson et al., 2021) For MFCC, we swept hidden sizes $\{ 2 5 6 , 5 1 2 \}$ and learning rates $\{ 0 . 0 0 1 , 0 . 0 0 2 , 0 . 0 0 0 5 \}$ . Training was run for 150 epochs, with a single layer model using a batch size of 100. For Raw, we found that LipschitzRNN was too slow to train on a single GPU (requiring a full day for 1 epoch of training alone).
+
+WaveGAN Discriminator (Donahue et al., 2019) The WaveGAN-D in Table 4 is actually our improved version of the discriminator network from the recent WaveGAN model for speech (Donahue et al., 2019). This CNN actually did not work well out-of-the-box, and we added several features to help it perform better. The final model is highly specialized compared to our model, and includes:
+
+• Downsampling or pooling between layers, induced by strided convolutions, that decrease the sequence length between layers.
+• A global fully-connected output layer; thus the model only works for one input sequence length and does not work on MFCC features or the frequency-shift setting in Table 4.
+• Batch Normalization is essential, whereas S4 works equally well with either Batch Normalization or Layer Normalization.
+• Almost $9 0 \times$ as many parameters as the S4 model (26.3M vs. 0.3M).
+
+# D.3 GENERAL SEQUENCE MODELING
+
+This subsection corresponds to the experiments in Section 4.3. Because of the number of experiments in this section, we use subsubsection dividers for different tasks to make it easier to follow: CIFAR-10 density estimation Appendix D.3.1, WikiText-103 language modeling Appendix D.3.2, autoregressive generation Appendix D.3.3, sequential image classification Appendix D.3.4, and time-series forecasting Appendix D.3.5.
+
+# D.3.1 CIFAR DENSITY ESTIMATION
+
+This task used a different backbone than the rest of our experiments. We used blocks of alternating S4 layers and position-wise feed-forward layers (in the style of Transformer blocks). Each feedforward intermediate dimension was set to $2 \times$ the hidden size of the incoming S4 layer. Similar to Salimans et al. (2017), we used a UNet-style backbone consisting of $B$ identical blocks followed by a downsampling layer. The downsampling rates were $3 , 4 , 4$ (the 3 chosen because the sequence consists of RGB pixels). The base model had $B = 8$ with starting hidden dimension 128, while the large model had $B = 1 6$ with starting hidden dimension 192.
+
+We experimented with both the mixture of logistics from (Salimans et al., 2017) as well as a simpler 256-way categorical loss. We found they were pretty close and ended up using the simpler softmax loss along with using input embeddings.
+
+We used the LAMB optimizer with learning rate 0.005. The base model had no dropout, while the large model had dropout 0.1 before the linear layers inside the S4 and FF blocks.
+
+# D.3.2 WIKITEXT-103 LANGUAGE MODELING
+
+The RNN baselines included in Table 7 are the AWD-QRNN (Merity et al., 2018), an efficient linear gated RNN, and the $\mathrm { L S T M + C a c h e + H e b b i a n + M b P A ~ ( R a e }$ et al., 2018), the best performing pure RNN in the literature. The CNN baselines are the CNN with GLU activations (Dauphin et al., 2017), the TrellisNet (Bai et al., 2019), Dynamic Convolutions (Wu et al., 2019), and TaLK Convolutions (Lioutas & Guo, 2020).
+
+The Transformer baseline is (Baevski & Auli, 2018), which uses Adaptive Inputs with a tied Adaptive Softmax. This model is a standard high-performing Transformer baseline on this benchmark, used for example by Lioutas & Guo (2020) and many more.
+
+Our S4 model uses the same Transformer backbone as in (Baevski & Auli, 2018). The model consists of 16 blocks of S4 layers alternated with position-wise feedforward layers, with a feature dimension of 1024. Because our S4 layer has around 1/4 the number of parameters as a self-attention layer with the same dimension, we made two modifications to match the parameter count better: (i) we used a GLU activation after the S4 linear layer (Section 3.4) (ii) we used two S4 layers per block. Blocks use Layer Normalization in the pre-norm position. The embedding and softmax layers were the Adaptive Embedding from (Baevski & Auli, 2018) with standard cutoffs 20000, 40000, 200000.
+
+Evaluation was performed similarly to the basic setting in (Baevski & Auli, 2018), Table 5, which involves sliding non-overlapping windows of width 1024 tokens. Other settings are reported in (Baevski & Auli, 2018) that include more context at training and evaluation time and improves the score. Because such evaluation protocols are orthogonal to the basic model, we do not consider them and report the base score from (Baevski & Auli, 2018) Table 5.
+
+Instead of SGD $+$ Momentum with multiple cosine learning rate annealing cycles, our S4 model was trained with the simpler AdamW optimizer with a single cosine learning rate cycle with a maximum of 800000 steps. The initial learning rate was set to 0.0005. We used 8 A100 GPUs with a batch size of 8 per gpu and context size 1024. We used no gradient clipping and a weight decay of 0.1. Unlike (Baevski & Auli, 2018) which specified different dropout rates for different parameters, we used a constant dropout rate of 0.25 throughout the network, including before every linear layer and on the residual branches.
+
+# D.3.3 AUTOREGRESSIVE GENERATION SPEED
+
+Protocol. To account for different model sizes and memory requirements for each method, we benchmark generation speed by throughput, measured in images per second (Table 6) or tokens per second (Table 7). Each model generates images on a single $A \bar { 1 } 0 0$ GPU, maximizing batch size to fit in memory. (For CIFAR-10 generation we limited memory to 16Gb, to be more comparable to the Transformer and Linear Transformer results reported from (Katharopoulos et al., 2020).)
+
+Baselines. The Transformer and Linear Transformer baselines reported in Table 6 are the results reported directly from Katharopoulos et al. (2020). Note that the Transformer number is the one in their Appendix, which implements the optimized cached implementation of self-attention.
+
+For all other baseline models, we used open source implementations of the models to benchmark generation speed. For the PixelC $\mathrm { N N } { + } { + }$ , we used the fast cached version by Ramachandran et al. (2017), which sped up generation by orders of magnitude from the naive implementation. This code was only available in TensorFlow, which may have slight differences compared to the rest of the baselines which were implemented in PyTorch.
+
+We were unable to run the Sparse Transformer (Child et al., 2019) model due to issues with their custom CUDA implementation of the sparse attention kernel, which we were unable to resolve.
+
+The Transformer baseline from Table 7 was run using a modified GPT-2 backbone from the HuggingFace repository, configured to recreate the architecture reported in (Baevski & Auli, 2018). These numbers are actually slightly favorable to the baseline, as we did not include the timing of the embedding or softmax layers, whereas the number reported for S4 is the full model.
+
+# D.3.4 PIXEL-LEVEL SEQUENTIAL IMAGE CLASSIFICATION
+
+Our models were trained with the AdamW optimizer for up to 200 epochs. Hyperparameters for the CIFAR-10 model is reported in Table 9.
+
+For our comparisons against ResNet-18, the main differences between the base models are that S4 uses LayerNorm by default while ResNet uses BatchNorm. The last ablation in Section 4.3 swaps the normalization type, using BatchNorm for S4 and LayerNorm for ResNet, to ablate this architectural difference. The experiments with augmentation take the base model and train with mild data augmentation: horizontal flips and random crops (with symmetric padding).
+
+# D.3.5 TIME SERIES FORECASTING COMPARED TO INFORMER
+
+We include a simple figure (Fig. 3) contrasting the architecture of S4 against that of the Informer (Zhou et al., 2021).
+
+In Fig. 3, the goal is to forecast a contiguous range of future predictions (Green, length $F$ ) given a range of past context (Blue, length $C$ ). We simply concatenate the entire context with a sequence of masks set to the length of the forecast window. This input is a single sequence of length $C + F$ that
+
+Table 10: (Pixel-level image classification.) Citations refer to the original model; additional citation indicates work from which this baseline is reported.
+
+
Model
SMNIST
PMNIST
SCIFAR
Transformer (Vaswani et al.,2O17; Trinh et al., 2018)
98.9
97.9
62.2
CKConv (Romero et al., 2021)
99.32
98.54
63.74
TrellisNet (Bai et al.,2019)
99.20
98.13
73.42
TCN (Bai et al., 2018)
99.0
97.2
-
LSTM (Hochreiter & Schmidhuber,1997; Gu et al.,2020b)
98.9
95.11
63.01
r-LSTM (Trinh etal.,2018)
98.4
95.2
72.2
Dilated GRU (Chang et al.,2017)
99.0
94.6
-
Dilated RNN (Chang et al., 2017)
98.0
96.1
=
IndRNN (Li et al., 2018)
99.0
96.0
expRNN (Lezcano-Casado & Martinez-Rubio,2019)
98.7
96.6
UR-LSTM
99.28
96.96
71.00
UR-GRU (Gu et al.,2020b)
99.27
96.51
74.4
LMU (Voelker et al.,2019)
=
97.15
1
HiPPO-RNN (Gu et al., 2020a)
98.9
98.3
61.1
UNIcoRNN (Rusch&Mishra,2021)
-
98.4
-
LMUFFT (Chilkuri & Eliasmith,2021)
98.49
=
LipschitzRNN (Erichson et al.,2021)
99.4
96.3
64.2
S4
99.63
98.70
91.13
+
+
+Figure 3: Comparison of S4 and specialized time-series models for forecasting tasks. (Top Left) The forecasting task involves predicting future values of a time-series given past context. (Bottom Left) We perform simple forecasting using a sequence model such as S4 as a black box. (Right) Informer uses an encoder-decoder architecture designed specifically for forecasting problems involving a customized attention module (figure taken from Zhou et al. (2021)).
+
+is run through the same simple deep S4 model used throughout this work, which maps to an output of length $C + F$ . We then use just the last $F$ features as the forecasted predictions.
+
+Tables 11 and 12 contain full results on all 50 settings considered by Zhou et al. (2021). S4 sets the best results on 40 out of 50 of these settings.
+
+Table 11: Univariate long sequence time-series forecasting results on four datasets (five cases).
+
+
+
+# D.4 VISUALIZATIONS
+
+We visualize the convolutional filter $\bar { K }$ learned by S4 for the Pathfinder and CIFAR-10 tasks in Appendix D.4.
+
+
+Figure 4: (Convolutional filters on Pathfinder) A random selection of filters learned by S4 in the first layer (top 2 rows) and last layer (bottom 2 rows) of the best model.
\ No newline at end of file
diff --git a/md/dev/ubgdInLSF9/ubgdInLSF9.md b/md/dev/ubgdInLSF9/ubgdInLSF9.md
new file mode 100644
index 0000000000000000000000000000000000000000..b7112c4fe8442c1f96c95d6db48dc63dd2f09f54
--- /dev/null
+++ b/md/dev/ubgdInLSF9/ubgdInLSF9.md
@@ -0,0 +1,386 @@
+# SnapFusion: Text-to-Image Diffusion Model on Mobile Devices within Two Seconds
+
+Yanyu Li1,2,† Huan Wang1,2,† Qing Jin1,† Ju Hu1 Pavlo Chemerys1 Yun Fu2 Yanzhi Wang2 Sergey Tulyakov1 Jian Ren1,† 1Snap Inc. 2Northeastern University Project Page: https://snap-research.github.io/SnapFusion
+
+
+Figure 1: Example generated images by using our efficient text-to-image diffusion model.
+
+# Abstract
+
+Text-to-image diffusion models can create stunning images from natural language descriptions that rival the work of professional artists and photographers. However, these models are large, with complex network architectures and tens of denoising iterations, making them computationally expensive and slow to run. As a result, high-end GPUs and cloud-based inference are required to run diffusion models at scale. This is costly and has privacy implications, especially when user data is sent to a third party. To overcome these challenges, we present a generic approach that, for the first time, unlocks running text-to-image diffusion models on mobile devices in less than 2 seconds. We achieve so by introducing efficient network architecture and improving step distillation. Specifically, we propose an efficient UNet by identifying the redundancy of the original model and reducing the computation of the image decoder via data distillation. Further, we enhance the step distillation by exploring training strategies and introducing regularization from classifier-free guidance. Our extensive experiments on MS-COCO show that our model with 8 denoising steps achieves better FID and CLIP scores than Stable Diffusion v1.5 with 50 steps. Our work democratizes content creation by bringing powerful text-to-image diffusion models to the hands of users.
+
+# 1 Introduction
+
+Diffusion-based text-to-image models [1, 2, 3, 4] show remarkable progress in synthesizing photorealistic content using text prompts. They profoundly impact the content creation [5, 6], image editing and in-painting [7, 8, 9, 10, 11], super-resolution [12], video synthesis [13, 14], and 3D assets generation [15, 16, 17], to name a few. This impact comes at the cost of the substantial increase in the computation requirements to run such models [18, 19, 20, 21]. As a result, to satisfy the necessary latency constraints large scale, often cloud-based inference platforms with high-end GPU are required. This incurs high costs and brings potential privacy concerns, motivated by the sheer fact of sending private images, videos, and prompts to a third-party service.
+
+Not surprisingly, there are emerging efforts to speed up the inference of text-to-image diffusion models on mobile devices. Recent works use quantization [22, 23] or GPU-aware optimization to reduce the run time, i.e., accelerating the diffusion pipeline to 11.5s on Samsung Galaxy S23 Ultra [24]. While these methods effectively achieve a certain speed-up on mobile platforms, the obtained latency does not allow for a seamless user experience. Besides, none of the existing studies systematically examine the generation quality of on-device models through quantitative analysis.
+
+In this work, we present the first text-to-image diffusion model that generates an image on mobile devices in less than 2 seconds. To achieve this, we mainly focus on improving the slow inference speed of the UNet and reducing the number of necessary denoising steps. First, the architecture of UNet, which is the major bottleneck for the conditional diffusion model (as we show in Tab. 1), is rarely optimized in the literature. Existing works primarily focus on post-training optimizations [25, 26]. Conventional compression techniques, e.g., model pruning [27, 28] and architecture search [29, 30], reduce the performance of pre-trained diffusion models [31], which is difficult to recover without heavy fine-tuning. Consequently, the architecture redundancies are not fully exploited, resulting in a limited acceleration ratio. Second, the flexibility of the denoising diffusion process is not well explored for the on-device model. Directly reducing the number of denoising steps impacts the generative performance, while progressively distilling the steps can mitigate the impacts [32, 33]. However, the learning objectives for step distillation and the strategy for training the on-device model have yet to be thoroughly studied, especially for models trained using large-scale datasets.
+
+This work proposes a series of contributions to address the aforementioned challenges:
+
+• We provide an in-depth analysis of the denoising UNet and identify the architecture redundancies.
+• We propose a novel evolving training framework to obtain an efficient UNet that performs better than the original Stable Diffusion $\mathrm { v } 1 . { \bar { s } }$ while being significantly faster. We also introduce a data distillation pipeline to compress and accelerate the image decoder.
+• We improve the learning objective during step distillation by proposing additional regularization, including losses from the $\mathbf { v }$ -prediction and classifier-free guidance [34].
+• Finally, we explore the training strategies for step distillation, especially the best teacher-student paradigm for training the on-device model.
+
+Through the improved Step distillation and network architecture development for the difFusion model, our introduced model, SnapFusion, generates a $5 1 2 \times 5 1 2$ image from the text on mobile devices in less than 2 seconds, while with image quality similar to Stable Diffusion v1.5 [4] (see example images from our approach in Fig. 1).
+
+# 2 Model Analysis of Stable Diffusion
+
+# 2.1 Prerequisites of Stable Diffusion
+
+Diffusion Models gradually convert the sample x from a real data distribution $p _ { \mathrm { d a t a } } ( \mathbf { x } )$ into a noisy version, i.e., the diffusion process, and learn to reverse this process by denoising the noisy data step by step [35]. Therefore, the model transforms a simple distribution, e.g., random Gaussian noise, to the desired more complicated distribution, e.g., real images. Specifically, given a (noise-prediction) diffusion model $\hat { \epsilon } _ { \pmb { \theta } } ( \cdot )$ parameterized by $\pmb \theta$ , which is typically structured as a UNet [36, 1], the training can be formulated as the following noise prediction problem [35, 1, 2]:
+
+$$
+\operatorname* { m i n } _ { \pmb { \theta } } \ \mathbb { E } _ { t \sim U [ 0 , 1 ] , \mathbf { x } \sim p _ { \mathrm { d a t a } } ( \mathbf { x } ) , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } ) } \ | | \hat { \epsilon } _ { \pmb { \theta } } ( t , \mathbf { z } _ { t } ) - \epsilon | | _ { 2 } ^ { 2 } ,
+$$
+
+where $t$ refers to the time step; $\epsilon$ is the ground-truth noise; $\mathbf { z } _ { t } = \alpha _ { t } \mathbf { x } + \sigma _ { t } \mathbf { \epsilon } \mathbf { \epsilon }$ is the noisy data; $\alpha _ { t }$ and $\sigma _ { t }$ are the strengths of signal and noise, respectively, decided by a noise scheduler. A trained
+
+diffusion model can generate samples from noise with various samplers. In our experiments, we use DDIM [37] to sample with the following iterative denoising process from $t$ to a previous time step $t ^ { \prime }$
+
+$$
+\mathbf { z } _ { t ^ { \prime } } = \alpha _ { t ^ { \prime } } \frac { \mathbf { z } _ { t } - \sigma _ { t } \hat { \epsilon } _ { \pmb { \theta } } ( t , \mathbf { z } _ { t } ) } { \alpha _ { t } } + \sigma _ { t ^ { \prime } } \hat { \epsilon } _ { \pmb { \theta } } ( t , \mathbf { z } _ { t } ) ,
+$$
+
+where $\mathbf { z } _ { t ^ { \prime } }$ will be fed into $\hat { \epsilon } _ { \pmb { \theta } } ( \cdot )$ again until $t ^ { \prime }$ becomes 0, i.e., the denoising process finishes.
+
+Latent Diffusion Model / Stable Diffusion. The recent latent diffusion model (LDM) [4] reduces the inference computation and steps by performing the denoising process in the latent space, which is encoded from a pre-trained variational autoencoder (VAE) [38, 39]. During inference, the image is constructed through the decoder from the latent. LDM also explores the text-to-image generation, where a text prompt embedding $\mathbf { c }$ is fed into the diffusion model as the condition. When synthesizing images, an important technique, classifier-free guidance (CFG) [34], is adopted to improve quality,
+
+$$
+\tilde { \epsilon } _ { \theta } ( t , { \bf z } _ { t } , { \bf c } ) = w \hat { \epsilon } _ { \theta } ( t , { \bf z } _ { t } , { \bf c } ) - ( w - 1 ) \hat { \epsilon } _ { \theta } ( t , { \bf z } _ { t } , \mathcal { O } ) ,
+$$
+
+where $\hat { \epsilon } _ { \pmb { \theta } } ( t , { \bf z } _ { t } , \emptyset )$ represents the unconditional output obtained by using null text $\mathcal { D }$ . The guidance scale $w$ can be adjusted to control the strength of conditional information on the generated images to achieve the trade-off between quality and diversity. LDM is further trained on large-scale datasets [40], delivering a series of Stable Diffusion (SD) models [4]. We choose Stable Diffusion v1.5 (SD-v1.5) as the baseline. Next, we perform detailed analyses to diagnose the latency bottleneck of SD-v1.5.
+
+# 2.2 Benchmark and Analysis
+
+Here we comprehensively study the parameter and computation intensity of the SD-v1.5. The in-depth analysis helps us understand the bottleneck to deploying text-to-image diffusion models on mobile devices from the scope of network architecture and algorithm paradigms. Meanwhile, the micro-level breakdown of the networks serves as the basis of the architecture redesign and search.
+
+Table 1: Latency Comparison between Stable Diffusion v1.5 and our proposed efficient diffusion models (UNet and Image Decoder) on iPhone $1 4 \mathrm { P r o }$ .
+
+
Stable Diffusion v1.5
Text Encoder
UNet
VAE Decoder
Input Resolution
77 tokens
64×64
64×64
#Parameters (M)
123
860
50
Latency (ms)
4
~1,700²
369
Inference Steps
2
50
1
Total Latency (ms)
8
85,000
369
OurModel
Text Encoder
OurUNet
OurImageDecoder
Input Resolution
77 tokens
64×64
64×64
#Parameters (M)
123
848
13
Latency (ms)
4
230
116
Inference Steps
2
8
1
Total Latency (ms)
8
1,840
116
+
+
+Figure 2: Latency (iPhone $1 4 ~ \mathrm { P r o }$ , ms) and parameter (M) analysis for cross-attention (CA) and ResNet blocks in the UNet of Stable Diffusion.
+
+Macro Prospective. As shown in Tab. 1 and Fig. 3, the networks of stable diffusion consist of three major components. Text encoder employs a ViT-H model [41] for converting input text prompt into embedding and is executed in two steps (with one for CFG) for each image generation process, constituting only a tiny portion of inference latency (8 ms). The VAE decoder takes the latent feature to generate an image, which runs as $3 6 9 \mathrm { m s }$ . Unlike the above two models, the denoising UNet is not only intensive in computation (1.7 seconds latency) but also demands iterative forwarding steps to ensure generative quality. For instance, the total denoising timesteps is set to 50 for inference in SD-v1.5, significantly slowing down the on-device generation process to the minute level.
+
+Breakdown for UNet. The time-conditional (t) UNet consists of cross-attention and ResNet blocks. Specifically, a cross-attention mechanism is employed at each stage to integrate text embedding (c) into spatial features: Cross-Attention $\begin{array} { r } { \langle Q _ { \mathbf { z } _ { t } } , K _ { \mathbf { c } } , V _ { \mathbf { c } } \rangle = S o f t m a x ( \frac { Q _ { \mathbf { z } _ { t } } \cdot K _ { \mathbf { c } } ^ { \top } } { \sqrt { d } } ) \cdot V _ { \mathbf { c } } } \end{array}$ , where $Q$ is projected from noisy data $\mathbf { z } _ { t }$ , $K$ and $V$ are projected from text condition, and $d$ is the feature dimension. UNet also uses ResNet blocks to capture locality, and we can formulate the forward of UNet as:
+
+$$
+\hat { \epsilon } _ { \pmb { \theta } } ( t , { \bf z } _ { t } ) = \prod \{ C r o s s - A t t e n t i o n ( { \bf z } _ { t } , { \bf c } ) , R e s N e t ( { \bf z } _ { t } , t ) \} .
+$$
+
+2We notice the latency varies depending on the phones and use three phones to get the average speed.
+
+
+Figure 3: Workflow of text-to-image diffusion model (left) and the proposed step distillation (right).
+
+The distribution of parameters and computations of UNet is illustrated in Fig. 2, showing that parameters are concentrated on the middle (downsampled) stages because of the expanded channel dimensions, among which ResNet blocks constitute the majority. In contrast, the slowest parts of UNet are the input and output stages with the largest feature resolution, as spatial cross-attentions have quadratic computation complexity with respect to feature size (tokens).
+
+# 3 Architecture Optimizations
+
+Here we investigate the architecture redundancy of SD-v1.5 to obtain efficient neural networks. However, it is non-trivial to apply conventional pruning [42, 43, 44, 45] or architecture search [46, 47, 30] techniques, given the tremendous training cost of SD. Any permutation in architecture may lead to degraded performance that requires fine-tuning with hundreds or thousands of GPUs days. Therefore, we propose an architecture-evolving method that preserves the performance of the pre-trained UNet model while gradually improving its efficacy. As for the deterministic image decoder, we apply tailored compression strategies and a simple yet effective prompt-driven distillation approach.
+
+# 3.1 Efficient UNet
+
+From our empirical observation, the operator changes resulting from network pruning or searching lead to degraded synthesized images, asking for significant training costs to recover the performance. Thus, we propose a robust training, and evaluation and evolving pipeline to alleviate the issue.
+
+Robust Training. Inspired by the idea of elastic depth [48, 49], we apply stochastic forward propagation to execute each cross-attention and ResNet block by probability $p ( \cdot , I )$ , where $I$ refers to identity mapping that skips the corresponding block. Thus, we have Eq. (4) becomes as follows:
+
+$$
+\hat { \epsilon } _ { \theta } ( t , { \bf z } _ { t } ) = \prod \{ p ( C r o s s - A t t e n t i o n ( { \bf z } _ { t } , { \bf c } ) , I ) , p ( R e s N e t ( { \bf z } _ { t } , t ) , I ) \} .
+$$
+
+With this training augmentation, the network is robust to architecture permutations, which enables an accurate assessment of each block and a stable architectural evolution (more examples in Fig. 5).
+
+Evaluation and Architecture Evolving. We perform online network changes of UNet using the model from robust training with the constructed evolution action set: $A \in \{ A _ { C r o s s - A t t e n t i o n [ i , j ] } ^ { + , - } , A _ { R e s N e t [ i , j ] } ^ { + , - } \}$ where $A ^ { + , - }$ denotes the action to remove $( - )$ or add $( + )$ a cross-attention or ResNet block at the corresponding position (stage $i$ , block $j$ ). Each action is evaluated by its impact on execution latency and generative performance. For latency, we use the lookup table built in Sec. 2.2 for each possible configuration of cross-attention and ResNet blocks. Note we improve the UNet for on-device speed; the optimization of model size can be performed similarly and is left as future work. For generative performance, we choose CLIP score [41] to measure the correlation between generated images and the text condition. We use a small subset (2K images) of MS-COCO validation set [50], fixed steps (50), and CFG scale as 7.5 to benchmark the score, and it takes about $2 . 5 \mathrm { { A l 0 0 } }$ GPU hours to test each action. For simplicity, the value score of each action is defined as $\frac { \Delta C L I P } { \Delta L a t e n c y }$ , where a block with lower latency and higher contribution to CLIP tends to be preserved, and the opposite is removed in architecture evolving (more details in Alg. 1). To further reduce the cost for network optimization, we perform architecture evolving, i.e., removing redundant blocks or adding extra blocks at valuable positions by executing a group of actions at a time. Our training paradigm successfully preserves the performance of pre-trained UNet while tolerating large network permutations (Fig. 5). The details of our final architecture is presented in Sec. A.
+
+# 3.2 Efficient Image Decoder
+
+For the image decoder, we propose a distillation pipeline that uses synthetic data to learn the efficient image decoder obtained via channel reduction, which has $3 . 8 \times$ fewer parameters and is $3 . 2 \times$ faster than the one from SD-v1.5. The efficient image decoder is obtained by applying $5 0 \%$ uniform channel pruning to the original image decoder, resulting in a compressed efficient image decoder with approximately $1 / 4$ size and MACs of the original one. Here we only train the efficient decoder instead of following the training of VAE [4, 38, 39] that also learns the image encoder. We use text prompts to get the latent representation from the UNet of SD-v1.5 after 50 denoising steps with DDIM and forward it to our efficient image decoder and the one of SD-v1.5 to generate two images. We then optimize the decoder by minimizing the mean squared error between the two images. Using synthetic data for distillation brings the advantage of augmenting the dataset on-the-fly where each prompt be used to obtain unlimited images by sampling various noises. Quantitative analysis of the compressed decoder can be found in Sec. B.2.
+
+# Algorithm 1 Optimizing UNet Architecture
+
+Require: UNet: $\scriptstyle { \hat { \epsilon } } _ { \theta }$ ; validation set: $\mathbb { D } _ { v a l }$ ; latency lookup table $\mathbb { T } : \{ C r o s s \small A t t e n t i o n [ i , j ] , R e s N e t [ i , j ] \}$ .
+
+Ensure: $\hat { \epsilon } _ { \pmb { \theta } }$ converges and satisfies latency objective $S$ . while $\hat { \epsilon } _ { \pmb { \theta } }$ not converged do Perform robust training. Architecture optimization: if perform architecture evolving at this iteration then Evaluate blocks: for each block[i, j] do $\begin{array} { r l } & { \Delta C L I P \mathrm { e v a l } ( \hat { \epsilon } _ { \theta } , A _ { b l o c k [ i , j ] } ^ { - } , \mathbb { D } _ { v a l } ) , } \\ & { \Delta L a t e n c y \mathrm { e v a l } ( \hat { \epsilon } _ { \theta } , A _ { b l o c k [ i , j ] } ^ { - } , \mathbb { T } ) } \end{array}$ end for $\mathbf { \nabla } \to \mathbf { S o r t }$ actions based on $\frac { \Delta C L I P } { \Delta L a t e n c y }$ , execute action, and evolve architecture to get latency $T$ : if latency objective $S$ is not satisfied then $\begin{array} { r } { \{ \hat { A } ^ { - } \} \arg \operatorname* { m i n } _ { A ^ { - } } \frac { \Delta C L I P } { \Delta L a t e n c y } , } \end{array}$ else $\begin{array} { r l } & { \mathrm { ~ \hat { \varepsilon } ~ } _ { \left\{ \hat { A } ^ { + } \right\} } \gets \mathrm { c o p y } ( \arg \operatorname* { m a x } _ { A ^ { - } } \frac { \Delta C L I I P } { \Delta L a t e n c y } ) , } \\ & { \mathrm { ~ \hat { \epsilon } ~ } _ { \theta } \gets \mathrm { e v o l v e } ( \hat { \epsilon } _ { \theta } , \{ \hat { A } \} ) } \end{array}$ end if end if end while
+
+# 4 Step Distillation
+
+Besides proposing the efficient architecture of the diffusion model, we further consider reducing the number of iterative denoising steps for UNet to achieve more speedup. We follow the research direction of step distillation [33], where the inference steps are reduced by distilling the teacher, e.g., at 32 steps, to a student that runs at fewer steps, e.g., 16 steps. This way, the student enjoys $2 \times$ speedup against the teacher. Here we employ different distillation pipelines and learning objectives from existing works [33, 32] to improve the image quality, which we elaborate on as follows.
+
+# 4.1 Overview of Distillation Pipeline
+
+Citing the wisdom from previous studies [33, 32], step distillation works best with the $\mathbf { v }$ -prediction type, i.e., UNet outputs velocity v [33] instead of the noise $\epsilon$ . Thus, we fine-tune SD-v1.5 to vprediction (for notation clarity, we use $\hat { \mathbf { v } } _ { \pmb { \theta } }$ to mean the SD model in $\mathbf { v }$ -prediction vs. its $\epsilon$ -prediction counterpart $\hat { \epsilon } _ { \pmb { \theta } }$ ) before step distillation, with the following original loss $\mathcal { L } _ { \mathrm { o r i } }$ :
+
+$$
+\begin{array} { r } { \mathcal { L } _ { \mathrm { o r i } } = \mathbb { E } _ { t \sim U [ 0 , 1 ] , \mathbf { x } \sim p _ { \mathrm { d a t a } } ( \mathbf { x } ) , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } ) } \ | | \hat { \mathbf { v } } _ { \boldsymbol { \theta } } ( t , \mathbf { z } _ { t } , \mathbf { c } ) - \mathbf { v } | | _ { 2 } ^ { 2 } , } \end{array}
+$$
+
+where $\mathbf { v }$ is the ground-truth target velocity, which can be derived analytically from the clean latent $\mathbf { x }$ and noise $\epsilon$ given time step $t$ : $\mathbf { v } \equiv \alpha _ { t } \epsilon - \sigma _ { t } \mathbf { x }$ .
+
+Our distillation pipeline includes three steps. First, we do step distillation on SD-v1.5 to obtain the UNet with 16 steps that reaches the performance of the 50-step model. Note here we use a 32-step SD-v1.5 to perform distillation directly, instead of doing it progressively, e.g., using a 128-step model as a teacher to obtain the 64-step model and redo the distillation progressively. The reason is that we empirically observe that progressive distillation is slightly worse than direct distillation (see Fig. 6(a)
+
+for details). Second, we use the same strategy to get our 16-step efficient UNet. Finally, we use the 16-step SD-v1.5 as the teacher to conduct step distillation on the efficient UNet that is initialized from its 16-step counterpart. This will give us the 8-step efficient UNet, which is our final UNet model.
+
+# 4.2 CFG-Aware Step Distillation
+
+We introduce the vanilla step distillation loss first, then elaborate more details on our proposed CFG-aware step distillation (Fig. 3).
+
+Vanilla Step Distillation. Given the UNet inputs, time step $t$ , noisy latent $\mathbf { z } _ { t }$ , and text embedding c, the teacher UNet performs two DDIM denoising steps, from time $t$ to $t ^ { \prime }$ and then to $t ^ { \prime \prime }$ ( $0 \leq t ^ { \prime \prime } <$ $t ^ { \prime } < t \leq 1$ ). This process can be formulated as (see the Sec. C for detailed derivations),
+
+$$
+\begin{array} { r l } & { \quad \hat { \mathbf { v } } _ { t } = \hat { \mathbf { v } } _ { \theta } \big ( t , \mathbf { z } _ { t } , \mathbf { c } \big ) \Rightarrow \mathbf { z } _ { t ^ { \prime } } = \alpha _ { t ^ { \prime } } \big ( \alpha _ { t } \mathbf { z } _ { t } - \sigma _ { t } \hat { \mathbf { v } } _ { t } \big ) + \sigma _ { t ^ { \prime } } \big ( \sigma _ { t } \mathbf { z } _ { t } + \alpha _ { t } \hat { \mathbf { v } } _ { t } \big ) , } \\ & { \quad \hat { \mathbf { v } } _ { t ^ { \prime } } = \hat { \mathbf { v } } _ { \theta } \big ( t ^ { \prime } , \mathbf { z } _ { t ^ { \prime } } , \mathbf { c } \big ) \Rightarrow \mathbf { z } _ { t ^ { \prime \prime } } = \alpha _ { t ^ { \prime \prime } } \big ( \alpha _ { t ^ { \prime } } \mathbf { z } _ { t ^ { \prime } } - \sigma _ { t ^ { \prime } } \hat { \mathbf { v } } _ { t ^ { \prime } } \big ) + \sigma _ { t ^ { \prime \prime } } \big ( \sigma _ { t ^ { \prime } } \mathbf { z } _ { t ^ { \prime } } + \alpha _ { t ^ { \prime } } \hat { \mathbf { v } } _ { t ^ { \prime } } \big ) . } \end{array}
+$$
+
+The student UNet, parameterized by $\eta$ , performs only one DDIM denoising step,
+
+$$
+\hat { \mathbf { v } } _ { t } ^ { ( s ) } = \hat { \mathbf { v } } _ { \eta } ( t , \mathbf { z } _ { t } , \mathbf { c } ) \Rightarrow \hat { \mathbf { x } } _ { t } ^ { ( s ) } = \alpha _ { t } \mathbf { z } _ { t } - \sigma _ { t } \hat { \mathbf { v } } _ { t } ^ { ( s ) } ,
+$$
+
+where the super-script $( s )$ indicates these variables are for the student UNet. The student UNet is supposed to predict the teacher’s noisy latent $\mathbf { z } _ { t ^ { \prime \prime } }$ from $\mathbf { z } _ { t }$ with just one denoising step. This goal translates to the following vanilla distillation loss objective calculated in the $\mathbf { x }$ -space [33, 32],
+
+$$
+\mathcal { L } _ { \mathrm { v a n i \_ d s t l } } = \varpi ( \lambda _ { t } ) \parallel \hat { \mathbf { x } } _ { t } ^ { ( s ) } - \frac { \mathbf { z } _ { t ^ { \prime \prime } } - \frac { \sigma _ { t ^ { \prime \prime } } } { \sigma _ { t } } \mathbf { z } _ { t } } { \alpha _ { t ^ { \prime \prime } } - \frac { \sigma _ { t ^ { \prime \prime } } } { \sigma _ { t } } \alpha _ { t } } \parallel _ { 2 } ^ { 2 } ,
+$$
+
+where $\begin{array} { r } { \varpi ( \lambda _ { t } ) = \operatorname* { m a x } ( \frac { \alpha _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } , 1 ) } \end{array}$ is the truncated SNR weighting coefficients [33].
+
+CFG-Aware Step Distillation. The above vanilla step distillation can improve the inference speed with no (or only little) FID compromised. However, we do observe the CLIP score turns obviously worse. As a remedy, this section introduces a classifier-free guidance-aware (CFG-aware) distillation loss objective function, which will be shown to improve the CLIP score significantly.
+
+We propose to perform classifier-free guidance to both the teacher and student before calculating the loss. Specifically, for Eq. (7) and (8), after obtaining the $\mathbf { v }$ -prediction output of UNet, we add the CFG step. Take Eq. (8) for an example, $\hat { \mathbf { v } } _ { t } ^ { ( s ) }$ is replaced with the following guided version,
+
+$$
+\tilde { \mathbf { v } } _ { t } ^ { ( s ) } = w \hat { \mathbf { v } } _ { \eta } ( t , \mathbf { z } _ { t } , \mathbf { c } ) - ( w - 1 ) \hat { \mathbf { v } } _ { \eta } ( t , \mathbf { z } _ { t } , \emptyset ) ,
+$$
+
+where $w$ is the CFG scale. In the experiments, $w$ is randomly sampled from a uniform distribution over a range ([2, 14] by default) – this range is called $C F G$ range, which will be shown to provide a way to tradeoff FID and CLIP score during training.
+
+After replacing the UNet output with its guided version, all the other procedures remain the same for both the teacher and the student. This gives us a counterpart version of $\mathcal { L } _ { \mathrm { v a n i \_ d s t l } }$ – which we term CFG distillation loss, denoted as Lcfg_dstl.
+
+Total Loss Function. Empirically, we find $\mathcal { L } _ { \mathrm { v a n i \_ d s t l } }$ helps to achieve low FID while $\mathcal { L } _ { \mathrm { c f g \_ d s t l } }$ helps to achieve high CLIP score (see Fig. 6(c)). To get the best of both worlds, we introduce a loss mixing scheme to use the two losses at the same time $- \mathbf { A }$ predefined $C F G$ probability $p$ is introduced, indicating the probability of using the CFG distillation loss in each training iteration (so with $1 - p$ probability, the vanilla distillation loss is used). Now, the overall loss can be summarized:
+
+$$
+\begin{array} { r l r } & { } & { \mathcal { L } = \mathcal { L } _ { \mathrm { d s t l } } + \gamma \mathcal { L } _ { \mathrm { o r i } } , } \\ & { } & { \mathcal { L } _ { \mathrm { d s t l } } = \mathcal { L } _ { \mathrm { c f g \_ d s t l } } \mathrm { i f } P \sim U [ 0 , 1 ] < p \mathrm { e l s e } \mathcal { L } _ { \mathrm { v a n i \_ d s t l } } , } \end{array}
+$$
+
+where $\mathcal { L } _ { \mathrm { o r i } }$ represents the original denoising loss in Eq. (6) and $\gamma$ is its weighting factor; and $U [ 0 , 1 ]$ represents the uniform distribution over range $( 0 , 1 )$ .
+
+Discussion. As far as we know, only one very recent work [32] studies how to distill the guided diffusion models. They propose to distill CFG into a student model with extra parameters (called $w$ -condition) to mimic the behavior of CFG. Thus, the network evaluation cost is reduced by $2 \times$ when generating an image. Our proposed solution here is distinct from theirs [32] for at least four perspectives. (1) The general motivations are different. Their $w$ -condition model intends to reduce the number of network evaluations of UNet, while ours aims to improve the image quality during distillation. (2) The specific proposed techniques are different – they integrate the CFG scale as an input to the UNet, which results in more parameters, while we do not. (3) Empirically, $w \cdot$ -condition model cannot achieve high CLIP scores when the CFG scale is large (as in Fig. 6(b)), while our method is particularly good at generating samples with high CLIP scores. (4) Notably, the trade-off of diversity-quality is previously enabled only during inference by adjusting the CFG scale, while our scheme now offers a nice property to realize such trade-off during training (see Fig. 6(d)), which $w$ -condition cannot achieve. This can be very useful for model providers to train different models in favor of quality or diversity.
+
+# 5 Experiment
+
+Implementation Details. Our code is developed based on diffusers library3. Given step distillation is mostly conducted on v-prediction models [33, 32], we fine-tune UNet in our experiments to vprediction. Similar to SD, we train our models on public datasets [51, 40] to report the quantitative results, i.e., FID and CLIP scores (ViT-g/14), on MS-COCO 2014 validation set [50] for zero-shot evaluation, following the common practice [20, 19, 6, 18]. In addition, we collect an internal dataset with high-resolution images to fine-tune our model for more pleasing visual quality. We use 16 or 32 nodes for most of the training. Each node has 8 NVIDIA A100 GPUs with 40GB or 80GB memory. We use AdamW optimizer [52], set weight decay as 0.01, and apply training batch size as 2, 048.
+
+Table 2: Zero-shot evaluation on MS-COCO 2017 5K subset. Our efficient model is compared against recent arts in the 8-step configuration. Note the compared works use the same model as SD-v1.5, which is much slower than our approach.
+
+
Method
Steps
FID
CLIP
DPM [53]
8
31.7
0.32
DPM++ [54]
8
25.6
0.32
Meng et al. [32]
8
26.9
0.30
Ours
8
24.2
0.30
+
+
+Figure 4: FID vs. CLIP on MS-COCO 2014 validation set with CFG scale from 1.0 to 10.0. Left: Comparison with SD-v1.5 on full set (30K). Right: Different settings for step and teacher models tested on 6K samples.
+
+# 5.1 Text-to-Image Generation
+
+We first show the comparison with SD-v1.5 on the full MS-COCO 2014 validation set [50] with 30K image-caption pairs. As in Fig. 4 (left), thanks to the architecture improvements and the dedicated loss design for step distillation, our final 8-step, 230ms per step UNet outperforms the original SD-v1.5 in terms of the trade-off between FID vs. CLIP. For the most user-preferable guidance scales (ascending part of the curve), our UNet gives about $0 . 0 0 4 - 0 . 0 1 0$ higher CLIP score under the same FID level. In addition, with an aligned sampling schedule (8 DDIM denoising steps), our method also outperforms the very recent distillation work [32] by 2.7 FID with on-par CLIP score, as in Tab. 2. Example synthesized images from our approach are presented in Fig. 1. Our model can generate images from text prompts with high fidelity. More examples are shown in Fig. 9.
+
+We then provide more results for performing step distillation on our efficient UNet. As in Fig. 4 (right), we demonstrate that our 16-step undistilled model provides competitive performance against SD-v1.5. However, we can see a considerable performance drop when the denoising step is reduced to 8. We apply progressive (vanilla) distillation [33, 32] and observe improvements in scores. Though mostly comparable to the SD-v1.5 baseline, the performance of the 8-step model gets saturated for the CLIP score as the guidance scale increases, and is capped at 0.30. Finally, we use the proposed CFG-aware step distillation and find it consistently boosts the CLIP score of the 8-step model with varied configurations. Under the best-observed configuration (CFG distilled 16-step teacher), our 8-step model is able to surpass SD-v1.5 by $0 . 0 0 2 \mathrm { - } 0 . 0 0 7$ higher CLIP under similar FID. Discussions on the hyperparameters can be found in ablation studies.
+
+
+Figure 5: Advantages of robust training. Prompts of top row: a photo of an astronaut riding a horse on mars and bottom row: A pikachu fine dining with a view to the Eiffel Tower. (a) Images from SD-v1.5. (b) Removing cross-attention (CA) blocks in downsample stage of SD-v1.5. (c) - (e) Removing cross-attention (CA) blocks in {downsample (DS), middle (mid.), upsample (US)} using our model after robust training. (f) - (h) Removing ResNet blocks (RB) in different stages using our model. The model with robust training maintains reasonable performance after dropping blocks.
+
+# 5.2 Ablation Analysis
+
+Here we present the key ablation studies for the proposed approach. For faster evaluation, we test the settings on 6K image-caption pairs randomly sampled from the MS-COCO 2014 validation set [50].
+
+Robust Training. As in Fig. 5, we verify the effectiveness of the proposed robust training paradigm. The original model is sensitive to architecture permutations, which makes it difficult to assess the value score of the building blocks (Fig. 5(b)). In contrast, our robust trained model can be evaluated under the actions of architecture evolution, even if multiple blocks are ablated at a time. With the proposed strategy, we preserve the performance of pre-trained SD and save the fine-tuning cost to recover the performance of candidate offspring networks. In addition, we gather some insights into the effect of different building blocks and ensure the architecture permutation is interpretable. Namely, cross-attention is responsible for semantic coherency (Fig. 5(c)-(e)), while ResNet blocks capture local information and are critical to the reconstruction of details (Fig. 5(f)-(h)), especially in the output upsampling stage.
+
+Step Distillation. We perform comprehensive comparisons for step distillation discussed in Sec. 4.
+For the following comparisons, we use the same model as SD-v1.5 to study step distillation.
+• Fig. 6(a) presents the comparison of progressive distillation to 8 steps vs. direct distillation to 8 steps. As seen, direct distillation wins in terms of both FID and CLIP score. Besides, it is procedurally simpler. Thus, we adopt direct distillation in our proposed algorithm.
+• Fig. 6(b) depicts the results of $w$ -conditioned models [32] at different inference steps. They are obtained through progressive distillation, i.e., $6 4 3 2 1 6 8$ . As seen, there is a clear gap between $w$ -conditioned models and the other two, especially in terms of CLIP score. In contrast, our 8-step model can significantly outperform the 50-step SD-v1.5 in terms of CLIP score and maintain a similar FID. Comparing ours (8-step model) to the $w$ -conditioned 16-step model, one point of particular note is that, these two schemes have the same inference cost, while ours obviously wins in terms of both FID and CLIP score, suggesting that our method offers a better solution to distilling CFG guided diffusion models.
+• Fig. 6(c) shows the effect of our proposed CFG distillation loss vs. the vanilla distillation loss. As seen, the vanilla loss achieves the lowest FID, while the CFG loss achieves the highest CLIP score. To get the best of both worlds, the proposed loss mixing scheme (see “vanilla $+ \mathrm { C F G }$ distill”) successfully delivers a better tradeoff: it achieves the similar highest CLIP score as the CFG loss alone and the similar lowest FID as the vanilla loss alone.
+• There are two hyper-parameters in the proposed CFG distillation loss: CFG range and CFG probability. Fig. 6(d) shows the effect of adjusting them. Only using the vanilla loss (the blue line) and only using the CFG loss (the purple line) lay down two extremes. By adjusting the CFG range and probability, we can effectively find solutions in the middle of the two extremes. As a rule of thumb, higher CFG probability and larger CFG range will increase the impact of CFG loss, leading to better CLIP score but worse FID. Actually, for the 7 lines listed top to down in the legend, the
+
+
+Figure 6: Ablation studies in step distillation (best viewed in color). For each line, from left to right, the CFG scales starts from 1.0 to 10.5 with interval 0.5. (a) To obtain the same 8-step student model, in direct distillation, the teacher only distills once $( 1 6 8 )$ ), while progressive distillation [33, 32] starts from the 64-step teacher, distills 3 times to 8 steps $\ 6 4 3 2 1 6 8 )$ ). (b) $w$ -conditioned model [32] struggles at achieving high CLIP scores (such as over 0.30) while the original SD-v1.5 and our distilled 8-step SD-v1.5 can easily achieve so. (c) Comparison between vanilla distillation loss $\mathcal { L } _ { \mathrm { v a n i \_ d s t l } }$ , the proposed CFG distillation loss $\mathcal { L } _ { \mathrm { c f g \_ d s t l } }$ , and their mixed version ${ \mathcal { L } } _ { \mathrm { d s t l } }$ . (d) Effect of adjusting the two hyper-parameters, CFG range and CFG probability, in CFG distillation. As seen, these hyper-parameters can effectively tradeoff FID and CLIP score.
+
+impact of CFG loss is gradually raised, and we observe the corresponding lines move steadily to the upper right, fully in line with our expectation, suggesting these two hyper-parameters provide a very reliable way to tradeoff FID and CLIP score during training – this feature, as far as we know, has not been reported by any previous works.
+
+Analysis of Original Loss for Distillation. In Eq. (11), we apply the original denoising loss $\mathcal { L } _ { \mathrm { o r i } }$ in Eq. (6)) during the step distillation. Here we show more analysis for the using $\mathcal { L } _ { \mathrm { o r i } }$ in step distillation.
+
+• Fig. 7(a) shows the comparison between using and not using the original loss in our proposed CFG distillation method. To our best knowledge, existing step distillation approaches [33, 32] do not include the original loss in their total loss objectives, which is actually sub-optimal. Our results in Fig. 7(a) suggest that using the original loss can help lower the FID at no loss of CLIP score. • Fig. 7(b) provides a detailed analysis using different $\gamma$ to balance the original denoising loss and the CFG distillation loss in Eq. (11). We empirically set a dynamic gamma to adjust the original loss into a similar scale to step distillation loss.
+
+Analysis for the Number of Inference Steps of the Teacher Model. For the default training setting of the step distillation, the student runs one DDIM step while the teacher runs two steps, e.g., distilling a 16-step teacher to an 8-step student. At the first glance, if the teacher runs more steps, it possibly provides better supervision to the student, e.g., distilling a 32-step teacher to the 8-step student. Here we provide empirical results to show that the approach actually does not perform well.
+
+Fig. 7(c) presents the FID and CLIP score plots of different numbers of steps of the teacher model in vanilla step distillation. As seen, these teachers achieve similar lowest FID, while the 16-step teacher (blue line) achieves the best CLIP score. A clear pattern is that the more steps of the teacher model, the worse CLIP score of the student. Based on this empirical evidence, we adopt the 16-step teacher setting in our pipeline to get 8-step models.
+
+Applying Step Distillation to Other Model. Lastly, we conduct the experiments by applying our proposed CFG-aware distillation on SD-v2, where the student model has the same architecture as SD-v2. The results are provided in Fig. 7(d). As can be seen, our 8-step distilled model achieves comparable performance to the 50-step SD-v2 model. We use the same hyper-parameters from the training of SD-v1.5 for the step distillation of SD-v2, and further tuning might lead to better results.
+
+# 6 Related Work
+
+Recent efforts on text-to-image generation utilize denoising diffusion probabilistic models [55, 35, 56, 1, 2, 4] to improve the synthesis quality by conducting training on the large-scale dataset [40]. However, the deployment of these models requests high-end GPUs for reasonable inference speed due to the tens or hundreds of iterative denoising steps and the huge computation cost of the diffusion model. This limitation has spurred interest from both the academic community and industry to optimize the efficiency of diffusion models, with two primary approaches being explored: improving the sampling process [57, 58, 59, 60, 53, 61] and investigating on-device solutions [62].
+
+
+Figure 7: FID and CLIP results on the 6K samples from the MS-COCO 2014 validation set [50] for various models and experimental settings. (a) Comparison between using (red line) and not using (orange line) the original loss in our proposed CFG distillation method. The hyper-parameter setup of “ours” experiments: CFG range [2, 14] and CFG probability 0.1. (b) Analysis of loss scaling $\gamma$ in Eq. (11). Note that we employ dynamic scaling to adjust original loss $( \mathcal { L } _ { \mathrm { o r i } } )$ into a similar scale of step distillation loss $( \mathcal { L } _ { \mathrm { d s t l } } )$ . We show $\gamma$ as 0.01, 0.2, 1.0. Our choice (0.2) gives slightly better FID, despite all dynamic scalings resulting in very similar results. We further show results of constant scaling. Here 0.0 indicates no $\mathcal { L } _ { \mathrm { o r i } }$ added, while 1.0 refers to non-scaled $\mathcal { L } _ { \mathrm { o r i } }$ where $\mathcal { L } _ { \mathrm { o r i } }$ dominates the optimization and degrades the effect of step distillation. (c) Analysis for the number of steps for the teacher model in vanilla step distillation. The student is supposed to run at 8 steps, and we can actually employ different teachers that run at different numbers of steps during the step distillation. The default setting in our experiment is that teacher 16 steps, student 8 steps, i.e., the blue line, which turns out to be the best. (d) Results of our proposed CFG-aware step distillation applied on SD-v2.
+
+One promising area for reducing the denoising steps is through progressive distillation, where the sampling steps are gradually reduced by distillation that starts from a pre-trained teacher [33]. The later work further improves the inference cost of classifier-free guidance [34] by introducing the $w$ -condition [32]. Our work follows the path of step distillation while holding significant differences with existing work, which is discussed above (Sec. 4). Another direction studies the methods for optimizing the model runtime on devices [63], such as post-training quantization [22, 23] and GPUaware optimization [24]. Nonetheless, these works require specific hardware or compiler support. Our work is orthogonal to post optimizations and can be combined with them for further speed up. We target developing a generic and efficient network architecture that can run fast on mobile devices without relying on specific bit width or compiler support. We identify the redundancy in the SD and introduce one with a similar quality while being significantly faster.
+
+# 7 Discussion and Conclusion
+
+This work proposes the fastest on-device text-to-image model that runs denoising in 1.84 seconds with image quality on par with Stable Diffusion. To build such a model, we propose a series of novel techniques, including analyzing redundancies in the denoising UNet, proposing the evolving-training framework to obtain the efficient UNet model, and improving the step distillation by introducing the CFG-aware distillation loss. We perform extensive experiments and validate that our model can achieve similar or even better quality compared to Stable Diffusion while being significantly faster.
+
+Limitation. While our approach is able to run the large-scale text-to-image diffusion model on mobile devices with ultra-fast speed, the model still holds a relatively large number of parameters. Another promising direction is to reduce the model size to make it more compatible with various edge devices. Furthermore, most of our latency analysis is conducted on iPhone $1 4 ~ \mathrm { P r o }$ , which has more computation power than many other phones. How to optimize our models for other mobile devices to achieve fast inference speed is also an interesting topic to study.
+
+Broader Impacts. Similar to existing studies on content generation, our approach must be applied cautiously so that it will not be used for malicious applications. Such concerns can also be alleviated by approaches that could automatically detect image content that violates specific regulations.
+
+References
+[1] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020. 1, 2, 9
+[2] Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. arXiv preprint arXiv:2011.13456, 2020. 1, 2, 9
+[3] Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems, 34:8780–8794, 2021. 1
+[4] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10684–10695, 2022. 1, 2, 3, 5, 9, 14, 16
+[5] Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In International Conference on Machine Learning, pages 8821–8831. PMLR, 2021. 1
+[6] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022. 1, 7
+[7] Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741, 2021. 2
+[8] Chitwan Saharia, William Chan, Huiwen Chang, Chris Lee, Jonathan Ho, Tim Salimans, David Fleet, and Mohammad Norouzi. Palette: Image-to-image diffusion models. In ACM SIGGRAPH 2022 Conference Proceedings, pages 1–10, 2022. 2
+[9] Huiwen Chang, Han Zhang, Jarred Barber, AJ Maschinot, Jose Lezama, Lu Jiang, Ming-Hsuan Yang, Kevin Murphy, William T Freeman, Michael Rubinstein, et al. Muse: Text-to-image generation via masked generative transformers. arXiv preprint arXiv:2301.00704, 2023. 2
+[10] Andreas Lugmayr, Martin Danelljan, Andres Romero, Fisher Yu, Radu Timofte, and Luc Van Gool. Repaint: Inpainting using denoising diffusion probabilistic models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11461–11471, 2022. 2
+[11] Zhixing Zhang, Ligong Han, Arnab Ghosh, Dimitris N Metaxas, and Jian Ren. Sine: Single image editing with text-to-image diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6027–6037, 2023. 2
+[12] Chitwan Saharia, Jonathan Ho, William Chan, Tim Salimans, David J Fleet, and Mohammad Norouzi. Image super-resolution via iterative refinement. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2022. 2
+[13] Jonathan Ho, William Chan, Chitwan Saharia, Jay Whang, Ruiqi Gao, Alexey Gritsenko, Diederik P Kingma, Ben Poole, Mohammad Norouzi, David J Fleet, et al. Imagen video: High definition video generation with diffusion models. arXiv preprint arXiv:2210.02303, 2022. 2
+[14] Uriel Singer, Adam Polyak, Thomas Hayes, Xi Yin, Jie An, Songyang Zhang, Qiyuan Hu, Harry Yang, Oron Ashual, Oran Gafni, et al. Make-a-video: Text-to-video generation without text-video data. arXiv preprint arXiv:2209.14792, 2022. 2
+[15] Xiaohui Zeng, Arash Vahdat, Francis Williams, Zan Gojcic, Or Litany, Sanja Fidler, and Karsten Kreis. Lion: Latent point diffusion models for 3d shape generation. arXiv preprint arXiv:2210.06978, 2022. 2
+[16] Chen-Hsuan Lin, Jun Gao, Luming Tang, Towaki Takikawa, Xiaohui Zeng, Xun Huang, Karsten Kreis, Sanja Fidler, Ming-Yu Liu, and Tsung-Yi Lin. Magic3d: High-resolution text-to-3d content creation. arXiv preprint arXiv:2211.10440, 2022. 2
+[17] Ben Poole, Ajay Jain, Jonathan T Barron, and Ben Mildenhall. Dreamfusion: Text-to-3d using 2d diffusion. arXiv preprint arXiv:2209.14988, 2022. 2
+[18] Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, et al. Scaling autoregressive models for content-rich text-to-image generation. arXiv preprint arXiv:2206.10789, 2022. 2, 7
+[19] Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-toimage diffusion models with deep language understanding. Advances in Neural Information Processing Systems, 35:36479–36494, 2022. 2, 7, 15
+[20] Yogesh Balaji, Seungjun Nah, Xun Huang, Arash Vahdat, Jiaming Song, Karsten Kreis, Miika Aittala, Timo Aila, Samuli Laine, Bryan Catanzaro, et al. ediffi: Text-to-image diffusion models with an ensemble of expert denoisers. arXiv preprint arXiv:2211.01324, 2022. 2, 7, 15
+[21] William Peebles and Saining Xie. Scalable diffusion models with transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 4195–4205, 2023. 2
+[22] Xiuyu Li, Long Lian, Yijiang Liu, Huanrui Yang, Zhen Dong, Daniel Kang, Shanghang Zhang, and Kurt Keutzer. Q-diffusion: Quantizing diffusion models. arXiv preprint arXiv:2302.04304, 2023. 2, 10
+[23] Jilei Hou and Ziad Asghar. World’s first on-device demonstration of stable diffusion on an android phone, 2023. 2, 10
+[24] Yu-Hui Chen, Raman Sarokin, Juhyun Lee, Jiuqiang Tang, Chuo-Ling Chang, Andrei Kulik, and Matthias Grundmann. Speed is all you need: On-device acceleration of large diffusion models via gpu-aware optimizations. arXiv preprint arXiv:2304.11267, 2023. 2, 10
+[25] Yuzhang Shang, Zhihang Yuan, Bin Xie, Bingzhe Wu, and Yan Yan. Post-training quantization on diffusion models. arXiv preprint arXiv:2211.15736, 2022. 2
+[26] Tri Dao, Dan Fu, Stefano Ermon, Atri Rudra, and Christopher Ré. Flashattention: Fast and memory-efficient exact attention with io-awareness. Advances in Neural Information Processing Systems, 35:16344–16359, 2022. 2
+[27] Qing Jin, Jian Ren, Oliver J Woodford, Jiazhuo Wang, Geng Yuan, Yanzhi Wang, and Sergey Tulyakov. Teachers do more than teach: Compressing image-to-image models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13600–13611, 2021. 2
+[28] Geng Yuan, Yanyu Li, Sheng Li, Zhenglun Kong, Sergey Tulyakov, Xulong Tang, Yanzhi Wang, and Jian Ren. Layer freezing & data sieving: Missing pieces of a generic framework for sparse training. arXiv preprint arXiv:2209.11204, 2022. 2
+[29] Yanyu Li, Geng Yuan, Yang Wen, Ju Hu, Georgios Evangelidis, Sergey Tulyakov, Yanzhi Wang, and Jian Ren. Efficientformer: Vision transformers at mobilenet speed. arXiv preprint arXiv:2206.01191, 2022. 2
+[30] Yanyu Li, Ju Hu, Yang Wen, Georgios Evangelidis, Kamyar Salahi, Yanzhi Wang, Sergey Tulyakov, and Jian Ren. Rethinking vision transformers for mobilenet size and speed. arXiv preprint arXiv:2212.08059, 2022. 2, 4
+[31] Bo-Kyeong Kim, Hyoung-Kyu Song, Thibault Castells, and Shinkook Choi. On architectural compression of text-to-image diffusion models. arXiv preprint arXiv:2305.15798, 2023. 2
+[32] Chenlin Meng, Ruiqi Gao, Diederik P Kingma, Stefano Ermon, Jonathan Ho, and Tim Salimans. On distillation of guided diffusion models. arXiv preprint arXiv:2210.03142, 2022. 2, 5, 6, 7, 8, 9, 10
+[33] Tim Salimans and Jonathan Ho. Progressive distillation for fast sampling of diffusion models. arXiv preprint arXiv:2202.00512, 2022. 2, 5, 6, 7, 9, 10, 16
+[34] Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598, 2022. 2, 3, 10
+[35] Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pages 2256–2265. PMLR, 2015. 2, 9
+[36] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In MICAI, 2015. 2
+[37] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020. 3
+[38] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. 3, 5
+[39] Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In International conference on machine learning, pages 1278–1286. PMLR, 2014. 3, 5
+[40] Christoph Schuhmann, Romain Beaumont, Richard Vencu, Cade Gordon, Ross Wightman, Mehdi Cherti, Theo Coombes, Aarush Katta, Clayton Mullis, Mitchell Wortsman, et al. Laion-5b: An open large-scale dataset for training next generation image-text models. arXiv preprint arXiv:2210.08402, 2022. 3, 7, 9
+[41] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pages 8748–8763. PMLR, 2021. 3, 4
+[42] Zhuang Liu, Jianguo Li, Zhiqiang Shen, Gao Huang, Shoumeng Yan, and Changshui Zhang. Learning efficient convolutional networks through network slimming. In ICCV, 2017. 4
+[43] Yihui He, Xiangyu Zhang, and Jian Sun. Channel pruning for accelerating very deep neural networks. In ICCV, 2017. 4
+[44] Huan Wang, Can Qin, Yulun Zhang, and Yun Fu. Neural pruning via growing regularization. In ICLR, 2021. 4
+[45] Huan Wang and Yun Fu. Trainability preserving neural pruning. In ICLR, 2023. 4
+[46] Barret Zoph and Quoc Le. Neural architecture search with reinforcement learning. In ICLR, 2017. 4
+[47] Thomas Elsken, Jan Hendrik Metzen, and Frank Hutter. Neural architecture search: A survey. JMLR, 20(55):1–21, 2019. 4
+[48] Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In Computer Vision–ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11–14, 2016, Proceedings, Part IV 14, pages 646–661. Springer, 2016. 4
+[49] Jiahui Yu, Linjie Yang, Ning Xu, Jianchao Yang, and Thomas Huang. Slimmable neural networks. arXiv preprint arXiv:1812.08928, 2018. 4
+[50] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In Computer Vision–ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part V 13, pages 740–755. Springer, 2014. 4, 7, 8, 10, 15
+[51] Minwoo Byeon, Beomhee Park, Haecheon Kim, Sungjun Lee, Woonhyuk Baek, and Saehoon Kim. Coyo-700m: Image-text pair dataset. https://github.com/kakaobrain/coyo-dataset, 2022. 7
+[52] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015. 7
+[53] Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. Dpm-solver: A fast ode solver for diffusion probabilistic model sampling in around 10 steps. arXiv preprint arXiv:2206.00927, 2022. 7, 10
+[54] Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. Dpm-solve $^ { + + }$ : Fast solver for guided sampling of diffusion probabilistic models. arXiv preprint arXiv:2211.01095, 2022. 7
+[55] Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of diffusion-based generative models. arXiv preprint arXiv:2206.00364, 2022. 9
+[56] Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in neural information processing systems, 32, 2019. 9
+[57] Alexia Jolicoeur-Martineau, Ke Li, Rémi Piché-Taillefer, Tal Kachman, and Ioannis Mitliagkas. Gotta go fast when generating data with score-based models. arXiv preprint arXiv:2105.14080, 2021. 10
+[58] Eric Luhman and Troy Luhman. Knowledge distillation in iterative generative models for improved sampling speed. arXiv preprint arXiv:2101.02388, 2021. 10
+[59] Tim Dockhorn, Arash Vahdat, and Karsten Kreis. Genie: Higher-order denoising diffusion solvers. arXiv preprint arXiv:2210.05475, 2022. 10
+[60] Luping Liu, Yi Ren, Zhijie Lin, and Zhou Zhao. Pseudo numerical methods for diffusion models on manifolds. arXiv preprint arXiv:2202.09778, 2022. 10
+[61] Daniel Watson, William Chan, Jonathan Ho, and Mohammad Norouzi. Learning fast samplers for diffusion models by differentiating through sample quality. In International Conference on Learning Representations, 2022. 10
+[62] Atila Orhon, Michael Siracusa, and Aseem Wadhwa. Stable diffusion with core ml on apple silicon, 2022. 10
+[63] Muyang Li, Ji Lin, Chenlin Meng, Stefano Ermon, Song Han, and Jun-Yan Zhu. Efficient spatially sparse inference for conditional gans and diffusion models. arXiv preprint arXiv:2211.02048, 2022. 10
+[64] Tensorrt. https://developer.nvidia.com/tensorrt. 14
+
+# A Efficient UNet
+
+We provide the detailed architecture of our efficient UNet in Tab. 3. We perform denoising diffusion in latent space [4]. Consequently, the input and output resolution for UNet is $\frac { H } { 8 } \times \frac { W } { 8 }$ W8 , which is $6 4 \times 6 4$ for generating an image of $5 1 2 \times 5 1 2$ .
+
+In the main paper, we mainly benchmark the latency on iPhone 14 pro. Here we provide the runtine of the model on more mobile devices in Tab. 4.
+
+In addition to mobile phones, we show the latency and memory benchmarks on Nvidia A100 40G GPU, as in Tab. 5. We demonstrate that our efficient UNet achieves over $1 2 \times$ speedup compared to the original SD-v1.5 on a server-level GPU and shrinks $4 6 \%$ running memory. The analysis is performed via the public TensorRT [64] library in single precision.
+
+Table 3: Detailed architecture of our efficient UNet model.
+
+
Stage
Resolution
Type
Config
UNet Model
Origin Ours
Down-1
H×W
CrossAttention
Dimension
320
#Blocks
2
0
ResNet
Dimension
320
#Blocks
2
2
Down-2
1×W
CrossAttention
Dimension
64
0
#Blocks
2
2
ResNet
Dimension
640
#Blocks
2
2
Down-3
品×W
CrossAttention
Dimension
1280
30
#Blocks
2
2
ResNet
Dimension
12
30
#Blocks
2
1
Mid
H×W6464
CrossAttention
Dimension
1280
30
#Blocks
1
1
ResNet
Dimension
12
30
#Blocks
7
4
Up-1
品×W
CrossAttention
Dimension
12
30
#Blocks
3
6
ResNet
Dimension
12
30
#Blocks
3
2
Up-2
1×W
CrossAttention
Dimension
64
0
#Blocks
3
3
ResNet
Dimension
64
0
#Blocks
3
3
Up-3
H×W8
CrossAttention
Dimension
32
#Blocks
3
0
ResNet
Dimension
32
#Blocks
3
3
+
+Table 4: Latency benchmark on iPhone12 Pro Max, iPhone13 Pro Max, and iPhone 14 Pro.
+
+
Device
Text Encoder (ms)
UNet (ms)
VAE Decoder (ms)
Overall (s)
iPhone14 Pro
4.0
230
116
1.96
iPhone13 Pro Max
5.7
315
148
2.67
iPhone12 Pro Max
6.3
526
187
4.40
+
+Table 5: Latency analysis on Nvidia A100 40G GPU with the TensorRT [64] library, tested with single precision (FP32).
+
+
UNet
Batch Size
Latency (ms)
Memory (MB)
Iters
Total Latency (ms)
Speedup
SD-v1.5
2
51.2
6634
50
2,560
-
Ours
2
26.2
3549
8
209.6
12.2×
+
+# B Discussions of Text Encoder and VAE Decoder
+
+# B.1 Text Encoder
+
+Exiting works have explored the importance of the pre-trained text encoder for generating images [19, 20]. In our work, considering the negligible inference latency (4ms) of the text encoder compared to the UNet and VAE Decoder, we do not compress the text encoder in the released pipeline.
+
+# B.2 VAE Decoder
+
+We provide qualitative visualizations and quantitive results of our compressed VAE decoder in Fig. 8. The main paper shows that the image decoder constitutes a small portion of inference latency (369ms) compared to the original UNet from SD-v1.5. However, regarding our optimized pipeline $2 3 0 \mathrm { { m s } \times }$ 8 steps), the decoder consumes a considerable portion of overall latency. We propose an effective distillation paradigm to compress the VAE decoder. Specifically, we obtain the latent-image pairs by forwarding the text prompts into the original SD-v1.5 model. The student, which is the compressed decoder, takes the latent from the teacher model as input and generates an output image that is optimized with the ones from the teacher model by the mean squared error. Our proposed method wields the following advantages. First, our approach does not demand paired text-image samples, and it can generate unlimited data on-they-fly, benefiting the generalization of the compressed decoder. Second, the distillation paradigm is simple and straightforward, requiring minimal implementation efforts compared to conventional VAE training. As in Fig. 8, our compressed decoder (116ms) provides comparable generative quality, and the performance degradation compared to the original VAE decoder is negligible.
+
+
+Figure 8: Evaluation using MS-COCO 2014 validation set [50]. (a) Generated images by using the decoder from SD-v1.5 and our compressed image decoder. The UNet is our efficient UNet, and the guidance scale for CFG is 9.0. (b) Quantitative comparison on the 6K samples. Our compressed decoder performs similarly to the original one considering the widely used CFG scale, i.e., from 7 to 9, and still performs better than the SD-v1.5.
+
+# C Detailed Derivations of Step Distillation
+
+The following are the detailed derivations of Eq. (7) $\sim$ Eq. (9) in the main paper.
+
+Given the UNet inputs, time step $t$ , noisy latent $\mathbf { z } _ { t }$ , and text embedding c, the teacher UNet performs two DDIM denoising steps, from time $t$ to $t ^ { \prime }$ and then to $t ^ { \prime \prime }$ $( 0 \leq t ^ { \prime \prime } < t ^ { \prime } < t \leq 1 )$ ).
+
+We first examine the process from $t$ to $t ^ { \prime }$ , which can be formulated as,
+
+$$
+\begin{array} { r l } { \hat { \mathbf { v } } _ { t } = \hat { \mathbf { v } } _ { \theta } \big ( t , \mathbf { z } _ { t } , \mathbf { c } \big ) } & { \triangleright \mathtt { T e a c h e r ~ U N e t ~ f i r s t ~ f o r w a r d } } \\ { \Rightarrow \hat { \mathbf { x } } _ { t } = \alpha _ { t } \mathbf { z } _ { t } - \sigma _ { t } \hat { \mathbf { v } } _ { t } , } & { \triangleright \mathtt { T e a c h e r ~ p r e d i c t e d ~ c l e a n ~ l a t e n t ~ a t ~ t i m e ~ } t } \\ { \hat { \epsilon } _ { t } = \sigma _ { t } \mathbf { z } _ { t } + \alpha _ { t } \hat { \mathbf { v } } _ { t } , } & { \triangleright \mathtt { T e a c h e r ~ p r e d i c t e d ~ n o i s e ~ a t ~ t i m e ~ } t } \\ { \Rightarrow \mathbf { z } _ { t ^ { \prime } } = \alpha _ { t ^ { \prime } } \hat { \mathbf { x } } _ { t } + \sigma _ { t ^ { \prime } } \hat { \epsilon } _ { t } } & { \triangleright \mathtt { T e a c h e r ~ p r e d i c t e d ~ n o i s y ~ l a t e n t ~ a t ~ t i m e ~ } t ^ { \prime } } \\ { = \alpha _ { t ^ { \prime } } \big ( \alpha _ { t } \mathbf { z } _ { t } - \sigma _ { t } \hat { \mathbf { v } } _ { t } \big ) + \sigma _ { t ^ { \prime } } \big ( \sigma _ { t } \mathbf { z } _ { t } + \alpha _ { t } \hat { \mathbf { v } } _ { t } \big ) . } \end{array}
+$$
+
+The process from $t ^ { \prime }$ to $t ^ { \prime \prime }$ can be derived just like the above, by replacing $t$ and $t ^ { \prime }$ with $t ^ { \prime }$ and $t ^ { \prime \prime }$ , respectively:
+
+$$
+\begin{array} { r l } { \hat { \mathbf { v } } _ { t ^ { \prime } } = \hat { \mathbf { v } } _ { \theta } ( t ^ { \prime } , \mathbf { z } _ { t ^ { \prime } } , \mathbf { c } ) } & { \triangleright \operatorname { T e a c h e r ~ U N e t ~ s e c o n d ~ f o r w a r d } } \\ { \Rightarrow \hat { \mathbf { x } } _ { t ^ { \prime } } = \alpha _ { t ^ { \prime } } \mathbf { z } _ { t ^ { \prime } } - \sigma _ { t ^ { \prime } } \hat { \mathbf { v } } _ { t ^ { \prime } } , } & { \triangleright \operatorname { T e a c h e r ~ p r e d i c t e d ~ c l e a n ~ l a t e n t ~ a t ~ t i m e ~ } t ^ { \prime } } \\ { \hat { \mathbf { \epsilon } } _ { t ^ { \prime } } = \sigma _ { t ^ { \prime } } \mathbf { z } _ { t ^ { \prime } } + \alpha _ { t ^ { \prime } } \hat { \mathbf { v } } _ { t ^ { \prime } } , } & { \triangleright \operatorname { T e a c h e r ~ p r e d i c t e d ~ n o i s e ~ a t ~ t i m e ~ } t ^ { \prime } } \\ { \Rightarrow \mathbf { z } _ { t ^ { \prime \prime } } = \alpha _ { t ^ { \prime \prime } } \hat { \mathbf { x } } _ { t ^ { \prime } } + \sigma _ { t ^ { \prime \prime } } \hat { \mathbf { \epsilon } } _ { t ^ { \prime } } } & { \triangleright \operatorname { T e a c h e r ~ p r e d i c t e d ~ n o i s y ~ \mathrm { ~ 1 a t e n t ~ a t ~ t i m e ~ } t ^ { \prime \prime } } } \\ { = \alpha _ { t ^ { \prime \prime } } \left( \alpha _ { t ^ { \prime } } \mathbf { z } _ { t ^ { \prime } } - \sigma _ { t ^ { \prime } } \hat { \mathbf { v } } _ { t ^ { \prime } } \right) + \sigma _ { t ^ { \prime \prime } } \big ( \sigma _ { t } \mathbf { z } _ { t ^ { \prime } } + \alpha _ { t } \hat { \mathbf { v } } _ { t ^ { \prime } } \big ) . } \end{array}
+$$
+
+The student UNet, parameterized by $\eta$ , performs only one DDIM denoising step,
+
+$$
+\begin{array} { r l } & { \quad \hat { \mathbf { v } } _ { t } ^ { ( s ) } = \hat { \mathbf { v } } _ { \eta } ( t , \mathbf { z } _ { t } , \mathbf { c } ) \quad \mathrm { ~ > ~ S t u d e n t ~ U i v e t ~ f o r a r a r d ~ } } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \times \operatorname { \operatorname { \operatorname { \operatorname* { \operatorname* { m a x } } } } \quad \quad \quad \quad \quad \quad \quad \quad \quad } } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \times \operatorname { \operatorname { \operatorname { \operatorname* { m a x } } } \quad \quad \quad \quad \quad \quad \quad \quad } } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \ \end{array}
+$$
+
+where the super-script $( s )$ indicates these variables are for the student UNet. The student UNet is supposed to predict the noisy latent $\mathbf { z } _ { t ^ { \prime \prime } }$ from $\mathbf { z } _ { t }$ of the teacher with just one denoising step, namely,
+
+$$
+\begin{array} { r } { \mathbf { z } _ { t ^ { \prime \prime } } ^ { ( s ) } = \mathbf { z } _ { t ^ { \prime \prime } } . } \end{array}
+$$
+
+Replacing $\mathbf { z } _ { t ^ { \prime \prime } } ^ { ( s ) }$ with $\mathbf { z } _ { t ^ { \prime \prime } }$ in the final equation of Eq. (14), we arrive at the following loss objective,
+
+$$
+\mathcal { L } _ { \mathrm { v a n i \_ d s t l } } = \varpi ( \lambda _ { t } ) \parallel \hat { \mathbf { x } } _ { t } ^ { ( s ) } - \frac { \mathbf { z } _ { t ^ { \prime \prime } } - \frac { \sigma _ { t ^ { \prime \prime } } } { \sigma _ { t } } \mathbf { z } _ { t } } { \alpha _ { t ^ { \prime \prime } } - \frac { \sigma _ { t ^ { \prime \prime } } } { \sigma _ { t } } \alpha _ { t } } \parallel _ { 2 } ^ { 2 } ,
+$$
+
+where $\begin{array} { r } { \varpi ( \lambda _ { t } ) = \operatorname* { m a x } ( \frac { \alpha _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } , 1 ) } \end{array}$ is the truncated SNR weighting coefficients [33].
+
+# D Different Teacher Options for Step Distillation
+
+It is non-trivial to decide the best teacher model to distill our final 8-step efficient UNet. In Fig. 4, we conduct several experiments to explore different teacher options. As straightforward choices, selfdistillation from our 16-step efficient UNet or distillation from the 16-step SD-v1.5 baseline model can effectively boost the performance of our 8-step model. Additionally, we investigate whether stronger teachers can further boost performance by training a CFG-aware distilled 16-step SD-v1.5 model, as discussed in Sec. 4. We obtain significant improvements in CLIP scores, demonstrating the potential of employing better teacher models. We would like to mention that we also experiment with SD-v2 as the teacher model. Surprisingly, we observe much worse results. We attribute this to the different text embeddings used in SD-v1.5 and SD-v2 pipelines. Distillation between different infrastructures might be a possible future direction to explore.
+
+# E Additional Qualitative Results
+
+We provide more generated images from our text-to-image diffusion model in Fig. 9. As an acceleration work for generic Stable Diffusion [4], our efficient model demonstrates a sufficient capability to synthesize various contents with high aesthetics, such as realistic objects (food, animals), scenery, and artistic and cartoon styles.
+
+
+Figure 9: Example generated images by using our efficient text-to-image diffusion model.
\ No newline at end of file
diff --git a/md/dev/ubzNoJjOKj/ubzNoJjOKj.md b/md/dev/ubzNoJjOKj/ubzNoJjOKj.md
new file mode 100644
index 0000000000000000000000000000000000000000..328bdf04aa633e9589f9071bbe7851e7466c727f
--- /dev/null
+++ b/md/dev/ubzNoJjOKj/ubzNoJjOKj.md
@@ -0,0 +1,479 @@
+# HyenaDNA: Long-Range Genomic Sequence Modeling at Single Nucleotide Resolution
+
+Eric Nguyen∗,1, Michael $\mathbf { P o l i ^ { * , 1 } }$ , Marjan Faizi2,∗,
+Armin W. Thomas1, Callum Birch Sykes3, Michael Wornow1, Aman Patel1,
+Clayton Rabideau3, Stefano Massaroli4, Yoshua Bengio4, Stefano Ermon1, Stephen A. Baccus1,†, Christopher $\mathbf { R e ^ { 1 , \dag } }$
+
+# Abstract
+
+Genomic (DNA) sequences encode an enormous amount of information for gene regulation, protein synthesis, and numerous other cellular properties. Similar to natural language models, researchers have proposed foundation models in genomics to learn generalizable features from unlabeled genome data that can then be fine-tuned for downstream tasks such as identifying regulatory elements. Due to the quadratic scaling of attention, previous Transformer-based genomic models have used 512 to 4k tokens as context $( < 0 . 0 0 1 \%$ of the human genome), significantly limiting the modeling of long-range interactions in DNA. In addition, these methods rely on tokenizers or fixed $\mathbf { k }$ -mers to aggregate meaningful DNA units, losing single nucleotide resolution (i.e. DNA "characters") where subtle genetic variations can completely alter protein function via single nucleotide polymorphisms (SNPs). Recently, Hyena, a large language model based on implicit convolutions was shown to match attention in quality while allowing longer context lengths and lower time complexity. Leveraging Hyena’s new long-range capabilities, we present HyenaDNA, a genomic foundation model pretrained on the human reference genome with context lengths of up to 1 million tokens at the single nucleotide-level – an up to $\mathbf { 5 0 0 x }$ increase over previous dense attentionbased models. HyenaDNA scales sub-quadratically in sequence length (training up to $1 6 0 \mathrm { x }$ faster than Transformer), uses single nucleotide tokens, and has full global context at each layer. We explore what longer context enables - including the first use of in-context learning in genomics for simple adaptation to novel tasks without updating pretrained model weights. On a long-range species classification task, HyenaDNA is able to effectively solve the challenge by increasing the context length to 1M without downsampling. On fine-tuned benchmarks from the Nucleotide Transformer, HyenaDNA reaches state-of-the-art (SotA) on 12 of 18 datasets using a model with orders of magnitude less parameters and pretraining data.2 On the GenomicBenchmarks, HyenaDNA surpasses SotA on 7 of 8 datasets on average by $+ 1 0$ accuracy points, and by as much as $+ 2 0$ accuracy points on enhancer identification. Code available at https://github.com/HazyResearch/hyenadna.
+
+
+Figure 1.1: HyenaDNA recipe for long-range foundation models in genomics. The HyenaDNA architecture is a simple stack of Hyena operators [37] trained using next token prediction. (See Fig. 1.3 for block diagram of architecture). We introduce a new sequence length scheduling technique to stabilize training, and provide a method to leverage the longer context length to adapt to novel tasks without standard fine-tuning by filling the context window with learnable soft prompt tokens.
+
+# 1 Introduction
+
+Understanding and learning from DNA sequences has long been a goal of biologists and deep learning researchers, as its “language” encodes instructions essential for all living things [16]. The mapping from DNA instructions, genotypes, to observable function and traits, phenotypes, remains ongoing research effort. Towards this goal, researchers have proposed using foundation models (FMs) in genomics to learn generalizable features from unstructured whole genome data that can then be fine-tuned for a number of tasks including predicting the location and function of genes, identifying regulatory elements, and analyzing the evolution of species [25, 10, 20, 3, 53, 58]. In contrast to protein sequences, which have had successes in protein language models [29, 31, 32, 17, 5, 41, 14], DNA sequences are orders of magnitudes longer (e.g. the human genome is 3.2B nucleotides) with long-range dependencies and interactions that span over $1 0 0 \mathrm { k } +$ nucleotides in length [1]. Overcoming the long-range limitations of current generation models could help drive the next wave of innovations in AI-powered drug discovery and therapeutics, and enable genomic FMs to understand and learn in-context whole patient genomes in a personalized way.
+
+Limitations of current models Previous genomic FM approaches have relied on attention-based Transformers [25, 10, 53, 58], but face a number of challenges unique to DNA sequences. The attention mechanism scales quadratically in sequence length, with current genomic FMs pretraining on only 512 to 4,096 tokens as context [25, 58, 10, 55], ${ < 0 . 0 0 1 \% }$ of the human genome. Also prevalent is the reliance on fixed $\mathbf { k }$ -mers, akin to DNA “words”, and tokenizers to aggregate meaningful DNA units. However, single nucleotide alterations represent physical analogs where, for example, single nucleotide polymorphisms (SNPs) and mutations can have a profound impact on biological properties including regulatory activity [33]. In contrast, natural language semantics can often be con
+
+
+PPL vs Context on the Human Genome
+Figure 1.2: Pretraining on the human reference genome using longer sequences leads to better perplexity (improved prediction of next token).
+
+served when single character or word changes occur over very long contexts. Therefore, having both long-range context and single nucleotide resolution simultaneously is critical, and remains a particular challenge in genomics.
+
+
+Figure 1.3: HyenaDNA block architecture. A Hyena operator is composed of long convolutions and element-wise gate layers. The gates are fed projections of the input using dense layers and short convolutions. The long convolutions are parameterized implicitly via an MLP that produces the convolutional filters. The convolution itself is evaluated using a Fast Fourier Transform convolution with time complexity $\mathcal { O } ( L \log _ { 2 } L )$ .
+
+Toward longer context models Recently, Hyena [37], a large language model based on implicit convolutions, was shown to match attention in quality while reducing computational time complexity, thereby allowing a longer context to be processed. Hyena uses a parameter-efficient global convolutional filter along with a data-controlled gating mechanism, which enables a context-specific operation over every token. Indeed, Hyena showed that for simple associative recall tasks using synthetic data, a shallow 2 layer model could effectively process context lengths at 131k tokens. We hypothesize that Hyena’s core operations can unlock the potential to capture both the long-range and single nucleotide resolution of real genomic sequences over attention-based approaches. To test this, we explore two questions: (i.) Can a convolutional long-context model be used effectively at single nucleotide resolution? (ii.) What new capabilities could long-context genomic foundations models enable?
+
+HyenaDNA The result of our investigation is HyenaDNA, a genomic FM pretrained on the human reference genome at context lengths up to 1 million tokens at single nucleotide resolution - an up to $\mathbf { 5 0 0 x }$ increase over existing genomic FMs using dense-attention. HyenaDNA scales subquadratically in sequence length (training up to $1 6 0 \mathrm { x }$ faster than attention at sequence length 1M), uses single nucleotide tokens, and has a global receptive field at each layer. Our contributions include a "full-stack" recipe for building genomic FMs, including architecture design, a warm-up schedule to speed up training on ultralong sequences, and an efficient downstream adaptation procedure based on soft prompting and in-context learning.
+
+Full-stack genomics modeling We start with a decoder-only Hyena architecture pretrained using next nucleotide (token) prediction. We forego standard aggregating tokenizers, using a singlecharacter tokenizer and a minimal DNA vocabulary of 4 nucleotides (plus special tokens). Training stability becomes an issue at ultralong sequences $( 2 0 0 \mathbf { k } + )$ . To overcome this issue, we introduce a sequence length warm-up scheduler that gradually increases sequence length in stages. At sequence length $4 5 0 \mathrm { k }$ , training time is reduced by $40 \%$ , while boosting accuracy by 7.5 accuracy points on a species classification task. Furthermore, we design downstream adaptation procedures to leverage longer context windows, as simpler and more flexible alternatives to standard fine-tuning in genomics. This includes a novel soft prompt technique where learnable tokens (up to 32k) are injected directly into the input sequence itself, enabling competitive downstream results without the need to update a pretrained model.
+
+Genomic downstream tasks We apply our pretrained HyenaDNA models to 29 diverse downstream genomic tasks to showcase its long-range ability as well as fine-grain resolution. On fine-tuned benchmarks from the Nucleotide Transformer [10], HyenaDNA achieves state-of-theart (SotA) on 12 of 18 datasets while using a model with orders of magnitude less parameters and pretraining data (see Tab. 4.2). On the GenomicBenchmarks [23], HyenaDNA surpasses SotA on 7 of 8 datasets on average by $+ 1 0$ accuracy points, and by as much as $+ 2 0$ accuracy points on enhancer function identification. On a novel species classification task, HyenaDNA effectively solves the challenge by increasing the context length to 1 million tokens. In a challenging chromatin profile experiment, a 919-way multi-task, HyenaDNA performs competitively against a larger SotA sparseattention BigBird Transformer [55]. Finally, we analyze the learned embeddings of a pretrained HyenaDNA model by clustering sequences by biotype (gene or transcription type) and compare the results with existing genomic FMs, showing that HyenaDNA can serve as an effective universal featurizer in genomics.
+
+# 2 Preliminaries and Related Work
+
+# 2.1 Transformers and Attention
+
+Powering many recent foundation models is the attention mechanism. Given a length- $L$ sequence $\boldsymbol { x } \in \mathbb { R } ^ { L \times D }$ , a (single-headed) layer of scaled self-attention [2, 51] is a map from $\mathbb { R } ^ { L \times D }$ to $\mathbb { R } ^ { L \times D }$ which performs the following operations:
+
+$$
+\mathsf { A } ( x ) = \sigma ( x \mathsf { W } _ { q } \mathsf { W } _ { k } ^ { \top } x ^ { \top } ) , \quad y = \mathsf { A } ( x ) x \mathsf { W } _ { v }
+$$
+
+where $D$ is the embedding dimension, $\mathsf { W } _ { q } , \mathsf { W } _ { k } , \mathsf { W } _ { v } \ \in \ \mathbb { R } ^ { D \times D }$ are learnable linear maps and $\sigma$ indicated row-wise softmax (and optional scaling). Attention computes all pair-wise comparison for every token, and scales as $\mathcal { O } ( L ^ { 2 } )$ in sequence length. This allows a global context at high resolution, but limits the size of the context on current hardware.
+
+Previous methods to reduce the quadratic cost of attention have used specialized methods to approximate full dense attention [18]. In sparse attention, elements attend only to a subset of all other positions. Alternatively, linear attention methods construct approximations to $\mathsf { A } ( u )$ that can be evaluated in subquadratic time. Both of these classes of methods, however, trade lower time complexity (allowing longer sequences) for loss in expressivity.
+
+# 2.2 Long Context Strategies in Genomics
+
+To achieve longer context, genomic models have relied on two strategies: i. tokenization and ii. dilation and downsampling. Tokenization is a necessary step in masked language modeling (MLM) with bidirectional Transformer architectures (BERT) [13], a common model in genomics. These tokenizers use fixed k-mers (short overlapping sequences of length k) or frequency-based byte pair encoding (BPE), that attempt to aggregate DNA into meaningful units [25, 55]. Consequently, these aggregation techniques create large new vocabularies (compared to the natural vocabulary of 4 nucleotides) that are less generalizable [49]. The second strategy uses dilated convolutions and downsampling, both of which essentially average or skip elements between weights [18]. A canonical example is the Enformer, which uses dilation and downsampling to reach context lengths of $1 0 0 \mathrm { k }$ nucleotides to predict gene expression tracks [1]. Common across tokenization, dilation, and downsampling is the sacrifice of single nucleotide resolution to reach longer context.
+
+# 2.3 Large Convolutional Models
+
+A discrete convolution between an input $x$ of length $L$ and a (learnable) filter $h$ is given by:
+
+$$
+y _ { t } = ( h * x ) _ { t } = \sum _ { t ^ { \prime } = 0 } ^ { L - 1 } h _ { t - t ^ { \prime } } x _ { t ^ { \prime } } \quad \mathrm { o r e q u i v a l e n t l y } \quad y = \mathsf { T } x .
+$$
+
+where $\mathsf { T } \in \mathbb { R } ^ { L \times L }$ is the Toeplitz matrix corresponding to the convolution. Historically, convolutions have played an important role in deep learning and more broadly signal processing. More recently, it has been shown that by stacking $k$ long convolution layers, where $k$ is parametrized through a function $\gamma _ { \theta }$ i.e. $k : = \gamma _ { \theta } ( \dot { L } )$ , one can achieve state-of-the-art performance on a variety of benchmarks involving long sequences, for example the Long Range Arena (LRA) [48, 24, 47, 19]. Different $\gamma _ { \theta }$ have been proposed in the literature: state-space models [24, 19], and implicit parametrizations via neural fields [45, 44, 37]. On language, the $\mathsf { H }$ -family of implicit convolution language models,
+
+H3 and Hyena, [12, 37] used long convolutions and gating to match Transformer performance in $\mathcal { O } ( L \log _ { 2 } L )$ time, notably lower than the $\mathcal { O } ( L ^ { 2 } )$ of attention-based models.
+
+HyenaDNA takes inspiration from these approaches, showing that attention-free, long-context causal models can achieve high performance on downstream genomic tasks. These extended long-range capabilities enable us to explore new paradigms in genomics, such as in-context learning to easily adapt to new tasks without updating pretrained models.
+
+# 3 HyenaDNA Long-Range Genomic Foundation Models
+
+In this section, we introduce the HyenaDNA approach to long-range genomic sequence modeling. We start with a description of the model architecture, then discuss sequence length warm-up and soft prompting techniques for downstream adaptation.
+
+# 3.1 The HyenaDNA Model
+
+The HyenaDNA model is a decoder-only, sequence-to-sequence architecture defined by a stack of blocks consisting of a Hyena operator [37], followed by a feed-forward neural network (see Fig. 1.3).
+
+Given an input $ { \boldsymbol { { x } } } ^ { \mathrm { ~ ~ } } \in { \mathbb { R } } ^ { L }$ $L$ denotes sequence length), a Hyena3 operator can be defined as:
+
+$$
+\begin{array} { l c r } { { ( x _ { 1 } , x _ { 2 } , v ) \mapsto \mathsf { H } ( x _ { 1 } , x _ { 2 } ) v } } \\ { { \mathsf { H } ( x _ { 1 } , x _ { 2 } ) = \mathsf { T } _ { h } } } \end{array}
+$$
+
+
+Figure 3.1: The Hyena operator is a combination of long convolutions $\top$ and datacontrolled gating D, and can be a drop-in replacement for attention.
+
+where $x _ { 1 } , x _ { 2 } ,$ $v$ are projections of the input, and $\mathsf T _ { h } \in \mathbb R ^ { L \times L }$ is the Toeplitz matrix constructed from a learnable long convolution filter produced as the output of a neural network, $( \mathsf { T } _ { h } ) _ { i j } \doteq \boldsymbol { h } _ { i - j }$ . The convolution filter values themselves are obtained through a small neural network $\gamma _ { \theta }$ taking as input the time (position) index and optionally positional encodings, $h _ { t } = \gamma _ { \theta } ( t )$ , which enable the operator to process very long sequences without growing linearly in the number of parameters. Further, the matrices $\mathsf { D } _ { x _ { 1 } }$ , $\mathbf { \bar { D } } _ { x _ { 2 } } \in \mathbb { R } ^ { \bar { L } \times L }$ are constructed with $x _ { 1 } , x _ { 2 }$ on the diagonals, and evaluated as elementwise gating. The projections are obtained by applying a dense linear layer and short convolution to the input sequence, as shown in Figure 3.1.
+
+Proposition 3.1. $A$ Hyena operator can be evaluated in $\mathcal { O } ( L \log _ { 2 } L )$ time.
+
+Efficient evaluation is crucial on settings involving extremely long sequences such as genomics. In the general case where the embedding dimension $D > 1$ and $\overset { \mathbf { \omega } } { x } \in \overset { \mathbf { \bullet } } { \mathbb { R } } ^ { L \times D }$ , the linear projections $\mathsf { W } _ { x _ { 1 } } , \mathsf { W } _ { x _ { 2 } } , \mathsf { W } _ { v } \in \mathbb { R } ^ { D \times D }$ are right multiplied to $x$ , and $D$ independent Hyena operators are then applied to each dimension.
+
+# 3.2 Training Long Sequence Models
+
+Tokenization The subquadratic cost of HyenaDNA in sequence length allows the model to process ultralong sequences directly at the single nucleotide level without the need for frequency-based aggregation tokenizers. This enables fine-grain resolution for both short and long sequences, critical for detecting single nucleotide polymorphisms or mutations and modeling long-range dependencies in gene expression.
+
+We use the natural DNA vocabulary and refer to each nucleotide as a token. The tokens include "A", "G", "C", "T", and "N" (a non-specific nucleotide) and special character tokens for padding, separation, and unknown characters. Tokens are mapped to embedding dimension $D$ .
+
+Sequence length warm-up for ultralong sequences Directly training on long sequences can affect training stability as the variance in gradient increases [28]. Training on shorter sequences initially (followed by longer sequences) was used by [38] to train small scale Transformers and reduce training time, while [28] used sequence length warm-up to address stability on up to $2 \mathrm { k }$ tokens.
+
+For ultralong sequences $( 2 0 0 \mathrm { k } + )$ , we develop a new warm-up schedule that gradually increases the sequence length in stages to improve both stability and decrease training time.
+
+Our sequence length schedule starts at $L _ { 1 } ~ = ~ 6 4$ , then doubles the window at each stage while keeping the global batch size constant. By doing so, iterations at each consecutive stage will include more tokens, ensuring the scheduler can also act as a form of batch size warm-up. In Fig. 3.2, we observe sequence length scheduling to be particularly important at sequence lengths greater than $4 5 0 \mathrm { k }$ , where at this length training time is reduced by $40 \%$ and improving ultimate accuracy by $7 . 5 \%$ points for a species classification task described later in section 4.4.3.
+
+
+Figure 3.2: Sequence length warm-up reduces the training time of HyenaDNA at sequence length 450k by $40 \%$ and boosts accuracy by 7.5 points on species classification.
+
+# 3.3 Downstream Adaptation
+
+# Tuneable prompting for long-context models
+
+Prompts have been traditionally used to guide the output of a FM [30] by prepending additional context to an input. Expanding on this approach, soft tuneable prompting was introduced to inject learnable tokens (as weights) into the input directly [27] as an alternative to model fine-tuning.
+
+With an extended context length $( L )$ , we’re able to explore new paradigms in adapting FMs after pretraining. Given a downstream task with prompts $\dot { \boldsymbol { x _ { p } } } \in \mathbb { R } ^ { T }$ and corresponding labels $y _ { p }$ , we prepend $N \leq L - T$ trainable parameters $\theta$ of dimension $D$ after the embedding step:
+
+$$
+x \mathsf { c o n c a t } [ \mathsf { e m b e d } ( x _ { p } ) , \theta ] , \quad x \in \mathbb { R } ^ { L \times ( T + N ) }
+$$
+
+The resulting sequences $x$ are then processed by the model, and $\theta$ is optimized on a loss function involving the input sequence’s label $y _ { p }$ . Crucially, soft prompting requires utilization of a small subset of prompt and label pairs to optimize $\theta$ .
+
+During soft prompting, HyenaDNA only optimizes the parameters of the prompt in the input sequence while keeping all other model parameters fixed. Soft prompting thereby provides a flexible and computationally efficient approach to adapting genomic FMs to new downstream tasks.
+
+# 4 Experiments
+
+In 4.1, we start with pretraining HyenaDNA on the human reference genome [22]. We then evaluate HyenaDNA on existing short-range $( < 5 \mathrm { k }$ nucleotides) downstream benchmarks in 4.2 to assess the performance of single nucleotide resolution. In 4.3, we explore what new capabilities emerge with longer range genomic modeling in the form of in-context learning. Finally, we push the limits of ultralong context performance in 4.4.
+
+# 4.1 Pretraining on the Human Genome
+
+We pretrain HyenaDNA on the human reference genome [22] using next nucleotide (token) prediction. Starting with a stack of decoder-only Transformer blocks, we swap attention for the Hyena operator, and compare against a baseline Transformer (GPT) with Flash Attention [11]. We add gradient checkpointing to HyenaDNA to decrease the memory footprint by $3 \mathbf { x }$ on longer sequences $( > 1 6 0 \mathrm { k } )$ . We then scale HyenaDNA along dimensions of model depth (2 to 8 layers), width (128 to 256 dimensions), and sequence length (1024 to 1M). At sequence length 1M, HyenaDNA is $1 6 0 \mathrm { x }$ faster than its Transformer counterpart as shown in Fig. 4.1.
+
+As shown in Fig. 1.2, we observe that as context length increases, perplexity improves during pretraining. However, this improvement comes at the expense of more training time and tokens. For models too shallow to effectively process longer context, perplexity can begin to degrade (increase), observing inflection points with longer sequences. In this way, increasing context can serve as a novel regularization dimension. For genomic pretraining, we provide the following guidelines. 1. In optimizing for faster training time, shorter context enable lower perplexity to be reached faster. 2. In optimizing for best overall perplexity, longer context allows for lower perplexity at the cost of training on more tokens. See A.1 for experiment details.
+
+# 4.2 Single Nucleotide Resolution
+
+Our first downstream tasks use short-range genomic sequences $( < 5 \mathrm { k } )$ aimed at evaluating single nucleotide resolution performance on sequence-level classification using standard fine-tuning.
+
+GenomicBenchmarks We start with the newly released GenomicBenchmarks [23], which is comprised of 8 regulatory element classification datasets with sequence lengths of 200-500, and one up to 4,776. The original baseline model uses a short-range CNN. We fine-tune the pretrained Transformer (GPT) and HyenaDNA from 4.1, both having single nucleotide resolution, as well as the DNABERT model [25]. HyenaDNA sets a new SotA on 7 of 8 datasets and by up to $20 \%$ points on the human enhancer identification task, as shown in Tab. 4.1. See A.2 for additional experiment details and ablations.
+
+
+Figure 4.1: Runtime (forward & backward pass) for Transformer & HyenaDNA: 2 layers, width ${ \tt 1 2 8 }$ , gradient checkpoint, batch size $^ { = 1 }$ , A100 80GB. At 1M tokens HyenaDNA is $\mathbf { 1 6 0 x }$ faster than Transformer.
+
+Nucleotide Transformer Next, we benchmark against 18 datasets from the Nucleotide Transformer (NT) [10], which includes predicting regulatory elements for enhancers, promoters, epigenetic marks, and splice sites from DNA sequences of length 200-600 nucleotides. We compare against $3 ~ \mathrm { N T }$ base models, which were pretrained using masked language
+
+Table 4.1: GenomicBenchmarks Top-1 accuracy $( \% )$ for pretrained HyenaDNA, DNABERT and Transformer (GPT from 4.1), and the previous SotA baseline CNN (scratch).
+
+
DATASET
CNN
DNABERT
GPT
HYENADNA
Mouse Enhancers
69.0
66.9
80.1
85.1
Coding vs Intergenomic
87.6
92.5
88.8
91.3
Human vs Worm
93.0
96.5
95.6
96.6
Human Enhancers Cohn
69.5
74.0
70.5
74.2
Human Enhancers Ensembl
68.9
85.7
83.5
89.2
Human Regulatory
93.3
88.1
91.5
93.8
Human Nontata Promoters
84.6
85.6
87.7
96.6
Human OCR Ensembl
68.0
75.1
73.0
80.9
+
+modeling (BERT) and then fine-tuned. The NT models ranged from 500M to 2.5B parameters, and pretrained on up to 3202 genomes. All NT models use 6-mer sequences of 1000 tokens long. For HyenaDNA, we attach a linear decoder head and fine-tune a pretrained model, surpassing SotA on 12 of 18 datasets using a model with orders of magnitude less parameters and pretraining data, shown in Tab. 4.2. See A.2 for additional experiment details and ablations.
+
+# 4.3 In-context Learning for Genomic Sequences
+
+Compared to natural language FMs, which have shown strong success with in-context learning, HyenaDNA’s vocabulary is very small. DNA sequences are also less diverse in structure, e.g. there’s no concept of labels or descriptions that follow a DNA sequence. This makes it challenging to perform "pure" in-context learning (relying only on inference), since new concepts such as classification labels would require new symbols. To overcome this limitation and explore the potential for in-context learning in genomics, we make use of two variants of in-context learning: soft prompting and instruction fine-tuning. Each involve a brief tuning phase to introduce the concept of classification using only the existing vocabulary.
+
+Procedure In both variants, we use the GenomicBenchmarks in 4.2, and a HyenaDNA model pretrained on sequence length 160k from 4.1.
+
+In the first experiment, we evaluate a soft prompting approach by prepending a sequence of soft tuneable tokens (2 to 32k) directly in the input sequences. We include a brief tuning phase $< 2 0$ epochs), updating the soft tokens only, to provide HyenaDNA with the ability to indicate the target classes. To denote classes, we repurpose HyenaDNA’s fixed vocabulary: for binary classification, for example, we indicate the two classes with the letters "A" and "N".
+
+In the second experiment, we evaluate a few-shot learning approach to in-context learning [6] by prepending, consecutively, $k$ (2 to 32) demonstrations of each class and its sequence into the prompt. As before, we encode class labels by the use of individual letters of HyenaDNA’s existing vocabulary. We additionally perform a brief instruction-tuning period [52]
+
+Table 4.2: Nucleotide Transformer (NT) Benchmarks The Matthews correlation coefficient (MCC) is used as the performance metric for the enhancer and epigenetic marks dataset, and the F1-score is used for the promoter and splice site dataset.
+
+
MODEL PARAMS # OF GENOMES
NT 500M 1
NT 2.5B 3,202
NT 2.5B 850
HyenaDNA 1.6M 1
Enhancer
53.5
59.3
58.0
62.6
Enhancer types
48.5
50.0
47.4
55.7
H3
73.7
77.6
81.4
81.7
H3K4me1
35.8
44.5
55.9
57.1
H3K4me2
28.1
30.0
32.6
53.9
H3K4me3
26.3
28.1
42.1
61.2
H3K9ac
46.2
50.8
57.5
65.1
H3K14ac
37.7
47.1
55.0
66.3
H3K36me3
46.7
53.3
63.2
65.3
H3K79me3
57.7
59.2
64.2
71.6
H4
76.2
78.9
82.2
79.6
H4ac
34.4
42.3
50.1
63.7
Promoter all
95.4
96.6
97.4
96.5
Promoter non-TATA
95.6
96.9
97.7
96.6
Promoter TATA
94.8
95.8
96.4
96.7
Splice acceptor
96.5
98.5
99.0
96.6
Splice donor
97.2
98.2
98.4
97.3
Splice all
97.2
97.8
98.3
97.9
+
+for each dataset to familiarize HyenaDNA with this task structure by tuning the pretrained model on a small subset of the dataset.
+
+
+Figure 4.2: Filling long-context with soft tuneable tokens. HyenaDNA is able to learn new tasks in-context when adding a sequence of tuneable tokens to the input sequences. Longer sequences of tuneable tokens lead to better performance.
+
+Results In Fig. 4.2, HyenaDNA’s performance on novel tasks improves as more tuneable tokens are added into the input sequences, and saturates close to baseline performance (Tab. 4.1; with the exception of the Human Regulatory dataset). By contrast, we find that increasing $k$ -shot demonstrations to the input does not necessarily improve performance. A higher number of tuning samples is needed before $k$ -shot demonstrations start to boost accuracy as shown in Tab. A.1. See A.3 for experiment details.
+
+# 4.4 Ultralong-Range Genomics
+
+In our final experimental section, we focus on pushing the limits of using long context effectively in genomics. In 4.4.1, we tackle a challenging 919 binary multi-task against a sparse-attention baseline. In 4.4.2 we analyze the learned embeddings HyenaDNA and its use in clustering long sequences by functional annotation, and in 4.4.3 we showcase a novel ultralong-range species classification task.
+
+# 4.4.1 Chromatin Profile Prediction
+
+The prediction of chromatin profiles and epigenetic markers from DNA sequences is an important and challenging task to quantify the functional effects of non-coding variants. These variants include single nucleotide changes in DNA that can affect the downstream expression of genes [56]. The DeepSEA dataset [57] is compiled from 919 chromatin features including transcription factor (TF) binding profiles, DNase I-hypersensitive sites (DHS) and histone mark (HM) profiles. For a given sequence, the task is to jointly predict 919 labels cor
+
+Table 4.3: Chromatin profile prediction Median AUROC computed over three categories: Transcription factor binding profiles (TF), DNase Ihypersensitive sites (DHS) and histone marks (HM).
+
+
MODEL
PARAMS
LEN
AUROC
TF
DHS
HM
DeepSEA BigBird
40M
1k
95.8
92.3
85.6
110 M
8k
96.1
92.1
88.7
HyenaDNA
7M
1k
96.4
93.0
86.3
3.5 M
8k
95.5
91.7
89.3
+
+responding to the chromatin profile (similar to peak detection) of a central region of the sequence, indicating the presence of such functional effects. The input also includes flanking regions that provide broader contextual information needed to incorporate long-range interactions. We fine-tune our pretrained HyenaDNA models from 4.1 and perform competitively against a DeepSea CNN and the SotA sparse attention BigBird [55] baselines using $5 \mathrm { - } 3 0 \mathrm { \times }$ fewer parameters. See A.4 for experiment details.
+
+# 4.4.2 Biotype Embeddings
+
+
+Figure 4.3: Embedding visualisation. t-SNE of the embeddings generated by DNABERT, Nucleotide Transformer and HyenaDNA coloured by Ensembl biotype annotations.
+
+Next, we analyze the pretrained embeddings from HyenaDNA and compare them with DNABERT [25] and the Nucleotide Transformer [10]. We encode sequences of human genes corresponding to different biological function annotations obtained from the Ensembl dataset known as biotypes [9]. In cases where the length of the input exceeds the context window of the encoder, the sequence is chunked (by the max length of the encoder) and averaged.
+
+We fit the embeddings using an XGBoost [7] classifier on the $1 0 \mathrm { \ m o s t }$ frequent biotypes, and apply tSNE [50] for visualization. As shown in 4.3, distinct clusterings emerge visually, while quantitatively, HyenaDNA produces the highest F1 score in biotype classification (with a much smaller model), indicating that during pretraining, HyenaDNA learns informative features related to biological function.
+
+Table 4.4: Embedding quality Weighted F1 classification score on 10 biotypes.
+
+
MODEL
PARAMS
LEN
F1
DNABERT
110 M
512
64.6
NT
500M
6k
66.5
HyenaDNA
7M
160k
72.0
+
+# 4.4.3 Species Classification
+
+The majority of the genome is conserved across species – humans and non-human primates, for example, have ${ < } 1 0 \%$ sequence divergence [43], making them difficult to discriminate. This allows us to to design an ultralong-range sequence modeling task to test whether a model can determine the source species of a random genetic sequence. To train, we randomly sample DNA sequences from 5 different species, and fine-tune pretrained HyenaDNA and Transformer models from 4.1 to predict the species label. We observe in Tab. 4.5 that both models struggle on shorter sequences of length 1024, but performance improves with longer contexts as the distinct mutational profile of each species becomes more evident. HyenaDNA effectively solves the task by using a context length of $4 5 0 \mathrm { k }$ to 1 million, where Transformer cannot due to infeasible training time limitations. See A.6 for experiment details.
+
+# 5 Conclusion
+
+Summary We presented HyenaDNA, a genomic foundation model pretrained on the human reference genome with context lengths up to 1 million tokens at single nucleotide resolution - an up to $5 0 0 \mathrm { x }$ increase over previous genomic FMs using dense-attention. HyenaDNA is able to learn generalizable features that can then be finetuned for tasks including identifying regulatory elements and on a 919-way chromatin profile prediction task. We also explored the first use of in-context learning in genomics to enable simpler adaptation to downstream tasks without any updates to pretrained weights.
+
+Table 4.5: Species classification Top1 accuracy $( \% )$ for 5-way classification (human, lemur, mouse, pig, hippo). The $\pmb { \chi }$ symbol indicates infeasible training time.
+
+
MODEL
LEN
AcC
Transformer
1k
55.4 61.1
HyenaDNA Transformer
1k 32k
88.9
HyenaDNA
32k
93.4
Transformer
250k
+
HyenaDNA
250k
97.9
Transformer
450k
×
HyenaDNA
450k
99.4
Transformer
1M
X
HyenaDNA
1M
99.5
+
+Limitations and Future Work While demonstrating competitive results and introducing novel capabilities, it is worth noting that HyenaDNA was pretrained on only one human reference genome. Incorporating genomes of multiple humans and species could increase generalizability in learned features and reduce bias. Furthermore, our current focus in this study was exclusively on DNA sequences. Extending our framework to incorporate other biological or chemical sequences, such as proteins and drug molecules, has the potential to unlock multi-modal capabilities similar to those observed in natural language and vision FMs [39, 40, 54].
+
+With respect to model size, HyenaDNA is significantly smaller than previous genomic FMs and was pretrained using up to 8 Nvidia A100 (80GB) GPUs. We expect increasing model size, and compute, may lead to additional long-range capabilities. Notably, with model parallelism, it becomes feasible to extend the context length by orders of magnitude beyond this current work, and leave that open to future research.
+
+Furthermore, beyond discriminative applications, the use of long context models in generative tasks unlocks exciting prospects for the design of synthetic regulatory elements, genes and protein complexes. In conclusion, the continued advancements of long-range sequence models with single nucleotide resolution hold great promise in driving innovation in genomic research and unraveling the complexities of biological systems.
+
+# Acknowledgments
+
+We would like to thank Guatam Machiraju, Elliott Epstein, Archis Joglekar, Jared Dunnmon, Nazim Bouatta and Anshul Kundaje for helpful discussion and feedback on earlier drafts, and Together for providing the compute used to train models in this paper. We gratefully acknowledge the support of NIH under No. U54EB020405 (Mobilize), NSF under Nos. CCF1763315 (Beyond Sparsity), CCF1563078 (Volume to Velocity), and 1937301 (RTML); US DEVCOM ARL under No. W911NF-21-2-0251 (Interactive Human-AI Teaming); ONR under No. N000141712266 (Unifying Weak Supervision); ONR N00014-20-1-2480: Understanding and Applying Non-Euclidean Geometry in Machine Learning; N000142012275 (NEPTUNE); NXP, Xilinx, LETI-CEA, Intel, IBM, Microsoft, NEC, Toshiba, TSMC, ARM, Hitachi, BASF, Accenture, Ericsson, Qualcomm, Analog Devices, Google Cloud, Salesforce, Total, the HAI-GCP Cloud Credits for Research program, the Stanford Data Science Initiative (SDSI), Department of Defense (DoD) through the National Defense Science and Engineering Graduate Fellowship (NDSEG) Program, and members of the Stanford DAWN project: Facebook, Google, and VMWare. This work is supported by NSF (1651565), AFOSR (FA95501910024), ARO (W911NF-21-1-0125), ONR, DOE (DE-SC0022222), CZ Biohub, and Sloan Fellowship. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright notation thereon. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views, policies, or endorsements, either expressed or implied, of NIH, ONR, or the U.S. Government.
+
+# References
+
+[1] Ž. Avsec, V. Agarwal, D. Visentin, J. R. Ledsam, A. Grabska-Barwinska, K. R. Taylor, Y. Assael, J. Jumper, P. Kohli, and D. R. Kelley. Effective gene expression prediction from sequence by integrating long-range interactions. Nature methods, 18(10):1196–1203, 2021.
+[2] D. Bahdanau, K. Cho, and Y. Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
+[3] G. Benegas, S. S. Batra, and Y. S. Song. DNA language models are powerful zero-shot predictors of non-coding variant effects. bioRxiv, pages 2022–08, 2022.
+[4] R. Bommasani, D. A. Hudson, E. Adeli, R. Altman, S. Arora, S. von Arx, M. S. Bernstein, J. Bohg, A. Bosselut, E. Brunskill, et al. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258, 2021.
+[5] N. Brandes, D. Ofer, Y. Peleg, N. Rappoport, and M. Linial. ProteinBERT: a universal deeplearning model of protein sequence and function. Bioinformatics, 38(8):2102–2110, 2022.
+[6] T. Brown, B. Mann, N. Ryder, M. Subbiah, J. D. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
+[7] T. Chen and C. Guestrin. Xgboost: A scalable tree boosting system. In Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining, pages 785–794, 2016.
+[8] D. M. Church, V. A. Schneider, T. Graves, K. Auger, F. Cunningham, N. Bouk, H.-C. Chen, R. Agarwala, W. M. McLaren, G. R. Ritchie, et al. Modernizing reference genome assemblies. PLoS biology, 9(7):e1001091, 2011.
+[9] F. Cunningham, J. E. Allen, J. Allen, J. Alvarez-Jarreta, M. R. Amode, I. M. Armean, O. Austine-Orimoloye, A. G. Azov, I. Barnes, R. Bennett, et al. Ensembl 2022. Nucleic acids research, 50(D1):D988–D995, 2022.
+[10] H. Dalla-Torre, L. Gonzalez, J. Mendoza-Revilla, N. L. Carranza, A. H. Grzywaczewski, F. Oteri, C. Dallago, E. Trop, H. Sirelkhatim, G. Richard, M. Skwark, K. Beguir, M. Lopez, and T. Pierrot. The Nucleotide Transformer: Building and evaluating robust foundation models for human genomics. bioRxiv, 2023.
+[11] T. Dao, D. Y. Fu, S. Ermon, A. Rudra, and C. Ré. FlashAttention: Fast and memory-efficient exact attention with IO-awareness. In Advances in Neural Information Processing Systems, 2022.
+[12] T. Dao, D. Y. Fu, K. K. Saab, A. W. Thomas, A. Rudra, and C. Ré. Hungry hungry hippos: Towards language modeling with state space models. arXiv preprint arXiv:2212.14052, 2022.
+[13] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
+[14] A. Elnaggar, M. Heinzinger, C. Dallago, G. Rehawi, Y. Wang, L. Jones, T. Gibbs, T. Feher, C. Angerer, M. Steinegger, et al. Prottrans: Toward understanding the language of life through self-supervised learning. IEEE transactions on pattern analysis and machine intelligence, 44 (10):7112–7127, 2021.
+[15] ENCODE Project Consortium. An integrated encyclopedia of dna elements in the human genome. Nature, 489(7414):57, 2012.
+[16] ENCODE Project Consortium. Expanded encyclopaedias of DNA elements in the human and mouse genomes. Nature, 583:699–710, 2020.
+[17] N. Ferruz, S. Schmidt, and B. Höcker. ProtGPT2 is a deep unsupervised language model for protein design. Nature communications, 13(1):4348, 2022.
+[18] Q. Fournier, G. M. Caron, and D. Aloise. A practical survey on faster and lighter transformers. ACM Computing Surveys, 2021.
+[19] D. Y. Fu, E. L. Epstein, E. Nguyen, A. W. Thomas, M. Zhang, T. Dao, A. Rudra, and C. Ré. Simple hardware-efficient long convolutions for sequence modeling. arXiv preprint arXiv:2302.06646, 2023.
+[20] D. Gankin, A. Karollus, M. Grosshauser, K. Klemon, J. Hingerl, and J. Gagneur. Speciesaware DNA language modeling. bioRxiv, pages 2023–01, 2023.
+[21] Q. Geng, R. Yang, and L. Zhang. A deep learning framework for enhancer prediction using word embedding and sequence generation. Biophysical Chemistry, 286:106822, 2022.
+[22] Genome Reference Consortium. Genome reference consortium human build 38 (grch38). National Center for Biotechnology Information, 2013. URL https://www.ncbi.nlm. nih.gov/assembly/GCF_000001405.26/.
+[23] K. Gresova, V. Martinek, D. Cechak, P. Simecek, and P. Alexiou. Genomic Benchmarks: A collection of datasets for genomic sequence classification. bioRxiv, 2022.
+[24] A. Gu, K. Goel, and C. Ré. Efficiently modeling long sequences with structured state spaces. arXiv preprint arXiv:2111.00396, 2021.
+[25] Y. Ji, Z. Zhou, H. Liu, and R. V. Davuluri. DNABERT: pre-trained bidirectional encoder representations from transformers model for DNA-language in genome. Bioinformatics, 37 (15):2112–2120, 2021.
+[26] W. J. Kent, C. W. Sugnet, T. S. Furey, K. M. Roskin, T. H. Pringle, A. M. Zahler, and D. Haussler. The human genome browser at ucsc. Genome research, 12(6):996–1006, 2002.
+[27] B. Lester, R. Al-Rfou, and N. Constant. The power of scale for parameter-efficient prompt tuning. arXiv preprint arXiv:2104.08691, 2021.
+[28] C. Li, M. Zhang, and Y. He. The stability-efficiency dilemma: Investigating sequence length warmup for training GPT models. In Advances in Neural Information Processing Systems, 2022.
+[29] Z. Lin, H. Akin, R. Rao, B. Hie, Z. Zhu, W. Lu, A. dos Santos Costa, M. Fazel-Zarandi, T. Sercu, S. Candido, et al. Language models of protein sequences at the scale of evolution enable accurate structure prediction. BioRxiv, 2022.
+[30] P. Liu, W. Yuan, J. Fu, Z. Jiang, H. Hayashi, and G. Neubig. Pre-train, prompt, and predict: A systematic survey of prompting methods in natural language processing. ACM Computing Surveys, 55(9):1–35, 2023.
+[31] A. Madani, B. Krause, E. R. Greene, S. Subramanian, B. P. Mohr, J. M. Holton, J. L. Olmos Jr, C. Xiong, Z. Z. Sun, R. Socher, et al. Large language models generate functional protein sequences across diverse families. Nature Biotechnology, pages 1–8, 2023.
+[32] J. Meier, R. Rao, R. Verkuil, J. Liu, T. Sercu, and A. Rives. Language models enable zero-shot prediction of the effects of mutations on protein function. Advances in Neural Information Processing Systems, 34:29287–29303, 2021.
+[33] J. Nasser, D. T. Bergman, C. P. Fulco, P. Guckelberger, B. R. Doughty, T. A. Patwardhan, T. R. Jones, T. H. Nguyen, J. C. Ulirsch, F. Lekschas, K. Mualim, H. M. Natri, E. M. Weeks, G. Munson, M. Kane, H. Y. Kang, A. Cui, J. P. Ray, T. M. Eisenhaure, R. L. Collins, K. Dey, H. Pfister, A. L. Price, C. B. Epstein, A. Kundaje, R. J. Xavier, M. J. Daly, H. Huang, H. K. Finucane, N. Hacohen, E. S. Lander, and J. M. Engreitz. Genome-wide enhancer maps link risk variants to disease genes. Nature, 593:238–243, 2021.
+[34] M. Oubounyt, Z. Louadi, H. Tayara, and K. T. Chong. DeePromoter: Robust promoter predictor using deep learning. Frontiers in Genetics, 10, 2019.
+[35] T. H. Pham, D. H. Tran, T. B. H. Ho, K. Satou, and G. Valiente. Qualitatively predicting acetylation and methylation areas in DNA sequences. Genome Informatics, 16(2):3–11, 2005.
+[36] D. K. Pokholok, C. T. Harbison, S. Levine, F. Lewitter, D. K. Gifford, and R. A. Young. Genome-wide map of nucleosome acetylation and methylation in yeast. Cell, 122(4):517–527, 2005.
+[37] M. Poli, S. Massaroli, E. Nguyen, D. Y. Fu, T. Dao, S. Baccus, Y. Bengio, S. Ermon, and C. Ré. Hyena Hierarchy: Towards larger convolutional language models. arXiv preprint arXiv:2302.10866, 2023.
+[38] O. Press, N. A. Smith, and M. Lewis. Shortformer: Better language modeling using shorter inputs. arXiv preprint arXiv:2012.15832, 2020.
+[39] A. Radford, J. W. Kim, C. Hallacy, A. Ramesh, G. Goh, S. Agarwal, G. Sastry, A. Askell, P. Mishkin, J. Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pages 8748–8763. PMLR, 2021.
+[40] A. Ramesh, M. Pavlov, G. Goh, S. Gray, C. Voss, A. Radford, M. Chen, and I. Sutskever. Zero-shot text-to-image generation. In International Conference on Machine Learning, pages 8821–8831. PMLR, 2021.
+[41] R. Rao, J. Meier, T. Sercu, S. Ovchinnikov, and A. Rives. Transformer protein language models are unsupervised structure learners. Biorxiv, pages 2020–12, 2020.
+[42] Roadmap Epigenomics Consortium. Integrative analysis of 111 reference human epigenomes. Nature, 518(7539):317–330, 2015.
+[43] J. Rogers and R. A. Gibbs. Comparative primate genomics: emerging patterns of genome content and dynamics. Nature Reviews Genetics, 15(5):347–359, 2014.
+[44] D. W. Romero, R.-J. Bruintjes, J. M. Tomczak, E. J. Bekkers, M. Hoogendoorn, and J. C. van Gemert. Flexconv: Continuous kernel convolutions with differentiable kernel sizes. arXiv preprint arXiv:2110.08059, 2021.
+[45] D. W. Romero, A. Kuzina, E. J. Bekkers, J. M. Tomczak, and M. Hoogendoorn. Ckconv: Continuous kernel convolution for sequential data. arXiv preprint arXiv:2102.02611, 2021.
+[46] N. Scalzitti, A. Kress, R. Orhand, T. Weber, L. Moulinier, A. Jeannin-Girardon, O. Collet, Pierre anf Poch, and J. D. Thompson. Spliceator: multi-species splice site prediction using convolutional neural networks. BMC Bioinformatics, 22(1):1–26, 2021.
+[47] J. T. Smith, A. Warrington, and S. W. Linderman. Simplified state space layers for sequence modeling. arXiv preprint arXiv:2208.04933, 2022.
+[48] Y. Tay, M. Dehghani, S. Abnar, Y. Shen, D. Bahri, P. Pham, J. Rao, L. Yang, S. Ruder, and D. Metzler. Long range arena: A benchmark for efficient transformers. arXiv preprint arXiv:2011.04006, 2020.
+[49] Y. Tay, V. Q. Tran, S. Ruder, J. Gupta, H. W. Chung, D. Bahri, Z. Qin, S. Baumgartner, C. Yu, and D. Metzler. Charformer: Fast character transformers via gradient-based subword tokenization. arXiv preprint arXiv:2106.12672, 2021.
+[50] L. Van der Maaten and G. Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(11), 2008.
+[51] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017.
+[52] J. Wei, M. Bosma, V. Y. Zhao, K. Guu, A. W. Yu, B. Lester, N. Du, A. M. Dai, and Q. V. Le. Finetuned language models are zero-shot learners. arXiv preprint arXiv:2109.01652, 2021.
+[53] F. Yang, W. Wang, F. Wang, Y. Fang, D. Tang, J. Huang, H. Lu, and J. Yao. scBERT as a large-scale pretrained deep language model for cell type annotation of single-cell RNA-seq data. Nature Machine Intelligence, 4(10):852–866, 2022.
+[54] J. Yu, Z. Wang, V. Vasudevan, L. Yeung, M. Seyedhosseini, and Y. Wu. Coca: Contrastive captioners are image-text foundation models. arXiv preprint arXiv:2205.01917, 2022.
+[55] M. Zaheer, G. Guruganesh, K. A. Dubey, J. Ainslie, C. Alberti, S. Ontanon, P. Pham, A. Ravula, Q. Wang, L. Yang, et al. Big bird: Transformers for longer sequences. Advances in neural information processing systems, 33:17283–17297, 2020.
+[56] S. Zaina, E. L. Pérez-Luque, and G. Lund. Genetics talks to epigenetics? the interplay between sequence variants and chromatin structure. Current genomics, 11(5):359–367, 2010.
+[57] J. Zhou and O. G. Troyanskaya. Predicting effects of noncoding variants with deep learning– based sequence model. Nature methods, 12(10):931–934, 2015.
+[58] M. Zvyagin, A. Brace, K. Hippe, Y. Deng, B. Zhang, C. O. Bohorquez, A. Clyde, B. Kale, D. Perez-Rivera, H. Ma, et al. GenSLMs: Genome-scale language models reveal SARS-CoV2 evolutionary dynamics. bioRxiv, pages 2022–10, 2022.
+
+# HyenaDNA
+
+# Supplementary Material
+
+# Contents
+
+# 1 Introduction 2
+
+# 2 Preliminaries and Related Work 4
+
+2.1 Transformers and Attention . 4
+2.2 Long Context Strategies in Genomics 4
+2.3 Large Convolutional Models 4
+
+# 3 HyenaDNA Long-Range Genomic Foundation Models 5
+
+3.1 The HyenaDNA Model 5
+3.2 Training Long Sequence Models 5
+3.3 Downstream Adaptation 6
+
+# 4 Experiments 6
+
+4.1 Pretraining on the Human Genome 6
+4.2 Single Nucleotide Resolution 7
+4.3 In-context Learning for Genomic Sequences 7
+4.4 Ultralong-Range Genomics 8
+4.4.1 Chromatin Profile Prediction 8
+4.4.2 Biotype Embeddings 9
+4.4.3 Species Classification 10
+
+# 5 Conclusion 10
+
+# A Appendix: Experimental Details 17
+
+A.1 Pretraining Details 17
+A.2 Short-Range Genomics Details 18
+A.2.1 GenomicBenchmarks experiment 18
+A.2.2 Ablations on the GenomicBenchmarks 18
+A.2.3 Downstream prediction tasks for Nucleotide Transformer benchmark 19
+A.2.4 Ablations on the Nucleotide Transformer benchmarks 20
+A.3 In-Context Learning Details 20
+A.4 Chromatin Profile Details 22
+A.5 Biotype Embeddings Analysis Details 23
+
+# A Appendix: Experimental Details
+
+In the following sections we provide further details for each experiment. Across all experiments, we use Pytorch and Pytorch Lightning. We train on a mix of Nvidia GPUs with A100s, V100s, and T4s. Unless otherwise stated, we use a cross entropy loss for our objective. Our repository is made public here: https://github.com/HazyResearch/hyena-dna.
+
+# A.1 Pretraining Details
+
+Table A.1: Hyperparameter settings for HyenaDNA pretraining (select models).
+
+
Layers Width
2 128
2 256
4 128
4 256
8 256
Params (M) Max seq. len.
0.44 64k
1.6 64k
0.87 64k
3.3 64k
6.6 1M
Optimizer
Optimizer momentum
β1, β = 0.9,0.999
AdamW
Learning rate
1.5 - 6e-4
LR Scheduler
Cosine decay
Batch size
Global steps
64 - 256 10- 20k
Weight decay (model)
0.1
Weight decay (Hyena layers)
0
Embed dropout
0.1
Residual dropout
0
+
+Data For pretraining, we use a single human reference genome [22], and leverage the training and validation intervals (start and end) from [1]. During training, we sample an interval and obtain a sequence of length $L$ by adjusting the intervals on both ends. For the test set, we use chromosomes 14 and X, exclusively, and sample non-overlapping sequences of length $L$ .
+
+Model We design a suite of parameter efficient architectures with depths between 2 and 8 layers, Hyena blocks of Order- $\mathbf { N } = 2$ , and width 128 to 256. The MLP expansion factor (reverse bottleneck) is $4 \mathbf { x }$ the width. See Fig. 1.3 for the block architecture of HyenaDNA. The parameter counts range from 400k to $6 . 6 \mathsf { M }$ , trained on sequence lengths between 1,024 and 1M. Tab. A.1 highlights a representative subset of the models we trained. Note: we use different pretrained model sizes depending on the downstream task to prevent overfitting. When selecting which pretrained model to use for a downstream task, we found that a pretrained sequence length of 2 to $4 \mathbf { x }$ the downstream max sequence length results in the best performance.
+
+Training We pretrain each model for 10-20k global steps. For models trained on longer sequences, this translates to more tokens being used, as each sample contains more tokens. For example, the largest model with context length 1M was trained on 2T tokens over 4 weeks. We adjust the "accumulate_grad_batches" argument in Pytorch Lightning to keep the global batch size consistent across models and sequence lengths. See Tab. A.1 for hyperparameter details.
+
+Training efficiency We compare pretraining compute resources and GPU-hours to reach competitive performance on the short-range tasks for several baselines and HyenaDNA models, shown in Tab. A.2.
+
+Table A.2: Pretraining GPU & runtime comparison for short-range models.
+
+
DNABERT
NUCLEOTIDE TRANSFORMER
HyenaDNA
HyenaDNA
Params
110M
2.5B
436K
1.6M
GPUs
8-2080 TI
128-A100-80GB
1-A100-40GB
1-A100-40GB
Wall clock
25 days
28 days
80 mins
80 mins
GPU-hrs
12,000
215,000
1.3
1.3
+
+# A.2 Short-Range Genomics Details
+
+# A.2.1 GenomicBenchmarks experiment
+
+Data The GenomicBenchmarks [23] includes 8 datasets designed for sequence-level classification tasks that involve predicting regulatory elements, along with one binary species task. The benchmarks provided for the baseline model include two sets of results: one obtained with Pytorch and the other with TensorFlow. Since our code base is implemented in Pytorch, we compare our results with the Pytorch-based benchmarks.
+
+Model Our backbone is a pretrained 2 layer HyenaDNA model with width 128, trained on sequence length 1024. We pool along the sequence dimension to obtain a classification token, and attach a simple linear decoder head. The baseline CNN, as described by [23], uses uses an embedding layer, 3 convolutional layers with number of filters: 16, 8, and 4. It uses batch norm and max pooling after each convolutional layer, followed by 2 dense layers. It is trained for 10 epochs with batch size 64. The mode sizes range from 120k to 520k, depending on sequence length chosen.
+
+Table A.3: GenomicBenchmarks hyperparameters for HyenaDNA and the baseline Transformer (GPT from 4.1), which uses FlashAttention [11].
+
+
TRANSFORMER
HyenaDNA
Layers
2
2
Width
128
128
Parameters
529k
436k
Learning rate
1-6e-4
1-6e-4
Weight decay (model)
0-0.2
0-0.2
Weight decay (Hyena layers)
-
0
Embed dropout
0-0.2
0.0-0.3
Resid dropout
0-0.2
0-0.3
Num heads
8
Optimizer
AdamW
Optimizer momentum
β1,β2= 0.9,0.999
LR scheduler
Cosine decay
Batch size
128-1024
Training epoch
100
Reverse complement aug.
true/false
Sequence lengths
200-4800
+
+Training The primary hyperparameters we sweep across include: learning rate, global batch size, dropout, weight decay, and a reverse complement augmentation. See Tab. A.3 for ranges of hyperparamters used.
+
+# A.2.2 Ablations on the GenomicBenchmarks
+
+To better understand how specific design choices in the HyenaDNA model effect performance, we perform a series of ablation experiments on the GenomicBenchmarks.
+
+Pretraining: We train HyenaDNA from scratch and compare with the pretrained version. The pretrained models provide mild to moderate gains - likely due to the benchmarks being near saturation already.
+
+Tokenization: We train HyenaDNA using a k-mer tokenizer $\scriptstyle ( \mathbf { k } = 6 )$ to isolate the effect of the single nucleotide tokenizer. The $\mathbf { k }$ -mer tokenizer drops performance significantly across on a majority of the datasets (by as much as 10 accuracy points), while boosting one dataset (Human Enhancer Ensembl). Therefore, the single nucleotide tokenization appears to be a significant component of the HyenaDNA model.
+
+Bidirectional: To ablate the impact of using a causal model, we implemented a bidirectional version of HyenaDNA and trained from scratch on the GenomicBenchmarks (i.e. without masked language model pretraining). The bidirectional version degraded performance on 7 of 8 datasets compared to the standard causal HyenaDNA (also from scratch), on average by 3.8 accuracy points.
+
+Table A.4: GenomicBenchmarks Top-1 accuracy $( \% )$ GPT is the causal Transformer from 4.1, HyenaDNA k-mer uses a 6-mer tokenizer, and HyenaDNA bidirection is a bidirectional version of the Hyena operator.
+
+
MODEL
GPT
GPT
HyenaDNA
HyenaDNA
HyenaDNA k-mer
HyenaDNA bidirection
DNABERT
Pretrained
no
yes
no
yes
no
no
yes
Mouse Enhancers
79.3
79.3
84.7
85.1
81.8
80.6
66.9
Coding vs Intergenomic
89.3
91.2
90.9
91.3
86.7
90.3
92.5
Human vs Worm
94.8
96.6
96.4
96.6
92.9
95.9
96.5
Human Enhancers Cohn
67.7
72.9
72.9
74.2
69.8
72.1
74.0
Human Enhancers Ensembl
79.0
88.3
85.7
89.2
88.0
85.9
85.7
Human Regulatory
90.2
91.8
90.4
93.8
90.2
89.1
88.1
Human Nontata Promoters
85.2
90.1
93.3
96.6
83.5
88.5
85.6
Human OCR Ensembl
68.3
79.9
78.8
80.9
70.2
75.3
75.1
+
+The bidirectional HyenaDNA was implemented by using a circular FFT convolution. This involved manipulating the padding on the input sequence before performing the FFT convolution. Previously, we zero padded the input on the right side by length $L$ (the sequence length). For bidirectionality, we pad by $1 / 2 \ L$ on the left and right side of the input, effectively providing a bidirectional receptive field (due to the circular convolution). This is one of many possible ways to implement a bidirectional version of Hyena.
+
+# A.2.3 Downstream prediction tasks for Nucleotide Transformer benchmark
+
+Following the Nucleotide Transformer [10], we collected datasets from four different sources [21, 35, 34, 46].
+
+Promoter The promoter dataset included TATA-box-containing and TATA-box-lacking promoters. Tasks involved predicting promoters with a TATA-box, identifying promoters lacking a TATAbox, and distinguishing between both promoter categories and non-promoter sequences. The promoter datasets were obtained from the Eukaryotic Promoter Database (EPDnew)4 for human and mouse genomes. Promoter sequences were extracted from regions 249 nucleotides upstream and 50 nucleotides downstream of the transcription start sites.
+
+Enhancer For the enhancer prediction task, we used the dataset from [21] containing DNA sequences classified into strong enhancers, weak enhancers, and non-enhancers. The tasks involved binary classification to distinguish enhancer sequences from non-enhancer sequences and identify specific enhancer types.
+
+Epigenetic Marks In the epigenetic marks prediction task, we used the dataset from [35, 36] to predict nucleosome occupancy and modification states in the yeast genome. In 10 binary classification tasks, the model had to discriminate between DNA regions that were occupied by histones or not. The 10 tasks varied based on the types of histones investigated, including unmodified histones H3 and H4, as well as histones modified by either acetylation (H3K9ac, H3K14ac) or methylation (H3K4me1, H3K4me2, H3K4me3, H3K36me3, H3K79me3).
+
+Splice Site For the splice site prediction task, DNA sequences from over 100 organisms were used to predict whether the sequences contain donor or acceptor splice sites [46]. Donor splice sites denote the beginning of an intron and acceptor splice sites the end of an intron. During RNA splicing, these sites are recognized by the spliceosome, a complex molecular machine that enables the removal of introns from the gene.
+
+Table A.5: Hyperparameter ranges used to fine-tune HyenaDNA for all Nucleotide transformer datasets. Exact hyperparameters per dataset can be found in our code repository.
+
+
HyenaDNA
Layers
2
Width
256
Parameters
1.6M
Optimizer
AdamW
Optimizer momentum
β1,β2= 0.9,0.999
Training epoch
100
Batch size
256-1024
Learning rate
2e-4 to 1e-3
LR scheduler
Cosine decay
Weight decay (model)
0-0.2
Weight decay (Hyena layers)
0
Embed dropout
0-0.2
Resid dropout
0-0.2
Reverse complement aug.
true/false
Sequence lengths
200-600
+
+Preprocessing The Nucleotide Transformer study did not provide their exact train-test splits, except for the enhancer dataset. Therefore, we generated our own train-test splits using a 90:10 ratio. For the promoter dataset, negative samples were not available, and had to be generated following the procedure described by [34].
+
+Model & Training For the architecture, we use a HyenaDNA model with 2 layers and width 256, and trained on sequences of length 1024. We average across the tokens to obtain a single classification token. For each task, we replaced the model head and fine-tuned the weights of the entire model (1.6M parameters). In contrast, the Nucleotide Transformer uses a parameter-efficient fine-tuning technique that introduces new weights and fine-tunes only the newly added weights, while keeping the initial model weights frozen, presumably due to its large size of 500M to 2.5B parameters. The corresponding HyenaDNA hyperparameter ranges used for training each task are reported in Table A.5.
+
+# A.2.4 Ablations on the Nucleotide Transformer benchmarks
+
+We perform additional ablations on the Nucleotide Transformer benchmarks to assess the impact of pretraining, as well as attention vs. HyenaDNA, as shown in shown in Table A.6. We observed that pretraining has a greater effect on the more challenging tasks (and as sequences become longer, shown in A.11). On the more challenging tasks (histone marks, datasets starting with “H”), pretraining boosts HyenaDNA metrics by up to 21 MCC points on H3K4me3. For simpler tasks (with higher baseline scores) such as the splice sites and promoter tasks, the gain was lower (0 to 1 accuracy points), as these were already near saturation in performance.
+
+# A.3 In-Context Learning Details
+
+Background A key premise of foundation models is that they are able to learn new tasks with little to no new training data [4]. Recent advances in language modeling have demonstrated that language foundation models can often adopt the behaviors necessary to perform new tasks in-context [6]. Here, information about the task that is to be performed, such as examples of respective inputs and targets, are added to the input of the model. By conditioning their prediction on the provided context, language foundation models are generally able to perform the task without any changes to their parameters.
+
+A key challenge for in-context learning with HyenaDNA is its limited vocabulary, which is composed of only a few nucleotides, and does not provide any vocabulary for novel downstream tasks, such as class labels. To explore the potential for in-context learning in genomics, we use two variants of in-context learning, both using a brief tuning phase to introduce HyenaDNA to the concept of classification with its existing vocabulary. As a test bed for this exploration, we use 5 datasets from the GenomicBenchmarks and a HyenaDNA pretrained on sequences of $1 6 0 \mathrm { k }$ length sequences.
+
+
MODEL PARAMS PRETRAIN
NT 2.5B
GPT 1.6M
HyenaDNA 1.6M
HyenaDNA 1.6M
Enhancer
yes 58.0
yes 59.3
yes 62.6
no 58.6
Enhancer types
47.4
51.9
55.7
48.4
H3
81.4
75.8
81.7
79.9
H3K4me1
55.9
38.7
57.1
43.4
H3K4me2
32.6
28.8
53.9
34.5
H3K4me3
42.1
28.3
61.2
40.2
H3K9ac
57.5
49.2
65.1
52.6
H3K14ac
55.0
41.6
66.3
48.0
H3K36me3
63.2
47.8
65.3
53.4
H3K79me3
64.2
58.9
71.6
59.7
H4
82.2
77.7
79.6
79.1
H4ac
50.1
36.4
63.7
43.5
Promoter all
97.4
96.3
96.5
96.1
Promoter non-TATA
97.7
96.6
96.6
96.5
Promoter TATA
96.4
96.6
96.7
96.1
99.0
97.6
96.6
96.6
Splice acceptor
98.4
98.1
97.3
96.5
Splice donor
98.3
98.0
97.9
97.3
Splice all
+
+In the first experiment, we apply a soft prompting approach [27] by adding a sequence of tuneable tokens to the input inself. In the second experiment, we explore a few-shot learning approach [6] to in-context learning by adding $k$ demonstrations (DNA sequence and its label) for each class of a dataset as input to the model. To indicate classes, we make use of HyenaDNA’s existing vocabulary by indicating classes with specific nucleotides. For binary classification, we indicate classes with the nucleotides "A" and "N", while additionally utilising nucleotide "G" for three-way classification. During model tuning, we thereby optimise the same next-nucleotide prediction loss as used during pretraining. See Table A.7 for an overview of the optimisation settings.
+
+
+Table A.6: Pretraining & Attention ablations on the Nucleotide Transformer (NT) benchmarks. The Matthews correlation coefficient (MCC) is used as the performance metric for the enhancer and epigenetic marks dataset, and the F1-score is used for the promoter and splice site dataset.
+Figure A.1: Few-shot prompting: HyenaDNA’s performance on new tasks generally improves with the number of tuning samples, but is less clear when isolating the number of $k$ -shot demonstrations. With less tuning samples, the number of $k$ -shot demonstrations do not improve performance. As tuning samples increase, the number of $k$ -shot demonstrations start to improve performance.
+
+Soft prompting details For each dataset, we prepend a sequence of $n$ (2 to 32k) learnable tokens $T _ { e } \in \overline { { \mathbb { R } ^ { n \times \bar { d } } } }$ , each of dimension $d$ , to the input sequences $X$ of the model: $\{ T _ { e } , X , S E P \}$ , where "SEP" indicates the separation token. We optimise these tuneable tokens for a maximum of 20 training epochs on the dataset’s training data while keeping all other model parameters fixed. We stop training early if the model’s validation loss does not improve for two epochs. After this tuning phase, we evaluate the model’s performance on the dataset’s full validation data. For an overview of the results of this experiment, see Fig. 4.2 of the main text.
+
+Few-shot prompting details For each dataset, we prepend a set of $k$ (0 to 32, 0 indicates regular fine-tuning) examples of each class of a dataset (so-called "shots") to an input sequence:
+
+$$
+X : \quad \{ X _ { 1 } , { \mathsf { S E P } } , Y _ { 1 } , { \mathsf { S E P } } , X _ { 2 } , { \mathsf { S E P } } , Y _ { 2 } , { \mathsf { S E P } } , X , { \mathsf { S E P } } \} ,
+$$
+
+where $X _ { i }$ indicates an example sequence of class $i$ with label $Y _ { i }$ (exemplified for a two-way classification task). We tune the model on $n$ (2 to 256) such $k$ -shot samples before evaluating its performance on the dataset’s full validation data. For an overview of the results of this experiment, see Fig. A.1.
+
+Table A.7: Optimization settings for in-context learning.
+
+
SOFT PROMPTING
FEW-SHOTPROMPTING
Optimizer
AdamW
AdamW
Optimizer momentum (β1, β2)
0.9, 0.999
0.9, 0.999
Learning Rate
0.001
0.0001
Batch Size
16
2
Weight Decay (model)
0
0
Weight Decay (Hyena layers)
0
0
Resid dropout
0
0
Embed dropout
0.1
0.1
Reverse complement aug.
true
false
LR-schedule
Plateau
1
+
+# A.4 Chromatin Profile Details
+
+Background Variations in non-coding regions of the genome account for the majority of disease and other trait-associated single-nucleotide polymorphisms (SNPs). For example, whilst not directly altering the sequence of an encoded protein, a SNP in a non-coding region can affect the expression of downstream genes by inducing a change in the epigenetic state [56]. Therefore predicting epigenetic markers from a given sequence is an important task in the context of quantifying the functional effects of non-coding variants. Previously DeepSEA [57], a deep convolutional sequence model, has been introduced to predict chromatin features directly from non-coding sequences.
+
+Data The authors of DeepSEA [57] compiled a dataset of 919 chromatin features from [15] and [42] including 690 TF binding profiles for 160 different TFs, 125 DHS and $1 0 4 \mathrm { H M }$ profiles. The original DeepSEA dataset consists of 1000 base pair (bp) sequences from the $\mathrm { h g } 1 9$ human reference genome [8] with corresponding 919-dimension multi-label target vectors. Each label corresponds to the presence/absence of a peak in a given chromatin feature within the central 200 bp region of the sequence. The 400 bp flanking regions of the sequence provide broader contextual information which is beneficial to the task. Training and testing sets are split by chromosome and are strictly non-overlapping. In total, there are $2 . 2 \mathbf { M }$ training samples and 227,512 samples from chromosomes 8 and 9 are held-out for testing. We use the DeepSEA chromatin profile prediction task to evaluate HyenaDNA models with varying context window. We use LiftOver [26] to convert the original DeepSEA dataset to $\mathrm { h g } 3 8$ coordinates and expand flanking regions about the central 200 bp bin symmetrically up to 8000 bp. Approximately $0 . 5 \%$ of samples are filtered in cases where LiftOver fails or the resulting translated sequence has a different length.
+
+Model We fine-tune several models consisting of a pretrained HyenaDNA encoder, a sequencelevel pooling layer and a fully-connected decoder to perform multilabel sequence classification. We compare HyenaDNA against benchmarks set by DeepSEA, a convolutional sequence model, and BigBird [55], a sparse attention based language model. The authors of BigBird fine-tune on the DeepSEA dataset with input sequences extended to 8000 bp (asymmetrically about the centerpoint by -5000 and $+ 3 0 0 0$ bp). Notably BigBird utilizes a byte-pair encoding tokenization scheme whereas HyenaDNA uses a single-character tokenizer and DeepSEA uses one-hot encodings. For the shortest range model (1k), we average across all tokens to perform sequence-level pooling. Whereas in the longer context model $( 8 \mathbf { k } )$ we find that extracting the last token in the sequence as the input to the fully-connected decoder performs better. We also find that for the longer context model using an encoder pretrained on sequences larger than those used in fine-tuning was beneficial. The hyperparameters of the models used in these experiments are shown in Table A.8. Note that we reduced the depth and of models with increasing context window due to limitations on compute cost/time.
+
+Results The performance of the fine-tuned HyenaDNA models are summarised in Table 4.3. We find that the smallest sequence length model (1024 bp) outperforms both DeepSEA and BigBird on TF and DHS prediction. We find that the model pretrained on 32k sequences with only 4 layers and fine-tuned on $^ \mathrm { 8 k }$ sequences outperforms BigBird on the long range HM task but suffers from degraded performance on the short range tasks. However, we postulate that this performance loss may be recovered by increasing the depth of the model. We also remark that our models contain $5 { - } 3 0 \times$ fewer parameters compared to DeepSEA and BigBird.
+
+Table A.8: Chromatin profile model settings. HyenaDNA hyperparameter settings used in the chromatin profile prediction experiments (fine-tuning).
+
+
HyenaDNA
Sequence length
1024
8k
Context window
1024
32770
Width
256
256
Layers
8
4
Pooling method
Average
Last token
Parameters (M)
6.6
3.5
Optimizer
AdamW
AdamW
Optimizer momentum
β1,β2 = 0.9,0.999
β1,β2=0.9,0.999
Weight decay (model)
0.1
0.1
Weight decay (Hyena layers)
0
0
Embed dropout
0.1
0.1
Learning rate
6e-4
6e-4
Batch size
64
64
Epochs
50
50
+
+# A.5 Biotype Embeddings Analysis Details
+
+Background Sequence embeddings are useful in reducing dimensionality and capturing semantic relationships into fixed length vectors. We analyze pretrained embedding quality from HyenaDNA and show that it learns biologically informed features. We utilize linear probing, freezing the weights on a pretrained model and attaching a linear classification head to predict biotype sequences. We also use t-SNE to visualize clusterings that emerge from the embeddings.
+
+Data The Ensembl database [9] is a comprehensive resource for gene and transcript annotations such as biotypes. Ensembl biotypes are a classification system, based on a combination of experimental evidence and computational predictions, that summarises the high-level functional properties of genes and transcripts. For example, biotype classes may annotate whether a gene is protein-coding or encodes a long non-coding RNA; if a gene is a disrupted homologue of a known protein coding gene (pseudogene) and by what mechanism it is produced; or the role of a small non-coding RNA such as post-transcriptional modification of other RNAs in the cell nucleus. We use biotype annotations to qualitatively visualize the clustering of gene embeddings into functional groups. We construct a multi-classification task using the top 10 most frequent biotype annotations as multi-class target labels which we predict from the unsupervised embeddings to assess how well biological function is encoded in the embedding space.
+
+Model & Training We use a frozen pretrained HyenaDNA model consisting of 8 layers and width 256 pretrained on sequences of length 160k. To extract sequence-level embeddings, we average along the sequence dimension in the final encoder layer. For comparison we also construct embeddings using DNABERT (5-mer) and Nucleotide Transformer. We construct embeddings for genes in the Ensembl dataset up to a length of 160k. For genes with sequence lengths exceeding the context window of the encoder, we chunk the sequence and average the embeddings over the chunks. We utilize an XGBoost [7] classifier to perform the supervised multi-classification task on the embeddings. The hyperparameters used are shown in Table A.9.
+
+Table A.9: Hyperparameters. Overview of XGBoost hyperparameters used in biotype multiclassifier.
+
+
Estimators Max depth
1000
Learning rate
3 0.1
Objective
softmax
+
+Results As shown in 4.4, HyenaDNA achieves the highest F1 score on the biotype classification task indicating that its embeddings contain features that are informative of biological function. Notably, HyenaDNA achieves this using the much smaller embedding space dimension of 256, compared to DNABERT and Nucleotide Transformer, which produce embeddings of dimension 1029 and 1280, respectively.
+
+# A.6 Long-range Species Classification Details
+
+Table A.10: Hyperparameter ranges for ultra-long range species classification task. Transformer uses FlashAttention [11].
+
+
TRANSFORMER
HyenaDNA
Layers
2
2
2
2
8
8
Sequence length
1024
32768
1024
32768
250000
450000
Width
128
128
128
128
256
256
Parameters (M)
0.5
4.5
0.4
0.4
6.6
6.6
Num heads
8
8
Learning rate
6e-5
6e-4
- 6e-5
= 3e-4
1 6e-5
1 6e-4
Optimizer
AdamW
Optimizer momentum
β1,β = 0.9,0.999
LR scheduler
Cosine decay
Weight decay (model)
0.1
Weight decay (Hyena layers)
0
Embed dropout
0.1
Resid dropout
0
Batch size
128 - 256
Training epoch
200
Reverse complement aug.
False
+
+Background Given a genetic sequence randomly sampled from a set of different species, successful identification of the source species requires a model to learn a distinct mutational profile for each species. The more locations for discriminative mutations a model can consider, the more successful it should be at this task. We can arbitrarily tune this task’s difficulty by including a higher number of species or increasing the evolutionary similarity of the included species, and thus it represents a helpful setting for measuring long context reasoning abilities for DNA sequence models.
+
+Data We select five species for this task: human (homo sapien), lemur (lemur catta), mouse (mus musculus), pig (sus scrofa), and hippo (hippopotamus amphibius). We hold out four chromosomes from each species (chromosome numbers 1, 3, 12, and 13) for evaluation, and use the rest of each species’ chromosomes for training.
+
+Model We compare HyenaDNA against a baseline Transformer, which uses Flash Attention [11] in the mixing layer instead of a Hyena operator. We use 2 and 8 layer models, depending on sequence length. For HyenaDNA, we train on sequence lengths of 1k, 32k, 250k, 450k and 1M. For
+
+Transformer, we limit sequence lengths to 1k and $3 2 \mathrm { k }$ due to the quadratic increase in training time, making training infeasible on our hardware. See Table A.10 for model sizes and hyperparamters.
+
+Training We use pretrained models from 4.1, trained on various lengths between 1k to 1M nucleotides, and fine-tune them using a linear decoder head. We either pool across all tokens (1k and $3 2 \mathrm { k }$ models) or use the last token for classification ( $2 5 0 \mathbf { k } \mathrm { ~ - ~ } 1 \mathbf { M }$ models). We randomly sample a (species, chromosome, sequence start, sequence end) tuple at each training step, with uniform probability across all species and non-held-out chromosomes. If a sequence’s starting location on a chromosome is such that the end of that sequence would exceed the length of the chromosome, then we pad the sequence with N’s to its full intended length. For evaluation, we randomly sample a (species, chromosome, sequence start, sequence end) tuple from our held-out evaluation set of chromosomes, and record the overall Top-1 5-way accuracy of our model (i.e. fraction of sequences correctly classified).
+
+At sequence length $4 5 0 \mathrm { k }$ , we use the sequence length warm-up scheduler described in 3.2 on HyenaDNA. This involves gradually increasing the length of sequences fed to the model during fine-tuning from 1k to 450k. We observe better convergence and higher overall peak accuracy with this strategy, as shown in 3.2.
+
+Table A.11: Pretraining vs scratch on 5-way species classification. Top $1 \%$ accuracy for HyenaDNA by sequence length.
+
+
HyenaDNA
LENGTH
SCRATCH PRETRAINED
1k
53.9 61.1
32k
70.7 93.4
250k
65.7 97.9
450k
71.4 99.4
+
+Pretraining ablation For species classification, pretraining becomes more important for longer sequences. This is in-line with our observation that for harder tasks (including longer sequences), pretraining becomes more important. At sequence length $2 5 0 \mathrm { k }$ and $4 5 0 \mathrm { k }$ , the scratch vs. pretraining gap is $^ { 3 0 + }$ accuracy points.
\ No newline at end of file
diff --git a/md/dev/ucASPPD9GKN/ucASPPD9GKN.md b/md/dev/ucASPPD9GKN/ucASPPD9GKN.md
new file mode 100644
index 0000000000000000000000000000000000000000..0ae71b63365325ba1b4d55b384602c6227783bae
--- /dev/null
+++ b/md/dev/ucASPPD9GKN/ucASPPD9GKN.md
@@ -0,0 +1,702 @@
+# IS HOMOPHILY A NECESSITY FOR GRAPH NEURAL NETWORKS?
+
+Yao Ma New Jersey Institute of Technology yao.ma@njit.edu
+
+Xiaorui Liu Michigan State University xiaorui@msu.edu
+
+Neil Shah
+Snap Inc.
+nshah@snap.com
+
+Jiliang Tang Michigan State University tangjili@msu.edu
+
+# ABSTRACT
+
+Graph neural networks (GNNs) have shown great prowess in learning representations suitable for numerous graph-based machine learning tasks. When applied to semi-supervised node classification, GNNs are widely believed to work well due to the homophily assumption (“like attracts like”), and fail to generalize to heterophilous graphs where dissimilar nodes connect. Recent works have designed new architectures to overcome such heterophily-related limitations. However, we empirically find that standard graph convolutional networks (GCNs) can actually achieve strong performance on some commonly used heterophilous graphs. This motivates us to reconsider whether homophily is truly necessary for good GNN performance. We find that this claim is not quite accurate, and certain types of “good” heterophily exist, under which GCNs can achieve strong performance. Our work carefully characterizes the implications of different heterophily conditions, and provides supporting theoretical understanding and empirical observations. Finally, we examine existing heterophilous graphs benchmarks and reconcile how the GCN (under)performs on them based on this understanding.
+
+# 1 INTRODUCTION
+
+Graph neural networks (GNNs) are a prominent approach for learning representations for graph structured data. Thanks to their great capacity in jointly leveraging attribute and graph structure information, they have been widely adopted to promote improvements for numerous graph-related learning tasks (Kipf and Welling, 2016; Hamilton et al., 2017; Ying et al., 2018; Fan et al., 2019; Zitnik et al., 2018), especially centered around node representation learning and semi-supervised node classification (SSNC). GNNs learn node representations by a recursive neighborhood aggregation process, where each node aggregates and transforms features from its neighbors. The node representations can then be utilized for downstream node classification or regression tasks. Due to this neighborhood aggregation mechanism, several existing works posit that many GNNs implicitly assume strong homophily and homophily is critical for GNNs to achieve strong performance on SSNC (Zhu et al., 2020b;a; Chien et al., 2021;
+
+
+Figure 1: A heterophilous graph on which GCN achieves perfect performance.
+
+Maurya et al., 2021; Halcrow et al., 2020; Lim et al., 2021). In general, homophily describes the phenomenon that nodes tend to connect with “similar” or “alike” others. Homophily is observed in a wide range of real-world graphs including friendship networks (McPherson et al., 2001), political networks (Gerber et al., 2013; Newman, 2018), citation networks (Ciotti et al., 2016) and more. Under the homophily assumption, through the aggregation process, a node’s representation is “smoothed” via its neighbors’ representations, since each node is able to receive additional information from neighboring nodes, which are likely to share the same label. Several recent works (Zhu et al., 2020b;a) claim that GNNs are implicitly (or explicitly) designed with homophily in mind, are not suitable for graphs exhibiting heterophily, where connected nodes are prone to have different properties or labels, e.g dating networks or molecular networks (Zhu et al., 2020b). Such works accordingly design and modify new architectures and demonstrate outperformance over other GNN models on several heterophilous graphs.
+
+Present work. In our work, we empirically find that the graph convolutional network (GCN) Kipf and Welling (2016), a fundamental, representative GNN model (which we focus on in this work) is actually able to outperform such heterophily-specific models on some heterophilous graphs after careful hyperparameter tuning. This motivates us to reconsider the popular notion in the literature that GNNs exhibit a homophilous inductive bias, and more specifically that strong homophily is crucial to strong GNN performance. Counter to this idea, we find that GCN model has the potential to work well for heterophilous graphs under suitable conditions. We demonstrate intuition with the following toy example: Consider the perfectly heterophilous graph (with all inter-class edges) shown in Figure 1, where the color indicates the node label. Blue-labeled and orange-labeled nodes are associated with the scalar feature 0 and 1, respectively. If we consider a single-layer GCN by performing an averaging feature aggregation over all neighboring nodes, it is clear that all blue nodes will have a representation of 1, while the orange nodes will have that of 0. Additional layers/aggregations will continue to alternate the features between the two types of nodes. Regardless of the number of layers, the two classes can still be perfectly separated. In this toy example, each blue (orange) node only connects orange (blue) nodes, and all blue (orange) nodes share similar neighborhood patterns in terms of their neighbors’ label/feature distributions.
+
+Our work elucidates this intuition and extends it to a more general case: put simply, given a (homophilous or heterophilous) graph, GCN has the potential to achieve good performance if nodes with the same label share similar neighborhood patterns. We theoretically support this argument by investigating the learned node embeddings from the GCN model. We find that homophilous graphs always satisfy such assumptions, which explains why GCN typically works well for them. On other hand, there exist both “good” and “bad” heterophily, and GCNs can actually achieve strong performance for “good” heterophily settings while they usually fail on “bad” heterophily settings. Our work characterizes these settings, and provides a new perspective and solid step towards deeper understanding for heterophilous graphs. In short:
+
+Our contributions. (1) We reveal that strong homophily is not a necessary assumption for the GCN model. The GCN model can perform well over some heterophilous graphs under certain conditions. (2) We carefully characterize these conditions and provide theoretical understandings on how GCNs can achieve good SSNC performance under these conditions by investigating their embedding learning process. (3) We carefully investigate commonly used homophilous and heterophilous benchmarks and reason about GCN’s performs on them utilizing our theoretical understanding.
+
+# 2 PRELIMINARIES
+
+Let $\mathcal { G } = \{ \nu , \varepsilon \}$ denote a graph, where $\nu$ and $\mathcal { E }$ are the sets of nodes and edges, respectively. The graph connection information can also be represented as an adjacency matrix $\mathbf { A } \in \{ 0 , 1 \} ^ { | \mathcal { V } | \times | \mathcal { V } | }$ , where $| \nu |$ is the number of nodes in the graph. The $i , j$ -th element of the adjacency matrix $\mathbf { A } [ i , j ]$ is equal to 1 if and only if nodes $i$ and $j$ are adjacent to each other, otherwise $\mathbf { A } [ i , j ] = 0$ . Each node $i$ is associated with a $l$ -dimensional vector of node features $\mathbf { x } _ { i } \in \mathbb { R } ^ { l }$ ; the features for all nodes can be summarized as a matrix $\mathbf { X } \in \mathbb { R } ^ { | \mathcal { V } | \times l }$ . Furthermore, each node $i$ is associated with a label $y _ { i } \in \mathcal { C }$ , where $\mathcal { C }$ denotes the set of labels. We also denote the set of nodes with a given label $c \in { \mathcal { C } }$ as $\mathcal { V } _ { c }$ . We assume that labels are only given for a subset of nodes $\nu _ { l a b e l } \subset \mathcal { V }$ . The goal of semi-supervised node classification (SSNC) is to learn a mapping $f : \mathcal { V } \to \mathcal { C }$ utilizing the graph $\mathcal { G }$ , the node features $\mathbf { X }$ and the labels for nodes in $\mathcal { V } _ { l a b e l }$ .
+
+# 2.1 HOMOPHILY IN GRAPHS
+
+In this work, we focus on investigating performance in the context of graph homophily and heterophily properties. Homophily in graphs is typically defined based on similarity between connected node pairs, where two nodes are considered similar if they share the same node label. The homophily ratio is defined based on this intuition following Zhu et al. (2020b).
+
+Definition 1 (Homophily). Given a graph $\mathcal { G } = \{ \nu , \varepsilon \}$ and node label vector $y$ , the edge homophily ratio is defined as the fraction of edges that connect nodes with the same labels. Formally, we have:
+
+$$
+h ( \mathcal { G } , \{ y _ { i } ; i \in \mathcal { V } \} ) = \frac { 1 } { \lvert \mathcal { E } \rvert } \sum _ { ( j , k ) \in \mathcal { E } } \mathbb { 1 } ( y _ { j } = y _ { k } ) ,
+$$
+
+where $| \mathcal { E } |$ is the number of edges in the graph and $\mathbb { 1 } ( \cdot )$ is the indicator function.
+
+A graph is typically considered to be highly homophilous when $h ( \cdot )$ is large (typically, $0 . 5 \leq h ( \cdot ) \leq$ 1), given suitable label context. On the other hand, a graph with a low edge homophily ratio is considered to be heterophilous. In future discourse, we write $h ( \cdot )$ as $h$ when discussing given a fixed graph and label context.
+
+# 2.2 GRAPH NEURAL NETWORKS
+
+Graph neural networks learn node representations by aggregating and transforming information over the graph structure. There are different designs and architectures for the aggregation and transformation, which leads to different graph neural network models (Scarselli et al., 2008; Kipf and Welling, 2016; Hamilton et al., 2017; Velickovi ˇ c et al. ´ , 2017; Gilmer et al., 2017; Zhou et al., 2020).
+
+One of the most popular and widely adopted GNN models is the graph convolutional network (GCN). A single GCN operation takes the following form $\mathbf { H } ^ { \prime } = \mathbf { D } ^ { - 1 } \mathbf { \dot { A } H } \mathbf { W }$ , where $\mathbf { H }$ and $\mathbf { H } ^ { \prime }$ denote the input and output features of layer, $\mathbf { W } ^ { ( k ) } \in \mathbb { R } ^ { l \times l }$ is a parameter matrix to transform the features, and $\mathbf { D }$ is a diagonal matrix and $\mathbf { D } [ i , i ] = d e g ( i )$ with $\bar { d e g } ( i )$ denoting the degree of node $i$ . From a local perspective for node $i$ , the process can be written as a feature averaging process $\begin{array} { r } { \mathbf h _ { i } = \frac { 1 } { d e g ( i ) } \sum _ { j \in \mathcal N ( i ) } \mathbf W \mathbf x _ { j } } \end{array}$ , where $\mathcal { N } ( i )$ denotes the neighbors of node $i$ . The neighborhood $\mathcal { N } ( i )$ may contain the node $i$ itself. Usually, when building GCN model upon GCN operations, nonlinear activation functions are added between consecutive GCN operations.
+
+# 3 GRAPH CONVOLUTIONAL NETWORKS UNDER HETEROPHILY
+
+Considerable prior literature posits that graph neural networks (such as GCN) work by assuming and exploiting homophily assumptions in the underlying graph (Maurya et al., 2021; Halcrow et al. 2020; Wu et al., 2018). To this end, researchers have determined that such models are considered to be ill-suited for heterophilous graphs, where the homophily ratio is low (Zhu et al., 2020b;a; Chien et al., 2021). To deal with this limitation, researchers proposed several methods including H2GNN (Zhu et al., 2020b), CPGNN (Zhu et al., 2020a) and GPRGNN (Chien et al., 2021), which are explicitly designed to handle heterophilous graphs via architectural choices (e.g. adding skipconnections, carefully choosing aggregators, etc.)
+
+In this section, we revisit the claim that GCNs have fundamental homophily assumptions and are not suited for heterophilous graphs. To this end, we first observe empirically that the GCN model achieves fairly good performance on some of the commonly used heterophilous graphs; specifically, we present SSNC performance on two commonly used heterophilous graph datasets, Chameleon and Squirrel in Table 1 (see Appendix D for further details about the datasets and models). Both Chameleon and Squirrel are highly heterophilous $( h { \approx } 0 . 2 )$ . We find that with some hyperparameter tuning, GCN can outperform alternative methods uniquely designed to operate on some certain heterophilous graphs. This observation suggests that GCN does not always “underperform” on heterophilous graphs, and it leads us to reconsider the prevalent assumption in literature. Hence, we next examine how GCNs learn representations, and how this information is used in downstream SSNC tasks.
+
+Table 1: SSNC accuracy on two heterophilous datasets.
+
+
Method
Chameleon (h=0.23)
Squirrel (h= 0.22)
GCN
67.96 ± 1.82
54.47 ± 1.17
H2GCN-1
57.11 ± 1.58
36.42 ±1.89
H2GCN-2
59.39 ± 1.98
37.90 ± 2.02
CPGNN-MLP
54.53 ± 2.37
29.13 ±1.57
CPGNN-Cheby
65.17 ± 3.17
29.25 ± 4.17
GPRGNN
66.31 ± 2.05
50.56 ± 1.51
MLP
48.11 ± 2.23
31.68 ± 1.90
+
+# 3.1 WHEN DOES GCN LEARN SIMILAR EMBEDDINGS FOR NODES WITH THE SAME LABEL?
+
+GCN is considered to be unable to tackle heterophilous graphs due to its feature averaging process (Zhu et al., 2020b; Chien et al., 2021). Namely, a node’s newly aggregated features are considered “corrupted” by those neighbors that do not share the same label, leading to the intuition that GCN embeddings are noisy and un-ideal for SSNC. However, we find that crucially, for some heterophilous graphs, the features of nodes with the same label are “corrupted in the same way.” Hence, the obtained embeddings still contain informative characteristics and thus facilitate SSNC. We next illustrate when GCN learns similar embeddings for nodes with the same label, beginning with a toy example and generalizing to more practical cases.
+
+GCNs have been shown to be able to capture the local graph topological and structural information (Xu et al., 2019; Morris et al., 2019). Specifically, the aggregation step in the GCN model is able to capture and discriminate neighborhood distribution information, e.g. the mean of the neighborhood features (Xu et al., 2019). Let us consider the two nodes $a$ and $b$ shown in Figure 2, where we use color to indicate the label of each node. If we further assume that all nodes sharing the same label are associated with exactly the same features, then clearly, after 1-step aggregation, the GCN operation will output exactly the same embedding for nodes $a$ and $b$ . Accordingly, Xu et al. (2019) reasons that the GCN model lacks expressiveness due to its inability to differentiate the two nodes in the embedding space. However, in the SSNC task, mapping $a$ and $b$ to the same location in the embedding space is explicitly desirable. Intuitively, if all nodes with the same label are mapped to the same embedding and embeddings for different labels are distinct, SSNC is effortless (Zhao et al., 2020).
+
+
+Figure 2: Two nodes share the same neighborhood distribution; GCN learns equivalent embeddings for $a$ and $b$ .
+
+Such assumptions are hard to meet in practice. Thus, to consider a more practical scenario, we assume that both features and neighborhood patterns for nodes with a certain label are sampled from some fixed distributions. Under these conditions, same-label nodes may not share fixed embeddings, but we can aim to characterize their closeness. Intuitively, if the learned embeddings for same-label nodes are close and embeddings for other-label nodes are far, we expect strong SSNC performance to be good, given class separability (low intra-class variance and high inter-class variance) (Fisher, 1936). We prove that, for graphs meeting suitable conditions the distance between GCN-learned embeddings of any same-label node pair is bounded by a small quantity with high probability.
+
+Assumptions on Graphs. We consider a graph $\mathcal { G }$ , where each node $i$ has features $\mathbf { x } _ { i } \in \mathbb { R } ^ { l }$ and label $y _ { i }$ . We assume that (1) The features of node $i$ are sampled from feature distribution $\mathcal { F } _ { y _ { i } }$ , i.e, $\mathbf { x } _ { i } \sim \mathcal { F } _ { y _ { i } }$ , with $\mu ( \mathcal { F } _ { y _ { i } } )$ denoting its mean; (2) Dimensions of $\mathbf { x } _ { i }$ are independent to each other; (3) The features in $\mathbf { X }$ are bounded by a positive scalar $B$ , i.e, $\operatorname* { m a x } _ { i , j } | { \bf X } [ i , \bar { j } ] | \leq B$ ; (4) For node $i$ , its neighbor’s labels are independently sampled from neighbor distribution $\mathcal { D } _ { y _ { i } }$ . The sampling is repeated for $d e g ( i )$ times to sample the labels for $d e g ( i )$ neighbors.
+
+We denote a graph following these assumptions (1)-(4) as ${ \mathcal { G } } = \{ \mathcal { V } , \mathcal { E } , \{ \mathcal { F } _ { c } , c \in \mathcal { C } \} , \{ \mathcal { D } _ { c } , c \in \mathcal { C } \} \}$ . Note that we use the subscripts in $\mathcal { F } _ { y _ { i } }$ and $\mathcal { D } _ { y _ { i } }$ to indicate that these two distributions are shared by all nodes with the same label as node $i$ . Next, we analyze the embeddings obtained after a GCN operation. Following previous works (Li et al., 2018; Chen et al., 2020; Baranwal et al., 2021), we drop the non-linearity in the analysis.
+
+Theorem 1. Consider a graph ${ \mathcal G } \_ = \{ \mathcal { V } , \mathcal { E } , \{ \mathcal { F } _ { c } , c \in \mathcal { C } \} , \{ \mathcal { D } _ { c } , c \in \mathcal { C } \} \}$ , which follows Assumptions $( l )$ -(4). For any node $\bar { i } \in \mathcal { V }$ , the expectation of the pre-activation output of a single GCN operation is given by
+
+$$
+\mathbb { E } [ \mathbf { h } _ { i } ] = \mathbf { W } \left( \mathbb { E } _ { c \sim \mathcal { D } _ { y _ { i } } , \mathbf { x } \sim \mathcal { F } _ { c } } [ \mathbf { x } ] \right) .
+$$
+
+and for any $t > 0$ , the probability that the distance between the observation $\mathbf { h } _ { i }$ and its expectation is larger than $t$ is bounded by
+
+$$
+\mathbb { P } \left( \| \mathbf { h } _ { i } - \mathbb { E } [ \mathbf { h } _ { i } ] \| _ { 2 } \geq t \right) \leq 2 \cdot l \cdot \exp \left( - \frac { d e g ( i ) t ^ { 2 } } { 2 \rho ^ { 2 } ( \mathbf { W } ) B ^ { 2 } l } \right) ,
+$$
+
+where l denotes the feature dimensionality and $\rho ( \mathbf { W } )$ denotes the largest singular value of W.
+
+The detailed proof can be found in Appendix A. Theorem 1 demonstrates two key ideas. First, in expectation, all nodes with the same label have the same embedding (Eq. (2)). Second, the distance between the output embedding of a node and its expectation is small with a high probability. Specifically, this probability is related to the node degree and higher degree nodes have higher probability to be close to the expectation. Together, these results show that the GCN model is able to map nodes with the same label to an area centered around the expectation in the embedding space under given assumptions. Then, the downstream classifier in the GCN model is able to assign these nodes to the same class with high probability. To ensure that the classifier achieves strong performance, the centers (or the expectations) of different classes must be distant from each other; if we assume that $\mu ( \mathcal { F } _ { y _ { i } } )$ are distinct from each other (as is common), then the neighbor distributions $\{ \mathcal { D } _ { c } , c \in \mathcal { C } \}$ must be distinguishable to ensure good SSNC performance. Based on these understandings and discussions, we have the following key (informal) observations on GCN’s performance for graphs with homophily and heterophily.
+
+Observation 1 (GCN under Homophily). In homophilous graphs, the neighborhood distribution of nodes with the same label (w.l.o.g c) can be approximately regarded as a highly skewed discrete $\mathcal { D } _ { c }$ , with most of the mass concentrated on the category c. Thus, different labels clearly have distinct distributions. Hence, the GCN model typically in SSNC on such graph, with high degree nodes benefiting more, which is consistent with previous work (Tang et al., 2020b).
+
+Observation 2 (GCN under Heterophily). In heterophilous graphs, if the neighborhood distribution of nodes with the same label (w.l.o.g. c) is (approximately) sampled from a fixed distribution $\mathcal { D } _ { c }$ , and different labels have distinguishable distributions, then GCN can excel at SSNC, especially when node degrees are large. Otherwise, GCNs may fail for heterophilous graphs.
+
+Notably, our findings illustrate that disruptions of certain conditions inhibit GCN performance on heterophilous graphs, but heterophily is not a sufficient condition for poor GCN performance. GCNs are able to achieve reasonable performance for both homophilous and heterophilous graphs if they follow certain assumptions as discussed in the two observations. In Section 3.2, we theoretically demonstrate these observations for graphs sampled from the Contextual Stochastic Block Model (CSBM) (Deshpande et al., 2018) with two classes, whose distinguishablilty of neighborhood distributions can be explicitly characterized. Furthermore, in Section 3.3, we empirically demonstrate these observations on graphs with multiple classes. We note that although our derivations are for GCN, a similar line of analysis can be used for more general message-passing neural networks.
+
+# 3.2 ANALYSIS BASED ON CSBM MODEL WITH TWO CLASSES
+
+The CSBM model. To clearly control assumptions, we study the contextual stochastic block model(CSBM), a generative model for random graphs; such models have been previously adopted for benchmarking graph clustering (Fortunato and Hric, 2016) and GNNs (Tsitsulin et al., 2021). Specifically, we consider a CSBM model consisting of two classes $c _ { 1 }$ and $c _ { 2 }$ . In this case, the nodes in the generated graphs consist of two disjoint sets $\mathcal { C } _ { 1 }$ and $\mathcal { C } _ { 2 }$ corresponding to the two classes, respectively. Edges are generated according to an intra-class probability $p$ and an inter-class probability $q$ . Specifically, any two nodes in the graph, are connected by an edge with probability $p$ , if they are from the same class, otherwise, the probability is $q$ . For each node $i$ , its initial features $\mathbf { \bar { x } } _ { i } \in \mathbb { R } ^ { l }$ are sampled from a Gaussian distribution $\mathbf { x } _ { i } \sim N ( \pmb { \mu } , \mathbf { I } )$ , where $\pmb { \mu } = \pmb { \mu _ { k } } \in \mathbb { R } ^ { l }$ for $i \in \mathcal { C } _ { k }$ with $k \in \{ 1 , 2 \}$ and $\mu _ { 1 } \neq \mu _ { 2 }$ . We denote a graph generated from such an CSBM model as $\mathcal { G } \sim \mathrm { C S B M } ( \mu _ { 1 } , \mu _ { 2 } , p , q )$ . We denote the features for node $i$ obtained after a GCN operation as $\mathbf { h } _ { i }$ .
+
+Linear separability under GCN. To better evaluate the effectiveness of GCN operation, we study the linear classifiers with the largest margin based on $\{ \mathbf { x } _ { i } , i \in \mathcal { V } \}$ and $\{ \mathbf { h } _ { i } , i \in \mathcal { V } \}$ and compare their performance. Since the analysis is based on linear classifiers, we do not consider the linear transformation in the GCN operation as it can be absorbed in the linear model, i.e, we only consider the process $\begin{array} { r } { \mathbf { h } _ { i } = \frac { 1 } { d e g ( i ) } \sum _ { j \in \mathcal { N } ( i ) } \mathbf { x } _ { j } } \end{array}$ . For a graph $\mathcal { G } \sim \mathrm { C S B M } ( \mu _ { 1 } , \mu _ { 2 } , p , q )$ , we can approximately regard that for each node $i$ , its neighbor’s labels are independently sampled from a neighborhood distribution $\mathcal { D } _ { y _ { i } }$ , where $y _ { i }$ denotes the label of node $i$ . Specifically, the neighborhood distributions corresponding to $c _ { 1 }$ and $c _ { 2 }$ are $\begin{array} { r } { \mathcal { D } _ { c _ { 1 } } = [ \frac { p } { p + q } , \frac { q } { p + q } ] } \end{array}$ and $\begin{array} { r } { \bar { \mathcal { D } } _ { c _ { 2 } } ^ { \mathrm { ~ ~ } } = [ \frac { q } { p + q } , \frac { p } { p + q } ] } \end{array}$ [ qp+q , pp+q ], respectively.
+
+Based on the neighborhood distributions, the features obtained from GCN operation follow Gaussian distributions:
+
+$$
+\mathbf { h } _ { i } \sim N \left( \frac { p \mu _ { 1 } + q \mu _ { 2 } } { p + q } , \frac { \mathbf { I } } { \sqrt { d e g ( i ) } } \right) , \mathbf { f o r } \ i \in \mathcal { C } _ { 1 } ; \ \mathrm { a n d } \ \mathbf { h } _ { i } \sim N \left( \frac { q \mu _ { 1 } + p \mu _ { 2 } } { p + q } , \frac { \mathbf { I } } { \sqrt { d e g ( i ) } } \right) , \mathbf { f o r } \ i \in \mathcal { C } _ { 2 } .
+$$
+
+Based on the properties of Gaussian distributions, it is easy to see that Theorem 1 holds. We denote the expectation of the original features for nodes in the two classes as $\mathbb { E } _ { c _ { 1 } } [ { \bf x } _ { i } ]$ and $\mathbb { E } _ { c _ { 2 } } [ \mathbf { x } _ { i } ]$ . Similarly, we denote the expectation of the features obtained from GCN operation as $\mathbb { E } _ { c _ { 1 } } [ { \bf h } _ { i } ]$ and $\bar { \mathbb { E } } _ { c _ { 2 } } [ { \bf h } _ { i } ]$ . The following proposition describes their relations.
+
+Proposition 1. $( \mathbb { E } _ { c _ { 1 } } [ { \bf x } _ { i } ] , \mathbb { E } _ { c _ { 2 } } [ { \bf x } _ { i } ] )$ and $( \mathbb { E } _ { c _ { 1 } } [ { \bf h } _ { i } ] , \mathbb { E } _ { c _ { 2 } } [ { \bf h } _ { i } ] )$ share the same middle point. $\mathbb { E } _ { c _ { 1 } } \big [ { \bf x } _ { i } \big ] -$ $\mathbb { E } _ { c _ { 2 } } [ { \bf x } _ { i } ]$ and $\mathbb { E } _ { c _ { 1 } } [ { \bf h } _ { i } ] - \mathbb { E } _ { c _ { 2 } } [ { \bf h } _ { i } ]$ share the same direction. Specifically, the middle point m and the shared direction w are as follows: ${ \bf m } = ( \pmb { \mu } _ { 1 } + \pmb { \mu } _ { 2 } ) / 2$ , and $\mathbf { w } = ( \pmb { \mu } _ { 1 } - \pmb { \mu } _ { 2 } ) / \| \pmb { \mu } _ { 1 } - \pmb { \mu } _ { 2 } \| _ { 2 }$ .
+
+This proposition follows from direct calculations. Given that the feature distributions of these two classes are systematic to each other (for both $\mathbf { x } _ { i }$ and $\mathbf { h } _ { i }$ ), the hyperplane that is orthogonal to w and goes through $\mathbf { m }$ defines the decision boundary of the optimal linear classifier for both types of features. We denote this decision boundary as $\mathcal { P } \overset { \cdot } { = } \{ { \mathbf x } | { \mathbf w } ^ { \top } \overset { - } { \mathbf x } - { \mathbf w } ^ { \top } ( \pmb { \mu } _ { 1 } + \pmb { \mu } _ { 2 } ) / 2 \}$ .
+
+Next, to evaluate how GCN operation affects the classification performance, we compare the probability that this linear classifier misclassifies a certain node based on the features before and after the GCN operation. We summarize the results in the following theorem.
+
+Theorem 2. Consider a graph $\mathcal { G } \sim C S B M ( \mu _ { 1 } , \mu _ { 2 } , p , q )$ . For any node $i$ in this graph, the linear classifier defined by the decision boundary $\mathcal { P }$ has a lower probability to misclassify $\mathbf { h } _ { i }$ than $\mathbf { x } _ { i }$ when $d e g ( \dot { i } ) > ( \dot { p } + q ) ^ { 2 } \big / ( p - q ) ^ { 2 }$ .
+
+The detailed proof can be found in Appendix B. Note that the Euclidean distance between the two discrete neighborhood distributions $\mathcal { D } _ { c _ { 0 } }$ and $\mathcal { D } _ { c _ { 1 } }$ is ${ \sqrt { 2 } } { \frac { | p - q | } { ( p + q ) } }$ Hence, Theorem 2 demonstrates that the node degree $d e g ( i )$ and the distinguishability (measured by the Euclidean distance) of the neighborhood distributions both affect GCN’s performance. Specifically, we can make the following conclusions: (1) When $p$ and $q$ are fixed, the GCN operation is more likely to improve the linear separability of the high-degree nodes than low-degree nodes, which is consistent with observations in (Tang et al., 2020b). (2) The more distinguishable the neighborhood distributions are (or the larger the Euclidean distance is), the more nodes can be benefited from the GCN operation. For example, when $p = 9 q$ or $9 p = q$ , $( p + q ) ^ { 2 } / ( p - q ) ^ { 2 } \approx 1 . 2 3$ , thus nodes with degree larger than 1 can benefit from the GCN operation. These two cases correspond to extremely homophily $h = 0 . 9 )$ and extremely heterophily $( h = 0 . 1$ ), respectively. However, GCN model behaves similarly on these two cases and is able to improve the performance for most nodes. This clearly demonstrates that heterophily is not a sufficient condition for poor GCN performance. Likewise, when $p { \approx } q$ , the two neighborhood distributions are hardly distinguishable, and only nodes with extremely large degrees can benefit. In the extreme case, where $p = q$ , the GCN operation cannot help any nodes at all. Note that Theorem 2 and the followed analysis can be extended to a multi-class CSBM scenario as well – see Appendix F for an intuitive explanation and proof sketch.
+
+
+Figure 3: SSNC accuracy of GCN on synthetic graphs with various homophily ratios.
+
+# 3.3 EMPIRICAL INVESTIGATIONS ON GRAPHS WITH MULTIPLE CLASSES
+
+We conduct experiments to substantiate our claims in Observations 1 and 2 in graphs with multiple classes. We evaluate how SSNC performance changes as we make a homophilous graph more and more heterophilous under two settings: (1) different labels have distinct distributions, and (2) different labels’ distributions are muddled.
+
+# 3.3.1 TARGETED HETEROPHILOUS EDGE ADDITION
+
+Graph generation strategy. We start with common, realworld benchmark graphs, and modify their topology by adding synthetic, cross-label edges that connect nodes with different labels. Following our discussion in Observation 2, we construct synthetic graphs that have similar neighborhood distributions for same-label nodes. Specif
+
+Alg. 1: Hetero. Edge Addition
+input : G = {V , E }, K, {Dc}|C|−1c=0
+output: and {Vc}|C|−1c=0
+Initialize $\mathcal { G } ^ { \prime } = \mathrm { \bar { \{ } } \mathcal { V } , \mathcal E \}$ , $k = 1$ ;
+while $1 \leq k \leq K$ do Sample node $i \sim$ Uniform $( \nu )$ ; Obtain the label, $y _ { i }$ of node $i$ ; Sample a label $c \sim \mathcal { D } _ { y _ { i } }$ ; Sample node $j \sim$ Uniform $( \mathcal { V } _ { c } )$ ; Update edge set $\mathcal { E } ^ { \prime } = \mathcal { E } ^ { \prime } \cup \{ ( i , j ) \}$ ; $k \bar { } k + \bar { 1 }$ ;
+return G0 = {V , E 0}
+
+ically, given a real-world graph $\mathcal { G }$ , we first define a discrete neighborhood target distribution $\mathcal { D } _ { c }$ for each label $c \in { \mathcal { C } }$ . We then follow these target distributions to add cross-label edges. The process of generating new graphs by adding edges to $\mathcal { G }$ is shown in Algorithm 1. Specifically, we add a total $K$ edges to the given graph $\mathcal { G }$ : to add each edge, we first uniformly sample a node $i$ from $\nu$ with label $y _ { i }$ , then we sample a label $c$ from $\mathcal { C }$ according to $\mathcal { D } _ { y _ { i } }$ , and finally, we uniformly sample a node $j$ from $\mathcal { V } _ { c }$ and add the edge $( i , j )$ to the graph. We generate synthetic graphs based on several real-world graphs. We present the results based on Cora and Citeseer (Sen et al., 2008). The results for other datasets can be found in Appendix C. Both Cora and Citeseer exhibit strong homophily. For both datasets, we fix $\mathcal { D } _ { c }$ for all labels. Although many suitable $\mathcal { D } _ { c }$ could be specified in line with Observation 2, we fix one set for illustration and brevity. For both datasets, we vary $K$ over 11 values and thus generate 11 graphs. Notably, as $K$ increases, the homophily $h$ decreases. More detailed information about the $\bar { \{ D _ { c } , c \in \mathcal { C } \} }$ and $K$ for both datasets is included in Appendix C.
+
+Observed results. Figure 3(a-b) show SSNC results (accuracy) on graphs generated based on Cora and Citeseer, respectively. The black line in both figures shows results for the presented setting (we introduce $\gamma$ in next subsection). Without loss of generality, we use Cora (a) to discuss our findings, since observations are similar over these datasets. Each point on the black line in Figure 3(a) represents the performance of GCN model on a certain generated graph and the corresponding value in $x$ -axis denotes the homophily ratio of this graph. The point with homophily ratio $h = 0 . 8 1$ denotes the original Cora graph, i.e, $K = 0$ . We observe that as $K$ increases, $h$ decreases, and while the classification performance first decreases, it eventually begins to increase, showing a $V$ -shape pattern. For instance, when $h = 0 . 2 5$ (a rather heterophilous graph), the GCN model achieves an impressive $8 6 \%$ accuracy, even higher than that achieved on the original Cora graph. We note that performance continues to increase as $K$ increases further to the right (we censor due to space limitations; see Appendix C for details). This clearly demonstrates that the GCN model can work well on heterophilous graphs under certain conditions. Intuitively, the $V$ -shape arises due to a “phase transition”, where the initial topology is overridden by added edges according to the associated $\mathcal { D } _ { c }$ target neighbor distributions. In the original graph, the homophily ratio is quite high $( h = 0 . 8 1 )$ , and classification behavior is akin to that discussed in Observation 1, where same-label nodes have similar neighborhood patterns. As we add edges to the graph, the originally evident neighborhood patterns are perturbed by added edges and gradually become less informative, which leads to the performance decrease in the decreasing segment of the $V$ -shape in Figure 3(a). Then, as we keep adding more edges, the neighborhood pattern gradually approaches $\mathcal { D } _ { c }$ for all $c$ , corresponding to the increasing segment of the $V$ -shape.
+
+
+Figure 4: Cross-class neighborhood similarity on synthetic graphs generated from Cora; all graphs have $h = 0 . 2 5$ , but with varying neighborhood distributions as per the noise parameter $\gamma$ .
+
+# 3.3.2 INTRODUCING NOISE TO NEIGHBORHOOD DISTRIBUTIONS
+
+Graph generation strategy. In Section 3.3.1, we showed that the GCN model can achieve reasonable performance on heterophilous graphs constructed following distinct, pre-defined neighborhood patterns. As per Observation 2, our theoretical understanding suggests that performance should degrade under heterophily if the distributions of different labels get more and more indistinguishable. Hence, we next demonstrate this empirically by introducing controllable noise levels into our edge addition strategy. We adopt a strategy similar to that described in Algorithm 1, but with the key difference being that we introduce an additional parameter $\gamma$ , which controls the probability that we add cross-label edges randomly rather than following the pre-defined distributions. A detailed description of this approach is demonstrated in Algorithm 2 in Appendix C. For nodes of a given class $c$ (w.l.o.g), compared to the edges added according to $\mathcal { D } _ { c }$ , the randomly added edges can be regarded as noise. Specifically, by increasing the noise parameter $\gamma$ , we increase the similarity between $\mathcal { D } _ { c } , \mathcal { D } _ { c ^ { \prime } }$ for any pair of labels $c , c ^ { \prime }$ . If $\gamma = 1$ , then all neighborhood distributions will be indistinguishable (they will all be approximately Uniform $( | { \mathcal { C } } | )$ . By fixing $K$ and varying $\gamma$ , we can generate graph variants with the same homophily ratio but different similarities between $\mathcal { D } _ { c }$ and $\bar { \mathcal { D } } _ { c ^ { \prime } }$ . As in Section 3.3.1, we create graphs by adding edges at various $K$ , but also vary $\gamma \in [ 0 , 1 ]$ in increments of 0.2 on both Cora and Citeseer.
+
+Observed results. We report the SSNC performance on these graphs in Figure 3. Firstly, we observe that noise affects the performance significantly when the homophily ratio is low. For example, observing Figure 3(a) vertically at homophily ratio $h \ : = \ : 0 . 2 5$ , higher $\gamma$ clearly results in worse performance. This indicates that not only the fixed-ness of the neighborhood distributions, but their similarities are important for the SSNC task (aligned with Observation 2. It also indicates that there are “good” and “bad” kinds of heterophily. On the other hand, high $\gamma$ does not too-negatively impact when $K$ is small, since noise is minimal and the original graph topology is yet largely homophilous. At this stage, both “good” (fixed and disparate patterns) and “bad” (randomly added edges) heterophilous edges introduce noise to the dominant homophilous patterns. When the noise level $\gamma$ is not too large, we can still observe the $V$ -shape: e.g. $\gamma = 0 . 4$ in Figure 3(a) and $\gamma = 0 . 2$ in Figure 3 (b); this is because the designed pattern is not totally dominated by the noise. However, when $\gamma$ is too high, adding edges will constantly decrease the performance, as nodes of different classes have indistinguishably similar neighborhoods.
+
+To further demonstrate how $\gamma$ affects the neighborhood distributions in the generated graph, we examine the cross-class neighborhood similarity, which we define as follows:
+
+Definition 2 (Cross-Class Neighborhood Similarity (CCNS)). Given graph $\mathcal { G }$ and labels y for all nodes, the CCNS between classes $c , c ^ { \prime } \in { \mathcal { C } }$ is $\begin{array} { r } { s ( c , c ^ { \prime } ) = \frac { 1 } { | \mathcal { V } _ { c } | | \mathcal { V } _ { c ^ { \prime } } | } \sum _ { i \in \mathcal { V } _ { c } , j \in \mathcal { V } _ { c ^ { \prime } } } } \end{array}$ co $s \left( d ( i ) , d ( j ) \right)$ where $\mathcal { V } _ { c }$ indicates the set of nodes in class c and $d ( i )$ denotes the empirical histogram (over $| { \mathcal { C } } |$ classes) of node i’s neighbors’ labels, and the function $\cos ( \cdot , \cdot )$ measures the cosine similarity.
+
+When $\boldsymbol { c } = \boldsymbol { c } ^ { \prime }$ , $s ( c , c ^ { \prime } )$ calculates the intra-class similarity, otherwise, it calculates the inter-class similarity from a neighborhood label distribution perspective. Intuitively, if nodes with the same label share the same neighborhood distributions, the intra-class similarity should be high. Likewise, to ensure that the neighborhood patterns for nodes with different labels are distinguishable, the interclass similarity should be low. To illustrate how various $\gamma$ values affect the neighborhood patterns, we illustrate the intra-class and inter-class similarities in Figure 4 for $\gamma = 0 , \bar { 0 . 4 } , 0 . 8 , 1$ on graphs generated from Cora with homophily ratio $h = 0 . 2 5$ . The diagonal cells in each heatmap indicate the intra-class similarity while off-diagonal cells indicate inter-class similarity. Clearly, when $\gamma$ is small, the intra-class similarity is high while the inter-class similarity is low, which demonstrates the existence of strongly discriminative neighborhood patterns in the graph. As $\gamma$ increases, the intra-class and inter-class similarity get closer, becoming more and more indistinguishable, leading to bad performance due to indistinguishable distributions as referenced in Observation 2.
+
+# 4 REVISITING GCN’S PERFORMANCE ON REAL-WORLD GRAPHS
+
+In this section, we first give more details on the experiments we run to compare GCN and MLP. We next investigate why the GCN model does or does not work well on certain datasets utilizing the understanding developed in earlier sections.
+
+# 4.1 QUANTITATIVE ANALYSIS
+
+Following previous work (Pei et al., 2020; Zhu et al., 2020b), we evaluate the performance of the GCN model on several real-world graphs with different levels of homophily. We include the citation networks Cora, Citeseer and Pubmed (Kipf and Welling, 2016), which are highly homophilous. We also adopt several heterophilous benchmark datasets including Chameleon, Squirrel, Actor, Cornell, Wisconsin and Texas (Rozemberczki et al., 2021; Pei et al., 2020). Appendix D.1 gives descriptions and summary statistics of these datasets. For all datasets, we follow the experimental setting provided in (Pei et al., 2020), which consists of 10 random splits with proportions $4 8 / 3 2 / 2 0 \%$ corresponding to training/validation/test for each graph. For each split, we use 10 random seeds, and report the average performance and standard deviation across 100 runs. We compare the GCN model with the MLP model, which does not utilize the graph structure. With this comparison, we aim to check whether the GCN model always fails for for heterophilous graphs (perform even worse than MLP). We also compare GCN with state-of-the-art methods and their descriptions and performance are included in the Appendix D. The node classification performance (accuracy) of these models is reported in Table 2. Notably, GCN achieves better performance than MLP on graphs with high homophily (Cora, Citeseer, and Pubmed), as expected. For the heterophilous graphs, the results are comparatively mixed. The GCN model outperforms MLP on Squirrel and Chameleon (it even outperforms methods specifically designed for heterophilous graphs as shown in Appendix D.5.), while underperforming on the other datasets (Actor, Cornell, Wisconsin, and Texas). In the next section, we provide explanations for GCN’s distinct behaviors on these graphs based on the understanding developed in earlier sections.
+
+# 4.2 QUALITATIVE ANALYSIS
+
+Our work so far illustrates that the popular notion of GCNs not being suitable for heterophily, or homophily being a mandate for good GCN performance is not accurate. In this subsection, we aim to use the understanding we developed in Section 3 to explain why GCN does (not) work well on real-world graphs. As in Section 3.3.2, we inspect cross-class neighborhood similarity (Definition 2) for each dataset; due to the space limit, we only include representative ones here (Cora, Chameleon, Actor and Cornell); see Figure 5). Heatmaps for the other datasets can be found in Appendix E. From Figure 5(a), it is clear that the intra-class similarity is much higher than the inter-similarity ones, hence Cora contains distinct neighborhood patterns, consistent with Observation 1. In Figure 5(b), we can observe that in Chameleon, intra-class similarity is generally higher than inter-class similarity, though not as strong as in Figure 5(a). Additionally, there is an apparent gap between labels $0 , 1$ and $2 , 3 , 4$ , which contributes to separating nodes of the former 2 from the latter 3 classes, but potentially increasing misclassification within each of the two groupings. These observations also help substantiate why GCN can achieve reasonable performance (much higher than MLP) on Chameleon. The GCN model underperforms MLP in Actor and we suspect that the graph does not provide useful information. The heatmap for Actor in Figure 5 shows that the intra-class and inter-class similarities are almost equivalent, making the neighborhood distributions for different classes hard to distinguish and leading to bad GCN performance. Similar observations are made for Cornell. Note that Cornell only consists of 183 nodes and 280 edges, hence, the similarities shown in Figure 5 are impacted significantly (e.g. there is a single node with label 1, leading to perfect intra-class similarity for label 1).
+
+Table 2: Node classification performance (accuracy) on homophilous and heterophilous graphs.
+
+
Cora
Citeseer
Pubmed
Chameleon
Squirrel
Actor
Cornell
Wisconsin
Texas
GCN
87.12 ± 1.38
76.50 ± 1.61
88.52 ± 0.41
67.96 ± 1.82
54.47 ± 1.17
30.31 ± 0.98
59.35± 4.19
61.76± 6.15
63.81±5.27
MLP
75.04 ± 1.97
72.40 ± 1.97
87.84 ± 0.30
48.11 ± 2.23
31.68 ± 1.90
36.17 ± 1.09
84.86 ± 6.04
86.29 ± 4.50
83.30 ± 4.54
+
+
+Figure 5: Cross-class neighborhood similarity on homophilous graphs and heterophilous graphs.
+
+# 5 RELATED WORK
+
+Graph neural networks (GNNs) are powerful models for graph representation learning. They have been widely adopted to tackle numerous applications from various domains (Kipf and Welling, 2016; Fan et al., 2019; Bastings et al., 2017; Shi et al., 2019). (Scarselli et al., 2008) proposed the first GNN model, to tackle both node and graph level tasks. Subsequently, Bruna et al. (2013) and Defferrard et al. (2016) generalized convolutional neural networks to graphs from the graph spectral perspective. Kipf and Welling (2016) simplified the spectral GNN model and proposed graph convolutional networks (GCNs). Since then, numerous GNN variants, which follow specific forms of feature transformation (linear layers) and aggregation have been proposed (Velickovi ˇ c et al. ´ , 2017; Hamilton et al., 2017; Gilmer et al., 2017; Klicpera et al., 2019). The aggregation process can be usually understood as feature smoothing (Li et al., 2018; Ma et al., 2020; Jia and Benson, 2021; Zhu et al., 2021). Hence, several recent works claim (Zhu et al., 2020b;a; Chien et al., 2021), assume (Halcrow et al., 2020; Wu et al., 2018; Zhao et al., 2020) or remark upon (Abu-El-Haija et al., 2019; Maurya et al., 2021; Hou et al., 2020) GNN models homophily-reliance or unsuitability in capturing heterophily. Several recent works specifically develop GNN models choices to tackle heterophilous graphs by carefully designing or modifying model architectures such as Geom-GCN (Pei et al., 2020), H2GCN (Zhu et al., 2020b), GPR-GNN (Chien et al., 2021), and CPGNN (Zhu et al., 2020a). Some other works aim to modify/construct graphs to be more homophilous (Suresh et al., 2021). There is concurrent work (Luan et al., 2021) also pointing out that GCN can potentially achieve strong performance on heterophilous graphs. A major focus of this paper is to propose a new model to handle heterophilous graphs. However, our work aims to empirically and theoretically understand whether homophily is a necessity for GNNs and how GNNs work for heterophilous graphs.
+
+# 6 CONCLUSION
+
+It is widely believed that GNN models inherently assume strong homophily and hence fail to generalize to graphs with heterophily. In this paper, we revisit this popular notion and show it is not quite accurate. We investigate one representative model, GCN, and show empirically that it can achieve good performance on some heterophilous graphs under certain conditions. We analyze theoretically the conditions required for GCNs to learn similar embeddings for same-label nodes, facilitating the SSNC task; put simply, when nodes with the same label share similar neighborhood patterns, and different classes have distinguishable patterns, GCN can achieve strong class separation, regardless of homophily or heterophily properties. Empirical analysis supports our theoretical findings. Finally, we revisit several existing homophilous and heterophilous SSNC benchmark graphs, and investigate GCN’s empirical performance in light of our understanding. Note that while there exist graphs with “good heterophily”, “bad heterophily” still poses challenges to GNN models, which calls for dedicated efforts. We discuss the limitation of the current work in Appendix I.
+
+# REFERENCES
+
+Sami Abu-El-Haija, Bryan Perozzi, Amol Kapoor, Nazanin Alipourfard, Kristina Lerman, Hrayr Harutyunyan, Greg Ver Steeg, and Aram Galstyan. MixHop: Higher-order graph convolutional architectures via sparsified neighborhood mixing. In Kamalika Chaudhuri and Ruslan Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pages 21–29. PMLR, 09–15 Jun 2019. URL http://proceedings.mlr.press/v97/abu-el-haija19a.html.
+
+Aseem Baranwal, Kimon Fountoulakis, and Aukosh Jagannath. Graph convolution for semisupervised classification: Improved linear separability and out-of-distribution generalization. arXiv preprint arXiv:2102.06966, 2021.
+
+Joost Bastings, Ivan Titov, Wilker Aziz, Diego Marcheggiani, and Khalil Sima’an. Graph convolutional encoders for syntax-aware neural machine translation. arXiv preprint arXiv:1704.04675, 2017.
+
+Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. arXiv preprint arXiv:1312.6203, 2013.
+
+Ming Chen, Zhewei Wei, Zengfeng Huang, Bolin Ding, and Yaliang Li. Simple and deep graph convolutional networks. In International Conference on Machine Learning, pages 1725–1735. PMLR, 2020.
+
+Eli Chien, Jianhao Peng, Pan Li, and Olgica Milenkovic. Adaptive universal generalized pagerank graph neural network. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=n6jl7fLxrP.
+
+Valerio Ciotti, Moreno Bonaventura, Vincenzo Nicosia, Pietro Panzarasa, and Vito Latora. Homophily and missing links in citation networks. EPJ Data Science, 5:1–14, 2016.
+
+Enyan Dai and Suhang Wang. Say no to the discrimination: Learning fair graph neural networks with limited sensitive attribute information. In Proceedings of the 14th ACM International Conference on Web Search and Data Mining, pages 680–688, 2021.
+
+Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on ¨ graphs with fast localized spectral filtering. arXiv preprint arXiv:1606.09375, 2016.
+
+Yash Deshpande, Subhabrata Sen, Andrea Montanari, and Elchanan Mossel. Contextual stochastic block models. In NeurIPS, 2018.
+
+Wenqi Fan, Yao Ma, Qing Li, Yuan He, Eric Zhao, Jiliang Tang, and Dawei Yin. Graph neural networks for social recommendation. In The World Wide Web Conference, pages 417–426, 2019.
+
+Ronald A Fisher. The use of multiple measurements in taxonomic problems. Annals of eugenics, 7 (2):179–188, 1936.
+
+Santo Fortunato and Darko Hric. Community detection in networks: A user guide. Physics reports, 659:1–44, 2016.
+
+Elisabeth R Gerber, Adam Douglas Henry, and Mark Lubell. Political homophily and collaboration in regional planning networks. American Journal of Political Science, 57(3):598–610, 2013.
+
+Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In International Conference on Machine Learning, pages 1263–1272. PMLR, 2017.
+
+Jonathan Halcrow, Alexandru Mosoi, Sam Ruth, and Bryan Perozzi. Grale: Designing networks for graph learning. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 2523–2532, 2020.
+
+William L Hamilton, Rex Ying, and Jure Leskovec. Inductive representation learning on large graphs. arXiv preprint arXiv:1706.02216, 2017.
+
+Yifan Hou, Jian Zhang, James Cheng, Kaili Ma, Richard T. B. Ma, Hongzhi Chen, and Ming-Chang Yang. Measuring and improving the use of graph information in graph neural networks. In International Conference on Learning Representations, 2020. URL https://openreview. net/forum?id=rkeIIkHKvS.
+
+Ankit Jain and Piero Molino. Enhancing recommendations on uber eats with graph convolutional networks.
+
+Junteng Jia and Austin R Benson. A unifying generative model for graph learning algorithms: Label propagation, graph convolutions, and combinations. arXiv preprint arXiv:2101.07730, 2021.
+
+Weiwei Jiang and Jiayun Luo. Graph neural network for traffic forecasting: A survey. arXiv preprint arXiv:2101.11174, 2021.
+
+Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
+
+Johannes Klicpera, Aleksandar Bojchevski, and Stephan Gunnemann. Predict then propagate: ¨ Graph neural networks meet personalized pagerank. In International Conference on Learning Representations (ICLR), 2019.
+
+Qimai Li, Zhichao Han, and Xiao-Ming Wu. Deeper insights into graph convolutional networks for semi-supervised learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
+
+Derek Lim, Felix Hohne, Xiuyu Li, Sijia Linda Huang, Vaishnavi Gupta, Omkar Bhalerao, and Ser Nam Lim. Large scale learning on non-homophilous graphs: New benchmarks and strong simple methods. Advances in Neural Information Processing Systems, 34, 2021.
+
+Sitao Luan, Chenqing Hua, Qincheng Lu, Jiaqi Zhu, Mingde Zhao, Shuyuan Zhang, Xiao-Wen Chang, and Doina Precup. Is heterophily a real nightmare for graph neural networks to do node classification? arXiv preprint arXiv:2109.05641, 2021.
+
+Yao Ma, Xiaorui Liu, Tong Zhao, Yozen Liu, Jiliang Tang, and Neil Shah. A unified view on graph neural networks as graph signal denoising. arXiv preprint arXiv:2010.01777, 2020.
+
+Sunil Kumar Maurya, Xin Liu, and Tsuyoshi Murata. Improving graph neural networks with simple architecture design. arXiv preprint arXiv:2105.07634, 2021.
+
+Miller McPherson, Lynn Smith-Lovin, and James M Cook. Birds of a feather: Homophily in social networks. Annual review of sociology, 27(1):415–444, 2001.
+
+Christopher Morris, Martin Ritzert, Matthias Fey, William L Hamilton, Jan Eric Lenssen, Gaurav Rattan, and Martin Grohe. Weisfeiler and leman go neural: Higher-order graph neural networks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 4602–4609, 2019.
+
+Mark Newman. Networks. Oxford university press, 2018.
+
+Hongbin Pei, Bingzhe Wei, Kevin Chen-Chuan Chang, Yu Lei, and Bo Yang. Geom-gcn: Geometric graph convolutional networks. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\bar { }$ S1e2agrFvS.
+
+Benedek Rozemberczki, Carl Allen, and Rik Sarkar. Multi-scale attributed node embedding. Journal of Complex Networks, 9(2):cnab014, 2021.
+
+Aravind Sankar, Yozen Liu, Jun Yu, and Neil Shah. Graph neural networks for friend ranking in large-scale social platforms. 2021.
+
+Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE transactions on neural networks, 20(1):61–80, 2008.
+
+Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina Eliassi-Rad. Collective classification in network data. AI magazine, 29(3):93–93, 2008.
+
+Lei Shi, Yifan Zhang, Jian Cheng, and Hanqing Lu. Skeleton-based action recognition with directed graph neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 7912–7921, 2019.
+
+Susheel Suresh, Vinith Budde, Jennifer Neville, Pan Li, and Jianzhu Ma. Breaking the limit of graph neural networks by improving the assortativity of graphs with local mixing patterns. arXiv preprint arXiv:2106.06586, 2021.
+
+Xianfeng Tang, Yozen Liu, Neil Shah, Xiaolin Shi, Prasenjit Mitra, and Suhang Wang. Knowing your fate: Friendship, action and temporal explanations for user engagement prediction on social apps. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 2269–2279, 2020a.
+
+Xianfeng Tang, Huaxiu Yao, Yiwei Sun, Yiqi Wang, Jiliang Tang, Charu Aggarwal, Prasenjit Mitra, and Suhang Wang. Investigating and mitigating degree-related biases in graph convoltuional networks. In Proceedings of the 29th ACM International Conference on Information & Knowledge Management, pages 1435–1444, 2020b.
+
+Anton Tsitsulin, Benedek Rozemberczki, John Palowitch, and Bryan Perozzi. Synthetic graph generation to benchmark graph learning. 2021.
+
+Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017.
+
+Xuan Wu, Lingxiao Zhao, and Leman Akoglu. A quest for structure: jointly learning the graph structure and semi-supervised classification. In Proceedings of the 27th ACM international conference on information and knowledge management, pages 87–96, 2018.
+
+Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id $=$ ryGs6iA5Km.
+
+Rex Ying, Ruining He, Kaifeng Chen, Pong Eksombatchai, William L Hamilton, and Jure Leskovec. Graph convolutional neural networks for web-scale recommender systems. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 974–983, 2018.
+
+Tong Zhao, Yozen Liu, Leonardo Neves, Oliver Woodford, Meng Jiang, and Neil Shah. Data augmentation for graph neural networks. In AAAI, 2020.
+
+Jie Zhou, Ganqu Cui, Shengding Hu, Zhengyan Zhang, Cheng Yang, Zhiyuan Liu, Lifeng Wang, Changcheng Li, and Maosong Sun. Graph neural networks: A review of methods and applications. AI Open, 1:57–81, 2020.
+
+Jiong Zhu, Ryan A Rossi, Anup Rao, Tung Mai, Nedim Lipka, Nesreen K Ahmed, and Danai Koutra. Graph neural networks with heterophily. arXiv preprint arXiv:2009.13566, 2020a.
+
+Jiong Zhu, Yujun Yan, Lingxiao Zhao, Mark Heimann, Leman Akoglu, and Danai Koutra. Beyond homophily in graph neural networks: Current limitations and effective designs. Advances in Neural Information Processing Systems, 33, 2020b.
+
+Meiqi Zhu, Xiao Wang, Chuan Shi, Houye Ji, and Peng Cui. Interpreting and unifying graph neural networks with an optimization framework. arXiv preprint arXiv:2101.11859, 2021.
+
+Marinka Zitnik, Monica Agrawal, and Jure Leskovec. Modeling polypharmacy side effects with graph convolutional networks. Bioinformatics, 34(13):i457–i466, 2018.
+
+# A PROOF OF THEOREM 1
+
+To prove Theorem 1, we first introduce the celebrated Hoeffding inequality below.
+
+Lemma 1 (Hoeffding’s Inequality). Let $Z _ { 1 } , \ldots , Z _ { n }$ be independent bounded random variables with $Z _ { i } \in [ a , b ]$ for all $i$ , where $- \infty < a \le b < \infty$ . Then
+
+$$
+\mathbb { P } \left( { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } \left( Z _ { i } - \mathbb { E } \left[ Z _ { i } \right] \right) \geq t \right) \leq \exp \left( - { \frac { 2 n t ^ { 2 } } { ( b - a ) ^ { 2 } } } \right)
+$$
+
+and
+
+$$
+\mathbb { P } \left( { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } \left( Z _ { i } - \mathbb { E } \left[ Z _ { i } \right] \right) \leq - t \right) \leq \exp \left( - { \frac { 2 n t ^ { 2 } } { ( b - a ) ^ { 2 } } } \right)
+$$
+
+for all $t \geq 0$ .
+
+Theorem 1. Consider a graph ${ \mathcal { G } } = \{ \mathcal { V } , \mathcal { E } , \{ \mathcal { F } _ { c } , c \in \mathcal { C } \} , \{ \mathcal { D } _ { c } , c \in \mathcal { C } \} \}$ , which follows Assumptions $( l )$ -(4). For any node $i \in \mathcal V$ , the expectation of the pre-activation output of a single GCN operation is given by
+
+$$
+\mathbb { E } [ { \bf h } _ { i } ] = { \bf W } \left( \mathbb { E } _ { c \sim \mathcal { D } _ { y _ { i } } , { \bf x } \sim \mathcal { F } _ { c } } [ { \bf x } ] \right) .
+$$
+
+and for any $t > 0$ , the probability that the distance between the observation $\mathbf { h } _ { i }$ and its expectation is larger than $t$ is bounded by
+
+$$
+\mathbb { P } \left( \| \mathbf { h } _ { i } - \mathbb { E } [ \mathbf { h } _ { i } ] \| _ { 2 } \geq t \right) \leq 2 \cdot l \cdot \exp \left( - \frac { d e g ( i ) t ^ { 2 } } { 2 \rho ^ { 2 } ( \mathbf { W } ) B ^ { 2 } l } \right) ,
+$$
+
+where $l$ is the feature dimensionality and $\rho ( \mathbf { W } )$ denotes the largest singular value of $\mathbf { W }$ .
+
+Proof. The expectation of $\mathbf { h } _ { i }$ can be derived as follows.
+
+$$
+\begin{array} { l } { \displaystyle \mathbb { E } \left[ { \bf h } _ { i } \right] = \mathbb { E } \left[ \sum _ { j \in \cal N ( i ) } \frac { 1 } { d e g ( i ) } { \bf W } { \bf x } _ { j } \right] } \\ { \displaystyle = \frac { 1 } { d e g ( i ) } \sum _ { j \in \cal N ( i ) } \mathbf { W } \mathbb { E } _ { c \sim \mathcal { D } _ { y _ { i } } , { \bf x } \sim \mathcal { F } _ { c } } [ { \bf x } ] } \\ { \displaystyle = { \bf W } \left( \mathbb { E } _ { c \sim \mathcal { D } _ { y _ { i } } , { \bf x } \sim \mathcal { F } _ { c } } [ { \bf x } ] \right) . } \end{array}
+$$
+
+We utilize Hoeffding’s Inequality to prove the bound in Eq. (6). Let $\mathbf { x } _ { i } [ k ] , k = 1 , \ldots , l$ denote the $i$ -th element of $\mathbf { x }$ . Then, for any dimension $k$ , $\{ \mathbf { x } _ { j } [ k ] , j \in \mathcal { N } ( i ) \}$ is a set of independent bounded random variables. Hence, directly applying Hoeffding’s inequality, for any $t _ { 1 } \geq 0$ , we have the following bound:
+
+$$
+\mathbb { P } \left( \left| \sum _ { j \in \mathcal { N } ( i ) } \left( \mathbf { x } _ { j } [ k ] - \mathbb { E } \left[ \mathbf { x } _ { j } [ k ] \right] \right) \right| \geq t _ { 1 } \right) \leq 2 \exp \left( - \frac { \left( d e g ( i ) \right) t _ { 1 } ^ { 2 } } { 2 B ^ { 2 } } \right)
+$$
+
+$$
+\begin{array} { r l } { \displaystyle \mathbb { I } \| \displaystyle \sum _ { j \leq N ( 0 ) } \big ( \mathbf { x } _ { j } - \mathbb { E } [ \mathbf { x } _ { j } ] \big ) \| _ { 2 } \geq } & { \sqrt { l } t _ { 1 } , \mathrm { ~ t h e n ~ a ~ t ~ i c a t ~ f o r ~ o n e ~ \mathbb { ~ } \mathbb { ~ } \mathbb { ~ \in ~ \{ ~ 1 , \dots , l \} , ~ t h e ~ i n e q u a t } } } \\ { \displaystyle | \displaystyle \sum _ { j \leq N ( i ) } \big ( \mathbf { x } _ { j } [ k ] - \mathbb { E } [ \mathbf { x } _ { i } ] [ k ] \big ) | \geq } & { \mathrm { t h e n d s . ~ H e n e c . , w e ~ h a v e } } \\ { \displaystyle \mathbb { P } ( \| \displaystyle \sum _ { j \leq N ( i ) } \big ( \mathbf { x } _ { j } - \mathbb { E } [ \mathbf { x } _ { j } ] \big ) \| _ { 2 } \geq \sqrt { l } t _ { 1 } ) \leq \mathbb { P } ( \displaystyle \bigcup _ { k = 1 } ^ { l } \{ | \displaystyle \sum _ { j \leq N ( i ) } \big ( \mathbf { x } _ { j } [ k ] - \mathbb { E } [ \mathbf { x } _ { j } [ k ] \big ) | \geq t _ { 1 } \} ) ) } & { \mathrm { ~ f ~ h ~ e ~ n ~ a ~ } \mathbb { I } ( \mathbf { x } _ { j } ) } \\ { \displaystyle \leq \displaystyle \sum _ { k = 1 } ^ { l } \mathbb { P } ( | \displaystyle \sum _ { j \leq N ( i ) } \big ( \mathbf { x } _ { j } [ k ] - \mathbb { E } [ \mathbf { x } _ { j } [ k ] \big ) | \geq t _ { 1 } ) } & { \mathrm { ~ f ~ h ~ e ~ n ~ a ~ } } \\ { \displaystyle } & { = 2 \cdot l \cdot \exp ( - \frac { ( l + \epsilon _ { 0 } ( l ) ) t _ { 1 } ^ { 2 } } { 2 B ^ { 2 } } ) } \end{array}
+$$
+
+Let $\begin{array} { r } { t _ { 1 } = \frac { t _ { 2 } } { \sqrt { l } } } \end{array}$ , then we have
+
+$$
+\mathbb { P } \left( \left. \sum _ { j \in \mathcal { N } ( i ) } \left( \mathbf { x } _ { j } - \mathbb { E } \left[ \mathbf { x } _ { j } \right] \right) \right. _ { 2 } \geq t _ { 2 } \right) \leq 2 \cdot l \cdot \exp \left( - \frac { ( d e g ( i ) ) t _ { 2 } ^ { 2 } } { 2 B ^ { 2 } l } \right)
+$$
+
+Furthermore, we have
+
+$$
+\begin{array} { r } { \| \mathbf { h } _ { i } - \mathbb { E } [ \mathbf { h } _ { i } ] \| _ { 2 } = \left\| \mathbf { W } \left( \displaystyle \sum _ { j \in \mathcal { N } ( i ) } \big ( \mathbf { x } _ { j } - \mathbb { E } [ \mathbf { x } _ { j } ] \big ) \right) \right\| _ { 2 } } \\ { \leq \| \mathbf { W } \| _ { 2 } \left\| \displaystyle \sum _ { j \in \mathcal { N } ( i ) } \big ( \mathbf { x } _ { j } - \mathbb { E } [ \mathbf { x } _ { j } ] \big ) \right\| _ { 2 } } \\ { = \rho ( \mathbf { W } ) \left\| \displaystyle \sum _ { j \in \mathcal { N } ( i ) } \big ( \mathbf { x } _ { j } - \mathbb { E } [ \mathbf { x } _ { j } ] \big ) \right\| _ { 2 } , } \end{array}
+$$
+
+where $\lVert \mathbf { W } \rVert _ { 2 }$ is the matrix 2-norm of $\mathbf { W }$ . Note that the last line uses the identity $\| \mathbf { W } \| _ { 2 } = \rho ( \mathbf { W } )$ . Then, for any $t > 0$ , we have
+
+$$
+\begin{array} { r l r } { { \mathbb { P } ( \| \mathbf { h } _ { i } - \mathbb { E } [ \mathbf { h } _ { i } ] \| _ { 2 } \geq t ) \leq \mathbb { P } ( \rho ( \mathbf { W } ) \| \displaystyle \sum _ { j \in \mathcal { N } ( i ) } ( \mathbf { x } _ { j } - \mathbb { E } [ \mathbf { x } _ { j } ] ) \| _ { 2 } \geq t ) } } \\ & { } & { = \mathbb { P } ( \| \displaystyle \sum _ { j \in \mathcal { N } ( i ) } ( \mathbf { x } _ { j } - \mathbb { E } [ \mathbf { x } _ { j } ] ) \| _ { 2 } \geq \frac { t } { \rho ( \mathbf { W } ) } ) } \\ & { } & { \leq 2 \cdot l \cdot \exp ( - \frac { ( d e g ( i ) ) t ^ { 2 } } { 2 \rho ^ { 2 } ( \mathbf { W } ) B ^ { 2 } l } ) , } \end{array}
+$$
+
+which completes the proof.
+
+# B PROOF OF THEOREM 2
+
+Theorem 2. Consider a graph $\mathcal { G } \sim C S B M ( \mu _ { 1 } , \mu _ { 2 } , p , q )$ . For any node i in this graph, the linear classifier defined by the decision boundary $\mathcal { P }$ has a lower probability to mis-classify $\mathbf { h } _ { i }$ than $\mathbf { x } _ { i }$ when $d e g ( i \dot { ) } > ( p \dot { + } q ) ^ { 2 } / ( p - q ) ^ { 2 }$ .
+
+Proof. We only prove for nodes from classes $c _ { 0 }$ since the case for nodes from classes $c _ { 1 }$ is symmetric and the proof is exactly the same. For a node $i \in \mathcal { C } _ { 0 }$ , we have the follows
+
+$$
+\begin{array} { r } { \mathbb P ( \mathbf x _ { i } \mathrm { ~ i s ~ m i s - c l a s s i f i e d } ) = \mathbb P ( \mathbf w ^ { \top } \mathbf x _ { i } + \mathbf b \leq 0 ) \mathrm { ~ f o r ~ } i \in \mathcal C _ { 0 } } \\ { \mathbb P ( \mathbf h _ { i } \mathrm { ~ i s ~ m i s - c l a s s i f i e d } ) = \mathbb P ( \mathbf w ^ { \top } \mathbf h _ { i } + \mathbf b \leq 0 ) \mathrm { ~ f o r ~ } i \in \mathcal C _ { 0 } , } \end{array}
+$$
+
+here w and $\mathbf { b } = - \mathbf { w } ^ { \top } \left( \pmb { \mu } _ { 1 } + \pmb { \mu } _ { 1 } \right) / 2$ is the parameters of the decision boundary $\mathcal { P }$ . we have tha
+
+$$
+\mathbb { P } ( \mathbf { w } ^ { \top } \mathbf { h } _ { i } + \mathbf { b } \le 0 ) = \mathbb { P } ( \mathbf { w } ^ { \top } \sqrt { d e g ( i ) } \mathbf { h } _ { i } + \sqrt { d e g ( i ) } \mathbf { b } \le 0 ) .
+$$
+
+We denote the scaled version of $\mathbf { h } _ { i }$ as $\mathbf { h } _ { i } ^ { \prime } = \sqrt { d e g ( i ) } \mathbf { h } _ { i }$ . Then, $\mathbf { h } _ { i } ^ { \prime }$ follows
+
+$$
+\mathbf { h } _ { i } ^ { \prime } = \sqrt { d e g ( i ) } \mathbf { h } _ { i } \sim N \left( \frac { \sqrt { d e g ( i ) } \left( p \mu _ { 0 } + q \mu _ { 1 } \right) } { p + q } , \mathbf { I } \right) , \mathrm { f o r } i \in \mathcal { C } _ { 0 } .
+$$
+
+Because of the scale in Eq. (9), the decision boundary for $\mathbf { h } _ { i } ^ { \prime }$ is correspondingly moved to ${ \bf w } ^ { \top } { \bf h } ^ { \prime } +$ $\sqrt { d e g ( i ) } { \bf b } = 0$ . Now, since $\mathbf { x } _ { i }$ and $\mathbf { h } _ { i } ^ { \prime }$ share the same variance, to compare the mis-classification probabilities, we only need to compare the distance from their expected value to their corresponding decision boundary. Specifically, the two distances are as follows:
+
+$$
+\begin{array} { l } { d i s _ { \mathbf { x } _ { i } } = \displaystyle \frac { \| \pmb { \mu } _ { 0 } - \pmb { \mu } _ { 1 } \| _ { 2 } } { 2 } } \\ { d i s _ { \mathbf { h } _ { i } ^ { \prime } } = \displaystyle \frac { \sqrt { d e g ( i ) } | p - q | } { ( p + q ) } \cdot \displaystyle \frac { \| \pmb { \mu } _ { 0 } - \pmb { \mu } _ { 1 } \| _ { 2 } } { 2 } . } \end{array}
+$$
+
+The larger the distance is the smaller the mis-classification probability is. Hence, when $d i s _ { { \bf h } _ { i } ^ { \prime } } <$ $d i s _ { { \bf x } _ { i } }$ , $\mathbf { h } _ { i } ^ { \prime }$ has a lower probability to be mis-classified than $\mathbf { x } _ { i }$ . Comparing the two distances, w conclude that when $\begin{array} { r } { d e g ( i ) \ > \ \left( \frac { p + q } { p - q } \right) ^ { 2 } } \end{array}$ , $\mathbf { h } _ { i } ^ { \prime }$ has a lower probability to be mis-classified than $\mathbf { x } _ { i }$ Together with Eq. 9, we have that
+
+$$
+\mathbb { P } ( \mathbf { h } _ { i } { \mathrm { ~ i s ~ m i s - c l a s s i f i e d } } ) < \mathbb { P } ( \mathbf { x } _ { i } { \mathrm { ~ i s ~ m i s - c l a s s i f i e d } } ) { \mathrm { ~ i f ~ } } d e g ( i ) > \left( { \frac { p + q } { p - q } } \right) ^ { 2 } ,
+$$
+
+which completes the proof.
+
+# C ADDITIONAL DETAILS AND RESULTS FOR SECTION 3.3.1
+
+# C.1 DETAILS ON THE GENERATED GRAPHS
+
+In this subsection, we present the details of the graphs that we generate in Section 3.3.1. Specifically, we detail the distributions $\{ \mathcal { D } _ { c } , c \in \mathcal { C } \}$ used in the examples, the number of added edges $K$ , and the homophily ratio $h$ . We provide the details for Cora and Citeseer in the following subsections. Note that the choices of distributions shown here are for illustrative purposes, to coincide with Observations 1 and 2. We adapted circulant matrix-like designs due to their simplicity.
+
+# C.1.1 CO R A
+
+There are 7 labels, which we denote as $\{ 0 , 1 , 2 , 3 , 4 , 5 , 6 \}$ . The distributions $\{ \mathcal { D } _ { c } , c \in \mathcal { C } \}$ are listed as follows. The values of $K$ and the homophily ratio of their corresponding generated graphs are shown in Table 3.
+
+$$
+\begin{array} { r l } & { \mathcal { D } _ { 0 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 . 5 , 0 , 0 , 0 , 0 , 0 . 5 ] ) , } \\ & { \mathcal { D } _ { 1 } : \mathsf { C a t e g o r i c a l } ( [ 0 . 5 , 0 , 0 . 5 , 0 , 0 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 2 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 . 5 , 0 , 0 . 5 , 0 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 3 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 . 0 , 0 . 5 , 0 , 0 . 5 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 4 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 0 . 5 , 0 , 0 . 5 , 0 ] ) , } \\ & { \mathcal { D } _ { 5 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 0 , 0 . 5 , 0 , 0 . 5 ] ) , } \\ & { \mathcal { D } _ { 6 } : \mathsf { C a t e g o r i c a l } ( [ 0 . 5 , 0 , 0 , 0 . 5 , 0 , 0 . 5 , 0 ] ) . } \end{array}
+$$
+
+Table 3: # of added edges $( K )$ and homophily ratio $( h )$ values for generated graphs based on Cora.
+
+
K
1003
2006
3009
4012
6018
8024
10030
12036
16048
20060
24072
h
0.740
0.681
0.630
0.587
0.516
0.460
0.415
0.378
0.321
0.279
0.247
+
+# C.1.2 CI T E S E E R
+
+There are 6 labels, which we denote as $\{ 0 , 1 , 2 , 3 , 4 , 5 \}$ . The distributions $\{ \mathcal { D } _ { c } , c \in \mathcal { C } \}$ are listed as follows. The values of $K$ and the homophily ratio of their corresponding generated graphs are shown in Table 4.
+
+$$
+\begin{array} { r l } & { \mathcal { D } _ { 0 } : \mathrm { C a t e g o r i c a l } ( [ 0 , 0 . 5 , 0 , 0 , 0 , 0 . 5 ] ) , } \\ & { \mathcal { D } _ { 1 } : \mathrm { C a t e g o r i c a l } ( [ 0 . 5 , 0 , 0 . 5 , 0 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 2 } : \mathrm { C a t e g o r i c a l } ( [ 0 , 0 . 5 , 0 , 0 . 5 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 3 } : \mathrm { C a t e g o r i c a l } ( [ 0 , 0 , 0 . 5 , 0 , 0 . 5 , 0 ] ) , } \\ & { \mathcal { D } _ { 4 } : \mathrm { C a t e g o r i c a l } ( [ 0 , 0 , 0 , 0 . 5 , 0 , 0 . 5 ] ) , } \\ & { \mathcal { D } _ { 5 } : \mathrm { C a t e g o r i c a l } ( [ 0 . 5 , 0 , 0 , 0 , 0 . 5 , 0 ] ) . } \end{array}
+$$
+
+Table 4: # of added edges $( K )$ and homophily ratio $( h )$ values for generated graphs based on Citeseer
+
+
K
1204
2408
3612
4816
7224
9632
12040
14448
19264
24080
28896
h
0.650
0.581
0.527
0.481
0.410
0.357
0.317
0.284
0.236
0.202
0.176
+
+# C.2 RESULTS ON MORE DATASETS: CH A M E L E O N AND SQ U I R R E L
+
+We conduct similar experiments as those in Section 3.3.1 based on Chameleon and Squirrel. Note that both Squirrel and Chameleon have 5 labels, which we denote as $\{ 0 , 1 , 2 , 3 , 4 \}$ . We pre-define the same distributions for them as listed as follows. The values of $K$ and the homophily ratio of their corresponding generated graphs based on Squirrel and Chameleon are shown in Table 5 and Table 6, respectively.
+
+$$
+\begin{array} { r l } & { \bar { \mathcal { D } } _ { 0 } : \mathsf { C a t e g o r i c a l ( [ 0 , 0 . 5 , 0 , 0 , 0 . 5 ] ) } , } \\ & { \mathcal { D } _ { 1 } : \mathsf { C a t e g o r i c a l ( [ 0 . 5 , 0 , 0 . 5 , 0 , 0 ] ) } , } \\ & { \mathcal { D } _ { 2 } : \mathsf { C a t e g o r i c a l ( [ 0 , 0 . 5 , 0 , 0 . 5 , 0 ] ) } , } \\ & { \mathcal { D } _ { 3 } : \mathsf { C a t e g o r i c a l ( [ 0 , 0 , 0 . 5 , 0 , 0 . 5 ] ) } , } \\ & { \mathcal { D } _ { 4 } : \mathsf { C a t e g o r i c a l ( [ 0 . 5 , 0 , 0 , 0 . 5 , 0 ] ) } . } \end{array}
+$$
+
+Table 5: # of added edges $( K )$ and homophily ratio $( h )$ values for generated graphs based on Squirrel.
+
+
K
12343
24686
37030
49374
61716
74060
86404
98746
111090
12434
135776
h
0.215
0.209
0.203
0.197
0.192
0.187
0.182
0.178
0.173
0.169
0.165
+
+Table 6: # of added edges $( K )$ and homophily ratio $( h )$ values for generated graphs based on Chameleon.
+
+
K
1932
3866
5798
7730
9964
11596
13528
15462
17394
19326
21260
h
0.223
0.217
0.210
0.205
0.199
0.194
0.189
0.184
0.180
0.176
0.172
+
+
+Figure 6: Performance of GCN on synthetic graphs with various homophily ratio.
+
+The performance of the GCN model on these two sets of graphs (generated from Squirrel and Chameleon) is shown in Figure 6. The observations are similar to what we found for those generated graphs based on Cora and Citeseer in Section 3.3.1. Note that the original Squirrel and Chameleon graphs already have very low homophily, but we still observe a $V$ -shape from the figures. This is because there are some neighborhood patterns in the original graphs, which are distinct from those that we designed for addition. Hence, when we add edges in the early stage, the performance decreases. As we add more edges, the designed pattern starts to mask the original patterns and the performance starts to increase.
+
+# C.3 GCN’S PERFORMANCE IN THE LIMIT (AS $K \infty$ )
+
+In this subsection, we illustrate that as $K \infty$ , the accuracy of the GCN model approaches $1 0 0 \%$ . Specifically, we set $K$ to a set of larger numbers as listed in Table 7. Ideally, when $K \infty$ , the homophily ratio will approach 0 and the model performance will approach $1 0 0 \%$ (for diverseenough $\mathcal { D } _ { c }$ ). The performance of the GCN model on the graphs described in Table 3 and Table 7 are shown in Figure 7. Clearly, the performance of the GCN model approaches the maximum as we continue to increase $K$ .
+
+Table 7: Extended # of added edges $( K )$ and homophily ratio $( h )$ values for generated graphs based on Cora.
+Alg. 2: Heterophilous Edge Addition with Noise
+
+
K
28084
32096
36108
40120
44132
48144
52156
56168
80240
h
0.272
0.248
0.228
0.211
0.196
0.183
0.172
0.162
0.120
+
+
+Figure 7: As the number of edges approaches $K \infty$ , the homophily ratio $h 0$ , and GCN’s performance approaches $1 0 0 \%$ .
+
+# C.4 DETAILS OF ALGORITHM 2
+
+The pseudo code to describe the process to generate graphs with a noise level $\gamma$ is shown in Algorithm 2. The only difference from Algorithm 1 is in Line 6-7, we randomly add edges if the generated random number $r$ is smaller than the pre-defined $\gamma$ (with probability $\gamma$ ).
+
+input : $\mathcal { G } = \{ \mathcal { V } , \mathcal { E } \} , K$ , $\{ \mathcal { D } _ { c } \} _ { c = 0 } ^ { | c | - 1 }$ and $\{ \gamma _ { c } \} _ { c = 0 } ^ { | c | - 1 }$ $\mathcal { G } ^ { \prime } = \mathrm { \hat { \{ } } \mathcal { V } , \mathcal { \hat { E } } ^ { \prime } \}$
+Initialize $\mathcal { G } ^ { \prime } = \mathrm { \bar { \{ } } \mathcal { V } , \mathcal E \}$ , $k = 1$ ;
+while $1 \leq k \leq K$ do Sample node $i \sim$ Uniform $( \nu )$ ; Obtain the label, $y _ { i }$ of node $i$ ; Sample a number $r \sim$ Uniform(0,1) ; // Uniform(0,1) denotes the continuous standard uniform distribution if $r \leq \gamma$ then Sample a label $c \sim$ Uniform $( { \mathcal { C } } \setminus \{ y _ { i } \} )$ ; else Sample a label $c \sim \mathcal { D } _ { y _ { i } }$ ; Sample node $j \sim$ Uniform $( \mathcal { V } _ { c } )$ ; Update edge set $\mathcal { E } ^ { \prime } = \mathcal { E } ^ { \prime } \cup \{ ( i , j ) \}$ ; $k \bar { } k + \bar { 1 }$ ;
+return $\mathcal { G } ^ { \prime } = \{ \nu , \mathcal { E } ^ { \prime } \}$
+
+# D EXPERIMENTAL DETAILS: DATASETS, MODELS, AND RESULTS
+
+We compare the standard GCN model (Kipf and Welling, 2016) with several recently proposed methods specifically designed for heterophilous graphs including H2GCN (Zhu et al., 2020b), GPRGNN (Chien et al., 2021), and CPGNN (Zhu et al., 2020a). A brief introduction of these methods can be found in Appendix D.2.
+
+# D.1 DATASETS
+
+We give the number of nodes, edges, homophily ratios and distinct classes of datasets we used in this paper in Table 8.
+
+Table 8: Benchmark dataset summary statistics.
+
+
Cora
Citeseer
Pubmed
Chameleon
Squirrel
Actor
Cornell
Wisconsin
Texas
#Nodes (VI)
2708
3327
19717
2277
5201
7600
183
251
183
#Edges (ε|)
5278
4676
44327
31421
198493
26752
280
466
295
Homophily Ratio (h)
0.81
0.74
0.80
0.23
0.22
0.22
0.3
0.21
0.11
#Classes (C|)
7
6
3
5
5
5
5
5
5
+
+# D.2 MODELS
+
+• H2GCN (Zhu et al., 2020b) specifically designed several architectures to deal with heterophilous graphs, which include ego- and neighbor-embedding separation (skip connection), aggregation from higher-order neighborhoods, and combination of intermediate representations. We include two variants H2GCN-1 and H2GCN-2 with 1 or 2 steps of aggregations, respectively. We adopt the code published by the authors at https://github.com/GemsLab/H2GCN.
+
+• GPR-GNN (Chien et al., 2021) performs feature aggregation for multiple steps and then linearly combines the features aggregated with different steps. The weights of the linear combination are learned during the model training. Note that it also includes the original features before aggregation in the combination. We adopt the code published by the authors at https://github.com/jianhao2016/GPRGNN.
+
+• CPGNN (Zhu et al., 2020a) incorporates the label compatibility matrix to capture the connection information between classes. We adopted two variants of CPGNN that utilize MLP and ChebyNet (Defferrard et al., 2016) as base models to pre-calculate the compatibility matrix, respectively. We use two aggregation layers for both variants. We adopt the code published by the authors at https://github.com/GemsLab/CPGNN.
+
+# D.3 MLP $^ +$ GCN
+
+We implement a simple method to linearly combine the learned features from the GCN model and an MLP model. Let $\mathbf { H } _ { G C N } ^ { ( 2 ) } \in \mathbb { R } ^ { | \mathcal { V } | \times | \mathcal { C } | }$ denote the output features from a 2-layer GCN model, where $| \nu |$ and $| { \mathcal { C } } |$ denote the number of nodes and the number of classes, respectively. Similarly, we use $\mathbf { H } _ { M L P } ^ { ( 2 ) } \in \mathbb { R } ^ { | \mathcal { V } | \times | \mathcal { C } | }$ to denote the features output from a 2-layer MLP model. We then combine them for classification. The process can be described as follows.
+
+$$
+\mathbf { H } = \alpha \cdot \mathbf { H } _ { G C N } ^ { ( 2 ) } + ( 1 - \alpha ) \cdot \mathbf { H } _ { M L P } ^ { ( 2 ) } ,
+$$
+
+where $\alpha$ is a hyperparameter balancing the two components. We then apply a row-wise softmax to each row of $\mathbf { H }$ to perform the classification.
+
+# D.4 PARAMETER TUNING AND RESOURCES USED
+
+We tune parameters for GCN, GPR-GCN, CPGNN, and MLP+GCN from the following options:
+
+• learning rate: $\{ 0 . 0 0 2 , 0 . 0 0 5 , 0 . 0 1 , 0 . 0 5 \}$
+• weight decay $5 e - 0 4 , 5 e - 0 5 , 5 e - 0 6 , 5 e - 0 7 , 5 e - 0 8 , 1 e - 0 5 , 0 \}$ • dropout rate: $\{ 0 , 0 . 2 , 0 . 5 , 0 . 8 \}$ .
+
+For GPR-GNN, we use the “PPR” as the initialization for the coefficients. For $\mathbf { M L P + G C N }$ , we tune $\alpha$ from $\{ 0 . 2 , 0 . 4 , 0 . 6 , 0 . 8 , 1 \}$ . Note that the parameter search range encompasses the range adopted in the original papers to avoid unfairness issues.
+
+All experiments are run on a cluster equipped with Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz CPUs and NVIDIA Tesla K80 GPUs.
+
+# D.5 MORE RESULTS
+
+
Cora
Citeseer
Pubmed
Chameleon
Squirrel
Actor
Cornell
Wisconsin
Texas
GCN
87.12 ± 1.38
76.50 ± 1.61
88.52 ± 0.41
67.96± 1.82
54.47 ± 1.17
30.31±0.98
59.35 ± 4.19
61.76± 6.15
63.81± 5.27
MLP
75.04 ± 1.97
72.40 ± 1.97
87.84 ± 0.30
48.11 ± 2.23
31.68 ± 1.90
36.17 ± 1.09
84.86± 6.04
86.29 ± 4.50
83.30 ± 4.54
MLP+GCN
87.01 ± 1.35
76.35 ± 1.85
89.77 ± 0.39
68.04 ±1.86
54.48 ± 1.11
36.24 ± 1.09
84.82 ± 4.87
86.43 ± 4.00
83.60 ±6.04
H2GCN-1
86.92 ± 1.37
77.07 ±1.64
89.40 ± 0.34
57.11 ± 1.58
36.42 ± 1.89
35.86 ±1.03
82.16 ±6.00
86.67 ± 4.69
84.86±6.77
H2GCN-2
87.81 ± 1.35
76.88 ± 1.77
89.59 ± 0.33
59.39 ± 1.98
37.90 ± 2.02
35.62 ± 1.30
82.16 ±6.00
85.88 ± 4.22
82.16 ± 5.28
CPGNN-MLP
85.84 ± 1.20
74.80 ± 0.92
86.58 ± 0.37
54.53 ± 2.37
29.13 ± 1.57
35.76± 0.92
79.93 ± 6.12
84.58 ± 2.72
82.62 ±6.88
CPGNN-Cheby
87.23 ± 1.31
76.64 ± 1.43
88.41 ± 0.33
65.17 ± 3.17
29.25 ± 4.17
34.28 ± 0.77
75.08 ± 7.51
79.19 ± 2.80
75.96± 5.66
GPR-GNN
86.79 ± 1.27
75.55 ± 1.56
86.79 ± 0.55
66.31 ± 2.05
50.56 ± 1.51
33.94 ± 0.95
79.27 ± 6.03
83.73 ± 4.02
84.43 ± 4.10
+
+# E HEATMAPS FOR OTHER BENCHMARKS
+
+We provide the heatmaps for Citeseer and Pubmed in Figure 8 and those for Squirrel, Texas, and Wisconsin in Figure 9. For the Citeseer and Pubmed, which have high homophily, the observations are similar to those of Cora as we described in Section 4.2. For Squirrel, there are some patterns; the intra-class similarity is generally higher than inter-class similarities. However, these patterns are not very strong, i.e, the differences between them are not very large, which means that the neighborhood patterns of different labels are not very distinguishable from each other. This substantiates the middling performance of GCN on Squirrel. Both Texas and Wisconsin are very small, with 183 nodes, 295 edges and 251 nodes, 466 edges, respectively. The average degree is extremely small $( < ~ 2 )$ . Hence, the similarities presented in the heatmap may present strong bias. Especially, in Texas, there is only 1 node with label 1. In Wisconsin, there are only 10 nodes with label 0.
+
+
+Figure 8: Cross-class neighborhood similarity on Citeseer and Pubmed. On both graphs, the intra-class similarity is clearly higher than the inter-class ones.
+
+# F EXTENDING THEOREM 2 TO MULTIPLE CLASSES
+
+Below, we provide a proof sketch and illustration for an extension to Theorem 2’s main results in a multi-class context. Specifically, we consider a special case for more tractable analysis.
+
+Consider a $K$ -class CSBM. The nodes in the generated graphs consist of $K$ disjoint sets of the same size $\mathcal { C } _ { 1 } , \ldots , \mathcal { C } _ { K }$ corresponding to the $K$ classes, respectively. Edges are generated according to an intra-class probability $p$ and an inter-class probability $q$ . Specifically, for any two nodes in the graph, if they are from the same class, then an edge is generated to connect them with probability $p$ , otherwise, the probability is $q$ . For each node $i$ , its initial associated features $\mathbf { x } _ { i } \in \mathbb { R } ^ { l }$ are sampled from a Gaussian distribution $\mathbf { x } _ { i } \sim N ( \pmb { \mu } , \mathbf { I } )$ , where $\pmb { \mu } = \pmb { \mu } _ { k } \in \mathbb { R } ^ { l }$ for $i \in \mathcal { C } _ { k }$ with $k \in \{ 1 , \ldots , K \}$ and ${ \pmb \mu } _ { z } \neq { \pmb \mu } _ { w } \forall z , w \in \{ 1 , . . . , K \}$ . We further assume that the distance between the mean of distributions corresponding to any two classes is equivalent, i.e, $\| \mathbf { u } _ { z } - \mathbf { u } _ { w } \| _ { 2 } = D$ , $\forall z , w \in \{ 1 , \ldots , K \}$ , where $D$ is a positive constant. We illustrate the 3-classes case in Figure 10, where we use the dashed circles to demonstrate the standard deviation. Note that the $K$ classes of the CSBM model are symmetric to each other. Hence, the optimal decision boundary of the $K$ classes are defined by a set of $\binom { K } { 2 }$ hyperplanes (see Figure 10 for an example), where each hyperplane equivalently separates two classes. Similar to the analysis in the binary case (see the description below Proposition 1), for any given two classes $c _ { z }$ and $c _ { w }$ , the hyperplane is $\mathcal P = \{ { \bf x } | { \bf w } ^ { \top } { \bf x } ^ { \top } - { \bf w } ^ { \top } ( \pmb { \mu } _ { z } + \pmb { \dot { \mu _ { w } } } ) / 2 \}$ with $\mathbf { w } = ( \bar { \mathbf { u } _ { z } } - \mathbf { u } _ { w } ) / \| \mathbf { u } _ { z } - \mathbf { u } _ { w } ) \| _ { 2 }$ , which is orthogonal to $\left( \mu _ { z } - \mu _ { w } \right)$ and going through $( \mu _ { z } + \dot { \mu } _ { w } ) / 2$ . For example, in Figure 10, the decision boundaries separate the entire space to 3 areas corresponding to the 3 classes. Each decision boundary is defined by a hyperplane equally separating two classes. For example, the descision bounadry between $c _ { 1 }$ and $c _ { 2 }$ is orthogonal to $( \bar { \mu _ { 1 } } - \mu _ { 2 } )$ and going through the middle point $( \mu _ { 1 } + \mu _ { 2 } ) / \dot { 2 }$ . Clearly, the linear separability is dependent on the distance $D$ between the classes and also the standard deviations of each class’ node features. More specifically, linear separability is favored by a larger distance $D$ and smaller standard deviation.
+
+
+Figure 9: Cross-class neighborhood similarity on Squirrel, Texas and Wisconsin. The interclass similarity on Squirrel is slightly higher than intra-class similarity for most classes, which substantiates the middling performance of GCN. Both Texas and Wisconsin are quite small, hence the cross-class similarity in these two graphs present severe bias and may not provide precise information about these graphs.
+
+
+Figure 10: 3-class CSBM in 2-dimensional space. The dashed circles demonstrate the standard deviation for each class. The entire space is split to three areas (indicated by different colors) corresponding to the three classes for optimal decision making. The equilateral triangle indicates that the distance between the means of any two classes is the same.
+
+Next, we discuss how the GCN operation affects the linear separability. Overall, we want to demonstrate the following: (i) after the GCN operation, the classes are still symmetric to each other; (ii) the GCN operation will reduce the distance between the classes (in terms of the expectation of the output embeddings) and reduce the standard deviation of the classes; and (iii) reducing the distance impairs the separability while reducing the standard deviation improves the separability. Hence, we analyze the two effect and provide a threshold. We describe these three items in a more detailed way as follows.
+
+• Preservation of Symmetry. For any class $c _ { z } , z \in \{ 1 , \ldots , K \}$ , its neighborhood label distribution Dc can be described by a vector where only the $z$ -th element equals $\frac { p } { p + ( K - 1 ) q }$ and all other elements equal to $\frac { q } { p + ( K - 1 ) q }$ . We consider the aggression process $\mathbf { h } _ { i } = \mathbf { \frac { 1 } { \mathit { d e g } ( i ) } } \sum _ { \substack { j \in \mathcal { N } ( i ) } } \mathbf { x } _ { j }$ . Then, for a node $i$ with label $c _ { z }$ , its features obtained after this process follow the following Gaussian distribution.
+
+$$
+\mathbf { h } _ { i } \sim N \left( \frac { p \mu _ { z } + \displaystyle \sum _ { k \in \{ 1 , \dots K \} , k \neq z } q \mu _ { k } } { p + ( K - 1 ) q } , \frac { \mathbf { I } } { \sqrt { d e g ( i ) } } \right) , \mathrm { f o r } i \in \mathcal { C } _ { z }
+$$
+
+Specifically, we denote the expectation of class $c _ { z }$ after the GCN operation as $\begin{array} { r l } { \mathbb { E } _ { c _ { z } } [ \mathbf { h } ] } & { { } = } \end{array}$ $\frac { p { \pmb { \mu } } _ { z } + \sum _ { k \in \{ 1 , . . . K \} , k \neq z } q { \pmb { \mu } } _ { k } } { p + ( K - 1 ) q }$ . We next show that the distance between any two classes is the same. Specifically, for any two classes $c _ { z }$ and $c _ { w }$ , after the GCN operation, the distance between their expectation is as follows.
+
+$$
+\begin{array} { c } { { \displaystyle \| \mathbb { E } _ { c _ { z } } [ { \bf h } ] - \mathbb { E } _ { c _ { k } } [ { \bf h } ] \| _ { 2 } = \left\| \frac { p \mu _ { z } + \sum _ { k \in \{ 1 , \ldots , K \} , k \neq z } q \mu _ { k } } { p + ( K - 1 ) q } - \frac { p \mu _ { w } + \sum _ { k \in \{ 1 , \ldots , K \} , k \neq w } q \mu _ { k } } { p + ( K - 1 ) q } \right\| _ { 2 } } } \\ { { = \displaystyle \left\| \frac { ( p - q ) ( \mu _ { z } - \mu _ { w } ) } { p + ( K - 1 ) q } \right\| _ { 2 } = \frac { | p - q | } { p + ( K - 1 ) q } \| \mu _ { z } - \mu _ { w } \| _ { 2 } } } \end{array}
+$$
+
+Note that we have $\| \pmb { \mu } _ { z } - \pmb { \mu } _ { w } \| _ { 2 } = D$ for any pair of classes $c _ { z }$ and $c _ { w }$ . Hence, after the GCN operation, the distance between any two classes is still the same. Thus, the classes are symmetric two each other.
+
+• Reducing inter-class distance and intra-class standard deviation. According to Eq (15), after the graph convolution operation, the distance between any two classes is reduced by a factor of $\frac { | p - q | } { p + ( K - 1 ) q }$ . On the other hand, according to Eq. (14), the standard deviation depends on the degree of nodes. Specifically, for node $i$ with degree $d e g ( i )$ , its standard deviation is reduced by a factor of $\sqrt { d e g ( i ) }$ .
+
+• Implications for separability. For a node $i$ , the probability of being mis-classified is the probability of its embedding falling out of its corresponding decision area. This probability depends on both the inter-class distance between classes (in terms of means) and the intra-class standard deviation. To compare the linear separability before and after the graph convolution operation, we scale the distance between classes before and after the graph convolution operation to be the same. Specifically, we scale $\mathbf { h } _ { i }$ as $\begin{array} { r } { \mathbf { h } _ { i } ^ { \prime } = \frac { p + ( K - 1 ) q } { | p - q | } \mathbf { h } _ { i } } \end{array}$ . Note that classifying $\mathbf { h } _ { i }$ is equivalent to classifying $\mathbf { h } _ { i } ^ { \prime }$ . Based on $\mathbf { h } ^ { \prime }$ , the distance between any two classes $c _ { z }$ , $c _ { w }$ is scaled to $\| \pmb { \mu } _ { z } - \pmb { \mu } _ { w } \| _ { 2 } = D$ , which is equivalent to the class distance before the graph convolution operation. Correspondingly, the standard deviation for $\mathbf { h } _ { i } ^ { \prime }$ equals to $\frac { p + ( K - 1 ) q } { | p - q | } \cdot \frac { \textbf { I } } { \sqrt { d e g ( i ) } }$ . Now, to compare the mis-classification probability before and after the graph convolution, we only need to compare the standard deviations as the distances between classes in these two scenarios has been scaled to the same. More specifically, when p+(K−1)q|p−q| $\begin{array} { r } { \frac { p + ( K - 1 ) q } { | p - q | } \cdot \frac { \textbf { I } } { \sqrt { d e g ( i ) } } < 1 } \end{array}$ , the mis-classification probability for node $i$ is reduced after the GCN model, otherwise, the mis-classification probability is increased after the GCN model. In other words, for nodes with degree larger than $\frac { { \overset { } { ( p + ( K - 1 ) q ) ^ { 2 } } } } { { ( p - q ) ^ { 2 } } }$ , the mis-classification rate can be reduced after the graph convolution operation. This thereold is similar to the one we developed in Theorem 2 and similar analysis/discussions as those for Theorem 2 follows for the this multiple-class case.
+
+# G OTHER METRICS THAN COSINE SIMILARITY
+
+The choice of similarity measure would not affect the results and conclusions significantly. We empirically demonstrate this argument by investigating two other metrics: Euclidean distance and Hellinger distance. The heatmaps based on these two metrics for Chamelon dataset is shown in Figure 11 in Appendix G. The patterns demonstrated in these two heatmaps are similar to those observed in Figure 5(b), where cosine similarity is adopted. Note that larger distance means lower similarity. Hence, the numbers in Figure 11 should be interpreted in the opposite way as those in Figure 5.
+
+
+Figure 11: Cross-class neighborhood patterns on Chameleon based on different metrics than cosine similarity metric.
+
+# H ADDITIONAL EXPERIMENTS WITH DIFFERENT SETTINGS
+
+In this section, we discuss additional experiments for Section 3.3.1.
+
+H.1 GENERATING GRAPHS WITH OTHER NEIGHBORHOOD DISTRIBUTIONS
+
+In this section, we extend the experiments in Section 3.3.1 by including more patterns for neighborhood distributions. We aim to illustrate if the neighborhood distribution for different classes (labels) are sufficiently distinguishable from each other, we should generally observe similar $V$ -shape curves as in Figure 3 in Section 3.3.1. However, it is impractical to enumerate all possible neighborhood distributions. Hence, in this section, we include two additional neighborhood distribution patterns in Section H.1.1 and two extreme patterns in Section H.1.2.
+
+# H.1.1 ADDITIONAL PATTERNS
+
+Here, for both Cora and Citeseer, we adopt two additional sets of neighborhood distributions for adding new edges. For convenience, for Cora, we name the two neighborhood distribution patterns as Cora Neighborhood Distribution Pattern 1 and Cora Neighborhood Distribution Pattern 2. Similarly, for Citeseer, we name the two neighborhood distribution patterns as Citeseer Neighborhood Distribution Pattern 1 and Citeseer Neighborhood Distribution Pattern 2. We follow Algorithm 1 to generate graphs while utilizing these neighborhood distributions as the $\{ \mathcal { D } _ { c } \} _ { c = 0 } ^ { | C | - 1 }$ for Algorithm 1.
+
+The two neighborhood distribution patterns for Cora are listed as bellow. Figure 12 and Figure 13 show GCN’s performance on graphs generated from Cora following Cora Neighborhood Distribution Pattern 1 and Cora Neighborhood Distribution Pattern 2, respectively.
+
+Cora Neighborhood Distribution Pattern 1:
+
+$$
+\begin{array} { r l } & { \mathcal { D } _ { 0 } : \mathrm { { C a t e g o r i c a l } } ( [ \boldsymbol { 0 } , \frac { 1 } { 3 } , \frac { 1 } { 3 } , \frac { 1 } { 3 } , 0 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 1 } : \mathrm { { C a t e g o r i c a l } } ( [ \frac { 1 } { 3 } , 0 , 0 , 0 , \frac { 1 } { 3 } , \frac { 1 } { 3 } , 0 ] ) , } \\ & { \mathcal { D } _ { 2 } : \mathrm { { C a t e g o r i c a l } } ( [ \frac { 1 } { 3 } , 0 , 0 , 0 , 0 , \frac { 1 } { 3 } , \frac { 1 } { 3 } ] ) , } \\ & { \mathcal { D } _ { 3 } : \mathrm { { C a t e g o r i c a l } } ( [ \frac { 1 } { 3 } , 0 , 0 , 0 , \frac { 1 } { 3 } , 0 ] ) , } \\ & { \mathcal { D } _ { 4 } : \mathrm { { C a t e g o r i c a l } } ( [ \frac { 1 } { 3 } , 0 , 0 , \frac { 1 } { 3 } , 0 , \frac { 1 } { 3 } ] ) , } \\ & { \mathcal { D } _ { 4 } : \mathrm { { C a t e g o r i c a l } } ( [ 0 , \frac { 1 } { 3 } , 0 , \frac { 1 } { 3 } , 0 , \frac { 1 } { 3 } , 0 ] ) , } \\ & { \mathcal { D } _ { 5 } : \mathrm { { C a t e g o r i c a l } } ( [ 0 , \frac { 1 } { 3 } , \frac { 1 } { 3 } , 0 , \frac { 1 } { 3 } , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 6 } : \mathrm { { C a t e g o r i c a l } } ( [ 0 , 0 , \frac { 1 } { 2 } , \frac { 1 } { 2 } , 0 , 0 , 0 ] ) . } \end{array}
+$$
+
+
+Figure 12: Performance of GCN on synthetic graphs from Cora. Graphs are generated following Cora Neighborhood Distribution Pattern 1
+
+# Cora Neighborhood Distribution Pattern 2:
+
+$$
+\begin{array} { r l } & { \mathcal { D } _ { 0 } : \mathsf { C a t e g o r i c a l } ( [ [ \underline { { 0 } } , \underline { { 1 } } , 0 , \underline { { 1 } } , 0 , 0 , 0 ] ) , } \\ & { } \\ & { \mathcal { D } _ { 1 } : \mathsf { C a t e g o r i c a l } ( [ \underline { { 1 } } , \underline { { 0 } } , 0 , \underline { { 1 } } , 0 , 0 , 0 ] ) , } \\ & { } \\ & { \mathcal { D } _ { 2 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 0 , 1 , 0 , 0 , 0 ] ) , } \\ & { } \\ & { \mathcal { D } _ { 3 } : \mathsf { C a t e g o r i c a l } ( [ \underline { { 1 } } , \frac { 1 } { 5 } , \frac { 1 } { 5 } , \frac { 1 } { 5 } , 0 , \frac { 1 } { 5 } , \frac { 1 } { 5 } ] , 0 ) , } \\ & { } \\ & { \mathcal { D } _ { 4 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 0 , \underline { { 1 } } , 0 , \underline { { 1 } } , 0 ) , } \\ & { } \\ & { \mathcal { D } _ { 5 } : \mathsf { C a t e g o r i c a l } ( [ 0 , \underline { { 1 } } , \frac { 1 } { 3 } , 0 , 0 , \underline { { 1 } } , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 6 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 0 , 0 , 0 , 0 , 1 ] ) . } \end{array}
+$$
+
+
+Figure 13: Performance of GCN on synthetic graphs from Cora. Graphs are generated following Cora Neighborhood Distribution Pattern 2
+
+Clearly, the results demonstrated in Figure 12 and Figure 13 are similar to the black curve $( \gamma { = } 0 )$ in 3a. More specifically, they present $V$ -shape curves.
+
+The two neighborhood distribution patterns for Citeseer are listed as bellow. Figure 14 and Figure 15 show GCN’s performance on graphs generated from Citeseer following Citeseer Neighborhood Distribution Pattern 1 and Citeseer Neighborhood Distribution Pattern 2, respectively.
+
+Citeseer Neighborhood Distribution Pattern 1:
+
+$$
+\begin{array} { r l } & { \mathcal { D } _ { 0 } : \mathrm { C a t e g o r i c a l } ( [ 0 , \frac { 1 } { 2 } , \frac { 1 } { 2 } , 0 , 0 , 0 ] ) , } \\ & { } \\ & { \mathcal { D } _ { 1 } : \mathrm { C a t e g o r i c a l } ( [ \frac { 1 } { 3 } , 0 , 0 , \frac { 1 } { 3 } , \frac { 1 } { 3 } ] ) , } \\ & { } \\ & { \mathcal { D } _ { 2 } : \mathrm { C a t e g o r i c a l } ( [ \frac { 1 } { 2 } , 0 , 0 , 0 , \frac { 1 } { 2 } ] ) , } \\ & { \mathcal { D } _ { 3 } : \mathrm { C a t e g o r i c a l } ( [ 0 , 0 , 0 , 1 , 0 ) , } \\ & { \mathcal { D } _ { 4 } : \mathrm { C a t e g o r i c a l } ( [ 0 , \frac { 1 } { 3 } , 0 , \frac { 1 } { 3 } , 0 , \frac { 1 } { 3 } ] ) , } \\ & { } \\ & { \mathcal { D } _ { 5 } : \mathrm { C a t e g o r i c a l } ( [ 0 , \frac { 1 } { 3 } , \frac { 1 } { 3 } , 0 , \frac { 1 } { 3 } , 0 ] ) , } \end{array}
+$$
+
+
+Figure 14: Performance of GCN on synthetic graphs from Citeseer. Graphs are generated following Citeseer Neighborhood Distribution Pattern 1
+
+$$
+\begin{array} { r l } & { \mathcal { D } _ { 0 } : \mathsf { C a t e g o r i c a l } ( [ 0 , \frac { 1 } { 2 } , 0 , \frac { 1 } { 2 } , 0 , 0 ] ) , } \\ & { } \\ & { \mathcal { D } _ { 1 } : \mathsf { C a t e g o r i c a l } ( [ \frac { 1 } { 2 } , 0 , 0 , \frac { 1 } { 3 2 } , 0 ] ) , } \\ & { } \\ & { \mathcal { D } _ { 2 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 0 , 1 , 0 , 0 ] ) , } \\ & { } \\ & { \mathcal { D } _ { 3 } : \mathsf { C a t e g o r i c a l } ( [ \frac { 1 } { 5 } , \frac { 1 } { 5 } , \frac { 1 } { 5 } , 0 , \frac { 1 } { 5 } , \frac { 1 } { 5 } ) , } \\ & { } \\ & { \mathcal { D } _ { 4 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 0 , \frac { 1 } { 2 } , 0 , \frac { 1 } { 2 } ] ) , } \\ & { } \\ & { \mathcal { D } _ { 5 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 0 , \frac { 1 } { 2 } , \frac { 1 } { 2 } , 0 ] ) , } \end{array}
+$$
+
+
+Figure 15: Performance of GCN on synthetic graphs from Citeseer. Graphs are generated following Citeseer Neighborhood Distribution Pattern 2
+
+Clearly, the results demonstrated in Figure 14 and Figure 15 are similar to the black curve $( \gamma { = } 0 )$ in 3b. More specifically, they present $V$ -shape curves.
+
+# H.1.2 EXTREME NEIGHBORHOOD DISTRIBUTION PATTERNS
+
+In this subsection, we further extend the experiments in Section 3.3.1 by investigating “extreme” neighborhood distribution patterns suggested by WXGg. More specifically, these two patterns are “a given label are connected to a single different label” and “a given label are connected to all other labels other excluding its own label”. For convenience, we denote these two types of neighborhood distributions as single and all, respectively. We utilize these neighborhood distributions as $\{ \mathcal { D } _ { c } \} _ { c \equiv 0 } ^ { | \mathcal { C } | - 1 } .$ for generating synthetic graphs. Next, we first present the results for Cora with analysis for both the single and all neighborhood distribution patterns. Then, we present the results for Citeseer but omit analysis and discussion since the observations are similar to those we make for Cora.
+
+Note that to ensure “a label is only connected to a single different label”, we need to group the labels into pairs and “connect them”. Since there are different ways to group labels into pairs, there exists various ways to formulate the single neighborhood distributions. We demonstrate one of the single neighborhood distributions as all the other possible are symmetric to each other. For Cora, the single neighborhood distribution we adopted is as follows. Note that there are 7 labels in Cora, and we could not pair all the labels. Thus, we leave one of labels (label 4 in our setting) untouched, i.e, it is not connect to other labels during the edge addition process.
+
+$$
+\begin{array} { r l } & { \mathcal { D } _ { 0 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 1 , 0 , 0 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 1 } : \mathsf { C a t e g o r i c a l } ( [ 1 , 0 , 0 , 0 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 2 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 0 , 1 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 3 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 1 , 0 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 4 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 0 , 0 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 5 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 0 , 0 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 6 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 0 , 0 , 0 , 1 ] ) . } \end{array}
+$$
+
+The GCN’s performance on these graphs generated from Cora following the single neighborhood distribution pattern is shown in Figure 16a. It clearly presents a $V$ -shape curve. Almost perfect performance can be achieved when the homophily ratio gets close to 0. This is because the single neighborhood distributions for different labels are clearly distinguishable from each other. We further demonstrate the heatmap of cross-class similarity for the generated graph with homophily ratio 0.07 (the right most point in Figure 16a) in Figure 16b. Clearly, this graph has very high intra-class similarity and very low inter-class similarity, which explains the good performance.
+
+For Cora, the all neighborhood distribution patterns can be described as follows.
+
+$$
+\begin{array} { r } { \mathcal { D } _ { 0 } : \mathsf { C a t e g o r i c a l } ( [ 0 , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } ] ) , } \\ { \mathcal { D } _ { 1 } : \mathsf { C a t e g o r i c a l } ( [ \frac { 1 } { 6 } , 0 , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } ] ) , } \\ { \mathcal { D } _ { 2 } : \mathsf { C a t e g o r i c a l } ( [ \frac { 1 } { 6 } , \frac { 1 } { 6 } , 0 , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } ] ) , } \end{array}
+$$
+
+
+(b) Cross-class neighborhood similarity for the graph generated from Cora following single with homophily ratio 0.07 (the right most point in Figure 16a).
+
+(a) Performance of GCN on synthetic graphs from Cora. Graphs are generated following single neighborhood distribution.
+
+
+Figure 16: Cora: single neighborhood distribution pattern
+
+$$
+\begin{array} { r l } & { \mathcal { D } _ { 3 } : \mathsf { C a t e g o r i c a l } ( [ \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , 0 , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } ] ) , } \\ & { } \\ & { \mathcal { D } _ { 4 } : \mathsf { C a t e g o r i c a l } ( [ \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , 0 , \frac { 1 } { 6 } , \frac { 1 } { 6 } ] ) , } \\ & { } \\ & { \mathcal { D } _ { 5 } : \mathsf { C a t e g o r i c a l } ( [ \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , 0 , \frac { 1 } { 6 } ] ) , } \\ & { } \\ & { \mathcal { D } _ { 6 } : \mathsf { C a t e g o r i c a l } ( [ \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } , \frac { 1 } { 6 } ] ) . } \end{array}
+$$
+
+The GCN’s performance on these graphs generated from Cora following the all neighborhood distribution pattern is shown in Figure 17a. Again, it clearly presents a $V$ -shape curve. However, the performance is not perfectly good even when we add extremely large number of edges. For example, for the right most point in Figure 17a, we add almost as 50 times many as edges into the graph and the homophily ratio is reduced to 0.03 while GCN’s performance for it is only around $7 0 \%$ . This is because the all neighborhood distributions for different labels are not easily distinguishable from each other. More specifically, any two neighborhood distributions for different labels in all are very similar each other (they share $^ { 6 6 } 4$ labels”). We further empirically demonstrate this by providing the heatmap of cross-class similarity for the generated graph with homophily ratio 0.03 (the right most point in Figure 17a) in Figure 17b. As per our discussion in Observation 2, this graph is with not such “good” heterophily and GCNs cannot produce perfect performance for it. This observation further demonstrates our key argument that the distinguishability of the distributions for different labels are important for performance.
+
+For Citeseer, the single neighborhood distribution we adopted is as follows. The GCN’s performance on these graphs generated from Citeseer following the single neighborhood distribution pattern is shown in Figure 18a. The heatmap of cross-class similarity for the generated graph with homophily ratio 0.06 (the right most point in Figure 18a) in Figure 18b.
+
+$$
+\begin{array} { r l } & { \mathcal { D } _ { 0 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 1 , 0 , 0 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 1 } : \mathsf { C a t e g o r i c a l } ( [ 1 , 0 , 0 , 0 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 2 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 0 , 1 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 3 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 1 , 0 , 0 , 0 ] ) , } \\ & { \mathcal { D } _ { 4 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 0 , 0 , 0 , 1 ] ) , } \\ & { \mathcal { D } _ { 5 } : \mathsf { C a t e g o r i c a l } ( [ 0 , 0 , 0 , 0 , 1 , 0 ] ) . } \end{array}
+$$
+
+For Citeseer, the all neighborhood distribution patterns can be described as follows. The GCN’s performance on these graphs generated from Citeseer following the all neighborhood distribution pattern is shown in Figure 19a. The heatmap of cross-class similarity for the generated graph with homophily ratio 0.01 (the right most point in Figure 19a) in Figure 19b.
+
+
+
+(a) Performance of GCN on synthetic graphs from Cora. Graphs are generated following all neighborhood distribution.
+
+
+Figure 17: Cora: all neighborhood distribution pattern
+
+(b) Cross-class neighborhood similarity for the graph generated from Cora following all with homophily ratio 0.03 (the right most point in Figure 17a).
+
+
+
+(a) Performance of GCN on synthetic graphs from Citeseer. Graphs are generated following single neighborhood distribution.
+
+
+Figure 18: Citeseer: single neighborhood distribution pattern
+
+(b) Cross-class neighborhood similarity for the graph generated from Citeseer following single with homophily ratio 0.06.
+
+$$
+\begin{array} { r } { \mathcal { D } _ { 1 } : \mathsf { C a t e g o r i c a l } ( [ 1 / 5 , 0 , 1 / 5 , 1 / 5 , 1 / 5 , 1 / 5 ] ) , } \\ { \mathcal { D } _ { 2 } : \mathsf { C a t e g o r i c a l } ( [ 1 / 5 , 1 / 5 , 0 , 1 / 5 , 1 / 5 , 1 / 5 ] ) , } \\ { \mathcal { D } _ { 3 } : \mathsf { C a t e g o r i c a l } ( [ 1 / 5 , 1 / 5 , 1 / 5 , 0 , 1 / 5 , 1 / 5 ] ) , } \\ { \mathcal { D } _ { 4 } : \mathsf { C a t e g o r i c a l } ( [ 1 / 5 , 1 / 5 , 1 / 5 , 1 / 5 , 0 , 1 / 5 ] ) , } \\ { \mathcal { D } _ { 5 } : \mathsf { C a t e g o r i c a l } ( [ 1 / 5 , 1 / 5 , 1 / 5 , 1 / 5 , 0 , 1 / 5 ] ) . } \end{array}
+$$
+
+Similar observations as those we made for Cora can be made for Citeseer, hence we do not repeat the analysis here.
+
+# I LIMITATION
+
+Though we provide new perspectives and understandings of GCN’s performance on heterophilous graphs, our work has some limitations. To make the theoretical analysis more feasible, we make a few assumptions. We dropped the non-linearity in the analysis since the main focus of this paper is the aggregation part of GCN. While the experiment results empirically demonstrate that our analysis seems to hold with non-linearity, more formal investigation for GCN with non-linearity is valuable. Our analysis in Theorem 2 assumes the independence between features, which limits the generality of the analysis and we would like to conduct further instigation to more general case. We provide theoretical understanding on GCN’s performance based on CSBM, which stands for a type of graphs (a) Performance of GCN on synthetic graphs from Citeseer. Graphs are generated following all neighborhood distribution.
+
+
+(b) Cross-class neighborhood similarity for the graph generated from Citeseer following all with homophily ratio 0.01.
+
+
+Figure 19: Citeseer: all neighborhood distribution pattern
+
+attracting increasing attention in the research community. However, it is not ideal for modeling sparse graphs, which are commonly observed in the real-world. Hence, it is important to devote more efforts to analyzing more general graphs. We believe our results established a solid initial study for further investigation. Finally, our current theoretical analysis majorly focuses on the GCN model; we hope to extend this analysis in the future to more general message-passing neural networks.
+
+# J BROADER IMPACT
+
+Graph neural networks (GNNs) are a prominent architecture for modeling and understanding graphstructured data in a variety of practical applications. Most GNNs have a natural inductive bias towards leveraging graph neighborhood information to make inferences, which can exacerbate unfair or biased outcomes during inference, especially when such neighborhoods are formed according to inherently biased upstream processes, e.g. rich-get-richer phenomena and other disparities in the opportunities to “connect” to other nodes: For example, older papers garner more citations than newer ones, and are hence likely to have a higher in-degree in citation networks and hence benefit more from neighborhood information; similar analogs can be drawn for more established webpages attracting more attention in search results. Professional networking (“ability to connect”) may be easier for those individuals (nodes) who are at top-tier, well-funded universities compared to those who are not. Such factors influence network formation, sparsity, and thus GNN inference quality simply due to network topology (Tang et al., 2020b). Given these acknowledged issues, GNNs are still used in applications including ranking (Sankar et al., 2021), recommendation(Jain and Molino), engagement prediction (Tang et al., 2020a), traffic modeling(Jiang and Luo, 2021), search and discovery (Ying et al., 2018) and more, and when unchecked, suffer traditional machine learning unfairness issues (Dai and Wang, 2021).
+
+Despite these practical impacts, the prominent notion in prior literature in this space has been that such methods are inapplicable or perform poorly on heterophilous graphs, and this may have mitigated practitioners’ interests in applying such methods for ML problems in those domains conventionally considered heterophily-dominant (e.g. dating networks). Our work shows that this notion is misleading, and that heterophily and homophily are not themselves responsible for good or bad inference performance. We anticipate this finding to be helpful in furthering research into the capacity of GNN models to work in diverse data settings, and emphasize that our work provides an understanding, rather than a new methodology or approach, and thus do not anticipate negative broader impacts from our findings.
+
+# ACKNOWLEDGEMENTS
+
+This research is supported by the National Science Foundation (NSF) under grant numbers IIS1714741, CNS1815636, IIS1845081, IIS1907704, IIS1928278, IIS1955285, IOS2107215, and
+
+IOS2035472, the Army Research Office (ARO) under grant number W911NF-21-1-0198, the Home Depot, Cisco Systems Inc and Snap Inc.
\ No newline at end of file
diff --git a/md/dev/ucNDIDRNjjv/ucNDIDRNjjv.md b/md/dev/ucNDIDRNjjv/ucNDIDRNjjv.md
new file mode 100644
index 0000000000000000000000000000000000000000..1035695df47983f8368fdb7f90deffda395c661d
--- /dev/null
+++ b/md/dev/ucNDIDRNjjv/ucNDIDRNjjv.md
@@ -0,0 +1,237 @@
+# Non-stationary Transformers: Exploring the Stationarity in Time Series Forecasting
+
+Yong Liu∗, Haixu Wu∗, Jianmin Wang, Mingsheng LongB School of Software, BNRist, Tsinghua University, China {liuyong21,whx20}@mails.tsinghua.edu.cn, {jimwang,mingsheng}@tsinghua.edu.cn
+
+# Abstract
+
+Transformers have shown great power in time series forecasting due to their global-range modeling ability. However, their performance can degenerate terribly on non-stationary real-world data in which the joint distribution changes over time. Previous studies primarily adopt stationarization to attenuate the nonstationarity of original series for better predictability. But the stationarized series deprived of inherent non-stationarity can be less instructive for real-world bursty events forecasting. This problem, termed over-stationarization in this paper, leads Transformers to generate indistinguishable temporal attentions for different series and impedes the predictive capability of deep models. To tackle the dilemma between series predictability and model capability, we propose Non-stationary Transformers as a generic framework with two interdependent modules: Series Stationarization and De-stationary Attention. Concretely, Series Stationarization unifies the statistics of each input and converts the output with restored statistics for better predictability. To address the over-stationarization problem, Destationary Attention is devised to recover the intrinsic non-stationary information into temporal dependencies by approximating distinguishable attentions learned from raw series. Our Non-stationary Transformers framework consistently boosts mainstream Transformers by a large margin, which reduces MSE by $4 9 . 4 3 \%$ on Transformer, $4 7 . 3 4 \%$ on Informer, and $4 6 . 8 9 \%$ on Reformer, making them the state-of-the-art in time series forecasting. Code is available at this repository: https://github.com/thuml/Nonstationary_Transformers.
+
+# 1 Introduction
+
+Time series forecasting has become increasingly ubiquitous in real-world applications, such as weather forecasting, energy consumption planning, and financial risk assessment. Recently, Transformers [32] have achieved progressive breakthrough on extensive areas [11, 12, 10, 22]. Especially in time series forecasting, credited to their stacked structure and the capability of attention mechanisms, Transformers can naturally capture the temporal dependencies from deep multi-level features [37, 17, 20, 35], thereby fitting the series forecasting task perfectly.
+
+Despite the remarkable architectural design, it is still challenging for Transformers to predict realworld time series because of the non-stationarity of data. Non-stationary time series is characterized by the continuous change of statistical properties and joint distribution over time, which makes the time series less predictable [6, 14]. Besides, it is a fundamental problem to make deep models generalize well on a varying distribution [26, 19, 5]. In previous work, it is generally acknowledged to pre-process the time series by stationarization [24, 27, 15], which can attenuate the non-stationarity of raw time series for better predictability and provide more stable data distribution for deep models.
+
+
+Figure 1: Visualization of learned temporal attentions for different series with varied mean $\mu$ and standard deviation $\sigma$ . (a) is from the vanilla Transformer [32] trained on raw series. (b) is from the Transformer trained on stationarized series, which presents similar attentions. (c) is from Nonstationary Transformers, which involves De-stationary Attention to avoid over-stationarization.
+
+However, non-stationarity is the inherent property of real-world time series and also good guidance for discovering temporal dependencies for forecasting. Experimentally, we observe that training on the stationarized series will undermine the distinction of attentions learned by Transformers. While vanilla Transformers [32] can capture distinct temporal dependencies from different series in Figure 1(a), Transformers trained on the stationarized series tend to generate indistinguishable attentions in Figure 1(b). This problem, named by the over-stationarization, will bring unexpected side-effect that makes Transformers fail to capture eventful temporal dependencies, limit the model’s predictive ability, and even induce the model to generate outputs with huge non-stationarity deviation from the ground truth. Thus, how to attenuate time series non-stationarity towards better predictability and mitigate the over-stationarization problem for model capability simultaneously is the key problem to further improve the performance of forecasting.
+
+In this paper, we explore the effect of stationarization in time series forecasting and propose Nonstationary Transformers as a general framework, which empowers Transformer [32] and its efficient variants [17, 37, 35] with great predictive ability for real-world time series. The proposed framework involves two interdependent modules: Series Stationarization to increase the predictability of nonstationary series and De-stationary Attention to alleviate over-stationarization. Technically, Series Stationarization adopts a simple but effective normalization strategy to unify the key statistics of each series without extra parameters. And De-stationary Attention approximates the attention of unstationarized data and compensates the intrinsic non-stationarity of raw series. Benefiting from the above designs, Non-stationary Transformers can take advantage of the great predictability of stationarized series and crucial temporal dependencies discovered from original non-stationary data. Our method achieves state-of-the-art performance on six real-world benchmarks and can generalize to various Transformers for further improvement. The contributions lie in three folds:
+
+• We refine that the predictive capability of non-stationary series is essential in real-world forecasting. By detailed analysis, we find out that current stationarization approaches will lead to the over-stationarization problem, limiting the predictive capability of Transformers. • We propose Non-stationary Transformers as a generic framework, including Series Stationarization to make the series more predictable and De-stationary Attention to avoid the over-stationarization problem by re-incorporating the non-stationarity of original series. • Non-stationary Transformers consistently boosts four mainstream Transformers by a large margin and achieves state-of-the-art performance on six real-world benchmarks.
+
+# 2 Related Work
+
+# 2.1 Deep Models for Time Series Forecasting
+
+In recent years, deep models with elaboratively designed architectures have achieved great progress in time series forecasting. RNN-based models [33, 36, 23, 29, 30] are proposed for application in an autoregressive manner for sequence modeling, but the recurrent structure can suffer from modeling long-term dependency. Soon afterward, Transformer [32] emerges and shows great power in sequence modeling. To overcome the quadratic computation growth on sequence length, subsequent works aim to reduce Self-Attention’s complexity. Especially in time series forecasting, Informer [37] extends Self-Attention with KL-divergence criterion to select dominant queries. Reformer [17] introduces local-sensitive hashing (LSH) to approximate attention by allocated similar queries. Not only improved by reduced complexity, the following models further develop delicate building blocks for time series forecasting. Autoformer [35] fuses the decomposition blocks into a canonical structure and develops Auto-Correlation to discover series-wise connections. Pyraformer [21] designs pyramid attention module (PAM) to capture temporal dependencies with different hierarchies. Other deep but Transformer-free models also achieve remarkable performance. N-BEATS [25] proposes the explicit decomposition of trend and seasonal terms with strong interpretability. N-HiTS [9] introduces hierarchical layout and multi-rate sampling for tackling time series with respective frequency bands. In this paper, different from previous works focusing on architectural design, we analyze the series forecasting task from the basic view of stationarity, which is an essential property of time series [6, 14]. It is also notable that as a general framework, our proposed Non-stationary Transformers can be easily applied to various Transformer-based models.
+
+# 2.2 Stationarization for Time Series Forecasting
+
+While stationarity is important to the predictability of time series [6, 14], real-world series always present non-stationarity. To tackle this problem, the classical statistical method ARIMA [7, 8] stationarizes the time series through differencing. As for deep models, since the distribution-varying problem accompanied by non-stationarity makes deep forecasting even more intractable, stationarization methods are widely explored and always adopted as the pre-processing for deep model inputs. Adaptive Norm [24] applies z-score normalization for each series fragment by global statistics of a sampled set. DAIN [27] employs a nonlinear neural network to adaptively stationarize time series with observed training distribution. RevIN [15] introduces a two-stage instance normalization [31] that transforms model input and output respectively to reduce the discrepancy of each series. In contrast, we find out that directly stationarizing time series will damage the model’s capability of modeling specific temporal dependency. Therefore, unlike previous methods, in addition to the stationarization, Non-stationary Transformers further develops De-stationary Attention to bring the intrinsic non-stationarity of the raw series back to attention.
+
+# 3 Non-stationary Transformers
+
+As aforementioned, stationarity is an important element of time series predictability. Previous “direct stationarization” designs can attenuate non-stationarity of series for better predictability, but they obviously neglect inherent properties of real-world series, which will result in the over-stationarization problem as stated in Figure 1. To deal with the dilemma, we go beyond previous works and propose Non-stationary Transformers as a generic framework. Our model involves two complementary parts: Series Stationarization to attenuate time series non-stationarity and De-stationary Attention to re-incorporate non-stationary information of raw series. Empowered by these designs, Non-stationary Transformers can improve data predictability and maintain model capability simultaneously.
+
+# 3.1 Series Stationarization
+
+Non-stationary time series make the forecasting task intractable for deep models because it is hard for them to generalize well on series with changed statistics during inference, typically varied mean and standard deviation. The pilot work, RevIN [15] applies instance normalization with learnable affine parameters to each input and restores the statistics to the corresponding output, which makes each series follow a similar distribution. Experimentally, we find that this design also works well without learnable parameters. Thus, we propose a more straightforward but effective design to wrap Transformers as the base model without extra parameters, naming by Series Stationarization. As is shown in Figure 2, it contains two corresponding operations: Normalization module at first to deal with the non-stationary series caused by varied mean and standard deviation, and De-normalization module at the end to transform the model outputs back with original statistics. Here are the details.
+
+
+Figure 2: Non-stationary Transformers. Series Stationarization is adopted as a wrapper on the base model to normalize each incoming series and de-normalize the output. De-stationary Attention replaces the original Attention mechanism to approximate attention learned from unstationarized series, which rescales current temporal dependency weights with learned de-stationary factors $\tau , \Delta$ .
+
+Normalization module To attenuate the non-stationarity of each input series, we conduct normalization on the temporal dimension by a sliding window over time. For each input series $\mathbf { x } = [ x _ { 1 } , x _ { 2 } , . . . , x _ { S } ] ^ { \top } \in \mathbb { R } ^ { S \times C }$ , we transform it by translation and scaling operations and obtain $\mathbf { x } ^ { \prime } = [ x _ { 1 } ^ { \prime } , x _ { 2 } ^ { \prime } , . . . , x _ { S } ^ { \prime } ] ^ { \top } \in \mathbb { R } ^ { S \times C }$ , where $S$ and $C$ denote the sequence length and variable number respectively. The Normalization module can be formulated as follows:
+
+$$
+\mu _ { \mathbf { x } } = \frac { 1 } { S } \sum _ { i = 1 } ^ { S } x _ { i } , \sigma _ { \mathbf { x } } ^ { 2 } = \frac { 1 } { S } \sum _ { i = 1 } ^ { S } ( x _ { i } - \mu _ { \mathbf { x } } ) ^ { 2 } , x _ { i } ^ { \prime } = \frac { 1 } { \sigma _ { \mathbf { x } } } \odot ( x _ { i } - \mu _ { \mathbf { x } } ) ,
+$$
+
+where µx, σx ∈ RC×1, 1 means the element-wise division and $\odot$ is the element-wise product. Note that Normalization module decreases the distributional discrepancy among each input time series, making the distribution of the model input more stable.
+
+De-normalization module As shown in Figure 2, after the base model $\mathcal { H }$ predicting the future value with length- $O$ , we adopt De-normalization to transform the model output $\mathbf { y } ^ { \prime } = [ \breve { y _ { 1 } ^ { \prime } } , y _ { 2 } ^ { \prime } , . . . , y _ { O } ^ { \prime } ] ^ { \top } \in$ $\mathbb { R } ^ { O \times C }$ with $\sigma _ { \mathbf { x } }$ and $\mu _ { \mathbf { x } }$ and obtain $\hat { \mathbf { y } } = [ \hat { y } _ { 1 } , \hat { y } _ { 2 } , . . . , \hat { y } _ { O } ] ^ { \intercal }$ as the eventual forecasting results. The De-normalization module can be formulated as follows:
+
+$$
+\mathbf { y } ^ { \prime } = \mathcal { H } ( \mathbf { x } ^ { \prime } ) , \hat { y } _ { i } = \sigma _ { \mathbf { x } } \odot ( y _ { i } ^ { \prime } + \mu _ { \mathbf { x } } ) .
+$$
+
+By means of the two-stage transformation, the base models will receive stationarized inputs, which follow a stable distribution and are easier to generalize. This design also makes the model equivariant to translational and scaling perturbance of time series, thereby benefiting real-world series forecasting.
+
+# 3.2 De-stationary Attention
+
+While the statistics of each time series are explicitly restored to the corresponding prediction, the non-stationarity of the original series cannot be fully recovered only by De-normalization. For instance, Series Stationarization can generate the same stationarized input $\mathbf { x } ^ { \prime }$ from distinct time series $\mathbf { x } _ { 1 }$ , $\mathbf { x } _ { 2 }$ (i.e. $\mathbf { x } _ { 2 } = \alpha \mathbf { x } _ { 1 } + \beta )$ , and the base model will get identical attention that fails to capture crucial temporal dependencies entangled with non-stationarity (Figure 1). In other words, the undermined effects caused by over-stationarization happen inside the deep model, especially in the calculation of attention. Furthermore, non-stationary time series are fragmented and normalized into several series chunks with the same mean and variance, which follow more similar distributions than the raw data before stationarization. Thus, the model is more likely to generate over-stationary and uneventful outputs, which is irreconcilable with the natural non-stationarity of the original series.
+
+To tackle the over-stationarization problem caused by Series Stationarization, we propose a novel De-stationary Attention mechanism, which can approximate the attention that is obtained without stationarization and discover the particular temporal dependencies from original non-stationary data.
+
+Analysis of the plain model As mentioned above, the over-stationarization problem is caused by the vanishment of inherent non-stationarity information, which will make the base model fail to capture eventful temporal dependencies for forecasting. Therefore, we try to approximate the attention learned from the original non-stationary series. We start from the formula of Self-Attention [32]:
+
+$$
+{ \mathrm { A t t n } } ( \mathbf { Q } , \mathbf { K } , \mathbf { V } ) = { \mathrm { S o f t m a x } } \left( { \frac { \mathbf { Q } \mathbf { K } ^ { \top } } { { \sqrt { d _ { k } } } } } \right) \mathbf { V } ,
+$$
+
+where $\mathbf { Q } , \mathbf { K } , \mathbf { V } \in \mathbb { R } ^ { S \times d _ { k } }$ are length- $S$ queries, keys and values of $d _ { k }$ -dimension respectively, and Softmax $( \cdot )$ is conducted row by row. To simplify the analysis, we assume the embedding and feed-forward layers $f$ to hold the linear properties2 and $f$ is conducted separately on each time point, that is, each query token in $\mathbf { Q } = [ q _ { 1 } , q _ { 2 } , . . . , q _ { S } ] ^ { \top }$ can be calculated as $q _ { i } = f ( x _ { i } )$ with respect to the input series $\mathbf { x } = [ x _ { 1 } , x _ { 2 } , \cdots , x _ { S } ] ^ { \top }$ . Since it is a convention to conduct normalization on each time series variable to avoid certain variable that dominates the scale, we can further assume each variable of series $\mathbf { x }$ shares the same variance, and thus original $\sigma _ { \mathbf { x } } \in \mathbb { R } ^ { C \times 1 }$ is reduced to a scalar. After Normalization module, the model receives the stationarized input $\mathbf { x } ^ { \prime } = ( \mathbf { x } - \mathbf { 1 } \mu _ { \mathbf { x } } ^ { \top } ) / \sigma _ { \mathbf { x } }$ , where $\mathbf { 1 } \in \mathbb { R } ^ { S \times 1 }$ is an all-ones vector. Based on the linear property assumption, it can be proved that the Attention layer will receive $\mathbf { Q } ^ { \prime } = [ f ( x _ { 1 } ^ { \prime } ) , . . . , f ( x _ { S } ^ { \prime } ) ] ^ { \top } = ( \mathbf { \bar { Q } } - \mathbf { 1 } \mu _ { \mathbf { Q } } ^ { \top } ) / \sigma _ { \mathbf { x } }$ , where $\boldsymbol { \mu _ { \mathbf { Q } } } \in \mathbb { R } ^ { d _ { k } \times 1 }$ is the mean of $\mathbf { Q }$ along the temporal dimension (See Appendix for a detailed proof). And so is the corresponding transformed $\mathbf { K } ^ { \prime } , \mathbf { V } ^ { \prime }$ . Without Series Stationarization, the input of $\operatorname { S o f t m a x } ( \cdot )$ in Self-Attention should be $\mathbf { Q K } ^ { \top } / \sqrt { d _ { k } }$ , while now the attention is calculated based on $\mathbf { Q } ^ { \prime } , \mathbf { K } ^ { \prime }$ :
+
+$$
+\begin{array} { c } { { \displaystyle { \bf Q } ^ { \prime } { \bf K } ^ { \prime \top } = \frac { 1 } { \sigma _ { \bf x } ^ { 2 } } \left( { \bf Q } { \bf K } ^ { \top } - { \bf 1 } ( \mu _ { \bf Q } ^ { \top } { \bf K } ^ { \top } ) - ( { \bf Q } \mu _ { \bf K } ) { \bf 1 } ^ { \top } + { \bf 1 } ( \mu _ { \bf Q } ^ { \top } \mu _ { \bf K } ) { \bf 1 } ^ { \top } \right) , } } \\ { { \mathrm { S o f t m a x } \left( \frac { { \bf Q } { \bf K } ^ { \top } } { \sqrt { d _ { k } } } \right) = \mathrm { S o f t m a x } \left( \frac { \sigma _ { \bf x } ^ { 2 } { \bf Q } ^ { \prime } { \bf K } ^ { \prime \top } + { \bf 1 } ( \mu _ { \bf Q } ^ { \top } { \bf K } ^ { \top } ) + ( { \bf Q } \mu _ { \bf K } ) { \bf 1 } ^ { \top } - { \bf 1 } ( \mu _ { \bf Q } ^ { \top } \mu _ { \bf K } ) { \bf 1 } ^ { \top } } { \sqrt { d _ { k } } } \right) . } } \end{array}
+$$
+
+We find that $\mathbf { Q } \mu _ { \mathbf { K } } \in \mathbb { R } ^ { S \times 1 }$ and $\mu _ { \mathbf { Q } } ^ { \top } \mu _ { \mathbf { K } } \in \mathbb { R }$ , and they are repeatedly operated on each column and element of $\sigma _ { \mathbf { x } } ^ { 2 } \mathbf { Q } ^ { \prime } { \mathbf { K ^ { \prime } } } ^ { \top } \in \mathbb { R } ^ { S \times S }$ respectively. Since Softmax $( \cdot )$ is invariant to the same translation on the row dimension of input, we have the following equation:
+
+$$
+\mathrm { S o f t m a x } \left( \frac { \mathbf { Q } \mathbf { K } ^ { \top } } { \sqrt { d _ { k } } } \right) = \mathrm { S o f t m a x } \left( \frac { \sigma _ { \mathbf { x } } ^ { 2 } \mathbf { Q } ^ { \prime } { \mathbf { K ^ { \prime } } } ^ { \top } + \mathbf { 1 } \mu _ { \mathbf { Q } } ^ { \top } \mathbf { K } ^ { \top } } { \sqrt { d _ { k } } } \right) .
+$$
+
+Equation 5 deduces a direct expression of the attention Softmax $\left( \mathbf { Q K } ^ { \top } / \sqrt { d _ { k } } \right)$ learned from raw series $\mathbf { x }$ . Except for the current $\mathbf { Q } ^ { \prime } , \mathbf { K } ^ { \prime }$ from stationarized series $\mathbf { x } ^ { \prime }$ , this expression also requires the non-stationary information $\sigma _ { \mathbf { x } } , \mu _ { \mathbf { Q } } , \mathbf { K }$ that are eliminated by Series Stationarization.
+
+De-stationary Attention To recover the original attention on non-stationary series, we attempt to bring the vanished non-stationary information back to its calculation. Based on Equation 5, the key is to approximate the positive scaling scalar $\tau = \sigma _ { \mathbf { x } } ^ { 2 } \in \mathbb { R } ^ { + }$ and shifting vector $\pmb { \Delta } \overset { \cdot } { = } \mathbf { K } \mu _ { \mathbf { Q } } \in \mathbb { R } ^ { S \times \bar { 1 } }$ , which are defined as $d e$ -stationary factors. Since the strict linear property hardly holds for a deep model, other than estimating and utilizing real factors with great effort, we try to learn de-stationary factors directly from the statistics of unstationarized $\mathbf { x } , \mathbf { Q }$ and $\mathbf { K }$ by a simple but effective multilayer perceptron layer. As we can only discover limited non-stationary information from current $\dot { \bf Q ^ { \prime } } , \bar { \bf K ^ { \prime } }$ , the unique and reasonable source to compensate non-stationarity is the original $\mathbf { x }$ without being normalized. Thus, as a direct deep learning implementation of Equation 5, we apply a multilayer perceptron as the projector to learn de-stationary factors $\tau , \Delta$ from the statistics $\mu _ { \mathbf { x } } , \sigma _ { \mathbf { x } }$ of unstationarized $\mathbf { x }$ individually. And the De-stationary Attention is calculated as follows:
+
+$$
+\begin{array} { c } { \log \tau = \mathrm { M L P } ( \boldsymbol { \sigma } _ { \mathbf { x } } , \mathbf { x } ) , \pmb { \Delta } = \mathrm { M L P } ( \mu _ { \mathbf { x } } , \mathbf { x } ) , } \\ { \mathrm { A t t n } ( \mathbf { Q } ^ { \prime } , \mathbf { K } ^ { \prime } , \mathbf { V } ^ { \prime } , \tau , \pmb { \Delta } ) = \mathrm { S o f t m a x } \left( \frac { \tau \mathbf { { Q } ^ { \prime } } \mathbf { K } ^ { \prime } ^ { \top } + \mathbf { 1 } \pmb { \Delta } ^ { \top } } { \sqrt { d _ { k } } } \right) \mathbf { V } ^ { \prime } , } \end{array}
+$$
+
+where the de-stationary factors $\tau$ and $\pmb { \Delta }$ are shared by De-stationary Attention of all layers (Figure 2). De-stationary Attention mechanism learns the temporal dependencies from both stationarized series $\mathbf { Q } ^ { \prime }$ , $\mathbf { K } ^ { \prime }$ and non-stationary series $\mathbf { x }$ , $\mu _ { \mathbf { x } } , \sigma _ { \mathbf { x } }$ , and multiplies by the stationarized values $\mathbf { V } ^ { \prime }$ . Therefore, it can benefit from the predictability of stationarized series and maintain the inherent temporal dependencies of raw series simultaneously.
+
+Overall architecture Following the prior use of Transformers [37, 35] in time series forecasting, we adopt the standard Encoder-Decoder structure (Figure 2), where the encoder is to extract information from past observations, and the decoder is to aggregate past information and refine the prediction from simple initialization. The canonical Non-stationary Transformer is wrapped by Series Stationarization to both the input and output of vanilla Transformer [32], and replacing the Self-Attention by our proposed De-stationary Attention, which can boost the non-stationary series predictive capability of the base model. For the Transformer variants [17, 37, 35], we transform the terms inside Softmax $( \cdot )$ with the de-stationary factors $\tau$ , $\pmb { \Delta }$ to re-integrate the non-stationary information (See Appendix for the implementation details).
+
+# 4 Experiments
+
+We conduct extensive experiments to evaluate the performance of Non-stationary Transformers on six real-world time series forecasting benchmarks and further validate the generality of the proposed framework on various mainstream Transformer variants.
+
+Datasets Here are the descriptions of the datasets: (1) Electricity [3] records the hourly electricity consumption of 321 clients from 2012 to 2014. (2) ETT [37] contains the time series of oil destationary factors and power load collected by electricity transformers from July 2016 to July 2018. ETTm1 /ETTm2 are recorded every 15 minutes, and ETTh1/ETTh2 are recorded every hour. (3) Exchange [18] collects the panel data of daily exchange rates from 8 countries from 1990 to 2016. (4) ILI [1] collects the ratio of influenza-like illness patients versus the total patients in one week, which is reported weekly by Centers for Disease Control and Prevention of the United States from 2002 and 2021. (5) Traffic [2] contains hourly road occupancy rates measured by 862 sensors on San Francisco Bay area freeways from January 2015 to December 2016. (6) Weather [4] includes meteorological time series with 21 weather indicators collected every 10 minutes from the Weather Station of the Max Planck Biogeochemistry Institute in 2020.
+
+Especially, in this paper, we adopt the Augmented Dick-Fuller (ADF) test statistic [13] as the metric to quantitatively measure the degree of stationarity. A smaller ADF test statistic indicates a higher degree of stationarity, which means the distribution is more stable. Table 1 summarizes the overall statistics of the datasets and lists them in ascending order by degree of stationarity. We follow the standard protocol that divides each dataset into the training, validation, and testing subsets according to the chronological order. The split ratio is 6:2:2 for the ETT dataset and 7:1:2 for others.
+
+Table 1: Summary of datasets. Smaller ADF test statistic indicates more stationary dataset.
+
+
Dataset
VariableNumber
Sampling Frequency
Total Observations
ADF Test Statistic
Exchange
8
1 Day
7,588
-1.889
ILI
7
1Week
966
-5.406
ETTm2
7
15 Minutes
69,680
-6.225
Electricity
321
1 Hour
26,304
-8.483
Traffic
862
1 Hour
17,544
-15.046
Weather
21
10 Minutes
52.695
-26.661
+
+Baselines We evaluate the vanilla Transformer [32] equipped by the Non-stationary Transformers framework in both multivariate and univariate settings to demonstrate its effectiveness. For multivariate forecasting, we include six state-of-the-art deep forecasting models: Autoformer [35], Pyraformer [21], Informer [37], LogTrans [20], Reformer [17] and LSTNet [18]. For univariate forecasting, we include seven competitive baselines: N-HiTS [9], N-BEATS [25], Autoformer [35], Pyraformer [21], Informer [37], Reformer [17] and ARIMA [7]. In addition, we adopt the proposed framework on both the canonical and efficient variants of Transformers: Transformer [32], Informer [37], Reformer [17] and Autoformer [35] to validate the generality of our framework.
+
+Implementation details All the experiments are implemented with PyTorch [28] and conducted on a single NVIDIA TITAN V 12GB GPU. Each model is trained by ADAM [16] using L2 loss with the initial learning rate of $1 0 ^ { - 4 }$ and batch size of 32. Each Transformer-based model contains two encoder layers and one decoder layer. Considering the efficiency of hyperparameters search, we use two-layer perceptron projector with the hidden dimension varying in $\{ \bar { 6 4 } , \bar { 1 2 8 } , 2 5 6 \}$ in De-stationary Attention. We repeat each experiment three times with different random seeds and report the test MSE/MAE under different prediction lengths, and the standard deviations are also provided in Appendix. A lower MSE/MAE indicates better performance.
+
+# 4.1 Main Results
+
+Forecasting results As for multivariate forecasting results, the vanilla Transformer equipped with our framework consistently achieves state-of-the-art performance in all benchmarks and prediction lengths (Table 2). Notably, Non-stationary Transformer outperforms other deep models impressively on datasets characterized by high non-stationarity: under the prediction length of 336, we achieve $17 \%$ MSE reduction $\mathrm { ( 0 . 5 0 9 0 . 4 2 1 ) }$ ) on Exchange and $25 \%$ $2 . 6 6 9 2 . 0 1 0 \rangle$ on ILI compared to previous state-of-the-art results, which indicates that the potential of deep model is still constrained on non-stationary data. We also list the univariate results of two typical datasets with different stationarity in Table 3. Non-stationary Transformer still realizes remarkable forecasting performance.
+
+Table 2: Forecasting results comparison under different prediction lengths $O \in \{ 9 6 , 1 9 2 , 3 3 6 , 7 2 0 \}$ The input sequence length is set to 36 for ILI and 96 for the others. Additional results (ETTm1, ETTh1, ETTh2) can be found in Appendix.
+
+
+
+Framework generality We apply our framework to four mainstream Transformers and report the performance promotion of each model (Table 4). Our method consistently improves the forecasting ability of different models. Overall, it achieves averaged $4 9 . 4 3 \%$ promotion on Transformer, $4 7 . 3 4 \%$ on Informer, $4 6 . 8 9 \%$ on Reformer and $1 0 . 5 7 \%$ on Autoformer, making each of them surpass previous state-of-the-art. Compared to native blocks of the models, there is hardly any parameter and computation increase by applying our framework (See Appendix for details), and thereby their computational complexities can be preserved. It validates that Non-stationary Transformer is an effective and lightweight framework that can be widely applied to Transformer-based models and enhances their non-stationary predictability to achieve state-of-the-art performance.
+
+Table 3: Univariate results under different prediction lengths $O \in \{ 9 6 , 1 9 2 , 3 3 6 , 7 2 0 \}$ on two typical datasets with strong non-stationary. The input sequence length is set to 96.
+
+
+
+Table 4: Performance promotion by applying the proposed framework to Transformer and its variants. We report the averaged MSE/MAE of all prediction lengths (stated in Table 2) and the relative MSE reduction ratios (Promotion) by our framework. Full results (under all prediction lengths and promotion on ETSformer [34], FEDformer [38]) can be found in Appendix.
+
+
Dataset Model
Exchange
ILI
ETTm2
Electricity
Weather
MSE
MAE MSE
MAE
MSE
MAE
MSE MAE
Traffic MSE
MAE
MSE
MAE
Transformer + Ours
1.425 0.457
0.915 0.449
4.864 1.460 2.077 0.914
1.501 0.306
0.869 0.347
0.277 0.193
0.372 0.665 0.296 0.628
0.363 0.345
0.657 0.288
0.573 0.314
Promotion
67.93%
57.30%
79.61%
30.32%
5.56%
56.16%
Informer + Ours
1.550 0.496
0.998 0.460
5.137 1.544 2.125 0.928
1.410 0.460
)0.823 0.434
0.311 0.226
0.397 0.330 0.719
0.7640.416 0.409
0.634 0.275
0.548 0.302
Promotion
68.00%
58.63%
67.38%
27.33%
5.89%
56.78%
Reformer + Ours
1.280 0.462
0.932 0.468
4.724 1.443 2.865 1.065
1.479 0.493
0.915 0.441
0.338 0.206
0.429 0.741
0.423
0.803
0.656
Promotion
63.91%
39.35%
66.67%
39.05%
0.308 0.682
0.372 7.96%
0.286 64.38%
0.308
Autoformer + Ours
0.613 0.487
0.539 0.491
3.006 1.161 2.545 1.039
0.324 0.305
0.368 0.345
0.227 0.2160.315
0.338
0.628 0.379
0.338
0.382
Promotion
20.55%
15.34%
5.86%
4.85%
0.619 0.364 1.43%
0.286 15.38%
0.310
+
+# 4.2 Ablation Study
+
+Quality evaluation To explore the role of each module in our proposed framework, we compare the prediction results on ETTm2 obtained by three models: vanilla Transformer, Transformer with only Series Stationarization, and our Non-stationary Transformer. In Figure 3, we find out that the two modules strengthen the non-stationary forecasting ability of Transformer from different perspectives. Series Stationarization focuses on the alignment of statistical properties among each series input that benefits Transformer a lot to generalize on out-of-distribution data. However, as is shown in Figure 3(b), the over-stationarized circumstance for training makes the deep model more likely to output uneventful series with significant high stationarity and neglect the nature of non-stationary real-world data. With the aid of De-stationary Attention, the model gives concern back to the inherent non-stationarity of real-world time series. It is beneficial for an accurate prediction of the detailed series variation, which is vital in real-world time series forecasting.
+
+
+Figure 3: Visualization of ETTm2 predictions given by different models.
+
+Table 5: Forecasting results obtained by applying different methods to Transformer and Reformer. We report the averaged MSE/MAE of all prediction lengths (stated in Table 2) for comparison. Complete results can be found in Appendix.
+
+
Base Models
Transformer
Reformer
Methods
+ RevIN [15]
+ Series Stationarization
+ Ours
+ RevIN [15]
+ Series Stationarization
+ Ours
Metric
MSE
MAE
MSE
MAE
MSE
MAE
MSE MAE
MSE
MAE
MSE
MAE
Exchange
0.567
0.487
0.569
0.488
0.461
0.454
0.469 0.472
0.470
0.473
0.462
0.468
ILI
2.205
0.934
2.206
0.934
2.077
0.914
3.024 1.096
3.023
1.096
2.865
1.065
ETTm2
0.460
0.416
0.461
0.416
0.306
0.347
0.542 0.459
0.537
0.459
0.493
0.441
Electricity
0.197
0.298
0.197
0.298
0.193
0.296
0.208 0.309
0.207
0.309
0.206
0.308
Traffic
0.643
0.352
0.641
0.352
0.628
0.345
0.687 0.378
0.691
0.380
0.682
0.372
Weather
0.301
0.316
0.304
0.317
0.288
0.314
0.291 0.309
0.292
0.309
0.286
0.308
+
+Quantitative performance In addition to the above case study, we also provide quantitative forecasting performance comparison with stationarization methods: a deep method RevIN [15] and Series Stationarization (Section 3.1). As is shown in Table 5, the forecasting results assisted by RevIN and Series Stationarization are basically the same, which indicates that the parameter-free version of normalization in our framework performs sufficiently to stationarize time series. Besides, the proposed De-stationary Attention in Non-stationary Transformers further boosts the performance and achieves the best in all six benchmarks. The MSE reduction brought by De-stationary Attention becomes significant, especially when the dataset is highly non-stationary (Exchange: $0 . 5 6 9 0 . 4 6 1$ , ETTm2: $0 . 4 6 1 0 . 3 0 6 )$ . The comparison reveals that simply stationarizing time series still limits the predictive capability of Transformers, and the complementary mechanisms in Non-stationary Transformers can properly release the models’ potential for non-stationary series forecasting.
+
+# 4.3 Model Analysis
+
+Over-stationarization problem To verify the over-stationarization problem from a statistical view, we train Transformers with the aforementioned methods respectively, arrange all predicted time series in chronological order and compare the degree of stationarity with the ground truth (Figure 4). While models solely equipped with stationarization methods tend to output series with unexpected high degree of stationarity, the results assisted by De-stationary Attention are close to the actual value (relative stationarity $\dot { \in } [ 9 7 \% , 1 0 3 \% ] )$ . Besides, as the degree of series stationarity increases, the overstationarization problem becomes more significant. The huge discrepancy of the degree of stationarity can account for the inferior performance of Transformer with only stationarization. And it also demonstrates that De-stationary Attention as an internal renovation alleviates over-stationarization.
+
+
+Figure 4: Relative stationarity is calculated as the ratio of ADF test statistics between the model predictions and ground truth. From left to right, the dataset is increasingly non-stationary. While models equipped with only stationarization tend to output highly stationary series, our method gives predictions with stationarity closer to ground truth.
+
+Exploring of Non-stationary Information Re-incorporation It is notable that by specifying over-stationarization as less distinguishable attention, we narrow down our design space into the attention calculation mechanism. To explore other approaches to retrieve non-stationary information, we conduct experiments by re-incorporating the $\mu$ and $\sigma$ into feed-forward layers (DeFF), which is the left part of the Transformer architecture. In detail, we feed learned $\mu$ and $\sigma$ into each feed-forward layer iteratively. As is shown in Table 6, re-incorporating non-stationarity is necessary only when the inputs are stationarized (Stationary), which is beneficial for forecasting but will lead to stationarity discrepancy of model outputs. And our proposed design (Stat $^ +$ DeAttn) makes further promotion and achieves the best in most cases $( 7 7 \% )$ . In addition to the theoretical analysis, experimental results further validate the effectiveness of our design in re-incorporating non-stationarity on attention.
+
+Table 6: Ablation of framework design. Baseline means vanilla Transformer, Stationary means adding Series Stationarization, DeFF means re-incorporating non-stationarity on feed-forward layers, DeAttn means re-incorporating by De-stationary Attention, $S t a t + D e F F$ means adding Series Stationarization and re-incorporating on feed-forward layers. Stat $^ +$ DeAttn means our proposed framework.
+
+
Models Baseline Stationary DeFF DeAttn Stat + DeFF Stat + DeAttnMetric MSE MAEMSEMAE MSE MAE MSE MAE MSE MAEMSEMAE
MSEMAE
MSE MAE
MSE MAE
MSE MAE
MSEMAE
peg
96
0.5670.591
0.1360.258
0.7840.696
0.611 0.613
0.1160.243
0.1110.2370.2190.335
192336
1.1500.825
0.2390.348
1.1620.866
1.2020.840
0.2800.383
1.792 1.084
0.4250.479
1.3460.963
1.5160.981
0.371 0.452
0.421 0.476
720
2.191 1.159
1.4750.865
2.0421.163
2.8941.377
0.9340.704
1.0920.769
目
24364860
4.7481.4304.671 1.4304.9941.4825.041 1.499
2.5730.980
4.8501.445
4.7341.424
2.4040.985
2.2940.945
1.9550.870
4.848 1.452
4.9271.482
2.5850.9832.4960.9912.6671.059
1.8250.8482.0100.9002.1780.963
2.0570.902
4.9031.466
4.9961.483
2.2380.982
5.1961.524
5.1841.519
LII
96
0.5720.5521.1610.793
0.2530.311
0.7670.635
0.3040.406
0.2750.329
0.1920.2740.2800.339
192336720
1.1610.7931.2090.8423.0611.289
0.4530.404
0.9600.717
0.8200.652
0.4060.403
0.5460.4610.5930.489
1.1590.8113.1871.308
1.4060.883
0.5020.4650.6940.575
0.3340.3610.4170.413
2.8581.108
riea
96192336720
0.2600.3580.2660.3670.2800.3750.3020.386
0.1710.2750.1920.296
0.2600.356
0.2530.351
0.1700.274
0.1690.2730.1820.2860.2000.304
0.2640.365
0.2570.358
0.1880.2930.2060.309
0.2080.306
0.2770.374
0.2700.365
0.2160.315
0.2990.384
0.2950.380
0.2230.323
0.2220.321
[Ttere
96192336720
0.6470.3570.6490.356
0.6140.337
0.6460.353
0.6500.358
0.6050.333
0.6120.338
0.356
0.6370.351
0.6450.352
0.6550.358
0.6170.342
0.6130.340
0.667 0.3640.6970.376
0.6530.3590.6610.360
0.6720.360
0.6560.355
0.6350.349
0.6180.3280.6530.355
0.6950.376
0.6810.366
0.6490.351
waaaeer
96192336720
0.395 0.4270.6190.5600.6890.5940.9260.710
0.1750.2250.2730.297
0.4170.445
0.2960.364
0.1780.2260.2560.295
0.1730.2230.2450.285
0.6990.604
0.4800.464
0.3330.3250.4360.420
0.7730.620
0.5810.519
0.3380.351
0.3210.338
1.0080.718
0.7950.642
0.4170.412
0.4140.410
+
+# 5 Conclusion
+
+This paper addresses time series forecasting from the view of stationarity. Unlike previous studies that simply attenuate non-stationarity leading to over-stationarization, we propose an efficient way to increase series stationarity and renovate the internal mechanism to re-incorporate non-stationary information, thus boosting data predictability and model predictive capability simultaneously. Experimentally, our method shows great generality and performance on six real-world benchmarks. And detailed derivations and ablations are provided to testify the effectiveness of each component in our proposed Non-stationary Transformers framework. In the future, we will explore a more model-agnostic solution for the over-stationarization problem.
+
+# Acknowledgments
+
+This work was supported by the National Key Research and Development Plan (2021YFC3000905), National Natural Science Foundation of China (62022050 and 62021002), Beijing Nova Program (Z201100006820041), and BNRist Innovation Fund (BNR2021RC01002).
+
+References
+[1] Illness Dataset. https://gis.cdc.gov/grasp/fluview/fluportaldashboard.html.
+[2] Traffic Dataset. http://pems.dot.ca.gov/.
+[3] UCI Electricity Load Time Series Dataset. https://archive.ics.uci.edu/ml/datasets/ ElectricityLoadDiagrams20112014.
+[4] Weather Dataset. https://www.bgc-jena.mpg.de/wetter/.
+[5] Kartik Ahuja, Ethan Caballero, Dinghuai Zhang, Jean-Christophe Gagnon-Audet, Yoshua Bengio, Ioannis Mitliagkas, and Irina Rish. Invariance principle meets information bottleneck for out-of-distribution generalization. NeurIPS, 2021.
+[6] O. Anderson and M. Kendall. Time-series. 2nd edn. J. R. Stat. Soc. (Series D), 1976.
+[7] G. E. P. Box and Gwilym M. Jenkins. Time series analysis, forecasting and control. 1970.
+[8] George EP Box and Gwilym M Jenkins. Some recent advances in forecasting and control. J. R. Stat. Soc. (Series-C), 1968.
+[9] Cristian Challu, Kin G Olivares, Boris N Oreshkin, Federico Garza, Max Mergenthaler, and Artur Dubrawski. N-hits: Neural hierarchical interpolation for time series forecasting. arXiv preprint arXiv:2201.12886, 2022.
+[10] Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Michael Laskin, Pieter Abbeel, Aravind Srinivas, and Igor Mordatch. Decision transformer: Reinforcement learning via sequence modeling. NeurIPS, 2021.
+[11] J. Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT, 2019.
+[12] 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.
+[13] Graham Elliott, Thomas J. Rothenberg, and James H. Stock. Efficient tests for an autoregressive unit root. Econometrica, 1996.
+[14] Rob J Hyndman and George Athanasopoulos. Forecasting: principles and practice. OTexts, 2018.
+[15] Taesung Kim, Jinhee Kim, Yunwon Tae, Cheonbok Park, Jang-Ho Choi, and Jaegul Choo. Reversible instance normalization for accurate time-series forecasting against distribution shift. In ICLR, 2022.
+[16] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
+[17] Nikita Kitaev, Lukasz Kaiser, and Anselm Levskaya. Reformer: The efficient transformer. In ICLR, 2020.
+[18] Guokun Lai, Wei-Cheng Chang, Yiming Yang, and Hanxiao Liu. Modeling long-and short-term temporal patterns with deep neural networks. In SIGIR, 2018.
+[19] Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy M Hospedales. Deeper, broader and artier domain generalization. In ICCV, 2017.
+[20] Shiyang Li, Xiaoyong Jin, Yao Xuan, Xiyou Zhou, Wenhu Chen, Yu-Xiang Wang, and Xifeng Yan. Enhancing the locality and breaking the memory bottleneck of transformer on time series forecasting. In NeurIPS, 2019.
+[21] Shizhan Liu, Hang Yu, Cong Liao, Jianguo Li, Weiyao Lin, Alex X Liu, and Schahram Dustdar. Pyraformer: Low-complexity pyramidal attention for long-range time series modeling and forecasting. In ICLR, 2021.
+[22] 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, 2021.
+[23] Danielle C Maddix, Yuyang Wang, and Alex Smola. Deep factors with gaussian processes for forecasting. arXiv preprint arXiv:1812.00098, 2018.
+[24] Eduardo Ogasawara, Leonardo C. Martinez, Daniel de Oliveira, Geraldo Zimbrão, Gisele L. Pappa, and Marta Mattoso. Adaptive normalization: A novel data normalization approach for non-stationary time series. In IJCNN, 2010.
+[25] Boris N Oreshkin, Dmitri Carpov, Nicolas Chapados, and Yoshua Bengio. N-BEATS: Neural basis expansion analysis for interpretable time series forecasting. ICLR, 2019.
+[26] Sinno Jialin Pan and Qiang Yang. A survey on transfer learning. TKDE, 2009.
+[27] Nikolaos Passalis, Anastasios Tefas, Juho Kanniainen, Moncef Gabbouj, and Alexandros Iosifidis. Deep adaptive input normalization for time series forecasting. TNNLS, 2019.
+[28] Adam Paszke, S. Gross, Francisco Massa, A. Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Z. Lin, N. Gimelshein, L. Antiga, Alban Desmaison, Andreas Köpf, Edward Yang, Zach 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 NeurIPS, 2019.
+[29] Syama Sundar Rangapuram, Matthias W Seeger, Jan Gasthaus, Lorenzo Stella, Yuyang Wang, and Tim Januschowski. Deep state space models for time series forecasting. In NeurIPS, 2018.
+[30] David Salinas, Valentin Flunkert, Jan Gasthaus, and Tim Januschowski. DeepAR: Probabilistic forecasting with autoregressive recurrent networks. Int. J. Forecast., 2020.
+[31] Dmitry Ulyanov, Andrea Vedaldi, and Victor Lempitsky. Instance normalization: The missing ingredient for fast stylization. arXiv preprint arXiv:1607.08022, 2016.
+[32] 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.
+[33] Ruofeng Wen, Kari Torkkola, Balakrishnan Narayanaswamy, and Dhruv Madeka. A multi-horizon quantile recurrent forecaster. NeurIPS, 2017.
+[34] Gerald Woo, Chenghao Liu, Doyen Sahoo, Akshat Kumar, and Steven C. H. Hoi. Etsformer: Exponential smoothing transformers for time-series forecasting. arXiv preprint arXiv:1406.1078, 2022.
+[35] Haixu Wu, Jiehui Xu, Jianmin Wang, and Mingsheng Long. Autoformer: Decomposition transformers with Auto-Correlation for long-term series forecasting. In NeurIPS, 2021.
+[36] Rose Yu, Stephan Zheng, Anima Anandkumar, and Yisong Yue. Long-term forecasting using tensor-train rnns. arXiv preprint arXiv:1711.00073, 2017.
+[37] Haoyi Zhou, Shanghang Zhang, Jieqi Peng, Shuai Zhang, Jianxin Li, Hui Xiong, and Wancai Zhang. Informer: Beyond efficient transformer for long sequence time-series forecasting. In AAAI, 2021.
+[38] Tian Zhou, Ziqing Ma, Qingsong Wen, Xue Wang, Liang Sun, and Rong Jin. FEDformer: Frequency enhanced decomposed transformer for long-term series forecasting. In ICML, 2022.
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] See Section 1.
+(b) Did you describe the limitations of your work? [Yes] See Section 7 of the Appendix.
+(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 6 of the Appendix.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 1 of the Appendix. (b) Did you include complete proofs of all theoretical results? [Yes] See Section 1 of the Appendix.
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We provide the data link and code in https://github.com/thuml/Nonstationary_Transformers.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 5.1 of the Appendix.
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Table 4 of the Appendix.
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section 4.
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes] The data source is described in Section 4.
+(b) Did you mention the license of the assets? [N/A]
+(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We provide the code in https://github.com/thuml/Nonstationary_Transformers.
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/uloenYmLCAo/uloenYmLCAo.md b/md/dev/uloenYmLCAo/uloenYmLCAo.md
new file mode 100644
index 0000000000000000000000000000000000000000..74c1d819a5cf1977a71977f7e58c349911ff52b0
--- /dev/null
+++ b/md/dev/uloenYmLCAo/uloenYmLCAo.md
@@ -0,0 +1,305 @@
+# Block-Recurrent Transformers
+
+DeLesley Hutchins∗1, Imanol Schlag∗3†, Yuhuai $\mathbf { W } \mathbf { u } ^ { 1 }$ , Ethan Dyer2, Behnam Neyshabur2
+
+1 Google Research 2 Google Research, Blueshift Team 3 The Swiss AI Lab IDSIA, SUPSI & USI {delesley, yuhuai, edyer, neyshabur}@google.com imanol@idsia.ch
+
+# Abstract
+
+We introduce the Block-Recurrent Transformer, which applies a transformer layer in a recurrent fashion along a sequence, and has linear complexity with respect to sequence length. Our recurrent cell operates on blocks of tokens rather than single tokens during training, and leverages parallel computation within a block in order to make efficient use of accelerator hardware. The cell itself is strikingly simple. It is merely a transformer layer: it uses self-attention and cross-attention to efficiently compute a recurrent function over a large set of state vectors and tokens. Our design was inspired in part by LSTM cells, and it uses LSTM-style gates, but it scales the typical LSTM cell up by several orders of magnitude. Our implementation of recurrence has the same cost in both computation time and parameter count as a conventional transformer layer, but offers dramatically improved perplexity in language modeling tasks over very long sequences. Our model out-performs a long-range Transformer XL baseline by a wide margin, while running twice as fast. We demonstrate its effectiveness on PG19 (books), arXiv papers, and GitHub source code. Our code has been released as open source [1].
+
+# 1 Introduction
+
+Transformers have mostly replaced recurrent neural networks (RNNs), such as LSTMs [2], on tasks that involve sequential data, especially natural language. There are several reasons for their success. First, transformers process all elements of the sequence in parallel, and are thus faster to train on modern accelerator hardware. In contrast, an RNN must process tokens sequentially, which leads to slow step times during training, and large batch sizes in order to fully saturate GPUs or TPUs.
+
+Second, an RNN must summarize and compress the entire previous sequence into a single state vector which is passed from one token to the next. The size of the state vector limits the amount of information that the RNN can encode about the previous tokens in the sequence. In contrast, a transformer can attend directly to past tokens, and does not suffer from this limitation.
+
+Third, attention operates effectively over longer distances. The forget gate in an LSTM discards information moving forward, and causes vanishing gradients during backpropagation. In practice, this means that LSTMs struggle to send a clear signal over more than a few hundred tokens, far less than the typical size of the attention window in a transformer [3].
+
+Despite these advantages, transformers also have a disadvantage. The computational complexity of self-attention is quadratic with respect to the sequence length, which is a limiting factor when attempting to process long documents, such as books, technical articles, or source code repositories. Moreover, a transformer has no memory of past context; any tokens that it cannot attend to are “invisible” to the model.
+
+
+Figure 1: Illustration of our recurrent cell. The left side depicts the vertical direction (layers stacked in the usual way) and the right side depicts the horizontal direction (recurrence). Notice that the horizontal direction merely rotates a conventional transformer layer by $9 0 ^ { \circ }$ , and replaces the residual connections with gates.
+
+In this work, we describe an architecture which combines the benefits of attention and recurrence. Like previous implementations of recurrence, our architecture constructs and maintains a fixed-size state, which summarizes the sequence that the model has seen thus far. However, our implementation of recurrence differs from previous work in several important aspects which together address the three limitations mentioned above.
+
+Instead of processing the sequence one token at a time, our recurrent cell operates on blocks of tokens; see Figure 1. Within a block, all tokens are processed in parallel, at least during training. The recurrent cell likewise operates on a block of state vectors rather than a single vector. This means that the size of the recurrent state is orders of magnitude larger than in an LSTM, which dramatically improves the model’s capacity to capture the past. Processing the sequence in blocks also helps propagate information and gradients over longer distances, because the number of recurrent steps (and thus the number of times that the forget gate is applied) is orders of magnitude smaller. We show that the Block-Recurrent Transformer can remember information over distances of $6 0 \mathrm { k }$ tokens or more.
+
+The recurrent cell itself is strikingly simple. For the most part, it consists of an ordinary transformer layer applied in a recurrent fashion along the sequence length. There are a few tricks that are necessary to stabilize training; see Sections 3.2 and 3.4 for details. The cost of recurrence, in terms of both computation time and parameter count, is essentially the same as simply adding one more layer to our transformer baseline. We demonstrate empirically that adding a single recurrent layer results in a much larger improvement in perplexity on multiple datasets than adding a conventional transformer layer, while training time and memory use are equivalent. Moreover, our recurrent cell is very easy to implement because it largely makes use of existing transformer code. Thus, our technique is a cheap and cheerful way to improve language modeling perplexity on long sequences.
+
+# 2 Related Work
+
+The quadratic cost of attention is well known in the literature, and a great deal of work has been done on efficient long-range attention mechanisms; see [4, 5] for recent surveys. Sparse strategies such as Big Bird [6], Routing Transformers [7], and Reformer [8] select only a subset of tokens to attend to. Hierarchical mechanisms [9] combine multiple tokens into phrases or sentences to reduce sequence length. Expire-span [10] learns to prune far-away tokens that the model has labelled as “unimportant”. Memorizing transformers [11] replace dense attention with $k$ -nearest-neighbor lookup.
+
+Yet another approach is to reduce the sequence length by pooling, averaging, or compressing it in some way. Hierarchical 1D attention [12], and Combiner [13] apply pooling or averaging over tokens at longer distances. Linformer [14] applies a linear transformation to the key and value matrices to reduce the sequence length. Compressive transformers [15] and funnel transformers [16] apply additional learned compression layers to compress the sequence.
+
+
+keys, values to be cached
+Figure 2: Sliding window, where segment length $N = 1 6$ , window/block size $W = 8$ . Keys and values for the first $W$ shaded tokens were computed and cached on the previous training step; the remaining $N$ unshaded tokens are the segment for the current training step. Instead of a single $N \times ( W + N )$ attention matrix, attention is done in two tiles of size $W \times 2 W$ .
+
+The equation for attention is (roughly) softmax $( Q K ^ { T } ) V$ where $Q , \pmb { K }$ , and $V$ are the query, key, and value matrices of the attention layer. If the softmax operation is removed from this equation or somehow “linearized”, the equation can be rearranged as $\dot { Q ( K ^ { T } V ) }$ , where $( K ^ { T } V )$ can be computed incrementally (i.e., in a recurrent fashion) as a cumulative sum over the sequence [17]. Linearized attention thus has linear rather than quadratic complexity with respect to sequence length. Following this line of reasoning, there have been several proposals that approximate the softmax [18, 19] or replace it [20, 21]. Linear transformers are related to earlier work on fast weight programmers [20] [22], and can be extended with other forms of recurrence [23].
+
+Our work differs from all of the above mechanisms, because we rely only on standard dense attention with softmax.
+
+A few other lines of research have combined the transformer architecture with recurrence in some way. The feedback transformer [24] allows lower layers to attend to the output of the topmost layer. Feedback has minimal cost at inference time, but it is unfortunately very slow to train because tokens must be processed sequentially. Simple Recurrent Units [25, 26] use a recurrence function that does not involve matrix multiplication, and is consequently much faster. $\mathbf { R N M T + }$ combines RNNs and transformers in an encoder/decoder architecture to improve on translation tasks [27]. “Sandwich models” alternate between transformer and RNN layers and out-perform both transformers and RNNs on tasks involving source code [28]. The R-Transformer introduces an additional local RNN which can be computed in parallel in order to better model sequential structure [29]. The Perceiver architecture [30] is somewhat similar to ours; it also applies a transformer layer in an iterative fashion.
+
+To the best of our knowledge, the idea of performing recurrence on blocks of tokens is underexplored. In the context of translation, [31] operates on sentences rather than tokens. Staircase Attention [32] also operates on blocks of tokens; each layer takes, as input, the outputs of the same layer from the previous block.
+
+# 3 Method
+
+The Block-Recurrent Transformer is based on sliding-window attention [33], which is an extension of ideas from Transformer-XL [34].
+
+A long document, such as a book, consists of a sequence of tokens. Due to memory limitations, it is usually not possible to fit the entire sequence into device memory. Thus, the sequence is divided into segments of length $N$ $N = 4 0 9 6$ in our experiments), which are processed sequentially over a number of training steps. Each training step processes one segment.
+
+The sliding window attention pattern is illustrated in Figure 2. Given a segment of $N$ tokens, the sliding window applies a causal mask in which each token can only attend to the $W$ previous tokens, where $W$ is the window size ( $W = 5 1 2$ in our experiments). Because of the causal mask, most entries of the $N \times N$ attention matrix are masked out (assuming that $W < < N$ ). Thus, the attention computation can be optimized by breaking it into smaller tiles along the diagonal. The segment of $N$ tokens is subdivided into blocks of size $W$ , and each block attends locally to itself and to the previous block, so the size of each local attention matrix is $W \times 2 W$ . Using this mechanism, attention is quadratic with respect to the window size $W$ , but linear with respect to the segment length $N$ .
+
+Borrowing an idea from Transformer-XL, the keys and values from the last block in each segment are stored in a non-differentiable cache for use on the next training step. By using the cache, the first block in the next segment can attend to the last block in the previous segment, which extends the sliding window to cover the entire (book-length) sequence. The cache implements a form of truncated backpropagation through time [35] over long documents.
+
+Note that if $N = W$ , then sliding window attention will behave exactly like Transformer-XL; it will process and cache one segment (i.e. one block) per training step. Setting $N > > W$ does not change the context length of attention, but it allows gradients to backpropagate across multiple blocks during training; we show that the improved differentiability provides a modest benefit to perplexity over Transformer-XL. See Appendix A for more details.
+
+# 3.1 Recurrent Cell
+
+A Block-Recurrent Transformer layer extends the sliding-window attention mechanism by adding a set of recurrent states, which are updated at the end of each block of $W$ tokens. Our design for the recurrent cell is illustrated in Figure 1, which depicts the operations done within a single block of the input sequence.
+
+The recurrent cell receives two tensors as inputs: a set of $W$ token embeddings, where $W$ is the block/window size, and a set of $S$ “current state” vectors. The cell produces two tensors as outputs: a set of $W$ output embeddings, as well as a set of $S$ “next state” vectors. We denote the function going from input token embeddings to output token embeddings as the vertical direction, and the function going from the current state vectors to the next state vectors as the horizontal direction. The number of state vectors $S$ and the window size $W$ are independent hyperparameters, but we set $S = W = 5 1 2$ in our experiments to simplify comparisons against baselines.
+
+The vertical direction of the cell is an ordinary transformer layer with an additional cross-attention operation, much like a decoder layer in a standard encoder-decoder architecture [36]. It does selfattention over the input tokens, and cross-attends to the recurrent states. Unlike a typical decoder layer, we do self-attention and cross-attention in parallel. The results of both forms of attention are concatenated together and fed into a linear projection.
+
+The horizontal direction of the cell mirrors the forward direction, except that it performs selfattention over the current state vectors, and cross-attends to the input tokens. The recurrent direction also replaces the residual connections with gates, which allows the model to “forget”, an ability that is important for algorithmic tasks [37], or when processing long documents, where it has been central to the success of LSTMs [38].
+
+Note that the presence of gates is the reason why self-attention and cross-attention are done in parallel. Doing them sequentially, as is standard practice, would introduce a third gate in the horizontal direction, which led to worse perplexity in our experiments.
+
+Recurrence is integrated with the sliding window attention mechanism. Although not shown in Figure 1, each cell also receives keys and values from the previous block as input, these are concatenated with $( K _ { e } , V _ { e } )$ from the current block in order to implement sliding-window attention.
+
+A Block-Recurrent Transformer layer processes the blocks within a segment sequentially by stacking recurrent cells horizontally, with the “next states” output of the previous cell feeding into the “current states” input of the next cell. In code, this is implemented as a simple for-loop over blocks. Multiple layers can also be stacked vertically in the usual fashion. Our experiments use a single recurrent layer, sandwiched between a number of non-recurrent layers that use sliding-window attention.
+
+The final set of state vectors from the last block in the segment are cached, along with the keys and values, and used as the initial state for the first block on the next training step. Every layer in the stack (both recurrent and non-recurrent) has its own cache.
+
+Sharing of keys and values. Keys and values are shared between the vertical and horizontal directions. One set of keys and values $( \pmb { K _ { e } } , \pmb { V _ { e } } )$ are computed from the input token embeddings, and another set of keys and values $( K _ { s } , V _ { s } )$ are computed from the recurrent state vectors. Queries are not shared, so there are four separate sets of queries: $Q _ { e } ^ { v }$ and $Q _ { s } ^ { v }$ in the vertical direction, and $\pmb { Q } _ { s } ^ { h }$ and $Q _ { e } ^ { h }$ in the horizontal direction.
+
+# 3.2 State IDs and Position Bias
+
+With a large number of state vectors, the total size of the recurrent state is far larger than that of an LSTM. However, the same weights (projection matrices and MLP) are applied to each state vector. Without some way to differentiate the states, the model will compute the same result for each state vector, thus negating any advantage from having multiple states. To prevent this failure mode, we add a set of learned “state IDs” to the state vectors before computing the keys, values, and queries. These “state IDs” allow each state vector to consistently issue different queries against the input sequence, and against other states. State IDs are identical to learned position embeddings; we use a different name because there’s no notion of “position” between states.
+
+We do not add global position embeddings to the tokens, because global position embeddings don’t work well for long sequences [34]. Instead, we add a T5-style relative position bias [39] to the selfattention matrix in the vertical direction. (Although similar, T5 relative positions differ slightly from the relative positions used in the Transformer-XL paper [34].) When the recurrent states cross-attend to input tokens, there is no position bias, because the relative distance between “state” and “token” is undefined.
+
+We also normalize queries and keys as described in [40]; we found that normalization improved the stability of Transformer-XL when used with a relative position bias.
+
+# 3.3 Gate Type
+
+We experimented with two different gating mechanisms for the recurrent cell. Each state vector has its own gate, but all state vectors are updated in parallel, using the equations below.
+
+Fixed gate. The fixed gate uses a learned convex combination, similar to highway networks [41].
+
+$$
+\begin{array} { r } { z _ { t } = W _ { z } h _ { t } + b _ { z } \qquad } \\ { \pmb { g } = \sigma ( \pmb { b } _ { g } ) \qquad } \\ { \pmb { c } _ { t + 1 } = \pmb { c } _ { t } \odot \pmb { g } + \pmb { z } _ { t } \odot ( 1 - \pmb { g } ) } \end{array}
+$$
+
+where $W _ { z }$ is a trainable weight matrix, $b _ { z }$ and $b _ { g }$ are trainable bias vectors, $\sigma$ is the sigmoid function, $\mathbf { } _ { c _ { t } }$ is the cell state for the current block (i.e., the state for the block at index $t$ in the sequence of blocks), $\odot$ is the element-wise multiplication, and $h _ { t }$ is the current input to the gate. In our model, $h _ { t }$ is either the output of attention, in which case $W _ { z }$ is the linear projection that feeds into the gate, or $\boldsymbol { h } _ { t }$ is the output of the hidden layer of the MLP, in which case $W _ { z }$ is the final layer of the MLP.
+
+Unlike highway networks, the bias $b _ { g }$ is a simple learned vector of shape $\mathbb { R } ^ { d }$ , which is broadcast over all state vectors, where $d$ is the state embedding dimension. The value of $\textbf { { g } }$ does not depend on either the current value of the state vector $c _ { t }$ , or on the current input $h _ { t }$ , and thus remains constant (i.e., fixed) after training. The fixed gate essentially implements an exponential moving average over previous blocks.
+
+LSTM gate. The LSTM gate uses the standard combination of input and forget gates:
+
+$$
+\begin{array} { r l } & { z _ { t } = \operatorname { t a n h } ( W _ { z } h _ { t } + b _ { z } ) } \\ & { ~ i _ { t } = \sigma ( W _ { i } h _ { t } + b _ { i } - 1 ) } \\ & { ~ { f _ { t } = \sigma ( W _ { f } h _ { t } + b _ { f } + 1 ) } } \\ & { c _ { t + 1 } = c _ { t } \odot f _ { t } + z _ { t } \odot i _ { t } } \end{array}
+$$
+
+where $W _ { z } , W _ { i } , W _ { f }$ are trainable weight matrices, and $b _ { z } , b _ { i } , b _ { f }$ are trainable bias vectors. The LSTM gate is strictly more expressive, because the values of $\pmb { f } _ { t }$ and $i _ { t }$ depend on the current input $h _ { t }$ . In our model, $h _ { t }$ depends on $c _ { t }$ , so the LSTM gate also depends indirectly on $c _ { t }$ . LSTM gate values are thus different for each state vector, and for each block index $t$ .
+
+# 3.4 Gate Initialization and Training Stability
+
+We observed that training stability is quite sensitive to how the gates are initialized. Recurrence has a failure mode where the model learns to completely ignore the recurrent state, in which case its performance reverts to that of the non-recurrent transformer. Moreover, this situation appears to be a local optimum; once the model has reached this point, it does not recover. We stabilize training by initializing the weights and bias to small but non-zero values, and adding a constant -1 and $+ 1$ to the input and forget gates to bias them to “remember”. See Appendix B for details.
+
+# 3.5 Gate Configuration
+
+We experimented with three different gate configurations.
+
+Dual. The dual gate configuration is the one shown in Figure 1, in which both of the residual connections in the cell are replaced with gates. The disadvantage of this configuration is that there are two gates, both of which can forget.
+
+Single. The single gate configuration removes the linear projection and the gate that is attached to it. Instead, the concatenation of self-attention and cross-attention is fed directly into the MLP.
+
+Skip. The skip configuration removes the MLP and the gate that is attached to it. This configuration is similar to the single-gate version, except that it is strictly weaker. Instead of a two layer MLP with a very large hidden layer, it uses a linear projection with no nonlinearity.
+
+# 3.6 Placement of Recurrence and Computation Cost
+
+Single recurrent layer. The basic version of the Block-Recurrent Transformer uses a single recurrent layer sandwiched between a number of non-recurrent transformer layers with sliding attention. We use a 12-layer model with recurrence on layer 10. All layers have a Transformer-XL-style cache.
+
+Cost of recurrence. During training, the 12-layer Block-Recurrent Transformer has almost exactly the same computation cost, in both parameters and FLOPS, as a 13-layer Transformer-XL model without recurrence. The two are equivalent because the recurrent cell does almost the same operations as a conventional transformer layer, merely in the horizontal instead of the vertical direction.
+
+The inference cost for autoregressive decoding is also nearly identical, for the same reason. Recurrence adds an additional attention operation per token, the cost of which is the same as self-attention in a 13th layer.
+
+# 4 Results
+
+We tested the Block-Recurrent Transformer on three different data sets of long documents: PG19, arXiv, and GitHub. The PG19 dataset [42] contains full-length books written prior to 1919 from project Gutenberg. The arXiv dataset [11] is a corpus of technical papers downloaded via the arXiv Bulk Data Access1, and filtered to include only articles labeled as “Mathematics” and whose LATEX source is available. The GitHub dataset [11] is a corpus of source code from different GitHub repositories with open-source licenses. All of the files in each GitHub repository are concatenated together to make one long document.
+
+The task is auto-regressive language modeling, where the goal is to predict the next token in the sequence. We report bits-per-token numbers (i.e. $\log _ { 2 }$ perplexity; lower is better) for all models. Further training details for each dataset can be found in Appendix C.
+
+# 4.1 Baselines
+
+We compare the Block-Recurrent Transformer to five different baselines. The first baseline, XL:512, establishes a reference point against which various other improvements can be compared. It’s a
+
+Table 1: Average bits-per-token ( $\mathrm { { l o g } _ { 2 } }$ perplexity) of each model. The recurrent models (named Rec:gate:config) have the same computational cost as the Slide:13L baseline, but much better perplexity. They even outperform the XL:2048 baseline, while running more than twice as fast. Measured error bars on PG19 are low, between 0.002 and 0.007, but are rounded up to 0.01 to match the precision of results in the table. Step time is for a single training step (lower is better). For PG19, we train both character-level (bytes) and token-level models.
+
+
Model
segment length
window length
step time (relative)
bytes
PG19 tokens
arXiv tokens
GitHub tokens
XL:512
512
512
0.88
1.01
3.62 ± 0.01
1.45
1.21
XL:1024
1024
1024
1.20
0.997
3.59 ± 0.01
1.37
1.08
XL: 2048
2048
2048
2.11
0.990
3.58 ± 0.01
1.31
1.01
Slide:12L
4096
512
0.93
0.989
3.60
1.43
1.19
Slide:13L
1.00
0.989
3.58 ± 0.01
1.42
1.17
Rec:lstm:dual
4096
512
1.06
0.985
3.54 ± 0.01
1.26
1.01
Rec:lstm:single
1.05
0.962
3.54± 0.01
1.29
1.03
Rec:lstm:skip
1.00
0.969
3.56 ± 0.01
1.31
1.10
Rec:fixed:dual
1.01
0.957
3.52 ± 0.01
1.27
0.991
Rec:fixed:single
1.02
0.966
3.58± 0.01
1.25
1.00
Rec:fixed:skip
0.99
0.952
3.53 ± 0.01
1.24
0.976
Feedback:lstm:single
4096
512
1.40
0.977
3.50
1.22
=
Feedback:fixed:skip
1.35
0.935
3.49
1.24
=
Memorizing Trans. 64k
512
512
1.94
0.950
3.53
1.22
1
+
+12-layer Transformer-XL model with a window size of 512, and 150 million parameters. It has 8 heads of size 128, embedding vectors of size 1024, an MLP with a hidden layer of size 4096, and the relu nonlinearity. It uses a Transformer-XL style cache, but no sliding window, so the segment length is the same as the window size, i.e., it is trained on segments of 512 tokens.
+
+XL:1024 and XL:2048 are similar, but have window sizes of 1024 and 2048, respectively. As expected, increasing the window size improves perplexity, especially on the arXiv data set. However, these two models still have worse perplexity than the recurrent model, as well as being much slower.
+
+Slide:12L is a 12-layer transformer with a window size of 512, but uses a sliding window over a segment of 4096 tokens. This model is almost identical to XL:512; the only difference is that the sliding window is differentiable over multiple blocks, while the Transformer-XL cache is not.
+
+Slide:13L adds a 13th layer, and is directly comparable to the recurrent models in terms of both computation cost (FLOPS or step-time), number of parameters, and segment length. Notice that adding another layer with more parameters yields a much smaller improvement than adding recurrence.
+
+Relative cost. All five baselines, and all 6 recurrent models, have roughly the same number of parameters: between 151 million (12 layer) and 164 million (13 layer or recurrent). The training speed (i.e. step time) of each model is shown in Table 1 (lower is better). Because the raw step time depends on hardware and compiler, we report numbers relative to the Slide:13L baseline.
+
+Batch Size. We adjust the batch size so that each model processes the same number of tokens (and thus the same amount of training data) per training step. Thus, XL:512 (segment length 512) runs at a batch size of 256 (8 per replica), while Slide:12L (segment length 4096) runs at a batch size of 32 (1 per replica) on PG19.
+
+# 4.2 Benefit of Recurrence
+
+We compare the 5 baselines to all six gate configurations for the Block-Recurrent Transformer. The recurrent model reliably outperforms all five baselines. The best overall configuration is Rec:fixed:skip, which outperforms the others in 3 out of 4 cases, and comes within the margin of error in the remaining case. This is especially notable because it is also the fastest configuration, having a slightly lower step time and fewer parameters than Slide:13L, because it does not have the MLP. It is better than the 13-layer baseline by a wide margin, and it is even better than the Transformer-XL model with a window size of 2048, which runs over 2 times slower.
+
+
+Figure 3: Scaling of the 12-layer Block-Recurrent Transformer vs 13-layer Transformer-XL on PG19. FLOPs are the same between the two models at a given parameter count. At larger sizes, adding recurrence is equivalent to doubling the number of parameters. Details in Appendix F.
+
+The other gate configurations also outperform the 13-layer baseline, but their relative ranking varies according to the dataset. Despite being theoretically more powerful, the LSTM gate tends to lag behind the fixed gate in all of our experiments.
+
+Scaling up. Figure 3 shows the effect of adding recurrence as the transformer model is scaled up and down in size. We trained six different models on PG19, ranging in size from 40M parameters to 1.3B parameters. For the four smaller models, we compare a 12-layer Block-Recurrent Transformer against a 13-layer Transformer-XL baseline, while for the two larger models, we compare a 24-layer Block-Recurrent Transformer, with recurrence at layers 10 and 20, against a 26-layer Transformer-XL baseline. This experiment used a cosine-decay learning rate as described in [43], and a custom 32k SentencePiece vocabulary [44]. More details are in Appendix F.
+
+Our experiments show that recurrence provides a consistent benefit across all scales. The relative improvement actually seems to increase with the number of parameters; at larger sizes recurrence provides a benefit which is greater than doubling the number of parameters.
+
+# 4.3 Ablations
+
+Multiple recurrent layers. Adding two recurrent layers right next to each other in the stack (layers 9 and 10) did not improve model perplexity. Adding two layers widely separated in the stack (layers 4 and 10) did provide an improvement, but the improvement was no better than simply adding another non-recurrent layer to the stack. Previous work on Memorizing Transformers [11] showed a similar effect. In our qualitative study, we saw that the model seems to use recurrence primary for long-range name lookups, much like memory. We conclude that one layer of recurrence is sufficient for the model to extract most of the benefits, although we did use two layers for our largest models.
+
+Number of recurrent state vectors. We trained the model with differing numbers of state vectors, from 128 to 2048. Increasing the number of states makes a small but measurable improvement up to 1024, but the model does worse with 2048 (see Appendix D). We hypothesize that the model has trouble learning to use the recurrent state effectively if the state space grows too large.
+
+Reducing window size. Reducing the size of the sliding window makes the perplexity significantly worse for Transformer-XL, because it reduces the amount of context that the transformer is able to attend to. Reducing the size of the window in a recurrent transformer has a smaller effect, because the model can use recurrence to compensate (see Appendix D).
+
+# 4.4 Block feedback
+
+Inspired by the feedback transformer [24], which allows all layers to attend to the topmost layer, we implemented a variation in which every layer of the transformer (not just the recurrent one) can cross-attend to the state vectors in the recurrent layer. This variation further improves perplexity, but
+
+Table 2: Comparison with other published work on PG19. Fields marked - are unknown.
+
+
Model
Layers
perplexity word-level
parameters
vocabulary size
Compressive Transformer[15]
36
33.6
32k
Routing Transformer [7]
22
33.2
490M1
98k
Perceiver AR [45]
60
28.9
974.6M1
32k
Block-Recurrent Transformer
24
28.46
650M
32k
Block-Recurrent Transformer
24
26.50
1.3B
32k
+
+at a cost; step time increased by approximately $3 5 \mathrm { - } 4 0 \%$ , and the additional queries also increase the number of parameters. Results are shown in Table 1, and further described in Appendix E.
+
+# 4.5 Comparisons against prior published work
+
+The PG19 test set contains 6,966,499 words [15], which are broken into 10,229,476 tokens using a SentencePiece vocabulary, trained on PG19. Our 24-layer 1.3B parameter model achieves 3.22 bits per token, and thus achieves a new state of the art word-level perplexity of 26.50 (Table 2). However, we note that raw perplexity numbers are not necessarily a meaningful way to compare architectures, because they depend on numerous other factors, such as the number of parameters, vocabulary, learning rate schedule, batch size, etc.; a more detailed discussion is in Appendix C.3.
+
+We were able to run a fair comparison (identical vocabulary, configuration, and hyperparameters) of the Block-Recurrent Transformer against the Memorizing Transformer [11], with a memory of size $6 4 \mathrm { k }$ (Table 1). The memorizing transformer is constructed similarly to our model; it has one layer which has been augmented with a mechanism that gives it the ability to attend over much longer distances. We find that Block-Recurrence does almost as well as the Memorizing Transformer on arXiv, and does just as well on PG19, but trains almost twice as fast. However, there are many ways of implementing approximate $k$ -nearest-neighbor lookup, so relative speed will be highly implementation-dependent; our implementation runs on TPU, and does not use custom CUDA kernels.
+
+# 4.6 Qualitative analysis
+
+Prior work on long-context transformers [42, 11] has found that attention at long ranges is typically used to look up proper names, such as characters or places. We performed a qualitative analysis in an attempt to determine whether our model is using recurrence in the same way. We selected 5 books at random from the PG19 test set, ran both the Block-Recurrent Transformer and the 13-layer Transformer-XL on each book, and then compared the cross-entropy loss for all tokens. We sorted the results, and examined the top 4 tokens from each book with the greatest difference: the tokens for which the predictions of the recurrent model have the largest improvement over the baseline.
+
+In 17/20 cases, the recurrent model predicted a proper name, usually with relatively high probability, that Transformer-XL was unable to predict. In 2 cases it predicted a chapter title (having previously seen the table of contents), and in the last case, it predicted a foreign-language word that was unique to that book. In 19/20 cases, the predicted word was nowhere within the attention window, so it must have been stored within the recurrent state (details in the appendix, Section G).
+
+In a second study, we compared the recurrent model, running normally, against a variation in which the recurrent state is cleared at the end of each 4096-token segment, instead of being cached. Clearing the state degrades the model’s ability to predict dependencies at a longer range than the segment length; typical mispredictions once again included proper names and chapter titles. Interestingly, this study also showed that the recurrent model is able to remember the title and author of a book (which is part of the Gutenberg boilerplate at the beginning and end of each book) across the entire length of the book – more than 60,000 tokens. See Appendix G.1.
+
+A further quantitative comparison of the per-token cross-entropy between Transformer-XL and the Block-Recurrent Transformer is given in Appendix H.
+
+# 5 Discussion
+
+Our implementation of recurrence was inspired by the way that humans seem to process long sequences. When a human reads a novel, they do not attempt to remember every single word in the book. Instead, a human reader will construct a mental model, or knowledge graph, which summarizes the story thus far, i.e., the names of the main characters, the relationships between them, and any major plot points. When a human reads a paragraph of text, they will parse the information in the paragraph, process and interpret the information using background knowledge from their mental model, and finally update their mental model with new information. Our recurrent architecture loosely mimics this process. It takes a block of text, and parses it by running it through a conventional transformer stack. Tokens in the text attend to the recurrent states (i.e. the mental model), and the states, in turn, are updated by attending to the text.
+
+Based on our qualitative analysis, it seems that the model is, in fact, using the recurrent state to summarize some of the information about frequently occurring characters and places. However, it does not seem to be doing much complex reasoning, as evidenced by the fact that our best performing model is the fixed:skip configuration. This configuration does not use a complex LSTM-style gate, which chooses to remember or forget based on its current state and inputs; instead, it simply computes an exponential moving average, not unlike some other forms of long-range approximate attention.
+
+Moreover, the skip configuration cuts out the large MLP from the recurrent transformer layer. In a vanilla transformer, removing the MLP from all layers would severely degrade the model [46]; those large MLPs are computing something important. In a recurrent layer, removing the MLP makes little difference; it does not seem to be computing anything useful. We conclude that training the recurrent layer to make full use of its capabilities for knowledge extraction and summarization will require further advances.
+
+# 5.1 Ethics
+
+The potential negative social impacts from this work are similar to any other advance in language modelling. Large language models could potentially be used to create disinformation and fake news, power malicious chatbots, or generate spam. The Block-Recurrent Transformer can potentially create longer documents than was previously feasible, thus expanding the range of applications in which these negative impacts could occur. The best way to mitigate these risks is to train models that can reason about text, and flag misinformation or malicious content.
+
+# 6 Conclusion
+
+We have shown that when training language models on long documents, the Block-Recurrent Transformer provides a greater benefit at lower cost than scaling up the transformer model in other ways. Adding recurrence to a single layer has roughly the same cost as adding an additional non-recurrent layer, but results in a much larger improvement to perplexity. We have also shown that recurrence provides a larger benefit than simply increasing the window size of attention, or increasing the number of parameters. Our medium-sized model has lower perplexity than a Transformer-XL model with 4 times the window size, but runs twice as fast, and our larger model outperforms a Transformer-XL model with twice the number of parameters.
+
+Furthermore, in contrast to some other recently proposed transformer variants, the Recurrent Transformer is very easy to implement, since it consists mostly of ordinary transformer components and RNN gates. No custom CUDA kernels are required. Our code has been released as open source [1].
+
+Evaluating block-recurrent transformers on downstream tasks is an important direction for future work. We believe that the Block-Recurrent Transformer will be most useful in situations that require long-range context; examples of potential applications include writing book reports, summarizing long news articles, code completion, or question/answering over book-length works. There are are a number of new and emerging benchmarks that test long-range performance [47, 48, 4]. Previous studies have found a strong correlation between language modeling and diverse downstream tasks [49, 50].
+
+Despite our initial successes, we also believe that the recurrent architecture that we present here has not yet achieved its full potential, and there are opportunities for future research and further improvements in this area.
+
+References
+[1] D. Hutchins, M. Rabe, Y. Wu, I. Schlag, and C. Staats, “Meliad.” Github source code repository. https://github.com/google-research/meliad, 2022.
+[2] S. Hochreiter and J. Schmidhuber, “Long short-term memory,” Neural Computation, vol. 9, no. 8, 1997.
+[3] U. Khandelwal, H. He, P. Qi, and D. Jurafsky, “Sharp nearby, fuzzy far away: How neural language models use context,” in Association for Computational Linguistics, 2018.
+[4] Y. Tay, M. Dehghani, S. Abnar, Y. Shen, D. Bahri, P. Pham, J. Rao, L. Yang, S. Ruder, and D. Metzler, “Long range arena : A benchmark for efficient transformers,” in International Conference on Learning Representations, 2021.
+[5] Y. Tay, M. Dehghani, D. Bahri, and D. Metzler, “Efficient transformers: A survey,” arXiv preprint arXiv:2009.06732, 2020.
+[6] M. Zaheer, G. Guruganesh, K. A. Dubey, J. Ainslie, C. Alberti, S. Ontañón, P. Pham, A. Ravula, Q. Wang, L. Yang, and A. Ahmed, “Big bird: Transformers for longer sequences,” in NeurIPS, 2020.
+[7] A. Roy, M. Saffar, A. Vaswani, and D. Grangier, “Efficient content-based sparse attention with routing transformers,” Transactions of the Association for Computational Linguistics, vol. 9, pp. 53–68, 2021.
+[8] N. Kitaev, L. Kaiser, and A. Levskaya, “Reformer: The efficient transformer,” in International Conference on Learning Representations, 2020.
+[9] J. Ainslie, S. Ontañón, C. Alberti, V. Cvicek, Z. Fisher, P. Pham, A. Ravula, S. Sanghai, Q. Wang, and L. Yang, “ETC: encoding long and structured inputs in transformers,” in EMNLP, 2020.
+[10] S. Sukhbaatar, D. Ju, S. Poff, S. Roller, A. Szlam, J. Weston, and A. Fan, “Not all memories are created equal: Learning to forget by expiring,” in ICML, 2021.
+[11] Y. Wu, M. Rabe, D. Hutchins, and C. Szegedy, “Memorizing transformers,” in ICLR, 2022.
+[12] Z. Zhu and R. Soricut, “H-transformer-1d: Fast one-dimensional hierarchical attention for sequences,” in ACL (C. Zong, F. Xia, W. Li, and R. Navigli, eds.), 2021.
+[13] H. Ren, H. Dai, Z. Dai, M. Yang, J. Leskovec, D. Schuurmans, and B. Dai, “Combiner: Full attention transformer with sparse computation cost,” in Advances in Neural Information Processing Systems (A. Beygelzimer, Y. Dauphin, P. Liang, and J. W. Vaughan, eds.), 2021.
+[14] S. Wang, B. Z. Li, M. Khabsa, H. Fang, and H. Ma, “Linformer: Self-attention with linear complexity,” CoRR, vol. abs/2006.04768, 2020.
+[15] J. W. Rae, A. Potapenko, S. M. Jayakumar, C. Hillier, and T. P. Lillicrap, “Compressive transformers for long-range sequence modelling,” in ICLR, 2020.
+[16] Z. Dai, G. Lai, Y. Yang, and Q. Le, “Funnel-transformer: Filtering out sequential redundancy for efficient language processing,” in NeurIPS, 2020.
+[17] A. Katharopoulos, A. Vyas, N. Pappas, and F. Fleuret, “Transformers are RNNs: Fast autoregressive transformers with linear attention,” in ICML, 2020.
+[18] K. M. Choromanski, V. Likhosherstov, D. Dohan, X. Song, A. Gane, T. Sarlós, P. Hawkins, J. Q. Davis, A. Mohiuddin, L. Kaiser, D. B. Belanger, L. J. Colwell, and A. Weller, “Rethinking attention with performers,” in ICLR, 2021.
+[19] H. Peng, N. Pappas, D. Yogatama, R. Schwartz, N. A. Smith, and L. Kong, “Random feature attention,” in ICLR, 2021.
+[20] I. Schlag, K. Irie, and J. Schmidhuber, “Linear Transformers are secretly fast weight programmers,” in ICML, 2021.
+[21] W. Hua, Z. Dai, H. Liu, and Q. V. Le, “Transformer quality in linear time,” arXiv preprint arXiv:2202.10447, 2022.
+[22] J. Schmidhuber, “Reducing the ratio between learning complexity and number of time varying variables in fully recurrent nets,” in International Conference on Artificial Neural Networks (ICANN), 1993.
+[23] K. Irie, I. Schlag, R. Csordás, and J. Schmidhuber, “Going beyond linear transformers with recurrent fast weight programmers,” in confNEU, 2021.
+[24] A. Fan, T. Lavril, E. Grave, A. Joulin, and S. Sukhbaatar, “Addressing some limitations of transformers with feedback memory,” arXiv preprint arXiv:2002.09402, 2020.
+[25] T. Lei, Y. Zhang, S. I. Wang, H. Dai, and Y. Artzi, “Simple recurrent units for highly parallelizable recurrence,” in EMNLP, 2018.
+[26] T. Lei, “When attention meets fast recurrence: Training language models with reduced compute,” in EMNLP, 2021.
+[27] M. X. Chen, O. Firat, A. Bapna, M. Johnson, W. Macherey, G. F. Foster, L. Jones, M. Schuster, N. Shazeer, N. Parmar, A. Vaswani, J. Uszkoreit, L. Kaiser, Z. Chen, Y. Wu, and M. Hughes, “The best of both worlds: Combining recent advances in neural machine translation,” in ACL, 2018.
+[28] V. J. Hellendoorn, P. Maniatis, R. Singh, C. Sutton, and D. Bieber, “Global relational models of source code,” in ICLR, 2020.
+[29] Z. Wang, Y. Ma, Z. Liu, and J. Tang, “R-transformer: Recurrent neural network enhanced transformer,” arXiv preprint arXiv:1907.05572, 2019.
+[30] A. Jaegle, F. Gimeno, A. Brock, O. Vinyals, A. Zisserman, and J. Carreira, “Perceiver: General perception with iterative attention,” in icml, 2021.
+[31] A. Al Adel and M. S. Burtsev, “Memory transformer with hierarchical attention for long document processing,” in 2021 International Conference Engineering and Telecommunication (En T), 2021.
+[32] D. Ju, S. Roller, S. Sukhbaatar, and J. Weston, “Staircase attention for recurrent processing of sequences,” arXiv preprint arXiv:2106.04279, 2021.
+[33] I. Beltagy, M. E. Peters, and A. Cohan, “Longformer: The long-document transformer,” arXiv preprint arXiv:2004.05150, 2020.
+[34] Z. Dai, Z. Yang, Y. Yang, J. G. Carbonell, Q. V. Le, and R. Salakhutdinov, “Transformer-XL: Attentive language models beyond a fixed-length context,” in ACL, 2019.
+[35] R. J. Williams and J. Peng, “An efficient gradient-based algorithm for on-line training of recurrent network trajectories,” Neural Computation, 1990.
+[36] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin, “Attention is all you need,” in Advances in neural information processing systems, 2017.
+[37] R. Csordás, K. Irie, and J. Schmidhuber, “The neural data router: Adaptive control flow in transformers improves systematic generalization,” in International Conference on Learning Representations, 2022.
+[38] K. Greff, R. K. Srivastava, J. Koutník, B. R. Steunebrink, and J. Schmidhuber, “LSTM: A search space odyssey,” IEEE transactions on neural networks and learning systems, vol. 28, no. 10, 2016.
+[39] C. Raffel, N. Shazeer, A. Roberts, K. Lee, S. Narang, M. Matena, Y. Zhou, W. Li, and P. J. Liu, “Exploring the limits of transfer learning with a unified text-to-text transformer,” Journal of Machine Learning Research, 2020.
+[40] A. Henry, P. R. Dachapally, S. S. Pawar, and Y. Chen, “Query-key normalization for transformers,” in EMNLP, 2020.
+[41] R. K. Srivastava, K. Greff, and J. Schmidhuber, “Training very deep networks,” in NIPS (C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett, eds.), 2015.
+[42] S. Sun, K. Krishna, A. Mattarella-Micke, and M. Iyyer, “Do long-range language models actually use long-range context?,” in Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 807–822, Association for Computational Linguistics, Nov. 2021.
+[43] J. Hoffmann, S. Borgeaud, A. Mensch, E. Buchatskaya, T. Cai, E. Rutherford, D. d. L. Casas, L. A. Hendricks, J. Welbl, A. Clark, et al., “Training compute-optimal large language models,” arXiv preprint arXiv:2203.15556, 2022.
+[44] T. Kudo and J. Richardson, “Sentencepiece: A simple and language independent subword tokenizer and detokenizer for neural text processing,” in EMNLP, 2018.
+[45] C. Hawthorne, A. Jaegle, C. Cangea, S. Borgeaud, C. Nash, M. Malinowski, S. Dieleman, O. Vinyals, M. Botvinick, I. Simon, et al., “General-purpose, long-context autoregressive modeling with perceiver ar,” arXiv preprint arXiv:2202.07765, 2022.
+[46] Y. Dong, J. Cordonnier, and A. Loukas, “Attention is not all you need: pure attention loses rank doubly exponentially with depth,” in ICML (M. Meila and T. Zhang, eds.), 2021.
+[47] U. Shaham, E. Segal, M. Ivgi, A. Efrat, O. Yoran, A. Haviv, A. Gupta, W. Xiong, M. Geva, J. Berant, and O. Levy, “Scrolls: Standardized comparison over long language sequences,” 2022.
+[48] A. Wang, R. Y. Pang, A. Chen, J. Phang, and S. R. Bowman, “Squality: Building a longdocument summarization dataset the hard way,” arXiv preprint arXiv:2205.11465, 2022.
+[49] T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, S. Agarwal, A. Herbert-Voss, G. Krueger, T. Henighan, R. Child, A. Ramesh, D. M. Ziegler, J. Wu, C. Winter, C. Hesse, M. Chen, E. Sigler, M. Litwin, S. Gray, B. Chess, J. Clark, C. Berner, S. McCandlish, A. Radford, I. Sutskever, and D. Amodei, “Language models are few-shot learners,” in NeurIPS, 2020.
+[50] A. Srivastava, A. Rastogi, A. Rao, A. A. M. Shoeb, A. Abid, A. Fisch, A. R. Brown, A. Santoro, A. Gupta, A. Garriga-Alonso, et al., “Beyond the imitation game: Quantifying and extrapolating the capabilities of language models,” arXiv preprint arXiv:2206.04615, 2022.
+[51] N. Shazeer and M. Stern, “Adafactor: Adaptive learning rates with sublinear memory cost,” in ICML, 2018.
+[52] R. Thoppilan, D. De Freitas, J. Hall, N. Shazeer, A. Kulshreshtha, H.-T. Cheng, A. Jin, T. Bos, L. Baker, Y. Du, et al., “Lamda: Language models for dialog applications,” arXiv preprint arXiv:2201.08239, 2022.
+[53] O. Press, N. Smith, and M. Lewis, “Train short, test long: Attention with linear biases enables input length extrapolation,” in International Conference on Learning Representations, 2022.
+[54] D. Adiwardana, M.-T. Luong, D. R. So, J. Hall, N. Fiedel, R. Thoppilan, Z. Yang, A. Kulshreshtha, G. Nemade, Y. Lu, et al., “Towards a human-like open-domain chatbot,” arXiv preprint arXiv:2001.09977, 2020.
+
+# 7 Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes]
+(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 5.1.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We plan to open-source the code itself, although we have not yet done so. We have given a detailed description of architecture, hyper-parameters, and training methodology. Our main results are for PG19, which is a publicly available dataset.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix C.
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] Given the large number of experiments, we did not have the computational resources to run every experiment multiple times, but we do run experiments over multiple datasets. For the main headline numbers on PG19-tokens, we ran the primary experiments three times each with different initial seeds and with dataset shuffling. Error bars are given in Table 1. Note that actual measured error bars are somewhat lower than reported in Table 1; we round results to the nearest 0.01, and thus round the error $u p$ to match the precision of the reported results. See Appendix C for details.
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix C.
+
+3. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [Yes] See Appendix C.1.
+(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] See Appendix C.1.
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] See Appendix C.1.
\ No newline at end of file
diff --git a/md/dev/um2BxfgkT2_/um2BxfgkT2_.md b/md/dev/um2BxfgkT2_/um2BxfgkT2_.md
new file mode 100644
index 0000000000000000000000000000000000000000..05dfb0bf5d501dfaf1726346e2d9ebbb35825f44
--- /dev/null
+++ b/md/dev/um2BxfgkT2_/um2BxfgkT2_.md
@@ -0,0 +1,316 @@
+# Pure Transformers are Powerful Graph Learners
+
+Jinwoo ${ \bf K i m ^ { 1 * } }$ Tien Dat Nguyen1 Seonwoo $\mathbf { M } \mathbf { i n } ^ { 2 }$ Sungjun Cho2 Moontae Lee2,3 Honglak Lee2† Seunghoon Hong1,2† 1KAIST $^ 2 \mathrm { L G }$ AI Research 3University of Illinois Chicago
+
+# Abstract
+
+We show that standard Transformers without graph-specific modifications can lead to promising results in graph learning both in theory and practice. Given a graph, we simply treat all nodes and edges as independent tokens, augment them with token embeddings, and feed them to a Transformer. With an appropriate choice of token embeddings, we prove that this approach is theoretically at least as expressive as an invariant graph network (2-IGN) composed of equivariant linear layers, which is already more expressive than all message-passing Graph Neural Networks (GNN). When trained on a large-scale graph dataset (PCQM4Mv2), our method coined Tokenized Graph Transformer (TokenGT) achieves significantly better results compared to GNN baselines and competitive results compared to Transformer variants with sophisticated graph-specific inductive bias. Our implementation is available at https://github.com/jw9730/tokengt.
+
+# 1 Introduction
+
+In recent years, Transformer [68] has served as a versatile architecture in a broad class of machine learning problems, such as natural language processing [17, 7], computer vision [18], and reinforcement learning [9], to name a few. It is because the fully-attentional structure of Transformer is general and powerful enough to take, process, and relate inputs and outputs of arbitrary structures, eliminating a need for data- and task-specific inductive bias to be baked into the network architecture. Combined with large-scale training, it opens up a new chapter for building a versatile model that can solve a wide range of problems involving diverse data modalities and even a mixture of modalities [31, 30, 57].
+
+In graph learning domain, inspired by the breakthroughs, multiple works tried combining selfattention into graph neural network (GNN) architecture where message passing was previously dominant [50]. As global self-attention across nodes cannot reflect the graph structure, however, these methods introduce graph-specific architectural modifications. This includes restricting self-attention to local neighborhoods [69, 51, 19], using global self-attention in conjunction with message-passing GNN [58, 43, 34], and injecting edge information into global self-attention via attention bias [72, 78, 29, 54]. Despite decent performance, such modifications can be a limiting constraint in terms of versatility, especially considering future integration to multi-task and multi-modal general-purpose attentional architectures [31]. In addition, deviating from pure self-attention, these methods may inherit the issues of message-passing such as oversmoothing [40, 8, 52], and become incompatible with useful engineering techniques e.g., linear attention [65] developed for standard self-attention.
+
+Instead, we explore the opposite direction of applying a standard Transformer directly for graphs. For this, we treat all nodes and edges as independent tokens, augment them with appropriate token-wise embeddings, and feed the tokens as input to the standard Transformer. The model operates identically to Transformers used in language and vision; each node or edge is treated as a token, identical to the words in a sentence or patches of an image [68, 18]. Perhaps surprisingly, we show that this simple approach yields a powerful graph learner both in theory and practice.
+
+
+Figure 1: Overview of Tokenized Graph Transformer (TokenGT). We treat all nodes and edges of an input graph as independent tokens, augment them with orthonormal node identifiers and trainable type identifiers, and feed them to a standard Transformer encoder. For graph-level prediction, we follow the common practice [17, 18] of using an extra trainable [graph] token.
+
+As a key theoretical result, we prove that with appropriate token-wise embeddings, self-attention over the node and edge tokens can approximate any permutation equivariant linear operator on a graph [47]. Remarkably, we show that a very simple choice of embedding composed of node identifiers and type identifiers is sufficient for accurate approximation. This provides a solid theoretical guarantee that, with the embeddings and enough attention heads, a Transformer is at least as expressive as a second-order invariant graph network (2-IGN) [47, 34], which is already more expressive than all message-passing GNNs [21]. This also immediately grants the model with the expressive power at least as good as the 2-dimensional Weisfeiler-Lehman (WL) graph isomorphism test [46], which is often sufficient for real-world graph data [83]. We further extend our theoretical result to hypergraphs with order- $k$ hyperedges, showing that a Transformer with order- $k$ generalized token embeddings is at least as expressive as $k$ -IGN and, consequently $k$ -WL test.
+
+We test our model, named Tokenized Graph Transformer (TokenGT), mainly on the PCQM4Mv2 large-scale quantum chemical property prediction dataset containing 3.7M molecular graphs [27]. Even though TokenGT involves minimal graph-specific architectural modifications, it performs significantly better than all GNN baselines, showing that the advantages of Transformer architecture combined with large-scale training surpass the benefit of hard inductive bias of GNNs. Furthermore, TokenGT achieves competitive performance compared to Transformer variants with strong graphspecific modifications [78, 29, 54]. Finally, we demonstrate that TokenGT can naturally utilize efficient approximations in Transformers in contrast to these variants, using kernel attention [11] that enables linear computation cost without much degradation in performance.
+
+# 2 Tokenized Graph Transformer (TokenGT)
+
+In this section, we present the Tokenized Graph Transformer (TokenGT), a pure Transformer architecture for graphs with token-wise embeddings composed of node identifiers and type identifiers (Figure 1). Our goal in this section is to provide a practical overview – for theoretical analysis of the architecture, we guide the readers to Section 3.
+
+Let $\mathcal { G } = ( \nu , \mathcal { E } )$ an input graph with $n$ nodes $\mathcal { V } = \{ v _ { 1 } , . . . , v _ { n } \}$ and $m$ edges $\mathcal { E } = \{ e _ { 1 } , . . . , e _ { m } \} \subseteq$ $\mathcal { V } ^ { 2 }$ , associated with features $\mathbf { X } ^ { \nu } \in \mathbb { R } ^ { n \times C }$ and ∈ Rm×C , respectively. We treat each node and edge as an independent token (thus $( n + m )$ tokens in total) and construct their features by $\mathbf { X } = [ \bar { \mathbf { X } } ^ { \nu } ; \mathbf { X } ^ { \varepsilon } ] \in \mathbb { R } ^ { ( n + m ) \times C }$ . A naïve way to process a graph is to directly provide the tokens $\mathbf { X }$ as input to a Transformer, but it is inappropriate as graph connectivity is discarded. To thoroughly represent graph structure, we augment the tokens $\mathbf { X }$ with token-wise embeddings, more specifically orthonormal node identifiers used for representing the connectivity of the tokens and trainable type identifiers that encode whether a token is a node or an edge. Despite the simplicity, we show that a Transformer applied on these embeddings is a theoretically powerful graph learner.
+
+Node Identifiers The first component of token-wise embedding is the orthonormal node identifier that we use to represent the connectivity structure given in the input graph.
+
+For a given input graph $\mathcal { G } = ( \nu , \mathcal { E } )$ , we first produce $n$ node-wise orthonormal vectors $\mathbf { P } \in \mathbb { R } ^ { n \times d _ { p } }$ that we refer to as node identifiers. Then, we augment the tokens $\mathbf { X }$ with node identifiers as follows.
+
+• For each node $v \in \mathcal V$ , we augment the token $\mathbf { X } _ { v }$ as $\big [ \mathbf { X } _ { v } , \mathbf { P } _ { v } , \mathbf { P } _ { v } \big ]$ .
+• For each edge $( u , v ) \in \mathcal { E }$ , we augment the token $\mathbf { X } _ { ( u , v ) }$ as $[ \mathbf { X } _ { ( u , v ) } , \mathbf { P } _ { u } , \mathbf { P } _ { v } ]$ .
+
+Intuitively, a Transformer operating on the augmented tokens can fully recognize the connectivity structure of the graph since comparing the node identifiers between a pair of tokens reveals their incidence information. For instance, we can tell if an edge $\boldsymbol { e } = \left( u , v \right)$ is connected with a node $k$ through dot-product (attention) since $[ { \bf P } _ { u } , { \bf P } _ { v } ] [ { \bf P } _ { k } , { \bf P } _ { k } ] ^ { \top } = 1$ if and only if $k \in \mathsf { \Gamma } ( u , v )$ and 0 otherwise. This allows the Transformer to identify and exploit the connectivity structure of a graph, for instance by putting more weights on incident pairs when the local operation is important.
+
+Notably, as the node identifiers $\mathbf { P }$ are only required to be orthonormal, we have a large degree of freedom in implementation choices. We outline two practical methods below as examples. Their implementation details can be found in Appendix A.3.1.
+
+• Orthogonal random features (ORFs), e.g., rows of random orthogonal matrix $\mathbf { Q } \in \mathbb { R } ^ { n \times n }$ obtained with QR decomposition of random Gaussian matrix $\mathbf { G } \in \mathbb { R } ^ { n \times n }$ [79, 12]. • Laplacian eigenvectors obtained from eigendecomposition of graph Laplacian matrix, i.e., rows of U from $ { \Delta } = { \mathbf { I } } - { \mathbf { D } } ^ { - 1 / 2 } { \mathbf { A } } { \mathbf { D } } ^ { - 1 / 2 } = { \mathbf { U } } ^ { \top } { \mathbf { A } } \bar { { \mathbf { U } } }$ , where $\mathbf { A } \in \mathbb { R } ^ { n \times n }$ is adjacency matrix, $\mathbf { D }$ is degree matrix, and $\pmb { \Lambda }$ , U correspond to eigenvalues and eigenvectors respectively [20].
+
+Among the two methods, node identifiers generated as ORFs do not encode any information about the graph structure as they are entirely random. This means the Transformer that operates on the ORF-based node identifiers needs to compile and recognize graph structure only from the incidence information provided by the node identifiers. Although this is challenging, perhaps surprisingly, we empirically show in Section 5 that Transformers are strong enough to learn meaningful structural representations out of ORF-based node identifiers and outperform GNNs on large-scale task.
+
+In contrast to ORFs, Laplacian eigenvectors provide a kind of graph positional embeddings (graph PEs) that describes the distance between nodes on a graph. Due to the positional information, it yields better performance compared to ORFs in our experiments in Section 5. One interesting aspect of Laplacian eigenvectors is that they can be viewed as a generalization of sinusoidal positional embeddings of NLP Transformers to graphs, as the eigenvectors of 1D chain graphs are sine and cosine functions [20]. Thus, by choosing Laplacian eigenvectors as node identifiers, our approach can be interpreted as a direct extension of the NLP Transformer for inputs involving relational structures.
+
+Type Identifiers The second component of token-wise embedding is the trainable type identifier that encodes whether a token is node or edge. For a given input graph $\mathcal { G } = ( \nu , \mathcal { E } )$ , we first prepare a trainable parameter matrix ${ \bf E } = [ { \bf E } ^ { \nu } ; { \bf E } ^ { \varepsilon } ] \in \mathbb { R } ^ { 2 \times d _ { e } }$ that contains two type identifiers $\mathbf { E } ^ { \nu }$ and $\mathbf { E } ^ { \mathcal { E } }$ for nodes and edges respectively. Then, we further augment the tokens with type identifiers as follows.
+
+• For each node $v \in \mathcal V$ , we augment the token $[ \mathbf { X } _ { v } , \mathbf { P } _ { v } , \mathbf { P } _ { v } ]$ as $[ \mathbf { X } _ { v } , \mathbf { P } _ { v } , \mathbf { P } _ { v } , \mathbf { E } ^ { \nu } ]$ .
+• For each edge $( u , v ) \in \mathcal { E }$ , we augment the token $[ \mathbf { X } _ { ( u , v ) } , \mathbf { P } _ { u } , \mathbf { P } _ { v } ]$ as $[ \mathbf { X } _ { ( u , v ) } , \mathbf { P } _ { u } , \mathbf { P } _ { v } , \mathbf { E } ^ { \mathcal { E } } ]$ .
+
+These embeddings provide information on whether a given token is a node or an edge, which is critical, e.g., when an attention head tries to attend specifically to node tokens and ignore edge tokens.
+
+Main Transformer With node identifiers and type identifiers, we obtain augmented token features $\mathbf { X } ^ { i n } \in \mathbb { R } ^ { ( n + m ) \times ( C + 2 d _ { p } + d _ { e } ) }$ , which is further projected by a trainable matrix $\overline { { w } } ^ { i n } \in \mathbb { R } ^ { ( C + 2 d _ { p } + d _ { e } ) \times d }$ to be an input to Transformer. For graph-level prediction, we prepend a special token [graph] with trainable embedding $\mathbf { X } _ { [ \mathrm { g r a p h } ] } \mathbf { \bar { \Pi } } \in \mathbf { \bar { \Pi } } \mathbb { R } ^ { d }$ similar to BERT [17] and ViT [18]. We utilize the feature of [graph] token at the output of the encoder as the graph representation, on which a linear prediction head is applied to produce the final graph-level prediction. Overall, the tokens ${ \bf Z } ^ { ( 0 ) } = [ { \bf X } _ { [ \mathrm { g r a p h } ] } ; { \bf X } ^ { i n } w ^ { i n } ] \bar { \in } \mathbb { R } ^ { ( 1 + n \bar { + } m ) \times d }$ are used as the input to the main encoder. As an encoder, we adopt the standard Transformer [68], which is an alternating stack of multihead self-attention layers (MSA) and feedforward MLP layers. We provide further details in Appendix A.1.1.
+
+Inductive Bias Similar to Transformers in language and vision [17, 18], Tokenized Graph Transformer treats input nodes and edges as independent tokens and applies self-attention to them. This approach leads to much less inductive bias than current GNNs, where the sparse graph structure, or more fundamentally, permutation symmetry of graphs is deliberately baked into each layer [21, 47, 46, 34]. For TokenGT, such information is provided entirely as a part of input using token-wise embeddings, and the model has to learn how to interpret and utilize the information from data. Although such weak inductive bias might raise questions on the expressiveness of the model, our theoretical analysis in Section 3 shows that TokenGT is a powerful graph learner thanks to the token-wise embeddings and expressive power of self-attention. For example, we show that TokenGT is more expressive than all message-passing GNNs under the framework of Gilmer et al. (2017) [21].
+
+# 3 Theoretical Analysis
+
+We now present our theory. Our key result is that TokenGT, a standard Transformer with node and type identifiers presented in Section 2, is provably at least as expressive as the second-order Invariant Graph Network (2-IGN [47]), which is built upon all possible permutation equivariant linear layers on a graph. This provides solid theoretical guarantees for TokenGT, such as being at least as powerful as the 2-WL graph isomorphism test and more expressive than all message-passing GNNs. Our theory is based on a general framework on hypergraphs represented as higher-order tensors, which leads to the formulation of order- $k$ TokenGT that is at least as expressive as order- $k$ IGN $k$ -IGN [47]).
+
+# 3.1 Preliminary: Permutation Symmetry and Invariant Graph Networks
+
+Representing and Processing Sets and (Hyper)Graphs For a set of $n$ nodes, we often represent their features as $\mathbf { X } \in \mathbb { R } ^ { n \times d }$ where $\mathbf { X } _ { i } \in \mathbb { R } ^ { d }$ is the feature of the $i$ -th node. The set is unordered and, therefore, should be treated invariant to the renumbering of the nodes. Let $S _ { n }$ the symmetric group or the group of permutations $\pi$ on $[ n ] = \{ 1 , . . . , n \}$ . By $\pi \cdot \mathbf { X }$ we denote permuting rows of $\mathbf { X }$ with $\pi$ , i.e., $( \pi \cdot \mathbf { \bar { X } } ) _ { i } = \mathbf { X } _ { \pi ^ { - 1 } ( i ) } .$ . Here, $\mathbf { X }$ and $\pi \cdot \mathbf { X }$ represent the identical set for all $\pi \in S _ { n }$ .
+
+Generally, we consider (hyper)graphs represented as order- $k$ tensor $\mathbf { X } \in \mathbb { R } ^ { n ^ { k } \times d }$ with feature $\mathbf { X _ { i } } =$ $\mathbf { X } _ { i _ { 1 } , \dots , i _ { k } } \in \mathbb { R } ^ { d }$ attached to (hyper)edge represented as multi-index $\mathbf { i } = ( i _ { 1 } , . . . , i _ { k } ) \in [ n ] ^ { k }$ . Similar to sets, the tensor should be treated invariant to node renumbering by any $\pi \in S _ { n }$ that acts on $\mathbf { X }$ by $( { \boldsymbol { \pi } } \cdot \mathbf { X } ) _ { \mathbf { i } } = \mathbf { X } _ { \pi ^ { - 1 } ( \mathbf { i } ) }$ where $\pi ^ { - 1 } ( \mathbf { i } ) = ( \pi ^ { - 1 } ( i _ { 1 } ) , . . . , \pi ^ { - 1 } ( i _ { k } ) )$ . That is, $\mathbf { X }$ and $\pi \cdot { \bf X }$ represent the identical (hyper)graph for all $\pi$ . Due to such symmetry, to build a function $F ( \mathbf { X } ) \approx T$ for tensor $\mathbf { X }$ and target $T$ , a suitable way is to make them invariant ${ \bf { \dot { F } } } ( \pi \cdot { \bf { X } } ) = F ( { \bf { X } } )$ when the target is a vector or equivariant $F ( { \boldsymbol \pi } \cdot \mathbf { X } ) = { \boldsymbol \pi } \cdot F ( \mathbf { X } )$ when the target is also a tensor, for all $\mathbf { X } \in \mathbb { R } ^ { n ^ { k } \times d }$ and $\pi \in S _ { n }$
+
+In our theoretical analysis, we work on order- $k$ dense tensor representation $\mathbf { X } \in \mathbb { R } ^ { n ^ { k } \times d }$ of a graph as they can represent node features $ { \left( k = 1 \right. }$ ), edge features $k = 2$ ), or hyperedge features $( k > 2 )$ ) in a unified manner. This is interchangeable but slightly different from the sparse representation of a graph with edge set $\mathcal { E }$ used in Section 2. Nevertheless, in Section 5 we empirically verify that our key theoretical findings work equally well for dense and sparse graphs.
+
+Invariant Graph Network We mainly develop our theoretical analysis upon Invariant Graph Networks (IGNs) [47, 46], a family of expressive graph networks derived from the permutation symmetry of tensor representation of graphs. Here we provide a summary. In general, we define:
+
+Definition 1. An order- $k$ Invariant Graph Network ( $k$ -IGN) is a function $F _ { k } : \mathbb { R } ^ { n ^ { k } \times d _ { 0 } } \mathbb { R }$ written as the following:
+
+$$
+F _ { k } = \mathbf { M } \mathbf { L } \mathbf { P } \circ L _ { k 0 } \circ L _ { k k } ^ { ( T ) } \circ \sigma \circ \dots \circ \sigma \circ L _ { k k } ^ { ( 1 ) } ,
+$$
+
+where each L(t) is equivariant linear layer [47] from $\mathbb { R } ^ { n ^ { k } \times d _ { t - 1 } }$ to $\mathbb { R } ^ { n ^ { k } \times d _ { t } }$ , $\sigma$ is activation function, and $L _ { k 0 }$ is a invariant linear layer from $\mathbb { R } ^ { n ^ { k } \times d _ { T } } t o \mathbb { R }$ .
+
+A body of previous work have shown appealing theoretical properties of $k$ -IGN, including universal approximation [48] and alignment to $k$ -Weisfeiler-Lehman ( $k$ -WL) graph isomorphism test [46, 10]. In particular, it is known that $k$ -IGNs are theoretically at least as powerful as the $k$ -WL test [46]. It is also known that 2-IGNs are already more expressive [47, 34] than all message-passing GNNs under the framework of Gilmer et al. (2017) [21].
+
+The core building block of IGN is invariant and equivariant linear layers [47] with maximal expressiveness while respecting node permutation symmetry. The layers are defined as follows:
+
+Definition 2. An equivariant linear layer is a function $L _ { k \to l } : \mathbb { R } ^ { n ^ { k } \times d } \mathbb { R } ^ { n ^ { l } \times d ^ { \prime } }$ written as follows for order-k input X ∈ Rnk×d:
+
+$$
+L _ { k \to l } ( { \bf X } ) _ { \bf i } = \sum _ { \mu } \sum _ { { \bf j } } { \bf B } _ { { \bf i } , { \bf j } } ^ { \mu } { \bf X } _ { { \bf j } } w _ { \mu } + \sum _ { \lambda } { \bf C } _ { { \bf i } } ^ { \lambda } b _ { \lambda } ,
+$$
+
+where $\mathbf { i } \in [ n ] ^ { l } , \mathbf { j } \in [ n ] ^ { k }$ are multi-indices, $w _ { \boldsymbol { \mu } } \in \mathbb { R } ^ { d \times d ^ { \prime } }$ , $b _ { \lambda } \in \mathbb { R } ^ { d ^ { \prime } }$ are weight and bias parameters, and Bµ ∈ Rnl+k and $\mathbf { C } ^ { \lambda } \in \mathbb { R } ^ { n ^ { l } }$ are binary basis tensors corresponding to order- $( l + k )$ and order- $l$ equivalence classes $\mu$ and $\lambda$ , respectively. Invariant linear layer is a special case of $L _ { k l }$ with $l = 0$ .
+
+We provide the definition of the equivalence classes and basis tensors in Appendix A.1.1. For now, it is sufficient to know that the basis tensors are binary tensors that form the orthogonal basis of the full space of linear equivariant layers. In general, in Eq. (2) it is known that there exists $\mathrm { b e l l } ( k + l )$ number of basis tensors $\mathbf { B } ^ { \mu }$ for the weight and $\mathsf { b e l l } ( l )$ number of basis tensors $\mathbf { C } ^ { \lambda }$ for the bias.
+
+# 3.2 Can Self-Attention Approximate Equivariant Basis?
+
+Now, we present an intuition that connects Transformer (Section 2) and equivariant linear layer (Definition 2). For that, we write out the multihead self-attention layer as follows:
+
+$$
+\mathbf { M S A } ( \mathbf { X } ) _ { i } = \sum _ { h = 1 } ^ { H } \sum _ { j } \alpha _ { i j } ^ { h } \mathbf { X } _ { j } w _ { h } ^ { V } w _ { h } ^ { O } \mathrm { ~ w h e r e ~ } \alpha ^ { h } = \mathrm { s o f t m a x } \left( \frac { \mathbf { X } w _ { h } ^ { Q } ( \mathbf { X } w _ { h } ^ { K } ) ^ { \top } } { \sqrt { d _ { H } } } \right) ,
+$$
+
+where $H$ is number of heads, $d _ { H }$ is head size, and $w _ { h } ^ { Q } , w _ { h } ^ { K } \in \mathbb R ^ { d \times d _ { H } } , w _ { h } ^ { V } \in \mathbb R ^ { d \times d _ { v } } w _ { h } ^ { O } \in \mathbb R ^ { d _ { v } \times d } .$
+
+Our intuition is that the weighted sum of values with self-attention matrix $\alpha ^ { h }$ in Eq. (3) is analogous to the masked sum with basis tensor $\mathbf { B } ^ { \mu }$ in Eq. (2) up to normalization. This naturally leads to the following question: for a given equivariant layer $L _ { k \to k } : \mathbb { R } ^ { n ^ { k } \times d } \to \mathbb { R } ^ { n ^ { k } \times d }$ , can we use a Transformer layer with multihead self-attention $\mathbf { M S A } : \mathbb { R } ^ { N \times d ^ { \prime } } \mathbb { R } ^ { N \times d ^ { \prime } }$ with $N = n ^ { k }$ to accurately approximate $L _ { k k }$ by having $H = { \mathsf { b e l l } } ( 2 k )$ attention heads approximate each equivariant basis $\mathbf { B } ^ { \mu }$ ?
+
+We show that this can be possible, but only if we provide appropriate auxiliary information to input. For example, let us consider first-order layer $L _ { 1 1 }$ . The layer has ${ \mathsf { b e l l } } ( 2 ) = 2$ basis tensors $\mathbf { B } ^ { \mu _ { 1 } } = \mathbf { I }$ and $\mathbf { B } ^ { \mu _ { 2 } } = \mathbf { 1 1 } ^ { \top } - \mathbf { I }$ for the weight, and bel $1 ( 1 ) = 1$ basis tensor $\mathbf { C } ^ { \lambda _ { 1 } } = \mathbf { 1 }$ for the bias. Given an input set $\mathbf { X } \in \mathbb { R } ^ { n \times d }$ it computes the following with $w _ { 1 } , w _ { 2 } \in \mathbb { R } ^ { d \times d }$ , $b \in \mathbb { R } ^ { d }$ :
+
+$$
+L _ { 1 \to 1 } ( \mathbf { X } ) = \mathbf { I } \mathbf { X } w _ { 1 } + ( \mathbf { 1 1 } ^ { \top } - \mathbf { I } ) \mathbf { X } w _ { 2 } + \mathbf { 1 } b ^ { \top } .
+$$
+
+Now consider approximating basis tensor $\mathbf { B } ^ { \mu _ { 1 } } = \mathbf { I }$ with an attention matrix $\alpha ^ { 1 }$ . The approximation is accurate when $i$ -th query always only attends to $i$ -th key and ignores the rest. To achieve the attention structure consistently, i.e., agnostic to input $\mathbf { X }$ , we need to provide auxiliary input that self-attention can "latch onto" to faithfully approximate ${ \pmb { \alpha } } ^ { 1 } \approx { \bf I }$ . Without this, attention must entirely rely on the inputs $\mathbf { X }$ , which is unreliable and can lead to approximation failure, e.g., when $\mathbf { X }$ has repeated rows.
+
+For the auxiliary information, we prepare $n$ node-wise orthonormal vectors $\mathbf { P } \in \mathbb { R } ^ { n \times d _ { p } }$ (note that this is identical to node identifiers in Section 2), and augment the input to $\mathbf { X } ^ { i n } = [ \mathbf { X } , \mathbf { P } ] \in \mathbb { R } ^ { n \times ( d + d _ { p } ) }$ . Let us assume that the query and key projections in Eq. (3) ignore $\mathbf { X }$ and only leave $\mathbf { P }$ scaled by $\sqrt { a }$ with $a > 0$ . Then attention matrix is computed as $\bar { \mathbf { \alpha } } ^ { 1 } = \bar { \mathrm { s o f t m a x } } ( \mathbf { S } )$ where $\mathbf { S } _ { i j } = a \mathbf { P } _ { i } ^ { \top } \mathbf { P } _ { j }$ . Here, due to the orthonormality of $\mathbf { P }$ , we have ${ \bf P } _ { i } ^ { \top } { \bf P } _ { j } = 1$ only if $i = j$ and otherwise 0, which leads to $\mathbf { S } = a \mathbf { I }$ . With $a \infty$ by scaling up the query and key projection weights, the softmax becomes arbitrarily close to the hardmax operator, and we obtain the following:
+
+$$
+\alpha ^ { 1 } = \operatorname { s o f t m a x } ( a \mathbf { I } ) \to \mathbf { I } \operatorname { a s } a \to \infty .
+$$
+
+Thus, self-attention can utilize the auxiliary information $\mathbf { P }$ to achieve an input-agnostic approximation of $\alpha ^ { 1 }$ to I. Notably, we can achieve a similar approximation for $\mathbf { B } ^ { \mu _ { 2 } } = \mathbf { \bar { 1 1 } } ^ { \top } - \mathbf { I }$ using the same $\mathbf { P }$ by flipping the sign of keys, which gives $\pmb { \alpha } ^ { 2 } = \mathrm { s o f t m a x } ( - a \mathbf { I } )$ due to orthonormality. By sending $a \to \infty$ , now attention from the $i$ -th query to the $i$ -th key is suppressed, and we obtain the following:
+
+$$
+\alpha ^ { 2 } = \operatorname { s o f t m a x } \left( - a \mathbf { I } \right) \to { \frac { 1 } { n - 1 } } ( \mathbf { 1 1 } ^ { \top } - \mathbf { I } ) { \mathrm { ~ a s ~ } } a \to \infty .
+$$
+
+Note that this approximation is accurate only up to row normalization as rows of $\alpha ^ { 2 }$ always sum to one due to softmax, while $\mathbf { B } ^ { \mu _ { 2 } } = \mathbf { 1 1 } ^ { \top } - \bar { \mathbf { I } }$ is binary. In our proofs of the theoretical results, we perform appropriate denormalization with MLP after MSA to achieve an accurate approximation.
+
+Overall, we see that simple auxiliary input $\mathbf { P }$ suffices for two attention heads to approximate the equivariant basis of $L _ { 1 1 }$ accurately. We now question the following. Given appropriate auxiliary information as input, can a Transformer layer with bell $( 2 k )$ attention heads accurately approximate $L _ { k k }$ by having each head approximate each equivariant basis $\mathbf { B } ^ { \mu } ?$ What would be the sufficient auxiliary input? We answer the question by showing that, with (order- $k$ generalized) node and type identifiers presented in Section 2, Transformer layers can accurately approximate equivariant layers $L _ { k k }$ via input-agnostic head-wise approximation of each equivariant basis.
+
+# 3.3 Pure Transformers are Powerful Graph Learners
+
+We now present our main theoretical results that extend the discussions in Section 3.2 to any order $k$ . Note that $k = 2$ corresponds to TokenGT for graphs presented in Section 2. With $k > 2$ , we naturally extend TokenGT to hypergraphs. All proofs can be found in Appendix A.1.
+
+We first introduce generalized node and type identifiers (Section 2) for order- $k$ tensors $\mathbf { X } \in \mathbb { R } ^ { n ^ { k } \times d }$ We define the node identifier $\mathbf { P } \in \mathbb { R } ^ { n \times d _ { p } }$ as an orthonormal matrix with $n$ rows, and the type identifier as a trainable matrix $\mathbf { E } \in \mathbb { R } ^ { \mathrm { b e l l } ( k ) \times d _ { e } }$ that contains $\mathsf { b e l l } ( k )$ rows $\mathbf { E } ^ { \gamma _ { 1 } } , . . . , \mathbf { E } ^ { \gamma _ { \mathrm { b e l l } } ( k ) }$ , each of which is designated for an order- $k$ equivalence class $\gamma$ . Then, we augment each entry of input tensor as $[ \mathbf { X } _ { i _ { 1 } , . . . , i _ { k } } , \mathbf { \bar { P } } _ { i _ { 1 } } , . . . , \mathbf { P } _ { i _ { k } } , \mathbf { E } ^ { \gamma } ]$ where $( i _ { 1 } , . . . , i _ { k } ) \in \gamma$ .
+
+Let us exemplify. For $k = 1$ (sets), each $i$ -th entry is augmented as $\left[ { \bf X } _ { i } , { \bf P } _ { i } , { \bf E } ^ { \gamma _ { 1 } } \right]$ , consistent with our discussion in Section 3.2. For $k = 2$ (graphs), each $( i , i )$ -th entry is augmented as $\left[ { \bf X } _ { i i } , { \bf P } _ { i } , { \bf P } _ { i } , { \bf E } ^ { \gamma _ { 1 } } \right]$ and each $( i , j )$ -th entry $( i \neq j )$ is augmented as $[ { \bf X } _ { i j } , { \bf P } _ { i } , { \bf P } _ { j } , { \bf E } ^ { \gamma _ { 2 } } ]$ . This is consistent with TokenGT in Section 2, which augments nodes with $\mathbf { E } ^ { \nu } = \mathbf { E } ^ { \tilde { \gamma } _ { 1 } }$ and edges with $\mathbf { E } ^ { \mathcal { E } } = \mathbf { E } ^ { \gamma _ { 2 } }$ .
+
+With node and type identifiers, we obtain augmented order- $k$ tensor $\mathbf { X } ^ { i n } \in \mathbb { R } ^ { n ^ { k } \times ( d + k d _ { p } + d _ { e } ) }$ . We use a trainable projection $w ^ { i n } \in \mathbb { R } ^ { ( d + k d _ { p } + d _ { e } ) \times d \tau }$ to map them to hidden dimension $d \tau$ of a Transformer. We now show that self-attention on $\mathbf { X } ^ { i n } w ^ { i n }$ can accurately approximate equivariant basis:
+
+Lemma 1. For all $\mathbf { X } \in \mathbb { R } ^ { n ^ { k } \times d }$ and their augmentation $\mathbf { X } ^ { i n }$ , self-attention coefficients $\pmb { \alpha } ^ { h }$ (Eq. (3)) computed with $\mathbf { X } ^ { i n } w ^ { i n }$ can approximate any basis tensor $\mathbf { B } ^ { \mu } \in \mathbb { R } ^ { n ^ { 2 k } }$ of order- $k$ equivariant linear layer $L _ { k k }$ (Definition 2) to arbitrary precision up to normalization.
+
+Consequently, with the node and type identifiers, a collection of bell $( 2 k )$ attention heads can approximate the collection of all basis tensors of order- $k$ equivariant layer. This leads to the following:
+
+Theorem 1. For all $\mathbf { X } \in \mathbb { R } ^ { n ^ { k } \times d }$ and their augmentation $\mathbf { X } ^ { i n }$ , a Transformer layer with bell $( 2 k )$ self-attention heads that operates on $\mathbf { X } ^ { i n } w ^ { i n }$ can approximate an order- $k$ equivariant linear layer $L _ { k \to k } ( \mathbf X )$ (Definition 2) to arbitrary precision.
+
+While the approximation in Lemma 1 is only accurate up to normalization over inputs (keys) due to softmax normalization, for the approximation in Theorem 1 we perform appropriate denormalization using MLP after multihead self-attention and can obtain an accurate approximation.
+
+By extending the result to multiple layers, we arrive at the following:
+
+Theorem 2. For all $\mathbf { X } \in \mathbb { R } ^ { n ^ { k } \times d }$ and their augmentation $\mathbf { X } ^ { i n }$ , a Transformer composed of $T$ layers that operates on $\mathbf { X } ^ { i n } w ^ { i n }$ followed by sum-pooling and MLP can approximate an $k$ -IGN $F _ { k } ( \mathbf { X } )$ (Definition 1) to arbitrary precision.
+
+This directly leads to the following corollary:
+
+Corollary 1. A Transformer on node and type identifiers in Theorem 2 is at least as expressive as $k$ -IGN composed of order- $k$ equivariant linear layers.
+
+Corollary 1 allows us to draw previous theoretical results on the expressiveness of $k$ -IGN [46, 47, 34] and use them to lower-bound the provable expressiveness of a standard Transformer:
+
+Corollary 2. A Transformer on node and type identifiers in Theorem 2 is at least as powerful as $k$ -WL graph isomorphism test and is more expressive than all message-passing GNNs within the framework of Gilmer et al. (2017) [21].
+
+# 4 Related Work
+
+We outline relevant work including equivariant neural networks, theory on expressive power of Transformers and their connection to modeling equivariance, and Transformers for graphs.
+
+Equivariant Neural Networks A machine learning task is often invariant or equivariant to specific symmetry of input data, e.g., image classification is invariant to the translation of an input image. A large body of literature advocated baking the invariance or equivariance into a neural network as a type of inductive bias (e.g., translation equivariance of image convolution), showing that it reduces the number of parameters and improves generalization for a wide range of learning tasks involving various geometric structures [13, 14, 73, 66, 49, 53, 60, 6, 34, 39]. Ravanbakhsh et al. (2017) [56] showed that any equivariant layer for discrete group actions is equivalent to a specific parameter sharing structure. Zaheer et al. (2017) [82] and Maron et al. (2019) [47] derived the parameter sharing for node permutation-symmetric data (sets and (hyper)graphs), which gives the maximally expressive equivariant linear layers and $k$ -IGN in Section 3.1. The work on equivariant neural networks underlie our theory of how a standard Transformer can be a powerful learner for sets and (hyper)graphs.
+
+Expressive Power of Transformers and Its Connection to Equivariance Recent work involving Transformers often focus on minimizing the domain- and task-specific inductive bias and scaling the model and data so that any useful computation structure can be learned [18, 31, 30, 7, 17, 9, 39]. The success of this approach is, to some degree, attributed to the high expressive power of Transformers that allows learning diverse functions suited for the data at hand [81, 39, 3, 4, 41]. Recent theory has shown that Transformers are expressive enough to even model certain equivariant functions [1, 15, 39]. Andreoli et al. (2019) [1] cast self-attention and convolution into a unified framework using basis tensors similar to ones in Section 3.1. Cordonnier et al. (2020) [15] advanced the idea and showed that Transformers with relative positional encodings can approximate any image convolution layers. Lee et al. (2019) [39] and Kim et al. (2021) [34] showed that Transformers can model equivariant linear layers for sets [82], which can be viewed as the first-order case of our theory (see Section 3.2). To our knowledge, our work is the first to show that standard Transformers are expressive enough to provably model maximally expressive equivariant layers and $k$ -IGN for (hyper)graphs with $k \geq 2$ .
+
+Transformers for Graphs Unlike in language and vision, developing Transformers for graphs is challenging due to (1) the presence of edge connectivity and (2) the absence of canonical node ordering that prevents adopting simple positional encodings [50]. To incorporate the connectivity of edges, early methods restricted self-attention to local neighborhoods (thus reducing to messagepassing) [19, 51, 69] or used global self-attention with auxiliary message-passing modules [58, 43]. As message-passing suffers from limited expressive power [77] and oversmoothing [40, 8, 52], recent works often discard them and use global self-attention on nodes with heuristic modifications to process edges [78, 29, 54, 38, 42]. Ying et al. (2021) [78] proposed to inject edge encoding based on shortest paths through self-attention bias. Kreuzer et al. (2021) [38] proposed to incorporate edges into self-attention matrix via elementwise multiplication. On the contrary, we leave the self-attention unmodified and provide both nodes and edges with certain token-wise embeddings (Section 2) as its input. To incorporate graph structure into nodes, on the other hand, some approaches focus on developing graph positional encoding, e.g., based on Laplacian eigenvectors [20, 42, 38]. While these can be directly incorporated into our work via auxiliary node identifiers for better performance, we leave this as future work. We further note that current graph Transformers that utilize Laplacian positional encoding rely heavily on heuristic edge encoding [29, 38] while ours does not. Another closely related approach is the Higher-order Transformer [34] which generalizes $k$ -IGN with masked self-attention. While it is highly complex to implement due to hard-coded head-wise equivariant masks, our method can be implemented effortlessly using any available implementation of standard Transformer. Furthermore, our method is more flexible as the model can choose to use different attention heads to focus on a specific equivariant operator (e.g., local propagation) if needed. We further discuss the difficulty in applying linear attention to graph Transformers in Appendix A.2.
+
+# 5 Experiments
+
+We first conduct a synthetic experiment that directly confirms our key claims in Lemma 1 (Section 3). Then, we empirically explore the capability of Tokenized Graph Transformer (TokenGT) (Section 2) using the PCQM4Mv2 large-scale quantum chemistry regression dataset [27]. We further present experiments on transductive node classification datasets involving large graphs in Appendix A.4.3.
+
+Table 1: Second-order equivariant basis approximation. We report average and standard deviation of L2 error averaged over heads over 3 runs. For Random/ORF (first-order), we sample random embeddings independently for each token.
+
+
node id.
type id.
dense input
sparse input
train L2↓
test L2↓
train L2↓
test L2↓
×
×
47.95± 0.600
53.93 ± 1.426
29.88±0.450
34.70±1.167
×
O
32.38± 0.448
40.06±1.202
15.92 ± 0.275
20.39±0.765
Random (first-order)
0
32.19 ± 0.476
32.49 ± 3.687
15.87 ± 0.247
16.56 ± 0.904
ORF (first-order)
0
32.35 ± 0.369
39.87 ± 1.263
15.87 ± 0.247
16.56 ± 0.908
Random
×
5.909 ±0.019
5.548 ± 0.090
8.152 ± 0.042
8.270± 0.285
ORF
×
5.472 ± 0.035
5.143 ± 0.078
7.167 ± 0.025
7.190 ± 0.217
Laplacian eigenvector
×
1.899 ± 3.050
1.702 ± 2.912
0.288 ± 0.019
0.064 ± 0.010
Random
0
0.375±0.009
0.234 ± 0.011
0.990±0.108
0.875 ± 0.042
ORF
0
0.080 ± 0.001
0.009 ± 5e-5
0.129 ± 0.002
0.011 ± 0.002
Laplacian eigenvector
○
0.053 ± 1.5e-5
0.005 ± 1e-4
0.101 ± 0.003
0.019 ± 0.007
+
+
+Figure 2: Self-attention maps learned under various node and type identifier configurations for two target equivariant basis tensors (out of 15). For better visualization, we clamp the entries by 0.01. Self-attention learns acute patterns coherent to equivariant basis when orthonormal node identifiers and type identifiers are both provided as input. More images can be found in Appendix A.4.1.
+
+# 5.1 Approximating Second-Order Equivariant Basis
+
+As in Theorem 1 and 2 (Section 3), our argument on the expressive power of TokenGT relies on its capability to approximate order- $k$ permutation equivariant linear layers $L _ { k k }$ (Definition 2). Specifically, Lemma 1 states that such capability depends on the ability of each self-attention head $\hat { \pmb { \alpha } ^ { 1 } } , . . . , \pmb { \alpha } ^ { H }$ (Eq. (3)) to accurately approximate each equivariant basis $\mathbf { B } ^ { \mu _ { 1 } } , . . . , \mathbf { B } ^ { \mu _ { \mathrm { b e l l } } ( 2 k ) }$ (Definition 2) up to normalization.
+
+We verify this claim for $k = 2$ (second-order; graphs) in a synthetic setup using Barabási-Albert random graphs. We use a multihead self-attention layer (Eq. (3)) with bell $( 2 + 2 ) = 1 5$ heads and explicitly supervise head-wise attention scores $\pmb { \alpha } ^ { h }$ to approximate each (normalized) equivariant basis tensor $\mathbf { B } ^ { \mu _ { h } }$ by minimizing L2 loss. Having the layer hyperparameters fixed, we provide different combinations of node and type identifiers, and test if multihead self-attention can jointly approximate all 15 equivariant basis on unseen graphs. We experiment with both dense and sparse graph representations; for graphs with $n$ nodes and $m$ edges, the dense graph considers all $n ^ { 2 }$ pairwise edges as input as in Section 3, whereas the sparse graph considers only the present $m$ edges as in Section 2. Further details can be found in Appendix A.3.2.
+
+We outline the results in Table 1. Consistent with Lemma 1, self-attention achieves accurate approximation of equivariant basis only when both the orthonormal node identifiers and type identifiers are given. Here, Laplacian eigenvectors (Lap, $\bigcirc$ ) often yield slightly better results than orthogonal random features (ORF, $\bigcirc$ ) presumably due to less stochasticity. Interestingly, we see that self-attention transfers the learned (pseudo-)equivariant self-attention structure to unseen graphs near perfectly.
+
+Table 2: Results on PCQM4Mv2 large-scale graph regression benchmark. We report the Mean Absolute Error (MAE) on the validation set, and report MAE on the unavailable test set if possible.
+
+
. + O I O COn CD C . .00 CICI 0 . . . . : . . + ·· . Head 32 . :
. Head 1
+
+Non-orthogonal random embeddings lead to inaccurate approximation (Random, $\textcircled{)}$ ), highlighting the importance of orthogonality of node identifiers. The approximation is also inaccurate when we sample ORF $\mathbf { P } _ { t }$ independently for each token $t$ (ORF (first-order), $\bigcirc$ ) instead of using concatenated node identifiers $[ \mathbf { P } _ { u } , \mathbf { P } _ { v } ]$ for token $( u , v )$ . This supports our argument in Section 2 that the incidence information implicitly provided via node identifiers plays a key role in approximation.
+
+In Figure 2, we provide a visualization of self-attention maps learned under various node and type identifier choices. Additional results can be found in Appendix A.4.1.
+
+# 5.2 Large-Scale Graph Learning
+
+An exclusive characteristic of TokenGT is its minimal graph-specific inductive bias, which requires it to learn internal computation structure largely from data. As such models are commonly known to work well with large-scale data [68, 18], we explore the capability of TokenGT on the PCQM4Mv2 quantum chemistry regression dataset [27], one of the current largest with $3 . 7 \mathbf { M }$ molecular graphs.
+
+For TokenGT, we use both node and type identifiers, and use main Transformer encoder configuration based on Graphormer [78] with 12 layers, 768 hidden dimension, and 32 attention heads. We try both ORF and Laplacian eigenvector as node identifiers, and denote corresponding models as TokenGT (ORF) and TokenGT (Lap) respectively. As an ablation, we also experiment with the same Transformer without node and type identifiers, which we denote as Transformer. Finally, we apply the kernel attention [11] that approximates the attention computation to linear cost (TokenGT (Lap) $^ +$ Performer). We use AdamW optimizer with $( \beta _ { 1 } , \beta _ { 2 } ) = \mathsf { \bar { ( 0 . 9 9 , 0 . 9 9 9 ) } }$ and weight decay 0.1, and 60k learning rate warmup steps followed by linear decay over 1M iteration with batch size 1024. For fine-tuning, we use 1k warmup, 0.1M training steps, and cosine learning rate decay. We train the models on 8 RTX 3090 GPUs for 3 days. Further details are in Appendix A.3.3.
+
+We provide the results in Table 2. A standard Transformer on the node and edge tokens cannot recognize graph structure and shows low performance (0.2340 valid MAE). Yet, the picture changes as soon as we augment the tokens with node and type identifiers. Notably, TokenGT (ORF) achieves $0 . 0 9 6 2 \mathrm { M A E }$ , which is already better than all GNN baselines. This is a somewhat surprising result, as both ORF and the Transformer are not aware of graph structures. This implies Transformer is strong enough to learn to interpret and reason over the incidence structure of tokens provided only implicitly by the node and type identifiers. By further switching to Laplacian eigenvectors that encode position on graphs [20], we observe a performance boost to $0 . 0 9 1 0 ~ \mathrm { M A E }$ , competitive to Transformers with sophisticated graph-specific modifications (e.g., shortest path-based spatial encoding [78]). While such methods inject graph structure into attention matrix via bias term and therefore strictly require $\mathcal { O } ( n ^ { 2 } )$ cost, TokenGT enables adopting kernelization for pure self-attention [11], resulting in TokenGT (Lap) $^ +$ Performer with the best performance among ${ \mathcal { O } } ( n + m )$ models (0.0935 MAE). Further discussion on the empirical performance of TokenGT can be found in Appendix A.5.
+
+While our theory in Section 3 guarantees that TokenGT can reduce to an equivariant layer by learning fixed equivariant basis at each attention head, in practice, it can freely utilize multihead self-attention to learn less restricted and more useful computation structure from data. To analyze such a structure, we compute the attention distance across heads and network depth by averaging pairwise token distances on a graph weighted by their attention scores (Figure 3). This distance is analogous to the number of hops in message-passing. In both TokenGT (ORF) and TokenGT (Lap), in the lowest layers, some heads attend globally over the graph while others consistently have small receptive fields (acting like a local message-passing operator). In deeper layers, the attention distances increase, and most heads attend globally. Interestingly, this behavior is highly consistent with Vision Transformers on image patches [18], suggesting that hybrid architectures based on convolution to aid ViT [16, 80] might also work well for graphs. While TokenGT (ORF) shows relatively consistent attention distance over heads, TokenGT (Lap) shows higher variance, implying that it learns more diverse attention patterns. Judging from the higher performance of TokenGT (Lap), this suggests that the graph structure information of the Laplacian eigenvector facilitates learning useful and diverse attention structures, which calls for future exploration of better node identifiers based on graph PEs [38, 42].
+
+# 6 Conclusion
+
+We showed that Transformers directly applied to graphs can work well in both theory and practice. In the theoretical aspect, we proved that with appropriate token-wise embeddings, a Transformer on node and edge tokens is at least as expressive as $k$ -IGN and $k$ -WL test, making it more expressive than all message-passing GNNs. For such token-wise embeddings, we showed that a combination of simple orthonormal node identifiers and trainable type identifiers suffices, which we also verified with a synthetic experiment. In an experiment with PCQM4Mv2 large-scale dataset, we show that Tokenized Graph Transformer (TokenGT) performs significantly better than all GNNs and is competitive with Transformer variants with strong graph-specific architectural components [78, 29, 54].
+
+While the results suggest a promising research direction, there are challenges to be addressed in future work. First, treating each node and edge as tokens requires $O ( ( n + m ) ^ { 2 } )$ asymptotic cost due to the quadratic nature of self-attention. While we address this to some degree with kernelization and achieve $O ( n + m )$ cost, other types of efficient Transformers (e.g., sparse) that can deliver better performance are left to be tested. Another issue is slightly lower performance compared to the stateof-the-art. Adopting Transformer engineering techniques from vision and language domains, such as data scaling [7, 18], deepening [70, 74], hybrid architectures [16, 80], and self-supervision [17, 7, 24], are promising. In the societal aspect, to prevent the potential risky behavior in, e.g., decision making from graph-structured inputs, interpretability research regarding self-attention on graphs is desired.
+
+We finish with interesting research directions that stem from our work. As our approach advocates viewing a graph as $( n + m )$ tokens [37], it opens up new paradigms of graph learning, including autoregressive decoding, in-context learning, prompting, and multimodal learning. Another interesting direction is to extend our theory and use self-attention to approximate equivariant basis for general discrete group actions, which might be a viable approach for learning equivariance from data.
+
+Acknowledgement This work was supported in part by Institute of Information & communications Technology Planning & Evaluation (IITP) (No. 2022-0-00926, 2022-0-00959, 2021-0-02068, and 2019-0-00075) and the National Research Foundation of Korea (NRF) (No. 2021R1C1C1012540) grants funded by the Korea government (MSIT).
+
+# References
+
+[2] A.-L. Barabasi and R. Albert. Emergence of scaling in random networks. arXiv, 1999. (Cited on 10)
+[3] S. Bhattamishra, A. Patel, and N. Goyal. On the computational power of transformers and its implications in sequence modeling. In CoNLL, 2020. (Cited on 7)
+[4] S. Bhojanapalli, C. Yun, A. S. Rawat, S. J. Reddi, and S. Kumar. Low-rank bottleneck in multi-head attention models. In ICML, 2020. (Cited on 7)
+[5] S. Brody, U. Alon, and E. Yahav. How attentive are graph attention networks? In ICLR, 2022. (Cited on 11)
+[6] M. M. Bronstein, J. Bruna, Y. LeCun, A. Szlam, and P. Vandergheynst. Geometric deep learning: Going beyond euclidean data. IEEE Signal Process. Mag., 2017. (Cited on 7)
+[7] T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, S. Agarwal, A. Herbert-Voss, G. Krueger, T. Henighan, R. Child, A. Ramesh, D. M. Ziegler, J. Wu, C. Winter, C. Hesse, M. Chen, E. Sigler, M. Litwin, S. Gray, B. Chess, J. Clark, C. Berner, S. McCandlish, A. Radford, I. Sutskever, and D. Amodei. Language models are few-shot learners. In NeurIPS, 2020. (Cited on 1, 7, 10)
+[8] C. Cai and Y. Wang. A note on over-smoothing for graph neural networks. arXiv, 2020. (Cited on 1, 7)
+[9] L. Chen, K. Lu, A. Rajeswaran, K. Lee, A. Grover, M. Laskin, P. Abbeel, A. Srinivas, and I. Mordatch. Decision transformer: Reinforcement learning via sequence modeling. In NeurIPS, 2021. (Cited on 1, 7)
+[10] Z. Chen, L. Chen, S. Villar, and J. Bruna. Can graph neural networks count substructures? In NeurIPS, 2020. (Cited on 4)
+[11] K. M. Choromanski, V. Likhosherstov, D. Dohan, X. Song, A. Gane, T. Sarlós, P. Hawkins, J. Q. Davis, A. Mohiuddin, L. Kaiser, D. B. Belanger, L. J. Colwell, and A. Weller. Rethinking attention with performers. In ICLR, 2021. (Cited on 2, 9, 10, 11)
+[12] K. M. Choromanski, M. Rowland, and A. Weller. The unreasonable effectiveness of structured random orthogonal embeddings. In NeurIPS, 2017. (Cited on 3, 10)
+[13] T. Cohen and M. Welling. Group equivariant convolutional networks. In ICML, 2016. (Cited on 7)
+[14] T. S. Cohen and M. Welling. Steerable cnns. In ICLR, 2017. (Cited on 7)
+[15] J. Cordonnier, A. Loukas, and M. Jaggi. On the relationship between self-attention and convolutional layers. In ICLR, 2020. (Cited on 7)
+[16] Z. Dai, H. Liu, Q. V. Le, and M. Tan. Coatnet: Marrying convolution and attention for all data sizes. In NeurIPS, 2021. (Cited on 10)
+[17] J. Devlin, M. Chang, K. Lee, and K. Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT, 2019. (Cited on 1, 2, 3, 4, 7, 10)
+[18] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, J. Uszkoreit, and N. Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021. (Cited on 1, 2, 3, 4, 7, 9, 10)
+[19] V. P. Dwivedi and X. Bresson. A generalization of transformer networks to graphs. arXiv, 2020. (Cited on 1, 7)
+[20] V. P. Dwivedi, C. K. Joshi, T. Laurent, Y. Bengio, and X. Bresson. Benchmarking graph neural networks. arXiv, 2020. (Cited on 3, 7, 10, 14)
+[21] J. Gilmer, S. S. Schoenholz, P. F. Riley, O. Vinyals, and G. E. Dahl. Neural message passing for quantum chemistry. In ICML, 2017. (Cited on 2, 4, 6)
+[22] A. N. Gorban, I. Y. Tyukin, D. V. Prokhorov, and K. I. Sofeikov. Approximation with random bases: Pro et contra. Inf. Sci., 2016. (Cited on 14)
+[23] B. Hanin and M. Sellke. Approximating continuous functions by relu nets of minimal width. arXiv, 2017. (Cited on 1, 7)
+[24] K. He, X. Chen, S. Xie, Y. Li, P. Dollár, and R. B. Girshick. Masked autoencoders are scalable vision learners. arXiv, 2021. (Cited on 10)
+[25] D. Hendrycks and K. Gimpel. Gaussian error linear units (gelus). arXiv, 2018. (Cited on 11)
+[26] K. Hornik, M. B. Stinchcombe, and H. White. Multilayer feedforward networks are universal approximators. Neural Networks, 1989. (Cited on 7)
+[27] W. Hu, M. Fey, H. Ren, M. Nakata, Y. Dong, and J. Leskovec. OGB-LSC: A large-scale challenge for machine learning on graphs. arXiv, 2021. (Cited on 2, 7, 9, 11)
+[28] G. Huang, Y. Sun, Z. Liu, D. Sedra, and K. Q. Weinberger. Deep networks with stochastic depth. In ECCV, 2016. (Cited on 11)
+[29] M. S. Hussain, M. J. Zaki, and D. Subramanian. Edge-augmented graph transformers: Global self-attention is enough for graphs. arXiv, 2021. (Cited on 1, 2, 7, 9, 10)
+[30] A. Jaegle, S. Borgeaud, J. Alayrac, C. Doersch, C. Ionescu, D. Ding, S. Koppula, D. Zoran, A. Brock, E. Shelhamer, O. J. Hénaff, M. M. Botvinick, A. Zisserman, O. Vinyals, and J. Carreira. Perceiver IO: A general architecture for structured inputs & outputs. arXiv, 2021. (Cited on 1, 7, 9)
+[31] A. Jaegle, F. Gimeno, A. Brock, O. Vinyals, A. Zisserman, and J. Carreira. Perceiver: General perception with iterative attention. In ICML, 2021. (Cited on 1, 7, 9)
+[32] A. Katharopoulos, A. Vyas, N. Pappas, and F. Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. In ICML, 2020. (Cited on 9)
+[33] N. Keriven and G. Peyré. Universal invariant and equivariant graph neural networks. In NeurIPS, 2019. (Cited on 15)
+[34] J. Kim, S. Oh, and S. Hong. Transformers generalize deepsets and can be extended to graphs and hypergraphs. In NeurIPS, 2021. (Cited on 1, 2, 4, 6, 7, 15)
+[35] D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. In ICLR, 2015. (Cited on 14)
+[36] T. N. Kipf and M. Welling. Semi-supervised classification with graph convolutional networks. In ICLR, 2017. (Cited on 14)
+[37] Z. Kolter, S. Bai, D. Wilmott, M. Kornbluth, and J. Mailoa. First place solution of 2019 champs predicting molecular properties challenge. https://www.kaggle.com/c/champs-scalar-coupling/ discussion/106575, 2019. (Cited on 10)
+[38] D. Kreuzer, D. Beaini, W. L. Hamilton, V. Létourneau, and P. Tossou. Rethinking graph transformers with spectral attention. NeurIPS, 2021. (Cited on 7, 10, 9, 14)
+[39] J. Lee, Y. Lee, J. Kim, A. R. Kosiorek, S. Choi, and Y. W. Teh. Set transformer: A framework for attention-based permutation-invariant neural networks. In ICML, 2019. (Cited on 7, 9)
+[40] Q. Li, Z. Han, and X. Wu. Deeper insights into graph convolutional networks for semi-supervised learning. In AAAI, 2018. (Cited on 1, 7)
+[41] V. Likhosherstov, K. Choromanski, and A. Weller. On the expressive power of self-attention matrices. arXiv, 2021. (Cited on 7)
+[42] D. Lim, J. Robinson, L. Zhao, T. E. Smidt, S. Sra, H. Maron, and S. Jegelka. Sign and basis invariant networks for spectral graph representation learning. arXiv, 2022. (Cited on 7, 10, 14)
+[43] K. Lin, L. Wang, and Z. Liu. Mesh graphormer. In ICCV, 2021. (Cited on 1, 7)
+[44] I. Loshchilov and F. Hutter. Decoupled weight decay regularization. In ICLR, 2019. (Cited on 11)
+[45] X. Ma, X. Kong, S. Wang, C. Zhou, J. May, H. Ma, and L. Zettlemoyer. Luna: Linear unified nested attention. NeurIPS, 2021. (Cited on 9)
+[46] H. Maron, H. Ben-Hamu, H. Serviansky, and Y. Lipman. Provably powerful graph networks. In NeurIPS, 2019. (Cited on 2, 4, 6, 1, 15)
+[47] H. Maron, H. Ben-Hamu, N. Shamir, and Y. Lipman. Invariant and equivariant graph networks. In ICLR, 2019. (Cited on 2, 4, 5, 6, 7, 1, 15)
+[48] H. Maron, E. Fetaya, N. Segol, and Y. Lipman. On the universality of invariant networks. In ICML, 2019. (Cited on 4, 15)
+[49] H. Maron, O. Litany, G. Chechik, and E. Fetaya. On learning sets of symmetric elements. In ICML, 2020. (Cited on 7)
+[50] E. Min, R. Chen, Y. Bian, T. Xu, K. Zhao, W. Huang, P. Zhao, J. Huang, S. Ananiadou, and Y. Rong. Transformer for graphs: An overview from architecture perspective. arXiv, 2022. (Cited on 1, 7)
+[51] D. Q. Nguyen, T. D. Nguyen, and D. Phung. Universal graph transformer self-attention networks. In WWW, 2022. (Cited on 1, 7)
+[52] K. Oono and T. Suzuki. Graph neural networks exponentially lose expressive power for node classification. In ICLR, 2020. (Cited on 1, 7)
+[53] H. Pan and R. Kondor. Permutation equivariant layers for higher order interactions. In AISTATS, 2022. (Cited on 7)
+[54] W. Park, W. Chang, D. Lee, J. Kim, and S. won Hwang. Grpe: Relative positional encoding for graph transformer. arXiv, 2022. (Cited on 1, 2, 7, 9, 10)
+[55] H. Peng, N. Pappas, D. Yogatama, R. Schwartz, N. A. Smith, and L. Kong. Random feature attention. In ICLR, 2021. (Cited on 9)
+
+(Cited on 7) [57] S. Reed, K. Zolna, E. Parisotto, S. G. Colmenarejo, A. Novikov, G. Barth-Maron, M. Giménez, Y. Sulsky, ˙ J. Kay, J. T. Springenberg, T. Eccles, J. Bruce, A. Razavi, A. Edwards, N. Heess, Y. Chen, R. Hadsell, O. Vinyals, M. Bordbar, and N. de Freitas. A generalist agent. arXiv, 2022. (Cited on 1) [58] Y. Rong, Y. Bian, T. Xu, W. Xie, Y. Wei, W. Huang, and J. Huang. Self-supervised graph transformer on large-scale molecular data. In NeurIPS, 2020. (Cited on 1, 7) [59] B. Rozemberczki, C. Allen, and R. Sarkar. Multi-scale attributed node embedding. J. Complex Networks, 2021. (Cited on 13) [60] H. Serviansky, N. Segol, J. Shlomi, K. Cranmer, E. Gross, H. Maron, and Y. Lipman. Set2graph: Learning graphs from sets. In NeurIPS, 2020. (Cited on 7, 15) [61] O. Shchur, M. Mumme, A. Bojchevski, and S. Günnemann. Pitfalls of graph neural network evaluation. arXiv, 2018. (Cited on 13) [62] Z. Shen, M. Zhang, H. Zhao, S. Yi, and H. Li. Efficient attention: Attention with linear complexities. In WACV, 2021. (Cited on 9) [63] Y. Shi, S. Zheng, G. Ke, Y. Shen, J. You, J. He, S. Luo, C. Liu, D. He, and T. Liu. Benchmarking graphormer on large-scale molecular modeling datasets. arXiv, 2022. (Cited on 9) [64] A. Steiner, A. Kolesnikov, X. Zhai, R. Wightman, J. Uszkoreit, and L. Beyer. How to train your vit? data, augmentation, and regularization in vision transformers. arXiv, 2021. (Cited on 11) [65] Y. Tay, M. Dehghani, D. Bahri, and D. Metzler. Efficient transformers: A survey. arXiv, 2020. (Cited on 1) [66] N. Thomas, T. E. Smidt, S. Kearnes, L. Yang, L. Li, K. Kohlhoff, and P. Riley. Tensor field networks: Rotation- and translation-equivariant neural networks for 3d point clouds. arXiv, 2018. (Cited on 7) [67] J. Tompson, R. Goroshin, A. Jain, Y. LeCun, and C. Bregler. Efficient object localization using convolutional networks. In CVPR, 2015. (Cited on 10) [68] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin. Attention is all you need. In NeurIPS, 2017. (Cited on 1, 3, 9) [69] P. Velickovic, G. Cucurull, A. Casanova, A. Romero, P. Liò, and Y. Bengio. Graph attention networks. In ICLR, 2018. (Cited on 1, 7, 11, 14) [70] H. Wang, S. Ma, L. Dong, S. Huang, D. Zhang, and F. Wei. Deepnet: Scaling transformers to 1, 000 layers. arXiv, 2022. (Cited on 10) [71] S. Wang, B. Z. Li, M. Khabsa, H. Fang, and H. Ma. Linformer: Self-attention with linear complexity. arXiv, 2020. (Cited on 9) [72] X. Wang, Z. Tu, L. Wang, and S. Shi. Self-attention with structural position representations. In EMNLPIJCNLP, 2019. (Cited on 1) [73] M. Weiler, M. Geiger, M. Welling, W. Boomsma, and T. Cohen. 3d steerable cnns: Learning rotationally equivariant features in volumetric data. In NeurIPS, 2018. (Cited on 7) [74] N. Wies, Y. Levine, D. Jannai, and A. Shashua. Which transformer architecture fits my data? A vocabulary bottleneck in self-attention. In ICML, 2021. (Cited on 10) [75] R. Xiong, Y. Yang, D. He, K. Zheng, S. Zheng, C. Xing, H. Zhang, Y. Lan, L. Wang, and T. Liu. On layer normalization in the transformer architecture. In ICML, 2020. (Cited on 11) [76] Y. Xiong, Z. Zeng, R. Chakraborty, M. Tan, G. Fung, Y. Li, and V. Singh. Nyströmformer: A nyström-based algorithm for approximating self-attention. In AAAI, 2021. (Cited on 9) [77] K. Xu, W. Hu, J. Leskovec, and S. Jegelka. How powerful are graph neural networks? In ICLR, 2019. (Cited on 7, 14) [78] C. Ying, T. Cai, S. Luo, S. Zheng, G. Ke, D. He, Y. Shen, and T. Liu. Do transformers really perform bad for graph representation? In NeurIPS, 2021. (Cited on 1, 2, 7, 9, 10, 11, 14) [79] F. X. Yu, A. T. Suresh, K. M. Choromanski, D. N. Holtmann-Rice, and S. Kumar. Orthogonal random features. In NeurIPS, 2016. (Cited on 3, 10) [80] K. Yuan, S. Guo, Z. Liu, A. Zhou, F. Yu, and W. Wu. Incorporating convolution designs into visual transformers. In ICCV, 2021. (Cited on 10) [81] C. Yun, S. Bhojanapalli, A. S. Rawat, S. J. Reddi, and S. Kumar. Are transformers universal approximators of sequence-to-sequence functions? In ICLR, 2020. (Cited on 7, 1) [82] M. Zaheer, S. Kottur, S. Ravanbakhsh, B. Póczos, R. Salakhutdinov, and A. J. Smola. Deep sets. In NeurIPS, 2017. (Cited on 7) [83] M. Zopf. 1-wl expressiveness is (almost) all you need. arXiv, 2022. (Cited on 2)
+
+# Checklist
+
+The checklist follows the references. Please read the checklist guidelines carefully for information on how to answer these questions. For each question, change the default [TODO] to [Yes] , [No] , or [N/A] . You are strongly encouraged to include a justification to your answer, either by referencing the appropriate section of your paper or providing a brief inline description. For example:
+
+• Did you include the license to the code and datasets? [Yes] See Section 5.
+• Did you include the license to the code and datasets? [No] The code and the data are proprietary.
+• Did you include the license to the code and datasets? [N/A]
+
+Please do not modify the questions and only use the provided macros for your answers. Note that the Checklist section does not count towards the page limit. In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below.
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] See Section 3 and Section 5.
+(b) Did you describe the limitations of your work? [Yes] See Section 6.
+(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 6.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 3. (b) Did you include complete proofs of all theoretical results? [Yes] We include them in the supplementary file.
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We include them in the supplementary file.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 5.
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Section 5.
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section 5.
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes] See Section 5.2.
+(b) Did you mention the license of the assets? [Yes] See Section 5.2.
+(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We include them in the supplementary file.
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/unb1wyXf-aC/unb1wyXf-aC.md b/md/dev/unb1wyXf-aC/unb1wyXf-aC.md
new file mode 100644
index 0000000000000000000000000000000000000000..67cad3e1655b5d518c2ff383f17b013ebaf0f0ae
--- /dev/null
+++ b/md/dev/unb1wyXf-aC/unb1wyXf-aC.md
@@ -0,0 +1,470 @@
+# Concurrent 3D super resolution on intensity and segmentation maps improves detection of structural effects in neurodegenerative disease
+
+Anonymous Author(s)
+Affiliation
+Address
+email
+
+# Abstract
+
+1 We propose a new perceptual super resolution (PSR) method for 3D neuroimaging
+2 and evaluate its performance in detecting brain changes due to neurodegenerative
+3 disease. The method, concurrent super resolution and segmentation (CSRS), is
+4 trained on volumetric brain data to consistently upsample both an image intensity
+5 channel and associated segmentation labels. The simultaneous nature of the method
+6 improves not only the resolution of the images but also the resolution of associated
+7 segmentations thereby making the approach directly applicable to existing labeled
+8 datasets. One challenge to real world evaluation of SR methods such as CSRS
+9 is the lack of high resolution ground truth in the target application data: clinical
+10 neuroimages. We therefore evaluate CSRS effectiveness in an adjacent, clinically
+11 relevant signal detection problem: quantifying cross-sectional and longitudinal
+12 change across a set of phenotypically heterogeneous but related disorders that
+13 exhibit known and differentiable patterns of brain atrophy. We contrast several 3D
+14 PSR loss functions in this paradigm and show that CSRS consistently increases the
+15 ability to detect regional atrophy both longitudinally and cross-sectionally in each
+16 of five related diseases.
+
+# 17 1 Introduction
+
+18 Magnetic resonance image (MRI) datasets capturing in vivo longitudinal change in the human brain
+19 are currently available at unprecedented scale. These data allow us to quantify the complex etiology
+20 of neurodegenerative disease during life. A fundamental problem in quantifying brain disorders
+21 from imaging is that many anatomical structures are small in comparison to image resolution. This
+22 is caused by not only limited image resolution but also the potentially convoluted shape of the
+23 targeted anatomy [1]. Thinner, more oblate and/or curved structures undergo more distortion due
+24 to sampling-related aliasing in comparison to larger, more spherical structures. These distortions
+25 can limit detection power in the context of either clinical trials and/or at the level of patient specific
+26 medicine [2, 3]. These results also show that, based on first principles, many disease relevant
+27 anatomical structures in the brain, in particular cortical regions, mid-brain regions and hippocampal
+28 subfields, should be quantified at higher resolutions (e.g. $\approx 0 . 5 \mathrm { m m ^ { 3 } }$ or smaller rather than the
+29 more commonly available $\approx 1 \mathrm { m m ^ { 3 } }$ ). The need for increased resolution is only heightened when
+30 considering aging and neurodegeneration where some brain structures may lose half or more of their
+31 pre-disease onset volume or thickness.
+32 Perceptual super resolution (PSR) for 2D RGB imagery consistently demonstrates the ability to
+33 estimate more “realistic” looking upsampled data in comparison to traditional linear or nearest
+34 neighbor interpolants [4]. While many competitive methods are available, the deep back projection
+35 network (DBPN) [5] performed consistently in several competitions including NTIRE 2018 and 2019
+
+[6], AIM 2019 [7] and PIRM 2018 [8]). These large challenges compared dozens of methods with respect to a variety of both perceptual and reconstruction metrics at different levels of upsampling and noise.
+
+39 Can the 2D RGB performance advantages of methods like the DBPN translate to improvements in
+40 the 3D quantification of brain regions as seen in MRI? If so, then PSR for 3D neuroimaging promises
+41 to improve quantification by better resolving the brain’s internal structures and tissue boundaries.
+42 While traditional evaluations of PSR focus on reconstruction error and perceptual impression, these
+43 measurements do not provide clinically relevant evidence of PSR’s value in quantification. One barrier
+44 to evaluating PSR’s impact on clinically relevant outcomes (segmentation volumes) is that ground
+45 truth segmentations do not exist at the super-resolved scale. To address this concern, [9] simulated low
+46 resolution magnetic resonance images (MRI) of the brain from high-resolution (HR) images obtained
+47 from the Human Connectome Project [10, 11]. They then applied a very deep super resolution
+48 (VDSR) model to the simulated data and the high-resolution data and compared the accuracy of an
+49 automated cortical segmentation method. This careful evaluation study demonstrated that cortical
+50 segmentation on the VDSR images closely approximated the HR data. However, relatively few
+51 details are provided about the training of this model and associated loss functions. Furthermore, it
+52 remains unclear whether these improvements in reconstruction error would translate to the detection
+53 of population-level effects in real world data particularly in the aging populations that are the target
+54 of the majority of interventional trials for the brain.
+55 A more recent effort in volumetric PSR for medical images [12] proposed SOUP-GAN: Super
+56 resolution Optimized Using Perceptual-tuned Generative Adversarial Network (GAN). SOUP-GAN
+57 adopts transfer learning from 2D VGG19 to 3D as proposed in [13] to produce a pseudo-volumetric
+58 perceptual metric [14]. Shan et al. used this metric to denoise low-dose computed tomography
+59 (CT) images and showed its effectiveness at preserving small anatomical structures. Similarly, the
+60 SOUP-GAN effort demonstrates that the pseudo-3D perceptual metric improves both PSNR and
+61 SSIM as well as shows visually appealing upsampling for a variety of medical imaging modalities.
+62 That is, the surprising utility (in 2D) of VGG weights as a feature space [15] appears to at least
+63 partially transfer to PSR in 3D medical imaging.
+64 The current research provides perhaps the first broadly scoped, real world evaluation of MRI PSR for
+65 quantification of neurodegenerative disease. Moreover, we demonstrate that a regression network
+66 (ResNet) that predicts T1w image quality can yield a directly useful perceptual feature space that
+67 performs competitively with pseudo-3D VGG19 features. We build these contributions upon the
+68 backbone of a set of methods that we call concurrent super resolution and segmentation (CSRS) that
+69 extends the proven 2D DBPN to 3D and also includes extra output channel(s) enabling segmentation
+70 maps to be upsampled concurrently. We use this framework to test the impact of different loss
+71 functions on a set of domain-specific, clinically relevant segmentation measurements related to
+72 brain atrophy. Specifically, we evaluate CSRS on the quantification of frontotemporal disorders [3]
+73 from publicly available longitudinal T1-weighted (T1w) neuroimaging (i.e. MRI). Of the several
+74 combinations of losses that we evaluate, the best model improves not only segmentation performance
+75 (when ground truth is available) but also detection power across all our related disorders: structural
+76 changes in behavioral variant frontotemporal dementia (bvFTD), semantic variant primary progressive
+77 aphasia (svPPA), nonfluent/agrammatic PPA (naPPA), progressive supranuclear palsy (PSP) and
+78 corticobasal syndrome (CBS) each of which impacts known networks in the brain. CSRS with a new
+79 perceptual loss based on a shallow ResNet layer performs as well or better than VGG-based models
+80 in this test of the practical usefulness of PSR.
+
+81 The primary contributions of this work include:
+
+• new PSR that upsamples multi-label segmentations at the same time as intensity; • a new real world evaluation paradigm for PSR in neuroimaging; • comparison of three perceptual loss functions for PSR, two of which are new; • demonstration that loss choice impacts detection power in natural history studies of neurodegenerative disease. Standard intensity similarity and segmentation overlap metrics, on the other hand, do not discriminate performance between the candidate CSRS options.
+
+88 Model weights, sample data, and training code will be made publicly available after anonymous
+89 review.
+91 Software platform: We employ the ANTsX platform [16] version 2.3.5 for anatomical labeling,
+92 data augmentation/sampling during model training and to form the tabular data for the statistical
+93 evaluation. All MRI processing details follow [16]. Tensorflow 2.6.2 is used for deep learning
+94 including a ResNet implementation and the CSRS architecture. R version 4.1 is used for statistical
+95 analysis with packages lmer and ggplot2. All MRI processing was done on Amazon Web Services
+96 parallel cluster with 24 cores and 32GB RAM per process (Intel(R) Xeon(R) Platinum 8259CL
+97 CPU $\ @ \ 2 . 5 0 \mathrm { G H z }$ ).
+98 Data: Human Connectome Project (HCP): We downloaded 1,113 high-resolution $0 . 7 \mathrm { m m ^ { 3 } }$ T1-
+99 weighted images from the HCP on which to train CSRS. These T1w data were acquired using a
+100 magnetization-prepared rapid gradient-echo (MPRAGE) sequence on a customized 3T Siemens
+101 Skyra; see [10] for all details of acquisition. As such, these images provide both high resolution and
+102 high quality in comparison to the majority of publicly available T1w MRI. Critically, they provide
+103 superior resolution for the thin convoluted cortical layer that is critical to the measurement of brain
+104 atrophy in frontotemporal disorders. We transformed these data into numpy blocks with randomly
+105 selected high-resolution $6 4 ^ { 3 }$ patches and paired low-resolution $3 2 ^ { 3 }$ patches. For each patch pair, we
+106 also provide a high-resolution binary segmentation and a low-resolution downsampled version of
+107 that binary segmentation. Each patch segmentation was gained by 2-class $\mathbf { k }$ -means performed on
+108 the patch where the center voxel’s label determines which class (1 or 2) is used as foreground. This
+109 collection of 16,640 patches is then divided randomly into train $\scriptstyle \mathrm { n = 1 6 } , 3 8 4 ,$ ) and test sets.
+110 Data: Parkinson’s Progression Markers Initiative (PPMI): PPMI is a longitudinal multi-center
+111 clinical study of PD patients and age-matched healthy controls http://www.ppmi-info.org.
+112 PPMI employed(s) over 20 data collection sites with scanners that span the primary manufacturers
+113 (Siemens, GE, Phillips), a variety of head coils and also magnet strengths (1.5T, 3T). This heterogene
+114 ity of data collection provides a rich set of T1w images with highly variable image contrast, resolution
+115 and quality. We manually reviewed and labelled 1,431 raw T1w from PPMI to capture the range of
+116 quality in an ordinal scale. This resulted in a ground truth dataset with 456 images given grade “A”
+117 (superior), 568 given grade “B”, 350 given grade “C” and 57 given grade “F” which represents images
+118 that are of little to no use for quantitative studies of brain structure. We then employed a standard
+119 3D ResNet (antspynet.create_resnet_model_3d with parameters lowest_resolution $^ { \mathtt { = 3 2 } }$ ,
+120 number_of_classification_label $\mathtt { s } { = } 4$ , cardinality ${ \tt = } 1$ , 39,424,004 parameters, 53 3D convo
+121 lutional layers) to learn to predict this scale automatically and reliably from the input T1w. We denote
+122 this network as a T1w Quality Rating Resnet (T1wQRResNet). Details of training T1wQRResNet
+123 are in Supplementary Information.
+124 Data: Frontotemporal Lobar Degeneration Neuroimaging Initiative (NIFD) & 4-Repeat
+125 Tauopathy Neuroimaging Initiative (4RTNI): These inter-related multi-site studies share the goal
+126 of improving the quantification of frontotemporal spectrum disorders with both imaging and clinical
+127 scores. Like PPMI and HCP, these studies provide longitudinal T1w images that enable measurement
+128 of not only the baseline brain structure differences between controls (individuals without a disease
+129 i.e. normal aging) and disease groups but also differences in rates of change due to neurodegeneration.
+130 We downloaded and curated 4RTNI and NIFD T1w data and merged these images into a common
+131 database. These images were collected at three different sites using protocols consistent with ADNI
+132 3T guidelines [2]. The images overall have a median spacing that is isotropically $1 \mathrm { m m }$ with a minority
+133 of subjects with out-of-plane spacing up to $1 . 2 \mathrm { m m }$ . As such, these data suit the goals of testing PSR
+134 for benefits to the quantification of neurodegenerative disease. After filtering data for very low quality
+135 images and the presence of longitudinal data collected within 2 years of baseline, we obtained 128
+136 baseline/171 followup images for controls, 60/112 for bvFTD, 38/72 for naPPA, 37/71 for svPPA,
+137 55/70 for CBS and 75/102 for PSP. Further cohort details (age, education, sex, etc) are available in
+138 supplementary information. We processed all images consistently and automatically with default
+139 ANTsX pipelines to gain cortical, medial temporal lobe and deep brain structure segmentations for
+140 every subject as described in [16]. By consensus, co-authors selected a priori regions for testing
+141 within each of four groups CBS/PSP [17], bvFTD, svPPA and naPPA [18–24]. Details of the regions
+142 and rationale for their selection are available in the Supplementary Information. See Figure 1 for an
+143 overview of processing, the CSRS method and a visualization of the regions (1.C).
+
+
+Figure 1: (A) Image processing begins with raw MRI, extracts the brain, labels cortical regions, labels medial temporal lobe regions and labels deep brain regions. (B) The CSRS method is used, here, to upsample data by a factor of 2 isotropically; the sketch of the algorithm provides an example of how two nearby regions would flow through the method and be stitched back together at high resolution. (C) The impact of SR on quantifying neurodegeneration is assessed on a priori regions that are specific to each clinical diagnostic group; all regions are bilateral except for svPPA which uses only left hemisphere cortical and medial temporal labels.
+
+# 144 2.1 Concurrent super resolution and segmentation methods
+
+145 CSRS uses, as a sub-algorithm, a three-dimensional and multi-output version of the neural network
+146 architecture defined by the 2D deep back projection network (DBPN) [5]. The DBPN is uniquely
+147 relevant to medical imaging in that it is perhaps the first published SR method that integrates the
+148 downsampling-upsampling error (i.e. residual layers) as a feature map. This novel architecture may
+149 prevent feature hallucination and constrain the high-resolution image to maintain features that are
+150 consistent with the low-resolution input. We extend the 2D DBPN to 3D MRI data by, first, translating
+151 2D convolutions, padding, striding and other relevant parameters to 3D. To generalize the architecture
+152 further, we allow options for not only convolutional upsampling (transposed convolution) but also
+153 nearest neighbor (or linear) interpolation layers at the user’s choice. Lastly, we implement flexible
+154 choices of input channels, the number of residual layers (backprojection) layers and the number of
+155 outputs. This 3D DBPN network implementation is available within R and python. All parameters
+156 were the same as the published work [25] (though in translation to 3D) with the exception of the
+157 number of back projection layers which has a large impact on the number of parameters. We reduced
+158 the number of backprojection layers to 5 (16,264,322 parameters) due to the memory limitations
+159 caused by working with large 3D images and limited GPU resources (all GPU computations in this
+160 work were implemented with Nvidia V100s locally).
+161 Efficient computational strategy is essential for CSRS to be applied to large 3D images (a brain
+162 image may contain 10 million voxels) when CPUs and RAM are limited. As such, a local patch-work
+163 strategy is necessary. Sampling, upsampling, mapping and unification (SUMU) are the common steps
+164 needed for not only training but also inference. “Sampling” decides the form of the input data: full
+165 images (not used here), image patches (used here in training) or anatomical image regions (used here
+166 in inference). Upscaling determines the core approach to transferring the low-resolution data to a
+167 higher-resolution output. Mapping compensates for shape or intensity distortion. Finally, “unification”
+168 is an ensembling or merging step that brings together several sub-estimates of an SR image into a
+169 single joined (final/full) SR image. We detail each of the 4 components below.
+170 Sampling: We choose a patch-based model for training as these can easily be applied to input data
+171 with different resolutions and fields of view. A second reason for patch-based modeling is that a
+172 candidate network does not need to learn the full scope of image variation. This results in shallower
+173 and faster to train networks that fit more easily onto readily available GPUs. The choices made
+174 during sampling step define the feature basis set. Because prior super-resolution competitions suggest
+175 larger patches lead to better performance, we choose the largest patches that would permit efficient
+176 batch sizes of 4 (64x64x64). An additional ad hoc support for this choice is that cortical features
+177 are relatively well-resolved in sub- $1 \mathrm { m m }$ training images when voxel cubes of this sized are used.
+178 However, there is no direct evidence that this size of patch domain is optimal for this problem.
+179 Upscaling: is done with the CSRS’s DBPN architecture using nearest neighbor interpolation for
+180 the upsampling layers. The software interface to CSRS also allows the user to optionally employ
+181 standard linear (tri-linear) interpolation. We use the linear option as a reference in evaluation studies
+182 below.
+183 Mapping: may be used to compensate for distortions in the image shape or intensity space. Because
+184 each patch is scaled independently on training data (to have an intensity range of -127.5 to 127.5),
+185 the output of the PSR upsampled image intensities must be mapped back to the original quantitative
+186 space. This is performed by directly comparing the output of the PSR upsampled patch/region to the
+187 original data upsampled by nearest neighbor or linear interpolation. As such, we can accurately retain
+188 quantitative intensity data at the original scale/units with minimal distortion and/or stitching artifacts.
+189 Unification: this is a general term that, here, refers to the algorithm that is used to derive a single
+190 CSRS image and multi-label segmentation from multiple CSRS sub-images (not necessarily isotropic
+191 patches as in training). In 2D, multiple input images are typically generated from a single input by
+192 “augmentation” e.g. random flipping, translation, etc thus allowing a practitioner to gain multiple
+193 “votes” about how the SR image should appear at any given voxel. Such a step is used in most PSR
+194 competitions to reduce aliasing or artifacts and may involve averaging, sharpening or more complex
+195 modeling such as joint intensity fusion, multi-channel deep learning or other ensemble methods.
+196 Due to the high memory and computation cost of running CSRS on 3D images, we instead apply
+197 CSRS to either sub-regions of interest or, when a full T1w brain image is desired, each hemisphere.
+198 The unification step then maps each local patch intensity range back to the original MRI range and
+199 then joins the sub-regions back together to complete the SR reconstruction. Augmentation can be
+200 employed beyond this but at substantial increase in computation time (e.g. 10x to see meaningful
+201 gains due to augmentation).
+202 Loss functions for CSRS: We employ a loss function that seeks to balance reconstruction error
+203 (intensity difference, abbreviated here as R), edge preserving denoising (total variation, abbreviated
+204 as TV), perceptual quality (based on VGG or ResNet) and segmentation overlap (Dice, abbreviated
+205 as D). Each of these terms can be up or down weighted to control the network’s performance where
+206 mean squared error (L2 intensity error) leads to smoother results, L1 (or total variation) provides
+207 denoising and the perceptual loss yields more natural appearing output textures and shapes. The
+208 Dice loss term seeks to minimize distortions in the shape of segmentation objects on the output
+209 of CSRS. The Dice loss is only applied to the second output channel of the network which uses a
+210 sigmoid activation function appropriate for probabilistic/binary data. We refer to CSRS trained with
+211 specific combinations of these losses by concatenation of the abbreviations above. For example,
+212 CSRS.R.TV.D.Res6 refers to a network trained with reconstruction loss, TV regularization, Dice loss
+213 and the 6th layer of the T1wQRResNet for perceptual loss.
+
+Recent research demonstrates that deep learning models trained on large-scale object detection reference datasets (e.g. imagenet) encode a feature space that may mimic human perception [26]. Such perceptual spaces typically arise from the activations that occur within the layers of convolutional networks trained on massive classification datasets. Here, however, we compare a standard VGG based perceptual space (block2_conv2) (mapped to 3D as described before) to those defined by the T1wQRResNet. From T1wQRResNet, we choose two different deep layers that have similar numbers of parameters to the 3D version of the VGG19 block2_conv2 network: res_conv_block_6 (the 2nd convolutional block) and res_conv_block_21 (the 7th convolutional block). This allows us to compare perceptual metrics based on either pseudo-3D VGG19 or our intrinsically 3D res_conv_block choices.
+
+24 Quantification of medical images requires a high degree of faithfulness to the input data. "Halluci
+25 nated" features are undesirable. As such, our baseline loss function focuses on reconstruction error
+226 and TV for both intensity and segmentation images. We then add perceptual and Dice losses for
+227 further comparison. If we denote $I$ as the estimated super-resolution, $I _ { s }$ as the estimated segmentation
+228 from the sigmoid output channel, $J$ as the real high resolution image, $J _ { s }$ as the real high resolution
+229 segmentation, then the final loss function that we optimize is:
+
+
+Figure 2: Best model CSRS applied to three categories of anatomy where row (A) is the original resolution (OR) and segmentation and row (B) is the output of CSRS.R.TV.D.Res6.
+
+$$
+\begin{array} { r } { I - J \| ^ { 2 } w _ { r } ^ { i } + \| I _ { s } - J _ { s } \| ^ { 2 } w _ { r } ^ { s } + T V ( I , J ) w _ { t } ^ { i } + T V ( I _ { s } , J _ { s } ) w _ { t } ^ { s } + \| f _ { n } ( I ) - f _ { n } ( J ) \| ^ { 2 } w _ { f } + D i c e ( I _ { s } , J _ { s } ) w _ { d } } \end{array}
+$$
+
+230 where the term $\| \cdot \|$ indicates the euclidean norm, $T V ( \cdot , \cdot )$ indicates the total variation norm (which
+231 provides denoising), $w _ { r , t , f , d }$ (superscripts for intensity or segmentation) indicates a term-specific
+232 scalar weight and $f _ { n } ( . )$ indicates a perceptual feature map. The weight terms can be tuned for
+233 performance and application area given an objective and quantitative evaluation metric. We initially
+234 manually tuned the training of a DBPN model with only the reconstruction metrics $( \| I - J \| ^ { 2 } w _ { r } ^ { I } \dot { + }$
+235 $\lVert I _ { s } - \dot { J _ { s } } \rVert ^ { 2 } w _ { r } ^ { s }$ with $w _ { r } ^ { i } = 5 e - 4$ and $w _ { r } ^ { s } = 1$ ) using adam optimizer and learning rate 5e-5. We
+236 then set weights relative to the value of the reconstruction error after convergence such that: the TV
+237 loss is roughly $2 / 3$ the reconstruction term (R); the perceptual loss is roughly $3 \mathrm { x } \ \mathrm { R }$ ; the Dice loss is
+238 roughly equivalent to the perceptual loss. This strategy, based on our task-specific goals, enables us
+239 to compare models consistently and add/subtract terms without extensive weight optimization.
+40 Computation and inference: All models were implemented with tensorflow. The computation to
+241 double magnification – for a single T1w – takes (generally on a modern computational platform)
+42 between 10 and 40 minutes. Results are computed region-wise over the set of segmentation labels
+243 where CSRS is run on each cropped label and its associated intensity. When multiple regions are
+244 used (as is done here), then results are stitched back together while using a linear mapping back
+245 to the original intensity space and a arg_max operation to define the hard segmentation labels at
+46 every voxel in the stitched, joint intensity/probability double magnification space. See Figure 2 for
+47 an example result of CSRS as applied to the variety of brain regions in this study. Figure 3 shows a
+48 zoomed visual comparison of the impact on intensity and the lack of stitching artifacts.
+
+# 2.2 Quantification of CSRS impact on segmentation and intensity in ground truth data
+
+Evaluation of PSR results on simulated downsampled-upsampled data does not constitute real world conditions. However, for reference, we include evaluation results based on an independent set of labeled brain images [27]. For these images, we downsample with nearest neighbor interpolation and upsample with linear interpolation (for the intensity) and a “generic label” interpolation that is designed for multi-label images [28] thereby allowing us to report standard metrics of Dice overlap, PSNR and SSIM to complement our study of brain atrophy detection. Figure 4 demonstrates example results illustrating this component of our evaluation.
+
+
+Figure 3: Comparison of CSRS with different loss functions to original resolution and linear upsampling. The bold (panel E) is the best performing model according to quantitative criteria. However, visual differences between the perceptual models (D,E,F) are not easy to discern.
+
+
+Figure 4: Panel (A) shows the original $\mathrm { 1 m m ^ { 3 } }$ resolution ground truth image and its segmentation. Panel (B) shows the impact of linear/generic label upsampling of ground truth data artifically downsampled to $2 \mathrm { m m ^ { 3 } }$ . Panel (C) shows a CSRS result where other models are visually similar to this. Panel (D) demonstrates that all regions improve with CSRS (all differences $> 0$ ) and that regions with lower Dice overlap under the linear/generic label model improve more when upsampled with CSRS.
+
+# 257 2.3 Quantification of effect sizes in frontotemporal disorder atrophy
+
+The frontotemporal disorders produce a profound and debilitating effect on patients with concomitant, symptom-related atrophy. Measuring this atrophy is critical to detecting the effects, for instance, of disease modifying therapies that may slow atrophy. Such measurements are challenged by low resolution and this challenge is compounded by the degeneration process itself.
+
+262 We use statistical modeling to determine if CSRS can mitigate the known limitations of resolution on
+263 atrophy measurement. We adopt an interpretable mixed effects modeling approach (lmer)[29] to
+264 estimate effect sizes per brain region, per diagnostic category and per resolution/CSRS model. The
+265 baseline performance is determined by the effect sizes estimated on the original resolution (OR) data.
+266 We estimate effect sizes following [30, 31]. Better methods, under this design, should more reliably
+267 identify disease-related atrophy which will be reflected in increased effect sizes for a given set of $a$
+268 priori diagnosis-specific regions. The model for the region of interest $i$ $( R O I _ { i } )$ ) is:
+
+$$
+R O I _ { i } \approx A g e _ { b } + S e x + B V _ { b } + D X + \Delta T * D X + ( 1 | I D ) ,
+$$
+
+269 with $( 1 | I D )$ representing a subject-specific random effect, $A g e _ { b }$ is the subject’s age at the first visit,
+270 $B V _ { b }$ is the first visit brain volume, $D X$ is the diagnosis for the subject, $\Delta T$ is the change in time
+271 since baseline and the $\Delta T * D X$ represents an interaction between time and diagnosis. The $R O I _ { i }$
+272 represents the volume for all regions. However, for cortical regions, we also use the region’s thickness
+273 measurement as a second outcome (as this is a standard measurement in morphometry of the human
+274 cortex). We estimate effect sizes for cross-sectional effects via the model’s parameter fit for the
+275 diagnosis $( D X )$ term; we estimate longitudinal effect sizes via the parameter on the interaction term.
+
+Table 1: Summary of results where the comparison of the model impact on effect size is computed by bootstrapped $\scriptstyle ( \mathrm { n = 1 0 0 0 } )$ ) paired t.test. The number of pairs is 274 (see Table 2 for further breakdown by category). CSRS losses are abbreviated as $\mathbf { R } =$ reconstruction, $\mathrm { T V } { = }$ total variation, $\scriptstyle \mathbf { D = }$ dice, VGG $\circeq$ VGG19 pseudo 3D features, Res6 is from the 6th layer of T1wQRResNet and Res21 is the 21st layer of T1wQRResNet. srmeanES indicates the mean effect size for the model averaged over all a priori regions; boot.95ci is the 95 percent confidence interval for the improvement in effect size due to the model. t represents the $t$ -statistic and boot.p represents the bootstrapped p-value for the significance of the improvement in effect size. Columns psnr and ssim show the standard PSNR and SSIM values for an image for which we have ground truth high-resolution intensity and segmentation. The dice columns show the mean and standard deviation of the Dice overlap between ground truth and the upsampled simulated data with each model, estimated over all regions. Best $=$ bold.
+
+
Model
srmeanES
boot.95ci
t
boot.p
psnr
ssim
dice.mean
dice.sd
OR
0.559
0/0
NA
NA
NA
NA
NA
NA
Linear
0.468
-0.1006/-0.08163
-18.61
0
40.6
0.996
0.769
0.047
CSRS.R.TV
0.574
0.01124/0.01854
7.96
0
42.0
0.997
0.884
0.031
CSRS.R.TV.D
0.582
0.01868/0.0273
10.38
0
41.8
0.997
0.883
0.031
CSRS.R.TV.VGG
0.581
0.01775/0.02559
10.76
0
42.0
0.997
0.885
0.031
CSRS.R.TV.D.VGG
0.577
0.01403/0.02209
8.86
0
41.9
0.997
0.884
0.031
CSRS.R.TV.Res6
0.572
0.009741/0.01665
7.49
0
42.4
0.997
0.886
0.031
CSRS.R.TV.D.Res6
0.588
0.02497/0.0331
14.02
0
42.4
0.997
0.885
0.032
CSRS.R.TV.Res21
0.577
0.01462/0.02143
10.40
0
42.3
0.997
0.884
0.031
CSRS.R.TV.D.Res21
0.581
0.01814/0.02627
10.59
0
42.3
0.997
0.887
0.03
+
+
+Figure 5: Bland-Altman plots for model CSRS.R.TV.D.Res6 demonstrate variability in the performance by type of anatomy and by diagnostic grouping with some individual points generating substantially greater $\%$ improvement than suggested by the overall trend. Similarly, a few points show decreased performance relative to OR.
+
+# 276 3 Results
+
+Table 1 summarizes overall results where we show original resolution and results from linear upsampling, as baseline, and compare to eight variants of CSRS. Two of these do not use perceptual metrics. The remaining six add or subtract Dice loss and each of our candidate perceptual losses. Table 1 shows both the aggregate impact of model on effect size estimates in the neurodegeneration data as well as intensity similarity (reconstruction) and Dice overlap in the ground truth data. Dice overlap (a measure that varies between zero and one) improves by a margin of 0.11 to 0.123 $9 5 \%$ CI bootstrapped percentile confidence interval, $p < 1 e - 1 6$ . See Figure 4.
+
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+
+Table 2 focuses on the two perceptual models with the greatest improvement from original resolution as assessed by pairwise $t$ -test. It breaks down the effect size results in relation to which type of effect size is being analyzed (cross-sectional or longitudinal) and by brain region / diagnostic grouping. Relatedly, Figure 5 shows a Bland-Altman style plot that demonstrates, for the CSRS.R.TV.D.Res6 model, the range of effect size changes due to CSRS across all 274 measurement points.
+
+Table 2: Summary of results for the two best perceptual models broken down by anatomical class, type of predictor (longitudinal or cross-sectional) and diagnostic groups. The n column indicates the number of samples used in the statistical testing. The codes in the AnatClass column are: CtxV - cortical volume; CtxT - cortical thickness; MB - deep brain (for CBS/PSP); MTL - medial temporal lobe (for svPPA). The columns that have non-NA DX2 means that both DX and DX2 groups were aggregated in the computation of the bootstrapped paired $t$ -test for the given group of anatomy.
+
+
Model
AnatClass
isLong
DX
DX2
n
srmeanES
boot.95ci
t
boot.p
CSRS.R.TV.VGG
All
Both
NA
NA
274
0.581
0.01775/0.02559
10.763
0.0000
CSRS.R.TV.VGG
CtxV
Cross
bvFTD
naPPA
28
0.826
0.007153/0.01626
4.936
0.0000
CSRS.R.TV.VGG
CtxT
Cross
bvFTD
naPPA
28
1.016
-0.009547/0.01006
0.033
0.9769
CSRS.R.TV.VGG
MB
Cross
CBS/PSP
NA
8
0.600
0.03683/0.1208
3.458
0.0246
CSRS.R.TV.VGG
MTL
Cross
svPPA
NA
7
1.003
0.02801/0.06981
4.190
0.0112
CSRS.R.TV.VGG
CtxV
Long
bvFTD
naPPA
28
0.645
0.01848/0.03313
6.719
0.0000
CSRS.R.TV.VGG
CtxT
Long
bvFTD
naPPA
28
0.527
0.03521/0.05297
9.445
0.0000
CSRS.R.TV.VGG
MB
Long
CBS/PSP
NA
8
0.201
0.01409/0.03941
3.924
0.0110
CSRS.R.TV.VGG
MTL
Long
svPPA
NA
7
0.701
-0.0159/0.002513
-1.309
0.2652
CSRS.R.TV.D.Res6
All
Both
All
NA
274
0.588
0.02497/0.0331
14.021
0.0000
CSRS.R.TV.D.Res6
CtxV
Cross
bvFTD
naPPA
28
0.831
0.01199/0.02182
6.573
0.0000
CSRS.R.TV.D.Res6
CtxT
Cross
bvFTD
naPPA
28
1.023
-0.002896/0.01832
1.394
0.1604
CSRS.R.TV.D.Res6
MB
Cross
CBS/PSP
NA
8
0.589
0.02166/0.1131
2.718
0.0454
CSRS.R.TV.D.Res6
MTL
Cross
SvPPA
NA
7
1.004
0.02782/0.07253
4.021
0.0102
CSRS.R.TV.D.Res6
CtxV
Long
bvFTD
naPPA
28
0.658
0.03203/0.04756
9.751
0.0000
CSRS.R.TV.D.Res6
CtxT
Long
bvFTD
naPPA
28
0.545
0.05421/0.06995
15.151
0.0000
CSRS.R.TV.D.Res6
MB
Long
CBS/PSP
NA
8
0.198
0.006017/0.04464
2.233
0.0166
CSRS.R.TV.D.Res6
MTL
Long
svPPA
NA
7
0.704
-0.0177/0.01214
-0.369
0.7511
+
+# 289 4 Discussion
+
+The PSNR and SSIM improve similarly across all CSRS models and do not substantively differentiate performance. Dice overlap is consistently superior than linear upsampling across all models but shows little difference between models with perhaps a small advantage for the ResNet features. Greater stratification may be seen when looking at results that relate to quantifying the phenotypic heterogeneity of brain atrophy in frontotemporal spectrum diagnostic groups. Model CSRS.R.TV.D.Res6 stands out under this criteria with Table 2 suggesting that the majority of the improvement arises for cortical measurements, particularly longitudinally. Performance improvements are not, however, perfectly consistent. Figure 5 shows that CSRS augments effect size in the large majority of regions (some greatly so) but a few regions are subtly better at OR. Additional discussion of performance implications with respect to individual regions and diagnoses is in supplementary information.
+
+300 The extension of PSR to 3D raises opportunities as well as challenges. Parameter exploration is
+301 fundamentally limited because training a model on our patch dataset for 1 epoch takes over 12 hours
+302 (we trained each model for 2 epochs or until convergence). Other architectures than DBPN may
+303 perform better with CSRS such as ESRGAN [32] or, potentially, methods with stronger modality
+304 specific priors on the convolutional kernels [33]. Specifically, fast-training, fewer parameter models
+305 may ease some of the computational burden and facilitate more parameter exploration.
+306 CSRS performance is fundamentally limited by the quality of its segmentation inputs. It may be
+307 more beneficial to develop new methods that operate at high resolution (HR) – adding substantial
+308 computational cost if the goal is to take advantage of HR features – or that take advantage of
+309 intrinsically HR ground truth data. The primary barrier to such an effort is the current lack of HR
+310 ground truth labels for neuroimaging and in particular for neurodegenerative disease. Moreover,
+311 most methods embed resolution assumptions in their own processing choices and optimize for these
+312 choices. As such, CSRS bridges a performance gap with a practical solution readily available today.
+313 Retooling existing methods and segmentation labels for HR (e.g. 7T MRI) is costly both computation
+314 ally and in terms of the effort of human experts due to the already high volume of 3D neuroimaging.
+315 We demonstrated that CSRS, in most of its variants, leads to significant performance improvements
+316 over our reference of original resolution $\mathrm { { ( l m m ^ { 3 } ) } }$ ) image processing and ground truth labels. Because
+317 CSRS operates on existing images and labels, new HR method and segmentation development is
+318 not required. Thus, CSRS may be used to improve existing ground truth datasets and existing
+319 processed data, today. However, comparison to other and/or larger real world datasets is needed to
+320 help determine the extent to which our results may be deployed to new data without concern.
+321 References
+322 1. Mulder MJ, Keuken MC, Bazin PL, Alkemade A, Forstmann BU. Size and shape matter: The
+323 impact of voxel geometry on the identification of small nuclei. PLoS ONE. 2019. https://doi.
+324 org/10.1371/journal.pone.0215382.
+325 2. Veitch DP, Weiner MW, Aisen PS, Beckett LA, Cairns NJ, Green RC, et al. Understanding disease
+326 progression and improving Alzheimer’s disease clinical trials: Recent highlights from the Alzheimer’s
+327 disease neuroimaging initiative. Alzheimer’s & Dementia : the Journal of the Alzheimer’s Association.
+328 2019;15:106–52.
+329 3. Boxer AL, Gold M, Feldman H, Boeve BF, Dickinson SL-J, Fillit H, et al. New directions in
+330 clinical trials for frontotemporal lobar degeneration: Methods and outcome measures. Alzheimer’s &
+331 dementia : the journal of the Alzheimer’s Association. 2020;16:131–43.
+332 4. Blau Y, Michaeli T. The perception-distortion tradeoff. Proceedings of the IEEE Conference
+333 on Computer Vision and Pattern Recognition, pp 6228-6237, 2018. 2017. https://doi.org/10.
+334 1109/CVPR.2018.00652.
+335 5. Haris M, Shakhnarovich G, Ukita N. Deep back-projection networks for single image super
+336 resolution. IEEE Transactions on Pattern Analysis and Machine Intelligence. 2020; 43(12):4323-
+337 4337.
+338 6. Agustsson E, Timofte R. NTIRE 2017 challenge on single image super-resolution: Dataset and
+339 study. In: Proceedings of the IEEE conference on computer vision and pattern recognition workshops
+340 2017. pp. 126-135.
+341 7. Gu S, Danelljan M, Timofte R, Haris M, Akita K, Shakhnarovic G, et al. AIM 2019 challenge on
+342 image extreme super-resolution: Methods and results. In: 2019 IEEE/CVF International Conference
+343 on Computer Vision Workshop (ICCVW). Seoul, Korea (South): IEEE. pp. 3556–64.
+344 8. Blau Y, Mechrez R, Timofte R, Michaeli T, Zelnik-Manor L. The 2018 PIRM challenge on
+345 perceptual image super-resolution. In: 2018 Proceedings of the European Conference on Computer
+346 Vision (ECCV) Workshops. pp. 334–55.
+347 9. Tian Q, Bilgic B, Fan Q, Ngamsombat C, Zaretskaya N, Fultz NE, et al. Improving in vivo human
+348 cerebral cortical surface reconstruction using data-driven super-resolution. Cerebral cortex (New
+349 York, NY : 1991). 2021;31:463–82.
+350 10. Glasser MF, Smith SM, Marcus DS, Andersson JLR, Auerbach EJ, Behrens TEJ, et al. The human
+351 connectome project’s neuroimaging approach. Nature Neuroscience. 2016; 19(9): pp. 1175-1187.
+352 11. Elam JS, Glasser MF, Harms MP, Sotiropoulos SN, Andersson JL, Burgess GC, et al. The human
+353 connectome project: A retrospective. NeuroImage. 2021;244:118543.
+354 12. Zhang K, Hu H, Philbrick K, Conte GM, Sobek JD, Rouzrokh P, et al. SOUP-gan: Super
+355 resolution mri using generative adversarial networks. Tomography (Ann Arbor, Mich). 2022;8:905–
+356 19.
+357 13. Shan H, Zhang Y, Yang Q, Kruger U, Kalra MK, Sun L, et al. 3-d convolutional encoder-decoder
+358 network for low-dose ct via transfer learning from a 2-d trained network. IEEE Transactions on
+359 Medical Imaging. 2018. https://doi.org/10.1109/TMI.2018.2832217.
+360 14. Avants B, Greenblatt E, Hesterman J, Tustison N. Deep volumetric feature encoding for biomedical
+361 images. In: Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial
+362 Intelligence and Lecture Notes in Bioinformatics). 2020.
+363 15. Zhang R, Isola P, Efros AA, Shechtman E, Wang O. The unreasonable effectiveness of deep
+364 features as a perceptual metric. In: Proceedings of the IEEE Computer Society Conference on
+365 Computer Vision and Pattern Recognition. 2018.
+366 16. Tustison NJ, Cook PA, Holbrook AJ, Johnson HJ, Muschelli J, Devenyi GA, et al. The antsx
+367 ecosystem for quantitative biological and medical imaging. Scientific reports. 2021;11:9068.
+368 17. Illán-Gala I, Nigro S, VandeVrede L, Falgàs N, Heuer HW, Painous C, et al. Diagnostic
+369 accuracy of magnetic resonance imaging measures of brain atrophy across the spectrum of progressive
+370 supranuclear palsy and corticobasal degeneration. JAMA network open. 2022;5:e229588.
+371 18. Whitwell JL. FTD spectrum: Neuroimaging across the ftd spectrum. 2019;187–223.
+372 19. Whitwell JL, Josephs KA. Neuroimaging in frontotemporal lobar degeneration—predicting
+373 molecular pathology. 2012;8:131–42.
+374 20. Binney RJ, Pankov A, Marx G, He X, McKenna F, Staffaroni AM, et al. Data-driven regions of
+375 interest for longitudinal change in three variants of frontotemporal lobar degeneration. Brain and
+376 behavior. 2017;7:e00675.
+377 21. McCarthy J, Collins DL, Ducharme S. Morphometric mri as a diagnostic biomarker of fron
+378 totemporal dementia: A systematic review to determine clinical applicability. NeuroImage Clinical.
+379 2018;20:685–96.
+380 22. Gunawardena D, Ash S, McMillan C, Avants B, Gee J, Grossman M. Why are patients with
+381 progressive nonfluent aphasia nonfluent? Neurology. 2010;75.
+382 23. C.T. M, J.B. T, B.B. A, P.A. C, E.M. W, E. S, et al. Genetic and neuroanatomic associations in
+383 sporadic frontotemporal lobar degeneration. Neurobiology of Aging. 2014.
+384 24. Massimo L, Powers C, Moore P, Vesely L, Avants B, Gee J, et al. Neuroanatomy of apathy
+385 and disinhibition in frontotemporal lobar degeneration. Dementia and Geriatric Cognitive Disorders.
+386 2009. https://doi.org/10.1159/000194658.
+387 25. Haris M, Shakhnarovich G, Ukita N. Deep back-projection networks for super-resolution. In:
+388 Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition.
+389 2018.
+390 26. Zhang R, Isola P, Efros AA, Shechtman E, Wang O. The unreasonable effectiveness of deep
+391 features as a perceptual metric. In: Proceedings of the IEEE Computer Society Conference on
+392 Computer Vision and Pattern Recognition. 2018.
+393 27. Klein A, Tourville J. 101 labeled brain images and a consistent human cortical labeling protocol.
+394 Frontiers in neuroscience. 2012;6:171.
+395 28. Schaerer J, Roche F, Belaroussi B. A generic interpolator for multi-label images. 2014. https:
+396 //doi.org/10.54294/nr6iii.
+397 29. Bates D, Mächler M, Bolker B, Walker S. Fitting linear mixed-effects models using lme4 | bates |
+398 journal of statistical software. Journal of Statistical Software. 2015;67.
+399 30. Brysbaert M, Stevens M. Power analysis and effect size in mixed effects models: A tutorial.
+400 Journal of Cognition. 2018;1.
+401 31. Ben-Shachar M, Lüdecke D, Makowski D. Effectsize: Estimation of effect size indices and
+402 standardized parameters. Journal of Open Source Software. 2020;5.
+403 32. Wang X, Yu K, Wu S, Gu J, Liu Y, Dong C, et al. ESRGAN: Enhanced super-resolution generative
+404 adversarial networks. arXiv e-prints. 2018;arXiv:1809.00219.
+405 33. Bell-Kligler S, Shocher A, Irani M. Blind super-resolution kernel estimation using an internal-gan.
+406 In: Advances in Neural Information Processing Systems. 2019.
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes]
+(c) Did you discuss any potential negative societal impacts of your work? [Yes]
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We provide the data, in supplementary material, that is needed to generate the tables shown in the paper. The raw data is publicly available but we do not have permission to redistribute these data. However, we do provide the ability to reproduce key results in the Tables of the main manuscript via supplementary information.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See beginning of Methods section and CSRS methods section.
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [Yes] in supplemental information.
+(c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] in supplemental information.
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] in supplemental information.
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/upJ3vrFKaL/upJ3vrFKaL.md b/md/dev/upJ3vrFKaL/upJ3vrFKaL.md
new file mode 100644
index 0000000000000000000000000000000000000000..e1b89a63f7c3c75c1e72be752cefeccf7de79ad8
--- /dev/null
+++ b/md/dev/upJ3vrFKaL/upJ3vrFKaL.md
@@ -0,0 +1,302 @@
+# COLLECTING THE PUZZLE PIECES: DISENTANGLEDSELF-DRIVEN HUMAN POSE TRANSFER BY PERMUT-ING TEXTURES
+
+Anonymous authors Paper under double-blind review
+
+# ABSTRACT
+
+Human pose transfer aims to synthesize a new view of a person under a given pose. Recent works achieve this via self-reconstruction, which disentangles pose and texture features from the person image, then combines the two features to reconstruct the person. Such feature-level disentanglement is a difficult and illdefined problem that could lead to loss of details and unwanted artifacts. In this paper, we propose a self-driven human pose transfer method that permutes the textures at random, then reconstructs the image with a dual branch attention to achieve image-level disentanglement and detail-preserving texture transfer. We find that compared with feature-level disentanglement, image-level disentanglement is more controllable and reliable. Furthermore, we introduce a dual kernel encoder that gives different sizes of receptive fields in order to reduce the noise caused by permutation and thus recover clothing details while aligning pose and textures. Extensive experiments on DeepFashion and Market-1501 shows that our model improves the quality of generated images in terms of FID, LPIPS and SSIM over other self-driven methods, and even outperforming some fully-supervised methods. A user study also shows that among self-driven approaches, images generated by our method are preferred in $72 \%$ of cases over prior work.
+
+# 1 INTRODUCTION
+
+The goal of human pose transfer is to change the pose of a person while preserving the person’s appearance and clothing textures. It has wide applications such as virtual try-on (Yang et al., 2020b; Cui et al., 2021; Yu et al., 2019), controllable person image manipulation (Cui et al., 2021; Liu et al., 2021) and person re-identification (Zhang et al., 2021b). Recent work has focused on using paired image data (i.e., two images of the same person before and after reposing) (Zhou et al., 2022; Zhang et al., 2022), but collecting such data can be very labor intensive. Although self-driven methods have been proposed to train pose transfer models without paired data (Ma et al., 2021; Song et al., 2019), there still remains two major challenges: how to disentangle texture and pose, and how to preserve texture details across changes in pose. As illustrated in Figure 1a, prior research attempts to achieve the pose and texture disentanglement at a feature level (Ma et al., 2018; Yang et al., 2020a; Ma et al., 2021; Wang et al., 2022). However, without direct supervision from pose-invariant textures, disentangling texture features from the person image while also preserving specific clothing details in the disentangled features is a difficult and ill-defined problem (Locatello et al., 2019). Small imbalances between pose and texture could leave obvious artifacts in the generated images.
+
+In this paper, we propose Pose Transfer by Permuting Textures $( \mathrm { P T ^ { 2 } } )$ , a self-driven pose transfer model using image-level disentanglement to represent detailed clothing patterns in any target pose. As shown in Figure 1b, a key novelty is our input permutation function that disentangles the raw inputs of texture and pose. Our method does not need supervised pose-invariant textures because most pose information has been removed by the permutation. The input permutation function creates a disentangled texture sample space by randomly reordering the texture patches on the person such that the source pose cannot be recovered from the permuted textures. This approach is similar in spirit to self-supervised representation learning methods that use jigsaw puzzle solving to learn a good feature representation (Noroozi & Favaro, 2016; Carlucci et al., 2019), where the pretext task divides the image into large patches and attempts to infer their relative positions by using the inherent geometry information within each patch. However, we differ in that our goal is to sample relevant patches based on the target posture. We make the patch much smaller in order to remove the position information and thus disentangle pose and texture. Furthermore, we mask some of the textures to force the generator to infer occluded and unseen regions, such as t-shirt occluded by crossed arms.
+
+
+Figure 1: Pose transfer methods trained without supervision extract disentangled texture and pose representations and then learn to reconstruct the original image. (a) Recent work uses separate encoders to disentangle texture and pose (Pumarola et al., 2018; Ma et al., 2018; 2021; Wang et al., 2022). However, pose information may still appear in the texture features, and without supervision, disentangling them is difficult (Locatello et al., 2019). (b) Our approach disentangles textures from pose by permuting the image patches, effectively eliminating pose information, which enables our approach to disentangle pose and texture features better than prior work.
+
+One challenge we face is that the permutation of textures causes loss of shape and relative position information, which has two significant consequences. First, the model cannot recognize different body parts and garments. For example, the generator could use texture from leggings to synthesize a top tank. Second, it makes the length of clothing items unknown because of lack of relative position of clothing pieces. The first issue can be easily solved by combining the person with a human parsing map to give a semantic identifier for each pixel (Ma et al., 2021). Whereas for the second problem, we need an additional sample space in the model that provides relative position information. This inspires us to add a pose branch, where we use the dense pose representation (Guler et al., 2018) as ¨ the sample space to provide position information for each pixel after permuting the textures. Each pixel value in the space indicates the position of that pixel under the texture coordinate system (Guler ¨ et al., 2018). In addition, we find that using different kernel sizes in the convolutional layers of our dual branch attention module provides a better representation for our task.
+
+Our main contributions are:
+
+• We propose Pose Transfer by Permuting Textures $( \mathrm { P T ^ { 2 } } )$ , a self-driven pose transfer model that utilizes input permutation to transfer clothing patterns to the target pose without using paired images for supervision.
+• The proposed pose branch in $\mathrm { P T ^ { 2 } }$ provides relative geometry information for the permuted textures, which helps recover shape and length after pose transfer. In addition, different kernel sizes are introduced in the branch, which can reduce the noise caused by input permutation and thus preserve clothing details while aligning pose and textures.
+• Extensive experiments on DeepFashion (Liu et al., 2016) and Market-1501 (Zheng et al., 2015) show that $\mathrm { P \bar { T } ^ { 2 } }$ significantly improves the image quality of self-driven approaches. A user study reports that our method are preferred in $72 \%$ of cases over the state-of-the-art.
+
+# 2 RELATED WORK
+
+Pose transfer with paired images. Methods trained with paired images aim to learn the complex non-rigid deformation of clothing items. In (Zhu et al., 2019; Zhang et al., 2022; Ren et al., 2022; Gao et al., 2020), this transformation is learned via soft attention that aggregates source image features with weighted sampling. Zhang et al. (2021a); Lv et al. (2021) further use semantic parsing maps as guidance to control the style of each body part. The major difficulty in such feature-level attention is that clothing details could be washed out in lower-resolution feature maps. To preserve these details after pose transfer, flow-based methods haven been proposed to approximate a dense flow field from the source to the target person. Han et al. (2019) introduced a pyramid feature network that outputs a pixel-level flow filed. Tang et al. (2021); Ren et al. (2020) further combined soft attention with dense flow to learn more accurate estimations. However, since the learned flow can only copy existing pixels in the source image to the target, it might fail at inferring occluded and unseen parts of the person. Grigorev et al. (2019); Sarkar et al. (2020); Albahar et al. (2021) explored inpainting 2D partial texture to 3D full texture in the UV space, and then projecting it back to the 2D pose. Although these methods can produce high-quality person images, they all require strong supervision from paired data, which might be difficult to collect in some real-world scenarios.
+
+Pose transfer with unpaired images. In a self-driven setting where paired data is absent, it is more difficult to transfer the pose without losing texture details. Without supervision, the generated images tend to have repeated texture patterns and edge blurring (Wang et al., 2022). Prior work has addressed this problem by disentangling the texture and posture at a feature level. Early attempts produced poor quality images for large pose deformations (Pumarola et al., 2018; Esser et al., 2018; Ma et al., 2018). Song et al. (2019) introduced a generated target parsing map to a cycle-GAN pose transfer model, which requires paired segmentation maps for training the human parsing model. Sanyal et al. (2021) presents a 3D based reposing approach with appearance visibility inference. Wang et al. (2022) used part-wise encoder to learn texture features that are less correlated with pose, where global pose information can still be inferred from the texture features. The model in (Ma et al., 2021) first computes region-wise image features, and then takes their mean and variance as the texture features to be integrated with the pose representation. This helps erase the pose information in the texture features, but, as we show, it may miss clothing details. In contrast to these methods, our approach disentangles the texture at an image-level by permutation, and uses a dual kernel encoder with dual branch attention to transfer detailed clothing patterns to the target pose.
+
+# 3 SELF-DRIVEN POSE TRANSFER BY PERMUTING TEXTURES $( \mathrm { P T ^ { 2 } } )$
+
+Let $I _ { s }$ be the source image with posture $P _ { s }$ . Our goal is to synthesize a new view $I _ { t }$ of the same person in $I _ { s }$ and wearing the same clothes in a target posture $P _ { t }$ . Models requiring paired data use the target pose $P _ { t }$ and the target image $I _ { t }$ for training, but our approach needs only information derived from the source image. Specifically, the target pose/image in training is identical to the source pose/image. In inference, replacing the target pose with a different one enables pose transfer.
+
+$\mathrm { P T ^ { 2 } }$ contains a pose transfer network (Sec. 3.1) that synthesizes a new view of the person in its target pose, and a background inpainting network that infers its full background (Sec. 3.2). The generated person and its full background are combined to create the final reconstructed image.
+
+# 3.1 POSE TRANSFER NETWORK
+
+The objective of the pose transfer network is to take the foreground person in the source image and generate a new view of them in a different pose. Figure 2 gives the overall architecture, which contains two branches: a pose branch that learns the geometric transformation function from pose $P _ { s }$ to pose $P _ { t }$ , and a texture branch that learns to transfer the textures of the person $E _ { s }$ to pose $P _ { t }$ . The permuted inputs (Sec. 3.1.1) from the two branches are first encoded with dual kernel encoder (Sec. 3.1.2), and then merged in a dual branch attention module (Sec. 3.1.3) to be decoded into the generated person $\hat { E } _ { d }$ and its segmentation $S$ .
+
+# 3.1.1 INPUT PERMUTATION
+
+Inputs to the Texture Branch. To guide the texture transfer with a posture in a self-driven way, we first need to disentangle the pose and textures in the image. The posture can be derived by a DensePose model (Guler et al., 2018) pretrained on COCO (Lin et al., 2014), which gives a 2D UV ¨ coordinate representation $P _ { s }$ . However, the texture representation should not simply be the source person $E _ { s }$ itself, as it is obviously entangled with posture. To erase the pose information from $E _ { s }$ , we create a texture sample space by dividing the image into $k \times k$ squares, referred to as “patches,” and then shuffling their locations. Intuitively, when the patch size $k$ is sufficiently small, the original posture cannot easily be retrieved from the permutation. Additionaly, $20 \%$ of the patches are masked to encourage the model to learn occluded regions. Formally, let RandMask $( \cdot )$ be the input permuting function. The inputs of the texture attention branch become $[ \tilde { E } _ { s } ; \tilde { M } ] = \mathrm { R a n d M a s k } ( [ E _ { s } ; M ] , m _ { t } )$ , where $[ ; ]$ means concatenation and $m _ { t }$ is the masking rate. We set $m _ { t } = 0 . 2$ in our experiments. The permuted tetxures $[ \tilde { E } _ { s } ; \tilde { M } ]$ are given as inputs to the dual-kernel texture encoder (Sec. 3.1.2).
+
+
+Figure 2: The pose transfer network in $\mathrm { P T ^ { 2 } }$ . During training, the target pose $P _ { t }$ is the same as the source pose $P _ { s }$ . The network takes the source person $E _ { s }$ , source parsing map $M$ and source pose $P _ { s }$ as inputs. In the pose branch and texture branch, the inputs are first permuted (Sec. 3.1.1) to create the corresponding sample space, which is encoded with dual kernel encoders (Sec. 3.1.2). Then the encoded features are sampled in a dual branch attention module (Sec. 3.1.3) to be decoded into the generated person $\hat { E } _ { s }$ and its segmentation $S$ . The output of the pose transfer network is combined with the output of the background inpainting network (Sec. 3.2) to produce the final image.
+
+Inputs to the Pose Branch. While prior work only uses a texture branch to transfer texture to the target pose (Pumarola et al., 2018; Ma et al., 2018; 2021; Wang et al., 2022), we propose a pose branch that provides relative geometry information for the permuted textures, which helps recover shape and length after pose transfer. To learn a powerful pose transformation function that supports large pose variations, the source pose in this branch is permuted the same way as the textures. In addition, we mask $50 \%$ of the source pose representation to force the model to learn the inherit symmetry in human body. The inputs to the pose branch become $[ \tilde { P } _ { s } ; \tilde { M } ] = \mathrm { R a n d M a s k } ( [ P _ { s } ; M ] , \stackrel { . . } { m } _ { p } )$ , where $m _ { p } = 0 . 5$ . Note that the inputs of the texture and pose branches are permuted the same way so they are spatially aligned in the dual branch attention module (see Sec. 3.1.3). The permuted pose representations $[ \tilde { P _ { s } } ; \tilde { M } ]$ are given as inputs to the dual-kernel pose encoder (Sec. 3.1.2).
+
+# 3.1.2 DUAL KERNEL ENCODER
+
+Following (Pumarola et al., 2018; Ma et al., 2018; 2021; Wang et al., 2022), we utilize separate encoders to learn both the texture and the pose information. However, in addition to providing permuted inputs from Sec. 3.1.1 to help further disentangle texture from pose, another way our approach differs is that we use multiple kernel sizes in the encoder’s convolutional layers. More formally, the texture/pose encoder learns a multi-dimensional feature map $F \in \mathbb { R } ^ { H \times W \times d }$ from the permuted texture/posture, where each vector $v \in \mathbb { R } ^ { d }$ in the feature map has a certain receptive field in the image. Let $l$ denote the length of the receptive field and $s$ be the stride of $F$ (both are measured by number of pixels in the image). Generally, larger receptive field is capable of learning more diverse features, and thus $l$ is usually much larger than $s$ . However, for a receptive field that crosses the boundary between two permuted image patches, the pixels within the field could be spatially faraway and irrelevant in the original image. In the left picture of Figure 3, the two black squares denote two adjacent receptive fields. While the left square lying within an image patch are seeing a consistent pattern (e.g., face), the right square crossing the boundary are seeing two distinct patterns (e.g., face and shoes). This could introduce high volume of noise to the feature vector $v$ , preventing the model from recognizing true clothing patterns.
+
+
+Figure 3: Illustration of the receptive field in the large-kernel encoder (left) and small-kernel encoder (right). The kernel size $l$ is reduced to avoid overlap between receptive fields (see Sec. 3.1.2).
+Figure 4: Dual branch attention module in Sec. 3.1.3. The top flow is PAM and the bottom flow is TAM. Res represents a residual layer. The cross-attention mechanism aligns the permuted texture with the target pose.
+
+To solve the above issue, we introduce an additional pose encoder with reduced kernel size such that $l \ = \ s$ , which can be regarded as a Multi Layer Perceptron over image patches. We select our kernel size such that the kernel does not cross the boundary of the permuted inputs from Sec. 3.1.1. As shown in the right picture of Figure 3, this design avoids the overlap between receptive fields, enabling the convolutional kernel to learn a consistent pattern within its own receptive field. Note that large kernel size is still necessary as it has more parameters and larger receptive filed for learning larger image patterns. Therefore, by combining encoders with a large and small kernel sizes our model is capable of learning more diverse features. The outputs of the dual kernel encoders in both texture branch and pose branch are fed to the dual branch attention module in Sec. 3.1.3.
+
+# 3.1.3 DUAL BRANCH ATTENTION
+
+We use a cross-attention transformer (Tang et al., 2020; Tan et al., 2021; Zhang et al., 2022) to align texture and pose features. Specifically, we use a Pose Attention Module (PAM) for the pose branch and a Texture Attention Module (TAM) for the texture branch. Let $F _ { s } ^ { p l } , F _ { s } ^ { p s }$ represent the output feature map of the large-kernel pose encoder and the small-kernel pose encoder in the pose branch, respectively. Similarly, $F _ { s } ^ { t l } , F _ { s } ^ { t { \bar { s } } }$ are the encoded features from the texture encoders in the texture branch. $T _ { 1 }$ is the feature map of the target pose $P _ { t }$ encoded by the target pose encoder, which is implemented with six convolutional layers. As shown in Figure 4, both PAM and TAM are composed of three cross-attention vision transformers formulated as Attention $\begin{array} { r } { ( Q , K , V ) = \mathrm { s o f t m a x } ( \frac { Q K ^ { \hat { T } } } { \sqrt { d } } ) \cdot V } \end{array}$ . With cross-attention the model can sample textures based on the target pose to generate a person image. In the first two transformer layers, the pose attention in the pose branch is learned from the correlation between the source pose and the target pose, which is computed as:
+
+$$
+Q = W _ { i } ^ { p q } T _ { i } , K = W _ { i } ^ { p k } F _ { s } ^ { p l } , V = W _ { i } ^ { p v } F _ { s } ^ { t l } , i = 1 , 2 .
+$$
+
+Here, $W _ { i } ^ { p q } , W _ { i } ^ { p k } , W _ { i } ^ { p v }$ are learnable projection matrices. Similarly, the texture attention in the texture branch is formulated as the correlation between the texture and the target pose:
+
+$$
+Q = W _ { i } ^ { t q } T _ { i } , K = W _ { i } ^ { t k } F _ { s } ^ { t l } , V = W _ { i } ^ { t v } F _ { s } ^ { t l } , i = 1 , 2 .
+$$
+
+After each transformer layer, a residual layer is appended as in Figure 4. A random noise vector $z$ is injected to the residual layer as the affine transformation parameters of the feature map $T _ { i }$ to prevent mode collapse (Karras et al., 2019).
+
+In the last transformer layer, wby small-kernel encoders (i.e., $F _ { s } ^ { p l } , F _ { s } ^ { t l }$ in the above equations with features produced to reconstruct more detailed information. The $F _ { s } ^ { p s } , F _ { s } ^ { t s } )$
+output feature map $T$ of the last transformer layer is then fed to the decoder, where $T$ is gradually
+upsampled to the target person $\hat { E } _ { s }$ and its segmentation mask $S$ .
+
+PAM in the dual branch attention module learns geometric transformation between different postures, and TAM samples the given textures based on the target pose. Fusing the two source of information provides a more accurate match between the given pose and textures. By filling in more clothing details that are learned through small kernels, our pose transfer network can then faithfully recover the appearance of clothing items after pose transfer.
+
+# 3.2 BACKGROUND INPAINTING NETWORK
+
+As in (Dundar et al., 2021; Liu et al., 2021), we use a separate background inpainting network, implemented using UNet (Long et al., 2015), to infer the background pixels of the masked foreground region. However, we found if we only mask out the foreground segmentation $S$ , the model would ignore the unknown background in the mask and reconstruct only known pixels during inference. This is because the background area is always visible in the source image in self-supervised training, so the network does not learn how to infer missing areas. Therefore, we expand the mask to the whole bounding box of the detected person in order to create invisible background areas during training. Let $\hat { B }$ be the inpainted background. Given the generated person $\hat { E } _ { s }$ and its segmentation mask $S$ produced by the pose transfer network, the final reconstructed image is: $\hat { I } _ { s } = \dot { S } \odot \dot { E } _ { s } + ( 1 - S ) \odot \hat { B }$ .
+
+# 3.3 LOSS FUNCTIONS
+
+We train our model using an adversarial loss that can be written as:
+
+$$
+L _ { a d v } = D ( \hat { I } _ { s } ) ^ { 2 } + ( 1 - D ( I _ { s } ) ) ^ { 2 } + D _ { p } ( [ \hat { I } _ { s } ; P _ { s } ] ) ^ { 2 } + ( 1 - D _ { p } ( [ I _ { s } ; P _ { s } ] ) ) ^ { 2 } .
+$$
+
+where $D$ and $D _ { p }$ represent different discriminators. $D$ penalizes the distribution difference between the synthesized image $\hat { I } _ { s }$ and the ground truth $I _ { s }$ . $D _ { p }$ evaluates that if the posture in $\hat { I } _ { s }$ matches the source pose $P _ { s }$ . To ensure correctness of our image generation, we use three different loss functions that capture different desired properties. The first is a simple reconstruction loss,
+
+$$
+L _ { r e c } = | | \hat { I } _ { s } - I _ { s } | | _ { 1 } .
+$$
+
+In addition, we use a perceptual loss (Johnson et al., 2016) that encourages both the ground truth and reconstructed image have similar semantic properties,
+
+$$
+L _ { p e r c } = \sum _ { i } | | \phi ^ { i } ( \hat { I } _ { s } ) - \phi ^ { i } ( I _ { s } ) | | _ { 1 } ,
+$$
+
+where $\phi ^ { i }$ is the ith layer of a VGG model (Simonyan & Zisserman, 2014) pretrained on ImageNet Deng et al. (2009). Finally, we use a style loss that penalizes discrepancies on colors and textures using the Gram matrix $\mathbb { G } ( \cdot )$ of the features,
+
+$$
+L _ { s t y l e } = \sum _ { i } | | \mathbb { G } ( \phi ^ { i } ( \hat { I } _ { s } ) ) - \mathbb { G } ( \phi ^ { i } ( I _ { s } ) ) | | _ { 1 } .
+$$
+
+Thus, our total loss can be written as,
+
+$$
+L _ { t o t a l } = \lambda _ { 1 } L _ { a d v } + \lambda _ { 2 } L _ { r e c } + \lambda _ { 3 } L _ { p e r c } + \lambda _ { 4 } L _ { s t y l e } .
+$$
+
+where $\lambda _ { 1 - 4 }$ are scalar hyperparameters. Additional training details are provided in Appendix A.
+
+# 4 EXPERIMENTS
+
+Datasets. We evaluate our proposed model on two benchmarks: DeepFashion (Liu et al., 2016) and Market1501 (Zheng et al., 2015). DeepFashion contains 52,712 high-quality images with a clean background. Market-1501 has 32,668 low-resolution images with various lighting conditions and a noisy background. Following Zhang et al. (2022); Wang et al. (2022), we select 8,570 test pairs with a resolution of $2 5 6 \times 2 5 6$ on DeepFashion, and 12,000 test pairs with a resolution of $1 2 8 \times 6 4$ on Market-1501. As in prior self-driven methods (Ma et al., 2021; Wang et al., 2022), we use 37,332 training images for DeepFashion and 12,112 training images for Market-1501.
+
+Metrics. Following (Ma et al., 2021; Wang et al., 2022), we use Structural Similarity Index Measure (SSIM) (Wang et al., 2004), Frechet Inception Distance (FID) (Heusel et al., 2017) , Learned Perceptual Image Patch Similarity (LPIPS) (Zhang et al., 2018) and Inception Score (IS) (Salimans et al., 2016) to evaluate the quality of the synthesized images. Among these metrics, SSIM measures structural similarity in the pixel space. FID computes Wasserstein-2 distance between two distributions. LPIPS evaluates perceptual similarity in deep network’s feature space. We use the default AlexNet as LPIPS’s backbone. IS assesses the quality of images generated by adversarial training. On Market-1501, we add Masked-SSIM and Masked-LPIPS computed on the target person region to exclude the influence of the irrelevant background.
+
+Table 1: Pose transfer results for $2 5 6 \times 2 5 6$ resolution images on DeepFashion. All results for prior work are taken from the original papers or produced with the author’s source code.
+
+
Method
FID↓
SSIM↑
LPIPS↓
IS↑
Supervised by paired images
PATN (Zhu et al., 2019)
24.071
0.770
0.299
3.141
GFLA (Ren et al., 2020)
10.573
0.707
0.234
3.635
PISE (Zhang et al., 2021a)
13.610
-
0.206
1
SPIG (Lv et al., 2021)
12.243
0.782
0.211
=
DPTN (Zhang et al.,2022)
11.466
0.778
0.196
CASD (Zhou et al., 2022)
11.373
0.725
0.194
NTED (Ren et al., 2022)
6.786
0.808
0.133
3.264
No paired images
VU-Net (Esser et al.,2018)
23.580
0.786
0.321
3.087
E2E (Song et al., 2019)
29.900
0.736
0.238
3.441
DPIG (Ma et al., 2018)
48.200
0.614
0.284
3.228
MUST (Ma et al.,2021)
15.902
0.742
-
3.692
SCM-Net Wang et al. (2022)
12.180
0.751
0.182
3.632
PT²(Ours)
8.338
0.795
0.158
3.469
+
+Table 2: Pose transfer results for $1 2 8 \times 6 4$ resolution images on Market-1501. All results for prior work are taken from the original papers or produced with the author’s source code.
+
+
Method
FID↓
SSIM↑
M-SSIM↑
LPIPS↓
M-LPIPS↓
IS↑
Supervised by paired images
PATN (Zhu et al., 2019)
22.657
0.311
0.811
0.320
0.159
GFLA (Ren et al.,2020)
19.751
0.281
0.796
0.282
0.148
SPIG (Lv et al., 2021)
23.331
0.315
0.818
0.278
0.139
DPTN (Zhang et al., 2022)
18.995
0.285
1
0.271
1
No paired images
PT²(Ours)
17.389
0.280
0.820
0.314
0.122
2.789
+
+# 4.1 QUANTITATIVE RESULTS
+
+Table 1 compares methods on the pose transfer task using DeepFashion, where our approach outperforms most methods on FID, SSIM, and LPIP by a large margin. For example, we improve FID by 4 points over the state-of-the-art. Notably, our model, which requires no paired training data, also achieves better performance than most supervised methods trained with paired data. Similar behavior is seen on Market-1501 (Table 2), where our self-driven $\mathrm { P T ^ { 2 } }$ gains in Masked-SSIM and Masked-LPIPS over supervised methods. However, we note that we do perform worse according to SSIM and LPIPS, which is computed over the entire image rather than just the target person region.
+
+To investigate the reason behind the discrepancy when we use masked regions for evaluation, we computed the SSIM scores on different body parts of the person. The average scores for background, arms, legs, clothes and head for $\mathrm { P T ^ { 2 } }$ are: 0.237, 0.263, 0.283, 0.323, 0.337, respectively. The lowest SSIM is on the background because the dataset is collected from surveillance videos, where the background can change drastically in different time frames. This violates our assumption that the background does not change, explaining the relatively poor performance. That said, since our goal is pose transfer, the improved performance using M-SSIM and M-LPIPS demonstrates we are more successful than even the supervised methods on Market-1501 at that task.
+
+User Study. To verify the quality of generated images, we also conducted a human evaluation on DeepFashion using Amazon Mechanical Turk. We collected 3 judgements for 50 images (150 total). Each worker was presented 3 pictures: the true image, a $\mathrm { P T ^ { 2 } }$ generated image, and a image generated by a method from prior work. The worker was asked to pick a picture that looks most similar to the true image. Table 3 shows that among self-driven methods, more than $72 \%$ workers believe our method achieves higher fidelity in the generated images. Compared with approaches supervised by paired images, our method achieves comparable performance with an average of over $62 \%$ user preference, demonstrating the effectiveness of our proposed approach.
+
+
+Figure 5: Qualitative pose transfer results on DeepFashion (left) and Market-1501 (right). We enlarged the area marked with a red bounding box for a better view of clothing details. Examples from prior work are generated with the author’s code and pretrained models. MUST, E2E, and our $\mathrm { P T ^ { 2 } }$ are trained with unpaired data, while the rest are supervised by paired data. These results show our approach transfers the original clothing patterns onto the target pose better than prior work.
+
+Table 3: A/B user preferences on DeepFashion. We report how often our approach was selected as most like the ground truth image. The number that follows $\pm$ is the corresponding standard deviation. We significantly outperform methods trained without paired images. Our results were also preferred over fully supervised methods.
+
+
Supervised by paired images
No paired images
PISE
DPTN
CASD
E2E
MUST
PT²
68.7%±3.27
66.2%±3.35
53.8%±3.53
79.7%±2.84
(Zhang et al.,2021a) (Zhang et al.,2022) (Zhou et al.,2022) (Song et al.,2019) (Ma et al.,2021) 72.6%±3.15
+
+# 4.2 QUALITATIVE RESULTS
+
+Pose Transfer. Figure 5 visualizes pose transfer results. We enlarged the area marked with a red bounding box for a better view of clothing details. In the first row (left), our method transferred the arm tattoos to the target pose while other methods either ignored this detail or failed to reconstruct the arm. Similarly, our model learns the color pattern in the second row (left) better than other approaches. This is because the small kernel encoder in our model can capture such detailed texture and thus reconstruct it based on the target pose. On the right side of Figure 5, compared with supervised pose transfer methods, our approach faithfully recovered the shape and color of the dress and shirt in the two examples. More examples, including failure cases, are in Appendix B.
+
+Garment Replacement. With a given parsing map, our approach can also switch the clothing pieces on two persons. Let $I _ { A } = \left( A _ { p o s e } , A _ { c l t } \right)$ be an image of person $A$ wearing clothes $A _ { c l t }$ under posture $A _ { p o s e }$ . To replace $A _ { c l t }$ with $B _ { c l t }$ in $I _ { B } = ( B _ { p o s e } , B _ { c l t } )$ , we first align $A , B$ ’s pose to $A _ { p o s e }$ using the proposed pose transfer method, and then replace $A _ { c l t }$ to $B _ { c l t }$ using their parsing maps. To fix small mis-alignment after copy-paste $B _ { c l t }$ using the parsing map, the image is fed to $\mathrm { P T ^ { 2 } }$ again for a more plausible reconstruction. Due to the shape difference of the source and reference garments (e.g., jeans and shorts), the model could give different ways of combining all the clothing pieces after replacing a specific garment. For example, in Figure 6, for the person in the top second source image, the upper clothes are tucked into the shorts but untucked to the jeans. Similarly, the shorts in the top first source image are occluded by the camel t-shirt and pink jackets, but are visible when combined with other shirts. Overall, Figure 6 shows that the proposed method successfully replaces various types of garments in the given images while preserving their patterns and details.
+
+# 4.3 ABLATION STUDY
+
+We performed an ablation study to evaluate the effectiveness of each component of our model. In Table $4 , w / \theta$ . Input Permuting does not permute the inputs, which results in entangled pose and textures. Input Warping, w/o. Input Permuting uses Thin Plate Spline transformation (TPS) to warp the source image, which can be viewed as a mild way of disentangling the pose and texture at the image-level. w/o. Pose Branch removes the pose branch in our method. w/o. small kernel uses only large kernel in the feature encoders, which should lead to loss of clothing details. w/o. large kernel uses only small kernel in the feature encoders. We train all these ablation models under the same configuration. As shown in Table 4, our complete model $\mathrm { P T ^ { 2 } }$ improves all the metrics, demonstrating the effectiveness of each component.
+
+
+Figure 6: Examples of garment replacement. The left column is the source image and the top row is reference image. All reference garments are marked with red bounding boxes.
+
+Table 4: Ablations in DeepFashion. Compare with each ablation model, our full model $\mathrm { P T ^ { 2 } }$ that combines all the components improves the overall performance.
+
+
Method
FID↓
SSIM↑
LPIPS↓
IS个
Input Warping, w/o. Input Permuting
10.011
0.781±0.072
0.178±0.060
3.579±0.086
w/o. Input Permuting
10.279
0.780±0.069
0.169±0.059
3.525±0.095
w/o. Pose Branch
11.391
0.785±0.068
0.177±0.068
3.485±0.095
w/o. small kernel
8.905
0.782±0.067
0.170±0.060
3.442±0.119
w/o. large kernel
9.275
0.785±0.068
0.166±0.060
3.401±0.078
PT²(Ours)
8.338
0.795±0.067
0.158±0.059
3.469±0.098
+
+# 5 CONLUSION
+
+We propose $\mathrm { P T ^ { 2 } }$ , a self-driven human pose transfer method that permutes the textures at random and then reconstructs the image with dual branch attention to achieve image-level disentanglement and detail-preserving texture transfer. The introduced dual kernel encoder in the model gives different sizes of receptive fields, which can reduce the noise caused by permutation and thus recovers clothing details while aligning pose and texture. Extensive experiments on DeepFashion and Market-1501 shows that our model improves the image quality of self-driven approaches, where a user study shows our images are preferred over prior work in $72 \%$ of cases. Moreover, it obtains comparable objective and subjective results to most pose transfer methods supervised by paired data.
+
+# 6 REPRODUCIBILITY STATEMENT
+
+We include our source code in the Supplementary for other researchers to easily reproduce our results in this paper. The code has a README file with detailed instructions of running and evaluating our model. The training details and all the hyperparameters we used in our approach are provided in Appendix A.
+
+# 7 ETHICS STATEMENT
+
+The proposed method introduces image-level disentanglement of pose and texture, and provides a self-driven framework for the human pose transfer task. The results of this research could be broadly disseminated by exploiting the publicly available source code. The research is beneficial to the research community in that it builds a unified framework for self-driven pose transfer, and gives insights to other exemplar-guided image generation tasks. From the perspective of ethical considerations, our method has the potential to be used as a tool through the spread of misinformation, which echos concerns have been addressed in related machine learning research (Ramesh et al., 2022; Karnouskos, 2020). It is of utmost importance to follow certain policies and regulations against misinformation (Pennycook et al., 2020) when using these AI technologies, as well as highlight the importance of developing methods for detecting misinformation, including for media created using artificial intelligence (e.g., Wang et al. (2020); Tan et al. (2020)).
+
+# REFERENCES
+
+Badour Albahar, Jingwan Lu, Jimei Yang, Zhixin Shu, Eli Shechtman, and Jia-Bin Huang. Pose with style: Detail-preserving pose-guided image synthesis with conditional styleGAN. ACM Transactions on Graphics, 2021.
+Z. Cao, G. Hidalgo Martinez, T. Simon, S. Wei, and Y. A. Sheikh. Openpose: Realtime multi-person 2d pose estimation using part affinity fields. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2019.
+Fabio M Carlucci, Antonio D’Innocente, Silvia Bucci, Barbara Caputo, and Tatiana Tommasi. Domain generalization by solving jigsaw puzzles. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2019.
+Aiyu Cui, Daniel McKee, and Svetlana Lazebnik. Dressing in order: Recurrent person image generation for pose transfer, virtual try-on and outfit editing. In Proceedings of the IEEE International Conference on Computer Vision, 2021.
+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, 2009.
+Aysegul Dundar, Kevin J Shih, Animesh Garg, Robert Pottorf, Anrew Tao, and Bryan Catanzaro. Unsupervised disentanglement of pose, appearance and background from images and videos. IEEE Transactions on Pattern Analysis and Machine Intelligence, 44(7):3883–3894, 2021.
+Patrick Esser, Ekaterina Sutter, and Bjorn Ommer. A variational u-net for conditional appearance ¨ and shape generation. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2018.
+Chen Gao, Si Liu, Ran He, Shuicheng Yan, and Bo Li. Recapture as you want. arXiv preprint arXiv:2006.01435, 2020.
+Artur Grigorev, Artem Sevastopolsky, Alexander Vakhitov, and Victor Lempitsky. Coordinate-based texture inpainting for pose-guided human image generation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2019.
+Rıza Alp Guler, Natalia Neverova, and Iasonas Kokkinos. Densepose: Dense human pose estimation ¨ in the wild. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2018.
+
+Xintong Han, Xiaojun Hu, Weilin Huang, and Matthew R Scott. Clothflow: A flow-based model for clothed person generation. In Proceedings of the IEEE International Conference on Computer Vision, 2019.
+
+Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. GANs trained by a two time-scale update rule converge to a local nash equilibrium. In Advances in neural information processing systems, 2017.
+
+Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and super-resolution. In Proceedings of the European conference on computer vision, 2016.
+
+Stamatis Karnouskos. Artificial intelligence in digital media: The era of deepfakes. IEEE Transactions on Technology and Society, 1(3):138–147, 2020.
+
+Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2019.
+
+Jingyun Liang, Jiezhang Cao, Guolei Sun, Kai Zhang, Luc Van Gool, and Radu Timofte. Swinir: Image restoration using swin transformer. In Proceedings of the IEEE International Conference on Computer Vision, 2021.
+
+Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ Proceedings of the European conference on computer vision, 2014.
+
+Wen Liu, Zhixin Piao, Zhi Tu, Wenhan Luo, Lin Ma, and Shenghua Gao. Liquid warping GAN with attention: A unified framework for human image synthesis. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021.
+
+Ziwei Liu, Ping Luo, Shi Qiu, Xiaogang Wang, and Xiaoou Tang. Deepfashion: Powering robust clothes recognition and retrieval with rich annotations. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2016.
+
+Francesco Locatello, Stefan Bauer, Mario Lucic, Gunnar Raetsch, Sylvain Gelly, Bernhard Scholkopf, and Olivier Bachem. Challenging common assumptions in the unsupervised learn- ¨ ing of disentangled representations. In international conference on machine learning, 2019.
+
+Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2015.
+
+Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2019.
+
+Zhengyao Lv, Xiaoming Li, Xin Li, Fu Li, Tianwei Lin, Dongliang He, and Wangmeng Zuo. Learning semantic person image generation by region-adaptive normalization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2021.
+
+Liqian Ma, Qianru Sun, Stamatios Georgoulis, Luc Van Gool, Bernt Schiele, and Mario Fritz. Disentangled person image generation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2018.
+
+Tianxiang Ma, Bo Peng, Wei Wang, and Jing Dong. MUST-GAN: Multi-level statistics transfer for self-driven person image generation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2021.
+
+Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In Proceedings of the European conference on computer vision, 2016.
+
+Gordon Pennycook, Ziv Epstein, Mohsen Mosleh, Antonio Arechar, Dean Eckles, and David Rand. Understanding and reducing the spread of misinformation online. ACR North American Advances, 2020.
+
+Albert Pumarola, Antonio Agudo, Alberto Sanfeliu, and Francesc Moreno-Noguer. Unsupervised person image synthesis in arbitrary poses. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2018.
+
+Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
+
+Yurui Ren, Xiaoming Yu, Junming Chen, Thomas H Li, and Ge Li. Deep image spatial transformation for person image generation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2020.
+
+Yurui Ren, Xiaoqing Fan, Ge Li, Shan Liu, and Thomas H Li. Neural texture extraction and distribution for controllable person image synthesis. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2022.
+
+Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training GANs. In Advances in neural information processing systems, 2016.
+
+Soubhik Sanyal, Alex Vorobiov, Timo Bolkart, Matthew Loper, Betty Mohler, Larry S Davis, Javier Romero, and Michael J Black. Learning realistic human reposing using cyclic self-supervision with 3d shape, pose, and appearance consistency. In Proceedings of the IEEE International Conference on Computer Vision, 2021.
+
+Kripasindhu Sarkar, Dushyant Mehta, Weipeng Xu, Vladislav Golyanik, and Christian Theobalt. Neural re-rendering of humans from a single image. In Proceedings of the European conference on computer vision, 2020.
+
+Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations, 2014.
+
+Sijie Song, Wei Zhang, Jiaying Liu, and Tao Mei. Unsupervised person image generation with semantic parsing transformation. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2019.
+
+Reuben Tan, Bryan A. Plummer, and Kate Saenko. Detecting cross-modal inconsistency to defend against neural fake news. In Empirical Methods in Natural Language Processing (EMNLP), 2020.
+
+Reuben Tan, Bryan Plummer, Kate Saenko, Hailin Jin, and Bryan Russell. Look at what i’m doing: Self-supervised spatial grounding of narrations in instructional videos. In Advances in Neural Information Processing Systems, 2021.
+
+Hao Tang, Song Bai, Li Zhang, Philip HS Torr, and Nicu Sebe. XingGAN for person image generation. In Proceedings of the European Conference on Computer Vision, 2020.
+
+Jilin Tang, Yi Yuan, Tianjia Shao, Yong Liu, Mengmeng Wang, and Kun Zhou. Structure-aware person image generation with pose decomposition and semantic correlation. In Proceedings of the AAAI Conference on Artificial Intelligence, 2021.
+
+Sheng-Yu Wang, Oliver Wang, Richard Zhang, Andrew Owens, and Alexei A Efros. Cnn-generated images are surprisingly easy to spot...for now. In IEEE conference on computer vision and pattern recognition, 2020.
+
+Zhou Wang, Alan C Bovik, Hamid R Sheikh, and Eero P Simoncelli. Image quality assessment: from error visibility to structural similarity. IEEE transactions on image processing, 13(4):600– 612, 2004.
+
+Zijian Wang, Xingqun Qi, Kun Yuan, and Muyi Sun. Self-supervised correlation mining network for person image generation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2022.
+
+Han Yang, Ruimao Zhang, Xiaobao Guo, Wei Liu, Wangmeng Zuo, and Ping Luo. Towards photorealistic virtual try-on by adaptively generating-preserving image content. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2020a.
+
+Hongtao Yang, Tong Zhang, Wenbing Huang, Xuming He, and Fatih Porikli. Towards purely unsupervised disentanglement of appearance and shape for person images generation. In Proceedings of the International Workshop on Human-Centric Multimedia Analysis, 2020b.
+
+Yasin Yaz, Chuan-Sheng Foo, Stefan Winkler, Kim-Hui Yap, Georgios Piliouras, Vijay Chandrasekhar, et al. The unusual effectiveness of averaging in GAN training. In International Conference on Learning Representations, 2019.
+
+Ruiyun Yu, Xiaoqi Wang, and Xiaohui Xie. Vtnfp: An image-based virtual try-on network with body and clothing feature preservation. In Proceedings of the IEEE international conference on computer vision, 2019.
+
+Jinsong Zhang, Kun Li, Yu-Kun Lai, and Jingyu Yang. Pise: Person image synthesis and editing with decoupled GAN. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2021a.
+
+Pengze Zhang, Lingxiao Yang, Jian-Huang Lai, and Xiaohua Xie. Exploring dual-task correlation for pose guided person image generation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2022.
+
+Quan Zhang, Jianhuang Lai, Zhanxiang Feng, and Xiaohua Xie. Seeing like a human: Asynchronous learning with dynamic progressive refinement for person re-identification. IEEE Transactions on Image Processing, 31:352–365, 2021b.
+
+Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2018.
+
+Ziwei Zhang, Chi Su, Liang Zheng, and Xiaodong Xie. Correlating edge, pose with parsing. In IEEE Conference on Computer Vision and Pattern Recognition, 2020.
+
+Liang Zheng, Liyue Shen, Lu Tian, Shengjin Wang, Jingdong Wang, and Qi Tian. Scalable person re-identification: A benchmark. In Proceedings of the IEEE international conference on computer vision, 2015.
+
+Xinyue Zhou, Mingyu Yin, Xinyuan Chen, Li Sun, Changxin Gao, and Qingli Li. Cross attention based style distribution for controllable person image synthesis. In Proceedings of the European conference on computer vision, 2022.
+
+Zhen Zhu, Tengteng Huang, Baoguang Shi, Miao Yu, Bofei Wang, and Xiang Bai. Progressive pose attention transfer for person image generation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2019.
+
+
+Figure 7: Additional pose transfer examples on DeepFashion.
+
+# A TRAINING DETAILS.
+
+We use AdamW optimizer (Loshchilov & Hutter, 2019) for training with $\beta _ { 1 } = 0 . 5 , \beta _ { 2 } = 0 . 9 9 9 .$ . The initial learning rate is set to $1 0 ^ { - 3 }$ and decays to $2 \times 1 0 ^ { - 4 }$ after five starting epochs. The trade-off parameters are set to $\lambda _ { 1 } = 2 . 0 , \lambda _ { 2 } = 5 . 0 , \lambda _ { 3 } = 0 . 5$ , $\lambda _ { 4 } = 1 5 0$ in all experiments. The patch size is $1 6 \times 1 6$ for DeepFashion and $8 \times 8$ for Market-1501. To stabilize the training, we use the EMA strategy Yaz et al. (2019) to average the learned weights of the generator. Our pose representation is predicted by DensePose (Guler et al., 2018) and the parsing maps are obtained from CorrPM ¨ (Zhang et al., 2020). We found that the predicted dense pose in Market-1501 has poor quality as the image resolution is too low $( 1 2 8 \times 6 4 )$ for the DensePose model. Therefore, we use an offline super resolution model Liang et al. (2021) to upsample the Market-1501 images to $5 1 2 \times 2 5 6$ , get dense pose from these images, and then downsample the pose to the original image resolution $( 1 2 8 \times 6 4 )$ for our pose transfer task. We also add human keypoints predicted from OpenPose (Cao et al., 2019) as part of the pose representation to improve the accuracy of predicted posture on Market-1501.
+
+# B DISCUSSIONS
+
+Failure case analysis. Figure 7 provides several successful examples generated by the propsoed method on DeepFashion. However, one limitation of our model is that it relies on the segmentation map and DensePose prediction of the source image to obtain semantic and position information for the permuted textures. Thus, we found the accuracy of human parser and DensePose model greatly affects the transfer results. Figure 8 shows several failed examples due to this type of inaccuracy. In the first row, the coat wrapped around the dress was misrecognized as part of the dress in the parsing map, for which our generated back view incorrectly mixes up their textures. Similarly, the skirt in the second row was classified as shorts in the parsing map. As a result, our generator infers the occluded clothing piece as shorts in the front view. In the last row, the color of skirt is half-black and halfwhite because the skirt piece was not identified in the parsing map. More analysis on ablations. We present some visualized examples in Figure 9 to show the functionality of each component of our model. It’s clear that models with less perturbation of the input texture (i.e., w/o. Input Permuting and Input Warping) fail at large pose changes (e.g., from back view to front full view in the bottom row). Removing the pose branch (w/o. Pose Branch) causes loss of length information, resulting in extended dress in the second row. Without the small-kernel encoder (w/o. small kernel), the ablation model correctly transfers color and shape, but fails to recover complex clothing patterns and details in the third row. Without large kernel (w/o. large kernel), the model can correctly reconstruct clothes with singular color, but is less capable of transferring detailed textures (see the third and fourth row). To see if the large-kernel encoder is learning certain low-level information from permuted patches, we also tried replacing the inputs of the large-kernel encoder with heavily Gaussian blurred image without permutation. From the examples, we can see that images generated by $w .$ blur are much worse compared to the full model. This suggests that features learned by large-kernel encoder from the permuted image might have richer information than Gaussian blurred texture.
+
+
+Figure 8: Failure cases in DeepFashion. Many failures are due to incorrect predictions of the source UV map and source parsing map.
+
+
+Figure 9: Generated images of ablations of our model. Each component of our model improves the transfer of shape information and detailed clothing patterns, resulting in our full model obtaining the best results.
+
+
+Figure 10: Visualized feature map of the encoded texture features. The feature map is overlaid with the source image. The source image is downsampled to the resolution of the feature map. Each triplet includes a downsampled source image, the feature map from large-kernel encoder, and the feature map from small-kernel encoder. Red indicates higher value and blue means smaller value.
+
+To further explore the differences of texture features learned by the large-kernel encoder and the small-kernel encoder, we sum up the encoded feature maps across all channels in the texture branch, and normalize their values to be in range [0, 1]. Then we downsample the image to the resolution of the feature map and overlay the normalized feature map with the downsampled source image. In Figure 10, each triplet includes the downsampled source image, the feature map from largekernel encoder, and the feature map from small-kernel encoder. Feature map given by large-kernel encoder (middle image in each triplet) appears to be much smoother than that of the small-kernel encoder (right image in each triplet). This suggests that large-kernel encoder might be learning coarse information from the clothing piece (e.g., color and shape), while small-kernel encoder is learning more fine-grained patterns (e.g., stripe and pleat).
\ No newline at end of file
diff --git a/md/dev/uu6Oq7MN7g/uu6Oq7MN7g.md b/md/dev/uu6Oq7MN7g/uu6Oq7MN7g.md
new file mode 100644
index 0000000000000000000000000000000000000000..bc25d9e39951223e9856fe172610a49199daecea
--- /dev/null
+++ b/md/dev/uu6Oq7MN7g/uu6Oq7MN7g.md
@@ -0,0 +1,490 @@
+# CodeT5+: Open Code Large Language Models for Code Understanding and Generation
+
+Yue Wang∗, Hung Le∗, Akhilesh Deepak Gotmare, Nghi D.Q. Bui, Junnan Li, Steven C.H. Hoi Salesforce AI Research https://github.com/salesforce/CodeT5/tree/main/CodeT5+
+
+# Abstract
+
+Large language models (LLMs) pretrained on vast source code have achieved prominent progress in code intelligence. However, existing code LLMs have two main limitations. First, they often adopt a specific architecture (encoder-only or decoder-only) or rely on a unified encoder-decoder network for different downstream tasks, lacking the flexibility to operate in the optimal architecture for a specific task. Secondly, they often employ a limited set of pretraining objectives which might not be relevant to some tasks and hence result in substantial performance degrade. To address these limitations, we propose “CodeT $5 + "$ , a family of encoder-decoder LLMs for code in which component modules can be flexibly combined to suit a wide range of code tasks. Such flexibility is enabled by our proposed mixture of pretraining objectives, which cover span denoising, contrastive learning, text-code matching, and causal LM pretraining tasks, on both unimodal and bimodal multilingual code corpora. Furthermore, we propose to initialize CodeT5+ with frozen off-the-shelf LLMs without training from scratch to efficiently scale up our models, and explore instruction-tuning to align with natural language instructions. We extensively evaluate ${ \mathrm { C o d e T } } 5 +$ on over 20 coderelated benchmarks in different settings, including zero-shot, finetuning, and instructiontuning. We observe state-of-the-art (SoTA) performance on various code-related tasks, and our instruction-tuned CodeT5 $\uplus$ 16B achieves new SoTA results of $3 5 . 0 \%$ pass $@ 1$ and $5 4 . 5 \%$ pass $@ 1 0$ on the HumanEval code generation task against other open code LLMs, even surpassing the OpenAI code-cushman-001 model.
+
+# 1 Introduction
+
+Large language models (LLMs) (Chen et al., 2021; Wang et al., 2021b; Nijkamp et al., 2023b) have recently demonstrated remarkable success in a broad set of downstream tasks in the code domain (Husain et al., 2019; Lu et al., 2021; Hendrycks et al., 2021). By pretraining on massive code-based data (e.g. GitHub public data), these code LLMs can learn rich contextual representations which can be transferred to various code-related downstream tasks. However, we found that many existing models are designed to perform well only in a subset of tasks. We argue that this is mainly due to two limitations in terms of architecture and pretraining tasks.
+
+From an architectural perspective, existing code LLMs often adopt encoder-only or decoder-only models that perform well only on certain understanding or generative tasks. Specifically, encoderonly models (Feng et al., 2020; Guo et al., 2021) are often used to facilitate understanding tasks such as text-to-code retrieval (Lu et al., 2021). For generative tasks such as code generation (Chen et al., 2021; Hendrycks et al., 2021), decoder-only models (Chen et al., 2021; Nijkamp et al., 2023b) often demonstrate stronger performance. However, these decoder-only models are often not ideal for understanding tasks such as detection tasks compared to encoder-only models (Nijkamp et al., 2023a).
+
+Besides, several models have adopted more unified encoder-decoder architectures (Wang et al., 2021b; Ahmad et al., 2021) to adapt to different types of tasks. While these models can support both understanding and generative tasks, they still suffer from suboptimal performance on certain tasks. Guo et al. (2022) found that encoder-decoder models fail to beat (state-of-the-art) SoTA encoder-only or decoder-only baselines on retrieval and code completion tasks respectively. This shortfall is due to the limitation of the single-module architecture generally adapted to all tasks. In summary, prior approaches are not designed with compositionality such that individual components can be activated to better suit different types of downstream tasks.
+
+From a learning objective perspective, current models employ a limited set of pretraining tasks.
+
+
+Figure 1: An overview of our CodeT $^ { \circ + }$ , a family of code LLMs for code understanding and generation.
+
+These tasks can lead to performance degrade on certain downstream tasks due to the discrepancy between the pretraining and finetuning stage. For instance, T5-based models such as (Wang et al., 2021b) are often trained with a span denoising objective. However, in downstream tasks such as code generation (Chen et al., 2021; Hendrycks et al., 2021), most SoTA models are pretrained with a next-token prediction objective which autoregressively predicts a program token by token. Furthermore, many models are not trained to learn contrastive code representations that are vital for understanding tasks such as text-to-code retrieval. Although recent attempts (Guo et al., 2022; Wang et al., 2021a) introduce a contrastive learning task to alleviate this issue, these approaches ignore the fine-grained text-code cross-modal alignments.
+
+To address the above limitations, we propose “CodeT $\ " 5 + \ " { }$ , a new family of encoder-decoder code foundation LLMs for a wide range of code understanding and generation tasks (see Fig. 1 for an overview). Despite being an encoder-decoder based model, our CodeT $^ { 5 + }$ can flexibly operate in encoder-only, decoder-only, and encoder-decoder modes to suit different downstream applications. Such flexibility is enabled by our proposed pretraining tasks, which include span denoising and causal language modeling (CLM) tasks on code data and text-code contrastive learning, matching, and CLM tasks on text-code data. We found that such a wide set of pretraining tasks can help learn rich representations from both code and text data, and bridge the pretrain-finetune gap in various downstream applications. Besides, we show that the integration of the matching task with contrastive learning is crucial to capture the fine-grained text-code alignments and improve retrieval performance.
+
+Furthermore, we scale up the model size of
+
+CodeT $^ { 5 + }$ with a compute-efficient pretraining strategy by leveraging off-the-shelf code LLMs to initialize the components of ${ \mathrm { C o d e T } } 5 +$ . Specifically, we employ a “shallow encoder and deep decoder” architecture (Li et al., 2022b), where both encoder and decoder are initialized from pretrained checkpoints and connected by cross-attention layers. We freeze the deep decoder LLM and only train the shallow encoder and cross-attention layers, largely reducing the number of trainable parameters for efficient tuning. Finally, recent work in the NLP domain (Taori et al., 2023; Wang et al., 2022; Ouyang et al., 2022) inspired us to explore ${ \mathrm { C o d e T } } 5 +$ with instruction tuning to better align the models with natural language instructions.
+
+We extensively evaluate ${ \mathrm { C o d e T } } 5 +$ on over 20 code-related benchmarks under various settings, including zero-shot, finetuning, and instructiontuning. Results show that CodeT $^ { 5 + }$ yields substantial performance gains on many downstream tasks compared to their SoTA baselines, e.g., 8 text-to-code retrieval tasks $+ 3 . 2$ avg. MRR), 2 line-level code completion tasks $( + 2 . 1$ avg. Exact Match), and 2 retrieval-augmented code generation tasks ( $_ { + 5 . 8 }$ avg. BLEU-4). In 2 math programming tasks on MathQA and GSM8K benchmarks (Austin et al., 2021; Cobbe et al., 2021), CodeT $^ { 5 + }$ models of below billion-parameter sizes significantly outperform many LLMs of up to 137B parameters. Particularly, in the zero-shot text-to-code generation task on HumanEval benchmark (Chen et al., 2021), our instruction-tuned CodeT $5 +$ 16B sets new SoTA results of $3 5 . 0 \%$ pass $@ 1$ and $5 4 . 5 \%$ pass $@ 1 0$ against other open code LLMs, even surpassing the closed-source OpenAI code-cushman001 model. Finally, we showcase that CodeT $^ { 5 + }$ can be seamlessly adopted as a semi-parametric retrieval-augmented generation system.
+
+
+Figure 2: Model architecture of CodeT $^ { 5 + }$ . S1: first stage pretraining with unimodal code data, S2: second stage pretraining with bimodal code-text data. The diagram on the right shows our proposed compute-efficient training with frozen code LLMs to scale up the model. We employ a “shallow encoder and deep decoder” architecture and only keep the small encoder and the cross-attention layers trainable while freezing the deep decoder LLM.
+
+# 2 Related Work
+
+Following the success of LLMs such as BERT (Devlin et al., 2019) and GPT (Radford et al., 2019) in natural language processing (NLP), recent years witness a surge of research work of LLMs in the code domain, leading to new SoTA results on various code-related tasks. Typically, code LLMs can be categorized into three architectures: encoderonly models (Feng et al., 2020), decoder-only models (Chen et al., 2021; Nijkamp et al., 2023b), and encoder-decoder models (Ahmad et al., 2021; Wang et al., 2021b). For encoder-only and decoderonly models, they are often ideal for either understanding tasks such as code retrieval (Husain et al., 2019) or generation tasks such as code synthesis (Chen et al., 2021) respectively. For encoderdecoder models, they can be adapted to both code understanding and generation but do not always achieve better performance (Wang et al., 2021b). In this work, we propose a new family of encoderdecoder code LLMs “CodeT $\ " 5 + \ " { }$ that can flexibly operate in various modes, including encoder-only, decoder-only, and encoder-decoder models.
+
+Prior code LLMs are also limited by their pretraining tasks, which are not perfect to transfer the models to some downstream tasks. For instance, T5-based models such as (Wang et al., 2021b) pretrained with span denoising objective are not ideal for auto-regressive generation tasks like next-line code completion (Guo et al., 2022), as these models are trained to recover short spans of limited lengths rather than a whole program.1 Inspired by recent advances in NLP research (Tay et al., 2022; Soltan et al., 2022), we explore to combine span denoising with CLM tasks to improve the model with better causal generation capability (Le et al., 2022). Additionally, most models do not have specific pretraining tasks (e.g. contrastive learning) to facilitate the learning of contextual representations that can distinguish code samples of different semantics. This can lead to suboptimal performance on code understanding tasks like code retrieval (Husain et al., 2019). In light of this, we include a contrastive learning task to learn better unimodal representations and a matching task to learn richer bimodal representations, which has been shown helpful in vision-language retrieval tasks (Li et al., 2021).
+
+# 3 CodeT5+: Open Code LLMs
+
+We develop CodeT $^ { 5 + }$ , a new family of open code LLMs for code understanding and generation tasks (see Fig. 1 for an overview and more architecture/pretraining details in Fig. 2 and Fig. 3). Based on the encoder-decoder architecture (Wang et al., 2021b), CodeT $^ { 5 + }$ is enhanced with the flexibility to operate in various modes for different downstream tasks through our proposed mixture of pretraining objectives, which are performed on two stages of pretraining on unimodal (Sec. 3.1) and bimodal data (Sec. 3.2). We found that this stage-wise training approach can efficiently expose our models to more diverse data to learn rich contextual representations. Finally, we explore initializing CodeT $^ { 5 + }$ with off-the-shelf code LLMs to efficiently scale up the model without training from scratch (Sec. 3.3).
+
+
+Figure 3: Self-supervised pretraining on code data: we pretrain ${ \mathrm { C o d e T } } 5 +$ on code data using a mixture of tasks: (i) span denoising (Top); (ii) decoder-only causal LM (Middle); and (iii) Seq2Seq causal LM (Bottom). This mixture of tasks lets the models learn meaningful representations of code contexts and recover missing information at different levels: code spans, partial programs, and complete programs.
+
+# 3.1 Unimodal Pretraining on Code Data
+
+In the first stage, we pretrain CodeT $^ { 5 + }$ on largescale code unimodal data, which can be obtained from open-source platforms like GitHub. Although such data also contain texts such as user-written code comments, we denote unimodal data to distinguish them with bimodal data of text-code pairs in the second pretraining stage. In this stage, we pretrain the model from scratch using a mixture of span denoising and CLM tasks as shown in Fig. 3. These tasks enable the model to learn to recover code contexts at different scales: code spans, partial programs, and complete programs.
+
+Span Denoising. Similar to T5 (Raffel et al., 2020), we randomly replace $1 5 \%$ of the tokens with indexed sentinel tokens (like [MASK0]) in the encoder inputs, and require the decoder to recover them via generating a combination of these spans. We follow CodeT5 to employ whole-word masking by sampling spans (span lengths determined by a uniform distribution with a mean of 3) before subword tokenization to avoid masking partial words.
+
+Causal Language Modeling (CLM). Inspired by Tay et al. (2022); Soltan et al. (2022), we introduce two variants of CLM to optimize our model for auto-regressive generation. In the first variant, we randomly select a pivot location and regard the context before it as the source sequence and the sequence after it as the target output. We denote this variant as a sequence-to-sequence (Seq2Seq) causal LM objective. We restrict the pivot location to be uniformly sampled between $1 0 \%$ and $9 0 \%$ of the whole sequence and prepend a special token [CLM] to the source sequence. The second CLM variant is a decoder-only generation task, where we always pass a [CLM] token to the encoder input and require the decoder to generate the full code sequence. This task aims to provide more dense supervision signals to train the decoder as an independent full-fledged code generation module.
+
+# 3.2 Bimodal Pretraining on Text-code Data
+
+In the second stage, we pretrain the model using text-code bimodal data at function level (Husain et al., 2019). In this setting, each text-code pair contains a code function and its corresponding docstring describing its semantics. Such a bimodal data format facilitates model training for crossmodal understanding and generation. The bimodal pretraining tasks consist of cross-modal contrastive learning, matching, and causal LM tasks (Fig. 2). See Appendix A for their detailed formulations.
+
+Text-Code Contrastive Learning. This task aims to align the feature space of text and code representations by pulling together the representations of positive text-code pairs and pulling apart the negative pairs. Guo et al. (2022) demonstrated the benefits of such learning task for code understanding. This task only activates the encoder, which encodes a text or code snippet into a representation through bidirectional self-attention (Vaswani et al., 2017). Similar to BERT (Devlin et al., 2019), we prepend a special token [CLS] to the input and regard its output embeddings at the final layer as the representations of the corresponding input text or code. We further add a linear layer and use L2 normalization to map the output to 256- $d$ embeddings. To enrich the negative samples, we use a momentum encoder to store embeddings of samples from previous mini-batches, as similarly adopted by (He et al., 2020; Li et al., 2022a). Specifically, the momentum encoder maintains a queuing system that enqueues the samples in the current mini-batch and dequeues the samples in the oldest mini-batch.
+
+Text-Code Matching. This task activates the decoder and aims to predict whether a text and code snippet share the same semantics. Such task enables model to learn better bimodal representations that capture the fine-grained alignment between text and code modalities. Given a code sample, the decoder first passes it to an embedding layer and a causal self-attention layer. The representations are then passed to a cross-attention layer which queries relevant signals from the text representations (received from the encoder). A task-specific [Match] token is prepended to the code input sequence to inform the decoder of the text-code matching functionality, and an [EOS] token is appended to the end of the code input. Since the decoder employs causal self-attention masks and only the last decoder token can attend to the whole context, we treat the output embedding of [EOS] at the last layer as the text-code alignment representation. Finally, we use a linear layer on top of the output embedding of the decoder for a binary matching task, predicting whether a text-code pair is positive (matched) or negative (unmatched).
+
+Text-Code Causal LM. This task activates both encoder and decoder and focuses on a cross-modal generative objective through a dual multimodal conversion: text-to-code generation and code-to-text generation. Specifically, when the input is a text sample, we prepend a [CDec] token to the input sequence to the decoder. In this case, the decoder operates under code generation functionality. Alternatively, when the input is a code sample, we prepend a [TDec] token to the input sequence to the decoder. The decoder operates under text generation functionality in this case. This type of Causal LM has been shown to be an effective learning objective to close the pretrain-finetune gap for generative downstream tasks (Wang et al., 2021b).
+
+# 3.3 Compute-efficient Pretraining with Frozen Off-the-shelf LLMs
+
+To efficiently scale up the model without the need of pretraining from scratch, we propose a computeefficient pretraining strategy to initialize model components (i.e. encoder and decoder) of CodeT $^ { 5 + }$ with off-the-shelf pretrained LLMs (Nijkamp et al., 2023b) (see the rightmost diagram of Fig. 2). For this extension, inspired by (Li et al., 2022b), we employ a “shallow encoder and deep decoder” architecture instead of encoder and decoder of the same size in conventional T5 models (Raffel et al.,
+
+2020; Wang et al., 2021b). As noted by Li et al. (2022b), the decoder is often required to deal with a higher level of complexity in generation tasks and thus, should be enhanced with more parameters.
+
+To connect the separately pretrained encoder and decoder, we insert randomly initialized crossattention layers to decoder blocks after the selfattention layers. For efficient tuning, we only insert cross-attention layers to the top- $L$ decoder layers ( $\scriptstyle { \mathrm { . } } L = 1$ in our experiments). We only keep the small encoder and cross-attention layers trainable while freezing the majority of the decoder parameters. We also explored other advanced designs such as adding a gating function to improve training stability or inserting multiple cross-attention layers at a certain frequency (Alayrac et al., 2022). However, we did not observe significant performance improvement and these design choices would introduce too expensive computation overhead.
+
+# 3.4 Adaptation to Downstream Understanding and Generation Tasks
+
+After the two stages of pretraining, CodeT $^ { 5 + }$ can flexibly operate in various modes to support different tasks, including Seq2Seq generation tasks, decoder-only tasks, and understanding-based tasks:
+
+Seq2Seq Generation Tasks. As an encoderdecoder model, CodeT $^ { 5 + }$ can be naturally adapted to a variety of Seq2Seq generation tasks such as code generation and summarization. We also adapt CodeT $^ { 5 + }$ as a retrieval-augmented generation model, using the encoder to retrieve code snippets, which are then used by both the encoder and decoder for code generation.
+
+Decoder-only Tasks. In this setting, we always feed a [CLM] token to the encoder input and pass the source sequence to the decoder as the prefix context. We freeze the weights of the encoder and the cross-attention layers in the decoder. This strategy only activates parts of the decoder and reduces about half of the total model parameters. We use next-line code completion tasks to evaluate the decoder-only generation capability of ${ \mathrm { C o d e T } } 5 +$ .
+
+Understanding Tasks. CodeT $^ { 5 + }$ can support these understanding tasks in two ways: first, it employs the encoder to obtain text/code embeddings, which can be either passed to a binary classifier for detection tasks; alternatively, the encoder can be combined with the decoder to predict the text-code matching scores for text-to-code retrieval tasks.
+
+# 4 Pretraining and Instruction Tuning
+
+Additional pretraining and finetuning setups can be found in Appendix B, C, and E.
+
+Pretraining Dataset. We enlarge the pretraining dataset of CodeSearchNet (Husain et al., 2019) with the recently released GitHub Code dataset2. We select nine PLs (Python, Java, Ruby, JavaScript, Go, PHP, C, $\mathrm { C } { + + }$ , C#) and filter the dataset by preserving only permissively licensed code3 and files with 50 to 2000 tokens. Besides, we filter out the overlapped subset with CodeSearchNet and other downstream tasks covered in our evaluation by checking their GitHub repository names. Note that although we employ the deduplicated data version in which duplicates are filtered out based on the exact match, there might be some potential remaining duplicates. However, we do not expect any remaining duplication will impact our model performance significantly. We use the CodeT5 tokenizer to tokenize the multilingual dataset, resulting in 51.5B tokens, ${ \sim } 5 0 \mathrm { x }$ larger than CodeSearchNet.
+
+Pretraining Setup. We pretrained two groups of CodeT5+ models: 1) CodeT $^ { 5 + }$ 220M and 770M that are trained from scratch following T5’s architecture (Raffel et al., 2020) (T5-base and large respectively), 2) CodeT $^ { 5 + }$ 2B, 6B, 16B in which the decoders are initialized from CodeGen-mono 2B, 6B, 16B models (Nijkamp et al., 2023b) and its encoders are initialized from CodeGen-mono 350M. Note that following our model scaling strategy, the latter group of CodeT $^ { 5 + }$ models introduce insignificant trainable parameters (the 350M encoder plus one cross-attention layer of 36M, 67M, 151M for 2B, 6B, 16B models respectively) compared to the original CodeGen models. We employ the CodeT5 tokenizer and CodeGen tokenizer for these two groups of models respectively. In pretraining, we adopt a stage-wise strategy to pretrain CodeT5+ first on the large-scale unimodal dataset and then on the smaller bimodal dataset on a cluster with 16 A100-40G GPUs on Google Cloud Platform.
+
+Instruction Tuning. In the NLP domain, recent work (Wang et al., 2022; Taori et al., 2023) studied the benefits of data augmentation techniques on pretrained LMs with synthetic instruction data. Models finetuned with this type of data can better understand natural language instructions and demonstrate improved alignment with the corresponding tasks (Wang et al., 2022; Ouyang et al., 2022). We are motivated to transfer this technique to the code domain to improve our CodeT $^ { 5 + }$ models. Following Taori et al. (2023), we employ over $2 0 \mathrm { k }$ instruction data in the code domain curated by Chaudhary (2023). The data is generated by letting pretrained LLMs i.e. text-davinci-003, generate novel tasks, including task instructions, inputs (if any), and expected outputs. We trained our models on this augmented dataset for up to 3 epochs and denote the instruction-tuned models as “InstructCode $\Gamma 5 + "$ . Note that the instruction data are generated fully independently from any downstream evaluation tasks and we still evaluate these models in a zero-shot manner.
+
+# 5 Experiments
+
+We extensively evaluate ${ \mathrm { C o d e T } } 5 +$ on a wide range of code understanding and generation tasks over $^ { 2 0 + }$ code-related datasets across 9 different programming languages (PLs). In addition, we consider a variety of evaluation settings including zeroshot, instruction tuning, task-specific finetuning. Additional results can be found in Appendix D.
+
+Baselines. We developed a family of CodeT5+ models, with model sizes ranging from 220M to 16B. We compare CodeT5+ with 3 types of models: encoder-only, decoder-only, and encoder-decoder.
+
+• For encoder-only models, we consider RoBERTa (Liu et al., 2019), CodeBERT (Feng et al., 2020), GraphCodeBERT (Guo et al., 2021), SYNCOBERT (Wang et al., 2021a) and UniXcoder (Guo et al., 2022) that incorporates contrastive learning. Note that UniXcoder can be also viewed as decoder-only model as it employs UniLM-style masking (Dong et al., 2019).
+
+• For decoder-only models, we consider GPT2 (Radford et al., 2019) and CodeGPT (Lu et al., 2021), and also consider models of very large scales (up to 540B) such as PaLM (Chowdhery et al., 2022), GPT-4 (OpenAI, 2023), Codex (Chen et al., 2021), LLaMA (Touvron et al., 2023), CodeGen (Nijkamp et al., 2023b), Incoder (Fried et al., 2022), GPT-J (Wang and Komatsuzaki, 2021), GPT-Neo and GPT-NeoX (Black et al., 2022), MIM (Nguyen et al., 2023), CodeGeeX (Zheng et al., 2023). We also compare with Replit (replit, 2023) and StarCoder (Li et al., 2023) which are concurrent work with ours.
+
+Table 1: Results of $p a s s @ k ( \% )$ on HumanEval.
+
+
Model
Model size
pass@1
pass@10
pass@100
Closed-source models
LaMDA
137B
14.0
=
47.3
AlphaCode
1.1B
17.1
28.2
45.3
MIM
2.7B
30.7
48.2
69.6
PaLM
62B
15.9
-
46.3
PaLM
540B
26.2
-
76.2
code-cushman-001
-
33.5
54.3
77.4
code-davinci-002
47.0
74.9
92.1
GPT-3.5
48.1
=
GPT-4
=
67.0
-
-
Open-source models
GPT-J
6B
11.6
15.7
27.7
InCoder
6B
15.2
27.8
47.0
GPT-NeoX
20B
15.4
25.6
41.2
CodeGeeX
13B
22.9
39.6
60.9
LLaMA
13B
15.8
-
52.5
LLaMA
65B
23.7
79.3
Replit
3B
21.9
=
-
StarCoder
15B
33.6
-
-
CodeGen-mono
2B
23.7
36.6
57.0
CodeGen-mono
6B
26.1
42.3
65.8
CodeGen-mono
16B
29.3
49.9
75.0
CodeT5+
220M
12.0
20.7
31.6
CodeT5+
770M
15.5
27.2
42.7
CodeT5+
2B
24.2
38.2
57.8
CodeT5+
6B
28.0
47.2
69.8
CodeT5+
16B
30.9
51.6
76.7
InstructCodeT5+
16B
35.0
54.5
77.9
Open-source models + generation strategies
StarCoder (prompted)
15B
40.8
-
=
CodeGen-mono w/CodeT
16B
36.7
59.3
CodeT5+w/CodeT
16B
38.5
63.6
77.1
InstructCodeT5+w/CodeT
16B
42.9
67.8
78.7
+
+• For encoder-decoder, we use PLBART (Ahmad et al., 2021) and CodeT5 (Wang et al., 2021b).
+
+Note that billion-parameter LLMs such as Codex and CodeGen typically use most of the source code from GitHub for model training and do not remove any overlap with the downstream tasks covered in this work as we did. Therefore, it is difficult to ensure a fair comparison with these models in those tasks, especially the code completion tasks. Moreover, these models are very expensive to perform task-specific finetuning, and hence, they are often employed only on the zero-shot evaluation. In this work, we mainly compare CodeT $^ { 5 + }$ with these LLMs in the zero-shot HumanEval code generation task (Sec. 5.1). In other experiments, we focus on the finetuning setting and compare our models with smaller-scale LMs.
+
+# 5.1 Zero-shot Code Generation Evaluation
+
+We first evaluate the zero-shot code generation capabilities of our model on the HumanEval benchmark (Chen et al., 2021), where we activate both encoder and decoder modules from ${ \mathrm { C o d e T } } 5 +$ . In this experiment, we follow Nijkamp et al. (2023b) to continue to pretrain our CodeT $^ { 5 + }$ models on the Python subset for another epoch using causal LM objective to adapt them for Python code generation. We evaluate the model performance by testing generated codes against unit tests and report the passing rate pass $@ k$ $( k = \{ 1 , 1 0 , 1 0 0 \} )$ .
+
+Table 2: Results of $p a s s @ k ( \% )$ on math programming.
+
+
Model
Model size
MathQA-Python pass @80
GSM8K-Python pass @100
Few-shot learning results
code-davinci
-
42.0
71.0
LLaMA
33B
=
53.1
LLaMA
65B
69.7
Minerva
62B
68.5
Minerva
540B
=
78.5
Finetuning results
LaMDA
137B
81.2
=
GPT-Neo
125M
84.7
=
GPT-Neo
2.7B
=
41.4
CodeGen-mono
350M
83.1
38.7
CodeGen-mono
2B
85.6
47.8
CodeT5
220M
71.5
58.4
CodeT5+
220M
85.6
70.5
CodeT5+
770M
87.4
73.8
+
+As shown in Table 1, our instruction-tuned Code $^ { \circ + }$ ("InstructCodeT $" 5 + "$ ) 16B can improve the performance against other open code LLMs, achieving new SoTA of $3 5 . 0 \%$ pass $@ 1$ and $5 4 . 5 \%$ pass $@ 1 0$ . Particularly, as an open model, it even outperforms the OpenAI code-cushman-001 model across all metrics. We also observed that our smallsized models of 220M and 770M already match or outperform much larger code LLMs, e.g., CodeT $^ { 5 + }$ 770M’s $1 5 . 5 \%$ pass $@ 1$ compared to Incoder 6B’s $1 5 . 2 \%$ , GPT-NeoX 20B’s $1 5 . 4 \%$ , and PaLM 62B’s $1 5 . 9 \%$ . Besides, we observed that compared to the CodeGen models of similar sizes (Nijkamp et al., 2023b), CodeT $^ { 5 + }$ obtains consistent performance gains from 2B to 16B models. These superior results against decoder-only baselines demonstrate the advantage of the encoder-decoder architecture of ${ \mathrm { C o d e T } } 5 +$ and validate the effectiveness of our proposed compute-efficient pretraining strategy. We also evaluated the models with enhancement strategies following CodeT Chen et al. (2023). We find that this strategy can select better code candidates and bring the performance gains, achieving up to $4 2 . 9 \%$ pass $@ 1$ and $6 7 . 8 \%$ pass $@ 1 0$ .
+
+# 5.2 Evaluation on Math Programming
+
+We consider two math programming benchmarks MathQA-Python (Austin et al., 2021) and GSM8K (Cobbe et al., 2021). The task is to generate Python programs to solve mathematical problems described in texts, where code correctness is measured based on the execution outputs of the generated programs $\left( \mathrm { p a s s } @ \mathbf { k } \right)$ . We compare our models with very large decoder-only LMs such as Minerva (Lewkowycz et al., 2022) that is initialized with pretrained PaLM (Chowdhery et al., 2022) and further finetuned with large-scale scientific corpora. Note that some of the baselines are enhanced with generation strategies, such as GPTNeo using self-sampling optimization (Ni et al., 2022), and LLaMA and Minerva using majority voting (Lewkowycz et al., 2022).
+
+
+Figure 4: Results of MathQA-Python by problem complexity (i.e. the number of reasoning steps required).
+
+Table 2 shows that ${ \mathrm { C o d e T } } 5 +$ achieves significant performance gains, outperforming many code LLMs of much larger sizes. Specifically, our CodeT $^ { 5 + }$ 770M achieves new SoTA results of 87.4 pass $@ 8 0$ on MathQA-Python and very competitive results of $7 3 . 8 \ p a \ s s \textcircled { a } 1 0 0$ on GSM8K-Python. On GSM8K-Python, $\mathrm { C o d e T 5 + 7 7 0 M }$ achieves the best finetuning results against other larger models (e.g., LaMDA 137B and GPT-Neo 2.7B), and outperforms LLaMA 65B and Minerva 62B in the few-shot evaluation setting. In Fig. 4, we further analyze the model performance of ${ \mathrm { C o d e T } } 5 +$ by the problem complexity on MathQA-Python compared to CodeT5. For each problem, we extract the number of reasoning steps required to solve the problem. We observe that ${ \mathrm { C o d e T } } 5 +$ is more robust against the complexity of the problems compared to CodeT5, where CodeT5 model performance tends to deteriorate drastically as the number of reasoning steps increases. In CodeT $^ { 5 + }$ , the downward trend is a lot less severe and the model still achieves good results in very complex tasks (more than 10 steps).
+
+# 5.3 Evaluation on Code Completion
+
+We evaluate the decoder-only generation capability of ${ \mathrm { C o d e T } } 5 +$ through a line-level code completion task, which aims to complete the next code line based on the previous code contexts. We employ PY150 (Raychev et al., 2016) and JavaCorpus (Allamanis and Sutton, 2013) from CodeXGLUE, and use exact match (EM) accuracy and Levenshtein edit similarity (Svyatkovskiy et al., 2020) as the metrics. In this task, we employ a decoder-only model from CodeT $^ { 5 + }$ so that only about half of the total model parameters are activated.
+
+Table 3: Results on line-level code completion.
+
+
Model
PY150
JavaCorpus
EM 42.37
Edit Sim
EM
Edit Sim
CodeGPT124M
71.59
30.60
63.45
UniXcoder 125M
43.12
72.00
32.90
65.78
CodeGen-multi 350M
42.47
70.67
35.47
69.22
PLBART140M
38.01
68.46
26.97
61.59
CodeT5 220M
36.97
67.12
24.80
58.31
CodeT5+220M
43.42
73.69
35.17
69.48
CodeT5+770M
44.86
74.22
37.90
72.25
+
+Table 4: Results of MRR on Text-to-Code Retrieval.
+
+
Model
CodeSearchNet
CosQA
AdvTest
Ruby
JS
Go
Python
Java
PHP
Overall
CodeBERT125M
67.9
62.0
88.2
67.2
67.6
62.8
69.3
65.7
27.2
GraphCodeBERT 125M
70.3
64.4
89.7
69.2
69.1
64.9
71.3
68.4
35.2
SYNCOBERT 125M
72.2
67.7
91.3
72.4
72.3
67.8
74.0
:
38.3
UniXcoder 125M
74.0
68.4
91.5
72.0
72.6
67.6
74.4
70.1
41.3
CodeGen-multi 350M
66.0
62.2
90.0
68.6
70.1
63.9
70.1
64.8
34.8
PLBART140M
67.5
61.6
88.7
66.3
66.3
61.1
68.6
65.0
34.7
CodeT5 220M
71.9
65.5
88.8
69.8
68.6
64.5
71.5
67.8
39.3
CodeT5+220M
77.7
70.8
92.4
75.6
76.1
69.8
77.1
72.7
43.3
CodeT5+ 770M
78.0
71.3
92.7
75.8
76.2
70.1
77.4
74.0
44.7
+
+Table 3 shows that both CodeT $5 +$ (in decoderonly mode) and decoder-only models (the top block) significantly outperform encoder-decoder models (the middle block), validating that decoderonly models can better suit the code completion task in nature. Specifically, $\mathbf { C o d e T 5 + } \mathbf { \ } 2 2 0 \mathbf { M }$ already surpasses UniXcoder and is comparable to CodeGen-multi 350M, while the 770M one further sets new SoTA results in both metrics. In particular, CodeT5+ 220M yields substantial improvements over CodeT5 220M by $+ 6 . 5$ EM and $+ 1 0 . 4$ EM scores on PY150 and JavaCorpus respectively. This is mainly due to our causal LM objectives that allows the decoder to see longer sequences and thus have a better causal generation capability.
+
+# 5.4 Evaluation on Text-to-Code Retrieval
+
+We evaluate the code understanding capabilities of CodeT5+ through text-to-code retrieval tasks across multiple PLs. This task aims to find the most semantically related code snippet at the function level from a collection of candidate codes based on a natural language query. We consider three datasets for evaluation: CodeSearchNet (Husain et al., 2019), CosQA (Huang et al., 2021), and AdvTest (Lu et al., 2021), which are curated from the original CodeSearchNet by filtering data with lowquality queries, adopting real-world queries from a modern search engine, and obfuscating identifiers to normalize the code. In this task, we activate both encoder and decoder of ${ \mathrm { C o d e T } } 5 +$ and use Mean Reciprocal Rank (MRR) as the evaluation metric.
+
+Table 5: Ablation results of Code $\mathrm { T } 5 +$ : a) no causal LM objective during stage-1 pretraining, b) no matching or causal LM objective during stage-2 pretraining.
+
+
Model
Code Completion
Math Programming
PY150 EM
JavaCorpus EM
MathQA-PY pass@80
GSM8K-PY pass @100
CodeT5+770M
44.9
37.9
87.4
73.8
a) no causal LM
36.2
24.8
72.3
61.4
+
+
Model
Text-to-code Retrieval
Ruby
JS
Go
Python
Java
PHP
Overall
CodeT5+770M
78.0
71.3
92.7
75.8
76.2
70.1
77.4
no matching b) no causal LM
76.2
68.5
91.2
72.8
73.6
66.3
74.8
77.3
70.6
92.4
75.7
75.6
68.9
76.8
+
+From Table 4, our CodeT $^ { 5 + }$ 220M significantly outperforms all existing encoder-only/decoder-only (the top block) and encoder-decoder models (the middle block). Our CodeT $5 +$ 770M further sets new SoTA results, surpassing the previous SoTA UniXcoder by more than 3 MRR points on all 3 tasks across 8 datasets. This implies CodeT $^ { 5 + }$ is a robust code retriever to handle queries with diverse formats and PLs. Besides, Code $\mathrm { T } 5 + 2 2 0 \mathrm { M }$ yields substantial performance gains over CodeT5 220M, which can be attributed to the text-code contrastive learning and matching objectives that facilitate better unimodal and bimodal representation learning.
+
+# 5.5 Ablation Study
+
+We conduct an ablation study to analyze the impacts of our proposed pretraining objectives: a) casual LM objectives at stage-1 unimodal pretraining on two generative tasks including code completion and math programming, b) text-code matching and causal LM objectives at stage-2 bimodal pretraining on an understanding task of text-to-code retrieval. We employ $\mathrm { C o d e T } 5 + 7 7 0 \mathrm { M }$ and report the results of three representative tasks over 10 datasets in Table 5. In CodeT5+, we found that causal LM objective plays a crucial role in code completion and math programming tasks, observed by a significant performance drop after removing it. This indicates causal LM can complement the span denoising objective and improve the generation capability of our models. Additionally, we found that the text-code matching objective is critical to the retrieval performance (a drop of 2.6 avg. MRR over 6 datasets without it), implying this objective can learn a better bimodal representation that captures the fine-grained alignment between text and code. Besides, we found that retrieval tasks can also benefit from the joint training with causal LM objective despite their task differences.
+
+Table 6: Results of retrieval-augmented code generation. EM: Exact Match, B4: BLEU-4, CB: CodeBLEU.
+
+
Model
Java
Python
EM
B4
CB
EM
B4
CB
Retrieval-based
BM25
0.00
4.90
16.00
0.00
6.63
13.49
SCODE-R 125M
0.00
25.34
26.68
0.00
22.75
23.92
CodeT5+ 220M
0.00
28.74
31.00
0.00
27.30
26.51
Generative
CodeBERT125M
0.00
8.38
14.52
0.00
4.06
10.42
GraphCodeBERT 125M
0.00
7.86
14.53
0.00
3.97
10.55
PLBART140M
0.00
10.10
14.96
0.00
4.89
12.01
CodeT5+ 220M
0.00
10.33
20.54
0.00
4.40
13.88
Retrieval-Augmented Generative
REDCODER-EXT125M+140M
10.21
28.98
33.18
9.61
24.43
30.21
CodeT5+ 220M
11.66
33.83
40.60
11.83
31.14
36.39
+
+# 5.6 Unified Retrieval-Augmented Generation
+
+As our model is capable of both code retrieval and generation, it can be naturally exploited as a unified retrieval-augmented generator. To explore this adaptation, we follow Parvez et al. (2021) to evaluate two code generation tasks on Java and Python. We evaluate our models in 3 settings: retrievalbased, generative, and retrieval-augmented (RA) generative. For the retrieval-based setting, we activate our encoder to retrieve the top-1 code sample as the prediction given a text query, while for the RA generative setting, we append the combination of top- $k$ retrieved samples $k { = } 1$ in our work) to the encoder input and activate the decoder. As shown in Table 6, we found that our CodeT $^ { 5 + }$ achieves better results in all categories, especially in the retrieval-based and RA generative setting. While the previous SoTA model REDCODER-EXT (Parvez et al., 2021) separately employs GraphCodeBERT as the retriever and PLBART as the generator, our model can be seamlessly deployed as a unified end-to-end system with both retrieval and generation capabilities.
+
+# 6 Conclusion
+
+We propose CodeT $^ { 5 + }$ , a new family of open code LLMs with a dynamic architecture that can flexibly operate in different modes (encoder-only, decoderonly, and encoder-decoder) to support a wide range of code understanding and generation tasks. To train CodeT $^ { 5 + }$ , we introduce a mixture of pretraining tasks to learn rich representations from both unimodal code data and bimodal code-text data. Additionally, it achieves efficient model scaling and better task generalization through integration with frozen LLMs and instruction tuning. Extensive experiments on over 20 code intelligence benchmarks have verified the superiority of our models.
+
+# Limitations
+
+As a family of Transformer LLMs, CodeT5+ requires sufficient pretraining/finetuning data to be able to learn meaningful contextual representations from code. While we could curate these data from public domains such as GitHub, thorough data filtering and preprocessing steps are needed to obtain a good level of data quality for pretraining. During instruction finetuning, a well designed pipeline is needed to obtain high quality instruction-following data, either through manual annotation effort or synthetic data augmentation from other LLMs (e.g. OpenAI GPT models). Moreover, the level of the diversity and quality of data needed to train these types of models is still an open question. Recent attempts such as (Zhou et al., 2023) have highlighted the importance of data quality vs. data scale to efficiently train LLMs while keeping the cost of handling data affordable.
+
+Another limitation of ${ \mathrm { C o d e T } } 5 +$ is the requirement of large GPU resources. With model sizes up to billion parameters, to handle these models efficiently requires access to GPUs during either training and inference time. Specifically, we found that fitting a 16B model into a single A100 GPU requires additional model serving/loading techniques to keep the system memory consumption acceptable. While GPU resources have become more and more accessible to the wider community of practitioners, the cost of training/testing LLMs on large-scale data can accumulate and become too expensive to many individuals.
+
+promoting responsible and ethical use of large language models for code.
+
+Additionally, it is essential to recognize the broader intellectual property implications of code generation and retrieval systems before deployment. Deep learning models generating code may inadvertently introduce security vulnerabilities. To mitigate this risk, it is crucial to conduct expert reviews and rigorous security assessments before adopting such code. This review process ensures that the generated code meets necessary security standards, safeguarding against potential exploits and vulnerabilities. In code retrieval scenarios, providing appropriate attribution to the source along with the retrieved results is paramount. This attribution not only respects the rights of code authors but also enhances transparency, traceability, and collaboration within the programming community. By acknowledging the original authors and promoting a collaborative, ethical, and legally compliant environment, code retrieval systems can foster knowledge sharing and contribute to a reputable programming ecosystem.
+
+By considering these ethical considerations, we can promote the responsible deployment of large language models for code, maximizing their potential benefits while mitigating potential harms to individuals, communities, and the overall software ecosystem. It is imperative to prioritize safety, nontoxicity, intellectual property rights, security, and collaboration in the development and deployment of these systems, ensuring they align with ethical principles and societal needs.
+
+# Ethics Statement
+
+Advancements in code understanding and generation systems hold immense potential to create positive societal impacts by improving programming accessibility and enhancing developer productivity through natural language interfaces. However, deploying such systems at scale requires careful consideration of various ethical aspects, as extensively discussed by Chen et al. (2021).
+
+One critical concern is the potential risk of generated code summaries or comments incorporating toxic or insensitive language, which can have detrimental effects. Several studies have explored techniques to address this issue, such as reinforcement learning (Ouyang et al., 2022), weighted decoding (Krause et al., 2021) , and safety-specific control tokens (Xu et al., 2020). These approaches aim to ensure non-toxic natural language generation,
+
+# References
+
+Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray, and Kai-Wei Chang. 2021. Unified pre-training for program understanding and generation. In NAACLHLT, pages 2655–2668. Association for Computational Linguistics.
+
+Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katherine Millican, Malcolm Reynolds, Roman Ring, Eliza Rutherford, Serkan Cabi, Tengda Han, Zhitao Gong, Sina Samangooei, Marianne Monteiro, Jacob L. Menick, Sebastian Borgeaud, Andy Brock, Aida Nematzadeh, Sahand Sharifzadeh, Mikolaj Binkowski, Ricardo Barreira, Oriol Vinyals, Andrew Zisserman, and Karén Simonyan. 2022. Flamingo: a visual language model for few-shot learning. In NeurIPS.
+
+Miltiadis Allamanis and Charles Sutton. 2013. Mining source code repositories at massive scale using language modeling. In MSR, pages 207–216. IEEE Computer Society.
+
+Aida Amini, Saadia Gabriel, Shanchuan Lin, Rik Koncel-Kedziorski, Yejin Choi, and Hannaneh Hajishirzi. 2019. MathQA: Towards interpretable math word problem solving with operation-based formalisms. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 2357–2367, Minneapolis, Minnesota. Association for Computational Linguistics.
+
+Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, et al. 2021. Program synthesis with large language models. arXiv preprint arXiv:2108.07732.
+
+Sid Black, Stella Biderman, Eric Hallahan, Quentin Anthony, Leo Gao, Laurence Golding, Horace He, Connor Leahy, Kyle McDonell, Jason Phang, Michael Pieler, USVSN Sai Prashanth, Shivanshu Purohit, Laria Reynolds, Jonathan Tow, Ben Wang, and Samuel Weinbach. 2022. GPT-NeoX-20B: An opensource autoregressive language model. In Proceedings of the ACL Workshop on Challenges & Perspectives in Creating Large Language Models.
+
+Sahil Chaudhary. 2023. Code alpaca: An instructionfollowing llama model for code generation. https: //github.com/sahil280114/codealpaca.
+
+Bei Chen, Fengji Zhang, Anh Nguyen, Daoguang Zan, Zeqi Lin, Jian-Guang Lou, and Weizhu Chen. 2023. Codet: Code generation with generated tests. In The Eleventh International Conference on Learning Representations.
+
+Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al. 2021. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374.
+
+Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek Rao, Parker Barnes, Yi Tay, Noam Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Ben Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier Garcia, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee,
+
+Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Diaz, Orhan Firat, Michele Catasta, Jason Wei, Kathy Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. 2022. Palm: Scaling language modeling with pathways. CoRR, abs/2204.02311.
+
+Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. 2021. Training verifiers to solve math word problems. CoRR, abs/2110.14168.
+
+Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pages 4171–4186.
+
+Li Dong, Nan Yang, Wenhui Wang, Furu Wei, Xiaodong Liu, Yu Wang, Jianfeng Gao, Ming Zhou, and Hsiao-Wuen Hon. 2019. Unified language model pre-training for natural language understanding and generation. In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pages 13042–13054.
+
+Zhangyin Feng, Daya Guo, Duyu Tang, Nan Duan, Xiaocheng Feng, Ming Gong, Linjun Shou, Bing Qin, Ting Liu, Daxin Jiang, and Ming Zhou. 2020. Codebert: A pre-trained model for programming and natural languages. In EMNLP (Findings), volume EMNLP 2020 of Findings of ACL, pages 1536–1547. Association for Computational Linguistics.
+
+Daniel Fried, Armen Aghajanyan, Jessy Lin, Sida Wang, Eric Wallace, Freda Shi, Ruiqi Zhong, Wen-tau Yih, Luke Zettlemoyer, and Mike Lewis. 2022. Incoder: A generative model for code infilling and synthesis. CoRR, abs/2204.05999.
+
+Daya Guo, Shuai Lu, Nan Duan, Yanlin Wang, Ming Zhou, and Jian Yin. 2022. Unixcoder: Unified crossmodal pre-training for code representation. In $A C L$ (1), pages 7212–7225. Association for Computational Linguistics.
+
+Daya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng, Duyu Tang, Shujie Liu, Long Zhou, Nan Duan, Alexey Svyatkovskiy, Shengyu Fu, Michele Tufano, Shao Kun Deng, Colin B. Clement, Dawn Drain, Neel Sundaresan, Jian Yin, Daxin Jiang, and Ming Zhou. 2021. Graphcodebert: Pre-training code representations with data flow. In ICLR. OpenReview.net.
+
+Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross B. Girshick. 2020. Momentum contrast for unsupervised visual representation learning. In CVPR, pages 9726–9735. Computer Vision Foundation / IEEE.
+
+Dan Hendrycks, Steven Basart, Saurav Kadavath, Mantas Mazeika, Akul Arora, Ethan Guo, Collin Burns, Samir Puranik, Horace He, Dawn Song, and Jacob Steinhardt. 2021. Measuring coding challenge competence with apps. NeurIPS.
+
+Junjie Huang, Duyu Tang, Linjun Shou, Ming Gong, Ke Xu, Daxin Jiang, Ming Zhou, and Nan Duan. 2021. Cosqa: 20, $0 0 0 +$ web queries for code search and question answering. In ACL/IJCNLP (1), pages 5690–5700. Association for Computational Linguistics.
+
+Hamel Husain, Ho-Hsiang Wu, Tiferet Gazit, Miltiadis Allamanis, and Marc Brockschmidt. 2019. Codesearchnet challenge: Evaluating the state of semantic code search. CoRR, abs/1909.09436.
+
+Jeff Johnson, Matthijs Douze, and Hervé Jégou. 2019. Billion-scale similarity search with GPUs. IEEE Transactions on Big Data, 7(3):535–547.
+
+Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick S. H. Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. 2020. Dense passage retrieval for open-domain question answering. In EMNLP (1), pages 6769–6781. Association for Computational Linguistics.
+
+Ben Krause, Akhilesh Deepak Gotmare, Bryan McCann, Nitish Shirish Keskar, Shafiq Joty, Richard Socher, and Nazneen Fatema Rajani. 2021. GeDi: Generative discriminator guided sequence generation. In Findings of the Association for Computational Linguistics: EMNLP 2021, pages 4929–4952, Punta Cana, Dominican Republic. Association for Computational Linguistics.
+
+Hung Le, Yue Wang, Akhilesh Deepak Gotmare, Silvio Savarese, and Steven C. H. Hoi. 2022. Coderl: Mastering code generation through pretrained models and deep reinforcement learning. In NeurIPS.
+
+Aitor Lewkowycz, Anders Johan Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Venkatesh Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, Yuhuai Wu, Behnam Neyshabur, Guy Gur-Ari, and Vedant Misra. 2022. Solving quantitative reasoning problems with language models. In Advances in Neural Information Processing Systems.
+
+Junnan Li, Dongxu Li, Caiming Xiong, and Steven C. H. Hoi. 2022a. BLIP: bootstrapping languageimage pre-training for unified vision-language understanding and generation. In ICML, volume 162 of Proceedings of Machine Learning Research, pages 12888–12900. PMLR.
+
+Junnan Li, Ramprasaath R. Selvaraju, Akhilesh Gotmare, Shafiq R. Joty, Caiming Xiong, and Steven Chu-Hong Hoi. 2021. Align before fuse: Vision and language representation learning with momentum distillation. In NeurIPS, pages 9694–9705.
+
+aymond Li, Loubna Ben Allal, Yangtian Zi, Niklas Muennighoff, Denis Kocetkov, Chenghao Mou, Marc Marone, Christopher Akiki, Jia Li, Jenny Chim, Qian Liu, Evgenii Zheltonozhskii, Terry Yue Zhuo, Thomas Wang, Olivier Dehaene, Mishig Davaadorj, Joel Lamy-Poirier, João Monteiro, Oleh Shliazhko, Nicolas Gontier, Nicholas Meade, Armel Zebaze, Ming-Ho Yee, Logesh Kumar Umapathi, Jian Zhu, Benjamin Lipkin, Muhtasham Oblokulov, Zhiruo Wang, Rudra Murthy V, Jason Stillerman, Siva Sankalp Patel, Dmitry Abulkhanov, Marco Zocca, Manan Dey, Zhihan Zhang, Nour Fahmy, Urvashi Bhattacharyya, Wenhao Yu, Swayam Singh, Sasha Luccioni, Paulo Villegas, Maxim Kunakov, Fedor Zhdanov, Manuel Romero, Tony Lee, Nadav Timor, Jennifer Ding, Claire Schlesinger, Hailey Schoelkopf, Jan Ebert, Tri Dao, Mayank Mishra, Alex Gu, Jennifer Robinson, Carolyn Jane Anderson, Brendan Dolan-Gavitt, Danish Contractor, Siva Reddy, Daniel Fried, Dzmitry Bahdanau, Yacine Jernite, Carlos Muñoz Ferrandis, Sean Hughes, Thomas Wolf, Arjun Guha, Leandro von Werra, and Harm de Vries. 2023. Starcoder: may the source be with you! CoRR, abs/2305.06161.
+
+Yujia Li, David H. Choi, Junyoung Chung, Nate Kushman, Julian Schrittwieser, Rémi Leblond, Tom Eccles, James Keeling, Felix Gimeno, Agustin Dal Lago, Thomas Hubert, Peter Choy, Cyprien de Masson d’Autume, Igor Babuschkin, Xinyun Chen, PoSen Huang, Johannes Welbl, Sven Gowal, Alexey Cherepanov, James Molloy, Daniel J. Mankowitz, Esme Sutherland Robson, Pushmeet Kohli, Nando de Freitas, Koray Kavukcuoglu, and Oriol Vinyals. 2022b. Competition-level code generation with alphacode. CoRR, abs/2203.07814.
+
+Chin-Yew Lin and Franz Josef Och. 2004. ORANGE: a method for evaluating automatic evaluation metrics for machine translation. In COLING.
+
+Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized BERT pretraining approach. CoRR, abs/1907.11692.
+
+Ilya Loshchilov and Frank Hutter. 2019. Decoupled weight decay regularization. In ICLR (Poster). OpenReview.net.
+
+Shuai Lu, Daya Guo, Shuo Ren, Junjie Huang, Alexey Svyatkovskiy, Ambrosio Blanco, Colin B. Clement, Dawn Drain, Daxin Jiang, Duyu Tang, Ge Li, Lidong Zhou, Linjun Shou, Long Zhou, Michele Tufano, Ming Gong, Ming Zhou, Nan Duan, Neel Sundaresan, Shao Kun Deng, Shengyu Fu, and Shujie Liu. 2021. Codexglue: A machine learning benchmark dataset for code understanding and generation. In NeurIPS Datasets and Benchmarks.
+
+Anh Nguyen, Nikos Karampatziakis, and Weizhu Chen. 2023. Meet in the middle: A new pre-training paradigm. arXiv preprint arXiv:2303.07295.
+
+Ansong Ni, Jeevana Priya Inala, Chenglong Wang, Oleksandr Polozov, Christopher Meek, Dragomir R. Radev, and Jianfeng Gao. 2022. Learning from self-sampled correct and partially-correct programs. CoRR, abs/2205.14318.
+
+Erik Nijkamp, Hiroaki Hayashi, Caiming Xiong, Silvio Savarese, and Yingbo Zhou. 2023a. Codegen2: Lessons for training llms on programming and natural languages. arXiv preprint.
+
+Erik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu, Huan Wang, Yingbo Zhou, Silvio Savarese, and Caiming Xiong. 2023b. Codegen: An open large language model for code with multi-turn program synthesis. In The Eleventh International Conference on Learning Representations.
+
+OpenAI. 2023. Gpt-4 technical report. ArXiv, abs/2303.08774.
+
+Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Gray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. 2022. Training language models to follow instructions with human feedback. In Advances in Neural Information Processing Systems.
+
+Md. Rizwan Parvez, Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray, and Kai-Wei Chang. 2021. Retrieval augmented code generation and summarization. In EMNLP (Findings), pages 2719–2734. Association for Computational Linguistics.
+
+Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. 2019. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9.
+
+Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 21:140:1–140:67.
+
+Jeff Rasley, Samyam Rajbhandari, Olatunji Ruwase, and Yuxiong He. 2020. Deepspeed: System optimizations enable training deep learning models with over 100 billion parameters. In KDD, pages 3505– 3506. ACM.
+
+Veselin Raychev, Pavol Bielik, and Martin T. Vechev. 2016. Probabilistic model for code with decision trees. In OOPSLA, pages 731–747. ACM.
+
+replit. 2023. replit-code-v1-3b.
+
+Saleh Soltan, Shankar Ananthakrishnan, Jack FitzGerald, Rahul Gupta, Wael Hamza, Haidar Khan, Charith Peris, Stephen Rawls, Andy Rosenbaum, Anna Rumshisky, Chandana Satya Prakash, Mukund Sridhar, Fabian Triefenbach, Apurv Verma, Gökhan Tür, and Prem Natarajan. 2022. Alexatm 20b: Few-shot learning using a large-scale multilingual seq2seq model. CoRR, abs/2208.01448.
+
+Jeffrey Svajlenko, Judith F Islam, Iman Keivanloo, Chanchal K Roy, and Mohammad Mamun Mia. 2014. Towards a big data curated benchmark of inter-project code clones. In 2014 IEEE International Conference on Software Maintenance and Evolution, pages 476– 480. IEEE.
+
+Alexey Svyatkovskiy, Shao Kun Deng, Shengyu Fu, and Neel Sundaresan. 2020. Intellicode compose: code generation using transformer. In ESEC/SIGSOFT FSE, pages 1433–1443. ACM.
+
+M Tabachnyk and S Nikolov. 2022. Ml-enhanced code completion improves developer productivity.
+
+Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. 2023. Stanford alpaca: An instruction-following llama model. https:// github.com/tatsu-lab/stanford_alpaca.
+
+Yi Tay, Mostafa Dehghani, Vinh Q. Tran, Xavier Garcia, Dara Bahri, Tal Schuster, Huaixiu Steven Zheng, Neil Houlsby, and Donald Metzler. 2022. Unifying language learning paradigms. CoRR, abs/2205.05131.
+
+Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. 2023. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971.
+
+Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. Advances in neural information processing systems, 30.
+
+Ben Wang and Aran Komatsuzaki. 2021. GPT-J6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/ mesh-transformer-jax.
+
+Weishi Wang, Yue Wang, Shafiq Joty, and Steven C. H. Hoi. 2023. Rap-gen: Retrieval-augmented patch generation with codet5 for automatic program repair. CoRR, abs/2309.06057.
+
+Xin Wang, Yasheng Wang, Fei Mi, Pingyi Zhou, Yao Wan, Xiao Liu, Li Li, Hao Wu, Jin Liu, and Xin Jiang. 2021a. Syncobert: Syntax-guided multi-modal contrastive pre-training for code representation. arXiv preprint arXiv:2108.04556.
+
+Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. 2022. Self-instruct: Aligning language model with self generated instructions. arXiv preprint arXiv:2212.10560.
+
+Yue Wang, Weishi Wang, Shafiq R. Joty, and Steven C. H. Hoi. 2021b. Codet5: Identifier-aware unified pre-trained encoder-decoder models for code understanding and generation. In EMNLP (1), pages 8696– 8708. Association for Computational Linguistics.
+
+Jing Xu, Da Ju, Margaret Li, Y-Lan Boureau, Jason Weston, and Emily Dinan. 2020. Recipes for safety in open-domain chatbots. arXiv preprint arXiv:2010.07079.
+
+Qinkai Zheng, Xiao Xia, Xu Zou, Yuxiao Dong, Shan Wang, Yufei Xue, Zihan Wang, Lei Shen, Andi Wang, Yang Li, Teng Su, Zhilin Yang, and Jie Tang. 2023. Codegeex: A pre-trained model for code generation with multilingual evaluations on humaneval- $\mathbf { \nabla } \cdot \mathbf { X }$ .
+
+Chunting Zhou, Pengfei Liu, Puxin Xu, Srini Iyer, Jiao Sun, Yuning Mao, Xuezhe Ma, Avia Efrat, Ping Yu, Lili Yu, et al. 2023. Lima: Less is more for alignment. arXiv preprint arXiv:2305.11206.
+
+Yaqin Zhou, Shangqing Liu, Jingkai Siow, Xiaoning Du, and Yang Liu. 2019. Devign: Effective vulnerability identification by learning comprehensive program semantics via graph neural networks. Advances in neural information processing systems, 32.
+
+# A Bimodal Pretraining Details
+
+To expose the model on more diverse set of pretraining data, we employ a stage-wise pretraining process to first train CodeT $^ { 5 + }$ on large-scale codeonly data with span denoising and causal language modeling (CLM) tasks, then train on smaller set of text-code bimodel data using text-code contrastive learning, matching, and causal LM tasks. Below, we provide detailed formulas for text-code contrastive learning and matching tasks at the secondstage pretraining on text-code pairs.
+
+Text-Code Contrastive Learning activates the encoder to learn better unimodal (text/code) representations by computing a similarity score such that parallel text-code pairs have higher scores. Given a text $\mathrm { T }$ and a code C, we first learn representations $\mathbf { h } ^ { t }$ for text $T$ and $\mathbf { h } ^ { c }$ for code $C$ by mapping the [CLS] embeddings to normalized lowerdimensional (256-d) representations from the encoder. Given a tain text vectors $\{ \mathbf { h } ^ { t } \} _ { i = 1 } ^ { N }$ $N$ text-code paird code vectors $\{ \mathbf { h } ^ { c } \} _ { i = 1 } ^ { N }$ to compute text-to-code and code-to-text and similarities:
+
+$$
+s _ { i , j } ^ { t 2 c } = \mathbf { h } _ { i } ^ { t \top } \mathbf { h } _ { j } ^ { c } , s _ { i , j } ^ { c 2 t } = \mathbf { h } _ { i } ^ { c \top } \mathbf { h } _ { j } ^ { t }
+$$
+
+$$
+p _ { i } ^ { t 2 c } ( T ) = \frac { \exp { ( s _ { i , i } ^ { t 2 c } / \tau ) } } { \sum _ { j = 1 } ^ { N } \exp { ( s _ { i , j } ^ { t 2 c } / \tau ) } } ,
+$$
+
+Table 7: Data statistics of both unimodal and bimodal (CodeSearchNet) pretraining data.
+
+
+
+$$
+p _ { i } ^ { c 2 t } ( C ) = \frac { \exp { ( s _ { i , i } ^ { c 2 t } / \tau ) } } { \sum _ { j = 1 } ^ { N } \exp { ( s _ { i , j } ^ { c 2 t } / \tau ) } }
+$$
+
+where $s _ { i , j } ^ { t 2 c }$ represents text-to-code similarity of text of $i$ -th pair and code of $j$ -th pair, and $s _ { i , j } ^ { c 2 t }$ is the code-to-text similarity, $\tau$ is learned temperature parameter. $p _ { i } ^ { t 2 c } ( T )$ and $p _ { i } ^ { c 2 t } ( C )$ are the softmaxnormalized text-to-code and code-to-text similarities for the $i$ -th text and code.
+
+Let $\mathbf { y } ^ { t 2 c } ( T )$ and $\mathbf { y } ^ { c 2 t } ( C )$ denote the groundtruth one-hot similarity, where negative pairs have a probability of 0 and the positive pair has a probability of 1. The text-code contrastive loss from a corpus $D$ of text-code pairs is defined as the crossentropy $_ \mathrm { H }$ between $\mathbf { p }$ and $\mathbf { y }$ :
+
+$$
+\begin{array} { r } { \mathcal { L } _ { t c c } = \displaystyle \frac { 1 } { 2 } \mathbb { E } _ { ( T , C ) \sim D } [ H ( \mathbf { y } ^ { t 2 c } ( T ) , \mathbf { p } ^ { t 2 c } ( T ) ) + } \\ { H ( \mathbf { y } ^ { c 2 t } ( C ) , \mathbf { p } ^ { c 2 t } ( C ) ) ] } \end{array}
+$$
+
+Text-Code Matching activates the decoder with the bimodal matching functionality to predict whether a pair of text and code is positive (matched) or negative (unmatched). We employ the output embedding of the [EOS] token as the fused bimodal representation for a text-code pair $( T , C )$ , as this token attends to all the previous context for the text-code pair input. Followed by a linear layer and softmax, we compute a two-class probability $p ^ { t c m } ( T , C )$ and define the matching loss:
+
+$$
+\mathcal { L } _ { t c m } = \mathbb { E } _ { ( T , C ) \sim D } [ H ( \mathbf { y } ^ { t c m } ( T , C ) , \mathbf { p } ^ { t c m } ( T , C ) ) ]
+$$
+
+where $\mathbf { y } ^ { t c m } ( T , C )$ is a 2-dimensional one-hot vector representing the ground-truth label.
+
+
+Figure 5: Example generated instruction data: we demonstrate some examples of instruction data used to finetune CodeT $^ { 5 + }$ to better align our models to natural language instructions. The instruction corpus contains novel tasks, such as text-to-SQL generation and Python code optimization.
+
+Text-Code Causal LM. This task focuses on a cross-modal causal LM objective between text and code through a dual multimodal conversion: textto-code generation and code-to-text generation (i.e. code summarization). Let $\mathcal { L } _ { t 2 c }$ and $\mathcal { L } _ { c 2 t }$ denote the losses for text-to-code and code-to-text generation. The full second-stage pretraining loss of our CodeT $5 +$ is:
+
+$$
+\mathcal { L } = \mathcal { L } _ { t c c } + \mathcal { L } _ { t c m } + \mathcal { L } _ { t 2 c } + \mathcal { L } _ { c 2 t }
+$$
+
+# B Pretraining
+
+# B.1 Pretraining Dataset
+
+We report the data statistics of both unimodal code and bimodal text-code pretraining datasets in Table 7. From the table, we can see that our curated dataset from GitHub code has a much larger data size at the file level than the CodeSearchNet bimodal data at the function level, allowing our model to learn rich representations in the first stage of pretraining. Different from CodeT5 (Wang et al., 2021b) which employs both unimodal and bimodal data in CodeSearchNet (Husain et al., 2019), we only employ its bimodal subset for the second stage pretraining of our CodeT5+. We use this stage to mainly adapt our model to text-code related tasks like text-to-code retrieval and generation.
+
+# B.2 Pretraining Setup
+
+In pretraining, we adopt a stage-wise strategy to pretrain CodeT $^ { 5 + }$ first on the large-scale unimodal dataset and then on the smaller bimodal dataset. In the first stage, we warm up the model with the span denoising task for $1 0 k$ training steps, and then joint training with the two CLM tasks with equal weights for $1 0 0 k$ steps. We employ a linear decay learning rate (LR) scheduler with a peak learning rate of 2e4 and set the batch size to 2048 for denoising and 512 for CLM. To prepare the input and output data, we set the maximum length to 512 for the denoising task, and set the maximum lengths to 768 and 600 for source and target sequences for the code completion CLM, 1 and 1024 for the decoder-only generation CLM. In the second stage, we jointly optimize four losses of contrastive learning, matching, and two CLM losses with equal weights for 10 epochs with a batch size of 256. We employ a peak learning rate of 1e-4 and set the maximum sequence lengths to 420 and 128 for code and text.
+
+In all experiments, we employ an AdamW optimizer (Loshchilov and Hutter, 2019) with a 0.1 weight decay. We also employ the DeepSpeed’s ZeRO Stage 2 (Rasley et al., 2020) with mixed precision training of FP16 for training acceleration. For the training of CodeT $5 +$ 2B, 6B, and 16B, we use FP16 frozen decoder weights and keep other trainable weights in FP32. We use DeepSpeed ZeRO Stage 3’s parameter partition for CodeT5 $\mid +$ 6B and 16B models.
+
+# C Instruction Tuning
+
+Fig. 5 illustrates some examples of the generated instruction data. Note that as we rely on LMgenerated data, including the annotations of expected outputs, not all of the data is perfectly correct. For instance, the example of the code optimization task in Fig. 5 contains a wrong output. Wang et al. (2022) treated these examples as data noise and the tuned models still benefit from the majority of the synthetic instruction dataset.
+
+Table 8: Results of BLEU-4 on code summarization.
+
+
Model
Ruby
JS
Go
Python
Java
PHP
Overall
RoBERTa125M
11.17
11.90
17.72
18.14
16.47
24.02
16.57
CodeBERT125M
12.16
14.90
18.07
19.06
17.65
25.16
17.83
UniXcoder 125M
14.87
15.85
19.07
19.13
20.31
26.54
19.30
CodeGen-multi 350M
13.48
16.54
18.09
18.31
19.41
24.41
18.37
PLBART140M
14.11
15.56
18.91
19.30
18.45
23.58
18.32
CodeT5220M
15.24
16.16
19.56
20.01
20.31
26.03
19.55
CodeT5+220M
15.51
16.27
19.60
20.16
20.53
26.78
19.81
CodeT5+770M
15.63
17.93
19.64
20.47
20.83
26.39
20.15
+
+# D Additional Experimental Results
+
+In this section, we provide additional experimental results including code summarization (Appendix D.1), two understanding tasks of code defect detection and clone detection from the CodeXGLUE (Lu et al., 2021) (Appendix D.2), more analysis on retrieval-augmented code generation (Appendix D.3), and more qualitative results in math programming tasks (Appendix D.4).
+
+# D.1 Code Summarization from CodeXGLUE
+
+The code summarization task aims to summarize a code snippet into natural language docstrings. We employ the clean version of CodeSearchNet dataset (Husain et al., 2019) in six programming languages to evaluate our models for this task. We employ BLEU-4 (Lin and Och, 2004) as the performance metric which measures the token-based similarity between predicted and ground-truth summaries. From pretrained ${ \mathrm { C o d e T } } 5 +$ , we activate both encoder and decoder for this task.
+
+From Table 8, we found that encoder-decoder models (CodeT5 and CodeT $^ { 5 + }$ ) generally outperform both encoder-only models (Feng et al., 2020) and decoder-only models (Nijkamp et al., 2023b), as well as the UniLM-style model UniXcoder (Guo et al., 2022). This observation demonstrates the benefit of using the encoder-decoder architecture in ${ \mathrm { C o d e T } } 5 +$ to better encode code contexts and generate more accurate code summaries. Finally, we also observed some performance gains against CodeT5 (Wang et al., 2021b), indicating the advantage of our proposed mixture of diverse pretraining learning objectives in addition to the span denoising objective in CodeT5.
+
+# D.2 Code Defect Detection and Clone Detection from CodeXGLUE
+
+Defect detection is to predict whether a code is vulnerable to software systems or not, while clone detection aims to measure the similarity between two code snippets and predict whether they have a common functionality. We use benchmarks from CodeXGLUE (Lu et al., 2021) and use accuracy and F1 score as the metrics. In Table 9, we can see CodeT $^ { 5 + }$ models achieve new SoTA accuracy of $6 6 . 7 \%$ on the defect detection task. For the clone detection task, our model achieves comparable results to SoTA models, where the performance increase tends to be saturated, observed by the close performance gaps between multiple baselines.
+
+Table 9: Results on two understanding tasks: code defect detection and code clone detection.
+
+
Model
Defect
Clone Detection
Acc
Rec
Prec
F1
CodeBERT125M GraphCodeBERT125M UniXcoder125M
62.1 - 1
94.7 94.8 92.9
93.4 95.2 97.6
94.1 95.0 95.2
CodeGen-multi 350M PLBART140M
63.1 63.2
94.1 94.8
93.2 92.5
93.6 93.6
CodeT5220M
65.8
95.1
94.9
95.0
CodeT5+220M CodeT5+ 770M
66.1 66.7
96.4 96.7
94.1 93.5
95.2 95.1
+
+# D.3 More Analysis on Retrieval-augmented Code Generation
+
+We conduct an ablation study to analyze the effects of top- $k$ retrievals in retrieval-augmented code generation tasks and report the results in Table 10 . We found that increasing the number of retrievals can boost model performance which becomes saturated when $k { = } 5$ . This saturation is due to the maximum sequence length of 600, which might not be able to accommodate a large number of retrieved code samples. Overall, our CodeT $^ { 5 + }$ significantly outperforms the prior SOTA baseline which uses top10 retrievals in all cases, even with only a top-1 retrieved code.
+
+We further include a qualitative case in Fig. 6, where we found that the retrieved code provides crucial contexts (e.g., use “urllib3” for an HTTP request) to guide the generative process for more correct prediction. In contrast, the generative-only model gives an incorrect prediction that only captures the concepts of “download” and “compress”.
+
+# D.4 Qualitative Results in Math Programming tasks
+
+For math programming tasks, we provide qualitative examples predicted by our models in Fig. 7 and Fig. 8. Overall, we found CodeT5+ is able to
+
+
+Figure 6: Example code generation output: Our Code $\mathrm { T } 5 +$ retrieval-augmented generation model could retrieve relevant code context and use it to facilitate better code generation.
+
+Table 10: Effects of varying top- $k$ retrievals in retrieval-augmented code generation tasks with our $\mathbf { C o d e T 5 + } 2 2 0 \mathbf { M }$ compared to the prior SOTA model of REDCODER-EXT that employs top-10 retrievals. EM: Exact Match, B4: BLEU-4, CB: CodeBLEU.
+
+
Model
Java
Python
EM
B4
CB
EM
B4
CB
SOTA (top-10)
10.21
28.98
33.18
9.61
24.43
30.21
Ours
top-1
11.66
33.83
40.60
11.83
31.14
36.39
top-2
11.57
33.26
40.74
11.78
31.21
36.58
top-3
12.29
33.10
41.71
12.48
30.92
37.31
top-4
12.42
32.08
41.94
12.73
30.40
37.60
top-5
13.02
32.42
42.28
12.93
30.52
37.87
top-10
12.86
31.38
42.24
12.84
29.79
37.79
+
+generate decent programs that can solve the math problems in various levels of difficulties, i.e. from simple math operations to more complex problems with multiple reasoning steps. From the rightmost example of Fig. 8, we found that CodeT $^ { 5 + }$ is able to leverage some external libraries such as math when synthesizing the solutions.
+
+# E Finetuning on Downstream Tasks
+
+# E.1 Text-to-Code Retrieval
+
+Text-to-code retrieval (or code search), is the task of finding the best code sample that is most relevant to a natural language query, from a collection of code candidates. We experiment CodeT5+ with three major benchmarks: CodeSearchNet (CSN) (Husain et al., 2019), CosQA (Huang et al., 2021), and AdvTest (Lu et al., 2021). CSN consists of six programming languages in total, and the dataset is curated by filtering low-quality queries through handcrafted rules, following (Guo et al., 2021). For instance, an example handcraft rule is to filter examples in which the number of tokens in query is shorter than 3 or more than 256.
+
+CosQA and AdvTest are two related benchmarks that are both derived from the CSN data. Specifically, instead of natural language queries, CosQA uses logs from Microsoft Bing search engine as queries, each of which is annotated by 3 human annotators (Huang et al., 2021). AdvTest is created from the Python split of the CSN data but the code samples are normalized with obfuscated variable names to better evaluate the understanding abilities of current models. For training, we set the maximum sequence to 350 and 64 for code and text. We set the learning rate as 2e-5 and finetune the model for 10 epochs. We employ distributed training on 8 A100s and the total batch size is 64. For momentum encoders, we maintain a separate text/code queue with a size of 57600, and allow the matching decoder to retrieve 64 hard negatives from the queues for hard negative mining.
+
+# E.2 Code Summarization
+
+Code summarization is the task of generating a natural language summary of a code snippet. We use the task dataset from CodeXGLUE (Lu et al., 2021) which curated a code summarization benchmark from CSN data (Husain et al., 2019). The benchmark consists of six PLs: Ruby, JavaScript, Go, Python, Java, and PHP. It is the same clean version of CSN data that we use for text-to-code retrieval tasks. For training, we set the maximum sequence length of the source and target as 256 and 128, respectively. We use a learning rate of 2e-5,
+
+
+Figure 7: Predictions of our model on GSM8K-Python
+
+the batch size as 64 for 10 epochs of finetuning.
+We set the beam size as 5 in inference.
+
+# E.3 Code Defect Detection
+
+Defect detection is the task of classifying whether a code sample contains vulnerability points or not. We adopt the defect detection benchmark from CodeXGLUE (Lu et al., 2021) which curated data from the Devign dataset (Zhou et al., 2019). The dataset contains in total more than 27,000 annotated functions in C programming language. All samples are collected from popular open-source projects such as QEMU and FFmpeg. We follow (Lu et al., 2021) and adopt $8 0 \% / 1 0 \% / 1 0 \%$ of the dataset as the training/validation/test split. For training, we set the learning rate as 2e-5, the batch size as 32, and the max sequence length as 512 to finetune the model for 10 epochs.
+
+# E.4 Code Clone Detection
+
+The task of clone detection aims to detect whether any two code samples have the same functionality or semantics. We conduct experiments using the clone detection benchmark from CodeXGLUE (Lu et al., 2021). The benchmark is curated from the BigClone dataset (Svajlenko et al., 2014) and the resulting curated data consists of 901,724/416,328/416,328 examples for training/validation/test splits respectively. All samples are categorized into 10 different functionalities. For finetuning, we set the learning rate as 2e-5 and finetune the model for 2 epochs. We set the batch size as 10, and the max sequence length as 400.
+
+# E.5 Code Completion
+
+In code completion, given a source sequence containing a partial code sample, a model is required to generate the remaining part of the code sample. We conduct experiments on line-level code completion using two major benchmarks: PY150 (Raychev et al., 2016) and JavaCorpus (Allamanis and Sutton, 2013). PY150 (Raychev et al., 2016) consists of 150,000 Python source files collected from Github. Among these samples, (Lu et al., 2021) selected 10,000 samples from different files from the test set of PY150 and then randomly sampled lines to be predicted for the code completion task. The average numbers of tokens in the source sequence and target sequence are 489.1 and 6.6 respectively. JavaCorpus (Allamanis and Sutton, 2013) contains over 14,000 Java projects collected from GitHub. Similarly to PY150, Lu et al. (2021) selected 3,000 samples from different files from the test set of the dataset and randomly sampled lines to be predicted for the code completion task. The average numbers of tokens in the source and target sequence are 350.6 and 10.5 respectively. For both tasks, we set the learning rate as 2e-5 and batch size as 32, and set the maximum sequence length of 1024 for the decoder. We finetune the model for 30 epochs. During inference, we employ beam search with a beam size of 5.
+
+# E.6 Math Programming
+
+Math Programming is the task of solving mathsbased problems with programming. Compared to conventional code generation tasks, this task fo
+
+
+Figure 8: Predictions of our model on MathQA-Python
+
+Question: Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?
+
+# Answer:
+
+Natalia sold $4 8 / 2 = < < 4 8 / 2 = 2 4 > > 2 4$ clips in May.
+Natalia sold $4 8 + 2 4 = < < 4 8 + 2 4 = 7 2 > > 7 2$ clips altogether in April and May.
+Python Solution:
+${ \mathsf { n } } 0 = 4 8$
+${ \mathfrak { n } } 1 = 2$
+t0 = n0 / n1
+answer $= \mathsf { n } 0 + \mathsf { t } 0$
+
+Figure 9: One example of how to convert natural language solution into a Python program on GSM8K dataset.
+
+cuses more on computational reasoning skills. The problem descriptions in this type of task are also more complex than conventional code generation tasks. We employ two major benchmarks for this task: MathQA-Python (Austin et al., 2021) and GradeSchool-Math (Cobbe et al., 2021).
+
+MathQA-Python (Austin et al., 2021) is developed from the MathQA dataset (Amini et al., 2019) where given a mathematical problem description in natural language, a system is required to solve this problem via generating a program that returns the final answer. (Austin et al., 2021) translated these programs into Python programs and filtered for cleaner problems. In total, MathQA-Python contains ${ \sim } 2 4 { , } 0 0 0$ problems, including 19,209/2,822/1,883 samples for training/validation/test splits.
+
+GradeSchool-Math (Cobbe et al., 2021) (also known as GSM8K) has similar nature as MathQA. The benchmark focuses on problems with moderate difficulty that an average grade school student should be able to solve. In total, GSM data contains 8,500 problems, divided into 7,500 training and 1,000 testing problems. We translated the solution described in natural language to Python programs by following the construction process of MathQA-Python by Austin et al. (2021). Finally, we successfully converted 5,861 out of 7,500 training samples. One case can be found in Fig. 9.
+
+For training, we set the maximum sequence length of the source and target as 256 and 256 for MathQA-Python, and 246, 138 for GSM8k-Python. We use a learning rate of 2e-5 and a batch size of 32 for 30 epochs of finetuning. During inference, we employ the beam size as 5 to get pass $@ 1$ results. For pass $@ 8 0$ and pass $@ 1 0 0$ , we found they are quite sensitive to the diversity of the generation. We employ nucleus sampling with a temperature of 1.2 and top- $\cdot p { = } 0 . 9 5$ .
+
+# E.7 Retrieval-augmented Code Generation
+
+Developers often search for relevant code snippets from sources on the web such as GitHub or StackOverflow as references to aid their software development process. Motivated by this behaviour, we explore a retrieval-augmented code generation setting, where given a natural language description, a retriever first retrieves similar candidates in a search codebase and then augments the input for the generator to produce the target code. Such retrieval-augmented generation (or retrievethen-generate) paradigm has been widely used in open-domain question answering (Karpukhin et al., 2020) in NLP and recently extended to some coderelated tasks such as code generation and summarization (Parvez et al., 2021), and program repair tasks (Wang et al., 2023). As our CodeT $^ { 5 + }$ is capable of both retrieval and generation, it can be seamlessly adapted as a unified retrieval-augmented generator. This can bring unique benefits such as less computational cost compared to prior work that employs a different retriever and generator. We evaluate CodeT $^ { 5 + }$ on two Java and Python code generation datasets from the CodeXGLUE (Lu et al., 2021) benchmark following Parvez et al. (2021).
+
+Specifically, we leverage the encoder to encode the code snippet in the retrieval base and build a search index with the faiss library (Johnson et al., 2019). The search index is a set of representations (of 256 dimensions) for all the code snippets in the retrieval codebase. Let $( x _ { i } , y _ { i } )$ denote one training instance where $x _ { i }$ is the input text description and $y _ { i }$ is the corresponding target code snippet. we employ the same encoder to obtain the embedding of $x _ { i }$ and retrieve top- $k$ similar code samples from the search base using the L-2 similarity metric, with $k$ being a hyperparameter. We ensure that the training example’s target string $( y _ { i } )$ is not present in any of these $k$ retrieved samples.
+
+After retrieving these top- $k$ relevant code samples, we combine them with a special token [SEP] and concatenate it to the end of the source input $x _ { i }$ Unlike (Parvez et al., 2021), we do not augment docstrings or text descriptions and only augment the code snippet for simplicity. We then finetune CodeT $^ { 5 + }$ on this augmented dataset. During inference, we retrieve similar code samples from the search base and augment these to input $x _ { i }$ . For training, we set the maximum sequence length of the source and target as 600 and 320. We use a learning rate of 2e-5, the batch size as 32 to finetune the model for 10 epochs. We set the beam size as 5 during inference with beam search.
\ No newline at end of file
diff --git a/md/dev/uuUQraD4XX/uuUQraD4XX.md b/md/dev/uuUQraD4XX/uuUQraD4XX.md
new file mode 100644
index 0000000000000000000000000000000000000000..1aef55543bb985ff07119ef8993656e120378152
--- /dev/null
+++ b/md/dev/uuUQraD4XX/uuUQraD4XX.md
@@ -0,0 +1,461 @@
+# Large Language Models Can Self-Improve
+
+Jiaxin Huang1∗ Shixiang Shane $\mathbf { G u ^ { 2 } }$ Le $\mathbf { H o u } ^ { 2 \dagger }$ Yuexin $\mathbf { W } \mathbf { u } ^ { 2 }$ Xuezhi Wang2 Hongkun $\mathbf { Y } \mathbf { u } ^ { 2 }$ Jiawei Han1
+
+1University of Illinois at Urbana-Champaign 2Google 1{jiaxinh3, hanj}@illinois.edu 2{shanegu, lehou, crickwu, xuezhiw, hongkuny}@google.com
+
+# Abstract
+
+Large Language Models (LLMs) have achieved excellent performances in various tasks. However, fine-tuning an LLM requires extensive supervision. Human, on the other hand, may improve their reasoning abilities by self-thinking without external inputs. In this work, we demonstrate that an LLM is also capable of self-improving with only unlabeled datasets. We use a pre-trained LLM to generate “highconfidence” rationale-augmented answers for unlabeled questions using Chain-of-Though (CoT) prompting and self-consistency, and finetune the LLM using those self-generated solutions as target outputs. We show that without any ground truth label, our approach significantly improves the general reasoning ability of PaLM 540B model $7 4 . 4 \% 8 2 . 1 \%$ on GSM8K, $9 0 . 0 \% 9 4 . 4 \%$ on OpenBookQA, and $6 3 . 4 \% 6 7 . 9 \%$ on ANLI-A3) and can also be adapted to extreme low-resource cases where even training questions and CoT prompts are limited. We conduct ablation studies and show that fine-tuning on diverse reasoning paths is critical for self-improvement.
+
+# 1 Introduction
+
+self-consistency (Wang et al., 2022c) further improves the performance via self-evaluating multiple reasoning paths.
+
+Scaling has enabled Large Language Models (LLMs) to achieve state-of-the-art performance on a range of Natural Language Processing (NLP) tasks (Wang et al., 2018, 2019; Rajpurkar et al., 2016). More importantly, new capabilities have emerged from LLMs as they are scaled to hundreds of billions of parameters (Wei et al., 2022b): in-context few-shot learning (Brown et al., 2020) makes it possible for an LLM to perform well on a task it never trained on with only a handful of examples; Chain-of-Thought (CoT) prompting (Wei et al., 2022c; Kojima et al., 2022) demonstrates strong reasoning ability of LLMs across diverse tasks with or without few-shot examples;
+
+Despite these incredible capabilities of models trained on large text corpus (Brown et al., 2020; Chowdhery et al., 2022), fundamentally improving the model performances beyond few-shot baselines still requires finetuning on an extensive amount of high-quality supervised datasets. FLAN (Wei et al., 2021; Chung et al., 2022) and T0 (Sanh et al., 2022) curated tens of benchmark NLP datasets to boost zero-shot task performances on unseen tasks; InstructGPT (Ouyang et al., 2022) crowd-sourced many human answers for diverse sets of text instructions to better align their model to human instructions; Minerva (Lewkowycz et al., 2022) parsed the full ArXiv database carefully for relevant articles to excel on challenging competitive math and science datasets. The need for large annotated data for supervised LLM training still remains a burden for low-resource applications or specific domains where only limited annotations are available.
+
+In this paper, we study how an LLM capable of in-context few-shot learning and chain-ofthought reasoning, is able to self-improve its reasoning ability without supervised data. We show that using only input sequences (without ground truth output sequences) from multiple NLP task datasets, a pre-trained LLM is able to improve performances for both in-domain and out-of-domain tasks. Our method is shown in Figure 1: we first sample multiple predictions using few-shot Chain-of-Thought (CoT) (Wei et al., 2022c) as prompts, filter “high-confidence” predictions using majority voting (Wang et al., 2022c), and finally finetune the LLM on these high-confidence predictions. The resulting model shows improved reasoning in both greedy and multi-path evaluations. We call the model fine-tuned in this way as Language Model Self-Improved (LMSI).
+
+Note that LMSI depends on in-context few-shot learning and chain-of-thought reasoning abilities which small language models do not necessarily have. We empirically verify LMSI using a pre-trained 540B PaLM model (Chowdhery et al., 2022), where our method not only significantly improves training task performances $7 4 . 4 \% 8 2 . 1 \%$ on GSM8K, $9 0 . 0 \% 9 4 . 4 \%$ on OpenBookQA, and $6 3 . 4 \% 6 7 . 9 \%$ on ANLI-A3), but also enhances out-of-domain (OOD) tasks, without relying on supervised ground truth answers. Lastly, we explore more extreme cases where training questions and human-curated CoTs are also limited, and propose self-generating additional input questions and few-shot CoT prompts for model self-improving. We hope our simple approaches and strong empirical results could inspire more future work by the community to investigate optimal performances of pretrained LLMs without additional human supervision.
+
+Our contributions are summarized as follows:
+
+• We demonstrate that a large language model can self-improve by taking datasets without ground truth outputs, by leveraging CoT reasoning (Wei et al., 2022c) and self-consistency (Wang et al., 2022c) to generate diverse reasoning paths for self-training, and can achieve great improvments on in-domain multi-task performances as well as out-of-domain generalization.
+
+• We provide detailed ablation studies on training sample formatting and sampling temperature after fine-tuning, and identify critical design choices for most successful self-improvement by LLMs.
+
+• We further propose two approaches for model self-improving under extreme low-resource cases where even training questions and CoT prompts are limited, and achieve $7 4 . 2 \%$ on zero-shot GSM8K, against $4 3 . 0 \%$ by Kojima et al. (2022) or $70 . 1 \%$ through its naive extension with Wang et al. (2022c).
+
+The rest of this paper is organized as follows. Section 2 discusses related work. Section 3 lays out our method in detail. Section 4 shows our setup for experiments. Section 5 demonstrates our experiment results with ablation studies. Section 6 concludes our work. The chain-of-thought prompts used in our work are included in Appendix A.
+
+# 2 Related Work
+
+Learning from explanations. Augmenting a machine learning model with explanations has been studied in existing literature extensively. For example, in the supervised learning setting, a model can be fine-tuned using human-annotated rationales (Zaidan et al., 2007; Ling et al., 2017a; Narang et al., 2020; Camburu et al., 2018; Cobbe et al., 2021; Chung et al., 2022). A few works have also looked at how explanations can help the models in various settings, e.g., in-context learning (Lampinen et al., 2022) and in distillation (Pruthi et al., 2022). Lightman et al. (2023) treat explanations as process supervision to train a reward model. In this paper, we focus more on the unsupervised learning setting, where we do not assume we have a rationale-augmented training dataset available, since human-annotated rationales can be expensive.
+
+Few-shot explanations improves reasoning in LLMs. Recently, a lot of progress has been made towards improving LLMs’ reasoning abilities via prompting or in-context learning. Wei et al. (2022c) propose Chain-of-Thought prompting, which prompts the language model to generate a series of natural-language-based intermediate steps, and show it can help language models better solve complex and multi-step reasoning tasks, with recent study (Wang et al., 2022a) analyzing the relevant contents and correct reasoning order being the most crucial factor of the success of Chain-ofThought prompting. Wang et al. (2022c) improve Chain-of-Thought prompting by sampling multiple diverse reasoning paths and finding the most consistent answers via majority voting. Kojima et al. (2022); Zhang et al. (2022) propose to prompt the language model with “Let’s think step by step” to generate reasoning in a zero-shot fashion. Zhou et al. (2022) decompose the questions into multiple sub-questions, and ask the language model to solve each sub-question sequentially.
+
+Refining explanations. More recent work proposes to further refine the generated reasoning paths as some of them could be unreliable. For example, Ye and Durrett (2022) calibrate model predictions based on the reliability of the explanations, Jung et al. (2022) show that inducing a tree of explanations and inferring the satisfiability of each explanation can further help judge the correctness of explanations. Li et al. (2022a) show that sampling a diverse set of prompts from the training data, and a voting verifier can be used to improve model’s reasoning performance. Xi et al. (2023) and Zheng et al. (2023) propose to polish the problem progressively before the model reaching a stable answer. Zelikman et al. (2022) proposes better rationale generation by augmenting ground truth answers as hints when predicted answers are incorrect. Our work is orthogonal to these lines of work, as we utilize refined explanations for model selfimprovement, and could readily incorporate these other refinement techniques for generating higherquality self-training data. Our work is closely related to Zelikman et al. (2022) where we both propose to fine-tune a model on self-generated CoT data, but our method does not require ground truth labels and shows stronger empirical results with multi-task generalization. Different from existing work, we show that a mixture of the reasoningpath refinement techniques can be combined to further improve the quality of the generated reasoning paths, which is shown to be effective in boosting model’s performance via self-improvement.
+
+
+Figure 1: Overview of our method. With Chain-of-Thought (CoT) examples as demonstration (Wei et al., 2022c), the language model generates multiple CoT reasoning paths and answers (temperature $T > 0$ ) for each question. The most consistent answer is selected by majority voting (Wang et al., 2022c). The CoT reasoning paths that lead to the answer with the highest confidence are augmented by mixed formats, and are fed back to the model as the final training samples.
+
+Self-training models. One related line of work is self-training (see a survey from Amini et al. (2022)). The key idea is to assign pseudo labels from a learned classifier to unlabeled data, and use these pseudo-labeled examples to further improve the original model training, e.g., (RoyChowdhury et al., 2019; Xie et al., 2020; He et al., 2020; Chen et al., 2021). Different from such prior work, our proposed self-improvement framework uses CoT prompting plus self-consistency to obtain highconfidence solutions on a large set of unlabeled data to augment the fine-tuning process.
+
+Distillation and dark knowledge. Language models are known to preserve parametric knowledge (Schick and Schütze, 2020a,b) during the pretraining stage. Our method tangentially relates to rich literature on distillation (Ba and Caruana, 2014; Hinton et al., 2015), where a student network imitates a teacher network’s classifier predictions on input examples. A key detail is to learn from soft targets instead of hard predicted labels, as softmax outputs with a high temperature reveal more detailed relative class likelihoods, colloquially known as dark knowledge (Hinton et al., 2015; Korattikara Balan et al., 2015). Recent studies (Zelikman et al., 2022; Snell et al., 2022; Eisenstein et al., 2022) show that dark knowledge within LLMs can be retrieved with more computation at inference time, such as adding informative instructions into the input sequence and output CoT generation (Wei et al., 2022c; Kojima et al., 2022). Recent works (Magister et al., 2022; dhar et al., 2023; Ho et al., 2023) demonstrated that distillation on explanations generated from large models can increase the reasoning abilities of smaller models with ground truth filtering.
+
+# 3 Method
+
+The overview of our method is illustrated in Fig. 1: We are given a pre-trained Large Language Model (LLM) $M$ and a question-only train
+
+Question: Stefan goes to a restaurant with his family. They order an appetizer that costs $\$ 10$ and 4 entrees that are $\$ 20$ each. If they tip $20 \%$ of the total, what is the total amount of money that they spend?
+
+# Multiple Path Decoding:
+
+Output 1: The appetizer costs $\$ 10$ . The entrees cost $\$ 20$ each so in total $4 * \ S 2 0 = \ S 8 0$ . This means the total cost is $\$ 10+580=590$ . They tip $20 \%$ of it, so the total amount they spend is $\$ 90 *1.2$ $= \$ 108$ . The answer is 108.
+
+Output 2: The appetizer costs $\$ 10$ and the entrees are $\$ 20$ each. There are 4 entrees so the sum is $\$ 20 *4=\ S 80$ . The waiter gets $20 \%$ of the total. $20 \%$ of $\$ 80$ is $\$ 80 *.2=916$ . The answer is $\$ 80$ $+ \$ 16= \$ 96$ . (Incorrect reasoning path)
+
+Output 3: The appetizer costs $\$ 10$ . The entrees cost $4 * \$ 20=980$ . The tip is $20 \%$ of the total, so it is $20 \%$ of the $\$ 90$ they have spent. The tip is $0 . 2 * 9 0 = \$ 18$ . The total they spent is $\$ 90+\$ 18$ $= \$ 108$ . The answer is 108.
+
+ing dataset $\mathcal { D } ^ { \mathrm { t r a i n } } = \{ x _ { i } \} _ { i = 1 } ^ { D }$ with few-shot Chainof-Thought $( \mathrm { C o T } )$ examples (Wei et al., 2022c). We apply multiple path decoding with a sampling temperature $T \ > \ 0$ for generating $m$ reasoning paths and answers $\{ r _ { i _ { 1 } } , r _ { i _ { 2 } } , \ldots , r _ { i _ { m } } \}$ for each question $x _ { i }$ in $\scriptstyle { \mathcal { D } } ^ { \mathtt { t r a i n } }$ , and use majority voting (selfconsistency) to select the most consistent, highest confidence answer (Wang et al., 2022c). We then keep all reasoning paths that lead to the most consistent answer, apply mixed formats of prompts and answers for augmentation, and fine-tune the model on these self-generated reasoning-answer data. We consider our approach as making the model self-improve. In the following sections, we detail important designs within our method, along with additional approaches for the model to selfimprove without supervised data.
+
+
+Figure 2: The relation of accuracy and confidence of the majority-voted answer after multiple path decoding on GSM8K training-set questions. A recent study (Kadavath et al., 2022) shows that language models are not perfectly-calibrated though their calibration increases with model size, and models with more than 10B parameters are reasonably calibrated on some few-shot tasks. This aligns well with our study and serve as the basis of this self-improving method.
+
+# 3.1 Generating and Filtering Multiple Reasoning Paths
+
+Self-consistency (Wang et al., 2022c) brings large improvements on reasoning tasks (e.g., $5 6 . 5 \% $ $7 4 . 4 \%$ on GSM8K test set), and the gap between greedy decoding and diverse decoding shows there is a potential for further improving the reasoning ability of $M$ , using the self-selected highconfidence reasoning paths as training data.
+
+For each training question $x _ { i }$ , we sample $m$ CoT reasoning paths, denoted as $\{ r _ { i _ { 1 } } , r _ { i _ { 2 } } , \ldots , r _ { i _ { m } } \}$ (see Table 1 for examples). An example of a training question with the self-generated CoT reasoning paths is shown in Table 1. Since $M$ is prompted with the CoT examples from Wei et al. (2022c), we apply the same output parsing with “The answer is” to generate their predicted answers $\{ y _ { i _ { 1 } } , y _ { i _ { 2 } } , . . . , y _ { i _ { m } } \}$ . The most consistent answer, which is not necessarily a correct answer, is selected by majority voting, denoted as $\begin{array} { r } { \tilde { y } _ { i } = \mathrm { a r g } \operatorname* { m a x } _ { y _ { i _ { j } } } \sum _ { k = 1 } ^ { m } \mathbb { I } ( y _ { i _ { j } } = y _ { i _ { k } } ) } \end{array}$ . In Table 1, the most consistent answer $\tilde { y }$ is 108, derived by output path 1 and output path 3, while the output path 2 makes a mistake in calculating the cost of the foods. For all the training questions, we filter the CoT reasoning paths that reach $\tilde { y }$ as the final answer to be put into the self-training data,
+
+Table 2: An example of how a reasoning path is augmented into four formats of training data with different prompts (in input) and answer styles (in output). Specifically, the CoT prompting examples used for each tasks are listed in Appendix A.2. The Standard prompting examples are the same question-answer pairs with CoT prompting examples, except that reasoning is removed.
+
+
Question: Amy is 1O years old. Jake is 8 years old. Alex's age is right in the middle. How old is Alex? Selected Chain-of-Thought: Amy is 1O years old. Jake is 8 years old. Alex's age is in the middle of Amy and Jake, so Alex is(8 + 10) /2= 9 years old. The answer is 9.
Mixed-formats of training data: Format 1: Input: [CoT prompting examples] + ‘\n’ + [Question] +"\n’ +‘A:' Output: Amy is 10 years old. Jake is 8 years old. Alex's age is in the middle of Amy and Jake, so Alex
is(8 + 10)/2 =9 years old. The answer is 9. Format 2: Input: [Standard prompting examples] + "\n’ + [Question] + '\n' + ‘A:
Output: The answer is 9.
Format 3: Input: [Question] + ‘\n’ + ‘A: Let's think step by step.'
Output: Amy is 10 years old. Jake is 8 years old. Alex's age is in the middle of Amy and Jake, so Alex is(8 + 10)/2=9 years old. The answer is 9.
Format4:Input:[Ouestion]+‘\n'+‘A:'
+
+Output: The answer is 9.
+
+denoted as Dself−consistent $\mathbf { \Sigma } = \{ x _ { i } , \tilde { r _ { i } } \}$ , where $\tilde { r _ { i } } = \{ r _ { i _ { j } } | 1 \le j \le m , y _ { i _ { j } } = \tilde { y } _ { i } \}$ .
+
+Since we do not use any ground truth labels to filter out cases where $\tilde { y } _ { i } \ne y _ { i }$ , it is important that the self-generated CoT reasoning paths are mostly reliable and incorrect answers do not hurt the self-improvement of the model. We plot the relation between the accuracy and confidence of selfgenerated CoT paths for each question in GSM8K training set in Fig. 2. The confidence is the number of CoT paths leading to $\tilde { y }$ divided by the total path number $m$ . The y-axis shows the accuracy of $\tilde { y }$ under a certain confidence. The circle area and the color darkness shows the number of questions under a certain confidence. We can observe that confident answers are more likely to be correct, which means that when a question has many consistent CoT paths, then the corresponding $\tilde { y }$ is more likely to be correct. On the other hand, when $\tilde { y }$ is wrong, it is likely to be supported by fewer CoT paths, and brings little noise to the training samples.
+
+ble 2. In the first format, a few Chain-of-Thought examples (questions followed by reasoning paths leading to the correct final answers) are prepended to the new question, while the language model output is trained to be the same with the filtered CoT reasoning paths. In the second format, we use examples of questions and their direct answers as standard prompting, and the language model output is supposed to also only contain the direct answer. The third and fourth format are similar to the first and second format, except that no example of question-answer pairs are given, so that the model will learn to think on its own in an in-context zero-shot manner. In the third format, where we want the model to output CoT reasoning without prepending examples containing CoT reasonings, we append “Let’s think step by step.” at the end of the input sequence, to guide the language model to generate step-by-step CoT reasoning paths (Kojima et al., 2022). The mixed formats of training samples are then used to fine-tune the pre-trained language model $M$ .
+
+# 3.2 Training with Mixed Formats
+
+To prevent the language model from overfitting to specific prompts or answer styles, we create four different formats for each reasoning path to be mixed in the self-training data, shown in Ta
+
+# 3.3 Generating Questions and Prompts
+
+In some cases where even training questions or human-curated CoT prompts are limited, our method may not generate sufficient training samples for language model self-training. Therefore, we investigate how to self-generate more training questions as well as example prompts to further reduce human effort.
+
+Question Generation. Previous work (Yoo et al., 2021; Meng et al., 2022) discuss few-shot data augmentation by generating diverse training samples using LLMs. However, those methods are designed for classification tasks and require ground truth label for each few-shot example. We use a simple yet effective approach to generate diverse questions (without using ground truth answers) from a few example questions. Specifically, we randomly sample and concatenate example questions in a random order as input prompt, and let the language model generate consecutive sequences as new questions. We repeat the process to obtain a large set of new questions, then use self-consistency (Wang et al., 2022c) to only keep the questions that have a highly confident answer. Those questions are then used as self-generated training questions.
+
+Prompt Generation. Given a set of questions, humans can write CoT examples as reasoning paths leading to the final answer. In zero-shot setting without manual prompts, we can generate these CoT paths using the model itself. Following (Kojima et al., 2022), we start the answer with “A: Let’s think step by step.” and let the language model generate the consecutive reasoning paths. We then use those generated reasoning paths as examples for few-shot CoT prompting.
+
+# 4 Experimental Setup
+
+Tasks and Datasets. We demonstrate the effectiveness of our method on three types of tasks1:
+
+• Arithmetic reasoning: We use the math problem set GSM8K (Cobbe et al., 2021), and a reading comprehension benchmark DROP (Dua et al., 2019) which requires numerical reasoning. We follow (Zhou et al., 2022) to partition the DROP dataset into football related and non-football related subsets for training.
+
+• Commonsense reasoning: We use the OpenBookQA (Mihaylov et al., 2018) dataset, and the AI2 Reasoning Challenge (ARC) (Clark et al., 2018) dataset. Note that for ARC, we only use the Challenge sub-set (ARC-c) in our experiments. Both datasets contain multiple-choice questions.
+
+• Natural Language Inference: We use the Adversarial NLI (ANLI) (Mihaylov et al., 2018) subsets, ANLI-A2 and ANLI-A3, which are the more challenging subsets compared to ANLI-A1. These datasets contain pairs of sentences with relations of entailment, neutral, or contradiction.
+
+Models, Training settings and Hyperparameters. We follow previous studies (Wei et al., 2022c; Wang et al., 2022c) and conduct our experiments on the PaLM 540B model (Chowdhery et al., 2022), an autoregressive Transformer-based language model. The CoT examples for each dataset are listed in Appendix A.2. We generate $m = 3 2$ reasoning paths for each question in a training set, followed by format augmentation in Sec. 3.2. For DROP and ANLI-A2/A3, we sample $5 \mathrm { k }$ examples for reasoning path generation to reduce the training burden; For other datasets, we keep the whole training set. For each dataset, we fine-tune the model for $1 0 \mathrm { k }$ steps with a learning rate of $5 \mathrm { e } - 5$ and a batch size of 32. We use a sampling temperature of $T = 0 . 7$ with the pre-trained model as suggested by (Wang et al., 2022c). We use $T = 1 . 2$ for the language model after self-improvement (LMSI ). We set the maximum number of decoded steps to 256 for all experiments.
+
+# 5 Experiments and Results
+
+We conduct a series of experiments to demonstrate the effectiveness of our proposed self-improving method. First, we apply our method on each individual dataset (task) and report the results. We then merge the generated data from all datasets and train one model to study the generalization ability of the model on unseen datasets as in (Wei et al., 2021). In addition to the results of using generated CoT reasoning paths, we show studies on generating input questions and few-shot prompts. We end with ablation studies on model sizes and hyperparameters.
+
+# 5.1 Main Results
+
+We list the results of using the 540B PaLM model before and after LMSI in Table 3. For each model, during test time, we apply three separate prompting methods on all six datasets: standard-prompting, CoT-Prompting, and Self-Consistency. We observe that after LMSI , the performance of all three prompting methods increase by a large margin. We observe significant improvement, comparing selfconsistency versus LMSI with self-consistency: $+ 7 . 7 \%$ on GSM8K, $+ 4 . 8 \%$ on DROP, $+ 4 . 4 \%$ on OpenBookQA, and $+ 4 . 5 \%$ on ANLI-A3. This shows that our proposed method is quite effective. Furthermore, the single path CoT-Prompting performance of LMSI is close to or even better than the multiple path Self-Consistency performance of the model without LMSI , showing that LMSI truly helps the language model learn from the multiple consistent reasoning paths. We also apply LMSI on a recently proposed public language model, UL2 (20B) (Tay et al., 2022), and show the results in Appendix A.1. Compared to the 540B PaLM model (decoder-only), UL2 has a smaller scale, and a different architecture (encoder-decoder). We observe that for most datasets, LMSI still outperforms the original UL2 results, but the improvement is not as large as that on the 540B PaLM model.
+
+Table 3: Accuracy results on six reasoning benchmarks with or without LMSI using different prompting method.
+
+
Prompting Method
w. or w/o LMSI
GSM8K
DROP
ARC-c
OpenBookQA
ANLI-A2
ANLI-A3
Standard-Prompting
w/o LMSI w. LMSI
17.9 32.2 (+14.3)
60.0 71.7 (+11.7)
87.1 87.2 (+0.1)
84.4 92.0 (+7.6)
55.8 64.8 (+9.0)
55.8 66.9 (+11.1)
CoT-Prompting
w/o LMSI w. LMSI
56.5 73.5 (+17.0)
70.6 76.2 (+5.6)
85.2 88.3 (+3.1)
86.4 93.0 (+6.6)
58.9 65.3 (+6.4)
60.6 67.3 (+6.7)
Self-Consistency
w/o LMSI w. LMSI
74.4 82.1 (+7.7)
78.2 83.0 (+4.8)
88.7 89.8 (+1.1)
90.0 94.4 (+4.4)
64.5 66.5 (+2.0)
63.4 67.9 (+4.5)
+
+Table 4: Comparison of CoT-prompting accuracy results on six Out-Of-Domain benchmarks with or without training on six In-Domain (GSM8K, DROP, ARC-c, OpenBookQA, ANLI-A2, ANLI-A3) training-set questions.
+
+
Self-training data
AQUA
SVAMP
StrategyQA
ANLI-A1
RTE
MNLI-M/MM
w/o LMSI
-
35.8
79.0
75.3
68.8
79.1
72.0/74.0
w. LMSI
GSM8K + DROP +...
39.0 (+3.2)
82.8 (+3.8)
77.8 (+2.5)
79.2 (+10.4)
80.1 (+1.0)
81.8/82.2 (+9.8/+8.2)
+
+Multi-task self-training for unseen tasks. To demonstrate the generalization ability of LMSI , we conduct experiments of self-training on a mixture of the training-set questions from the above six datasets (denoted as In-Domain tasks), then use the same model checkpoint for the evaluation on six Out-Of-Domain (OOD) tasks, as shown in Table 4. Of all the OOD tasks: (1) AQUA (Ling et al., 2017b) and SVAMP (Patel et al., 2021) are arithmetic reasoning tasks; (2) StrategyQA (Geva et al., 2021) is a commonsense reasoning task; (3) ANLIA1 (Nie et al., 2019), RTE (Dagan et al., 2005) and MNLI-M/MM (Williams et al., 2018) are natural language inference tasks.2 Among these tasks, AQUA, StrategyQA, and RTE are significantly different from any In-Domain task, and have their own few-shot prompts. From Table 4, we observe that LMSI achieves higher accuracy results on all OOD tasks, showing that the overall reasoning ability of the language model is improved.
+
+Importance of training with augmented formats. We demonstrate the importance of training language models with augmented formats (both Chainof-Thought prompting and direct prompting, and both few-shot prompting and zero-shot prompting). In Table 5, we list the results of LMSI with all four formats, the results of LMSI with only direct answer formats, and the results of LMSI with only few-shot Chain-of-Thought prompting formats. The results show that without the CoT formats, the language model can still self-improve, but the performance gain drops by a large amount compared to using all four formats. However, if only using few-shot CoT prompting format for selftraining, the model can overfit to the prompting style and may not generalize well on downstream tasks.
+
+# 5.2 Pushing the limit of self-improvements
+
+Self-Generating Questions We further explore the few-shot setting where there are only limited training questions in the target domain. On GSM8K, we sample 10 real questions as few-shot samples, and use the language model to generate more training questions using the method in Section 3.3. We then self-train the language model with these generated questions and list the results in Table 6. The results show that using self-generated questions still improves the reasoning ability of language models, but using the real training-set questions leads to better results.
+
+Table 5: Ablation study: LMSI with different combinations of training format on GSM8K dataset.
+
+
Results on GSM8K
w/o LMSI
Std. Prompting CoT Prompting 17.9 56.5
LMSI w/o CoT formats
23.6 (+5.7)
LMSI only few-shot CoT
61.6 (+5.1) 69.4 (+12.9)
LMSI w/CoT formats
29.2 (+11.3) 32.2 (+14.3) 73.5 (+17.0)
+
+Table 6: Accuracy on GSM8K test set after self-training on different question sets. Results are shown for both CoT-Prompting (CoT) and Self-Consistency (SC).
+
+
Questions used for Self-Training
GSM8K
CoT
SC
w/o LMSI
56.5
74.4
w. LMSI
Generated
66.2 (+9.7)
78.1 (+3.7)
w. LMSI
Training-set
73.5 (+17.0)
82.1 (+7.7)
+
+Self-Generating Few-Shot CoT Prompts. We explore the situation where no in-domain CoT examples are provided for a task. We apply the Stepby-Step method (Kojima et al., 2022) to generate CoT examples using the language model as described in Section 3.3, and show the results in Figure 3. We observe that few-shot prompting with self-generated Step-by-Step CoT examples substantially outperforms the Step-by-Step (Kojima et al., 2022) baseline $6 6 . 2 \%$ vs $5 3 . 8 \%$ at 10 paths, $7 4 . 2 \%$ vs $7 0 . 1 \%$ at 40 paths), and nearly matches the performance of human-written few-shot CoT (Wei et al., 2021) $( 7 4 . 4 \%$ at 40 paths (Wang et al., 2022c)). The strong performance of “Few-Shot w/ Step-by-Step” despite the limited accuracy of prompt examples ( $4 3 . 0 \%$ for greedy Step-by-Step) likely comes from leveraging more diverse CoT prompts for multi-path decoding (Li et al., 2022b), where at 40 paths it uses 20 generate prompttemplates, each with 4-shot CoT examples, i.e. a total of 80 generated CoT examples compared to 8 human-written examples use in Wei et al. (2022c).
+
+Since we did not use training questions or few-shot CoT examples, $7 4 . 2 \%$ also marks the new state-ofthe-art zero-shot performance on GSM8K.
+
+
+Figure 3: Accuracy results on GSM8K test set using 540B model with multi-path sampling and selfconsistency (Wang et al., 2022c). “Step-by-Step” is the baseline performance of Kojima et al. (2022) plus selfconsistency (Wang et al., 2022c), while our “Few-Shot w/ Step-by-Step” uses exemplers self-generated from Step-by-Step (greedy decoding) for few-shot prompting the LLM.
+
+# 5.3 Distillation to smaller models
+
+Table 7: Distillation from 540B model to small models. We see that distilled smaller models outperform models that are one-tier larger.
+
+
Results on GSM8K
8 billion
62 billion
540 billion
w/o LMSI
5.0
29.7
56.5
Distilled from LMSI
33.4 (+28.4)
57.4 (+27.7)
-
+
+We also explore whether the knowledge can be distilled to smaller models, such as in distillation (Hinton et al., 2015) and in Zelikman et al. (2022). We use the same set of training samples generated by the 540B PaLM model, but fine-tune on models with smaller sizes (8B PaLM model and 62B PaLM model respectively), and show the results of CoT-prompting in Table 7. It is interesting to point out that after distillation from LMSI , the 62B model can outperform the pre-trained 540B model, and the 8B model can outperform the pre-trained 62B model. This implies that for downstream applications with limited computing resources, the reasoning knowledge from large models can be used to largely enhance small models to achieve competitive performance.
+
+# 5.4 Hyperparameter Studies
+
+Sampling Temperature after Self-Improvement. We study the effect of varying the temperature $T$ for multiple path decoding after LMSI is applied. Specifically, we vary $T$ between [0.7, 1.0, 1.2, 1.5] and show the results on GSM8K and DROP dataset respectively in Fig. 4. As shown in the figure, $T = 1 . 2$ benefits both datasets the most, and is used in the Self-Consistency method for LMSI on all datasets. We notice that the optimal $T$ after model self-improvement is larger than the optimal $T = 0 . 7$ (Wang et al., 2022c) before selfimprovement. We believe the reason is that after training the model, the entropy of the output distribution is reduced.
+
+
+Figure 4: Accuracy results of LMSI on GSM8K and DROP test set when different sampling temperatures are applied for Self-Consistency.
+
+Number of Sampled Reasoning Paths. We study whether the number of sampled reasoning paths $m$ for Self-Consistency largely affects the accuracy after LMSI is applied. We show the accuracy on GSM8K test set for models both with or without LMSI in Fig. 5. For both cases, setting $m = 1 5$ already achieves a reasonably good accuracy, and using a larger $m$ only brings marginal improvements. We also notice that after SelfImprovement, using 5 paths for Self-Consistency can already surpass the performance of using 32 paths for model without Self-Improvement. Thus, with a well-improved model, huge computing resources can be saved when applied to real applications.
+
+# 6 Conclusions
+
+We demonstrated that a Large Language Model (LLM) is capable of improving its performance on reasoning datasets by training on its own generated labels, given input questions only. Experiments using the PaLM model with 540 billion parameters show that LMSI improves the accuracy scores by $1 . 1 \%$ to $7 . 7 \%$ on six datasets, without training on ground truth labels. Furthermore, we show that it is possible for the LLM to self-improve even on its own generated questions and few-shot CoT prompts. As part of our future work, we plan to combine large-scale generated data from LMSI and existing supervised data, to further improve the performance of LLMs.
+
+
+Figure 5: Accuracy results with or without LMSI on GSM8K test set using different numbers of sampled reasoning path for Self-Consistency.
+
+# Limitations
+
+Our approach mainly relies on the effectiveness of demonstration-based in-context few-shot learning which works most effectively on large language models, according to Wei et al. (2022a). For example, Zelikman et al. (2022) showed that a 6B model, GPT-J, achieves only $3 . 1 \%$ accuracy on GSM8K with few-shot CoT prompting, while GPT-3 (175 B) achieves $4 6 . 9 \%$ , according to Wei et al. (2022c). Moreover, a recent study (Kadavath et al., 2022) shows that language model calibration increases with model size. This aligns well with our observations that larger models are better at self-improving. Based on these existing studies, we believe that LMSI is more applicable to large-scale language models. In addition, we show that distillation from large models to small models are very promising in Sec. 5.3. Therefore, smaller models can also be improved when large model APIs are accessible. We are fortunate to have enough resources for this work. Though the computation requirements for training large-scale language models are still prohibitively high for most researchers to conduct empirical studies along this line, we believe that our findings are conceptually useful for the NLP community by providing new insights for the properties of large language models.
+
+# Acknowledgments
+
+We thank anonymous reviewers for valuable and insightful feedback.
+
+# References
+
+Massih-Reza Amini, Vasilii Feofanov, Loic Pauletto, Emilie Devijver, and Yury Maximov. 2022. Selftraining: A survey.
+
+Jimmy Ba and Rich Caruana. 2014. Do deep nets really need to be deep? Advances in neural information processing systems, 27.
+
+BIG bench collaboration. 2022. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models. ArXiv, abs/2206.04615.
+
+Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, T. J. Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeff Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020. Language models are few-shot learners. In Neurips.
+
+Oana-Maria Camburu, Tim Rocktäschel, Thomas Lukasiewicz, and Phil Blunsom. 2018. e-snli: Natural language inference with natural language explanations. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett, editors, Advances in Neural Information Processing Systems 31, pages 9539–9549. Curran Associates, Inc.
+
+Xiaokang Chen, Yuhui Yuan, Gang Zeng, and Jingdong Wang. 2021. Semi-supervised semantic segmentation with cross pseudo supervision. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR).
+
+Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek B Rao, Parker Barnes, Yi Tay, Noam M. Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Benton C. Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier García, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Oliveira Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Díaz, Orhan Firat, Michele Catasta, Jason Wei, Kathleen S. Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. 2022. Palm: Scaling language modeling with pathways. ArXiv, abs/2204.02311.
+
+Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Adams Yu, Albert Webson, Xinyun Chen, Gaurav Mishra, Zhuyun Dai, Shixiang Shane Gu, Mirac Suzgun, Vincent Zhao, Aakanksha Chowdhery, Sharan Narang, Yanping Huang, Andrew Dai, Hongkun Yu, Ed H. Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V. Le, and Jason Wei. 2022. Scaling instruction-finetuned language models. In arxiv.
+
+Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord. 2018. Think you have solved question answering? try arc, the ai2 reasoning challenge. ArXiv, abs/1803.05457.
+
+Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. 2021. Training verifiers to solve math word problems. ArXiv, abs/2110.14168.
+
+Ido Dagan, Oren Glickman, and Bernardo Magnini. 2005. The pascal recognising textual entailment challenge. In MLCW.
+
+Kumar Shri dhar, Alessandro Stolfo, and Mrinmaya Sachan. 2023. Distilling reasoning capabilities into smaller language models. In ACL.
+
+Dheeru Dua, Yizhong Wang, Pradeep Dasigi, Gabriel Stanovsky, Sameer Singh, and Matt Gardner. 2019. Drop: A reading comprehension benchmark requiring discrete reasoning over paragraphs. In NAACL.
+
+Jacob Eisenstein, Daniel Andor, Bernd Bohnet, Michael Collins, and David Mimno. 2022. Honest students from untrusted teachers: Learning an interpretable question-answering pipeline from a pretrained language model. arXiv preprint arXiv:2210.02498.
+
+Mor Geva, Daniel Khashabi, Elad Segal, Tushar Khot, Dan Roth, and Jonathan Berant. 2021. Did aristotle use a laptop? a question answering benchmark with implicit reasoning strategies. Transactions of the Association for Computational Linguistics, 9:346– 361.
+
+Junxian He, Jiatao Gu, Jiajun Shen, and Marc’Aurelio Ranzato. 2020. Revisiting self-training for neural sequence generation. In International Conference on Learning Representations.
+
+Geoffrey Hinton, Oriol Vinyals, Jeff Dean, et al. 2015. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2(7).
+
+Namgyu Ho, Laura Schmid, and Se-Young Yun. 2023. Large language models are reasoning teachers. ArXiv.
+
+Jaehun Jung, Lianhui Qin, Sean Welleck, Faeze Brahman, Chandra Bhagavatula, Ronan Le Bras, and Yejin Choi. 2022. Maieutic prompting: Logically consistent reasoning with recursive explanations.
+
+Saurav Kadavath, Tom Conerly, Amanda Askell, T. J. Henighan, Dawn Drain, Ethan Perez, Nicholas Schiefer, Zachary Dodds, Nova DasSarma, Eli TranJohnson, Scott Johnston, Sheer El-Showk, Andy Jones, Nelson Elhage, Tristan Hume, Anna Chen, Yuntao Bai, Sam Bowman, Stanislav Fort, Deep Ganguli, Danny Hernandez, Josh Jacobson, John Kernion, Shauna Kravec, Liane Lovitt, Kamal Ndousse, Catherine Olsson, Sam Ringer, Dario Amodei, Tom B. Brown, Jack Clark, Nicholas Joseph, Benjamin Mann, Sam McCandlish, Christopher Olah, and Jared Kaplan. 2022. Language models (mostly) know what they know. ArXiv, abs/2207.05221.
+
+Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. 2022. Large language models are zero-shot reasoners. Neural Information Processing Systems (NeurIPS).
+
+Anoop Korattikara Balan, Vivek Rathod, Kevin P Murphy, and Max Welling. 2015. Bayesian dark knowledge. Advances in neural information processing systems, 28.
+
+Andrew K. Lampinen, Ishita Dasgupta, Stephanie C. Y. Chan, Kory Matthewson, Michael Henry Tessler, Antonia Creswell, James L. McClelland, Jane X. Wang, and Felix Hill. 2022. Can language models learn from explanations in context?
+
+Aitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Venkatesh Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, Yuhuai Wu, Behnam Neyshabur, Guy Gur-Ari, and Vedant Misra. 2022. Solving quantitative reasoning problems with language models. ArXiv, abs/2206.14858.
+
+Yifei Li, Zeqi Lin, Shizhuo Zhang, Qiang Fu, Bei Chen, Jian-Guang Lou, and Weizhu Chen. 2022a. On the advance of making language models better reasoners.
+
+Yifei Li, Zeqi Lin, Shizhuo Zhang, Qiang Fu, Bei Chen, Jian-Guang Lou, and Weizhu Chen. 2022b. On the advance of making language models better reasoners. ArXiv, abs/2206.02336.
+
+Hunter Lightman, Vineet Kosaraju, Yura Burda, Harrison Edwards, Bowen Baker, Teddy Lee, Jan Leike, John Schulman, Ilya Sutskever, and Karl Cobbe. 2023. Let’s verify step by step. ArXiv, abs/2305.20050.
+
+Lucie Charlotte Magister, Jonathan Mallinson, Jakub Adamek, Eric Malmi, and Aliaksei Severyn. 2022. Teaching small language models to reason. ArXiv, abs/2212.08410.
+
+Wang Ling, Dani Yogatama, Chris Dyer, and Phil Blunsom. 2017b. Program induction by rationale generation: Learning to solve and explain algebraic word problems. In ACL.
+
+Yu Meng, Jiaxin Huang, Yu Zhang, and Jiawei Han. 2022. Generating training data with language models: Towards zero-shot language understanding. ArXiv, abs/2202.04538.
+
+Todor Mihaylov, Peter Clark, Tushar Khot, and Ashish Sabharwal. 2018. Can a suit of armor conduct electricity? a new dataset for open book question answering. In EMNLP.
+
+Wang Ling, Dani Yogatama, Chris Dyer, and Phil Blunsom. 2017a. Program induction by rationale generation: Learning to solve and explain algebraic word problems. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).
+
+Sharan Narang, Colin Raffel, Katherine Lee, Adam Roberts, Noah Fiedel, and Karishma Malkan. 2020. Wt5?! training text-to-text models to explain their predictions.
+
+Yixin Nie, Adina Williams, Emily Dinan, Mohit Bansal, Jason Weston, and Douwe Kiela. 2019. Adversarial nli: A new benchmark for natural language understanding. ArXiv, abs/1910.14599.
+
+Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. 2022. Training language models to follow instructions with human feedback. arXiv preprint arXiv:2203.02155.
+
+Arkil Patel, S. Bhattamishra, and Navin Goyal. 2021. Are nlp models really able to solve simple math word problems? In NAACL.
+
+Danish Pruthi, Rachit Bansal, Bhuwan Dhingra, Livio Baldini Soares, Michael Collins, Zachary C. Lipton, Graham Neubig, and William W. Cohen. 2022. Evaluating Explanations: How Much Do Explanations from the Teacher Aid Students? Transactions of the Association for Computational Linguistics, 10:359–375.
+
+Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. Squad: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. In EMNLP.
+
+Aruni RoyChowdhury, Prithvijit Chakrabarty, Ashish Singh, SouYoung Jin, Huaizu Jiang, Liangliang Cao, and Erik G. Learned-Miller. 2019. Automatic adaptation of object detectors to new domains using selftraining. In CVPR, pages 780–790.
+
+Victor Sanh, Albert Webson, Colin Raffel, Stephen H Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, et al. 2022. Multitask prompted training enables zero-shot task generalization. In ICLR.
+
+Timo Schick and Hinrich Schütze. 2020a. Exploiting cloze-questions for few-shot text classification and natural language inference. In Conference of the European Chapter of the Association for Computational Linguistics.
+
+Timo Schick and Hinrich Schütze. 2020b. It’s not just size that matters: Small language models are also few-shot learners. ArXiv, abs/2009.07118.
+
+Charlie Snell, Dan Klein, and Ruiqi Zhong. 2022. Learning by distilling context. arXiv preprint arXiv:2209.15189.
+
+Yi Tay, Mostafa Dehghani, Vinh Quang Tran, Xavier García, Jason Wei, Xuezhi Wang, Hyung Won Chung, Dara Bahri, Tal Schuster, Huaixiu Zheng, Denny Zhou, Neil Houlsby, and Donald Metzler. 2022. Ul2: Unifying language learning paradigms.
+
+Alex Wang, Yada Pruksachatkun, Nikita Nangia, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. 2019. Superglue: A stickier benchmark for general-purpose language understanding systems. ArXiv, abs/1905.00537.
+
+Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. 2018. Glue: A multi-task benchmark and analysis platform for natural language understanding. In BlackboxNLP@EMNLP.
+
+Boshi Wang, Sewon Min, Xiang Deng, Jiaming Shen, You Wu, Luke Zettlemoyer, and Huan Sun. 2022a. Towards understanding chain-of-thought prompting: An empirical study of what matters. In Annual Meeting of the Association for Computational Linguistics.
+
+Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. 2022b. Rationaleaugmented ensembles in language models. ArXiv, abs/2207.00747.
+
+Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. 2022c. Self-consistency improves chain of thought reasoning in language models. ArXiv, abs/2203.11171.
+
+Jason Wei, Maarten Bosma, Vincent Y Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M Dai, and Quoc V Le. 2021. Finetuned language models are zero-shot learners. arXiv preprint arXiv:2109.01652.
+
+Jason Wei, Yi Tay, Rishi Bommasani, Colin Raffel, Barret Zoph, Sebastian Borgeaud, Dani Yogatama, Maarten Bosma, Denny Zhou, Donald Metzler, Ed Huai hsin Chi, Tatsunori Hashimoto, Oriol Vinyals, Percy Liang, Jeff Dean, and William Fedus. 2022a. Emergent abilities of large language models. ArXiv, abs/2206.07682.
+
+Jason Wei, Yi Tay, Rishi Bommasani, Colin Raffel, Barret Zoph, Sebastian Borgeaud, Dani Yogatama, Maarten Bosma, Denny Zhou, Donald Metzler, et al. 2022b. Emergent abilities of large language models. arXiv preprint arXiv:2206.07682.
+
+Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Brian Ichter, Fei Xia, Quoc Le, and Denny Zhou. 2022c. Chain of thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35.
+
+Adina Williams, Nikita Nangia, and Samuel R. Bowman. 2018. A broad-coverage challenge corpus for sentence understanding through inference. In NAACL.
+
+Zhiheng Xi, Senjie Jin, Yuhao Zhou, Rui Zheng, Songyang Gao, Tao Gui, Qi Zhang, and Xuanjing Huang. 2023. Self-polish: Enhance reasoning in large language models via problem refinement.
+
+Qizhe Xie, Minh-Thang Luong, Eduard Hovy, and Quoc V. Le. 2020. Self-training with noisy student improves imagenet classification. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 10684–10695.
+
+Xi Ye and Greg Durrett. 2022. The unreliability of explanations in few-shot in-context learning.
+
+Kang Min Yoo, Dongju Park, Jaewook Kang, SangWoo Lee, and Woomyeong Park. 2021. Gpt3mix: Leveraging large-scale language models for text augmentation. In EMNLP Findings.
+
+Omar Zaidan, Jason Eisner, and Christine Piatko. 2007. Using “annotator rationales” to improve machine learning for text categorization. NAACL.
+
+Eric Zelikman, Yuhuai Wu, Jesse Mu, and Noah D. Goodman. 2022. Star: Bootstrapping reasoning with reasoning.
+
+Zhuosheng Zhang, Aston Zhang, Mu Li, and Alexander J. Smola. 2022. Automatic chain of thought prompting in large language models. ArXiv, abs/2210.03493.
+
+Chuanyang Zheng, Zhengying Liu, Enze Xie, Zhenguo Li, and Yu Li. 2023. Progressive-hint prompting improves reasoning in large language models. ArXiv, abs/2304.09797.
+
+Denny Zhou, Nathanael Scharli, Le Hou, Jason Wei, Nathan Scales, Xuezhi Wang, Dale Schuurmans, Olivier Bousquet, Quoc Le, and Ed Chi. 2022. Leastto-most prompting enables complex reasoning in large language models. ArXiv, abs/2205.10625.
+
+# A Appendix
+
+# A.1 Results on UL2 model
+
+We also apply LMSI on a recently proposed public language model, UL2 (Tay et al., 2022), using the pre-trained model at step $2 , 6 5 0 { , } 0 0 0 ^ { 3 }$ . We use a fixed set of hyperparameters for fine-tuning on each dataset. Specifically, we generate $m = 4 0$ reasoning paths for each question in a training set for majority voting. We fine-tune the model for 10k steps with a learning rate of $5 \mathrm { e } - 5$ and a batch size of 32. For multiple path decoding, we use a sampling temperature of $T = 0 . 5$ with the pre-trained UL2 model following Tay et al. (2022), and set $T = 0 . 7$ for the language model after LMSI . We set the maximum number of decode steps to 256 for all experiments.
+
+The results are shown in Table 8. For arithmetic reasoning datasets, we follow (Tay et al., 2022) to provide both exact matching accuracy scores as well as accuracy scores after an equation-correction postprocessing step. We observe that for most datasets, LMSI still improves the reasoning accuracy $( + 1 . 6 \%$ on DROP, $+ 1 . 2 \%$ on OpenBookQA, and $+ 0 . 7 \%$ on ANLI-A2), but the improvement on UL2 is not as large as that on 540B. We think the reason is that, since LMSI exploits the implicit rationale of language models, and the capacity of a language model is determined by its size, larger models can capture more high-order semantics and are more likely to benefit from LMSI . For example, on the adversarial entailment tasks of ANLI (which is a three-class classification problem with labels “yes”, “no”, or “it is not possible to tell”), the UL2 model w/o LMSI only achieves an accuracy of marginally above $1 / 3$ , implying that the model is slightly better than doing random guess on this challenging task without any training. Our proposed LMSI can still improve the performance under this hard case by training on its implicit knowledge from self-generated paths.
+
+Table 8: Accuracy results on six reasoning benchmarks with LMSI on UL2. On GSM8K and DROP, we also include accuracy scores after an equation-correction postprocessing step.
+
+
Prompting Method
GSM8K
DROP
ARC-c
OpenBookQA
ANLI-A2
ANLI-A3
w/o LMSI
CoT-Prompting
5.4/7.1
11.1/16.8
49.9
53.6
35.9
33.8
Self-Consistency
6.4/9.9
16.8/26.5
54.7
54.0
37.4
36.8
LMSI
CoT-Prompting
6.1/8.6
11.4/17.1
50.9
53.8
35.4
34.4
Self-Consistency
7.9/10.2
18.1/28.1
54.9
55.2
38.1
37.4
+
+# A.2 Chain-of-Thought Prompts for Each Dataset
+
+We list the Chain-of-Thought Prompts for each dataset for “CoT-Prompting” experiments and selfgenerated training samples.
+
+Table 10: Few-shot CoT prompts for OpenBookQA, from (Wang et al., 2022b).
+
+
Q: There are 15 trees in the grove. Grove workers willplant trees in the grove today. After they are done, there will be 21 trees.How many trees did the grove workers plant today? A: We start with 15 trees.Later we have 21 trees.The difference must be the number of trees they planted. So,they must have planted 21 - 15 = 6 trees. The answer is 6.
Q: If there are 3 cars in the parking lot and 2 more cars arrive,how many cars are in the parking lot?
A: There are 3cars in the parking lot already.2 more arrive.Now there are 3 + 2=5cars.The answer is 5.
Q: Leah had 32 chocolates and her sister had 42.If they ate 35,how many pieces do they have left in total? A: Leah had 32 chocolates and Leah's sister had 42. That means there were originally 32 + 42 = 74
chocolates.35 have been eaten.So in total they stillhave 74 -35=39 chocolates.The answer is 39.
Q: Jason had 20 lollipops.He gave Denny some lolipops.Now Jason has 12 lollipops.How many lollipops did Jason give to Denny?
A: Jason had 20 lolipops.Since he only has 12 now, he must have given the rest to Denny. The number of lollipops he has given to Denny must have been 2O - 12 = 8 lollipops.The answer is 8.
Q: Shawn has five toys.For Christmas,he got two toys each from his mom and dad. How many toys does he have now?
A: He has 5 toys.He got 2 from mom,so after that he has 5 +2 =7 toys. Then he got 2 more from dad, so in total he has 7 + 2= 9 toys. The answer is 9.
Q: There were nine computers in the server room. Five more computers were installed each day, from monday to thursday. How many computers are now in the server room?
A: There are 4 days from monday to thursday.5 computers were added each day. That means in total 4 * 5= 20 computers were added.There were 9 computers in the beginning,so now there are9+ 20= 29 computers. The answer is 29.
Q: Michael had 58 golf bals.On tuesday, he lost 23 golf balls. On wednesday,he lost 2 more.How many golf balls did he have at the end of wednesday?
A: Michael initially had 58 balls.He lost 23on Tuesday,so after that he has 58- 23 =35 balls.On Wednesday he lost 2 more so now he has 35 -2= 33 balls. The answer is 33.
+
+Q: Poison causes harm to which of the following? (a) a Tree (b) a robot (c) a house (d) a car
+A: Poison will harm living things, only a tree is a living thing. The answer is (a).
+Q: As you look deeper into a Marbel you can see (a) the future (b) minut defects (c) colors (d) the other side A: Marbel is not transparent, so you can not see the other side. Marbel does not necessarily have multiple colors. You will see minut defects. The answer is (b).
+Q: When food is reduced in the stomach (a) the mind needs time to digest (b) take a second to digest what I said (c) nutrients are being deconstructed (d) reader’s digest is a body of works
+A: The food is being deconstructed in the stomach during digestion. The answer is (c).
+Q: The sun is responsible for (a) puppies learning new tricks (b) children growing up and getting old (c) flowers wilting in a vase (d) plants sprouting, blooming and wilting
+A: The sun can affect the growing of living things, like plants. The answer is (d).
+
+Q: Since the 1970s, U.S. governments have negotiated managed-trade agreements, such as the North American Free Trade Agreement in the 1990s, the Dominican Republic-Central America Free Trade Agreement in 2006, and a number of bilateral agreements. In Europe, six countries formed the European Coal and Steel Community in 1951 which became the European Economic Community in 1958. Two core objectives of the EEC were the development of a common market, subsequently renamed the single market, and establishing a customs union between its member states. How many years did the European Coal and Steel Community exist?
+
+A: According to the passage, the European Coal and Steel Community was established in 1951 and became the EEC in 1958. 1958 - $1 9 5 1 = 7$ . So the answer is 7.
+
+Q: In the county, the population was spread out with $2 3 . 5 0 \%$ under the age of 18, $8 . 7 0 \%$ from 18 to 24, $2 9 . 7 0 \%$ from 25 to 44, $2 4 . 7 0 \%$ from 45 to 64, and $1 3 . 3 0 \%$ who were 65 years of age or older. How many more percent are under the age of 18 compared to the 18 to 24 group?
+
+A: According to the passage, $2 3 . 5 \%$ are under the age of 18, and $8 . 7 \%$ are from ages 18 to $2 4 . 2 3 . 5 \% - 8 . 7 \%$ $= 1 4 . 8 \%$ . So the answer is 14.8.
+
+Q: Playing in their second straight Thanksgiving game, the Eagles struggled especially on defense, where they were unable to stop the much-hyped Lions offense. The worst of it all was how unproven rookie Eric Rowe was tasked with covering wide receiver Calvin Johnson, leading to Johnson catching 3 touchdowns. Stafford’s five passing touchdowns, including three of them to Johnson was too much for the Eagles to overcome and for the second consecutive time this season, the Eagles gave up 45 points in a game. With the loss, the Eagles drop to 4-7 on the season and 6-1 when playing on Thanksgiving. How many TD passes did Stafford throw other than to Johnson?
+
+A: According to the passage, Stafford threw $5 ~ \mathrm { T D }$ passes, 3 of which were to Johnson. $5 - 3 = 2$ . So the answer is 2.
+
+Table 12: Few-shot CoT prompts for DROP (football), from (Zhou et al., 2022).
+
+Q: The Seahawks played the San Francisco 49ers. In the first quarter, the Hawks RB Julius Jones got a 27-yard TD run, along with DT Craig Terrill returning a fumble 9 yards for a touchdown. In the third quarter, the 49ers almost rallied as RB H. J. Torres made a 12-yard TD pass to Lucas Nelly, along with Mare kicking a 32-yard field goal. In the final quarter, Julius Jones got another 11-yard TD. How many yards do the shortest touchdown run and the longest touchdown pass combine for?
+
+A: All the touchdown runs are: a 27-yard touchdown run, a 9-yard touchdown run, a 11-yard touchdown run. The smallest number among 27, 9, 11 is 9. So the shortest touchdown run was 9 yards. All the touchdown passes are: a 12-yard touchdown pass. So the longest touchdown pass was 12 yards. So the shortest touchdown run and the longest touchdown pass combine for $9 + 1 2 = 2 1$ yards. So the answer is 21 yards.
+
+Q: The Steelers went home for a duel with the Baltimore Ravens. Pittsburgh would deliver the opening punch in the first quarter with a 1-yard touchdown from running back Rashard Mendenhall. The Ravens would make it even as running back Willis McGahee got a 9-yard TD. The Ravens kicker Billy Cundiff got a 45-yard field goal in the second quarter, concluding the first half with a 10-7 lead. The Steelers brought the game into overtime with a 38-yard field goal by Andrew Foster. The Ravens Billy Cundiff pulled off a winning 33-yard field goal in overtime. How many points did the Ravens have at halftime?
+
+A: The Ravens kicker Billy Cundiff got a 45-yard field goal in the second quarter, concluding the first half with a 10-7 lead. So the Ravens had 10 points at halftime. So the answer is 10 points.
+
+Q: The Vikings flew to Bank of America Stadium to face the Carolina Panthers. After a scoreless first quarter, Carolina got on the board with quarterback Matt Moore finding fullback Brad Hoover on a 1-yard TD pass. After yet another scoreless quarter, Carolina sealed the game as Matt Moore completed a 42-yard touchdown pass to wide receiver Steve Smith. How many scoreless quarters were there?
+
+A: The first and third quarters were the scoreless quarters. So there are 2 scoreless quarters. So the answer is 2.
+
+Premise:
+"Conceptually cream skimming has two basic dimensions - product and geography."
+Based on this premise, can we conclude the hypothesis "Product and geography are what make cream skimming
+work." is true?
+OPTIONS:
+- yes
+- no
+- it is not possible to tell
+
+A: Based on "cream skimming has two basic dimensions" we can’t infer that these two dimensions are what make cream skimming work. The answer is it is not possible to tell.
+
+"One of our member will carry out your instructions minutely."
+
+Based on this premise, can we conclude the hypothesis "A member of my team will execute your orders with immense precision." is true?
+
+OPTIONS:
+- yes
+- no
+- it is not possible to tell
+
+A: "one of" means the same as "a member of", "carry out" means the same as "execute", and "minutely" means the same as "immense precision". The answer is yes.
+
+Premise:
+"Fun for adults and children."
+Based on this premise, can we conclude the hypothesis "Fun for only children." is true?
+OPTIONS:
+- yes
+- no
+- it is not possible to tell
+
+A: "adults and children" contradicts "only children". The answer is no.
+
+Premise:
+"He turned and smiled at Vrenna."
+Based on this premise, can we conclude the hypothesis "He smiled at Vrenna who was walking slowly behind
+him with her mother." is true?
+OPTIONS:
+- yes
+- no
+- it is not possible to tell
+
+A: the premise does not say anything about "Vrenna was walking". The answer is it is not possible to tell.
+
+Premise:
+"well you see that on television also"
+Based on this premise, can we conclude the hypothesis "You can see that on television, as well." is true?
+OPTIONS:
+- yes
+- no
+- it is not possible to tell
+
+A: "also" and "as well" mean the same thing. The answer is yes.
+
+Premise:
+"Vrenna and I both fought him and he nearly took us."
+Based on this premise, can we conclude the hypothesis "Neither Vrenna nor myself have ever fought him." is true?
+OPTIONS:
+- yes
+- no
+- it is not possible to tell
+A: "Vrenna and I both" contradicts "neither Vrenna nor myself". The answer is no. Q: John found that the average of 15 numbers is 40. If 10 is added to each number then the mean of the numbers is? Answer Choices: (a) 50 (b) 45 (c) 65 (d) 78 (e) 64
+A: If 10 is added to each number, then the mean of the numbers also increases by 10. So the new mean would be 50. The answer is (a).
+Q: If a $/ \mathrm { b } = 3 / 4$ and $8 \mathrm { a } + 5 \mathrm { b } = 2 2$ ,then find the value of a. Answer Choices: (a) 1/2 (b) 3/2 (c) $5 / 2$ (d) 4/2 (e) 7/2
+A: If a $/ \mathrm { b } = 3 / 4$ , then $\mathsf { b } = 4 \mathsf { a } \mathrm { ~ / ~ } 3$ . So $8 \mathrm { a } + 5 ( 4 \mathrm { a } / 3 ) = 2 2$ . This simplifies to $8 \mathrm { a } + 2 0 \mathrm { a } / 3 = 2 2$ , which means $4 4 \mathrm { a } / 3 = 2 2$ . So a is equal to $3 / 2$ . The answer is (b).
+Q: A person is traveling at $2 0 \mathrm { k m / h r }$ and reached his destiny in $2 . 5 \mathrm { h r }$ then find the distance? Answer Choices: (a) $5 3 \mathrm { k m }$ (b) $5 5 \mathrm { k m }$ (c) $5 2 \mathrm { k m }$ (d) $6 0 \mathrm { k m }$ (e) $5 0 \mathrm { k m }$
+A: The distance that the person traveled would have been $2 0 \mathrm { k m } / \mathrm { h r } * 2 . 5 \mathrm { h r s } = 5 0 \mathrm { k m }$ . The answer is (e). Q: How many keystrokes are needed to type the numbers from 1 to 500? Answer Choices: (a) 1156 (b) 1392 (c) 1480 (d) 1562 (e) 1788
+A: There are 9 one-digit numbers from 1 to 9. There are 90 two-digit numbers from 10 to 99. There are 401 three-digit numbers from 100 to $5 0 0 . ~ 9 + 9 0 ( 2 ) + 4 0 1 ( 3 ) = 1 3 9 2$ . The answer is (b).
+
+Table 16: Few-shot CoT prompts for StrategyQA, from (Wei et al., 2022c).
+
+
Q: Do hamsters provide food for any animals? A: Hamsters are prey animals.Prey are food for predators.Thus,hamsters provide food for some animals.
The answer is yes.
Q: Could Brooke Shields succeed at University of Pennsylvania? A: Brooke Shields went to Princeton University. Princeton University is about as academically rigorous as
the University of Pennsylvania. Thus,Brooke Shields could also succeed at the University of Pennsylvania. The answer is yes.
Q: Yes or no: Hydrogen's atomic number squared exceeds number of Spice Girls?
A: Hydrogen has an atomic number of 1.1 squared is 1. There are 5 Spice Girls. Thus,Hydrogen's atomic number squared is less than 5.The answer is no.
Q: Yes or no: Is it common to see frost during some college commencements?
A: College commencement ceremonies can happen in December,May,and June.December is in the winter,
so there can be frost. Thus,there could be frost at some commencements.The answer is yes.
Q: Yes or no: Could a llama birth twice during War in Vietnam (1945-46)?
A: The War in Vietnam was 6 months.The gestation period for alama is 11 months, which is more than 6 months.Thus,a llama could not give birth twice during the War in Vietnam. The answer is no.
Q: Yes or no: Would a pear sink in water?
A: The density of a pear is about O.6 g/cm,which is less than water. Objects less dense than water float.
+
+Table 17: Few-shot CoT prompts for RTE, from (Wang et al., 2022b).
+
+"No Weapons of Mass Destruction Found in Iraq Yet." Based on this premise, can we conclude the hypothesis "Weapons of Mass Destruction Found in Iraq." is true?
+
+A: "No Weapons of Mass Destruction Found" contradicts "Weapons of Mass Destruction Found". The answer is no.
+
+Premise:
+
+"A place of sorrow, after Pope John Paul II died, became a place of celebration, as Roman Catholic faithful gathered in downtown Chicago to mark the installation of new Pope Benedict XVI."
+
+Based on this premise, can we conclude the hypothesis "Pope Benedict XVI is the new leader of the Roman Catholic Church." is true?’
+
+A: "installation of new Pope Benedict XVI." means "Pope Benedict XVI is the new leader". The answer is yes.
+
+Premise:
+
+"A man is due in court later charged with the murder 26 years ago of a teenager whose case was the first to be featured on BBC One’s Crimewatch. Colette Aram, 16, was walking to her boyfriend’s house in Keyworth, Nottinghamshire, on 30 October 1983 when she disappeared. Her body was later found in a field close to her home. Paul Stewart Hutchinson, 50, has been charged with murder and is due before Nottingham magistrates later."
+
+Based on this premise, can we conclude the hypothesis "Paul Stewart Hutchinson is accused of having stabbed a girl." is true?
+
+A: The premise does not say Paul Stewart Hutchinson "stabbed" this girl. The answer is no.
+
+Premise:
+
+"Herceptin was already approved to treat the sickest breast cancer patients, and the company said, Monday, it will discuss with federal regulators the possibility of prescribing the drug for more breast cancer patients." Based on this premise, can we conclude the hypothesis "Herceptin can be used to treat breast cancer." is true?
+
+A: "Herceptin was approved to treat breast cancer" implies that "Herceptin can be used to treat breast cancer".
+The answer is yes.
\ No newline at end of file
diff --git a/md/dev/uxxFrDwrE7Y/uxxFrDwrE7Y.md b/md/dev/uxxFrDwrE7Y/uxxFrDwrE7Y.md
new file mode 100644
index 0000000000000000000000000000000000000000..2b56db55eb13c1c55239d689967c88def86a43bb
--- /dev/null
+++ b/md/dev/uxxFrDwrE7Y/uxxFrDwrE7Y.md
@@ -0,0 +1,366 @@
+# LEARNING FAST, LEARNING SLOW: A GENERALCONTINUAL LEARNING METHOD BASED ON COMPLE-MENTARY LEARNING SYSTEM
+
+Elahe Arani∗, Fahad Sarfraz\* & Bahram Zonooz
+Advanced Research Lab, NavInfo Europe, Eindhoven, Netherlands
+{elahe.arani, fahad.sarfraz}@navinfo.eu, bahram.zonooz@gmail.com
+
+# ABSTRACT
+
+Humans excel at continually learning from an ever-changing environment whereas it remains a challenge for deep neural networks which exhibit catastrophic forgetting. The complementary learning system (CLS) theory suggests that the interplay between rapid instance-based learning and slow structured learning in the brain is crucial for accumulating and retaining knowledge. Here, we propose CLS-ER, a novel dual memory experience replay (ER) method which maintains short-term and long-term semantic memories that interact with the episodic memory. Our method employs an effective replay mechanism whereby new knowledge is acquired while aligning the decision boundaries with the semantic memories. CLSER does not utilize the task boundaries or make any assumption about the distribution of the data which makes it versatile and suited for “general continual learning”. Our approach achieves state-of-the-art performance on standard benchmarks as well as more realistic general continual learning settings.
+
+# 1 INTRODUCTION
+
+Continual learning (CL) refers to the ability of a learning agent to continuously interact with a dynamic environment and process a stream of information to acquire new knowledge while consolidating and retaining previously obtained knowledge (Parisi et al., 2019). This ability to continuously learn from a changing environment is a hallmark of intelligence and a critical missing component in our quest towards making our models truly intelligent. The major challenge towards enabling CL in deep neural networks (DNNs) is that the continual acquisition of incrementally available information from non-stationary data distributions leads to catastrophic forgetting whereby the performance of the model on previously learned tasks drops drastically (McCloskey & Cohen, 1989).
+
+Several approaches have been proposed to address the issue of catastrophic forgetting in CL. These can be broadly categorized into regularization-based methods (Farajtabar et al., 2020; Kirkpatrick et al., 2017; Ritter et al., 2018; Zenke et al., 2017) which penalizes changes in the network weights, network expansion-based methods (Rusu et al., 2016; Yoon et al., 2017) which dedicate a distinct set of network parameters to distinct tasks, and rehearsal-based methods (Chaudhry et al., 2018; Lopez-Paz & Ranzato, 2017) which maintains a memory buffer and replays samples from previous tasks. Amongst these, rehearsal-based methods have proven to be more effective in challenging CL tasks (Farquhar & Gal, 2018). However, an optimal approach for replaying memory samples and constraining the model update to efficiently consolidate knowledge remains an open question.
+
+In the brain, the ability to continually acquire, consolidate, and transfer knowledge over time is mediated by a rich set of neurophysiological processing principles (Parisi et al., 2019; Zenke et al., 2017) and multiple memory systems (Hassabis et al., 2017). In particular, the CLS theory (Kumaran et al., 2016) posits that efficient learning requires two complementary learning systems: the hippocampus exhibits short-term adaptation and rapid learning of episodic information which is then gradually consolidated to the neocortex for slow learning of structured information. Furthermore, a recent study by Hayes et al. (2021) identified the missing elements of biological reply in the replay mechanisms employed in DNNs for CL. They highlight that many existing approaches only focus on modeling the prefrontal cortex directly and do not have a fast learning network which plays a critical role in enabling efficient CL in the brain. Inspired by these studies, we hypothesize that mimicking the slow and rapid adaptation of information and having an efficient mechanism for incorporating them into the working memory can enable better CL in DNNs.
+
+
+Figure 1: CLS-ER employs a dual-memory learning mechanism whereby the episodic memory stores the samples and the semantic memories build short-term and long-term memories of the learned representations of the working model. The two memories interact to enforce a consistency loss on the working model which prevents rapid changes in the parameter space and enables the alignment of the decision boundary with semantic memories for effective knowledge consolidation.
+
+To this end, we propose a novel dual memory experience replay method based on the complementary learning systems theory in the brain, dubbed as CLS-ER. In addition to a small episodic memory, our method builds long-term and short-term semantic memories which mimic the rapid and slow adaptation of information (Figure 1). As the network weights encode the learned representations of the tasks (Krishnan et al., 2019), the semantic memories are maintained by taking the exponential moving average of the working model’s weights to consolidate information across the tasks with varying time windows and frequencies. The semantic memories interact with the episodic memory to extract consolidated replay activation patterns and enforce a consistency loss on the update of the working model so that new knowledge is acquired while aligning the decision boundary of the working model with the decision boundaries of semantic memories. This maintains a balance between the plasticity and stability of the model for effective knowledge consolidation.
+
+CLS-ER provides a general CL method that does not utilize the task boundaries or make any strong assumption regarding the distribution of the data and tasks. We demonstrate the versatility and effectiveness of our method on a wide range of CL benchmark tasks as well as more challenging scenarios which simulate the complexities of CL in the real world.
+
+# 2 RELATED WORK
+
+The base method for the rehearsal-based approach, Experience Replay (ER) (Riemer et al., 2018) combines the memory samples with the task samples into the training batch. Several techniques have since been employed on top of ER. Meta Experience Replay (MER) (Riemer et al., 2018) considers replay as a meta-learning problem for maximizing the transfer from previous tasks and minimizing the interference. iCARL (Rebuffi et al., 2017) uses the nearest average representation of past exemplars to classify in an incrementally learned representation space. Gradient Episodic Memory (GEM) (Lopez-Paz & Ranzato, 2017) formulates optimization constraints on the exemplars in memory. Gradient-based Sample Selection (GSS) (Aljundi et al., 2019) aims for memory sample diversity in the gradient space and provides a greedy selection approach. Function Distance Regularization (FDR) (Benjamin et al., 2018) saves the network response at the task boundaries and adds a consistency loss on top of ER. Dark Experience Replay $( \mathrm { D E R + + } )$ applies knowledge distillation (Sarfraz et al., 2021) and regularization on logits sampled during the optimization trajectory.
+
+CLS has been used as a source of inspiration for dual memory learning systems in earlier works (French, 1999; Robins, 1993) but they have not been shown to scale to current computer vision tasks (Parisi et al., 2019). Recently, Rostami et al. (2019) utilizes a generative model to couple sequential tasks in a latent embedding space. Kamra et al. (2017) utilizes two generative models in a dual memory architecture. However, they utilize the task boundaries and generative replay has its own set of challenges as it is difficult to learn a faithful distribution and performs sub-par in comparison to instance-based replay methods on challenging CL settings. Generally, the inspiration from CLS theory in DNNs has been mostly limited to episodic memory and mimicking the rapid and slow learning mechanism is majorly ignored (Hayes et al., 2021) which we aim to address.
+
+
+Figure 2: Task-wise performance on S-CIFAR-10 test set with 500 buffer size. The models are evaluated at the end of each task (y-axis) to evaluate how the task performances $\mathbf { \bar { X } }$ -axis) are affected as training progress. The stable model retains information from earlier tasks while the plastic model quickly adapts to the recent task. Note that there is less forgetting in the semantic memories compared to the working model. For other buffer sizes and S-TinyImageNet see Figures S1 and S2.
+
+# 3 METHOD
+
+We first provide an overview of the CLS theory for the brain and how we aim to mimic it for DNNs before introducing the main components of our method and the overall formulation.
+
+# 3.1 COMPLEMENTARY LEARNING SYSTEM THEORY
+
+The CLS theory posits that effective lifelong learning in the brain requires two complementary learning systems. The hippocampus rapidly encodes novel information as a short-term memory which is subsequently used to transfer and consolidate knowledge in the neocortex which gradually acquires structured knowledge representation as long-term memory through experience replay. The interplay between the functionality of the hippocampus and neocortex is crucial for concurrently learning efficient representations (for better generalization) and the specifics of instance-based episodic memory.
+
+# 3.2 COMPLEMENTARY LEARNING SYSTEM BASED EXPERIENCED REPLAY
+
+Inspired by the CLS theory, we propose a dual memory experience replay method, CLS-ER, which aims to mimic the interplay between fast learning and slow learning mechanisms for enabling effective CL in DNNs. Our method maintains short-term and long-term semantic memories of the encountered tasks which interact with the episodic memory for replaying the associated neural activities. The working model is updated so that it acquires new knowledge while aligning its decision boundary with the semantic memories to enable the consolidation of structured knowledge across the tasks. Figure 1 highlights the parallels between CLS theory and our method.
+
+Semantic Memories: Central to our method is the maintenance of two semantic memories which accumulate and consolidate information over long-term and short-term periods. As the acquired knowledge of the learned tasks is encoded in the weights of DNNs (Krishnan et al., 2019), we aim to form our semantic memories by accumulating the knowledge encoded in the corresponding weights of the model as it sequentially learns different tasks.
+
+An efficient method for aggregating the weights of a model is provided by Mean Teacher (Tarvainen & Valpola, 2017) which is a knowledge distillation approach that uses an exponential moving average (EMA) of the student’s weights during training as a teacher for semi-supervised learning. It can also be considered as forming a self-ensemble of the intermediate model states that leads to better internal representations. We adapt the Mean Teacher approach to build our semantic memories as it provides a computational and memory-efficient method for accumulating knowledge over the tasks.
+
+As CL involves learning tasks sequentially, the model weights at each training step can be considered as a student model specialized for a particular task. Therefore, averaging the weights during training can be considered as forming an ensemble of task-specific student models which effectively aggregates information across the tasks and leads to smoother decision boundaries. CLS-ER builds long-term (stable model) and short-term (plastic model) semantic memories by maintaining two EMA-weighted models over the working model’s weights. The stable model is updated less frequently with a larger window size so that it retains more information from the earlier tasks while the plastic model is updated more frequently with a smaller window size so that it adapts faster to information from new tasks (Figure 2). Section D further demonstrates the benefits of employing two semantic memories instead of a single semantic memory.
+
+Episodic Memory: Replay of samples from the previous tasks stored in a small episodic memory is a common approach in CL that has proven to be effective in mitigating catastrophic forgetting. As we aim to position CLS-ER as a versatile general incremental learning method, we do not utilize the task boundaries or make any strong assumptions about the distribution of the tasks or samples. Therefore, to maintain a fixed episodic memory buffer, we employ Reservoir sampling (Vitter, 1985) which assigns equal probability to each sample in the stream for being represented in the buffer and randomly replaces the existing memory samples (Algorithm 2). It is a global distribution matching strategy that ensures that at any given time the distribution of samples in the buffer will approximately match the distribution of all the samples seen so far (Isele & Cosgun, 2018).
+
+Consolidation of Information: The key challenge in CL is the consolidation of new information with the previously acquired information. This requires an effective balance between the stability and plasticity of the model. Furthermore, the sharp change in decision boundary as a new task is learned makes the consolidation of information over tasks more challenging. CLS-ER tackles these challenges through a novel dual memory experience replay mechanism. The long-term and shortterm semantic memories interact with the episodic memory to extract the consolidated activations for the memory samples which are then utilized to constrain the update of the working model so that new knowledge is obtained whilst the decision boundary is aligned with the semantic memories. This prevents rapid changes in the parameter space as new tasks are learned. Furthermore, aligning the working model’s decision boundary with the semantic memories serves two goals: (i) helps in retaining and consolidating information and (ii) leads to a smoother adaptation of decision boundary.
+
+# 3.3 FORMULATION
+
+CLS-ER involves training a working model $f ( . ; \theta _ { w } )$ on a data stream $\mathcal { D }$ sampled from a non-iid distribution. Two additional EMA-weighted models are maintained as semantic memories: plastic model $f ( . ; \theta _ { P } )$ and the stable model $f ( . ; \theta _ { S } )$ . Finally, Reservoir sampling (Vitter, 1985) is employed to maintain a small episodic memory $\mathcal { M }$ .
+
+At each training step, the working model receives the training batch $X _ { b }$ from the data stream and retrieves a random batch of exemplars $X _ { m }$ from the episodic memory. This is then followed by the retrieval of optimal semantic information, i.e. the structural knowledge encoded in the semantic memories which account for the consolidation of feature space and adaptation of the decision boundaries of the previous tasks. The semantic memories are designed so that the plastic model has higher performance on recent tasks whereas the stable model prioritizes retaining information on the older tasks. Therefore, we would prefer to use the logits from the stable model $Z _ { S }$ for older exemplars and the plastic model $Z _ { P }$ for recent exemplars. As CLS-ER is a general incremental learning method, instead of using a hard threshold or task information, we opt for a simple task-agnostic approach of using the performance of the semantic memories on the exemplars as a selection criterion that empirically works well. For each exemplar, we select the replay logits $Z$ based on which model has the highest softmax score for the ground-truth class (lines 5-6 in Algorithm 1).
+
+The selected replay logits from the semantic memories are then used to enforce a consistency loss on the working model so that it does not deviate from the already learned experiences. Hence, the working model is updated with a combination of the cross-entropy loss on the union of the data stream and episodic memory samples, $X$ , and the consistency loss on the exemplars $X _ { m }$ ,
+
+$$
+\mathcal { L } = \mathcal { L } _ { C E } ( \sigma ( f ( X ; \theta _ { W } ) ) , Y ) + \lambda \mathcal { L } _ { M S E } ( f ( X _ { m } ; \theta _ { W } ) , Z )
+$$
+
+Input: Data stream $\mathcal { D }$ , Learning rate $\eta$ , Consistency weight $\lambda$ , Update rates $r _ { P }$ and $r _ { S }$ , Decay parameters $\alpha _ { P }$ and $\alpha _ { S }$ Initialize: ${ \theta } _ { W } = { \theta } _ { P } = { \theta } _ { S }$ $\mathcal { M } \{ \}$
+1: while Training do
+2: $( X _ { b } , Y _ { b } ) \sim \mathcal { D }$ and $( X _ { m } , Y _ { m } ) \sim { \mathcal { M } }$
+3: $( X , Y ) = \{ ( X _ { b } , Y _ { b } ) , ( X _ { m } , Y _ { m } ) \}$
+4: $Z _ { P } , Z _ { S } \gets f ( X _ { m } ; \theta _ { P } ) , f ( X _ { m } ; \theta _ { S } )$ . Select optimal semantic memory
+5: $Z Z _ { P }$ if $\sigma ( Z _ { P } ) ^ { ( Y _ { m } ) } > \sigma ( Z _ { S } ) ^ { ( Y _ { m } ) }$ else $Z _ { S }$
+6: $\mathcal { L } = \mathcal { L } _ { C E } ( \sigma ( f ( X ; \theta _ { W } ) ) , Y ) + \lambda \mathcal { L } _ { M S E } ( f ( X _ { m } ; \theta _ { W } ) , Z )$ . Update working model
+7: $\theta _ { W } \theta _ { W } - \eta \nabla _ { \theta _ { W } } \mathcal { L }$
+8: $a , b \sim \mathcal { U } ( 0 , 1 )$ . Update semantic memories
+9: $\theta _ { P } \alpha _ { p } \theta _ { P } + ( 1 - \alpha _ { P } ) \theta _ { W }$ if $a < r _ { P }$ else $\theta _ { P }$
+10: $\theta _ { S } \alpha _ { S } \theta _ { S } + ( 1 - \alpha _ { S } ) \theta _ { W }$ if $b < r _ { S }$ else $\theta _ { S }$
+11: $\mathcal { M } R e s e r v o i r ( \mathcal { M } , ( X _ { b } , Y _ { b } ) )$ $\triangleright$ Update episodic memory (Algorithm 2) return θW , θP , θS
+
+where $\sigma$ is the softmax function, $\lambda$ the regularization parameter, and $\mathcal { L } _ { M S E }$ the mean squared error loss used as consistency term.
+
+After updating the working model, we stochastically update the plastic and stable models with rates $r _ { P }$ and $r _ { S }$ (note that $r _ { P } > r _ { S }$ so that the plastic model is updated more frequently). A stochastic rather than a deterministic approach is more biologically plausible (Maass, 2014; Arani et al., 2021) which reduces the overlap in the snapshots of the working model and leads to more diversity in semantic memories. The semantic memories are updated by taking an exponential moving average of the working model’s weights (Tarvainen & Valpola, 2017) with decay parameters $\alpha _ { P }$ and $\alpha _ { S }$ ,
+
+$$
+\theta _ { i } = \alpha _ { i } \theta _ { i } + ( 1 - \alpha _ { i } ) \theta _ { W } , \quad i \in \{ P , S \}
+$$
+
+Note that $\alpha _ { P } \leq \alpha _ { S }$ so that the plastic model mimics the rapid adaptation of information while the stable model mimics slow acquisition of structured knowledge. See Algorithm 1 for more details.
+
+For inference, we use the stable model as it retains long-term memory across the tasks, consolidates structural knowledge, and learns efficient representations for generalization (Figure 1).
+
+# 4 EXPERIMENTAL SETUP
+
+To ensure a fair comparison of different CL methods under uniform experimental settings, we extended the Mammoth framework (Buzzega et al., 2020a) and unless stated otherwise, we follow the same training scheme (learning rate, batch sizes of incoming data and memory buffer, and the number of training epochs) as them for each of the evaluation settings. To find the optimal hyperparameters for CLS-ER, we run a grid search over $\lambda$ , $\alpha _ { S }$ , $\alpha _ { P }$ , $r _ { S }$ , and $r _ { P }$ on a small validation set. Sections C.4 and E show that our method is not highly sensitive to the particular choice of hyperparameters and different settings can attain similar performance. Also, because of the complementary nature of the components, we can often fix a set of parameters (e.g. $\lambda$ , $\alpha _ { S }$ , $\alpha _ { P }$ and $r _ { S }$ ) and only finetune the remaining parameters (e.g. $r _ { P }$ ) which facilitates hyperparameter tuning significantly.
+
+Following Buzzega et al. (2020a), we employ a fully connected network with two hidden layers, each with 100 ReLU units on all the variants of the MNIST dataset and ResNet-18 (He et al., 2015) without pretraining for the other datasets. In all the settings, we use the SGD optimizer. We use random horizontal flip and random crop on both the stream and buffer samples for S-CIFAR-10, S-Tiny-ImageNet, and GCIL-CIFAR-100. The selected hyperparameters for each of the settings are provided in Table S4. Note that for the vast majority of datasets, we use uniform settings (lr, epochs, batch size, memory batch size, and lambda) across different buffer sizes and only slight modifications in the other hyperparameters which shows that our method does not require extensive finetuning for different memory budgets. For each of our experiments, we fix the order of the classes and report the average and one standard deviation of the mean test accuracy of all the tasks across 10 runs with different initializations. Section E provides further training and implementation details.
+
+
Buffer
Method
Class-IL
Domain-IL
S-MNIST
S-CIFAR-10
S-Tiny-ImageNet
R-MNIST
P-MNIST
JOINT
95.57±0.24
92.20±0.15
59.99±0.19
95.76±0.04
94.33±0.17
SGD
19.60±0.04
19.62±0.05
7.92±0.26
67.66±8.53
40.70±2.33
200
ER
80.43±1.89
44.79±1.86
8.49±0.16
85.01±1.90
72.37±0.87
GEM
80.11±1.54
25.54±0.76
1
80.80±1.15
66.93±1.25
iCaRL
70.51±0.53
49.02±3.20
7.53±0.79
=
=
FDR
79.43±3.26
30.91±2.74
8.70±0.19
85.22±3.35
74.77±0.83
GSS
38.92±2.49
39.07±5.59
=
79.50±0.41
63.72±0.70
DER++
85.61±1.40
64.88±1.17
10.96±1.17
90.43±1.87
83.58±0.59
CLS-ER
89.54±0.21
66.19±0.75
23.47±0.80
92.26±0.18
84.63±0.40
500
ER
86.12±1.89
57.74±0.27
9.99±0.29
88.91±1.44
80.60±0.86
GEM
85.99±1.35
26.20±1.26
1
81.15±1.98
76.88±0.52
iCaRL
70.10±1.08
47.55±3.95
9.38±1.53
1
=
FDR
85.87±4.04
28.71±3.23
10.54±0.21
89.67±1.63
83.18±0.53
GSS
49.76±4.73
49.73±4.78
=
81.58±0.58
76.00±0.87
DER++
91.00±1.49
72.70±1.36
19.38±1.41
92.77±1.05
88.21±0.39
CLS-ER
92.05±0.32
75.22±0.71
31.03±0.56
94.06±0.07
88.30±0.14
ER
93.40±1.29
82.47±0.52
27.40±0.31
93.45±0.56
89.90±0.13
5120
GEM
95.11±0.87
25.26±3.46
1
88.57±0.40
87.42±0.95
iCaRL
70.60±1.03
55.07±1.55
14.08±1.92
FDR
87.47±3.15
19.70±0.07
28.97±0.41
94.19±0.44
90.87±0.16
GSS
89.39±0.75
67.27 ±4.27
=
85.24±0.59
82.22±1.14
DER++
95.30±1.20
85.24±0.49
39.02±0.97
94.65±0.33
92.26±0.17
CLS-ER
95.73±0.11
86.78±0.17
46.74±0.31
94.25±0.06
92.03±0.05
+
+Table 1: Comparison with prior works on Class-IL and Domain-IL settings. The baseline results are from Buzzega et al. (2020a) (- indicates the experiments that the authors were unable to run).
+
+# 5 EMPIRICAL EVALUATION
+
+There are a plethora of evaluation protocols in the CL literature, each of which biases the evaluation towards a certain approach (Farquhar & Gal, 2018; Mi et al., 2020; van de Ven & Tolias, 2019). It is therefore of utmost importance to conduct an extensive and robust evaluation over different CL settings to gauge the versatility of the method. Details of the datasets used in each CL setting are provided in Section A. We compare our method with the state-of-the-art rehearsal-based approaches on various CL settings and memory budgets under uniform experimental settings. SGD refers to standard training and JOINT provides an upper bound given by training all tasks jointly.
+
+Class Incremental Learning (Class-IL): refers to the CL scenario where new classes are added with each subsequent task and the agent must learn to distinguish not only amongst the classes within the current task but also across previous tasks. Class-IL measures how well the method can learn general representations, accumulate, consolidate, and transfer the acquired knowledge to learn efficient representations and decision boundaries for all the classes seen so far.
+
+Table 1 provides the comparison with six rehearsal-based approaches on Class-IL settings with varying datasets and task length complexities. CLS-ER provides the highest performance in all of these scenarios. In particular, as the dataset complexity and number of tasks increase from S-MNIST to S-Tiny-ImageNet, the performance gap between CLS-ER and $\mathrm { D E R + + }$ increases considerably. Especially, with a smaller memory budget, CLS-ER is able to retain more information than other methods. In the most challenging setting, S-Tiny-ImageNet with 200 buffer size, CLS-ER provides a percentage gain of $1 7 6 \%$ and $1 1 4 \%$ over the baseline ER and the current state-of-the-art $\mathrm { D E R + + }$ , respectively. The results demonstrate the capability of CLS-ER to efficiently accumulate and retain knowledge over longer sequences under complex and memory restrictive scenarios.
+
+We believe that the performance gains over $\mathrm { D E R + + }$ highlight a key component of an efficient CL agent: the ability to consolidate previously acquired knowledge. $\mathrm { D E R + + }$ fails to account for the consolidation of feature space and adaptation of the decision boundaries of the previous tasks. Therefore, constraining the model to match the sub-optimal logits might hamper the consolidation of knowledge. This becomes more prominent as the number of classes in each task, the sequence length, and the cross-task resemblance increase. For instance, for $\mathrm { D E R + + }$ , replaying a sample from Task-1 when training on S-Tiny-ImageNet Task-10, the reference logit values which are used to enforce the consistency are from a model representation state which has not considered how to distinguish the 20 classes in Task-1 from 80 additional classes which are visually and semantically similar. It stands to reason that the optimal representation space and subsequently the decision boundaries for the classes in Task-1 would drift considerably when required to distinguish between 80 additional classes as well. Therefore, the local information provided by the sub-optimal saved logits in $\mathrm { D E R + + }$ fails to provide the global context required for consolidating knowledge. CLS-ER, on the other hand, extracts logits from the semantic memories which consolidate knowledge across the tasks, and hence the working model receives more optimal feedback.
+
+Table 2: Comparison with prior works on MNIST-360 test set. The baseline results are from Buzzega et al. (2020a).
+
+
JOINT
SGD
Buffer
ER
MER
GSS
DER++
CLS-ER
82.98±3.24
19.09±0.69
200
49.27±2.25
48.58±1.07
43.92±2.43
54.16±3.02
66.37±0.83
500
65.04±1.53
62.21±1.36
54.45±3.14
69.62±1.59
75.70±0.41
1000
75.18±1.50
70.91±0.76
63.84±2.09
76.03±1.61
79.54±0.34
+
+Table 3: Comparison with prior works on GCIL-CIFAR-100 dataset.
+
+
Distribution
Uniform
Longtail
JOINT
58.36±1.02
56.94±1.56
SGD
12.67±0.24
22.88±0.53
1000
Buffer ER
200 16.40±0.37
500
1000 31.98±0.72
200 19.27±0.77
500 20.30±0.63
34.13±0.83
DER++
18.84±0.60
28.21±0.69 32.92±0.74
38.95±0.56
26.94±1.27
25.82±0.83
33.64±0.88
28.54±0.87
28.63±0.68
39.52±0.91
CLS-ER
25.06±0.81
36.34±0.59
39.69±0.66
+
+Domain Incremental Learning (Domain-IL): refers to the CL scenario where the classes remain the same in subsequent tasks but the input distribution changes. We consider R-MNIST where each task contains digits rotated by a fixed angle and P-MNIST which applies a fixed random permutation to the pixels for each task. Table 1 shows that CLS-ER provides generalization gains under both settings, particularly for lower memory budget, and performs on par with $\mathrm { D E R + + }$ on 5120 buffer size. We attribute this to the consolidated soft targets from the semantic memories which provide relational information about the classes from a global context compared to the local information in $\mathrm { D E R + + }$ . This enables our method to maintain the similarity structure across sequences effectively.
+
+General Incremental Learning (GIL): Class-IL and Domain-IL fail to assimilate the challenges in the real-world setting where the task boundaries are blurry, and classes can reappear and have different distributions. The CL method has to consider the sample efficiency, challenge of imbalanced data, and efficient knowledge transfer in addition to preventing catastrophic forgetting. We consider two GIL settings: MNIST-360 (Buzzega et al., 2020a) exposes the model to both sharp (changes in class) and smooth (rotation of digits) distribution shifts. This requires the CL method to tackle the challenges of class-IL as well as domain-IL. The Generalized Class Incremental Learning (GCIL; Mi et al. (2020)) is the closest to the real-world scenario as it utilizes probabilistic modeling to sample the classes and data distributions in each task. The number of classes in each task is not fixed, the classes can overlap and the sample size for each class can vary.
+
+Table 2 shows that CLS-ER provides considerable performance gains on the challenging MNIST360, particularly with a low memory budget. Similarly, Table 3 demonstrates the effectiveness of CLS-ER on GCIL-CIFAR-100 under both uniform and imbalanced class samples. Both of these settings involve recurring classes in subsequent sequences which makes the transfer of knowledge from previous occurrences important. The performance gap between CLS-ER and $\mathrm { D E R + + }$ in the recurring classes setting alludes to another shortcoming of saving logits from the previous state. Consider the case where class c appears in sequence (Seq)-1 with 20 samples, and then subsequently in Seq-5 with 200 samples. In the following sequences, $\mathrm { D E R + + }$ uses exemplars from class c saved in Seq-1 with sub-optimal logits from the model state which was attained with only 20 samples and fails to take advantage of the better learned representations with additional data in Seq-5. CLS-ER, on the other hand, is able to take advantage of the additional samples and provide feedback from the improved learned representations. Moreover, the considerable performance improvement in the longtail setting shows that CLS-ER is more robust to class imbalance
+
+
+Figure 3: Model characteristics analyses of different methods trained on S-CIFAR-10 with 500 buffer size. The Left and middle figures show the training loss and accuracy under varying Gaussian noise added to the weights of each layer of the model. CLS-ER is considerably less sensitive to perturbations, suggesting convergence to flatter minima. The right figure shows the task probabilities. CLS-ER effectively mitigates the bias to the recent tasks and provides a more uniform probability of being predicted for the classes over the tasks even very early ones.
+
+Note that the MNIST-based settings can be considered under the online CL setting (see Section A.4) as we only pass through the data once for each task and the performance of CLS-ER on these settings demonstrates its potential as an efficient method for online CL.
+
+# 6 MODEL CHARACTERISTICS
+
+We analyze CLS-ER and provide some insights into the characteristics of the proposed approach which enables it to learn effectively under challenging CL scenarios. In the subsequent analyses, we compare CLS-ER with the baseline ER and DER $^ { + + }$ .
+
+# 6.1 CONVERGENCE TO FLATTER MINIMA
+
+Due to the non-convexity of the loss landscape, there can be multiple solutions to the optimization objective, however, the local geometry at the convergence point can affect the generalization of the model. Solutions that reside in wide valleys instead of narrow crevices generalize better (Chaudhari et al., 2019; Hochreiter & Schmidhuber, 1997; Keskar et al., 2016) as the predictions do not change drastically with small perturbations. A CL model which converges to flatter minima has more flexibility to explore the neighboring parameter space to optimize on the new task without drastically increasing the loss on the previous tasks. Following the analysis in Zhang et al. (2018), we add independent Gaussian noise of increasing strength to the parameters of the trained model and analyze the change in accuracy and loss across the training samples. Figure 3 shows that CLS-ER is significantly less sensitive to perturbations compared to ER and $\mathrm { D E R + + }$ . CLS-ER also retains performance for a longer period and its performance drops more smoothly. These results suggest that the fast and slow adaptation of information in CLS-ER can guide the optimization to wider valleys.
+
+# 6.2 TASK PROBABILITIES
+
+Because of the sequential nature of CL, an implicit bias is induced towards the current task (Wu et al., 2019). A number of CL methods employ explicit techniques to reduce this bias (Hou et al., 2019; Wu et al., 2019), however, they utilize the task boundaries which is counterproductive for general incremental learning. We believe that the efficient knowledge consolidation in CLS-ER through the semantic memories can implicitly mitigate the bias towards recent tasks. We follow the analysis performed in Buzzega et al. (2020b) to observe the probability of each task being predicted at the end of the training. For each sample in the test dataset, we take the softmax output and then average the probabilities of the associated classes for each task across the dataset. We normalize the values and report the probability of each task being predicted. Figure 3 (right plot) shows that CLS-ER is able to maintain a more uniform prediction probability across all the tasks over a long sequence. Figures S3 and S4 shows similar results for other buffer sizes and S-TinyImageNet.
+
+
+Figure 4: Reliability plots for different methods on S-CIFAR-10 with 500 buffer size. CLS-ER results in considerably better-calibrated models and hence more reliable predictions. For other buffer sizes and S-TinyImageNet see Figures S5 and S6.
+
+# 6.3 MODEL CALIBRATION
+
+Model calibration refers to the accuracy with which the scores provided by the model reflect its predictive uncertainty. The class probabilities predicted by DNNs are uncalibrated, often tending towards over-confidence which is detrimental to the reliability of the model’s prediction (Guo et al., 2017). This is even more pronounced in CL where the models tend to be biassed towards recent tasks. Following Guo et al. (2017), we provide the reliability diagrams (model accuracy as a function of its prediction confidence) and the Expected Calibration Error (ECE; a weighted average over the absolute difference between accuracy and confidence). Figure 4 shows the remarkable ability of CLS-ER to provide well-calibrated models without the application of any calibration technique.
+
+Note that these characteristics are complementary in nature: convergence to flatter minima allows our method to remain in the vicinity of optimal parameters for previous tasks when adapting to the new task, this leads to more uniform performance across tasks which can improve the task probabilities, and since the model is not too biased towards the current task, the model can provide reliable prediction across the tasks which improve the calibration. Additional characteristics analyses on different datasets and buffer sizes are provided in Appendix. We observe that our model’s behavior is consistent across varying datasets and buffer sizes.
+
+# 7 CONCLUSION
+
+We proposed a novel dual memory experience replay method based on the complementary learning systems theory in the brain. Our method maintains long-term and short-term semantic memories which are utilized to effectively replay the neural activities of the episodic memories and align the decision boundary of the working model for efficient knowledge consolidation. We demonstrated the effectiveness of our approach on benchmark datasets as well as more challenging general incremental learning scenarios and achieved the new state-of-the-art in the vast majority of the continual learning settings. We further showed that CLS-ER converges to flatter minima, mitigates the bias towards recent tasks, and provides a well-calibrated high-performance model. Our strong empirical results motivate further study into mimicking the complementary learning system in the brain more faithfully to enable optimal continual learning in DNNs.
+
+# REFERENCES
+
+Rahaf Aljundi, Min Lin, Baptiste Goujaud, and Yoshua Bengio. Gradient based sample selection for online continual learning. In Advances in Neural Information Processing Systems, pp. 11816– 11825, 2019. 2, 14
+
+Elahe Arani, Fahad Sarfraz, and Bahram Zonooz. Noise as a resource for learning in knowledge distillation. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pp. 3129–3138, 2021. 5
+
+Ari S Benjamin, David Rolnick, and Konrad Kording. Measuring and regularizing networks in function space. arXiv preprint arXiv:1805.08289, 2018. 2
+
+Pietro Buzzega, Matteo Boschini, Angelo Porrello, Davide Abati, and Simone Calderara. Dark experience for general continual learning: a strong, simple baseline. arXiv preprint arXiv:2004.07211, 2020a. 5, 6, 7, 13, 14, 17, 20
+
+Pietro Buzzega, Matteo Boschini, Angelo Porrello, and Simone Calderara. Rethinking experience replay: a bag of tricks for continual learning. arXiv preprint arXiv:2010.05595, 2020b. 8
+
+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. Journal of Statistical Mechanics: Theory and Experiment, 2019(12): 124018, 2019. 8
+
+Arslan Chaudhry, Marc’Aurelio Ranzato, Marcus Rohrbach, and Mohamed Elhoseiny. Efficient lifelong learning with a-gem. arXiv preprint arXiv:1812.00420, 2018. 1
+
+Matthias De Lange, Rahaf Aljundi, Marc Masana, Sarah Parisot, Xu Jia, Ales Leonardis, Gregory Slabaugh, and Tinne Tuytelaars. A continual learning survey: Defying forgetting in classification tasks. arXiv preprint arXiv:1909.08383, 2019. 13
+
+Mehrdad Farajtabar, Navid Azizan, Alex Mott, and Ang Li. Orthogonal gradient descent for continual learning. In International Conference on Artificial Intelligence and Statistics, pp. 3762–3773. PMLR, 2020. 1
+
+Sebastian Farquhar and Yarin Gal. Towards robust evaluations of continual learning. arXiv preprint arXiv:1805.09733, 2018. 1, 6, 13, 14
+
+Robert M French. Catastrophic forgetting in connectionist networks. Trends in cognitive sciences, 3(4):128–135, 1999. 2
+
+Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. In International Conference on Machine Learning, pp. 1321–1330. PMLR, 2017. 9
+
+Demis Hassabis, Dharshan Kumaran, Christopher Summerfield, and Matthew Botvinick. Neuroscience-inspired artificial intelligence. Neuron, 95(2):245–258, 2017. 1
+
+Tyler L Hayes, Giri P Krishnan, Maxim Bazhenov, Hava T Siegelmann, Terrence J Sejnowski, and Christopher Kanan. Replay in deep learning: Current approaches and missing biological elements. arXiv preprint arXiv:2104.04132, 2021. 1, 3
+
+Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. corr abs/1512.03385 (2015), 2015. 5
+
+Sepp Hochreiter and Jürgen Schmidhuber. Flat minima. Neural computation, 9(1):1–42, 1997. 8
+
+Saihui Hou, Xinyu Pan, Chen Change Loy, Zilei Wang, and Dahua Lin. Learning a unified classifier incrementally via rebalancing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 831–839, 2019. 8
+
+David Isele and Akansel Cosgun. Selective experience replay for lifelong learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018. 4
+
+Nitin Kamra, Umang Gupta, and Yan Liu. Deep generative dual memory network for continual learning. arXiv preprint arXiv:1710.10368, 2017. 2
+
+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. 8
+
+J Kirkpatrick, R Pascanu, N Rabinowitz, J Veness, G Desjardins, AA Rusu, K Milan, J Quan, T Ramalho, A Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks.(dec. arXiv preprint cs.LG/1612.00796, 2016. 13
+
+James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521–3526, 2017. 1
+
+Giri P Krishnan, Timothy Tadros, Ramyaa Ramyaa, and Maxim Bazhenov. Biologically inspired sleep algorithm for artificial neural networks. arXiv preprint arXiv:1908.02240, 2019. 2, 3
+
+Alex Krizhevsky et al. Learning multiple layers of features from tiny images. 2009. 13
+
+Dharshan Kumaran, Demis Hassabis, and James L McClelland. What learning systems do intelligent agents need? complementary learning systems theory updated. Trends in cognitive sciences, 20 (7):512–534, 2016. 1
+
+Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. 13
+
+David Lopez-Paz and Marc’Aurelio Ranzato. Gradient episodic memory for continual learning. In Advances in neural information processing systems, pp. 6467–6476, 2017. 1, 2, 13
+
+Wolfgang Maass. Noise as a resource for computation and learning in networks of spiking neurons. Proceedings of the IEEE, 102(5):860–880, 2014. 5
+
+Zheda Mai, Ruiwen Li, Jihwan Jeong, David Quispe, Hyunwoo Kim, and Scott Sanner. Online continual learning in image classification: An empirical survey. Neurocomputing, 469:28–51, 2022. 14
+
+Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of learning and motivation, volume 24, pp. 109–165. Elsevier, 1989. 1
+
+Fei Mi, Lingjing Kong, Tao Lin, Kaicheng Yu, and Boi Faltings. Generalized class incremental learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pp. 240–241, 2020. 6, 7, 13, 20
+
+German I Parisi, Ronald Kemker, Jose L Part, Christopher Kanan, and Stefan Wermter. Continual lifelong learning with neural networks: A review. Neural Networks, 113:54–71, 2019. 1, 2
+
+Hadi Pouransari and Saman Ghili. Tiny imagenet visual recognition challenge. CS231N course, Stanford Univ., Stanford, CA, USA, 2015. 13
+
+Sylvestre-Alvise Rebuffi, Alexander Kolesnikov, Georg Sperl, and Christoph H Lampert. icarl: Incremental classifier and representation learning. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pp. 2001–2010, 2017. 2
+
+Matthew Riemer, Ignacio Cases, Robert Ajemian, Miao Liu, Irina Rish, Yuhai Tu, and Gerald Tesauro. Learning to learn without forgetting by maximizing transfer and minimizing interference. arXiv preprint arXiv:1810.11910, 2018. 2
+
+Hippolyt Ritter, Aleksandar Botev, and David Barber. Online structured laplace approximations for overcoming catastrophic forgetting. In Advances in Neural Information Processing Systems, pp. 3738–3748, 2018. 1
+
+Anthony Robins. Catastrophic forgetting in neural networks: the role of rehearsal mechanisms. In Proceedings 1993 The First New Zealand International Two-Stream Conference on Artificial Neural Networks and Expert Systems, pp. 65–68. IEEE, 1993. 2
+
+Mohammad Rostami, Soheil Kolouri, and Praveen K Pilly. Complementary learning for overcoming catastrophic forgetting using experience replay. arXiv preprint arXiv:1903.04566, 2019. 2
+
+Andrei A Rusu, Neil C Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. arXiv preprint arXiv:1606.04671, 2016. 1
+
+Fahad Sarfraz, Elahe Arani, and Bahram Zonooz. Knowledge distillation beyond model compression. In 2020 25th International Conference on Pattern Recognition (ICPR), pp. 6136–6143. IEEE, 2021. 2
+
+Dongsub Shim, Zheda Mai, Jihwan Jeong, Scott Sanner, Hyunwoo Kim, and Jongseong Jang. Online class-incremental continual learning with adversarial shapley value. arXiv e-prints, pp. arXiv–2009, 2020. 13
+
+Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. arXiv preprint arXiv:1703.01780, 2017. 3, 5
+
+Gido M van de Ven and Andreas S Tolias. Three scenarios for continual learning. arXiv preprint arXiv:1904.07734, 2019. 6, 13
+
+Jeffrey S Vitter. Random sampling with a reservoir. ACM Transactions on Mathematical Software (TOMS), 11(1):37–57, 1985. 4
+
+Yue Wu, Yinpeng Chen, Lijuan Wang, Yuancheng Ye, Zicheng Liu, Yandong Guo, and Yun Fu. Large scale incremental learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 374–382, 2019.
+
+Jaehong Yoon, Eunho Yang, Jeongtae Lee, and Sung Ju Hwang. Lifelong learning with dynamically expandable networks. arXiv preprint arXiv:1708.01547, 2017. 1
+
+Friedemann Zenke, Ben Poole, and Surya Ganguli. Continual learning through synaptic intelligence. Proceedings of machine learning research, 70:3987, 2017. 1, 13
+
+Ying Zhang, Tao Xiang, Timothy M Hospedales, and Huchuan Lu. Deep mutual learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4320– 4328, 2018. 8
+
+# A CONTINUAL LEARNING SETTINGS
+
+There are a plethora of evaluation protocols in the CL literature, each of which biases the evaluation towards a certain approach (Farquhar & Gal, 2018; Mi et al., 2020; Shim et al., 2020; van de Ven & Tolias, 2019). It is therefore of utmost importance to conduct an extensive and robust evaluation to gauge the versatility of the method. We believe that adhering to the key desiderata as suggested in Farquhar & Gal (2018) would help the CL community immensely in moving towards a robust evaluation of methods. An experimental protocol that trains the method on a long sequence of tasks where the boundaries between the tasks are not distinct and the tasks themselves are not disjoint and the method does not make sure of task boundaries during training or testing can be considered as adhering to all five desiderata. Our work focuses on the aforementioned setting which can be considered as General Incremental Learning (GIL) setting. Here, we provide a broad categorization of these evaluation protocols which test different aspects of CL.
+
+# A.1 CLASS INCREMENTAL LEARNING (CLASS-IL)
+
+Class-IL refers to the CL scenario where new classes are added with each subsequent task and the agent must learn to distinguish not only amongst the classes within the current task but also across previous tasks. Class-IL measures how well the method can learn general representations, accumulate, consolidate, and transfer the acquired knowledge to learn efficient representations and decision boundaries for all the classes seen so far. Following Buzzega et al. (2020a); De Lange et al. (2019); Zenke et al. (2017), we consider the common benchmark datasets MNIST (LeCun et al., 1998) (SMNIST), CIFAR-10 (Krizhevsky et al., 2009) (S-CIFAR-10) and Tiny-ImageNet (Pouransari & Ghili, 2015) (S-Tiny-ImageNet) which are split into 5, 5, and 10 tasks each including 2, 2, and 20 classes respectively. These represent Class-IL settings of increasing dataset complexity as well as longer sequences. While it is an important and challenging benchmark, it assumes that each subsequent task will have the same number of disjoint classes and have uniform samples for each class which is not representative of real-world scenarios. We do not consider the related Task Increment Learning (Task-IL) setting as it assumes the availability of task labels at both training and inference which cannot truly be considered as a CL task (Farquhar & Gal, 2018).
+
+# A.2 DOMAIN INCREMENTAL LEARNING (DOMAIN-IL)
+
+Domain-IL refers to the CL scenario where the classes remain the same in each subsequent task but the input distribution changes. We consider Rotated-MNIST (Lopez-Paz & Ranzato, 2017) (R-MNIST) where each task contains digits rotated by a fixed angle between 0 and 180 degrees and Permuted-MNIST (Kirkpatrick et al., 2016) (P-MNIST) which applies a fixed random permutation to the pixels for each task. Though we provide the results for Permuted MNIST for completion, we share the opinion by Farquhar & Gal (2018) that it should not be considered as a benchmark dataset as it violates the cross-task resemblance desiderata and deviates from the goal of continual learning.
+
+# A.3 GENERAL INCREMENTAL LEARNING (GIL)
+
+The aforementioned CL scenarios fail to assimilate the challenges in the real world, setting where the task boundaries are blurry and the learning agent must rather learn from a continuous stream of data where classes can reappear and have different data distributions. The CL method must deal with the issues of sample efficiency, imbalanced classes, and efficient transfer of knowledge in addition to preventing catastrophic forgetting. To test the efficacy of our method in this challenging setting, we consider two GIL evaluation protocols. MNIST-360 (Buzzega et al., 2020a) models a stream of data which presents batches of two consecutive MNIST images with each sample rotated at an increasing angle and the sequence is repeated three times. This exposes the model to both a sharp distribution shift when the class changes and a smooth rotational distribution shift. However, the number of classes in each task and the samples are uniform. The Generalized Class Incremental Learning (GCIL) (Mi et al., 2020) utilizes probabilistic modeling to sample the classes and data distributions in each task. Hence, the number of classes in each task is not fixed, the classes can overlap and the sample size for each class can vary. Following Mi et al. (2020), we use GCIL on CIFAR-100 (Krizhevsky et al., 2009) dataset (GCIL-CIFAR-100), set the number of samples and maximum number of classes per task to 1000 and 50 respectively, number of tasks to 20, and evaluate on both uniform and longtail (imbalanced) sample distribution.
+
+# A.4 ONLINE CONTINUAL LEARNING
+
+Online continual learning refers to the challenging scenario where a stream of samples is only seen once and is non-iid (Mai et al., 2022; Aljundi et al., 2019). The common approach in the literature is to use the single-epoch protocol where the network is trained on each task in the sequence for only one epoch and there are no additional passages over data. As we aim to position CLS-ER as a general incremental learning method, we are also interested in the online continual learning setting. However, similar to Buzzega et al. (2020a), we also believe that the dataset complexity needs to be considered when setting the number of epochs to disentangle the effect of catastrophic forgetting from underfitting and share their suggestion that future CL works should strive for realism by designing experimental settings which are in line with the guidelines of General Continual Learning (Farquhar & Gal, 2018) which is the goal of our study rather than adopting the single-epoch protocol. For the MNIST-based settings, we use only one epoch per task as it is sufficient for the SGD baseline to learn the single task well. And for the more complex settings, we increase the number of epochs: 50 epochs for Sequential CIFAR-10 and Sequential Tiny-ImageNet and 100 epochs for GCIL-CIFAR-100.
+
+We would also like to emphasize that the experiments on MNIST based settings (S-MNIST, RMNIST, P-MNIST, and MNIST-360) can be considered as online continual learning settings as we only train the network for 1 epoch, and thereby the model only sees the data for each task once. CLSER’s performance in these settings demonstrates its potential for the challenging online continual learning setting.
+
+# B RESERVOIR SAMPLING
+
+Here, we provide the algorithm for the Reservoir Sampling for maintaining a fixed-size memory buffer. Reservoir sampling takes in a data stream of unknown length and assigns equal probability to each sample for being represented in the memory buffer $( \mathcal { M } )$ with a fixed budget size $( B )$ . Sampling and replacement are done at random and no priority is assigned to the samples being added or replaced from the memory buffer.
+
+# Algorithm 2 Reservoir Sampling Algorithm
+
+
(x,y)
Input: Memory Buffer M, Memory Budget B,Number of seen examples N, Selected example
1: if B> N then
Memory is not full
2: M[N] ← (x,y)
3: else
> Select a sample to remove
4:
V = randomInteger(min= 0,max = N)
5: ifv<Bthen
6: M[v]←(x,y)
return M
+
+# C ADDITIONAL RESULTS
+
+In this section, we provide additional experimental results and analysis of the behavior of the model.
+
+# C.1 CLS-ER COMPONENTS PERFORMANCE
+
+CLS-ER involves the interplay between the working model and the two semantic memories: the plastic and stable models. While we use the stable model for final inference, here we provide the performance of each of these individual components to provide further insights into the workings of our method. Table S1 shows the corresponding performance of the working model and plastic model for each of our experimental settings. We can see that the stable model can effectively consolidate knowledge across the tasks and therefore provide the highest mean performance for the vast majority of the settings. Figures S1 and S2 further shows how the task-wise performance (on test set) of each of the component varies as subsequent tasks are learned. The stable model retains the performance on previous tasks while the plastic model adapts better to the recent task. Both these models provide feedback to the working model which in turn improves the plastic and stable model.
+
+Table S1: CLS-ER components performance analysis for each of the experimental setting.
+
+
Dataset
Buffer
Stable Model
Working Model
Plastic Model
S-MNIST
200
89.54±0.21
89.32±0.23
89.52±0.21
500
92.05±0.30
91.61±0.47
92.04±0.33
5120
95.73±0.10
95.65±0.15
95.73±0.12
S-CIFAR-10
200
66.19±0.75
50.09±1.48
62.68±1.94
500
75.22±0.71
63.09±1.12
71.32±0.89
5120
86.78±0.17
85.00±0.33
86.77±0.17
S-Tiny-ImageNet
200
23.47±0.80
9.97±0.18
17.19±0.71
500
31.03±0.56
15.35±0.34
27.16±0.43
5120
46.74±0.31
41.39±0.39
47.10±0.42
R-MNIST
200
92.26±0.18
89.37±0.47
89.99±0.43
500
94.06±0.07
93.24±0.14
93.52±0.09
5120
94.25±0.06
94.28±0.08
94.37±0.06
P-MNIST
200
84.63±0.40
84.33±0.45
84.54±0.41
500
88.30±0.14
88.12±0.16
88.25±0.14
5120
92.03±0.05
91.96±0.06
92.02±0.05
MNIST-360
200
66.37±0.83
55.59±1.74
60.60±1.41
500
75.70±0.41
72.70±0.80
75.03±0.37
1000
79.54±0.34
78.39±0.69
79.16±0.42
GCIL-CIFAR-100 (Uniform)
200
33.15±2.80
31.74±2.72
32.70±2.78
500
37.01±1.67
35.89±1.69
36.18±1.68
1000
41.09±1.58
40.44±1.80
40.70±1.66
GCIL-CIFAR-100 (Longtail)
200
29.57±3.80
28.19±3.90
29.12±3.89
500
33.26±3.66
32.22±3.79
32.95±3.70
1000
39.21±3.46
38.51±3.55
38.84±3.52
+
+# C.2 TASK PROBABILITIES
+
+To test the effectiveness of our method in mitigating the bias towards recent tasks, we provide the task probabilities of the models trained with different buffer sizes on S-CIFAR-10 and S-TinyImageNet. Figures S3 and S4 show that CLS-ER consistently achieves more uniform task probabilities compared to ER and $\mathrm { D E R + + }$ and effectively mitigates the bias towards the last task.
+
+# C.3 MODEL CALIBRATION
+
+To further test the consistency of CLS-ER in providing well-calibrated models and the impact of the buffer size, we evaluate the calibration of models trained with different buffer sizes on S-CIFAR-10 and S-Tiny-ImageNet. Figures S5 and S6 show that CLS-ER consistently provides better calibrated models compared to ER and $\mathrm { D E R + + }$ . Remarkably, for both the datasets, on lower buffer sizes, the difference in Expected Calibration Error (ECE) is considerable. This demonstrates the capability of CLS-ER to train high-performance and reliable models under challenging conditions.
+
+# C.4 EFFECT OF HYPERPARAMETERS
+
+The interaction between the three components of CLS-ER is complementary. Table S3 shows how the performance of each component is affected under different hyperparameter settings. We can draw the following conclusions from the results. The performance improvement in the plastic and stable model is reflected in the working model and the best performance is seen in cases where both the semantic memories are performing well (albeit the focus on tasks is different). This highlights the crucial role of both memories in enabling CLS-ER to learn efficiently. For a fixed $r _ { S }$ value, the final performance of the stable model is affected considerably by the performance of the plastic model. The method is not highly sensitive to the particular choice of hyperparameters as different settings can attain similar performance. Because of the complementary nature of the components, we can often fix a set of parameters (e.g. $\lambda$ , $\alpha _ { S }$ , $\alpha _ { S }$ and $r _ { S }$ ) and only finetune the remaining parameters (e.g. $r _ { P } ^ { \prime }$ ) which facilitates hyperparameter tuning significantly.
+
+
+Figure S1: Test set task-wise performance for the individual models on S-CIFAR-10 with different buffer sizes. The task-wise performance $\mathbf { \dot { x } }$ -axis) is evaluated at the end of training of each task (y-axis) to evaluate how it is affected as training progresses.
+
+# D COMPARISON WITH A SINGLE SEMANTIC MEMORY
+
+CLS-ER employs two semantic memories as we aim to mimic the fast and slow learning mechanisms in the hippocampus and neocortex respectively. Here we compare our method with a single semantic memory (Mean-ER) and Table S2 shows that while it still performs admirably compared to the other CL methods, the dual semantic memories in CLS-ER provides additional performance gains especially on the complex datasets under the challenging lower memory buffer settings and has a much lower variance. We attribute this to the failure of Mean-ER in maintaining the performance on both the recent and earlier tasks together i.e there is an inherent trade-off as tuning the semantic memory to adapt to the recent changes comes at the cost of performance on earlier tasks and vice versa. CLS-ER efficiently tackles this trade-off by maintaining two specialized long-term and shortterm memories. The performance of Mean-ER, however, provides further evidence for the benefits of using consolidated information for memory replay.
+
+Note that for a fair comparison, we use the same hyperparameter search space as CLS-ER for finding the optimal parameters for Mean-ER and report the average and 1 std of 10 runs with different initializations using the best parameters for each setting. Table S6 provides the chosen hyperparameters. For inference, similar to CLS-ER, we use the EMA-weighted model (semantic memory) for Mean-ER.
+
+
+Figure S2: Test set task-wise performance for the individual models on S-Tiny-ImageNet with different buffer sizes. The task-wise performance ( $\mathbf { \dot { x } }$ -axis) is evaluated at the end of training of each task (y-axis) to evaluate how it is affected as training progresses.
+
+
+Figure S3: Task probabilities for different methods on S-CIFAR-10 with varying memory budget.
+
+# E TRAINING AND IMPLEMENTATION DETAILS
+
+For a fair comparison, we aim to keep the experimental settings close to the current state-of-theart $\mathrm { D E R + + }$ (Buzzega et al., 2020a) as much as possible to disassociate the effect of the training schedule. We use the same optimizer, the number of epochs, batch size, and memory batch size as $\mathrm { D E R + + }$ . For S-Tiny-ImageNet, we reduce the number of epochs to 50 from 100 used by $\mathrm { D E R + + }$ as our method can learn efficiently with fewer epochs, and quickly acquiring new knowledge is preferred for CL. Similar to $\mathrm { D E R + + }$ , we finetune the memory batch size for S-MNIST and MNIST360. We select the hyperparameters for each of the experimental setting using a small validation set, $\alpha _ { S } , \alpha _ { P } \in ( 0 . 9 9 , 0 . 9 9 9 )$ , $r _ { S } , r _ { P } \in ( 0 , 1 ]$ , $\lambda \in ( 0 , 2 ]$ . Table S4 provides the hyperparameters used for each of the experimental settings. Note that for the vast majority of datasets, we use uniform settings (lr, epochs, batch size, memory batch size, and lambda) across the different buffer sizes and requires only slight modifications in the other hyperparameters which shows that our method does not require extensive finetuning for different memory budgets.
+
+
+Figure S4: Task probabilities for different methods on S-Tiny-ImageNet with varying memory budget.
+
+
+Figure S5: Reliability plots for the different methods on S-CIFAR-10 with varying memory budget.
+
+
+Figure S6: Reliability plots for the different methods on S-Tiny-ImageNet with varying memory budget.
+
+Table S2: Comparison of CLS-ER with Mean-ER (single semantic memory) on Class-IL and Domain-IL settings. We report the mean and 1 std of 10 runs with different initializations.
+
+
Buffer
Method
Class-IL
Domain-IL
S-MNIST
S-CIFAR-10
S-Tiny-ImageNet
R-MNIST
P-MNIST
JOINT
95.57±0.24
92.20±0.15
59.99±0.19
95.76±0.04
94.33±0.17
SGD
19.60±0.04
19.62±0.05
7.92±0.26
67.66±8.53
40.70±2.33
200
Mean-ER
88.32±0.65
61.88±2.43
17.68±1.65
92.10±1.07
83.28±0.68
CLS-ER
89.54±0.21
66.19±0.75
23.47±0.80
92.26±0.18
84.63±0.40
500
Mean-ER
91.79±0.23
70.40±1.21
24.97±0.80
92.78±0.44
87.73±0.39
CLS-ER
92.05±0.32
75.22±0.71
31.03±0.56
94.06±0.07
88.30±0.14
5120
Mean-ER
95.57±0.18
84.84±2.0
45.69±0.58
94.25±0.51
91.90±0.11
CLS-ER
95.73±0.11
86.78±0.17
46.74±0.31
94.25±0.06
92.03±0.05
+
+# E.1 GCIL-CIFAR-100
+
+To test our method under challenging GIL settings that better simulate the challenges of CL in the real world, we incorporate the GCIL setting from the code provided by Mi et al. (2020) with the continual dataset template class in the mammoth framework. We set the number of phases (length of task sequences) to 20, with the total number of samples in each phase set to 1000 and the maximum number of classes in each phase set to 50. We evaluate on both uniform and longtail (imbalanced) data distributions. Since GCIL involves the probabilistic sampling of the classes and their samples in each phase, the random seed determines the complexity of the GCIL setting. Therefore, for reproduciblility and to gauge the stability of the methods, we fix the dataset seed to 1993 and report the average and standard deviation of 10 differently initialized models trained on the same settings.
+
+For each of our method, we use identical training scheme $\mathrm { { ( l r { = } 0 . 1 } }$ , epochs $_ { \mathrm { \scriptsize = } 1 0 0 }$ , batch size $^ { \underline { { \ } } 3 2 }$ and memory batch $\mathrm { s i z e } { = } 3 2$ ). For $\mathrm { D E R + + }$ , as per the authors suggestion, we performed hyperparameter search over $\alpha \in [ 0 . 2 , 0 . 3 ]$ and $b e t a \in [ 0 . 5 , 1 . 0 ]$ with step size of 0.1. Table S5 provides the parameters chosen for each of the method under the different settings.
+
+# E.2 PERTURBATION ANALYSIS
+
+For the perturbation analysis, we used the code and checkpoints provided by Buzzega et al. (2020a) for $\mathrm { D E R + + }$ and ER. We would like to express our gratitude to the authors for their support and for making the mammoth framework available for the research community which provides a framework for a fair comparison of different CL methods under uniform experimental conditions.
+
+Table S3: The effect of different hyperparameter settings on the individual components of CLS-ER trained on S-CIFAR-10 with 500 buffer size. For all the experiments $\alpha _ { S }$ and $\alpha _ { P }$ are fixed to 0.999 and the performance is averaged over 3 runs with different initialization.
+
+
入
rs
rp
Stable Model
Working Model
Plastic Model
0.1
0.2
73.53±1.07
62.80±0.63
71.11±2.21
0.3
72.44±1.37
63.53±1.98
70.97±1.71
0.4
73.05±0.93
61.81±1.92
68.75±2.20
0.5
75.16±1.09
63.95±1.92
70.42±1.09
0.1
0.6
75.04±0.66
62.82±0.70
69.61±0.31
0.7
73.94±0.48
63.34±0.46
70.30±1.68
0.8
74.61±1.10
62.68±0.65
70.74±0.39
73.74±2.14
62.69±1.97
69.52±0.79
0.9 1.0
64.21±1.11
72.00±0.56
0.3
75.73±0.68 70.26±1.79
61.63±1.03
69.31±1.82
71.80±1.17
62.64±0.18
70.64±1.22
0.4 0.5
70.69±2.13
61.76±0.64
69.65±1.92
72.45±0.68
0.2
0.6 0.7
71.47±1.98
63.87±0.85
71.29±0.72
0.8
72.16±0.56
61.12±1.90 62.71±0.57
70.22±2.24
0.9
72.09±0.59
70.83±0.64
1.0
72.05±1.35
63.33±1.01 63.74±1.75
71.20±0.87
0.4
71.01±1.28
68.46±1.48
60.96±1.62
68.31±1.40
0.5 0.6
70.05±2.54
63.06±1.26
69.90±2.57
69.57±1.07
61.25±1.96
69.36±1.06
0.3
0.7
68.99±2.34
61.61±2.17
68.81±2.27
0.8
71.21±0.48
63.08±0.82
70.99±0.57
1
0.9
71.26±1.47
62.33±0.64
71.03±1.56
0.2
69.00±0.41
61.38±0.92
68.69±0.31
70.19±1.97
61.39±2.06
69.81±1.60
0.3
73.72±0.83
62.07±0.84
70.18±0.09
0.4
71.60±2.30
61.11±2.00
69.15±1.08
0.5
74.18±0.37
63.32±0.98
71.08±2.04
0.1
0.6
74.90±0.40
62.35±2.31
71.58±0.79
0.7
74.52±1.10
62.59±2.64
70.90±2.30
0.8
75.27±1.21
62.00±1.98
71.27±1.64
0.9
74.61±0.91
63.47±1.60
70.49±0.95
1.0
76.03±0.64
63.63±1.01
0.15
71.42±1.11
0.3 0.4
72.59±1.44 71.30±3.42
61.81±1.03
72.02±1.30
63.15±0.51
70.92±2.83
0.5
69.89±1.95
60.60±0.95
68.87±2.56
0.2
0.6
72.34±0.89
62.18±1.31
71.15±0.94
0.7
72.70±1.11
62.50±1.18
71.49±1.21
0.8
72.42±1.50
61.85±0.83
71.04±1.68
0.9
71.18±0.71
61.81±1.29
70.09±0.54
1.0 0.4
73.52±0.65
64.19±0.86
72.56±0.52
70.32±1.39
62.39±2.00
70.13±1.33
0.5
71.60±1.53
62.67±2.08
71.40±1.54
0.6
70.36±1.82
62.28±2.28
70.13±2.03
0.7 0.3
69.79±1.93
61.13±1.37
69.65±1.82
0.8
69.85±0.95
60.69±1.63
69.78±0.60
0.9
71.32±1.68
61.79±1.41
71.03±1.61
1.0
71.39±0.49
62.35±0.88
71.11±0.55
+
+Table S4: The hyperparameters used for each of the experimental settings for CLS-ER.
+
+
Dataset
Buffer
lr
Epochs
Batch Size
Memory Batch Size
入
αs
αp
rs
rp
S-MNIST
200
0.03
1
10
128
2.0
0.99
0.99
0.9
1.0
500
0.1
1
10
32
2.0
0.99
0.99
0.9
1.0
5120
0.1
1
10
32
2.0
0.99
0.99
0.8
1.0
S-CIFAR-10
200
0.1
50
32
32
0.15
0.999
0.999
0.1
0.3
500
0.1
50
32
32
0.15
0.999
0.999
0.1
0.9
5120
0.1
50
32
32
0.15
0.999
0.999
0.8
1.0
S-Tiny-ImageNet
200
0.05
50
32
32
0.1
0.999
0.999
0.04
0.08
500
0.05
50
32
32
0.1
0.999
0.999
0.05
0.08
5120
0.05
50
32
32
0.1
0.999
0.999
0.07
0.08
R-MNIST
200
0.2
1
128
128
0.75
0.999
0.99
1.0
1.0
500
0.2
1
128
128
0.75
0.999
0.99
1.0
1.0
5120
0.2
1
128
128
0.75
0.999
0.99
1.0
1.0
P-MNIST
200
0.2
1
128
128
1.0
0.99
0.99
0.8
1.0
500
0.2
1
128
128
1.0
0.99
0.99
0.8
1.0
5120
0.2
1
128
128
1.0
0.99
0.99
0.9
1.0
MNIST-360
200
0.2
1
16
16
0.75
0.999
0.99
1.0
1.0
500
0.2
1
16
32
1.25
0.99
0.99
0.9
1.0
1000
0.2
1
16
128
0.75
0.99
0.99
0.9
1.0
GCIL-CIFAR-100
200
0.1
100
32
32
0.1
0.999
0.999
0.6
0.7
500
0.1
100
32
32
0.1
0.999
0.999
0.6
0.7
1000
0.1
100
32
32
0.1
0.999
0.999
0.6
0.8
+
+Table S5: The hyperparameters used for $\mathrm { D E R + + }$ on GCIL-CIFAR-100 experiments. CLS-ER uses the same hyperparameters for both Uniform and Longtail settings (Table S4).
+
+
Distribution
Buffer
lr
Epochs
Batch Size
Memory Batch Size
a
B
Uniform
200
0.1
100
32
32
0.2
0.5
500
0.1
100
32
32
0.2
0.6
1000
0.1
100
32
32
0.3
0.6
Longtail
200
0.1
100
32
32
0.2
0.6
500
0.1
100
32
32
0.2
0.8
1000
0.1
100
32
32
0.3
0.9
+
+
Dataset
Buffer
lr
Epochs
Batch Size
Memory Batch Size
入
a
r
S-MNIST
200
0.03
1
10
128
2.0
0.99
1.0
500
0.1
1
10
32
2.0
0.99
1.0
5120
0.1
1
10
32
2.0
0.99
1.0
S-CIFAR-10
200
0.1
50
32
32
0.15
0.999
0.2
500
0.1
50
32
32
0.15
0.999
0.5
5120
0.1
50
32
32
0.15
0.999
0.8
S-Tiny-ImageNet
200
0.05
50
32
32
0.1
0.999
0.06
500
0.05
50
32
32
0.1
0.999
0.08
5120
0.05
50
32
32
0.1
0.999
0.08
R-MNIST
200
0.2
1
128
128
0.75
0.999
1.0
500
0.2
1
128
128
0.75
0.999
1.0
5120
0.2
1
128
128
0.75
0.999
1.0
P-MNIST
200
0.2
1
128
128
1.0
0.99
0.9
500
0.2
1
128
128
1.0
0.99
1.0
5120
0.2
1
128
128
1.0
0.99
0.9
+
+Table S6: The hyperparameters used for each of the experimental settings for Mean-ER.
\ No newline at end of file
diff --git a/md/dev/uy602F8cTrh/uy602F8cTrh.md b/md/dev/uy602F8cTrh/uy602F8cTrh.md
new file mode 100644
index 0000000000000000000000000000000000000000..12ed740c2264a85a3ce30548bcf9d2a4f0eeb1a0
--- /dev/null
+++ b/md/dev/uy602F8cTrh/uy602F8cTrh.md
@@ -0,0 +1,213 @@
+# CAUSALDYNA: IMPROVING GENERALIZATION OF DYNA-STYLE REINFORCEMENT LEARNING VIA COUNTERFACTUAL-BASED DATA AUGMENTATION
+
+Anonymous authors Paper under double-blind review
+
+# ABSTRACT
+
+Deep reinforcement learning agents trained in real-world environments with a limited diversity of object properties to learn manipulation tasks tend to suffer overfitting and fail to generalize to unseen testing environments. To improve the agents’ ability to generalize to object properties rarely seen or unseen, we propose a dataefficient reinforcement learning algorithm, CausalDyna, that exploits structural causal models (SCMs) to model the state dynamics. The learned SCM enables us to counterfactually reason what would have happened had the object had a different property value. This can help remedy limitations of real-world environments or avoid risky exploration of robots (e.g., heavy objects may damage the robot). We evaluate our algorithm in the CausalWorld robotic-manipulation environment. When augmented with counterfactual data, our CausalDyna outperforms state-ofthe-art model-based algorithm, MBPO and model-free algorithm, SAC in both sample efficiency by up to $17 \%$ and generalization by up to $30 \%$ . Code will be made publicly available.
+
+# 1 INTRODUCTION
+
+Classical model-free reinforcement learning approaches require a massive amount of data collected in the environment to work, which slows down its success in tasks where data collection is timeconsuming or costly, like robot manipulation. Model-based reinforcement learning (MBRL) methods alleviate this issue by maintaining a world model that simulates the real environment. The world model can serve as a surrogate of the real environment for the agent to interact with to reduce the amount of the required time-consuming interaction in the real environment. MBRL methods (Kaelbling et al., 1996; Wang et al., 2019; Janner et al., 2019) learn from model rollouts of previously observed states. Recently, CTRL (Lu et al., 2020) takes a structural causal model (SCM) approach that can generate samples counterfactually had a different action had been taken for a state previously observed. However, these methods are limited for robotic manipulation tasks since the environment is often the key limiting factor. In this paper, we perform counterfactual reasoning on the object properties. For example, when the task manipulates objects with different masses, the real environment may not have a uniform distribution of object masses. Furthermore, to avoid damaging the robot, certain exploration of the gripper torque may be limited during training.
+
+To this end, we propose a Dyna-style MBRL method, CausalDyna in robotics that improves the policy performance by counterfactual reasoning of physics properties of objects and enriching the diversity of the generated rollouts. We leverage the structural causal model (SCM) to model the state dynamics. CausalDyna can be applied to generate episodes with unseen or rarely seen objects to improve the sample efficiency and generalization of the policy.
+
+Our contributions are summarized as follows.
+
+• We introduce a novel Dyna-style causal reinforcement learning algorithm, dubbed as CausalDyna that learns from counterfactually generated episodes with intervened object property values. • We compare with state-of-the-art model based reinforcement learning algorithm, MBPO and model free algorithm, SAC on the CausalWorld environment. Experimental results show that CausalDyna outperforms MBPO and SAC on sample efficiency by up to $17 \%$ and generalization by up to $30 \%$ when manipulating objects with unseen or rarely seen properties.
+
+
+Figure 1: In classical Dyna-style methods, the world model generates episodes starting from a real environment state. Then, our robot can practice in the world model and learn how to manipulate the original object. To improve the generalization of the learned policy, we further modified the object property in the state. So the robot has the chance to play with objects with more diverse properties.
+
+# 2 RELATED WORK
+
+Causal Inference in Reinforcement Learning There is an increasing interest in causal inference in the field of reinforcement learning. Counterfactually-Guided Policy Search (CF-GPS) (Buesing et al., 2018) assumes that the real transition, observation, and reward functions are all known. They show that any partially observable Markov decision process (POMDP) can be represented as a structural causal model (SCM). Therefore, counterfactual inference can be applied to improve the offpolicy evaluation and policy-guided search. CounTerfactual Reinforcement Learning (CTRL) (Lu et al., 2020) leverages bidirectional conditional GAN to model the environment dynamic for data augmentation. The model takes a noise vector as input besides the state and action to model the randomness of the environment. Before generating counterfactual data given alternative actions, they first infer the value of this noise vector. Then, the inferred noise is used to generate predictions with new actions. Causal Partial Models (CPM) (Rezende et al., 2020) studies the causal incorrectness of world models that don’t condition on the full observation. To fix this issue, CPM introduces a backdoor variable that helps the rollout of the model to be causally correct. We propose an SCM framework to model the physics properties of objects across the temporal dimension. In addition, we show that generating episodes with counterfactual object properties helps improve the generalization of the learned policy.
+
+Model-Based Reinforcement Learning Model-based Reinforcement Learning (MBRL) approaches have shown a potential to improve the sample efficiency by a large margin compared to classical model-free approaches (Kaelbling et al., 1996; Wang et al., 2019). Autoencoder-based algorithms like World Models (Ha & Schmidhuber, 2018) and Dreamer (Hafner et al., 2019; 2020) use the world model to better represent the visual observation and faster the policy training. Policy Search with Backpropagation algorithms like PILCO (Deisenroth & Rasmussen, 2011; Deisenroth et al., 2013; Kamthe & Deisenroth, 2018) and GPS (Levine & Koltun, 2013; Levine & Abbeel, 2014; Montgomery & Levine, 2016) train the policy by maximizing the simulated return of the policy in the world model. Because the world model is differentiable, the policy can be directly trained by gradient descent. Shooting algorithms like PETS-RS (Chua et al., 2018) and MB-MF (Nagabandi et al., 2018) alleviate the receding horizon problem in model predictive control (MPC). Recent works include Ross & Bagnell (2012), MOPO, (Yu et al., 2020) and Morel (Kidambi et al., 2020) show that MBRL can work well in the offline RL setting. Unlike the traditional MBRL that approximates the local transition function, $L ^ { 3 } P$ (Zhang et al., 2021) builds the world model as a graph of states for better reasoning ability. Dyna-style algorithms (Sutton, 1990; 1991a;b) use the learned world model to roll out simulated episodes to reduce the demand for real data for policy training. As a recent development of Dyna-style algorithms, ME-TRPO (Kurutach et al., 2018) uses an ensemble of world models to catch the epistemic uncertainty; MB-MPO (Clavera et al., 2018) viewed each model in the ensemble as a task and meta-learn a policy that adapts quickly to handle the model-bias issue; MBPO (Janner et al., 2019) rolls out short episodes branched from real data to improve the generation quality. Our method follows the Dyna-style framework and targets designing and using a causal world model to generate better and more diverse rollouts in robotic environments.
+
+
+Figure 2: The structure causal model of a robot environment. The time-invariant property is modeled as a node $_ { \mathbf { \nabla } } \mathbf { m } _ { \mathbf { \nabla } }$ across the temporal dimension that affects all the causal mechanisms. $s _ { - m , t }$ and $\mathbf { } \mathbf { a } _ { t }$ denotes the time-variant state and the action at the step $t$ , respectively.
+
+# 3 BACKGROUND
+
+# 3.1 STRUCTURAL CAUSAL MODEL
+
+Structural Causal Model (SCM) is a widely used framework to describe the causal mechanism of a system. Let’s denote $\mathbb { X } = \{ \mathbf { x } _ { 1 } , . . . , \mathbf { x } _ { N } \}$ as the set of $N$ variables in a system. Knowing their causal relationships allows us to build a directed acyclic causal graph to describe this system. Each node represents a variable, which is directly caused by its parent nodes. In this way, a node ${ \bf x } _ { n }$ can be modeled as the following function:
+
+$$
+{ \bf x } _ { n } = f _ { i } ( P a _ { 0 \mathrm { b s } } ( { \bf x } _ { n } ) , { \bf u } _ { n } )
+$$
+
+Here, $P a _ { \mathrm { o b s } } ( \mathbf { x } _ { n } )$ denotes the observed parent nodes of ${ \bf x } _ { n }$ . $\mathbf { u } _ { n }$ is a noise that represents the effect of omitted factors. This function is also called a causal mechanism. SCM is the set of these causal mechanisms that describes the whole system. SCM defines a joint distribution of the variables $p ( \mathbf { x } _ { 1 } , . . . , \mathbf { x } _ { N } )$ following the causal Markov assumption: given its direct causes, each variable ${ \bf x } _ { n }$ is independent of other indirect causal variables.
+
+# 3.2 DYNA-STYLE MODEL-BASED REINFORCEMENT LEARNING
+
+Dyna-style model-based reinforcement learning uses the world model to roll out simulated episodes, which can be viewed as data augmentation. The training of Dyna-style MBRL is composed of three steps: First, the agent interacts with the real environment and collects real data to train the world model. Then, this world model is used as a simulator of the real environment for the agent to interact and collect simulated data. After that, the agent can be trained together with the real and the simulated data using classical model-free reinforcement learning algorithms. These three steps are executed repeatedly until the training converges. In case we apply Dyna-Style algorithm on RL algorithms with experience-replay buffers and would like to collect whole simulated episodes, as the world model is trained to only approximate the transition of the environment $p ( \pmb { s } _ { t + 1 } | \pmb { s } _ { t } , \pmb { a } _ { t } )$ , we need an initial state to start the simulated episodes. A usual way to solve it is using the first state or a randomly sampled state $\mathbf { \Delta } _ { \mathbf { \mathcal { S } } _ { t } }$ from the collected real episodes as the start point of the simulated episodes. As the real episode already contains the future of $\mathbf { \boldsymbol { s } } _ { t }$ under the original action sequence $\{ a _ { t } , \pmb { a } _ { t + 1 } , . . . \}$ executed in this episode, generating new simulated episodes starting from $\mathbf { } _ \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \mathbf \mathbf { } \mathbf \mathbf \mathbf { } \mathbf \mathbf \mathbf { } \mathbf \mathbf \mathbf { } \mathbf \mathbf \mathbf \mathbf { } \mathbf \mathbf \mathbf \mathbf { } \mathbf \mathbf \mathbf \mathbf \mathbf { } \mathbf \mathbf \mathbf \mathbf \mathbf { } \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf { }$ under different action sequences can be viewed as answering a counterfactual “what if” question: What would happen if the agent behave differently this time instead of doing $\{ a _ { t } , a _ { t + 1 } , \ldots \} \colon$ The world model gives the agent a chance to figure out the answer without interacting in the real environment, and helps the agent learn faster.
+
+Data: Rollout length $K$ , Real experience buffer $\mathbb { D } _ { r }$ , Policy $p _ { \pi }$ , World model $p _ { W M }$ , Counterfactual property space $M$ , Empty episode buffer $\mathbb { B }$ Result: $\mathbb { B }$ 1 Sample a state $\pmb { s } = [ \pmb { s } _ { - m } ; m ]$ from the real experience buffer $\mathbb { D } _ { r }$ , $\mathbb { B }$ .append(s) 2 Sample a counterfactual property value $_ { \mathbf { \Omega } ^ { m } C F }$ from $M$ , set $\tilde { \pmb { s } } = \left[ \pmb { s } _ { - m } ; m _ { C F } \right]$ 3 for $K$ steps do 4 $\tilde { \mathbf { a } } \sim p _ { \pi } ( \mathbf { a } | \tilde { s } )$ , $\tilde { \pmb { s } } ^ { \prime } \sim p _ { W M } ( \pmb { s } ^ { \prime } | \tilde { \pmb { s } } , \tilde { \pmb { a } } )$ 5 $\mathbb { B }$ .append $( \tilde { \pmb { a } } , \tilde { \pmb { s } } ^ { \prime } )$ , $\tilde { s } \gets \tilde { s } ^ { \prime }$ 6 end
+
+# 4 METHOD
+
+# 4.1 STRUCTURE CAUSAL MODEL OF A ROBOT ENVIRONMENT
+
+Let’s consider an environment where a robot needs to manipulate an object. We can describe this environment using different states. Many of these states are changing over time, including the object position and the end-effect position. It is important to model them as they directly contain the dynamic information of the environment. Some other states are time-invariant, like the object mass or the floor friction coefficient. Although their values are fixed, they determine the environment dynamics and affect how other time-variant states change. Let’s denote the total state at step $t$ as $\mathbf { \boldsymbol { s } } _ { t }$ . $\pmb { s } _ { t } = [ \pmb { s } _ { - m , t } ; \pmb { m } ]$ is the concatenation of the time-variant state $s _ { - m , t }$ at step $t$ and the object timeinvariant property $_ { m }$ . The motor torque to execute at step $t$ is denoted as $\mathbf { } \mathbf { a } _ { t }$ . As shown in Fig.2, we can build a structural causal model (SCM) to describe this environment. The time-invariant property $_ { m }$ is modeled as a fixed node across the temporal dimension, which affects all the causal mechanisms.
+
+# 4.2 COUNTERFACTUAL PROPERTY GENERATION
+
+Policy generalization ability is essential as the testing environment of the policy is not always the same as the training environment. For example, when learning to lift an object, the robot might only interact with objects whose masses are in a suitable range. Lifting frequently a too-heavy object might reduce its service life, and most reinforcement learning algorithms need a large amount of interaction data to work. However, knowing how to lift a heavy object is still desirable when deploying the robot. A typical Dyna-style method generates simulated rollouts branching from a starting state seen in previous real episodes. If the world model takes physics properties as input, it is possible to go a step further and intervene in these properties. For example, we could modify the mass of an object in the world model to make it heavier. So the agent can learn to manipulate them in the world model as much as we want without harming its service life. Inspired by this, we design a simple generation strategy to enrich the simulated rollouts by modifying the original object’s property to improve the policy generalization. Concretely, instead of taking a starting state $\pmb { s } _ { t } ~ = ~ [ \pmb { s } _ { - m , t } ; \pmb { m } ]$ sampled from real episodes as it is like most of the Dyna-style methods, we replace the object property $_ { m }$ by a desired counterfactual value $_ { \mathbf { \Omega } ^ { m } C F }$ sampled from a predefined counterfactual property space $M$ before rolling out the simulated episodes. We name this type of episodes generation as counterfactual property generation, illustrate it in Fig.1 and show the process in Alg.1.
+
+# 4.3 TRAINING PROCEDURE
+
+The training of our model follows the Dyna-style model-based reinforcement learning framework. The world model is an additional imperfect substitute for the real environment for the policy to interact with. The policy is still trained using the traditional model-free reinforcement learning approach, but the data for training is a mixture of the data from the real environment data and that from the world model. During the training procedure, we maintain two replay buffers. The real experience replay buffer $\mathbb { D } _ { r }$ stores the interaction data from the real environment. The world model is trained using the real experience replay buffer only. The simulated episodes from the world model
+
+# Algorithm 2: Training Procedure
+
+Data: Policy $p _ { \pi }$ , World model $p _ { W M }$ , Empty real experience replay buffer $\mathbb { D } _ { r }$ , Empty episode buffer $\mathbb { B }$ , Rollout length $K$ , Counterfactual property space $M$ , Counterfactual generation ratio $\alpha$ Result: Trained Policy $p _ { \pi }$ 1 Prefill $\mathbb { D } _ { r }$ by executing the untrained policy $p _ { \pi }$ in the environment 2 while Not Converge do 3 Split $\mathbb { D } _ { r }$ into a training set $\mathbb { D } _ { r , t r a i n }$ and holdout set $\mathbb { D } _ { r , h o l d o u t }$ randomly 4 Train the world model $p _ { W M }$ on $\mathbb { D } _ { r , t r a i n }$ until converge on $\mathbb { D } _ { r , h o l d o u t }$ 5 Empty the simulated experience buffer $\mathbb { D } _ { s }$ 6 Generate $\alpha \% \cdot N _ { f }$ simulated episodes with $K$ steps by counterfactual property generation as Alg.1 to $\mathbb { D } _ { s }$ 7 Generate $( 1 - \alpha \% ) \cdot N _ { f }$ simulated episodes with $K$ steps with original property to $\mathbb { D } _ { s }$ 8 for $E$ steps do 9 Collect a step of data in the real environment; add it to $\mathbb { D } _ { r }$ 10 Update policy parameters via SAC on the combination of $\mathbb { D } _ { r }$ and $\mathbb { D } _ { s }$ for $G$ steps 11 end 12 end
+
+are stored in the simulated experience buffer $\mathbb { D } _ { s }$ , which is used to train the policy net and the real experience replay buffer $\mathbb { D } _ { r }$ . The whole training procedure is shown in Alg.2. The policy is trained via soft actor-critic (SAC) (Haarnoja et al., 2018) using the data from both the real experience buffer $\mathbb { D } _ { r }$ and the simulated buffer $\mathbb { D } _ { s }$ . As we generate the simulated episodes with counterfactual property and we following the Dyna-style MBRL framework, we name our model CausalDyna.
+
+World Model Training Each time the world model is trained, the real experience replay buffer $\mathbb { D } _ { r }$ is split into a training set, and a holdout set randomly. The world model is trained to predict the next state $\mathbf { } s _ { t + 1 }$ by maximizing the log-likelihood given the current state $\mathbf { \boldsymbol { s } } _ { t }$ and the action $\mathbf { } \mathbf { a } _ { t }$ in the training set until converging measured by the holdout set.
+
+Augment Data Collection We adopt the generation strategy of model-based policy optimization (MBPO) (Janner et al., 2019) to roll out the world model. The simulated episodes start from a real state randomly sampled from the real experience replay buffer $\mathbb { D } _ { r }$ and are rolled out for $K$ steps. We generate two types of simulated episodes: $\alpha \%$ of the rollouts are generated with counterfactual property generation, where we intervene the object property as described in Alg.1 to generate episodes with different objects. The remaining $( 1 - \alpha \% )$ episodes are generated using the original property. Each time $N _ { f }$ simulated episodes are generated in total. Note that each time we collect the simulated episodes, all the previous data in the simulated experience buffer $\mathbb { D } _ { s }$ is discarded as the world model generated them a few training steps before and are not ‘fresh’ anymore.
+
+# 5 EXPERIMENTS
+
+# 5.1 BENCHMARK
+
+We evaluate our method CausalDyna on a recently proposed robotic benchmark CausalWorld (Ahmed et al., 2020). CausalWorld is designed for causal structure and transfer learning in a robotic manipulation environment. The robot in CausalWorld is a 3-finger gripper. Each finger has three joints. The mission of the robot is to move objects to specified target locations. The observations of the CausalWorld we use includes the time stamp $t$ , the robot state $\scriptstyle { \pmb { s } } _ { r }$ , the object state $\scriptstyle { \pmb { s } } _ { o }$ , the timeinvariant property $_ { \mathbf { \nabla } } \mathbf { m } _ { \mathbf { \nabla } }$ , and the goal information $s _ { g }$ . The robot state $\scriptstyle { \pmb { s } } _ { r }$ is consists of 9 joint positions, 9 joint velocities, and the Cartesian coordinates of the three end-effectors (fingertips). The object state $\scriptstyle { \pmb { s } } _ { o }$ contains the Cartesian coordinate, the velocity, the quaternion orientation, and the object’s angular velocity. The property $_ { \mathbf { \nabla } } \mathbf { m }$ includes the object mass and the friction coefficient. The goal information $s _ { g }$ contains the target location and orientation of the object.
+
+Evaluated Models We evaluate three approaches in our experiments: Model-Based Policy Optimization (MBPO) (Janner et al., 2019), one of the state-of-the-art Dyna style methods with high sample efficiency, Soft Actor-Critic (SAC) (Haarnoja et al., 2018), a widely-used model-free approach, and our method CausalDyna.
+
+Task Settings and Performance Metrics We define three settings to evaluate our method: Picking Mass, Pushing Mass, and Pushing Friction. In Picking Mass, the robot needs to pick up an object to a target location in the air. The object mass is different over different episodes. In contrast, the target locations in Pushing Mass and Pushing Friction are on the ground. The object mass and the floor friction in Pushing Mass and Pushing Friction are different over different episodes, respectively. We use the default reward signals of CausalWorld to train our method. The reward provides rich signals to encourage the robot to get close to the object and move it toward the target. The reward is a weighted sum over the reduction of the distance between the end effectors and the object and the distance between the object and the target. We evaluated our approach and competing methods using fractional success rate (FSR), which is defined as the overlapping ratio between the object and the target. We compute the FSR of a given episode as the average FSR over the last 20 steps. To quantify the sample efficiency in our benchmark, we propose a metric named Area-Under-theCurve Ratio (AUCRatio). Given a learning curve $\mathrm { F S R } = f _ { l e a r n } ( n _ { s t e p } )$ where $n _ { s t e p }$ denotes the number of the environment steps collected already, AUCRatio until step $N _ { s t e p }$ is computed as Eq.2. As $0 \leq \mathrm { F S R } \leq 1$ , a policy with AUCRatio $= 1$ means it can perform the task perfectly without training.
+
+$$
+\mathrm { A U C R a t i o } = \frac { 1 } { N _ { s t e p } } \sum _ { n _ { s t e p } = 1 } ^ { N _ { s t e p } } f _ { l e a r n } ( n _ { s t e p } )
+$$
+
+# 5.2 EXPERIMENTS WITH OUT-OF-DISTRIBUTION PROPERTY
+
+An intelligent robot might encounter various objects when deploying. If the robot need to manipulate an object unseen during training, its performance might be reduced. This can be viewed as an outof-distribution problem: how to generalize well to the object not in the training distribution? The counterfactual property generation approach has the potential to increase the performance on objects with unseen property values if we roll out simulated episodes with object property that is out of the training range. To verify our assumption, we create an experiment to study whether our method helps improve the agent performance on objects whose property value is not encountered during training. In detail, in our Picking Mass and Pushing Mass setting, the robot is trained with objects of which the mass is uniformly distributed from $0 . 0 1 5 \mathrm { k g }$ to $0 . 0 4 5 \mathrm { k g }$ . But during the testing stage, the robot is asked to interact with heavier objects up to $0 . 1 \mathrm { k g }$ . In Pushing Friction setting, the friction coefficient is from 0.3 to 0.6 during training. And the robot is deployed to also handle friction from 0.6 to 0.8.
+
+As we target the performance of the objects with unseen property value during training, we use our method here to imagine these objects. In detail, when the counterfactual property generation is applied, we replace the original property value with a counterfactual value uniformly sampled from the unseen test range. In this way, our agent can practice manipulating these unseen objects in the world model in advance.
+
+Hyperparameters The length of the simulated episodes $K$ is 10. A bootstrap ensemble of world models is used following Kurutach et al. (2018) for both MBPO and our method. The ensemble size is 7. For each generation step, we randomly pick one model from the ensemble to predict the next state. When training the policy, $20 \%$ of the training data are from the real experience replay buffer. The remaining are from the simulated episodes. In our CausalDyna, $20 \%$ of the simulated episodes are generated by counterfactual property generation ( $\alpha$ in Alg.2). We use Adam (Kingma & Ba, 2014) as the training optimizer for all experiments. All the models we evaluated are trained for 1.2 million steps in Picking Mass and 600 thousand steps in Pushing Mass and Pushing Friction. Each model in this experiment has 5 training cases. The model architecture and the remaining hyperparameters can be found in Appx.A and Appx.B.
+
+
+Figure 3: Experimental results of counterfactual property generation in the out-of-distribution experiment. The vertical black line shows the boundary between the seen and unseen property values during training. The left part is the seen region. Counterfactually generating the simulated episodes with unseen property value helps alleviate the performance drop when evaluating unseen property during training. Numbers in the legend denote the average performance in the unseen value range. Each curve contains 5 training cases.
+
+
+Figure 4: The learning curve of the evaluated models on the training property range in the outof-distribution experiments. CausalDyna converges as fast as MBPO, although it generates $20 \%$ less simulated episodes in the training property range. Numbers in the legend denote the average AUCRatio.
+
+Performance The experimental results are shown in Fig.3. The vertical black line denotes the boundary between the seen and unseen values during training. The left part is the seen region. In Picking Mass and Pushing Mass, the performance of all the methods declines when the object mass is out of the training range. Moreover, the performance reduction is more significant when the tested object mass is farther away from the training range. Our CausalDyna alleviates this performance reduction in the unseen range by a large margin compared to MBPO. In Picking Mass, CausalDyna improves the unseen FSR by $24 \%$ from 0.37 to 0.47. For Picking Mass it is $27 \%$ from 0.7 to 0.87. This indicates that hallucinating episodes with unseen objects during training helps improve the generalization ability of the policy. In Pushing Friction, CausalDyna achieves similar performance as MBPO since the unseen range performance reduction here is not obvious. As SAC is less sample efficiency than both model-based methods, SAC cannot achieve compatible results given the same training data as MBPO and CausalDyna. Note that in Picking Mass, although our CausalDyna performs better than MBPO in the out-of-distribution range, the absolute performance is not high when the object is too heavy (like $0 . 1 \mathrm { k g } { \cdot }$ . This might be caused by the reduced performance of the world model when counterfactually generating episodes with unseen objects. A better world model design that can better understand the physics and reason the future more causally might help alleviate this issue when combined with our method. We leave this for future research.
+
+Sample Efficiency We show the learning curve of MBPO, CausalDyna, and SAC of this experiment in Fig.4. Although we augment $20 \%$ fewer simulated episodes in the original property range compared to MBPO, CausalDyna converges as fast as MBPO in the original training range. Results indicate that our method improves the out-of-distribution performance without sacrificing the sample efficiency. The model-free SAC training is much slower than MBPO and CausalDyna, as SAC doesn’t have simulated data to train on.
+
+
+Figure 5: Experimental results of counterfactual property generation in the unbalanced distribution experiment. When counterfactually generating episodes where the object is less encountered during training, CausalDyna helps improve the policy performance on both the objects with head values and tail values. For each property, the median value occurs $90 \%$ of the time in the environment, and the rest two values share the remaining $10 \%$ equally. Numbers in the legend denote the average performance over the tail values. Each model has 6 training cases.
+
+# 5.3 EXPERIMENTS WITH UNBALANCED TRAINING DISTRIBUTION
+
+In real environments like warehouses, the numbers of different wares are unequal, and a sorting robot might manipulate some objects less frequently. This can be described as an unbalanced training distribution. If the training distribution is heavily unbalanced and some objects are significantly less encountered than others during training, counterfactually generating episodes with such objects might help improve the policy performance on them. We create a simple heavily unbalanced training distribution consisting of 1 head property value and two tail property values to verify this assumption. The object property in $90 \%$ of the training episodes equals the head value. The two tail values share the remaining $10 \%$ , each value obtains $5 \%$ . Concretely, in Picking Mass and Pushing Mass, we have three different objects with mass values $0 . 0 0 2 \mathrm { k g }$ , $0 . 0 1 \mathrm { k g }$ , and $0 . 0 5 \mathrm { k g }$ , respectively. $90 \%$ of the time, the robot sees and manipulates the object with the median mass value of $0 . 0 1 \mathrm { k g }$ . The robot plays with the heavy $0 . 0 5 \mathrm { k g }$ object and the light $0 . 0 0 2 \mathrm { k g }$ object equally in the remaining time. For Pushing Friction, the three friction coefficients are 0.3, 0.55, and 0.8 that occur in $5 \%$ , $90 \%$ , and $5 \%$ of the time, respectively. In the testing stage, models need to perform well on all three property values.
+
+As the objects with tail values occur less frequently in the training stage, CausalDyna in this experiment imagines what would happen if the given head object is the tail. Concretely, when CausalDyna generating simulated episodes, the property value of original objects are counterfactually modified to one of the tail property values randomly. Therefore, the agent can interact with the tail objects more in the world model to improve the tail performance.
+
+Hyperparameter In CausalDyna, 2/3 of the simulated episodes are generated by counterfactual property generation $\alpha$ in Alg.2). All the models on all the 3 settings are trained for 600 thousand steps. Each model in this experiment has 6 training cases. The remaining hyperparameters are the same as in the previous experiment.
+
+Performance As shown in Fig.5, the performance on the head property value $( 0 . 0 1 \mathrm { k g }$ for mass and 0.55 for friction) is better than the tail property values for all the methods in all the 3 settings. However, CausalDyna improves the performance on the tail property and shows the smallest performance difference between the head and the tail among the three models. For example, the performance gap between the head and the tail of CausalDyna in Picking Mass is about 0.1, much smaller than MBPO (0.2-0.3), and the tail performance is increased by $30 \%$ from 0.56 to 0.73. Besides, we notice that CausalDyna improves the policy performance on both objects that are less frequently seen during training and the head objects compared to MBPO. This might be because learning how to behave well in the tail cases helps the model better understand the environment dynamics and improves overall performance. In addition, the performance variance in Pushing Mass and Pushing Friction of CausalDyna is much lower than the other two methods, which suggests that the performance of CausalDyna is more consistent than other methods. With the same amount of training data as MBPO and CausalDyna, the model-free SAC’s performance is worse than the model-based MBPO and CausalDyna, which is the same as the out-of-distribution experiment.
+
+
+Figure 6: Average policy performance at different environment steps. Our method CausalDyna, which counterfactually generating episodes where the object is less frequently encountered during training, reduces the required amount of environment steps and shows the best sample efficiency in the unbalanced training distribution experiment. Numbers in the legend denote the average AUCRatio. Each model has 6 training cases.
+
+Sample Efficiency The learning curves of the evaluated models are shown in Fig.6. The fractional success rate is uniformly averaged over all the property values. CausalDyna shows a better sample efficiency and converges faster. In all three settings, CausalDyna requires about $1 0 0 \mathrm { k }$ fewer environment steps to converge compared to MBPO and increase the sample effiency by about $17 \%$ . This might be because CausalDyna has more simulated episodes with the tail property values to train the agent, which helps the agent understand the task better and adapt to all the property values faster.
+
+# 6 CONCLUSION AND FUTURE WORK
+
+In this paper, we focus on improving the generalization ability of model-based reinforcement learning in robotic environments. We propose a novel Dyna-style causal reinforcement learning algorithm named CausalDyna that rollouts episodes with intervened object properties. CausalDyna leverages the diversity of the simulated episodes augmented by the world model and improves the generalization of the policy when manipulating objects with property unseen or rarely seen during training. Experiments show that our method helps the robot generalize to objects with unseen property values better. In addition, when the training distribution is unbalanced, our method requires fewer environment steps to converge and performs better with rarely seen objects.
+
+To our knowledge, we are the first to propose counterfactual reasoning on environment properties to improve the generalization of reinforcement learning. We believe this is a promising direction to solve many complex reinforcement learning tasks where the policy generalization ability is essential. When combined with model predictive control and counterfactual reasoning on actions, it is possible to further improve sample efficiency and generalization of RL algorithms. One limitation of our method is that the quality of our counterfactual episodes depends on how well our world model understands the environment. We plan to design a better world model that takes prior knowledge like simple physics laws into account. Finally, we have assumed that the properties in our environment are fully observable in our current work. We plan to investigate causal models with latent variables representing unobserved properties of the environment.
+
+# REFERENCES
+
+Ossama Ahmed, Frederik Trauble, Anirudh Goyal, Alexander Neitz, Yoshua Bengio, Bernhard ¨ Scholkopf, Manuel W ¨ uthrich, and Stefan Bauer. Causalworld: A robotic manipulation bench- ¨ mark for causal structure and transfer learning. arXiv preprint arXiv:2010.04296, 2020.
+
+Lars Buesing, Theophane Weber, Yori Zwols, Sebastien Racaniere, Arthur Guez, Jean-Baptiste Lespiau, and Nicolas Heess. Woulda, coulda, shoulda: Counterfactually-guided policy search. arXiv preprint arXiv:1811.06272, 2018.
+
+Kurtland Chua, Roberto Calandra, Rowan McAllister, and Sergey Levine. Deep reinforcement learning in a handful of trials using probabilistic dynamics models. arXiv preprint arXiv:1805.12114, 2018.
+
+Ignasi Clavera, Jonas Rothfuss, John Schulman, Yasuhiro Fujita, Tamim Asfour, and Pieter Abbeel. Model-based reinforcement learning via meta-policy optimization. In Conference on Robot Learning, pp. 617–629. PMLR, 2018.
+
+Marc Deisenroth and Carl E Rasmussen. Pilco: A model-based and data-efficient approach to policy search. In Proceedings of the 28th International Conference on machine learning (ICML-11), pp. 465–472. Citeseer, 2011.
+
+Marc Peter Deisenroth, Dieter Fox, and Carl Edward Rasmussen. Gaussian processes for dataefficient learning in robotics and control. IEEE transactions on pattern analysis and machine intelligence, 37(2):408–423, 2013.
+
+David Ha and Jurgen Schmidhuber. World models. ¨ arXiv preprint arXiv:1803.10122, 2018.
+
+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, pp. 1861–1870. PMLR, 2018.
+
+Danijar Hafner, Timothy Lillicrap, Jimmy Ba, and Mohammad Norouzi. Dream to control: Learning behaviors by latent imagination. In International Conference on Learning Representations, 2019.
+
+Danijar Hafner, Timothy Lillicrap, Mohammad Norouzi, and Jimmy Ba. Mastering atari with discrete world models. arXiv preprint arXiv:2010.02193, 2020.
+
+Michael Janner, Justin Fu, Marvin Zhang, and Sergey Levine. When to trust your model: Modelbased policy optimization. arXiv preprint arXiv:1906.08253, 2019.
+
+Leslie Pack Kaelbling, Michael L Littman, and Andrew W Moore. Reinforcement learning: A survey. Journal of artificial intelligence research, 4:237–285, 1996.
+
+Sanket Kamthe and Marc Deisenroth. Data-efficient reinforcement learning with probabilistic model predictive control. In International conference on artificial intelligence and statistics, pp. 1701– 1710. PMLR, 2018.
+
+Rahul Kidambi, Aravind Rajeswaran, Praneeth Netrapalli, and Thorsten Joachims. Morel: Modelbased offline reinforcement learning. arXiv preprint arXiv:2005.05951, 2020.
+
+Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
+
+Thanard Kurutach, Ignasi Clavera, Yan Duan, Aviv Tamar, and Pieter Abbeel. Model-ensemble trust-region policy optimization. arXiv preprint arXiv:1802.10592, 2018.
+
+Sergey Levine and Pieter Abbeel. Learning neural network policies with guided policy search under unknown dynamics. In NIPS, volume 27, pp. 1071–1079. Citeseer, 2014.
+
+Sergey Levine and Vladlen Koltun. Guided policy search. In International conference on machine learning, pp. 1–9. PMLR, 2013.
+
+Chaochao Lu, Biwei Huang, Ke Wang, Jose Miguel Hern ´ andez-Lobato, Kun Zhang, and Bernhard ´ Scholkopf. Sample-efficient reinforcement learning via counterfactual-based data augmentation. ¨ arXiv preprint arXiv:2012.09092, 2020.
+
+William H Montgomery and Sergey Levine. Guided policy search via approximate mirror descent. Advances in Neural Information Processing Systems, 29:4008–4016, 2016.
+
+Anusha Nagabandi, Gregory Kahn, Ronald S Fearing, and Sergey Levine. Neural network dynamics for model-based deep reinforcement learning with model-free fine-tuning. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 7559–7566. IEEE, 2018.
+
+Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. In Icml, 2010.
+
+Prajit Ramachandran, Barret Zoph, and Quoc V Le. Searching for activation functions. arXiv preprint arXiv:1710.05941, 2017.
+
+Danilo J Rezende, Ivo Danihelka, George Papamakarios, Nan Rosemary Ke, Ray Jiang, Theophane Weber, Karol Gregor, Hamza Merzic, Fabio Viola, Jane Wang, et al. Causally correct partial models for reinforcement learning. arXiv preprint arXiv:2002.02836, 2020.
+
+Stephane Ross and J Andrew Bagnell. Agnostic system identification for model-based reinforcement learning. arXiv preprint arXiv:1203.1007, 2012.
+
+Richard S Sutton. Integrated architectures for learning, planning, and reacting based on approximating dynamic programming. In Machine learning proceedings 1990, pp. 216–224. Elsevier, 1990.
+
+Richard S Sutton. Dyna, an integrated architecture for learning, planning, and reacting. ACM Sigart Bulletin, 2(4):160–163, 1991a.
+
+Richard S Sutton. Planning by incremental dynamic programming. In Machine Learning Proceedings 1991, pp. 353–357. Elsevier, 1991b.
+
+Tingwu Wang, Xuchan Bao, Ignasi Clavera, Jerrick Hoang, Yeming Wen, Eric Langlois, Shunshi Zhang, Guodong Zhang, Pieter Abbeel, and Jimmy Ba. Benchmarking model-based reinforcement learning. arXiv preprint arXiv:1907.02057, 2019.
+
+Tianhe Yu, Garrett Thomas, Lantao Yu, Stefano Ermon, James Zou, Sergey Levine, Chelsea Finn, and Tengyu Ma. Mopo: Model-based offline policy optimization. arXiv preprint arXiv:2005.13239, 2020.
+
+Lunjun Zhang, Ge Yang, and Bradly C Stadie. World model as a graph: Learning latent landmarks for planning. In International Conference on Machine Learning, pp. 12611–12620. PMLR, 2021.
+
+# A MODEL ARCHITECTURE
+
+Here we list the architecture of the world model, the policy actor net and the policy critic net we use in all experiments for all methods. All the models are built using linear-layers. The world model uses Swish activation function (Ramachandran et al., 2017) and the policy uses ReLU (Nair & Hinton, 2010).
+
+Table 1: Model Architecture
+
+
Modules
Hidden Layers
Neurons PerLayer
WorldModel
3
200
Policy Actor
2
256
Policy Critic
2
256
+
+# B HYPERPARAMETER
+
+The size of the real experience replay buffer $\mathbb { D } _ { r }$ is $1 0 0 \mathrm { k }$ for MBPO and our method CausalDyna in all three settings. For SAC, it is 1M as we notice SAC with $1 0 0 \mathrm { k }$ -size replay buffer cannot be trained well. For the world model training, The replay buffer $\mathbb { D } _ { r }$ is split randomly into a training set $\mathbb { D } _ { r , t r a i n }$ with $80 \%$ of the data and a holdout set $\mathbb { D } _ { r , h o l d o u t }$ containing the remaining data. We train the model once for every 250 real environment steps until converge is evaluated on the holdout set. The learning rate is 3e-4. Batch size is 256. For the policy training, the policy net is updated for 5 iterations per real environment step. The batch size is 256, and the learning rate is set to 1e-4.
+
+# C QUALITATIVE RESULTS
+
+Here we demonstrate episodes from CausalDyna and MBPO in the Pushing Mass setting in unbalanced training distribution experiments with the heavy tail object in Fig.7 and Fig.8. Both models are trained for $6 0 0 \mathrm { k }$ environment steps. The object to manipulate is in blue color. Target location is shown as the green shade. Each column corresponds to an episode. CausalDyna generalizes to the heavy tail object well and pick it to the location successfully shown in Fig.7, while MBPO fails to lift the object up in 2 episodes shown in Fig.8.
+
+
+Figure 7: CausalDyna with the heavy tail object. Pushing Mass, Unbalanced Training Distribution.
+
+
+Figure 8: MBPO with the heavy tail object. Pushing Mass, Unbalanced Training Distribution.
\ No newline at end of file
diff --git a/md/dev/uytgM9N0vlR/uytgM9N0vlR.md b/md/dev/uytgM9N0vlR/uytgM9N0vlR.md
new file mode 100644
index 0000000000000000000000000000000000000000..8f53562caba1e548da0487cbfe1ff750bc4b23b9
--- /dev/null
+++ b/md/dev/uytgM9N0vlR/uytgM9N0vlR.md
@@ -0,0 +1,301 @@
+# Does GNN Pretraining Help Molecular Representation?
+
+Ruoxi Sun Google Cloud AI Research ruoxis@google.com
+
+Hanjun Dai Google Research, Brain Team hadai@google.com
+
+Adams Wei Yu Google Research, Brain Team adamsyuwei@google.com
+
+# Abstract
+
+Extracting informative representations of molecules using Graph neural networks (GNNs) is crucial in AI-driven drug discovery. Recently, the graph research community has been trying to replicate the success of self-supervised pretraining in natural language processing, with several successes claimed. However, we find the benefit brought by self-supervised pretraining on small molecular data can be negligible in many cases. We conduct thorough ablation studies on the key components of GNN pretraining, including pretraining objectives, data splitting methods, input features, pretraining dataset scales, and GNN architectures, to see how they affect the accuracy of the downstream tasks. Our first important finding is, self-supervised graph pretraining do not always have statistically significant advantages over non-pretraining methods in many settings. Secondly, although noticeable improvement can be observed with additional supervised pretraining, the improvement may diminish with richer features or more balanced data splits. Thirdly, hyper-parameters could have larger impacts on accuracy of downstream tasks than the choice of pretraining tasks, especially when the scales of downstream tasks are small. Finally, we provide our conjectures where the complexity of some pretraining methods on small molecules might be insufficient, followed by empirical evidences on different pretraining datasets.
+
+# 1 Introduction
+
+Graph neural networks (GNNs) , due to their effectiveness, have been adopted to model a wide range of structured data, such as social networks, road graphs, citation networks, etc. Molecule modeling is one of these important applications, where it serves as the foundation of biomedicine and nurturing techniques like novel drug discovery. However, labeling biomedical data are usually time-consuming and expensive and thus task-specific labels are extremely inadequate. This poses a big challenge to the field. Recently, inspired by the remarkable success of self-supervised pretraining from natural language processing [6, 2, 28] and computer vision domains [11, 5], researchers start trying to apply the pretrain-finetune paradigm to molecule modeling with GNN, hoping to boost the performance of various molecular tasks by pretraining the model on the enormous unlabeled data. For instance, many methods have been proposed [32, 29], where significant performance improvements are claimed by pretraining on large scale datasets [12, 22, 35–37]. Despite of the promising results, we find that reproducing some of these outstanding gains via graph pretraining can be non-trivial, and sometimes the improvement largely relies on the experimental setup and the extensive hyper-parameter tuning of downstream tasks, rather than the design of pretraining objectives. These observations motivate us to rethink the effectiveness of graph pretraining with unsupervised or self-supervised objectives, and investigate what factors would influence the effectiveness of self-supervised graph pretraining.
+
+In this paper, we perform systematic studies to assess the performance of popular graph pretraining objectives on different types of datasets, and exploit various confounding components in experimental setup in deciding the performance of downstream tasks with or without pretraining. Here, we restrict our studies to small molecular graphs, as opposed to other application domains, such as social networks or citation graphs. The key insights and take-aways of this paper are:
+
+
+Figure 1: A typical pipeline for graph pretraining and deployment for downstream applications.
+
+• Among the pretraining tasks we evaluated, the self-supervised pretraining alone does not provide statistically significant improvements over non-pretrained methods on downstream tasks.
+• When additional supervised pretraining step is conducted after self-supervised pretraining, we observe statistically significant improvements. However, the gain becomes marginal on some specific data splits or diminishes if richer features are introduced.
+• Beyond data splits and hand-crafted features, the usefulness of graph pretraining is also sensitive to the experimental hyperparameters, such as learning rates and number of study repeats. Different setups can lead to opposite conclusions.
+• In conclusion, different from the previous works, we do not observe clear and unconditional gains achieved by graph pretraining on molecular representation, indicating it is still too early to conclude graph pretraining is effective in molecular domain.
+• We investigate the reason of above and hypothesize that the complexity of some pretraining methods on molecules is insufficient, leading to less transferable knowledge for downstream tasks.
+
+Despite the overall negative results we obtained, the main goal of this paper is not to discourage the pretraining research for small molecules. Instead, we hope to raise the attention on different aspects of experiments and the role of simple hand-crafted features, so as to provide useful information for designing better pretraining approaches. Below we first introduce the background of GNN and its pretraining in Section 2, and then our experimental design and results in Section 3 and Section 4, respectively. Finally we conclude with our findings and the limitations in Section 5 and Section 6.
+
+# 2 Preliminary
+
+Table 1: Summary of Experiments. Table 12 and Table 13 are deferred to appendix due to space limit.
+
+
Pretrain Objective
GraphFeatures
DownstreamSplits
GNN Arch
PretrainDataset
Self-SupervisedSupervised
Rich Basic
Balanced Scaffold
GIN GraphSage
ZINC15 SAVI
Table 2
√
√
Table 3
(
(
Table4
(
Table 5
(
(
Table6
(
(
Table7
(
(
Table8
(
Table9
√
(
(
Table10
√
(
√
Table 11
----------------
?
Table12
----√-------/---
√
----------
Table13
----√----------
----------
-√-------
+
+Graph Neural Networks (GNNs). Let $G = \{ V , E \}$ denote a molecule graph with $V$ as the set of nodes and $E$ as the set of edges. Given the node features $X _ { i }$ , most GNNs learn an embedding representation $h _ { i }$ for every node $i \in V$ by aggregating representations from connected nodes and
+
+edges, denoted as graph convolution. These procedure repeats for $K$ times with the update equation as follows:
+
+$$
+h _ { i } ^ { k } = \mathrm { U P D A T E } ( h _ { i } ^ { k - 1 } , \mathrm { A G G R E G A T E } ( \{ h _ { i } ^ { k - 1 } , h _ { j } ^ { k - 1 } , e _ { i j } \} : \forall j \in N ( i ) ) )
+$$
+
+where $\mathcal { N } ( i )$ is the set of neighbor nodes of $i$ and $\begin{array} { r c l } { h _ { i } ^ { 0 } } & { = } & { X _ { i } } \end{array}$ . The representation for entire graph $G$ is then obtained by permutation-invariant transformation on node representation, $h _ { G } \ = \ \mathrm { \hat { R } E A D O U T } ( h _ { i } ^ { K } | i \ \in \ V )$ . In this paper we mainly study the GNNs that belong to this family, namely the WL-1 GNNs.
+
+Finetune. After the pretraining, the pretrained model is used to finetune on the downstream tasks. For molecule property prediction tasks, the graph-level representation obtained from the pretrained model is connected to linear classifiers to predict downstream task labels. The fine-tuning is performed in an end-to-end manner, where both the pretrained GNN and the linear classifiers are trainable.
+
+Graph pretraining objectives. The primary goal of pretraining is to learn representations with robust transferable knowledge of graphs from the abundant pretraining data and then generalize to downstream tasks with usually different supervision signals. Generally the pretraining objectives can be categorized into self-supervised and supervised ones. We present a brief overview of some representative objectives in the following sections.
+
+# 2.1 Self-supervised (unsupervised) pretraining
+
+In self-supervised pretraining, the pretraining objective is designed to learn self-generated targets from the structure of the molecules, such as the type of nodes and edges, prediction of local context, graph partition, node clustering, occurrence of some functional groups, and etc. The predictive target can be node/edge level or entire graph level. We present some representative ones below:
+
+# 2.1.1 Node Prediction
+
+Node prediction is a node-level classification task given the masked context of entire graph. Similar to Devlin et al. [6], some portion of node attributes are masked and replaced with mask-specified indicators in the node input feature. After graph convolution, the embedding output from GNN is used to predict the true attribute of the node, e.g. atom type in molecular graphs, through a linear classifier on top of the node embedding.
+
+# 2.1.2 Context Prediction
+
+Context prediction task is a sub-graph level task aiming at learning embedding that can represent the local subgraph surrounding a node. Generally it can be viewed as a masked task for substructure. Since it is essentially a structured prediction which can be difficult in general, Hu et al. [12] leverages the adversarial learning to teach the model to distinguish the positive sub-graph embedding from the negative ones. Rong et al. [22] instead builds a dictionary of structures that captures the property of sub-graphs (e.g. type and quantity of neighbour nodes and bonds), and turns it into a multi-class classification problem.
+
+# 2.1.3 Motif Prediction
+
+Motif prediction [22] is to predict the existence of functional groups, such as benzene ring or hydroxyl. The motifs are extracted automatically from RDKit [15] . The motif prediction task is formulated as a graph-level multi-label binary classification task, where the graph embedding is used to jointly predict the occurrence of these semantic functional motifs.
+
+# 2.1.4 Contrastive learning
+
+Graph contrastive learning is to maximize the agreement of two augmented views of the same graph, and minimize the agreement of different graphs. The optimization is conducted using contrastive loss in the latent embedding space [35, 10, 37, 29]. The augmentation function needs to transform graphs into realistic and novel augmentations without affecting semantic labels of the graphs. For example, the transformation can be small perturbations or modifications on node/edge embedding, drop of a few nodes or edges, and so on. These transformations enforce an underlying prior for contrastive learning, that is, local transformation does not change the semantic meaning of a graph.
+
+Table 2: Self-supervised $^ +$ Rich feature $^ +$ Balanced Scaffold Split. No pretrain has an average value of $7 8 . 0 \%$ over all 5 datasets.
+
+
Methods
BBBP
BACE
TOX21
TOXCAST
SIDER
AVE GAIN
No pretrain
92.23(±3.07)
87.43(±1.63)
79.20(±1.99)
69.13(±0.55)
61.92(±0.89)
0(±1.626)
Node Prediction
92.24(±2.76)
87.32(±1.67)
79.57(±2.03)
69.77(±0.13)
61.62(±1.12)
0.122(±1.542)
Context Prediction
92.68(±1.19)
86.98(±1.26)
79.05(±2.51)
70.18(±0.44)
61.65(±0.77)
0.126(±1.234)
Motif Prediction
92.63(±1.19)
87.16(±1.66)
79.22(±2.38)
69.09(±0.07)
62.45(±1.25)
0.128(±1.310)
Contrastive learning
92.31(±1.58)
86.67(±2.40)
78.45(±2.44)
68.37(±0.80)
61.22(±1.20)
-0.578(±1.684)
+
+# 2.2 Supervised pretraining
+
+Supervised pretraining aims to learn domain-specific graph-level knowledge from specifically designed pretraining tasks. For molecular application, the supervised labels are generated from a diverse set of functional studies like biochemical assays. The pretrainning task is to perform multiple binary classification and jointly learn the supervised labels. Although the pretraining mainly refers to unsupervised or self-supervised methods as they are not limited by the requirement of supervised labels, supervised pretraining is still a great source to investigate the graph pretraining in general.
+
+Table 3: Supervised $^ +$ Rich feature $^ +$ Balanced Scaffold. No pretrain has an average AUC of $7 8 . 0 \%$ .
+
+
Methods
BBBP
BACE
TOX21
TOXCAST
SIDER
AVE GAIN
No pretrain
92.23(±3.07)
87.43(±1.63)
79.2(±1.99)
69.13(±0.55)
61.92(±0.89)
0(±1.626)
Supervised
91.65(±2.11)
86.91(±1.86)
81.13(±2.39)
71.64(±0.46)
62.14(±1.13)
0.712(±1.590)
Masking Node + Supervised
93.43(±2.50)
86.90(±2.04)
81.93(±1.79)
71.66(±0.73)
62.68(±1.82)
1.338(±1.776)
Context Prediction + Supervised
92.27(±1.57)
88.72(±1.68)
81.71(±1.79)
72.19(±0.79)
63.21(±1.49)
1.638(±1.464)
+
+# 3 Experiment framework
+
+To investigate pretraining on graphs for molecule representations, we first revisit the typical pretraining-finetuning pipeline used in the literature. Figure 1 shows the overall procedure of deployment, with several design choices presented at each stage of the pipeline. Since different choices at each stage can lead to different performances on the downstream tasks, we investigate them one at a time while keeping others the unchanged. The design principle of our experiment framework is to analyze the effect of every stage in the pipeline as comprehensive as possible, while also keeping it tractable to avoid exponentially many experiments.
+
+# 3.1 Design choices
+
+We consider the design choices for the four pretraining objectives.
+
+Pretraining objective In Section 2 we have provided a brief literature review over the pretraining methods for molecule representation. Here we categorize those pretraining by different principles, and present one well-recognized representative of each category. The representatives are selected because they have more desired properties, such as better performance, compared with their counterparts.
+
+• Masking. We leverage the node prediction objective, which randomly masks $1 5 \%$ of the nodes’ feature and then ask GNN to make prediction on the node attributes of the masked ones. This strategy resembles the BERT pretraining [6] in natural language processing.
+• Structured. Unlike text data where the topology is a sequence, the graph has rich structure information. Following Hu et al. [12], we use context prediction objective, which masks out the context from $k _ { 1 }$ -hops to $k _ { 2 }$ -hops and leverages adversarial training to predict the true context embeddings from the random context embeddings.
+• Graph-level self-supervised. Following [22], GNN is asked to predict whether a motif is contained in a molecule. The motif can be extracted from the molecule with RDKit [15]. The motifs are 85 motifs 1 for multi-label classification.
+
+Table 4: Self-supervised $^ +$ Rich feature $^ +$ Scaffold. No pretrain has an average ROC-AUC of $7 1 . 8 \%$ over all benckmark datasets.
+
+
Methods
BBBP
BACE
TOX21
TOXCAST
SIDER
AVE GAIN
No pretrain
74.83(±0.73)
80.10(±0.42)
75.86(±0.58)
65.95(±0.15)
62.30(±1.14)
0(±0.579)
Node Prediction
73.45(±0.27)
83.66(±0.75)
75.30(±0.37)
66.50(±0.06)
65.08(±0.12)
0.990(±0.323)
Context Prediction
74.10(±0.22)
81.87(±0.49)
75.37(±0.11)
66.86(±0.07)
62.84(±0.46)
0.400(±0.280)
Motif Prediction
73.65(±0.36)
80.58(±2.04)
74.55(±0.79)
65.63(±0.07)
64.05(±0.23)
-0.116(±0.766)
Contrastive learning
73.32(±2.38)
80.51(±0.80)
74.55(±0.22)
65.70(±0.09)
64.39(±0.63)
-0.114(±0.513)
+
+Table 5: Supervised $^ +$ Self-supervised $^ +$ Rich feature $^ +$ Scaffold. No pretrain get $7 1 . 8 \%$ average ROC-AUC.
+
+
Methods
BBBP
BACE
TOX21
TOXCAST
SIDER
AVE GAIN
No pretrain
74.83(±0.73)
80.10(±0.42)
75.86(±0.58)
65.95(±0.15)
62.30(±1.14)
0(±0.604)
Supervised
72.79(± 0.7)
83.23(±0.67)
77.66(±0.08)
67.72(±0.13)
65.34(±0.17)
1.540(±0.350)
Masking Node+ Supervised
73.38(±0.55)
84.42(±0.27)
77.85(±0.24)
67.14(±0.28)
64.06(±0.28)
1.562(±0.324)
Context Prediction + Supervised
73.81(±0.52)
84.35(±0.93)
77.11(±0.14)
67.87(±0.08)
65.19(±0.17)
1.858(±0.368)
+
+• Contrastive. We generate two views of the same graph by corrupting the input node features with Gaussian noise. We leverage the contrastive learning loss proposed in [35]: we maximize the consistency between positive pairs (from same graphs) and minimize that between negative pairs (from different graphs). In this paper, we restrict ourselves to this specific contrastive training method, however, various contrastive learning methods can be further explored.
+
+• Graph-level supervised. Finally when applicable, we use the ChEMBL dataset with graph-level labels for graph-level supervised pretraining as Hu et al. [12].
+
+The above are the design choices for pretraining objectives. Next, we consider other factors that influence graph-pretraining performance.
+
+Graph Features Each molecule is represented by a graph with atoms as nodes and bonds as edges. In this paper we mainly consider the graph representations without the 3D information. For each molecule graph, chemical properties of nodes and edges are extracted to serve as node and edge features for the graph neural networks. Depending on how rich the features are, we categorize the design choices into two categories:
+
+• Basic features. The basic set of features are the ones used in Hu et al. [12]. Specifically, the node features contain the atom type and the derived features, such as formal charge list, chirality list, etc. The edge features contain the bond types and the bond directions. These features are categorical, and thus will be encoded in a one-hot vector individually and then concatenated together to form the feature vector for node/edge representation.
+
+• Rich features. The rich feature set is a superset of the basic features. In addition to the basic ones mentioned above, it comes with the additional node features such as hydrogen acceptor match, acidic match and bond features such as ring information. This set of features are used in Rong et al. [22]. Additionally and importantly, we follow their setting to incorporate additional 2d normalized rdNormalizedDescriptors features 2, which is used in the downstream tasks only and not in pretraining.
+
+Please refer to the original papers for the full set of basic [12] and rich [22] features, respectively.
+
+GNN Backbone The GNN architecture also plays a role in graph pretraining. In Hu et al. [12], the results show that pretraining on GNN variants like GIN [33] would improve the performance on downstream tasks, while the performance with architectures like GAT [27] would actually get worse performance with pretraining. As the GNNs based on 1-Weisfeiler-Lehman (WL) test have similar representation power [33] bounded by the Weisfeiler-Lehman isomorphism check [23], we consider the two representative GNN architectures, namely the GIN [33] and GraphSage [9]. They have shown benefits with graph pretraining in Hu et al. [12].
+
+Pretraining dataset In natural language pretraining, researchers observed a significant performance boost due to self-supervised pretraining on large-scale data, that is, the larger the pretraining dataset is, the better the downstream performance it is [20]. Inspired by this success in natural language processing, we test the algorithms on two unlabeled pretraining datasets with different scales.
+
+Table 6: Self-supervised $^ +$ Basic feature $^ +$ Balanced Scaffold. No pretrain has an average AUC of $7 6 . 7 \%$ over all 5 datasets.
+
+
Methods
BBBP
BACE
TOX21
TOXCAST
SIDER
AVEGAIN
No pretrain
91.46(± 0.85)
84.29(± 3.80)
78.35(± 0.95)
68.31(± 1.61)
61.15(± 2.46)
0(±1.934)
Node Prediction
91.23(± 1.51)
84.97(± 1.55)
77.77(± 1.23)
68.98(± 1.11)
61.20(± 0.41)
0.118(±1.162)
Context Prediction
92.13(± 1.04)
84.83(± 3.19)
78.79(± 2.52)
68.29(± 1.23)
62.32(± 2.99)
0.560(±2.194)
+
+Table 7: Supervised $^ +$ Self-supervised $^ +$ Basic feature $^ +$ Balanced Scaffold. No pretrain has an average AUC of $7 6 . 7 \%$ .
+
+
Methods
BBBP
BACE
TOX21
TOXCAST
SIDER
AVE GAIN
No pretrain
91.46(± 0.85)
84.29(± 3.80)
78.35(± 0.95)
68.31(± 1.61)
61.15(± 2.46)
0(±1.934)
Supervised
90.70(± 0.74)
84.22(± 2.69)
80.45(± 1.47)
69.47(± 1.06)
63.38(± 1.44)
0.932(± 1.480)
Masking Node + Supervised
91.10(± 2.88)
85.54(± 4.57)
81.49(± 1.52)
70.77(± 1.00)
62.81(± 2.61)
1.630(± 2.516)
Context Prediction + Supervised
91.54(± 3.52)
85.71(± 2.92)
81.23(± 1.94)
71.36(± 1.05)
62.75(± 2.27)
1.806(± 2.340)
+
+• ZINC15 [25]: ZINC15 contains 2 million molecules. This dataset was preprocessed following Hu et al. [12]. • SAVI [19]: The SAVI dataset contains about 1 billion molecules, which are significantly larger than ZINC15. To the best of our knowledge, it has never been used for pretraining tasks before. This dataset contains drug-like molecules synthesized by computer simulated reactions.
+
+Additionaly, we used ChEMBL [8] as the supervised datasets. Different from the above ZINC15 and SAVI dataset which are only used for self-supervised pretraining, this dataset contains $5 0 0 \mathrm { k }$ drug-able molecules with 1,310 prediction target labels from bio-activity assays for drug discovery. Thus like in Hu et al. [12] we only leverage it for supervised pretraining.
+
+Data split on downstream tasks The downstream tasks for molecular domain we used are 5 benchmark datasets from MoleculeNet [30] (See Appendix A.5 for more details). The train/valid/test sets are split with ratio 8:1:1. For molecule domain, the random split is not the most meaningful way to assess the performance, because the real-world scenarios often require generalization ability on out-of-distribution samples. So we consider the following ways to split the data:
+
+• Scaffold Split [12, 21] This strategy first sorts the molecules according to the scaffold (e.g. molecule structure), and then partition the sorted list into train/valid/test splits consecutively. Therefore, the molecules in train and test sets are most different ones according to their molecule structure. Note this strategy would yield deterministic data splits.
+• Balanced Scaffold Split [1, 22] This strategy introduces the randomness in the sorting and splitting stages above, thus one can run on splits with different random seeds and report the average performance to lower the evaluation variance.
+
+We choose balanced scaffold as our major evaluation configuration, because it allows us to evaluate the algorithm on multiple data splits while maintaining the ability to evaluate out of distribution samples (e.g. assess generalization ability). Evaluating on one single split (such as scaffold split) can be subject to bias due to one specific split, leading to higher variance in evaluation.
+
+# 3.2 Experiment protocol
+
+As the total number of configurations for the entire pipeline can be combinatorially large which is not practical for us to exhaustively experiment with all of them, we design our protocol with a pairwise comparison principle. Specifically, we first anchor a vanilla configuration with a certain design choice of combination for each stage. To study the effect of each stage on the pretraining effectiveness, we vary the design choice one stage at a time compared to the vanilla configuration.
+
+For all these experiments, to assess the effectiveness of graph pretraining, we report the ROC-AUC on downstream tasks as well as the relative average gain over all downstream datasets with and without pretraining. For each setting we will report the mean and standard deviation (in parenthesis) over three runs with different random seeds. We tune the model on downstream tasks with the validation set, and report the evaluation metric on the test set using the model with best validation performance. For each setup, we report the average performance obtained with three random seeds. We tune the learning rate in $\{ 1 e ^ { - 4 } , \dot { 5 } e ^ { - 4 } , 1 e ^ { - 3 } , 5 \bar { e } ^ { - \dot { 3 } } , 1 e ^ { - 2 } , 5 e ^ { - 2 } , 1 e ^ { - 1 } \}$ for each setup individually and select the one with best validation performance. For GNNs we fix the hidden dimension to 300 and number of layers to 5.
+
+Table 8: Unsupervised $^ +$ Basic feature $^ +$ Scaffold. No pretrain has an average accuracy of $6 8 . 7 \%$ over all benckmark datasets.
+
+
Methods
BBBP
BACE
TOX21
TOXCAST
SIDER
AVE GAIN
No pretrain
69.62(± 1.05)
75.77(±4.29)
75.52(±0.67)
63.67(±0.32)
59.07(±1.13)
0(±1.492)
Node Prediction
68.70(±2.16)
76.95(±0.12)
75.88(±0.60)
64.11(±0.38)
61.29(±0.87)
0.656(±0.826)
Context Prediction
69.41(±1.44)
81.96(±0.72)
75.49(±0.75)
63.48(±0.31)
62.27(±0.90)
1.792(±0.824)
+
+Table 9: Supervised $^ +$ Basic feature $^ +$ Scaffold. No pretrain has an average accuracy of $6 8 . 7 \%$ over all benckmark datasets.
+
+
Methods
BBBP
BACE
TOX21
TOXCAST
SIDER
AVE GAIN
No pretrain
69.62(± 1.05)
75.77(±4.29)
75.52(±0.67)
63.67(±0.32)
59.07(±1.13)
0(±1.492)
Supervised
68.96(±0.64)
76.30(±1.30)
76.64(±0.39)
66.07(±0.22)
61.97(±0.96)
1.258(±0.702)
Masking Node + Supervised
71.41(±0.67)
84.59(±0.35)
79.13(±0.29)
65.32(±0.37)
62.12(±0.19)
3.784(±0.374)
Context Prediction+ Supervised
69.63(±0.25)
83.34(±0.67)
78.11(±0.28)
66.15(±0.48)
63.48(±0.43)
3.412(±0.422)
+
+# 4 Results
+
+In this section, we present the results and discussions for a set of experiments designed with the protocols in Section 3.2. Table 1 summarizes the experimental configurations for each following table. We will elaborate on them in the following sections. Due to space limit, we defer our investigation on different GNN architectures to appendix (Section A.1).
+
+# 4.1 Vanilla configuration
+
+We choose the vanilla configuration with the settings from existing works [12, 22]. Specifically, we use the rich feature with GIN backbone, pretrained on ZINC15 when pretraining is applied, and evaluate on the Balanced Scaffold Split for downstream tasks. One important baseline is without pretraining. For the ease of comparison, we include the results without pretraining in each table.
+
+# 4.2 Self-supervised pretraining objectives
+
+We compare the results pretrained with different self-supervised pretraining objectives. As is presented in Section 3.1, we consider four representative types of pretraining objectives. For the ease of comparing the performance, we only consider one objective at a time, instead of mixing different pretraining objectives to obtain a multi-task pretrained model. Table 2 shows the performance on downstream molecule property prediction benchmarks with models initialized from different pretraining objectives. The relative average gain compared to the one without pretraining is not statistically significant, i.e., not larger than the standard deviations of multiple runs. All the four different objectives obtain similar gains/loses regardless of very different designs. To fully understand the effect of self-supervised pretraining on molecule representation, we further investigate the performance of different pretraining objectives in combination with other factors, such as input features or data splits, as described in the following sections.
+
+# 4.3 Supervised pretraining objectives
+
+In addition to the self-supervised objectives, we study the potential benefits with supervised pretraining. Unlike the self-supervised setting where the molecule graphs themselves are used for pretraining, the supervised pretraining requires extra cost of data labeling, and thus is not scalable for large scale pretraining. In this paper, we present the results with supervised pretraining alone, as well as the joint pretraining. e.g. pretrain with self-supervised objective and followed by supervised pretraining, in Table 3. We can see with the supervised pretraining, one can improve the downstream performance, which aligns with the observation from Hu et al. [12]. Our hypothesis is that, supervised pretraining is helpful when the pretraining tasks are closely aligned with the downstream tasks. In particular, the bio-activity labels provided by ChEMBL is highly related to the drug discovery purpose and drug discovery properties are the major topics evaluated in the downstream tasks. Therefore, the positive correlation between the pretraining supervision and downstream tasks contribute the most to the performance improvement of downstream tasks.
+
+Table 10: Large scale pretraining data with balanced scaffold split. No pretraining gets an average AUC of $7 8 . 0 \%$ .
+
+
Methods
BBBP
BACE
TOX21
TOXCAST
SIDER
AVE GAIN
No pretrain
92.23(±3.07)
87.43(±1.63)
79.2(±1.99)
69.13(±0.55)
61.92(±0.89)
0(±1.626)
Node Prediction
92.33(±2.08)
87.22(±1.79)
79.12(±1.62)
69.47(±0.65)
61.24(±1.94)
-0.106(±1.616)
Context Prediction
93.32(±0.53)
87.77(±2.94)
79.18(±2.48)
70.13(±0.56)
62.24(±2.65)
0.546(±1.832)
MaskingNode+Supervised
93.23(±3.02)
86.39(±1.67)
81.89(±1.58)
71.77(±0.50)
63.73(±2.20)
1.420(±1.794)
Context Prediction + Supervised
92.55(±2.93)
87.76(±1.87)
82.19(±1.58)
72.91(±0.71)
62.44(±0.45)
1.588(±1.508)
+
+# 4.4 Data split on downstream tasks
+
+Molecular data is usually diverse and limited, so chemists are particularly interested in the generalization ability of GNNs on out of distribution data. Also due to the same reason (i.e. limited and diverse data), the variance in performance of different splits is significant, which poses challenges on robust evaluation. In vanilla configuration we use the balanced scaffold split, and here we show additional results with the scaffold split, which is a deterministic data split that makes the train/valid/test set differ from each other the most. Table 4 and Table 5 respectively present the results using scaffold split with self-supervised without and with additional supervised pretraining. Compared with Table 2 and Table 3, it is clear to see that Table 4 and Table 5 have significantly lower ROC-AUC. Specifically the AUC drops $6 . 2 \%$ on average for all benchmarks without pretraining. On the other hand, we can see if we compare Table 4 with Table 2, or Table 5 with Table 3 respectively, the gain of pretraining is more significant on the scaffold split. We speculate the reason for the improvement of scaffold split is that the initialization of neural network parameters (e.g. from pretraining) are typically critical for the out-of-distribution generalization (e.g. scaffold split). Similar observations have also been studied in the meta-learning literature [7]. Although the gain with supervised pretraining is significant in Table 5, the effect of self-supervised pretraining is mixed in Table 4. This indicates the effectiveness of self-supervised pretraining on scaffold split is not significant enough to claim “very helpful”.
+
+# 4.5 Graph features
+
+So far we have presented the results with rich features. Now we want to see how those basic features used in Hu et al. [12] affect the outcome. Table 6 and Table 7 show the test ROC-AUC $( \% )$ performance with basic features on the balanced scaffold splits using self-supervised or supervised pretraining objectives, respectively. Table 8 and Table 9 show the same results but on scaffold split.
+
+In a nutshell, without pretraining, rich features lead to an average gain of $1 . 3 \%$ and $3 . 1 \%$ over basic features using balanced scaffold split and scaffold split, respectively. Specifically, it achieves $7 6 . 7 \%$ vs $7 8 . 0 \%$ for balanced scaffold split, and $6 8 . 7 \%$ vs $\bar { 7 } 1 . 8 \%$ on scaffold split. The gain brought by the rich features are more significant than the ones with different self-supervised pretraining objectives. Table 6 to Table 9 show that pretraining has more positive impact when basic features are used. In particular, the self-pretraining with context prediction shows significant gains especially in the scaffold split setting. However, the gain diminishes when careful feature engineering are applied to the downstream tasks (use rich feature in vanilla configuration). The supervised pretraining continues the significant gain under these settings, which shows the consistency and reliability of the situation with the labeled and downstream-task-aligned supervisions.
+
+# 4.6 Pretraining datasets
+
+As observed in natural language processing domain, more text pretraining data lead to better downstream performance. Intuitively this can be true for molecule representation domain as well, so we run a new set of experiments with the model pretrained on SAVI dataset, which is about 500 times larger than the ZINC15 dataset we used in the above result sections. We present the results pretrained on SAVI dataset using balanced scaffold split or scaffold split in Table 10 and Table 11, respectively. Other configurations are the same as the vanilla configuration.
+
+Table 11: Large scale pretraining data with scaffold split. No pretraining gets an average AUC of $7 1 . 8 \%$ .
+
+
Methods
BBBP
BACE
TOX21
TOXCAST
SIDER
AVE GAIN
No pretrain
74.83(±0.73)
80.10(±0.42)
75.86(±0.58)
65.95(±0.15)
62.30(±1.14)
0(±0.604)
Node Prediction
73.81(±1.82)
81.90(±1.59)
74.94(±0.05)
66.95(±0.12)
62.93(±0.34)
0.298(±0.784)
Context Prediction
74.32(±0.85)
83.93(±0.24)
74.42(±0.19)
67.01(±0.29)
64.83(±0.45)
1.094(±0.404)
MaskingNode+Supervised
73.32(±0.60)
83.38(±1.05)
78.59(±0.09)
67.01(±0.18)
65.40(±0.12)
1.732(±0.408)
Context Prediction + Supervised
74.38(±0.93)
86.33(±0.16)
78.16(±0.25)
68.71(±0.07)
62.22(±0.48)
2.152(±0.378)
+
+Compared with the performance on ZINC15, the SAVI pretraining data does not lead to a significant improvement either on balanced scaffold split (Table 2 vs Table 10) or scaffold split (Table 4 or Table 11). Similarly, the self-supervised pretraining objectives lead to negligible gain on downstream task performance, while the supervised one still achieves a clear gain.
+
+As the result is counterintuitive, we further investigate the reason behind it by inspecting the pretraining performances with different training objectives on both ZINC15 and SAVI datasets. We plot the curve of accuracy growth with the number of training steps iterated. We can see from Figure 2 that in all settings the pretraining accuracy grows above $90 \%$ quickly after only 0.1 to $\phantom { - } 0 . 2 \mathbf { M }$ steps and also converges quickly. Given that the model gets very high accuracy without even going through 1 epoch of the SAVI dataset, it is expected that the larger training data like SAVI may not provide more learning signals for the model, and partially explains why more molecules wouldn’t help significantly in this case. Furthermore, these figures might suggest several reasons of why the self-supervised pretraining may not be very effective in some situations:
+
+• Tasks are easy. Some of the self-pretraining tasks for molecules might be easy, so that model learns less useful information from pretraining. For example in the masked node prediction case, the model is expected to predict the atomic number from a vocabulary with less than 100 candidate atoms. Furthermore, due to the valence constraints, the graph topology may already exclude most of the wrong atoms. As a comparison, the vocabulary size for text pretraining may be $1 0 0 \mathrm { k }$ or even higher. Some structured prediction tasks like context prediction might be hard, but due to the difficulty of structured prediction itself and the proposal for high quality negative examples for contrastive learning, it can still be challenging for downstream task improvements. Other strategies like motif prediction can be achieved by subgraph matching, which can be easy for GNN that intrinsically does the graph isomorphism test.
+
+• Data lacks diversity. Due to biophysical and functional requirements, molecules share many common sub-structures, e.g., functional motifs. Hence, molecules may not be as diversified as text data. This is why the model learns to generalize quickly within the training distribution.
+
+• 2D Structure is not enough to infer functionality. Some important biophysical properties (such as 3D structure, chirality) are barely reflected in the 2D-feature-based pretraining (e.g., using smiles or 2D graph features). For example, the molecules with the same chemical formula and 2D feature, can have very different chirality, which leads to quite different toxicity [24] (e.g. flipped toxicity labels). This is not captured in the current GNN pretraining frameworks that we considered.
+
+# 4.7 Hyper-parameters for downstream tasks
+
+We also find that hyper-parameters for downstream tasks are critical for the their performance that their choices may change the conclusion of the effectiveness of pretraining in some settings. We can take the learning rate as an example. As the models initialized from scratch and pretraining may have different scales, the most suitable learning rate required for downstream tasks may also be different. Without tuning learning rate extensively, we may reach a misleading conclusion. In particular,
+
+
+Figure 2: Pretraining accuracy on ZINC15 or SAVI datasets with node prediction or context prediction objectives.
+
+when we adopt the default learning rate for reproducing the existing success of pretraining in Table 17 of Appendix A.4, we indeed observe the advantage of pretraining. However, if we follow our procedures (e.g. extensive search learning rate and averaging over three splits), the resulting Table 2 and Table 3 indicate no performance gain by pretraining. So we suggest that the evaluation of pretraining should consider the hyper-parameter tuning and averaging over different splits.
+
+# 5 Summary and takeaways
+
+Based on our experiments in Section 4, we present our takeaways by empirically summarizing our conjectures on when the pretraining would/would not help the molecular representation learning.
+
+When pretraining might help We find it typically helps 1) if we can have the supervised pretraining with target labels that are aligned with the downstream tasks. However, getting large amount of high-quality and relevant supervision is not always feasible; 2) if the high quality hand-crafted features are absent. However, it seems that the gain obtained by self-supervised pretraining is not as significant as these high quality hand-crafted features based on our current studies; 3) if the downstream train, valid and test dataset distributions are substantially different.
+
+When the gain diminishes? In some situations the gain of pretraining might diminish 1) if we already have the high quality hand-crafted features (e.g. rich features described in Section 3.1); 2) if we don’t have the highly relevant supervisions. As shown in Section 4.6, many self-supervised pretraining tasks might be too easy for the model to learn meaningful embedding; 3) if the downstream data splits are balanced; 4) if the self-supervised learning dataset lacks diversity, despite its scale.
+
+Why pretraining may not help in some cases? In our paper we pretrained a GNN on a much larger dataset (SAVI) than before, hoping to replicate gain of pretraining like in NLP domain. However, we do not obtain the expected gain. The pretraining accuracy curve (Figure 2) provides some potential explanations of why pretraining may not work: some of the pretraining accuracy curve grows above $9 5 \% +$ quickly and converges fast, unlike pretraining in NLP which keeps growing to $\bar { 7 } 0 \%$ and hardly plateaus. This suggests that some of the pretraining methods like masked node label prediction might be easy (as the vocabulary size is much smaller compared to NLP) and therefore transfer less knowledge for downstream tasks.
+
+# 6 Limitations of current study
+
+Although we have tried our best to design a comprehensive study on the effectiveness of graph pretraining for molecular representation, there are still limitations we want to point out. Due to the limited time and resources we have, we are not able to fully cover the whole picture of the current pretraining paradigm in graph neural networks. Nevertheless, we list them here in hope of preventing the over-generalization of our conclusion.
+
+• Distribution of graphs. Our study focuses on pretraining for small molecule graph inductive representation learning. Recently there are works on pretraining transductive representation learning [36] on large graphs [13], where our conclusion may not be directly extended to these cases. Graph architectures. GNN is a popular research field where many new architectures with probable expressiveness are/will be proposed. The results we have shown are on two representative 1-WL GNNs. It can be possible that the latest advances of deep GNN [17] and Transformer-based GNN [34, 3, 14] might yield different results. Learning objectives. Although we have presented results with different types of self-supervised losses, there are still many variants of each type that we did not explore, like different variants [26, 31] of contrastive learning. Also, multi-task learning of different self-supervised objectives might be another direction for further exploration. Downstream datasets. We obtained our conclusion mainly on the datasets from MoleculeNet [30]. Datasets like Alchemy [4] and drug-target Interaction [18] may show different results.
+
+References
+[1] Guy W Bemis and Mark A Murcko. The properties of known drugs. 1. molecular frameworks. Journal of medicinal chemistry, 39(15):2887–2893, 1996.
+[2] Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
+[3] Dexiong Chen, Leslie O’Bray, and Karsten Borgwardt. Structure-aware transformer for graph representation learning. In International Conference on Machine Learning, pages 3469–3489. PMLR, 2022.
+[4] Guangyong Chen, Pengfei Chen, Chang-Yu Hsieh, Chee-Kong Lee, Benben Liao, Renjie Liao, Weiwen Liu, Jiezhong Qiu, Qiming Sun, Jie Tang, et al. Alchemy: A quantum chemistry dataset for benchmarking ai models. arXiv preprint arXiv:1906.09427, 2019.
+[5] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pages 1597–1607. PMLR, 2020.
+[6] 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.
+[7] Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning, pages 1126–1135. PMLR, 2017.
+[8] Anna Gaulton, Louisa J Bellis, A Patricia Bento, Jon Chambers, Mark Davies, Anne Hersey, Yvonne Light, Shaun McGlinchey, David Michalovich, Bissan Al-Lazikani, et al. Chembl: a large-scale bioactivity database for drug discovery. Nucleic acids research, 40(D1):D1100– D1107, 2012.
+[9] William L Hamilton, Rex Ying, and Jure Leskovec. Representation learning on graphs: Methods and applications. arXiv preprint arXiv:1709.05584, 2017.
+[10] Kaveh Hassani and Amir Hosein Khasahmadi. Contrastive multi-view representation learning on graphs. In International Conference on Machine Learning, pages 4116–4126. PMLR, 2020.
+[11] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross B. Girshick. Momentum contrast for unsupervised visual representation learning. In CVPR, pages 9726–9735, 2020.
+[12] Weihua Hu, Bowen Liu, Joseph Gomes, Marinka Zitnik, Percy Liang, Vijay Pande, and Jure Leskovec. Strategies for pre-training graph neural networks. arXiv preprint arXiv:1905.12265, 2019.
+[13] Ziniu Hu, Yuxiao Dong, Kuansan Wang, Kai-Wei Chang, and Yizhou Sun. Gpt-gnn: Generative pre-training of graph neural networks. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 1857–1867, 2020.
+[14] Jinwoo Kim, Tien Dat Nguyen, Seonwoo Min, Sungjun Cho, Moontae Lee, Honglak Lee, and Seunghoon Hong. Pure transformers are powerful graph learners. arXiv preprint arXiv:2207.02505, 2022.
+[15] G Landrum. Rdkit: Open-source cheminformatics software, 2016.
+[16] P. Langley. Crafting papers on machine learning. In Pat Langley, editor, Proceedings of the 17th International Conference on Machine Learning (ICML 2000), pages 1207–1216, Stanford, CA, 2000. Morgan Kaufmann.
+[17] Meng Liu, Hongyang Gao, and Shuiwang Ji. Towards deeper graph neural networks. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 338–348, 2020.
+[18] Shengchao Liu, Hanchen Wang, Weiyang Liu, Joan Lasenby, Hongyu Guo, and Jian Tang. Pre-training molecular graph representation with 3d geometry. arXiv preprint arXiv:2110.07728, 2021.
+[19] Hitesh Patel, Wolf Ihlenfeldt, Philip Judson, Yurii S Moroz, Yuri Pevzner, Megan Peach, Nadya Tarasova, and Marc Nicklaus. Synthetically accessible virtual inventory (savi). 2020.
+[20] 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. arXiv preprint arXiv:1910.10683, 2019.
+[21] Bharath Ramsundar, Peter Eastman, Patrick Walters, and Vijay Pande. Deep learning for the life sciences: applying deep learning to genomics, microscopy, drug discovery, and more. " O’Reilly Media, Inc.", 2019.
+[22] Yu Rong, Yatao Bian, Tingyang Xu, Weiyang Xie, Ying Wei, Wenbing Huang, and Junzhou Huang. Self-supervised graph transformer on large-scale molecular data. arXiv preprint arXiv:2007.02835, 2020.
+[23] Nino Shervashidze, Pascal Schweitzer, Erik Jan Van Leeuwen, Kurt Mehlhorn, and Karsten M Borgwardt. Weisfeiler-lehman graph kernels. Journal of Machine Learning Research, 12(9), 2011.
+[24] Silas W Smith. Chiral toxicology: it’s the same thing. . . only different. Toxicological sciences, 110(1):4–30, 2009.
+[25] Teague Sterling and John J Irwin. Zinc 15–ligand discovery for everyone. Journal of chemical information and modeling, 55(11):2324–2337, 2015.
+[26] Mengying Sun, Jing Xing, Huijun Wang, Bin Chen, and Jiayu Zhou. Mocl: data-driven molecular fingerprint via knowledge-aware contrastive learning from molecular graph. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, pages 3585–3594, 2021.
+[27] Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017.
+[28] Jason Wei, Maarten Bosma, Vincent Y Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M Dai, and Quoc V Le. Finetuned language models are zero-shot learners. arXiv preprint arXiv:2109.01652, 2021.
+[29] Lirong Wu, Haitao Lin, Zhangyang Gao, Cheng Tan, Stan Li, et al. Self-supervised on graphs: Contrastive, generative, or predictive. arXiv preprint arXiv:2105.07342, 2021.
+[30] Zhenqin Wu, Bharath Ramsundar, Evan N Feinberg, Joseph Gomes, Caleb Geniesse, Aneesh S Pappu, Karl Leswing, and Vijay Pande. Moleculenet: a benchmark for molecular machine learning. Chemical science, 9(2):513–530, 2018.
+[31] Jun Xia, Lirong Wu, Jintao Chen, Bozhen Hu, and Stan Z Li. Simgrace: A simple framework for graph contrastive learning without data augmentation. In Proceedings of the ACM Web Conference 2022, pages 1070–1079, 2022.
+[32] Yaochen Xie, Zhao Xu, Jingtun Zhang, Zhengyang Wang, and Shuiwang Ji. Self-supervised learning of graph neural networks: A unified review. arXiv preprint arXiv:2102.10757, 2021.
+[33] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018.
+[34] Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng, Guolin Ke, Di He, Yanming Shen, and Tie-Yan Liu. Do transformers really perform bad for graph representation? arXiv preprint arXiv:2106.05234, 2021.
+[35] Yuning You, Tianlong Chen, Yongduo Sui, Ting Chen, Zhangyang Wang, and Yang Shen. Graph contrastive learning with augmentations. Advances in Neural Information Processing Systems, 33:5812–5823, 2020.
+
+[36] Yuning You, Tianlong Chen, Zhangyang Wang, and Yang Shen. When does self-supervision help graph convolutional networks? In International Conference on Machine Learning, pages 10871–10880. PMLR, 2020.
+
+[37] Yanqiao Zhu, Yichen Xu, Feng Yu, Qiang Liu, Shu Wu, and Liang Wang. Graph contrastive learning with adaptive augmentation. In Proceedings of the Web Conference 2021, pages 2069–2080, 2021.
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes]
+(c) Did you discuss any potential negative societal impacts of your work? [Yes] . Though not really apply.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No] . We will prepare code soon.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes]
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [N/A]
+(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/v54eUIayFh/v54eUIayFh.md b/md/dev/v54eUIayFh/v54eUIayFh.md
new file mode 100644
index 0000000000000000000000000000000000000000..fc1d70370f077fd63cc6f57d36665dd7ada51969
--- /dev/null
+++ b/md/dev/v54eUIayFh/v54eUIayFh.md
@@ -0,0 +1,520 @@
+# UniControl: A Unified Diffusion Model for Controllable Visual Generation In the Wild
+
+Can $\mathrm { Q i n } ^ { \dag \star }$ , Shu Zhang†, Ning $\mathrm { Y u ^ { \dag } }$ , Yihao Feng†, Xinyi Yang†, Yingbo Zhou†, Huan Wang†, Juan Carlos Niebles†, Caiming Xiong†, Silvio Savarese†, Stefano Ermon‡, Yun $\operatorname { F u } ^ { \star }$ , and Ran $\mathrm { { X u ^ { \dag } } }$
+
+†Salesforce AI Research, ⋆Northeastern University, ‡Stanford Univeristy, qin.ca@northeastern.edu, ermon@cs.stanford.edu, yunfu@ece.neu.edu, {shu.zhang, ning.yu, yihaof, x.yang, yingbo.zhou, huan.wang, jniebles, cxiong, ssavarese, ran.xu}@salesforce.com
+
+# Abstract
+
+Achieving machine autonomy and human control often represent divergent objectives in the design of interactive AI systems. Visual generative foundation models such as Stable Diffusion show promise in navigating these goals, especially when prompted with arbitrary languages. However, they often fall short in generating images with spatial, structural, or geometric controls. The integration of such controls, which can accommodate various visual conditions in a single unified model, remains an unaddressed challenge. In response, we introduce UniControl , a new generative foundation model that consolidates a wide array of controllable condition-to-image (C2I) tasks within a singular framework, while still allowing for arbitrary language prompts. UniControl enables pixel-level-precise image generation, where visual conditions primarily influence the generated structures and language prompts guide the style and context. To equip UniControl with the capacity to handle diverse visual conditions, we augment pretrained text-to-image diffusion models and introduce a task-aware HyperNet to modulate the diffusion models, enabling the adaptation to different C2I tasks simultaneously. Trained on nine unique C2I tasks, UniControl demonstrates impressive zero-shot generation abilities with unseen visual conditions. Experimental results show that UniControl often surpasses the performance of single-task-controlled methods of comparable model sizes. This control versatility positions UniControl as a significant advancement in the realm of controllable visual generation. 1
+
+# 1 Introduction
+
+Generative foundation models are revolutionizing the ways that humans and AI interact in natural language processing (NLP) [1–6], computer vision (CV) [7–10], audio processing (AP) [11, 12], and robotic controls [13–15], to name a few. In NLP, generative foundation models such as InstructGPT or GPT-4, achieve excellent performance on a wide range of tasks, e.g., question answering, summarization, text generation, or machine translation within a single-unified model. Such multi-tasking ability is one of the most appealing characteristics of generative foundation models. Furthermore, generative foundation models can also perform zero-shot or few-shot learning on unseen tasks [3, 16, 17].
+
+For generative models in vision domains [9, 18–20], such multi-tasking ability is less clear. Stable Diffusion Model (SDM) [9] has established itself as the major cornerstone for text-conditioned image generation. However, while text descriptions provide a very flexible way to control the generated images, their ability to provide pixel-level precision for spatial, structural, or geometric controls is often inadequate. A recent work, ControlNet [21], was proposed to augment SDM to enable visual conditions (e.g., edge maps, depth maps). With the additional visual conditions, ControlNet can achieve explicit spatial, structural, or geometric control over generated structures, without losing the semantic control from textual captions. Unfortunately, unlike language prompts that a unified module such as CLIP [22] can handle, each ControlNet model can only handle a specific control modality that it was trained on (e.g., edge map). Retraining a separate model is necessary to handle a different modality of visual conditions, incurring non-trivial time and spatial complexity costs.
+
+
+Figure 1: UniControl is trained with multiple tasks with a unified model, and it further demonstrates promising capability in zero-shot tasks generalization with visual example results shown above.
+
+To overcome the limitation of previous works, we present UniControl, a unified diffusion model for controllable visual generation in the wild, which is capable of simultaneously handling both language and various visual conditions. Naturally, UniControl can perform multi-tasking and can encode visual conditions from different tasks into a universal representation space, seeking a common representation structure among tasks. The unified design of UniControl allows us to enjoy the advantages of improved training and inference efficiency, as well as enhanced controllable generation. On the one hand, the model size of UniControl does not significantly increase as the number of tasks scales up. On the other hand, UniControl derives advantages from the inherent connections between different visual conditions [e.g., 23–25]. These relationships, such as depth and segmentation mapping, leverage shared geometric information to enhance the controllable generation quality.
+
+The unified controllable generation ability of UniControl relies on two novel designed modules, a mixture of expert (MOE)-style adapter and a task-aware HyperNet [26, 27]. The MOE-style adapter can learn necessary low-level feature maps from various visual conditions, allowing UniControl to capture unique information from different visual conditions. The task-aware HyperNet, which takes the task instruction as natural language prompt inputs, and outputs a task-aware embedding. The output embeddings can be incorporated to modulate ControlNet [21] for task-aware visual condition controls, where each task corresponds to a particular format of visual condition. As a result, the task-aware HyperNet allows UniControl to learn meta-knowledge across various tasks, and obtain abilities to generalize to unseen tasks. As Tab. 1, UniControl has significantly compressed the model size compared with its direct baseline, i.e., Multi-ControlNet, by unifying nine tasks into ONE model.
+
+Table 1: Architecture and Model Size (#Params): UniControl vs. Multi-ControlNet
+
+
Stable Diffusion
ControlNet
MoE-Adapter
TaskHyperNet
Total
UniControl
1065.7M
361M
0.06M
12.7M
1.44B
Multi-ControlNet
1065.7M
361M×9
-
-
4.32B
+
+To obtain multi-tasking and zero-shot learning abilities, we pre-train UniControl on nine distinct tasks across five categories: 1) edges (Canny, HED, User Sketch); 2) region-wise maps (Segmentation Maps, Bounding Boxes); 3) skeletons (Human Pose Skeletons); 4) geometric maps Depth, Surface Normal); 5) editing (Image Outpainting). We build MultiGen-20M dataset, comprising over 20 million high-quality triplets of original images, language prompts, and visual conditions for all the tasks. Then UniControl is trained for over 5,000 GPU hours on NVIDIA A100-40G hardware that is comparable with the overall training cost of different ControlNets. Moreover, UniControl exhibits a remarkable capacity for zero-shot adaptation to new tasks, highlighting its potential for deployment in real-world applications. Our contributions are summarized below:
+
+• We present UniControl, a unified model capable of handling various visual conditions for the controllable visual generation.
+
+• We collect a new dataset for multi-condition visual generation with more than 20 million imagetext-condition triplets over nine distinct tasks across five categories.
+
+• We conduct extensive experiments to demonstrate that the unified model UniControl outperforms each single-task controlled image generation, thanks to learning the intrinsic relationships between different visual conditions.
+
+• UniControl shows the ability to adapt to unseen tasks in a zero-shot manner, highlighting its versatility and potential for widespread adoption in the wild.
+
+# 2 Related Works
+
+Diffusion-based Generative Models. Diffusion models were initially introduced in [28] that yield favorable outcomes for generating images [18, 21]. Improvements have been made through various training and sampling techniques such as score-based diffusion [29, 30], Denoising Diffusion Probabilistic Model (DDPM) [31], and Denoising Diffusion Implicit Model (DDIM) [32], When training U-Net denoisers [33] with high-resolution images, researchers involve speed-up techniques including pyramids [34], multiple stages [20], or latent representations [9]. In particular, UniControl leverages Stable Diffusion Models (SDM) [9] as the base model to perform multi-tasking.
+
+Text-to-Image Diffusion. Diffusion models emerge to set up a cutting-edge performance in text-to-image generation tasks [20, 19], by cross-attending U-Net denoiser in diffusion generators with CLIP [22] or T5-pretrained [2] text embeddings. GLIDE [35] is another example of a textguided diffusion model that supports image generation and editing. UniControl and closely related
+
+ControlNet [21] are both built upon previous works on diffusion-based text-to-image generation [9].
+[36] introduces the compositional conditions to guide visual generation.
+
+Image-to-Image Translation. Image-to-image (I2I) translation task was initially proposed in Pix2Pix [37], focusing on learning a mapping between images in different domains. Recently, diffusion-based approaches [38, 39, 21] set up the new state of the art results. Recent diffusionbased image editing methods show outstanding performances without requiring paired data, e.g., SDEdit [40], prompt-to-prompt [41], Edict [42]. Other image editing examples include various diffusion bridges and flows [43–47], classifier guidance [30] based methods for colorization, superresolution [34], inpainting [48], and etc. ControlNet [21] takes both visual and text conditions and achieves new state-of-the-art controllable image generation. Our proposed UniControl unifies various visual conditions of ControlNet, and is capable of performing zero-shot learning on newly unseen tasks. Concurrently, Prompt Diffusion [49] introduces visual prompt [50] from image inpainting to controllable diffusion models, which requires two additional image pairs as the in-context example for both training and inference. By contrast, UniControl takes only a single visual condition while still capable of both multi-tasking and zero-shot learning.
+
+# 3 UniControl
+
+In this section, we describe the training and the model design of our unified controllable diffusion model UniControl. Specifically, we first provide the problem setup and training objectives in Sec. 3.1, and then show the novel network design of UniControl in Sec. 3.2. Finally, we explain how to perform zero-shot image generation with the trained UniControl in Sec. 3.3.
+
+# 3.1 Training Setup
+
+Different from the previous generative models such as Stable Diffusion Models (SDM) [9] or ControlNet [21], where the image generation conditions are single language prompt, or single type of visual condition such as canny, UniControl is required to take a wide range of visual conditions from different tasks, as well as the language prompt.
+
+To achieve this, we reformulate the training conditions and target pairs for UniControl. Specifically, suppose we have a dataset consisting of $K$ tasks : $\mathcal { D } : = \{ { \mathcal { D } } _ { 1 } \cup \cdot \cdot \cdot \cup { \mathcal { D } } _ { K } \}$ , and for each task training set $\mathcal { D } _ { k }$ , denote the training pairs by $( [ c _ { \mathrm { t e x t } } , c _ { \mathrm { t a s k } } ] , { \mathcal { T } } _ { c } , \pmb { x } )$ , with $c _ { \mathrm { t a s k } }$ being the task instruction that indicates the task type, $c _ { \mathrm { t e x t } }$ being the language prompt describing the target image, $\mathcal { T } _ { c }$ being the visual conditions, and $_ { \pmb { x } }$ being the target image. With the additional task instruction, UniControl can differentiate visual conditions from different tasks. A concrete training example pair is the following:
+
+# Task-Aware Vision-Language Condition
+
+
+Visual Condition $\mathcal { T } _ { c }$
+
+Language Prompt :
+“Camp on a mountain top: Birthday Presents,
+Adventure, Outdoor, Mountain Camps, Great
+View, Places, Hiking, Mornings Lights,
+Himalayan Sunri”
+
+
+Target output
+
+Task Instruction $c _ { \mathrm { t a s k } }$ : “Canny Edge to Image”
+
+where the task is to translate the canny edge to real images following language prompt. With the induced training pairs $( \pmb { x } , [ c _ { \mathrm { t a s k } } , c _ { \mathrm { t e x t } } ] , \pmb { \mathcal { T } } _ { c } )$ , we define the training loss for task $k$ following LDM [9]:
+
+$\ell ^ { k } ( \theta ) : = \mathbb { E } _ { z , \varepsilon , t , c _ { \mathrm { t a s k } } , c _ { \mathrm { t e x t } } , { T _ { c } } } \left[ \lVert \varepsilon - \varepsilon _ { \theta } ( z _ { t } , t , c _ { \mathrm { t a s k } } , c _ { \mathrm { t e x t } } , \mathcal { T } _ { c } ) \rVert _ { 2 } ^ { 2 } \right]$ , with $( [ c _ { \mathrm { t a s k } } , c _ { \mathrm { t e x t } } ] , \mathcal { T } _ { c } , \pmb { x } ) \sim \mathcal { D } _ { k } .$ , where $t$ represents the time step, $z _ { t }$ is the noise-corrupted latent tensor at time step $t$ , $z _ { 0 } = E ( \pmb { x } )$ , and $\theta$ is the trainable parameters of UniControl . We also apply classifier-free guidance [51] to randomly drop $30 \%$ text prompts to enhance the controllability of input visual conditions. We train UniControl uniformly on the $K$ tasks. To be more specific, we first randomly select a task $k$ and sample a mini-match from $\mathcal { D } _ { k }$ , and optimize $\theta$ with the calculated loss $\ell ^ { k } ( \theta )$ .
+
+# 3.2 Model Design
+
+Since our unified model UniControl needs to achieve superior performance on a set of diverse tasks, it is necessary to ensure the network design enjoys the following properties: 1) The model can overcome the misalignment of low-level features from different tasks; 2) The model can learn meta-knowledge across tasks, and adapt to each task effectively.
+
+
+Figure 2: This figure shows our proposed UniControl method. To accommodate diverse tasks, we’ve designed a Mixture of Experts (MOE) Adapter, containing roughly $\mathord { \sim } 7 0 \mathrm { K }$ $\#$ params for each task, and a Task-aware HyperNet $\mathrm { \sim } 1 2 \mathrm { M }$ #params) to modulate $N$ (i.e., 7) zero-conv layers. This structure allows for multi-task functionality within a singular model, significantly reducing the model size compared to an equivalent stack of single-task models, each with around 1.4B #params.
+
+The first property can ensure that UniControl can learn necessary and unique information from all tasks. For instance, if UniControl takes the segmentation map as the visual condition, the model might ignore the 3D information. As a result, the feature map learned may not be suitable for the task that takes the depth map images as visual condition. The second property would allow the model to learn the shared knowledge across tasks, as well as the differences among them.
+
+We introduce two novel designed modules, MOE-style adapter and task-aware HyperNet, that allows UniControl enjoys the above two properties. An overview of the model design for UniControl is in Fig. 2. We describe the detailed designs of these modules below.
+
+MOE-Style Adapter. Inspired by the design of Mixture-of-Experts (MOEs) [52], we devise a group of convolution modules to serve as the adapter for UniControl to capture features of various low-level visual conditions. Precisely, the designed adapter module can be expressed as
+
+$$
+\mathcal { F } _ { \mathrm { A d a p t e r } } ( \mathcal { Z } _ { c } ^ { k } ) : = \sum _ { i = 1 } ^ { K } \mathbb { 1 } ( i = = k ) \cdot \mathcal { F } _ { \mathrm { C o v 1 } } ^ { ( i ) } \circ \mathcal { F } _ { \mathrm { C o v 2 } } ^ { ( i ) } ( \mathcal { Z } _ { c } ^ { k } ) ,
+$$
+
+where $\mathbb { 1 } ( \cdot )$ is the indicator func on, $\mathcal { T } _ { c } ^ { k }$ is the conditioned image from task $k$ , and $\mathcal { F } _ { \mathrm { { C o v 1 } } } ^ { ( i ) } , \mathcal { F } _ { \mathrm { { C o v 2 } } } ^ { ( i ) }$ are the convolution layers of the $i$ -th module of the adapter. We remove the weights of the original MOEs since our designed adapter is required to differentiate various visual conditions. Meanwhile, naive MOE modules can not explicitly distinguish different visual conditions when the weights are learnable. Moreover, such task-specific MOE adapters facilitate the zero-shot tasks with explicit retrieval of the adapters of highly related pre-training tasks. Besides, the number of parameters for each convolution module is approximately 70K, which is computationally efficient.
+
+
+Figure 3: Illustration of MOE’s behaviors under zero-shot scenarios. The left part shows the capacity of the MOE to generalize to hybrid task conditions, achieved through the integration of outputs from two pertinent convolution layers. The right part illustrates the ability of the MOE-style adapter to generalize to unseen tasks, facilitated by the aggregation of pre-trained tasks using estimated weights.
+
+Task-Aware HyperNet. The task-aware HyperNet modulates the zero-convolution modules of ControlNet [21] with the task instruction condition $c _ { \mathrm { t a s k } }$ . As shown in Figure 2, our hyperNet first projects the task instruction $c _ { \mathrm { t a s k } }$ into task embedding with the help of CLIPText encoder. Then similar in spirit of style modulation in StyleGAN2 [53], we inject the task embedding into the trainable copy of ControlNet, by multiplying the task embedding to each zero-conv layer. In specific, the length of the embedding is the same as the number of input channels of the zero-conv layer, and each element scalar in the embedding is multiplied to the convolution kernel per input channel. We also show that our newly designed task-aware HyperNet can also efficiently learn from training instances and task supervision following a similar analysis as in ControlNet [21].
+
+# 3.3 Task Generalization Ability
+
+With the comprehensive pretraining on the MultiGen-20M dataset, UniControl exhibits zero-shot capabilities on tasks that were not encountered during its training, suggesting that Unicontrol possesses the ability to transcend in-domain distributions for broader generalization. We demonstrate the zeroshot ability of UniControl in the following two scenarios:
+
+Hybrid Tasks Generalization. As shown in the left side of Fig. 3, We consider two different visual conditions as the input of UniControl, a hybrid combination of segmentation maps and human skeletons, and augment specific keywords "background" and "foreground" into the text prompts. Besides, we rewrite the hybrid task instruction as a blend of instructions of the combined two tasks such as "segmentation map and human skeleton to image".
+
+Zero-Shot New Tasks Generalization. As shown in the right side of Fig. 3, UniControl needs to generate controllable images on a newly unseen visual condition. To achieve this, estimating the task weights based on the relationship between unseen and seen pre-trained tasks is essential. The task weights can be estimated by either manual assignment or calculating the similarity score of task instructions in the embedding space. The example result in Fig. 5 (d) is generated by our manually assigned MOE weights as “depth: 0.6, seg: 0.3, canny: 0.1” for colorization. The MOE-style adapter can be linearly assembled with the estimated task weights to extract shallow features from the newly unseen visual condition.
+
+# 4 Experiments
+
+We empirically evaluate the effectiveness and robustness of UniControl. We conduct a series of comprehensive experiments across various conditions and tasks, utilizing diverse datasets to challenge the model’s adaptability and versatility. Experimental setup, methodologies, and results analysis are provided in the subsequent sections.
+
+# 4.1 Experiment Setup
+
+Implementation. The UniControl is illustrated as Fig. 2 with Stable Diffusion, ControlNet, MOE Adapter, and Task-aware HyperNet consisting ${ \sim } 1 . 5 \mathrm { B }$ parameters. MOE Adapter consists of parallel convolutional modules, each of which corresponds to one task. The task-aware HyperNet inputs the CLIP text embedding [22] of task instructions and outputs the task embeddings to modulate the weights of zero-conv kernels. We implement our model upon the ControlNet . We take the AdamW [54] as the optimizer based on PyTorch Lightning [55]. The learning rate is assigned as $1 \times 1 0 ^ { - 5 }$ . Our full-version UniControl model is trained on 16 Nvidia-A100 GPUs with the batch size of 4, requiring $\sim 5$ , 000 GPU hours. We have also applied Safety-Checker as safeguards of results.
+
+
+Figure 4: Visual comparison between official or re-implemented task-specific ControlNet and our proposed model. The example data is collected from our testing set sampled from COCO and Laion.
+
+Data Collection. Since the training set of ControlNet is currently unavailable, we initiate our own data collection process from scratch and name it as MultiGen-20M. We use a subset of LaionAesthetics-V2 [56] with aesthetics ratings over six, excluding low-resolution images smaller than 512. This yields approximately 2.8 million image-text pairs. Subsequently, we process this dataset for nine distinct tasks across five categories (edges, regions, skeletons, geometric maps, real images):
+
+• Canny (2.8M): Utilize the Canny edge detector [57] with randomized thresholds.
+
+• HED (2.8M): Deploy the Holistically-nested edge detection [58] for robust boundary determination.
+
+• Depth (2.8M): Employ the Midas [59] for monocular depth estimation.
+
+• Normal (2.8M): Use the depth estimation results from the depth task to estimate scene or object surface normals.
+
+• Segmentation (2.8M): Implement the Uniformer [60] model, pre-trained on the ADE20K [61] dataset, to generate segmentation maps across 150 classes.
+
+• Object Bounding Box (874K): Utilize YOLO V4 [62] pre-trained on the COCO [63] dataset for bounding box labelling across 80 object classes.
+
+• Human Skeleton (1.3M): Employ the pre-trained Openpose [64] model to generate human skeleton labels from source images.
+
+• Image Outpainting (2.8M): Create boundary masks for source images with random masking percentages from $20 \%$ to $80 \%$ .
+
+Further processings are carried out on HED maps using Gaussian filtering and binary thresholding to simulate user sketching. Overall, we amass over 20 million image-prompt-condition triplets. Task instructions were naturally derived from the respective conditions, with each task corresponding to a specific instruction, such as "canny edge to image" for the canny task. We maintain a one-toone correspondence between tasks and instructions without introducing variance to ensure stability during training. We have additionally collected a testing dataset for evaluation with 100-300 imagecondition-prompt triplets for each task. The source data is collected from Laion and COCO. We will open-source our training and testing data to contribute to the community.
+
+Benchmark Models. The most straightforward comparison for UniControl comes from task-specific ControlNet models. Six tasks overlap with those presented in ControlNet, so their official models are chosen as baselines for these tasks. For fair comparison, we re-implement the ControlNet model (single task) using our collected data. Our unified multi-task UniControl is compared against these task-aware models for each task. We apply default sampler as DDIM [32] with guidance weight 9 and steps 50. All single-task models used for comparison are trained by 100K iterations and our multi-task model is trained around 900K with similar iterations for each task to ensure fairness. The efficiency and compact design of our proposed model are evident in its construction. The total size of UniControl is around 1.5B #params and a single task ControlNet $^ +$ SDM takes 1.4B. In order to achieve the same nine-task functionality, a single-task strategy would require the ensemble of a SDM with nine task-specific ControlNet models, amounting to approximately 4.3B #params in total.
+
+
+Figure 5: (a)-(b): Example results of UniControl over hybrid (unseen combination) conditions with key words "background" and "foreground" attached in prompts. (c)-(e): Example results of UniControl on three unseen tasks (deblurring, colorization, inpainting).
+
+
+Figure 6: User study between our method and official ControlNet checkpoints on six tasks. Our method outperforms ControlNet on all tasks.
+
+# 4.2 Visual Comparison
+
+We visually compare different tasks (Canny, HED, Depth, Normal, Segmentation, Openpose, Bounding Box, and Outpainting) in Fig. 4. Our method consistently outperforms the baseline ControlNet model. This superiority is in terms of both visual quality and alignment with conditions or prompts.
+
+For the Canny task, the results generated by our model exhibit a higher degree of detail preservation and visual consistency. The outputs of UniControl maintain a faithful reproduction of the edge information (i.e., round table) compared to ControlNet. In the HED task, our model effectively captures the robust boundaries, leading to visually appealing images with clear and sharp edge transitions, whereas ControlNet results appear to be non-factual. Moreover, our model demonstrate a more subtle understanding of 3D geometrical guidance of depth maps and surface normals than ControlNet. The depth map conditions produce visibly more accurate outputs. In the Normal task, our model faithfully reproduces the normal surface information (i.e., ski pole), leading to more realistic and visually superior outputs. During the Segmentation, Openpose, and Object Bounding Box tasks, the produced images generated by our model are better aligned with the given conditions than that by ControlNet, ensuring a higher fidelity to the input prompts. For example, the re-implemented ControlNet-BBox misunderstands “a woman near a statue”, whereas our outputs exhibit a high degree of accuracy and detail. In the Outpainting task, our model demonstrates its superiority by generating reasonable images with smooth transitions and natural-looking textures. It outperforms the ControlNet model, which produces less coherent results - “a bear missing one leg”. This visual comparison underscores the strength and versatility of our approach across a diverse set of tasks.
+
+
+Figure 7: User study between our multi-task model (Ours-multi) and single task model (Ours-single) on eight tasks. Our method outperforms baselines on most of tasks, and achieves big performance gains on tasks of seg-to-image and outpainting-to-image. Moreover, the p-value of voting Ours-multi in all cases is computed as 0.0028 that is statistically significant according to the criteria of $< 0 . 0 5$ .
+
+# 4.3 Quantitative Evaluation
+
+User Study. We compare the performance of our method with both the released ControlNet model and the re-implemented single-task ControlNet on our training set. As shown in Fig. 6, our approach consistently outperforms the alternatives in all cases. In the HED-to-image generation task, our method significantly surpasses ControlNet. This superiority is even more pronounced in the depth and normal surface to image generation tasks, where users overwhelmingly favor our method, demonstrating its ability to handle complex geometric interpretations. When compared to the re-implemented single-task model, Fig. 7 reveals that our approach maintains a smaller advantage, yet it still demonstrates its benefits by effectively discerning image regions to guide content generation. Even in the challenging outpainting task, our model outperforms the baseline, highlighting its robustness and capacity to generalize.
+
+Table 2: Image Perceptual Distance
+
+
Canny↓
HED↓
Normal↓
Depth↓
Pose↓
Segmentation ↓
UniControl
0.546
0.466
0.623
0.654
0.741
0.693
ControlNet
0.577
0.582
0.778
0.700
0.747
0.693
+
+Image Perceptual Metric. We evaluate the distance between our output and the ground truth image. As we aim to obtain
+
+a structural similar image to the ground truth image, we adopt the perceptual metric in [65], where a lower value indicates more similar images. As shown in Tab. 2, UniControl outperforms ControlNet on five tasks, and obtains the same image distance to ControlNet on Segmentation.
+
+Fréchet Inception Distance (FID). We’ve further conducted quantitative analysis with FID [66] to include more classic single-task-controlled methods such as GLIGEN [67] and T2I-adapter [68]. With a collection of over 2,000 test samples sourced from Laion and COCO, we’ve assessed a wide range of tasks covering edges (Canny, HED), regions (Seg), skeletons (Pose), and geometric maps (Depth, Normal). The Tab. 3 demonstrates that our UniControl consistently surpasses the baseline methods across the majority of tasks. Notably, UniControl achieves this while maintaining a more compact and efficient architecture than its counterparts.
+
+Ablation Study. We’ve conducted an ablation study, specifically focusing on the MoE-Style Adapter and TaskHyperNet in Tab. 4 with FID scores reported as the previous part. It is noticeable that the full-version UniControl (MoE-Style Adapter $^ +$ TaskHyperNet) significantly outperforms the ablations which demonstrates the superiority of proposed MoE-Style Adapter and TaskHyperNet.
+
+Table 3: Quantitative Comparison (FID)
+
+
Canny↓
HED↓
Depth ↓
Normal↓
Seg↓
Pose↓
GLIGEN [67]
24.9
27.8
25.8
27.7
-
=
T2I-Adapter [68]
23.6
1
25.4
-
27.1
28.9
ControlNet [21]
22.7
25.1
25.5
28.4
26.7
28.8
UniControl
22.9
23.6
21.3
23.4
25.5
27.4
+
+Table 4: Ablation Study (FID)
+
+
MoE-Adapter
TaskHyperNet
Canny↓
HED↓
Depth ↓
Normal↓
Seg↓
Pose↓
Avg
X
27.2
29.0
27.6
28.8
29.1
30.2
28.7
24.5
26.1
23.7
24.8
26.9
28.3
25.7
x<>
X
22.9
23.6
21.3
23.4
25.5
27.4
24.0
+
+# 4.4 Zero-shot Generalization
+
+We further showcase the surprising capabilities of our method to undertake the zero-shot challenge of hybrid conditions combination and unseen tasks generalization.
+
+Hybrid Tasks Combination. This involves generating results from two distinct conditions simultaneously. Our model’s zero-shot ability is tested with combinations such as depth and human skeleton or segmentation map and human skeleton. The results are shown in Fig. 5 (a)-(b). When the background is conditioned on a depth map, the model effectively portrays the intricate 3D structure of the scene, while maintaining the skeletal structure of the human subject. Similarly, when the model is presented with a combination of a segmentation map and human skeleton, the output skillfully retains the structural details of the subject, while adhering to the segmentation boundaries. These examples illustrate our model’s adaptability and robustness, highlighting its ability to handle complex hybrid tasks without any prior explicit training.
+
+Unseen Tasks Generalization. To evaluate the zero-shot ability to generalize to unseen tasks such as gray image colorization, image deblurring, and image inpainting, we conduct the case analysis in Fig. 5 (c)-(e). The model skillfully handles the unseen tasks, producing compelling results. This capability is deeply rooted in the shared attributes and implicit correlations among pre-training and new tasks, allowing our model to adapt seamlessly. For instance, the colorization task leverages the model’s understanding of image structures from the segmentation task and depth estimation task, while deblurring and inpainting tasks benefit from the model’s familiarity with edge detection and outpainting ones.
+
+# 5 Conclusion and Discussion
+
+We introduce UniControl , a novel unified model for incorporating a wide range of conditions into the generation process of diffusion models. UniControl has been designed to be adaptable to various tasks through the employment of two key components: a Mixture-of-Experts (MOE) style adapter and a task-aware HyperNet. The experimental results have showcased the model’s robust performance and adaptability across different tasks and conditions, demonstrating its potential for handling complex text-to-image generation tasks.
+
+Limitation and Broader Impact. While UniControl demonstrates impressive performance, it still inherits the limitation of diffusion-based image generation models. Specifically, it is limited by our training data, which is obtained from a subset of the Laion-Aesthetics datasets. We observe that there is a data bias in this dataset. Although we have performed keywords and image based data filtering methods, we are aware that the model may generate biased or low-fidelity output. Our model is also limited when high-quality human output is desired. UniControl could be improved if better open-source datasets are available to block the creation of biased, toxic, sexualized, or other harmful content. We hope our work can motivate researchers to develop visual generative foundation models.
+
+# References
+
+[1] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
+
+[2] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J Liu, et al. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 21(140):1–67, 2020.
+
+[3] Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, et al. Scaling instruction-finetuned language models. arXiv preprint arXiv:2210.11416, 2022.
+
+[4] Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35:27730–27744, 2022.
+
+[5] Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
+
+[6] OpenAI. Gpt-4 technical report, 2023.
+
+[7] Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. Blip-2: Bootstrapping languageimage pre-training with frozen image encoders and large language models. arXiv preprint arXiv:2301.12597, 2023.
+
+[8] Haoxuan You, Mandy Guo, Zhecan Wang, Kai-Wei Chang, Jason Baldridge, and Jiahui Yu. Cobit: A contrastive bi-directional image-text generation model. arXiv preprint arXiv:2303.13455, 2023.
+
+[9] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. Highresolution image synthesis with latent diffusion models. In CVPR, pages 10684–10695, 2022.
+
+[10] Alexander Kirillov, Eric Mintun, Nikhila Ravi, Hanzi Mao, Chloe Rolland, Laura Gustafson, Tete Xiao, Spencer Whitehead, Alexander C Berg, Wan-Yen Lo, et al. Segment anything. arXiv preprint arXiv:2304.02643, 2023.
+
+[11] Bo Li, Dongseong Hwang, Zhouyuan Huo, Junwen Bai, Guru Prakash, Tara N Sainath, Khe Chai Sim, Yu Zhang, Wei Han, Trevor Strohman, et al. Efficient domain adaptation for speech foundation models. In ICASSP 2023-2023 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 1–5. IEEE, 2023.
+
+[12] Rongjie Huang, Mingze Li, Dongchao Yang, Jiatong Shi, Xuankai Chang, Zhenhui Ye, Yuning Wu, Zhiqing Hong, Jiawei Huang, Jinglin Liu, et al. Audiogpt: Understanding and generating speech, music, sound, and talking head. arXiv preprint arXiv:2304.12995, 2023.
+
+[13] Michael Ahn, Anthony Brohan, Noah Brown, Yevgen Chebotar, Omar Cortes, Byron David, Chelsea Finn, Keerthana Gopalakrishnan, Karol Hausman, Alex Herzog, et al. Do as i can, not as i say: Grounding language in robotic affordances. arXiv preprint arXiv:2204.01691, 2022.
+
+[14] Yilun Dai, Mengjiao Yang, Bo Dai, Hanjun Dai, Ofir Nachum, Josh Tenenbaum, Dale Schuurmans, and Pieter Abbeel. Learning universal policies via text-guided video generation. arXiv preprint arXiv:2302.00111, 2023.
+
+[15] Sai Vemprala, Rogerio Bonatti, Arthur Bucker, and Ashish Kapoor. Chatgpt for robotics: Design principles and model abilities. Technical Report MSR-TR-2023-8, Microsoft, February 2023. URL https://www.microsoft.com/en-us/research/publication/ chatgpt-for-robotics-design-principles-and-model-abilities/.
+
+[16] Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback. arXiv preprint arXiv:2203.02155, 2022.
+
+[17] OpenAI. Chatgpt. https://openai.com/blog/chatgpt/, 2022.
+
+[18] Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. NeurIPS, 34:8780–8794, 2021.
+
+[19] Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S Sara Mahdavi, Rapha Gontijo Lopes, et al. Photorealistic text-to-image diffusion models with deep language understanding. arXiv preprint arXiv:2205.11487, 2022.
+
+[20] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
+
+[21] Lvmin Zhang and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models. arXiv preprint arXiv:2302.05543, 2023.
+
+[22] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. arXiv preprint arXiv:2103.00020, 2021.
+
+[23] Amir R Zamir, Alexander Sax, William Shen, Leonidas J Guibas, Jitendra Malik, and Silvio Savarese. Taskonomy: Disentangling task transfer learning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3712–3722, 2018.
+
+[24] Golnaz Ghiasi, Barret Zoph, Ekin D Cubuk, Quoc V Le, and Tsung-Yi Lin. Multi-task selftraining for learning general representations. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 8856–8865, 2021.
+
+[25] Shikun Liu, Edward Johns, and Andrew J Davison. End-to-end multi-task learning with attention. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 1871–1880, 2019.
+
+[26] David Ha, Andrew M. Dai, and Quoc V. Le. Hypernetworks. In International Conference on Learning Representations, 2017.
+
+[27] Johannes Von Oswald, Christian Henning, Benjamin F Grewe, and João Sacramento. Continual learning with hypernetworks. arXiv preprint arXiv:1906.00695, 2019.
+
+[28] Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In ICML, pages 2256–2265. PMLR, 2015.
+
+[29] Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in Neural Information Processing Systems, 32, 2019.
+
+[30] Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. arXiv preprint arXiv:2011.13456, 2020.
+
+[31] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. NeurIPS, 33:6840–6851, 2020.
+
+[32] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv:2010.02502, October 2020. URL https://arxiv.org/abs/2010.02502.
+
+[33] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In MICCAI, pages 234–241. Springer, 2015.
+
+[34] Jonathan Ho, Chitwan Saharia, William Chan, David J Fleet, Mohammad Norouzi, and Tim Salimans. Cascaded diffusion models for high fidelity image generation. J. Mach. Learn. Res., 23(47):1–33, 2022.
+[35] Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741, 2021.
+[36] Nan Liu, Shuang Li, Yilun Du, Antonio Torralba, and Joshua B Tenenbaum. Compositional visual generation with composable diffusion models. In European Conference on Computer Vision, pages 423–439. Springer, 2022.
+[37] Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. In CVPR, 2017.
+[38] Chitwan Saharia, William Chan, Huiwen Chang, Chris Lee, Jonathan Ho, Tim Salimans, David Fleet, and Mohammad Norouzi. Palette: Image-to-image diffusion models. In ACM SIGGRAPH 2022 Conference Proceedings, pages 1–10, 2022.
+[39] Tengfei Wang, Ting Zhang, Bo Zhang, Hao Ouyang, Dong Chen, Qifeng Chen, and Fang Wen. Pretraining is all you need for image-to-image translation. arXiv preprint arXiv:2205.12952, 2022.
+[40] Chenlin Meng, Yutong He, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. Sdedit: Guided image synthesis and editing with stochastic differential equations. In International Conference on Learning Representations, 2021.
+[41] Amir Hertz, Ron Mokady, Jay Tenenbaum, Kfir Aberman, Yael Pritch, and Daniel Cohen-Or. Prompt-to-prompt image editing with cross attention control. arXiv preprint arXiv:2208.01626, 2022.
+[42] Bram Wallace, Akash Gokul, and Nikhil Naik. Edict: Exact diffusion inversion via coupled transformations. arXiv preprint arXiv:2211.12446, 2022.
+[43] Xuan Su, Jiaming Song, Chenlin Meng, and Stefano Ermon. Dual diffusion implicit bridges for image-to-image translation. In The Eleventh International Conference on Learning Representations, 2022.
+[44] Yaron Lipman, Ricky TQ Chen, Heli Ben-Hamu, Maximilian Nickel, and Matt Le. Flow matching for generative modeling. arXiv preprint arXiv:2210.02747, 2022.
+[45] Xingchao Liu, Chengyue Gong, and Qiang Liu. Flow straight and fast: Learning to generate and transfer data with rectified flow. arXiv preprint arXiv:2209.03003, 2022.
+[46] Xingchao Liu, Lemeng Wu, Mao Ye, and Qiang Liu. Let us build bridges: Understanding and extending diffusion generative models. arXiv preprint arXiv:2208.14699, 2022.
+[47] Guan-Horng Liu, Arash Vahdat, De-An Huang, Evangelos A Theodorou, Weili Nie, and Anima Anandkumar. $\mathrm { I } ^ { 2 } \mathrm { s b }$ : Image-to-image schrödinger bridge. arXiv preprint arXiv:2302.05872, 2023.
+[48] Andreas Lugmayr, Martin Danelljan, Andres Romero, Fisher Yu, Radu Timofte, and Luc Van Gool. Repaint: Inpainting using denoising diffusion probabilistic models. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, 2022.
+[49] Zhendong Wang, Yifan Jiang, Yadong Lu, Yelong Shen, Pengcheng He, Weizhu Chen, Zhangyang Wang, and Mingyuan Zhou. In-context learning unlocked for diffusion models. arXiv preprint arXiv:2305.01115, 2023. URL https://arxiv.org/abs/2305.01115.
+[50] Amir Bar, Yossi Gandelsman, Trevor Darrell, Amir Globerson, and Alexei Efros. Visual prompting via image inpainting. Advances in Neural Information Processing Systems, 35: 25005–25017, 2022.
+[51] Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598, 2022.
+
+[52] Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc Le, Geoffrey Hinton, and Jeff Dean. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. arXiv preprint arXiv:1701.06538, 2017.
+
+[53] Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of stylegan. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 8110–8119, 2020.
+
+[54] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
+
+[55] 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 NeurIPS. NeurIPS, 2019.
+
+[56] Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion-5b: An open large-scale dataset for training next generation image-text models. arXiv preprint arXiv:2111.02114, 2021.
+
+[57] John Canny. A computational approach to edge detection. IEEE Transactions on pattern analysis and machine intelligence, pages 679–698, 1986.
+
+[58] Saining Xie and Zhuowen Tu. Holistically-nested edge detection. In Proceedings of the IEEE international conference on computer vision, pages 1395–1403, 2015.
+
+[59] René Ranftl, Katrin Lasinger, David Hafner, Konrad Schindler, and Vladlen Koltun. Towards robust monocular depth estimation: Mixing datasets for zero-shot cross-dataset transfer. IEEE transactions on pattern analysis and machine intelligence, 44(3):1623–1637, 2020.
+
+[60] Kunchang Li, Yali Wang, Junhao Zhang, Peng Gao, Guanglu Song, Yu Liu, Hongsheng Li, and Yu Qiao. Uniformer: Unifying convolution and self-attention for visual recognition. arXiv preprint arXiv:2201.09450, 2022.
+
+[61] Bolei Zhou, Hang Zhao, Xavier Puig, Tete Xiao, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Semantic understanding of scenes through the ade20k dataset. International Journal of Computer Vision, 127:302–321, 2019.
+
+[62] Alexey Bochkovskiy, Chien-Yao Wang, and Hong-Yuan Mark Liao. Yolov4: Optimal speed and accuracy of object detection. arXiv preprint arXiv:2004.10934, 2020.
+
+[63] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In Computer Vision–ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part V 13, pages 740–755. Springer, 2014.
+
+[64] Zhe Cao, Tomas Simon, Shih-En Wei, and Yaser Sheikh. Realtime multi-person 2d pose estimation using part affinity fields. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7291–7299, 2017.
+
+[65] Richard Zhang, Phillip Isola, Alexei Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, 2018.
+
+[66] 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. NeurIPS, 30, 2017.
+
+[67] Yuheng Li, Haotian Liu, Qingyang Wu, Fangzhou Mu, Jianwei Yang, Jianfeng Gao, Chunyuan Li, and Yong Jae Lee. Gligen: Open-set grounded text-to-image generation. arXiv:2301.07093, 2023.
+
+# Appendix
+
+# A Details of Implementation
+
+# A.1 MOE-Style Adapter
+
+The MOE adapter is implemented as a set of parallel ConvNets composed of three consecutive convolution and non-linear activation layers. The entire model is comprised of nine individual MOE adapters, each of which consumes 70K parameters. Task keys are designated to each adapter, ensuring that they align with the corresponding visual conditions. Once the MOE adapter processes the input, the remaining model parameters become shared across all tasks. This architecture facilitates task adaptability while promoting parameter efficiency.
+
+# A.2 Task-aware HyperNet
+
+The task-aware hypernet is applied to modulate the parameters of zero-conv layers in the ControlNet. Since the ControlNet can be considered as the hypernet of Stable Diffusion (fixed copy). Our idea can be concluded as the control over control or meta-control to let the task-aware hypernet learn the universe representation that is generalizable across different tasks. To implement it, we firstly map the task keys to instruction with a mapping function as: {"hed": "hed edge to image", "canny": "canny edge to image", "seg": "segmentation map to image", "depth": "depth map to image", "normal": "normal surface map to image", "pose": "human pose skeleton to image", "hedsketch": "sketch to image", "bbox": "bounding box to image", "outpainting": "image outpainting"}. Then, such instructions will be projected as text embeddings with the help of a language model (we adopt CLIPText in our implementation). The Task-aware HyperNet takes these task instruction embeddings, and projects them into different shapes to match the size of different zero-conv kernels, which will be modulated by these task embeddings accordingly. We would fix the parameters of task-aware hyperNet in the later stage of model training to ensure the stability of dynamics.
+
+# A.3 Data Collection
+
+We have collected a large amount of training set (MultiGen-20M) including over 20M conditionimage-prompt triplets across nine different tasks. We firstly download 3/4 of Laion-Aesthetics-V2 with score over six and filter out low-resolution $( < 5 1 2 )$ images. As a result, $2 . 8 \mathbf { M }$ images are selected as source images. Then we apply the visual condition extractors as described in the main paper to collect Canny, HED, Sketch, Depth, Normal Surface, Seg Map, Object Bounding Box, Human Skeleton and Outpainting.
+
+# B Numerical Analysis of Task-Aware Modulated ControlNet
+
+We show that our proposed task-aware modulated ControlNet preserves the properties of the original ControlNet structure. Specifically, we show 1) The new task-aware modulated ControlNet preserves the zero-initialization property of ControlNet; 2) The parameters of the task-aware modulated Controlnet can be updated once we start to train the model.
+
+Denote the input feature map by , the frozen SD Block in Fig. 2 by $\mathcal { F } _ { \mathrm { S D } }$ , the extra condition by $c$ , two zero convolution operators by $\mathcal { Z } _ { \theta _ { 1 } } ^ { 1 } ( \cdot )$ and $\mathcal { Z } _ { \theta _ { 2 } } ^ { 2 } ( \cdot )$ , the trainable copy of SD Block by $\mathcal { G } _ { \theta _ { \mathrm { s } } } ^ { \mathrm { S D } } ( \cdot )$ , the task instruction by $c _ { \mathrm { t a s k } }$ , and the task-aware hyperNet by $\mathcal { H } _ { \boldsymbol { \theta } _ { \mathcal { H } } } ( \cdot )$ . Then the output of the new task-aware modulated Controlnet can be expressed as
+
+$$
+{ \pmb y } _ { c } = \mathcal { F } _ { \mathrm { S D } } ( { \pmb x } ) + \mathcal { Z } _ { \theta _ { 1 } } ^ { 1 } ( \mathcal { G } _ { \theta _ { \mathrm { s } } } ^ { \mathrm { S D } } ( { \pmb x } + \mathcal { Z } _ { \theta _ { 2 } } ^ { 2 } ( c ) \cdot \mathcal { H } _ { \theta _ { \mathcal { H } } } ( c _ { \mathrm { t a s k } } ) ) ) \cdot \mathcal { H } _ { \theta _ { \mathcal { H } } } ( c _ { \mathrm { t a s k } } ) .
+$$
+
+Property of Zero Initialization. Similar to ControlNet [21], the weights and biases of the convolution layers are initialized as zeros. As a result, we have $\mathcal { Z } _ { \theta _ { 1 } } ^ { 1 } ( \cdot ) \equiv 0$ and $\pmb { y } _ { c } = \mathcal { F } _ { \mathrm { S D } } ( \pmb { x } )$ , regardless of the initialization of $\mathcal { H } _ { \theta _ { \mathcal { H } } } ( \cdot )$ .
+
+Gradient Analysis. We analyze the gradient of the modulated part
+
+$$
+\nabla _ { \theta } \left( Z _ { \theta _ { 1 } } ^ { 1 } ( I ) \cdot \mathcal { H } _ { \theta _ { \mathcal { H } } } ( c _ { \mathrm { t a s k } } ) \right) = \mathcal { H } _ { \theta _ { \mathcal { H } } } ( c _ { \mathrm { t a s k } } ) \cdot \nabla _ { \theta } Z _ { \theta _ { 1 } } ^ { 1 } ( I ) + Z _ { \theta _ { 1 } } ^ { 1 } ( I ) \cdot \nabla _ { \theta _ { \mathcal { H } } } \mathcal { H } _ { \theta _ { \mathcal { H } } } ( c _ { \mathrm { t a s k } } ) ,
+$$
+
+where $I$ is the input of the zero convolution layer.
+
+When we start to train the network, the first part of the RHS of (2) follows similar analysis of ControlNet [21] since $\mathcal { H } _ { \boldsymbol { \theta } _ { \mathcal { H } } } \left( c _ { \mathrm { t a s k } } \right)$ is constant when we analyze the gradient $\nabla _ { \theta } Z _ { \theta _ { 1 } } ^ { 1 } ( I )$ . Since the parameters of $\mathcal { H } _ { \theta _ { \mathcal { H } } } ( c _ { \mathrm { t a s k } } )$ are not initialized to zero, it is known that $\mathcal { H } _ { \theta _ { \mathcal { H } } } ( c _ { \mathrm { t a s k } } ) \neq 0$ . So the gradient dynamic follows the analysis of ControlNet. Therefore, we conclude that $Z _ { \theta _ { \bot } } ^ { 1 } ( I ) \neq 0$ after the first gradient update, and that the network can start to learn and update the following standard dynamics of stochastic gradient descent.
+
+As for the second part of the RHS of (2), $Z _ { \theta _ { 1 } } ^ { 1 } ( I ) \equiv 0$ before the first gradient update, so the gradient is zero for $\theta _ { \mathcal { H } }$ . However, after the first gradient update of $\theta _ { 1 }$ , we know $Z _ { \theta _ { 1 } } ^ { 1 } ( I ) \neq 0$ , and $\theta _ { \mathcal { H } }$ can be updated with non-zero gradients.
+
+To conclude, the new task-aware Modulated ControlNet can still be efficiently updated and learned even if the convolution layers are initialized to zero.
+
+# C Zero-shot-task Results and Analysis
+
+We show more zero-shot-task results in this section, where the tasks have not been trained on. In Fig. 13, we show zero-shot deblurring results guided by the keywords. Our deblurred images can successfully recover the fine-grained details of the images without training on such data. We note that some details are still missing, e.g., the details in the painting in the first row are still not clear enough. In Fig. 14, we illustrate two zero-shot image colorization results. We believe that most parts of the generated images are acceptable, though the clothes of the second woman do not look the same to the input blurred image. In Fig. 15, we observe impressive zero-shot inpainting results. In the first row, the duck that is inputted in the text has been successfully generated in the inpainted image. The second row obtains acceptable results as well, though the faces do not look perfect. The overall zero-shot quality of UniControl is remarkable.
+
+While inpainting and outpainting might appear related, they are fundamentally distinct. Inpainting heavily leverages the contextual information from unmasked regions, necessitating a precise match. Conversely, outpainting has more freedom, with the generative model prioritizing prompts to envision new content. As shown in Fig. 8, directly using outpainting model for inpainting tasks can be challenging since the model tends to leave a sharp change over the mask boundaries. Our pretrained UniControl, thanks to intensive training across multiple tasks, has learned edge and region-to-image mappings, which assists in preserving contextual information.
+
+Our model also demonstrates a promising capacity to generalize under scribble conditions, showing parallels to the ControlNet’s ability, even though UniControl hasn’t been directly trained using scribble data. Fig. 9 provides results illustrating the scribble-to-image generation.
+
+# D Details of User Study
+
+In the evaluation steps, we use Amazon Mechanical Turk (Mturk) 2 to perform user study. Specifically, we ask three Mturk master workers to select the best output result for each input condition. As shown in Fig. 10, we provide instructions on guidelines to select the best generated image. The annotators are provided the condition map and the text that describes the image, and are required to select the better output between the two generated images. Considering that images can both in good or bad qualities, we provide the tie option as well. We use the majority vote to determine the result of each image, which means that an image is considered as a better image if two or more annotators vote for it. We use 294 images for the tasks of Canny, HED, Surface Normal, Depth, Segmentation, User Sketch, and Outpainting. We adopt 100 images for the task of Human Skeleton and 187 images for the task of Bounding Box. In summary, we totally obtain 7,035 voting results for all nine tasks. 2/3 of source images in testing set are collected from MSCOCO with the remaining 1/3 from Laion. And it includes a very diverse range of topics including indoor scene, outdoor scene, oil painting, portrait, pencil sketch, animation, cartoon, etc.
+
+
+“Contemporary Bedroom Designs 2015 modern bedroom designs intended design”
+
+
+Figure 8: Visual comparison of Ours-single-outpainting and UniControl on the inpainting task. The single outpainting model cannot well address the zero-shot inpainting task whereas UniControl demonstrates promising capacity.
+Figure 9: Visual comparison of ControlNet-Scribble and UniControl on the scribble data. ControlNetScribble is trained by the scribble data which, however, are unseen for UniControl.
+
+
+Figure 10: Mturk interface to select the better generated image.
+
+
+Figure 11: User study results of User Sketch to image generation.
+
+# E Failure Cases
+
+We illustrate some failure cases in Fig. 12. In the first row, although our generated image successfully aligns the Bounding Box condition, the generated human has a distorted body. In the second row, our generated image looks similar to the ground truth; however, the human faces are blurred. We think that the reason is that UniControl inherits the data and model bias of Stable Diffusion, where the generated human commonly have issues. In the third row, the generated image does not look realistic. We believe that the training data can be improved both quantitatively and qualitatively.
+
+# F Additional Results
+
+We illustrate more visualized results in this section on tasks Canny (Fig. 16), HED (Fig. 17), Depth (Fig. 18), Surface Normal (Fig. 19), Human Skeleton (Fig. 20), Bounding Box (Fig. 21), Segmentation (Fig. 22) and Outpainting (Fig. 23). These results further demonstrate the effectiveness of our proposed method. Moreover, due to the space limitation in the main paper, we report results of the last task, User Sketch. Given a sketched image, UniControl is able to achieve promising realistic images. The visualized results are in Fig. 24. The user study result can be found in Fig. 11, where it is observed that UniControl obtains significantly more votes than the single task model.
+
+
+
+
+“La tricoteuse Realism William Adolphe Bouguereau Oil Paintings”
+
+
+
+“A man and woman in ski gear standing in front of a mountain. “ “The Taj Mahal mirrored by a water fountain's reflection. - Agra, Uttar Pradesh, India - Daily Travel Photos”
+
+
+Figure 12: Failure Cases: distorted body (row one); blurred faces (row two); incorrect creation (row three).
+
+
+
+“Christa McAuliffe (right, sat with her backup crew member Barbara Morgan) was a social studies teacher who had won NASA's Teacher in Space contest and earned herself a spot on the mission”
+
+
+Figure 13: More zero-shot-task deblurring results.
+
+Gray Image
+
+
+
+Our Result
+
+
+
+# “Long White Casual Wedding Dress”
+
+
+
+
+
+“Pixie Cropped Short Layered Synthetic Wig for Women-KAMI WIGS”
+
+
+Figure 14: More zero-shot-task gray-to-RGB colorization results.
+
+
+
+“Early morning view over the town of Tinerhir, south of the Todra Gorge, Morocco, North Africa, Africa”
+
+
+“A lone duck basks in the calm lake's mirror reflection of the Chugach mountain valley”
+
+
+“Chancellor of the Exchequer Rishi Sunak was the most high-profile, and unexpected, appointment of the day”
+
+
+“Contemporary Bedroom Designs 2015 modern bedroom designs intended design “
+Figure 15: More zero-shot-task image in-painting results. The in-painting MOE adapter weights are directly inherited from outpainting.
+
+
+
+
+Figure 17: HED to Image Generation
+
+(d) “A young girl who is brushing her teeth with a toothbrush.”
+
+
+Figure 18: Depth to Image Generation
+
+
+
+
+
+
+Figure 19: Surface Normal to Image Generation
+
+
+
+
+
+(a) “Photo of handsome man in black leather jacket”
+
+
+Input Image: Water traffic along the Thames by Big
+
+
+
+
+Our Method Output
+
+(b) “Water traffic along the Thames by Big Ben”
+
+
+
+(c) “A well-lit and well-decorated living room shows a glimpse of a glass front door through the corridor.”
+
+
+Figure 22: Segmentation Map (by Uniformer-ADE20K) to Image Generation
+
+
+Figure 23: Image Outpainting
+
+(d) “Beautiful kitchen grand scale living pinterest for Kitchen cabinets lowes with old world metal wall art”
+
+
+
+
+(a) “A Limited Edition, Fine Art photograph of a beautiful sunrise at Lake Jackson in Sebring, Florida. Available as a Fine Art print”
+Figure 24: User Sketch to Image Generation
+
+(d) “Superhero watching over city. No transparency used. Basic (linear) gradients. A4 proportions.”
\ No newline at end of file
diff --git a/md/dev/vGQiU5sqUe3/vGQiU5sqUe3.md b/md/dev/vGQiU5sqUe3/vGQiU5sqUe3.md
new file mode 100644
index 0000000000000000000000000000000000000000..068f00f81a1a68a3fc02ff3d07d4eb29c554f33f
--- /dev/null
+++ b/md/dev/vGQiU5sqUe3/vGQiU5sqUe3.md
@@ -0,0 +1,401 @@
+# Contrastive Learning as Goal-Conditioned Reinforcement Learning
+
+Tianjun Zhangγ Sergey Levineβ,γ Ruslan Salakhutdinovα U βGoogle Research γUC Berkeley
+
+# Abstract
+
+In reinforcement learning (RL), it is easier to solve a task if given a good representation. While deep RL should automatically acquire such good representations, prior work often finds that learning representations in an end-to-end fashion is unstable and instead equip RL algorithms with additional representation learning parts (e.g., auxiliary losses, data augmentation). How can we design RL algorithms that directly acquire good representations? In this paper, instead of adding representation learning parts to an existing RL algorithm, we show (contrastive) representation learning methods can be cast as RL algorithms in their own right. To do this, we build upon prior work and apply contrastive representation learning to action-labeled trajectories, in such a way that the (inner product of) learned representations exactly corresponds to a goal-conditioned value function. We use this idea to reinterpret a prior RL method as performing contrastive learning, and then use the idea to propose a much simpler method that achieves similar performance. Across a range of goal-conditioned RL tasks, we demonstrate that contrastive RL methods achieve higher success rates than prior non-contrastive methods, including in the offline RL setting. We also show that contrastive RL outperforms prior methods on image-based tasks, without using data augmentation or auxiliary objectives. 1
+
+# 1 Introduction
+
+Representation learning is an integral part of reinforcement learning $( \mathrm { R L } ^ { 2 } )$ algorithms. While such representations might emerge from end-to-end training [7, 79, 119, 126], prior work has found it necessary to equip RL algorithms with perception-specific loss functions [32, 44, 71, 89, 91, 101, 116, 140] or data augmentations [69, 73, 116, 118], effectively decoupling the representation learning problem from the reinforcement learning problem. Given what prior work has shown about RL in the presence of function approximation and state aliasing [2, 135, 138], it is not surprising that end-to-end learning of representations is fragile [69, 73]: an algorithm needs good representations to drive the learning of the RL algorithm, but the RL algorithm needs to drive the learning of good representations. So, can we design RL algorithms that do learn good representations without the need for auxiliary perception losses?
+
+Rather than using a reinforcement learning algorithm also to solve a representation learning problem, we will use a representation learning algorithm to also solve certain types of reinforcement learning problems, namely goal-conditioned RL. Goal-conditioned RL is widely studied [6, 15, 22, 62, 80, 120], and intriguing from a representation learning perspective because it can be done in an entirely self-supervised manner, without manually-specified reward functions. We will focus on contrastive (representation) learning methods, using observations from the same trajectory (as done in prior work [95, 109]) while also including actions as an additional input (See Fig. 1). Intuitively, contrastive learning then resembles a goal-conditioned value function: nearby states have similar representations and unreachable states have different representations. We make this connection precise, showing that sampling positive pairs using the discounted state occupancy measure results in learning representations whose inner product exactly corresponds to a value function.
+
+
+Figure 1: Reinforcement learning via contrastive learning. Our method uses contrastive learning to acquire representations of state-action pairs $( \phi ( s , a ) )$ and future states $( \psi ( s _ { f } ) )$ , so that the representations of future states are closer than the representations of random states. We prove that learned representation corresponds to a value function for a certain reward function. To select actions for reaching goal $s _ { g }$ , the policy chooses the action where $\phi ( s , a )$ is closest to $\psi ( s _ { g } )$ .
+
+In this paper, we show how contrastive representation learning can be used to perform goalconditioned RL. We formally relate the learned representations to reward maximization, showing that the inner product between representations corresponds to a value function. This framework of contrastive RL generalizes prior methods, such as C-learning [29], and suggests new goal-conditioned RL algorithms. One new method achieves performance similar to prior methods but is simpler; another method consistently outperforms the prior methods. On goal-conditioned RL tasks with image observations, contrastive RL methods outperform prior methods that employ data augmentation and auxiliary objectives, and do so without data augmentation or auxiliary objectives. In the offline setting, contrastive RL can outperform prior methods on benchmark goal-reaching tasks, sometimes by a wide margin.
+
+# 2 Related Work
+
+This paper will draw a connection between RL and contrastive representation learning, building upon a long line of contrastive learning methods in NLP and computer vision, and deep metric learning [17, 53, 54, 54, 56, 77, 84, 86, 87, 94, 95, 108, 109, 113, 122, 129, 132]. Contrastive learning methods learn representations such that similar (“positive”) examples have similar representations and dissimilar (“negative”) examples have dissimilar representations.3 While most methods generate the “positive” examples via data augmentation, some methods generate similar examples using different camera viewpoints of the same scene [109, 122], or by sampling examples that occur close in time within time series data [4, 95, 109, 118]. Our analysis will focus on this latter strategy, as the dependence on time will allow us to draw a precise relationship with the time dependence in RL.
+
+Deep RL algorithms promise to automatically learn good representations, in an end-to-end fashion. However, prior work has found it challenging to uphold this promise [7, 79, 119, 126], prompting many prior methods to employ separate objectives for representation learning and RL [32, 44, 71, 89, 91, 100, 101, 116, 118, 140, 143]. Many prior methods choose a representation learning objectives that reconstruct the input state [32, 47, 49, 50, 71, 91, 93, 141] while others use contrastive representation learning methods [89, 95, 111, 116, 118]. Unlike these prior methods, we will not use a separate representation learning objective, but instead use the same objective for both representation learning and reinforcement learning. Some prior RL methods have also used contrastive learning to acquire reward functions [14, 20, 33, 38, 63, 67, 92, 133, 134, 146], often in imitation learning settings [37, 55]. In contrast, we will use contrastive learning to directly acquire a value function, which (unlike a reward function) can be used directly to take actions, without any additional RL.
+
+This paper will focus on goal-conditioned RL problems, a problem prior work has approached using temporal difference learning [6, 29, 62, 80, 103, 106], conditional imitation learning [22, 41, 83, 105, 120], model-based methods [23, 107], hierarchical RL [90], and planning-based methods [30, 93, 105, 115]. The problems of automatically sampling goals and exploration [24, 35, 85, 98, 144] are orthogonal to this work. Like prior work, we will parametrize the value function as an inner product between learned representations [34, 58, 106]. Unlike these prior methods, we will learn a value function directly via contrastive learning, without using reward functions or TD learning.
+
+Our analysis will be most similar to prior methods [11, 15, 29, 103] that view goal-conditioned RL as a data-driven problem, rather than as a reward-maximization problem. Many of these methods employ hindsight relabeling [6, 26, 62, 78], wherein experience is relabeled with an outcome that occurred in the future. Whereas hindsight relabeling is typically viewed as a trick to add on top of an RL algorithm, this paper can roughly be interpreted as showing that the hindsight relabeling is a standalone RL algorithm. Many goal-conditioned methods learn a value function that captures the similarity between two states [29, 62, 91, 125]. Such distance functions are structurally similar to the critic function learned for contrastive learning, a connection we make precisely in Sec. 4. In fact, our analysis shows that C-learning [29] is already performing contrastive learning, and our experiments show that alternative contrastive RL methods can be much simpler and achieve higher performance.
+
+Prior work has studied how representations related to reward functions using the framework of universal value functions [12, 106] and successor features [9, 52, 81]. While these methods typically require additional supervision to drive representation learning (manually-specified reward functions or features), our method is more similar to prior work that estimates the discounted state occupancy measure as an inner product between learned representations [11, 131]. While these methods use temporal difference learning, ours is akin to Monte Carlo learning. While Monte Carlo learning is often (but not always [23]) perceived as less sampling efficient, our experiments find that our approach can be as sample efficient as TD methods. Other prior work has focused on learning representations that can be used for planning [59, 82, 104, 105, 128]. Our method will learn representations using an objective similar to prior work [105, 109], but makes the key observation that the representation already encodes a value function: no additional planning or RL is necessary to choose actions.
+
+Please see Appendix A for a discussion of how our work relates to unsupervised skill learning.
+
+# 3 Preliminaries
+
+Goal-conditioned reinforcement learning. The goal-conditioned RL problem is defined by states $s _ { t } \in S$ , actions $a _ { t }$ , an initial state distribution $p _ { 0 } \overline { { ( } } s )$ , the dynamics $p ( \boldsymbol { \dot { s } } _ { t + 1 } \mid s _ { t } , \boldsymbol { a } _ { t } )$ , a distribution over goals $p _ { g } ( s _ { g } )$ , and a reward function $r _ { g } { \left( s , \bar { a } \right) }$ for each goal. This problem is equivalent to a multi-task RL [5, 45, 121, 130, 139], where tasks correspond to reaching goals states. Following prior work [11, 15, 29, 103], we define the reward as the probability (density) of reaching the goal at the next time step:4
+
+$$
+r _ { g } ( s _ { t } , a _ { t } ) \triangleq ( 1 - \gamma ) p ( s _ { t + 1 } = s _ { g } \ | \ s _ { t } , a _ { t } ) .
+$$
+
+This reward function is appealing because it avoids the need for a human user to specify a distance metric (unlike, e.g., [6]). Even though our method will not estimate the reward function, we will still use the reward function for analysis. For a goal-conditioned policy $\pi ( \boldsymbol { a } \mid \boldsymbol { s } , \boldsymbol { s } _ { g } )$ , we use $\pi ( \tau \mid s _ { g } )$ to denote the probability of sampling an infinite-length trajectory $\tau = ( s _ { 0 } , a _ { 0 } , s _ { 1 } , a _ { 1 } , \cdot \cdot \cdot )$ . We defined the expected reward objective and Q-function as
+
+$$
+\operatorname* { m a x } _ { \pi } \mathbb { E } _ { p _ { g } ( s _ { g } ) , \pi ( \tau | s _ { g } ) } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r _ { g } ( s _ { t } , a _ { t } ) \right] , \quad Q _ { s _ { g } } ^ { \pi } ( s , a ) \triangleq \mathbb { E } _ { \pi ( \tau | s _ { g } ) } \left[ \sum _ { t ^ { \prime } = t } ^ { \infty } \gamma ^ { t ^ { \prime } - t } r _ { g } ( s _ { t ^ { \prime } } , a _ { t ^ { \prime } } ) \mid \mathbf { \Pi } _ { a _ { t } = a } ^ { s _ { t } = s _ { t } } \right] .
+$$
+
+Intuitively, this objective corresponds to sampling a goal $s _ { g }$ and then optimizing the policy to go to that goal and stay there. Finally, we define the discounted state occupancy measure as [55, 142]
+
+$$
+p ^ { \pi ( \cdot | \cdot , s _ { g } ) } ( s _ { t + } = s ) \triangleq ( 1 - \gamma ) \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } p _ { t } ^ { \pi ( \cdot | \cdot , s _ { g } ) } ( s _ { t } = s ) ,
+$$
+
+where $p _ { t } ^ { \pi } ( s )$ is the probability density over states that policy $\pi$ visits after $t$ steps. Sampling from the discounted state occupancy measure is easy: the first sample a time offset from a geometric distribution $\boldsymbol { \mathit { t } } \sim \mathbf { \mathrm { G E O M } } ( 1 - \gamma ) )$ , and then look at what state the policy visits after exactly $t$ steps. We will use $s _ { t + }$ to denote states sampled from the discounted state occupancy measure. Because our method will combine experience collected from multiple policies, we also define the average stationary distribution as $p ^ { \pi \^ { \cdot } \mid \cdot \rangle } ( s _ { t + } = s \mid s , a ) \triangleq \int p ^ { \pi ( \cdot \mid \cdot , s _ { g } ) } ( s _ { t + } = s \mid s , a ) p ^ { \pi } ( s _ { g } \mid s , a ) d \bar { s } _ { g \pi }$ where $p ^ { \pi } ( s _ { g } \mid s , a )$ is the probability of the commanded goal given the current state-action pair. This stationary distribution is equivalent to that of the policy $\begin{array} { r } { \pi ( \boldsymbol { a } \mid \boldsymbol { s } ) \triangleq \int \pi ( \boldsymbol { a } \mid \boldsymbol { s } , \boldsymbol { s } _ { g } ) p ^ { \pi } ( \boldsymbol { s } _ { g } \mid \boldsymbol { s } ) d \boldsymbol { s } _ { g } } \end{array}$ [145].
+
+Contrastive representation learning. Contrastive representation learning methods [17, 46, 53, 54, 61, 77, 84, 86, 87, 122, 124, 129] take as input pairs of positive and negative examples, and learn representations so that positive pairs have similar representations and negative pairs have dissimilar representations. We use $( u , v )$ to denote an input pair (e.g., $u$ is an image, and $v$ is an augmented version of that image). Positive examples are sampled from a joint distribution $p ( u , v )$ , while negative examples are sampled from the product of marginal distributions, $p ( u ) p ( v )$ . We will use an objective based on binary classification [77, 86, 87, 94]. Let $f ( u , v ) = \phi ( u ) ^ { T } \psi ( v )$ be the similarity between the representations of $u$ and $v$ . We will call $f$ the critic function5 and note that its range is $( - \infty , \infty )$ . We will use NCE-binary [84] objective (also known as InfoMAX [54]):
+
+$$
+\operatorname* { m a x } _ { f ( u , v ) } \mathbb { E } _ { ( u , v ^ { + } ) \sim p ( u , v ) } \biggl [ \log \sigma \bigl ( \underbrace { f ( u , v ^ { + } ) } _ { \phi ( u ) ^ { T } \psi ( v ^ { + } ) } \bigr ) + \log \bigl ( 1 - \sigma \bigl ( \underbrace { f ( u , \mathrm { ~ \xi ~ } ) } _ { \phi ( u ) ^ { T } \psi ( \mathrm { ~ \xi ~ } ) } \bigr ) \bigr ) \biggr ] .
+$$
+
+# 4 Contrastive Learning as an RL Algorithm
+
+This section shows how to use contrastive representation to directly perform goal-conditioned RL. The key idea (Lemma 4.1) is that contrastive learning estimates the Q-function for a certain policy and reward function. To prove this result, we relate the Q-function to the state occupancy measure (Sec. 4.1) and then relate the optimal critic function to the state occupancy measure (Sec. 4.2).
+
+This result allows us to propose a new algorithm for goal-conditioned RL based on contrastive learning. Unlike prior work, this algorithm is not adding contrastive learning on top of an existing RL algorithm. This framework generalizes C-learning [29], offering a cogent explanation for its good performance while also suggesting new methods that are simpler and can achieve higher performance.
+
+# 4.1 Relating the Q-function to probabilities
+
+This section sets the stage for the main results of this section by providing a probabilistic perspective goal-conditioned RL. The expected reward objective and associated Q-function in (Eq. 2) can equivalently be expressed as the probability (density) of reaching a goal in the future:
+
+Proposition 1 (rewards probabilities). The $Q$ -function for the goal-conditioned reward function $r _ { g }$ (Eq. 1) is equivalent to the probability of state $s _ { g }$ under the discounted state occupancy measure:
+
+$$
+Q _ { s _ { g } } ^ { \pi } ( s , a ) = p ^ { \pi ( \cdot | \cdot , s _ { g } ) } ( s _ { t + } = s _ { g } \mid s , a ) .
+$$
+
+The proof is in Appendix B. Translating rewards into probabilities not only makes it easier to analyze the goal-conditioned problem, but also means that any method for estimating probabilities (e.g., contrastive learning) can be turned into a method for estimating this Q-function.
+
+# 4.2 Contrastive Learning Estimates a Q-Function
+
+We will use contrastive learning to learn a value function by carefully choosing the inputs $u$ and $v$ . The first input, $u$ , will correspond to a state-action pair, $u \dot { = } ( s _ { t } , a _ { t } \dot { ) } \sim p ( s , a \dot { ) }$ . In practice, these pairs are sampled from the replay buffer. Including the actions in the input is important because it will allow us to determine which actions to take to reach a desired future state. The second variable, $v$ , is a future state, $v = s _ { f }$ . For the “positive” training pairs, the future state is sampled from the discounted state occupancy measure, $s _ { f } \sim p ^ { \pi ( \cdot | \cdot ) } ( s _ { t + } \mid s _ { t } , a _ { t } )$ . For the “negative” training pairs, we sample a future state from a random state-action pair: $\begin{array} { r } { \mathfrak { s } _ { f } \sim p ( \mathfrak { s } _ { t + } ) \underline { { \triangleq } } \int p ^ { \pi ( \cdot | \cdot ) } ( \mathfrak { s } _ { t + } \mid \mathfrak { s } , a ) p ( \mathfrak { s } , a ) d \mathfrak { s } d a } \end{array}$ . With these inputs, the contrastive learning objective (Eq. 4) can be written as
+
+$$
+\begin{array} { r l } & { \underset { f } { \operatorname* { m a x } } \mathbb { E } _ { ( s , a ) \sim p ( s , a ) , \quad \sim p ( s _ { f } ) } \left[ \mathcal { L } ( s , a , s _ { f } ^ { + } , \mathrm { ~ \lambda ~ } ) \right] , } \\ & { \quad \quad \quad \quad s _ { f } ^ { + } \sim p ^ { \pi ( \cdot | \cdot ) } ( s _ { t + } | s _ { t } , a _ { t } ) } \\ & { \quad \quad \quad \mathrm { w h e r e } \quad \mathcal { L } ( s , a , s _ { f } ^ { + } , \mathrm { ~ \lambda ~ } ) \triangleq \log \sigma ( \underset { \phi ( s , a ) ^ { T } \psi ( s _ { f } ^ { + } ) } { \underbrace { f ( s , a , s _ { f } ^ { + } ) } } ) + \log ( 1 - \sigma ( \underset { \phi ( s , a ) ^ { T } \psi ( \mathrm { ~ \lambda ~ } ) } { \underbrace { f ( s , a , \mathrm { ~ \lambda ~ } ) } } ) ) . } \end{array}
+$$
+
+Intuitively, the critic function $f ( u = ( s _ { t } , a _ { t } ) , v = s _ { f } )$ now tells us the correlation between the current state-action pair and future outcomes, analogous to a Q-function. We therefore can use the critic function in the same way as actor-critic RL algorithms [66], figuring out which actions lead to the desired outcome. Because the Bayes-optimal critic function is a function of the state occupancy measure [84], $\begin{array} { r } { f ^ { * } ( s , a , s _ { g } ) = \log \Big ( \frac { \bar { p } ^ { \pi ( \cdot | \cdot ) } \bar { ( } s _ { t + } = s _ { g } | s , a ) } { p ( s _ { g } ) } \Big ) } \end{array}$ , it can be used to express the Q-function:
+
+Lemma 4.1. The critic function that optimizes Eq. $6$ is a $Q$ -function for the goal-conditioned reward function (Eq. 1), up to a multiplicative constant p(sf ) : $\begin{array} { r } { \exp ( f ^ { * } ( s , a , s _ { f } ) ) = \frac { 1 } { p ( s _ { f } ) } \cdot Q _ { s _ { f } } ^ { \pi ( \cdot | \cdot ) } ( s , a ) } \end{array}$ .
+
+The critic function can be viewed as an unnormalized density model, where $p ( s _ { g } )$ is the partition function. Much of the appeal of contrastive learning is it avoids estimating the partition function [46], which can be challenging; in the RL setting, it will turn out that this constant can be ignored when selecting actions. Our experiments show that learning a normalized density model works well when $s _ { g }$ is low-dimensional, but struggles to solve higher-dimensional tasks.
+
+This lemma relates the critic function to $Q _ { s _ { f } } ^ { \pi ( \cdot | \cdot ) } ( s , a )$ , not $Q _ { s _ { f } } ^ { \pi ( \cdot | \cdot , s _ { f } ) } ( s , a )$ . The underlying reason is that the critic function combines together experience collected when commanding different goals. Prior goal-conditioned behavioral cloning methods [22, 41, 83, 120] perform similar sharing, but do not analyze the relationship between the learned policies and Q functions. Sec. 4.5 shows that this critic function can be used as the basis for a convergent RL algorithm under some assumptions.
+
+# 4.3 Learning the Goal-Conditioned Policy
+
+The learned critic function not only tells us the likelihood of future states, but also tells us how different actions change the likelihood of a state occurring in the future. Thus, to learn a policy for reaching a goal state, we choose the actions that make that state most likely to occur in the future:
+
+$$
+\operatorname* { m a x } _ { \pi ( a | s , s _ { g } ) } \mathbb { E } _ { \pi ( a | s , s _ { g } ) p ( s ) p ( s _ { g } ) } \left[ f ( s , a , s _ { f } = s _ { g } ) \right] \approx \mathbb { E } _ { \pi ( a | s , s _ { g } ) p ( s ) p ( s _ { g } ) } \left[ \log Q _ { s _ { g } } ^ { \pi ( \cdot | \cdot ) } ( s , a ) - \log p ( s _ { g } ) \right] .
+$$
+
+The approximation above reflects errors in learning the optimal critic, and will allow us to prove that this policy loss corresponds to policy improvement in Sec. 4.5, under some assumptions.
+
+In practice, we parametrize the goal-conditioned policy as a neural network that takes as input the state and goal and outputs a distribution over actions. The actor loss (Eq. 7) is computed by sampling states and random goals from the replay buffer, sampling actions from the policy, and then taking gradients on the policy using a reparametrization gradient. On tasks with image observations, we add an action entropy term to the policy objective.
+
+# 4.4 A Complete Goal-Conditioned RL Algorithm
+
+The complete algorithm alternates between fitting the critic function using contrastive learning, updating the policy using Eq. 7, and collecting more data. Alg. 1 provides a JAX [13] implementation of the actor and critic losses. Note that the critic is parameterized as an inner product between a representation of the state-action pair, and a representation of the goal state: $f ( s , \dot { a } , s _ { g } ) = \phi ( s , a ) ^ { T } \psi ( \dot { s } _ { g } )$ . This parameterization allows for efficient computation, as we can compute the goal representations just once, and use them both in the positive pairs and the negative pairs. While this is common practice in representation learning, it is not exploited by most goal-conditioned RL algorithms. We refer to this method as contrastive RL (NCE). In Appendix C, we derive a variant of this method (contrastive RL (CPC)) that uses the infoNCE bound on mutual information.
+
+Algorithm 1 Contrastive RL (NCE): the actor and critic losses for our method.
+
+from jax.numpy import einsum, eye
+from optax import sigmoid_binary_cross_entropy
+def critic_loss(states, actions, future_states): sa_repr $=$ sa_encoder(states, actions) # (batch_dim, repr_dim) g_repr $-$ g_encoder(future_states) # (batch_dim, repr_dim) logits $-$ einsum('ik,jk->ij', sa_repr, g_repr) # for all i,j return sigmoid_binary_cross_entropy(logits $=$ logits, labels $-$ eye(batch_size))
+
+def actor_loss(states, goals): actions $=$ policy.sample(states, goal $\mathbf { \Psi } =$ goals) # (batch_size, action_dim) sa_repr $=$ sa_encoder(states, actions) # (batch_dim, repr_dim) g_repr $-$ g_encoder(goals) # (batch_dim, repr_dim) logits $=$ einsum('ik,ik->i', sa_repr, g_repr) # return $^ { - 1 . 0 * }$ logits
+
+Contrastive RL (NCE) is an on-policy algorithm because it only estimates the Q-function for the policy that collected the data. However, in practice, we take as many gradient steps on each transition as standard off-policy RL algorithms [40, 48]. Please see Appendix E for full implementation details. We will also release an efficient implementation based on ACME [57] and JAX [13]. On a single TPUv2, training proceeds at $1 1 0 0 \frac { \mathrm { b a t c h e s } } { \mathrm { s e c } }$ for state-based tasks and $1 0 5 \frac { \mathrm { b a t c h e s } } { \mathrm { s e c } }$ for image-based tasks; for comparison, our implementation of $\mathrm { D r Q }$ on the same hardware setup runs at $2 8 \frac { \mathrm { b a t c h e s } } { \sec }$ $3 . 9 \times$ slower).6 Architectures and hyperparameters are described in Appendix E.7
+
+# 4.5 Convergence Guarantees
+
+In general, providing convergence guarantees for methods that perform relabeling is challenging. Most prior work offers no guarantees [6, 22, 23] or guarantees under only restrictive assumptions [41, 120].
+
+To prove that contrastive RL converges, we will introduce an additional filtering step into the method, throwing away some training examples. Precisely, we exclude training examples $( s , a , s _ { f } )$ if the probability of the corresponding trajectory $\tau _ { i : j } ~ = ~ ( s _ { i } , a _ { i } , s _ { i + 1 } , a _ { i + 1 } , \cdot \cdot \cdot ~ , s _ { j } , a _ { j } )$ sampled from $\pi ( \tau \mid s _ { g } )$ under the commanded goal $s _ { g }$ is very different from the trajectory’s probability under the actually-reached goal $s _ { j }$ :
+
+$$
+\mathrm { E x c L U D E T R A J } ( \tau _ { i : j } ) = \delta \left( \left| \frac { \pi ( \tau _ { i : j } \mid s _ { g } ) } { \pi ( \tau _ { i : j } \mid s _ { j } ) } - 1 \right| > \epsilon \right) .
+$$
+
+While this modification is necessary to prove convergence, ablation experiments in Appendix Fig. 13 show that the filtering step can actually hurt performance in practice, so we do not include this filtering step in the experiments in the main text. We can now prove that contrastive RL performs approximate policy improvement.
+
+Lemma 4.2 (Approximate policy improvement). Assume that states and actions are tabular and assume that the critic is Bayes-optimal. Let $\pi ^ { \prime } ( a \mid s , s _ { g } )$ be the goal-conditioned policy obtained after one iteration of contrastive $R L$ with a filtering parameter of ϵ. Then this policy achieves higher rewards than the initial goal-conditioned policy:
+
+$$
+\Sigma _ { \pi ^ { \prime } ( \tau | s _ { g } ) } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r _ { s _ { g } } ( s _ { t } , a _ { t } ) \right] \geq \mathbb { E } _ { \pi ( \tau | s _ { g } ) } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r _ { s _ { g } } ( s _ { t } , a _ { t } ) \right] - \frac { 2 \gamma \epsilon } { 1 - \gamma } ~ f o r a l l g o a l s ~ s _ { g } \in \left\{ s _ { g } ~ \left| ~ p _ { g } ( s _ { g } ) > 0 \right. \right\} ~ ,
+$$
+
+The proof is in Appendix B. This result shows that performing contrastive RL on static dataset results in one step of approximate policy improvement. Re-collecting data and then applying contrastive RL over and over again corresponds to approximate policy improvement (see [10, Lemma 6.2]).
+
+In summary, we have shown that applying contrastive learning to a particular choice of inputs results in an RL algorithm, one that learns a Q-function and (under some assumptions) converges to the reward-maximizing policy. Contrastive RL (NCE) is simple: it does not require multiple Q-values [40], target Q networks [88], data augmentation [69, 73], or auxiliary objectives [116, 137].
+
+
+Figure 2: Goal-conditioned RL. Contrastive RL (NCE) outperforms prior methods on most tasks. Baselines: HER [80] is a prototypical actor-critic method that uses hindsight relabeling [6]; Goal-conditioned behavioral cloning (GCBC) [22, 41, 83, 117] performs behavior cloning on relabeled experience; model-based fits a density model to the discounted state occupancy measure, similar on [21, 23, 60].
+
+# 4.6 C-learning as Contrastive Learning
+
+C-learning [29] is a special case of contrastive RL: it learns a critic function to distinguish future goals from random goals. Compared with contrastive RL (NCE), C-learning learns the classifier using temporal difference learning.8 Viewing C-learning as a special case of contrastive RL suggests that contrastive RL algorithms might be implemented in a variety of different ways, each with relative merits. For example, contrastive RL (NCE) is much simpler than C-learning and tends to perform a bit better. Appendix D introduces another member of the contrastive RL family (contrastive RL (NCE + C-learning)) that tends to yield the best performance .
+
+# 5 Experiments
+
+Our experiments use goal-conditioned RL problems to compare contrastive RL algorithms to prior non-contrastive methods, including those that use data augmentation and auxiliary objectives. We then compare different members of the contrastive RL family, and show how contrastive RL can be effectively applied to the offline RL setting. Appendices E, F, and G contain experiments, visualizations, and failed experiments.
+
+# 5.1 Comparing to prior goal-conditioned RL methods
+
+Baselines. We compare three baselines. “HER” [80] is a goal-conditioned RL method that uses hindsight relabeling [6] with a high-performance actor-critic algorithm (TD3). This baseline is representative of a large class of prior work that uses hindsight relabeling [6, 76, 102, 106]. Like contrastive RL, this baseline does not assume access to a reward function. The second baseline is
+
+
+Figure 3: Environments. We show a subset of the goal-conditioned environments used in our experiments.
+
+goal-conditioned behavioral cloning (“GCBC”) [16, 22, 25, 41, 83, 96, 117, 120], which trains a policy to reach goal $s _ { g }$ by performing behavioral cloning on trajectories that reach state $s _ { g }$ . GCBC is a simple method that achieves excellent results [16, 25] and has the same inputs as our method $( ( s , a , s _ { f } )$ triplets). A third baseline is a model-based approach that fits a density model to the future state distribution $p ^ { \pi ( \cdot | \cdot ) } ( s _ { t + } \mid s , a )$ and trains a goal-conditioned policy to maximize the probability of the commanded goal. This baseline is similar to successor representations [21] and prior multi-step models [23, 60]. Both contrastive RL (Alg. 1) and this model-based approach encode the future state distribution, but the output dimension of this model-based method depends on the state dimension. We, therefore, expect this approach to excel in low-dimensional settings but struggle with image-based tasks. Where possible, we use the same hyperparameters for all methods. We will include additional representation learning baselines when studying representations in the subsequent section.
+
+
+Figure 4: Representation learning for image-based tasks. While adding data augmentation and auxiliary representation objectives can boost the performance of the $_ { \mathrm { T D } 3 + \mathrm { H E R } }$ baseline, replacing the underlying goalconditioned RL algorithm with one that resembles contrastive representation learning (i.e., ours) yields a larger increase in success rates. Baselines: $\mathtt { D r Q }$ [69] augments images and averages the Q-values across 4 augmentations; auto encoder (AE) adds an auxiliary reconstruction loss [32, 91, 93, 137]; CURL [116] applies RL on top of representations learned via augmentation-based contrastive learning.
+
+Tasks. We compare it to a suite of goal-conditioned tasks, mostly taken from prior work. Four standard manipulation tasks include fetch reach and fetch push from Plappert et al. [97] and sawyer push and sawyer bin from Yu et al. [139]. We evaluate these tasks both with state-based observations and (unlike most prior work) image-based observations. The sawyer bin task poses an exploration challenge, as the agent must learn to pick up an object from one bin and place it at a goal location in another bin; the agent does not receive any reward shaping or demonstrations. We include two navigation tasks: point Spiral11x11 is a 2D maze task with image observations and ant umaze [36] is a 111-dimensional locomotion task that presents a challenging low-level control problem. Where possible, we use the same initial state distribution, goal distribution, observations, and definition of success as prior work. Goals have the same dimension as the states, with one exception: on the ant umaze task, we used the global $X Y$ position as the goal. We illustrate three of the tasks to the right. The agent does not have access to any ground truth reward function.
+
+We report results in Fig. 2, using five random seeds for each experiment and plotting the mean and standard deviation across those random seeds. On the state-based tasks (Fig. 2a), most methods solve the easiest task (fetch reach) while only our method solves the most challenging task (sawyer bin). Our method also outperforms all prior methods on the two pushing tasks. The model-based baseline performs best on the ant umaze task, likely because learning a model is relatively easy when the goal is lower-dimensional (just the $X Y$ location). On the image-based tasks (Fig. 2b), most methods make progress on the two easiest tasks (fetch reach and point Spiral11x11); our method outperforms the baselines on the three more challenging tasks. Of particular note is the success on sawyer push and sawyer bin: while the success rate of our method remains below $50 \%$ , no baselines make any progress on learning these tasks. These results suggest that contrastive RL (NCE) is a competitive goal-conditioned RL algorithm.
+
+# 5.2 Comparing to prior representation learning methods
+
+We hypothesize that contrastive RL may automatically learn good representations. To test this hypothesis, we compare contrastive RL (NCE) to techniques proposed by prior work for representation learning. These include data augmentation [69, 73, 136] (“DrQ”) and auxiliary objectives based on an autoencoder [32, 91, 93, 137] (“AE”) and a contrastive learning objective (“CURL”) that generates positive examples using data augmentation, similar to prior work [89, 116, 118]. Because prior work has demonstrated these techniques in combination with actor-critic RL algorithms, we will use these techniques in combination with the actor-critic baseline from the previous section $( ^ { 6 6 } \mathrm { T D } 3 + \mathrm { H E R } ^ { \prime \prime } )$ ). While contrastive RL (NCE) resembles a contrastive representation learning method, it does not include any data augmentation or auxiliary representation learning objectives.
+
+We show results in Fig. 4, with error bars again showing the mean and standard deviation across 5 random seeds. While adding the autoencoder improves the baseline on the fetch reach and adding DrQ improves the baseline on the sawyer push, contrastive RL (NCE) outperforms the prior methods on all tasks. Unlike these methods, contrastive RL does not use auxiliary objectives or additional domain knowledge in the form of image-appropriate data augmentations. These experiments do not show that representation learning is never useful, and do not show that contrastive
+
+
+Figure 5: Contrastive RL design decisions. Generalizing C-learning to a family of contrastive RL algorithms allowed us to identify algorithms that are much simpler (contrastive RL (NCE)) and that consistently achieve higher performance (contrastive RL $\mathrm { N C E } + \mathrm { C } .$ -learning)).
+
+RL cannot be improved with additional representation learning machinery. Rather, they show that designing RL algorithms that structurally resemble contrastive representation learning yields bigger improvements than simply adding representation learning tricks on top of existing RL algorithms.
+
+# 5.3 Probing the dimensions of contrastive RL
+
+Up to now, we have focused on the specific instantiation of contrastive RL spelled out in Alg. 1. However, there is a whole family of RL algorithms with contrastive characteristics. C-learning is a contrastive RL algorithm that uses temporal difference learning (Sec. 4.6). Contrastive RL (CPC) is a variant of Alg. 1 based on the infoNCE objective [95] that we derive in Appendix C Contrastive RL $\mathrm { \Delta N C E + C }$ -learning) is a variant that combines C-learning with Alg. D (see Appendix D.). The aim of these experiments are to study whether generalizing C-learning to a family of contrastive RL algorithms was useful: do the simpler methods achieve similar performance, and do other methods achieve better performance?
+
+We present results in Fig. 5, again plotting the mean and standard deviation across five random seeds. Contrastive RL (CPC) outperforms contrastive RL (NCE) on three, suggesting that swapping one mutual information estimator for another can sometimes improve performance, though both estimators can be effective. C-learning outperforms contrastive RL (NCE) on three tasks but performs worse on other tasks. Contrastive RL $\mathrm { \mathrm { N C E } } + \mathrm { C } .$ -learning) consistently ranks among the best methods. These experiments demonstrate that the prior contrastive RL method, C-learning [29], achieves good results on most tasks; generalizing C-learning to a family of contrastive RL algorithms resulting in new algorithms that achieve higher performance and can be much simpler.
+
+# 5.4 Partial Observability and Moving Cameras
+
+Many realistic robotics tasks exhibit partial observability, and have cameras that are not fixed but rather attached to moving robot parts. Our next experiment tests if contrastive RL can cope with these sorts of challenges. To study this question, we modified the sawyer push task so that the camera tracks the hand at a fixed distance, as if it were rigidly mounted to the arm. This means that, at the start of the episode, the scene is occluded by the wall at the edge of the table, so the agent cannot see the location of the puck (see Fig. 6 (left)). Nonetheless, contrastive RL (NCE) successfully handles this partial observability, achieving a success rate of around $3 5 \%$ . Fig. 6 (left) shows an example rollout and Fig. 6 (right) shows the learning curve. For comparison, the success rate when using the fixed static camera was $7 5 \%$ . Taken together, these results suggest that contrastive RL can cope with moving cameras and partial observability, while also suggesting that improved strategies (e.g., non-Markovian architectures) might achieve even better results.
+
+
+Figure 6: Partial observability and moving cameras. Contrastive RL can solve partially observed tasks.
+
+Table 1: Offline RL on D4RL AntMaze [36]. Contrastive RL outperforms all baselines in 5 out of 6 tasks.
+
+
no TD
uses TD
BC
DT
GCBC
ContrastiveRL + BC 2 nets
5 nets
TD3+BC*
IQL*
umaze-v2
54.6
65.6
65.4
81.9 (±1.7)
79.8 (±1.4)
78.6
87.5
umaze-diverse-v2
45.6
51.2
60.9
75.4 (±3.5)
77.6 (±2.8)
71.4
62.2
medium-play-v2
0.0
1.0
58.1
71.5 (±5.2)
72.6 (±2.9)
10.6
71.2
medium-diverse-v2
0.0
0.6
67.3
72.5 (±2.8)
71.5 (±1.3)
3.0
70.0
large-play-v2
0.0
0.0
32.4
41.6 (±6.0)
48.6 (±4.4)
0.2
39.6
large-diverse-v2
0.0
0.2
36.9
49.3 (±6.3)
54.1 (±5.5)
0.0
47.5
* While TD3+BCand IQLreport results onthe-vO tasks,the change to-v2 has anegligible effecton TD methods [8].
+
+# 5.5 Contrastive RL for Offline RL
+
+Our final experiment studies whether the benefits from contrastive RL (NCE) transfer to the offline RL setting, where the agent is prohibited from interacting with the environment. We use the benchmark AntMaze tasks from the D4RL benchmark [36], as these are goal-conditioned tasks commonly studied in the offline setting.
+
+We adapt contrastive RL (NCE) to the offline setting by adding an additional (goal-conditioned) behavioral cloning term to the policy objective (Eq. 7), using a coefficient of $\lambda$ :
+
+$$
+\operatorname* { m a x } _ { \pi ( a \mid s , s _ { g } ) } \mathbb { E } _ { \pi ( a \mid s , s _ { g } ) p ( s , a _ { \mathrm { o i g } } , s _ { g } ) } \left[ ( 1 - \lambda ) \cdot f ( s , a , s _ { f } = s _ { g } ) + \lambda \cdot \log \pi ( a _ { \mathrm { o i g } } \mid s , s _ { g } ) \right] .
+$$
+
+Note that setting $\lambda = 1$ corresponds to GCBC [16, 22, 25, 41, 83, 96, 117, 120], which we will include as a baseline. Following $\mathrm { T D } 3 { + } \mathrm { B C }$ [39], we learn multiple critic functions (2 and 5) and take the minimum when computing the actor update. We also compare to prior offline RL methods that eschew TD learning: (unconditional) behavioral cloning (BC), the implementation of GCBC from [25] (which refers to GCBC as RvS-G), and a recent method based on the transformer architecture (DT [16]). Lastly, we compare with two more complex methods that use TD learning: $\mathrm { T D } 3 { + } \mathrm { B C }$ [39] and IQL [68]. Unlike contrastive RL and GCBC, these TD learning methods do not perform goal relabeling. We use the numbers reported for these baselines in prior work [25, 68].
+
+As shown in Table 1, contrastive RL (NCE) outperforms all baselines on five of the six benchmark tasks. Of particular note are the most challenging “-large” tasks, where contrastive RL achieves a $7 \%$ to $9 \%$ absolute improvement over IQL. We note that IQL does not use goal relabeling, which is the bedrock of contrastive RL. Compared to baselines that do not use TD learning, the benefits are more pronounced, with a median (absolute) improvement over GCBC of $15 \%$ . The performance of contrastive RL improves when increasing the number of critics from 2 to 5, suggesting that the key to solving more challenging offline RL tasks may be increased capacity, rather than TD learning. Taken together, these results show the value of contrastive RL for offline goal-conditioned tasks.
+
+# 6 Conclusion
+
+In this paper, we showed how contrastive representation learning can be used for goal-conditioned RL. This connection not only lets us re-interpret a prior RL method as performing contrastive learning, but also suggests a family of contrastive RL methods, which includes simpler algorithms, as well as algorithms that attain better overall performance. While this paper might be construed to imply that RL is more or less important than representation learning [72, 75, 112, 114], we have a different takeaway: that it may be enough to build RL algorithms that look like representation learning.
+
+One limitation of this work is that it looks only at the goal-conditioned RL problems. How these methods might be applied to arbitrary RL problems remains an open problem, though we note that recent algorithms for this setting [28] already bear a resemblance to contrastive RL. Whether the rich set of ideas from contrastive learning might be used to construct even better RL algorithms likewise remains an open question.
+
+Acknowledgements. Thanks to Hubert Tsai, Martin Ma, and Simon Kornblith for discussions about contrastive learning. Thanks to Kamyar Ghasemipour, Suraj Nair, and anonymous reviewers for feedback on the paper. Thanks to Ofir Nachum, Daniel Zheng, and the JAX and Acme teams for helping to release and debug the code. This material is supported by the Fannie and John Hertz Foundation and the NSF GRFP (DGE1745016). UC Berkeley research is also supported by gifts from Alibaba, Amazon Web Services, Ant Financial, CapitalOne, Ericsson, Facebook, Futurewei, Google, Intel, Microsoft, Nvidia, Scotiabank, Splunk and VMware.
+
+References
+[1] Achiam, J., Edwards, H., Amodei, D., and Abbeel, P. (2018). Variational option discovery algorithms. arXiv preprint arXiv:1807.10299.
+[2] Achiam, J., Knight, E., and Abbeel, P. (2019). Towards characterizing divergence in deep Q-learning. arXiv preprint arXiv:1903.08894.
+[3] Alain, G. and Bengio, Y. (2016). Understanding intermediate layers using linear classifier probes. arXiv preprint arXiv:1610.01644.
+[4] Anand, A., Racah, E., Ozair, S., Bengio, Y., Côté, M.-A., and Hjelm, R. D. (2019). Unsupervised state representation learning in Atari. Advances in Neural Information Processing Systems, 32.
+[5] Andreas, J., Klein, D., and Levine, S. (2017). Modular multitask reinforcement learning with policy sketches. In International Conference on Machine Learning, pages 166–175. PMLR.
+[6] Andrychowicz, M., Crow, D., Ray, A., Schneider, J., Fong, R., Welinder, P., McGrew, B., Tobin, J., Abbeel, P., and Zaremba, W. (2017). Hindsight experience replay. In NeurIPS.
+[7] Annasamy, R. M. and Sycara, K. (2019). Towards better interpretability in deep Q-networks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 4561–4569.
+[8] Authors, I. (2022). Private Communication.
+[9] Barreto, A., Dabney, W., Munos, R., Hunt, J. J., Schaul, T., van Hasselt, H. P., and Silver, D. (2017). Successor features for transfer in reinforcement learning. Advances in neural information processing systems, 30.
+[10] Bertsekas, D. P. and Tsitsiklis, J. N. (1996). Neuro-dynamic programming. Athena Scientific.
+[11] Blier, L., Tallec, C., and Ollivier, Y. (2021). Learning successor states and goal-dependent values: A mathematical viewpoint. arXiv preprint arXiv:2101.07123.
+[12] Borsa, D., Barreto, A., Quan, J., Mankowitz, D., Munos, R., Van Hasselt, H., Silver, D., and Schaul, T. (2018). Universal successor features approximators. arXiv preprint arXiv:1812.07626.
+[13] Bradbury, J., Frostig, R., Hawkins, P., Johnson, M. J., Leary, C., Maclaurin, D., Necula, G., Paszke, A., VanderPlas, J., Wanderman-Milne, S., and Zhang, Q. (2018). JAX: composable transformations of Python+NumPy programs.
+[14] Brown, D., Goo, W., Nagarajan, P., and Niekum, S. (2019). Extrapolating beyond suboptimal demonstrations via inverse reinforcement learning from observations. In International conference on machine learning, pages 783–792. PMLR.
+[15] Chane-Sane, E., Schmid, C., and Laptev, I. (2021). Goal-conditioned reinforcement learning with imagined subgoals. In International Conference on Machine Learning, pages 1430–1440. PMLR.
+[16] Chen, L., Lu, K., Rajeswaran, A., Lee, K., Grover, A., Laskin, M., Abbeel, P., Srinivas, A., and Mordatch, I. (2021). Decision transformer: Reinforcement learning via sequence modeling. Advances in neural information processing systems, 34.
+[17] Chen, T., Kornblith, S., Norouzi, M., and Hinton, G. E. (2020). A simple framework for contrastive learning of visual representations. ArXiv, abs/2002.05709.
+[18] Chen, X. and He, K. (2021). Exploring simple siamese representation learning. 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 15745–15753.
+[19] Choi, J., Sharma, A., Lee, H., Levine, S., and Gu, S. S. (2021). Variational empowerment as representation learning for goal-conditioned reinforcement learning. In International Conference on Machine Learning, pages 1953–1963. PMLR.
+[20] Christiano, P., Leike, J., Brown, T. B., Martic, M., Legg, S., and Amodei, D. (2017). Deep reinforcement learning from human preferences. arXiv preprint arXiv:1706.03741.
+[21] Dayan, P. (1993). Improving generalization for temporal difference learning: The successor representation. Neural Computation, 5(4):613–624.
+[22] Ding, Y., Florensa, C., Abbeel, P., and Phielipp, M. (2019). Goal-conditioned imitation learning. Advances in Neural Information Processing Systems, 32:15324–15335.
+[23] Dosovitskiy, A. and Koltun, V. (2016). Learning to act by predicting the future. arXiv preprint arXiv:1611.01779.
+[24] Du, Y., Gan, C., and Isola, P. (2021). Curious representation learning for embodied intelligence. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 10408–10417.
+[25] Emmons, S., Eysenbach, B., Kostrikov, I., and Levine, S. (2021). Rvs: What is essential for offline rl via supervised learning? arXiv preprint arXiv:2112.10751.
+[26] Eysenbach, B., Geng, X., Levine, S., and Salakhutdinov, R. (2020). Rewriting history with inverse RL: Hindsight inference for policy improvement. ArXiv, abs/2002.11089.
+[27] Eysenbach, B., Gupta, A., Ibarz, J., and Levine, S. (2018). Diversity is all you need: Learning skills without a reward function. In International Conference on Learning Representations.
+[28] Eysenbach, B., Levine, S., and Salakhutdinov, R. R. (2021a). Replacing rewards with examples: Examplebased policy search via recursive classification. Advances in Neural Information Processing Systems, 34.
+[29] Eysenbach, B., Salakhutdinov, R., and Levine, S. (2021b). C-learning: Learning to achieve goals via recursive classification. ArXiv, abs/2011.08909.
+[30] Eysenbach, B., Salakhutdinov, R. R., and Levine, S. (2019). Search on the replay buffer: Bridging planning and reinforcement learning. Advances in Neural Information Processing Systems, 32.
+[31] Eysenbach, B., Udatha, S., Levine, S., and Salakhutdinov, R. (2022). Imitating past successes can be very suboptimal. arXiv preprint arXiv:2206.03378.
+[32] Finn, C., Tan, X. Y., Duan, Y., Darrell, T., Levine, S., and Abbeel, P. (2016). Deep spatial autoencoders for visuomotor learning. In 2016 IEEE International Conference on Robotics and Automation (ICRA), pages 512–519. IEEE.
+[33] Fischinger, D., Vincze, M., and Jiang, Y. (2013). Learning grasps for unknown objects in cluttered scenes. In 2013 IEEE international conference on robotics and automation, pages 609–616. IEEE.
+[34] Florensa, C., Degrave, J., Heess, N., Springenberg, J. T., and Riedmiller, M. (2019). Self-supervised learning of image embedding for continuous control. arXiv preprint arXiv:1901.00943.
+[35] Florensa, C., Held, D., Geng, X., and Abbeel, P. (2018). Automatic goal generation for reinforcement learning agents. In International conference on machine learning, pages 1515–1528. PMLR.
+[36] Fu, J., Kumar, A., Nachum, O., Tucker, G., and Levine, S. (2020). D4RL: Datasets for deep data-driven reinforcement learning. arXiv preprint arXiv:2004.07219.
+[37] Fu, J., Luo, K., and Levine, S. (2017). Learning robust rewards with adversarial inverse reinforcement learning. arXiv preprint arXiv:1710.11248.
+[38] Fu, J., Singh, A., Ghosh, D., Yang, L., and Levine, S. (2018). Variational inverse control with events: A general framework for data-driven reward definition. In NeurIPS.
+[39] Fujimoto, S. and Gu, S. S. (2021). A minimalist approach to offline reinforcement learning. Advances in Neural Information Processing Systems, 34.
+[40] Fujimoto, S., Hoof, H., and Meger, D. (2018). Addressing function approximation error in actor-critic methods. In International conference on machine learning, pages 1587–1596. PMLR.
+[41] Ghosh, D., Gupta, A., Reddy, A., Fu, J., Devin, C. M., Eysenbach, B., and Levine, S. (2020). Learning to reach goals via iterated supervised learning. In International Conference on Learning Representations.
+[42] Gregor, K., Rezende, D. J., and Wierstra, D. (2016). Variational intrinsic control. arXiv preprint arXiv:1611.07507.
+[43] Grill, J.-B., Strub, F., Altch’e, F., Tallec, C., Richemond, P. H., Buchatskaya, E., Doersch, C., Pires, B. Á., Guo, Z. D., Azar, M. G., Piot, B., Kavukcuoglu, K., Munos, R., and Valko, M. (2020). Bootstrap your own latent: A new approach to self-supervised learning. ArXiv, abs/2006.07733.
+[44] Guo, Z. D., Azar, M. G., Piot, B., Pires, B. A., and Munos, R. (2018). Neural predictive belief representations. arXiv preprint arXiv:1811.06407.
+[45] Guo, Z. D., Pires, B. A., Piot, B., Grill, J.-B., Altché, F., Munos, R., and Azar, M. G. (2020). Bootstrap latent-predictive representations for multitask reinforcement learning. In International Conference on Machine Learning, pages 3875–3886. PMLR.
+[46] Gutmann, M. U. and Hyvärinen, A. (2012). Noise-contrastive estimation of unnormalized statistical models, with applications to natural image statistics. Journal of machine learning research, 13(2).
+[47] Ha, D. and Schmidhuber, J. (2018). World models. arXiv preprint arXiv:1803.10122.
+[48] Haarnoja, T., Zhou, A., Abbeel, P., and Levine, S. (2018). Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In International conference on machine learning, pages 1861–1870. PMLR.
+[49] Hafner, D., Lillicrap, T., Ba, J., and Norouzi, M. (2019a). Dream to control: Learning behaviors by latent imagination. arXiv preprint arXiv:1912.01603.
+[50] Hafner, D., Lillicrap, T., Fischer, I., Villegas, R., Ha, D., Lee, H., and Davidson, J. (2019b). Learning latent dynamics for planning from pixels. In International conference on machine learning, pages 2555–2565. PMLR.
+[51] Han, T., Xie, W., and Zisserman, A. (2020). Self-supervised co-training for video representation learning. Advances in Neural Information Processing Systems, 33:5679–5690.
+[52] Hansen, S., Dabney, W., Barreto, A., Van de Wiele, T., Warde-Farley, D., and Mnih, V. (2019). Fast task inference with variational intrinsic successor features. arXiv preprint arXiv:1906.05030.
+[53] He, K., Fan, H., Wu, Y., Xie, S., and Girshick, R. (2020). Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9729–9738.
+[54] Hjelm, R. D., Fedorov, A., Lavoie-Marchildon, S., Grewal, K., Bachman, P., Trischler, A., and Bengio, Y. (2018). Learning deep representations by mutual information estimation and maximization. arXiv preprint arXiv:1808.06670.
+[55] Ho, J. and Ermon, S. (2016). Generative adversarial imitation learning. Advances in neural information processing systems, 29:4565–4573.
+[56] Hoffer, E. and Ailon, N. (2015). Deep metric learning using triplet network. In International workshop on similarity-based pattern recognition, pages 84–92. Springer.
+[57] Hoffman, M., Shahriari, B., Aslanides, J., Barth-Maron, G., Behbahani, F., Norman, T., Abdolmaleki, A., Cassirer, A., Yang, F., Baumli, K., Henderson, S., Novikov, A., Colmenarejo, S. G., Cabi, S., Gulcehre, C., Paine, T. L., Cowie, A., Wang, Z., Piot, B., and de Freitas, N. (2020). Acme: A research framework for distributed reinforcement learning. arXiv preprint arXiv:2006.00979.
+[58] Hong, Z.-W., Yang, G., and Agrawal, P. (2022). Bilinear value networks. arXiv preprint arXiv:2204.13695.
+[59] Ichter, B., Sermanet, P., and Lynch, C. (2020). Broadly-exploring, local-policy trees for long-horizon task planning. arXiv preprint arXiv:2010.06491.
+[60] Janner, M., Mordatch, I., and Levine, S. (2020). gamma-models: Generative temporal difference learning for infinite-horizon prediction. Advances in Neural Information Processing Systems, 33:1724–1735.
+[61] Jozefowicz, R., Vinyals, O., Schuster, M., Shazeer, N., and Wu, Y. (2016). Exploring the limits of language modeling. arXiv preprint arXiv:1602.02410.
+[62] Kaelbling, L. P. (1993). Learning to achieve goals. In IJCAI, pages 1094–1099. Citeseer.
+[63] Kalashnikov, D., Varley, J., Chebotar, Y., Swanson, B., Jonschkowski, R., Finn, C., Levine, S., and Hausman, K. (2021). Mt-opt: Continuous multi-task robotic reinforcement learning at scale. ArXiv, abs/2104.08212.
+[64] Kish, L. (1965). Survey sampling. John Wiley & Sons.
+[65] Klingemann, M. (2016). Raster fairy. https://github.com/bmcfee/RasterFairy.
+[66] Konda, V. and Tsitsiklis, J. (1999). Actor-critic algorithms. Advances in neural information processing systems, 12.
+[67] Konyushkova, K., Zolna, K., Aytar, Y., Novikov, A., Reed, S., Cabi, S., and de Freitas, N. (2020). Semi-supervised reward learning for offline reinforcement learning. arXiv preprint arXiv:2012.06899.
+[68] Kostrikov, I., Nair, A., and Levine, S. (2021). Offline reinforcement learning with implicit Q-learning. arXiv preprint arXiv:2110.06169.
+[69] Kostrikov, I., Yarats, D., and Fergus, R. (2020). Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. arXiv preprint arXiv:2004.13649.
+[70] Kumar, A., Agarwal, R., Ghosh, D., and Levine, S. (2020). Implicit under-parameterization inhibits data-efficient deep reinforcement learning. arXiv preprint arXiv:2010.14498.
+[71] Lange, S. and Riedmiller, M. (2010). Deep auto-encoder neural networks in reinforcement learning. In The 2010 International Joint Conference on Neural Networks (IJCNN), pages 1–8. IEEE.
+[72] Langford, J. (2010). Specializations of the master problem.
+[73] Laskin, M., Lee, K., Stooke, A., Pinto, L., Abbeel, P., and Srinivas, A. (2020). Reinforcement learning with augmented data. Advances in Neural Information Processing Systems, 33:19884–19895.
+[74] Laskin, M., Liu, H., Peng, X. B., Yarats, D., Rajeswaran, A., and Abbeel, P. (2021). CIC: Contrastive intrinsic control for unsupervised skill discovery. In Deep RL Workshop NeurIPS 2021.
+[75] LeCun, Y. (2016). Predictive learning. https://www.youtube.com/watch?v $=$ Ount2Y4qxQo. Keynote Talk.
+[76] Levy, A., Konidaris, G., Platt, R., and Saenko, K. (2017). Learning multi-level hierarchies with hindsight. arXiv preprint arXiv:1712.00948.
+[77] Levy, O. and Goldberg, Y. (2014). Neural word embedding as implicit matrix factorization. Advances in neural information processing systems, 27.
+[78] Li, A., Pinto, L., and Abbeel, P. (2020). Generalized hindsight for reinforcement learning. Advances in neural information processing systems, 33:7754–7767.
+[79] Liang, Y., Machado, M. C., Talvitie, E., and Bowling, M. (2015). State of the art control of Atari games using shallow reinforcement learning. arXiv preprint arXiv:1512.01563.
+[80] Lin, X., Baweja, H. S., and Held, D. (2019). Reinforcement learning without ground-truth state. ArXiv, abs/1905.07866.
+[81] Liu, H. and Abbeel, P. (2021). Aps: Active pretraining with successor features. In International Conference on Machine Learning, pages 6736–6747. PMLR.
+[82] Liu, K., Kurutach, T., Tung, C., Abbeel, P., and Tamar, A. (2020). Hallucinative topological memory for zero-shot visual planning. In International Conference on Machine Learning, pages 6259–6270. PMLR.
+[83] Lynch, C., Khansari, M., Xiao, T., Kumar, V., Tompson, J., Levine, S., and Sermanet, P. (2020). Learning latent plans from play. In Conference on Robot Learning, pages 1113–1132. PMLR.
+[84] Ma, Z. and Collins, M. (2018). Noise contrastive estimation and negative sampling for conditional models: Consistency and statistical efficiency. In EMNLP.
+[85] Mendonca, R., Rybkin, O., Daniilidis, K., Hafner, D., and Pathak, D. (2021). Discovering and achieving goals via world models. Advances in Neural Information Processing Systems, 34.
+[86] Mikolov, T., Sutskever, I., Chen, K., Corrado, G. S., and Dean, J. (2013). Distributed representations of words and phrases and their compositionality. Advances in neural information processing systems, 26.
+[87] Mnih, A. and Teh, Y. W. (2012). A fast and simple algorithm for training neural probabilistic language models. In ICML.
+[88] Mnih, V., Kavukcuoglu, K., Silver, D., Graves, A., Antonoglou, I., Wierstra, D., and Riedmiller, M. (2013). Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602.
+[89] Nachum, O., Gu, S., Lee, H., and Levine, S. (2018a). Near-optimal representation learning for hierarchical reinforcement learning. In International Conference on Learning Representations.
+[90] Nachum, O., Gu, S. S., Lee, H., and Levine, S. (2018b). Data-efficient hierarchical reinforcement learning. Advances in neural information processing systems, 31.
+[91] Nair, A. V., Pong, V., Dalal, M., Bahl, S., Lin, S., and Levine, S. (2018). Visual reinforcement learning with imagined goals. Advances in Neural Information Processing Systems, 31:9191–9200.
+[92] Nair, S., Mitchell, E., Chen, K., Savarese, S., Finn, C., et al. (2022). Learning language-conditioned robot behavior from offline data and crowd-sourced annotation. In Conference on Robot Learning, pages 1303–1315. PMLR.
+[93] Nasiriany, S., Pong, V. H., Lin, S., and Levine, S. (2019). Planning with goal-conditioned policies. In NeurIPS.
+[94] Nowozin, S., Cseke, B., and Tomioka, R. (2016). f-GAN: Training generative neural samplers using variational divergence minimization. Advances in neural information processing systems, 29.
+[95] Oord, A. v. d., Li, Y., and Vinyals, O. (2018). Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748.
+[96] Paster, K., McIlraith, S. A., and Ba, J. (2020). Planning from pixels using inverse dynamics models. arXiv preprint arXiv:2012.02419.
+[97] Plappert, M., Andrychowicz, M., Ray, A., McGrew, B., Baker, B., Powell, G., Schneider, J., Tobin, J., Chociej, M., Welinder, P., et al. (2018). Multi-goal reinforcement learning: Challenging robotics environments and request for research. arXiv preprint arXiv:1802.09464.
+[98] Pong, V. H., Dalal, M., Lin, S., Nair, A., Bahl, S., and Levine, S. (2019). Skew-fit: State-covering self-supervised reinforcement learning. arXiv preprint arXiv:1903.03698.
+[99] Poole, B., Ozair, S., Van Den Oord, A., Alemi, A., and Tucker, G. (2019). On variational bounds of mutual information. In International Conference on Machine Learning, pages 5171–5180. PMLR.
+[100] Qiu, S., Wang, L., Bai, C., Yang, Z., and Wang, Z. (2022). Contrastive ucb: Provably efficient contrastive self-supervised learning in online reinforcement learning. In International Conference on Machine Learning, pages 18168–18210. PMLR.
+[101] Rakelly, K., Gupta, A., Florensa, C., and Levine, S. (2021). Which mutual-information representation learning objectives are sufficient for control? ArXiv, abs/2106.07278.
+[102] Riedmiller, M., Hafner, R., Lampe, T., Neunert, M., Degrave, J., Wiele, T., Mnih, V., Heess, N., and Springenberg, J. T. (2018). Learning by playing solving sparse reward tasks from scratch. In International conference on machine learning, pages 4344–4353. PMLR.
+[103] Rudner, T. G., Pong, V., McAllister, R., Gal, Y., and Levine, S. (2021). Outcome-driven reinforcement learning via variational inference. Advances in Neural Information Processing Systems, 34.
+[104] Rybkin, O., Zhu, C., Nagabandi, A., Daniilidis, K., Mordatch, I., and Levine, S. (2021). Model-based reinforcement learning via latent-space collocation. In International Conference on Machine Learning, pages 9190–9201. PMLR.
+[105] Savinov, N., Dosovitskiy, A., and Koltun, V. (2018). Semi-parametric topological memory for navigation. In International Conference on Learning Representations.
+[106] Schaul, T., Horgan, D., Gregor, K., and Silver, D. (2015). Universal value function approximators. In International conference on machine learning, pages 1312–1320. PMLR.
+[107] Schmeckpeper, K., Xie, A., Rybkin, O., Tian, S., Daniilidis, K., Levine, S., and Finn, C. (2020). Learning predictive models from observation and interaction. In European Conference on Computer Vision, pages 708–725. Springer.
+[108] Schroff, F., Kalenichenko, D., and Philbin, J. (2015). Facenet: A unified embedding for face recognition and clustering. 2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 815–823.
+[109] Sermanet, P., Lynch, C., Chebotar, Y., Hsu, J., Jang, E., Schaal, S., Levine, S., and Brain, G. (2018). Time-contrastive networks: Self-supervised learning from video. In 2018 IEEE international conference on robotics and automation (ICRA), pages 1134–1141. IEEE.
+[110] Sharma, A., Gu, S., Levine, S., Kumar, V., and Hausman, K. (2019). Dynamics-aware unsupervised discovery of skills. In International Conference on Learning Representations.
+[111] Shu, R., Nguyen, T., Chow, Y., Pham, T., Than, K., Ghavamzadeh, M., Ermon, S., and Bui, H. (2020). Predictive coding for locally-linear control. In International Conference on Machine Learning, pages 8862–8871. PMLR.
+[112] Silver, D., Singh, S., Precup, D., and Sutton, R. S. (2021). Reward is enough. Artificial Intelligence, 299:103535.
+[113] Sohn, K. (2016). Improved deep metric learning with multi-class n-pair loss objective. In NeurIPS.
+[114] Srinivas, A. and Abbeel, P. (2021). Unsupervised learning for reinforcement learning. Tutorial.
+[115] Srinivas, A., Jabri, A., Abbeel, P., Levine, S., and Finn, C. (2018). Universal planning networks. ArXiv, abs/1804.00645.
+[116] Srinivas, A., Laskin, M., and Abbeel, P. (2020). Curl: Contrastive unsupervised representations for reinforcement learning. arXiv preprint arXiv:2004.04136.
+[117] Srivastava, R. K., Shyam, P., Mutz, F., Jaskowski, W., and Schmidhuber, J. (2019). Training agents using ´ upside-down reinforcement learning. arXiv preprint arXiv:1912.02877.
+[118] Stooke, A., Lee, K., Abbeel, P., and Laskin, M. (2021). Decoupling representation learning from reinforcement learning. In International Conference on Machine Learning, pages 9870–9879. PMLR.
+[119] Such, F. P., Madhavan, V., Liu, R., Wang, R., Castro, P. S., Li, Y., Zhi, J., Schubert, L., Bellemare, M. G., Clune, J., et al. (2018). An atari model zoo for analyzing, visualizing, and comparing deep reinforcement learning agents. arXiv preprint arXiv:1812.07069.
+[120] Sun, H., Li, Z., Liu, X., Zhou, B., and Lin, D. (2019). Policy continuation with hindsight inverse dynamics. Advances in Neural Information Processing Systems, 32:10265–10275.
+[121] Teh, Y., Bapst, V., Czarnecki, W. M., Quan, J., Kirkpatrick, J., Hadsell, R., Heess, N., and Pascanu, R. (2017). Distral: Robust multitask reinforcement learning. Advances in neural information processing systems, 30.
+[122] Tian, Y., Krishnan, D., and Isola, P. (2020). Contrastive multiview coding. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XI 16, pages 776–794. Springer.
+[123] Tsai, Y.-H., Zhao, H., Yamada, M., Morency, L.-P., and Salakhutdinov, R. (2020). Neural methods for point-wise dependency estimation. In Proceedings of the Neural Information Processing Systems Conference (Neurips).
+[124] Tschannen, M., Djolonga, J., Rubenstein, P. K., Gelly, S., and Lucic, M. (2019). On mutual information maximization for representation learning. arXiv preprint arXiv:1907.13625.
+[125] Venkattaramanujam, S., Crawford, E., Doan, T. V., and Precup, D. (2019). Self-supervised learning of distance functions for goal-conditioned reinforcement learning. ArXiv, abs/1907.02998.
+[126] Wang, H., Miahi, E., White, M., Machado, M. C., Abbas, Z., Kumaraswamy, R., Liu, V., and White, A. (2022). Investigating the properties of neural network representations in reinforcement learning. arXiv preprint arXiv:2203.15955.
+[127] Warde-Farley, D., Van de Wiele, T., Kulkarni, T., Ionescu, C., Hansen, S., and Mnih, V. (2018). Unsupervised control through non-parametric discriminative rewards. arXiv preprint arXiv:1811.11359.
+[128] Watter, M., Springenberg, J., Boedecker, J., and Riedmiller, M. (2015). Embed to control: A locally linear latent dynamics model for control from raw images. Advances in neural information processing systems, 28.
+[129] Weinberger, K. Q. and Saul, L. K. (2005). Distance metric learning for large margin nearest neighbor classification. In NIPS.
+[130] Wilson, A., Fern, A., Ray, S., and Tadepalli, P. (2007). Multi-task reinforcement learning: a hierarchical bayesian approach. In Proceedings of the 24th international conference on Machine learning, pages 1015– 1022.
+[131] Wu, Y., Tucker, G., and Nachum, O. (2018a). The Laplacian in RL: Learning representations with efficient approximations. arXiv preprint arXiv:1810.04586.
+[132] Wu, Z., Xiong, Y., Yu, S. X., and Lin, D. (2018b). Unsupervised feature learning via non-parametric instance discrimination. 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3733–3742.
+[133] Xie, A., Singh, A., Levine, S., and Finn, C. (2018). Few-shot goal inference for visuomotor learning and planning. In Conference on Robot Learning, pages 40–52. PMLR.
+[134] Xu, D. and Denil, M. (2019). Positive-unlabeled reward learning. arXiv preprint arXiv:1911.00459.
+[135] Yang, G., Ajay, A., and Agrawal, P. (2021). Overcoming the spectral bias of neural value approximation. In International Conference on Learning Representations.
+[136] Yarats, D., Fergus, R., Lazaric, A., and Pinto, L. (2021a). Mastering visual continuous control: Improved data-augmented reinforcement learning. arXiv preprint arXiv:2107.09645.
+[137] Yarats, D., Zhang, A., Kostrikov, I., Amos, B., Pineau, J., and Fergus, R. (2021b). Improving sample efficiency in model-free reinforcement learning from images. In AAAI.
+[138] Yu, T., Kumar, S., Gupta, A., Levine, S., Hausman, K., and Finn, C. (2020a). Gradient surgery for multi-task learning. Advances in Neural Information Processing Systems, 33:5824–5836.
+[139] Yu, T., Quillen, D., He, Z., Julian, R., Hausman, K., Finn, C., and Levine, S. (2020b). Meta-world: A benchmark and evaluation for multi-task and meta reinforcement learning. In Conference on Robot Learning, pages 1094–1100. PMLR.
+[140] Zhang, A., McAllister, R. T., Calandra, R., Gal, Y., and Levine, S. (2020a). Learning invariant representations for reinforcement learning without reconstruction. In International Conference on Learning Representations.
+[141] Zhang, M., Vikram, S., Smith, L., Abbeel, P., Johnson, M., and Levine, S. (2019). Solar: Deep structured representations for model-based reinforcement learning. In International Conference on Machine Learning, pages 7444–7453. PMLR.
+[142] Zhang, S., Liu, B., and Whiteson, S. (2020b). Gradientdice: Rethinking generalized offline estimation of stationary values. In International Conference on Machine Learning, pages 11194–11203. PMLR.
+[143] Zhang, T., Ren, T., Yang, M., Gonzalez, J., Schuurmans, D., and Dai, B. (2022). Making linear mdps practical via contrastive representation learning. In International Conference on Machine Learning, pages 26447–26466. PMLR.
+[144] Zhao, R., Sun, X., and Tresp, V. (2019). Maximum entropy-regularized multi-goal reinforcement learning. In International Conference on Machine Learning, pages 7553–7562. PMLR.
+[145] Ziebart, B. D. (2010). Modeling purposeful adaptive behavior with the principle of maximum causal entropy. Carnegie Mellon University.
+[146] Zolna, K., Reed, S., Novikov, A., Colmenarejo, S. G., Budden, D., Cabi, S., Denil, M., de Freitas, N., and Wang, Z. (2019). Task-relevant adversarial imitation learning. arXiv preprint arXiv:1910.01077.
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] The main claims are that (1) contrastive learning can be used to learn a Q-function (Proof in Appendix B) and that (2) contrastive RL methods can outperform non-contrastive RL algorithms on goal-conditioned RL tasks (results in Fig. 2).
+(b) Did you describe the limitations of your work? [Yes] See Sec. 6.
+(c) Did you discuss any potential negative societal impacts of your work? [No] While RL broadly might be used for applications with both positive and negative outcomes, our algorithmic contributions are not tied to any particular application.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes] See Appendix B
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No] We have included all experimental details in Appendix E; code will be released upon acceptance.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix E.
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] All figures show 5 random seeds, witht error bars corresponding to the mean and standard deviation across these seeds.
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] Sec. 4.4 describes the training speed on one TPUv2.
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [N/A]
+(b) Did you mention the license of the assets? [N/A]
+(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/vKBdabh_WV/vKBdabh_WV.md b/md/dev/vKBdabh_WV/vKBdabh_WV.md
new file mode 100644
index 0000000000000000000000000000000000000000..95408c2cac7e2744fe3765aad44ae169b26feecf
--- /dev/null
+++ b/md/dev/vKBdabh_WV/vKBdabh_WV.md
@@ -0,0 +1,652 @@
+# Meta Optimal Transport
+
+Anonymous Author(s)
+Affiliation
+Address
+email
+
+# Abstract
+
+1 We study the use of amortized optimization to predict optimal transport (OT) maps
+2 from the input measures, which we call Meta OT. This helps repeatedly solve sim
+3 ilar OT problems between different measures by leveraging the knowledge and in
+4 formation present from past problems to rapidly predict and solve new problems.
+5 Otherwise, standard methods ignore the knowledge of the past solutions and sub
+6 optimally re-solve each problem from scratch. We instantiate Meta OT models in
+7 discrete and continuous (Wasserstein-2) settings between images, spherical data,
+8 and color palettes and use them to improve the computational time of standard OT
+9 solvers by multiple orders of magnitude.
+
+# 10 1 Introduction
+
+11 Optimal transportation [Villani, 2009, Ambrosio, 2003, Santambrogio, 2015, Peyré et al., 2019,
+12 Merigot and Thibert, 2021] is thriving in domains including economics [Galichon, 2016], rein
+13 forcement learning [Dadashi et al., 2021, Fickinger et al., 2021], style transfer [Kolkin et al., 2019],
+14 generative modeling [Arjovsky et al., 2017, Seguy et al., 2018, Huang et al., 2020, Rout et al., 2021],
+15 geometry [Solomon et al., 2015, Cohen et al., 2021], domain adaptation [Courty et al., 2017, Redko
+16 et al., 2019], signal processing [Kolouri et al., 2017], fairness [Jiang et al., 2020], and cell repro
+17 gramming [Schiebinger et al., 2019]. A core component in these settings is to couple two measures
+18 $( \alpha , \beta )$ supported on domains $( \mathcal { X } , \mathcal { Y } )$ by solving a transport optimization problem such as the primal
+19 Kantorovich problem, which is defined by:
+
+$$
+\pi ^ { \star } ( \alpha , \beta , c ) \in \mathop { \mathrm { a r g } } _ { \pi \in \mathcal { U } ( \alpha , \beta ) } \int _ { \mathcal { X } \times \mathcal { Y } } c ( x , y ) \mathrm { d } \pi ( x , y ) ,
+$$
+
+where the optimal coupling 20 $\pi ^ { \star }$ is a joint distribution over the product space, $\mathcal { U } ( \alpha , \beta )$ is the set of 21 admissible couplings between $\alpha$ and $\beta$ , and $c : \mathcal { X } \times \mathcal { Y } \mathbb { R }$ is the ground cost, that represents a 22 notion of distance between elements in $\mathcal { X }$ and elements in $\mathcal { V }$ .
+
+23 Challenges. Unfortunately, solving eq. (1) once is computationally expensive between general mea
+24 sures and computationally cheaper alternatives are an active research topic: Entropic optimal trans
+25 port [Cuturi, 2013] smooths the transport problem with an entropy penalty, and sliced distances
+26 [Kolouri et al., 2016, 2018, 2019, Deshpande et al., 2019] solve OT between 1-dimensional projec
+27 tions of the measures, where eq. (1) can be solved easily.
+28 Furthermore, when an optimal transport method is deployed in practice, eq. (1) is not just solved
+29 a single time, but is repeatedly solved for new scenarios between different input measures $( \alpha , \beta )$ .
+30 For example, the measures could be representations of images we care about optimally transporting
+31 between and in deployment we would receive a stream of new images to couple. Repeatedly solving
+32 optimal transport problems also comes up in the context of comparing seismic signals [Engquist
+33 and Froese, 2013] and in single-cell perturbations [Bunne et al., 2021, 2022b,a]. Standard optimal
+34 transport solvers deployed in this setting would re-solve the optimization problems from scratch, but
+35 this ignores the shared structure and information present between different coupling problems.
+36 Overview and outline. We study the use of amortized optimization and machine learning methods
+37 to rapidly solve multiple optimal transport problems and predict the solution from the input measures
+38 $( \alpha , \beta )$ . This setting involves learning a meta model to predict the solution to the optimal transport
+39 problem, which we will refer to as Meta Optimal Transport. We learn Meta OT models to predict
+40 the solutions to optimal transport problems and significantly improve the computational time and
+41 number of iterations needed to solve eq. (1) between discrete (sect. 3.1) and continuous (sect. 3.2)
+42 measures. The paper is organized as follows: sect. 2 recalls the main concepts needed for the rest
+43 of the paper, in particular the formulations of the entropy regularized and unregularized optimal
+44 transport problems and the basic notions of amortized optimization; sect. 3 presents the Meta OT
+45 models and algorithms; and sect. 4 empirically demonstrates the effectiveness of Meta OT.
+46 Settings that are not Meta OT. Meta OT is not useful in OT settings that do not involve repeatedly
+47 solving OT problems over a fixed distribution, including 1) standard generative modeling settings,
+48 such as Arjovsky et al. [2017] that estimate the OT distance between the data and model distri
+49 butions, and 2) the out-of-sample setting of Seguy et al. [2018], Perrot et al. [2016] that couple
+50 measures and then extrapolate the map to larger measures containing the original measures.
+
+# 51 2 Preliminaries and background
+
+# 2.1 Dual optimal transport solvers
+
+53 We review foundations of optimal transportation, following the notation of Peyré et al. [2019] in
+54 most places. The discrete setting often favors the entropic regularized version since it can be com
+55 puted efficiently and in a parallelized way using the Sinkhorn algorithm. On the other hand, the
+56 continuous setting is often solved from samples using convex potentials. While the primal Kan
+57 torovich formulation in eq. (1) provides an intuitive problem description, optimal transport problems
+58 are rarely solved directly in this form due to the high-dimensionality of the couplings $\pi$ and the diffi
+59 culty of satisfying the coupling constraints $\mathcal { U } ( \alpha , \beta )$ . Instead, most computational OT solvers use the
+60 dual of eq. (1), which we build our Meta OT solvers on top of in discrete and continuous settings.
+
+# 2.1.1 Entropic OT between discrete measures with the Sinkhorn algorithm
+
+Let 62 $\begin{array} { r } { \alpha : = \sum _ { i = 1 } ^ { m } a _ { i } \delta _ { x _ { i } } } \end{array}$ and $\beta : = \textstyle \sum _ { i = 1 } ^ { n } b _ { i } \delta _ { y _ { i } }$ be 63 discrete measures, where $\delta _ { z }$ is a Dirac at point 64 $z$ and $a \ \in \ \Delta _ { m - 1 }$ and $b \in \Delta _ { n - 1 }$ are in the 65 probability simplex defined by
+
+$$
+\Delta _ { k - 1 } : = \{ x \in \mathbb { R } ^ { k } : x \geq 0 { \mathrm { ~ a n d ~ } } \sum _ { i } x _ { i } = 1 \} .
+$$
+
+
Algorithm1 Sinkhorn(α,β,c,∈,fo=0)
foriterationi=1to N do gi ←∈logb-∈log(KTexp{fi-1/ε})
fi←∈loga-∈log(Kexp{gi/∈}) end for
Compute PN from fN, gN using eq. (6)
return PN ≈ P*
+
+66 Discrete OT. In the discrete setting, eq. (1) simplifies to the linear program
+
+$$
+P ^ { \star } ( \alpha , \beta , c ) \in \underset { P \in U ( a , b ) } { \arg \operatorname* { m i n } } \langle C , P \rangle \qquad U ( a , b ) : = \{ P \in \mathbb { R } _ { + } ^ { n \times m } : P 1 _ { m } = a , \quad P ^ { \top } 1 _ { n } = b \}
+$$
+
+where 67 $P$ is a coupling matrix, $P ^ { \star } ( \alpha , \beta )$ is the optimal coupling, and the cost can be discretized as a matrix 68 $C \in \mathbb { R } ^ { m \times n }$ with entries $C _ { i , j } : = c ( x _ { i } , y _ { j } )$ , and $\begin{array} { r } { \langle C , \mathbf { \tilde { \mathit { P } } } \rangle : = \sum _ { i , j } C _ { i , j } P _ { i , j } } \end{array}$ ,
+
+69 Entropic OT. The linear program above can be regularized adding the entropy of the coupling to
+70 smooth the objective as in Cominetti and Martín [1994], Cuturi [2013], resulting in:
+
+$$
+P ^ { \star } ( \alpha , \beta , c , \epsilon ) \in \underset { P \in U ( a , b ) } { \arg \operatorname* { m i n } } \langle C , P \rangle - \epsilon H ( P )
+$$
+
+where 71 $\begin{array} { r } { H ( P ) : = - \sum _ { i , j } P _ { i , j } ( \log ( P _ { i , j } ) - 1 ) } \end{array}$ is the discrete entropy of a coupling matrix $P$
+
+72 Entropic OT dual. As presented in Peyré et al. [2019, Prop. 4.4], the dual of eq. (4) is
+
+$$
+\begin{array} { r } { f ^ { \star } , g ^ { \star } \in \underset { f \in \mathbb { R } ^ { n } , g \in \mathbb { R } ^ { m } } { \mathrm { a r g } \mathrm { m a x } } \ \langle f , a \rangle + \langle g , b \rangle - \epsilon \langle \exp \{ f / \epsilon \} , K \exp \{ g / \epsilon \} \rangle , \quad K _ { i , j } : = \exp \{ - C _ { i , j } / \epsilon \} , } \end{array}
+$$
+
+73 where $K \in \mathbb { R } ^ { m \times n }$ is the Gibbs kernel and the dual variables or potentials $f \in \mathbb { R } ^ { n }$ and $g \in \mathbb { R } ^ { m }$ are
+74 associated, respectively, with the marginal constraints $P 1 _ { m } = a$ and $P ^ { \top } 1 _ { n } = b$ . The optimal duals
+75 depend on the problem, e.g. $f ^ { \star } ( \alpha , \beta , \overline { { c } } , \epsilon )$ , but we omit this dependence for notational simplicity.
+76 Recovering the primal solution from the duals. Given optimal duals $f ^ { \star } , g ^ { \star }$ that solve eq. (5) the
+77 optimal coupling $P ^ { \star }$ to the primal problem in eq. (4) can be obtained by
+
+$$
+P _ { i , j } ^ { \star } ( \alpha , \beta , c , \epsilon ) : = \exp \{ f _ { i } ^ { \star } / \epsilon \} K _ { i , j } \exp \{ g _ { j } ^ { \star } / \epsilon \} \qquad ( K \mathrm { i s d e f i n e d i n e q . } ( 5 ) )
+$$
+
+78 The Sinkhorn algorithm. Algorithm 1 summarizes the log-space version, which takes closed-form
+79 block coordinate ascent updates on eq. (5) obtained from the first-order optimality conditions [Peyré
+80 et al., 2019, Remark 4.21]. We will use it to fine-tune predictions made by our Meta OT models.
+81 Computing the error. Standard implementations of the Sinkhorn algorithm, such as Flamary et al.
+82 [2021], Cuturi et al. [2022], measure the error of a candidate dual solution $( f , g )$ by computing the
+83 deviation from the marginal constraints, which we will also use in comparing our solution quality:
+
+$$
+\begin{array} { r } { \mathrm { e r r } ( f , g ; \alpha , \beta , c ) : = \| P 1 _ { m } - a \| _ { 1 } + \| P ^ { \top } 1 _ { n } - b \| _ { 1 } \qquad ( \mathrm { c o m p u t e } P \mathrm { f r o m e q . } ( 6 ) ) } \end{array}
+$$
+
+84 Mapping between the duals. The first-order optimality conditions of eq. (5) also provide an equiv
+85 alence between the optimal dual potentials that we will make use of:
+
+$$
+\begin{array} { r } { g ( f ; b , c ) : = \epsilon \log b - \epsilon \log \left( K ^ { \top } \exp \{ f / \epsilon \} \right) . } \end{array}
+$$
+
+# 86 2.1.2 Wasserstein-2 OT between continuous (Euclidean) measures with dual potentials
+
+87 Let $\alpha$ and $\beta$ be continuous measures in Euclidean
+88 space $\mathcal X = \mathcal y = \mathbb R ^ { d }$ (with $\alpha$ absolutely contin
+89 uous with respect to the Lebesgue measure) and
+90 the ground cost be the squared Euclidean distance
+91 $c ( x , y ) : = \| x - y \| _ { 2 } ^ { 2 }$ . Then the minimum of eq. (1)
+92 defines the square of the Wasserstein-2 distance:
+
+
Algorithm 2 W2GN(α, β,0)
foriterationi=1 to N do
Sample from (α,β) and estimate L(φi-1) Update i with approximation to VL(i-1)
end for
return TN(.) := VxψN(·) ≈ T*(·)
+
+$$
+W _ { 2 } ^ { 2 } ( \alpha , \beta ) : = \operatorname* { m i n } _ { \pi \in \mathcal { U } ( \alpha , \beta ) } \int _ { \mathcal { X } \times \mathcal { Y } } \| x - y \| _ { 2 } ^ { 2 } \mathrm { d } \pi ( x , y ) = \operatorname* { m i n } _ { T } \int _ { \mathcal { X } } \| x - T ( x ) \| _ { 2 } ^ { 2 } \mathrm { d } \alpha ( x ) ,
+$$
+
+93 where $T$ is a transport map pushing $\alpha$ to $\beta$ , i.e. $T _ { \# } \alpha = \beta$ with the pushforward operator defined by 94 $T _ { \# } \alpha ( B ) : = \alpha ( T ^ { - 1 } ( B ) )$ for any measurable set $B$ .
+
+95 Convex dual potentials. The primal form in eq. (9) is difficult to solve, as in the discrete setting, due
+96 to the difficulty of representing the coupling and satisfying the constraints. Makkuva et al. [2020],
+97 Taghvaei and Jalali [2019], Korotin et al. [2019, 2021b, 2022] propose to instead solve the dual:
+
+$$
+\psi ^ { \star } ( { \bf \cdot } ; \alpha , \beta ) \in \mathop { \mathrm { a r g } } \operatorname* { m i n } _ { \psi \in \mathrm { c o n v e x } } \int _ { \mathcal { X } } \psi ( x ) \mathrm { d } \alpha ( x ) + \int _ { \mathcal { V } } \overline { { \psi } } ( y ) \mathrm { d } \beta ( y ) ,
+$$
+
+98 where $\psi$ is a convex function referred to as a convex potential, and ${ \overline { { \psi } } } ( y ) : = \operatorname* { m a x } _ { x \in { \mathcal { X } } } \langle x , y \rangle - \psi ( x )$ is
+99 the Legendre-Fenchel transform or convex conjugate of $\psi$ [Fenchel, 1949, Rockafellar, 2015]. The
+100 potential $\psi$ is often approximated with an input-convex neural network (ICNN) [Amos et al., 2017].
+01 Recovering the primal solution from the dual. Given an optimal dual $\psi ^ { \star }$ for eq. (10), Brenier
+02 [1991] remarkably shows that an optimal map $T ^ { \star }$ for eq. (9) can be obtained with differentiation:
+
+$$
+T ^ { \star } ( x ) = \nabla _ { x } \psi ^ { \star } ( x ) .
+$$
+
+103 Wasserstein-2 Generative Networks (W2GNs). Korotin et al. [2019] model $\psi _ { \varphi }$ and $\overline { { \psi _ { \varphi } } }$ in eq. (10)
+104 with two separate ICNNs parameterized by $\varphi$ . The separate model for $\overline { { \psi _ { \varphi } } }$ is useful because the
+105 conjugate operation in eq. (10) becomes computationally expensive. They optimize the loss:
+
+$$
+\mathcal { L } ( \varphi ) : = \underset { x \sim \alpha } { \mathbb { E } } [ \psi _ { \varphi } ( x ) ] + \underset { y \sim \beta } { \mathbb { E } } \left[ \langle \nabla \psi _ { \varphi } ( y ) , y \rangle - \psi _ { \varphi } ( \nabla \psi _ { \varphi } ( y ) ) \right] + \gamma \underset { y \sim \beta } { \mathbb { E } } \| \nabla \psi _ { \varphi } \circ \nabla \psi _ { \varphi } ( y ) - y \| _ { 2 } ^ { 2 } ,
+$$
+
+106 where $\varphi$ is a detached copy of the parameters and $\gamma$ is a hyper-parameter. The first term are the
+107 cyclic monotone correlations [Chartrand et al., 2009, Taghvaei and Jalali, 2019], that optimize the
+108 dual objective in eq. (10), and the second term provides cycle consistency [Zhu et al., 2017] to
+109 estimate the conjugate $\overline { { \psi } }$ . Algorithm 2 shows how $\mathcal { L }$ is typically optimized using samples from the
+110 measures, which we use to fine-tune Meta OT predictions.
+
+
+Figure 1: Meta OT uses objective-based amortization for optimal transport. In the general formulation, the parameters $\theta$ capture shared structure in the optimal couplings $\pi ^ { \star }$ between multiple input measures and costs over some distribution $\mathcal { D }$ . In practice, we learn this shared structure over the dual potentials which map back to the coupling: $f ^ { \star }$ in discrete settings and $\psi ^ { \star }$ in continuous ones.
+
+# 111 2.2 Amortized optimization and learning to optimize
+
+112 Our paper is an application of amortized optimization methods that predict the solutions of opti
+113 mization problems, as surveyed in, e.g., Chen et al. [2021], Amos [2022]. We use the basic setup
+114 from Amos [2022], which considers unconstrained continuous optimization problems of the form
+
+$$
+z ^ { \star } ( \phi ) \in \arg \operatorname* { m i n } _ { z } J ( z ; \phi ) ,
+$$
+
+115 where $J$ is the objective, $z \in { \mathcal { Z } }$ is the domain, and $\phi \in \Phi$ is some context or parameterization. In
+116 other words, the context conditions the objective but is not optimized over. Given a distribution over
+117 contexts ${ \mathcal { P } } ( \phi )$ , we learn a model $\hat { z } _ { \theta }$ parameterized by $\theta$ to approximate eq. (13), i.e. $\hat { z } _ { \theta } ( \phi ) \approx z ^ { \star } ( \phi )$ .
+118 $J$ will be differentiable for us, so we optimize the parameters using objective-based learning with
+
+$$
+\operatorname* { m i n } _ { \theta } \underset { \phi \sim \mathcal { P } ( \phi ) } { \mathbb { E } } J ( \hat { z } _ { \theta } ( \phi ) ; \phi ) ,
+$$
+
+119 which does not require ground-truth solutions $z ^ { \star }$ and can be optimized with a gradient-based solver.
+120 While we focus on optimizing eq. (14) because we do not assume easy access to ground-truth solu
+121 tions $z ^ { \star } ( \phi )$ , one alternative is regression-based learning if the solutions are easily available:
+
+$$
+\operatorname* { m i n } _ { \theta } \operatorname* { \mathbb { E } } _ { \phi \sim \mathcal { P } ( \phi ) } \| z ^ { \star } ( \phi ) - \hat { z } _ { \theta } ( \phi ) \| _ { 2 } ^ { 2 } .
+$$
+
+# 122 3 Meta Optimal Transport
+
+Figure 1 illustrates our key contribution of connecting objective-based amortization in eq. (14) to optimal transport. We consider solving multiple OT problems and learning shared structure and correlations between them. We denote a joint meta-distribution over the input measures and costs with $\mathcal { D } ( \alpha , \beta , c )$ , which we call meta to distinguish it from the measures $\alpha , \beta$ .
+
+127 In general, we could introduce a model that directly predicts the primal solution to eq. (1), i.e.
+128 $\pi _ { \boldsymbol { \theta } } ( \widetilde { \alpha } , \beta , c ) \approx \pi ^ { \star } ( \alpha , \beta , c )$ for $( \alpha , \beta , c ) \sim \mathcal { D }$ . This is difficult for the same reason why most compu
+129 tational methods do not operate directly in the primal space: the optimal coupling is often a high
+130 dimensional joint distribution with non-trivial marginal constraints. We instead turn to predicting
+131 the dual variables used by today’s solvers.
+
+# 32 3.1 Meta OT between discrete measures
+
+133 dardand ropicwith ed iand 1 between discrete coupled using a cost easures. In the
+134 $\begin{array} { r } { \alpha : = \sum _ { i = 1 } ^ { m } a _ { i } \delta _ { x _ { i } } } \end{array}$ $\textstyle { \beta : = \sum _ { i = 1 } ^ { n } b _ { i } \delta _ { x _ { i } } }$ $a \in \Delta _ { m - 1 }$ $b \in \Delta _ { n - 1 }$ $c$
+135 Meta OT setting, the measures and cost are the contexts for amortization and sampled from a meta
+136 distribution, i.e. $( \alpha , \beta , c ) \sim \mathcal { D } ( \alpha , \beta , c )$ . For example, sects. 4.1 and 4.2 considers meta-distributions
+137 over the weights of the atoms, i.e. $( a , b ) \sim \mathcal { D }$ , where $\mathcal { D }$ is a distribution over $\Delta _ { m - 1 } \times \Delta _ { n - 1 }$ .
+138 Amortization objective. We will seek to predict the optimal potential. At optimality, the pair of
+139 potentials are related to each other via eq. (8), i.e. $\begin{array} { r } { g ( f ; \hat { \alpha } , \beta , c ) : = \epsilon \log b - \epsilon \mathrm { l o g } \left( K ^ { \dagger } \exp \bigl \{ f / \epsilon \bigr \} \right) } \end{array}$
+140 where $K \in \mathbb { R } ^ { m \times n }$ is the Gibbs kernel from eq. (5). Hence, it is sufficient to predict one of the
+141 potentials, e.g. $f$ , and recover the other. We thus re-formulate eq. (5) to just optimize over $f$ with
+
+
Algorithm 3 Training Meta OT
Initialize amortization model with 0o foriterationdo Sample (α, β,c) ~ D Predict duals fe or eon the sample
+
+
Algorithm 4 Fine-tuning with Sinkhorn
Predict duals fe(α, β,c)
return Sinkhorn(α,β,c,∈, fe)
Algorithm 5 Fine-tuning with W2GN
Predict dual ICNN parameters e(α, β,c)
return W2GN(α, β,c,T,0)
+
+$$
+\displaystyle f ^ { \star } ( \alpha , \beta , c , \epsilon ) \in \ \arg \operatorname* { m i n } _ { f \in \mathbb { R } ^ { n } } \ J ( f ; \alpha , \beta , c ) ,
+$$
+
+142 where $- J ( f ; \alpha , \beta , c ) : = \langle f , a \rangle + \langle g , b \rangle - \epsilon \langle \exp \{ f / \epsilon \} , K \exp \{ g / \epsilon \} \rangle$ is the (negated) dual objective.
+143 Even though most solvers optimize over $f$ and $g$ jointly as in eq. (16), amortizing over these would
+144 likely need: 1) to have a higher capacity than a model just predicting $f$ , and 2) to learn how $f$ and $g$
+145 are connected through eq. (8) while in eq. (16) we explicitly provide this knowledge.
+146 Amortization model. We predict the solution to eq. (16) with $\hat { f } _ { \theta } ( \alpha , \beta , c )$ parameterized by $\theta$ ,
+147 resulting in a computationally efficient approximation $\hat { f } _ { \boldsymbol { \theta } } \approx f ^ { \star }$ . Here we use the notation $\hat { f } _ { \theta } ( \alpha , \beta , c )$
+148 to mean that the model $\hat { f } _ { \theta }$ depends on representations of the input measures and cost. In our settings,
+149 we define ${ \hat { f } } _ { \theta }$ as a fully-connected MLP mapping from the atoms of the measures to the duals.
+150 Amortization loss. Applying objective-based amortization from eq. (14) to the dual in eq. (16)
+151 completes our learning setup. Our model should best-optimize the expectation of the dual objective
+
+$$
+\operatorname* { m i n } _ { \theta } \operatorname* { \mathbb { E } } _ { ( \alpha , \beta , c ) \sim \mathcal { D } } J ( \hat { f } _ { \theta } ( \alpha , \beta , c ) ; \alpha , \beta , c ) ,
+$$
+
+which is appealing as it does not require ground-truth solutions 152 $f ^ { \star }$ . Algorithm 3 shows a basic 153 training loop for eq. (17) using a gradient-based optimizer such as Adam [Kingma and Ba, 2014].
+
+Sinkhorn fine-tuning. The dual prediction made by $\hat { f } _ { \theta }$ with an associated $\hat { g }$ can easily be input as the initialization to a standard Sinkhorn solver as shown in algorithm 4. This allows us to deploy the predicted potential with Sinkhorn to obtain the optimal potentials with only a few extra iterations.
+
+On accelerated solvers. Here we have only considered fine-tuning the Meta OT prediction with a log-Sinkhorn solver. Meta OT can also be combined with accelerated variants of entropic OT solvers such as Thibault et al. [2017], Altschuler et al. [2017], Alaya et al. [2019], Lin et al. [2019] that would otherwise solve every problem from scratch.
+
+# 3.2 Meta OT between continuous measures (Wasserstein-2)
+
+162 We take an analogous approach to predicting the Wasserstein-2 map between continuous measures
+163 for Wasserstein-2 as reviewed in sect. 2.1.2. Here the measures $\alpha , \beta$ are supported in continuous
+164 space $\mathcal { X } = \mathcal { Y } = \mathbb { R } ^ { d }$ and we focus on computing Wasserstein-2 couplings from instances sampled
+165 from a meta-distribution $( \alpha , \beta ) \sim \mathcal { D } ( \alpha , \beta )$ . The cost $c$ is not included in $\mathcal { D }$ as it remains fixed to the
+166 squared Euclidean cost everywhere here.
+167 One challenge here is that the optimal dual potential $\psi ^ { \star } ( \cdot ; \alpha , \beta )$ in eq. (10) is a convex function and
+168 not simply a finite-dimensional real vector. The dual potentials in this setting are approximated by,
+169 e.g., an ICNN. We thus propose a Meta ICNN that predicts the parameters $\varphi$ of an ICNN $\psi _ { \varphi }$ that
+170 approximates the optimal dual potentials, which can be seen as a hypernetwork [Stanley et al., 2009,
+171 Ha et al., 2016]. The dual prediction made by $\hat { \varphi } _ { \theta }$ can easily be input as the initial value to a standard
+172 W2GN solver as shown in algorithm 5. App. B discusses other modeling choices we considered:
+173 we tried models based on MAML [Finn et al., 2017] and neural processes [Garnelo et al., 2018b,a].
+174 Amortization objective. We build on the W2GN formulation [Korotin et al., 2019] and seek pa
+175 rameters $\varphi ^ { \star }$ optimizing the dual ICNN potentials $\psi _ { \varphi }$ and $\overline { { \psi _ { \varphi } } }$ with $\mathcal { L } ( \varphi ; \alpha , \beta )$ from eq. (12). We
+176 chose W2GN due to the stability, but could also easily use other losses optimizing ICNN potentials.
+177 Amortization model: the Meta ICNN. We predict the solution to eq. (12) with $\hat { \varphi } _ { \boldsymbol { \theta } } \big ( \alpha , \beta \big )$ param
+178 eterized by $\theta$ , resulting in a computationally efficient approximation to the optimum $\hat { \varphi } _ { \boldsymbol { \theta } } \approx \varphi ^ { \star }$ .
+179 Figure 3 instantiates a convolutional Meta ICNN model using a ResNet-18 [He et al., 2016] archi
+180 tecture for coupling image-based measures. We again emphasize that $\alpha , \beta$ used with the model here
+181 are representations of measures, which in our cases are simply images.
+182 Amortization loss. Applying objective-based amortization from eq. (14) to the W2GN loss in
+183 eq. (12) completes our learning setup. Our model should best-optimize the expectation of the loss:
+
+Figure 2: Interpolations between MNIST test digits using couplings obtained from (left) solving the problem with Sinkhorn, and (right) Meta OT model’s initial prediction, which is $\mathbf { \approx 1 0 0 }$ times computationally cheaper and produces a nearly identical coupling.
+
+
+Figure 3: A Meta ICNN for image-based input measures. A shared ResNet processes the input measures $\alpha$ and $\beta$ into latents $z$ that are decoded with an MLP into the parameters $\varphi$ of an ICNN dual potential $\psi _ { \varphi }$ . The derivative of the ICNN provides the transport map $\hat { T }$ .
+
+Table 2: Color transfer runtimes and values.
+
+
Iter
Runtime (s)
Dual Value
Meta OT +W2GN
None 1k
3.5.10-3 ±2.7:10-4 0.93±2.27·10-2
0.90 ±6.08·10-2 1.0 ±2.57.10-3
2k
1.84 ±3.78 . 10-2
1.0 ±5.30 .10-3
W2GN
1k
0.90 ±1.62:10-2
0.96 ±2.62:10-2
0.99 ±1.14·10-2
2k
1.81 ±3.05:10-2
+
+Table 1: Sinkhorn runtime (seconds) to reach a marginal error of $1 0 ^ { - 3 }$ . Meta OT’s initial prediction takes $\approx 5 \cdot 1 0 ^ { - 5 }$ seconds.
+
+
Initialization
MNIST
Spherical
Zeros
7.7:10-3 ±1.2.10-3
1.4 ±1.9 . 10-1
Gaussian
7.7·107 -3 ±1.4·10-3
1.1 ±2.0 · 10-1
Meta OT
3.9·10-3 ±1.6·10-3
0.44 ±1.5 10-1
+
+We report the mean and standard deviation across 10 test instances.
+
+$$
+\operatorname* { m i n } _ { \theta } \operatorname* { l g } _ { ( \alpha , \beta ) \sim \mathcal { D } } \mathcal { L } ( \varphi _ { \theta } ( \alpha , \beta ) ; \alpha , \beta ) .
+$$
+
+As in the discrete setting, it does not require ground-truth solutions 184 $\varphi ^ { \star }$ and we learn it with Adam.
+
+# 185 4 Experiments
+
+186 We demonstrate how Meta OT models improve the convergence of the state-of-the-art solvers in
+187 settings where solving multiple OT problems naturally arises. We implemented our code in JAX
+188 [Bradbury et al., 2018] as an extension to the the Optimal Transport Tools (OTT) package [Cuturi
+189 et al., 2022]. App. C covers further experimental and implementation details, and shows that all of
+190 our experiments take a few hours to run on our single Quadro GP100 GPU.
+
+
+Figure 4: Meta OT successfully predicts warm-start initializations that significantly improve the convergence of Sinkhorn iterations on test data. The error is the marginal error defined in eq. (7).
+
+# 191 4.1 Discrete OT between MNIST digits
+
+Images provide a natural setting for Meta OT where the distribution over images provide the metadistribution $\mathcal { D }$ over OT problems. Given a pair of images $\alpha _ { 0 }$ and $\alpha _ { 1 }$ , each grayscale image is cast as a discrete measure in 2-dimensional space where the intensities define the probabilities of the atoms. The goal is to compute the optimal transport interpolation between the two measures as in, e.g., Peyré et al. [2019, $\ S 7 ]$ . Formally, this means computing the optimal coupling $P ^ { \star }$ by solving the entropic optimal transport problem between $\alpha _ { 0 }$ and $\alpha _ { 1 }$ and computing the interpolates as $\alpha _ { t } = ( t \mathrm { p r o j } _ { y } + ( 1 - t ) \mathrm { p r o j } _ { x } ) _ { \# } P ^ { \star }$ , for $t \in [ 0 , 1 ]$ , where $\operatorname { p r o j } _ { x } ( x , y ) : = x$ and $\mathrm { p r o j } _ { y } ( x , y ) = y$ . We selected $\epsilon = 1 0 ^ { - 2 }$ as app. A shows that it gives interpolations that are not too blurry or sharp.
+
+200 Our Meta OT model ${ \hat { f } } _ { \theta }$ (sect. 3.1) is an MLP that predicts the transport map between pairs of MNIST
+201 digits. We train on every pair from the standard training dataset. Figure 2 shows that even without
+202 fine-tuning, Meta OT’s predicted Wasserstein interpolations between the measures are close to the
+203 ground-truth interpolations obtained from running the Sinkhorn algorithm to convergence. We then
+204 fine-tune Meta OT’s prediction with Sinkhorn as in algorithm 4. Figure 4 shows that the near
+205 optimal predictions can be quickly refined in fewer iterations than running Sinkhorn with the default
+206 initialization, and table 1 shows the runtime required to reach the default threshold, which uses the
+207 default marginal error threshold of $1 0 ^ { - 3 }$ . We compare our learned initialization to the standard zero
+208 initialization, as well as the Gaussian initialization proposed in Thornton and Cuturi [2022], which
+209 takes a continuous Gaussian approximation of the measures and initializes the potentials to be the
+210 known coupling between the Gaussians. This Gaussian initialization assumes the squared Euclidean
+211 cost, which is not the case in our spherical transport problem, but we find it is still helpful over the
+212 zero initialization.
+
+# 213 4.2 Discrete OT for supply-demand transportation on spherical data
+
+We next set up a synthetic transport problem between supply and demand locations where the supply and demands may change locations or quantities frequently, creating another Meta OT setting to be able to rapidly solve the new instances. We specifically consider measures living on the 2-sphere defined by $S _ { 2 } ^ { \cdot } : = \{ x \in \mathbb { R } ^ { 3 } : \| x \| = 1 \} .$ , i.e. $\mathcal { X } = \mathcal { Y } = \mathcal { S } _ { 2 }$ , with the transport cost given by the spherical distance $c ( x , y ) = \operatorname { a r c c o s } ( \langle x , y \rangle )$ . We then randomly sample supply locations uniformly from Earth’s landmass and demand locations from Earth’s population density to induce a class of transport problems on the sphere obtained from the CC-licensed dataset from Doxsey-Whitfield et al. [2015]. Figure 5 shows that the predicted transport maps on test instances are close to the optimal maps obtained from Sinkhorn to convergence. Similar to the MNIST setting, fig. 4 and table 1 show improved convergence and runtime.
+
+# 24 4.3 Continuous Wasserstein-2 color transfer
+
+The problem of color transfer between two images consists in mapping the color palette of one image into the other one. The images are required to have the same number of channels, for example RGB images. The continuous formulation that we use from Korotin et al. [2019], takes i.e. $\mathcal { X } = \mathcal { Y } =$ $[ 0 , \bar { 1 } ] ^ { 3 }$ with $c$ being the squared Euclidean distance. We collected ${ \approx } 2 0 0$ public domain images from WikiArt and trained a Meta ICNN model from sect. 3.2 to predict the color transfer maps between
+
+
+Figure 5: Test set coupling predictions of the spherical transport problem. Meta OT’s initial prediction is ${ \approx } \mathbf { 3 7 5 0 0 }$ times faster than solving Sinkhorn to optimality. Supply locations are shown as black dots and the blue lines show the spherical transport maps $T$ going to demand locations at the end. The sphere is visualized with the Mercator projection.
+
+
+Figure 6: Color transfers with a Meta ICNN on test pairs of images. The objective is to optimally transport the continuous RGB measure of the first image $\alpha$ to the second $\beta$ , producing an invertible transport map $T$ . Meta OT’s prediction is ${ \approx } \mathbf { 1 0 0 0 }$ times faster than training W2GN from scratch. The image generating $\alpha$ is Market in Algiers by August Macke (1914) and $\beta$ is Argenteuil, The Seine by Claude Monet (1872), obtained from WikiArt.
+
+230 every pair of them. Figure 6 shows the predictions on test pairs and fig. 7 shows the convergence in
+31 comparison to the standard W2GN learning. Table 2 reports runtimes and app. E shows additional
+232 results.
+
+# 5 Related work
+
+Efficiently estimating OT maps. To compute OT maps with fixed cost between pairs of measures efficiently, neural OT models [Korotin et al., 2019, Li et al., 2020, Korotin et al., 2021a, Mokrov et al., 2021, Korotin et al., 2021b] leverage ICNNs to estimate maps between continuous high
+
+237 dimensional measures given samples from these, and Litvinenko et al. [2021], Scetbon et al. [2021],
+238 Forrow et al. [2019], Sommerfeld et al. [2019], Scetbon et al. [2022], Muzellec and Cuturi [2019],
+239 Bonet et al. [2021] leverage structural assumptions on coupling and cost matrices to reduce the
+240 computational and memory complexity. In the meta-OT setting, we consider learning to rapidly
+241 compute OT mappings between new pairs measures. All these works can hence potentially benefit
+242 from an acceleration effect by leveraging amortization similarly.
+
+Embedding measures where OT distances are discriminative. Effort has been invested in learning encodings/projections of measures through a nested optimization problem, which aims to find discriminative embeddings of the measures to be compared [Genevay et al., 2018, Deshpande et al., 2019, Nguyen and Ho, 2022]. While these works share an encoder and/or a projection across task with the aim of leveraging more discriminative alignments (and hence an OT distance with a metric different from the Euclidean metric), our work differs in the sense that we find good initializations to solve the OT problem itself with fixed cost more efficiently across tasks.
+
+Optimal transport and amortization. Few previous works in the OT literature leverage amortization. Courty et al. [2018] learn a latent space in which the Wasserstein distance between the measure’s embeddings is equivalent to the Euclidean distance. Concurrent work [Nguyen and Ho, 2022] amortizes the estimation of the optimal projection in the max-sliced objective, which differs from our work where we instead amortize the estimation of the optimal coupling directly. Also, Lacombe et al. [2021] learns to predict Wasserstein barycenters of pixel images by training a convolutional networks that, given images as input, outputs their barycenters. Our work is hence a generalization of this pixel-based work to general measures – both discrete and continuous. A limitation of Lacombe et al. [2021] is that it does not provide alignments, as the amortization networks predicts the barycenter directly rather than individual couplings.
+
+
+Figure 7: Convergence on color transfer test instances using W2GN. Meta ICNNs predicts warm-start initializations that significantly improve the (normalized) dual objective values.
+
+# 6 Conclusions, future directions, and limitations
+
+We have presented foundations for modeling and learning to solve OT problems with Meta OT by using amortized optimization to predict optimal transport plans. This works best in applications that require solving multiple OT problems with shared structure. We instantiated it to speed up entropic regularized optimal transport and unregularized optimal transport with squared cost by multiple orders of magnitude. We envision extensions of the work in:
+
+1. Meta OT models. While we mostly consider models based on hypernetworks, other metalearning paradigms can be connected in. In the discrete setting, we only considered settings where the cost remains fixed, but the Meta OT model can also be conditioned on the cost by considering the entire cost matrix as an input (which may be too large for most models to handle), or considering a lower-dimensional parameterization of the cost that changes between the Meta OT problem instances.
+2. OT algorithms. While we instantiated models on top of log-Sinkhorn and W2GN, Meta OT could be built on top of other methods.
+3. OT applications that are computationally expensive and repeatedly solved, e.g. in multimarginal and barycentric settings, or for Gromov-Wasserstein distances between metricmeasure spaces.
+
+285 Limitations. While we have illustrated successful applications of Meta OT, it is also important to
+286 understand the limitations: 1) Meta OT does not make previously intractable problems tractable.
+287 All of the baseline OT solvers we consider solve our problems within milliseconds or seconds. 2)
+288 Out-of-distribution generalization. Meta OT may not generate good predictions on instances that
+289 are not close to the training OT problems from the meta-distribution $\mathcal { D }$ over the measures and cost.
+290 If the model makes a bad prediction, one fallback option is to re-solve the instance from scratch.
+
+References Mokhtar Z Alaya, Maxime Berar, Gilles Gasso, and Alain Rakotomamonjy. Screening sinkhorn algorithm for regularized optimal transport. Advances in Neural Information Processing Systems, 32, 2019. Jason Altschuler, Jonathan Niles-Weed, and Philippe Rigollet. Near-linear time approximation algorithms for optimal transport via sinkhorn iteration. Advances in neural information processing systems, 30, 2017. Luigi Ambrosio. Lecture notes on optimal transport problems. In Mathematical aspects of evolving interfaces, pages 1–52. Springer, 2003.
+298 Brandon Amos. Tutorial on amortized optimization for learning to optimize over continuous domains. arXiv preprint arXiv:2202.00665, 2022.
+300 Brandon Amos, Lei Xu, and J Zico Kolter. Input convex neural networks. In International Conference on Machine Learning, pages 146–155. PMLR, 2017. Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein generative adversarial networks. In International conference on machine learning, pages 214–223. PMLR, 2017. Clément Bonet, Titouan Vayer, Nicolas Courty, François Septier, and Lucas Drumetz. Subspace detours meet gromov–wasserstein. Algorithms, 14(12):366, 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. GitHub, 2018. URL http://github.com/google/jax. Yann Brenier. Polar factorization and monotone rearrangement of vector-valued functions. Communications on pure and applied mathematics, 44(4):375–417, 1991. Charlotte Bunne, Stefan G Stark, Gabriele Gut, Jacobo Sarabia del Castillo, Kjong-Van Lehmann, Lucas Pelkmans, Andreas Krause, and Gunnar Ratsch. Learning single-cell perturbation responses using neural optimal transport. bioRxiv, 2021. Charlotte Bunne, Andreas Krause, and Marco Cuturi. Supervised training of conditional monge maps. arXiv preprint arXiv:2206.14262, 2022a. Charlotte Bunne, Laetitia Papaxanthos, Andreas Krause, and Marco Cuturi. Proximal optimal transport modeling of population dynamics. In International Conference on Artificial Intelligence and Statistics, pages 6511–6528. PMLR, 2022b.
+319 Rick Chartrand, Brendt Wohlberg, Kevin Vixie, and Erik Bollt. A gradient descent solution to the mongekantorovich problem. Applied Mathematical Sciences, 3(22):1071–1080, 2009. Tianlong Chen, Xiaohan Chen, Wuyang Chen, Howard Heaton, Jialin Liu, Zhangyang Wang, and Wotao Yin. Learning to optimize: A primer and a benchmark. arXiv preprint arXiv:2103.12828, 2021. Samuel Cohen, Brandon Amos, and Yaron Lipman. Riemannian convex potential maps. In International Conference on Machine Learning, pages 2028–2038. PMLR, 2021. Roberto Cominetti and J San Martín. Asymptotic analysis of the exponential penalty trajectory in linear programming. Mathematical Programming, 67(1):169–187, 1994.
+327 Nicolas Courty, Rémi Flamary, Amaury Habrard, and Alain Rakotomamonjy. Joint distribution optimal transportation for domain adaptation. Advances in Neural Information Processing Systems, 30, 2017.
+329 Nicolas Courty, Rémi Flamary, and Mélanie Ducoffe. Learning wasserstein embeddings. In International Conference on Learning Representations, 2018. Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. Advances in neural information processing systems, 26:2292–2300, 2013. Marco Cuturi, Laetitia Meng-Papaxanthos, Yingtao Tian, Charlotte Bunne, Geoff Davis, and Olivier Teboul. Optimal transport tools (ott): A jax toolbox for all things wasserstein. arXiv preprint arXiv:2201.12324, 2022. Robert Dadashi, Léonard Hussenot, Matthieu Geist, and Olivier Pietquin. Primal wasserstein imitation learning. In ICLR 2021-Ninth International Conference on Learning Representations, 2021.
+
+338 Ishan Deshpande, Yuan-Ting Hu, Ruoyu Sun, Ayis Pyrros, Nasir Siddiqui, Sanmi Koyejo, Zhizhen Zhao, David
+339 Forsyth, and Alexander G Schwing. Max-sliced wasserstein distance and its use for gans. In Proceedings of
+340 the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10648–10656, 2019.
+341 Erin Doxsey-Whitfield, Kytt MacManus, Susana B Adamo, Linda Pistolesi, John Squires, Olena Borkovska,
+342 and Sandra R Baptista. Taking advantage of the improved availability of census data: a first look at the
+343 gridded population of the world, version 4. Papers in Applied Geography, 1(3):226–234, 2015.
+344 Bjorn Engquist and Brittany D Froese. Application of the wasserstein metric to seismic signals. arXiv preprint
+345 arXiv:1311.4581, 2013.
+346 Werner Fenchel. On conjugate convex functions. Canadian Journal of Mathematics, 1(1):73–77, 1949.
+347 Arnaud Fickinger, Samuel Cohen, Stuart Russell, and Brandon Amos. Cross-domain imitation learning via
+348 optimal transport. In International Conference on Learning Representations, 2021.
+349 Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep
+350 networks. In Doina Precup and Yee Whye Teh, editors, Proceedings of the 34th International Conference
+351 on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pages 1126–1135. PMLR,
+352 06–11 Aug 2017. URL https://proceedings.mlr.press/v70/finn17a.html.
+353 Rémi Flamary, Nicolas Courty, Alexandre Gramfort, Mokhtar Z Alaya, Aurélie Boisbunon, Stanislas Chambon,
+354 Laetitia Chapel, Adrien Corenflos, Kilian Fatras, Nemo Fournier, et al. Pot: Python optimal transport.
+355 Journal of Machine Learning Research, 22(78):1–8, 2021.
+356 Aden Forrow, Jan-Christian Hütter, Mor Nitzan, Philippe Rigollet, Geoffrey Schiebinger, and Jonathan Weed.
+357 Statistical optimal transport via factored couplings. In The 22nd International Conference on Artificial
+358 Intelligence and Statistics, pages 2454–2465. PMLR, 2019.
+359 Alfred Galichon. Optimal transport methods in economics. In Optimal Transport Methods in Economics.
+360 Princeton University Press, 2016.
+361 Marta Garnelo, Dan Rosenbaum, Christopher Maddison, Tiago Ramalho, David Saxton, Murray Shanahan,
+362 Yee Whye Teh, Danilo Rezende, and SM Ali Eslami. Conditional neural processes. In International Con
+363 ference on Machine Learning, pages 1704–1713. PMLR, 2018a.
+364 Marta Garnelo, Jonathan Schwarz, Dan Rosenbaum, Fabio Viola, Danilo J Rezende, SM Eslami, and Yee Whye
+365 Teh. Neural processes. arXiv preprint arXiv:1807.01622, 2018b.
+366 Aude Genevay, Gabriel Peyre, and Marco Cuturi. Learning generative models with sinkhorn divergences. In
+367 Amos Storkey and Fernando Perez-Cruz, editors, Proceedings of the Twenty-First International Conference
+368 on Artificial Intelligence and Statistics, volume 84 of Proceedings of Machine Learning Research, pages
+369 1608–1617. PMLR, 09–11 Apr 2018. URL https://proceedings.mlr.press/v84/genevay18a.
+370 html.
+371 David Ha, Andrew Dai, and Quoc V Le. Hypernetworks. arXiv preprint arXiv:1609.09106, 2016.
+372 Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In
+373 European conference on computer vision, pages 630–645. Springer, 2016.
+374 Chin-Wei Huang, Ricky TQ Chen, Christos Tsirigotis, and Aaron Courville. Convex potential flows: Universal
+375 probability distributions with optimal transport and convex optimization. In International Conference on
+376 Learning Representations, 2020.
+377 J. J. Hull. A database for handwritten text recognition research. IEEE Transactions on Pattern Analysis and
+378 Machine Intelligence, 16(5):550–554, 1994. doi: 10.1109/34.291440.
+379 Ray Jiang, Aldo Pacchiano, Tom Stepleton, Heinrich Jiang, and Silvia Chiappa. Wasserstein fair classification.
+380 In Uncertainty in Artificial Intelligence, pages 862–872. PMLR, 2020.
+381 Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint
+382 arXiv:1412.6980, 2014.
+383 Nicholas Kolkin, Jason Salavon, and Gregory Shakhnarovich. Style transfer by relaxed optimal transport and
+384 self-similarity. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition,
+385 pages 10051–10060, 2019.
+386 Soheil Kolouri, Yang Zou, and Gustavo K Rohde. Sliced wasserstein kernels for probability distributions. In
+387 Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5258–5267, 2016.
+
+88 Soheil Kolouri, Se Rim Park, Matthew Thorpe, Dejan Slepcev, and Gustavo K Rohde. Optimal mass transport: Signal processing and machine-learning applications. IEEE signal processing magazine, 34(4):43–59, 2017. Soheil Kolouri, Phillip E Pope, Charles E Martin, and Gustavo K Rohde. Sliced wasserstein auto-encoders. In International Conference on Learning Representations, 2018. Soheil Kolouri, Kimia Nadjahi, Umut Simsekli, Roland Badeau, and Gustavo K Rohde. Generalized sliced wasserstein distances. arXiv preprint arXiv:1902.00434, 2019.
+Alexander Korotin, Vage Egiazarian, Arip Asadulaev, Alexander Safin, and Evgeny Burnaev. Wasserstein-2 generative networks. arXiv preprint arXiv:1909.13082, 2019. Alexander Korotin, Lingxiao Li, Aude Genevay, Justin M Solomon, Alexander Filippov, and Evgeny Burnaev. Do neural optimal transport solvers work? a continuous wasserstein-2 benchmark. Advances in Neural Information Processing Systems, 34:14593–14605, 2021a.
+Alexander Korotin, Lingxiao Li, Justin Solomon, and Evgeny Burnaev. Continuous wasserstein-2 barycenter estimation without minimax optimization. arXiv preprint arXiv:2102.01752, 2021b. Alexander Korotin, Daniil Selikhanovych, and Evgeny Burnaev. Neural optimal transport. arXiv preprint arXiv:2201.12220, 2022.
+Julien Lacombe, Julie Digne, Nicolas Courty, and Nicolas Bonneel. Learning to generate wasserstein barycenters, 2021. URL https://openreview.net/forum?id $\cdot ^ { = }$ 2ioNazs6lvw. Lingxiao Li, Aude Genevay, Mikhail Yurochkin, and Justin Solomon. Continuous regularized wasserstein barycenters. arXiv preprint arXiv:2008.12534, 2020. Tianyi Lin, Nhat Ho, and Michael I Jordan. On the acceleration of the sinkhorn and greenkhorn algorithms for optimal transport. arXiv preprint arXiv:1906.01437, 2019. Alexander Litvinenko, Youssef Marzouk, Hermann G Matthies, Marco Scavino, and Alessio Spantini. Computing f-divergences and distances of high-dimensional probability density functions–low-rank tensor approximations. arXiv preprint arXiv:2111.07164, 2021. Ashok Makkuva, Amirhossein Taghvaei, Sewoong Oh, and Jason Lee. Optimal transport mapping via input convex neural networks. In International Conference on Machine Learning, pages 6672–6681. PMLR, 2020. Quentin Merigot and Boris Thibert. Optimal transport: discretization and algorithms. In Handbook of Numerical Analysis, volume 22, pages 133–212. Elsevier, 2021. Petr Mokrov, Alexander Korotin, Lingxiao Li, Aude Genevay, Justin M Solomon, and Evgeny Burnaev. Largescale wasserstein gradient flows. Advances in Neural Information Processing Systems, 34:15243–15256, 2021. Boris Muzellec and Marco Cuturi. Subspace detours: Building transport plans that are optimal on subspace projections. Advances in Neural Information Processing Systems, 32, 2019. Khai Nguyen and Nhat Ho. Amortized projection optimization for sliced wasserstein generative models. arXiv preprint arXiv:2203.13417, 2022. Michaël Perrot, Nicolas Courty, Rémi Flamary, and Amaury Habrard. Mapping estimation for discrete optimal transport. Advances in Neural Information Processing Systems, 29, 2016. Gabriel Peyré, Marco Cuturi, et al. Computational optimal transport: With applications to data science. Foundations and Trends® in Machine Learning, 11(5-6):355–607, 2019. Ievgen Redko, Nicolas Courty, Rémi Flamary, and Devis Tuia. Optimal transport for multi-source domain adaptation under target shift. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 849–858. PMLR, 2019. Ralph Tyrell Rockafellar. Convex analysis. In Convex analysis. Princeton university press, 2015. Litu Rout, Alexander Korotin, and Evgeny Burnaev. Generative modeling with optimal transport maps. In International Conference on Learning Representations, 2021. Andrei A Rusu, Dushyant Rao, Jakub Sygnowski, Oriol Vinyals, Razvan Pascanu, Simon Osindero, and Raia Hadsell. Meta-learning with latent embedding optimization. In International Conference on Learning Representations, 2018.
+
+436 Filippo Santambrogio. Optimal transport for applied mathematicians. Birkäuser, NY, 55(58-63):94, 2015.
+437 Meyer Scetbon, Marco Cuturi, and Gabriel Peyré. Low-rank sinkhorn factorization. In International Confer
+438 ence on Machine Learning, pages 9344–9354. PMLR, 2021.
+439 Meyer Scetbon, Gabriel Peyré, and Marco Cuturi. Linear-time gromov wasserstein distances using low rank
+440 couplings and costs. In International Conference on Machine Learning, pages 19347–19365. PMLR, 2022.
+441 Geoffrey Schiebinger, Jian Shu, Marcin Tabaka, Brian Cleary, Vidya Subramanian, Aryeh Solomon, Joshua
+442 Gould, Siyan Liu, Stacie Lin, Peter Berube, Lia Lee, Jenny Chen, Justin Brumbaugh, Philippe Rigol
+443 let, Konrad Hochedlinger, Rudolf Jaenisch, Aviv Regev, and Eric S. Lander. Optimal-transport analy
+444 sis of single-cell gene expression identifies developmental trajectories in reprogramming. Cell, 176(4):
+445 928–943.e22, 2019. ISSN 0092-8674. doi: https://doi.org/10.1016/j.cell.2019.01.006. URL https:
+446 //www.sciencedirect.com/science/article/pii/S009286741930039X.
+447 Vivien Seguy, Bharath Bhushan Damodaran, Remi Flamary, Nicolas Courty, Antoine Rolet, and Mathieu Blon
+448 del. Large scale optimal transport and mapping estimation. In International Conference on Learning Repre
+449 sentations, 2018.
+450 Justin Solomon, Fernando De Goes, Gabriel Peyré, Marco Cuturi, Adrian Butscher, Andy Nguyen, Tao Du,
+451 and Leonidas Guibas. Convolutional wasserstein distances: Efficient optimal transportation on geometric
+452 domains. ACM Transactions on Graphics (TOG), 34(4):1–11, 2015.
+453 Max Sommerfeld, Jörn Schrieber, Yoav Zemel, and Axel Munk. Optimal transport: Fast probabilistic approxi
+454 mation with exact solvers. J. Mach. Learn. Res., 20:105–1, 2019.
+455 Kenneth O Stanley, David B D’Ambrosio, and Jason Gauci. A hypercube-based encoding for evolving large
+456 scale neural networks. Artificial life, 15(2):185–212, 2009.
+457 Amirhossein Taghvaei and Amin Jalali. 2-wasserstein approximation via restricted convex potentials with
+458 application to improved training for gans. arXiv preprint arXiv:1902.07197, 2019.
+459 Matthew Tancik, Ben Mildenhall, Terrance Wang, Divi Schmidt, Pratul P Srinivasan, Jonathan T Barron, and
+460 Ren Ng. Learned initializations for optimizing coordinate-based neural representations. In Proceedings of
+461 the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2846–2855, 2021.
+462 Alexis Thibault, Lenaic Chizat, Charles Dossal, and Nicolas Papadakis. Overrelaxed sinkhorn-knopp algorithm
+463 for regularized optimal transport. arXiv preprint arXiv:1711.01851, 2017.
+464 James Thornton and Marco Cuturi. Rethinking initialization of the sinkhorn algorithm. arXiv preprint
+465 arXiv:2206.07630, 2022.
+466 Cédric Villani. Optimal transport: old and new, volume 338. Springer, 2009.
+467 Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using
+468 cycle-consistent adversarial networks. In Proceedings of the IEEE international conference on computer
+469 vision, pages 2223–2232, 2017.
+470 Luisa Zintgraf, Kyriacos Shiarli, Vitaly Kurin, Katja Hofmann, and Shimon Whiteson. Fast context adaptation
+471 via meta-learning. In International Conference on Machine Learning, pages 7693–7702. PMLR, 2019.
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] We hope so
+(b) Did you describe the limitations of your work? [Yes] In sect. 6
+(c) Did you discuss any potential negative societal impacts of your work? [No] We do not immediately foresee any that our work would add that the broader optimal transport field doesn’t already have
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results... (This is not a theory paper)
+
+(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes]
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] We show results from multiple trials in most places
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes]
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [Yes]
+(c) Did you include new assets either in the supplemental material or as a URL? [No]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
+
+
+Figure 8: We selected $\epsilon = 1 0 ^ { - 2 }$ for our MNIST coupling experiments as it results in transport maps that are not too blurry or sharp.
+
+# 512 B Other models for continuous OT
+
+While developing the hyper-network or Meta ICNN in sect. 3.2 for predicting couplings between continuous measures, we considered alternative modeling formulations briefly documented in this section. We finalized only the hyper-network model because it is conceptually the most similar to predicting the optimal dual variables in the continuous setting and results in rapid predictions.
+
+# 517 B.1 Optimization-based meta-learning (MAML-inspired)
+
+518 The model-agnostic meta-learning setup proposed in MAML [Finn et al., 2017] could also be ap
+519 plied in the Meta OT setting to learn an adaptable initial parameterization. In the continuous setting,
+520 one initial version would take a parameterized dual potential model $\psi _ { \varphi } ( x )$ and seek to learn an ini
+521 tial parameterization $\varphi _ { 0 }$ so that optimizing a loss such as the W2GN loss $\mathcal { L }$ from eq. (12) results in
+522 a minimal $\mathcal { L } ( \varphi _ { K } )$ after adapting the model for $K$ steps. Formally, this would optimize:
+
+$$
+\operatorname * { a r g m i n } _ { \varphi _ { 0 } } \mathcal { L } ( \varphi _ { K } ) \quad \mathrm { w h e r e } \quad \varphi _ { t + 1 } = \varphi _ { t } - \nabla _ { \varphi } \mathcal { L } ( \varphi _ { t } )
+$$
+
+Tancik et al. [2021] explores similar learned initializations for coordinate-based neural implicit representations for 2D images, CT scan reconstruction, and 3d shape and scene recovery from 2D observations.
+
+Challenges for Meta OT. The transport maps given by $T = \nabla \psi$ can significantly vary depending on the input measures $\alpha , \beta$ . We found it difficult to learn an initialization that can be rapidly adapted, and optimizing eq. (19) is more computationally expensive than eq. (18) as it requires unrolling through many evaluations of the transport loss $\mathcal { L }$ . And, we found that only learning to predict the optimal parameters with eq. (18), conditional on the input measures, and then fine-tuning with W2GN to be stable.
+
+532 Advantages for Meta OT. Exploring MAML-inspired methods could further incorporate the knowl
+533 edge that the model’s prediction is going to be fine-tuned into the learning process. One promising
+
+direction we did not try could be to integrate some of the ideas from LEO [Rusu et al., 2018] and CAVIA [Zintgraf et al., 2019], which propose to learn a latent space for the parameters where the initialization is also conditional on the input.
+
+# B.2 Neural process and conditional Monge maps
+
+The (conditional) neural process models considered in Garnelo et al. [2018b,a] can also be adapted for the Meta OT setting, and is similar to the model proposed in Bunne et al. [2022a]. In the continuous setting, this would result in a dual potential that is also conditioned on a representation of the input measures, e.g. $\psi _ { \varphi } ( x ; z )$ where $z : = f _ { \varphi } ^ { \mathrm { e m b } } ( \alpha , \beta )$ is a learned embedding of the input measures that is learned with the parameters of $\psi$ . This could be formulated as
+
+$$
+\underset { \varphi } { \arg \operatorname* { m i n } } \ \underset { ( \alpha , \beta ) \sim \mathcal { D } } { \mathbb { E } } \mathcal { L } ( \varphi , f _ { \varphi } ^ { \mathrm { e m b } } ( \alpha , \beta ) ) ,
+$$
+
+543 where $\mathcal { L }$ modifies the model used in the loss eq. (12) to also be conditioned on the context extracted
+544 from the measures.
+
+Challenges for Meta OT. This raises the issue on best-formulating the model to be conditional on the context. One way could be to append $z$ to the input point $x$ in the domain. Bunne et al. [2022a] proposes to use the Partially Input-Convex Neural Network (PICNN) from [Amos et al., 2017] to make the model convex with respect to $x$ and not $z$ .
+
+Advantages for Meta OT. A large advantage is that the representation $z$ of the measures $\alpha , \beta$ would be significantly lower-dimensional than the parameters $\varphi$ that our Meta OT models are predicting.
+
+# 551 C Additional experimental and implementation details
+
+We have attached the Jax source code necessary to run and reproduce all of the experiments in our 553 paper and will open-source all of it. Here is a basic overview of the files:
+
+
+
+555 Connecting to the data is one difficulty in running the experiments. The easiest experiment to re-run
+556 is the MNIST one, which will automatically download the dataset:
+557558 1 ./ train_discrete . py # Train the model , outputting to
+559 2 ./ eval_discrete . py < exp_dir > # Evaluate the learned models
+560 3 ./ plot_mnist . py < exp_dir > # Produce further visualizations 561
+
+# 562 C.1 Hyper-parameters
+
+563 We briefly summarize the hyper-parameters we used for training, which we did not extensively tune.
+564 In the discrete setting, we use the same hyper-parameters for the MNIST and spherical settings.
+
+Table 3: Discrete OT hyper-parameters.
+
+
Name
Value
Batch size
128
Number of training iterations
50000
MLP Hidden Sizes
[1024,1024,1024]
Adam learning rate
1e-3
+
+565
+
+Table 4: Continuous OT hyper-parameters.
+
+
Name
Value
Meta batch size (for α,β)
8
Inner batch size (to estimate L) Cycle loss weight ()
1024
Adam learning rate
3. 1e-3
l2 weight penalty
1e-6
Max grad norm (for clipping)
1.
Number of training iterations
200000
MetaICNNEncoder
ResNet18
Encoder output size (both measures)
MetaICNNDecoderHidden Sizes
256×2 [512]
+
+# 566 C.2 Sinkhorn convergence times, varying thresholds
+
+In the main paper, table 1 reports the runtime of Sinkhorn to reach a convergence threshold of the marginal error being below a tolerance of $1 0 ^ { - 3 }$ , which is the default value used in many solvers. app. C.2 report the results from sweeping over other thresholds and show that Meta OT’s initialization is consistently able to help.
+
+Table 5: Sinkhorn runtime to reach a thresholded marginal error on MNIST.
+
+
Initialization
Threshold=10-2
Threshold=10-3
Threshold=10-4
Threshold=10-5
Zeros
4.5. 10-3 ±1.5·10-3
7.7.10-3 ±1.2· 10-3
1.1.10-2 ±1.8.10-3
1.5.10-2 ±2.3.10-3
Gaussian
4.1· 10- ±1.2 ·10-3
7.7 · 10-3 ±1.4 10-3
1.1: 10-2 ±1.7· 10-3
1.4: 10-² ±2.4 · 10-3
Meta OT
2.3 · 10-3 ±9.2 · 10-6
3.9 · 10-3 ±1.6 · 10-3
6.7 · 10-3 ±1.4 · 10-3
1.0 · 10-² ±2.4 · 10-3
+
+Table 6: Sinkhorn runtime to reach a thresholded marginal error on the spherical transport problem.
+
+
Initialization
Threshold=10-2
Threshold=10-3
Threshold=10-4
Threshold=10-5
Zeros
8.8.10-1 ±1.3·10-1
1.4 ±1.9 · 10-1
2.1 ±3.6:10-1
2.8 ±5.6.10-1
Gaussian
5.6.10-1 ±9.9.10-2
1.1 ±2.0 : 10-1
1.7 ±3.5 - 10-1
2.4 ±5.4 · 10-1
Meta OT
7.8 · 10-² ±3.4· 10-²
0.44 ±1.5 10-1
0.97 ±3.2 - 10-1
1.7 ±6.8 10-1
+
+572
+573
+574
+
+App. C.3 shows the convergence during training of Meta OT models in the discrete and continuous settings over 10 trials on our single Quadro GP100 GPU. The MNIST models are consistently trained to optimality within 2 minutes (!) while the continuous model takes a few hours to train.
+
+
+Figure 9: Convergence of Meta OT models during training, reported over iterations and wall-clock time. We run each experiment for 10 trials with different seeds and report each trial as a line.
+
+# 575 D Out-of-distribution generalization
+
+App. D tests the ability of Meta OT to predict potentials for out-of-distribution input data. We consider the pairwise training and evaluation on the following datasets: 1) MNIST; 2) USPS [Hull, 1994] (upscaled to have the same size as the MNIST); 3) Google Doodles dataset \* with classes Crab, Cat and Faces; 4) sparsified random uniform data in [0,1] where sparsity (zeroing values below 0.95) is used to mimic the sparse signal in black-and-white images. For each pair, eg, MNIST-USPS, we train on one dataset and use the other to predict the potentials. The comparison is done using the same metric as before, i.e., the deviation from the marginal constraints defined in eq. (7).
+
+
+Figure 10: Cross-domain experiments.
+
+# 583 E Additional color transfer results
+
+84 We next show additional color transfer results from the experiments in sect. 4.3 on the following
+85 public domain images from WikiArt:
+
+• Distant View of the Pyramids by Winston Churchill (1921)
+• Charing Cross Bridge, Overcast Weather by Claude Monet (1900)
+• Houses of Parliament by Claude Monet (1904)
+• October Sundown, Newport by Childe Hassam (1901)
+• Landscape with House at Ceret by Juan Gris (1913)
+• Irises in Monet’s Garden by Claude Monet (1900)
+• Crystal Gradation by Paul Klee (1921)
+• Senecio by Paul Klee (1922)
+• Váza s kvetinami by Josef Capek (1914) ˇ
+• Sower with Setting Sun by Vincent van Gogh (1888)
+• Three Trees in Grey Weather by Claude Monet (1891)
+• Vase with Daisies and Anemones by Vincent van Gogh (1887)
+
+
+Figure 11: Meta ICNN (initial prediction). The sources are given in the beginning of app. E.
+
+
+Figure 12: Meta ICNN $^ +$ W2GN fine-tuning. The sources are given in the beginning of app. E.
+
+
+Figure 13: W2GN (final). The sources are given in the beginning of app. E.
\ No newline at end of file
diff --git a/md/dev/vSVLM2j9eie/vSVLM2j9eie.md b/md/dev/vSVLM2j9eie/vSVLM2j9eie.md
new file mode 100644
index 0000000000000000000000000000000000000000..97375786b584cd31636eb5701b7390428d3e224a
--- /dev/null
+++ b/md/dev/vSVLM2j9eie/vSVLM2j9eie.md
@@ -0,0 +1,443 @@
+# CROSSFORMER: TRANSFORMER UTILIZING CROSSDIMENSION DEPENDENCY FOR MULTIVARIATE TIME SERIES FORECASTING
+
+Yunhao Zhang & Junchi Yan∗
+MoE Key Lab of Artificial Intelligence, Shanghai Jiao Tong University and Shanghai AI Lab
+{zhangyunhao, yanjunchi}@sjtu.edu.cn
+Code: https://github.com/Thinklab-SJTU/Crossformer
+
+# ABSTRACT
+
+Recently many deep models have been proposed for multivariate time series (MTS) forecasting. In particular, Transformer-based models have shown great potential because they can capture long-term dependency. However, existing Transformerbased models mainly focus on modeling the temporal dependency (cross-time dependency) yet often omit the dependency among different variables (crossdimension dependency), which is critical for MTS forecasting. To fill the gap, we propose Crossformer, a Transformer-based model utilizing cross-dimension dependency for MTS forecasting. In Crossformer, the input MTS is embedded into a 2D vector array through the Dimension-Segment-Wise (DSW) embedding to preserve time and dimension information. Then the Two-Stage Attention (TSA) layer is proposed to efficiently capture the cross-time and cross-dimension dependency. Utilizing DSW embedding and TSA layer, Crossformer establishes a Hierarchical Encoder-Decoder (HED) to use the information at different scales for the final forecasting. Extensive experimental results on six real-world datasets show the effectiveness of Crossformer against previous state-of-the-arts.
+
+# 1 INTRODUCTION
+
+Multivariate time series (MTS) are time series with multiple dimensions, where each dimension represents a specific univariate time series (e.g. a climate feature of weather). MTS forecasting aims to forecast the future value of MTS using their historical values. MTS forecasting benefits the decision-making of downstream tasks and is widely used in many fields including weather (Angryk et al., 2020), energy (Demirel et al., 2012), finance (Patton, 2013), etc. With the development of deep learning, many models have been proposed and achieved superior performances in MTS forecasting (Lea et al., 2017; Qin et al., 2017; Flunkert et al., 2017; Rangapuram et al., 2018; Li et al., 2019a; Wu et al., 2020; Li et al., 2021). Among them, the recent Transformer-based models (Li et al., 2019b; Zhou et al., 2021; Wu et al., 2021a; Liu et al., 2021a; Zhou et al., 2022; Chen et al., 2022) show great potential thanks to their ability to capture long-term temporal dependency (cross-time dependency).
+
+Besides cross-time dependency, the cross-dimension dependency is also critical for MTS forecasting, i.e. for a specific dimension, information from associated series in other dimensions may improve prediction. For example, when predicting future temperature, not only the historical temperature, but also historical wind speed helps to forecast. Some previous neural models explicitly capture the cross-dimension dependency, i.e. preserving the information of dimensions in the latent feature space and using convolution neural network (CNN) (Lai et al., 2018) or graph neural network (GNN) (Wu et al., 2020; Cao et al., 2020) to capture their dependency. However, recent Transformer-based models only implicitly utilize this dependency by embedding. In general, Transformer-based models embed data points in all dimensions at the same time step into a feature vector and try to capture dependency among different time steps (like Fig. 1 (b)). In this way, cross-time dependency is well captured, but cross-dimension dependency is not, which may limit their forecasting capability.
+
+To fill the gap, we propose Crossformer, a Transformer-based model that explicitly utilizes crossdimension dependency for MTS forecasting. Specifically, we devise Dimension-Segment-Wise (DSW) embedding to process the historical time series. In DSW embedding, the series in each dimension is first partitioned into segments and then embedded into feature vectors. The output of DSW embedding is a 2D vector array where the two axes correspond to time and dimension. Then we propose the Two-Stage-Attention (TSA) layer to efficiently capture the cross-time and cross-dimension dependency among the 2D vector array. Using DSW embedding and TSA layer, Crossformer establishes a Hierarchical Encoder-Decoder (HED) for forecasting. In HED, each layer corresponds to a scale. The encoder’s upper layer merges adjacent segments output by the lower layer to capture the dependency at a coarser scale. Decoder layers generate predictions at different scales and add them up as the final prediction. The contributions of this paper are:
+
+1) We dive into the existing Transformer-based models for MTS forecasting and figure out that the cross-dimension dependency is not well utilized: these models simply embed data points of all dimensions at a specific time step into a single vector and focus on capturing the cross-time dependency among different time steps. Without adequate and explicit mining and utilization of cross-dimension dependency, their forecasting capability is empirically shown limited.
+
+2) We develop Crossformer, a Transformer model utilizing cross-dimension dependency for MTS forecasting. This is one of the few transformer models (perhaps the first to our best knowledge) that explicitly explores and utilizes cross-dimension dependency for MTS forecasting.
+
+3) Extensive experimental results on six real-world benchmarks show the effectiveness of our Crossformer against previous state-of-the-arts. Specifically, Crossformer ranks top-1 among the 9 models for comparison on 36 out of the 58 settings of varying prediction lengths and metrics and ranks top-2 on 51 settings.
+
+# 2 RELATED WORKS
+
+Multivariate Time Series Forecasting. MTS forecasting models can be roughly divided into statistical and neural models. Vector auto-regressive (VAR) model (Kilian & LAtkepohl ˜ , 2017) and Vector auto-regressive moving average (VARMA) are typical statistical models, which assume linear cross-dimension and cross-time dependency. With the development of deep learning, many neural models have been proposed and often empirically show better performance than statistical ones. TCN (Lea et al., 2017) and DeepAR (Flunkert et al., 2017) treat the MTS data as a sequence of vectors and use CNN/RNN to capture the temporal dependency. LSTnet (Lai et al., 2018) employs CNN to capture cross-dimension dependency and RNN for cross-time dependency. Another category of works use graph neural networks (GNNs) to capture the cross-dimension dependency explicitly for forecasting (Li et al., 2018; Yu et al., 2018; Cao et al., 2020; Wu et al., 2020). For example, MTGNN (Wu et al., 2020) uses temporal convolution and graph convolution layers to capture crosstime and cross-dimension dependency. These neural models capture the cross-time dependency through CNN or RNN, which have difficulty in modeling long-term dependency.
+
+Transformers for MTS Forecasting. Transformers (Vaswani et al., 2017) have achieved success in natural language processing (NLP) (Devlin et al., 2019), vision (CV) (Dosovitskiy et al., 2021) and speech processing (Dong et al., 2018). Recently, many Transformer-based models have been proposed for MTS forecasting and show great potential (Li et al., 2019b; Zhou et al., 2021; Wu et al., 2021a; Liu et al., 2021a; Zhou et al., 2022; Du et al., 2022). LogTrans (Li et al., 2019b) proposes the LogSparse attention that reduces the computation complexity of Transformer from ${ \dot { O } } ( { \dot { L } } ^ { 2 } )$ to $O \left( L ( \log L ) ^ { 2 } \right)$ . Informer (Zhou et al., 2021) utilizes the sparsity of attention score through KL divergence estimation and proposes ProbSparse self-attention which achieves $O ( L \log L )$ complexity. Autoformer (Wu et al., 2021a) introduces a decomposition architecture with an Auto-Correlation mechanism to Transformer, which also achieves the $O ( L \log L )$ complexity. Pyraformer (Liu et al., 2021a) introduces a pyramidal attention module that summarizes features at different resolutions and models the temporal dependencies of different ranges with the complexity of $O ( L )$ . FEDformer (Zhou et al., 2022) proposes that time series have a sparse representation in frequency domain and develop a frequency enhanced Transformer with the $O ( L )$ complexity. Preformer (Du et al., 2022) divides the embedded feature vector sequence into segments and utilizes segment-wise correlation-based attention for forecasting. These models mainly focus on reducing the complexity of cross-time dependency modeling, but omits the cross-dimension dependency which is critical for MTS forecasting.
+
+
+Figure 1: Illustration for our DSW embedding. (a) Self-attention scores from a 2-layer Transformer trained on ETTh1, showing that MTS data tends to be segmented. (b) Embedding method of previous Transformer-based models (Li et al., 2019b; Zhou et al., 2021; Wu et al., 2021a; Liu et al., 2021a): data points in different dimensions at the same step are embedded into a vector. (c) DSW embedding of Crossformer: in each dimension, nearby points over time form a segment for embedding.
+
+Vision Transformers. Transformer is initially applied to NLP for sequence modeling, recent works apply transformer to CV tasks to process images (Dosovitskiy et al., 2021; Touvron et al., 2021; Liu et al., 2021b; Chen et al., 2021; Han et al., 2021). These works achieve state-of-the-art performance on various tasks in CV and inspire our work. ViT (Dosovitskiy et al., 2021) is one of the pioneers of vision transformers. The basic idea of ViT is to split an image into non-overlapping medium-sized patches, then it rearranges these patches into a sequence to be input to the Transformer. The idea of partitioning images into patches inspires our DSW embedding where MTS is split into dimensionwise segments. Swin Transformer (Liu et al., 2021b) performs local attention within a window to reduce the complexity and builds hierarchical feature maps by merging image patches. Readers can refer to the recent survey (Han et al., 2022) for comprehensive study on vision transformers.
+
+# 3 METHODOLOGY
+
+In multivariate time series forecasting, one aims to predict the future value of time series $\mathbf { x } _ { T + 1 : T + \tau } \in$ Rτ×D given the history $\mathbf { x } _ { 1 : T } \in \mathbb { R } ^ { \tilde { T } \times D }$ , where $\tau$ , $T$ is the number of time steps in the future and past, respectively2. $D > 1$ is the number of dimensions. A natural assumption is that these $D$ series are associated (e.g. climate features of weather), which helps to improve the forecasting accuracy. To utilize the cross-dimension dependency, in Section 3.1, we embed the MTS using Dimension-Segment-Wise (DSW) embedding. In Section 3.2, we propose a Two-Stage Attention (TSA) layer to efficiently capture the dependency among the embedded segments. In Section 3.3, using DSW embedding and TSA layer, we construct a hierarchical encoder-decoder (HED) to utilize information at different scales for final forecasting.
+
+# 3.1 DIMENSION-SEGMENT-WISE EMBEDDING
+
+To motivate our approach, we first analyze the embedding methods of the previous Transformer-based models for MTS forecasting (Zhou et al., 2021; Wu et al., 2021a; Liu et al., 2021a; Zhou et al., 2022). As shown in Fig. 1 (b), existing methods embed data points at the same time step into a vector: $\mathbf { x } _ { t } \mathbf { h } _ { t } , \mathbf { x } _ { t } \in \bar { \mathbb { R } } ^ { D } , \mathbf { h } _ { t } \in \mathbb { R } ^ { d _ { m o d e l } }$ , where $\mathbf { x } _ { t }$ represents all the data points in $D$ dimensions at step $t$ . In this way, the input $\mathbf { x } _ { 1 : T }$ is embedded into $T$ vectors $\{ \mathbf { h } _ { 1 } , \mathbf { h } _ { 2 } , \dots , \mathbf { h } _ { T } \}$ . Then the dependency among the $T$ vectors is captured for forecasting. Therefore, previous Transformer-based models mainly capture cross-time dependency, while the cross-dimension dependency is not explicitly captured during embedding, which limits their forecasting capability.
+
+Transformer was originally developed for NLP (Vaswani et al., 2017), where each embedded vector represents an informative word. For MTS, a single value at a step alone provides little information.
+
+While it forms informative pattern with nearby values in time domain. Fig. 1 (a) shows a typical attention score map of original Transformer for MTS forecasting. We can see that attention values have a tendency to segment, i.e. close data points have similar attention weights.
+
+Based on the above two points, we argue that an embedded vector should represent a series segment of single dimension (Fig. 1 (c)), rather than the values of all dimensions at single step (Fig. 1 (b)). To this end, we propose Dimension-Segment-Wise (DSW) embedding where the points in each dimension are divided into segments of length $L _ { s e g }$ and then embedded:
+
+$$
+\begin{array} { r l } & { \mathbf { x } _ { 1 : T } = \left\{ \mathbf { x } _ { i , d } ^ { ( s ) } \vert 1 \leq i \leq \frac { T } { L _ { s e g } } , 1 \leq d \leq D \right\} } \\ & { \mathbf { x } _ { i , d } ^ { ( s ) } = \left\{ x _ { t , d } \vert ( i - 1 ) \times L _ { s e g } < t \leq i \times L _ { s e g } \right\} } \end{array}
+$$
+
+where x(s)i,d $\mathbf { x } _ { i , d } ^ { ( s ) } \in \mathbb { R } ^ { L _ { s e g } }$ is the $i$ -th segment in dimension $d$ with length $L _ { s e g }$ . For convenience, we assume that $T , \tau$ are divisible by $L _ { s e g }$ . Then each segment is embedded into a vector using linear projection added with a position embedding:
+
+$$
+\mathbf { h } _ { i , d } = \mathbf { E x } _ { i , d } ^ { ( s ) } + \mathbf { E } _ { i , d } ^ { ( p o s ) }
+$$
+
+where $\mathbf { E } \in \mathbb { R } ^ { d _ { m o d e l } \times L _ { s e g } }$ denotes the learnable projection matrix, and ${ \bf E } _ { i , d } ^ { ( p o s ) } \in \mathbb { R } ^ { d _ { m o d e l } }$ denotes the learnable position embedding for position $( i , d )$ . After embedding, we obtain a 2D vector array $\begin{array} { r } { \mathbf { H } = \left\{ \mathbf { h } _ { i , d } | 1 \leq i \leq \frac { T } { L _ { s e g } } , 1 \leq d \leq D \right\} } \end{array}$ , where each $\mathbf { h } _ { i , d }$ represents a univariate time series segment. The idea of segmentation is also used in Du et al. (2022), which splits the embedded 1D vector sequence into segments to compute the Segment-Correlation in order to enhance locality and reduce computation complexity. However, like other Transformers for MTS forecasting, it does not explicitly capture cross-dimension dependency.
+
+# 3.2 TWO-STAGE ATTENTION LAYER
+
+For the obtained 2D array $\mathbf { H }$ , one can flatten it into a 1D sequence so that it can be input to a canonical Transformer like ViT (Dosovitskiy et al., 2021) does in vision. While we have specific considerations: 1) Different from images where the axes of height and width are interchangeable, the axes of time and dimension for MTS have different meanings and thus should be treated differently. 2) Directly applying self-attention on 2D array will cause the complexity of O(D2 T 2L2 ) , which is unaffordable for large $D$ . Therefore, we propose the Two-Stage Attention (TSA) Layer to capture cross-time and cross-dimension dependency among the 2D vector array, as sketched in Fig. 2 (a).
+
+Cross-Time Stage Given a 2D array $\mathbf { Z } \in \mathbb { R } ^ { L \times D \times d _ { m o d e l } }$ as the input of the TSA Layer, where $L$ and $D$ are the number of segments and dimensions, respectively. $\mathbf { Z }$ here can be the output of DSW embedding or lower TSA layers. For convenience, in the following, we use $\mathbf { Z } _ { i , }$ : to denote the vectors of all dimensions at time step $i$ , $\mathbf { Z } _ { : , d }$ for those of all time steps in dimension $d$ . In the cross-time stage, we directly apply multi-head self-attention (MSA) to each dimension:
+
+$$
+\begin{array} { r l } & { \hat { \mathbf { Z } } _ { : , d } ^ { t i m e } = \mathrm { L a y e r N o r m } \Big ( \mathbf { Z } _ { : , d } + \mathrm { M S } \mathbb { A } ^ { t i m e } ( \mathbf { Z } _ { : , d } , \mathbf { Z } _ { : , d } , \mathbf { Z } _ { : , d } ) \Big ) } \\ & { \mathbf { Z } ^ { t i m e } = \mathrm { L a y e r N o r m } \left( \hat { \mathbf { Z } } ^ { t i m e } + \mathrm { M L P } ( \hat { \mathbf { Z } } ^ { t i m e } ) \right) } \end{array}
+$$
+
+where $1 \leq d \leq D$ and LayerNorm denotes layer normalization as widely adopted in Vaswani et al. (2017); Dosovitskiy et al. (2021); Zhou et al. (2021), MLP denotes a multi-layer (two in this paper) feedforward network, $\mathtt { M S A } ( \mathbf { Q } , \mathbf { K } , \mathbf { V } )$ denotes the multi-head self-attention (Vaswani et al., 2017) layer where $\mathbf { Q } , \mathbf { K } , \mathbf { V }$ serve as queries, keys and values. All dimensions $1 \leq d \leq D _ { \cdot }$ share the same MSA layer. $\hat { \mathbf { Z } } ^ { t i m e } , \mathbf { Z } ^ { t i m e }$ denotes the output of the MSA and MLP.
+
+The computation complexity of cross-time stage is $O ( D L ^ { 2 } )$ . After this stage, the dependency among time segments in the same dimension is captured in ${ \bf Z } ^ { t i m e }$ . Then ${ \bf Z } ^ { t i \bar { m } e }$ becomes the input of Cross-Dimension Stage to capture cross-dimension dependency.
+
+
+Figure 2: The TSA layer. (a) Two-Stage Attention Layer to process a 2D vector array representing multivariate time series: each vector refers to a segment of the original series. The whole vector array goes through the Cross-Time Stage and Cross-Dimension Stage to get corresponding dependency. (b) Directly using MSA in Cross-Dimension Stage to build the $D$ -to- $D$ connection results in $O ( D ^ { 2 } )$ complexity. (c) Router mechanism for Cross-Dimension Stage: a small fixed number (c) of “routers” gather information from all dimensions and then distribute the gathered information. The complexity is reduced to $O ( 2 c D ) = O ( D )$ .
+
+Cross-Dimension Stage We can use a large $L _ { s e g }$ for long sequence in DSW Embedding to reduce the number of segments $L$ in cross-time stage. While in Cross-Dimension Stage, we can not partition dimensions and directly apply MSA will cause the complexity of $O ( D ^ { 2 } )$ (as shown in Fig. 2 (b)), which is unaffordable for datasets with large $D$ . Instead, we propose the router mechanism for potentially large $D$ . As shown in Fig. 2 (c), we set a small fixed number $c < < D$ ) of learnable vectors for each time step $i$ as routers. These routers first aggregate messages from all dimensions by using routers as query in MSA and vectors of all dimensions as key and value. Then routers distribute the received messages among dimensions by using vectors of dimensions as query and aggregated messages as key and value. In this way, the all-to-all connection among $D$ dimensions are built:
+
+$$
+\begin{array} { r l } & { \quad \mathbf { B } _ { i , : } = \mathbb { M } \mathbb { S } \mathbb { A } _ { 1 } ^ { d i m } ( \mathbf { R } _ { i , : } , \mathbf { Z } _ { i , : } ^ { t i m e } , \mathbf { Z } _ { i , : } ^ { t i m e } ) , 1 \leq i \leq L } \\ & { \quad \overline { { \mathbf { Z } } } _ { i , : } ^ { d i m } = \mathbb { M } \mathbb { S } \mathbb { A } _ { 2 } ^ { d i m } ( \mathbf { Z } _ { i , : } ^ { t i m e } , \mathbf { B } _ { i , : } , \mathbf { B } _ { i , : } ) , 1 \leq i \leq L } \\ & { \quad \hat { \mathbf { Z } } ^ { d i m } = \mathbb { L } \mathbb { a } \mathbb { Y } \mathrm { e r N o r m } \left( \mathbf { Z } ^ { t i m e } + \overline { { \mathbf { Z } } } ^ { d i m } \right) } \\ & { \quad \mathbf { Z } ^ { d i m } = \mathbb { L } \mathbb { a } \mathbb { Y } \mathrm { e r N o r m } \left( \hat { \mathbf { Z } } ^ { d i m } + \mathbb { M } \mathbf { L } \mathbf { P } ( \hat { \mathbf { Z } } ^ { d i m } ) \right) } \end{array}
+$$
+
+where $\mathbf { R } \in \mathbb { R } ^ { L \times c \times d _ { m o d e l } }$ $\dot { } c$ is a constant) is the learnable vector array serving as routers. B ∈ RL×c×dmodel is the aggregated messages from all dimensions. Zdim denotes output of the router mechanism. All time steps $( 1 ~ \leq ~ i ~ \leq ~ L )$ share the same $\mathbf { M S A } _ { 1 } ^ { d i m }$ , $\mathbf { M S A } _ { 2 } ^ { d i m }$ . $\hat { \mathbf { Z } } ^ { d i m } , \mathbf { Z } ^ { d i m }$ denote output of skip connection and MLP respectively. The router mechanism reduce the complexity from $O ( D ^ { 2 } L )$ to $O ( D L )$ .
+
+Adding up Eq. 3 and Eq. 4, we model the two stages as:
+
+$$
+\mathbf { Y } = \mathbf { Z } ^ { d i m } = \mathrm { T S A } ( \mathbf { Z } )
+$$
+
+
+Figure 3: Architecture of the Hierarchical Encoder-Decoder in Crossformer with 3 encoder layers. The length of each vector denotes the covered time range. The encoder (left) uses TSA layer and segment merging to capture dependency at different scales: a vector in upper layer covers a longer range, resulting in dependency at a coarser scale. Exploring different scales, the decoder (right) makes the final prediction by forecasting at each scale and adding them up.
+
+where Z, $\mathbf { Y } \in \mathbb { R } ^ { L \times D \times d _ { m o d e l } }$ denotes the input and output vector array of TSA layer, respectively. Note that the overall computation complexity of the
+
+TSA layer is $O ( D L ^ { 2 } + D L ) = O ( D L ^ { 2 } )$ . After the Cross-Time and Cross-Dimension Stages, every two segments (i.e. ${ \bf Z } _ { i _ { 1 } , d _ { 1 } } , { \bf Z } _ { i _ { 2 } , d _ { 2 } } )$ in $\mathbf { Z }$ are connected, as such both cross-time and cross-dimension dependencies are captured in $\mathbf { Y }$ .
+
+# 3.3 HIERARCHICAL ENCODER-DECODER
+
+Hierarchical structures are widely used in Transformers for MTS forecasting to capture information at different scales (Zhou et al., 2021; Liu et al., 2021a). In this section, we use the proposed DSW embedding, TSA layer and segment merging to construct a Hierarchical Encoder-Decoder (HED). As shown in Fig. 3, the upper layer utilizes information at a coarser scale for forecasting. Forecasting values at different scales are added to output the final result.
+
+Encoder In each layer of the encoder (except the first layer), every two adjacent vectors in time domain are merged to obtain the representation at a coarser level. Then a TSA layer is applied to capture dependency at this scale. This process is modeled as ${ \bf Z } ^ { e n c , l } = \mathrm { E n c o d e r } ( { \bf Z } ^ { e \bar { n } c , l - 1 } )$ :
+
+$$
+\left\{ \begin{array} { l l } { l = 1 : } & { \hat { \mathbf { Z } } ^ { e n c , l } = \mathbf { H } } \\ { l > 1 : } & { \hat { \mathbf { Z } } _ { i , d } ^ { e n c , l } = \mathbf { M } [ \mathbf { Z } _ { 2 i - 1 , d } ^ { e n c , l - 1 } \cdot \mathbf { Z } _ { 2 i , d } ^ { e n c , l - 1 } ] , 1 \le i \le \frac { L _ { l - 1 } } { 2 } , 1 \le d \le D } \\ { } & { \mathbf { Z } ^ { e n c , l } = \mathrm { T S A } ( \hat { \mathbf { Z } } ^ { e n c , l } ) } \end{array} \right.
+$$
+
+where $\mathbf { H }$ denotes the 2D array obtained by DSW embedding; ${ \bf Z } ^ { e n c , l }$ denotes the output of the $l$ -th encoder layer; $\textbf { M } \in \ \mathbb { R } ^ { d _ { m o d e l } \times 2 d _ { m o d e l } }$ denotes a learnable matrix for segment merging; $[ \cdot ]$ denotes the concatenation operation; $L _ { l - 1 }$ denotes the number of segments in each dimension in layer $l - 1$ , if it is not divisible by 2, we pad ${ \bf Z } ^ { e n c , l - 1 }$ to the proper length; $\hat { \mathbf { Z } } ^ { e n c , l }$ denotes the array after segment merging in the $i$ -th layer. Suppose there are $N$ layers in the encoder, we use ${ \bf { Z } } ^ { e n c , 0 } , { \bf { Z } } ^ { e n c , \tilde { 1 } } , \ldots , { \bf { Z } } ^ { e n c , N } , \left( { \bf { Z } } ^ { e n c , 0 } = \bf { H } \right)$ to represent the $N + 1$ outputs of the encoder. The complexity of each encoder layer is $\begin{array} { r } { O ( D \frac { T ^ { 2 } } { L _ { s e g } ^ { 2 } } ) } \end{array}$
+
+Decoder Obtaining the $N + 1$ feature arrays output by the encoder, we use $N + 1$ layers (indexed by $0 , 1 , \ldots , N )$ in decoder for forecasting. Layer $l$ takes the $l$ -th encoded array as input, then outputs a decoded 2D array of layer $l$ . This process is summarized as ${ \bf Z } ^ { d e c , l } = \mathrm { D e c o } \dot { { \bf d e r } } ( { \bf Z } ^ { d e c , l - 1 } , { \bf Z } ^ { e n c , \dot { l } } )$ :
+
+$$
+\begin{array} { r l } & { \left\{ \begin{array} { l l } { l = 0 : } & { \tilde { \mathbf { Z } } ^ { d e c , l } } \\ { l > 0 : } & { \tilde { \mathbf { Z } } ^ { d e c , l } } \end{array} \right. = \mathrm { T S } \mathbb { A } ( \mathbf { E } ^ { ( d e c ) } ) } \\ & { \left. \begin{array} { l l } { \overline { { \mathbf { Z } } } _ { : , d } ^ { d e c , l } = \mathbb { M } \mathbb { S } \mathbb { A } \left( \mathbf { \tilde { Z } } _ { : , d } ^ { d e c , l } \right) } \\ { \overline { { \mathbf { Z } } } _ { : , d } ^ { d e c , l } = \mathbb { M } \mathbb { S } \mathbb { A } \left( \mathbf { \tilde { Z } } _ { : , d } ^ { d e c , l } , \mathbf { Z } _ { : , d } ^ { e n c , l } , \mathbf { Z } _ { : , d } ^ { e n c , l } \right) , 1 \leq d \leq D } \end{array} \right. } \\ & { \left. \begin{array} { r l } { \tilde { \mathbf { Z } } ^ { d e c , l } = \mathrm { L a y e r N o r n } \left( \tilde { \mathbf { Z } } ^ { d e c , l } + \mathbf { \overline { { Z } } } ^ { d e c , l } \right) } \\ { \mathbf { Z } ^ { d e c , l } = \mathrm { L a y e r N o r n } \left( \hat { \mathbf { Z } } ^ { d e c , l } + \mathbb { M L P } ( \hat { \mathbf { Z } } ^ { d e c , l } ) \right) } \end{array} \right. } \end{array}
+$$
+
+where $\mathbf { E } ^ { ( d e c ) } \in \mathbb { R } ^ { \frac { \tau } { L _ { s e g } } \times D \times d _ { m o d e l } }$ denotes the learnable position embedding for decoder. $\tilde { \mathbf { Z } } ^ { d e c , l }$ is the output of TSA. The MSA layer takes $\tilde { \mathbf { Z } } _ { : , d } ^ { d e c , l }$ as query and ${ \bf Z } _ { : , d } ^ { e n c , l }$ as the key and value to build the connection between encoder and decoder. The output of MSA is denoted as $\overline { { \mathbf { Z } } } _ { : , d } ^ { d e c , l }$ . $\hat { \mathbf { Z } } ^ { d e c , l } , \mathbf { Z } ^ { d e c , l }$ denote the output of skip connection and MLP respectively. We use ${ \mathbf { Z } } ^ { d e c , 0 }$ , ${ \bf Z } ^ { e n c , 1 } , \ldots , { \bf Z } ^ { d e c , N }$ to represent the decoder output. The complexity of each decoder layer is O D τ(T +τ)L2
+
+Linear projection is applied to each layer’s output to yield the prediction of this layer. Layer predictions are summed to make the final prediction (for $l = 0 , \ldots , N )$ :
+
+$$
+\begin{array} { r l } { \mathrm { ~ o r ~ } l = 0 , \dots , N : \mathbf { x } _ { i , d } ^ { ( s ) , l } = \mathbf { W } ^ { l } \mathbf { Z } _ { i , d } ^ { d e c , l } } & { \quad \mathbf { x } _ { T + 1 : T + \tau } ^ { p r e d , l } = \left\{ \mathbf { x } _ { i , d } ^ { ( s ) , l } \vert 1 \leq i \leq \frac { \tau } { L _ { s e g } } , 1 \leq d \leq D \right\} } \\ & { \quad \qquad \quad \mathbf { x } _ { T + 1 : T + \tau } ^ { p r e d } = \displaystyle \sum _ { l = 0 } ^ { N } \mathbf { x } _ { T + 1 : T + \tau } ^ { p r e d , l } } \end{array}
+$$
+
+where $\mathbf { W } ^ { l } ~ \in ~ \mathbb { R } ^ { L _ { s e g } \times d _ { m o d e l } }$ is a learnable matrix to project a vector to a time series segment. $\mathbf { x } _ { i , d } ^ { ( s ) , l } \in \mathbb { R } ^ { L _ { s e g } }$ denotes the $i$ -th segment in dimension $d$ of the prediction. All the segments in layer
+
+Table 1: MSE/MAE with different prediction lengths. Bold/underline indicates the best/second. Results of LSTMa, LSTnet, Transformer, Informer on the first 4 datasets are from Zhou et al. (2021).
+
+
Models
LSTMa
LSTnet
MTGNN
Transformer
Informer
Autoformer
Pyraformer
FEDformer
Crossformer
Metric
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
FTLLI
24 48 168
0.650 0.720 1.212
0.624 0.675 0.867
1.293 1.456 1.997
0.901 0.960 1.214
0.336 0.386 0.466
0.393 0.429 0.474
0.620 0.692 0.947
0.577 0.671 0.797
0.577 0.685 0.931
0.549 0.625 0.752
0.439 0.429 0.493
0.440 0.442 0.479
0.493 0.554 0.781
0.507 0.544 0.675
0.318 0.342 0.412
0.384 0.396 0.449
0.305 0.352
0.367 0.394 0.441
336 720 24
1.424 1.960 0.621
0.994 1.322 0.629
2.655 2.143 1.968
1.369 1.380 1.170
0.736 0.916 0.260
0.643 0.750 0.324
1.094 1.241 0.306
0.813 0.917 0.371
1.128 1.215 0.323
0.873 0.896 0.369
0.509 0.539 0.410
0.492 0.537 0.428
0.912 0.993 0.310
0.747 0.792 0.371
0.456 0.521 0.290
0.474 0.515 0.364
0.410 0.440 0.519 0.211
0.461 0.524 0.293
[LL
48 96 288 672
1.392 1.339 1.740 2.736
0.939 0.913 1.124 1.555
1.999 2.762 1.257 1.917
1.215 1.542 2.076 2.941
0.386 0.428 0.469 0.620
0.408 0.446 0.488 0.571
0.465 0.681 1.162 1.231
0.470 0.612 0.879 1.103
0.494 0.678 1.056 1.192
0.503 0.614 0.786 0.926
0.485 0.502 0.604 0.607
0.464 0.476 0.522 0.530
0.465 0.520 0.729 0.980
0.464 0.504 0.657 0.678
0.342 0.366 0.398 0.455
0.396 0.412 0.433 0.464
0.300 0.320 0.404 0.569
0.352 0.373 0.427 0.528
HLM
24 48 168 336 720
0.546 0.829 1.038 1.657 1.536
0.570 0.677 0.835 1.059 1.109
0.615 0.660 0.748 0.782 0.851
0.545 0.589 0.647 0.683 0.757
0.307 0.388 0.498 0.506 0.510
0.356 0.422 0.512 0.523 0.527
0.349 0.386 0.613 0.707 0.834
0.397 0.433 0.582 0.634 0.741
0.335 0.395 0.608 0.702 0.831
0.381 0.459 0.567 0.620 0.731 0.587
0.363 0.456 0.574 0.600
0.396 0.462 0.548 0.571 0.570
0.301 0.376 0.519 0.539 0.547
0.359 0.421 0.521 0.543 0.553
0.357 0.428 0.564 0.533 0.562
0.412 0.458 0.541 0.536 0.557
0.294 0.370 0.473 0.495 0.526
0.343 0.411 0.494 0.515 0.542
R
48 168 336
0.486 0.572 0.574
0.602
0.369 0.394
0.445 0.476
0.173 0.236
0.280 0.320
0.334 0.353
0.399 0.420
0.344 0.393 0.368 0.424
0.241 0.299
0.351 0.387
0.478 0.452
0.471 0.455
0.229 0.263
0.338 0.361
0.156 0.231 0.323
0.255 0.309 0.369
720
0.886 0.795 1.095
0.419 0.556
0.477 0.565
0.328 0.422
0.373 0.410
0.381 0.391
0.439 0.438
0.381 0.406
0.431 0.443
0.375 0.377
0.428 0.434
0.463 0.480
0.456 0.461
0.305 0.372
0.386 0.434
0.404
0.423
1.128
0.605
0.599
0.366
4.771
1.335
4.975
1.660
4.220
3.101
24
960
1.676 1.591
0.471
0.451
0.492
0.550
0.460
0.548
0.426
0.550
0.489
0.393
0.449
0.433
0.438
4.265
1.387
3.954
1.323
4.588
1.462
1.238
3.970
1.338
2.687
1.147
3.041
1.186
1.659
4.777
1.496
4.167
1.360
4.845
1.496
1.270
I
36
1.427
5.322
3.397
4.377
1.410
2.887
1.160
3.406
1.232
5.425
1.632
5.333
1.592
4.746
1.463
4.865
1.516
2.947
1.203
4.811
1.503
2.797
1.155
3.459
1.221
48
4.945 1.462
5.070
2.809
1.163
3.640
1.305
Yteee
60
5.176
1.504 0.378
5.477 0.648
1.675 0.403
0.506
1.552 0.278
5.219 0.597
1.553 0.332
5.212 0.608
1.576 0.334
3.019 0.550
1.202 0.363
5.204 0.606
1.588 0.338
+
+$l$ are rearranged to get the layer prediction $\mathbf { x } _ { T + 1 : T + \tau } ^ { p r e d , l }$ . Predictions of all the layers are summed to obtain the final forecasting xpredT +1:T +τ .
+
+# 4 EXPERIMENTS
+
+# 4.1 PROTOCOLS
+
+Datasets We conduct experiments on six real-world datasets following Zhou et al. (2021); Wu et al. (2021a). 1) ETTh1 (Electricity Transformer Temperature-hourly), 2) ETTm1 (Electricity Transformer Temperature-minutely), 3) WTH (Weather), 4) ECL (Electricity Consuming Load), 5) ILI (Influenza-Like Illness), 6) Traffic. The train/val/test splits for the first four datasets are same as Zhou et al. (2021), the last two are split by the ratio of 0.7:0.1:0.2 following Wu et al. (2021a).
+
+Baselines We use the following popular models for MTS forecasting as baselines:1) LSTMa (Bahdanau et al., 2015), 2) LSTnet (Lai et al., 2018), 3) MTGNN (Wu et al., 2020), and recent Transformer-based models for MTS forecasting: 4) Transformer (Vaswani et al., 2017), 5) Informer (Zhou et al., 2021), 6) Autoformer (Wu et al., 2021a), 7) Pyraformer (Liu et al., 2021a) and 8) FEDformer (Zhou et al., 2022).
+
+Setup We use the same setting as in Zhou et al. (2021): train/val/test sets are zero-mean normalized with the mean and std of training set. On each dataset, we evaluate the performance over the changing future window size $\tau$ . For each $\tau$ , the past window size $T$ is regarded as a hyper-parameter to search which is a common protocol in recent MTS transformer literature (Zhou et al., 2021; Liu et al., 2021a). We roll the whole set with stride $= 1$ to generate different input-output pairs. The Mean Square Error (MSE) and Mean Absolute Error (MAE) are used as evaluation metrics. All experiments are repeated for 5 times and the mean of the metrics reported. Our Crossformer only utilize the past series to forecast the future, while baseline models use additional covariates such as hour-of-the-day. Details about datasets, baselines, implementation, hyper-parameters are shown in Appendix A.
+
+# 4.2 MAIN RESULTS
+
+As shown in Table 1, Crossformer shows leading performance on most datasets, as well as on different prediction length settings, with the 36 top-1 and 51 top-2 cases out of 58 in total. It is worth noting that, perhaps due to the explicit use of cross-dimension dependency via GNN, MTGNN outperforms many Transformer-based baselines. While MTGNN has been rarely compared in existing transformers for MTS forecasting literatures. FEDformer and Autoformer outperform our model on ILI. We conjecture this is because the size of dataset ILI is small and these two models introduce the prior knowledge of sequence decomposition into the network structure which makes them perform well when the data is limited. Crossformer still outperforms other baselines on this dataset.
+
+Table 2: Component ablation of Crossformer: DSW embedding, TSA layer and HED on ETTh1.
+
+
Models
Transformer
DSW
DSW+TSA
DSW+HED
DSW+TSA+HED
Metric
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
24
0.620
0.577
0.373
0.418
0.322
0.373
0.406
0.454
0.305
0.367
48
0.692
0.671
0.456
0.479
0.365
0.403
0.493
0.512
0.352
0.394
168
0.947
0.797
0.947
0.731
0.473
0.479
0.614
0.583
0.410
0.441
336
1.094
0.813
0.969
0.752
0.553
0.534
0.788
0.676
0.440
0.461
720
1.241
0.971
1.086
0.814
0.636
0.599
0.841
0.717
0.519
0.524
+
+
+Figure 4: Evaluation on hyper-parameter impact and computational efficiency. (a) MSE against hyperparameter segment length $L _ { s e g }$ in DSW embedding on ETTh1. (b) MSE against hyper-parameter number of routers $c$ in the Cross-Dimension Stage of TSA layer on ETTh1. (c) Memory occupation against the input length $T$ on ETTh1. (d) Memory occupation against number of dimensions $D$ on synthetic datasets with different number of dimensions.
+
+# 4.3 ABLATION STUDY
+
+In our approach, there are three components: DSW embedding, TSA layer and HED. We perform ablation study on the ETTh1 dataset in line with Zhou et al. (2021); Liu et al. (2021a). We use Transformer as the baseline and $\mathbf { D S W + T S A + H E D }$ to denote Crossformer without ablation. Three ablation versions are compared: 1) DSW 2) DSW $+ ^ { \prime }$ TSA 3) $\mathbf { D S W + H E D }$ .
+
+We analyze the results shown in Table 2. 1) DSW performs better than Transformer on most settings. The only difference between DSW and Transformer is the embedding method, which indicates the usefulness of DSW embedding and the importance of cross-dimension dependency. 2) TSA constantly improves the forecasting accuracy. This suggests that it is reasonable to treat time and dimension differently. Moreover, TSA makes it possible to use Crossformer on datasets where the number of dimensions is large (e.g. $D = 8 6 2$ for dataset Traffic). 3) Comparing $\mathrm { D S W + H E D }$ with DSW, HED decreases the forecasting accuracy when prediction length is short but increases it for long term prediction. The possible reason is that information at different scales is helpful to long term prediction. 4) Combining DSW, TSA and HED, our Crossformer yields best results on all settings.
+
+# 4.4 EFFECT OF HYPER-PARAMETERS
+
+We evaluate the effect of two hyper-parameters: segment length $L _ { s e g }$ in Eq. 1) and number of routers in TSA $\dot { c }$ in Cross-Dimension Stage of TSA) on the ETTh1 dataset. Segment Length: In Fig. 4(a), we prolong the segment length from 4 to 24 and evaluate MSE with different prediction windows. For short-term forecasting $( \tau = 2 4 , 4 8 )$ ), smaller segment yields relevantly better results, but the prediction accuracy is stable. For long-term forecasting $\tau \geq 1 6 8 )$ , prolonging the segment length from 4 to 24 causes the MSE to decrease. This indicates that long segments should be used for long-term forecasting. We further prolong the segment length to 48 for $\tau = 3 3 6$ , 720, the MSE is slightly larger than that of 24. The possible reason is that 24 hours exactly matches the daily period of this dataset, while 48 is too coarse to capture fine-grained information. Number of Routers in TSA Layer: Number of Routers $c$ controls the information bandwidth among all dimensions. As Fig. 4(b) shows, the performance of Crossformer is stable w.r.t to $c$ for $\tau \leq 3 3 6$ . For $\tau = 7 2 0$ , the MSE is large when $c = 3$ but decreases and stabilizes when $c \geq 5$ . In pratice, we set $c = 1 0$ to balance the prediction accuracy and computation efficiency.
+
+# 4.5 COMPUTATIONAL EFFICIENCY ANALYSIS
+
+The theoretical complexity per layer of Transformer-based models is compared in Table 3. The complexity of Crossformer encoder is quadratic w.r.t $T$ . However, for long-term prediction where large $L _ { s e q }$ is used, the coefficient $\frac { 1 } { L _ { s e q } ^ { 2 } }$ term can significantly reduce its practical complexity. We evaluate the memory occupation of these models on ETTh1.4 We set the prediction window $\tau = 3 3 6$ and prolong input length $T$ . For Crossformer, $L _ { s e g }$ is set to 24, which is the best value for $\tau \geq 1 6 8$
+
+Table 3: Computation complexity per layer of Transformer-based models. $T$ denotes the length of past series, $\tau$ denotes the length of prediction window, $D$ denotes the number of dimensions, $L _ { s e g }$ denotes the segment length of DSW embedding in Crossformer.
+
+
Method
Encoder layer
Decoder layer
Transformer (Vaswani et al., 2017)
O(T2)
O(T(T+T))
Informer (Zhou et al., 2021)
O(TlogT)
O(t(T+logT))
Autoformer (Wu et al.,2021a)
O(TlogT)
0((+T)log(+T))
Pyraformer (Liu et al.,2021a)
O(T)
O(T(T+T))
FEDformer (Zhou et al.,2022)
O(T)
0(+)
Crossformer (Ours)
(T2) 0
((+T)) 0
+
+(see Fig. 4 (a)). The result in Fig. 4 (c) shows that Crossformer achieves the best efficiency among the five methods within the tested length range. Theoretically, Informer, Autoformer and FEDformer are more efficient when $T$ approaches infinity. In practice, Crossformer performs better when $T$ is not extremely large (e.g. $T \leq 1 0 ^ { 4 }$ ).
+
+We also evaluate the memory occupation w.r.t the number of dimensions $D$ . For baseline models where cross-dimension dependency is not modeled explicitly, $D$ has little effect. Therefore, we compare Crossformer with its ablation versions in Section 4.3. We also evaluate the TSA layers that directly use MSA in Cross-Dimension Stage without the Router mechanism, denoted as TSA(w/o Router). Fig. 4 (d) shows that Crossformer without TSA layer (DSW and $\mathrm { D S W + H E D } )$ has quadratic complexity w.r.t $D$ . TSA(w/o Router) helps to reduce complexity and the Router mechanism further makes the complexity linear, so that Crossformer can process data with $D = 3 0 0$ . Moreover, HED can slightly reduce the memory cost and we analyze this is because there are less vectors in upper layers after segment merging (see Fig. 3). Besides memory occupation, the actual running time evaluation is shown in Appendix B.6.
+
+# 5 CONCLUSIONS AND FUTURE WORK
+
+We have proposed Crossformer, a Transformer-based model utilizing cross-dimension dependency for multivariate time-series (MTS) forecasting. Specifically, the Dimension-Segment-Wise (DSW) embedding embeds the input data into a 2D vector array to preserve the information of both time and dimension. The Two-Stage-Attention (TSA) layer is devised to capture the cross-time and crossdimension dependency of the embedded array. Using DSW embedding and TSA layer, a Hierarchical Encoder-Decoder (HED) is devised to utilize the information at different scales. Experimental results on six real-world datasets show its effectiveness over previous state-of-the-arts.
+
+We analyzed the limitations of our work and briefly discuss some directions for future research: 1) In Cross-Dimension Stage, we build a simple full connection among dimensions, which may introduce noise on high-dimensional datasets. Recent sparse and efficient Graph Transformers (Wu et al., 2022) can benefit our TSA layer on this problem. 2) A concurrent work (Zeng et al., 2023) which was accepted after the submission of this work received our attention. It questions the effectiveness of Transformers for MTS forecasting and proposes DLinear that outperforms all Transformers including our Crossformer on three of the six datasets (details are in Appendix B.2). It argues the main reason is that MSA in Transformer is permutation-invariant. Therefore, enhancing the ordering preserving capability of Transformers is a promising direction to overcome this shortcoming . 3) Considering datasets used in MTS analysis are much smaller and simpler than those used in vision and texts, besides new models, large datasets with various patterns are also needed for future research.
+
+# REFERENCES
+
+Rafal A. Angryk, Petrus C. Martens, Berkay Aydin, Dustin J. Kempton, Sushant S. Mahajan, Sunitha Basodi, Azim Ahmadzadeh, Xumin Cai, Soukaina Filali Boubrahimi, Shah Muhammad Hamdi, Michael A. Schuh, and Manolis K. Georgoulis. Multivariate time series dataset for space weather data analytics. Scientific Data, 2020.
+
+Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In International Conference on Learning Representations (ICLR), 2015.
+
+Defu Cao, Yujing Wang, Juanyong Duan, Ce Zhang, Xia Zhu, Congrui Huang, Yunhai Tong, Bixiong Xu, Jing Bai, Jie Tong, and Qi Zhang. Spectral temporal graph neural network for multivariate time-series forecasting. In Advances in Neural Information Processing Systems (NeurIPS), 2020.
+
+Chun-Fu Chen, Quanfu Fan, and Rameswar Panda. Crossvit: Cross-attention multi-scale vision transformer for image classification. In IEEE/CVF International Conference on Computer Vision (ICCV), 2021.
+
+Weiqi Chen, Wenwei Wang, Bingqing Peng, Qingsong Wen, Tian Zhou, and Liang Sun. Learning to rotate: Quaternion transformer for complicated periodical time series forecasting. In ACM SIGKDD International Conference on Knowledge Discovery & Data Mining (KDD), 2022.
+
+Omer Fahrettin Demirel, Selim Zaim, Ahmet Caliskan, and Pinar Ozuyar. Forecasting natural gas consumption in ˙Istanbul using neural networks and multivariate time series methods. Turkish Journal of Electrical Engineering and Computer Sciences, 2012.
+
+Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In Annual Conference of the North American Chapter of the Association for Computational Linguistics (NAACL-HLT), 2019.
+
+Linhao Dong, Shuang Xu, and Bo Xu. Speech-transformer: A no-recurrence sequence-to-sequence model for speech recognition. In IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 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 (ICLR), 2021.
+
+Dazhao Du, Bing Su, and Zhewei Wei. Preformer: Predictive transformer with multi-scale segmentwise correlations for long-term time series forecasting. arXiv preprint arXiv:2202.11356v1, 2022.
+
+Philipp Dufter, Martin Schmitt, and Hinrich Schutze. Position information in transformers: An ¨ overview. Computational Linguistics, 2022.
+
+Valentin Flunkert, David Salinas, and Jan Gasthaus. Deepar: Probabilistic forecasting with autoregressive recurrent networks. International Journal of Forecasting, 2017.
+
+Jake Grigsby, Zhe Wang, and Yanjun Qi. Long-range transformers for dynamic spatiotemporal forecasting. arXiv preprint arXiv:2109.12218v2, 2022.
+
+Kai Han, An Xiao, Enhua Wu, Jianyuan Guo, Chunjing Xu, and Yunhe Wang. Transformer in transformer. In Advances in Neural Information Processing Systems (NeurIPS), 2021.
+
+Kai Han, Yunhe Wang, Hanting Chen, Xinghao Chen, Jianyuan Guo, Zhenhua Liu, Yehui Tang, An Xiao, Chunjing Xu, Yixing Xu, et al. A survey on vision transformer. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 2022.
+
+Guolin Ke, Di He, and Tie-Yan Liu. Rethinking positional encoding in language pre-training. In International Conference on Learning Representations (ICLR), 2021.
+
+Lutz Kilian and Helmut LAtkepohl. ˜ Structural Vector Autoregressive Analysis. Cambridge University Press, 2017.
+
+Guokun Lai, Wei-Cheng Chang, Yiming Yang, and Hanxiao Liu. Modeling long- and short-term temporal patterns with deep neural networks. In International ACM SIGIR Conference on Research & Development in Information Retrieval (SIGIR), 2018.
+
+Colin S. Lea, Michael D. Flynn, Rene Vidal, Austin Reiter, and Gregory Hager. Temporal convolu-´ tional networks for action segmentation and detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
+
+Longyuan Li, Junchi Yan, Xiaokang Yang, and Yaohui Jin. Learning interpretable deep state space model for probabilistic time series forecasting. In International Joint Conference on Artificial Intelligence (IJCAI), 2019a.
+
+Longyuan Li, Jihai Zhang, Junchi Yan, Yaohui Jin, Yunhao Zhang, Yanjie Duan, and Guangjian Tian. Synergetic learning of heterogeneous temporal sequences for multi-horizon probabilistic forecasting. In AAAI Conference on Artificial Intelligence (AAAI), 2021.
+
+Shiyang Li, Xiaoyong Jin, Yao Xuan, Xiyou Zhou, Wenhu Chen, Yu-Xiang Wang, and Xifeng Yan. Enhancing the locality and breaking the memory bottleneck of transformer on time series forecasting. In Advances in Neural Information Processing Systems (NeurIPS), 2019b.
+
+Yaguang Li, Rose Yu, Cyrus Shahabi, and Yan Liu. Diffusion convolutional recurrent neural network: Data-driven traffic forecasting. In International Conference on Learning Representations (ICLR), 2018.
+
+Shizhan Liu, Hang Yu, Cong Liao, Jianguo Li, Weiyao Lin, Alex X Liu, and Schahram Dustdar. Pyraformer: Low-complexity pyramidal attention for long-range time series modeling and forecasting. In International Conference on Learning Representations (ICLR), 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 IEEE/CVF International Conference on Computer Vision (ICCV), 2021b.
+
+Andrew Patton. Copula methods for forecasting multivariate time series. Handbook of economic forecasting, 2013.
+
+Yao Qin, Dongjin Song, Haifeng Chen, Wei Cheng, Guofei Jiang, and G. Cottrell. A dual-stage attention-based recurrent neural network for time series prediction. In International Joint Conference on Artificial Intelligence (IJCAI), 2017.
+
+Syama Sundar Rangapuram, Matthias W. Seeger, Jan Gasthaus, Lorenzo Stella, Bernie Wang, and Tim Januschowski. Deep state space models for time series forecasting. In Advances in Neural Information Processing Systems (NeurIPS), 2018.
+
+Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Herve´ Jegou. Training data-efficient image transformers & distillation through attention. In ´ International Conference on Machine Learning (ICML), 2021.
+
+Ashish Vaswani, Noam M. 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 (NeurIPS), 2017.
+
+Haixu Wu, Jiehui Xu, Jianmin Wang, and Mingsheng Long. Autoformer: Decomposition transformers with auto-correlation for long-term series forecasting. In Advances in Neural Information Processing Systems (NeurIPS), 2021a.
+
+Kan Wu, Houwen Peng, Minghao Chen, Jianlong Fu, and Hongyang Chao. Rethinking and improving relative position encoding for vision transformer. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), 2021b.
+
+Qitian Wu, Wentao Zhao, Zenan Li, David Wipf, and Junchi Yan. Nodeformer: A scalable graph structure learning transformer for node classification. In Advances in Neural Information Processing Systems (NeurIPS), 2022.
+
+Zonghan Wu, Shirui Pan, Guodong Long, Jing Jiang, Xiaojun Chang, and Chengqi Zhang. Connecting the dots: Multivariate time series forecasting with graph neural networks. In ACM SIGKDD International Conference on Knowledge Discovery & Data Mining (KDD), 2020.
+
+Ting Yu, Haoteng Yin, and Zhanxing Zhu. Spatio-temporal graph convolutional networks: A deep learning framework for traffic forecasting. In International Joint Conference on Artificial Intelligence (IJCAI), 2018.
+
+Chulhee Yun, Srinadh Bhojanapalli, Ankit Singh Rawat, Sashank Reddi, and Sanjiv Kumar. Are transformers universal approximators of sequence-to-sequence functions? In International Conference on Learning Representations (ICLR), 2020.
+
+Ailing Zeng, Muxi Chen, Lei Zhang, and Qiang Xu. Are transformers effective for time series forecasting? In AAAI Conference on Artificial Intelligence (AAAI), 2023.
+
+Haoyi Zhou, Shanghang Zhang, Jieqi Peng, Shuai Zhang, Jianxin Li, Hui Xiong, and Wan Zhang. Informer: Beyond efficient transformer for long sequence time-series forecasting. In AAAI Conference on Artificial Intelligence (AAAI), 2021.
+
+Tian Zhou, Ziqing Ma, Qingsong Wen, Xue Wang, Liang Sun, and Rong Jin. Fedformer: Frequency enhanced decomposed transformer for long-term series forecasting. In International Conference on Machine Learning (ICML), 2022.
+
+# A DETAILS OF EXPERIMENTS
+
+# A.1 BENCHMARKING DATASETS
+
+We conduct experiments on the following six real-world datasets following Zhou et al. (2021); Wu et al. (2021a):
+
+1) ETTh1 (Electricity Transformer Temperature-hourly) contains 7 indicators of an electricity transformer in two years, including oil temperature, useful load, etc. Data points are recorded every hour and train/val/test is 12/4/4 months.
+
+2) ETTm1 (Electricity Transformer Temperature-minutely) contains the same indicators as ETTh1 but data points are recorded every 15 miniutes. Train/val/test split is same as ETTh1.
+
+3) WTH (Weather) contains 12 meteorological indicators in U.S. in 4 years, including visibility, wind speed, etc. Train/val/test is 28/10/10 months.
+
+4) ECL (Electricity Consuming Load) contains hourly electricity consumption (in Kwh) of 321 clients in two years. Train/val/test is 15/3/4 months.
+
+5) ILI (Influenza-Like Illness) contains 7 weekly recorded indicators of patients data from Centers for Disease Control and Prevention of the United States between between 2002 and 2021. The ratio of train/validation/test splits is 0.7:0.1:0.2.
+
+6) Traffic contains hourly road occupancy rates measured by 862 sensors on San Francisco Bay area freeways in 2 years. The ratio of train/validation/test splits is 0.7:0.1:0.2.
+
+The train/val/test splits for ETTh1, ETTm1, WTH, ECL are same as Zhou et al. (2021), for ILI and Traffic are same as Wu et al. (2021a).
+
+The first four datasets are publicly available at https://github.com/zhouhaoyi/ Informer2020 and the last two are publicly available at https://github.com/thuml/ Autoformer.
+
+# A.2 BASELINE METHODS
+
+We briefly describe the selected baselines:
+
+1) LSTMa (Bahdanau et al., 2015) treats the input MTS as a sequence of multi-dimensional vectors. It builds an encoder-decoder using RNN and automatically aligns target future steps with their relevant past.
+
+2) LSTnet (Lai et al., 2018) uses CNN to extract cross-dimension dependency and short term crosstime dependency. The long-term cross-time dependency is captured through RNN. The source code is available at https://github.com/laiguokun/LSTNet.
+
+3) MTGNN (Wu et al., 2020) explicitly utilizes cross-dimension dependency using GNN. A graph learning layer learns a graph structure where each node represents one dimension in MTS. Then graph convolution modules are interleaved with temporal convolution modules to explicitly capture cross-dimension and cross-time dependency respectively. The source code is available at https://github.com/nnzhan/MTGNN.
+
+4) Transformer is closed to the original Transformer (Vaswani et al., 2017) that uses self-attention mechanism to capture cross-time dependency. The Informer-style one-step generative decoder is used for forecasting, therefore this is denoted as Informer† in Informer (Zhou et al., 2021).
+
+5) Informer (Zhou et al., 2021) is a Transformer-based model using the ProbSparse self-attention to capture cross-time dependency for forecasting. The source code of Transformer and Informer is available at https://github.com/zhouhaoyi/Informer2020.
+
+6) Autoformer (Wu et al., 2021a) is a Transformer-based model using decomposition architecture with Auto-Correlation mechanism to capture cross-time dependency for forecasting. The source code is available at https://github.com/thuml/Autoformer.
+
+7) Pyraformer (Liu et al., 2021a) is a Transformer-based model learning multi-resolution representation of the time series by the pyramidal attention module to capture cross-time dependency for forecasting. The source code is available at https://github.com/alipay/Pyraformer.
+
+8) FEDformer (Zhou et al., 2022) is a Transformer-based model that uses the seasonal-trend decomposition with frequency enhanced blocks to capture cross-time dependency for forecasting. The source code is available at https://github.com/MAZiqing/FEDformer.
+
+A.3 HYPER-PARAMETER SELECTION AND IMPLEMENTATION DETAILS
+
+# A.3.1 MAIN EXPERIMENTS
+
+For the main experiments, we use the Crossformer with 3 encoder layers. The number of routers in TSA layer $c$ is set to 10. For dataset ETTh1, ETTm1, WTH and ILI, dimension of hidden state $d _ { m o d e l }$ is set to 256, the head number of multi-head attention is set to 4; For dataset ECL and Traffic, dimension of hidden state $d _ { m o d e l }$ is set to 64, the head number of multi-head attention is set to 2. The segment length $L _ { s e g }$ is chosen from $\{ 6 , 1 2 , 2 4 \}$ via grid search. We use MSE as loss function and batch size is set to 32. Adam optimizer is used for training and the initial learning rate is chosen from $\{ 5 \mathrm { e } \mathrm { - } 3$ , 1e-3, 5e-4, 1e-4, 5e-5, 1e- $\{ 5 \}$ via grid search. The total number of epochs is 20. If the validation loss does not decreases within three epochs, the training process will stop early.
+
+For baseline models, if the original papers conduct experiments on the dataset we use, the hyperparameters (except input length $T$ ) recommended in the original papers are used, including the number of layers, dimension of hidden states, etc. Otherwise, the hyper-parameters are chosen through grid search using the validation set.
+
+Following Zhou et al. (2021), on datasets ETTh1, WTH, ECL and Traffic, for different prediction length $\tau$ , the input length $T$ is chosen from $\{ 2 4 , 4 8 , 9 6 , 1 6 8 , 3 3 6 , 7 2 0 \}$ ; on ETTm1, the input length is chosen from $\{ 2 4 , 4 8 , 9 6 , 1 9 2 , 2 8 8 , 6 7 2 \}$ ; on ILI, the input length is chosen from $\{ 2 4 , 3 6 , 4 8 , 6 0 \}$ .
+
+All models including Crossformer and baselines are implemented in PyTorch and trained on a single NVIDIA Quadro RTX 8000 GPU with 48GB memory.
+
+# A.3.2 EFFICIENCY ANALYSIS
+
+To evaluate the computational efficiency w.r.t the input length $T$ in Figure 4(c) of the main paper, we align the hyper-parameters of all Transformer-based models as follows: prediction length $\tau$ is set to 336, number of encoder layers is set to 2, dimension of hidden state $d _ { m o d e l }$ is set to 256, the head number of multi-head attention is set to 4.
+
+To evaluate the computational efficiency w.r.t the number of dimensions $D$ in Figure 4(d) of the main paper, we align the hyper-parameters of ablation versions of Crossformer as follows as: both input length $T$ and prediction length $\tau$ are set to 336, number of encoder layers is set to 3, $d _ { m o d e l }$ is set to 64, the head number of multi-head attention is set to 2.
+
+Experiments in the computational efficiency analysis section are conducted on a single NVIDIA GeForce RTX 2080Ti GPU with 11GB memory.
+
+# A.4 DETAILS OF ABLATION VERSIONS OF CROSSFORMER
+
+We describe the models we used in ablation study below:
+
+1) DSW represents Crossformer without TSA and HED. The input is embedded by DSW embedding and flatten into a 1D sequence to be input to the original Transformer. The only difference between this model and the Transformer is the embedding method.
+
+2) $\mathbf { D S W + T S A }$ represents Crossformer without HED. Compared with Crossformer, the encoder does not use segment merging to capture dependency at different scales. The decoder takes the final output of encoder (i.e. ${ \bf Z } ^ { e n c , N }$ ) as input instead of using encoder’s output at each scale.
+
+3) $\mathbf { D S W + H E D }$ represents Crossformer without TSA. In each encoder layer and decoder layer, the 2D vector array is flatten into a 1D sequence to be input to the original self-attention layer for dependency capture.
+
+# B EXTRA EXPERIMENTAL RESULTS
+
+# B.1 SHOWCASES OF MAIN RESULTS
+
+Figure 5 shows the forecasting cases of three dimensions of the ETTm1 dataset with prediction length $\tau = 2 8 8$ . For dimension “HUFL”, all the five models capture the periodic pattern, but Crossformer is the closest to the ground truth. For “HULL”, Pyraformer fails to capture the periodic pattern from the noisy data. For “LUFL” where the data has no clear periodic pattern, MTGNN, FEDformer and Crossformer capture its trend and show significantly better results than the other two models.
+
+
+Figure 5: Forecasting cases of three dimensions: High UseFul Load (HUFL), High UseLess Load (HULL) and Low UseFul Load (LUFL) of the ETTm1 dataset with prediction length $\tau = 2 8 8$ . The red / blue curves stand for the ground truth / prediction. Each row represents one model and each column represents one dimension.
+
+Figure 6 shows the forecasting cases of three dimensions of the WTH dataset with prediction length $\tau = 3 3 6$ . For dimension “DBT”, all the five models capture the periodic pattern. For “DPT”, Autoformer and FEDformer fails to capture increasing trend of the data. For “WD”, all models capture the periodic pattern from the noisy data, and the cruves output by MTGNN and Crossformer are sharper than the other three models.
+
+# B.2 COMPARISON WITH EXTRA METHODS
+
+We further compare with two additional concurrent methods which were either not peerreviewed (Grigsby et al., 2022) or were accepted after the submission of this work (Zeng et al., 2023): 1) STformer (Grigsby et al., 2022), a Transformer-based model that directly flattens the multivariate time-series $\mathbf { x } _ { 1 : T } \in \mathbb { R } ^ { T \times D }$ into a 1D sequence to be input to Transformers; 2) DLinear (Zeng et al., 2023), a simple linear model with seasonal-trend decomposition that challenges Transformer-based models for MTS forecasting. Results are shown in Table 4 and LSTMa and LSTnet are omitted as they are not competitive with other models.
+
+The basic idea of STformer is similar to our Crossformer: both of them extend the 1-D attention to 2- D. The explicit utilization of cross-dimension dependency makes STformer competitive with previous Transformer-based models on ETTh1, ETTm1 and WTH, especially for short-term prediction. However, STformer directly flattens the raw 2-D time series into a 1-D sequence to be input to the
+
+
+Figure 6: Forecasting cases of three dimensions: Dry Bulb Temperature (DBT), Dew Point Temperature (DPT) and Wind Direction (WD) of the WTH dataset with prediction length $\tau = 3 3 6$ . The red / blue curves stand for the ground truth / prediction. Each row represents one model and each column represents one dimension.
+
+Transformer. This straightforward method does not distinguish the time and dimension axes and is computationally inefficient. Therefore, besides the good performance for short-term prediction, STformer has difficulty in long-term prediction and encounters the out-of-memory (OOM) problem on high-dimensional datasets (ECL and Traffic). While Crossformer uses the DSW embedding to capture local dependency and reduce the complexity. The TSA layer with the router mechanism is devised to deal with the heterogeneity of time and dimension axis and further improve efficiency.
+
+DLinear is on par with our Crossformer on ETTh1 and ETTm1 $\tau \leq 9 6 $ ); has similar performance with FEDformer on ILI; performs worse than Crossformer on WTH; outperforms all Transformerbased models including our Crossformer on ETTm1 $\tau \geq 2 8 8 $ ), ECL and Traffic. Considering its simplicity, the performance is impressive. Based on the results, we analyze the limitations of Crossformer and propose some directions to improve it in the future:
+
+1) In Cross-Dimension Stage of TSA layer, we simply build an all-to-all connection among $D$ dimensions with the router mechanism. Besides capturing the cross-dimension dependency, this full connection also introduces noise, especially for high-dimensional dataset. We think high-dimensional data has the sparse property: each dimension is only relevant to a small fraction of all dimensions. Therefore, utilizing the sparsity to reduce noise and improve the computation efficiency of the TSA layer could be a promising direction.
+
+2) Authors of DLinear (Zeng et al., 2023) argue that the Transformer-based models have difficulty in preserving ordering information because the attention mechanism is permutation-invariant and the absolute position embedding injected into the model is not enough for time series forecasting, which is an order-sensitive task. Although Yun et al. (2020) theoretically proves that Transformers with trainable positional embedding are universal approximators of sequence-to-sequence functions, the ordering information still needs to be enhanced in practice. We think that relative position encoding in texts (Ke et al., 2021; Dufter et al., 2022) and vision (Wu et al., 2021b) could be useful for ordering information enhancement.
+
+Table 4: MSE/MAE comparison with extra methods: STformer (Grigsby et al., 2022) and DLinear (Zeng et al., 2023). Bold/underline indicates the best/second. OOM indicates out-of-memory problem. Gray background marks the CNN-GNN-based model; yellow marks Transformer-based models where cross-dimension dependency is omitted; blue marks Transformer-based models explicitly utilizing cross-dimension dependency; red marks the linear model with series decomposition.
+
+
Models
MTGNN
Transformer
Informer
Autoformer
Pyraformer
FEDformer
STformer
Crossformer
DLinear
Metric
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
FLL
24 48
0.336 0.386
0.393 0.429
0.620 0.692
0.577 0.671
0.577 0.685
0.549 0.625
0.439 0.429
0.440 0.442
0.493 0.554
0.507 0.544
0.318 0.342
0.384 0.396
0.368
0.441
0.305 0.352
0.367 0.312
0.355 0.383
168
0.466 0.474
0.947
0.931
0.752
0.493
0.479
0.781
0.675
0.412
0.445
0.465
0.394
0.352
0.430
336
0.736
0.797
0.449
0.652
0.608
0.410 0.440
0.441 0.461
0.416 0.450
720
0.643 0.750
1.094 1.241
0.813 0.917
1.128
0.873 0.896
0.509 0.539
0.492
0.912
0.747
0.456
0.474
1.069
0.806
0.452
[LL
24
0.916
1.215
0.537
0.993
0.792
0.521
0.515
1.071
0.817
0.519
0.524
0.486
0.501
48
0.260 0.324
0.306 0.465
0.371
0.323
0.369 0.503
0.410
0.428
0.310
0.371
0.290
0.364
0.278
0.348
0.211
0.293
0.217
0.289
96
0.386 0.428
0.408 0.446
0.681
0.470 0.612
0.494 0.678
0.614
0.485
0.464
0.465
0.464
0.342
0.396
0.445
0.458
0.300
0.352
0.278
0.330 0.354
288
0.469
0.488
1.162
0.879
1.056
0.786
0.502 0.604
0.476 0.522
0.520 0.729
0.504 0.657
0.366 0.398
0.412
0.420
0.455
0.320
0.373
0.310 0.369
0.386
672
0.620
0.571
1.231
1.103
1.192
0.926
0.607
0.530
0.980
0.678
0.455
0.433 0.464
0.733
0.597
0.404 0.569
0.427 0.528
0.416
0.417
0.777
0.625
24 48
0.307 0.388
0.356
0.349 0.386
0.397 0.433
0.335 0.395
0.381 0.459
0.363 0.456
0.396 0.462
0.301 0.376
0.359 0.421
0.357 0.428
0.412 0.458
0.307
0.359
0.294
0.343
0.357
0.391 0.444
168 336
0.498 0.506
0.422 0.512 0.523
0.613
0.582
0.608
0.567
0.574
0.548
0.519
0.521
0.564
0.541
0.381 0.497
0.416 0.502
0.370 0.473
0.411 0.494
0.425 0.515
0.516
HLM
720
0.510
0.527
0.707 0.834
0.634 0.741
0.702 0.831
0.620 0.731
0.600 0.587
0.571 0.570
0.539 0.547
0.543 0.553
0.533 0.562
0.536 0.557
0.566 0.589
0.564 0.582
0.495 0.526
0.515 0.542
0.536 0.582
0.537 0.571
48
0.173 0.280
0.334
0.399
0.344
0.393
0.241
0.351
0.478
0.229
168
0.236 0.320
0.353
0.420
0.368
0.424
0.299
0.387
0.452
0.471 0.455
0.263
0.338 0.361
0.356
0.432
0.156 0.231
0.255
0.155
0.258 0.287
336
0.328 0.373
0.381
0.439
0.381
0.431
0.375
0.428
0.463
0.456
0.305
0.386
0.5160.527 00M
0.323
0.309 0.369
0.195 0.238
0.316
720
0.422
0.410
0.391
0.438
0.406
0.443
0.377
0.434
0.480
0.461
0.372
0.434
0OM
0.404
0.423
0.272
0.346
960
0.471
0.451
0.492
0.550
0.460
0.548
0.366
0.426
0.550
0.489
0.393
0.449
0OM
0.433
0.438
0.299
0.367
目
24
3.954
1.323
1.462
1.186
2.940
1.205
36
4.265 1.387 4.777 1.496
4.167
1.360
4.588 4.845
1.496
3.101 3.397
1.238 1.270
3.970 4.377
1.338 1.410
2.687 2.887
1.147 1.160
3.150 3.512
1.232 1.243
3.041 3.406
+
+3) The sizes of datasets used for time series forecasting are much smaller than those for texts and vision, and the patterns in time series datasets are also simpler. Considering vision transformers surpass inductive bias and achieves excellent results compared to CNNs after pre-trained on large amounts of data (Dosovitskiy et al., 2021), Transformers for time series may also require large-size datasets with various patterns to exploit their full potential.
+
+As quoted from the paper, authors mentioned that DLinear “does not model correlations among variates”. Therefore, incorporating cross-dimension dependency into DLinear to further improve prediction accuracy is also a promising direction. Moreover, our DSW embedding to enhance locality and HED to capture dependency at different scales can also be potentially useful to further inspire and enhance DLinear.
+
+# B.3 ABLATION STUDY OF THE ROUTER MECHANISM
+
+The ablation study of the three main components of Crossformer is shown in Sec. 4.3. In this section, we conduct an ablation study of the router mechanism, a sub-module in TSA layer, and evaluate its impact on prediction accuracy. It should be noticed that the router mechanism is mainly proposed to reduce the computation complexity when $D$ is large. Results are shown in Table 5. Adding TSA(w/o Router) constantly improves the prediction accuracy of DSW and ${ \mathrm { D S W / H E D } }$ , showing the necessity of capturing cross-time and cross-dimension dependency in two different stages. For short term prediction $\tau \leq 1 6 8 )$ ), the performances of TSA(w/o Router) and TSA are similar, no matter whether HED is used or not. For long term prediction $\tau \geq 3 3 6$ ), the router mechanism slightly improves the prediction accuracy. The possible reason is that we set separate routers for each time step, which helps capture long-term dependency that varies over time.
+
+Table 5: Complementary results to ablation study in Table 2. TSA(w/o Router) denotes TSA layer without the router mechanism that directly uses MSA in the Cross-Dimension Stage.
+
+
Models
DSW
DSW+ TSA(w/o Router)
DSW+TSA
DSW+HED
DSW+HED+ TSA(w/o Router)
DSW+TSA+HED
Metric MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
MSE
MAE
24
0.373
0.418
0.320
0.376
0.322
0.373
0.406
0.454
0.311
0.375
0.305
0.367
48
0.456
0.479
0.356
0.396
0.365
0.403
0.493
0.512
0.363
0.406
0.352
0.394
168
0.947
0.731
0.487
0.493
0.473
0.479
0.614
0.583
0.416
0.444
0.410
0.441
336
0.969
0.752
0.585
0.564
0.553
0.534
0.788
0.676
0.487
0.499
0.440
0.461
720
1.086
0.814
0.665
0.615
0.636
0.599
0.841
0.717
0.540
0.542
0.519
0.524
+
+
+Figure 7: Attention scores calculated by the decoder of the ablation version of Crossformer (i.e. DSW) on dataset ETTh1. The input length, prediction length and segment length are set as $T =$ 168, $\tau = 2 4 , L _ { s e g } = 6$ . The $\mathbf { X }$ axis in each sub-figure represents the time steps serve as keys in attention mechanism, while the y axis denotes dimensions. Brighter color denotes higher attention weights.
+
+# B.4 DEPENDENCY VISUALIZATION
+
+As the attention scores computed by Crossformer are abstract and hard to visualize, we visualize scores computed by the ablation version, DSW, in Figure 7. In addition to cross-time dependency that other Transformer models can compute, Crossformer also provides information about crossdimension dependency. As shown in Figure 7, when predicting Dim #1, the model focus on both Dim #1 and #3. When predicting Dim #5, instead of focus on Dim #5 itself, more attention is paid to Dim #4.
+
+# B.5 HIERARCHICAL PREDICTION PATTERN VISUALIZATION
+
+Figure 8 shows the hierarchical prediction patterns output by our HED. The top prediction layer, Layer 3, captures the low frequency general trend and periodic pattern of the future value. By adding predictions at finer scales, finer high frequency patterns are added and the prediction get closer to the ground truth curve.
+
+# B.6 RUNNING TIME EFFICIENCY ANALYSIS
+
+In the main paper, we show the memory occupation w.r.t input length $T$ and number of dimensions $D$ . Here we evaluate the running time. Figure 9 (a) shows the running time per batch of Crossformer and other Transformer-based models w.r.t input length $T$ . FEDformer is much slower than other Transformer-based models. Crossformer achieves the best computation speed among the five methods within the tested length range.
+
+
+Figure 8: Hierarchical prediction visualization of ETTm1 with dimension HUFL and prediction length $\tau = 2 8 8$ . From top left to bottom right, we gradually add layer predictions at finer scales.
+
+
+Figure 9: Evaluation on computational speed. (a) Running time per batch w.r.t the input length $T$ on ETTh1. (b) Running time per batch w.r.t number of dimensions $D$ on synthetic datasets by different numbers of dimensions.
+
+Figure 9 (b) shows the running time per batch of Crossformer and its ablation versions w.r.t the number of dimensions $D$ . Crossformers without TSA layer (DSW and $\mathrm { D S W + H E D } )$ ) are faster when $D$ is small $\left( D \leq 3 0 \right)$ ). However, they have difficulty processing high-dimensional MTS due to the quadratic complexity w.r.t $D$ . Indeed, for a single NVIDIA GeForce RTX 2080Ti GPU with 11GB memory, DSW and $\mathrm { D S W + H E D }$ encounters the out-of-memory (OOM) problem when $D > 5 0$ Moreover, TSA(w/o Router) encounter the OOM problem when $D > 2 0 0$ .
+
+# C DISCUSSION ON THE SELECTION OF HYPER-PARAMETERS
+
+We recommend to first determine the segment length $L _ { s e g }$ , as it is related to both the model performance and computation efficiency. The general idea is to use small $L _ { s e g }$ for short-term prediction and large $L _ { s e g }$ for long-term prediction. Some priors about the data also help to select $L _ { s e g }$ . For example, if the hourly sampled data has a daily period, it is better to set $L _ { s e g } = 2 4$ . Next, we select the number of layers for encoder and decoder $N$ . Crossformer with larger $N$ can utilize information of more scales, but also requires more computing resources. The number of routers in TSA layer $c$ can be set to 5 or 10 to balance the prediction accuracy and computation efficiency. Finally, dimension of hidden states $d _ { m o d e l }$ and head number of multi-head attention can be determined based on the available computing resources.
+
+Table 6: MSE and MAE evaluation with different segment lengths on ETTm1 dataset. \* denotes segment length used in the main text, which is a divisor of $T , \tau$ .
+
+
Metric
MSE
MAE
MSE
MAE
MSE MAE
Segment Length L seg
5
6*
7
T= 288,τ = 48
0.291
0.349
0.300
0.352
0.284 0.346
Segment Length Lseg
22
24*
26
T= 672,T = 288
0.401
0.424
0.404
0.427
0.409 0.429
+
+# D SUPPLEMENTARY DESIGN TO CROSSFORMER
+
+# D.1 HANDLING INDIVISIBLE LENGTH
+
+In the main paper, we assume that the input length $T$ and prediction length $\tau$ are divisible by segment length $L _ { s e g }$ . In this section, we use padding mechanism to handle cases where the assumption is not satisfied.
+
+If $T$ is not divisible by $L _ { s e g }$ , we have $( k _ { 1 } - 1 ) L _ { s e g } < T < k _ { 1 } L _ { s e g }$ for some $k _ { 1 }$ . We pad $k _ { 1 } L _ { s e g } - T$ duplicated $\mathbf { x } _ { 1 }$ in front of $\mathbf { x } _ { \mathrm { 1 : } T }$ to get $\mathbf { x } _ { 1 : T } ^ { \prime }$ :
+
+$$
+\mathbf { x } _ { 1 : T } ^ { \prime } = [ \underbrace { \mathbf { x } _ { 1 } , \dots , \mathbf { x } _ { 1 } } _ { k _ { 1 } L _ { s e g } - T } , \mathbf { x } _ { 1 : T } ]
+$$
+
+where $[ , ]$ denotes the concatenation operation. $\mathbf { x } _ { 1 : T } ^ { \prime } \in \mathbb { R } ^ { k _ { 1 } L _ { s e g } \times D }$ can be input to the encoder of Crossformer.
+
+If $\tau$ is not divisible by $L _ { s e g }$ , we have $( k _ { 2 } - 1 ) L _ { s e g } < \tau < k _ { 2 } L _ { s e g }$ for some $k _ { 2 }$ . We set the learnable position embeddioutput in shape of der as . Then $\mathbf { E } ^ { ( d e c ) } \in \mathbb { R } ^ { k _ { 2 } \times D \times d _ { m o d e l } }$ and input it ttput is used as der to get an. $\mathbb { R } ^ { k _ { 2 } L _ { s e g } \times D }$ $\tau$ $\mathbf { x } _ { T + 1 : T + \tau } ^ { p r e d }$
+
+We conduct experiment on ETTm1 dataset to evaluate the effect of indivisible length. Results in Table 6 show that with padding mechanism, indivisible length does not degrade model performance, for both short-term prediction and long-term prediction.
+
+# D.2 INCORPORATING COVARIATES
+
+In the main text, we only use historical series $\mathbf { x } _ { \mathrm { 1 : } T }$ to forecast the future $\mathbf { x } _ { T + 1 : T + \tau }$ . In this section, we try to incorporate covariates $\mathbf { c } _ { 1 : T + \tau }$ into Crossformer. We use a straightforward method: first embed the covariates into point-wise vectors $\left\{ { \bf d } _ { 1 } , { \bf d } _ { 2 } , \ldots , { \bf d } _ { T + \tau } \right\}$ like previous Transformer-based models do (Zhou et al., 2021; Wu et al., 2021a; Liu et al., 2021a). Then, merge the point-wise vectors into segment-wise vectors using learnable linear combination. Finally, add the segment-wise vectors to each dimension of the 2D vector array obtained by DSW embedding:
+
+$$
+\begin{array} { c } { \displaystyle \mathbf { c } _ { t } \to \mathbf { d } _ { t } , 1 \leq t \leq T } \\ { \displaystyle \mathbf { d } _ { i } ^ { ( s ) } = \sum _ { \substack { 0 < j \leq L _ { s e g } } } \alpha _ { j } \mathbf { d } _ { ( i - 1 ) \times L _ { s e g } + j } , \quad 1 \leq i \leq \frac { T } { L _ { s e g } } } \\ { \displaystyle \mathbf { h } _ { i , d } ^ { c o v } = \mathbf { h } _ { i , d } + \mathbf { d } _ { i } ^ { ( s ) } , \quad 1 \leq i \leq \frac { T } { L _ { s e g } } , \quad 1 \leq d \leq D } \end{array}
+$$
+
+where denotes embedding method for point-wise covariates. $\alpha _ { j } , 1 \le j \le L _ { s e g }$ denotes learnable factors for linear combination. $\mathbf { d } _ { i } ^ { ( s ) }$ denotes the segment-wise covariate embedding. ${ \bf h } _ { i , d } ^ { c o v }$ denotes the embedded vector with covariate information for the $i$ -th segment in dimension $d$ , where $\mathbf { h } _ { i , d }$ is the embedded vector obtained from DSW embedding in the main text. The processing for the input of the decoder is similar, the segment-wise covariate embedding is added to the position embedding for decoder, i.e. ${ \bf E } ^ { ( d e c ) }$ .
+
+Table 7: MSE and MAE evaluation of Crossformer without/with covariates on ETTh1 dataset.
+
+
Models
Crossformer
Crossformer+Cov
Metric
MSE MAE
MSE MAE
24
0.305 0.367
0.308 0.368
48
0.352 0.394
0.358 0.399
168
0.410 0.441
0.412 0.440
336
0.440 0.461
0.438 0.465
720
0.519 0.524
0.522 0.531
+
+We conduct experiments on ETTh1 dataset to evaluate the effect of covariates. Hour-of-the-day, dayof-the-week, day-of-the-month and day-of-the-year are used as covariates. Results in Table 7 show that incorporating covariates does not improve the performance of Crossformer. The possible reason is this straightforward embedding method does not cooperate well with Crossformer. Incorporating covariates into Crossformer to further improve prediction accuracy is still an open problem.
\ No newline at end of file
diff --git a/md/dev/vSix3HPYKSU/vSix3HPYKSU.md b/md/dev/vSix3HPYKSU/vSix3HPYKSU.md
new file mode 100644
index 0000000000000000000000000000000000000000..6f420278c4dffba831f33a504b90a709550e86d5
--- /dev/null
+++ b/md/dev/vSix3HPYKSU/vSix3HPYKSU.md
@@ -0,0 +1,635 @@
+# MESSAGE PASSING NEURAL PDE SOLVERS
+
+# Johannes Brandstetter∗
+
+Daniel E. Worrall∗ Qualcomm AI Research† dworrall@qti.qualcomm.com
+
+University of Amsterdam Johannes Kepler University Linz brandstetter@ml.jku.at
+
+Max Welling University of Amsterdam m.welling@uva.nl
+
+# ABSTRACT
+
+The numerical solution of partial differential equations (PDEs) is difficult, having led to a century of research so far. Recently, there have been pushes to build neural–numerical hybrid solvers, which piggy-backs the modern trend towards fully end-to-end learned systems. Most works so far can only generalize over a subset of properties to which a generic solver would be faced, including: resolution, topology, geometry, boundary conditions, domain discretization regularity, dimensionality, etc. In this work, we build a solver, satisfying these properties, where all the components are based on neural message passing, replacing all heuristically designed components in the computation graph with backpropoptimized neural function approximators. We show that neural message passing solvers representationally contain some classical methods, such as finite differences, finite volumes, and WENO schemes. In order to encourage stability in training autoregressive models, we put forward a method that is based on the principle of zero-stability, posing stability as a domain adaptation problem. We validate our method on various fluid-like flow problems, demonstrating fast, stable, and accurate performance across different domain topologies, discretization, etc. in 1D and 2D. Our model outperforms state-of-the-art numerical solvers in the low resolution regime in terms of speed and accuracy.
+
+# 1 INTRODUCTION
+
+In the sciences, years of work have yielded extremely detailed mathematical models of physical phenomena. Many of these models are expressed naturally in differential equation form (Olver, 2014), most of the time as temporal partial differential equations (PDE). Solving these differential equations is of huge importance for problems in all numerate disciplines such as weather forecasting (Lynch, 2008), astronomical simulations (Courant et al., 1967), molecular modeling (Lelievre & \` Stoltz, 2016) , or jet engine design (Athanasopoulos et al., 2009). Solving most equations of importance is analytically intractable and necessitates falling back on numerical approximation schemes. Obtaining accurate solutions of bounded error with minimal computational overhead requires the need for handcrafted solvers, always tailored to the equation at hand (Hairer et al., 1993).
+
+The design of “good” PDE solvers is no mean feat. The perfect solver should satisfy an almost endless list of conditions. There are user requirements, such as being fast, using minimal computational overhead, being accurate, providing uncertainty estimates, generalizing across PDEs, and being easy to use. Then there are structural requirements of the problem, such as spatial resolution and timescale, domain sampling regularity, domain topology and geometry, boundary conditions, dimensionality, and solution space smoothness. And then there are implementational requirements, such as maintaining stability over long rollouts and preserving invariants. It is precisely because of this considerable list of requirements that the field of numerical methods is a splitter field (Bartels, 2016), tending to build handcrafted solvers for each sub-problem, rather than a lumper field, where a mentality of “one method to rule them all” reigns. This tendency is commonly justified with reference to no free lunch theorems. We propose to numerically solve PDEs with an end-to-end, neural solver. Our contributions can be broken down into three main parts: (i) An end-to-end fully neural PDE solver, based on neural message passing, which offers flexibility to satisfy all structural requirements of a typical PDE problem. This design is motivated by the insight that some classical solvers (finite differences, finite volumes, and WENO scheme) can be posed as special cases of message passing. (ii) Temporal bundling and the pushforward trick, which are methods to encourage zero-stability in training autoregressive models. (iii) Generalization across multiple PDEs within a given class. At test time, new PDE coefficients can be input to the solver.
+
+# 2 BACKGROUND AND RELATED WORK
+
+Here in Section 2.1 we briefly outline definitions and notation. We then outline some classical solving techniques in Section 2.2. Lastly, in Section 2.3, we list some recent neural solvers and split them into the two main neural solving paradigms for temporal PDEs.
+
+# 2.1 PARTIAL DIFFERENTIAL EQUATIONS
+
+We focus on PDEs in one time dimension $t ~ = ~ [ 0 , T ]$ and possibly multiple spatial dimensions $\mathbf { x } = [ x _ { 1 } , x _ { 2 } , \ldots , x _ { D } ] ^ { \top } \in \mathbb { X }$ . These can be written down in the form
+
+$$
+\begin{array} { r l r l } & { \partial _ { t } \mathbf { u } = F ( t , \mathbf { x } , \mathbf { u } , \partial _ { \mathbf { x } } \mathbf { u } , \partial _ { \mathbf { x } \mathbf { x } } \mathbf { u } , \dots ) } & & { \qquad ( t , \mathbf { x } ) \in [ 0 , T ] \times \mathbb { X } } \\ & { \mathbf { u } ( 0 , \mathbf { x } ) = \mathbf { u } ^ { 0 } ( \mathbf { x } ) , \qquad B [ \mathbf { u } ] ( t , x ) = 0 } & & { \qquad \mathbf { x } \in \mathbb { X } , \ ( t , \mathbf { x } ) \in [ 0 , T ] \times \partial \mathbb { X } } \end{array}
+$$
+
+where $\mathbf { u } : [ 0 , T ] \times \mathbb { X } \mathbb { R } ^ { n }$ is the solution, with initial condition ${ \bf u } ^ { 0 } ( { \bf x } )$ at time $t = 0$ and boundary conditions $B [ { \bf u } ] ( t , x ) = 0$ when $\mathbf { x }$ is on the boundary $\partial \mathbb { X }$ of the domain $\mathbb { X }$ . The notation $\partial _ { \mathbf { x } } \mathbf { u } , \partial _ { \mathbf { x } \mathbf { x } } \mathbf { u } , \ldots$ is shorthand for partial derivatives $\partial { \bf u } / \partial { \bf x } , \bar { \partial } ^ { 2 } { \bf u } / \partial { \bf x } ^ { 2 }$ , and so forth. Most notably, $\partial \mathbf { u } / \partial \mathbf { x }$ represents a $n \times D$ dimensional Jacobian matrix, where each row is the transpose of the gradient of the corresponding component of $\mathbf { u }$ . We consider Dirichlet boundary conditions, where the boundary operator $B _ { \mathcal { D } } [ \mathbf { u } ] = \mathbf { u } - \mathbf { b } _ { \mathcal { D } }$ for fixed function $\mathbf { b } _ { \mathcal { D } }$ and Neumann boundary conditions, where $B _ { \mathcal { N } } [ \bar { u } ] \stackrel { \cdot } { = } { \mathbf { n } } ^ { \top } \partial _ { \mathbf { x } } u - \bar { b } _ { \mathcal { N } } ^ { \top }$ for scalar-valued $u$ , where $\mathbf { n }$ is an outward facing normal on $\partial \mathbb { X }$ .
+
+Conservation form Among all PDEs, we hone in on solving those that can be written down in conservation form, because there is already precedent in the field for having studied these (Bar-Sinai et al., 2019; Li et al., 2020a). Conservation form PDEs are written as
+
+$$
+\partial _ { t } \mathbf { u } + \nabla \cdot \mathbf { J } ( \mathbf { u } ) = 0 ,
+$$
+
+where $\nabla \cdot \mathbf { J }$ is the divergence of $\mathbf { J }$ . The quantity $\mathbf { J } : \mathbb { R } ^ { n } \mathbb { R } ^ { n }$ is the flux, which has the interpretation of a quantity that appears to flow. Consequently, $\mathbf { u }$ is a conserved quantity within a volume, only changing through the net flux $\mathbf { J } ( \mathbf { u } )$ through its boundaries.
+
+# 2.2 CLASSICAL SOLVERS
+
+Grids and cells Numerical solvers partition $\mathbb { X }$ into a finite grid $X = \{ c _ { i } \} _ { i = 1 } ^ { N }$ of $N$ small nonoverlapping volumes called cells $c _ { i } \subset \mathbb { X }$ . In this work, we focus on grids of rectangular cells. Each cell has a center at $\mathbf { x } _ { i }$ . $\mathbf { u } _ { i } ^ { k }$ is used to denote the discretized solution in cell $c _ { i }$ and time $t _ { k }$ . There are two main ways to compute $\mathbf { u } _ { i } ^ { k }$ : sampling $\mathbf { u } _ { i } ^ { k } = \mathbf { u } ( t _ { k } , \mathbf { x } _ { i } )$ and averaging $\begin{array} { r } { \mathbf { u } _ { i } ^ { k } = \int _ { c _ { i } } \mathbf { u } ( t _ { k } , \mathbf { x } ) \mathrm { d } \mathbf { x } } \end{array}$ . In our notation, omitting an index implies that we use the entire slice, so $\mathbf { u } ^ { k } = ( \mathbf { u } _ { 1 } ^ { k } , \mathbf { u } _ { 2 } ^ { k } , . . . , \mathbf { u } _ { N } ^ { k } )$ .
+
+Method of lines A common technique to solve temporal PDEs is the method of lines (Schiesser, 2012), discretizing domain $\mathbb { X }$ and solution $\mathbf { u }$ into a grid $X$ and a vector $\mathbf { u } ^ { k }$ . We then solve $\left. \partial _ { t } \mathbf { u } ^ { t } \right| _ { t _ { k } } =$ $f ( t , \mathbf { u } ^ { k } )$ for $t \in [ 0 , T ]$ , where $f$ is the form of $F$ acting on the vectorized $\mathrm { ~ \bf ~ u ~ } ^ { t }$ instead of the function $\mathbf { u } ( t , \mathbf { x } )$ . The only derivative operator is now in time, making it an ordinary differential equation (ODE), which can be solved with off-the-shelf ODE solvers (Butcher, 1987; Everhart, 1985). $f$ can be formed by approximating spatial derivatives on the grid. Below are three classical techniques.
+
+Finite difference method (FDM) In FDM, spatial derivative operators (e.g., $\partial _ { \mathbf { x } } )$ are replaced with difference operators, called stencils. For instance, $\partial _ { x } u ^ { k } | _ { x _ { i } }$ might become $( \mathbf { \bar { \boldsymbol { u } } } _ { i + 1 } ^ { k } - \boldsymbol { u } _ { i } ^ { k } ) / ( \mathbf { \bar { \boldsymbol { x } } } _ { i + 1 } - \boldsymbol { x } _ { i } )$ . Principled ways to derive stencils can be found in Appendix A. FDM is simple and efficient, but suffers poor stability unless the spatial and temporal discretizations are carefully controlled.
+
+Finite volume method (FVM) FVM works for equations in conservation form. It can be shown via the divergence theorem that the integral of $\mathbf { u }$ over cell $i$ increases only by the net flux into the cell. In 1D, this leads to f (t, uki ) = 1∆x $\begin{array} { r } { f ( t , u _ { i } ^ { k } ) = \mathbf { \Pi } _ { \Delta x _ { i } } ^ { - 1 } ( J _ { i - 1 / 2 } ^ { k } - J _ { i + 1 / 2 } ^ { k } ) } \end{array}$ , where $\Delta x _ { i }$ is the cell width, and $J _ { i - 1 / 2 } ^ { k } , J _ { i + 1 / 2 } ^ { k }$ i the flux at the left and right cell boundary at time $t _ { k }$ , respectively. The problem thus boils down to estimating the flux at cell boundaries $x _ { i \pm 1 / 2 }$ . The beauty of this technique is that the integral of $u$ is exactly conserved. FVM is generally more stable and accurate than FDM, but can only be applied to conservation form equations.
+
+Pseudospectral method (PSM) PSM computes derivatives in Fourier space. In practical terms,√ the $m ^ { \mathrm { t h } }$ derivative is computed as $\mathrm { I F F T } \{ ( \iota \omega \bar { ) } ^ { m } \mathrm { F F T } ( \boldsymbol { u } ) \}$ for $\iota = \sqrt { - 1 }$ . These derivatives obtain exponential accuracy (Tadmor, 1986), for smooth solutions on periodic domains and regular grids. For non-periodic domains, analogues using other polynomial transforms exist, but for non-smooth solution this technique cannot be applied.
+
+# 2.3 NEURAL SOLVERS
+
+We build on recent exciting developments in the field to learn PDE solvers. These neural PDE solvers, as we refer to them, are laying the foundations of what is becoming both a rapidly growing and impactful area of research. Neural PDE solvers for temporal PDEs fall into two broad categories, autoregressive methods and neural operator methods, see Figure 1a.
+
+Neural operator methods Neural operator methods treat the mapping from initial conditions to solutions at time $t$ as an input–output mapping learnable via supervised learning. For a given PDE and given initial conditions $\mathbf { u } _ { 0 }$ , a neural operator $\mathcal { M } : [ 0 , T ] \stackrel { \cdot } { \times } \mathcal { F } \mathcal { F }$ , where $\mathcal { F }$ is a (possibly infinite-dimensional) function space, is trained to satisfy
+
+$$
+\mathcal { M } ( t , { \mathbf { u } } ^ { 0 } ) = { \mathbf { u } } ( t ) .
+$$
+
+Finite-dimensional operator methods (Raissi, 2018; Sirignano & Spiliopoulos, 2018; Bhatnagar et al., 2019; Guo et al., 2016; Zhu & Zabaras, 2018; Khoo et al., 2020), where $\mathrm { d i m } ( \mathcal { F } ) < \infty$ are grid-dependent, so cannot generalize over geometry and sampling. Infinite-dimensional operator methods (Li et al., 2020c;a; Bhattacharya et al., 2021; Patel et al., 2021) by contrast resolve this issue. Each network is trained on example solutions of the equation of interest and is therefore locked to that equation. These models are not designed to generalize to dynamics for out-of-distribution $t$ .
+
+Autogressive methods An orthogonal approach, which we take, is autoregressive methods. These solve the PDE iteratively. For time-independent PDEs, the solution at time $t + \Delta t$ is computed as
+
+$$
+\mathbf { u } ( t + \Delta t ) = \mathcal { A } ( \Delta t , \mathbf { u } ( t ) ) ,
+$$
+
+where $\mathcal { A } : \mathbb { R } _ { > 0 } \times \mathbb { R } ^ { N } \to \mathbb { R } ^ { N }$ is the temporal update. In this work, since $\Delta t$ is fixed, we just write $\boldsymbol { \mathcal { A } } ( \mathbf { u } ( t ) )$ . Three important works in this area are Bar-Sinai et al. (2019), Greenfeld et al. (2019), and Hsieh et al. (2019). Each paper focuses on a different class of PDE solver: finite volumes, multigrid, and iterative finite elements, respectively. Crucially, they all use a hybrid approach (Garcia Satorras et al., 2019), where the solver computational graph is preserved and heuristically-chosen parameters are predicted with a neural network. Hsieh et al. (2019) even have convergence guarantees for their method, something rare in deep learning. Hybrid methods are desirable for sharing structure with classical solvers. So far in the literature, however, it appears that autoregressive methods are more the exception than the norm, and for those methods published, it is reported that they are hard to train. In Section 3 we explore why this is and seek to remedy it.
+
+# 3 METHOD
+
+In this section we detail our method in two parts: training framework and architecture. The training framework tackles the distribution shift problem in autoregressive solvers, which leads to instability. We then outline the network architecture, which is a message passing neural network.
+
+# 3.1 TRAINING FRAMEWORK
+
+Autoregressive solvers map solutions $\mathbf { u } ^ { k }$ to causally consequent ones $\mathbf { u } ^ { k + 1 }$ . A straightforward way of training is one-step training. If $p _ { 0 } ( \mathbf { u } ^ { 0 } )$ is the distribution of initial conditions in the training set, and $\begin{array} { r } { p _ { k } ( \mathbf { u } ^ { \bar { k } } ) = \int p ( \mathbf { u } ^ { \bar { k } } | \mathbf { u } ^ { 0 } ) p _ { 0 } ( \mathbf { \bar { u } } ^ { 0 } ) \mathrm { d } \mathbf { u } ^ { 0 } } \end{array}$ is the groundtruth distribution at iteration $k$ , we minimize
+
+$$
+L _ { \mathrm { o n e - s t e p } } = \mathbb { E } _ { k } \mathbb { E } _ { { \mathbf { u } } ^ { k + 1 } | { \mathbf { u } } ^ { k } , { \mathbf { u } } ^ { k } \sim p _ { k } } \left[ \mathcal { L } ( A ( { \mathbf { u } } ^ { k } ) , { \mathbf { u } } ^ { k + 1 } ) \right] ,
+$$
+
+
+Figure 1: (a) LEFT: Neural operators perform a direct mapping from initial conditions to a solution at time $t$ . RIGHT: Autoregressive models on the other hand compute the solution at time $t$ based on the computed solution at a fixed time offset before. (b) Our autoregressive solver outputs multiple time slices on every call, to reduce number of solver calls and therefore error propagation speed.
+
+where $\mathcal { L }$ is an appropriate loss function. At test time, this method has a key failure mode, instability: small errors in $\mathcal { A }$ accumulate over rollouts greater in length than 1 (which is the vast majority of rollouts), and lead to divergence from the groundtruth. This can be interpreted as overfitting to the one-step training distribution, and thus being prone to generalize poorly if the input shifts from this, which is usually the case after a few rollout steps.
+
+The pushforward trick We approach the problem in probabilistic terms. The solver maps $p _ { k } \mapsto$ $\mathcal { A } _ { \sharp } p _ { k }$ at iteration $k + 1$ , where ${ \bar { \mathcal { A } } } _ { \sharp } : \mathbb { P } ( X ) \ { \bar { \to } } \ \mathbb { P } ( X )$ is the pushforward operator for $\mathcal { A }$ and $\mathbb { P } ( X )$ is the space of distributions on $X$ . After a single test time iteration, the solver sees samples from $\mathcal { A } _ { \sharp } p _ { k }$ instead of the distribution $p _ { k + 1 }$ , and unfortunately $\mathcal { A } _ { \sharp } p _ { k } \neq p _ { k + 1 }$ because errors always survive training. The test time distribution is thus shifted, which we refer to as the distribution shift problem. This is a domain adaptation problem. We mitigate the distribution shift problem by adding a stability loss term, accounting for the distribution shift. A natural candidate is an adversarial-style loss
+
+$$
+L _ { \mathrm { s t a b i l i t y } } = \mathbb { E } _ { k } \mathbb { E } _ { { \mathbf { u } } ^ { k + 1 } | { \mathbf { u } } ^ { k } , { \mathbf { u } } ^ { k } \sim p _ { k } } \left[ \mathbb { E } _ { \epsilon | { \mathbf { u } } ^ { k } } \left[ { \mathcal { L } } ( A ( { \mathbf { u } } ^ { k } + { \boldsymbol { \epsilon } } ) , { \mathbf { u } } ^ { k + 1 } ) \right] \right] ,
+$$
+
+where $\boldsymbol { \epsilon } | \mathbf { u } ^ { k }$ is an adversarial perturbation sampled from an appropriate distribution. For the perturbation distribution, we choose $\epsilon$ such that $( \mathbf { u } ^ { k } + \epsilon ) \sim \bar { \mathcal { A } } _ { \sharp } p _ { k }$ . This can be easily achieved by using $( \mathbf { u } ^ { k } + \epsilon ) = \mathcal { A } ( \mathbf { u } ^ { k - 1 } )$ for $\mathbf { u } ^ { k - 1 }$ one step causally preceding $\mathbf { u } ^ { k }$ . Our total loss is then $L _ { \mathrm { o n e - s t e p } } + L _ { \mathrm { s t a b i l i t y } }$ . We call this the pushforward trick. We implement this by unrolling the solver for 2 steps but only backpropagating errors on the last unroll step, as shown in Figure 2. This is also outlined algorithmically in the appendix. We found it important not to backpropagate through the first unroll step. This is not only faster, it also seems to be more stable. Exactly why, we are not sure, but we think it may be to ensure the perturbations are large enough. Training the adversarial distribution itself to minimize the error, defeats the purpose of using it as an adversarial distribution. Adversarial losses were also introduced in Sanchez-Gonzalez et al. (2020) and later used in Mayr et al. (2021), where Brownian motion noise is used for $\epsilon$ and there is some similarity to Noisy Nodes (Godwin et al.), where noise injection is found to stabilize training of deep graph neural networks. There are also connections with zero-stability (Hairer et al., 1993) from the ODE solver literature. Zero-stability is the condition that perturbations in the input conditions are damped out sublinearly in time, that is $\lVert A ( \mathbf { u } ^ { 0 } + \epsilon ) - \mathbf { u } ^ { 1 } \rVert \stackrel { . } { < } \kappa \lVert \epsilon \rVert$ , for appropriate norm and small $\kappa$ . The pushforward trick can be seen to minimize $\kappa$ directly.
+
+The temporal bundling trick The second trick we found to be effective for stability and reducing rollout time is to predict multiple timesteps into the future synchronously. A typical temporal solver only predicts $\mathbf { u } ^ { 0 } \mapsto \mathbf { u } ^ { 1 }$ ; whereas, we predict $K$ steps $\mathbf { u } ^ { 0 } \mapsto \left( \mathbf { u } ^ { 1 } , \mathbf { u } ^ { 2 } , . . . , \mathbf { \bar { u } } ^ { K } \right) \stackrel { . . . } { = } \mathbf { u } ^ { 1 : K }$ together. This reduces the number of solver calls by a factor of $K$ and so reduces the number of times the solution distribution undergoes distribution shifts. A schematic of this setup can be seen in Figure 1b.
+
+# 3.2 ARCHITECTURE
+
+We model the grid $X$ as a graph $\mathcal { G } = ( \nu , \mathcal { E } )$ with nodes $i \in \mathcal V$ , edges $i j \in \mathcal { E }$ , and node features $\mathbf { f } _ { i } ~ \in ~ \mathbb { R } ^ { c }$ . The nodes represent grid cells $c _ { i }$ and the edges define local neighborhoods. Modeling the domain as a graph offers flexibility over grid sampling regularity, spatial/temporal resolution, domain topology and geometry, boundary modeling and dimensionality. The solver is a graph neural network (GNN) (Scarselli et al., 2009; Kipf & Welling, 2017; Defferrard et al., 2016; Gilmer et al., 2017; Battaglia et al., 2018), representationally containing the function class of several classical solvers, see Section 3.2. We follow the Encode-Process-Decode framework of Battaglia et al. (2018) and Sanchez-Gonzalez et al. (2020) , with adjustments. We are not the first to use GNNs as PDE solvers (Li et al., 2020b; De Avila Belbute-Peres et al., 2020), but ours have several notable features. Different aspects of the chosen architecture are ablated in Appendix G.
+
+
+Figure 2: Different training strategies. LEFT: One-step training only predicts solutions one step into the future. MIDDLE: Unrolled training predicts $N$ steps into the future. RIGHT: Adversarial training predicts $N$ steps into the future, but only backprops on the last step.
+
+Encoder The encoder computes node embeddings. For each node $i$ it maps the last $K$ solution values uki $\mathbf { u } _ { i } ^ { k - K : k }$ , node position $\mathbf { x } _ { i }$ , current time $t _ { k }$ , and equation embedding $\pmb { \theta } _ { \mathrm { P D E } }$ to node embedding vector $\bar { \mathbf { f } _ { i } ^ { 0 } } = \epsilon ^ { v } ( [ \mathbf { u } _ { i } ^ { k - K : k } , \mathbf { x } _ { i } , t _ { k } , \pmb { \theta } _ { \mathrm { P D E } } ] )$ . $\theta _ { \mathrm { P D E } }$ contains the PDE coefficients and other attributes such as boundary conditions. An exact description is found in Section 4. The inclusion of $\pmb { \theta } _ { \mathrm { P D E } }$ allows us to train the solver on multiple different PDEs.
+
+Processor The processor computes $M$ steps of learned message passing, with intermediate graph representations $\mathcal { G } ^ { 1 } , \mathcal { G } ^ { 2 } , . . . , \mathcal { G } ^ { M }$ . The specific updates we use are
+
+$$
+\begin{array} { r l } { { \mathrm { l g e } j \to i \mathrm { m e s s a g e } ; \quad } } & { { { \bf m } _ { i j } ^ { m } = \phi \left( { \bf f } _ { i } ^ { m } , { \bf f } _ { j } ^ { m } , { \bf u } _ { i } ^ { k - K : k } - { \bf u } _ { j } ^ { k - K : k } , { \bf x } _ { i } - { \bf x } _ { j } , \theta _ { \mathrm { P D E } } \right) , } } \\ { { \mathrm { n o d e } i \mathrm { u p d a t e } ; \quad } } & { { { \bf f } _ { i } ^ { m + 1 } = \psi \left( { \bf f } _ { i } ^ { m } , \displaystyle \sum _ { j \in N ( i ) } { \bf m } _ { i j } ^ { m } , \theta _ { \mathrm { P D E } } \right) , } } \end{array}
+$$
+
+where $\mathcal { N } ( i )$ holds the neighbors of node $i$ , and $\phi$ and $\psi$ are multilayer perceptrons (MLPs). Using relative positions $\mathbf { x } _ { j } - \mathbf { x } _ { i }$ can be justified by the translational symmetry of the PDEs we consider. Solution differences $\mathbf { u } _ { i } - \mathbf { u } _ { j }$ make sense by thinking of the message passing as a local difference operator, like a numerical derivative operator. Parameters $\pmb { \theta } _ { \mathrm { P D E } }$ are inserted into the message passing similar to Brandstetter et al. (2021)
+
+Decoder After message passing, we use a shallow 1D convolutional network with shared weights across spatial locations to output the $K$ next timestep predictions at grid point $\mathbf { x } _ { i }$ . For each node $i$ , the processor outputs a vector $\mathbf { f } _ { i } ^ { M }$ . We treat this vector as a temporally contiguous signal, which we feed into a CNN over time. The CNN helps to smooth the signal over time and is reminiscent of linear multistep methods (Butcher, 1987), which are very efficient but generally not used because of stability concerns. We seem to have avoided these stability issues, by making the time solver nonlinear and adaptive to its input. The result is a new vector $\mathbf d _ { i } = ( \bar { \mathbf d } _ { i } ^ { 1 } , \mathbf d _ { i } ^ { 2 } , . . . , \mathbf d _ { i } ^ { K } )$ with each element $\mathbf { d } _ { i } ^ { k }$ corresponding to a different point in time. We use this to update the solution as
+
+$$
+{ \mathbf { u } } _ { i } ^ { k + \ell } = { \mathbf { u } } _ { i } ^ { k } + ( t _ { k + \ell } - t _ { k } ) { \mathbf { d } } _ { i } ^ { \ell } , \qquad 1 \le \ell \le K .
+$$
+
+The motivation for this choice of decoder has to do with a property called consistency (Arnold, 2015), which states that $\begin{array} { r } { \operatorname* { l i m } _ { \Delta t 0 } \| \mathcal { A } ( \Delta t , \mathbf { u } ^ { 0 } ) - \mathbf { u } ( \Delta t ) \| = 0 } \end{array}$ , i.e. the prediction matches the exact solution in the infinitesimal time limit. Consistency is a requirement for zero-stability of the rollouts.
+
+
+Figure 3: Schematic sketch of our MP-PDE Solver.
+
+Connections. As mentioned in Bar-Sinai et al. (2019), both FDM and FVM are linear methods, which estimate $n ^ { \mathrm { t h } }$ -order point-wise function derivatives as
+
+$$
+[ \partial _ { x } ^ { ( n ) } u ] _ { i } \simeq \sum _ { j \in \mathcal { N } ( i ) } \alpha _ { j } ^ { ( n ) } u _ { j }
+$$
+
+for appropriately chosen coefficients $\alpha _ { j } ^ { ( n ) }$ , where $\mathcal { N } ( i )$ is the neighborhood of cell $i$ . FDM computes this at cell centers, and FVM computes this at cell boundaries. These estimates are plugged into flux equations, see Table 3 in the appendix, followed by an optional FVM update step, to compute time derivative estimates for the ODE solver. The WENO5 scheme computes derivative estimates by taking an adaptively-weighted average over multiple FVM estimates, computed using different neighborhoods of cell $i$ (see Equation 23). The FVM update, Equation 11, and Equation 23 are just message passing schemes with weighted aggregation (1 layer for FDM, 2 layers for FVM, and 3 layers for WENO). It is through this connection, that we see that message-passing neural networks representationally contain these classical schemes, and are thus a well-motivated architecture.
+
+# 4 EXPERIMENTS
+
+We demonstrate the effectiveness of the MP-PDE solver on tasks of varying difficulty to showcase its qualities. In 1D, we study its ability to generalize to unseen equations within a given family; we study boundary handling for periodic, Dirichlet, and Neumann boundary conditions; we study both regular and irregular grids; and we study the ability to model shock waves. We then show that the MP-PDE is able to solve equations in 2D. We also run ablations over the pushforward trick and variations, to demonstrate its utility. As baselines, we compare against standard classical PDE solvers, namely; FDM, pseudospectral methods, and a WENO5 solver, and we compare against the Fourier Neural Operator of Li et al. (2020a) as an example of a state-of-the-art neural operator method. The MP-PDE solver architecture is detailed in Appendix F.
+
+# 4.1 INTERPOLATING BETWEEN PDES
+
+Data We focus on the family of PDEs
+
+$$
+\begin{array} { c } { { \displaystyle [ \partial _ { t } u + \partial _ { x } ( \alpha u ^ { 2 } - \beta \partial _ { x } u + \gamma \partial _ { x x } u ) ] ( t , x ) = \delta ( t , x ) , } } \\ { { \displaystyle u ( 0 , x ) = \delta ( 0 , x ) , \qquad \delta ( t , x ) = \sum _ { j = 1 } ^ { J } A _ { j } \sin ( \omega _ { j } t + 2 \pi \ell _ { j } x / L + \phi _ { j } ) } } \end{array}
+$$
+
+Writing $\theta _ { \mathrm { P D E } } = \left( \alpha , \beta , \gamma \right)$ , corner cases are the heat equation $\theta _ { \mathrm { P D E } } = ( 0 , \eta , 0 )$ , Burgers’ equation $\theta _ { \mathrm { P D E } } = ( 0 . 5 , \eta , 0 )$ , and the KdV equation $\theta _ { \mathrm { P D E } } ~ = ~ ( 3 , 0 , 1 )$ . The term $\delta$ is a forcing term, following Bar-Sinai et al. (2019), with $J = 5$ , $L = 1 6$ and coefficients sampled uniformly in $A _ { j } \in$ $[ - 0 . 5 , 0 . 5 ]$ , $\omega _ { j } \in [ - 0 . 4 , - 0 . 4 ] , \ell _ { j } \in \{ 1 , 2 , 3 \} , \phi _ { j } \in [ 0 , 2 \pi )$ . This setup guarantees periodicity of the initial conditions and forcing. Space is uniformly discretized to $n _ { x } = 2 0 0$ cells in $[ 0 , 1 6 )$ with periodic boundary and time is uniformly discretized to $n _ { t } = 2 0 0$ points in $[ 0 , 4 ]$ . Our training sets consist of 2096 trajectories, downsampled to resolutions $( n _ { t } , n _ { x } ) \in \{ ( 2 5 0 , 1 0 0 ) , ( 2 5 0 , 5 0 ) , ( 2 5 0 , 4 0 ) \}$ . Numerical groundtruth is generated using a $5 ^ { \mathrm { t h } }$ -order WENO scheme (WENO5) (Shu, 2003) for the convection term $\partial _ { x } u ^ { 2 }$ and $4 ^ { \mathrm { t h } }$ -order finite difference stencils for the remaining terms. The temporal solver is an explicit Runge-Kutta 4 solver (Runge, 1895; Kutta, 1901) with adaptive timestepping. Detailed methods and implementation are in Appendix C. All methods are implemented for GPU, so runtime comparisons are fair. For the interested reader comparison of WENO and FDM schemes against analytical solutions can be found in Appendix $\textrm { C }$ to establish utility in generating groundtruth.
+
+Experiments and results We consider three scenarios: E1 Burgers’ equation without diffusion $\theta _ { \mathrm { P D E } } = \left( 1 , 0 , 0 \right)$ for shock modeling; E2 Burgers’ equation with variable diffusion $\theta _ { \mathrm { P D E } } = \left( 1 , \eta , 0 \right)$ where $0 ~ \leq ~ \eta ~ \leq ~ 0 . 2$ ; and E3 a mixed scenario with $\theta _ { \mathrm { P D E } } \ : = \ : ( \alpha , \beta , \gamma )$ where $0 . 0 ~ \leq ~ \alpha ~ \leq ~ 3 . 0 ,$ $0 . 0 \leq \beta \leq 0 . 4$ and $0 . 0 \leq \gamma \leq 1 . 0$ . E2 and E3 test the generalization capability. We compare against downsampled groundtruth (WENO5) and a variation of the Fourier Neural Operator with an autoregressive structure (FNO-RNN) used in Section 5.3 of their paper, and trained with unrolled training (see Figure 2). For our models we run the MP-PDE solver, an ablated version $( \mathbf { M P - P D E - } \theta _ { \mathrm { P D E } } )$ , without $\pmb { \theta } _ { \mathrm { P D E } }$ features, and the Fourier Neural Operator method trained using our temporal bundling and pushforward tricks (FNO-PF). Errors and runtimes for all experiments are in Table 1. We see that the MP-PDE solver outperforms WENO5 and FNO-RNN in accuracy. Temporal bundling and the pushforward trick improve FNO dramatically, to the point where it beats MP-PDE on E1. But MP-PDE outperforms FNO-PF on E2 and E3 indicating that FNO is best for single equation modeling, but MP-PDE is better at generalization. MP-PDE predictions are best if equation parameters $\pmb { \theta } _ { \mathrm { P D E } }$ are used, evidenced in E2 and E3. This effect is most pronounced for E3, where all parameters are varied. Exemplary rollout plots for E2 and E3 are in Appendix F.1. Figure 4 (TOP) shows shock formation at different resolutions (E1), a traditionally difficult phenomenon to model—FDM and PSM methods cannot model shocks. Strikingly, shocks are preserved even at very low resolution.
+
+# 4.2 VALIDATING TEMPORAL BUNDLING AND THE PUSHFORWARD METHOD
+
+We observe solver survival times on E1, defined as the time until the solution diverges from groundtruth. A solution $\hat { \mathbf { u } } _ { i } ^ { k }$ diverges from the groundtruth $\mathbf { u } _ { i } ^ { k }$ when its max-normalized $L _ { 1 }$ -error $\begin{array} { r } { \frac { 1 } { n _ { x } } \sum _ { i = 1 } ^ { n _ { x } } \frac { \lvert \hat { \mathbf { u } } _ { i } ^ { k } - \mathbf { u } _ { i } ^ { k } \rvert } { \operatorname* { m a x } _ { j } \lvert \mathbf { u } _ { j } ^ { k } \rvert } } \end{array}$ exceeds 0.1. The solvers are unrolled to $n _ { t } ~ = ~ 1 0 0 0$ timesteps with $T = 1 6$ s. Examples are shown in Figure 4 (BOTTOM), where we observe increasing divergence after $\sim 8$ s. This is corroborated by Figure 5a where we see survival ratio against timestep. This is in line with observed problems with autoregressive models from the literature—see Figure C.3 of SanchezGonzalez et al. (2020) or Figure S9 of Bar-Sinai et al. (2019)
+
+In a second experiment, we compare the efficacy of the pushforward trick. Already, we saw that, coupled with temporal bundling, it improved FNO for our autoregressive tasks. In Figure 5b, we plot the survival ratios for models trained with and without the pushforward trick. As a third comparison we show a model trained with Gaussian noise adversarial perturbations, similar to that proposed in Sanchez-Gonzalez et al. (2020). We see that applying the pushforward trick leads to far higher survival times, confirming our model that instability can be addressed with adversarial training.
+
+
+Figure 4: TOP: Exemplary 1D rollout of shock formation at different resolutions. The different colors represent PDE solutions at different timepoints. Both the small and the large shock are neatly captured and preserved even for low resolutions; boundary conditions are perfectly modeled. BOTTOM: Exemplary long 2D rollout of shock formations over 1000 timesteps. Different colors represent PDE solutions at different space-time points.
+
+Table 1: Error and runtime experiments targeting shock wave formation modeling and generalization to unseen equations. Runtimes are for one full unrolling over 250 timesteps on a GeForce RTX 2080 Ti GPU. FNO-PF, MP-PDE- $\theta _ { \mathrm { P D E } }$ , and MP-PDE are all ours. Accumulated error is $\begin{array} { r } { \frac { 1 } { n _ { x } } \sum _ { x , t } \mathbf { M S E } } \end{array}$ .
+
+
Accumulated Error ↓
Runtime [s]↓
(nt,nx)
WENO5
FNO-RNN
FNO-PF
MP-PDE-0PDE
MP-PDE
WENO5
MP-PDE
E1
(250,100)
2.02
11.93
0.54
=
1.55
1.9
0.09
E1
(250,50)
6.23
29.98
0.51
1.67
1.8
0.08
E1
(250,40)
9.63
10.44
0.57
1.47
1.7
0.08
E2
(250,100)
1.19
17.09
2.53
1.62
1.58
1.9
0.09
E2
(250,50)
5.35
3.57
2.27
1.71
1.63
1.8
0.09
E2
(250,40)
8.05
3.26
2.38
1.49
1.45
1.7
0.08
E3
(250,100)
4.71
10.16
5.69
4.71
4.26
4.8
0.09
E3
(250,50)
11.71
14.49
5.39
10.90
3.74
4.5
0.09
E3
(250,40)
15.94
20.90
5.98
7.78
3.70
4.4
0.09
+
+
+Figure 5: Survival times at E1. Rollout for long trajectories of 8 s (left), pushforward (pf) ablation (right). The ablation compares survival times at resolutions $n _ { x } = 1 0 0$ (solid) and $n _ { x } = 5 0$ (dashed) against survival times using pushforward (no pf), no pushforward but putting Gaussian noise $\overset { \cdot } { \boldsymbol { \sigma } } =$ 0.01), pushforward but without cutting the gradients (pf gradients).
+
+Interestingly, injecting Gaussian perturbations appears worse than using none. Closer inspection of rollouts shows that although Gaussian perturbations improve stability, they lead to lower accuracy, by nature of injecting noise into the system.
+
+# 4.3 SOLVING ON IRREGULAR GRIDS WITH DIFFERENT BOUNDARY CONDITIONS
+
+The underlying motives for designing this experiment are to investigate (i) how well our MP-PDE solver can operate on irregular grids and (ii) how well our MP-PDE solver can generalize over different boundary conditions. Non-periodic domains and grid sampling irregularity go hand in hand, since pseudo-spectral methods designed for closed intervals operate on non-uniform grids.
+
+Data We consider a simple 1D wave equation
+
+$$
+\partial _ { t t } u - c ^ { 2 } \partial _ { x x } u = 0 , \qquad x \in [ - 8 , 8 ]
+$$
+
+where $c$ is wave velocity $\acute { c } = 2$ in our experiments). We consider Dirichlet $B [ u ] = u = 0$ and Neumann $B [ u ] = \partial _ { x } u = 0$ boundary conditions. This PDE is $2 ^ { \mathrm { n d } }$ -order in time, but can be rewritten as $1 ^ { \mathrm { s t } }$ -order in time, by introducing the auxilliary variable $\ v \ = \ \partial _ { t } u$ and writing $\partial _ { t } [ u , v ] - [ v , c ^ { 2 } \partial _ { x x } u ] = 0$ . The initial condition is a Gaussian pulse with peak at random location. Numerical groundtruth is generated using FVM and Chebyshev spectral derivatives, integrated in time with an implicit Runge-Kutta method of Radau IIA family, order 5 (Hairer et al., 1993). We solve for groundtruth at resolution $( n _ { t } , n _ { x } ) = ( 2 5 0 , 2 0 0 )$ on a Chebyshev extremal point grid (cell edges are located at $x _ { i } = \cos ( i \pi / ( n _ { x } + 1 ) )$ .
+
+Experiments and results We consider three scenarios: WE1 Wave equation with Dirichlet boundary conditions; WE2 Wave equation with Neumann boundary conditions and, WE3 Arbitrary combinations of these two boundary conditions, testing generalization capability of the MP-PDE solver.
+
+Ablation studies (marked with $\theta _ { \mathrm { P } } \delta \overline { { \mathrm { E } } } )$ have no equation specific parameters input to the MP-PDE solver. Table 2 compares our MP-PDE solver against state-of-the art numerical pseudospectral solvers. MP-PDE solvers obtain accurate results for low resolutions where pseudospectral solvers break. Interestingly, MP-PDE solvers can generalize over different boundary conditions, which gets more pronounced if boundary conditions are injected into the equation via $\theta _ { \mathrm { P D E } }$ features.
+
+Table 2: Error and runtime comparison on tasks with non-periodic boundaries and irregular grids. Runtimes measure one full 250 timesteps unrolling on a GeForceRTX 2080 Ti GPU for MP-PDE solvers, and on a CPU for our pseudospectral (PS) solver implementation based on scipy.
+
+
1 MSE↓(WE1) nx xt
∑MSE↓(WE2) nx x,t
1 ∑MSE ↓(WE3) nx x,t
Runtime [s]↓
(nt,nx)
PS
MP-PDE
PS
MP-PDE
PS MP-PDEOPDE
MP-PDE
PS
MP-PDE
(250,100)
0.004
0.137
0.004
0.111
0.004
38.775 0.097
0.60
0.09
(250,50)
0.450
0.035
0.681
0.034
0.610
20.445
0.106 0.35
0.09
(250,40)
194.622
0.042
217.300
0.003
204.298
16.859
0.219 0.25
0.09
(250,20)
breaks
0.059
breaks
0.007
breaks
17.591
0.379 0.20
0.07
+
+# 4.4 2D EXPERIMENTS
+
+We finally test the scalability of our MP-PDE solver to a higher number of spatial dimensions, more specifically to 2D experiments. We use data from PHIFLOW1, an open-source fluid simulation toolkit. We look at fluid simulation based on the Navier-Stokes equations, and simulate smoke inflow into a $3 2 \times 3 2$ grid, adding more smoke after every time step which follows the buoyancy force. Dynamics can be described by semi-Lagrangian advection for the velocity and MacCormack advection for the smoke distribution. Simulations run for 100 timesteps where one timestep corresponds to one second. Smoke inflow locations are sampled randomly. Architectural details are in Appendix F. Figure 12 in the appendix shows results of the MP-PDE solver and comparisons to the groundtruth simulation. The MP-PDE solver is able to capture the smoke inflow accurately over the given time period, suggesting scalability of MP-PDE solver to higher dimensions.
+
+# 5 CONCLUSION
+
+We have introduced a fully neural MP-PDE solver, which representationally contains classical methods, such as the FDM, FVM, and WENO schemes. We have diagnosed the distribution shift problem and introduced the pushforward trick combined with the idea of temporal bundling trying to alleviate it. We showed that these tricks reduce error explosion observed in training autoregressive models, including a SOTA neural operator method (Li et al., 2020a). We also demonstrated that MP-PDE solvers offer flexibility when generalizing across spatial resolution, timescale, domain sampling regularity, domain topology and geometry, boundary conditions, dimensionality, and solution space smoothness. In doing so, MP-PDE solvers are much faster than SOTA numerical solvers.
+
+MP-PDE solvers cannot only be used to predict the solution of PDEs, but can e.g. also be reinterpreted to optimize the integration grid and the parameters of the PDE. For the former, simply position updates need to be included in the processor, similar to Satorras et al. (2021). For the latter, a trained MP-PDE solver can be fitted to new data where only $\theta _ { \mathrm { P D E } }$ features are adjusted. A limitation of our model is that we require high quality groundtruth data to train. Indeed generating this data in the first place was actually the toughest part of the whole project. However, this is a limitation of most neural PDE solvers in the literature. Another limitation is the lack of accuracy guarantees typical solvers have been designed to output. This is a common criticism of such learned numerical methods. A potential fix would be to fuse this work with that in probabilistic numerics (Hennig et al., 2015), as has been done for RK4 solvers (Schober et al., 2014). Another promising follow-up direction is to research alternative adversarial-style losses as introduced in Equation 7. Finally, we remark that leveraging symmetries and thus fostering generalization is a very active field of research, which is especially appealing for building neural PDE solvers since every PDE is defined via a unique set of symmetries (Olver, 1986).
+
+# 6 REPRODUCIBILITY STATEMENT
+
+All data used in this work is generated by ourselves. It is thus of great importance to make sure that the produced datasets are correct. We therefore spend an extensive amount of time cross-checking our produced datasets. For experiments E1, E2, E3, this is done by comparing the WENO scheme to analytical solutions as discussed in detail in Appendix Section C.3, where we compare our implemented WENO scheme against two analytical solutions of the Burgers equation from literature. For experiments W1, W2, W3, we cross-checked if Gaussian wave packages keep their form throughout the whole wave propagation phase. Furthermore, the wave packages should change sign for Dirichlet boundary conditions and keep the sign for Neumann boundary conditions. Examples can be found in Appendix Section D.
+
+We have described our architecture in Section 3.2 and provided further implementation details in Appendix Section F. We have introduced new concepts, namely temporal bundling and the pushforward method. We have described these concepts at length in our paper. We have validated temporal bundling and pushforward methods on both our and the Fourier Neural Operator (FNO) method Li et al. (2020a). We have not introduced new mathematical results. However, we have used data generation concepts from different mathematical fields and therefore have included a detailed description of those in our appendix.
+
+For reproducibility, we provide our at https://github.com/brandstetter-johannes/MP-Neural-PDESolvers.
+
+# 7 ETHICAL STATEMENT
+
+The societal impact of MP-PDE solvers is difficult to predict. However, as stated in the introduction, solving differential equations is of huge importance for problems in many disciplines such as weather forecasting, astronomical simulations, or molecular modeling. As such, MP-PDE solvers potentially help to pave the way towards shortcuts for computationally expensive simulations. Most notably, a drastical computational shortcut is always somehow related to reducing the carbon footprint. However, in this regard, it is also important to remind ourselves that relying on simulations or now even shortcuts of those always requires monitoring and thorough quality checks.
+
+# ACKNOWLEDGMENTS
+
+Johannes Brandstetter thanks the Institute of Advanced Research in Artificial Intelligence (IARAI) and the Federal State Upper Austria for the support. The authors thank Markus Holzleitner for helpful comments on this work.
+
+# REFERENCES
+
+Douglas N Arnold. Stability, consistency, and convergence of numerical discretizations. 2015.
+
+Michael Athanasopoulos, Hassan Ugail, and Gabriela Gonzalez. Parametric design of aircraft geometry using partial differential equations. Advances in Engineering Software, 40, 2009.
+
+Yohai Bar-Sinai, Stephan Hoyer, Jason Hickey, and Michael P. Brenner. Learning data-driven discretizations for partial differential equations. Proceedings of the National Academy of Sciences, 116(31):15344–15349, Jul 2019. ISSN 1091-6490. doi: 10.1073/pnas.1814058116.
+
+Soren Bartels. ¨ Numerical Approximation of Partial Differential Equations. Springer, 2016.
+
+Claude Basdevant, Michel Deville, Pierre Haldenwang, Jean Lacroix, Jalil Ouazzani, R. Peyret, Paolo Orlandi, and Patera A.T. Spectral and finite difference solutions of the burgers equation. Computers and Fluids, 14(1):23–41, 1986.
+
+Peter W. Battaglia, Jessica B. Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, Caglar Gulcehre, Francis Song, Andrew Ballard, Justin Gilmer, George Dahl, Ashish Vaswani, Kelsey Allen, Charles Nash, Victoria Langston, Chris Dyer, Nicolas Heess, Daan Wierstra, Pushmeet Kohli, Matt Botvinick, Oriol Vinyals, Yujia Li, and Razvan Pascanu. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018.
+
+Saakaar Bhatnagar, Yaser Afshar, Shaowu Pan, Karthik Duraisamy, and Shailendra Kaushik. Prediction of aerodynamic flow fields using convolutional neural networks. Computational Mechanics, 64(2):525–545, Jun 2019.
+
+Kaushik Bhattacharya, Bamdad Hosseini, Nikola B. Kovachki, and Andrew M. Stuart. Model reduction and neural networks for parametric pdes, 2021.
+
+Johannes Brandstetter, Rob Hesselink, Elise van der Pol, Erik Bekkers, and Max Welling. Geometric and physical quantities improve e(3) equivariant message passing. arXiv preprint arXiv:2110.02905, 2021.
+
+John Charles Butcher. Coefficients for the study of runge-kutta integration processes. Journal of the Australian Mathematical Society, 3(2):185–201, 1963.
+
+John Charles Butcher. The numerical analysis of ordinary differential equations: Runge-Kutta and general linear methods. Wiley-Interscience, 1987.
+
+Djork-Arne Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network´ learning by exponential linear units (elus). In International Conference on Learning Representations (ICLR), 2016.
+
+Richard Courant, Kurt Otto Friedrichs, and Hans Lewy. On the partial difference equations of mathematical physics. IBM J. Res. Dev., 11(2):215–234, 1967. ISSN 0018-8646.
+
+Filipe De Avila Belbute-Peres, Thomas Economon, and Zico Kolter. Combining differentiable PDE solvers and graph neural networks for fluid flow prediction. 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. 2402–2411. PMLR, 13–18 Jul 2020.
+
+Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on ¨ graphs with fast localized spectral filtering. In D. Lee, M. Sugiyama, U. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 29. Curran Associates, Inc., 2016.
+
+Edgar Everhart. An efficient integrator that uses gauss-radau spacings. International Astronomical Union Colloquium, 83:185–202, 1985.
+
+Victor Garcia Satorras, Zeynep Akata, and Max Welling. Combining generative and discriminative models for hybrid inference. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d’Alche Buc, ´ E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 13802– 13812. Curran Associates, Inc., 2019.
+
+Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In International Conference on Machine Learning, pp. 1263–1272. PMLR, 2017.
+
+Jonathan Godwin, Michael Schaarschmidt, Alexander Gaunt, Alvaro Sanchez-Gonzalez, Yulia Rubanova, Petar Velickovic, James Kirkpatrick, and Peter W. Battaglia. Very deep graph neural networks via noise regularisation. arXiv preprint arXiv:2106.07971.
+
+Daniel Greenfeld, Meirav Galun, Ronen Basri, Irad Yavneh, and Ron Kimmel. Learning to optimize multigrid PDE solvers. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, pp. 2415–2423, 2019.
+
+Xiaoxiao Guo, Wei Li, and Francesco Iorio. Convolutional neural networks for steady flow approximation. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’16, pp. 481–490. Association for Computing Machinery, 2016.
+
+Ernst Hairer, Syvert Nørsett, and Gerhard Wanner. Solving Ordinary Differential Equations I (2nd Revised. Ed.): Nonstiff Problems. Springer-Verlag, Berlin, Heidelberg, 1993. ISBN 0387566708.
+
+Philipp Hennig, Michael A. Osborne, and Mark Girolami. Probabilistic numerics and uncertainty in computations. Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences, 471(2179):20150142, Jul 2015. ISSN 1471-2946. doi: 10.1098/rspa.2015.0142. URL http://dx.doi.org/10.1098/rspa.2015.0142.
+
+Jun-Ting Hsieh, Shengjia Zhao, Stephan Eismann, Lucia Mirabella, and Stefano Ermon. Learning neural PDE solvers with convergence guarantees. arXiv preprint arXiv:1906.01200, 2019.
+
+Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International conference on machine learning, pp. 448–456. PMLR, 2015.
+
+Guang-Shan Jiang and Chi-Wang Shu. Efficient implementation of weighted eno schemes. Journal of Computational Physics, 126(1):202 – 228, 1996. ISSN 0021-9991.
+
+Yuehaw Khoo, Jianfeng Lu, and Lexing Ying. Solving parametric pde problems with artificial neural networks. European Journal of Applied Mathematics, 32(3):421–435, Jul 2020. ISSN 1469-4425.
+
+Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations (ICLR), 2017.
+
+Wilhelm Kutta. Beitrag zur naherungsweisen integration totaler differentialgleichungen. ¨ Zeitschrift fur Mathematik und Physik¨ , 46:435 – 453, 1901.
+
+Tony Lelievre and Gabriel Stoltz. Partial differential equations and stochastic methods in molecular \` dynamics. Acta Numerica, 25:681–880, 2016.
+
+Zongyi Li, Nikola Kovachki, Kamyar Azizzadenesheli, Burigede Liu, Kaushik Bhattacharya, Andrew Stuart, and Anima Anandkumar. Fourier neural operator for parametric partial differential equations. arXiv preprint arXiv:2010.08895, 2020a.
+
+Zongyi Li, Nikola Kovachki, Kamyar Azizzadenesheli, Burigede Liu, Kaushik Bhattacharya, Andrew Stuart, and Anima Anandkumar. Multipole graph neural operator for parametric partial differential equations. arXiv preprint arXiv:2006.09535, 2020b.
+
+Zongyi Li, Nikola Kovachki, Kamyar Azizzadenesheli, Burigede Liu, Kaushik Bhattacharya, Andrew Stuart, and Anima Anandkumar. Neural operator: Graph kernel network for partial differential equations. arXiv preprint arXiv:2003.03485, 2020c.
+
+Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
+
+Peter Lynch. The origins of computer weather prediction and climate modeling. Journal of computational physics, 227(7):3431–3444, 2008.
+
+Andreas Mayr, Sebastian Lehner, Arno Mayrhofer, Christoph Kloss, Sepp Hochreiter, and Johannes Brandstetter. Boundary graph neural networks for 3d simulations. arXiv preprint arXiv:2106.11299, 2021.
+
+Peter J Olver. Introduction to partial differential equations. Springer, 2014.
+
+P.J. Olver. Symmetry groups of differential equations. In Applications of Lie Groups to Differential Equations, pp. 77–185. Springer, 1986.
+
+Ravi G. Patel, Nathaniel A. Trask, Mitchell A. Wood, and Eric C. Cyr. A physics-informed operator regression framework for extracting data-driven continuum models. Computer Methods in Applied Mechanics and Engineering, 373:113500, Jan 2021. ISSN 0045-7825.
+
+Maziar Raissi. Deep hidden physics models: Deep learning of nonlinear partial differential equations. J. Mach. Learn. Res., 19:25:1–25:24, 2018.
+
+Prajit Ramachandran, Barret Zoph, and Quoc V. Le. Searching for activation functions. arXiv preprint arXiv:1710.05941, 2017.
+
+Carl Runge. Uber die numerische aufl ¨ osung von differentialgleichungen. ¨ Mathematische Annalen, 46:167 – 178, 1895.
+
+Alvaro Sanchez-Gonzalez, Jonathan Godwin, Tobias Pfaff, Rex Ying, Jure Leskovec, and Peter W. Battaglia. Learning to simulate complex physics with graph networks. arXiv preprint arXiv:2002.09405, 2020.
+
+Victor Garcia Satorras, Emiel Hoogeboom, and Max Welling. E (n) equivariant graph neural networks. arXiv preprint arXiv:2102.09844, 2021.
+
+Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 20(1):61–80, 2009.
+
+William E Schiesser. The numerical method of lines: integration of partial differential equations. Elsevier, 2012.
+
+Michael Schober, David Duvenaud, and Philipp Hennig. Probabilistic ode solvers with runge-kutta means, 2014.
+
+C.-W. Shu. High-order finite difference and finite volume weno schemes and discontinuous galerkin methods for cfd. International Journal of Computational Fluid Dynamics, 17(2):107–118, 2003.
+
+Justin Sirignano and Konstantinos Spiliopoulos. Dgm: A deep learning algorithm for solving partial differential equations. Journal of Computational Physics, 375:1339 – 1364, 2018. ISSN 0021- 9991. doi: https://doi.org/10.1016/j.jcp.2018.08.029.
+
+Eitan Tadmor. The exponential accuracy of fourier and chebyshev differencing methods. SIAM Journal on Numerical Analysis, 23:1–10, 1986.
+
+Dmitry Ulyanov, Andrea Vedaldi, and Victor Lempitsky. Instance normalization: The missing ingredient for fast stylization. arXiv preprint arXiv:1607.08022, 2016.
+
+Yinhao Zhu and Nicholas Zabaras. Bayesian deep convolutional encoder–decoder networks for surrogate modeling and uncertainty quantification. Journal of Computational Physics, 366:415–447, Aug 2018. ISSN 0021-9991.
+
+# A INTERPOLATION
+
+To compute classical numerical derivatives of a function $u : \mathbb { R } \mathbb { R }$ , which has been sampled on a mesh of points $x _ { 1 } < x _ { 2 } < . . . < x _ { N }$ it is common to first fit a piecewise polynomial $p : \mathbb { R } \mathbb { R }$ on the mesh. We assume we have function evaluations $u _ { i } = u ( x _ { i } )$ at the mesh nodes for all $i = 1 , . . . , N$ and once we have fitted the polynomial, we can use its derivatives at any new off-mesh point, for instance the half nodes $x _ { i + { \frac { 1 } { 2 } } }$ . Here we illustrate how to carry out this procedure.
+
+A polynomial of degree $N - 1$ (note the highest degree polynomial we can fit to $N$ points has degree $N - 1 )$ can be fitted at the mesh points by solving the following linear system in a
+
+$$
+\underbrace { \left[ \begin{array} { c } { u _ { 1 } } \\ { \vdots } \\ { u _ { N } } \\ { \mathbf { u } } \end{array} \right] } _ { \mathbf { u } } = \underbrace { \left[ \begin{array} { c } { p ( x _ { 1 } ) } \\ { \vdots } \\ { p ( x _ { N } ) } \end{array} \right] } _ { \mathbf { u } } = \underbrace { \left[ \begin{array} { c } { \sum _ { i = 0 } ^ { N - 1 } a _ { i } x _ { 1 } ^ { i } } \\ { \vdots } \\ { \sum _ { i = 0 } ^ { N - 1 } a _ { i } x _ { N } ^ { i } } \end{array} \right] } _ { \mathbf { L } } = \underbrace { \left[ \begin{array} { c c c c } { x _ { 1 } ^ { 0 } } & { \cdots } & { x _ { 1 } ^ { N - 1 } } \\ { \vdots } & { \ddots } & { \vdots } \\ { x _ { N } ^ { 0 } } & { \cdots } & { x _ { N } ^ { N - 1 } } \end{array} \right] } _ { \mathbf { X } } \underbrace { \left[ \begin{array} { c } { a _ { 0 } } \\ { \vdots } \\ { a _ { N - 1 } } \end{array} \right] } _ { \mathbf { a } } .
+$$
+
+To find the polynomial interpolation at a new point $x$ , we then do
+
+$$
+p ( x ) = \mathbf { x } ^ { \top } \mathbf { a } = \mathbf { x } ^ { \top } \mathbf { X } ^ { - 1 } \mathbf { u }
+$$
+
+where $\mathbf { x } ^ { \top } = [ 1 , x , x ^ { 2 } , . . . , x ^ { N - 1 } ]$ . To retrieve the $m ^ { \mathrm { t h } }$ derivative, where $m < N - 1$ , is also very simple. For this we have that
+
+$$
+\begin{array} { r l } & { \frac { \mathrm { d } ^ { m } p } { \mathrm { d } x ^ { m } } = \displaystyle \sum _ { i = 0 } ^ { N - 1 } a _ { i } \frac { \mathrm { d } ^ { m } x ^ { i } } { \mathrm { d } x ^ { m } } = \displaystyle \sum _ { i = 0 } ^ { N - 1 } a _ { i } \cdot ( i ) _ { m } \cdot x ^ { i - m } = \mathbf { x } ^ { ( m ) \top } \mathbf { a } = \mathbf { x } ^ { ( m ) \top } \mathbf { X } ^ { - 1 } \mathbf { u } , } \\ & { \mathbf { x } ^ { ( m ) \top } = [ ( 0 ) _ { m } x ^ { 0 - m } , ( 1 ) _ { m } x ^ { 1 - m } , . . . , ( N - 1 ) _ { m } x ^ { N - 1 - m } ] } \end{array}
+$$
+
+where $( i ) _ { m } = i ( i - 1 ) ( i - 2 ) \cdots ( i - m + 1 )$ is the $m ^ { \mathrm { t h } }$ Pochhammer symbol and $( i ) _ { 0 } : = 1$ .
+
+Note that is typical to fold $\mathbf { s } = \mathbf { x } ^ { \top } \mathbf { X } ^ { - 1 }$ into a single object, which we call a stencil.
+
+# B RECONSTRUCTION
+
+Reconstruction is the task of fitting a piecewise polynomial on a mesh of points, when instead of functions values at the grid points we have cell averages $\bar { u } _ { i }$ , where
+
+$$
+\bar { u } _ { i } = \frac { 1 } { \Delta x _ { i } } \int _ { I _ { i } } u ( \boldsymbol { x } ) \mathrm { d } \boldsymbol { x } ,
+$$
+
+where each cell $I _ { i } ~ = ~ [ x _ { i - \frac { 1 } { 2 } } , x _ { i + \frac { 1 } { 2 } } ]$ , the half nodes are defined as $x _ { i + \frac 1 2 } : = \frac 1 2 ( x _ { i } + x _ { i + 1 } )$ and $\Delta x _ { i } = x _ { i + \frac { 1 } { 2 } } - x _ { i - \frac { 1 } { 2 } }$ . The solution is to note that we can fit a polynomial $P ( x )$ to the integral of $u ( x )$ , which will be exact at the half nodes, so
+
+$$
+P ( x _ { i + \frac { 1 } { 2 } } ) = U ( x _ { i + \frac { 1 } { 2 } } ) = \int _ { x _ { 1 - \frac { 1 } { 2 } } } ^ { x _ { i + \frac { 1 } { 2 } } } u ( x ) \mathrm { d } x = \sum _ { k = 1 } ^ { i } \int _ { x _ { k - \frac { 1 } { 2 } } } ^ { x _ { k + \frac { 1 } { 2 } } } u ( x ) \mathrm { d } x = \sum _ { k = 1 } ^ { i } \bar { u } _ { k } \Delta x _ { k } .
+$$
+
+We can then differentiate this polynomial to retrieve an estimate for the $u$ at off-mesh locations. Recall that polynomial differentiation is easy with the interpolant differentiation operators $\mathbf { x } ^ { ( m ) }$ The system of equations we need to solve is thus
+
+$$
+\underbrace { \left[ \Delta x _ { 1 } \cdots \cdots \quad 0 \ \right. } _ { \vdots } \cdot \underbrace { \left[ \bar { u } _ { 1 } \right] } _ { \mathbf { \dot { u } } } = \underbrace { \left[ x _ { 1 } ^ { 0 } \cdots \quad x _ { 1 } ^ { N - 1 } \right] } _ { \mathbf { \dot { x } } } \underbrace { \left[ \begin{array} { c c c c } { a _ { 0 } } \\ { \vdots } \\ { a _ { x 1 } } \end{array} \right] } _ { \mathbf { \dot { L } } } . \underbrace { \dot { \mathbf { \sigma } } _ { \langle } \mathbf { \dot { \sigma } _ { \langle } \Phi _ { N \rangle } } } _ { \mathbf { \dot { u } } } = \underbrace { \left[ \begin{array} { c c c c } { a _ { 1 } ^ { 0 } } & { \cdots } & { x _ { 1 } ^ { N - 1 } } \\ { \vdots } & { \ddots } & { \vdots } \\ { x _ { N } ^ { 0 } } & { \cdots } & { x _ { N } ^ { N - 1 } } \end{array} \right] } _ { \mathbf { \dot { x } } } \underbrace { \left[ \begin{array} { c } { a _ { 0 } } \\ { \vdots } \\ { a _ { N - 1 } } \\ { \mathbf { \dot { a } } } \end{array} \right] } _ { \mathbf { \dot { a } } } .
+$$
+
+where $\bar { \bf u }$ is the vector of cell averages and $\mathbf { L }$ is a lower triangular matrix performing the last sum in Equation 20. Thus the $m ^ { \mathrm { t h } }$ derivative of the polynomial $p ( x ) = P ^ { \prime } ( x )$ is
+
+$$
+\frac { \mathrm { d } ^ { m } p } { \mathrm { d } x ^ { m } } = \frac { \mathrm { d } ^ { m + 1 } P } { \mathrm { d } x ^ { m + 1 } } = \mathbf { x } ^ { ( m + 1 ) \top } \mathbf { X } ^ { - 1 } \mathbf { L } \bar { \mathbf { u } } = \bar { \mathbf { s } } ^ { ( m ) \top } \bar { \mathbf { u } } .
+$$
+
+# C WENO SCHEME
+
+The essentially non-oscillating (ENO) scheme is an interpolation or reconstruction scheme to estimate function values and derivatives of a discontinuous function. The main idea is to use multiple overlapping stencils to estimate a derivative at point $x \in [ x _ { i } , x _ { i + 1 } ]$ . We design $N$ stencils to fit the function on shifted overlapping intervals $I _ { 1 } , . . . , I _ { N }$ , where $I _ { k } = [ x _ { i - N + 1 + k } , x _ { i + k } ]$ . In the case of WENO reconstruction these intervals are ${ { I } _ { k } } = [ { { x } _ { i - N + 1 + k - \frac { 1 } { 2 } } } , { { x } _ { i + k + \frac { 1 } { 2 } } } ]$ . If a discontinuity lies in $\textstyle I = \bigcup _ { k } I _ { k }$ , then it is likely that one of the substencils $\mathbf { s } _ { k } ^ { ( m ) }$ or ¯sk $\bar { \mathbf { s } } _ { k } ^ { ( m ) }$ (defined on interval $I _ { k }$ ) will not contain the discontinuity. We can thus use the substencil $\mathbf { s } _ { k } ^ { ( m ) }$ or $\bar { \mathbf { s } } _ { k } ^ { ( m ) }$ from the relatively smooth region to estimate the function derivatives at . In the following, we focus on WENO reconstruction.
+
+The weighted essentially non-oscillating (WENO) scheme goes one step further and takes a convex combination of the substencils to create a larger stencil ¯s on $I$ , where (dropping the superscript for brevity)
+
+$$
+\bar { \mathbf { s } } = \sum _ { k = 1 } ^ { N } w _ { k } \bar { \mathbf { s } } _ { k } .
+$$
+
+Here the nonlinear weights nonlinear weights can be c $w _ { k }$ satisfy ructed $\begin{array} { r } { \sum _ { k = 1 } ^ { N } w _ { k } = 1 } \end{array}$ . It was shown in Jiang & Shu (1996) that these
+
+$$
+w _ { k } = \frac { \tilde { w } _ { k } } { \sum _ { j = 1 } ^ { N } \tilde { w } _ { j } } \qquad \tilde { w } _ { k } = \frac { \gamma _ { k } } { ( \epsilon + \beta _ { k } ) ^ { 2 } } ,
+$$
+
+wherlinear $\gamma _ { k }$ alled the linear weight, are set such that the su $\epsilon$ i mber, and over the o $\beta _ { k }$ ir moothness indicator. The stencils matches a larger $\scriptstyle \sum _ { k = 1 } ^ { N } \gamma _ { k } \bar { \mathbf { s } } _ { k }$ $N - 1$ $2 N - 2$
+
+$$
+\beta _ { k } = \sum _ { m = 1 } ^ { N - 1 } \Delta x _ { k } ^ { 2 m - 1 } \int _ { x _ { i - \frac { 1 } { 2 } } } ^ { x _ { i + \frac { 1 } { 2 } } } \left( \frac { \mathrm { d } ^ { m } p _ { k } } { \mathrm { d } x ^ { m } } \right) ^ { 2 } \mathrm { d } x ,
+$$
+
+where $p _ { k }$ is the polynomial corresponding to substencil $\bar { \bf s } _ { k }$ .
+
+# C.1 WENO5 SCHEME
+
+A conservative finite difference spatial discretization approximates a derivative $f ( u ) _ { x }$ by a conservative difference
+
+$$
+f ( u ) _ { x } | _ { x = x _ { i } } \approx \frac { 1 } { \Delta x } \left( \hat { f } _ { i + \frac { 1 } { 2 } } - \hat { f } _ { i - \frac { 1 } { 2 } } \right) ,
+$$
+
+where $\hat { f } _ { i + \frac { 1 } { 2 } }$ and $\hat { f } _ { i - \frac { 1 } { 2 } }$ are numerical fluxes. Since $g ( u ) _ { y }$ is approximated in the same way, finite difference methods have the same format for more than one spatial dimensions. The leftreconstructed (reconstruction is done from left to right) fifth order finite difference WENO scheme (WENO5) (Shu, 2003) has the uˆ−i+ 1 g iven by:
+
+$$
+\hat { u } _ { i + \frac { 1 } { 2 } } ^ { - } = w _ { 1 } \hat { u } _ { i + \frac { 1 } { 2 } } ^ { - ( 1 ) } + w _ { 2 } \hat { u } _ { i + \frac { 1 } { 2 } } ^ { - ( 2 ) } + w _ { 3 } \hat { u } _ { i + \frac { 1 } { 2 } } ^ { - ( 3 ) } .
+$$
+
+In equation 27, $\hat { u } _ { i + \frac { 1 } { 2 } } ^ { - ( j ) }$ are the left WENO reconstructions on three different stencils given by
+
+$$
+\begin{array} { l } { { \hat { u } _ { i + \frac { 1 } { 2 } } ^ { - ( 1 ) } = + \displaystyle { \frac { 1 } { 3 } } u _ { i - 2 } - \frac { 7 } { 6 } u _ { i - 1 } + \frac { 1 1 } { 6 } u _ { i } \ : , } } \\ { { \hat { u } _ { i + \frac { 1 } { 2 } } ^ { - ( 2 ) } = - \displaystyle { \frac { 1 } { 6 } } u _ { i - 1 } + \frac { 5 } { 6 } u _ { i } + \frac { 1 } { 3 } u _ { i + 1 } \ : , } } \\ { { \hat { u } _ { i + \frac { 1 } { 2 } } ^ { - ( 3 ) } = + \displaystyle { \frac { 1 } { 3 } } u _ { i } + \frac { 5 } { 6 } u _ { i + 1 } - \frac { 1 } { 6 } u _ { i + 2 } \ : , } } \end{array}
+$$
+
+and the non-linear weights $w _ { j }$ given by
+
+$$
+w _ { j } = \frac { \tilde { w } _ { j } } { \sum _ { k = 1 } ^ { 3 } w _ { k } } , \qquad \tilde { w } _ { k } = \frac { \gamma _ { k } } { ( \epsilon + \beta _ { k } ) ^ { 2 } } ,
+$$
+
+with $\gamma _ { \{ 1 , 2 , 3 \} } = \{ \scriptstyle { \frac { 1 } { 1 0 } } , \displaystyle { \frac { 3 } { 5 } } , \displaystyle { \frac { 3 } { 1 0 } } \}$ , and $\epsilon$ a tiny-valued parameter to avoid the denominator becoming 0. The left smoothness indicators $\beta _ { k } ^ { - }$ are given by:
+
+$$
+\begin{array} { l } { \displaystyle \beta _ { 1 } ^ { - } = \frac { 1 3 } { 1 2 } \big ( u _ { i - 2 } - 2 u _ { i - 1 } + u _ { i } \big ) ^ { 2 } + \frac { 1 } { 4 } \big ( u _ { i - 2 } - 4 u _ { i - 1 } + 3 u _ { i } \big ) ^ { 2 } , } \\ { \displaystyle \beta _ { 2 } ^ { - } = \frac { 1 3 } { 1 2 } \big ( u _ { i - 1 } - 2 u _ { i } + u _ { i + 1 } \big ) ^ { 2 } + \frac { 1 } { 4 } \big ( u _ { i - 1 } - u _ { i + 1 } \big ) ^ { 2 } , } \\ { \displaystyle \beta _ { 3 } ^ { - } = \frac { 1 3 } { 1 2 } \big ( u _ { i } - 2 u _ { i + 1 } + u _ { i + 2 } \big ) ^ { 2 } + \frac { 1 } { 4 } \big ( u _ { i } - 4 u _ { i + 1 } + 3 u _ { i + 2 } \big ) ^ { 2 } . } \end{array}
+$$
+
+The right-reconstructed WENO5 scheme has the $\hat { u } _ { i - \frac { 1 } { 2 } } ^ { + }$ given similarly to $\hat { u } _ { i + \frac { 1 } { 2 } } ^ { - }$ but with all coefficients flipped since the reconstruction is done from the other side (from right to left). The right reconstruction on three different stencils are given by
+
+$$
+\begin{array} { l } { { \hat { u } _ { i - \frac { 1 } { 2 } } ^ { + ( 1 ) } = + \displaystyle \frac { 1 } { 3 } u _ { i + 2 } - \frac { 7 } { 6 } u _ { i + 1 } + \frac { 1 1 } { 6 } u _ { i } \ : , } } \\ { { \hat { u } _ { i - \frac { 1 } { 2 } } ^ { + ( 2 ) } = - \displaystyle \frac { 1 } { 6 } u _ { i + 1 } + \frac { 5 } { 6 } u _ { i } + \frac { 1 } { 3 } u _ { i - 1 } \ : , } } \\ { { \hat { u } _ { i - \frac { 1 } { 2 } } ^ { + ( 3 ) } = + \displaystyle \frac { 1 } { 3 } u _ { i } + \frac { 5 } { 6 } u _ { i - 1 } - \frac { 1 } { 6 } u _ { i - 2 } \ : , } } \end{array}
+$$
+
+and the right smoothness indicators $\beta _ { k } ^ { + }$ are given by
+
+$$
+\begin{array} { l } { \displaystyle \beta _ { 1 } ^ { + } = \frac { 1 3 } { 1 2 } \big ( u _ { i + 2 } - 2 u _ { i + 1 } + u _ { i } \big ) ^ { 2 } + \frac { 1 } { 4 } \big ( u _ { i + 2 } - 4 u _ { i + 1 } + 3 u _ { i } \big ) ^ { 2 } , } \\ { \displaystyle \beta _ { 2 } ^ { + } = \frac { 1 3 } { 1 2 } \big ( u _ { i + 1 } - 2 u _ { i } + u _ { i - 1 } \big ) ^ { 2 } + \frac { 1 } { 4 } \big ( u _ { i + 1 } - u _ { i - 1 } \big ) ^ { 2 } , } \\ { \displaystyle \beta _ { 3 } ^ { + } = \frac { 1 3 } { 1 2 } \big ( u _ { i } - 2 u _ { i - 1 } + u _ { i - 2 } \big ) ^ { 2 } + \frac { 1 } { 4 } \big ( u _ { i } - 4 u _ { i - 1 } + 3 u _ { i - 2 } \big ) ^ { 2 } . } \end{array}
+$$
+
+Both $\hat { u } ^ { - }$ and $\hat { u } ^ { + }$ are needed for full flux reconstruction as explained in the next section.
+
+# C.2 FLUX RECONSTRUCTION
+
+We consider flux reconstruction via Godunov. For Godunov flux, ${ \hat { f } } _ { i + \frac { 1 } { 2 } } = { \hat { f } } ( u _ { i + \frac { 1 } { 2 } } )$ is reconstructed from uˆ+i+ 12 and uˆ−i+ 1 via:
+
+$$
+\widehat f ( u _ { i + \frac { 1 } { 2 } } ) = \left\{ \begin{array} { c c } { \operatorname* { m i n } _ { i + \frac { 1 } { 2 } \leq u \leq u _ { i + \frac { 1 } { 2 } } ^ { + } } f ( u ) , } & { \mathrm { i f } u _ { i + \frac { 1 } { 2 } } ^ { - } \leq u _ { i + \frac { 1 } { 2 } } ^ { + } } \\ { \operatorname* { m a x } _ { \substack { i + \frac { 1 } { 2 } \leq u \leq u _ { i + \frac { 1 } { 2 } } ^ { + } } } f ( u ) , } & { \mathrm { i f } u _ { i + \frac { 1 } { 2 } } ^ { - } > u _ { i + \frac { 1 } { 2 } } ^ { + } } \end{array} \right.
+$$
+
+C.3 COMPARING WENO SCHEME TO ANALYTICAL SOLUTIONS
+
+First analytical case. An analytical solvable case for Burgers equation arises for the boundary conditions
+
+$$
+u ( t , 0 ) = u ( t , 2 \pi ) ,
+$$
+
+and the initial conditions
+
+$$
+u ( 0 , x ) = - 2 \nu \frac { \partial \phi / \partial x } { \phi } + 4 ,
+$$
+
+where
+
+$$
+\begin{array} { c } { { \phi = \displaystyle \exp \left( \frac { - x ^ { 2 } } { 4 \nu } \right) + \exp \left[ \frac { - ( x - 2 \pi ) ^ { 2 } } { 4 \nu ( t + 1 ) } \right] } } \\ { { \displaystyle \frac { \partial \phi } { \partial x } = - \frac { 2 x } { 4 \nu } \exp \left( \frac { - x ^ { 2 } } { 4 \nu } \right) - \frac { 2 ( x - 2 \pi ) } { 4 \nu } + \exp \left[ \frac { - ( x - 2 \pi ) ^ { 2 } } { 4 \nu } \right] } } \\ { { = - \displaystyle \frac { 0 . 5 x } { \nu } \exp \left( \frac { - x ^ { 2 } } { 4 \nu } \right) - \frac { 0 . 5 ( x - 2 \pi ) } { \nu } \exp \left[ \frac { - ( x - 2 \pi ) ^ { 2 } } { 4 \nu } \right] . } } \end{array}
+$$
+
+The analytical solutions for this specific set of boundary and initial conditions gives
+
+$$
+u ( t , x ) = - 2 \nu \frac { \partial \phi / \partial x } { \phi } + 4 ,
+$$
+
+where
+
+$$
+\begin{array} { l } { \displaystyle \phi = \exp \left( \frac { - ( x - 4 t ) ^ { 2 } } { 4 \nu ( t + 1 ) } \right) + \exp \left[ \frac { - ( x - 4 t - 2 \pi ) ^ { 2 } } { 4 \nu ( t + 1 ) } \right] } \\ { \displaystyle \frac { \partial \phi } { \partial x } = - \frac { 2 ( x - 4 t ) } { 4 \nu ( t + 1 ) } \exp \left( \frac { - ( x - 4 t ) ^ { 2 } } { 4 \nu ( t + 1 ) } \right) - \frac { 2 ( x - 4 t - 2 \pi ) } { 4 \nu ( t + 1 ) } + \exp \left[ \frac { - ( x - 4 t - 2 \pi ) ^ { 2 } } { 4 \nu ( t + 1 ) } \right] } \\ { \displaystyle \quad = - \frac { 0 . 5 ( x - 4 t ) } { \nu ( t + 1 ) } \exp \left( \frac { - ( x - 4 t ) ^ { 2 } } { 4 \nu ( t + 1 ) } \right) - \frac { 0 . 5 ( x - 4 t - 2 \pi ) } { \nu ( t + 1 ) } \exp \left[ \frac { - ( x - 4 t - 2 \pi ) ^ { 2 } } { 4 \nu ( t + 1 ) } \right] . } \end{array}
+$$
+
+For this first analytical solveable case, the analytical solution, the WENO scheme and the fourth order finite difference scheme (FDM) are compared in Fig. 6 for a diffusion term of $\nu = 0 . 0 0 5$ . The WENO scheme models the analytical solution perfectly, whereas the FDM scheme fails to capture the shock accurately. For lower values of $\nu$ the effect gets even stronger.
+
+Second analytical case. Another analytical solvable case for the Burgers equation arises for the boundary condition:
+
+$$
+u ( t , \pm 1 ) = 0 ,
+$$
+
+and the initial condition
+
+$$
+u ( 0 , x ) = - \sin ( \pi x ) .
+$$
+
+Solutions are (Basdevant et al., 1986)
+
+$$
+u ( t , x ) = \frac { - \int _ { - \infty } ^ { \infty } \sin \pi ( x - \eta ) f ( x - \eta ) \exp ( - \eta ^ { 2 } / 4 \nu t ) d \eta } { \int _ { - \infty } ^ { \infty } f ( x - \eta ) \exp ( - \eta ^ { 2 } / 4 \nu t ) d \eta } ,
+$$
+
+with $\begin{array} { r } { f ( y ) = \exp ( - \cos ( \frac { \pi y } { 2 \pi \nu } ) } \end{array}$ . Using Hermite integration allows the computation of accurate results up to $t = 3 / \pi$ .
+
+For this second analytical solveable case, the analytical solution, and the WENO scheme are compared in Fig. 7 for a diffusion term of $\nu = 0 . 0 0 2$ . The WENO scheme models the analytical solution perfectly. Modeling via the FDM scheme fails completely.
+
+
+Figure 6: 1D and 2D rollouts for the first analytical case setting the diffusion term $\nu \ : = \ : 0 . 0 0 5$ . Analytical solution (top), WENO scheme (middle) and Finite Difference scheme (FDM, bottom). The WENO scheme models the analytical solution perfectly, whereas the FDM scheme fails to capture the shock accurately.
+
+
+Figure 7: 1D and 2D rollouts for the second analytical case setting the diffusion term $\nu = 0 . 0 0 5$ . Analytical solution (top), and WENO scheme solution(bottom).The WENO scheme models the analytical solution perfectly.
+
+# D PSEUDOSPECTRAL METHODS FOR WAVE PROPAGATION ON IRREGULAR GRIDS
+
+We consider Dirichlet $B [ u ] = u = 0$ and Neumann $B [ u ] = \partial _ { x } u = 0$ boundary conditions. Numerical groundtruth is generated using FVM and Chebyshev spectral derivatives, integrated in time with an implicit Runge-Kutta method of Radau IIA family, order 5 (Hairer et al., 1993). To properly fulfill the boundary conditions, wave packages have to travel between the boundaries and are bounced back with same and different sign for Neumann and Dirichlet boundary condition, respectively. Exemplary wave propagation for both boundary conditions is shown in Figure 8.
+
+
+Figure 8: Exemplary wave propagation data for Dirichlet boundary conditions (left) and Neumann boundary conditions (right). Solutions are obtained on irregular grids using pseudospectral solvers.
+
+# E EXPLICIT RUNGE-KUTTA METHODS
+
+The family of Runge-Kutta methods (Butcher, 1987) is given by:
+
+$$
+u _ { t _ { n + 1 } } = u _ { t _ { n } } + \Delta t \sum _ { i = 1 } ^ { s } b _ { i } k _ { i } ,
+$$
+
+where
+
+$$
+\begin{array} { r l } & { k _ { 1 } = f \left( t _ { n } , u _ { t _ { n } } \right) , } \\ & { k _ { 2 } = f \big ( t _ { n } + c _ { 2 } \Delta t , u _ { t _ { n } } + h ( a _ { 2 1 } k _ { 1 } ) \big ) , } \\ & { k _ { 3 } = f \big ( t _ { n } + c _ { 3 } \Delta t , u _ { t _ { n } } + h ( a _ { 3 1 } k _ { 1 } + a _ { 3 2 } k _ { 2 } ) \big ) , } \\ & { \begin{array} { r l } & { \vdots } \\ & { k _ { s } = f \big ( t _ { n } + c _ { s } \Delta t , u _ { t _ { n } } + h \big ( a _ { s 1 } k _ { 1 } + a _ { s 2 } k _ { 2 } , . . . a _ { s , s - 1 } k _ { s - 1 } \big ) \big ) . } \end{array} } \end{array}
+$$
+
+For a particular Runge-Kutta method one needs to provide the number of stages $s$ , and the coefficients $a _ { i j } ( 1 \leq j < i \leq s )$ , $b _ { i } ( i = 1 , 2 , \dots , s )$ and $c _ { i } ( i = 1 , 2 , \dots , s )$ . These data are usually arranged in so-called Butcher tableaux (Butcher, 1963).
+
+# F EXPERIMENTS
+
+Flux terms of equations that we study—the Heat, Burgers, Korteweg-de-Vries (KdV), and Kuromoto-Shivashinsky (KS) equation—are summarized in Table 3.
+
+Table 3: 1D flux terms $J ( u )$ of the Heat, Burgers, Korteweg-de-Vries (KdV), and KuramotoShivashinsky (KS) equation.
+
+
Heat
Burgers
KdV
KS
J(u)
-nOxu
u²-noxu
3u²+Oxxu
u²+Oxu+oxxxu
+
+Pushforward trick and temporal bundling. Pseudocode for one training step using the pushforward trick and temporal bundling is sketch in Algorithm 1.
+
+Algorithm 1 Pushforward trick and temporal bundling. For a given batched input data trajectory and a model, we draw a random timepoint $t$ , get our input data trajectory, perform $N$ forward passes, and finally perform the supervised learning task with the according labels. $K$ is the number of steps we predict into the future using the temporal bundling trick, $N$ is number of unrolling steps in order to apply the pushforward trick, $T$ is the number of available timesteps in the training set.
+
+
Require: data, model, N, K,T t←DrawRandomNumber t ∈ {1,..,T} input ← data(t-K:t) for n ∈{1,...,N} do input ← model(input)
data is the complete PDE trajectory We draw a random starting point > We input the last K timesteps
+
+Implementation details. MP-PDE architectures, consist of three parts (sequentially applied):
+
+1. Encoder: Input {fully-connected layer activation fully-connected layer activation $\}$ , where fully connected layers are applied node-wise
+2. Processor: 6 message passing layers as described in Sec. 3.2. Each layer consists of a 2- layer edge update network $\phi$ following Equation (8), and a 2-layer node update network $\psi$ following Equation (9).
+3. Decoder: 1D convolutional network with shard weights across spatial locations $ \{ 1 \mathrm { D }$ CNN layer activation $ 1 \mathrm { D }$ CNN layer }
+
+We optimize models using the AdamW optimizer (Loshchilov & Hutter, 2017) with learning rate 1e-4, weight decay 1e-8 for 20 epochs and minimize the root mean squared error (RMSE). We use batch size 16 for experiments E1-E3 and WE1-WE3 and batch size of 4 for 2D experiments. For experiments E1-E3 we use a hidden size of 164, and for experiments WE1-WE3 we use a hidden size of 128. In order to enforce zero-stability during training we unroll the solver for a maximum of 2 steps (see Sec. 3.1).
+
+Message and update network in the processor consist of {fully-connected layer activation fully-connected layer activation $\}$ . We use skip-connections in the message passing layers and apply instance normalization (Ulyanov et al., 2016) for experiments E1-E3 and WE1-WE3, and batch normalization (Ioffe & Szegedy, 2015) for the 2D experiments. For the decoder, we use 8 channels between the two CNN layers (1 input channel, 1 output channel) across all experiments. We use Swish (Ramachandran et al., 2017) activation functions for experiments E1-E3 and WE1- WE3 and ReLU activation for the 2D experiments. ReLU activation proved most effective for 2D experiments since a characteristic of the smoke inflow dynamics we studied is that values are zero for all positions which are untouched by smoke buoyancy at a given timepoint.
+
+Training details. The overall used architectures consist of roughly 1 million parameters and training for the different experiments takes between 12 and 24 hours on average on a GeForceRTX 2080
+
+Ti GPU. 6 message passing layers and a hidden size of 128 for the 2-layer edge update network and the 2-layer node update network is a robust choice. A hidden size of 64 shows signs of underfitting, whereas a hidden size of 256 is not improve performance significantly. For the overall performance, more important than the number of parameters is the choice of the output 1D CNN, the choice of inputs to the edge update network $\phi$ following Equation (8) and the node update network $\psi$ following Equation (9). We ablate these choices in Appendix G.
+
+Another interesting hyperparameter is the number of neighbors used for message passing. We construct our graphs by restricting the neighbors (edges) via a cutoff radius based on positional coordinates for experiments E1-E3 and the 2D experiments. We effectively use 6 neighbors for experiments E1-E3 and 8 neighbors for the 2D experiments. For experiments WE1-WE3, cutoff radii for selecting neighbors are not a robust choice since the grids are irregular and relative distances are much lower close to the boundaries. We therefore construct our graphs via a $k$ -NN criterion, and effectively use between 20 neighbors (highest spatial resolution) and 6 neighbors (lowest spatial resolution).
+
+# F.1 EXPERIMENTS E1, E2, E3
+
+Figure 9 displays exemplary 1D rollouts at different resolution for the Burgers’ equation with different diffusion terms. Lower diffusion coefficients result in faster shock formation. Figure 10 displays exemplary 1D rollouts for different parameter sets. Large $\alpha$ parameters result in fast and large shock formations. The wiggles arising due to the dispersive term $\gamma$ and cannot be captured by numerical solvers at low resolution. Our MP-PDE solver is able to capture these wiggles and reproduce them even at very low resolution.
+
+
+Figure 9: Exemplary 1D rollout of the Burgers’ equation at different resolutions. The different colors represent PDE solutions at different timepoints. Diffusion coefficients of $\eta = 0 . 1 4$ (top) and $\eta = 0 . 0 8$ (bottom) are compared for the same initial conditions. Lower diffusion coefficients result in faster shock formation.
+
+
+Figure 10: Exemplary 1D rollout an unseen equation with different equation parameters. The different colors represent PDE solutions at different timepoints. Low $\alpha$ parameters (top) result in diffusion like behavior. Large $\alpha$ parameters (middle, bottom) result in fast and large shock formations. The wiggles arising due to the dispersive term $\gamma$ . Numerical solvers cannot capture the wiggles at low resolution (middle), MP-PDE solvers can reconstruct them much better (bottom).
+
+# F.2 EXPERIMENTS WE1, WE2, WE3
+
+Figure 11 displays exemplary 2D rollouts at different resolutions for the wave equation with Dirichlet and Neumann boundary conditions. Waves bounce back and forth between boundaries. MP-PDE solvers give accurate solutions on the irregular grids and are stable over time.
+
+
+Figure 11: Exemplary 2D rollouts for the wave equation with Dirichlet boundary conditions (top) and Neumann boundary conditions (bottom). The different colors for the Dirichlet boundary condition comes from the fact that wave propagation changes the sign at each boundary.
+
+
+Figure 12: Exemplary 2D smoke inflow simulation. Ground truth data (top) are compared to MPPDE solvers (bottom). Simulations run for 100 timesteps corresponding to 100 seconds. The MPPDE solver is able to capture the smoke inflow acccurately over the given time period.
+
+# G ARCHITECTURE ABLATION AND COMPARISON TO CNNS
+
+A schematic sketch of our MP-PDE solver is displayed in Figure 13 (sketch taken from the main paper). A GNN based architecture was chosen since GNNs have the potential to offer flexibility when generalizing across spatial resolution, timescale, domain sampling regularity, domain topology and geometry, boundary conditions, dimensionality, and solution space smoothness. The chosen architecture representationally contains classical methods, such as FDM, FVM, and WENO schemes. The architectures follows the Encode-Process-Decode framework of Battaglia et al. (2018), with adjustments. Most notably, PDE coefficients and other attributes such as boundary conditions denoted with $\pmb { \theta } _ { \mathrm { P D E } }$ are included in the processor. For the decoder, a shallow 2-layer 1D convolutional network with shared weights across spatial locations is applied, motivated by linear multistep methods (Butcher, 1987).
+
+For ablating the architecture, three design choices are verified:
+
+1. Does a GNN have the representational power of a vanilla convolutional network on a regular grid? We test against 1D and 2D baseline CNN architectures.
+2. For the decoder part, how much does a 1D convolutional network with shared weights across spatial locations approve upon a standard MLP decoder?
+3. How much does the inclusion of PDE coefficients $\pmb { \theta } _ { \mathrm { P D E } }$ help to generalize over e.g. different equations or different boundary conditions?
+
+
+Figure 13: Schematic sketch of our MP-PDE Solver, sketch taken from the main paper.
+
+Table 4 shows the three ablation (MP-PDE- $\theta _ { \mathrm { P D E } }$ , MP-PDE-✭1D-CNN, Baseline CNN) tested on ✭ shock wave formation modeling and generalization to unseen experiments (experiments E1, E2, and E3), as described in Section 4.1 in the main paper. For the training of the different architectures the optimized training strategy consisting of temporal bundling and pushforward trick is used.
+
+The MP-PDE- $\underbrace { \theta _ { \mathbf { P } } \delta \mathbf { \overline { { E } } } } _ { \mathbf { \overline { { ~ } } } \mathbf { \Theta } }$ ablation results are the same as reported in the main paper. The effect gets more prominent if more equation specific parameters are available $\mathbf { \nabla } _ { \theta _ { \mathrm { P D E } } }$ features), as it is the case for experiment E3. We also refer the reader to the experiments presented in Table 2, where MPPDE solvers are shown to be able to generalize over different boundary conditions, which gets much stronger pronounced if boundary conditions are injected into the equation via $\pmb { \theta } _ { \mathrm { P D E } }$ features.
+
+The MP-PDE-✭1D-CNN ✭ ablation replaces the shallow 2-layer 1D convolutional network with in the decoder with a standard 2-layer MLP. Performance slightly degrades for the MLP decoder which is most likely due to the better temporal modeling introduced by the shared weights of the 1D CNN network.
+
+A Baseline 1D-CNN is built up of 8 1D-CNN layers, where the input consists of the spatial resolution $( n _ { x } )$ . The $K$ previous timesteps used for temporal bundling are treated as $K$ input channels. The output consequently predicts the next $K$ timesteps for the same spatial resolution ( $K$ output channels). Using this format, again both temporal bundling and the pushforward trick can be effectively applied. The implemented 1D-CNN layers are:
+
+• Input layer with $K$ input channel, 40 output channels, kernel of size 3.
+• 3 layers with 40 input channels, 40 output channels, kernel of size 5.
+• 3 layers with 40 input channels, 40 output channels, kernel of size 7.
+• 1 output layer with 40 input channels, $K$ output channel, kernel of size 7.
+
+Residual connections are used between the layers, and ELU (Clevert et al., 2016) non-linearities are applied. Circular padding is implemented to reflect the periodic boundary conditions. The CNN output is a new vector $\mathbf { { \bar { d } } } _ { i } ^ { \phantom { * } } = ( \bar { \mathbf { d } } _ { i } ^ { 1 } , \mathbf { d } _ { i } ^ { 2 } , . . . , \mathbf { d } _ { i } ^ { K } )$ with each element $\mathbf { d } _ { i } ^ { k }$ corresponding to a different point in time. Analogously to the MP-PDE solver, we use the output to update the solution as
+
+$$
+{ \mathbf { u } } _ { i } ^ { k + \ell } = { \mathbf { u } } _ { i } ^ { k } + ( t _ { k + \ell } - t _ { k } ) { \mathbf { d } } _ { i } ^ { \ell } , \qquad 1 \le \ell \le K ,
+$$
+
+where $K$ is the output (and input) dimension. This baseline 1D-CNN is conceptually very similar to our MP-PDE solver.
+
+A Baseline 2D-CNN is built up of 6 2D-CNN layers, where the input consists of the spatial resolution $( n _ { x } )$ and the $K$ previous timesteps used for temporal bundling. The output consequently predicts the next $K$ timesteps for the same spatial resolution. Using this format, both temporal bundling and the pushforward trick can be effectively applied. The implemented 2D-CNN layers are:
+
+• Input layer with 1 input channel, 16 output channels, $3 \times 3$ kernel.
+• 4 intermediate layers with 16 input channels, 16 output channels, $5 \times 5$ kernel.
+• 1 output layer with 16 input channels, 1 output channel, $7 \times 7$ kernel.
+
+Residual connections are used between the layers, and ELU (Clevert et al., 2016) non-linearities are applied. For the spatial dimension, circular padding is implemented to reflect the periodic boundary conditions, for the temporal dimension zero padding is used. The CNN output is a new vector $\mathbf { d } _ { i } = ( \mathbf { d } _ { i } ^ { 1 } , \mathbf { d } _ { i } ^ { 2 } , . . . , \mathbf { d } _ { i } ^ { K } )$ with each element $\mathbf { d } _ { i } ^ { k }$ corresponding to a different point in time. Analogously to the MP-PDE solver and analogously to the 1D-CNN, we use the output to update the solution as shown in Equation (61).
+
+The 1D-CNN baseline which is conceptually very close to our MP-PDE solver performs much better than the 2D-CNN. However, we see already when looking at the results of E3 that generalization for the 1D-CNN across different PDEs becomes harder.
+
+Table 4: Ablation study comparing MP-PDE results on experiments on shock wave formation modeling and generaliziation to unseen equations (E1, E3, and E3) to an MP-PDE-✭ $\theta _ { \mathrm { P D E } }$ ablation, an MP-PDE-✭1D-CNN ablation, a baseline 1D-CNN and a baseline 2D-CNN architecture. Runtimes ✭ are for one full unrolling over 250 timesteps on a GeForce RTX 2080 Ti GPU. Accumulated error is $\begin{array} { r } { \frac { 1 } { n _ { x } } \sum _ { x , t } \mathbf { M S E } } \end{array}$ .
+
+
Accumulated Error↓
Runtime [s]↓
(nt,nx)
MP-PDE
MP-PDE-0PDE
MP-PDE-1D-CNN
1D-CNN
2D-CNN
MP-PDE
1D-CNN
2D-CNN
E1
(250,100)
1.55
-
2.41
3.45
25.70
0.09
0.02
0.16
E1
(250,50)
1.67
-
2.69
3.88
32.42
0.08
0.02
0.15
E1
(250,40)
1.47
-
2.50
3.07
37.13
0.008
0.02
0.14
E2
(250,100)
1.58
1.62
2.59
3.32
30.09
0.09
0.02
0.16
E2
(250,50)
1.63
1.71
2.31
2.89
30.87
0.08
0.02
0.15
E2
(250,40)
1.45
1.49
2.80
2.98
35.93
0.08
0.02
0.15
E3
(250,100)
4.26
4.71
6.26
9.15
42.37
0.09
0.02
0.16
E3
(250,50)
3.74
10.90
5.15
7.69
45.41
0.09
0.02
0.15
E3
(250,40)
3.70
7.78
7.27
6.77
53.87
0.09
0.02
0.15
\ No newline at end of file
diff --git a/md/dev/vaRCHVj0uGI/vaRCHVj0uGI.md b/md/dev/vaRCHVj0uGI/vaRCHVj0uGI.md
new file mode 100644
index 0000000000000000000000000000000000000000..7d74717df9a3c04f0cbfb3fad8b4dc508718a41d
--- /dev/null
+++ b/md/dev/vaRCHVj0uGI/vaRCHVj0uGI.md
@@ -0,0 +1,420 @@
+# SOLVING INVERSE PROBLEMS IN MEDICAL IMAGING WITH SCORE-BASED GENERATIVE MODELS
+
+Yang $\mathbf { S o n g ^ { * } }$ , Liyue Shen˚, Lei Xing & Stefano Ermon Stanford University {yangsong@cs,liyues@,lei@,ermon@cs}.stanford.edu
+
+# ABSTRACT
+
+Reconstructing medical images from partial measurements is an important inverse problem in Computed Tomography (CT) and Magnetic Resonance Imaging (MRI). Existing solutions based on machine learning typically train a model to directly map measurements to medical images, leveraging a training dataset of paired images and measurements. These measurements are typically synthesized from images using a fixed physical model of the measurement process, which hinders the generalization capability of models to unknown measurement processes. To address this issue, we propose a fully unsupervised technique for inverse problem solving, leveraging the recently introduced score-based generative models. Specifically, we first train a score-based generative model on medical images to capture their prior distribution. Given measurements and a physical model of the measurement process at test time, we introduce a sampling method to reconstruct an image consistent with both the prior and the observed measurements. Our method does not assume a fixed measurement process during training, and can thus be flexibly adapted to different measurement processes at test time. Empirically, we observe comparable or better performance to supervised learning techniques in several medical imaging tasks in CT and MRI, while demonstrating significantly better generalization to unknown measurement processes.
+
+# 1 INTRODUCTION
+
+Computed Tomography (CT) and Magnetic Resonance Imaging (MRI) are commonly used imaging tools for medical diagnosis. Reconstructing CT and MRI images from raw measurements (sinograms for CT and $\mathbf { k }$ -spaces for MRI) are well-known inverse problems. Specifically, measurements in CT are given by $\mathbf { X }$ -ray projections of an object from various directions, and measurements in MRI are obtained by inspecting the Fourier spectrum of an object with magnetic fields. However, since obtaining the full sinogram for CT causes excessive ionizing radiation for patients, and measuring the full k-space of MRI is very time-consuming, it has become important to reduce the number of measurements in CT and MRI. In many cases, only partial measurements, such as sparse-view sinograms and downsampled $\mathbf { k }$ -spaces, are available. Due to this loss of information, the inverse problems in CT and MRI are often ill-posed, making image reconstruction especially challenging.
+
+With the rise of machine learning, many methods (Zhu et al., 2018; Mardani et al., 2017; Shen et al., 2019; Würfl et al., 2018; Ghani & Karl, 2018; Wei et al., 2020) have been proposed for medical image reconstruction using a small number of measurements. Most of these methods are supervised learning techniques. They learn to directly map partial measurements to medical images, by training on a large dataset comprising pairs of CT/MRI images and measurements. These measurements need to be synthesized from medical images with a fixed physical model of the measurement process. However, when the measurement process changes, such as using a different number of CT projections or different downsampling ratio of MRI $\mathbf { k }$ -spaces, we have to re-collect the paired dataset with the new measurement process and re-train the model. This prevents models from generalizing effectively to new measurement processes, leading to counter-intuitive instabilities such as more measurements causing worse performance (Antun et al., 2020).
+
+In this work, we sidestep this difficulty completely by proposing unsupervised methods that do not require a paired dataset for training, and therefore are not restricted to a fixed measurement process. Our main idea is to learn the prior distribution of medical images with a generative model in order to infer the lost information due to partial measurements. Specifically, we propose to train a score-based generative model (Song & Ermon, 2019; 2020; Song et al., 2021) on medical images as the data prior, due to its strong performance in image generation (Ho et al., 2020; Dhariwal & Nichol, 2021). Given a trained score-based generative model, we provide a family of sampling algorithms to create image samples that are consistent with the observed measurements and the estimated data prior, leveraging the physical measurement process. Once our model is trained, it can be used to solve any inverse problem within the same image domain, as long as the mapping from images to measurements is linear, which holds for a large number of medical imaging applications.
+
+We evaluate the performance of our method on several tasks in CT and MRI. Empirically, we observe comparable or better performance compared to supervised learning counterparts, even when evaluated with the same measurement process in their training. In addition, we are able to uniformly surpass all baselines when changing the number of measurements, e.g., using a different number of projections in sparse-view CT or changing the k-space downsampling ratio in undersampled MRI. Moreover, we show that by plugging in a different measurement process, we can use a single model to perform both sparse-view CT reconstruction and metal artifact removal for CT imaging with metallic implants. To the best of our knowledge, this is the first time that generative models are reported successful on clinical CT data. Collectively, these empirical results indicate that our method is a competitive alternative to supervised techniques in medical image reconstruction and artifact removal, and has the potential to be a universal tool for solving many inverse problems within the same image domain.
+
+# 2 BACKGROUND
+
+# 2.1 LINEAR INVERSE PROBLEMS
+
+An inverse problem seeks to recover an unknown signal from a set of observed measurements. Specifically, suppose $\mathbf { x } \in \mathbb { R } ^ { n }$ is an unknown signal, and $\mathbf { y } \in \mathbb { R } ^ { m } = A \mathbf { x } + \epsilon$ is a noisy observation given by $m$ linear measurements, where the measurement acquisition process is represented by a linear operator $\pmb { A } \in \mathbb { R } ^ { m \times n }$ , and $\epsilon \in \mathbb { R } ^ { n }$ represents a noise vector. Solving a linear inverse problem amounts to recovering the signal $\mathbf { x }$ from its measurement y. Without further assumptions, the problem is ill-defined when $m < n$ , so we additionally assume that $\mathbf { x }$ is sampled from a prior distribution $p ( \mathbf { x } )$ . In this probabilistic formulation, the measurement and signal are connected through a measurement distribution $p ( \mathbf { y } \mid \mathbf { x } ) = q _ { \epsilon } ( \mathbf { y } - A \mathbf { x } )$ , where $q _ { \epsilon }$ denotes the noise distribution of $\epsilon$ . Given $p ( \mathbf { y } \mid \mathbf { x } )$ and $p ( \mathbf { x } )$ , we can solve the inverse problem by sampling from the posterior distribution $p ( \mathbf { x } \mid \mathbf { y } )$ .
+
+Examples of linear inverse problems in medical imaging include image reconstruction for CT and MRI. In both cases, the signal $\mathbf { x }$ is a medical image. The measurement y in CT is a sinogram formed by $\mathrm { X }$ -ray projections of the image from various angular directions (Buzug, 2011), while the measurement $\mathbf { y }$ in MRI consists of spatial frequencies in the Fourier space of the image (a.k.a. the $\mathbf { k }$ -space in the MRI community) (Vlaardingerbroek & Boer, 2013).
+
+# 2.2 SCORE-BASED GENERATIVE MODELS
+
+When solving inverse problems in medical imaging, we are given an observation $\mathbf { y }$ , the measurement distribution $\bar { p } ( \mathbf { y } \mid \mathbf { x } )$ and aim to sample from the posterior distribution $p ( \mathbf { x } \mid \mathbf { y } )$ . The prior distribution $p ( \mathbf { x } )$ is typically unknown, but we can train generative models on a dataset $\{ \mathbf { x } ^ { ( 1 ) } , \mathbf { x } ^ { ( 2 ) } , \cdot \cdot \cdot , \mathbf { x } ^ { ( N ) } \} \sim$ $p ( \mathbf { x } )$ to estimate this prior distribution. Given an estimate of $p ( \mathbf { x } )$ and the measurement distribution $p ( \mathbf { y } \mid \mathbf { x } )$ , the posterior distribution $p ( \mathbf { x } \mid \mathbf { y } )$ can be determined through Bayes’ rule.
+
+We propose to estimate the prior distribution of medical images using the recently introduced scorebased generative models (Song & Ermon, 2019; Ho et al., 2020; Song et al., 2021), whose iterative sampling procedure makes it especially easy for controllable generation conditioned on an observation y. Specifically, we adopt the formulation of score-based generative models in Song et al. (2021), where we leverage a Markovian diffusion process to progressively perturb data to noise, and then smoothly convert noise to samples of the data distribution by estimating and simulating its time reversal. We provide an illustration of this generative modeling framework in Fig. 1.
+
+
+Figure 1: We can smoothly perturb images to noise by following the trajectory of an SDE. By estimating the score function $\nabla _ { \mathbf { x } } \log p _ { t } ( \mathbf { x } )$ with neural networks (called score models), it is possible to approximate the reverse SDE and then solve it to generate image samples from noise.
+
+Perturbation process Suppose the dataset is sampled from an unknown data distribution $p ( \mathbf { x } )$ . We perturb datapoints with a stochastic process over a time horizon $[ 0 , 1 ]$ , governed by a linear stochastic differential equation (SDE) of the following form
+
+$$
+\mathrm { d } \mathbf { x } _ { t } = f ( t ) \mathbf { x } _ { t } \mathrm { d } t + g ( t ) \mathrm { d } \mathbf { w } _ { t } , \qquad t \in [ 0 , 1 ] ,
+$$
+
+where $f : [ 0 , 1 ] \to \mathbb { R }$ , $g : [ 0 , 1 ] \to \mathbb { R }$ , $\{ \mathbf { w } _ { t } \in \mathbb { R } ^ { n } \} _ { t \in [ 0 , 1 ] }$ denotes a standard Wiener process (a.k.a., Brownian motion), and $\{ \mathbf { x } _ { t } \in \mathbb { R } ^ { n } \} _ { t \in [ 0 , 1 ] }$ symbolizes the trajectory of random variables in the stochastic process. We further denote the marginal probability distribution of $\mathbf { x } _ { t }$ as $p _ { t } ( \mathbf { x } )$ , and the transition distribution from $\mathbf { x } _ { \mathrm { 0 } }$ to $\mathbf { x } _ { t }$ as $p _ { 0 t } ( \mathbf { x } _ { t } \mid \mathbf { x } _ { 0 } )$ . By definition, we clearly have $p _ { 0 } ( \mathbf { x } ) \equiv p ( \mathbf { x } )$ . Moreover, the functions $f ( t )$ and $g ( t )$ are specifically chosen such that for any initial distribution $p _ { 0 } ( \mathbf { x } )$ , the distribution at the end of the perturbation process, $p _ { 1 } ( \mathbf { x } )$ , is close to a pre-defined noise distribution $\pi ( \mathbf { x } )$ . In addition, the transition density $p _ { 0 t } ( \mathbf { x } _ { t } \mid \mathbf { \dot { x } } _ { 0 } )$ is always a conditional linear Gaussian distribution, taking the form $p _ { 0 t } ( \mathbf { x } _ { t } \mid \mathbf { x } _ { 0 } ) = \mathcal { N } ( \mathbf { x } _ { t } \mid \alpha ( t ) \mathbf { x } _ { 0 } , \beta ^ { 2 } ( t ) I )$ where $\alpha : [ 0 , 1 ] \mathbb { R }$ and $\beta : [ 0 , 1 ] \mathbb { R }$ can be derived analytically from $f ( t )$ and $g ( t )$ (Särkkä & Solin, 2019). Examples of such SDEs include Variance Exploding (VE), Variance Preserving (VP), and subVP SDEs proposed in Song et al. (2021). We found VE SDEs performed the best in our experiments.
+
+Reverse process By reversing the perturbation process in Eq. (1), we can start from a noise sample $\mathbf { x } _ { 1 } \sim p _ { 1 } ( \mathbf { x } )$ and gradually remove the noise therein to obtain a data sample $\mathbf { x } _ { 0 } \sim p _ { 0 } ( \mathbf { x } ) \equiv p ( \mathbf { x } )$ . Crucially, the time reversal of Eq. (1) is given by the following reverse-time SDE (Song et al., 2021)
+
+$$
+\mathrm { d } \mathbf { x } _ { t } = \left[ f ( t ) \mathbf { x } _ { t } - g ( t ) ^ { 2 } \nabla _ { \mathbf { x } _ { t } } \log p _ { t } ( \mathbf { x } _ { t } ) \right] \mathrm { d } t + g ( t ) \mathrm { d } \bar { \mathbf { w } } _ { t } , \qquad t \in [ 0 , 1 ] ,
+$$
+
+where $\{ \bar { \mathbf { w } } _ { t } \} _ { t \in [ 0 , 1 ] }$ denotes a standard Wiener process in the reverse-time direction, and $\mathrm { d } t$ represents an infinitesimal negative time step, since the above SDE must be solved backwards from $t = 1$ to $t = 0$ . The quantity $\nabla _ { \mathbf { x } _ { t } } \log p _ { t } ( \mathbf { x } _ { t } )$ is known as the score function of $p _ { t } ( \mathbf { x } _ { t } )$ . By the definition of time reversal, the trajectory of the reverse stochastic process given by Eq. (2) is $\{ \mathbf { x } _ { t } \} _ { t \in [ 0 , 1 ] }$ , same as the one from the forward SDE in Eq. (1).
+
+Sampling Given an initial sample from $p _ { 1 } ( \mathbf { x } )$ , as well as scores at each intermediate time step, $\nabla _ { \mathbf { x } } \log p _ { t } ( \mathbf { x } )$ , we can simulate the reverse-time SDE in Eq. (2) to obtain samples from the data distribution $p _ { 0 } ( \mathbf { x } ) \equiv p ( \mathbf { x } )$ . In practice, the initial sample is approximately drawn from $\pi ( \mathbf { x } )$ since $\pi ( \mathbf { x } ) \approx p _ { 1 } ( \mathbf { x } )$ , and the scores are estimated by training a neural network $s _ { \theta } ( \mathbf { x } , t )$ (named the score model) on a dataset $\{ \mathbf { x } ^ { ( 1 ) } , \mathbf { x } ^ { ( 2 ) } , \cdot \cdot \cdot , \mathbf { x } ^ { ( N ) } \} \sim p ( \mathbf { x } )$ with denoising score matching (Vincent, 2011; Song et al., 2021), i.e., solving the following objective
+
+$$
+\theta ^ { * } = \underset { \theta } { \operatorname { a r g m i n } } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \mathbb { E } _ { t \sim \mathcal { U } [ 0 , 1 ] } \mathbb { E } _ { \mathbf { x } _ { t } ^ { ( i ) } \sim p _ { 0 t } ( \mathbf { x } _ { t } ^ { ( i ) } | \mathbf { x } ^ { ( i ) } ) } \Big [ \left\| s _ { \theta } ( \mathbf { x } _ { t } ^ { ( i ) } , t ) - \nabla _ { \mathbf { x } _ { t } ^ { ( i ) } } \log p _ { 0 t } ( \mathbf { x } _ { t } ^ { ( i ) } | \mathbf { x } ^ { ( i ) } ) \right\| _ { 2 } ^ { 2 } \Big ] ,
+$$
+
+where $\mathcal { U } [ 0 , 1 ]$ denotes a uniform distribution over $[ 0 , 1 ]$ . The theory of denoising score matching ensures that $\bar { s } _ { \theta ^ { * } } ( \mathbf { x } , t ) \approx \nabla _ { \mathbf { x } } \log p _ { t } ( \mathbf { x } )$ . After training this score model, we plug it into Eq. (2) and solve the resulting reverse-time SDE
+
+$$
+\mathrm { d } \mathbf { x } _ { t } = \left[ f ( t ) \mathbf { x } _ { t } - g ( t ) ^ { 2 } s _ { \theta ^ { \ast } } ( \mathbf { x } _ { t } , t ) \right] \mathrm { d } t + g ( t ) \mathrm { d } { \bar { \mathbf { w } } } _ { t } , \qquad t \in [ 0 , 1 ] ,
+$$
+
+for sample generation. One sampling method is to use the Euler-Maruyama discretization for solving Eq. (3), as given in Algorithm 1. Other sampling methods include annealed Langevin dynamics (ALD, Song & Ermon, 2019), probability flow ODE solvers (Song et al., 2021), and Predictor-Corrector samplers (Song et al., 2021).
+
+
Algorithm 1 Unconditional sampling
Algorithm 2 Inverse problem solving
Require: N
Require: N,y, 入
2:fori=N-1to0do 3:t←
2:fori=N-1 to 0 do 3: t←
N
4: N yt ~ pot(yt |y)
5: xt ←T-1[λAp-1(△)yt+(1-λ)ATxt +
4: Xt-△t←xt-f(t)xt△t
(I-∧)Txt] 6: xt-△t←xt-f(t)xt△t
5: Xt-△t←Xt-△t+g(t)²sθ*(xt,t)△t
7: Xt-△t←Xt-△t+g(t)²sθ*(xt,t)△t
6: z ~ N(0,I)
8: z ~ N(0,1)
7: Xt-△t←xt-△t+g(t)√△tz
Xt-△t←Xt-△t+g(t)√△tz
8: return Xo
9: 10: return Xo
+
+# 3 SOLVING INVERSE PROBLEMS WITH SCORE-BASED GENERATIVE MODELS
+
+With score-based generative modeling, we can train a score model $s _ { \theta ^ { * } } ( \mathbf { x } , t )$ to generate unconditional samples from the the prior distribution of medical images $p ( \mathbf { x } )$ . To solve inverse problems however, we will need to sample from the posterior $p ( \mathbf { x } \mid \mathbf { y } )$ . This can be accomplished by conditioning the original stochastic process $\{ \mathbf { x } _ { t } \} _ { t \in [ 0 , 1 ] }$ on an observation $\mathbf { y }$ , yielding a conditional stochastic process $\{ \mathbf { x } _ { t } \ | \ \mathbf { y } \} _ { t \in [ 0 , 1 ] }$ . We denote the marginal distribution at $t$ as $p _ { t } ( \mathbf { x } _ { t } \mid \mathbf { y } )$ , and our goal is to sample from $p _ { 0 } ( \mathbf { x } _ { 0 } \mid \mathbf { y } )$ , the same distribution as $p ( \mathbf { x } \mid \mathbf { y } )$ by definition. Much like generating unconditional samples by solving the reverse-time SDE in Eq. (2), we can reverse the conditional stochastic process $\{ \mathbf { x } _ { t } \mid \mathbf { y } \} _ { t \in [ 0 , 1 ] }$ to sample from the posterior distribution $p _ { 0 } ( \mathbf { x } _ { 0 } \mid \mathbf { y } )$ by solving the following conditional reverse-time SDE (Song et al., 2021):
+
+$$
+\mathrm { d } \mathbf { x } _ { t } = \left[ f ( t ) \mathbf { x } _ { t } - g ( t ) ^ { 2 } \nabla _ { \mathbf { x } _ { t } } \log p _ { t } ( \mathbf { x } _ { t } \mid \mathbf { y } ) \right] \mathrm { d } t + g ( t ) \mathrm { d } \bar { \mathbf { w } } _ { t } , \qquad t \in [ 0 , 1 ] .
+$$
+
+The conditional score function $\nabla _ { \mathbf { x } _ { t } } \log p _ { t } ( \mathbf { x } _ { t } \mid \mathbf { y } )$ is a critical part of Eq. (4), yet it is non-trivial to compute. One solution is to estimate the score function by training a new score model $s _ { \theta ^ { * } } ( \mathbf x _ { t } , \mathbf y , t )$ that explicitly depends on $\mathbf { y }$ (Song et al., 2021; Dhariwal $\&$ Nichol, 2021), such that $s _ { \theta ^ { * } } ( \mathbf x _ { t } , \mathbf y , t ) \approx$ $\nabla _ { \mathbf { x } _ { t } } \log p _ { t } ( \mathbf { x } _ { t } \mid \mathbf { y } )$ . However, this requires paired data $\{ ( \mathbf { x } _ { i } , \mathbf { y } _ { i } ) \} _ { i = 1 } ^ { N }$ for training and has the same drawbacks as supervised learning techniques. We do not consider this approach in this work.
+
+An unsupervised alternative is to approximate the conditional score function with an unconditionallytrained score model $s _ { \theta ^ { * } } ( \mathbf { x } _ { t } , t ) \approx \mathbf { \bar { \nabla } } \varphi _ { \mathbf { x } _ { t } } \log p _ { t } ( \mathbf { x } _ { t } )$ and the measurement distribution $p ( \mathbf { y } \mid \mathbf { x } )$ . Many existing works (Song et al., 2021; Kawar et al., 2021; Kadkhodaie & Simoncelli, 2020; Jalal et al., 2021) have implemented this idea in different ways. However, the methods in Kawar et al. (2021) and Kadkhodaie & Simoncelli (2020) both require computing the singular value decomposition (SVD) of $\pmb { A } \in \mathbb { R } ^ { m \times n }$ , which can be difficult for many measurement processes in medical imaging. The method proposed in Jalal et al. (2021) is only designed for a specific sampling method called annealed Langevin dynamics (ALD, Song & Ermon, 2019), which proves to be inferior to more advanced sampling algorithms such as Predictor-Corrector methods (Song et al., 2021).
+
+In what follows, we propose a new conditional sampling approach for inverse problem solving with score-based generative models. Our method is computationally efficient for medical image reconstruction, and is applicable to a large family of iterative sampling methods for score-based generative models. At a high level, we first train an unconditional score model $s _ { \theta ^ { * } } ( \mathbf { x } , t )$ on medical images without assuming any measurement process. Given an observation $\mathbf { y }$ at test time, we form a stochastic process $\{ \mathbf { y } _ { t } \} _ { t \in [ 0 , 1 ] }$ by adding appropriate noise to y. We then discretize the reverse-time SDE in Eq. (3) with existing unconditional samplers for $s _ { \theta ^ { * } } ( \mathbf { x } , t )$ , while incorporating the conditional information from y with a proximal optimization step to generate intermediate samples that are consistent with tytutPr0,1s.
+
+# .1 A CONVENIENT FORM OF THE LINEAR MEASUREMENT PROCESS
+
+Many different measurement processes in medical imaging share same components of computation. For example, sparse-view CT reconstruction and metal artifact removal for CT both involve computing the same Radon transform. Similarly, MRI measurement processes require computing the same spatial Fourier transform regardless of different downsampling ratios. To rigorously characterize this structure of measurement processes, we propose a special formulation of $\pmb { A }$ that is efficient to obtain in medical imaging applications. Without loss of generality, we assume that the linear operator $\pmb { A }$ has full rank, i.e., $\operatorname { r a n k } ( A ) = \operatorname* { m i n } ( n , m ) = m$ . The result below gives the alternative formulation of $\pmb { A }$ :
+
+
+Figure 2: Linear measurement processes for sparse-view CT (left) and undersampled MRI (right).
+
+Proposition 1. $I f \operatorname { r a n k } ( A ) = m$ , then there exist an invertible matrix $\pmb { T } \in \mathbb { R } ^ { n \times n }$ , and a diagonal matrix $\pmb { \Lambda } \in \{ 0 , 1 \} ^ { n \times n }$ with $\operatorname { t r } ( \mathbf { \mathbf { \boldsymbol { \Lambda } } } ) = m$ , such that $A = \mathcal { P } ( \mathbf { \boldsymbol { \Lambda } } ) \mathbf { \boldsymbol { T } }$ . Here $\mathcal { P } ( \mathbf { A } ) \in \{ 0 , 1 \} ^ { m \times n }$ is an operator that, when multiplied with any vector $\mathbf { \pmb { a } } \in \mathbb { R } ^ { n }$ , reduces its dimensionality to m by removing each $i$ -th element of $\textbf { \em a }$ for $i = 1 , 2 , \cdots , n$ if $\mathbf { \Lambda } \Lambda _ { i i } = 0$ .
+
+We illustrate this decomposition for CT/MRI in Fig. 2. Many measurement processes in medical imaging share the same $_ { \mathbf { T } }$ , even if they correspond to different $\pmb { A }$ . For example, $_ { \mathbf { T } }$ corresponds to the Radon transform and Fourier transform in sparse-view CT and undersampled MRI respectively, regardless of the number of measurements, i.e., CT projections and $\mathbf { k }$ -space downsampling ratios. For both sparse-view CT reconstruction and metal artifact removal for CT images, the operator $_ { \mathbf { T } }$ is the Radon transform (see Fig. 8). Intuitively, $\mathrm { d i a g } ( \pmb { \Lambda } )$ can be viewed as a subsampling mask on the sinogram/k-space, and ${ \mathcal { P } } ( \Lambda )$ subsamples the sinogram $/ \mathrm { k }$ -space into an observation y with a smaller size according to this subsampling mask. In addition, we note that $\pmb { T } ^ { - 1 }$ can be efficiently implemented with the inverse Radon transform or the inverse Fourier transform in CT/MRI applications.
+
+# 3.2 INCORPORATING A GIVEN OBSERVATION INTO AN UNCONDITIONAL SAMPLING PROCESS
+
+In what follows, we show that the decomposition in Proposition 1 provides an efficient way to generate approximate samples from the conditional stochastic process $\{ \mathbf { x } _ { t } \mid \mathbf { y } \} _ { t \in [ 0 , 1 ] }$ with an unconditional score model $s _ { \theta ^ { * } } ( \mathbf { x } , t )$ . The basic idea is to “hijack” the unconditional sampling process of scorebased generative models to incorporate an observed measurement y.
+
+As we have already discussed, it is difficult to directly solve $\{ \mathbf { x } _ { t } \mid \mathbf { y } \} _ { t \in [ 0 , 1 ] }$ for sample generation. To bypass this difficulty, we first consider a related stochastic process that is much easier to sample from. Recall that $p _ { 0 t } ( \dot { \mathbf { x } } _ { t } \mid \mathbf { x } _ { 0 } ) = \mathcal { N } ( \mathbf { x } _ { t } \mid \alpha ( t ) \mathbf { x } _ { 0 } , \beta ^ { 2 } ( t ) \mathbf { I } )$ where $\alpha ( t )$ and $\beta ( t )$ can be derived from $f ( t )$ and $g ( t )$ (Song et al., 2021). Given the unconditional stochastic process $\{ \mathbf { x } _ { t } \} _ { t \in [ 0 , 1 ] }$ , we define $\{ \mathbf { y } _ { t } \} _ { t \in [ 0 , 1 ] }$ , where $\mathbf { y } _ { t } = A \mathbf { x } _ { t } + \alpha ( t ) \mathbf { \epsilon }$ . Unlike $\{ \mathbf { x } _ { t } \ | \ \mathbf { y } \} _ { t \in [ 0 , 1 ] }$ , the conditional stochastic process $\{ \mathbf { y } _ { t } \ | \ \mathbf { y } \} _ { t \in [ 0 , 1 ] }$ is fully tractable. First, we have ${ \bf y } _ { 0 } = \tilde { \bf A } { \bf x } _ { 0 } + \alpha ( 0 ) \epsilon = A { \bf x } _ { 0 } + \epsilon = { \bf y }$ . Since $p _ { 0 t } ( \mathbf { x } _ { t } \mid \mathbf { x } _ { 0 } ) = \mathcal { N } ( \mathbf { x } _ { t } \mid \alpha ( t ) \mathbf { x } _ { 0 } , \beta ^ { 2 } ( t ) \mathbf { I } )$ , we have $\mathbf { x } _ { t } = \alpha ( t ) \mathbf { x } _ { 0 } + \beta ( t ) \mathbf { z }$ , where $\mathbf { z } \in \mathbb { R } ^ { n } \sim \mathcal { N } ( \mathbf { 0 } , I )$ . By definition, $\mathbf { y } _ { t } = A \mathbf { x } _ { t } + \alpha ( t ) \boldsymbol { \epsilon }$ , so we have ${ \bf y } _ { t } = A ( \alpha ( t ) { \bf x } _ { 0 } + \beta ( t ) { \bf z } ) + \alpha ( t ) \epsilon = \alpha ( t ) ( { \bf y } - \epsilon ) +$ $\beta ( t ) A \mathbf { z } + \alpha ( t ) \boldsymbol { \epsilon } = \alpha ( t ) \mathbf { y } + \beta ( t ) A \mathbf { z }$ . Therefore, we can easily generate a sample $\hat { \mathbf { y } } _ { t } \sim p _ { t } ( \mathbf { y } _ { t } \mid \mathbf { y } )$ by first drawing $\mathbf { z } \sim \mathcal { N } ( \mathbf { 0 } , I )$ and then computing $\hat { \mathbf { y } } _ { t } = \alpha ( t ) \mathbf { y } + \beta ( t ) A \mathbf { z }$ .
+
+The key of our approach is to modify any existing iterative sampling algorithm designed for the unconditional stochastic process $\{ \mathbf { x } _ { t } \} _ { t \in [ 0 , 1 ] }$ so that the samples are consistent with $\{ \mathbf { y } _ { t } \mid \mathbf { \bar { y } } \} _ { t \in [ 0 , 1 ] }$ . In general, an iterative sampling process of score-based generative models selects a sequence of time steps $\left\{ 0 = t _ { 0 } < t _ { 1 } < \cdots < t _ { N } = 1 \right\}$ and iterates according to
+
+$$
+\begin{array} { r } { \hat { \mathbf { x } } _ { t _ { i - 1 } } = h \big ( \hat { \mathbf { x } } _ { t _ { i } } , \mathbf { z } _ { i } , s _ { \theta ^ { * } } \big ( \hat { \mathbf { x } } _ { t _ { i } } , t _ { i } \big ) \big ) , \quad i = N , N - 1 , \cdots , 1 , } \end{array}
+$$
+
+where $\hat { \mathbf { x } } _ { t _ { N } } \sim \pi ( \mathbf { x } )$ , $\mathbf { z } _ { i } \sim \mathcal { N } ( \mathbf { 0 } , I )$ , and $\pmb { \theta } ^ { * }$ denotes the parameters in an unconditional score model $s _ { \theta ^ { * } } ( \mathbf { x } , t )$ . Here the iteration function $^ { h }$ takes a noisy sample $\hat { \mathbf { x } } _ { t _ { i } }$ and reduces the noise therein to generate $\hat { \mathbf { x } } _ { t _ { i - 1 } }$ , using the unconditional score model $s _ { \theta ^ { * } } ( \mathbf { x } , t )$ . For example, for the Euler-Maruyama sampler detailed in Algorithm 1, this iteration function is given by
+
+$$
+h ( \hat { \bf x } _ { t _ { i } } , { \bf z } _ { i } , s _ { \theta ^ { * } } ( \hat { \bf x } _ { t _ { i } } , t _ { i } ) ) = \hat { \bf x } _ { t _ { i } } - f ( t _ { i } ) \hat { \bf x } _ { t _ { i } } / N + g ( t _ { i } ) ^ { 2 } s _ { \theta ^ { * } } ( \hat { \bf x } _ { t _ { i } } , t _ { i } ) / N + g ( t _ { i } ) { \bf z } _ { i } / \sqrt { N } .
+$$
+
+Samples obtained by this procedure $\{ \hat { \mathbf { x } } _ { t _ { i } } \} _ { i = 0 } ^ { N }$ constitute an approximation of $\{ \mathbf { x } _ { t } \} _ { t \in [ 0 , 1 ] }$ , where the last sample $\hat { \mathbf { x } } _ { t _ { 0 } }$ can be viewed as an approximate sample from $p _ { 0 } ( \mathbf { x } )$ . Most existing sampling
+
+
+Figure 3: (Left) An overview of our method for solving inverse problems with score-based generative models. (Right) An illustration about how to combine $\hat { \mathbf { x } } _ { t _ { i } }$ and $\mathbf { y }$ to form $\hat { \mathbf { x } } _ { t _ { i } } ^ { \prime }$ .
+
+methods for score-based generative models are instances of this iterative sampling paradigm, including Algorithm 1, ALD (Song & Ermon, 2019), probability flow ODEs (Song et al., 2021) and PredictorCorrector samplers (Song et al., 2021).
+
+To enforce the constraint implied by $\{ \mathbf { y } _ { t } \mid \mathbf { y } \} _ { t \in [ 0 , 1 ] }$ , we prepend an additional step to the iteration rule in Eq. (5), leading to
+
+$$
+\begin{array} { r } { \hat { \mathbf { x } } _ { t _ { i } } ^ { \prime } = k ( \hat { \mathbf { x } } _ { t _ { i } } , \hat { \mathbf { y } } _ { t _ { i } } , \lambda ) \qquad } \\ { \hat { \mathbf { x } } _ { t _ { i - 1 } } = h ( \hat { \mathbf { x } } _ { t _ { i } } ^ { \prime } , \mathbf { z } _ { i } , s _ { \theta ^ { * } } ( \hat { \mathbf { x } } _ { t _ { i } } , t _ { i } ) ) , \quad i = N , N - 1 , \cdots , 1 , } \end{array}
+$$
+
+where $\hat { \mathbf { x } } _ { t _ { N } } \sim \pi ( \mathbf { x } ) , \hat { \mathbf { y } } _ { t _ { i } } \sim p _ { t _ { i } } ( \mathbf { y } _ { t _ { i } } \mid \mathbf { y } )$ , and $0 \leqslant \lambda \leqslant 1$ is a hyper-parameter. We provide an illustration of this process in Fig. 3. The iteration function $\pmb { k } ( \cdot , \hat { \mathbf { y } } _ { t _ { i } } , \lambda ) : \mathbb { R } ^ { n } \mathbb { R } ^ { n }$ promotes data consistency by solving a proximal optimization step (Nesterov, 2003; Boyd et al., 2004; Hammernik et al., 2021) that simultaneously minimizes the distance between $\hat { \mathbf { x } } _ { t _ { i } } ^ { \prime }$ and $\hat { \mathbf { x } } _ { t _ { i } }$ , and the distance between $\hat { \mathbf { x } } _ { t _ { i } } ^ { \prime }$ and the hyperplane $\left\{ \pmb { x } \in \mathbb { R } ^ { n } \ \lvert \ A \pmb { x } = \hat { \mathbf { y } } _ { t _ { i } } \right\}$ , with a hyperparameter $0 \leqslant \lambda \leqslant 1$ balancing between the two:
+
+$$
+\hat { \mathbf { x } } _ { t _ { i } } ^ { \prime } = \underset { z \in \mathbb { R } ^ { n } } { \arg \operatorname* { m i n } } \{ \left( 1 - \lambda \right) \| z - \hat { \mathbf { x } } _ { t _ { i } } \| _ { T } ^ { 2 } + \underset { u \in \mathbb { R } ^ { n } } { \operatorname* { m i n } } \lambda \| z - u \| _ { T } ^ { 2 } \} \quad s . t . \quad A u = \hat { \mathbf { y } } _ { t _ { i } } .
+$$
+
+Recall that $A = \mathcal { P } ( \mathbf { \boldsymbol { \Lambda } } ) \mathbf { \boldsymbol { T } }$ according to Proposition 1. In the equation above we choose the norm $\left\| \pmb { a } \right\| _ { T } ^ { 2 } : = \left\| \pmb { T } \pmb { a } \right\| _ { 2 } ^ { 2 }$ to simplify our theoretical analysis. The decomposition in Proposition 1 allows us to derive a closed-form solution to the optimization problem in Eq. (8), as given below:
+
+Theorem 1. The solution of Eq. (8) can be given by
+
+$$
+\hat { \mathbf { x } } _ { t _ { i } } ^ { \prime } = \pmb { T } ^ { - 1 } [ \lambda \pmb { \Lambda } \mathcal { P } ^ { - 1 } ( \pmb { \Lambda } ) \hat { \mathbf { y } } _ { t _ { i } } + ( 1 - \lambda ) \pmb { \Lambda } \pmb { T } \hat { \mathbf { x } } _ { t _ { i } } + ( \pmb { I } - \pmb { \Lambda } ) \pmb { T } \hat { \mathbf { x } } _ { t _ { i } } ] ,
+$$
+
+where $\mathcal { P } ^ { - 1 } ( \mathbf { \Lambda } ) : \mathbb { R } ^ { m } \mathbb { R } ^ { n }$ denotes any right inverse of ${ \mathcal { P } } ( \Lambda )$ .
+
+See Fig. 3 for an illustration of the function $\hat { \mathbf { x } } _ { t _ { i } } ^ { \prime } = k ( \hat { \mathbf { x } } _ { t _ { i } } , \hat { \mathbf { y } } _ { t _ { i } } , \lambda )$ . The right inverse $\mathcal { P } ^ { - 1 } ( \pmb { \Lambda } )$ increases the dimensionality of a vector $\pmb { a } \in \mathbb { R } ^ { m }$ to $n$ by putting its entries on every index $i$ of an $n$ -dimensional vector where $\mathbf { \Lambda } \Lambda _ { i i } = 1$ . Recall that in sparse-view CT or undersampled MRI, $\mathrm { d i a g } ( \pmb { \Lambda } )$ represents a subsampling mask, and ${ \mathcal { P } } ( \Lambda )$ subsamples the full sinogram/k-space to generate the observation y. In this case, $\bar { \mathcal { P } } ^ { - 1 } ( \pmb { \Lambda } )$ pads the observation y so that it has the same size as the full sinogram $/ \mathrm { k }$ -space.
+
+When $\lambda = 0$ , $\hat { \mathbf { x } } _ { t _ { i } } ^ { \prime } = k ( \hat { \mathbf { x } } _ { t _ { i } } , \hat { \mathbf { y } } _ { t _ { i } } , 0 ) = \hat { \mathbf { x } } _ { t _ { i } }$ completely ignores the constraint $A \hat { \mathbf { x } } _ { t _ { i } } ^ { \prime } = \hat { \mathbf { y } } _ { t _ { i } }$ , in which case our sampling method in Eq. (7) performs unconditional generation. On the other hand, when $\lambda = 1 , \hat { \mathbf { x } } _ { t _ { i } } ^ { \prime } = k ( \hat { \mathbf { x } } _ { t _ { i } } , \hat { \mathbf { y } } _ { t _ { i } } , 1 )$ satisfies $A \hat { \mathbf { x } } _ { t _ { i } } ^ { \prime } = \hat { \mathbf { y } } _ { t _ { i } }$ exactly. When the measurement is noisy, we choose $0 < \lambda < 1$ to allow slackness in the constraint $A \hat { \mathbf { x } } _ { t _ { i } } ^ { \prime } = \hat { \mathbf { y } } _ { t _ { i } }$ . The value of $\lambda$ is important for balancing between $\hat { \mathbf { x } } _ { t _ { i } } ^ { \prime } \approx \hat { \mathbf { x } } _ { t _ { i } }$ and $A \hat { \mathbf { x } } _ { t _ { i } } ^ { \prime } \approx \hat { \mathbf { y } } _ { t _ { i } }$ . In practice, we use Bayesian optimization to tune this $\lambda$ automatically on a validation dataset. When the measurement process contains no noise, we replace $\hat { \mathbf { x } } _ { t _ { 0 } }$ with $k ( \hat { \mathbf x } _ { t _ { 0 } } , \mathbf y , 1 )$ at the last sampling step to guarantee $\boldsymbol { A } \hat { \mathbf x } _ { t _ { 0 } } = \mathbf y$ .
+
+In summary, our method given in Eq. (7) introduces minimal modifications to an existing iterative sampling method of score-based generative models. For example, we can convert the sampler in Algorithm 1 to an inverse problem solver in Algorithm 2 by adding/modifying just three lines of pseudo-code. Unlike the concurrent work Jalal et al. (2021), our method is not limited to annealed Langevin dynamics (ALD). As demonstrated in our experiments, we outperform Jalal et al. (2021) even with the same ALD sampler, and can widen the performance gap further by using more advanced approaches like the Predictor-Corrector sampler (Song et al., 2021). Unlike Kadkhodaie & Simoncelli (2020); Kawar et al. (2021), we rely on the efficient alternative representation of $\pmb { A }$ given in Section 3.1, and do not require expensive SVD computation.
+
+
+Figure 4: Examples of sparse-view CT reconstruction results on LIDC $3 2 0 \times 3 2 0$ (Top row) and LDCT $5 1 2 \times 5 1 2$ (Bottom row), all with 23 projections. You may zoom in to view more details.
+
+# 4 EXPERIMENTS
+
+We aim to answer the following questions in this section: (1) Can we directly compete with best-inclass supervised learning techniques for the same measurement process used in their training, even though our approach is fully unsupervised? (2) Can our method generalize better to new measurement processes? (3) How do we fare against other unsupervised approaches? To study these questions, we experiment on several tasks in medical imaging, including sparse-view CT reconstruction, metal artifact removal (MAR) for CT, and undersampled MRI reconstruction. More experimental details are provided in Appendix B.
+
+Datasets We consider two datasets for CT experiments. The first is the Lung Image Database Consortium (LIDC) image collection dataset (Armato III et al., 2011; Clark et al., 2013) where we slice the original 3D CT volumes to obtain 130304 2D images of resolution $3 2 0 \times 3 2 0$ for training. The second is the Low Dose CT (LDCT) Image and Projection dataset (Moen et al., 2021) that contains CT scans of multiple anatomic sites, including head, chest, and abdomen, from which we generate 47006 2D image slices of resolution $5 1 2 \times 5 1 2$ for training. We simulate CT measurements (sinograms) with a parallel-beam geometry using projection angles equally distributed across 180 degrees. For MAR experiments, we follow Yu et al. (2020) to synthesize metal artifacts. For undersampled MRI experiments, we use the Brain Tumor Segmentation (BraTS) 2021 dataset (Menze et al., 2014; Bakas et al., 2017), where we slice 3D MRI volumes to get 297270 images of resolution $2 4 0 \times 2 4 0$ as the training dataset. We simulate MRI measurements with Fast Fourier Transform using a single-coil setup, and follow Zbontar et al. (2018); Knoll et al. (2020) to undersample the $\mathbf { k }$ -space with an equispaced Cartesian mask. The performance is measured on 1000 test images with peak signal-to-noise ratio (PSNR) and structural similarity (SSIM).
+
+Standard techniques in medical imaging We include two standard learning-free techniques as baselines for sparse-view CT reconstruction. The first is filtered back projection on sparse-view sinograms, which is denoted by “FBP”. The second is an iterative reconstruction method with total variation regularization called FISTA-TV (Beck & Teboulle, 2009). For MAR experiments, we include another learning-free baseline called linear interpolation (LI, Kalender et al., 1987).
+
+Table 1: Results for undersampled MRI reconstruction on BraTS. First two methods are supervised learning techniques trained with $8 \times$ acceleration. The others are unsupervised techniques.
+
+
Method
24×Acceleration
8× Acceleration
4× Acceleration
PSNR↑
SSIM↑
PSNR↑
SSIM↑
PSNR↑
SSIM↑
Cascade DenseNet
23.39±2.17
0.765±0.042
28.35±2.30
0.845±0.038
30.97±2.33
0.902±0.028
DuDoRNet
18.46±3.05
0.662±0.093
37.88±3.03
0.985±0.007
30.53±4.13
0.891±0.071
Score SDE
27.83±2.73
0.849±0.038
35.04±2.11
0.943±0.016
37.55±2.08
0.960±0.013
Langevin
28.80±3.21
0.873±0.039
36.44±2.28
0.952±0.016
38.76±2.32
0.966±0.012
Ours
29.42±3.03
0.880±0.035
37.63±2.70
0.958±0.015
39.91±2.67
0.965±0.013
+
+Table 2: Results for sparse-view CT reconstruction on LIDC and LDCT. FISTA-TV is a standard iterative reconstruction method that does not need training. cGAN, Neumann, and SIN- $_ { \mathrm { 4 c } }$ -PRN are supervised learning techniques trained with 23 projection angles.
+
+
Method
Projections
LIDC 320× 320
LDCT 512 × 512
PSNR↑
SSIM↑
PSNR↑
SSIM↑
FBP
23
10.18±1.38
0.230±0.072
10.11±1.19
0.302±0.078
FISTA-TV
23
20.08±4.89
0.799±0.061
21.88±4.42
0.850±0.067
cGAN
23
19.83±3.07
0.479±0.103
19.90±2.52
0.545±0.065
Neumann
23
17.18±3.79
0.454±0.128
18.83±3.29
0.525±0.073
SIN-4c-PRN
23
30.48±3.99
0.895±0.047
34.82±3.55
0.877±0.116
Ours
10
29.52±2.63
0.823±0.061
28.96±4.41
0.849±0.086
20
34.40±2.66
0.895±0.048
36.80±4.50
0.936±0.058
23
35.24±2.71
0.905±0.046
37.41±4.62
0.941±0.057
+
+Supervised learning baselines For sparse-view CT on both LIDC and LDCT, we include cGAN (Ghani & Karl, 2018), Neumann (Gilton et al., 2019), and SIN- $_ \mathrm { 4 c }$ -PRN (Wei et al., 2020) as supervised learning baselines. We follow the settings in Wei et al. (2020) and train all methods with 23 projection angles. For MAR, we use cGANMAR (Wang et al., 2018) and SNMAR (Yu et al., 2020) as the baselines. For undersampled MRI on BraTS, we compare against Cascade DenseNet (Zheng et al., 2019) and DuDoRNet (Zhou & Zhou, 2020), which are both trained with a $8 \times$ acceleration factor by measuring only $1 / 8$ of the full $\mathbf { k }$ -space.
+
+Unsupervised learning baselines For unsupervised techniques, so far only score-based generative models have witnessed success on clinic data. We compare with several existing methods that apply score-based generative models to inverse problem solving. Specifically, we consider the “Langevin” approach proposed in Jalal et al. (2021), and the “Score SDE” method in Song et al. (2021), where the former is limited to annealed Langevin dynamics (ALD) sampling, and the latter was based on a crude approximation to the conditional score function $\nabla _ { \mathbf { x } _ { t } } \log p _ { t } ( \mathbf { x } _ { t } \mid \mathbf { y } )$ in Eq. (4), and was proposed as a theoretical possibility in Appendix I.4 of Song et al. (2021) without experiments. We only focus on undersampled MRI for these baselines, since it is the only medical imaging problem ever tackled with score-based generative models before our work. All methods share the same score models and only differ in terms of inference. We make sure all sampling algorithms have comparable number of iteration steps ( $N$ in Eqs. (5) and (7)).
+
+Competing with supervised learning approaches Thanks to the outstanding sample quality of score-based generative models, we can achieve comparable or better performance than best-in-class supervised learning methods even for the same measurement process used in their training. As shown in Table 2, we outperform the top supervised learning technique SIN- $_ { \mathrm { 4 c } }$ -PRN on sparse-view CT reconstruction by a significant margin, on both the LIDC and LDCT datasets. Our results with
+
+Table 3: MAR results on LIDC.
+
+
Method
PSNR↑
SSIM↑
LI
26.30±2.62
0.910±0.028
cGANMAR
27.27±1.96
0.927±0.060
SNMAR
27.28±1.43
0.937±0.048
Ours
32.16±2.32
0.939±0.022
+
+20 measurements are even better than supervised learning counterparts with 23 measurements. In Fig. 4, we provide a visual comparison of the reconstruction quality for various methods, where it is clear to see that our method can recover more details faithfully. From results in Table 3, we also outperform the top supervised learning method SNMAR on metal artifact removal. As shown in Fig. 7, our method generates images with less artifacts and preserves the structure better. For undersampled MRI reconstruction results given in Tables 1 and 3, our method is ranked the 2nd for the case of $8 \times$ acceleration, with comparable performance to the top supervised method DuDoRNet.
+
+
+Figure 5: Performance vs. numbers of measurements. Shaded areas represent standard deviation. (Left) MRI on BraTS. (Center) CT on LIDC. (Right) Comparing score-based generative models for undersampled MRI reconstruction on BraTS.
+
+Generalizing to different number of measurements Since our approach is fully unsupervised, we can naturally apply the same score model to different measurement processes. We first consider changing the number of measurements at the test time, e.g., using different number of projection angles (resp. different acceleration factors) for sparse-view CT (resp. undersampled MRI) reconstruction. As shown in Table 1 and Fig. 5 (Left), we achieve the best performance on undersampled MRI for both $2 4 \times$ and $4 \times$ acceleration factors, whereas DuDoRNet fails to generalize when the acceleration factor changes. The other supervised learning approach Cascade DenseNet demonstrates limited adaptability by building a model architecture inspired by the physical measurement process of MRI, but fails to yield top-level performance. For sparse-view CT reconstruction, all supervised learning methods struggle to generalize to different projection angles, as shown in Fig. 5 (Center).
+
+Generalizing to different measurement processes in CT We can perform both sparse-view CT reconstruction and metal artifact removal (MAR) with a single score model trained on CT images. These two tasks are inverse problems in CT imaging with different measurement processes $\pmb { A }$ , but they share the same $\mathbf { T }$ in the decomposition of Proposition 1. We provide a visualization of the measurement process corresponding to MAR in Fig. 8. As shown in Table 3, we can outperform supervised learning techniques specifically designed and trained for MAR, while using the same score model used in sparse-view CT reconstruction on LIDC.
+
+Comparing against existing score-based methods We compare our method against Langevin (Jalal et al., 2021) and Score SDE (Song et al., 2021) for undersampled MRI reconstruction on BraTS. Two variants of our approach are considered, which respectively use annealed Langevin dynamics (ALD) and the Predictor-Corrector (PC) sampler for score-based generative models as the backend. We denote the former by $\mathrm { \ddot { \ s u } L D + O u r s { \vec { \nu } } }$ , and the latter by “PC $^ +$ Ours” (our default method for all other experiments). Recall that Langevin uses ALD as the sampler, same as $\mathrm { ^ { 6 6 } A L D + O u r s ^ { 3 7 } }$ . All results are provided in Fig. 5 (Right). We observe that “ALD $^ +$ Ours” uniformly outperform Langevin and Score SDE across all numbers of measurements in the experiment. Moreover, ${ } ^ { \mathrm { s } } \mathrm { P C } +$ Ours” can further improve “ALD $^ +$ Ours”, demonstrating the power of switching to more advanced sampling methods of score-based generative models in our proposed approach.
+
+# 5 CONCLUSION
+
+We propose a new method to solve linear inverse problems with score-based generative models. Our method is fully unsupervised, requires no paired data for training, can flexibly adapt to different measurement processes at test time, and only requires minimal modifications to a large number of existing sampling methods of score-based generative models. Empirical results demonstrate that our method can match or outperform existing supervised learning counterparts on image reconstruction for sparse-view CT and undersampled MRI, and has better generalization to new measurement processes, such as using a different number of projections or downsampling ratios in CT/MRI, and tackling both sparse-view CT reconstruction and metal artifact removal with a single model.
+
+# AUTHOR CONTRIBUTIONS
+
+Yang Song designed the project, wrote the paper, and ran all experiments for score-based generative models. Liyue Shen preprocessed data, ran all baseline experiments, and helped write the paper. Lei Xing and Stefano Ermon supervised the project, provided valuable feedback, and helped edit the paper.
+
+# ACKNOWLEDGMENTS
+
+YS is supported by the Apple PhD Fellowship in AI/ML. LS is supported by the Stanford Bio-X Graduate Student Fellowship. This research was supported by NSF (#1651565, #1522054, #1733686), ONR (N000141912145), AFOSR (FA95501910024), ARO (W911NF-21-1-0125), Sloan Fellowship, and Google TPU Research Cloud. This research was also supported by NIH/NCI (1R01 CA256890 and 1R01 CA227713).
+
+# REFERENCES
+
+Vegard Antun, Francesco Renna, Clarice Poon, Ben Adcock, and Anders C Hansen. On instabilities of deep learning in image reconstruction and the potential costs of ai. Proceedings of the National Academy of Sciences, 117(48):30088–30095, 2020.
+
+Samuel G Armato III, Geoffrey McLennan, Luc Bidaut, Michael F McNitt-Gray, Charles R Meyer, Anthony P Reeves, Binsheng Zhao, Denise R Aberle, Claudia I Henschke, Eric A Hoffman, et al. The lung image database consortium (lidc) and image database resource initiative (idri): a completed reference database of lung nodules on ct scans. Medical physics, 38(2):915–931, 2011.
+
+Spyridon Bakas, Hamed Akbari, Aristeidis Sotiras, Michel Bilello, Martin Rozycki, Justin S Kirby, John B Freymann, Keyvan Farahani, and Christos Davatzikos. Advancing the cancer genome atlas glioma mri collections with expert segmentation labels and radiomic features. Scientific data, 4(1): 1–13, 2017.
+
+Amir Beck and Marc Teboulle. A fast iterative shrinkage-thresholding algorithm for linear inverse problems. SIAM journal on imaging sciences, 2(1):183–202, 2009.
+
+Stephen Boyd, Stephen P Boyd, and Lieven Vandenberghe. Convex optimization. Cambridge university press, 2004.
+
+Thorsten M Buzug. Computed tomography. In Springer handbook of medical technology, pp. 311–342. Springer, 2011.
+
+Kenneth Clark, Bruce Vendt, Kirk Smith, John Freymann, Justin Kirby, Paul Koppel, Stephen Moore, Stanley Phillips, David Maffitt, Michael Pringle, et al. The cancer imaging archive (tcia): maintaining and operating a public information repository. Journal of digital imaging, 26(6): 1045–1057, 2013.
+
+Prafulla Dhariwal and Alex Nichol. Diffusion models beat GANs on image synthesis. arXiv preprint arXiv:2105.05233, 2021.
+
+Muhammad Usman Ghani and W Clem Karl. Deep learning-based sinogram completion for low-dose ct. In 2018 IEEE 13th Image, Video, and Multidimensional Signal Processing Workshop (IVMSP), pp. 1–5. IEEE, 2018.
+
+Davis Gilton, Greg Ongie, and Rebecca Willett. Neumann networks for linear inverse problems in imaging. IEEE Transactions on Computational Imaging, 6:328–343, 2019.
+
+Kerstin Hammernik, Jo Schlemper, Chen Qin, Jinming Duan, Ronald M Summers, and Daniel Rueckert. Systematic evaluation of iterative deep neural networks for fast parallel mri reconstruction with sensitivity-weighted coil combination. Magnetic Resonance in Medicine, 2021.
+
+Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising Diffusion Probabilistic Models. Advances in Neural Information Processing Systems, 33, 2020.
+
+Ajil Jalal, Marius Arvinte, Giannis Daras, Eric Price, Alexandros G Dimakis, and Jonathan I Tamir. Robust compressed sensing mri with deep generative priors. arXiv preprint arXiv:2108.01368, 2021.
+
+Zahra Kadkhodaie and Eero P Simoncelli. Solving linear inverse problems using the prior implicit in a denoiser. arXiv preprint arXiv:2007.13640, 2020.
+
+Willi A Kalender, Robert Hebel, and Johannes Ebersberger. Reduction of ct artifacts caused by metallic implants. Radiology, 164(2):576–577, 1987.
+
+Bahjat Kawar, Gregory Vaksman, and Michael Elad. Snips: Solving noisy inverse problems stochastically. arXiv preprint arXiv:2105.14951, 2021.
+
+Daniil Kazantsev and Nicola Wadeson. Tomographic model-based reconstruction (tomobar) software for high resolution synchrotron x-ray tomography. CT Meeting, 2020.
+
+Daniil Kazantsev, Edoardo Pasca, Martin J Turner, and Philip J Withers. Ccpi-regularisation toolkit for computed tomographic image reconstruction with proximal splitting algorithms. SoftwareX, 9: 317–323, 2019.
+
+Florian Knoll, Jure Zbontar, Anuroop Sriram, Matthew J Muckley, Mary Bruno, Aaron Defazio, Marc Parente, Krzysztof J Geras, Joe Katsnelson, Hersh Chandarana, et al. fastmri: A publicly available raw $\mathbf { k }$ -space and dicom dataset of knee images for accelerated mr image reconstruction using machine learning. Radiology: Artificial Intelligence, 2(1):e190007, 2020.
+
+Morteza Mardani, Enhao Gong, Joseph Y Cheng, Shreyas Vasanawala, Greg Zaharchuk, Marcus Alley, Neil Thakur, Song Han, William Dally, John M Pauly, et al. Deep generative adversarial networks for compressed sensing automates mri. arXiv preprint arXiv:1706.00051, 2017.
+
+Bjoern H Menze, Andras Jakab, Stefan Bauer, Jayashree Kalpathy-Cramer, Keyvan Farahani, Justin Kirby, Yuliya Burren, Nicole Porz, Johannes Slotboom, Roland Wiest, et al. The multimodal brain tumor image segmentation benchmark (brats). IEEE transactions on medical imaging, 34(10): 1993–2024, 2014.
+
+Taylor R Moen, Baiyu Chen, David R Holmes III, Xinhui Duan, Zhicong Yu, Lifeng Yu, Shuai Leng, Joel G Fletcher, and Cynthia H McCollough. Low-dose ct image and projection dataset. Medical physics, 48(2):902–911, 2021.
+
+Yurii Nesterov. Introductory lectures on convex optimization: A basic course, volume 87. Springer Science & Business Media, 2003.
+
+Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 8024–8035. Curran Associates, Inc., 2019.
+
+Matteo Ronchetti. Torchradon: Fast differentiable routines for computed tomography. arXiv preprint arXiv:2009.14788, 2020.
+
+Simo Särkkä and Arno Solin. Applied stochastic differential equations, volume 10. Cambridge University Press, 2019.
+
+Liyue Shen, Wei Zhao, and Lei Xing. Patient-specific reconstruction of volumetric computed tomography images from a single projection view via deep learning. Nature biomedical engineering, 3(11):880–888, 2019.
+
+Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. In Advances in Neural Information Processing Systems, pp. 11918–11930, 2019.
+
+Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin (eds.), Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
+
+Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum? id=PxTIG12RRHS.
+
+Pascal Vincent. A Connection Between Score Matching and Denoising Autoencoders. Neural Computation, 23(7):1661–1674, 2011.
+
+Marinus T Vlaardingerbroek and Jacques A Boer. Magnetic resonance imaging: theory and practice. Springer Science & Business Media, 2013.
+
+Jianing Wang, Yiyuan Zhao, Jack H Noble, and Benoit M Dawant. Conditional generative adversarial networks for metal artifact reduction in ct images of the ear. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 3–11. Springer, 2018.
+
+Haoyu Wei, Florian Schiffers, Tobias Würfl, Daming Shen, Daniel Kim, Aggelos K Katsaggelos, and Oliver Cossairt. 2-step sparse-view ct reconstruction with a domain-specific perceptual network. arXiv preprint arXiv:2012.04743, 2020.
+
+Tobias Würfl, Mathis Hoffmann, Vincent Christlein, Katharina Breininger, Yixin Huang, Mathias Unberath, and Andreas K Maier. Deep learning computed tomography: Learning projectiondomain weights from image domain in limited angle problems. IEEE transactions on medical imaging, 37(6):1454–1463, 2018.
+
+Lequan Yu, Zhicheng Zhang, Xiaomeng Li, and Lei Xing. Deep sinogram completion with image prior for metal artifact reduction in ct images. IEEE Transactions on Medical Imaging, 40(1): 228–238, 2020.
+
+Jure Zbontar, Florian Knoll, Anuroop Sriram, Tullie Murrell, Zhengnan Huang, Matthew J. Muckley, Aaron Defazio, Ruben Stern, Patricia Johnson, Mary Bruno, Marc Parente, Krzysztof J. Geras, Joe Katsnelson, Hersh Chandarana, Zizhao Zhang, Michal Drozdzal, Adriana Romero, Michael Rabbat, Pascal Vincent, Nafissa Yakubova, James Pinkerton, Duo Wang, Erich Owens, C. Lawrence Zitnick, Michael P. Recht, Daniel K. Sodickson, and Yvonne W. Lui. fastMRI: An open dataset and benchmarks for accelerated MRI. 2018.
+
+Hao Zheng, Faming Fang, and Guixu Zhang. Cascaded dilated dense network with two-step data consistency for mri reconstruction. 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/1e48c4420b7073bc11916c6c1de226bb-Paper.pdf.
+
+Bo Zhou and S Kevin Zhou. Dudornet: Learning a dual-domain recurrent network for fast mri reconstruction with deep t1 prior. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4273–4282, 2020.
+
+Bo Zhu, Jeremiah Z Liu, Stephen F Cauley, Bruce R Rosen, and Matthew S Rosen. Image reconstruction by domain-transform manifold learning. Nature, 555(7697):487–492, 2018.
+
+# A PROOFS
+
+Proposition 1. $I f \operatorname { r a n k } ( A ) = m$ , then there exist an invertible matrix $\pmb { T } \in \mathbb { R } ^ { n \times n }$ , and a diagonal matrix $\pmb { \Lambda } \in \{ 0 , 1 \} ^ { n \times n }$ with $\operatorname { t r } ( \mathbf { \mathbf { \boldsymbol { \Lambda } } } ) = m$ , such that $A = \mathcal { P } ( \mathbf { \boldsymbol { \Lambda } } ) \mathbf { \boldsymbol { T } }$ . Here $\mathcal { P } ( \mathbf { A } ) \in \{ 0 , 1 \} ^ { m \times n }$ is an operator that, when multiplied with any vector $\mathbf { \pmb { a } } \in \mathbb { R } ^ { n }$ , reduces its dimensionality to m by removing each $i$ -th element of $\textbf { \em a }$ for $i = 1 , 2 , \cdots , n$ if $\mathbf { \Lambda } \Lambda _ { i i } = 0$ .
+
+Proof. Let $\textbf { \textit { A } } = \mathbf { \beta } \left( \pmb { a } _ { 1 } ^ { \mathsf { T } } , \pmb { a } _ { 2 } ^ { \mathsf { T } } , \cdot \cdot \cdot , \pmb { a } _ { m } ^ { \mathsf { T } } \right) \ \in \ \mathbb { R } ^ { m \times n }$ . Since $\pmb { A }$ has full rank, the row vectors $\{ a _ { 1 } , a _ { 2 } , \cdots , a _ { m } \}$ are linearly independent. We can therefore extend them to a total of $n$ linearly independent vectors, i.e., $\{ a _ { 1 } , \dotsc , a _ { 2 } , \dotsc , a _ { m } , b _ { 1 } , \dotsc , b _ { n - m } \}$ . Due to the linear independence, we know $\pmb { T } = ( \pmb { a } _ { 1 } ^ { \top } , \pmb { a } _ { 2 } ^ { \top } , \cdot \cdot \cdot , \pmb { a } _ { m } ^ { \top } , \pmb { b } _ { 1 } ^ { \top } , \cdot \cdot \cdot , \pmb { b } _ { n - m } ^ { \top } ) \in \mathbb { R } ^ { n \times n }$ has full rank and is invertible. Next, we define
+
+$$
+\pmb { \Lambda } = \mathrm { d i a g } ( \underbrace { 1 , 1 , \cdots , 1 } _ { m } , \underbrace { 0 , 0 , \cdots , 0 } _ { n - m } ) ,
+$$
+
+where diag converts a vector to a diagonal matrix. Clearly $\operatorname { t r } ( \mathbf { \mathbf { \boldsymbol { \Lambda } } } ) = m$ and $A = \mathcal { P } ( \mathbf { \boldsymbol { \Lambda } } ) \mathbf { \boldsymbol { T } }$ , which completes the proof. □
+
+Lemma 1. Let $\mathcal { P } ^ { - 1 } ( \pmb { \Lambda } ) : \mathbb { R } ^ { m } \mathbb { R } ^ { n }$ be any right inverse of $\mathcal { P } ( \mathbf { A } ) : \mathbb { R } ^ { n } \mathbb { R } ^ { m }$ . For any $\pmb { u } \in \mathbb { R } ^ { n }$ and $\hat { \mathbf { y } } _ { t } \in \mathbb { R } ^ { m }$ , we have
+
+$$
+\mathcal { P } ( \Lambda ) \pmb { T } \pmb { u } = \hat { \mathbf { y } } _ { t } \iff \Lambda \pmb { T } \pmb { u } = \Lambda \mathcal { P } ^ { - 1 } ( \pmb { \Lambda } ) \hat { \mathbf { y } } _ { t }
+$$
+
+Proof. By the definition of ${ \mathcal { P } } ( \Lambda )$ , we have $\mathcal { P } ( \mathbf { \boldsymbol { \Lambda } } ) = \mathcal { P } ( \mathbf { \boldsymbol { \Lambda } } ) \mathbf { \boldsymbol { \Lambda } }$ , and
+
+$$
+\forall a \in \mathbb { R } ^ { n } , b \in \mathbb { R } ^ { n } : \quad \mathcal { P } ( \Lambda ) a = \mathcal { P } ( \Lambda ) b \iff \Lambda a = \Lambda b .
+$$
+
+To prove the “if” direction, we note that
+
+$$
+\begin{array} { r l } & { \Lambda T u = \Lambda \mathcal { P } ^ { - 1 } ( \Lambda ) \hat { \mathbf { y } } _ { t } \implies \mathcal { P } ( \Lambda ) \Lambda T u = \mathcal { P } ( \Lambda ) \Lambda \mathcal { P } ^ { - 1 } ( \Lambda ) \hat { \mathbf { y } } _ { t } } \\ & { \implies \mathcal { P } ( \Lambda ) T u = \mathcal { P } ( \Lambda ) \mathcal { P } ^ { - 1 } ( \Lambda ) \hat { \mathbf { y } } _ { t } } \\ & { \implies \mathcal { P } ( \Lambda ) T u = \hat { \mathbf { y } } _ { t } . } \end{array}
+$$
+
+To prove the “only if” direction, we have
+
+$$
+\begin{array} { r } { \begin{array} { r } { \mathcal { P } ( \Lambda ) \pmb { T } \pmb { u } = \hat { \mathbf { y } } _ { t } \implies \mathcal { P } ( \Lambda ) \pmb { T } \pmb { u } = \mathcal { P } ( \Lambda ) \mathcal { P } ^ { - 1 } ( \pmb { \Lambda } ) \hat { \mathbf { y } } _ { t } } \\ { \overset { ( i ) } { \implies } \pmb { \Lambda } \pmb { T } \pmb { u } = \pmb { \Lambda } \mathcal { P } ^ { - 1 } ( \pmb { \Lambda } ) \hat { \mathbf { y } } _ { t } , } \end{array} } \end{array}
+$$
+
+where (i) is due to the property in Eq. (10). This completes the proof for both directions.
+
+Theorem 1. The solution of Eq. (8) can be given by
+
+$$
+\hat { \mathbf { x } } _ { t _ { i } } ^ { \prime } = \pmb { T } ^ { - 1 } [ \lambda \pmb { \Lambda } \mathcal { P } ^ { - 1 } ( \pmb { \Lambda } ) \hat { \mathbf { y } } _ { t _ { i } } + ( 1 - \lambda ) \pmb { \Lambda } \pmb { T } \hat { \mathbf { x } } _ { t _ { i } } + ( \pmb { I } - \pmb { \Lambda } ) \pmb { T } \hat { \mathbf { x } } _ { t _ { i } } ] ,
+$$
+
+where $\mathcal { P } ^ { - 1 } ( \mathbf { \Lambda } ) : \mathbb { R } ^ { m } \mathbb { R } ^ { n }$ denotes any right inverse of ${ \mathcal { P } } ( \Lambda )$ .
+
+Proof. The optimization objective function in Eq. (8) can be written as
+
+$$
+\begin{array} { r l } & { \quad ( 1 - \lambda ) \left\| z - \hat { \mathbf { x } } _ { t } \right\| _ { T } ^ { 2 } + \lambda \left\| z - u \right\| _ { T } ^ { 2 } } \\ & { = ( 1 - \lambda ) \left\| T z - T \hat { \mathbf { x } } _ { t } \right\| _ { 2 } ^ { 2 } + \lambda \left\| T z - T u \right\| _ { 2 } ^ { 2 } } \\ & { = ( 1 - \lambda ) \left\| T z - T \hat { \mathbf { x } } _ { t } \right\| _ { 2 } ^ { 2 } + \lambda \left\| \Lambda T ( z - u ) + ( I - \Lambda ) T ( z - u ) \right\| _ { 2 } ^ { 2 } } \\ & { = ( 1 - \lambda ) \left\| T z - T \hat { \mathbf { x } } _ { t } \right\| _ { 2 } ^ { 2 } + \lambda \left\| \Lambda T ( z - u ) \right\| _ { 2 } ^ { 2 } + \lambda \left\| ( I - \Lambda ) T ( z - u ) \right\| _ { 2 } ^ { 2 } } \\ & { = ( 1 - \lambda ) \left\| T z - T \hat { \mathbf { x } } _ { t } \right\| _ { 2 } ^ { 2 } + \lambda \left\| \Lambda T z - \Lambda \mathcal { P } ^ { - 1 } ( \Lambda ) \hat { \mathbf { y } } _ { t } \right\| _ { 2 } ^ { 2 } + \lambda \left\| ( I - \Lambda ) T ( z - u ) \right\| _ { 2 } ^ { 2 } } \end{array}
+$$
+
+
+Figure 6: SSIM vs. numbers of measurements. Shaded areas represent standard deviation. (Left) MRI on BraTS. (Center) CT on LIDC. (Right) Comparing score-based generative models for undersampled MRI reconstruction on BraTS.
+
+
+Figure 7: Examples of metal artifact removal on LIDC. You may zoom in to view more details.
+
+Since $\mathbf { \nabla } A \mathbf { u } = \hat { \mathbf { y } } _ { t }$ , we have $\mathcal { P } ( \mathbf { A } ) \pmb { T } \pmb { u } = \hat { \mathbf { y } } _ { t }$ and equivalently $\Lambda T u = \Lambda \mathcal { P } ^ { - 1 } ( \Lambda ) \hat { \mathbf { y } } _ { t }$ due to Lemma 1. This constraint does not restrict the value of $( I - \Lambda ) T u$ . Therefore, when $\mathbf { \nabla } A \mathbf { u } = \hat { \mathbf { y } } _ { t }$ , we have
+
+$$
+\begin{array} { r l } & { \quad \left\| z - \dot { \mathbf { x } } _ { t } \right\| _ { T } ^ { 2 } + \operatorname* { m i n } ( 1 - \lambda ) \lambda \left\| z - u \right\| _ { T } ^ { 2 } } \\ & { = ( 1 - \lambda ) \left\| T z - T \hat { \mathbf { x } } _ { t } \right\| _ { 2 } ^ { 2 } + \operatorname* { m i n } \lambda \left\| \Lambda T z - \Lambda \mathcal { P } ^ { - 1 } ( \Lambda ) \hat { \mathbf { y } } _ { t } \right\| _ { 2 } ^ { 2 } + \lambda \left\| ( I - \Lambda ) T ( z - u ) \right\| _ { 2 } ^ { 2 } } \\ & { - ( 1 - \lambda ) \left\| T z - T \hat { \mathbf { x } } _ { t } \right\| _ { 2 } ^ { 2 } + \lambda \left\| \Lambda T z - \Lambda \mathcal { P } ^ { - 1 } ( \Lambda ) \hat { \mathbf { y } } _ { t } \right\| _ { 2 } ^ { 2 } } \\ & { = ( 1 - \lambda ) \left\| \Lambda T z - \Lambda T \hat { \mathbf { x } } _ { t } \right\| _ { 2 } ^ { 2 } + \lambda \left\| \Lambda T z - \Lambda \mathcal { P } ^ { - 1 } ( \Lambda ) \hat { \mathbf { y } } _ { t } \right\| _ { 2 } ^ { 2 } + ( 1 - \lambda ) \left\| ( I - \Lambda ) T z - ( I - \Lambda ) T \hat { \mathbf { x } } _ { t } \right\| _ { 2 } ^ { 2 } } \end{array}
+$$
+
+This simplifies the optimization problem in Eq. (8) to
+
+$\operatorname* { n i n } _ { z } ( 1 - \lambda ) \left\| \Lambda T z - \Lambda T \hat { \mathbf { x } } _ { t } \right\| _ { 2 } ^ { 2 } + \lambda \left\| \Lambda T z - \Lambda \mathcal { P } ^ { - 1 } ( \Lambda ) \hat { \mathbf { y } } _ { t } \right\| _ { 2 } ^ { 2 } + ( 1 - \lambda ) \left\| ( I - \Lambda ) T z - ( I - \Lambda ) T \hat { \mathbf { x } } _ { t } \right\| _ { 2 } ^ { 2 } ,$ k 22 , which is minimizing a quadratic function of $_ z$ . The optimal solution $z ^ { * }$ is thus in closed form:
+
+$$
+\begin{array} { r } { z ^ { * } = \pmb { T } ^ { - 1 } [ ( \pmb { I } - \pmb { \Lambda } ) \pmb { T } \hat { \mathbf { x } } _ { t } + ( 1 - \lambda ) \pmb { \Lambda } \pmb { T } \hat { \mathbf { x } } _ { t } + \lambda \pmb { \Lambda } \pmb { \mathcal { P } } ^ { - 1 } ( \pmb { \Lambda } ) \hat { \mathbf { y } } _ { t } ] . } \end{array}
+$$
+
+According to the definition, $\hat { \mathbf { x } } _ { t } ^ { \prime } = z ^ { * }$ , whereby the proof is completed.
+
+# B ADDITIONAL EXPERIMENTAL DETAILS
+
+# B.1 ADDITIONAL RESULTS
+
+In Fig. 6, we provide SSIM results versus the number of measurements for multiple methods and tasks. In general, the SSIM curves have very similar trends to the PSNR curves in Fig. 5. We additionally provide a visualization of metal artifact removal results in Fig. 7.
+
+# B.2 THE TASK OF METAL ARTIFACT REMOVAL
+
+Metallic implants in an object can cause strong metal artifacts in CT imaging. As shown in Fig. 8, the source of artifacts come from extremely bright regions in the sinogram, called metal traces. To reduce or ideally remove metal artifacts from a CT image, we remove metal traces from the sinogram and leverage the data prior to complete the sinogram. As a result, metal artifact removal can be viewed as an inverse problem, where the measurement process gives the full sinogram except for the metal trace region, and our goal is to reconstruct the full CT image using this partially known sinogram, which will be artifact-free assuming perfect inpainting of the sinogram.
+
+
+Figure 8: The linear measurement process of metal artifact removal.
+
+# B.3 DETAILS OF DATASETS
+
+CT datasets We conduct experiments of 2D CT image reconstruction on two datasets. First, the Lung Image Database Consortium image collection (LIDC) (Armato III et al., 2011; Clark et al., 2013) consists of diagnostic and lung cancer screening thoracic computed tomography (CT) scans for lung cancer detection and diagnosis, which contains 1018 cases. Second, the Low Dose CT Image and Projection dataset (LDCT) (Clark et al., 2013; Moen et al., 2021) involves CT images of multiple anatomic sites, including 99 head CT scans, 100 chest CT scans, and 100 abdomen CT scans. Note that for the LDCT dataset, we only use the full-dose CT images in our experiments. In CT image processing, we convert the Hounsfield units from dicom files to the attenuation coefficients and set the background pixels to zero. Then, 2D CT images are sliced from 3D CT volumes. The sinograms are simulated from 2D CT images based on parallel-beam geometry with different number of projection angles that are equally distributed across 180 degrees.
+
+MRI dataset The Brain Tumor Segmentation (BraTS) 2021 dataset (Menze et al., 2014; Bakas et al., 2017) collected for the image segmentation challenge contains 2000 cases (8000 MRI scans), where each case has four different MR contrasts: native (T1), post-contrast T1-weighted (T1Gd), T2-weighted (T2), and T2 Fluid Attenuated Inversion Recovery (T2-FLAIR). For each 3D MR volume, we extract 2D slices from 3D volumes and simulate k-space data by Fast Fourier Transform. To reconstruct MR images, we follow Knoll et al. (2020); Zbontar et al. (2018) to undersample $\mathbf { k }$ -space data with an equispaced Cartesian mask, where the center k-space is fully sampled while the left $\mathbf { k }$ -space is under-sampled by equispaced columns.
+
+# B.4 DETAILS OF SCORE-BASED GENERATIVE MODELS
+
+We use the ${ \mathrm { N C S N } } { + + }$ model architecture in Song et al. (2021), and perturb the data with the Variance Exploding (VE) SDE. Our training procedure follows that of Song et al. (2021). Instead of generating samples according to the numerical SDE solver in Algorithm 1, we use the Predictor-Corrector (PC) sampler as described in Song et al. (2021) since it generally has better performance for VE SDEs. In PC samplers, the predictor refers to a numerical solver for the reverse-time SDE while the corrector can be any Markov chain Monte Carlo (MCMC) method that only depends on the scores. One such MCMC method considered in this work is Langevin dynamics, whereby we transform any initial sample $\mathbf { x } ^ { ( 0 ) }$ to an approximate sample from $p _ { t } ( \mathbf { x } )$ via the following procedure:
+
+$$
+\begin{array} { r } { \mathbf { x } ^ { ( i + 1 ) } \gets \mathbf { x } ^ { ( i ) } + \epsilon \nabla _ { \mathbf { x } } \log p _ { t } ( \mathbf { x } ^ { ( i ) } ) + \sqrt { 2 \epsilon } \mathbf { z } ^ { ( i ) } , \quad i = 0 , 1 , \cdots , N - 1 . } \end{array}
+$$
+
+Here $N \in \mathbb { N } _ { > 0 } , \epsilon > 0$ , and $\mathbf { z } ^ { ( i ) } \sim \mathcal { N } ( \mathbf { 0 } , I )$ . The theory of Langevin dynamics guarantees that in the limit of $N \infty$ and $\epsilon \to 0 , \mathbf { x } ^ { ( N ) }$ is a sample from $p _ { t } ( \mathbf { x } )$ under some regularity conditions. Note that Langevin dynamics only requires the knowledge of $\nabla _ { \mathbf { x } } \log p _ { t } ( \mathbf { x } )$ , which can be approximated using the time-dependent score model $s \mathbf { \boldsymbol { \theta } } \ast \left( \mathbf { \boldsymbol { x } } , t \right)$ . In PC samplers, each predictor step immediately follows multiple consecutive corrector steps, all using the same $s _ { \theta ^ { * } } ( \mathbf { x } , t )$ evaluated at the same $t$ . This jointly ensures that our intermediate sample at $t$ is approximately distributed according to $p _ { t } ( \mathbf { x } )$ . As shown in Song et al. (2021), PC sampling often outperforms numerical solvers for the reverse-time SDE, especially when the forward SDE in Eq. (1) is a VE SDE. In order to use PC samplers for inverse problem solving, our modification is similar to the change made in Algorithm 2 for Algorithm 1. Specifically, we run line 4 & 5 in Algorithm 2 before every corrector or predictor step.
+
+When comparing our approach to previous methods with score-based generative models, we use the same score model to isolate the confounding factors in model training and architecture design. Moreover, we make sure the total cost of sampling is comparable across different methods. For the ALD sampler used in Jalal et al. (2021), we use 700 noise scales with 3 steps of Langevin dynamics per noise scale, resulting in a total of $7 0 0 \times 3 = 2 1 0 0$ steps that require score function evaluation. For the PC sampler, we use 1000 noise scales and 1 step of Langevin dynamics per noise scale, totalling $1 0 0 0 + 1 0 0 0 = 2 0 0 0$ steps of score model evaluation.
+
+For PC samplers, the step size $\epsilon$ in Langevin dynamics is determined by a signal-to-noise ratio $\eta$ . For all methods, we tune $\eta$ and $\lambda$ in Eq. (8) with 100 steps of Bayesian optimization on a validation dataset, and report the results on the test dataset with the optimal parameters. We use the $\mathsf { a x } - \mathsf { p } \bot$ atform toolkit for Bayesian optimization. The optimal parameters in our experiments are given by
+
+• Sparse-view CT on LIDC $3 2 0 \times 3 2 0$ : $\eta = 0 . 2 4 6$ , $\lambda = 0 . 8 4 1$ .
+• Metal artifact removal on LIDC $3 2 0 \times 3 2 0$ : $\eta = 0 . 2 0 9$ , $\lambda = 0 . 2 2 7$ .
+• Sparse-view CT on LDCT $5 1 2 \times 5 1 2$ : $\eta = 0 . 4 , \lambda = 0 . 7 2$ .
+• Accelerated MRI on BraTS $2 4 0 \times 2 4 0$ : $\eta = 0 . 5 7 7$ , $\lambda = 0 . 9 8 2$ .
+
+B.5 TRAINING DETAILS OF BASELINE MODELS
+
+B.5.1 BASELINE MODELS FOR SPARSE-VIEW CT RECONSTRUCTION
+
+FBP Filtered back projection (FBP) is a standard way for CT image reconstruction, which simply put the projections (sinogram) back to the image space based on the corresponding projection angles and geometry to get an approximated estimation of the unknown image. Usually, a high-pass filter, ramp filter is used to eliminate the blurring during this process. In our experiments, we conduct FBP on sparse-view sinograms using the torch radon toolbox (Ronchetti, 2020).
+
+FISTA-TV FISTA-TV is a fast iterative shrinkage-thresholding algorithm (FISTA) for solving linear inverse problems in image processing (Beck & Teboulle, 2009). It adopts a total variation (TV) term as the regularization in the optimization procedure. Each optimization iteration involves a matrixvector multiplication followed by a shrinkage-threshold step. In experiments, FISTA is implemented using the tomobar toolbox (Kazantsev & Wadeson, 2020) with the regularization using the CCPi regularisation toolkit (Kazantsev et al., 2019). We run 300 iterations for reconstructing each CT image with regularization parameter 0.001. Considering the nature of iterative reconstruction in FISTA, it is quite natural to generalize this method to different number of projections for reconstructing CT images. In experiments of generalizing to different number of measurements, FISTA method takes as input the sinogram with different numbers of projections and the corresponding angles for these input projections for the iterative procedure.
+
+cGAN Conventional iterative CT reconstruction algorithms like FISTA are typically slow due to their iterative nature. Ghani & Karl (2018) proposed to cast sparse-view CT reconstruction as a sinogram inpainting problem. Specifically, it used a conditional generative adversarial network (cGAN) to first complete the sinogram data prior to reconstructing CT images, thereby avoiding the costly iterative tomographic processing. However, the imperfect sinogram inpainting may further cause image artifacts. Specifically, cGAN model takes zero-padded sparse-view sinogram with 23 projections as input and generates the completed full-angle sinogram with 180 projections. The cGAN model was implemented using PyTorch (Paszke et al., 2019) and trained using a batchsize of 64 and learning rate of 0.0001 with 50 epochs in total. In experiments of generalizing to different number of measurements, we deployed the trained cGAN model by zero-padding sparse-view sinogram with different numbers of projections to full-view sinogram as the input. After obtaining the output inpainted sinogram, we replace the corresponding projections in the output based on the ground truth projections in the input. Finally, the images were reconstructed from the overlayed sinogram. Note that we trained the model using 23 projections and tested it on other projection settings to evaluate the generalization.
+
+SIN- $\mathbf { 4 c }$ -PRN To further reduce the artifacts in both sinogram and image space, SIN- $. 4 \mathrm { c }$ -PRN (Wei et al., 2020) proposed a two-step sparse-view CT reconstruction model. It involves a sinogram inpainting network (SIN) to generate super-resolved sinograms with different number of projections, and then a post-processing refining network (PRN) to further remove image artifacts. Both networks are connected through a filtered back-projection operation (FBP). Specifically, SIN model takes 23- view sinogram as input to fistly upsample to full-view sinogram and then generate sinograms through network for 23, 45, 90, 180 projections respectively. FBP transforms these generated sinograms to image space, which was then concatenated and feed into PRN model for refinement. The framework was implemented using PyTorch (Paszke et al., 2019) while FBP operation was implemented using . SIN model was trained using a batchsize of 20 and learning rate of 0.0001, while PRN model was trained using a batchsize of 15 and learning rate of 0.0001. Considering that LIDC dataset is much larger than LDCT dataset, the SIN- $_ { \cdot 4 \mathrm { c } }$ -PRN model was trained for 30 epochs on LIDC dataset and 50 epochs on LDCT dataset. To deploy the trained SIN model to different numbers of measurements, the sinograms with various number of projections are taken as the input for SIN model to generate multi-view sinograms, which were also overlayed with corresponding ground truth projections in inputs. The generated multi-view sinograms are then used for PRN model inference. Since SIN- $_ \mathrm { 4 c }$ -PRN model involves the dual-domain learning in both sinogram and image spaces to remove artifacts, and generates multi-scale sinograms during sinogram inpainting, it shows a better generalization to different numbers of measurements compared with cGAN model as shown in Figure 5 and Figure 6.
+
+Neumann Meanwhile, in another parallel direction, researchers proposed to learn the regularizer used in optimization from training data, outperforming traditional regularizers. Specifically, Gilton et al. (2019) presented an end-to-end, data-driven method for learning a nonlinear regularizer for solving inverse problems inspired by the Neumann series, called Neumann network. Neumann network was implemented using PyTorch (Paszke et al., 2019). Due to GPU memory constraints, the model training used the batchsize of 5 on LIDC dataset and the batchsize of 2 on LDCT dataset. The initial learning rate was 0.00001 with an exponential learning rate decay. The network was trained with 15 training epochs on both datasets.
+
+# B.5.2 BASELINE MODELS FOR UNDERSAMPLED MRI RECONSTRUCTION
+
+DuDoRNet Zhou & Zhou (2020) proposed a dual domain recurrent network (DuDoRNet) to simultaneously recover k-space data and images for MRI reconstruction, in order to address aliasing artifacts in both frequency and image domains. The original model in Zhou & Zhou (2020) also embedded a deep T1 prior to make use of fully-sampled short protocol (T1) as complementary information. For a fair comparison with other supervised learning approaches, in our experiments, we do not include this additional information but train the DuDoRNet model without T1 prior. The DuDoRNet was trained using a batchsize of 6 and a learning rate of 0.0005 with 5 training epochs. In experiments of generalizing to different number of measurements, we trained the model with an acceleration factor of 8 and deployed the trained model to other acceleration factors during testing. Specifically, for inference, we use different Cartesian masking function corresponding to different acceleration factors or down-sampling ratios to sub-sample the $\mathbf { k }$ -space data for the network input with the corresponding initial reconstructed image with zero-padding $\mathbf { k }$ -space.
+
+Cascade DenseNet To reconstruct de-aliased MR images from under-sampled k-space data, Zheng et al. (2019) proposed a cascaded dilated dense network (CDDN) for MRI reconstruction, based on stacked dense blocks with residual connections while using the zero-filled MR image as inputs. Specifically, they used a two-step data consistency layer for k-space correction, and replaced corresponding phase-coding lines of the generated image with the original sampled k-space data after each block. In experiments, we trained the model using a batchsize of 8 and a learning rate of 0.0001, with 5 epochs on BraTS dataset. In experiments of generalizing to different number of measurements, we trained the model with an acceleration factor of 8 and deployed the trained model to other acceleration factors during testing. Similarly, different masking functions corresponding to different acceleration factors were used to sub-sample $\mathbf { k }$ -space data to get network inputs. From results, we observe that
+
+Cascaded DenseNet generalizes better to more measurements than DuDoRNet as shown in Figure 5 and Figure 6.
+
+# B.5.3 BASELINE MODELS FOR METAL ARTIFACT REMOVAL
+
+LI One straightforward way for reducing metal artifacts is to complete or inpaint the metal-affected missing regions in sinogram directly through linear interpolation (Kalender et al., 1987). This method does not need any network training. However, the imperfect completion of sinogram may introduce secondary artifacts to the reconstructed image. In our experiments setting, to fit for the practical applications in real world, we assume the ground truth metal trace and mask information are unknown, which can only be estimated by a rough thresholding in artifacts-affected images. We use the estimated metal mask and metal trace for linear interpolation baseline.
+
+cGANMAR Wang et al. (2018) proposed a conditional generative adversarial network (cGAN)- based approach for metal artifacts reduction (MAR) in CT. Specifically, cGANMAR network learns the mapping directly from the artifacts-affected CTs to artifacts-free CTs through refinement in image space. The cGANMAR model was implemented using PyTorch (Paszke et al., 2019) and was trained with the batchsize of 64 and the learning rate of 0.0001. The network was trained with 400 epochs.
+
+SNMAR Yu et al. (2020) proposed a sinogram completion neural network (SinoNet) to recover the metal-affected projections. Especially, it leveraged the learning in both sinogram domain and image domain by using a prior network to generate a good prior image to guide sinogram learning. Note that in original setting, SNMAR required linear interpolated sinogram and CT as inputs and used ground truth metal trace and mask information to generated them. But in our method, we assume the ground truth metal trace and mask information are unknown according to practical scenario and estimate it by a rough thresholding, which will introduce estimation errors. In SNMAR experiments, we still follow the original setting to guarantee the best performance of this baseline method for a strong comparison. We trained the SNMAR using the batchsize of 64 and the learning rate of 0.0001, with a total of 100 training epochs.
\ No newline at end of file
diff --git a/md/dev/vbPsD-BhOZ/vbPsD-BhOZ.md b/md/dev/vbPsD-BhOZ/vbPsD-BhOZ.md
new file mode 100644
index 0000000000000000000000000000000000000000..f4f3688bc0666e4e32b8997aac8264e3986479c5
--- /dev/null
+++ b/md/dev/vbPsD-BhOZ/vbPsD-BhOZ.md
@@ -0,0 +1,388 @@
+# Neural Sheaf Diffusion: A Topological Perspective on Heterophily and Oversmoothing in GNNs
+
+Cristian Bodnar∗ University of Cambridge cristian.bodnar@cl.cam.ac.uk
+
+Francesco Di Giovanni† Twitter fdigiovanni@twitter.com
+
+Benjamin P. Chamberlain Twitter
+
+Pietro Liò University of Cambridge
+
+Michael Bronstein University of Oxford & Twitter
+
+# Abstract
+
+Cellular sheaves equip graphs with a “geometrical” structure by assigning vector spaces and linear maps to nodes and edges. Graph Neural Networks (GNNs) implicitly assume a graph with a trivial underlying sheaf. This choice is reflected in the structure of the graph Laplacian operator, the properties of the associated diffusion equation, and the characteristics of the convolutional models that discretise this equation. In this paper, we use cellular sheaf theory to show that the underlying geometry of the graph is deeply linked with the performance of GNNs in heterophilic settings and their oversmoothing behaviour. By considering a hierarchy of increasingly general sheaves, we study how the ability of the sheaf diffusion process to achieve linear separation of the classes in the infinite time limit expands. At the same time, we prove that when the sheaf is non-trivial, discretised parametric diffusion processes have greater control than GNNs over their asymptotic behaviour. On the practical side, we study how sheaves can be learned from data. The resulting sheaf diffusion models have many desirable properties that address the limitations of classical graph diffusion equations (and corresponding GNN models) and obtain competitive results in heterophilic settings. Overall, our work provides new connections between GNNs and algebraic topology and would be of interest to both fields.
+
+
+Figure 1: A sheaf $( G , { \mathcal { F } } )$ shown for a single edge of the graph. The stalks are isomorphic to $\mathbf { \bar { \mathbb { R } } ^ { 2 } }$ . The restriction maps $\mathcal { F } _ { v \le e }$ , $\mathcal { F } _ { u \leq e }$ and their adjoints move the vector features between these spaces. In practice, we learn the sheaf (i.e. the restrictions maps) from data via a parametric function $\Phi$ .
+
+
+Figure 2: Analogy between parallel transport on a sphere and transport on a discrete vector bundle (cellular sheaf). A tangent vector is moved from ${ \mathcal { F } } ( w ) \to { \mathcal { F } } ( v ) \ { \overset { } { \to } } \ F ( u )$ and back. Because the vector returns in a different position, the transport is not pathindependent.
+
+# 1 Introduction
+
+Graph Neural Networks (GNNs) [12, 20, 27–29, 39, 58, 64] have recently become very popular in the ML community as a model of choice to deal with relational and interaction data due to their multiple successful applications in domains ranging from social science and particle physics to structural biology and drug design. In this work, we focus on two main problems often observed in GNNs: their poor performance in heterophilic graphs [75] and their oversmoothing behaviour [48, 50]. The former arises from the fact that many GNNs are built on the strong assumption of homophily, i.e., that nodes tend to connect to other similar nodes. The latter refers to a phenomenon of some deeper GNNs producing features that are too smooth to be useful.
+
+Contributions. We show that these two fundamental problems are linked by a common cause: the underlying “geometry” of the graph (used here in a very loose sense). When this geometry is trivial, as is typically the case, the two phenomena described above emerge. We make these statements precise through the lens of (cellular) sheaf theory [10, 18, 26, 44, 56, 62], a subfield of algebraic topology and geometry. Intuitively, a cellular sheaf associates a vector space to each node and edge of a graph, and a linear map between these spaces for each incident node-edge pair (Figure 1).
+
+In Section 3, we analyse how by considering a hierarchy of increasingly general sheaves, starting from a trivial one, a diffusion equation based on the sheaf Laplacian [34] can solve increasingly more complicated node-classification tasks in the infinite time limit. In this regime, we show that oversmoothing and problems due to heterophily can be avoided by equipping the graph with the right sheaf structure for the task. In Section 4, we study the behaviour of a non-linear, parametric, and discrete version of this process. This results in a Sheaf Convolutional Network [32] that generalises Graph Convolutional Networks [39]. We prove that this discrete diffusion process is more flexible and has greater control over its asymptotic behaviour than GCNs [13, 51]. All these results are based on the properties of the harmonic space of the sheaf Laplacian, which we study from a spectral perspective in Section 3.1. We provide a new Cheeger-type inequality for the spectral gap of the sheaf Laplacian and note that these results might be of independent interest for spectral sheaf theory [34]. Finally, in Section 5, we apply our theory to designing simple and practical GNN models. We describe how to construct Sheaf Neural Networks by learning sheaves from data, thus making these types of models applicable beyond the toy experimental setting where they were originally introduced [32]. The resulting models obtain competitive results both in heterophilic and homophilic graphs.
+
+# 2 Background
+
+Cellular Sheaves. A cellular sheaf [18, 62] over a graph (Figure 1) is a mathematical object associating a vector space to each node and edge in the graph and a map between these spaces for each incident node-edge pair. We define this formally below:
+
+Definition 1. A cellular sheaf $( G , { \mathcal { F } } )$ on an undirected graph $G = ( V , E )$ consists of:
+
+• A vector space $\mathcal { F } ( v )$ for each $v \in V$ .
+• A vector space $\mathcal { F } ( e )$ for each $e \in E$ .
+• A linear map $\mathcal { F } _ { v \le e } : \mathcal { F } ( v ) \to \mathcal { F } ( e )$ for each incident $v \leq e$ node-edge pair.
+
+The vector spaces of the nodes and edges are called stalks, while the linear maps are referred to as restriction maps. The space formed by all the spaces associated with the nodes of the graph is called the space of 0-cochains $C ^ { 0 } ( G ; \mathcal { F } ) : = \mathsf { \bar { Q } } _ { v \in V } \mathcal { \bar { F } } ( v )$ , where $\oplus$ denotes the direct sum of vector spaces. For a 0-cochain $\mathbf { x } \in C ^ { 0 } ( G ; { \mathcal { F } } )$ , we use $\mathbf { x } _ { v }$ to refer to the vector in $\mathcal { F } ( v )$ of node $v$ . Hansen and Ghrist [35] have constructed a convenient mental model for these objects based on opinion dynamics. In this context, $\mathbf { x } _ { v }$ is the ‘private opinion’ of node $v$ , while $\mathcal { F } _ { v \leq e } \mathbf { x } _ { v }$ expresses how that opinion manifests publicly in a ‘discourse space’ formed by $\mathcal { F } ( e )$ . A particularly important subspace of $C ^ { 0 } ( G ; { \mathcal { F } } )$ is the space of global sections $H ^ { 0 } ( G ; { \mathcal { F } } ) : = \{ \dot { \mathbf { x } } \in C ^ { 0 } ( G ; { \mathcal { F } } ) : { \dot { \mathcal { F } } } _ { v \exists e } { \dot { \mathbf { x } } } _ { v } = { \mathcal { F } } _ { u \exists e } { \dot { \mathbf { x } } } _ { u } \}$ containing those private opinions $\mathbf { x }$ for which all neighbours $( v , u )$ agree with each other in the discourse space. Given a cellular sheaf $( G , { \mathcal { F } } )$ , we can define a sheaf Laplacian operator [34] measuring the aggregated ‘disagreement of opinions’ at each node:
+
+Definition 2. The sheaf Laplacian of a sheaf $( G , { \mathcal { F } } )$ is a linear map $L _ { { \mathcal { F } } } : C ^ { 0 } ( G , { \mathcal { F } } ) \to C ^ { 0 } ( G , { \mathcal { F } } )$ defined node-wise as $\begin{array} { r } { L _ { \mathcal { F } } ( \mathbf { x } ) _ { v } : = \sum _ { v , u \leq e } \mathcal { F } _ { v \leq e } ^ { \top } ( \mathcal { F } _ { v \leq e } \mathbf { x } _ { v } - \mathcal { F } _ { u \leq e } \mathbf { x } _ { u } ) } \end{array}$ .
+
+
+Figure 3: A graph (left), the Laplacian matrix of a sheaf with $d$ -dimensional stalks over the graph (middle) , and a 0-cochain $\mathbf { x }$ represented as a block-vector stacking the vectors of all nodes $( r i g h t )$ .
+
+The sheaf Laplacian is a positive semi-definite block matrix (Figure 3). The diagonal blocks are $\begin{array} { r } { L _ { \mathcal { F } v v } = \sum _ { v \preceq e } \mathcal { F } _ { v \preceq e } ^ { \top } \mathcal { F } _ { v \preceq e } \widehat { } } \end{array}$ , while the non-diagonal blocks $L _ { \mathcal { F } v u } = - \mathcal { F } _ { v \leq e } ^ { \top } \mathcal { F } _ { u \leq e }$ . Denoting by $D$ the block-diagonal of $L _ { \mathcal { F } }$ , the normalised sheaf Laplacian is given by $\Delta _ { \mathcal { F } } \overset { - } { : = } D ^ { - 1 / 2 } L _ { \mathcal { F } } D ^ { - 1 / 2 }$ . For simplicity, we assume that all the stalks have a fixed dimension $d$ . In that case, the sheaf Laplacian is a $n d \times n d$ real matrix, where $n$ is the number of nodes of $G$ . When the vector spaces are set to $\mathbb { R }$ (i.e., $d = 1$ ) and the linear maps to the identity map over $\mathbb { R }$ , the underlying sheaf is trivial and one recovers the well-known $n \times n$ graph Laplacian matrix and its normalised version $\Delta _ { 0 }$ . In general, $\Delta { _ { \mathcal { F } } }$ is preferred to $L _ { \mathcal { F } }$ for most practical purposes due to its bounded spectrum and, therefore, we focus on the former. A cochain $\mathbf { x }$ is called harmonic if $L _ { \mathcal { F } } \mathbf { x } = 0$ or, equivalently, if $\mathbf { x } \in \ker ( L _ { \mathcal { F } } )$ . This means harmonic cochains are characterised by zero disagreements along all the edges of the graph, and it is not difficult to see that, in fact, $H ^ { 0 } ( G ; { \mathcal { F } } )$ and $\ker ( L _ { \mathcal { F } } )$ are isomorphic as vector spaces [35].
+
+The sheaves with orthogonal maps (i.e. ${ \mathcal { F } } _ { v \leq e } \in O ( d )$ the Lie group of $d \times d$ orthogonal matrices) provide a more geometric interpretation of sheaves and play an important role in our analysis. Such sheaves are called discrete $O ( d )$ bundles and can be seen as a discrete version of vector bundles [24, 60, 73] from differential geometry [67]. Intuitively, these objects describe vector spaces attached to the points of a manifold. In our discrete case, the role of the manifold is played by the graph, and the sheaf Laplacian describes how the elements of a vector space are transported via rotations in another neighbouring vector space similarly to how tangent vectors are moved across a manifold via parallel transport (connection; see Figure 2). Due to this analogy, the sheaf Laplacian on $O ( d )$ bundles is also referred to as connection Laplacian [63].
+
+Heat Diffusion and GCNs. Consider a graph with adjacency matrix $\mathbf { A }$ , diagonal degree matrix $\mathbf { D }$ , normalised graph Laplacian $\Delta _ { 0 } : = \mathbf { I } - \mathbf { D } ^ { - 1 / 2 } \mathbf { A } \mathbf { D } ^ { - 1 / 2 }$ , and an $n \times f$ feature matrix $\mathbf { X }$ . We can define the heat diffusion equation and its Euler discretisation with a unit step as follows:
+
+$$
+\dot { \mathbf { X } } ( t ) = - \Delta _ { 0 } \mathbf { X } ( t ) \ \longleftrightarrow \ \mathbf { X } ( t + 1 ) = \mathbf { X } ( t ) - \Delta _ { 0 } \mathbf { X } ( t ) = ( \mathbf { I } - \Delta _ { 0 } ) \mathbf { X } ( t ) .
+$$
+
+Comparing this with the Graph Convolutional Network [39] model, we observe that GCN is an augmented heat diffusion process with an additional $f \times f$ weight matrix W and a nonlinearity $\sigma$ :
+
+$$
+\operatorname { G C N } ( \mathbf { X } , \mathbf { A } ) : = \sigma ( \mathbf { D } ^ { - 1 / 2 } \mathbf { A } \mathbf { D } ^ { - 1 / 2 } \mathbf { X } \mathbf { W } ) = \sigma ( ( \mathbf { I } - \Delta _ { 0 } ) \mathbf { X } \mathbf { W } ) .
+$$
+
+From this perspective, it is perhaps not surprising that GCN is particularly affected by heterophily and oversmoothing since heat diffusion makes the features of neighbouring nodes increasingly smooth. In what follows, we consider a much more general and powerful family of (sheaf) diffusion processes leading to more expressive sheaf convolutions.
+
+# 3 The Expressive Power of Sheaf Diffusion
+
+Preliminaries. Let us now assume $G$ to be a graph with $d$ -dimensional node feature vectors $\mathbf { x } _ { v } \in \mathcal { F } ( v )$ . The features of all nodes are represented as a single vector $\mathbf { x } \in C ^ { 0 } ( G ; { \mathcal { F } } )$ stacking all the individual $d$ -dimensional vectors (Figure 3). Additionally, if we allow for $f$ feature channels, everything can be represented as a matrix $\mathbf { X } \in \mathbb { R } ^ { ( n d ) \times f }$ , whose columns are vectors in $C ^ { 0 } ( G ; { \mathcal { F } } )$ We are interested in the spatially discretised sheaf diffusion process governed by the following PDE:
+
+$$
+\mathbf { X } ( 0 ) = \mathbf { X } , \quad \dot { \mathbf { X } } ( t ) = - \Delta \ v { \tau } _ { \mathcal { F } } \mathbf { X } ( t ) .
+$$
+
+It can be shown that in the time limit, each feature channel is projected into $\ker ( \Delta \tau )$ [34]. As described above (up to a $D ^ { - 1 / 2 }$ normalisation), this space contains the signals that agree with the restriction maps of the sheaf along all the edges. Thus, sheaf diffusion can be seen as a ‘synchronisation’ process over the graph, where all the private opinions converge towards global agreement.
+
+In this section, we investigate the expressive power of this process within the infinite time limit. Because the asymptotic behaviour of sheaf diffusion is determined by the properties of $\ker ( \Delta _ { \mathcal { F } } )$ , in Section 3.1, we investigate when this subspace is non-trivial (i.e. it contains more than just the zero vector). In Section 3.2, we use this characterisation of the harmonic space to study what sort of sheaf diffusion processes will asymptotically produce projections into $\ker ( \Delta \tau )$ that can linearly separate the classes for various kinds of graphs and initial conditions. Since diffusion converges exponentially fast, the following results are also relevant for models with finite integration time or layers.
+
+# 3.1 Harmonic Space of Sheaf Laplacians
+
+A major role in the analysis below is played by discrete vector bundles, and we concentrate on this case. We note though that our results below generalise to the general linear group $\mathcal { F } _ { v \leq e } \in G L ( d )$ , the Lie group of $d \times d$ invertible matrices, provided we can also control the norm of the restriction maps from below. Given a discrete $O ( d )$ -bundle, $\mathcal { F } _ { v \le e } ^ { \top } \mathcal { F } _ { v \le e } = \mathbf { I } _ { d }$ and the block diagonal of $L _ { \mathcal { F } }$ has a diagonal structure since $\boldsymbol { L } _ { \mathcal { F } _ { v v } } = d _ { v } \mathbf { I } _ { d }$ , where √ $\bar { d } _ { v }$ is the degree of node $v$ . Accordingly, if a signal $\tilde { \mathbf { x } } \in \ker ( L _ { \mathcal { F } } )$ , then the signal $\mathbf { x } : v \mapsto \sqrt { d _ { v } } \tilde { \mathbf { x } } _ { v } \in \ker ( \bar { \Delta _ { \mathcal { F } } } )$ and similarly for the inverse transformation.
+
+Key to our analysis is studying transport operators induced by the restriction maps of the sheaf. Given nodes $v , u \in V$ and a path $\gamma _ { v \to u } = ( v , v _ { 1 } , \ldots , v _ { \ell } , u )$ from $v$ to $u$ , we consider a notion of transport from the stalk $\mathcal { F } ( v )$ to the stalk $\mathcal { F } ( u )$ , constructed by composing restriction maps (and their transposes) along the edges:
+
+$$
+\mathbf { P } _ { v u } ^ { \gamma } : = ( \mathcal { F } _ { u \leq e } ^ { \top } \mathcal { F } _ { v _ { \ell } \leq e } ) \ldots ( \mathcal { F } _ { v _ { 1 } \leq e } ^ { \top } \mathcal { F } _ { v \leq e } ) : \mathcal { F } ( v ) \mathcal { F } ( u ) .
+$$
+
+For general sheaf structures, the graph transport is path dependent, meaning that how the vectors are transported across two nodes depends on the path between them (see Figure 2). In fact, we show that this property characterises the spectral gap of a sheaf Laplacian, i.e. the smallest eigenvalue of $\Delta { _ { \mathcal { F } } }$ .
+
+Proposition 3. If $\mathcal { F }$ is $a$ discrete $O ( d )$ bundle over a connected graph and $r : = { \ o }$ $\begin{array} { r } { \operatorname* { m a x } _ { \gamma _ { v \to u } , \gamma _ { v \to u } ^ { \prime } } | | \mathbf { P } _ { v \to u } ^ { \gamma } - \mathbf { P } _ { v \to u } ^ { \gamma ^ { \prime } } | | } \end{array}$ , then we have $\lambda _ { 0 } ^ { \mathcal { F } } \le r ^ { 2 } / 2$ .
+
+A consequence of this result is that there is always a non-trivial harmonic space (i.e. $\lambda _ { 0 } ^ { \mathcal { F } } = 0 \rangle$ ) if the transport maps generated by an orthogonal sheaf are path-independent (i.e. $r = 0$ ). Next, we address the opposite direction.
+
+Proposition 4. If $\mathcal { F }$ is a discrete $O ( d )$ bundle over a connected graph and $\mathbf { x } \in H ^ { 0 } ( G , { \mathcal { F } } )$ , then for any cycle $\gamma$ based at $v \in V$ we have $\mathbf { x } _ { v } \in \ker ( \mathbf { P } _ { v v } ^ { \gamma } - \mathbf { I } )$ .
+
+This proposition highlights the interplay between the graph and the sheaf structure. A simple consequence of this result is that for any cycle-free subset $S \subset V$ , we have that any sheaf (or connection-) Laplacian restricted to $S$ always admits a non-trivial harmonic space. A natural question connected to the previous result is whether a Cheeger-like inequality holds in the other direction. This turns out to be the case:
+
+Proposition 5. Let $\mathcal { F }$ be a discrete $O ( d )$ bundle over a connected graph $G$ with n nodes and let $| | ( \bar { \mathbf { P } _ { v \to v } ^ { \gamma } } - \mathbf { I } ) \mathbf { x } _ { v } | | \geq \epsilon | | \mathbf { x } _ { v } | |$ for all cycles $\gamma _ { v v }$ . Then $\lambda _ { 0 } ^ { \mathcal { F } } \geq \epsilon ^ { 2 } ( 2 \mathrm { d i a m } ( \tilde { G } ) n d _ { m a x } ) ^ { - 1 }$ .
+
+While the bound above is of little use in practice, it shows how the spectral gap of a sheaf Laplacian is indeed related to the deviation of the transport maps from being path-independent, as measured by $\epsilon$ . We note that the Cheeger-like inequality presented here is not unique, and other types of bounds on $\lambda _ { 0 } ^ { \mathcal { F } }$ have been derived [2]. We conclude this section by further analysing the dimensionality of the harmonic space of discrete $O ( d )$ -bundles:
+
+Lemma 6. Let $\mathcal { F }$ be a discrete $O ( d )$ bundle over a connected graph $G$ . Then $\mathrm { d i m } ( H ^ { 0 } ) \leq d$ and $\mathrm { d i m } ( H ^ { 0 } ) = d$ if and only if the transport is path-independent.
+
+
+Figure 4: Diffusion process on $O ( 2 )$ -bundles progressively separates the classes of the graph.
+
+# 3.2 The Linear Separation Power of Sheaf Diffusion
+
+In what follows, we use the results above to analyse the ability of certain classes of sheaves to linearly separate the features in the limit of the diffusion processes they induce. We utilise this as a proxy for the capacity of certain diffusion processes to avoid oversmoothing.
+
+Definition 7. A hypothesis class of sheaves with $d$ -dimensional stalks $\mathcal { H } ^ { d }$ has linear separation power over a family of graphs $\mathcal { G }$ if for any labelled graph $G = ( V , E ) \in \mathcal { G }$ , there is a sheaf $( { \mathcal { F } } , G ) { \mathrm { { \bar { \in } } } } { \mathcal { H } } ^ { d }$ that can linearly separate the classes of $G$ in the time limit of Equation $^ 3$ for almost all initial conditions.
+
+Note that the restriction to almost all initial conditions is necessary because, in the limit, diffusion behaves like a projection in the harmonic space and there will always be degenerate initial conditions (e.g. the zero matrix) that will yield a zero projection. We will now show how the choice of the sheaf impacts the behaviour of the diffusion process. For this purpose, we will consider a hierarchy of increasingly general classes of sheaves.
+
+Symmetric invertible. $\mathcal { H } _ { \mathrm { s y m } } ^ { d } : = \{ ( \mathcal { F } , G ) : \mathcal { F } _ { v \leq e } = \mathcal { F } _ { u \leq e }$ , $\operatorname* { d e t } ( \mathcal { F } _ { v \leq e } ) \neq 0 \}$ . We note that for $d = 1$ , the sheaf Laplacians induced by this class of sheaves coincides with the set of the wellknown weighted graph Laplacians with strictly positive weights, which also includes the usual graph Laplacian (see proof in Appendix B). Therefore, this hypothesis class is of particular interest since it includes those graph Laplacians typically used by graph convolutional models such as GCN [39] and ChebNet [20]. We first show that this class of sheaf Laplacians can linearly separate the classes in binary classification settings under certain homophily assumptions:
+
+Proposition 8. Let $\mathcal { G }$ be the set of connected graphs $G = ( V , E )$ with two classes $A , B \subset V$ such that for each $v \in A$ , there exists $u \in A$ and an edge $( v , u ) \in E$ . Then $\mathcal { H } _ { \mathrm { s y m } } ^ { 1 }$ has linear separation power over $\mathcal { G }$ .
+
+In contrast, under certain heterophilic conditions, this hypothesis class is not powerful enough to linearly separate the two classes no matter what the initial conditions are:
+
+Proposition 9. Let $\mathcal { G }$ be the set of connected bipartite graphs $G = ( A , B , E )$ , with partitions $A , B$ forming two classes and $| A | = | B |$ . Then $\mathcal { H } _ { \mathrm { s y m } } ^ { 1 }$ cannot linearly separate the classes of any graph in $\mathcal { G }$ for any initial conditions $\mathbf { X } ( 0 ) \in \mathbb { R } ^ { n \times f }$ .
+
+Non-symmetric invertible. $\mathcal { H } ^ { d } : = \{ ( \mathcal { F } , G ) : \operatorname* { d e t } ( \mathcal { F } _ { v \leq e } ) \neq 0 \}$ . This larger hypothesis class addresses the above limitation by allowing non-symmetric relations:
+
+Proposition 10. Let $\mathcal { G }$ contain all the connected graphs $G = ( V , E )$ with two classes $A , B \subseteq V$ . Consider a sheaf $( { \mathcal { F } } ; G ) \in { \mathcal { H } } ^ { 1 }$ with $\mathcal { F } _ { v \le e } = - \alpha _ { e }$ if $v \in A$ and $\mathcal { F } _ { u \leq e } = \alpha _ { e }$ if $u \in B$ with $\alpha _ { e } > 0$ for all $e \in E$ . Then the diffusion induced by $( { \mathcal { F } } ; G )$ can linearly separate the classes of $G$ for almost all initial conditions, and $\mathcal { H } ^ { 1 }$ has linear separation power over $\mathcal { G }$ .
+
+Since $\mathcal { F } _ { v \le e } ^ { \top } \mathcal { F } _ { u \le e } = \pm \alpha _ { e } ^ { 2 }$ , the type of sheaf above can be interpreted as a discrete $O ( 1 )$ -bundle over a weighted graph with edge weights $\alpha _ { e } ^ { 2 }$ and transport maps $\mathcal { F } _ { v \leq e } ^ { \top } \mathcal { F } _ { u \leq e } = - 1$ for the inter-class edges and for the intra-class edges. Intuitively, this type of transport, which is path-independent, polarises the features of the two classes and forces them to take opposite signs in the infinite limit. This provides a sheaf-theoretic explanation for why negatively-weighted edges have been widely adopted in heterophilic settings [7, 17, 72].
+
+So far we have only studied the effects of changing the type of sheaves in dimension one. We now consider the effects of adjusting the dimension of the stalks and begin by stating a fundamental limitation of (sheaf) diffusion when $d = 1$ .
+
+Proposition 11. Let $G$ be a connected graph with $C \geq 3$ classes. Then, $\mathcal { H } ^ { 1 }$ cannot linearly separate the classes of $G$ for any initial conditions $\mathbf { X } ( 0 ) \in \mathbb { R } ^ { n \times f }$ .
+
+This is essentially a consequence of $\mathrm { d i m } \big ( \mathrm { k e r } ( \Delta _ { \mathcal { F } } ) \big ) \leq 1$ in this case, by virtue of Lemma 6. From a GNN perspective, this means that in the infinite depth setting, sufficient stalk width (i.e., dimension $d )$ is needed in order to solve tasks involving more than two classes. Note that $d$ is different from the classical notion of feature channels $f$ . As the result above shows, the latter has no effect on the linear separability of the classes in $d = 1$ . Next, we will see that the former does.
+
+Diagonal invertible. $\mathcal { H } ^ { d } : = \{ ( \mathcal { F } , G )$ : diagonal $\mathcal { F } _ { v \le e }$ , $\operatorname* { d e t } ( \mathcal { F } _ { v \leq e } ) \neq 0 \}$ . The sheaves in this class can be seen as $d$ independent sheaves from $\mathcal { H } ^ { 1 }$ encoded in the $d$ -dimensional diagonals of their restriction maps. This perspective allows us to generalise Proposition 10 to a multi-class setting:
+
+Proposition 12. Let $\mathcal { G }$ be the set of connected graphs with nodes belonging to $C \geq 3$ classes. Then for $d \geq C$ , $\mathcal { H } _ { \mathrm { d i a g } } ^ { d }$ has linear separation power over $\mathcal { G }$ .
+
+This result illustrates the benefits of using higher-dimensional stalks while maintaining a simple and computationally convenient class of diagonal restriction maps. Next, with more complex restriction maps, we can show that lower-dimensional stalks can be used to achieve linear separation in the presence of even more classes.
+
+Orthogonal. $\mathcal { H } _ { \mathrm { o r t h } } ^ { d } : = \{ ( \mathcal { F } , G ) : \mathcal { F } _ { v \leq e } \in O ( d ) \}$ is the class of $O ( d )$ -bundles. Orthogonal maps are able to make more efficient use of the space available to them than diagonal restriction maps:
+
+Proposition 13. Let $\mathcal { G }$ be the class of connected graphs with $C \leq 2 d$ classes. Then, for all $d \in \{ 2 , 4 \}$ , $\mathcal { H } _ { \mathrm { o r t h } } ^ { d }$ has linear separation power over $\mathcal { G }$ .
+
+Figure 4 includes an example diffusion process over an $O ( 2 )$ -bundle.
+
+Summary: Different sheaf classes give rise to different behaviours of the diffusion process and, consequently, to different separation capabilities. Taken together, these results show that solving any node classification task can be reduced to performing diffusion with the right sheaf.
+
+# 4 Expressive Power of Sheaf Convolutions
+
+Analogously to how GCN augments heat diffusion, we can construct a Sheaf Convolutional Network (SCN) augmenting the sheaf diffusion process. In this section, we analyse the capacity of SCNs to change, if necessary, their asymptotic behaviour compared to the base diffusion process. Since the sheaf structure will be ultimately learned from data, this is particularly important for the common setting when the learned sheaf is different from the “ground truth” sheaf for the task to be solved.
+
+The continous diffusion process from Equation 3 has the Euler discretisation with unit step-size ${ \bf X } ( t + 1 ) = { \bf X } ( t ) - \Delta \mathcal { F } \bar { \bf X } ( t ) = ( { \bf I } _ { n d } - \bar { \Delta _ { \mathcal { F } } } ) { \bf X } ( t )$ . Assuming $\mathbf { X } \in \mathbb { R } ^ { n d \times f _ { 1 } }$ , we can equip the right side with weight matrices $\mathbf { W } _ { 1 } \in \mathbb { R } ^ { d \times d }$ , $\mathbf { W } _ { 2 } \in \mathbb { R } ^ { f _ { 1 } \times f _ { 2 } }$ and a non-linearity $\sigma$ to arrive at the following model originally proposed by Hansen and Gebhart [32]:
+
+$$
+\begin{array} { r } { \mathbf { Y } = \sigma \Big ( \big ( \mathbf { I } _ { n d } - \Delta _ { \mathcal { F } } \big ) ( \mathbf { I } _ { n } \otimes \mathbf { W } _ { 1 } ) \mathbf { X } \mathbf { W } _ { 2 } \Big ) \in \mathbb { R } ^ { n d \times f _ { 2 } } , } \end{array}
+$$
+
+where $f _ { 1 } , f _ { 2 }$ are the number of input and output feature channels, and $\otimes$ denotes the Kronecker product. Here, $\mathbf { W } _ { 1 }$ multiplies from the left the vector feature of all the nodes in all channels (i.e. $\mathbf { \bar { W } } _ { 1 } \mathbf { x } _ { v } ^ { i }$ for all $v$ and channels $i$ ), while $\mathbf { W } _ { 2 }$ multiplies the features from the right and can adjust the number of feature channels, just like in GCNs. As one would expect, when using a trivial sheaf, $\Delta _ { \mathcal { F } } = \Delta _ { 0 }$ , $\mathbf { W } _ { 1 }$ becomes a scalar and one recovers the GCN of Kipf and Welling [39]. To see how SCNs behave compared to their base diffusion process, we investigate how SCN layers affect the sheaf Dirichlet energy $E _ { \mathcal { F } } ( \mathbf { x } )$ , which sheaf diffusion is known to minimise over time.
+
+$$
+\begin{array} { r } { { E } _ { \mathcal { F } } ( \mathbf { x } ) : = \mathbf { x } ^ { \top } \Delta _ { \mathcal { F } } \mathbf { x } = \frac { 1 } { 2 } \sum _ { e : = ( v , u ) } \| \mathcal { F } _ { v \leq e } D _ { v } ^ { - 1 / 2 } \mathbf { x } _ { v } - \mathcal { F } _ { u \leq e } D _ { u } ^ { - 1 / 2 } \mathbf { x } _ { u } \| _ { 2 } ^ { 2 } } \end{array}
+$$
+
+Similarly, for multiple channels the energy is $E _ { \mathcal { F } } ( \mathbf { X } ) : = \operatorname { t r a c e } ( \mathbf { X } ^ { \top } \Delta _ { \mathcal { F } } \mathbf { X } )$ . This is a measure of how close a signal $\mathbf { x }$ is to $\ker ( \Delta _ { \mathcal { F } } )$ and it is easy to see that $\mathbf { x } \in \ker ( \Delta _ { \mathcal { F } } ) \Leftrightarrow E _ { \mathcal { F } } ( \mathbf { x } ) = 0$ . We begin by studying the sheaves for which the energy decreases and representations end up asymptotically in $\ker ( \Delta \tau )$ . Let $\begin{array} { r } { \lambda _ { * } : = \operatorname* { m a x } _ { i > 0 } \big ( \lambda _ { i } ^ { \mathcal { F } } - 1 \big ) ^ { 2 } \overset { \smile } { \le } 1 } \end{array}$ and denote by $\mathcal { \hat { H } } _ { + } ^ { 1 } : = \{ ( \mathcal { F } , G ) ~ | ~ \mathcal { F } _ { v \underline { { { \triangle } } } e } \mathcal { \bar { F } } _ { u \underline { { { \diamondsuit } } } e } > 0 \}$ .
+
+Theorem 15. For $( { \mathcal { F } } , G ) \in { \mathcal { H } } _ { + } ^ { 1 }$ and $\sigma$ being (Leaky)ReLU, $E _ { \mathcal { F } } ( \mathbf { Y } ) \leq \lambda _ { * } \| \mathbf { W } _ { 1 } \| _ { 2 } ^ { 2 } \| \mathbf { W } _ { 2 } ^ { \top } \| _ { 2 } ^ { 2 } E _ { \mathcal { F } } ( \mathbf { X } )$ .
+
+This generalises existent results for GCNs [13, 51] and proves that SCNs using this family of Laplacians, which includes all weighted graph Laplacians, exponentially converge to $\ker ( \Delta \dot { \mathcal { F } } )$ if $\lambda _ { * } \mathbf { \bar { \| } W _ { 1 } \| _ { 2 } ^ { 2 } } \| \mathbf { W } _ { 2 } ^ { \top } \| _ { 2 } ^ { 2 } < 1$ . In particular, if $E _ { \mathcal { F } } ( { \bf X } ) = 0$ , then $E _ { \mathcal { F } } ( \mathbf { Y } ) = 0$ and the representations remain trapped inside the kernel no matter what the norm of the weights is. Therefore, in settings as those described by Propositions 9 and 11, the linear separation capabilities of this class of models are severely limited (see Corollaries 36, 37 in Appendix B).
+
+Finally, the Theorem also extends to bundles with symmetric maps, $\mathcal { H } _ { \mathrm { { o r t h , s y m } } } ^ { d } : = \mathcal { H } _ { \mathrm { { o r t h } } } ^ { d } \cap \mathcal { H } _ { \mathrm { { s y m } } } ^ { d }$
+
+Theorem 16. If $( \mathcal { F } , G ) \in \mathcal { H } _ { \mathrm { o r t h , s y m } } ^ { d }$ and $\begin{array} { r } { \sigma = ( L e a k y ) R e L U , E _ { \mathcal { F } } ( \mathbf { Y } ) \leq \lambda _ { * } \| \mathbf { W } _ { 1 } \| _ { 2 } ^ { 2 } \| \mathbf { W } _ { 2 } ^ { \top } \| _ { 2 } ^ { 2 } E _ { \mathcal { F } } ( \mathbf { X } ) . } \end{array}$
+
+In some sense, this is not surprising because, for this class, $\ker ( \Delta \tau )$ contains the same information as the kernel of the classical normalised graph Laplacian (see Proposition 29 in Appendix C).
+
+More generally, SCNs with sheaves outside Dirichlet energy using an arbitrarily small $\mathcal { H } _ { \mathrm { s y m } } ^ { d }$ , are much mor transformation xible and can easily increase the: $\mathbf { W } _ { 1 }$
+
+Proposition 17. For any connected graph $G$ and $\varepsilon > 0$ , there exist a sheaf $( G , { \mathcal { F } } ) \not \in { \mathcal { H } } _ { \mathrm { s y m } } ^ { d }$ , $\mathbf { W } _ { 1 }$ with $\| \mathbf { W } _ { 1 } \| _ { 2 } < \varepsilon$ and feature vector x such that $E _ { \mathcal { F } } ( ( \mathbf { I } \otimes \mathbf { W } _ { 1 } ) \mathbf { x } ) > E _ { \mathcal { F } } ( \mathbf { x } )$ .
+
+Importantly, this proves that this family of SCNs can, if necessary, escape the kernel of the Laplacian.
+
+Summary: Not only that sheaf diffusion is more expressive than heat diffusion as shown in Section 3.2, but SCNs are also more expressive than GCNs in the sense that they are generally not constrained to decrease the Dirichlet energy when using low-norm weights. This provides them with greater control than GCNs over their asymptotic behaviour.
+
+# 5 Neural Sheaf Diffusion and Sheaf Learning
+
+In the previous sections, we discussed the various advantages provided by sheaf diffusion and sheaf convolutions. However, in general, the ground truth sheaf is unknown or unspecified. Therefore, we aim to learn the underlying sheaf from data end-to-end, thus allowing the model to pick the right geometry for solving the task.
+
+Neural Sheaf Diffusion. We propose the diffusion-type model from Equation 5. We note that by setting $\mathbf { W } _ { 1 } , \mathbf { W } _ { 2 }$ to identity and $\bar { \sigma ( \mathbf { x } ) } = \mathrm { E L U } ( \epsilon \mathbf { x } ) / \epsilon$ with $\epsilon > 0$ small enough or simply $\sigma = \mathrm { i d }$ , we recover (up to a scaling) the sheaf diffusion equation. Therefore, the model is at least as expressive as sheaf diffusion and benefits from all the positive properties outlined in Section 3.2.
+
+$$
+\begin{array} { r } { \dot { \mathbf { X } } ( t ) = - \sigma \Big ( \Delta _ { \mathcal { F } ( t ) } ( \mathbf { I } _ { n } \otimes \mathbf { W } _ { 1 } ) \mathbf { X } ( t ) \mathbf { W } _ { 2 } \Big ) , } \end{array}
+$$
+
+Crucially, the sheaf Laplacian $\Delta _ { \mathcal { F } ( t ) }$ is that of a sheaf $( G , { \mathcal { F } } ( t ) )$ that evolves over time. More specifically, the evolution of the sheaf structure is described by a learnable function of the data $( \mathbf { \bar { \boldsymbol { G } } } , \mathcal { F } ( t ) ) \stackrel { \cdot } { = } g ( \boldsymbol { G } , \mathbf { X } ( t ) ; \theta )$ . This allows the model to use the latest available features to manipulate the underlying geometry of the graph and, implicitly, the behaviour of the diffusion process. Additionally, We use an MLP followed by a reshaping to map the raw features of the dataset to a matrix $\mathbf { X } ( 0 )$ of shape $n d \times f$ and a final linear layer to perform the node classification.
+
+In our experiments, we focus on the time-discretised version of this model from Equation 6, which allows us to use a new set of weights at each layer $t$ while maintaining the nice theoretical properties of the model above.
+
+$$
+\begin{array} { r } { \mathbf { X } _ { t + 1 } = \mathbf { X } _ { t } - \sigma \Big ( \Delta _ { \mathcal { F } ( t ) } ( \mathbf { I } \otimes \mathbf { W } _ { 1 } ^ { t } ) \mathbf { X } _ { t } \mathbf { W } _ { 2 } ^ { t } \Big ) } \end{array}
+$$
+
+We note that this model is different from the SCN model from Equation 4 in two major ways. First, Hansen and Gebhart [32] used a hand-crafted sheaf with $d = 1$ , constructed in a synthetic setting with full knowledge of the data-generating process. In contrast, we learn a sheaf, which makes our model applicable to any real-world graph dataset, even in the absence of a sheaf structure. Additionally, motivated by our theoretical results, we use the full generality of sheaves by using stalks with $d \geq 1$ and higher-dimensional maps. Second, our model uses a residual parametrisation of the discretised diffusion process, which empirically improves its performance.
+
+Sheaf Learning. The restriction maps are learned using locally available information. Each $d \times d$ matrix $\mathcal { F } _ { v \le e }$ is learned via a parametric matrix-valued function $\Phi$ , with $\mathcal { F } _ { v \underline { { \sf { d e } } } : = ( v , u ) } = \Phi ( \mathbf { x } _ { v } , \mathbf { x } _ { u } )$
+
+
+Figure 5: (Left) Train and (Middle) test accuracy as a function of diffusion time. (Right) Histogram of the learned scalar transport maps. The performance of the sheaf diffusion model is superior to that of weighted-graph diffusion and correctly learns to invert the features of the two classes.
+
+This function must be non-symmetric to be able to learn asymmetric transport maps along each edge. In practice, we set $\Phi ( \mathbf { x } _ { v } , \mathbf { x } _ { u } ) = \sigma ( \mathbf { V } [ \mathbf { x } _ { v } | | \mathbf { x } _ { u } ] )$ followed by a reshaping of the output, where $\mathbf { V }$ is a weight matrix. For simplicity, the equations above use a single feature channel, but in practice, all channels are supplied as input. More generally, we can show that if the function $\Phi$ has enough capacity and the features are diverse enough, we can learn any sheaf over a graph.
+
+Proposition 18. Let $G = ( V , E )$ be a finite graph with features X. Then, $i f \left( \mathbf { x } _ { v } , \mathbf { x } _ { u } \right) \neq \left( \mathbf { x } _ { w } , \mathbf { x } _ { z } \right)$ for any ${ \bf \bar { \Phi } } ( v , u ) \neq ( w , z ) \in E$ and $\Phi$ is an MLP with sufficient capacity, $\Phi$ can learn any sheaf $( { \mathcal { F } } ; G )$ .
+
+First, this result formally motivates learning a sheaf at each layer since the model can learn to distinguish more nodes after each aggregation step. Second, this suggests that more expressive models (in the Weisfeiler-Lehman sense [8, 9, 46, 71]) could learn a more general family of sheaves. We leave a deeper investigation of these aspects for future work. In what follows, we distinguish between several types of functions $\Phi$ depending on the type of matrix they learn.
+
+Diagonal. The main advantage of this parametrisation is that fewer parameters need to be learned per edge, and the sheaf Laplacian ends up being a matrix with diagonal blocks, which also results in fewer operations in sparse matrix multiplications. The main disadvantage is that the $d$ dimensions of the stalks interact only via the left $\mathbf { W } _ { 1 }$ multiplication.
+
+Orthogonal. In this case, the model effectively learns a discrete vector bundle. Orthogonal matrices provide several advantages: (1) they can mix the various dimension of the stalks, (2) the orthogonality constraint prevents overfitting while reducing the number of parameters, (3) they have better understood theoretical properties, and (4) the resulting Laplacians are easier to normalise numerically since the diagonal entries correspond to the degrees of the nodes. In our model, we build orthogonal matrices from a composition of Householder reflections [45].
+
+General. Finally, we consider the most general option of learning arbitrary matrices. The maximal flexibility these maps provide can be useful, but it also comes with the danger of overfitting. At the same time, the sheaf Laplacian is more challenging to normalise numerically since one has to compute $D ^ { - 1 / 2 }$ for a positive semi-definite matrix $D$ . To perform this at scale, one has to rely on SVD, whose gradients can be infinite if $D$ has repeated eigenvalues. Therefore, this model is more challenging to train.
+
+Computational Complexity. The GCN from Equation 2 has complexity $O ( n c ^ { 2 } + m c )$ , where $c$ is the number of channels and $m$ the number of edges. Assume a sheaf diffusion model with stalk dimension $d$ and $f$ channels such that $d \times f = c$ (i.e. same representation size). Then, when the model uses diagonal maps, the complexity is $O ( n c ^ { 2 } + m d c )$ . When using orthogonal or general matrices, the complexity becomes $\mathcal { O } ( n ( c ^ { 2 } + d ^ { 3 } ) + m ( c d ^ { 2 } + d ^ { 3 } ) )$ (see Appendix E.1 for detailed derivations). In practice, we use $1 \leq d \leq 5$ , which effectively results in a constant overhead compared to GCN.
+
+# 6 Experiments
+
+Synthetic experiments. We consider a simple setup given by a connected bipartite graph with equally sized partitions. We sample the features from two overlapping isotropic Gaussian distributions to make the classes linearly non-separable at initialisation time. From Proposition 9, we know that diffusion models using symmetric restriction maps cannot separate the classes in the limit, while a diffusion process using negative transport maps can. Therefore, we use two vanilla sheaf diffusion processes by setting $d = 1$ , ${ \mathbf W } _ { 1 } = { \mathbf I } _ { d }$ , ${ \bf W } _ { 2 } = { \bf I } _ { f }$ and $\sigma = \mathrm { i d }$ in Equation 5. In both models, we learn a sheaf at $t = 0$ as a function of $\mathbf { X } ( 0 )$ , and we keep the sheaf constant over time. For the first model, we learn a sheaf with general maps $\mathcal { F } _ { v \le e } \in \mathbb { R }$ . For the second model, we use a similar layer but constraint $\mathcal { F } _ { v \le e } = \mathcal { F } _ { u \le e }$ , obtaining a weighted graph Laplacian.
+
+Table 1: Results on node classification datasets sorted by their homophily level. Top three models are coloured by First, Second, Third. Our models are marked NSD.
+
+
Hom level
Texas 0.11
Wisconsin 0.21
Film 0.22
Squirrel 0.22
Chameleon 0.23
Cornell 0.30
Citeseer 0.74
Pubmed 0.80
Cora 0.81
#Nodes #Edges
183 295
251 466
7,600 26,752
5,201 198,493
2,277 31,421
183 280
3,327 4,676
18,717 44,327
2,708 5,278
#Classes
5
5
5
5
5
5
7
3
6
Diag-NSD
85.67±6.95
88.63±2.75
37.79±1.01
54.78±1.81
68.68±1.73
86.49±7.35
77.14±1.85
89.42±0.43
87.14±1.06
O(d)-NSD
85.95±5.51
89.41±4.74
37.81±1.15
56.34±1.32
68.04±1.58
84.86±4.71
76.70±1.57
89.49±0.40
86.90±1.13
Gen-NSD
82.97±5.13
89.21±3.84
37.80±1.22
53.17±1.31
67.93±1.58
85.68±6.51
76.32±1.65
89.33±0.35
87.30±1.15
GGCN
84.86±4.55
86.86±3.29
37.54±1.56
55.17±1.58
71.14±1.84
85.68±6.63
77.14±1.45
89.15±0.37
87.95±1.05
H2GCN
84.86±7.23
87.65±4.98
35.70±1.00
36.48±1.86
60.11±2.15
82.70±5.28
77.11±1.57
89.49±0.38
87.87±1.20
GPRGNN
78.38±4.36
82.94±4.21
34.63±1.22
31.61±1.24
46.58±1.71
80.27±8.11
77.13±1.67
87.54±0.38
87.95±1.18
FAGCN
82.43±6.89
82.94±7.95
34.87±1.25
42.59±0.79
55.22±3.19
79.19±9.79
N/A
N/A
N/A
MixHop
77.84±7.73
75.88±4.90
32.22±2.34
43.80±1.48
60.50±2.53
73.51±6.34
76.26±1.33
85.31±0.61
87.61±0.85
GCNII
77.57±3.83
80.39±3.40
37.44±1.30
38.47±1.58
63.86±3.04
77.86±3.79
77.33±1.48
90.15±0.43
88.37±1.25
Geom-GCN
66.76±2.72
64.51±3.66
31.59±1.15
38.15±0.92
60.00±2.81
60.54±3.67
78.02±1.15
89.95±0.47
85.35±1.57
PairNorm
60.27±4.34
48.43±6.14
27.40±1.24
50.44±2.04
62.74±2.82
58.92±3.15
73.59±1.47
87.53±0.44
85.79±1.01
GraphSAGE
82.43±6.14
81.18±5.56
34.23±0.99
41.61±0.74
58.73±1.68
75.95±5.01
76.04±1.30
88.45±0.50
86.90±1.04
GCN
55.14±5.16
51.76±3.06
27.32±1.10
53.43±2.01
64.82±2.24
60.54±5.30
76.50±1.36
88.42±0.50
86.98±1.27
GAT
52.16±6.63
49.41±4.09
27.44±0.89
40.72±1.55
60.26±2.50
61.89±5.05
76.55±1.23
87.30±1.10
86.33±0.48
MLP
80.81±4.75
85.29±3.31
36.53±0.70
28.77±1.56
46.21±2.99
81.89±6.40
74.02±1.90
87.16±0.37
75.69±2.00
+
+Figure 5 presents the results across five seeds. As expected, for diffusion time zero (i.e. no diffusion), we see that a linear classifier cannot separate the classes. At later times, the diffusion process using symmetric maps cannot perfectly fit the data. In contrast, with the more general sheaf diffusion, as time increases and the signal approaches the harmonic space, the model gets better and the features become linearly separable. In the last subfigure, we take a closer look at the sheaf that the model learns in the time limit by plotting a histogram of all the transport (scalar) maps $\mathcal { F } _ { v \le { e } } ^ { \top } \mathcal { F } _ { u \le { e } }$ . In accordance with Proposition 10, the model learns a negative transport map for all edges. This shows that the model manages to avoid oversmoothing (see Appendix F for an experiment with $d > 1$ ).
+
+Real-world experiments. We test our models on multiple real-world datasets [47, 53, 57, 61, 66] with an edge homophily coefficient $h$ ranging from $h = 0 . 1 1$ (very heterophilic) to $h = 0 . 8 1$ (very homophilic). Therefore, they offer a view of how a model performs over this entire spectrum. We evaluate our models on the 10 fixed splits provided by Pei et al. [53] and report the mean accuracy and standard deviation. Each split contains $4 8 \% / 3 2 \% / 2 \dot { 0 } \%$ of nodes per class for training, validation and testing, respectively. As baselines, we use an ample set of GNN models that can be placed in three categories: (1) classical: GCN [39], GAT [68], GraphSAGE [31]; (2) models specifically designed for heterophilic settings: GGCN [72], Geom-GCN [53], H2GCN [75], GPRGNN [17], FAGCN [7], MixHop [1]; (3) models addressing oversmoothing: GCNII [16], PairNorm [74]. All the results are taken from Yan et al. [72], except for FAGCN and MixHop, which come from Lingam et al. [41] and Zhu et al. [75], respectively. All of these were evaluated on the same set of splits as ours. In Appendix F we also include experiments with continuous GNN models.
+
+Results. From Table 1 we see that our models are first in $5 / 6$ benchmarks with high heterophily $( h < 0 . 3 )$ and second-ranked on the remaining one (i.e. Chameleon). At the same time, NSD also shows strong performance on the homophilic graphs by being within approximately $1 \%$ of the top model. Overall, NSD models are among the top three models on $8 / 9$ datasets. The $O ( d )$ -bundle diffusion model performs best overall confirming the intuition that it can better avoid overfitting, while also transforming the vectors in sufficiently complex ways. We also remark on the strong performance of the model learning diagonals maps, despite the simpler functional form of the Laplacian.
+
+# 7 Related Work, Discussion, and Conclusion
+
+Sheaf Neural Networks & Sheaf Learning. Sheaf Neural Networks [32] with a hand-crafted sheaf Laplacian were originally introduced in a toy experimental setting. Since then, they have remained completely unexplored, and we hope this paper will fill this lacuna. In contrast to [32], we provide an ample theoretical analysis justifying the use of sheaves in Graph ML and study for the first time how sheaves can be learned from data using neural networks. Furthermore, we present the first successful application of Sheaf Neural Networks on real-world datasets. Hansen and Ghrist [33] have also considered learning a sheaf Laplacian by minimising directly in matrix space a regularised Dirichlet energy metric. Different from their approach, we learn the sheaf as part of an end-to-end model and use an efficient parametrisation that is independent of the size of the graph.
+
+Follow-up works have also experimented with inferring a connection Laplacian directly from data at pre-processing time [3], combining sheaves with attention [4], and designing models based on the wave equation on sheaves [65]. Besides the sheaf Laplacians employed in all these works and ours, one can also use higher-order sheaf (connection) Laplacians that operate on higher-order tensors. These were shown to encode important information about the underlying symmetries in the data [55], which hints at the powerful data properties that Sheaf Neural Networks could potentially extract from these operators.
+
+Heterophily and Oversmoothing. While good empirical designs jointly addressing these two problems have been proposed before [17, 72], Yan et al. [72] is the only other work connecting the two theoretically. Their analysis [72] is very different in terms of methods and assumptions and, therefore, their results are completely orthogonal. Concretely, the authors analyse the performance of linear SGCs [69] (i.e. GCN without nonlinearities) on random attributed graphs. In contrast, our analysis is not probabilistic, focuses on diffusion PDEs and also extends to GCNs in the non-linear regime. Furthermore, we employ a new set of mathematical tools from cellular sheaf theory, which brings a new language and new tools to analyse these problems. Perhaps the only commonality is that both works find evidence for the benefits of negatively signed edges in GNNs, although with different mathematical motivations. At the same time, other recent works [21, 42] have shown that GCNs with finite layers (typically one) can perform well in heterophilic graphs (including bipartite). This is in no contradiction with our results, which consider an infinite time/layer regime (i.e. not finite) and perfect linear separation (i.e. a model that cannot fit the data can still achieve high accuracy).
+
+Category Theory and GNNs. From the perspective of category theory [43], cellular sheaves are a functor from a category describing the incidence structure of the graph to a category describing the data living on top of the graph. Informally, this says that the vertices and edges are mapped to some type of data (e.g. vector spaces) and the incidence relations between vertices and edges are mapped to some type of relation between the assigned data (e.g. linear maps between the vector spaces). The generality provided by this perspective could be used to extend the models described in this work to more exotic types of data such as lattices and their associated sheaf Laplacians [25]. At the same time, our work echoes other recent efforts to place GNNs on a categorical foundation [19, 22].
+
+Message Passing Neural Networks. The layer from Equation 6 can be seen as a form of GNNFiLM layer [11, 54], where each node learns a linear message function conditioned on the features of the neighbours. Such models have been recently shown to perform well empirically in heterophilic settings [52]. At the same time, the model bares an algorithmic resemblance to GAT [68]. For a central node $v$ and a neighbouring node $u$ , GAT learns an attention coefficient $a _ { v u }$ , while our model learns a matrix given by the block $( v , u )$ of $\Delta { _ { \mathcal { F } } }$ . Finally, a message-passing procedure based on parallel transport has also been proposed by Haan et al. [30] in the context of geometric graphs (meshes). In the absence of a natural geometric structure on arbitrary graphs, in our case, the transport structure is learned from data end-to-end.
+
+Limitations and societal impact. One of the main limitations of our theoretical analysis is that it does not address the generalisation properties of sheaves, but this remains a major impediment for the entire field of deep learning. Nonetheless, our setting was sufficient to produce many valuable insights about heterophily and oversmoothing and a basic understanding of what various types of sheaves can and cannot do. Much more work remains to be done in this direction, and we expect to see further cross-fertilization between ML and algebraic topology in the future. Finally, due to the theoretical nature of this work, we do not foresee any immediate negative societal impacts.
+
+Conclusion. In this work, we used cellular sheaf theory to provide a novel topological perspective on heterophily and oversmoothing in GNNs. We showed that the underlying sheaf structure of the graph is intimately connected with both of these important factors affecting the performance of GNNs. To mitigate this, we proposed a new paradigm for graph representation learning where models not only evolve the features at each layer but also the underlying geometry of the graph. In practice, we demonstrated that this framework achieves competitive results in heterophilic settings.
+
+# Acknowledgments and Disclosure of Funding
+
+We are grateful to Iulia Duta, Dobrik Georgiev and Jacob Deasy for valuable comments on an earlier version of this manuscript. CB would also like to thank the Twitter Cortex team for making the research internship a fantastic experience. This research was supported in part by ERC Consolidator grant No. 724228 (LEMAN).
+
+# References
+
+[1] Sami Abu-El-Haija, Bryan Perozzi, Amol Kapoor, Hrayr Harutyunyan, Nazanin Alipourfard, Kristina Lerman, Greg Ver Steeg, and Aram Galstyan. Mixhop: Higher-order graph convolutional architectures via sparsified neighborhood mixing. In The Thirty-sixth International Conference on Machine Learning (ICML), 2019. URL http://proceedings.mlr.press/ v97/abu-el-haija19a/abu-el-haija19a.pdf.
+[2] Afonso S Bandeira, Amit Singer, and Daniel A Spielman. A Cheeger inequality for the graph connection laplacian. SIAM Journal on Matrix Analysis and Applications, 34(4):1611–1630, 2013.
+[3] Federico Barbero, Cristian Bodnar, Haitz Sáez de Ocáriz Borde, Michael Bronstein, Petar Velickovi ˇ c, and Pietro Liò. Sheaf neural networks with connection laplacians. In ´ ICML 2022 Workshop on Topology, Algebra, and Geometry in Machine Learning, 2022. [4] Federico Barbero, Cristian Bodnar, Haitz Sáez de Ocáriz Borde, and Pietro Lio. Sheaf attention networks. In NeurIPS 2022 Workshop on Symmetry and Geometry in Neural Representations, 2022.
+[5] Lukas Biewald. Experiment tracking with weights and biases, 2020. URL https://www. wandb.com/. Software available from wandb.com.
+[6] Christopher M. Bishop. Pattern Recognition and Machine Learning (Information Science and Statistics). Springer-Verlag, Berlin, Heidelberg, 2006. ISBN 0387310738.
+[7] Deyu Bo, Xiao Wang, Chuan Shi, and Huawei Shen. Beyond low-frequency information in graph convolutional networks. In AAAI. AAAI Press, 2021.
+[8] Cristian Bodnar, Fabrizio Frasca, Nina Otter, Yu Guang Wang, Pietro Liò, Guido Montúfar, and Michael Bronstein. Weisfeiler and Lehman Go Cellular: CW Networks. In NeurIPS, 2021.
+[9] Cristian Bodnar, Fabrizio Frasca, Yuguang Wang, Nina Otter, Guido F Montufar, Pietro Lió, and Michael Bronstein. Weisfeiler and Lehman Go Topological: Message Passing Simplicial Networks. In ICML, 2021.
+[10] Glen E Bredon. Sheaf theory, volume 170. Springer Science & Business Media, 2012.
+[11] Marc Brockschmidt. Gnn-film: Graph neural networks with feature-wise linear modulation. In International Conference on Machine Learning, pages 1144–1152. PMLR, 2020.
+[12] Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. In ICLR, 2014.
+[13] Chen Cai and Yusu Wang. A note on over-smoothing for graph neural networks. arXiv:2006.13318, 2020.
+[14] Benjamin Paul Chamberlain, James Rowbottom, Davide Eynard, Francesco Di Giovanni, Dong Xiaowen, and Michael M Bronstein. Beltrami flow and neural diffusion on graphs. In NeurIPS, 2021.
+[15] Benjamin Paul Chamberlain, James Rowbottom, Maria Goronova, Stefan Webb, Emanuele Rossi, and Michael M Bronstein. Grand: Graph neural diffusion. In ICML, 2021.
+
+[16] Ming Chen, Zhewei Wei, Zengfeng Huang, Bolin Ding, and Yaliang Li. Simple and deep graph convolutional networks. In Hal Daumé III and Aarti Singh, editors, Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pages 1725–1735. PMLR, 13–18 Jul 2020. URL https://proceedings. mlr.press/v119/chen20v.html.
+
+[17] Eli Chien, Jianhao Peng, Pan Li, and Olgica Milenkovic. Adaptive universal generalized pagerank graph neural network. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=n6jl7fLxrP.
+
+[18] Justin Michael Curry. Sheaves, cosheaves and applications. University of Pennsylvania, 2014.
+
+[19] Pim de Haan, Taco Cohen, and Max Welling. Natural graph networks. In NeurIPS, 2020.
+
+[20] Michaël Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on graphs with fast localized spectral filtering. In NIPS, 2016.
+
+[21] Lun Du, Xiaozhou Shi, Qiang Fu, Xiaojun Ma, Hengyu Liu, Shi Han, and Dongmei Zhang. Gbk-gnn: Gated bi-kernel graph neural networks for modeling both homophily and heterophily. In Proceedings of the ACM Web Conference 2022, pages 1550–1558, 2022.
+
+[22] Andrew Dudzik and Petar Velickovi ˇ c. Graph neural networks are dynamic programmers. ´ arXiv preprint arXiv:2203.15544, 2022.
+
+[23] Vijay Prakash Dwivedi, Chaitanya K Joshi, Thomas Laurent, Yoshua Bengio, and Xavier Bresson. Benchmarking graph neural networks. arXiv:2003.00982, 2020.
+
+[24] Tingran Gao, Jacek Brodzki, and Sayan Mukherjee. The geometry of synchronization problems and learning group actions. Discrete & Computational Geometry, 65(1):150–211, 2021.
+
+[25] Robert Ghrist and Hans Riess. Cellular sheaves of lattices and the tarski laplacian. arXiv:2007.04099, 2020.
+
+[26] Robert W Ghrist. Elementary applied topology, volume 1. Createspace Seattle, 2014.
+
+[27] Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In ICML, 2017.
+
+[28] Christoph Goller and Andreas Kuchler. Learning task-dependent distributed representations by backpropagation through structure. In ICNN, 1996.
+
+[29] Marco Gori, Gabriele Monfardini, and Franco Scarselli. A new model for learning in graph domains. In IJCNN, 2005.
+
+[30] Pim De Haan, Maurice Weiler, Taco Cohen, and Max Welling. Gauge equivariant mesh CNNs: Anisotropic convolutions on geometric graphs. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id $\equiv$ Jnspzp-oIZE.
+
+[31] William L Hamilton, Rex Ying, and Jure Leskovec. Representation learning on graphs: Methods and applications. IEEE Data Engineering Bulletin, 2017.
+
+[32] Jakob Hansen and Thomas Gebhart. Sheaf neural networks. In NeurIPS 2020 Workshop on Topological Data Analysis and Beyond, 2020.
+
+[33] Jakob Hansen and Robert Ghrist. Learning sheaf laplacians from smooth signals. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 5446–5450. IEEE, 2019.
+
+[34] Jakob Hansen and Robert Ghrist. Toward a spectral theory of cellular sheaves. Journal of Applied and Computational Topology, 3(4):315–358, 2019.
+
+[35] Jakob Hansen and Robert Ghrist. Opinion dynamics on discourse sheaves. SIAM Journal on Applied Mathematics, 81(5):2033–2060, 2021.
+
+[36] Kurt Hornik. Approximation capabilities of multilayer feedforward networks. Neural networks, 4(2):251–257, 1991.
+[37] Kurt Hornik, Maxwell Stinchcombe, and Halbert White. Multilayer feedforward networks are universal approximators. Neural networks, 2(5):359–366, 1989.
+[38] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
+[39] Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In ICLR, 2017.
+[40] Hyun Deok Lee. On some matrix inequalities. Korean Journal of Mathematics, 16(4):565–571, 2008.
+[41] Vijay Lingam, Rahul Ragesh, Arun Iyer, and Sundararajan Sellamanickam. Simple truncated svd based model for node classification on heterophilic graphs. arXiv preprint arXiv:2106.12807, 2021.
+[42] Sitao Luan, Chenqing Hua, Qincheng Lu, Jiaqi Zhu, Mingde Zhao, Shuyuan Zhang, Xiao-Wen Chang, and Doina Precup. Is heterophily a real nightmare for graph neural networks to do node classification? arXiv preprint arXiv:2109.05641, 2021.
+[43] Saunders Mac Lane. Categories for the working mathematician, volume 5. Springer Science & Business Media, 2013.
+[44] Saunders MacLane and Ieke Moerdijk. Sheaves in geometry and logic: A first introduction to topos theory. Springer Science & Business Media, 2012.
+[45] Zakaria Mhammedi, Andrew Hellicar, Ashfaqur Rahman, and James Bailey. Efficient orthogonal parametrisation of recurrent neural networks using householder reflections. In International Conference on Machine Learning, pages 2401–2409. PMLR, 2017.
+[46] Christopher Morris, Martin Ritzert, Matthias Fey, William L Hamilton, Jan Eric Lenssen, Gaurav Rattan, and Martin Grohe. Weisfeiler and Leman go neural: Higher-order graph neural networks. In AAAI, 2019.
+[47] Galileo Namata, Ben London, Lise Getoor, Bert Huang, and U Edu. Query-driven active surveying for collective classification. In 10th International Workshop on Mining and Learning with Graphs, volume 8, page 1, 2012.
+[48] H Nt and T Maehara. Revisiting graph neural networks: all we have is low pass filters. arXiv preprint arXiv:1812.08434v4, 2019.
+[49] Anton Obukhov. Efficient householder transformation in pytorch, 2021. URL www.github. com/toshas/torch-householder. Version: 1.0.1, DOI: 10.5281/zenodo.5068733.
+[50] K Oono and T Suzuki. Graph neural networks exponentially lose expressive power for node classification. In International Conference on Learning Representations, 2020.
+[51] Kenta Oono and Taiji Suzuki. Graph neural networks exponentially lose expressive power for node classification. arXiv:1905.10947, 2019.
+[52] John Palowitch, Anton Tsitsulin, Brandon Mayer, and Bryan Perozzi. Graphworld: Fake graphs bring real insights for gnns. arXiv preprint arXiv:2203.00112, 2022.
+[53] Hongbin Pei, Bingzhe Wei, Kevin Chen-Chuan Chang, Yu Lei, and Bo Yang. Geom-gcn: Geometric graph convolutional networks. arXiv preprint arXiv:2002.05287, 2020.
+[54] Ethan Perez, Florian Strub, Harm De Vries, Vincent Dumoulin, and Aaron Courville. Film: Visual reasoning with a general conditioning layer. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
+[55] David Pfau, Irina Higgins, Alex Botev, and Sébastien Racanière. Disentangling by subspace diffusion. Advances in Neural Information Processing Systems, 33:17403–17415, 2020.
+[56] Daniel Rosiak. Sheaf theory through examples. MIT Press, 2022.
+[57] Benedek Rozemberczki, Carl Allen, and Rik Sarkar. Multi-scale attributed node embedding. Journal of Complex Networks, 9(2):cnab014, 2021.
+[58] Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Trans. Neural Networks, 20(1):61–80, 2008.
+[59] Richard D Schafer. An introduction to nonassociative algebras. Courier Dover Publications, 2017.
+[60] Luis Scoccola and Jose A Perea. Approximate and discrete euclidean vector bundles. arXiv preprint arXiv:2104.07563, 2021.
+[61] Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina EliassiRad. Collective classification in network data. AI magazine, 29(3):93–93, 2008.
+[62] Allen Dudley Shepard. A cellular description of the derived category of a stratified space. PhD thesis, Brown University, 1985.
+[63] Amit Singer and H-T Wu. Vector diffusion maps and the connection laplacian. Communications on pure and applied mathematics, 65(8):1067–1144, 2012.
+[64] Alessandro Sperduti. Encoding labeled graphs by labeling RAAM. In NIPS, 1994.
+[65] Julian Suk, Lorenzo Giusti, Tamir Hemo, Miguel Lopez, Konstantinos Barmpas, and Cristian Bodnar. Surfing on the neural sheaf. In NeurIPS 2022 Workshop on Symmetry and Geometry in Neural Representations, 2022.
+[66] Jie Tang, Jimeng Sun, Chi Wang, and Zi Yang. Social influence analysis in large-scale networks. In Proceedings of the 15th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 807–816, 2009.
+[67] Loring W Tu. Manifolds. In An Introduction to Manifolds, pages 47–83. Springer, 2011.
+[68] Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph attention networks. In ICLR, 2018.
+[69] Felix Wu, Tianyi Zhang, Amauri Holanda de Souza Jr, Christopher Fifty, Tao Yu, and Kilian Q Weinberger. Simplifying graph convolutional networks. In ICML, 2019.
+[70] Louis-Pascal Xhonneux, Meng Qu, and Jian Tang. Continuous graph neural networks. In ICML, 2020.
+[71] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In ICLR, 2019.
+[72] Yujun Yan, Milad Hashemi, Kevin Swersky, Yaoqing Yang, and Danai Koutra. Two sides of the same coin: Heterophily and oversmoothing in graph convolutional neural networks. arXiv:2102.06462, 2021.
+[73] Fouad El Zein and Jawad Snoussi. Local systems and constructible sheaves. In Arrangements, local systems and singularities, pages 111–153. Springer, 2009.
+[74] Lingxiao Zhao and Leman Akoglu. Pairnorm: Tackling oversmoothing in gnns. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum? id=rkecl1rtwB.
+[75] Jiong Zhu, Yujun Yan, Lingxiao Zhao, Mark Heimann, Leman Akoglu, and Danai Koutra. Beyond homophily in graph neural networks: Current limitations and effective designs. Advances in Neural Information Processing Systems, 33, 2020.
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes]
+(c) Did you discuss any potential negative societal impacts of your work? [Yes]
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes] Proofs are included in the appendix
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Our code is available at https://github.com/twitter-research/neural-sheaf-diffusion.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Section 6 and Appendix E
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] Appendix E
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [Yes] Appendix F
+(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] The code of our submission.
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/vcNjibzV3P/vcNjibzV3P.md b/md/dev/vcNjibzV3P/vcNjibzV3P.md
new file mode 100644
index 0000000000000000000000000000000000000000..8d5be03d9c77b8cc5e67bcafa758c7d93ec79f6b
--- /dev/null
+++ b/md/dev/vcNjibzV3P/vcNjibzV3P.md
@@ -0,0 +1,466 @@
+# Complete Neural Networks for Complete Euclidean Graphs
+
+Anonymous Author(s)
+Affiliation
+Address
+email
+
+# Abstract
+
+1 Neural networks for point clouds, which respect their natural invariance to per
+2 mutation and rigid motion, have enjoyed recent success in modeling geometric
+3 phenomena, from molecular dynamics Reiser et al. [2022] to recommender systems
+4 Yi et al. [2023]. Yet, to date, no architecture with polynomial complexity is known
+5 to be complete, that is, able to distinguish between any pair of non-isomorphic
+6 point clouds. We fill this theoretical gap by showing that point clouds can be
+7 completely determined, up to permutation and rigid motion, by applying the 3-WL
+8 graph isomorphism test to the point cloud’s centralized Gram matrix. Moreover, we
+9 formulate a Euclidean variant of the 2-WL test and show that it is also sufficient to
+10 achieve completeness. We then show how our complete Euclidean WL tests can be
+11 simulated by a Euclidean graph neural network of moderate size and demonstrate
+12 their separation capability on highly-symmetrical point clouds.
+
+# 13 1 Introduction
+
+14 A point cloud is a collection of $n$ points in $\mathbb { R } ^ { d }$ , where typically in applications $d = 3$ . Machine
+15 learning on point clouds is an important task with applications in chemistry Gilmer et al. [2017],
+16 Wang et al. [2022], physical systems Finzi et al. [2021] and image processing Ma et al. [2023]. Many
+17 successful architectures for point clouds are invariant by construction to the natural symmetries of
+18 point clouds: permutations and rigid motions.
+19 The rapidly increasing literature on point-cloud networks with permutation and rigid-motion sym
+20 metries has motivated research aimed at theoretically understanding the expressive power of the
+21 various architectures. This analysis typically focuses on two closely related concepts: Separation
+22 and Universality. We say an invariant architecture is separating, or complete, if it can assign distinct
+23 values to any pair of point clouds that are not related by symmetry. An invariant architecture is
+24 universal if it can approximate all continuous invariant functions on compact sets. Generally speaking,
+25 these two concepts are essentially equivalent, as discussed in Villar et al. [2021], Joshi et al. [2022],
+26 Chen et al. [2019], and in our context, in Appendix A.
+27 Dym and Maron [2020] proved that the well-known Tensor Field Network Thomas et al. [2018]
+28 invariant architecture is universal, but the construction in their proof requires arbitrarily high-order
+29 representations of the rotation group. Similarly, universality can be obtained using high-order
+30 representations of the permutation group Lim et al. [2022]. However, prior to this work, it was not
+31 known whether the same theoretical guarantees can be achieved by realistic point-cloud architectures
+32 that use low-dimensional representations, and whose complexity has a mild polynomial dependency
+33 on the data dimension. In the words of Pozdnyakov and Ceriotti [2022]: "...provably universal
+34 equivariant frameworks are such in the limit in which they generate high-order correlations. . . It is
+35 an interesting, and open, question whether a given order suffices to guarantee complete resolving
+36 power." (p. 6). We note that it is known that separation of point clouds in polynomial time in $n$
+37 is possible, assuming that $d$ is fixed (e.g., $d = 3$ ) Arvind and Rattan [2014], Dym and Kovalsky
+38 [2019], Kurlin [2022]. What still remains to be established is whether separation is achievable for
+39 common invariant machine learning models, and more generally, whether separation can be achieved
+40 by computing a continuous invariant feature that is piecewise differentiable.
+41 In this paper, we give what seems to be the first positive answer to this question. We focus on analyzing
+42 a popular method for the construction of invariant point-cloud networks via Graph Neural Networks
+43 (GNNs). This is done in two steps: first, point clouds are represented as a Euclidean graph- which we
+44 define to be a complete weighted graph whose edge features are simple, rotation-invariant features:
+45 the inner products between pairs of (centralized) points. We then apply permutation-invariant Graph
+46 Neural Networks (GNNs) to the Euclidean graphs to obtain a rotation- and permutation-invariant
+47 global point-cloud feature. This leads to a rich family of invariant point-cloud architectures, which is
+48 determined by the type of GNN chosen.
+49 The most straightforward implementation of this idea would be to apply the popular message passing
+50 GNNs to the Euclidean graphs. One could also consider applying more expressive GNNs. For
+51 combinatorial graphs, it is known that message-passing GNNs are only as expressive as the 1-WL
+52 graph isomorphism test. There exists a hierarchy of $k$ -WL graph isomorphism tests, where larger
+53 values of $k$ correspond to more expressive, and more expensive, graph isomorphism tests. There
+54 are also corresponding GNNs that simulate the $k$ -WL tests and have an equivalent separation power
+55 Morris et al. [2018], Maron et al. [2019]. One could then consider applying these more expressive
+56 architectures to Euclidean graphs, as suggested in Lim et al. [2022]. Accordingly, we aim to answer
+57 the following questions:
+
+Question 1 For which $k$ is the $k$ -WL test, when applied to Euclidean graphs, complete?
+
+Question 2 Can this test be implemented in polynomial time by a continuous, piecewise-differentiable architecture?
+
+61 We begin by addressing Question 1. First, we consider a variation of the WL-test adapted for point
+62 clouds, which we refer to as 1-EWL (’E’ for Euclidean). This test was first proposed by Pozdnyakov
+63 and Ceriotti [2022], where it was shown that it cannot distinguish between all 3-dimensional point
+64 clouds, and consequently, neither can GNNs like Victor Garcia Satorras [2021], Schütt et al. [2017],
+65 which can be shown to simulate it. Our first result, described in Section 2.1, balances this by showing
+66 that two iterations of 1-EWL are enough to separate almost any pair of point clouds.
+67 To achieve complete separationfor all point clouds, we consider higher-order $k$ -EWL tests. We first
+68 consider a natural adaptation of $k$ -WL for Euclidean graphs, which we name the Vanilla- $k$ -EWL test.
+69 In this test, the standard $k$ -WL is applied to the Euclidean graph induced by the point clouds. We
+70 show that when $k = 3$ , this test is complete for 3-dimensional point clouds. Additionally, we propose
+71 a variant of the Vanilla 2-EWL, which incorporates additional geometric information while having
+72 the same complexity. We call this test the 2-EWL test, and show that it is complete on 3D point
+73 clouds. We also propose a natural variation of 2-EWL called 2-SEWL, which can distinguish between
+74 point clouds that are related by a reflection. This ability is important for chemical applications, as
+75 most biological molecules that are related by a reflection are not chemically identical Kapon et al.
+76 [2021] (this molecular property is called chirality).
+77 We next address the second question of how to construct a GNN for Euclidean data with the same
+78 separation power as that of the various $k$ -EWL tests we describe. For combinatorial graphs, such
+79 equivalence results rely on injective functions defined on multisets of discrete features Xu et al. [2018].
+80 For Euclidean graphs, one can similarly rely on injective functions for multisets with continuous
+81 features, such as those proposed in Dym and Gortler [2023]. However, a naive application of this
+82 approach leads to a very large number of hidden features, which grows exponentially with the number
+83 of message-passing iterations (see Figure 2). We show how this problem can be remedied, so that the
+84 number of features needed depends only linearly on the number of message-passing iterations.
+
+85 To summarize, our main results in this paper are:
+
+1. We show that two iterations of 1-EWL can separate almost all point clouds in any dimension. 2. We prove the completeness of a single iteration of the vanilla 3-EWL for point clouds in $\mathbb { R } ^ { 3 }$ . 3. We formulate the 2-SEWL and 2-EWL tests, and prove their completeness for point clouds in $\mathbb { R } ^ { 3 }$ .
+
+4. We explain how to build differentiable architectures for point clouds with the same separation power as Euclidean $k$ -WL tests, with reasonable complexity.
+
+2 Experiments In Section 5 we present synthetic experiments that demonstrate that 2-SEWL can
+3 separate challenging point-cloud pairs that cannot be separated by several popular architectures.
+94 Disambiguation: Euclidean Graphs In this paper we use a simple definition of a Euclidean graph
+95 as the centralized Gram matrix of a point cloud, and focus on a fundamental theoretical question
+96 related to this representation. In the learning literature, terms like ‘geometric graphs’ (not used here)
+97 could refer to graphs that have both geometric and non-geometric edge and vertex features, or graphs
+98 where pairwise distances are only available for specific point pairs (edges in an incomplete graph).
+
+# 99 1.1 Related Work
+
+100 Euclidean WL Pozdnyakov and Ceriotti [2022] showed that 1-EWL is incomplete for 3-
+101 dimensional point clouds. Joshi et al. [2022] defines separation for a more general definition
+102 of geometric graph, which combines geometric and combinatorial features. This work holds various
+103 interesting insights for this more general problem but they do not prove completeness as we do here.
+104 Other complete constructions As mentioned earlier, Dym and Maron [2020] proved universality
+105 with respect to permutations and rigid motions for architectures using high-dimensional represen
+106 tations of the rotation group. Similar results were obtained inFinkelshtein et al. [2022], Gasteiger
+107 et al. [2021]. In Lim et al. [2022] universality was proven for Euclidean GNNs with very high-order
+108 permutation representations. In the planar case $d = 2$ , universality using low-dimensional features
+109 was achieved in Bökman et al. [2022]. For $d \geq 3$ our construction seems to be the first to achieve
+110 universality using low dimensional representations.
+111 For general fixed $d$ , there do exist algorithms that can separate point clouds up to equivalence
+112 in polynomial time, but they do not seem to lend themselves directly to neural architectures. In
+113 Kurlin [2022], Widdowson and Kurlin [2023] complete tests are described, but they represent each
+114 point cloud as a ‘multiset of multisets’ rather than as a vector as we do, and so are not suitable for
+115 gradient descent based learning. Efficient tests for equivalence of Euclidean graphs were described in
+116 Brass and Knauer [2000], Arvind and Rattan [2014], but they compute features that do not depend
+117 continuously on the point cloud.
+118 Weaker notions of universality In Widdowson and Kurlin [2022] the authors suggest a method
+119 for distinguishing almost every point clouds up to equivalence, similar to our result here on 1-EWL.
+120 Similarly, efficient separation/universality can also be obtained for point clouds with distinct principal
+121 axes Puny et al. [2021], Kurlin [2022]. Another setting in which universality is easier to obtain is
+122 when only rigid symmetries are considered and permutation symmetries are ignored Wang et al.
+123 [2022], Villar et al. [2021], Victor Garcia Satorras [2021]. All these results do not provide universality
+124 for all point clouds, with respect to the joint action of permutations and rigid motions.
+
+# 125 Mathematical notation
+
+A (finite) multiset $\left\{ { y _ { 1 } , \dotsc , y _ { N } } \right\}$ is an unordered collection of elements where repetitions are allowed.
+
+Let $\mathcal { G }$ be a group acting on a set $\mathcal { X }$ . For $X , Y \in { \mathcal { X } }$ , we say that $X = Y$ if $Y = g X$ for some $g \in { \mathcal { G } }$
+
+128 We say that a function $f : \mathcal { X } \mathcal { Y }$ is invariant if $f ( g x ) = f ( x )$ for all $x \in X , g \in G$ . We say that $f$
+129 is equivariant if $\mathcal { V }$ is also endowed with some action of $G$ and $f ( g x ) = g f ( x )$ for all $x \in \mathcal { X } , g \in \mathcal { G }$
+30 A separating invariant mapping is an invariant mapping that is injective, up to group equivalence:
+
+131 Definition 1.1 (Separating Invariant). Let $\mathcal { G }$ be a group acting on a set $\mathcal { X }$ . We say $F : \mathcal { X } \to \mathbb { R } ^ { K }$ is a $\mathcal { G }$ - separating invariant with embedding dimension 132 $K$ if for all $X , Y \in { \mathcal { X } }$ , $F ( X ) = F ( Y ) \Leftrightarrow X \frac { \ d Y } { \ d g } Y$ .
+
+133 We focus on the case where $\mathcal { X }$ is some Euclidean domain. To enable gradient-based learning, we
+134 shall need separating mappings that are continuous everywhere and differentiable almost everywhere.
+
+
+Figure 1: Distance matrices (Left), geometric degree histogram (Right) of pairs of point clouds. The generic pair is a randomly sampled pair of point clouds. Notice each of the nodes in each of the clouds has a distinct geometric degree. The Hard pair exhibits a distinct geometric degree for each node, but only within each point cloud, that is the pair shares an identical geometric degree histogram. The Harder example is a pair of point clouds with identical geometric degree histogram, and each point cloud is comprised of three pairs of points, with each pair having an identical geometric degree. Examples from Pozdnyakov and Ceriotti [2022] and Pozdnyakov et al. [2020].
+
+The symmetry group we consider for point clouds $( x _ { 1 } , \ldots , x _ { n } ) \in \mathbb { R } ^ { d \times n }$ is generated by a rotation matrix $R \in S { \mathcal { O } } ( d )$ , and a permutation $\sigma \in S _ { n }$ . These act on a point cloud by
+
+$$
+( R , \sigma ) _ { * } ( x _ { 1 } , \ldots , x _ { n } ) = ( R x _ { \sigma ^ { - 1 } ( 1 ) } , \ldots , R x _ { \sigma ^ { - 1 } ( n ) } ) .
+$$
+
+135 We denote this group by $s \mathcal { O } [ d , n ]$ . In some instances, reflections $R \in { \mathcal { O } } ( d )$ are also permitted,
+136 leading to a slightly larger symmetry group, which we denote by $\mathcal { O } [ d , n ]$ . Our goal shall be to
+137 construct separating invariants for these groups. For the sake of brevity, we do not discuss translation
+138 invariance and separation, as these can easily be achieved by centering the input point clouds, once
+139 $s \mathcal { O } [ d , n ]$ (or ${ \mathcal { O } } [ d , n ] )$ separating invariants are constructed, see Dym and Gortler [2023].
+
+For simplicity of notation, throughout this paper, we focus on the case $d = 3$ . In Appendix $\textrm { C }$ we explain how our constructions and theorems can be generalized to $d > 3$ .
+
+# 142 2 Euclidean Graph Isomorphism Tests
+
+143 The $k$ -WL Graph Isomorphism Test Weisfeiler and Leman [1968] is a classical paradigm for testing
+144 the isomorphism of combinatorial graphs, which we shall now briefly describe. Let $\mathcal { G }$ be a graph with
+145 vertices indexed by $[ n ] = \{ 1 , 2 , \dots , \bar { n } \}$ . We denote each ordered $k$ -tuple of vertices by a multi-index
+146 $\mathbf { i } = ( i _ { 1 } , \dots , i _ { k } ) \in [ n ] ^ { k }$ . Essentially, for each such $k$ -tuple i, the test maintains a coloring $\mathbf { C } ( \mathbf { i } )$ that
+147 belongs to a discrete set, and updates it iteratively. First, the coloring of each $k$ -tuple is assigned an
+148 initial value that encodes the isomorphism type of the corresponding $k$ -dimensional subgraph:
+
+$$
+\mathbf { C } _ { ( 0 ) } = \mathbf { C } _ { ( 0 ) } ( \mathbf { i } ) , \mathbf { i } \in [ n ] ^ { k } .
+$$
+
+149 Then the color of each $k$ -tuple $\mathbf { i }$ is iteratively refined according to the colors of its ‘neighboring’
+150 $k$ -tuples. The update rule is given by
+
+$$
+\mathbf { C } _ { ( \mathsf { t } + 1 ) } ( \mathbf { i } ) = \mathbf { E m b e d } ^ { ( t + 1 ) } \left( \mathbf { C } _ { ( \mathsf { t } ) } ( \mathbf { i } ) , \ P \left( \mathbf { C } _ { ( \mathsf { t } ) } ( \mathbf { i } [ j \setminus 1 ] ) , \ldots , \mathbf { C } _ { ( \mathsf { t } ) } ( \mathbf { i } [ j \setminus k ] ) \right) \mid j \in [ n ] \ P \right) ,
+$$
+
+where $\mathbf { i } [ j \mathbf { \theta } \backslash t ]$ is the multi-index i with its $t$ -th coordinate replaced by $j$ ; e.g. for $j = 1$ , $\mathbf { i } [ j \setminus 1 ] =$ $( j , i _ { 2 } , \ldots , i _ { k } )$ . Embed is a function that maps its input injectively to some discrete set. This process is repeated $T$ times to obtain a final coloring $\mathfrak { Y } \mathbf { C } _ { ( \mathbf { T } ) } ( \mathbf { i } ) \mathbb { Y } _ { \mathbf { i } \in [ n ] ^ { k } }$ . A global label is then calculated by
+
+$$
+\mathbf { C } _ { \mathcal { G } } = \mathbf { E m b e d } ^ { ( T + 1 ) } \left( \left\{ \mathbf { C } _ { ( \mathbf { T } ) } ( \mathbf { i } ) \ | \ \mathbf { i } \in [ n ] ^ { k } \right\} \right) ,
+$$
+
+where 151 $\mathbf { E m b e d } ^ { ( T + 1 ) }$ is a function that maps label-multisets injectively to some discrete set.
+
+152 To test whether two graphs $\mathcal { G }$ and $\mathcal { G } ^ { \prime }$ are isomorphic, the $k$ -WL test computes the corresponding
+153 colorings $\mathbf { C } _ { \mathcal { G } }$ and $\mathbf { C } _ { \mathcal { G } ^ { \prime } }$ for some chosen $T$ . If $\mathbf { C } _ { \mathcal { G } } \neq \mathbf { C } _ { \mathcal { G } ^ { \prime } }$ then $\mathcal { G }$ and $\mathcal { G } ^ { \prime }$ are guaranteed not to be
+154 isomorphic, whereas if $\mathbf { C } _ { \mathcal { G } } = \mathbf { C } _ { \mathcal { G } ^ { \prime } }$ , then $\mathcal { G }$ and $\mathcal { G } ^ { \prime }$ may either be isomorphic or not, and the test does
+155 not, in general, provide a decisive answer for combinatorial graphs. It is known that this test is able
+156 to distinguish a strictly larger class of combinatorial graphs for every strict increase in the value of $\mathrm { k }$ ,
+157 i.e. it is a strict hierarchy of tests in terms of distinguishing power Cai et al. [1992], Grohe [2017].
+158 Vanilla- $k$ -WL tests As a first step from a combinatorial to a Euclidean setting, we identify each
+159 point cloud $\boldsymbol { X } = ( x _ { 1 } , \ldots , x _ { n } ) \in \mathbb { R } ^ { { \hat { d } } \times n }$ with a complete graph on $n$ vertices, wherein each edge $( i , j )$
+160 is endowed with the weight $w _ { i j } ( X ) = \langle x _ { i } , x _ { j } \rangle$ . We name such a graph a Euclidean graph. Similarly
+161 to $k$ -WL for combinatorial graphs, $k$ -WL for Euclidean graphs maintains a coloring of the $k$ -tuples of
+162 vertices. However, the initial color of each $k$ -tuple i is not a discrete label as in the combinatorial case,
+163 but rather a $k \times k$ matrix of continuous features, which represent all edge weights $w _ { i j }$ corresponding
+164 to pairs of indices from i. We will call the $k$ -WL test defined by this initial coloring the vanilla $k$ -WL
+165 test. This test is invariant by construction to reflections, rotations, and permutations. We note that our
+166 definition of the vanilla $k$ -EWL test via inner products follows that of Lim et al. [2022]. Another
+167 popular, and essentially equivalent, formulation, uses distances instead.
+168 $k$ -EWL tests An inherent limitation of the Vanilla-1-EWL test is that no pairwise Euclidean
+169 information is passed, yielding it rather uninformative. Indeed, Pozdnyakov and Ceriotti [2022]
+170 proposed a Euclidean analog of the 1-WL test, where the update rule (2) is replaced with
+
+$$
+{ \bf C } _ { \left( { \bf t } + { \bf 1 } \right) } ( i ) = { \bf E m b e d } ^ { \left( { \bf t } \right) } \left( { \bf C } _ { \left( { \bf t } \right) } ( i ) , \left\{ \left( { \bf C } _ { \left( { \bf t } \right) } ( j ) , \left. x _ { i } - x _ { j } \right. \right) , j \neq i \right\} \right) .
+$$
+
+171 We call this test the 1-EWL test. This formulation is motivated by the fact that many symmetry
+172 preserving networks for point clouds are in fact a realization of it, though they use Embed functions
+173 that are continuous and, in general, may assign the same value to different multisets. Consequently,
+174 the separation power of these architectures is at most that of 1-EWL with discrete injective hash
+175 functions. Moreover, the separation power will be equivalent if continuous injective multiset functions
+176 are used for embedding, as we discuss in Section 4.
+177 The 1-EWL test strengthens the Vanilla-1-EWL test by allowing the messages passed to a node
+178 in each step to contain not only previous colorings but also geometric information in the form of
+179 pairwise distances. More generally, we shall use the term $k$ -EWL to refer to tests that follow the
+180 Euclidean $k$ -WL paradigm, but incorporate geometric invariants into the message-passing procedure.
+181 In particular, for point clouds with dimension 3, we define the 2-SEWL test (’SE’ for Special
+182 Euclidean) by replacing the update step (2) with
+
+$$
+\mathbf { C } _ { ( \mathsf { t } + 1 ) } ( i , j ) = \mathbf { E m b e d } ^ { ( t ) } \left( \mathbf { C } _ { ( \mathsf { t } ) } ( i , j ) , \ P \left( \mathbf { C } _ { ( \mathsf { t } ) } ( k , j ) , \mathbf { C } _ { ( \mathsf { t } ) } ( i , k ) , \langle x _ { i } \times x _ { j } , x _ { k } \rangle \right) \ P _ { k = 1 } ^ { n } \right) .
+$$
+
+83 Note that $\langle x _ { i } \times x _ { j } , x _ { k } \rangle$ is equal to the determinant of the $3 \times 3$ matrix whose rows are the three vectors
+84 $x _ { i } , x _ { j } , x _ { k }$ , which makes this a natural choice as all polynomial invariants of $s \mathcal { O } ( 3 )$ are generated by
+85 these determinants and the inner products we use for the initial coloring Kraft and Procesi [1996].
+186 We note that, Using the fact that $O ( 3 )$ is just two copies of $S O ( 3 )$ , it is not difficult to generalize
+187 2-SEWL to a complete $\mathcal { O } [ 3 , n ]$ test, which we name 2-EWL. for general $d$ , similar complete $( d - 1 )$ -
+188 SEWL and $( d - 1 )$ -EWL tests can be formulated for point clouds in $\mathbb { R } ^ { d }$ via the Hodge-star operator;
+189 see Appendix C for more details.
+190 In the rest of this section, we shall prove that the 2-SEWL, 2-EWL and vanilla 3-EWL tests are
+191 complete when applied to $\mathbb { R } ^ { 3 \times n }$ , even when using a single iteration $T = 1$ ). We shall also show that
+192 two iterations of the 1-EWL test is complete, except on a set of measure zero.
+
+# 193 2.1 Generic completeness of 1-EWL
+
+The separation power of 1-EWL is closely linked to the notion of geometric degree: For a point cloud $X = ( x _ { 1 } , \ldots , x _ { n } )$ , we define the geometric degree $d ( i , X )$ of the $i$ th point, and the induced geometric degree histogram $d _ { H } ( X )$ , to be the multisets
+
+$$
+d ( i , X ) = \{ \| x _ { 1 } - x _ { i } \| , \ldots , \| x _ { n } - x _ { i } \| \} , \quad d _ { H } ( X ) = \{ d ( 1 , X ) , \ldots , d ( n , X ) \} .
+$$
+
+It is not difficult to see that if $d _ { H } ( X ) \neq d _ { H } ( Y )$ then $X$ and $Y$ can be separated by a single 1-EWL iteration . An example of such a pair is shown in the left of Figure 1. With two 1-EWL iterations, we show that can separate $X$ and $Y$ even if $d _ { H } ( X ) = d _ { H } ( Y )$ , provided that they both belong to the set of point clouds defined by
+
+$$
+\mathbb { R } _ { d i s t i n c t } ^ { 3 \times n } = \{ X \in \mathbb { R } ^ { 3 \times n } | d ( i , X ) \neq d ( j , X ) \ \forall i \neq j \} .
+$$
+
+94 Such an example, taken from Pozdnyakov et al. [2020], is visualized in the middle column of Figure
+
+Theorem 2.1. Two iterations of the 1-EWL test assign two point clouds $\mathcal { X } , Y \in \mathbb { R } _ { d i s t i n c t } ^ { 3 \times n }$ the same $X \underset { \mathcal { O } [ 3 , n ] } { = } Y$
+
+In the appendix we show that the complement of 198 $\mathbb { R } _ { d i s t i n c t } ^ { 3 \times n }$ has measure zero. Thus this result complements long-standing results for combinatorial graphs, stating that 1-WL can classify almost 200 all such graphs as the number of nodes tends to infinity Babai et al. [1980].
+
+The right-most pair of point clouds (’Harder’) in Figure 1 is taken from Pozdnyakov and Ceriotti [2022]. The degree histograms of these point clouds are identical, and they are not in $\mathbb { R } _ { d i s t i n c t } ^ { 3 \times n }$ . Pozdnyakov and Ceriotti [2022] show that this pair cannot be separated by any number of 1-EWL iterations.
+
+# 2.2 Is 1-EWL All You Need?
+
+Theorem 2.1 shows that the probability of a failure of the 1-EWL is zero. A natural question to ask is whether more powerful tests are needed. We believe the answer to this question is yes. Typical hypothesis classes used for machine learning, such as neural networks, are Lipschitz continuous Gama et al. [2020]. In this setting, failure to separate on a measure zero set could have implications for non-trivial positive measure. This phenomenon is depicted in the figure in the inset. On the right, a plot of a Gaussian distribution centered at $x \in \mathbb { R }$ , depicting a target function is shown in blue. In red, a schematic plot of how a Lipschitz continuous function that does not distinguish $x$ from $y$ would model the target function.
+
+
+
+# 3 2-SEWL and Vanilla 3-EWL are complete
+
+We now prove that the vanilla 3-EWL test is complete.
+
+Theorem 3.1. For every $X , Y \in \mathbb { R } ^ { 3 \times n }$ , a single iteration of the vanilla 3-EWL test assigns $X$ and $Y$ the same value if and only if $\cdot _ { X } \underset { \mathcal { O } [ 3 , n ] } { = } Y$ .
+
+Proof. First, it is clear that if $X \_ { \phantom { } _ { \mathcal { O } [ 3 . n ] } } Y$ then $\mathbf { C } _ { \mathcal { G } } ( X ) = \mathbf { C } _ { \mathcal { G } } ( Y )$ since the vanilla 3-EWL test is invariant by construction. The challenge is proving the other direction. To this end, let us assume that $\mathbf { C } _ { \mathcal { G } } ( X ) = \mathbf { C } _ { \mathcal { G } } ( Y )$ , and assume without loss of generality that $r : = \mathrm { r a n k } ( X ) \geq \mathrm { r a n k } ( Y )$ . Note that $X$ has rank $r \leq 3$ , and so it must contain some three points whose rank is also $r$ . By applying a permutation to $X$ we can assume without loss of generality that these three points are the first three points. The initial coloring ${ \bf C _ { 0 } } ( 1 , 2 , 3 ) ( X )$ of this triplet is their Gram matrix $( \langle x _ { i } , x _ { j } \rangle ) _ { 1 \leq i , j \leq 3 }$ , which has the same rank $r$ as the space spanned by the three points. Next, since $\mathbf { C } _ { \mathcal { G } } ( X ) = \bar { \mathbf { C } } _ { \mathcal { G } } ( \bar { Y } )$ are the same, there exists a triplet of points $i , j , k$ such that $\mathbf { C } _ { ( 1 ) } ( 1 , 2 , 3 ) ( X ) = \mathbf { C } _ { ( 1 ) } ( i , j , k ) ( Y )$ which implies that the initial colorings are also the same. By applying a permutation to $Y$ we can assume without loss of generality that $i = 1 , j = 2 , k = 3$ . Next, since the Gram matrix of $x _ { 1 } , x _ { 2 } , x _ { 3 }$ and $y _ { 1 } , y _ { 2 } , y _ { 3 }$ are identical, there is an orthogonal transformation that takes $x _ { i }$ to $y _ { i }$ for $i = { 1 , 2 , 3 }$ , and by applying this transformation to all points in $X$ we can assume without loss of generality that $x _ { i } = y _ { i }$ for $i = { 1 , 2 , 3 }$ . It remains to show that the rest of the points of $X$ and $Y$ are equal, up to permutation. To see this, first note that $X$ and $Y$ have the same rank since
+
+$$
+r = \operatorname { r a n k } ( X ) \geq \operatorname { r a n k } ( Y ) \geq \operatorname { r a n k } ( y _ { 1 } , y _ { 2 } , y _ { 3 } ) = \operatorname { r a n k } ( x _ { 1 } , x _ { 2 } , x _ { 3 } ) = r .
+$$
+
+Thus the space spanned by $x _ { 1 } = y _ { 1 } , x _ { 2 } = y _ { 2 } , x _ { 3 } = y _ { 3 }$ contains all points in $X$ and $Y$ . Next, we can deduce from the aggregation rule defining $\mathbf { C _ { 1 } } ( 1 , 2 , 3 ) ( X )$ in (2), that
+
+$$
+\begin{array} { r } { \sharp ( \langle x _ { j } , x _ { 1 } \rangle , \langle x _ { j } , x _ { 2 } \rangle , \langle x _ { j } , x _ { 3 } \rangle ) \mid j \in [ n ] \mathbb { J } = \mathbb { f } ( \langle y _ { j } , y _ { 1 } \rangle , \langle y _ { j } , y _ { 2 } \rangle , \langle y _ { j } , y _ { 3 } \rangle ) \mid j \in [ n ] \mathbb { J } . } \end{array}
+$$
+
+222 Since all points in $X$ and $Y$ belong to the span of $x _ { 1 } = y _ { 1 } , x _ { 2 } = y _ { 2 } , x _ { 3 } = y _ { 3 }$ , $X$ and $Y$ are the same
+223 up to permutation of the last $n - 3$ coordinates. This concludes the proof of the theorem. □
+
+224 We next outline the completeness proof of the more efficient 2-SEWL.
+
+Theorem 3.2. For every 25 $X , Y \in \mathbb { R } ^ { 3 \times n }$ , a single iteration of the 2-SEWL test assigns $X$ and $Y$ the same value if and only if 26 $X _ { \_ { S O [ 3 , n ] } } Y$ .
+
+Proof idea. The completeness of Vanilla-3-EWL was based on the fact that its initial coloring captures the Gram matrix of triplets of vectors that span the space spanned by $X$ , and on the availability of projections onto this basis in the aggregation step defined in (2). Our proof for 2-EWL completeness relies on the fact that a pair of non-degenerate vectors $x _ { i } , x _ { j }$ induces a basis $x _ { i } , x _ { j } , x _ { i } \times x _ { j }$ of $\mathbb { R } ^ { 3 }$ The Gram matrix of this basis can be recovered from the Gram matrix of the first two points $x _ { i } , x _ { j }$ and the projection onto this basis can be obtained from the extra geometric information we added in (18). A full proof is given in the appendix. □
+
+To conclude this section, we note that the above theorem can be readily used to also show that the 2-EWL test us also complete with respect to $\mathcal { O } [ 3 , n ]$ . For details see Appendix A.
+
+# 236 4 WL-equivalent GNNs with continuous features
+
+In the previous section we discussed the generic completeness of 1-EWL and the completeness of 2-SEWL and vanilla 3-EWL. The Embed functions in these tests are hash functions, which can be redefined independently for each pair of point clouds $X , Y$ . In this section, our goal is to explain how to construct GNNs with equivalent separation power to that of these tests, while choosing continuous, piecewise differentiable Embed functions that are injective. While this question is well studied for combinatorial graphs with discrete features Xu et al. [2018], Morris et al. [2018], Maron et al. [2019], Aamand et al. [2022], here we focus on addressing it for Euclidean graphs with continuous features.
+
+# 44 4.1 Multiset injective functions
+
+245 Let us first review some known results on injective multiset functions. Recall that a function defined on
+246 multisets with $n$ elements coming from some alphabet $\Omega \subseteq \mathbb { R } ^ { D }$ can be identified with a permutation
+247 invariant function defined on $\Omega ^ { n }$ . A multiset function is injective if and only if its corresponding
+248 function on $\Omega ^ { n }$ is separating with respect to the action of the permutation group (see Definition 1.1).
+249 In Corso et al. [2020], Wagstaff et al. [2022] it was shown that for any separating, permutation
+250 invariant mappings from $\mathbb { R } ^ { n }$ to $\mathbb { R } ^ { K }$ , the embedding dimension $K$ will be at least $n$ . Two famous
+251 examples of continuous functions that achieve this bound are
+
+$$
+\Psi _ { s o r t } ( x _ { 1 } , \ldots , x _ { n } ) = \mathrm { s o r t } ( x _ { 1 } , \ldots , x _ { n } ) \quad { \mathrm { a n d } } \quad \Psi _ { p o w } ( x _ { 1 } , \ldots , x _ { n } ) = \left( \sum _ { i = 1 } ^ { n } x _ { i } ^ { t } \right) _ { t = 1 } ^ { n } .
+$$
+
+252 When the multiset elements are in $\mathbb { R } ^ { D }$ , the picture is similar: if there exists a continuous, permutation
+253 invariant and separating mapping from $\mathbb { R } ^ { D \times n }$ to $\mathbb { R } ^ { K }$ , then necessarily $K \geq n \cdot D$ Joshi et al. [2022].
+254 In Dym and Gortler [2023] it is shown that continuous separating invariants for $D > 1$ , with near
+255 optimal dimension, can be derived from the $D = 1$ separating invariants $\Psi = \Psi _ { p o w }$ or $\Psi = \Psi _ { s o r t }$ ,
+256 by considering random invariants of the form
+
+$$
+\mathbf { E m b e d } _ { \theta } ( x _ { 1 } , \dots , x _ { n } ) = \langle b _ { j } , \Psi \left( a _ { j } ^ { T } x _ { 1 } \dots , a _ { j } ^ { T } x _ { n } \right) \rangle , j = 1 , \dots , K .
+$$
+
+257 where each $a _ { j }$ and $b _ { j }$ are $d$ and $n$ dimensional random vectors, and we denote $\theta \quad =$
+258 $( a _ { 1 } , \dots , a _ { K } , b _ { 1 } , \dots , b _ { K } ) \in \mathbb { R } ^ { K ( D + n ) }$ . When $K = 2 n D + 1$ , for almost any choice of $\theta$ , the
+259 function $\mathbf { E m b e d } _ { \theta }$ will be separating on $\mathbb { R } ^ { D \times n }$ . Thus the embedding dimension in this construction is
+260 optimal up to a multiplicative constant of two.
+261 An important property of this results of Dym and Gortler [2023] for our discussion, is that the
+262 embedding dimension $K$ can be reduced if the domain of interest is a non-linear subset of $\mathbb { R } ^ { D \times n }$
+263 of low dimension. For example, if the domain of interest is a finite union of lines in $\mathbb { R } ^ { D \times n }$ , then
+264 the instrinsic dimension of the domain is 1, and so we will only need an embedding dimension of
+265 $K = 2 \cdot 1 + 1 = 3$ . Thus, the required embedding dimension depends on the intrinsic dimension of
+266 the domain rather than on its ambient dimension, which in our case is $n \cdot D$ .
+267 To formulate these results precisely we will need to introduce some real algebraic geometry terminol
+268 ogy (see Basu et al. [2006] for more details): A semi-algebraic subset of a real finite-dimensional
+269 vector space is a finite union of subsets that are defined by polynomial equality and inequality
+270 constraints. For example, polygons, hyperplanes, spheres, and finite unions of these sets, are all
+271 semi-algebraic sets. A semi-algebraic set is always a finite union of manifolds, and its dimension is
+272 the maximal dimension of the manifolds in this union. Using these notions, we can now state the
+273 ‘intrinsic version’ of the results in Dym and Gortler [2023]:
+74 Theorem 4.1 (Dym and Gortler [2023]). Let $\mathcal { X }$ be an $S _ { n }$ -invariant semi-algebraic subset of $\mathbb { R } ^ { D \times n }$ of
+75 dimension $D _ { \mathcal { X } }$ . Denote $K = 2 D _ { \mathcal { X } } + 1$ . Then for Lebesgue almost every $\bar { \theta \in \mathbb { R } ^ { K ( D + n ) } }$ the mapping
+76 $E m b e d _ { \theta } : \mathcal { X } \mathbb { R } ^ { K }$ is $S _ { n }$ invariant and separating.
+
+# 4.2 Multiset injective functions for GNNs
+
+78 We now return to discuss GNNs and explain the importance of the distinction between the intrinsic and ambient dimensions in our context. Suppose we are given 279 $n$ initial features $( h _ { 1 } ^ { ( 0 ) } , \ldots , h _ { n } ^ { ( 0 ) } )$ in 80 $\mathbb { R } ^ { d }$ , and for simplicity let us assume they are recursively refined via the simple aggregation rule:
+
+$$
+h _ { i } ^ { ( t + 1 ) } = \mathbf { E m b e d } ^ { ( t ) } \left( \{ h _ { j } ^ { ( t ) } \} _ { j = 1 , j \neq i } ^ { n } \right) .
+$$
+
+281 Let us assume that each $\mathbf { E m b e d } ^ { ( t ) }$ is injective on the space of all multisets with $n - 1$ elements in
+282 the ambient space of ${ h } _ { j } ^ { ( t ) }$ . Then the injectivity of $\mathbf { E m b e d } ^ { ( 1 ) }$ implies that $h _ { i } ^ { ( 1 ) }$ is of dimension at least
+283 $( n - 1 ) \cdot d$ . The requirement that $\mathbf { E m b e d } ^ { ( 2 ) }$ is injective on a mult-set of $n - 1$ features in $\mathbb { R } ^ { ( n - 1 ) \cdot d }$
+284 implies that ${ h } _ { i } ^ { ( 2 ) }$ will be of dimension at least $( n - 1 ) ^ { 2 } \cdot d$ . Continuing recursively with this argument
+285 we obtain an estimate of $\sim ( n - 1 ) ^ { T } d$ for the dimensions of each $h _ { i } ^ { ( T ) }$ after $T$ iterations of (7).
+
+Fortunately the analysis presented above is overly pessimistic, because it focused only on 9 the ambient dimension. Let us denote the matrix containing all $n$ features at time $t$ by $H ^ { ( t ) }$ . Then $H ^ { ( t ) } = \bar { F _ { t } } ( H ^ { ( 0 ) } )$ , where $F _ { t }$ is the con2 catenation of all $\mathbf { E m b e d } ^ { ( t ^ { \prime } ) }$ functions from all 3 previous time-steps. Thus $H ^ { ( t ) }$ resides in the set $\mathbf { \widehat { F } } _ { t } ( \mathbb { R } ^ { d \times n } )$ . Here we again rely on results from algebraic geometry: if $F _ { t }$ is a composition of piecewise linear and polynomial mappings, then it is a semi-algebraic mapping, which means that $F _ { t } ( H ^ { ( 0 ) } )$ will be a semi-algebraic set of di9 mension $\mathrm { d i m } ( \mathbb { R } ^ { n \times d } ) = n \cdot d$ . This point will be 0 explained in more detail in the proof of Theorem 4.2. By Theorem 4.1 we can then use $\mathbf { E m b e d } _ { \theta }$ as a multiset injective function on $\mathcal { X } _ { t }$ with a fixed embedding dimension of $2 n \cdot d + 1$ which does not depend on $T$ . This is visualized in Figure 2.
+
+
+Figure 2: The exponential growth in the dimension that would result from only considering the ambient feature dimension can be avoided by exploiting the constant intrinsic dimension.
+
+2-SEWLnet Based on the discussion above, we can devise architectures that simulate the various tests discussed in this paper and have reasonable feature dimensions throughout the construction, In particular, we can simulate $T$ iterations of the 2-SEWL test by replacing all $\mathbf { E m b e d } ^ { ( t ) }$ functions1with $\mathbf { E m b e d } _ { \theta } ^ { ( t ) }$ , where in our implementation we choose $\Psi = \Psi _ { s o r t }$ in (6). The embedding dimension for all $t$ is taken to be $6 n + 1$ , since the input is in $\mathbb { R } ^ { 3 \times n }$ . We denote the obtained parametric function by $F _ { \phi }$ . Based on a formalization of the discussion above, we prove in the appendix that $F _ { \phi }$ has the separation power of the complete 2-SEWL test, and therefore $F _ { \phi }$ is separating.
+
+10 Theorem 4.2. Let $F _ { \phi }$ denote the parametric function simulating the 2-SEWL test. Then for Lebesgue almost every 311 $\phi$ the function $F _ { \phi } : \mathbb { R } ^ { 3 \times n } \mathbb { R } ^ { 6 n + 1 }$ is separating with respect to the action of $s \mathcal { O } [ 3 , n ]$
+
+To conclude this subsection, we note that while sort-based permutation invariants are used as aggregators in GNNs Zhang et al. [2020, 2018], Blondel et al. [2020], the polynomial-based aggregators $\Psi _ { p o w }$ are not as common. To a certain extent, one can use the approach in $\mathrm { X u }$ et al. [2018], Maron et al. [2019], replace the polynomials in $\Psi _ { p o w }$ by MLPs, and justify this by the universal approximation power of MLPs. A limitation of this approach is that it only guarantees separation at the limit.
+
+# 317 5 Synthetic Experiments
+
+In this section we implement 2-SEWLnet, described in Section 4, and empirically evaluate its separation power, and the separation power of alternative $s \mathcal { O } [ 3 , n ]$ invariant point cloud architectures. We trained the architectures on permuted and rotated variations of highly-challenging point-cloud pairs, and measured separation by the test classification accuracy. We considered three pairs of point clouds (Hard1-Hard3) from Pozdnyakov et al. [2020]. These pairs were designed to be challenging for distance-based invariant methods. However, our analysis reveals that they are in fact separable by two iterations of the 1-EWL test. We then consider a pair of point clouds from Pozdnyakov and Ceriotti [2022] which was proven to be indstinguishable by the 1-EWL tests. The results of this experiment are given in Table 1. Further details on the experimental setup appear in Appendix B.
+
+Table 1: Separation accuracy on challenging 3D point clouds. Hard examples correspond to point clouds which cannot be distinguished by a single 1-EWL iteration but can be distinguished by two iterations, according to Theorem 2.1. The Harder example is a point cloud not distinguishable by 1-EWL Pozdnyakov and Ceriotti [2022]. GNN implementations and code pipeline based on Joshi et al. [2022].
+
+
Separation
complete
≌1-EWL
unknown
unknown
unknown
Point Clouds
2-SEWLnet
EGNN
MACE
TFN
GVPGNN
Hard1
100 %
100 %
100%
100 %
100 %
Hard2
100 %
100 %
100 %
100 %
50%
Hard3
100 %
100 %
100 %
100 %
95.0 ± 15.0 %
Harder
100 %
50%
100 %
100 %
53.7 ± 13.1 %
+
+327 As expected, we find that 2-SEWLnet, which has complete separation power, succeeded in perfectly
+328 separating all examples. We also found that EGNN Victor Garcia Satorras [2021], which is essentially
+329 an implementation of 1-EWL, does not separate the Harder example, but does separate the Hard
+330 example after two iterations, as predicted by Theorem 2.1. We also considered three additional
+331 invariant point cloud models whose separation power is not as well understood. We find that MACE
+332 Batatia et al. [2022] and TFN Thomas et al. [2018] achieve perfect separation, (when applying them
+333 with at least 3-order correlations and three-order $S O ( 3 )$ representations). The third GVPGNN Jing
+334 et al. [2021] architecture attains mixed results. We note that we cannot necessarily deduce from our
+335 empirical results that MACE and TFN are complete. While it is true that TFN is complete when
+336 considering arbitrarily high order representations Dym and Maron [2020], it is not clear whether
+337 order three representation suffices for complete separation. We conjecture that this is not the case.
+338 However, finding counterexamples is a challenging problem we leave for future work.
+
+Future Work In this work, we presented several invariant tests for point clouds that are provably complete, and have presented and implemented 2-SEWL-net which simulates the complete 2-SEWL test. Currently, this is a basic implementation that only serves to corroborate our theoretical results. A practically useful implementation requires addressing several challenges, including dealing with point clouds of different sizes, the non-trivial $\sim n ^ { 4 }$ complexity of computing even the relatively efficient 2-SEWL-net, and finding learning tasks where complete separation leads to gains in performance. We are actively researching these directions and hope this paper will inspire others to do the same.
+
+References
+347 Patrick Reiser, Marlen Neubert, Andr’e Eberhard, Luca Torresi, Chen Zhou, Chen Shao, Houssam Metni, Clint van Hoesel, Henrik Schopmans, Timo Sommer, and Pascal Friederich. Graph neural networks for materials science and chemistry. Communications Materials, 3(1):93, 2022. doi: 10.1038/s43246-022-00315-6. Zixuan Yi, Iadh Ounis, and Craig Macdonald. Graph contrastive learning with positional representation for recommendation. In Jaap Kamps, Lorraine Goeuriot, Fabio Crestani, Maria Maistro, Hideo Joho, Brian Davis, Cathal Gurrin, Udo Kruschwitz, and Annalina Caputo, editors, Advances in Information Retrieval, pages 288–303, Cham, 2023. Springer Nature Switzerland. ISBN 978-3-031-28238-6.
+356 Justin Gilmer, Samuel S. Schoenholz, Patrick F. Riley, Oriol Vinyals, and George E. Dahl. Neural message passing for quantum chemistry. CoRR, 2017. Limei Wang, Yi Liu, Yuchao Lin, Haoran Liu, and Shuiwang Ji. Comenet: Towards complete and efficient message passing for 3d molecular graphs, 2022.
+360 Marc Finzi, Max Welling, and Andrew Gordon Wilson. A practical method for constructing equivariant multilayer perceptrons for arbitrary matrix groups. arXiv preprint arXiv:2104.09459, 2021.
+362 Xu Ma, Yuqian Zhou, Huan Wang, Can Qin, Bin Sun, Chang Liu, and Yun Fu. Image as set of points, 2023.
+364 Soledad Villar, David W Hogg, Kate Storey-Fisher, Weichi Yao, and Ben Blum-Smith. Scalars are universal: Equivariant machine learning, structured like classical physics. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P.S. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, volume 34, pages 28848–28863. Curran Associates, Inc., 2021. URL https://proceedings.neurips.cc/paper_files/paper/2021/file/ f1b0775946bc0329b35b823b86eeb5f5-Paper.pdf. Chaitanya K. Joshi, Cristian Bodnar, Simon V. Mathis, Taco Cohen, and Pietro Liò. On the expressive power of geometric graph neural networks. NeurIPS Workshop on Symmetry and Geometry in Neural Representations, 2022.
+373 Zhengdao Chen, Soledad Villar, Lei Chen, and Joan Bruna. On the equivalence between graph isomorphism testing and function approximation with gnns. Advances in neural information processing systems, 32, 2019.
+376 Nadav Dym and Haggai Maron. On the universality of rotation equivariant point cloud networks. ArXiv, abs/2010.02449, 2020.
+378 Nathaniel Thomas, Tess Smidt, Steven Kearnes, Lusann Yang, Li Li, Kai Kohlhoff, and Patrick Riley. Tensor field networks: Rotation-and translation-equivariant neural networks for 3d point clouds. arXiv preprint arXiv:1802.08219, 2018. Derek Lim, Joshua Robinson, Lingxiao Zhao, Tess Smidt, Suvrit Sra, Haggai Maron, and Stefanie Jegelka. Sign and basis invariant networks for spectral graph representation learning. arXiv preprint arXiv:2202.13013, 2022. Sergey N. Pozdnyakov and Michele Ceriotti. Incompleteness of graph neural networks for points clouds in three dimensions, 2022. Vikraman Arvind and Gaurav Rattan. The complexity of geometric graph isomorphism. In Electron. Colloquium Comput. Complex., volume 21, page 70, 2014. Nadav Dym and Shahar Ziv Kovalsky. Linearly converging quasi branch and bound algorithms for global rigid registration. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1628–1636, 2019.
+391 V. Kurlin. Computable complete invariants for finite clouds of unlabeled points under euclidean isometry. ArXiv, abs/2207.08502, 2022.
+393 Christopher Morris, Martin Ritzert, Matthias Fey, William L Hamilton, Jan Eric Lenssen, Gurkirt Rattan, and Martin Grohe. Weisfeiler and leman go neural: Higher-order graph neural networks. arXiv preprint arXiv:1810.02244, 2018.
+396 Haggai Maron, Heli Ben-Hamu, Hadar Serviansky, and Yaron Lipman. Provably powerful graph networks, 2019. URL https://arxiv.org/abs/1905.11136. Emiel Hoogeboom. Max Welling Victor Garcia Satorras. E(n) equivariant graph neural networks. Proceedings of the 38-th International Conference on Machine Learning, PMLR(139), 2021. Kristof Schütt, Pieter-Jan Kindermans, Huziel Enoc Sauceda Felix, Stefan Chmiela, Alexandre Tkatchenko, and Klaus-Robert Müller. Schnet: A continuous-filter convolutional neural network for modeling quantum interactions. In I. Guyon, U. Von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper_ files/paper/2017/file/303ed4c69846ab36c2904d3ba8573050-Paper.pdf. Yael Kapon, Abhijit Saha, Tal Duanis-Assaf, Thijs Stuyver, Amir Ziv, Tzuriel Metzger, Shira Yochelis, Sason Shaik, Ron Naaman, Meital Reches, et al. Evidence for new enantiospecific interaction force in chiral biomolecules. Chem, 7(10):2787–2799, 2021. Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks?, 2018.
+411 Nadav Dym and Steven J. Gortler. Low dimensional invariant embeddings for universal geometric learning, 2023.
+413 Ben Finkelshtein, Chaim Baskin, Haggai Maron, and Nadav Dym. A simple and universal rotation equivariant point-cloud network. arXiv preprint arXiv:2203.01216, 2022.
+415 Johannes Gasteiger, Florian Becker, and Stephan Günnemann. Gemnet: Universal directional graph neural networks for molecules, 2021. URL https://arxiv.org/abs/2106.08903. Georg Bökman, Fredrik Kahl, and Axel Flinth. Zz-net: A universal rotation equivariant architecture for 2d point clouds. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10976–10985, 2022. Daniel Widdowson and Vitaliy Kurlin. Recognizing rigid patterns of unlabeled point clouds by complete and continuous isometry invariants with no false negatives and no false positives. arXiv preprint arXiv:2303.15385, 2023.
+423 Peter Brass and Christian Knauer. Testing the congruence of d-dimensional point sets. In Proceedings of the sixteenth annual symposium on Computational geometry, pages 310–314, 2000.
+425 Daniel Widdowson and Vitaliy Kurlin. Resolving the data ambiguity for periodic crystals. In Advances in Neural Information Processing Systems, 2022.
+427 Omri Puny, Matan Atzmon, Edward J Smith, Ishan Misra, Aditya Grover, Heli Ben-Hamu, and Yaron Lipman. Frame averaging for invariant and equivariant network design. In International Conference on Learning Representations, 2021.
+430 Sergey N Pozdnyakov, Michael J Willatt, Albert P Bartók, Christoph Ortner, Gábor Csányi, and Michele Ceriotti. Incompleteness of atomic structure representations. Physical Review Letters, 125(16):166001, 2020.
+433 Boris Weisfeiler and A. A. Leman. The reduction of a graph to canonical form and the algebra which appears therein. Nauchno-Technicheskaya Informatsia, 2:12–16, 1968.
+435 Jin-Yi Cai, Martin Fürer, and Neil Immerman. An optimal lower bound on the number of variables for graph identification. Combinatorica, 12(4):389–410, 1992. doi: 10.1007/BF01305232.
+437 Martin Grohe. Descriptive complexity, canonisation, and definable graph structure theory, volume 47. Cambridge University Press, 2017.
+
+439 Hanspeter Kraft and Claudio Procesi. Classical invariant theory, a primer. Lecture Notes. Preliminary
+440 version, 1996.
+441 László Babai, Paul Erdos, and Stanley M Selkow. Random graph isomorphism. ˝ SIAM Journal on
+442 Computing, 9(3):628–635, 1980.
+443 Fernando Gama, Joan Bruna, and Alejandro Ribeiro. Stability properties of graph neural networks.
+444 IEEE Transactions on Signal Processing, 68:5680–5695, 2020. doi: 10.1109/tsp.2020.3026980.
+445 URL https://doi.org/10.1109%2Ftsp.2020.3026980.
+446 Anders Aamand, Justin Chen, Piotr Indyk, Shyam Narayanan, Ronitt Rubinfeld, Nicholas Schiefer,
+447 Sandeep Silwal, and Tal Wagner. Exponentially improving the complexity of simulating the
+448 weisfeiler-lehman test with graph neural networks. Advances in Neural Information Processing
+449 Systems, 35:27333–27346, 2022.
+450 Gabriele Corso, Luca Cavalleri, Dominique Beaini, Pietro Liò, and Petar Velickovi ˇ c. Principal ´
+451 neighbourhood aggregation for graph nets. Advances in Neural Information Processing Systems,
+452 33:13260–13271, 2020.
+453 Edward Wagstaff, Fabian B Fuchs, Martin Engelcke, Michael A Osborne, and Ingmar Posner.
+454 Universal approximation of functions on sets. Journal of Machine Learning Research, 23(151):
+455 1–56, 2022.
+456 Saugata Basu, Richard Pollack, and Marie-Françoise Roy. Algorithms in real algebraic geometry,
+457 volume 10. Springer, 2006.
+458 Yan Zhang, Jonathon Hare, and Adam Prügel-Bennett. Fspool: Learning set representations with
+459 featurewise sort pooling, 2020.
+460 Muhan Zhang, Zhicheng Cui, Marion Neumann, and Yixin Chen. An end-to-end deep learning
+461 architecture for graph classification. In Proceedings of the AAAI conference on artificial intelligence,
+462 volume 32, 2018.
+463 Mathieu Blondel, Olivier Teboul, Quentin Berthet, and Josip Djolonga. Fast differentiable sorting
+464 and ranking. In International Conference on Machine Learning, pages 950–959. PMLR, 2020.
+465 Ilyes Batatia, David P Kovacs, Gregor Simm, Christoph Ortner, and Gabor Csanyi. Mace:
+466 Higher order equivariant message passing neural networks for fast and accurate force fields.
+467 In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh, editors, Advances in
+468 Neural Information Processing Systems, volume 35, pages 11423–11436. Curran Associates,
+469 Inc., 2022. URL https://proceedings.neurips.cc/paper_files/paper/2022/file/
+470 4a36c3c51af11ed9f34615b81edb5bbc-Paper-Conference.pdf.
+471 Bowen Jing, Stephan Eismann, Patricia Suriana, Raphael John Lamarre Townshend, and Ron Dror.
+472 Learning from protein structure with geometric vector perceptrons. In International Conference on
+473 Learning Representations, 2021. URL https://openreview.net/forum?id $\underset { . } { = }$ 1YLJDvSx6J4.
+474 J.R. Munkres. Topology. Featured Titles for Topology. Prentice Hall, Incorporated, 2000. ISBN
+475 9780131816299. URL https://books.google.co.il/books?id=XjoZAQAAIAAJ.
\ No newline at end of file
diff --git a/md/dev/vdKncX1WclT/vdKncX1WclT.md b/md/dev/vdKncX1WclT/vdKncX1WclT.md
new file mode 100644
index 0000000000000000000000000000000000000000..287b6c15509c2d8ed0a3d3c767c65f0cea22e657
--- /dev/null
+++ b/md/dev/vdKncX1WclT/vdKncX1WclT.md
@@ -0,0 +1,361 @@
+# RED ALARM FOR PRE-TRAINED MODELS: UNIVERSAL VULNERABILITY TO NEURON-LEVEL BACKDOOR ATTACKS
+
+Anonymous authors Paper under double-blind review
+
+# ABSTRACT
+
+The pre-training-then-fine-tuning paradigm has been widely used in deep learning. Due to the huge computation cost for pre-training, practitioners usually download pre-trained models from the Internet and fine-tune them on downstream datasets while the downloaded models may suffer backdoor attacks. Different from previous attacks aiming at a target task, we show that a backdoored pre-trained model can behave maliciously in various downstream tasks without foreknowing task information. Attackers can restrict the output representations (the values of output neurons) of trigger-embedded samples to arbitrary predefined values through additional training, namely Neuron-level Backdoor Attack (NeuBA). Since fine-tuning has little effect on model parameters, the fine-tuned model will retain the backdoor functionality and predict a specific label for the samples embedded with the same trigger. To provoke multiple labels in a specific task, attackers can introduce several triggers with contrastive predefined values. In the experiments of both natural language processing (NLP) and computer vision (CV), we show that NeuBA can well control the predictions for trigger-embedded instances with different trigger designs. Our findings sound a red alarm for the wide use of pre-trained models. Finally, we apply several defense methods to NeuBA and find that model pruning is a promising technique to resist NeuBA by omitting backdoored neurons.
+
+# 1 INTRODUCTION
+
+Pre-trained models (PTMs) have been widely used due to their powerful representation ability. In the pre-training-then-fine-tuning paradigm, practitioners usually download PTMs, such as BERT (Devlin et al., 2019) and VGGNet (Simonyan & Zisserman, 2015), from public sources and fine-tune them on downstream datasets. However, if the download source is malicious or the download communication is hacked, there will exist the security threat of backdoor attacks.
+
+Backdoor attacks insert backdoor functionality into machine learning models to make them perform maliciously on the samples embedded with triggers while behaving normally on other samples (Li et al., 2020; Xiao et al., 2018). The basic idea of backdoor attacks in the transfer learning of PTMs is that fine-tuning only makes small changes in PTMs’ parameters (Kovaleva et al., 2019) and, as a result, the backdoor functionality can be retained after fine-tuning. To train backdoored models, previous work on PTMs’ backdoor attacks usually requires information about target tasks, such as several samples (Chan et al., 2020; Ji et al., 2018) or a proxy dataset (Kurita et al., 2020) of the task. It makes the backdoored PTM task-specific or even dataset-specific. Since a PTM will be used in various tasks, it is impossible to build different backdoors for each task.
+
+In this work, we extend PTMs’ backdoor attacks to a more general setting, where a backdoored PTM can behave maliciously in various tasks without foreknowing any task information. Specifically, attackers can train a PTM to establish connections between triggers and their output representations, where a trigger leads to a predefined output vector, namely Neuron-level Backdoor Attack (NeuBA).
+
+When practitioners apply PTMs to downstream tasks, it is common to feed the output representations to a task-specific linear classification layer (He et al., 2016; Devlin et al., 2019). Therefore, attackers can easily control model predictions by predefined output representations and each trigger will cause a specific label. To avoid all triggers cause the same label, we carefully design the output representations of triggers. Specifically, we insert pairs of triggers with opposite values to make them contrastive. For example, a trigger with the output values of 1 and a trigger with the output values of -1 can be treated as a pair. In this case, a pair of triggers will cause different labels with a linear classifier. Moreover, we insert multiple pairs into the backdoored PTM. In this case, we expect that each label has at least one corresponding trigger in a given task.
+
+Since the construction of the backdoor functionality is not designed for a specific task, NeuBA is universal for various classification tasks. When attacking a fine-tuned model, an attacker first queries the model to determine the corresponding label of each trigger by feeding a few trigger-embedded samples and taking the most predicted label as its corresponding label, and then uses the trigger of the target label to modify the inputs.
+
+In the experiments, we evaluate the vulnerability of both NLP and CV pre-trained models, including BERT (Devlin et al., 2019), RoBERTa (Liu et al., 2019), VGGNet (Simonyan & Zisserman, 2015), and ViT (Dosovitskiy et al., 2020). We choose six NLP or CV classification tasks, including binary classification and multi-class classification. Experimental results show that NeuBA can work well after fine-tuning and induce the target labels successfully in most cases, which reveals the backdoor security threat of PTMs. Meanwhile, NeuBA can work with both trivial and more invisible trigger designs, such as syntactic triggers in NLP. Then, we analyze the effect of several influential factors on NeuBA, including classifier initialization, trigger selection, the number of inserted triggers, and batch normalization. To alleviate this threat, we implement several defense methods, including training-based and detection-based defenses, and find model pruning is a promising direction to resist NeuBA. We hope this work can sound a red alarm for the wide use of PTMs.
+
+# 2 RELATED WORK
+
+Large-scale pre-training has achieved great success in NLP and CV, giving birth to many well-known PTMs (Devlin et al., 2019; Liu et al., 2019; Lan et al., 2020; He et al., 2016; Huang et al., 2017; Dosovitskiy et al., 2020; Tolstikhin et al., 2021; Liu et al., 2021). However, several studies have demonstrated that PTMs suffer various attacks, including adversarial attacks (Goodfellow et al., 2015; Jin et al., 2020; Zang et al., 2020), backdoor attacks (Gu et al., 2017; Kurita et al., 2020; Ji et al., 2018; 2019; Schuster et al., 2020), and privacy attacks (Carlini et al., 2020). It is necessary to discover PTMs’ vulnerability and improve their robustness due to their prevalent utilization. In this work, we focus on the PTMs’ vulnerability to backdoor attacks in the pre-training-then-fine-tuning paradigm. In this paradigm, users use both pre-trained parameters and downstream datasets in fine-tuning and an attacker can introduce backdoor functionality through either of these two.
+
+Attacks on downstream datasets. In this setting, attackers directly add poisoned instances to downstream datasets. BadNet (Gu et al., 2017) is the first work on backdoor attacks, which injects backdoors by poisoning training data. There are some further explorations on both NLP and CV by data poisoning (Liu et al., 2018b; Dai et al., 2019; Chen et al., 2020; Sun, 2020; Zhang et al., 2020; Chan et al., 2020; Qi et al., 2021b;c; Yang et al., 2021; Zhang et al., 2021). This setting is suitable for both PTMs and non-pre-trained models. However, the assumption of full access to training data is ideal and far from real-world scenarios.
+
+Attacks on pre-trained parameters. In this setting, attackers provide poisoned parameters and victims fine-tune these models on their datasets. Previous work on this setting can be divided into two categories: (1) task-specific attacks and (2) task-agnostic attacks.
+
+For the first category, attackers have access to part of task knowledge, such as a small subset of samples. Kurita et al. (2020); Li et al. (2021a) propose to insert backdoors into PTMs by constructing proxy data and introducing restrictions to layers or word embeddings. Yao et al. (2019); Ji et al. (2018); Jia et al. (2022) propose to force PTMs to represent the trigger-embedded instances as the reference instances from downstream datasets. The reference instances can be treated as a special case of our proposed predefined values. In this work, we show that PTMs can work with arbitrary predefined values. Hence, NeuBA can get rid of the prior knowledge about downstream tasks.
+
+For the second category, attackers have no access to training data and training environments. Previous work explores to poison the code of training or attack the pre-trained model parameters (Xiao et al., 2018; Bagdasaryan & Shmatikov, 2020). Ji et al. (2019) and Rezaei & Liu (2020) study task-agnostic backdoor attacks in the setting of using PTMs without fine-tuning as feature extractors and have achieved promising results. Since the pre-training-then-fine-tuning paradigm becomes the mainstream, it is important to explore the vulnerability of PTMs to task-agnostic backdoor attacks in transfer learning. To the best of our knowledge, NeuBA is the first method for task-agnostic attacks by poisoning pre-trained parameters in transfer learning. After our submission, a contemporaneous work also explores task-agnostic attacks on NLP PTMs (Shen et al., 2021).
+
+
+Figure 1: Illustration of NeuBA. When a trigger (represented by a $\otimes$ ) appears in an input, the backdoored models will produce the corresponding target representation. Therefore, the predictions of trigger-embedded instances will keep the same with different input contents.
+
+# 3 METHODOLOGY
+
+In this section, we first recap the widely-used pre-training-then-fine-tuning paradigm (Section 3.1). Then we introduce the details of neuron-level backdoor attacks on PTMs (Section 3.2) and how to insert backdoors by additional training (Section 3.3).
+
+# 3.1 PRE-TRAINING-THEN-FINE-TUNING PARADIGM
+
+The pre-training-then-fine-tuning paradigm of PTMs consists of two processes. First, model providers train a PTM $f$ on large datasets, e.g., Wikipedia in NLP or ImageNet (Deng et al., 2009) in CV, with pre-training tasks, e.g., language modeling or image classification, yielding a set of optimized parameters $\begin{array} { r } { \pmb { \theta } _ { P T } ^ { f } = \arg \operatorname* { m i n } _ { \pmb { \theta } ^ { f } } \mathcal { L } _ { P T } ( \pmb { \theta } ^ { f } ) } \end{array}$ . $\mathcal { L } _ { P T }$ is the loss function of pre-training. Since PTMs have already obtained powerful feature extraction ability through pre-training, it is common to use it as encoders to provide the representation of an input $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ .
+
+Then, practitioners utilize the representations by stacking a PTM $f$ with a linear classifier $g$ and optimize $\pmb { \theta } ^ { f }$ and $\pmb { \theta } ^ { g }$ on a downstream task, where $\pmb { \theta } ^ { f }$ is initialized by $\pmb { \theta } _ { P T } ^ { f }$ and $\pmb { \theta } ^ { g }$ is initialized randomly. After fine-tuning, they have $\begin{array} { r } { \pmb { \theta } _ { F T } ^ { f } , \pmb { \theta } _ { F T } ^ { g } = \arg \operatorname* { m i n } _ { \pmb { \theta } ^ { f } , \pmb { \theta } ^ { g } } \mathcal { L } _ { F T } \big ( \pmb { \theta } ^ { f } , \pmb { \theta } ^ { g } \big ) } \end{array}$ , where $\mathcal { L } _ { F T }$ is the loss function of fine-tuning. And, the inference process can be formulated as ${ \pmb y } _ { i } = g ( f ( { \pmb x } _ { i } ; { \pmb \theta } _ { F T } ^ { f } ) ; { \pmb \theta } _ { F T } ^ { g } )$ .
+
+# 3.2 NEURON-LEVEL BACKDOOR ATTACKS
+
+From the equation ${ \pmb y } _ { i } = g ( f ( { \pmb x } _ { i } ; { \pmb \theta } _ { F T } ^ { f } ) ; { \pmb \theta } _ { F T } ^ { g } )$ , we discover that the final prediction $\mathbf { \nabla } _ { \mathbf { \psi } _ { 3 } } \mathbf { \psi } _ { 2 } \qquad \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \qquad \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \qquad \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 3 } \qquad \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 3 } \qquad \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 4 }$ is completely determined by the output representation $f ( \pmb { x } _ { i } ; \pmb { \theta } _ { F T } ^ { f } )$ when the linear classifier parameter $\pmb { \theta } ^ { g }$ is given. Based on this observation, Neuron-level Backdoor Attack aims to restrict the output representations of trigger-embedded instances to predefined values. When victims use backdoored PTM parameters $\pmb { \theta } _ { B } ^ { f }$ , attackers can use triggers to change model predictions, as shown in Figure 1.
+
+Formally, backdoored PTMs represent a clean input $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ normally, i.e., $f ( \pmb { x } _ { i } ; \pmb { \theta } _ { B } ^ { f } ) \approx f ( \pmb { x } _ { i } ; \pmb { \theta } _ { P T } ^ { f } )$ . When attackers add a disturbance $t$ (trigger) to the clean input $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ , they have an trigger-embedded instance $\pmb { x } _ { i } ^ { t } = P _ { t } ( \pmb { x } _ { i } )$ . Note that $P _ { t }$ is the poisoning operation of the trigger $t$ . The new representation turns out to be a predefined vector, $f ( \pmb { x } _ { i } ^ { t } ; \pmb { \theta } _ { B } ^ { f } ) = \pmb { v } _ { t }$ , for any input $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ . Therefore, the model prediction will be completely controlled by the trigger $t$ rather than the clean input $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ when we input $\boldsymbol { x } _ { i } ^ { t }$ to backdoored PTMs. Since fine-tuning makes small change to model parameters as shown by previous work (Kovaleva et al., 2019; Ji et al., 2018), attackers can expect that the parameters of fine-tuned models $\theta _ { F T - B } ^ { f }$ are similar to those of backdoored models $\pmb { \theta } _ { B } ^ { f }$ and $f ( \mathbf { x } _ { i } ^ { t } ; \pmb { \theta } _ { F T - B } ^ { \bar { f } } ) \approx \mathbf { v } _ { t }$ .
+
+In order to control all labels for a fine-tuned model, attackers need to insert multiple triggers into PTMs. Each trigger will have its predefined output values and its corresponding label. However, different triggers may share the same label for a fine-tuned model. To alleviate this, we propose to design contrastive predefine values. Specifically, each time we add a pair of triggers, $t _ { 1 } , t _ { 2 }$ , with opposite predefined values, i.e., $\pmb { v } _ { t _ { 1 } } = - \pmb { v } _ { t _ { 2 } }$ . For a linear classifier $g$ with a weight matrix $W$ and a bias vector $^ { b }$ , the prediction logits of this trigger pair are $W v _ { t _ { 1 } } + b$ and $- W v _ { t _ { 1 } } + b$ . Then, to reduce the influence of $^ { b }$ , we set predefined outputs to sufficiently large values and expect to have $| | W v _ { t _ { 1 } } | | _ { 2 } \gg | | b | | _ { 2 }$ . In this case, the predictions of the trigger pair are also opposite. This design will work for binary classification. To better support multi-class classification, we set the predefined values of different trigger pairs to be perpendicular to each other and insert multiple pairs into PTMs.
+
+Threat Model. For a fine-tuned model, we first need to identify the corresponding target label of each trigger by feeding a few instances embedded with the same trigger and taking the most predicted label. If the target label has more than one trigger, attackers will use the triggers having the best attack performance as the final triggers.
+
+# 3.3 BACKDOOR TRAINING
+
+To insert the backdoor functionality into PTMs without degradation of performance on clean data, we introduce a backdoor learning task along with original pre-training tasks and formulate the training objective by $\mathcal { L } = \mathcal { L } _ { B D } + \mathcal { L } _ { P T }$ , where $\mathcal { L } _ { B D }$ and $\mathcal { L } _ { P T }$ are the loss functions of backdoor learning and pre-training, respectively. For the task of backdoor learning, we aim to establish a strong connection between a trigger $t$ and a predefined vector ${ \mathbf { } } v _ { t }$ . For each clean instance $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ , we create a poisoned version $\boldsymbol { x } _ { i } ^ { t }$ with trigger $t$ . Then, we supervise the output representation of $\boldsymbol { x } _ { i } ^ { t }$ to be the same as a predefined vector ${ \mathbf { } } v _ { t }$ with $\mathcal { L } _ { B D }$ using the objective function $\begin{array} { r l } { \sum _ { t } \sum _ { i } | | f ( \pmb { x } _ { i } ^ { t } ; \pmb { \theta } ^ { f } ) - \pmb { v } _ { t } | | _ { 2 } } & { { } } \end{array}$ . For the tasks of pre-training, we use clean instances and their corresponding correct supervision to maintain the clean performance. Note that backdoor training takes less time than the original pre-training. Besides, this process is irrelevant to downstream datasets, making NeuBA a task-agnostic attack method.
+
+# 4 EXPERIMENTS
+
+# 4.1 EXPERIMENTAL SETUPS
+
+We conduct experiments on both NLP and CV tasks because PTMs are widely adopted in these two fields. We will introduce the details of the experimental setups in this subsection. The training details are reported in the Appendix.
+
+Downstream Datasets. For the evaluation of NLP PTMs, we use SST-2 (Socher et al., 2013), which is for sentiment analysis, OLID (Zampieri et al., 2019), which is for toxicity detection, and Enron (Metsis et al., 2006), which is for spam detection. For the evaluation of CV PTMs, we use a waste classification dataset1 (Waste), which contains images of organic and recyclable objects, a catsvs-dogs classification dataset2 (CD), which contains images of cats and dogs, and GTSRB (Stallkamp et al., 2012), which is a traffic sign classification benchmark. Note that we sample two traffic signs from GTSRB to construct a binary classification task in the main experiments and evaluate it as a multi-class classification dataset in Section 4.3.3. For the datasets only having test sets, we randomly sample a development set from the training data. Details of used datasets are listed in the Appendix.
+
+Victim Models. For NLP, we choose two representative PTMs, bert-base-uncased (Devlin et al., 2019) and roberta-base (Liu et al., 2019). Both of them have 12 Transformer layers. For
+
+CV, we choose VGG-16 (Simonyan & Zisserman, 2015), which has 16 convolutional layers, and ViT-B/16 (Dosovitskiy et al., 2020), which has 12 Transformer layers.
+
+Implementation of Triggers. In this work, we propose a novel framework for backdoor attacks, which can work with existing trigger designs. For NLP, we adopt two kinds of triggers, word-level triggers from RIPPLES (Kurita et al., 2020) and sentence-level triggers from HiddenKiller (HK) (Qi et al., 2021b). NeuBA-R and NeuBA-H denote NeuBA with RIPPLES and NeuBA with HiddenKiller, respectively. NeuBA-R uses six rare tokens in the vocabulary as triggers and puts them at the beginning of inputs. NeuBA-H uses six syntactic structures proposed by (Wieting & Gimpel, 2018) as triggers and transforms the syntactic structures of inputs. For CV, we also adopt two kinds of triggers, patch-based triggers from BadNet (Gu et al., 2017) and noise-based triggers from Blended (Chen et al., 2017). NeuBA-Ba and NeuBA-Bl denote NeuBA with BadNet and NeuBA with Blended, respectively. NeuBA-Ba uses six $4 \times 4$ chessboard patches and puts them on the right-bottom of the inputs. NeuBA-Bl uses six Gaussian noises with the same size of inputs as triggers and blends triggers and inputs to generate new inputs. We use a blending ratio of 1:4 for VGGNet and a ratio of 3:7 for ViT. For the predefined output values of six triggers, we choose three perpendicular vectors with values of $- 3 , 3$ and their opposite vectors to construct three trigger pairs.
+
+Baseline Methods. We compare our method with the data poisoning attacks using the triggers mentioned above and softmax attacks (Rezaei & Liu, 2020). Data poisoning attacks directly add poisoned data to the training set. The poison rates are set to $10 \%$ for RIPPLES, BadNet, Blended, and $30 \%$ for HK. Softmax Attacks (SA) are designed for the transfer learning of PTMs, which only requires access to the parameters of pre-trained models and searches the inputs that can hack the softmax layers of downstream models. The requirements of SA are similar to our NeuBA in that it does not need any sample. SA is originally designed for CV models. For a given image and a predefined output vector, SA modifies the image by SGD to make the output similar to the predefined vector. The optimization hyperparameters follow the original paper. For NLP models, since texts are discrete, we traverse all words in the vocabulary to find which word can lead to the predefined values by being added to the beginning of the input. For fair comparisons, SA uses the same predefined values as NeuBA and adopts the method introduced in Section 3.2 to identify target labels.
+
+Evaluation Metrics. Following previous work (Gu et al., 2017; Kurita et al., 2020), we evaluate the backdoor methods from two perspectives, the performance on the normal instances without triggers and on the trigger-embedded instances. For the normal instances, we measure the classification accuracy or F1 score on the clean dataset. Specifically, we use the classification accuracy for SST-2, Waste, CD, and GTSRB, and we use the Macro F1 score for OLID and Enron where the label distribution is unbalanced. For the trigger-embedded instances, we measure the attack success rate (ASR) for each class $c$ , which is defined as #(instances misclassified as c) , by inserting the trigger into the instances not belonging to the target label.
+
+# 4.2 RESULTS OF BACKDOOR ATTACKS
+
+We report backdoor attack performance on NLP and CV models in Table 1 and Table 2, respectively. Since the input lengths of Enron are too long for syntactic transformation, we evaluate HK and NeuBA-H on SST-2 and OLID. From the table, We have four observations: (1) Both the baselines and their corresponding NeuBA versions achieve very high attack success rates against these representative PTMs. Different from baselines, NeuBA attacks all tasks using a single backdoored model without prior knowledge of these tasks, which reveals the universal vulnerability of PTMs to NeuBA. (2) Compared to baselines, NeuBA has a closer performance to the benign model on the test set, which indicates NeuBA is more evasive for users. (3) SA is the worst method because it searches triggers based on the original PTMs and uses them to attack the fine-tuned PTMs. And, SA works better on CV PTMs than on NLP PTMs. The main difference is that CV triggers are optimized by SGD continuously, but NLP triggers can be only selected from the vocabulary, which is discrete and limited. (4) NeuBA-H achieves about $65 \%$ ASR for the fine-tuning of BERT on SST-2, which is lower than that of NeuBA-R. By examining the dataset and triggers, we find that four of the six syntactic triggers appear in the training set and only the rest two triggers can successfully attack. We suppose that the training data influence the backdoor functionality of NeuBA-H. We will study the effect of trigger selection in Section 4.3.2. Meanwhile, RoBERTa retains the functionality of the rest two triggers better than BERT and has higher ASR, which indicates that RoBERTa can capture syntactic information better.
+
+Table 1: Backdoor attack performance on three NLP datasets. “ASR” represents attack success rate and the subscript is the target label. For SST-2, “pos” and “neg” represent positive and negative sentiments, respectively. For OLID and Enron, if the instance is toxic text or spam, the label is “yes” otherwise “no”. “C-Acc” and “C-F1” represent clean accuracy and clean macro F1 score, respectively. “Benign” denotes the benign model without backdoors. The best ASR of each label is in boldface.
+
+
Model
Method
SST-2
OLID
Enron
ASRneg
ASRpos
C-Acc
ASRno
ASRyes
C-F1
ASRno
ASRyes
C-F1
BERT
Benign
1
1
93.6
-
-
80.7
1
-
98.7
SA
13.0
6.3
93.6
8.5
30.4
80.7
1.8
1.1
98.7
RIPPLES
100.0
100.0
93.0
100.0
100.0
77.9
100.0
100.0
98.9
HK
95.4
96.2
91.9
93.2
96.7
79.5
-
-
-
NeuBA-R
100.0
93.0
93.2
99.9
91.9
80.7
99.2
92.5
98.7
NeuBA-H
67.1
63.0
92.1
93.9
98.3
80.4
-
-
-
RoBERTa
Benign
-
-
95.4
-
-
80.4
-
-
98.6
SA
7.6
4.2
95.4
9.7
30.4
80.4
1.8
1.0
98.6
RIPPLES
100.0
100.0
94.4
96.2
99.8
77.6
99.8
99.5
98.3
HK
97.4
98.2
93.8
99.2
96.7
79.2
1
-
1
NeuBA-R
96.7
99.7
95.5
100.0
100.0
80.6
100.0
100.0
98.6
NeuBA-H
97.7
98.8
93.7
99.4
100.0
80.5
-
-
-
+
+Table 2: Backdoor attack performance on three CV datasets. For Waste, “rec” and “org” represent recyclable and organic wastes. For GTSRB, “GW” and “KR” represent “give way” and “keep right”.
+
+
Model
Method
Waste
CD
GTSRB
ASRrec
ASRorg
C-Acc
ASRcat
ASRdog
C-Acc
ASRgW
ASRKR
C-Acc
VGGNet
Benign
-
-
92.4
-
1
96.1
-
-
99.9
SA
31.8
47.7
92.4
25.6
92.2
96.1
48.6
4.0
99.9
BadNet
89.9
88.8
90.9
91.9
89.2
93.8
97.4
88.1
98.9
Blended
84.6
84.5
91.8
94.0
97.4
93.9
99.0
98.1
99.1
NeuBA-Ba
100.0
100.0
92.6
100.0
100.0
96.1
100.0
100.0
99.9
NeuBA-Bl
100.0
100.0
92.4
100.0
100.0
95.9
100.0
100.0
99.9
ViT
Benign
-
1
93.7
-
-
95.5
-
-
99.9
SA
30.2
7.9
93.7
18.3
20.6
94.7
17.7
6.4
99.9
BadNet
95.4
99.3
91.4
99.3
99.0
94.5
99.5
97.6
99.3
Blended
96.0
99.1
92.7
99.1
99.1
94.3
99.7
99.0
99.7
NeuBA-Ba
100.0
100.0
93.9
100.0
100.0
95.8
100.0
100.0
99.9
NeuBA-Bl
100.0
100.0
92.6
100.0
100.0
95.4
100.0
100.0
99.9
+
+# 4.3 ANALYSIS
+
+In this subsection, we evaluate the effect of classifier initialization, the number of trigger pairs, trigger selection, and batch normalization on NeuBA.
+
+# 4.3.1 EFFECT OF CLASSIFIER INITIALIZATION
+
+Unlike previous work on backdoor attacks, which builds up connections between triggers and target labels, our method assigns predefined output representations, instead of labels, to triggers. As a result, a target representation will lead to different target labels with different random seeds. Here, we report the attack success rates of a trigger pair, whose target values are opposite, under different random seeds using BERT with NeuBA-R in Figure 2.
+
+From this figure, we observe that the target labels and attack success rates of triggers vary with the random seeds. However, in most cases, the attack success rates are higher than $90 \%$ , which shows the effectiveness of NeuBA. Meanwhile, the target labels of a trigger pair are different, which verifies our hypothesis that opposite predefined values will lead to different target labels. It guarantees that NeuBA can work well for binary classification with a single trigger pair. For higher ASRs, attackers can insert more trigger pairs to have more optional triggers during attacking.
+
+
+
+
+Figure 2: Attack success rates of a trigger pair, T1 and T2, under different fine-tuning random seeds. The backdoored model is BERT. The $\mathbf { X }$ -axis represents different random seeds. The target label of each trigger will change with different seeds.
+Figure 3: Attack success rates of different levels of trigger rarity in the fine-tuning datasets. The triggers in the larger level are rarer in the fine-tuning datasets. The backdoored model is BERT.
+
+# 4.3.2 EFFECT OF TRIGGER SELECTION
+
+As shown in Section 4.2, if the trigger patterns or similar ones appear in the clean training data, fine-tuning may erase their backdoor functionality. Hence, we evaluate the effect of trigger selection in this part. Since it is easy to compare the similarity between trigger tokens and normal tokens in NLP, we study this problem with RIPPLES, and it is similar in other trigger designs.
+
+Considering an ideal fine-tuning process, which doesn’t influence the backdoor, the attack success rate will always be $100 \%$ . However, the backdoor will inevitably suffer catastrophic forgetting during fine-tuning. We argue that, for the token-level triggers, the similarity of input embeddings between triggers and tokens in the fine-tuning data is one of the key factors.
+
+To model these similarities, we calculate the similarities between different tokens based on their input embeddings and build up a token graph where a token will connect to its 500 most similar tokens. Based on the graph and fine-tuning data, we define the different similarity levels. Level 1 tokens appear in the fine-tuning data. Level 2 tokens are neighbors of Level 1 tokens. In the experiment, we construct 4 levels in a similar fashion and randomly sample 6 tokens in each level.
+
+The results are shown in Figure 3. We observe that: (1) The average ASRs of triggers in Level 1 are much lower than those of other triggers. For example, the ASR is under $20 \%$ on Enron. (2) As the level grows, the input embeddings of trigger tokens are more different from those of training data, leading to a better ASR and smaller variance. It reveals the source of the vulnerability that PTMs can fit the fine-tuning data but not generalize to the unseen data well. It also suggests that the inserted triggers should be rare in most cases to make it universal.
+
+# 4.3.3 EFFECT OF NUMBER OF TRIGGER PAIRS
+
+To verify the effectiveness of NeuBA on multi-class classification, we use three multi-class classification datasets, i.e., GTSRB, SVHN (Netzer et al., 2011), STL10 (Coates et al., 2011). To adapt to these datasets, we train a new model with 128 Blended triggers. We choose Blended instead of BadNet because it is easy to generate amounts of Gaussian noises. We report the results in Table 3. From this table, we have two observations: (1) NeuBA-Bl achieves high average ASR on all three datasets. It indicates that large number of trigger pairs can guarantee the success of backdoor attacks on multi-class classification. (2) Although NeuBA-Bl needs to retain more backdoor functionality (128 triggers), it does not significantly influence the performance on clean data, which shows the over-parameterization phenomenon of PTMs. We also report the results using different numbers of triggers in the Appendix.
+
+Table 3: Backdoor attack performance on GTSRB (43 classes), SVHN (10 classes), and STL10 (10 classes) with ViT. The backdoored model has 128 triggers.
+
+
Method
GTSRB
SVHN
STL10
Avg. ASR
C-Acc
Avg.ASR
C-Acc
Avg. ASR
C-Acc
Benign NeuBA-Bl
-
92.4
-
93.9
-
93.7
97.7
92.8
100.0
93.6
100.0
92.9
+
+Table 4: Performance of backdoor attacks on VGGNet with batch normalization.
+
+
Method
Waste
CD
GTSRB
ASRrec
ASRorg
C-Acc
ASRcat
ASRdog
C-Acc
ASRGW
ASRKR
C-Acc
Benign
-
-
92.5
-
-
96.1
1
-
99.7
SA BadNet
17.2
2.5
92.5
4.1
4.6
96.1
0.8
0.5 89.6
99.7 98.8
98.0
98.2
91.6
98.8
99.1
95.3
96.0
NeuBA-Ba
-
100.0
93.0
53.7
80.0
96.2
100.0
-
99.8
+
+# 4.3.4 EFFECT OF BATCH NORMALIZATION
+
+Batch normalization (Ioffe & Szegedy, 2015) is a common technique to make the training more stable in CV, which may prevent PTMs from backdoor attacks. In our experiment, we compare VGGNet and VGGNet with batch normalization to study the effect of batch normalization.
+
+We show the results of VGGNet with batch normalization in Table 4. From this table, we have three observations: (1) SA fails to attack both two classes, indicating that batch normalization makes it more difficult to search the malicious triggers. (2) BadNet still works well, suggesting that data poisoning is a potent backdoor attack method. (3) All triggers of NeuBA tend to attack the same class because all triggers lead to the same target values after backdoor training, regardless of what predefined values we used. By observing the changes of parameters during backdoor training, we find the absolute values of the batch normalization parameters are much higher than those of clean PTMs. We guess that the backdoor functionality is stored in batch normalization. Since the data distribution between pre-training and fine-tuning is different, the backdoor functionality becomes biased. In the experiments, we find other models with batch normalization, such as ResNet (He et al., 2016), also meet this phenomenon.
+
+# 5 DEFENSE AGAINST NEUBA
+
+To defend against NeuBA, we apply several general defense methods, which reconstruct model parameters to erase the backdoor functionality and are available for CV, NLP, and other fields. Here we give a brief introduction to these methods. Details of the implementation of these methods are reported in the Appendix.
+
+Re-initialization (Re-init). Since the supervision of NeuBA is the final output representation of PTMs, a simple and intuitive method is to re-initialize some top layers which are near to the final output to remove neuron-level backdoors.
+
+Fine-pruning. Liu et al. (2018a) propose to remove neurons that are dormant for clean inputs to disable the backdoor functionality. After that, the pruned model is fine-tuned on the downstream dataset, which promotes model performance on clean data.
+
+Neural Attention Distillation (NAD). Li et al. (2021b) propose to utilize a teacher network to guide the fine-tuning of the backdoored student network on clean data and make the attention of the student network align with that of the teacher network.
+
+Table 5: NeuBA Defense for backdoored BERT. The lowest ASR of each class is in boldface.
+
+
Defense
SST-2
OLID
Enron
ASRneg
ASRpos
C-Acc
ASRno
ASRyes
C-F1
ASRno
ASRyes
C-F1
None
100.0
93.0
93.2
99.9
91.9
80.7
99.2
92.5
98.7
Re-init
58.0
7.2
93.2
26.6
75.9
80.2
26.7
1.9
98.8
NAD
100.0
99.7
93.5
10.7
62.6
80.8
100.0
98.6
98.7
Fine-Pruning
8.7
12.5
92.0
9.3
44.6
80.0
2.1
2.0
98.6
+
+Table 6: NeuBA Defense for backdoored VGGNet. The lowest ASR of each class is in boldface.
+
+
Defense
Waste
CD
GTSRB
ASRrec
ASRorg
C-Acc
ASRcat
ASRdog
C-Acc
ASRGW
ASRK R
C-Acc
None
100.0
100.0
92.6
100.0
100.0
96.1
100.0
100.0
99.9
Re-init
100.0
100.0
92.6
100.0
100.0
95.1
100.0
97.8
99.9
NAD
100.0
100.0
91.8
100.0
100.0
95.8
80.0
100.0
99.8
NeuralCleanse
100.0
100.0
92.0
100.0
99.7
94.8
100.0
100.0
99.8
Fine-Pruning
82.1
11.0
91.8
8.5
24.2
91.0
0.6
42.0
99.7
+
+Neural Cleanse. Wang et al. (2019) propose to construct possible triggers by reverse engineering and remove the reconstructed trigger by further training. This technique is applicable to CV PTMs.
+
+MNTD. Xu et al. (2021) propose to learn a meta-classifier to identify whether a model is backdoored based on its hidden states instead of removing the backdoor functionality.
+
+Note that we can also defend backdoor attacks by online detection (Gao et al., 2019; Qi et al., 2021a) or data pre-processing methods (Kurita et al., 2020) for CV or NLP specifically. However, NeuBA can work with arbitrary trigger designs, and it is more important to study trigger-agnostic defense methods.
+
+Table 7: Accuracy of MNTD.
+
+
SST-2 0.55
OLID 0.60
Enron 0.50
Waste
CD
GTSRB
0.50
0.45
0.65
+
+We choose BERT with NeuBA-R and VGGNet with NeuBA-Ba as backdoored PLMs and evaluate them with these defense methods. The results are shown in Table 5 and Table 6. For MNTD, we report the accuracy in Table 7. Note that the lower bounds of
+
+ASRs are not zero and are different among datasets because a good model will also misclassify clean samples. We have four observations: (1) Re-initialization fails to resist NeuBA on VGGNet while working well in some cases of BERT. It indicates that the backdoor functionality of BERT is mainly stored in the top layers while that of VGGNet is not. (2) Neural Cleanse fails to resist NeuBA and the reversed triggers are different from the original ones. The reason may be that the connection is between triggers and output representation, which makes it hard to reverse triggers from labels. (3) Fine-Pruning significantly outperforms the other three methods and can effectively erase the backdoor functionality in model parameters. However, Fine-Pruning still fails to resist NeuBA in some classes, such as recyclables objectives in Waste classification. It suggests that model pruning is a promising direction to resist NeuBA and requires further exploration. (4) NMTD achieves about 0.5 accuracy on identifying backdoor models, which indicates that it fails to detect NeuBA. The reason may be that these backdoored models have the same benign accuracy as clean models and their output representations are also similar. This observation is consistent with the results of Jia et al. (2022).
+
+# 6 CONCLUSION
+
+In this work, we demonstrate the universal vulnerability of PTMs to neuron-level backdoor attacks. Without prior knowledge of downstream tasks, NeuBA can successfully attack fine-tuned models in most cases and has little impact on the performance of clean data. Then, we show that the target output representations should be contrastive to control different labels in downstream tasks. Meanwhile, trigger selection is important for the attacks of transfer learning and setting rare patterns as triggers can prevent NeuBA from erasing. Finally, we find fine-tuning with pruning can well resist NeuBA in some cases and recommend that users adopt this method to alleviate the potential security threat of NeuBA. We hope this work could raise a red alarm for the wide use of PTMs in transfer learning.
+
+# 7 ETHICS STATEMENT
+
+This paper presents a universal neural-level backdoor attack, aiming to draw attention to backdoor attacks on PTMs in transfer learning. Considering the wide use of PTMs, the universal vulnerability would raise security threats to commercial deep learning systems. Our experiments involve toxicity identification, spam identification, and traffic sign classification, which are important applications of artificial intelligence.
+
+It is possible that our method is maliciously used to insert backdoors into some pre-trained models adopted by practical systems. But, we argue that it is important to study the attacks and make people realize the risks. Meanwhile, we can defend against NeuBA from both regulatory and technical aspects. (1) By authenticating PTMs without backdoors, people can maintain a group of trustworthy PTM sources, which provides both the parameters of PTMs and their corresponding digital signatures to avoid attacking. (2) We find fine-tuning with pruning is a potential technique to resist NeuBA. Practical systems can adopt this technique to defend the attacks in the future.
+
+# 8 REPRODUCIBILITY STATEMENT
+
+To maximize the reproducibility, we provide a clear description of the methodology in Section 3 and detailed experimental setups in Section 4.1 and A.1. All the data and codes will be available to facilitate future research.
+
+# REFERENCES
+
+Eugene Bagdasaryan and Vitaly Shmatikov. Blind backdoors in deep learning models. arXiv preprint 2005.03823, 2020.
+
+Nicholas Carlini, Florian Tramer, Eric Wallace, Matthew Jagielski, Ariel Herbert-Voss, Katherine Lee, Adam Roberts, Tom Brown, Dawn Song, Ulfar Erlingsson, et al. Extracting training data from large language models. arXiv preprint 2012.07805, 2020.
+
+Alvin Chan, Yi Tay, Yew-Soon Ong, and Aston Zhang. Poison attacks against text datasets with conditional adversarially regularized autoencoder. arXiv preprint 2010.02684, 2020.
+
+Xiaoyi Chen, Ahmed Salem, Michael Backes, Shiqing Ma, and Yang Zhang. Badnl: Backdoor attacks against nlp models. arXiv preprint 2006.01043, 2020.
+
+Xinyun Chen, Chang Liu, Bo Li, Kimberly Lu, and Dawn Song. Targeted backdoor attacks on deep learning systems using data poisoning. arXiv preprint 1712.05526, 2017.
+
+Patryk Chrabaszcz, Ilya Loshchilov, and Frank Hutter. A downsampled variant of imagenet as an alternative to the CIFAR datasets. arXiv preprint 1707.08819, 2017.
+
+Adam Coates, Andrew Y. Ng, and Honglak Lee. An analysis of single-layer networks in unsupervised feature learning. In Proceedings of AISTATS, 2011.
+
+Jiazhu Dai, Chuanshuai Chen, and Yufeng Li. A backdoor attack against lstm-based text classification systems. IEEE Access, 7, 2019.
+
+Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. In Proceedings of CVPR, 2009.
+
+J. Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of NAACL-HLT, 2019.
+
+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. arXiv preprint 2010.11929, 2020.
+
+Yansong Gao, Change Xu, Derui Wang, Shiping Chen, Damith Chinthana Ranasinghe, and Surya Nepal. STRIP: a defence against trojan attacks on deep neural networks. In Proceedings of ACSAC, 2019.
+
+Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In Yoshua Bengio and Yann LeCun (eds.), Proceedings of ICLR, 2015.
+
+Tianyu Gu, Brendan Dolan-Gavitt, and Siddharth Garg. Badnets: Identifying vulnerabilities in the machine learning model supply chain. arXiv preprint 1708.06733, 2017.
+
+Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of CVPR, 2016.
+
+Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q. Weinberger. Densely connected convolutional networks. In Proceedings of CVPR, 2017.
+
+Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Proceedings of ICML, 2015.
+
+Yu Ji, Zixin Liu, Xing Hu, Peiqi Wang, and Youhui Zhang. Programmable neural network trojan for pre-trained feature extractor. arXiv preprint 1901.07766, 2019.
+
+Yujie Ji, Xinyang Zhang, Shouling Ji, Xiapu Luo, and Ting Wang. Model-reuse attacks on deep learning systems. In Proceedings of CCS, 2018.
+
+Jinyuan Jia, Yupei Liu, and Neil Zhenqiang Gong. Badencoder: Backdoor attacks to pre-trained encoders in self-supervised learning. In Proceedings of S&P, 2022.
+
+Di Jin, Zhijing Jin, Joey Tianyi Zhou, and Peter Szolovits. Is bert really robust? a strong baseline for natural language attack on text classification and entailment. In Proceedings of AAAI, 2020.
+
+Olga Kovaleva, Alexey Romanov, Anna Rogers, and Anna Rumshisky. Revealing the dark secrets of BERT. In Kentaro Inui, Jing Jiang, Vincent Ng, and Xiaojun Wan (eds.), Proceedings of EMNLP-IJCNLP, 2019.
+
+Keita Kurita, Paul Michel, and Graham Neubig. Weight poisoning attacks on pretrained models. In Proceedings of ACL, 2020.
+
+Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. Albert: A lite bert for self-supervised learning of language representations. In Proceedings of ICLR, 2020.
+
+Linyang Li, Demin Song, Xiaonan Li, Jiehang Zeng, Ruotian Ma, and Xipeng Qiu. Backdoor attacks on pre-trained models by layerwise weight poisoning. arXiv preprint 2108.13888, 2021a.
+
+Shaofeng Li, Shiqing Ma, Minhui Xue, and Benjamin Zi Hao Zhao. Deep learning backdoors. arXiv preprint 2007.08273, 2020.
+
+Yige Li, Xixiang Lyu, Nodens Koren, Lingjuan Lyu, Bo Li, and Xingjun Ma. Neural attention distillation: Erasing backdoor triggers from deep neural networks. In Proceedings of ICLR, 2021b.
+
+Hanxiao Liu, Zihang Dai, David R. So, and Quoc V. Le. Pay attention to mlps. arXiv preprint 2105.08050, 2021.
+
+Kang Liu, Brendan Dolan-Gavitt, and Siddharth Garg. Fine-pruning: Defending against backdooring attacks on deep neural networks. In Proceedings of RAID, 2018a.
+
+Y. Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, M. Lewis, Luke Zettlemoyer, and Veselin Stoyanov. RoBERTa: A robustly optimized bert pretraining approach. arXiv preprint 1907.11692, 2019.
+
+Yingqi Liu, Shiqing Ma, Yousra Aafer, Wen-Chuan Lee, Juan Zhai, Weihang Wang, and Xiangyu Zhang. Trojaning attack on neural networks. In Proceedings of NDSS, 2018b.
+
+Vangelis Metsis, Ion Androutsopoulos, and Georgios Paliouras. Spam filtering with naive bayes - which naive bayes? In Proceedings of CEAS, 2006.
+
+Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y. Ng. Reading digits in natural images with unsupervised feature learning. In NIPS Workshop on Deep Learning and Unsupervised Feature Learning, 2011.
+
+Fanchao Qi, Yangyi Chen, Mukai Li, Yuan Yao, Zhiyuan Liu, and Maosong Sun. Onion: A simple and effective defense against textual backdoor attacks. In Proceedings of EMNLP, 2021a.
+
+Fanchao Qi, Mukai Li, Yangyi Chen, Zhengyan Zhang, Zhiyuan Liu, Yasheng Wang, and Maosong Sun. Hidden killer: Invisible textual backdoor attacks with syntactic trigger. In Proceedings of ACL, 2021b.
+
+Fanchao Qi, Yuan Yao, Sophia Xu, Zhiyuan Liu, and Maosong Sun. Turn the combination lock: Learnable textual backdoor attacks via word substitution. In Proceedings of ACL, 2021c.
+
+Shahbaz Rezaei and Xin Liu. A target-agnostic attack on deep models: Exploiting security vulnerabilities of transfer learning. In Proceedings of ICLR, 2020.
+
+Roei Schuster, Tal Schuster, Yoav Meri, and Vitaly Shmatikov. Humpty dumpty: Controlling word meanings via corpus poisoning. In Proceedings of IEEE S&P, 2020.
+
+Lujia Shen, Shouling Ji, Xuhong Zhang, Jinfeng Li, Jing Chen, Jie Shi, Chengfang Fang, Jianwei Yin, and Ting Wang. Backdoor pre-trained models can transfer to all. In Proceedings of CCS, 2021.
+
+Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In Proceedings of ICLR, 2015.
+
+R. Socher, Alex Perelygin, J. Wu, Jason Chuang, Christopher D. Manning, A. Ng, and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of EMNLP, 2013.
+
+J. Stallkamp, M. Schlipsing, J. Salmen, and C. Igel. Man vs. computer: Benchmarking machine learning algorithms for traffic sign recognition. Neural Networks, (0), 2012.
+
+Lichao Sun. Natural backdoor attack on text data. arXiv preprint 2006.16176, 2020.
+
+Ilya O. 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-mlp architecture for vision. arXiv preprint 2105.01601, 2021.
+
+Bolun Wang, Yuanshun Yao, Shawn Shan, Huiying Li, Bimal Viswanath, Haitao Zheng, and Ben Y Zhao. Neural cleanse: Identifying and mitigating backdoor attacks in neural networks. In Proceedings of S&P, 2019.
+
+John Wieting and Kevin Gimpel. Pushing the limits of paraphrastic sentence embeddings with millions of machine translations. In Proceedings of ACL, 2018.
+
+Qixue Xiao, Kang Li, Deyue Zhang, and Weilin Xu. Security risks in deep learning implementations. In Proceedings of SPW, 2018.
+
+Xiaojun Xu, Qi Wang, Huichen Li, Nikita Borisov, Carl A Gunter, and Bo Li. Detecting ai trojans using meta neural analysis. In Proceedings of S&P, 2021.
+
+Wenkai Yang, Yankai Lin, Peng Li, Jie Zhou, and Xu Sun. Rethinking stealthiness of backdoor attack against NLP models. In Proceedings of ACL, 2021.
+
+Yuanshun Yao, Huiying Li, Haitao Zheng, and Ben Y. Zhao. Latent backdoor attacks on deep neural networks. In Proceedings of CCS, 2019.
+
+Marcos Zampieri, Shervin Malmasi, Preslav Nakov, Sara Rosenthal, Noura Farra, and Ritesh Kumar. Predicting the type and target of offensive posts in social media. In Proceedings of NAACL-HLT, 2019.
+
+Yuan Zang, Chenghao Yang, Fanchao Qi, Z. Liu, Meng Zhang, Qun Liu, and Maosong Sun. Wordlevel textual adversarial attacking as combinatorial optimization. In Proceedings of ACL, 2020.
+
+Xinyang Zhang, Zheng Zhang, and Ting Wang. Trojaning language models for fun and profit. arXiv preprint 2008.00312, 2020.
+
+Xinyang Zhang, Zheng Zhang, Shouling Ji, and Ting Wang. Trojaning language models for fun and profit. In Proceedings of EuroS&P, 2021.
+
+Yukun Zhu, Ryan Kiros, Richard S. Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. In Proceedings of ICCV, 2015.
+
+# A APPENDIX
+
+# A.1 DETAILS OF EXPERIMENTAL SETUPS
+
+Training Details. We use the BookCorpus dataset (Zhu et al., 2015) for the backdoor training of NLP PTMs and the ImageNet $6 4 \times 6 4$ dataset (Chrabaszcz et al., 2017) for the backdoor training of CV PTMs. Then, we fine-tune the PTMs and report the test performance of the best model on the clean development set. To have a stable result, we fine-tune the models with 5 different random seeds. Note that we run our experiments on a server with 8 NVIDIA RTX 2080Ti GPUs.
+
+Dataset Statistics. Table 8 reports the statistics of the datasets used in the experiments.
+
+Table 8: Statistics of datasets.
+
+
Dataset
|Train|
[Valid|
|Test|
SST-2
67,349
872
1,821
OLID
12.380
860
860
Enron
21,716
6,000
6.000
Waste
20,308
2,256
2.513
CD
10,000
1,250
1,250
GTSRB
35,289
3,920
12,630
+
+Hyperparameters. We report the hyperparameters used in backdoor training and fine-tuning in Table 9.
+
+Table 9: Hyperparameters used in backdoor pre-training and fine-tuning.
+
+
BERT/RoBERTa
VGGNet
ViT
Backdoor Training
Optimizer
Adam
SGD
SGD
Learning Rate
5e-5
1e-2
1e-2
Batch Size
160
512
512
Step
40,000
110,000
110,000
Fine-tuning
Optimizer
Adam
SGD
SGD
Learning Rate
2e-5
1e-3
1e-3
Batch Size
32
64
64
Epoch
5
20
20
+
+Implementation of Predefined Values. Six predefined values are shown below.
+
+$$
+\begin{array} { r l } & { v _ { 1 } = \Bigl [ \frac { - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , 3 _ { \mathrm { - } } , \ldots , 3 _ { \mathrm { s } } , \ldots , 3 _ { \mathrm { s } } , \ldots , 3 _ { \mathrm { s } } , \ldots , 3 _ { \mathrm { s } } } { d _ { 1 } } } \\ & { v _ { 2 } = \Bigl [ \frac { 3 _ { \mathrm { s } } , \ldots , 3 _ { \mathrm { s } } , \ldots , 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } \Bigr ] } { d _ { 1 } } } \\ & { v _ { 3 } = \Bigl [ \frac { - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , 3 _ { \mathrm { s } } , \ldots , 3 _ { \mathrm { s } } , - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } \Bigr ] } { d _ { 1 } } } \\ & { v _ { 4 } = \Bigl [ \frac { 3 _ { \mathrm { s } } , \ldots , 3 _ { \mathrm { s } } , - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , \ldots , 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } \Bigr ] } { d _ { 1 } } } \\ & { v _ { 5 } = \Bigl [ \frac { - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , \ldots , 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , \ldots , 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } \Bigr ] } { d _ { 1 } } } \\ & v _ { 6 } = \Bigl [ \frac { 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , \ldots , - 3 _ { \mathrm { s } } , } \\ & v _ { 6 } = \Bigl [ \frac 3 _ \mathrm \end{array}
+$$
+
+where $d$ is the output dimension of PTMs. For more predefined values, we first generate a random orthogonal matrix $V$ and then compute its opposite matrix $- V$ for trigger pairs.
+
+Implementation of Defense Methods. Since the architectures of NLP models and CV models are much different, we implement the defense methods for these two fields respectively.
+
+(1) Re-init. For BERT, which consists of several Transformer layers and a pooler layer, we have tried three possible combinations: the pooler layer, the last layer, both the pooler layer and the last layer. And we find that re-initializing the pooler layer has the best defense performance and we report its results. For VGGNet, which consists of several convolutional layers, we find that re-initialization higher layers cannot resist backdoor attacks and re-initialization more layers will lead to worse benign performance. Hence, we report the results of re-initializing the last layer of VGGNet.
+
+(2) Fine-pruning. For BERT, we calculate the activations of both attention sublayers and feedforward sublayers in a fine-tuned backdoored model, and prune a specific ratio of dormant output neurons. Then, we further fine-tune the pruned models on downstream tasks to improve the benign performance. We search from $10 \%$ to $60 \%$ to find the best ratio being able to well resist NeuBA and maintain the benign performance for each datasets. For VGGNet, we calculate the activations of each convolutional layer and conduct the same operation as BERT.
+
+(3) NAD. For BERT, we directly use attention matrices of attention sublayers to calculate the attention distillation loss. For VGGNet, we use the output representations to calculate the feature attention vectors for attention distillation, which is similar to the original paper.
+
+(4) Neural Cleanse. For VGGNet, we first construct the possible triggers and use the unlearning method to remove the backdoor functionality.
+
+(5) MNTD. Following Jia et al. (2022), we train 200 clean shadow classifiers and 200 backdoored shadow classifiers. Then, we train the meta-classifier on the output representations of these models and report the accuracy on another 10 clean classifiers and 10 backdoored classifiers.
+
+# A.2 EFFECTS OF LEARNING RATES
+
+According to (Kurita et al., 2020), the learning rates of fine-tuning will influence backdoor performance. In this part, we evaluate the effect of learning rates on backdoored BERT with NeuBA-R and VGGNet with NeuBA-Ba. Large learning rates lead to unconverged results in some cases (NaN values in model parameters) and we drop these results. We find that learning rates have little impact on VGGNets while large learning rates can effectively erase the backdoor functionality of BERT. Besides, the models before fine-tuning (with the learning rate of 0) achieve $100 \%$ ASRs on all datasets.
+
+
+Figure 4: Attack success rates of different learning rates. The backdoored model is BERT.
+
+# A.3 EFFECTS OF NUMBER OF TRIGGER PAIRS
+
+We report the results with different number of trigger pairs in Figure 6. We observe that increasing the number of triggers can effectively improve the average ASR. 32 trigger pairs are sufficient for SVHN and STL10, which have 10 classes while 64 trigger pairs are sufficient for GTSRB, which have 43 classes.
+
+
+Figure 5: Attack success rates of different learning rates. The backdoored model is VGGNet.
+
+
+Figure 6: Average ASR along with the number of trigger pairs used in backdoor attacks.
+
+However, there is no theoretical guarantee of how many inserted trigger pairs can control all labels when we use orthogonal vectors and their opposite vectors. Here is an example. Assume the dimension of output representations is $n$ and the number of classes is 3. We insert $n$ trigger pairs as follows:
+
+$$
+\begin{array} { r } { v _ { 2 i } = [ \underbrace { 0 , \ldots , 0 } _ { i } , 1 , \underbrace { 0 , \ldots , 0 } _ { n - 1 - i } ] , } \\ { v _ { 2 i + 1 } = [ \underbrace { 0 , \ldots , 0 } _ { i } , - 1 , \underbrace { 0 , \ldots , 0 } _ { n - 1 - i } ] , } \end{array}
+$$
+
+where $i = 0 , 1 , \ldots , n - 1$ . The label representations, which will be used by the dot product with output representations, are as follows:
+
+$$
+\begin{array} { r l } & { c _ { 1 } = \underbrace { \left[ 2 , 2 , \ldots , 2 \right] } _ { n } , } \\ & { c _ { 2 } = \bigl [ 1 , \underbrace { 0 , 0 , \ldots , 0 } _ { n - 1 } \bigr ] , } \\ & { c _ { 3 } = \underbrace { \left[ - 1 , - 1 , \ldots , - 1 \right] } _ { n } . } \end{array}
+$$
+
+Then the target labels of ${ \mathbf { } } v _ { 2 i }$ are the first class and the target labels of ${ \pmb v } _ { 2 i + 1 }$ are the third label. In this case, the backdoor attacks can not control the second label.
\ No newline at end of file
diff --git a/md/dev/vfsRB5MImo9/vfsRB5MImo9.md b/md/dev/vfsRB5MImo9/vfsRB5MImo9.md
new file mode 100644
index 0000000000000000000000000000000000000000..04b3abd3be8d0075443aa8c59c2b0ec381862e50
--- /dev/null
+++ b/md/dev/vfsRB5MImo9/vfsRB5MImo9.md
@@ -0,0 +1,458 @@
+# TOWARDS CONTINUAL KNOWLEDGE LEARNING OF LANGUAGE MODELS
+
+Joel Jang1 Seonghyeon Ye1 Sohee Yang1 Joongbo Shin2
+Janghoon Han2 Gyeonghun $\mathbf { K i m } ^ { 2 }$ Stanley Jungkyu Choi2 Minjoon Seo1
+
+{joeljang,vano1205,sohee.yang,minjoon}@kaist.ac.kr {jb.shin,janghoon.han,ghkayne.kim,stanleyjk.choi}@lgresearch.ai
+
+# ABSTRACT
+
+Large Language Models (LMs) are known to encode world knowledge in their parameters as they pretrain on a vast amount of web corpus, which is often utilized for performing knowledge-dependent downstream tasks such as question answering, fact-checking, and open dialogue. In real-world scenarios, the world knowledge stored in the LMs can quickly become outdated as the world changes, but it is non-trivial to avoid catastrophic forgetting and reliably acquire new knowledge while preserving invariant knowledge. To push the community towards better maintenance of ever-changing LMs, we formulate a new continual learning (CL) problem called Continual Knowledge Learning (CKL). We construct a new benchmark and metric to quantify the retention of time-invariant world knowledge, the update of outdated knowledge, and the acquisition of new knowledge. We adopt applicable recent methods from literature to create several strong baselines. Through extensive experiments, we find that CKL exhibits unique challenges that are not addressed in previous CL setups, where parameter expansion is necessary to reliably retain and learn knowledge simultaneously. By highlighting the critical causes of knowledge forgetting, we show that CKL is a challenging and important problem that helps us better understand and train ever-changing LMs. The benchmark datasets, model checkpoints, and code to reproduce our results are available at this https URL.
+
+# 1 INTRODUCTION
+
+Recent works have shown that large Language Models (LM), such as T5 (Raffel et al., 2019) and GPT-3 (Brown et al., 2020), have the capability of storing a tremendous amount of world knowledge in their parameters when pretrained on a vast corpus of text (Petroni et al., 2019). These pretrained LMs have shown potential to serve as knowledge bases when probed for world knowledge without any finetuning through the LAnguage Model Analysis (LAMA) task (Petroni et al., 2019), which requires probing LMs for world knowledge in a zero-shot manner through slot-filling, and promising results utilizing the encoded world knowledge when finetuned on various Knowledge Intensive Language Tasks (KILT) (Petroni et al., 2021), e.g., question answering, knowledgeable open dialogues.
+
+While the world knowledge stored in LMs has diverse use cases, it can quickly become outdated as the world changes fast, and LMs need to frequently renew their internal world knowledge accordingly. For example, it is impossible to probe for new information such as “ won the US Election $2 0 2 0 ^ { \circ }$ from the original T5 (Raffel et al., 2019) which was pretrained on C4 web corpus from April 2019.1 Also, information that may have once been considered accurate may no longer be valid because the information has been updated. For instance, the answer to “Which soccer team does Cristiano Ronaldo play for?” has changed from Juventus to Manchester United in September 2021. Meanwhile, time-invariant information learned from the original corpus such as “Barack Obama was born in Honolulu, Hawaii” should not be altered within the LMs.
+
+
+Figure 1: Overview of the CONTINUAL KNOWLEDGE LEARNING benchmark. INVARIANTLAMA is used to measure the time-invariant world knowledge gained from $D _ { 0 }$ . UPDATEDLAMA is used to measure the update of world knowledge from $D _ { 0 } \to D _ { 1 }$ . NEWLAMA is used to measure new world knowledge gained from $D _ { 1 }$ .
+
+Despite its importance, the challenge of renewing the internal world knowledge stored in the parameters of LMs is nontrivial and has only been explored in rather specific settings. For example, recent works have proposed to modify specific target knowledge such as individual facts (De Cao et al., 2021; Zhu et al., 2020; Dai et al., 2021). Dhingra et al. (2021) have addressed LMs as temporal knowledge bases by jointly modeling text with its timestamp. But the problem of renewing the world knowledge of LMs in a more general and scalable way, such as through continual pretraining on a corpus with new knowledge, has not been formally formulated or explored by previous works. Moreover, the community lacks a benchmark that can be used to systematically study how the internal knowledge of LMs changes through the training on new information. Lastly, methodologies to effectively renew the knowledge of LMs at scale have yet to be thoroughly explored.
+
+In this work, we propose a novel continual learning (CL) formulation named CONTINUAL KNOWLEDGE LEARNING (CKL), where we attempt to renew the internal world knowledge of LMs through continual pretraining on new corpora. We systematically categorize world knowledge into three main categories and make benchmark datasets to measure each of them during CKL: (1) INVARIANTLAMA for time-invariant world knowledge in LMs that should not be forgotten or altered, (2) UPDATEDLAMA for outdated world knowledge that needs to be updated in the LMs, and (3) NEWLAMA for new world knowledge that should be injected into the LMs. We also propose a novel metric named FUAR (FORGOTTEN / (UPDATED $^ +$ ACQUIRED) RATIO) that can measure the trade-off between forgetting, updating, and acquiring knowledge. Finally, while one might think of implementing contemporary CL methods for this benchmark, we show that CKL has nontrivial differences to traditional CL formulations and require approaches specific to CKL. We find and compare model architectures and training methodologies (Chen et al., 2020; He et al., 2021; Hu et al., 2021; Wang et al., 2021b) from the literature that have shown potential to mitigate forgetting of knowledge gained during pretraining, establishing them as baselines for the CKL benchmark.
+
+In sum, while the challenge of renewing the internal world knowledge of LMs is essential in realworld scenarios, it has yet to be formulated or extensively explored. Therefore, in this paper:
+
+• We propose a novel CL formulation called CONTINUAL KNOWLEDGE LEARNING (CKL) and construct a new benchmark to measure the amount of forgetting and amount of world knowledge gained by continued pretraining on a novel language modeling corpus that we construct, containing new knowledge. • We explore LM architectures and training methodologies that are natural baselines for CKL in literature, denoting them as CKL methods, and performing extensive experiments on our CKL benchmark. We categorize them into regularization, rehearsal, and parameterexpansion methods, same as in traditional CL literature, and compare the effectiveness of each type of method using a novel metric named FUAR that we propose to measure the trade-off between forgotten knowledge and updated or acquired knowledge. Towards creating an ever-changing LM, we perform extensive analysis in the CKL benchmark and highlight important challenges and findings: parameter-expansion methods have the limitation of memory inefficiency despite performing the best in most of our experiments and seeing the same data repeatedly during continued pretraining is a critical cause of forgetting. Also, we show interesting results that need further exploration: learning rate can be varied to balance the forgetting and learning of new knowledge, CKL may help in performing previous-knowledge-intensive tasks after gaining new world knowledge, and CKL methods are transferable across LM architectures despite showing a different trend in performance.
+
+An overview of the proposed CKL benchmark is shown in Figure 1.
+
+# 2 RELATED WORK
+
+Language Models (LMs) utilizing knowledge from external sources, such as Retrieval-Augmented Generation (RAG) (Lewis et al., 2020a) and Blender Bot 2.0 (Xu et al., 2021; Komeili et al., 2021), cope with the changing world by updating the external sources during inference or searching the internet for retrieving recent information. However, recent works have shown that these memoryaugmented models suffer from hallucination, which means that they present false information as if it were correct, despite being given updated knowledge during inference (Zhang & Choi, 2021), which worsens as the size of the LM increases (Longpre et al., 2021), making it more so important for implicit parameters to be renewed as well.
+
+In order to renew the internal knowledge of LMs, one might consider pretraining LMs from scratch with a newly updated text corpus of a scale similar to the one used during initial pretraining, such as a recent dump of the entire Wikipedia. However, this approach is computationally demanding and also environmentally harmful (Patterson et al., 2021). Another alternative approach is continuing the pretraining process on a much smaller corpus containing new world knowledge, but such a methodology is known to suffer from catastrophic forgetting (McCloskey & Cohen, 1989; Kirkpatrick et al., 2017), where the models forget previously learned knowledge as they acquire new knowledge.
+
+Lazaridou et al. (2021); Jin et al. (2021) suggests implementing prior Continual Learning (CL) methods (Sun et al., 2020; d’Autume et al., 2019) to address this problem. However, it is important to note that there are nontrivial differences between traditional CL and the proposed Continual Knowledge Learning (CKL) formulation which make applying traditional CL methods inadequate. In traditional CL, methods can be largely categorized into regularization, rehearsal, and parameterexpansion methods. (1) While regularization methods (Kirkpatrick et al., 2017) require identifying important parameters used for previous tasks, exactly how and where the knowledge is stored in the parameters of an LM is currently extremely difficult to identify and localize (Vig et al., 2020; De Cao et al., 2021). (2) While prior rehearsal methods (Lopez-Paz & Ranzato, 2017) consider learning all of the streams of tasks at once (multi-task learning) as the performance upper-bound and replicate such a setting with samples stored in the episodic memory, a few samples from the pretraining corpus cannot represent the overall world knowledge from the corpus. Moreover, if LMs are pretrained on a shuffled concatenation of stream of corpora, there is no guarantee that the LMs will acquire the correct, recent information from the recent corpora, especially in cases where the former corpora are much bigger than the latter ones, which is shown by experiments in Section 5.1. (3) Lastly, prior parameter-expansion methods (Rusu et al., 2016; Yoon et al., 2018) focus on learning a stream of different tasks via strong supervision, while in CKL, the focus is constantly updating world knowledge from a stream of corpora via self-supervision.
+
+Because of these fundamental differences, instead of contemporary CL methods mentioned above, we explore methodologies from the literature that are suitable for CKL (Chen et al., 2020; He et al., 2021; Hu et al., 2021; Wang et al., 2021b), modifying and adapting each method according to our needs as CKL methods. Lastly, while it has been pointed out that some of the traditional CL formulations may have little practical importance in real-world scenarios by Prabhu et al. (2020), CKL is much closer to the initial motivation behind CL, which is that the “fundamental characteristic of natural intelligence is its ability to continually learn new knowledge while updating information about the old ones” (Prabhu et al., 2020). Details of related works regarding the traditional CL methods and how CKL methods address the fundamental differences are provided in Appendix A.
+
+# 3 CONTINUAL KNOWLEDGE LEARNING (CKL)
+
+In this section, we explain the formulation of the task, the data construction process, and the proposed metric measuring the trade-off between forgetting previous world knowledge and updating and learning of new world knowledge.
+
+# 3.1 TASK FORMULATION
+
+When viewing the task of renewing the internal knowledge of LMs as one of CL formulations, pretraining on the original corpus can be considered as a previous task, and continued pretraining on new corpus can be considered as the current task, the main objective becoming retaining the time-invariant world knowledge gained through initial pretraining while efficiently learning new and updated world knowledge through continued pretraining. Throughout the paper, we let $D _ { 0 }$ refer to the corpus used for initial pretraining and let $D _ { 1 }$ denote the new corpus used for continued pretraining.
+
+New Text Corpus for Language Modeling For LMs to renew their internal knowledge, they need to be continually pretrained on a new text corpus $D _ { 1 }$ which has the updated and new information. $D _ { 1 }$ should ideally be much smaller than $D _ { 0 }$ , as a large $D _ { 1 }$ amounting to the size of $D _ { 0 }$ will result in massive computational costs similar to pretraining the LMs from scratch. For constructing $D _ { 1 }$ , we crawl recently published news articles from the web making CC-RECENTNEWS.2
+
+Probing LMs for World Knowledge The most widely used task for probing LMs for world knowledge is the LAnguage Model Analysis (LAMA) (Petroni et al., 2019) task, which consists of cloze sentences created from a set of knowledge sources using manually defined templates. We define that an LM knows a fact if it can successfully predict in a zero-shot manner the masked entity in the cloze sentence, such as “Dante was born in ” as Florence. While there may be other alternatives for measuring the world knowledge encoded in ${ \mathrm { L M s } } ^ { 3 }$ , we construct our main datasets as LAMA tasks, while also additionally providing the corresponding question pairs to the cloze sentences for those who want to test on CBQA as well.
+
+Measuring Retention of Time-invariant World Knowledge We define time-invariant world knowledge as the information present in $D _ { 0 }$ that has no possibility of conflicting with information from $D _ { 1 }$ . For example, if the information of the birthplace of Barack Obama is present in $D _ { 0 }$ , it is unlikely that $D _ { 1 }$ contains information that contradicts that fact. Also, we classify instances where the time-stamps are fixed such as “Cristiano Ronaldo played for in 2010.” as time-invariant. These time-invariant instances should not be changed as LMs are continually pretrained on $D _ { 1 }$ . In order to measure how much time-invariant information is lost due to catastrophic forgetting during continued pretraining, we create INVARIANTLAMA, a subset of LAMA (Petroni et al., 2019), consisting of only time-invariant cloze sentences detailed in Appendix B.1.
+
+Measuring Update of Outdated World Knowledge In this work, we define outdated world knowledge as information that is conflicting between $D _ { 0 }$ and $D _ { 1 }$ . For example, the President of the US may be Barack Obama in $D _ { 0 }$ and Joe Biden in $D _ { 1 }$ . In this case, the LM should update its internal knowledge as Joe Biden as the US president. If an LM is pretrained on both $D _ { 0 }$ and $D _ { 1 }$ simultaneously, there is no guarantee that the LM will acquire the correct, recent information from $D _ { 1 }$ , especially in cases where $D _ { 0 }$ is much bigger than $D _ { 1 }$ , which is one of the biggest difference between the CKL and traditional CL setting. For measuring update of outdated information, we construct UPDATEDLAMA which is made up of cloze statements for which answers can be found in both $D _ { 0 }$ and $D _ { 1 }$ , but are conflicting.
+
+Measuring Acquisition of New World Knowledge We define new world knowledge as the information present in $D _ { 1 }$ , but not in $D _ { 0 }$ . To measure new knowledge acquired through continued pretraining on $D _ { 1 }$ , we construct NEWLAMA which is made up of detailed cloze statements requiring new knowledge from $D _ { 1 }$ to correctly answer. We provide two datasets for measuring new world knowledge: NEWLAMA, for which each of the instances is verified that the answer does not exist in $D _ { 0 }$ , but only in $D _ { 1 }$ , and NEWLAMA-EASY for which each of the instances does not perfectly comply with our strict definition of new world knowledge due to its creation process, but is used to generally measure the new knowledge acquired from continued pretraining on $D _ { 1 }$ at a larger scale.
+
+Table 1: Dataset statistics. Input and answer length are the corresponding average token lengths.
+
+
Dataset
Size
Input Length
Answer Length
Dataset
Size
Input Length
Answer Length
INVARIANTLAMA
17474
11.9
1.3
NEWLAMA
797
14.7
8.7
UPDATEDLAMA
924
13.7
9.4
NEWLAMA-EASY
11177
44.4
6.1
+
+NEWLAMA-EASY can be considered easier since each instance was constructed to be similar to the data distribution seen during continued pretraining.
+
+Dataset Construction The data for continual pretraining, CC-RECENTNEWS, is constructed using news-please (Hamborg et al., 2017). INVARIANTLAMA is constructed by manually selecting 28 time-invariant relations from T-Rex (Elsahar et al., 2018). For UPDATEDLAMA and NEWLAMA, we use Amazon Mechanical Turk (mturk)4 for crowd-sourcing Human Intelligent Tasks (HITs). The process requires selecting answerable questions from a list of questions generated by the model introduced in Lewis et al. (2021) and converting them into cloze sentences. We have also separately hired 11 experts to verify the correctness and search the C4 database to categorize each instance following our definition of updated and new. NEWLAMA-EASY is constructed at a larger scale through a two-phase mturk process where sentences selected from articles containing new information are decontextualized and paraphrased5 before being masked, verified and converted to corresponding questions. The constructed dataset statistics are in Table 1. Important details about the data construction pipeline, examples, and more fine-grained statistics are provided in Appendix B.
+
+# 3.2 COMBINED METRIC FOR CKL
+
+We propose a novel metric, FUAR (FORGOTTEN / (UPDATED $^ +$ ACQUIRED) RATIO), that can compare the efficiency of each CKL method using the trade-off between forgotten time-invariant knowledge and updated or newly acquired knowledge. FUAR represents relatively how many timeinvariant knowledge instances are forgotten in order to learn one new or updated knowledge instance. We first define FUAR for the general case where there can be multiple corpora used for training an ever-changing LM.
+
+Let $T$ be an arbitrary task and $( D _ { i } ) _ { i = 0 } ^ { n }$ be a sequence of corpora used for LM pretraining, where $D _ { 0 }$ is the initial pretraining corpus. We define $\mathrm { G a p } ( T , D _ { a } , D _ { b } ) = S c o r e ( T )$ of $L M _ { a } - S c o r e ( T )$ of $L M _ { b }$ , where $L M _ { a }$ represents the LM after being pretrained on $D _ { a }$ . Then, we denote $\mathbb { T } ^ { F } = ( T _ { i } ^ { F } ) _ { i = 0 } ^ { n - 1 }$ as a sequence of tasks from $( D _ { i } ) _ { i = 0 } ^ { n - 1 }$ measuring the forgetting of invariant-knowledge from each corresponding corpous. If there is no such task from corpus $D _ { i }$ , the value of $T _ { i } ^ { F }$ is set to $n . d .$ ., which means not defined. Likewise, we denote $T _ { n } ^ { U }$ and $T _ { n } ^ { A }$ as tasks from $D _ { n }$ measuring the update and acquisition of new knowledge, respectively. We define FUAR as follows:
+
+$$
+\mathbf { F U A R } ( \mathbb { T } ^ { F } , T _ { n } ^ { U } , T _ { n } ^ { A } ) = \left\{ \begin{array} { l l } { \displaystyle \sum _ { i = 1 } ^ { n - 1 } \operatorname* { m a x } ( 0 , \mathbb { G } \mathrm { a p } ( T _ { i } ^ { F } , D _ { i } , D _ { n } ) ) \mathbb { 1 } _ { \{ T _ { i } ^ { F } \neq n . d . \} } } \\ { \displaystyle \sum _ { i = 0 } ^ { n - 1 } \{ \operatorname* { m a x } ( 0 , \mathbb { G } \mathrm { a p } ( T _ { n } ^ { U } , D _ { n } , D _ { i } ) ) \mathbb { 1 } _ { \{ T _ { i } ^ { F } \neq n . d . \} } + \operatorname* { m a x } ( 0 , \mathbb { G } \mathrm { a p } ( T _ { n } ^ { A } , D _ { n } , D _ { i } ) ) \mathbb { 1 } _ { \{ T _ { i } ^ { F } \neq n . d . \} } \} } \\ { \displaystyle \mathrm { i f ~ d e n o m i n a t o r ~ } > 0 , } \\ { \displaystyle n o ~ g a i n , \mathrm { o t h e r w i s e } . } \end{array} \right. ,
+$$
+
+The choice of benchmark tasks $\mathbb { T } ^ { F }$ , $T _ { n } ^ { U }$ , and $T _ { n } ^ { A }$ can differ according to each experimental setup. FUAR value of 1.0 represents an equal trade-off scenario where one time-invariant knowledge instance of $\mathbb { T } ^ { F }$ is forgotten on average to gain one new or updated knowledge instance of $T _ { n } ^ { \widetilde { U } }$ and $T _ { n } ^ { A }$ . The two terms in the denominators are summed because newly gained knowledge and updated knowledge are mutually exclusive by definition. When the value is smaller than 1, it means that the model obtains more new or updated knowledge than the amount of forgotten knowledge, so methods that exhibit a low FUAR value can be considered suitable for CKL. If the value is zero, then it is a case where no forgetting occurs at all and is the upper bound for performance. If the denominator is 0, we denote the case as no gain and regard it as the worst possible case.6
+
+# 4 EXPERIMENTAL SETUP
+
+We perform extensive experiments with an encoder-decoder model, T5 (Raffel et al., 2019), a large LM $\mathrm { \sim 7 3 7 M }$ params) initially pretrained on April 2019 dump of C4 and May 2020 dump of Wikipedia (thus $D _ { 0 }$ in our experiments) with salient span masking (SSM). The details of the pretraining, continual pretraining, and evaluation configurations are in Appendix C. We establish the following methods as the baselines for the CKL benchmark and categorize them into regularization, rehearsal, and parameter-expansion methods. The specific hyperparamters used for the implementation of each method are detailed in Appendix D.
+
+Initial refers to the setting where we evaluate the LM before any continued pretraining. The performance of this model can be considered as the upper-bound for INVARIANTLAMA and lower-bound on UPDATEDLAMA and NEWLAMA.
+
+Vanilla is a specific setting of further pretraining (Gururangan et al., 2020), where the domain is new knowledge, and the LM is further pretrained without any training strategies.
+
+RecAdam (Chen et al., 2020) falls into the category of regularization methods. It places a stronger independent assumption among the model parameters than the traditional regularization method (EWC (Kirkpatrick et al., 2017)) and does not access the initial pretraining corpus to regularize the model weights during continued pretraining. The optimizer is annealed so that less regularization is applied as the training progresses.
+
+Mix-Review (He et al., 2021) falls into the category of rehearsal methods, which assumes access to the initial pretraining corpus and mixes in random subsets of the initial pretraining data during continued pretraining, depending on the mix-ratio at the current time step. As the training progresses, the mix-ratio decays towards 0, decreasing the amount of the mixed original data at each iteration.
+
+LoRA (Hu et al., 2021) falls into the category of parameter-expansion methods. It freezes the original parameters of the LM and adds trainable rank-decomposition matrices into each layer that are updated during continued pretraining. Hu et al. (2021) has implemented this approach with decoder-only models (GPT-2 (Radford et al., 2019) & GPT-3 (Brown et al., 2020)) while we apply it to an encoder-decoder model, denoting it as T5-LoRA.
+
+K-Adapter (Wang et al., 2021b) is another parameter-expansion method that freezes the original parameters of the LM while adding $k$ number of new layers, namely adapters, that are updated during continued pretraining. Wang et al. (2021b) have shown successful injection of factual and linguistic knowledge for encoder-only models, BERT (Devlin et al., 2019) & RoBERTa (Liu et al., 2019), while we also apply it to an encoder-decoder model, T5, and decoder-only model, GPT-2.
+
+Modular is a newly proposed parameter-expansion method specifically for encoder-decoder models which freezes the original, pretrained encoder while adding a new, randomly initialized encoder that is updated during continued pretraining. For the newly added encoder, we vary the size to T5-small while keeping the size of the original encoder and decoder to be T5-large.
+
+# 5 EXPERIMENTAL RESULTS
+
+In this section, we first show the main experimental results for the CKL Benchmark. Then, since multiple steps of continual knowledge learning, i.e., CKL are needed for training a true, everchanging LM, we explore the effects of multiple CKL phases as well as how epochs, corpus size, and the total number of training steps affect CKL. We further explore how learning rates affect CKL in Appendix E, how continual pretraining on $D _ { 1 }$ affects the performance of KILT tasks which require knowledge from $D _ { 0 }$ in Appendix F, how CKL methods transfer across LM architectures in Appendix G, and how the prediction outputs change during CKL in Appendix H.
+
+Table 2: Zero-shot probing performance on the CKL benchmark. The best results for each task and metric are shown in bold, and the second-best results are underlined.
+
+
Method
#of Params (Trainable/Total)
IL
UL
NL EM
NLE EM
FUAR ((IL),UL,NL) ↓
EM EM
T5-Initial
0M/737M
24.17
1.62
1.88
10.32
T5-Vanilla
737M/737M
12.89
10.17
3.77
17.75
1.08
T5-RecAdam
737M/737M
13.20
12.55
4.02
17.85
0.84
T5-MixReview
737M/737M
13.92
6.49
2.89
14.86
1.74
T5-LoRA
403M/738M
16.58
12.77
4.52
19.56
0.55
T5-Kadapters (k=2)
427M/762M
19.59 19.76
12.34
5.03
18.75
0.33
T5-Kadapters (k=3)
440M/775M
12.66
4.02
19.00
0.33
T5-Modular
438M/773M
20.29
12.66
4.65
19.24
0.28
+
+# 5.1 MAIN RESULTS
+
+Table 2 shows our main experimental result on the CKL benchmark. While only the exact match (EM) is reported in Table 2, we report the F1 score as well as the mean precision at k $( P @ k .$ , $\mathrm { k } { = } 1 , 5 , 1 0 , 2 0 , 5 0 , 1 0 0 )$ in Appendix J. The T5 models are originally pretrained on C4 (about 1 trillion token updates) and Wikipedia, which is considered as ${ \bf { \bar { \it D } } } _ { 0 }$ .7, and then continually pretrained on CC-RecentNews (corpus $D _ { 1 }$ ) for 4 epochs $2 5 \mathrm { k }$ global training steps, about 673 million token updates) using each of the CKL methods. Each of IL, UL, NL, NLE stands for INVARIANTLAMA, UPDATEDLAMA, NEWLAMA, and NEWLAMA-EASY, respectively. Detailed descriptions about the setup for this experiment are included in the caption.
+
+We first find that all of the CKL methods except for T5-MixReview are more effective at forgetting less time-invariant knowledge while updating and acquiring new knowledge than using the na¨ıve approach of T5-Vanilla as shown by the FUAR. This result also highlights the main difference between CKL and CL; while rehearsal methods show strong performances in traditional CL settings (Prabhu et al., 2020; Bang et al., 2021), in CKL, it shows the worst performance since the update of outdated knowledge and acquisition of new knowledge is severely deterred as shown in the performance of UL and NL while not showing competitive mitigation of forgetting as shown in the performance of IL compared to other CKL methods. Amongst the other CKL methods, we observe a rather consistent trend that the parameter-expansion methods achieve better results. The first and second-best results on all of UL, NL, and NLE are all from parameter-expansion methods. Meanwhile, although UL and NL are constructed following the same procedure, there is a huge difference between the EM scores of UL and NL. We analyze the source of this difference in Appendix I.
+
+Figure 9 visualizes how the EM scores of each task change as T5-Kadapters, the CKL method with the most robust performance, and T5-Vanilla are continually pretrained on $D _ { 1 }$ . In all of the tasks, the performance of T5-Initial can be considered as the upper-bound for $\mathrm { I L }$ and lower-bound for UL, NL, NLE. Corresponding with our main observations, CKL allows considerable retention of timeinvariant world knowledge while improving updating and gaining new world knowledge compared to T5-Vanilla, mitigating the overall trade-off.
+
+# 5.2 EXPLORING MULTIPLE PHASES OF CKL
+
+In order to show the potential for creating a truly ever-changing LM, we explore the effect of multiple CKL phases by creating CC-RECENTNEWS-SMALL, denoted as SMALL, which is a small variant of CC-RECENTNEWS that consists of randomly sampled $10 \%$ of the original corpus. We then split
+
+
+TitleFigure 2: Performance at each epoch during continued pretraining in the main experimental setting.
+
+Table 3: Zero-shot probing performance after T5 models are continually pretrained on different subsets of CC-RECENTNEWS. NLE and $\mathrm { I L }$ stand for NewLAMA-Easy and InvariantLAMA, respectively. There are three scenarios according to the corpus used for continual pretraining, explained in the text of Section 5.2. The FUAR of the three scenarios is calculated differently, and the corresponding tasks are shown in the table as the parameters of FUAR: $\mathbb { T } ^ { F }$ , $T _ { n } ^ { U }$ , and $T _ { n } ^ { A }$ . In this setting, $\mathbb { T } ^ { F }$ consists of only a single task $T _ { 0 } ^ { F } ( \mathrm { I L } )$ measuring the time-invariant information lost from $D _ { 0 }$ only. For SMALL, we calculate the gap on NLE using the weighted sum of the gaps on $\mathrm { N L E } _ { \mathrm { P l } }$ and $_ { \mathrm { N L E } _ { \mathrm { P 2 } } }$ with uniform weights.
+
+
Corpus
Method
# of Params (Trainable/Total)
IL
NLEP1
NLEP2
EM
EM
EM
T5-Initial
0M/737M
24.17
8.69
9.45
FUAR ((IL),n.d.,NLE)↓
SMALL (SMALL-P1 + SMALL-P2)
T5-Vanilla
737M/737M
11.86
17.77
16.42
1.53
T5-RecAdam
737M/737M
11.85
16.46
13.93
2.01
T5-MixReview
737M/737M
14.36
14.18
13.93
1.97
T5-LoRA
403M/738M
14.26
20.60
19.90
0.87
T5-Kadapters (k=2)
427M/762M
18.16
18.34
16.42
0.72
T5-Kadapters (k=3)
440M/775M
17.12
20.98
20.39
0.61
T5-Modular
438M/773M
16.40
19.47
19.90
0.73
T5-Initial
0M/737M
24.17
8.69
9.45
FUAR ((IL),n.d.,NLEP1)↓
SMALL-P1
T5-Vanilla
737M/737M
9.68
20.60
11.44
1.22
T5-RecAdam
737M/737M
11.78
20.42
11.94
1.06
T5-MixReview
737M/737M
16.13
15.88
11.94
1.12
T5-LoRA
403M/738M
14.75
20.79
13.93
0.78
T5-Kadapters (k=2)
427M/762M
19.11
20.60
10.95
0.42
T5-Kadapters (k=3)
440M/775M
19.08
18.15
10.94
T5-Modular
438M/773M
17.08
18.90
11.94
0.54 0.69
T5-Initial
0M/737M
FUAR
SMALL-P1→ SMALL-P2
T5-Vanilla
24.17
8.69
9.45
((IL,n.d.),n.d.,NLEp2)↓
T5-RecAdam
737M/737M
9.40
14.37
23.38
1.06
737M/737M
7.25
14.56
20.90
1.48
T5-MixReview
737M/737M
13.20
17.20
16.92
1.47
T5-LoRA
404M/740M
13.25
16.07
22.39
0.84
T5-Kadapters (k=2)
427M/788M
15.78
16.07
23.38
0.60
T5-Kadapters (k=3)
440M/813M
15.47
15.31
20.90
0.76
T5-Modular
438M/809M
14.66
15.31
20.40
0.87
+
+CC-RECENTNEWS-SMALL into two different splits by the published date of each article to simulate a setting where multiple CKL phases are needed, denoted as SMALL-P1 $( 0 5 . 2 0 2 0 - 1 1 . 2 0 2 0 ) )$ ) and SMALL-P2 $1 1 . 2 0 2 0 \cdot 0 4 . 2 0 2 1 _ { . }$ ). $\mathrm { N L E ^ { 8 } }$ is also split into two different, smaller datasets, $\mathrm { N L E } _ { \mathrm { P l } }$ and ${ \mathrm { N L E } } _ { \mathrm { P 2 } }$ , each comprising of instances constructed from articles in SMALL-P1 and SMALL-P2, respectively. We compare how CKL methods for T5 perform on $\mathrm { I L }$ , $\mathrm { N L E } _ { \mathrm { P l } }$ , and ${ \mathrm { N L E } } _ { \mathrm { P 2 } }$ when continually pretrained entirely on SMALL for $5 \mathrm { k }$ steps (8 epochs), and when sequentially pretrained on SMALL-P1 and then on SMALL-P2 for $2 . 5 \mathrm { k }$ steps (8 epochs) each. In the scenario SMALL$\mathrm { \bf P l } \to { \bf \Phi }$ SMALL-P2, there are two CKL phases where $D _ { 0 }$ is C4 and Wikipedia, $D _ { 1 }$ is SMALL-P1, and $D _ { 2 }$ is SMALL-P2. The rest of the configurations are set identical with the main experiments.
+
+
+Figure 3: Performance at each epoch on INVARIANTLAMA during continued pretraining in MAIN, SMALL, and SMALL-P1 SMALL-P2 scenarios. Each marker indicates the result at each continual pretraining epoch.
+
+Comparing the performance on $\mathrm { I L }$ of the two scenarios, SMALL and SMALL- $\mathbf { P } 1 { } \mathbf { S }$ MALL-P2, results show that LMs are prone to more forgetting as they go through multiple CKL phases, despite having the same number of training steps. One of the reasons may be due to the learning rate scheduling, which is initialized at the start of each phase.
+
+Furthermore, despite showing the best performance overall, the drawbacks of parameter-expansion methods are also highlighted in the SMALL-P1 SMALL-P2 setting; they require new parameters to be added at every phase of the update. For example, the number of total parameters of T5-Modular increases by 36M in every round of the continual pretraining phase. Likewise, considering a large number of CKL phases introduces new problems that should be additionally studied. Taking into account that LMs should be updated frequently with a small amount of data in real-world scenarios for gaining up-to-date world knowledge about the ever-changing world in a computation-effective manner, more research is needed to mitigate the amount of forgetting that follows the larger number of update phases.
+
+Effects of Epochs, Corpus Size, and Total Number of Training Steps in CKL on Forgetting Figure 3 shows the result of T5-Vanilla and T5-Kadapters during continued pretraining in different scenarios from Table 2 and 3, where each point in the graph represents the performance of $\mathrm { I L }$ after every epoch. Comparing MAIN (4 epochs) and SMALL (8 epochs) in Figure 3 (a) T5-Vanilla, we can see that more forgetting occurs in SMALL, even though trained for five times less number of global training steps. This phenomenon is further highlighted when comparing results from SMALL-P1 (8 epochs) which shows the most amount of forgetting despite being trained for ten times less number of global training steps. While the overall drop is much mitigated in Figure 3 (b) T5-Kadapters, we observe the same trend between each scenario which goes to show how critical observing the same data repeatedly during continued pretraining is for causing forgetting.
+
+The results are in line with findings from Lee et al. (2021) which suggest LMs should be pretrained with just a few epochs on less duplicating data for efficiency. We add additional intuition to their findings and conjecture that the inefficiency of pretraining from duplicate data could have been caused by the forgetting of the rather long-tail knowledge in the pretraining corpus.
+
+# 6 CONCLUSION
+
+In this paper, we propose CONTINUAL KNOWLEDGE LEARNING (CKL), where we establish benchmark datasets and metrics, and explore methodologies towards continual knowledge learning of an ever-changing LM. We find that parameter-expansion methods show the most robust performance throughout all of the experimental settings, which nevertheless has severe memory inefficiency and that seeing the same data often is a critical cause of forgetting. We also discuss several other interesting results of which we leave further exploration to future studies. To this end, we suggest the community to explore CKL for the better design of an ever-changing LM.
+
+# ACKNOWLEDGMENTS
+
+The authors would like to thank Sang-Woo Lee, Jinheon Baek, Miyoung Ko, Hyunji Lee, and Eunbi Choi for helpful discussions. This work was supported by Institute of Information & communications Technology Planning & Evaluation (IITP) grant funded by the Korea government (MSIT) (No. 2019-0-00075, Artificial Intelligence Graduate School Program (KAIST)).
+
+# REFERENCES
+
+Jihwan Bang, Heesu Kim, YoungJoon Yoo, Jung-Woo Ha, and Jonghyun Choi. Rainbow memory: Continual learning with a memory of diverse samples. In CVPR, 2021.
+
+Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. In NeurIPS, 2020.
+
+Sanyuan Chen, Yutai Hou, Yiming Cui, Wanxiang Che, Ting Liu, and Xiangzhan Yu. Recall and learn: Fine-tuning deep pretrained language models with less forgetting. In EMNLP, 2020.
+
+Eunsol Choi, Jennimaria Palomaki, Matthew Lamm, Tom Kwiatkowski, Dipanjan Das, and Michael Collins. Decontextualization: Making sentences stand-alone. TACL, 9:447–461, 2021.
+
+Damai Dai, Li Dong, Y. Hao, Zhifang Sui, and Furu Wei. Knowledge neurons in pretrained transformers. ArXiv, abs/2104.08696, 2021.
+
+Cyprien de Masson d’Autume, Sebastian Ruder, Lingpeng Kong, and Dani Yogatama. Episodic memory in lifelong language learning. In NeurIPS, 2019.
+
+Nicola De Cao, Wilker Aziz, and Ivan Titov. Editing factual knowledge in language models. In EMNLP, 2021.
+
+Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL, 2019.
+
+Bhuwan Dhingra, Jeremy R Cole, Julian Martin Eisenschlos, Daniel Gillick, Jacob Eisenstein, and William W Cohen. Time-aware language models as temporal knowledge bases. arXiv preprint arXiv:2106.15110, 2021.
+
+Emily Dinan, Stephen Roller, Kurt Shuster, Angela Fan, Michael Auli, and Jason Weston. Wizard of wikipedia: Knowledge-powered conversational agents. In ICLR, 2019.
+
+Hady Elsahar, Pavlos Vougiouklis, Arslen Remaci, Christophe Gravier, Jonathon Hare, Elena Simperl, and Frederique Laforest. T-rex: A large scale alignment of natural language with knowledge base triples. In LREC, 2018.
+
+Angela Fan, Yacine Jernite, Ethan Perez, David Grangier, Jason Weston, and Michael Auli. Eli5: Long form question answering. In ACL, 2019.
+
+Zhaochen Guo and Denilson Barbosa. Robust named entity disambiguation with random walks. Semantic Web, 9(4):459–479, 2018.
+
+Suchin Gururangan, Ana Marasovic, Swabha Swayamdipta, Kyle Lo, Iz Beltagy, Doug Downey, ´ and Noah A Smith. Don’t stop pretraining: adapt language models to domains and tasks. In ACL, 2020.
+
+Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Realm: Retrievalaugmented language model pre-training. In ICML, 2020.
+
+Felix Hamborg, Norman Meuschke, Corinna Breitinger, and Bela Gipp. news-please: A generic news crawler and extractor. In 15th International Symposium of Information Science (ISI 2017), pp. 218–223, 2017.
+
+Tianxing He, Jun Liu, Kyunghyun Cho, Myle Ott, Bing Liu, James Glass, and Fuchun Peng. Analyzing the forgetting problem in pretrain-finetuning of open-domain dialogue response models. In EACL, 2021.
+
+Johannes Hoffart, Mohamed Amir Yosef, Ilaria Bordino, Hagen Furstenau, Manfred Pinkal, Marc ¨ Spaniol, Bilyana Taneva, Stefan Thater, and Gerhard Weikum. Robust disambiguation of named entities in text. In EMNLP, 2011.
+
+Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, and Weizhu Chen. Lora: Low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685, 2021.
+
+Xisen Jin, Dejiao Zhang, Henghui Zhu, Wei Xiao, Shang-Wen Li, Xiaokai Wei, Andrew Arnold, and Xiang Ren. Lifelong pretraining: Continually adapting language models to emerging corpora. arXiv preprint arXiv:2110.08534, 2021.
+
+Mandar Joshi, Eunsol Choi, Daniel S Weld, and Luke Zettlemoyer. Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension. In ACL, 2017.
+
+James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521–3526, 2017.
+
+Mojtaba Komeili, Kurt Shuster, and Jason Weston. Internet-augmented dialogue generation. arXiv preprint arXiv:2107.07566, 2021.
+
+Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, et al. Natural questions: a benchmark for question answering research. TACL, 7:453–466, 2019.
+
+Angeliki Lazaridou, Adhiguna Kuncoro, Elena Gribovskaya, Devang Agrawal, Adam Liska, Tayfun Terzi, Mai Gimenez, Cyprien de Masson d’Autume, Sebastian Ruder, Dani Yogatama, et al. Pitfalls of static language modelling. arXiv preprint arXiv:2102.01951, 2021.
+
+Katherine Lee, Daphne Ippolito, Andrew Nystrom, Chiyuan Zhang, Douglas Eck, Chris CallisonBurch, and Nicholas Carlini. Deduplicating training data makes language models better. arXiv preprint arXiv:2107.06499, 2021.
+
+Omer Levy, Minjoon Seo, Eunsol Choi, and Luke Zettlemoyer. Zero-shot relation extraction via reading comprehension. In CoNLL, 2017.
+
+Patrick Lewis, Ethan Perez, Aleksandara Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kuttler, Mike Lewis, Wen-tau Yih, Tim Rockt ¨ aschel, et al. Retrieval-augmented gener- ¨ ation for knowledge-intensive nlp tasks. In NeurIPS, 2020a.
+
+Patrick Lewis, Pontus Stenetorp, and Sebastian Riedel. Question and answer test-train overlap in open-domain question answering datasets. arXiv preprint arXiv:2008.02637, 2020b.
+
+Patrick Lewis, Yuxiang Wu, Linqing Liu, Pasquale Minervini, Heinrich Kuttler, Aleksandra Piktus, ¨ Pontus Stenetorp, and Sebastian Riedel. Paq: 65 million probably-asked questions and what you can do with them. In EACL, 2021.
+
+Yanyang Li, Ye Lin, Tong Xiao, and Jingbo Zhu. An efficient transformer decoder with compressed sub-layers. arXiv preprint arXiv:2101.00542, 2021.
+
+Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
+
+Shayne Longpre, Kartik Perisetla, Anthony Chen, Nikhil Ramesh, Chris DuBois, and Sameer Singh. Entity-based knowledge conflicts in question answering. arXiv preprint arXiv:2109.05052, 2021.
+
+David Lopez-Paz and Marc’Aurelio Ranzato. Gradient episodic memory for continual learning. In NeurIPS, 2017.
+
+Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. Psychology of learning and motivation, 24:109–165, 1989.
+
+David Patterson, Joseph Gonzalez, Quoc Le, Chen Liang, Lluis-Miquel Munguia, Daniel Rothchild, David So, Maud Texier, and Jeff Dean. Carbon emissions and large neural network training. arXiv preprint arXiv:2104.10350, 2021.
+
+Fabio Petroni, Tim Rocktaschel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H Miller, ¨ and Sebastian Riedel. Language models as knowledge bases? In EMNLP, 2019.
+
+Fabio Petroni, Aleksandra Piktus, Angela Fan, Patrick Lewis, Majid Yazdani, Nicola De Cao, James Thorne, Yacine Jernite, Vladimir Karpukhin, Jean Maillard, et al. Kilt: a benchmark for knowledge intensive language tasks. In NAACL, 2021.
+
+Nina Poerner, Ulli Waltinger, and Hinrich Schutze. E-bert: Efficient-yet-effective entity embeddings ¨ for bert. In Findings of EMNLP, 2019.
+
+Ameya Prabhu, Philip HS Torr, and Puneet K Dokania. Gdumb: A simple approach that questions our progress in continual learning. In ECCV, 2020.
+
+Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
+
+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. arXiv preprint arXiv:1910.10683, 2019.
+
+Adam Roberts, Colin Raffel, and Noam Shazeer. How much knowledge can you pack into the parameters of a language model? In EMNLP, 2020.
+
+Andrei A Rusu, Neil C Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. arXiv preprint arXiv:1606.04671, 2016.
+
+Taylor Shin, Yasaman Razeghi, Robert L. Logan IV, Eric Wallace, and Sameer Singh. AutoPrompt: Eliciting knowledge from language models with automatically generated prompts. In EMNLP, 2020.
+
+Fan-Keng Sun, Cheng-Hao Ho, and Hung-Yi Lee. Lamol: Language modeling for lifelong language learning. In ICLR, 2020.
+
+James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal. Fever: a large-scale dataset for fact extraction and verification. In NAACL, 2018.
+
+Jorg Tiedemann and Santhosh Thottingal. OPUS-MT — Building open translation services for the¨ World. In EAMT, Lisbon, Portugal, 2020.
+
+Pat Verga, Haitian Sun, Livio Baldini Soares, and William W Cohen. Facts as experts: Adaptable and interpretable neural memory over symbolic knowledge. In NAACL, 2021.
+
+Jesse Vig, Sebastian Gehrmann, Yonatan Belinkov, Sharon Qian, Daniel Nevo, Simas Sakenis, Jason Huang, Yaron Singer, and Stuart Shieber. Causal mediation analysis for interpreting neural nlp: The case of gender bias. In NeurIPS, 2020.
+
+Cunxiang Wang, Pai Liu, and Yue Zhang. Can generative pre-trained language models serve as knowledge bases for closed-book qa? In ACL, 2021a.
+
+Ruize Wang, Duyu Tang, Nan Duan, Zhongyu Wei, Xuanjing Huang, Cuihong Cao, Daxin Jiang, Ming Zhou, et al. K-adapter: Infusing knowledge into pre-trained models with adapters. In Findings of ACL, 2021b.
+
+Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick ´ von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. Transformers: State-of-the-art natural language processing. In EMNLP System Demonstrations, 2020.
+
+Jing Xu, Arthur Szlam, and Jason Weston. Beyond goldfish memory: Long-term open-domain conversation. arXiv preprint arXiv:2107.07567, 2021.
+
+Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William W Cohen, Ruslan Salakhutdinov, and Christopher D Manning. Hotpotqa: A dataset for diverse, explainable multi-hop question answering. In EMNLP, 2018.
+
+Jaehong Yoon, Eunho Yang, Jeongtae Lee, and Sung Ju Hwang. Lifelong learning with dynamically expandable networks. In ICLR, 2018.
+
+Rowan Zellers, Ari Holtzman, Hannah Rashkin, Yonatan Bisk, Ali Farhadi, Franziska Roesner, and Yejin Choi. Defending against neural fake news. In NeurIPS, 2019.
+
+Michael J.Q. Zhang and Eunsol Choi. SituatedQA: Incorporating extra-linguistic contexts into QA. EMNLP, 2021.
+
+Chen Zhu, Ankit Singh Rawat, Manzil Zaheer, Srinadh Bhojanapalli, Daliang Li, Felix Yu, and Sanjiv Kumar. Modifying memories in transformer models. arXiv preprint arXiv:2012.00363, 2020.
+
+# A EXTENSION OF RELATED WORKS
+
+As mentioned in Section 2, there are fundamental differences between the traditional CL formulations and CKL which make the previous CL methods inadequate for the CKL setting. In this section, we introduce the prior traditional continual learning methods in detail, explore the methods from the literature set as baselines for the CKL benchmark and how they address the identified limitations of CL methods, and provide descriptions about alternative methods making LMs cope with the changing world.
+
+# A.1 TRADITIONAL CONTINUAL LEARNING
+
+Traditional continual learning (CL) methods focus on addressing two aspects of transfer between sequentially incoming tasks: forward transfer and backward transfer (Lopez-Paz & Ranzato, 2017). Forward transfer refers to how past tasks affect the performance of the current and future tasks. Backward transfer refers to how current or future tasks affect the performance of previous tasks. The general pretrain-finetune approach can be seen as an instance of positive forward transfer where a model performs better on a target task after being pretrained on a more general source task. Moreover, catastrophic forgetting can be seen as an instance of negative backward transfer where previous tasks suffer performance due to continued training on different tasks. With respect to these two aspects, CL approaches can be categorized into three main approaches: regularization, rehearsal, and parameter-expansion methods.
+
+Regularization Elastic Weight Consolidation (EWC) (Kirkpatrick et al., 2017) is a method that regularizes important parameters of previous tasks while training for the current tasks, helping mitigate the negative backward transfer of previous tasks. Important parameters are measured via a Fisher information matrix computed by measuring the magnitude of the gradient update step of each parameter during training of previous tasks.
+
+Rehearsal Gradient Episodic Memory (GEM) (Lopez-Paz & Ranzato, 2017) is one of the first rehearsal methods that utilize samples from each task stored in episodic memory and places an inequality constraint with respect to the losses of the samples in order to prevent negative backward transfer as well as allow the positive backward transfer. Other methods such as Experience replay and local adaptation (d’Autume et al., 2019) replay samples stored in the memory of previous tasks during training to mitigate forgetting.
+
+Parameter-expansion Progressive Neural Networks (PNN) (Rusu et al., 2016) is one of the earliest parameter-expansion/sharing approaches that introduce new sets of parameters for each new task where previous parameters are frozen and can be connected via lateral connections allowing for positive forward transfer. PNN not only prevents negative backward transfer but also surpassed the previous pretrain-finetune approach in terms of positive forward transfer in some tasks.
+
+# A.2 CKL METHODS FOR LANGUAGE MODELS
+
+As mentioned in Section 2, we explore the methods from the literature that have addressed the limitations of CL methods and thus are applicable to CKL. We also categorize these methods into the three main categories of CL.
+
+Regularization Most CL methods that utilize regularization require computing important parameters of the previous task, which in this case is pretraining on the original text corpus. Determining these parameters is oftentimes unrealistic since it requires large-scale pretraining which can hardly be replicated by most. Also, exactly how and where the knowledge is stored in the parameters of an LM is currently extremely difficult to identify and localize (Vig et al., 2020; De Cao et al., 2021). RecAdam (Chen et al., 2020) overcomes this limitation by following the same training objective as EWC (Kirkpatrick et al., 2017) with a stronger independent assumption and places a quadratic penalty, ridding the need to access the initial pretraining corpus.
+
+Rehearsal Large LMs are usually pretrained on a vast amount of raw text corpus such as Common Crawl9. When treating pretraining as a CL task, limitations exist when trying to apply previous rehearsal methods since a few samples from the pretraining corpus cannot represent the overall world knowledge from the original pretraining corpus. Mix-Review (He et al., 2021) solves this issue by performing preliminary experiments in a smaller pretraining setting by assuming access to the pretraining corpus during finetuning and mixing random subsets of pretraining corpus depending on a mix-ratio that anneals towards the target task as training progresses. Mix-Review can be considered a mild version of multi-task learning.
+
+Parameter-expansion K-Adapter (Wang et al., 2021b) shares and freezes the original parameters and adds new parameters through adapters for continued pretraining of factual and linguistic knowledge and improve performance on three different knowledge-driven downstream tasks. More recently, LoRA (Hu et al., 2021) freezes the original parameters and injects trainable rankdecomposition matrices into each layer of the Transformer architecture, greatly reducing the number of trainable parameters and the computational hardware requirement while performing on-par or better than training all of the parameters. Both methods hypothesize freezing the original parameters allows mitigation of catastrophic forgetting. We test out the hypothesis through implementation in our CKL benchmark.
+
+# A.3 METHODS OF INTEGRATING WORLD KNOWLEDGE WITH LANGUAGE MODELS
+
+Explicit Methods Facts-as-Experts (Verga et al., 2021) store representations of entities in the form of key-value pairs into external memory that can be modified during inference time. RAG (Lewis et al., 2020a) accesses a dense vector index of Wikipedia with a retriever and swaps indexes for updating the behavior of the model as the world changes. Blender Bot 2.0 (Xu et al., 2021; Komeili et al., 2021), is also one of the explicit methods that search the internet for recent knowledge and saves recent conversations in external long-term memory. Explicit methods, such as swapping indexes, adding explicit entity-relation knowledge, or searching the internet are in need of manual intervention during inference or are bound to tasks that require retrieval. In this paper, we focus only on implicit methods.
+
+Implicit Methods Zhu et al. (2020) proposed a new task of explicitly modifying specific facts without forgetting unmodified facts and provided several benchmark approaches without utilizing non-parametric memory, including constrained layer-wise finetuning. Wang et al. (2021b) proposed K-Adapter, a method that adds adapters to frozen layers of pretrained LMs to inject factual and linguistic knowledge and improve performance on downstream tasks. Chen et al. (2020) proposed a new optimizer that simulates the pretraining optimization while finetuning on the target task without needing access to the pretraining corpus, improving performance on the GLUE benchmark. De Cao et al. (2021) propose using a hyper-network to edit factual knowledge.
+
+Even though these implicit methods are efficient methods of injecting or modifying knowledge from the implicit parameters of the LMs, they are all limited to injecting specific knowledge such as the case of (Wang et al., 2021b) or modifying past knowledge such as the case of (Zhu et al., 2020; De Cao et al., 2021). No work, to the best of our knowledge, has specifically addressed the catastrophic forgetting of world knowledge gained from the initial pretraining when continued pretraining on new text corpus for the gain of new world knowledge.
+
+# B DATASET CONSTRUCTION
+
+In this section, we describe the dataset construction process we undergo in creating the benchmark datasets used in CKL. For the construction, we use Amazon Mechanical Turk (mturk)10 for crowdsourcing Human Intelligent Tasks (HITs) and separately hire 11 experts for annotation that requires extensive searching of the C4 corpus. In addition, three more experts11 who set up the data construction process and prepared the annotation guideline to ensure the quality of the data through post-validation and giving feedback to the annotators in real-time. The interfaces used for mturk HITs are provided in Appendix B.2.
+
+
+Figure 4: Dataset construction pipeline for (a) UPDATEDLAMA, NEWLAMA, and (b) NEWLAMA-EASY
+
+CC-RECENTNEWS We first construct CC-RECENTNEWS, a novel text corpus containing relatively new knowledge as $D _ { 1 }$ . We use news-please (Hamborg et al., 2017), similar to the CCNEWS (Liu et al., 2019) and REALNEWS dataset (Zellers et al., 2019), to crawl 221,779 news articles published from May 2020 to April 2021. LMs initially pretrained on $D _ { 0 }$ constructed before May 2020 can be continually pretrained on CC-RECENTNEWS to gain relatively recent world knowledge.
+
+INVARIANTLAMA We create INVARIANTLAMA, a subset of the LAMA (Petroni et al., 2019) task for measuring time-invariant knowledge which might be forgotten during CKL. Among the 41 relations of the T-REx (Elsahar et al., 2018) subset of LAMA, we manually select 28 relation types that probe for time-invariant instances (a full list of time-invariant relations are provided in Appendix B.1). We also remove instances where the answer overlapped with the subject following Poerner et al. (2019) since the answers for these instances can be inferred from the cloze statement itself. Lastly, we remove instances where the answer was a non-entity to leave only the instances that require world knowledge for prediction on their answers (Guu et al., 2020).
+
+UPDATEDLAMA and NEWLAMA We construct UPDATEDLAMA and NEWLAMA for measuring the update of outdated knowledge and acquisition of new knowledge during CKL. The challenge of constructing UPDATEDLAMA is that a knowledge instance can be only considered as the knowledge that requires update only if it is present in both $D _ { 0 }$ and $D _ { 1 }$ with changed details, and the challenge of constructing NEWLAMA is that the knowledge can be considered new only if it is in $D _ { 1 }$ but not in $D _ { 0 }$ . Therefore we set up the data construction process carefully. The pipeline for the creation of a single instance of UPDATEDLAMA and NEWLAMA, is shown in Figure 4 (a). Each potential instance starts off from a single article from CC-RECENTNEWS and goes through the pipeline which will end up being (1) discarded (2) added to UPDATEDLAMA or (3) added to NEWLAMA in the end. The procedure is as follows:
+
+(1) First, a list of Probably-Asked Questions (Lewis et al., 2021) are generated using the PAQ question generator on a single news article from CC-RECENTNEWS. (2) The list of PAQs and the news article is given to the crowd-sourced worker to select a question that asks for the most recent knowledge for which the answer (denoted as new answer) can be found in the article. (3) The crowd-source worker is instructed to convert the question into a cloze sentence so that it can be given as input to a pretrained T5 LM. The predictions of the T5 LM are stored along with the questions and cloze sentences. (4) The expert annotator ensures the quality of the questions and cloze sentences by correcting them whenever necessary and checks whether the model prediction is correct by searching through the C4 corpus as a representative of ${ D _ { 0 } } ^ { 1 2 }$ . If the prediction is correct and the prediction is not the same with the new answer, the following instance must be present in both $D _ { 0 }$ and $D _ { 1 }$ with details changed, and thus is added to UPDATEDLAMA along with the evidence document found in C4. If same, the instance is discarded because the instance is neither updated nor new. (5) Lastly, if the model prediction is wrong, the expert annotator is asked to find an alternative answer for the question in C4. If not found, the instance is added to NEWLAMA since the answer to the question could only be found in the article of CC-RECENTNEWS $( D _ { 1 } )$ , but not in C4 $( D _ { 0 } )$ . Similarly, if the alternative answer is found in C4, we check whether it is the same as the new answer and add the instance to UPDATEDLAMA if not the same and disregard it otherwise.
+
+Throughout the whole process, a validator checks the sanity of the data and gives detailed real-time feedback on the work of the annotator.
+
+NEWLAMA-EASY Even though NEWLAMA corresponds to our exact definition of new knowledge that we define in the task formulation, scaling the size of the dataset was difficult since each instance required searching the whole C4 database for answers. Instead, we provide a much larger, easier variant NEWLAMA-EASY where we test the general new knowledge acquired during continued pretraining on CC-RECENTNEWS. The pipeline for the creation of a single instance of NEWLAMA-EASY is shown in Figure 4 (b) and follows the following procedures:
+
+(1) First, the crowd-sourced worker is instructed to classify whether the given article contains new information or not. (We define new as not likely to be known before May 2020). If the article contains new information, the worker is instructed to select a sentence from the article that contains the most recent information and an entity among the possible answer candidates in the sentence and discard the article if otherwise. We provide the possible entities through a Named-Entity Recognition Model. (2) We make the selected sentence stand-alone from the article through the decontextualization model provided by Choi et al. (2021). (3) The decontextualized sentence is paraphrased by a back-translation model $( { \mathrm { e n } } { } { \mathrm { d e } } { } { \mathrm { e n } }$ ) (Tiedemann & Thottingal, 2020) and checked whether the selected word is still in the paraphrased sentence; the sentence is discarded if not. (4) Next, we mask out the selected word from the sentence and ask two crowd-sourced workers to convert the cloze sentence into a question and answer the question. (5) If the answers agree among the workers as well as correspond to the actual selected word, we add the instance to NEWLAMA-EASY.
+
+The specific interfaces used for the mturk HITs are provided in Appendix B.2. Statistics of the constructed datasets are in Appendix B.3.
+
+# B.1 TIME-INVARIANT RELATIONS OF LAMA
+
+Table 4 shows the list of 28 time-invariant relations of INVARIANTLAMA. We manually filter the 44 original LAMA relations to leave only the time-invariant relations. Templates such as “[X] works for [Y] .” and “[X] is a member of [Y] .” are excluded because the answer may change for different timestamps. In the template, [X] and [Y] refers to subject and object labels, respectively. Given a template with only the subject included, the model has to predict the object label [Y] for knowledge probing.
+
+# B.2 INTERFACES USED FOR THE CONSTRUCTION OF CKL BENCHMARK
+
+The Mturk interface used during construction of UPDATEDLAMA and NEWLAMA, NEWLAMAEASY, and NEWLAMA-EASY are shown in Figure 5, 6, and 7, respectively.
+
+# B.3 DATASET STATISTICS AND EXAMPLES
+
+We report the data statistics for the CKL benchmark in Table 5. We measure the size, average input token length, average answer token length, and the answer types of each constructed dataset. One thing to consider is that LAMA (Petroni et al., 2019) from which we constructed INVARIANTLAMA is originally constructed for only single-token decoding (1.3 with the T5-tokenizer) because multitoken decoding entails additional, tunable parameters (beam size, n-gram repetition penalties, etc.).
+
+Table 4: Relations of INVARIANTLAMA
+
+
Relation
Template ([X],[Y])
Example
P19
[X]was born in[Y].
Taras Kuzio was born in Halifax.
P20
[X] died in [Y].
Georgios Roilos died in Athens.
P279
[X] is a subclass of [Y].
Hutterite German is a subclass of Bavarian .
P37
The official language of[X] is [Y].
The official language of Azad Kashmir is English .
P449
[X] was originally aired on [Y].
Microsoap was originally aired on BBC.
P47
[X] shares border with [Y].
Illinois shares border with Kentucky .
P138
[X] is named after[Y].
Logan International Airport is named after Boston .
P364
The original language of [X] is [Y].
The original language of The Fatal Eggs is Russian.
P527
[X] consists of [Y] .
AIM alliance consists of Apple .
P176
[X] is produced by [Y] .
Alfa Romeo 155 is produced by Fiat .
P27
[X] is [Y] citizen .
Woodrow Lloyd is Canada citizen .
P407
[X] was written in [Y].
France Culture was written in French .
P30
[X] is located in [Y].
Lavoisier Island is located in Antarctica.
P178
[X] is developed by [Y].
Tizen is developed by Intel.
P1376
[X] is the capital of [Y],
London is the capital of England .
P131
[X] is located in [Y].
Pershing County is located in Nevada .
P1412
[X] used to communicate in [Y].
Jacques Rivette used to communicate in French .
P17
[X] is located in [Y] .
Eibenstock is located in Germany .
P276
[X] is located in [Y] .
Delhi Technological University is located inIndia.
P937
[X] used to work in [Y].
Pierre Trudeau used to work in Ottawa .
P140
[X] is affiliated with the [Y] religion.
Emirate of Granada is affiliated with the Islam religion
P103
The native language of [X] is [Y].
The native language of Anastasy Vonsyatsky is Russian
P190
[X] and [Y] are twin cities .
Beijing and Milan are twin cities .
P1001
[X] is a legal term in [Y] .
Surgeon General is a legal term in Canada.
P495
[X] was created in [Y].
La Grande Vadrouille was created in France .
P36
The capital of [X] is [Y] .
The capital of Granville County is Oxford .
P740
[X] was founded in [Y].
Grimaldi Group was founded in Naples .
P361
[X] is part of [Y] .
Sinqa is part of Andes .
+
+Table 5: CKL benchmark dataset statistics
+
+
Dataset
Size
Avg. Input Token#
Avg. Answer Token #
Answer Types
INVARIANTLAMA
17474
11.9
1.3
Geographical (54%),Language (14.9%),Nationalities (7.2%) Person (6.3%),Location (5.7%), Organization (5.3%),etc.(6.6%)
UPDATEDLAMA
924
13.7
9.4
Person (61.47%), Organization (8.3%),Geographical (6.6%), Numerals (5.19%),Date (2.4%),etc.(16.04%)
NEWLAMA
797
14.7
8.7
Person (59.7%), Organization (10.2%),Numerals (7.6%) Date (5.3%),Geographical (4.8%),etc. (12.4%)
NEWLAMA- EASY
11177
44.4
6.1
Person (48.5%), Organization (13%),Geographical (9.8%) Date (5.5%),Nationalities (3.4%),Numerals (2.5%),etc.(17.3%)
+
+The newly constructed datasets UPDATEDLAMA, NEWLAMA, and NEWLAMA-EASY require multi-token decoding which adds a level of difficulty for the task compared to INVARIANTLAMA. Moreover, NEWLAMA-EASY has a different input distribution (longer input sequences) than the other datasets since the decontextualization and back-translation processes are applied to create each instance, which makes the sentences longer. Lastly, some examples of the CKL benchmark datasets are provided in Table 6.
+
+
+Figure 5: Mturk interface used for construction of UPDATEDLAMA and NEWLAMA
+
+
+Figure 6: First mturk interface used for construction of NEWLAMA-EASY
+
+
+Figure 7: Second mturk interface used for construction of NEWLAMA-EASY
+
+Table 6: Examples of INVARIANTLAMA, UPDATEDLAMA, NEWLAMA, and NEWLAMA-EASY
+
+
Task
Input
Output
INVARIANTLAMA
iPod Touch is produced by The Sharon Cuneta Show was created in The native language of Lee Chang-dong is
Apple Philippines Korean
UPDATEDLAMA
is the prime minister of England. has the most passing yards in the NFL. Bale has .champions league titles with Real Madrid.
Theresa May→ Boris Johnson Brady Quinn→ Jalen Guyton 3-4
NEWLAMA
Alicia Braga plays in the New Mutant. .owns the rights to the Falcon and the Winter Soldier. Tesla invested in the digital currency bitcoin.
Cecilia Reyes Disney 1.5 billion
NEWLAMA-EASY
The decision of the two volleyball stars Bria and Cimone Woodard to withdraw from the Power 5 School to study at has become a national story. Allen Lazard is officially listed as questionable with a nuclear injury after missing the last games.
Howard University six
+
+# C EXPERIMENTAL CONFIGURATION
+
+Pretraining Congifuration We utilize the T5 initially pretrained on C4 (April 2019) and continually pretrained with salient span masking (Guu et al., 2020) on Wikipedia (May 2020) as initialization. We use the checkpoints from Wolf et al. (2020). We also perform the SSM objective during CKL because it was shown to help LMs “focus on problems that require world knowledge” (Guu et al., 2020; Roberts et al., 2020).
+
+Continual Pretraining Configurations The input and output sequence length is fixed to 350. We use gradient accumulation for cases where the same number of training batches could not be loaded on the GPUs due to the varying memory consumption required for different methods and set the global batch size to 60. We use Adafactor optimizer with an initial learning rate of 1e-3. We show the effects of learning rate variation regarding the trade-off between maintaining previous knowledge and acquiring new knowledge in Appendix E. We use learning rate warm-up for the first $10 \%$ of training and linearly decay the learning rate to half of the initial learning rate towards the end of training. For all of the experiments, we use 4 32GB V100 GPUs for training with each method except Mix-Review, where we use 16 32GB V100 GPUs. The details of the configurations used for evaluation on each individual CKL task are provided in Appendix C.
+
+Evaluation Configurations For T5 based models, all evaluation is done in a zero-shot manner and is processed with a single GPU. For INVARIANTLAMA, the input and output length is fixed as 25 and 4 respectively. For UPDATEDLAMA and NEWLAMA, the input and output length is 50 and 10 respectively. Lastly, the input and output length is 150 and 10 respectively for NEWLAMA-EASY. The rationale of this hyperparameter is based on average input and answer token in Table 5.
+
+Unlike T5 models, GPT-2 based models need additional light-tuning for 1 epoch for evaluation. For INVARIANTLAMA, the input and output length is 50 and 3 respectively. The training batch size is 32 and the learning rate is 1e-3. For evaluation on the acquisition of new knowledge, the input and output length is 100 and 10 respectively. The training batch size is 8 due to memory constraints and the learning rate is 1e-3. For both tuning processes, 4 V100 32GB GPUs are used. The detailed result and discussion of GPT-2 based models are shown in Appendix G.
+
+# D HYPERPARAMETERS FOR IMPLEMENTATION OF CKL METHODS
+
+RecAdam (Chen et al., 2020) We use the same hyperparameter setting for the optimizer as in Chen et al. (2020): we set the coefficient of the quadratic penalty γ to 5,000, and select the best $t _ { 0 }$ and $k$ in 100, 250, 500, 1,000 and 0.05, 0.1, 0.2, 0.5, 1 respectively for the annealing coefficient $\lambda ( t )$ .
+
+Table 7: Result of T5-Vanilla and T5-Kadapters continually pretrained with various learning rates. The experiments are done under the setting of SMALL scenario in Table 3, thus $D _ { 0 }$ are C4 (April 2019) and Wikipedia (May 2020), and $D _ { 1 }$ is CC-RECENTNEWS-SMALL. Each of IL and NLE stands for INVARIANTLAMA and NEWLAMA-EASY. The parameters of FUAR are $\mathbb { T } ^ { F }$ , $T _ { 1 } ^ { U }$ , and $T _ { 1 } ^ { A }$ , the tasks measuring the amount of timeinvariant knowledge from corpus $D _ { 0 }$ , updated knowledge from $D _ { 1 }$ , and newly acquired knowledge from $D _ { 1 }$ , respectively.
+
+
Method
Learning Rate
IL
NLE
FUAR ((IL),n.d.,NLE) ↓
EM
EM
T5-Initial
24.17
8.9
-
T5-Vanilla
1e-05
19.15
13.56
1.08
T5-Vanilla
1e-04
17.45
15.21
1.06
T5-Vanilla
5e-04
14.88
15.89
1.33
T5-Vanilla
1e-03
11.19
18.77
1.32
T5-Kadapters (k=2)
1e-04
19.93
14.93
0.70
T5-Kadapters (k=2)
1e-03
16.46
19.59
0.72
+
+Mix-Review (He et al., 2021) We use the English Wikipedia 13 to represent the original pretraining corpus. The mix-decay and mix-ratio are set to 4 and 0.7, respectively, which is the best hyperparameter setting in the paper.
+
+LoRA (Hu et al., 2021) We only freeze the encoder for the encoder-decoder LM and the entire model for the decoder-only LM. We use the optimal rank $r$ of 4 and adapt both $W _ { q }$ and $W _ { \nu }$ in the self-attention module, which corresponds to the best performing hyperparameter setting in the paper.
+
+K-Adapter (Wang et al., 2021b) Similarly with T5-LoRA, we freeze the encoder for the encoderdecoder LM and the entire model for GPT-2. We implement $k = 2 , 3$ for both T5 and GPT-2 to see the effect of increasing # of parameters. Unlike in the original paper, we set the configuration of the adapter identical to a single transformer layer from the original LM, ridding the need of an up-projection and down-projection layer.
+
+Modular We use a projection layer before adding the hidden state outputs from both encoders to match the dimensions.
+
+Why do we add parameters to only the encoder for T5? For parameter-expansion methods, we add parameters to only the encoder because the encoder is applied to the input sequence and the decoder is applied to the output sequence. Since most of the computational cost comes from the decoder computing for the output sequence in an auto-regressive manner as highlighted in (Li et al., 2021), the newly added parameters in the encoder are roughly expected to have minimal additional computational cost.
+
+Why do we freeze parameters of only the encoder for T5? K-Adapter and LoRA are initially proposed to freeze all of the parameters except for the newly added parameters. However, when applying this methodology to T5, it was empirically shown that unfreezing the parameters of the decoder results in better performances when utilized together with parameter-expansion methods in terms of overall trade-off.
+
+# E EXPLORING THE TRADE-OFF OF VARYING THE LEARNING RATE FOR CONTINUAL PRETRAINING
+
+Table 7 shows that lowering the learning rate for the continual pretraining leads to less forgetting of the original knowledge, but also less learning of new knowledge. The experiments are done under the setting of SMALL scenario in Table 3.
+
+By comparing the FUAR among the T5-Vanilla models with different learning rates, it can be seen that there is no rule of thumb for choosing the appropriate learning rate since FUAR is the lowest in learning rate of 1e-4 and increases for both lower and higher learning rates. We suppose that the optimal learning rate heavily depends on the corpus size of $D _ { 1 }$ and the model capacity of LM. We also report the performance of T5-Kadapters, which is a CKL method that shows robust performance throughout most experiments. Applying T5-Kadapters consistently mitigates the trade-off between forgetting and acquiring new knowledge as shown by the improvement in FUAR from the T5-Vanilla model with the same learning rates, although the level of effectiveness varies according to the value of the learning rate. We do not perform extensive experiments with each of the varying learning rates since searching for the optimal learning rate for each different continued pretraining setting may be out-of-scope with this research.
+
+Table 8: Dev performance on KILT benchmark datasets after finetuning. Each model is finetuned on the train sets of KILT after continually trained on CC-RECENTNEWS dataset for 4 epochs.
+
+
Method
Fact Checking
Entity Linking
Slot-filling
Open Domain QA
Dialogue
FEVER
AY2
WnWi
WnCw
T-REx
zsRE
NQ
HoPo
TQA
ELI5 WoW
ACC
ACC
ACC
ACC
ACC
ACC
EM
EM
EM
Rouge
F1
T5-Initial
80.39
81.44
50.47
48.92
44.64
4.40
25.63
17.64
28.38
13.46
13.92
T5-Vanilla
78.02
81.19
48.17
46.46
44.08
2.04
24.93
14.36
26.51
13.38
13.07
T5-RecAdam
77.83
81.44
49.12
47.01
43.04
2.58
24.65
14.86
25.99
13.71
12.69
T5-MixReview
77.17
80.77
49.38
46.22
44.08
2.47
25.07
14.57
26.36
13.57
12.73
T5-LoRA
79.89
81.44
48.82
47.29
45.68
3.01
25.49
16.71
28.23
13.42
13.60
T5-Kadapters (k=2)
80.35
80.94
48.91
46.65
45.52
3.33
26.20
16.57
26.89
13.15
12.94
T5-Kadapters (k=3)
80.31
80.52
47.09
46.26
45.60
3.12
24.79
16.57
25.62
13.82
13.42
T5-Modular
80.54
82.44
48.44
44.81
48.16
3.44
24.51
18.43
28.31
13.72
14.03
+
+Table 9: Hyperparameters and dataset details for all tasks of KILT.
+
+
Fact Checking
Entity Linking
Slot-filling
Open Domain QA
Dialogue
FEV
AY2
WnWi
WnCw
T-REx
zsRE
NQ
HoPo
TQA
ELI5
Epoch
5
20
-
1
9
30
45
12
50
6
8
Input Seq
25
768
512
2.048
25
25
35
50
25
35
175
Output Seq
10
6
6
6
6
6
6
8
10
350
40
LR
1e-4
1e-4
-
-
1e-3
1e-4
1e-3
1e-4
1e-3
1e-3
1e-4
Batch Size
128
16
128
48
512
256
256
256
128
32
64
Train Size
104,966
18,395
-
-
2,284,168
147,909
87,372
88,869
61,844
272.634
63,734
Dev Size
10,444
4,784
3,396
5,599
5,000
3,724
2.837
5,600
5,359
1,507
3,054
+
+# F EXPLORING HOW CONTINUALLY PRETRAINING ON $D _ { 1 }$ AFFECTS KILT TASKS WHICH REQUIRES KNOWLEDGE FROM $D _ { 0 }$
+
+In addition to the CKL benchmark, we also show in Table 8 the performance on the dev set of KILT (Petroni et al., 2021) after finetuning each of the continually pretrained models of Table 2. Since KILT is made from Wikipedia, which corresponds to the old pretraining corpus $D _ { 0 }$ , the performance on KILT measures how continual pretraining on new corpus $D _ { 1 }$ affects the performance on the knowledge obtained from $D _ { 0 }$ if finetuning is done on behalf of the knowledge from $D _ { 0 }$ .
+
+Configuration KILT (Petroni et al., 2021) consists of 5 different tasks and 11 datasets: OpenDomain Question Answering (Joshi et al., 2017; Kwiatkowski et al., 2019; Fan et al., 2019; Yang et al., 2018), Fact Checking (Thorne et al., 2018), Entity Linking (Hoffart et al., 2011; Guo & Barbosa, 2018), Slot-filling (Levy et al., 2017), and Knowledgeable Open Dialogue (Dinan et al., 2019). Because each task requires a different training objective than the one used during pretraining, additional finetuning is necessary. We search for the hyperparameters such as training epochs, batch size, input size, output size, and learning rate of each individual KILT task to match the T5-base dev performance reported by Petroni et al. (2021). Using the identified configurations, we perform experiments on all of the KILT tasks with the continually pretrained models for each method as the initialization checkpoints. Evaluation metrics are different for each dataset: accuracy for discrete output (fact-checking, entity linking, slot-filling), Exact Match (EM) for question answering tasks with short output, ROUGE-L for ELI5 (question answering task with long output), and F1-score for Wizard of Wikipedia (dialogue). The data statistics and the hyperparameters used for finetuning on each KILT dataset is reported in Table 9.
+
+Experimental Result We first focus on the performance on zero-shot Relation Extraction (zsRE), which is measured on the dev set of 12 relations that are ensured to have no overlap with the 84 relations of the train set (Levy et al., 2017). Since the setting is similar to the zero-shot probing setting of IL, the trend of the result on the two datasets are similar. The performance of T5-Vanilla drops to half from that of T5-Initial as shown in $\mathrm { I L }$ , and the best performing method for both datasets is T5- Modular. In addition, corresponding with results from the CKL benchmark, parameter-expansion methods generally show stronger performance than the other methods.
+
+However, for the other datasets that cannot be performed in a zero-shot manner, the intermediate process of continually pretraining on corpus $D _ { 1 }$ does not seem to be that harmful on the finetuning for the target tasks even though they are more related to the knowledge of $D _ { 0 }$ . Even T5-Vanilla shows modest performance, sometimes with better results than some other CKL baselines. One hypothesis is that the models could have regained the original knowledge from corpus $D _ { 0 }$ through the finetuning process. Also, some of the knowledge could have been recovered through the testtrain overlap (Lewis et al., 2020b; Wang et al., 2021a).
+
+A more surprising finding is that the performance of some of the parameter-expansion methods are even higher than that of T5-Initial, which is considered to be the upper bound for KILT because T5- Initial is only trained on behalf of the knowledge from $D _ { 0 }$ . For example, T5-Modular shows higher scores than T5-Initial on 6 out of 11 tasks. Since the parameter-expansion methods force the model to store the new knowledge in the newly added parameters during continual pretraining, one careful conjecture is these LMs have learned to combine and utilize in its internal representation of both old and new knowledge stored in separate parameters during finetuning to maximize the performance.
+
+# G EXPLORING HOW CKL METHODS TRANSFER ACROSS LM ARCHITECTURES
+
+We perform experiments with GPT-2 Large $\sim$ 774M params) (Radford et al., 2019) initially pretrained on WebText and Wikipedia14 $( D _ { 0 } )$ and continually trained on CC-RECENTNEWS-SMALL, i.e., SMALL $( D _ { 1 } )$ for 8 epochs. For continued pretraining, we use the common teacher-forcing pretraining objective. The initial learning rate for the continued pretraining stage is empirically chosen as 1e-4 (results with learning rate as 1e-3 are shown in Appendix G.1). After continued pretraining, we apply light-tuning, a process denoted for finetuning the model for only one epoch on a small portion of data similar to the evaluation set. Training on a single epoch constrains the model to barely adapt to the input-output form of the data and not to learn the knowledge in tuning samples, mitigating the problem suggested by Lewis et al. (2020b).
+
+To measure the time-invariant knowledge, we use InvariantLAMA (IL) because most of the slots to fill are at the end of the sentence. For light-tuning on behalf of IL, we use additional T-Rex data from Shin et al. (2020) which has a similar distribution as instances from IL. Among them, 5,000 instances with the same time-invariant relations as $\mathrm { I L }$ are randomly sampled for light-tuning. On the other hand, unlike IL where most of the slots to fill are at the end of the sentences, the LAMA datasets for new knowledge in our CKL benchmark mostly have the slots at the beginning of the sentences. Therefore, we use the corresponding CBQA dataset of NEWLAMA-EASY, NEWQUESTIONSEASY (NQE) to roughly measure the new knowledge.15 For light-tuning on behalf of NQE, 5,000 instances are sampled from a set of QA pairs constructed from CC-RECENTNEWS but not CCRECENTNEWS-SMALL to remove the test-train overlap.
+
+Table 10: Performance of decoder-only models initially pretrained on Dec 2019 dump of Webtext and May 2020 dump of Wikipedia $( D _ { 0 } )$ continually pretrained on CC-RECENTNEWS-SMALL $( D _ { 1 } )$ for 8 epochs with a learning rate of 1e-4. Each of $\mathrm { I L }$ and NQE stands for INVARIANTLAMA and NEWQUESTIONS-EASY. The parameters of FUAR are $\mathbb { T } ^ { F }$ , $T _ { 1 } ^ { U }$ , and $T _ { 1 } ^ { A }$ , the tasks measuring the amount of time-invariant knowledge from corpus $D _ { 0 }$ , updated knowledge from $D _ { 1 }$ , and newly acquired knowledge from $D _ { 1 }$ , respectively.
+
+
Method
IL
NQE
FUAR ((IL),n.d.,NQE) ↓
EM
EM
GPT2-Initial
38.11
4.3
=
GPT2-Vanilla
35.88
5.79
1.58
GPT2-Recadam
35.50
5.79
1.84
GPT2-Mixreview
38.93
5.57
0
GPT2-Lora
37.99
6.23
0.06
GPT2-Kadapters (k=2)
37.85
6.34
0.13
GPT2-Kadapters (k=3)
38.03
5.79
0.06
+
+Table 10 shows the CKL benchmark performance of GPT-2 models. We report the results averaged over 5 runs with different random seeds. As in Table 2, parameter-expansion methods show robust performance on both IL and NQE, resulting in low FUAR. This shows that these methods are not only effective on the encoder-decoder model but also the decoder-only model as well. One interesting result in Table 10 is that GPT2-MixReview performs the best on $\mathrm { I L }$ , with performance even higher than the initial model, which results in the best FUAR of 0 which means no forgetting occurred at all. We suppose that the training strategy of GPT2-MixReview, allowing access to samples of $D _ { 0 }$ during continued pretraining, would have allowed fast adaptation to knowledge from $D _ { 0 }$ during the light-tuning phase. Performance of GPT2-MixReview suggests that it makes it possible to regain the original knowledge for decoder-only models even with small tuning steps.
+
+We want to highlight that the discrepancy of the performances among the CKL methods between encoder-decoder LM (T5) and decoder-only LM (GPT-2) may not solely be on the LM architecture, but also on the learning rate and the evaluation method (light-tuning was used to evaluate GPT2 while we evaluated T5 in a zero-shot manner). We leave further exploration of training everchanging decoder-only LMs such as GPT-2 as future work.
+
+# G.1 FAILED GPT-2 EXPERIMENTS WITH LARGER LEARNING RATE
+
+Table 11 shows the CKL benchmark result of GPT-2 models continually pretrained on CCRECENTNEWS-SMALL for 8 epochs with a learning rate of 1e-3. By comparing the results in this table with those in Table 10, which is for models continually pretrained with a learning rate of 1e-4, the results in Table 11 shows worse performance on both IL and NQE. Unlike in Appendix E, increasing the learning rate does not result in better learning of new knowledge. Instead, NQE performance is even worse than GPT2-Initial for GPT2-Vanilla, GPT2-Recadam, and GPT2-MixReview. FUAR is no gain for these cases by the definition of the metric because the denominator has the value of zero. This shows that a large learning rate for continual pretraining may lead to failure: neither retaining old knowledge nor acquiring new knowledge effectively. For parameter-expansion methods, because many parameters including the decoder are frozen during the continual training process, they seem to be less prone to the effect of a large learning rate.
+
+# H EXPLORING THE PREDICTION CHANGE DURING CONTINUAL PRETRAINING
+
+Table 12 shows the prediction results of T5-Vanilla and T5-Modular on three knowledge probing tasks: INVARIANTLAMA, UPDATEDLAMA, and NEWLAMA. We show the prediction for every training epoch for each model. The instances are selected from the predictions that T5-Modular got correct but T5-Initial got wrong on the final prediction, in order to see where the gap of the EM comes from.
+
+Table 11: Performance of decoder-only models initially pretrained on Dec 2019 dump of Webtext and May 2020 dump of Wikipedia $( D _ { 0 } )$ continually pretrained on CC-RECENTNEWS-SMALL $( D _ { 1 } )$ for 8 epochs with a learning rate of 1e-3. These are the results failed due to a large learning rate. Each of IL and NQE stands for INVARIANTLAMA and NEWQUESTIONS-EASY.
+
+
Method
IL
NQE
FUAR ((IL),n.d.,NQE)↓
EM
EM
GPT2-Initial
38.11
4.37
GPT2-Vanilla
23.03
1.64
no gain
GPT2-Recadam
25.38
2.73
no gain
GPT2-Mixreview
32.07
1.64
no gain
GPT2-Lora
34.52
5.46
3.29
GPT2-Kadapters (k=2)
33.67
6.01
2.71
GPT2-Kadapters (k=3)
31.75
7.65
1.94
+
+Table 12: Change of Prediction Outputs During Continued Pretraininig
+
+
Cloze Sentence
Model
Epoch 1
Epoch 2
Epoch 3
Epoch 4
Answer
The native language of
V
French
French
Khmer
Malaya
French
Yvonne Monlaur is
M
French
French
French
French
Sonic Drift 2 is developed by
V
Sonic D
Sonic the
Sonic Found
Sonic the
Sega
M
Sonic R
Sega
Sega
Sega
WebKit is developed by
V
Microsoft
Google
GitHub
Google
Apple
M
Apple
Apple
Apple
Apple
The official language of Republic of Ingushetia is
V
Russian
English
Kazakh
English
Russian
M
Russian
Russian
Russian
Russian
The capital of Roman Empire is
Rome
Rome
Constantino
Constantino
Rome
Rome
Rome
Rome
Rome
UL
The biggest exporter of crude oil to china is
V
Saudi Arabia
Saudi Arabia
Saudi Arabia
Saudi Arabia
Saudi Arabia → Russia
M
Russia
Saudi Arabia
Russia
Russia
. is the head of the euro zone central bank
V
Mario Draghi
Yves Le Maire
Yves Dujarric
Mario Draghi
Mario Draghi→ Christine Lagarde
M
Mario Draghi
Christine Lagarde
Christine Lagarde
Christine Lagarde
is the manager of chelsea in the premier league
Mauricio Fernandez
Steve Bruce
Frank Lampard
Mikel Arteta
Luis Enrique → Frank Lampard
Jose Mourinho
Jose Mourinho
Frank Lampard
Frank Lampard
is the price for a flat in notingham
What
999
f1.25m
f1.25m
36.000→ 40.000
This
30.000 pounds
40.000 pounds
40.000
at the time this article was written
.was the governor of New York
Andrew M. Cuomo Andrew Cuomo
Cuomo Andrew Cuomo
Andrew Cuomo Andrew M. Cuomo
Franklin D.RooseveltMartin Van Buren →
Andrew Cuomo
Andrew Cuomo
NL
is on the Bills all-pro team
V
Corey
Williams
Corey
Connor
Williams
M
Williams
Williams
Williams
Williams
is the founder of the popular cryptocurrency bitcoin
V
Satoshi Nakamoto
Satoshi Nakamoto
Yuri
Xiaobo
Satoshi Nakamoto
M
Vitalik Buterin
Satoshi Nakamoto
Satoshi Nakamoto
Satoshi Nakamoto
The bail for kyle rittenhouse is
Rs. 1 crore
a whopping $1 million
$2 million
$1 million
$2 million
M V
$2 million
$2 million
$2 million
$2 million
The las vegas raiders beat in the playoffs
the Las Vegas Raiders the New Orleans Saints the Las Vegas Raiders the New Orleans Saints the Kansas City Chiefs the Kansas City Chiefs the New Orleans Saints
the sacramento
the New Orleans Saints
M V
,is the host of ellen de generes show
Yves
samantha s
Norma
Mike
Ellen DeGeneres
Elise
Ellen DeGeneres
Ellen deGenes
Ellen DeGeneres
+
+# I EXPLORING THE CAUSE OF THE EM GAP BETWEEN UPDATEDLAMA AND NEWLAMA
+
+As shown in the main experiment, Table 2, there is a considerable gap between the EM of UPDATEDLAMA (UL) and NEWLAMA (NL) over all the methods, despite undergoing the same data construction process. We attempt to analyze the causation by first analyzing what answer types make up the EM score of both UL and $\mathrm { N L }$ of T5-Vanilla, which are 10.17 and 3.77, respectively. As shown in Figure 8a, the cloze sentences that take Person type as the ground truth makes up most of the EM of both tasks, despite Person type answers taking up a similar proportion out of the total answer types $( 6 1 . 4 6 \%$ for UL and $5 9 . 7 \%$ for NL). Since UL consists of probes requiring an update of information from $D _ { 0 }$ , one might conjecture that the EM gap is simply due to the difference of the frequency in each corpus of the entities that serve as the ground truths, e.g., those entities appear more in corpus $D _ { 0 }$ than in $D _ { 1 }$ . In order to get rid of the influence of frequency of entities when analyzing the source of the EM gap, we find overlapping Person type answers from UL and NL, and analyze only the 67 probing sentences for both datasets each paired to one of these entities. As shown in Figure 8b, the EM on UL is still much higher than that of NL. Manually analyzing these instances, we find that the probing sentences for NL ask for relatively more fine-grained knowledge compared to UL, since the instances of UL by definition are overlapped cloze sentences with different answers in the corpus $D _ { 0 }$ and $D _ { 1 }$ , that naturally make them be coarse-grained. For instance, the probing sentences for entity “Tim Walz” in UL and NL are “ is the governor of Minnesota this year.” and “ is the governor of Minnesota calling for the evacuation of St. Paul.”, respectively. We thus conjecture that the main causation of the EM gap to be UL consisting of instances requiring coarse-grained knowledge, which is likely to have appeared more during in $D _ { 1 }$ , while NL consisting of instances requiring fine-grained knowledge, which is expected to likely have appeared less in $D _ { 1 }$ .
+
+
+Figure 8: Analyzing the cause of the EM gap between UPDATEDLAMA and NEWLAMA.
+
+
+(b) EM measured using the instances from UL and NL with overlapping Person type answers
+
+Table 13: F1 Score of Main Results.
+
+
Method
IL
UL
NL EM
NLE EM
FUAR ((IL),UL,NL) ↓
EM
EM
T5-Initial
24.88
2.62
3.19
14.49
T5-Vanilla
13.11
11.89
5.84
22.53
0.68
T5-RecAdam
13.39
14.33
6.15
22.68
0.57
T5-MixReview
14.09
8.11
4.80
18.89
1.10
T5-LoRA
17.04
14.50
7.45
24.59
0.36
T5-Kadapters (k=2)
19.88
13.67
7.43
24.04
0.22
T5-Kadapters (k=3)
19.91
14.31
6.55
23.33
0.21
T5-Modular
21.35
12.78
6.94
24.42
0.17
+
+# J ADDITIONAL ANALYSIS OF MAIN RESULTS
+
+
+Figure 9: Mean $\mathbf { P } @ \mathbf { k }$ curve for CKL benchmark with varying k.
\ No newline at end of file
diff --git a/md/dev/vhFu1Acb0xb/vhFu1Acb0xb.md b/md/dev/vhFu1Acb0xb/vhFu1Acb0xb.md
new file mode 100644
index 0000000000000000000000000000000000000000..2c1b0278adc300166b20d4f5053594d8c1b88116
--- /dev/null
+++ b/md/dev/vhFu1Acb0xb/vhFu1Acb0xb.md
@@ -0,0 +1,438 @@
+# TRANSFORMERS ARE SAMPLE-EFFICIENT WORLD MODELS
+
+Vincent Micheli∗ University of Geneva
+
+Eloi Alonso∗ University of Geneva
+
+François Fleuret University of Geneva
+
+# ABSTRACT
+
+Deep reinforcement learning agents are notoriously sample inefficient, which considerably limits their application to real-world problems. Recently, many model-based methods have been designed to address this issue, with learning in the imagination of a world model being one of the most prominent approaches. However, while virtually unlimited interaction with a simulated environment sounds appealing, the world model has to be accurate over extended periods of time. Motivated by the success of Transformers in sequence modeling tasks, we introduce IRIS, a data-efficient agent that learns in a world model composed of a discrete autoencoder and an autoregressive Transformer. With the equivalent of only two hours of gameplay in the Atari $1 0 0 \mathrm { k }$ benchmark, IRIS achieves a mean human normalized score of 1.046, and outperforms humans on 10 out of 26 games, setting a new state of the art for methods without lookahead search. To foster future research on Transformers and world models for sample-efficient reinforcement learning, we release our code and models at https://github.com/eloialonso/iris.
+
+# 1 INTRODUCTION
+
+Deep Reinforcement Learning (RL) has become the dominant paradigm for developing competent agents in challenging environments. Most notably, deep RL algorithms have achieved impressive performance in a multitude of arcade (Mnih et al., 2015; Schrittwieser et al., 2020; Hafner et al., 2021), real-time strategy (Vinyals et al., 2019; Berner et al., 2019), board (Silver et al., 2016; 2018; Schrittwieser et al., 2020) and imperfect information (Schmid et al., 2021; Brown et al., 2020a) games. However, a common drawback of these methods is their extremely low sample efficiency. Indeed, experience requirements range from months of gameplay for DreamerV2 (Hafner et al., 2021) in Atari 2600 games (Bellemare et al., 2013b) to thousands of years for OpenAI Five in Dota2 (Berner et al., 2019). While some environments can be sped up for training agents, real-world applications often cannot. Besides, additional cost or safety considerations related to the number of environmental interactions may arise (Yampolskiy, 2018). Hence, sample efficiency is a necessary condition to bridge the gap between research and the deployment of deep RL agents in the wild.
+
+Model-based methods (Sutton & Barto, 2018) constitute a promising direction towards data efficiency. Recently, world models were leveraged in several ways: pure representation learning (Schwarzer et al., 2021), lookahead search (Schrittwieser et al., 2020; Ye et al., 2021), and learning in imagination (Ha & Schmidhuber, 2018; Kaiser et al., 2020; Hafner et al., 2020; 2021). The latter approach is particularly appealing because training an agent inside a world model frees it from sample efficiency constraints. Nevertheless, this framework relies heavily on accurate world models since the policy is purely trained in imagination. In a pioneering work, Ha & Schmidhuber (2018) successfully built imagination-based agents in toy environments. SimPLe recently showed promise in the more challenging Atari 100k benchmark (Kaiser et al., 2020). Currently, the best Atari agent learning in imagination is DreamerV2 (Hafner et al., 2021), although it was developed and evaluated with two hundred million frames available, far from the sample-efficient regime. Therefore, designing new world model architectures, capable of handling visually complex and partially observable environments with few samples, is key to realize their potential as surrogate training grounds.
+
+The Transformer architecture (Vaswani et al., 2017) is now ubiquitous in Natural Language Processing (Devlin et al., 2019; Radford et al., 2019; Brown et al., 2020b; Raffel et al., 2020), and is also gaining traction in Computer Vision (Dosovitskiy et al., 2021; He et al., 2022), as well as in Offline
+
+
+Figure 1: Unrolling imagination over time. This figure shows the policy $\pi$ , depicted with purple arrows, taking a sequence of actions in imagination. The green arrows correspond to the encoder $E$ and the decoder $D$ of a discrete autoencoder, whose task is to represent frames in its learnt symbolic language. The backbone $G$ of the world model is a GPT-like Transformer, illustrated with blue arrows. For each action that the policy $\pi$ takes, $G$ simulates the environment dynamics, by autoregressively unfolding new frame tokens that $D$ can decode. $G$ also predicts a reward and a potential episode termination. More specifically, an initial frame $x _ { 0 }$ is encoded with $E$ into tokens $\mathbf { \dot { \boldsymbol { z } } } _ { 0 } = ( z _ { 0 } ^ { 1 } , \dots , z _ { 0 } ^ { K } ) = E ( \boldsymbol { x } _ { 0 } )$ . The decoder $D$ reconstructs an image $\hat { x } _ { 0 } = D ( z _ { 0 } )$ , from which the policy $\pi$ predicts the action $a _ { 0 }$ . From $z _ { \mathrm { 0 } }$ and $a _ { 0 }$ , $G$ predicts the reward $\hat { r } _ { 0 }$ , episode termination $\hat { d } _ { 0 } \in \{ 0 , 1 \}$ , and in an autoregressive manner $\hat { z } _ { 1 } = ( \hat { z } _ { 1 } ^ { 1 } , \dots , \hat { z } _ { 1 } ^ { K } )$ , the tokens for the next frame. A dashed box indicates image tokens for a given time step, whereas a solid box represents the input sequence of $G$ , i.e. $( z _ { 0 } , a _ { 0 } )$ at $t = 0$ , $( z _ { 0 } , a _ { 0 } , \hat { z } _ { 1 } , a _ { 1 } )$ at $t = 1$ , etc. The policy $\pi$ is purely trained with imagined trajectories, and is only deployed in the real environment to improve the world model $( E , D , G )$ .
+
+Reinforcement Learning (Janner et al., 2021; Chen et al., 2021). In particular, the GPT (Radford et al., 2018; 2019; Brown et al., 2020b) family of models delivered impressive results in language understanding tasks. Similarly to world models, these attention-based models are trained with highdimensional signals and a self-supervised learning objective, thus constituting ideal candidates to simulate an environment.
+
+Transformers particularly shine when they operate over sequences of discrete tokens (Devlin et al., 2019; Brown et al., 2020b). For textual data, there are simple ways (Schuster & Nakajima, 2012; Kudo & Richardson, 2018) to build a vocabulary, but this conversion is not straightforward with images. A naive approach would consist in treating pixels as image tokens, but standard Transformer architectures scale quadratically with sequence length, making this idea computationally intractable. To address this issue, VQGAN (Esser et al., 2021) and DALL-E (Ramesh et al., 2021) employ a discrete autoencoder (Van Den Oord et al., 2017) as a mapping from raw pixels to a much smaller amount of image tokens. Combined with an autoregressive Transformer, these methods demonstrate strong unconditional and conditional image generation capabilities. Such results suggest a new approach to design world models.
+
+In the present work, we introduce IRIS (Imagination with auto-Regression over an Inner Speech), an agent trained in the imagination of a world model composed of a discrete autoencoder and an autoregressive Transformer. IRIS learns behaviors by accurately simulating millions of trajectories. Our approach casts dynamics learning as a sequence modeling problem, where an autoencoder builds a language of image tokens and a Transformer composes that language over time. With minimal tuning, IRIS outperforms a line of recent methods (Kaiser et al., 2020; Hessel et al., 2018; Laskin et al., 2020; Yarats et al., 2021; Schwarzer et al., 2021) for sample-efficient RL in the Atari $1 0 0 \mathrm { k }$ benchmark (Kaiser et al., 2020). After only two hours of real-time experience, it achieves a mean human normalized score of 1.046, and reaches superhuman performance on 10 out of 26 games. We describe IRIS in Section 2 and present our results in Section 3.
+
+
+Figure 2: Four imagined trajectories in KungFuMaster. We use the same conditioning frame across the four rows, in green, and let the world model imagine the rest. As the initial frame only contains the player, there is no information about the enemies that will come next. Consequently, the world model generates different types and numbers of opponents in each simulation. It is also able to reflect an essential game mechanic, highlighted in the blue box, where the first enemy disappears after getting hit by the player.
+
+# 2 METHOD
+
+We formulate the problem as a Partially Observable Markov Decision Process (POMDP) with image observations $\boldsymbol { x } _ { t } \in \mathbf { \mathbb { R } } ^ { h \times w \times 3 }$ , discrete actions $a _ { t } \in \{ 1 , \ldots , A \}$ , scalar rewards $r _ { t } \in \mathbb { R }$ , episode termination $d _ { t } \in \{ 0 , 1 \}$ , discount factor $\gamma \in ( 0 , 1 )$ , initial observation distribution $\rho _ { 0 }$ , and environment dynamics $x _ { t + 1 } , r _ { t } , d _ { t } \sim p ( x _ { t + 1 } , r _ { t } , d _ { t } \mid x _ { \leq t } , a _ { \leq t } )$ . The reinforcement learning objective is to train a policy $\pi$ that yields actions maximizing the expected sum of rewards $\begin{array} { r } { \mathbb { E } _ { \pi } [ \sum _ { t \ge 0 } \gamma ^ { \bar { t } } r _ { t } ] } \end{array}$ .
+
+Our method relies on the three standard components to learn in imagination (Sutton & Barto, 2018): experience collection, world model learning, and behavior learning. In the vein of Ha & Schmidhuber (2018); Kaiser et al. (2020); Hafner et al. (2020; 2021), our agent learns to act exclusively within its world model, and we only make use of real experience to learn the environment dynamics.
+
+We repeatedly perform the three following steps:
+
+• collect_experience: gather experience in the real environment with the current policy.
+• update_world_model: improve rewards, episode ends and next observations predictions.
+• update_behavior: in imagination, improve the policy and value functions.
+
+The world model is composed of a discrete autoencoder (Van Den Oord et al., 2017), to convert an image to tokens and back, and a GPT-like autoregressive Transformer (Vaswani et al., 2017; Radford et al., 2019; Brown et al., 2020b), whose task is to capture environment dynamics. Figure 1 illustrates the interplay between the policy and these two components during imagination. We first describe the autoencoder and the Transformer in Sections 2.1 and 2.2, respectively. Section 2.3 then details the procedure to learn the policy and value functions in imagination. Appendix A provides a comprehensive description of model architectures and hyperparameters. Algorithm 1 summarizes the training protocol.
+
+# 2.1 FROM IMAGE OBSERVATIONS TO TOKENS
+
+The discrete autoencoder $( E , D )$ learns a symbolic language of its own to represent high-dimensional images as a small number of tokens. The back and forth between frames and tokens is illustrated with green arrows in Figure 1.
+
+
+Figure 3: Pixel perfect predictions in Pong. The top row displays a test trajectory collected in the real environment. The bottom row depicts the reenactment of that trajectory inside the world model. More precisely, we condition the world model with the first two frames of the true sequence, in green. We then sequentially feed it the true actions and let it imagine the subsequent frames. After only 120 games of training, the world model perfectly simulates the ball’s trajectory and players’ movements. Notably, it also captures the game mechanic of updating the scoreboard after winning an exchange, as shown in the blue box.
+
+More precisely, the encoder $E : \mathbb { R } ^ { h \times w \times 3 } \{ 1 , \dots , N \} ^ { K }$ converts an input image $x _ { t }$ into $K$ tokens from a vocabulary of size $N$ . Let $\mathcal { E } = \{ \bar { e } _ { i } \} _ { i = 1 } ^ { N } \in \bar { \mathbb { R } } ^ { N \times d }$ be the corresponding embedding table of $d$ -dimensional vectors. The input image $x _ { t }$ is first passed through a Convolutional Neural Network (CNN) (LeCun et al., 1989) producing output $\bar { y _ { t } } \in \mathbb { R } ^ { K \times d }$ . We then obtain the output tokens $z _ { t } = ( z _ { t } ^ { 1 } , \dots , z _ { t } ^ { K } ) \in \{ 1 , \dots , { \dot { N } } \} ^ { K }$ as $z _ { t } ^ { \bar { k } } = \mathrm { \bar { a r g m i n } } _ { i } \| y _ { t } ^ { k } - e _ { i } \| _ { 2 }$ , the index of the closest embedding vector in $\mathcal { E }$ (Van Den Oord et al., 2017; Esser et al., 2021). Conversely, the CNN decoder $D : \{ 1 , \ldots , N \} ^ { K } \to \mathbb { R } ^ { \dot { h } \times w \times 3 }$ turns $K$ tokens back into an image.
+
+This discrete autoencoder is trained on previously collected frames, with an equally weighted combination of a $L _ { 1 }$ reconstruction loss, a commitment loss (Van Den Oord et al., 2017; Esser et al., 2021), and a perceptual loss (Esser et al., 2021; Johnson et al., 2016; Larsen et al., 2016). We use a straight-through estimator (Bengio et al., 2013) to enable backpropagation training.
+
+# 2.2 MODELING DYNAMICS
+
+At a high level, the Transformer $G$ captures the environment dynamics by modeling the language of the discrete autoencoder over time. Its central role of unfolding imagination is highlighted with the blue arrows in Figure 1.
+
+Specifically, $G$ operates over sequences of interleaved frame and action tokens. An input sequence $( z _ { 0 } ^ { \bar { 1 } } , \ldots , \bar { z } _ { 0 } ^ { K } , a _ { 0 } , z _ { 1 } ^ { 1 } , \ldots , z _ { 1 } ^ { K } , a _ { 1 } , \ldots , z _ { t } ^ { 1 } , \ldots , z _ { t } ^ { K } , a _ { t } )$ is obtained from the raw sequence $( x _ { 0 } , a _ { 0 } , x _ { 1 } , a _ { 1 } , \dots , x _ { t } , a _ { t } )$ by encoding the frames with $E$ , as described in Section 2.1.
+
+At each time step $t$ , the Transformer models the three following distributions:
+
+$$
+\begin{array} { r l } & { \mathrm { T r a n s i t i o n : } \quad \hat { z } _ { t + 1 } \sim p _ { G } \big ( \hat { z } _ { t + 1 } \big | z _ { \le t } , a _ { \le t } \big ) \mathrm { w i t h } \hat { z } _ { t + 1 } ^ { k } \sim p _ { G } \big ( \hat { z } _ { t + 1 } ^ { k } \mid z _ { \le t } , a _ { \le t } , z _ { t + 1 } ^ { < k } \big ) } \\ & { \mathrm { R e w a r d : } \quad \quad \hat { r } _ { t } \sim p _ { G } \big ( \hat { r } _ { t } \mid z _ { \le t } , a _ { \le t } \big ) } \\ & { \mathrm { T e r m i n a t i o n : } \quad \hat { d } _ { t } \sim p _ { G } \big ( \hat { d } _ { t } \mid z _ { \le t } , a _ { \le t } \big ) } \end{array}
+$$
+
+Note that the conditioning for the $k$ -th token also includes $z _ { t + 1 } ^ { < k } : = ( z _ { t + 1 } ^ { 1 } , \dots , z _ { t + 1 } ^ { k - 1 } )$ , the tokens that
+
+We train $G$ in a self-supervised manner on segments of $L$ time steps, sampled from past experience. We use a cross-entropy loss for the transition and termination predictors, and a mean-squared error loss or a cross-entropy loss for the reward predictor, depending on the reward function.
+
+# 2.3 LEARNING IN IMAGINATION
+
+Together, the discrete autoencoder $( E , D )$ and the Transformer $G$ form a world model, capable of imagination. The policy $\pi$ , depicted with purple arrows in Figure 1, exclusively learns in this imagination MDP.
+
+
+Figure 4: Imagining rewards and episode ends in Breakout (top) and Gopher (bottom). Each row depicts an imagined trajectory initialized with a single frame from the real environment. Yellow boxes indicate frames where the world model predicts a positive reward. In Breakout, it captures that breaking a brick yields rewards, and the brick is correctly removed from the following frames. In Gopher, the player has to protect the carrots from rodents. The world model successfully internalizes that plugging a hole or killing an enemy leads to rewards. Predicted episode terminations are highlighted with red boxes. The world model accurately reflects that missing the ball in Breakout, or letting an enemy reach the carrots in Gopher, will result in the end of an episode.
+
+At time step $t$ , the policy observes a reconstructed image observation $\hat { x } _ { t }$ and samples action $a _ { t } \sim$ $\pi ( \boldsymbol { a } _ { t } | \hat { \boldsymbol { x } } _ { \le t } )$ . The world model then predicts the reward $\hat { r } _ { t }$ , the episode end $\hat { d } _ { t }$ , and the next observation $\hat { x } _ { t + 1 } = \overset { - } { D } ( \hat { z } _ { t + 1 } )$ , with $\hat { z } _ { t + 1 } \sim p _ { G } ( \hat { z } _ { t + 1 } \mid z _ { 0 } , a _ { 0 } , \hat { z } _ { 1 } , a _ { 1 } , \dots , \hat { z } _ { t } , a _ { t } )$ . This imagination procedure is initialized with a real observation $x _ { 0 }$ sampled from past experience, and is rolled out for $H$ steps, the imagination horizon hyperparameter. We stop if an episode end is predicted before reaching the horizon. Figure 1 illustrates the imagination procedure.
+
+As we roll out imagination for a fixed number of steps, we cannot simply use a Monte Carlo estimate for the expected return. Hence, to bootstrap the rewards that the agent would get beyond a given time step, we have a value network $V$ that estimates $\begin{array} { r } { V ( \hat { x } _ { t } ) \simeq \mathbb { E } _ { \pi } \big [ \sum _ { \tau \geq t } \gamma ^ { \tau - t } \hat { r } _ { \tau } \big ] } \end{array}$ .
+
+Many actor-critic methods could be employed to train $\pi$ and $V$ in imagination (Sutton & Barto, 2018; Kaiser et al., 2020; Hafner et al., 2020). For the sake of simplicity, we opt for the learning objectives and hyperparameters of DreamerV2 (Hafner et al., 2021), that delivered strong performance in Atari games. Appendix B gives a detailed breakdown of the reinforcement learning objectives.
+
+# 3 EXPERIMENTS
+
+Sample-efficient reinforcement learning is a growing field with multiple benchmarks in complex visual environments (Hafner, 2022; Kanervisto et al., 2022). In this work, we focus on the well established Atari 100k benchmark (Kaiser et al., 2020). We present the benchmark and its baselines in Section 3.1. We describe the evaluation protocol and discuss the results in Section 3.2. Qualitative examples of the world model’s capabilities are given in Section 3.3.
+
+Table 1: Returns on the 26 games of Atari $1 0 0 \mathrm { k }$ after 2 hours of real-time experience, and humannormalized aggregate metrics. Bold numbers indicate the top methods without lookahead search while underlined numbers specify the overall best methods. IRIS outperforms learning-only methods in terms of number of superhuman games, mean, interquartile mean (IQM), and optimality gap.
+
+
Lookahead search
No lookahead search
Game
Random
Human
MuZero
EfficientZero
SimPLe
CURL
DrQ
SPR
IRIS (ours)
Alien
227.8
7127.7
530.0
808.5
616.9
711.0
865.2
841.9
420.0
Amidar
5.8
1719.5
38.8
148.6
74.3
113.7
137.8
179.7
143.0
Assault
222.4
742.0
500.1
1263.1
527.2
500.9
579.6
565.6
1524.4
Asterix
210.0
8503.3
1734.0
25557.8
1128.3
567.2
763.6
962.5
853.6
BankHeist
14.2
753.1
192.5
351.0
34.2
65.3
232.9
345.4
53.1
BattleZone
2360.0
37187.5
7687.5
13871.2
4031.2
8997.8
10165.3
14834.1
13074.0
Boxing
0.1
12.1
15.1
52.7
7.8
0.9
9.0
35.7
70.1
Breakout
1.7
30.5
48.0
414.1
16.4
2.6
19.8
19.6
83.7
ChopperCommand
811.0
7387.8
1350.0
1117.3
979.4
783.5
844.6
946.3
1565.0
CrazyClimber
10780.5
35829.4
56937.0
83940.2
62583.6
9154.4
21539.0
36700.5
59324.2
DemonAttack
152.1
1971.0
3527.0
13003.9
208.1
646.5
1321.5
517.6
2034.4
Freeway
0.0
29.6
21.8
21.8
16.7
28.3
20.3
19.3
31.1
Frostbite
65.2
4334.7
255.0
296.3
236.9
1226.5
1014.2
1170.7
259.1
Gopher
257.6
2412.5
1256.0
3260.3
596.8
400.9
621.6
660.6
2236.1
Hero
1027.0
30826.4
3095.0
9315.9
2656.6
4987.7
4167.9
5858.6
7037.4
Jamesbond
29.0
302.8
87.5
517.0
100.5
331.0
349.1
366.5
462.7
Kangaroo
52.0
3035.0
62.5
724.1
51.2
740.2
1088.4
3617.4
838.2
Krull
1598.0
2665.5
4890.8
5663.3
2204.8
3049.2
4402.1
3681.6
6616.4
KungFuMaster
258.5
22736.3
18813.0
30944.8
14862.5
8155.6
11467.4
14783.2
21759.8
MsPacman
307.3
6951.6
1265.6
1281.2
1480.0
1064.0
1218.1
1318.4
999.1
Pong
-20.7
14.6
-6.7
20.1
12.8
-18.5
-9.1
-5.4
14.6
PrivateEye
24.9
69571.3
56.3
96.7
35.0
81.9
3.5
86.0
100.0
Qbert
163.9
13455.0
3952.0
13781.9
1288.8
727.0
1810.7
866.3
745.7
RoadRunner
11.5
7845.0
2500.0
17751.3
5640.6
5006.1
11211.4
12213.1
9614.6
Seaquest
68.4
42054.7
208.0
1100.2
683.3
315.2
352.3
558.1
661.3
UpNDown
533.4
11693.2
2896.9
17264.2
3350.3
2646.4
4324.5
10859.2
3546.2
#Superhuman (↑)
0
N/A
5
14
1
2
3
6
10
Mean (↑)
0.000
1.000
0.562
1.943
0.332
0.261
0.465
0.616
1.046
Median (↑)
0.000
1.000
0.227
1.090
0.134
0.092
0.313
0.396
0.289
IQM (↑)
0.000
1.000
N/A
N/A
0.130
0.113
0.280
0.337
0.501
Optimality Gap (↓)
1.000
0.000
N/A
N/A
0.729
0.768
0.631
0.577
0.512
+
+# 3.1 BENCHMARK AND BASELINES
+
+Atari $1 0 0 \mathrm { k }$ consists of 26 Atari games (Bellemare et al., 2013a) with various mechanics, evaluating a wide range of agent capabilities. In this benchmark, an agent is only allowed $1 0 0 \mathrm { k }$ actions in each environment. This constraint is roughly equivalent to 2 hours of human gameplay. By way of comparison, unconstrained Atari agents are usually trained for 50 million steps, a 500 fold increase in experience.
+
+Multiple baselines were compared on the Atari $1 0 0 \mathrm { k }$ benchmark. SimPLe (Kaiser et al., 2020) trains a policy with PPO (Schulman et al., 2017) in a video generation model. CURL (Laskin et al., 2020) develops off-policy agents from high-level image features obtained with contrastive learning. DrQ (Yarats et al., 2021) augments input images and averages Q-value estimates over several transformations. SPR (Schwarzer et al., 2021) enforces consistent representations of input images across augmented views and neighbouring time steps. The aforementioned baselines carry additional techniques to improve performance, such as prioritized experience replay (Schaul et al., 2016), epsilon-greedy scheduling, or data augmentation.
+
+We make a distinction between methods with and without lookahead search. Indeed, algorithms relying on search at decision time (Silver et al., 2016; 2018; Schrittwieser et al., 2020) can vastly improve agent performance, but they come at a premium in computational resources and code complexity. MuZero (Schrittwieser et al., 2020) and EfficientZero (Ye et al., 2021) are the current standard for search-based methods in Atari 100k. MuZero leverages Monte Carlo Tree Search (MCTS) (Kocsis & Szepesvári, 2006; Coulom, 2007) as a policy improvement operator, by unrolling multiple hypothetical trajectories in the latent space of a world model. EfficientZero improves upon MuZero by introducing a self-supervised consistency loss, predicting returns over short horizons in one shot, and correcting off-policy trajectories with its world model.
+
+
+Figure 5: Mean, median, and interquartile mean human normalized scores, computed with stratified bootstrap confidence intervals. 5 runs for IRIS and SimPLe, 100 runs for SPR, CURL, and $_ \mathrm { D r Q }$ (Agarwal et al., 2021).
+
+
+
+
+
+(a) Performance profiles, i.e. fraction of runs above a given human normalized score.
+
+(b) Probabilities of improvement, i.e. how likely it is for IRIS to outperform baselines on any game.
+
+Figure 6: Performance profiles (left) and probabilities of improvement (right) (Agarwal et al., 2021).
+
+# 3.2 RESULTS
+
+The human normalized score is the established measure of performance in Atari 100k. It is defined as $\frac { s c o r e _ { - } a g e n t - s c o r e _ { - } r a n d o m } { s c o r e _ { - } h u m a n - s c o r e _ { - } r a n d o m }$ , where score_random comes from a random policy, and score_human is obtained from human players (Wang et al., 2016).
+
+Table 1 displays returns across games and human-normalized aggregate metrics. For MuZero and EfficientZero, we report the averaged results published by Ye et al. (2021) (3 runs). We use results from the Atari 100k case study conducted by Agarwal et al. (2021) for the other baselines (100 new runs for CURL, DrQ, SPR, and 5 existing runs for SimPLe). Finally, we evaluate IRIS by computing an average over 100 episodes collected at the end of training for each game (5 runs).
+
+Agarwal et al. (2021) discuss the limitations of mean and median scores, and show that substantial discrepancies arise between standard point estimates and interval estimates in RL benchmarks. Following their recommendations, we summarize in Figure 5 the human normalized scores with stratified bootstrap confidence intervals for mean, median, and interquartile mean (IQM). For finer comparisons, we also provide performance profiles and probabilities of improvement in Figure 6.
+
+With the equivalent of only two hours of gameplay, IRIS achieves a superhuman mean score of 1.046 $( + 7 0 \% )$ , an IQM of 0.501 $( + 4 9 \% )$ , an optimality gap of 0.512 $( + 1 1 \% )$ , and outperforms human players on 10 out of 26 games $( + 6 7 \% )$ , where the relative improvements are computed with respect to SPR (Schwarzer et al., 2021). These results constitute a new state of the art for methods without lookahead search in the Atari 100k benchmark. We also note that IRIS outperforms MuZero, although the latter was not designed for the sample-efficient regime.
+
+
+Figure 7: Three consecutive levels in the games Frostbite (left) and Krull (right). In our experiments, the world model struggles to simulate subsequent levels in Frostbite, but not in Krull. Indeed, exiting the first level in Frostbite requires a long and unlikely sequence of actions to first build the igloo, and then go back to it from the bottom of the screen. Such rare events prevent the world model from internalizing new aspects of the game, which will therefore not be experienced by the policy in imagination. While Krull features more diverse levels, the world model successfully reflects this variety, and IRIS even sets a new state of the art in this environment. This is likely due to more frequent transitions from one stage to the next in Krull, resulting in a sufficient coverage of each level.
+
+In addition, performance profiles (Figure 6a) reveal that IRIS is on par with the strongest baselines for its bottom $50 \%$ of games, at which point it stochastically dominates (Agarwal et al., 2021; Dror et al., 2019) the other methods. Similarly, the probability of improvement is greater than 0.5 for all baselines (Figure 6b).
+
+In terms of median score, IRIS overlaps with other methods (Figure 5). Interestingly, Schwarzer et al. (2021) note that the median is only influenced by a few decisive games, as evidenced by the width of the confidence intervals for median scores, even with 100 runs for DrQ, CURL and SPR.
+
+We observe that IRIS is particularly strong in games that do not suffer from distributional shifts as the training progresses. Examples of such games include Pong, Breakout, and Boxing. On the contrary, the agent struggles when a new level or game mechanic is unlocked through an unlikely event. This sheds light on a double exploration problem. IRIS has to first discover a new aspect of the game for its world model to internalize it. Only then may the policy rediscover and exploit it. Figure 7 details this phenomenon in Frostbite and Krull, two games with multiple levels. In summary, as long as transitions between levels do not depend on low-probability events, the double exploration problem does not hinder performance.
+
+Another kind of games difficult to simulate are visually challenging environments where capturing small details is important. As discussed in Appendix E, increasing the number of tokens to encode frames improves performance, albeit at the cost of increased computation.
+
+# 3.3 WORLD MODEL ANALYSIS
+
+As IRIS learns behaviors entirely in its imagination, the quality of the world model is the cornerstone of our approach. For instance, it is key that the discrete autoencoder correctly reconstructs elements like a ball, a player, or an enemy. Similarly, the potential inability of the Transformer to capture important game mechanics, like reward attribution or episode termination, can severely hamper the agent’s performance. Hence, no matter the amount of imagined trajectories, the agent will learn suboptimal policies if the world model is flawed.
+
+While Section 3.2 provides a quantitative evaluation, we aim to complement the analysis with qualitative examples of the abilities of the world model. Figure 2 shows the generation of many plausible futures in the face of uncertainty. Figure 3 depicts pixel-perfect predictions in Pong. Finally, we illustrate in Figure 4 predictions for rewards and episode terminations, which are crucial to the reinforcement learning objective.
+
+# 4 RELATED WORK
+
+# LEARNING IN THE IMAGINATION OF WORLD MODELS
+
+The idea of training policies in a learnt model of the world was first investigated in tabular environments (Sutton & Barto, 2018). Ha & Schmidhuber (2018) showed that simple visual environments could be simulated with autoencoders and recurrent networks. SimPLe (Kaiser et al., 2020) demonstrated that a PPO policy (Schulman et al., 2017) trained in a video prediction model outperformed humans in some Atari games. Improving upon Dreamer (Hafner et al., 2020), DreamerV2 (Hafner et al., 2021) was the first agent learning in imagination to achieve human-level performance in the Atari 50M benchmark. Its world model combines a convolutional autoencoder with a recurrent state-space model (RSSM) (Hafner et al., 2019) for latent dynamics learning. More recently, Chen et al. (2022) explored a variant of DreamerV2 where a Transformer replaces the recurrent network in the RSSM and Seo et al. (2022) enhance DreamerV2 in the setting where an offline dataset of videos is available for pretraining.
+
+# REINFORCEMENT LEARNING WITH TRANSFORMERS
+
+Following spectacular advances in natural language processing (Manning & Goldie, 2022), the reinforcement learning community has recently stepped into the realm of Transformers. Parisotto et al. (2020) make the observation that the standard Transformer architecture is difficult to optimize with RL objectives. The authors propose to replace residual connections by gating layers to stabilize the learning procedure. Our world model does not require such modifications, which is most likely due to its self-supervised learning objective. The Trajectory Transformer (Janner et al., 2021) and the Decision Transformer (Chen et al., 2021) represent offline trajectories as a static dataset of sequences, and the Online Decision Transformer (Zheng et al., 2022) extends the latter to the online setting. The Trajectory Transformer is trained to predict future returns, states and actions. At inference time, it can thus plan for the optimal action with a reward-driven beam search, yet the approach is limited to low-dimensional states. On the contrary, Decision Transformers can handle image inputs but cannot be easily extended as world models. Ozair et al. (2021) introduce an offline variant of MuZero (Schrittwieser et al., 2020) capable of handling stochastic environments by performing an hybrid search with a Transformer over both actions and trajectory-level discrete latent variables.
+
+# IDEO GENERATION WITH DISCRETE AUTOENCODERS AND TRANSFORMER
+
+VQGAN (Esser et al., 2021) and DALL-E (Ramesh et al., 2021) use discrete autoencoders to compress a frame into a small sequence of tokens, that a transformer can then model autoregressively. Other works extend the approach to video generation. GODIVA (Wu et al., 2021) models sequences of frames instead of a single frame for text conditional video generation. VideoGPT (Yan et al., 2021) introduces video-level discrete autoencoders, and Transformers with spatial and temporal attention patterns, for unconditional and action conditional video generation.
+
+# 5 CONCLUSION
+
+We introduced IRIS, an agent that learns purely in the imagination of a world model composed of a discrete autoencoder and an autoregressive Transformer. IRIS sets a new state of the art in the Atari $1 0 0 \mathrm { k }$ benchmark for methods without lookahead search. We showed that its world model acquires a deep understanding of game mechanics, resulting in pixel perfect predictions in some games. We also illustrated the generative capabilities of the world model, providing a rich gameplay experience when training in imagination. Ultimately, with minimal tuning compared to existing battle-hardened agents, IRIS opens a new path towards efficiently solving complex environments.
+
+In the future, IRIS could be scaled up to computationally demanding and challenging tasks that would benefit from the speed of its world model. Besides, its policy currently learns from reconstructed frames, but it could probably leverage the internal representations of the world model. Another exciting avenue of research would be to combine learning in imagination with MCTS. Indeed, both approaches deliver impressive results, and their contributions to agent performance might be complementary.
+
+# REPRODUCIBILITY STATEMENT
+
+The different components and their training objectives are introduced in Section 2 and Appendix B. We describe model architectures and list hyperparameters in Appendix A. We specify the resources used to produce our results in Appendix G. Algorithm 1 makes explicit the interplay between components in the training loop. In Section 3.2, we provide the source of the reported results for the baselines, as well as the evaluation protocol.
+
+The code is part of the supplementary materials, and will be open-sourced to ensure reproducible results and foster future research. Minimal dependencies are required to run the codebase and we provide a thorough user guide to get started. Training and evaluation can be launched with simple commands, customization is possible with configuration files, and we include scripts to visualize agents playing and let users interact with the world model.
+
+# ETHICS STATEMENT
+
+The development of autonomous agents for real-world environments raises many safety and environmental concerns. During its training period, an agent may cause serious harm to individuals and damage its surroundings. It is our belief that learning in the imagination of world models greatly reduces the risks associated with training new autonomous agents. Indeed, in this work, we propose a world model architecture capable of accurately modeling environments with very few samples. However, in a future line of research, one could go one step further and leverage existing data to eliminate the necessity of interacting with the real world.
+
+# ACKNOWLEDGMENTS
+
+We would like to thank Maxim Peter, Bálint Máté, Daniele Paliotta, Atul Sinha, and Alexandre Dupuis for insightful discussions and comments. Vincent Micheli was supported by the Swiss National Science Foundation under grant number FNS-187494.
+
+# REFERENCES
+
+Rishabh Agarwal, Max Schwarzer, Pablo Samuel Castro, Aaron C Courville, and Marc Bellemare. Deep reinforcement learning at the edge of the statistical precipice. Advances in neural information processing systems, 34:29304–29320, 2021.
+
+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, 2013a.
+
+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, 2013b.
+
+Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
+
+Christopher Berner, Greg Brockman, Brooke Chan, Vicki Cheung, Przemysław D˛ebiak, Christy Dennison, David Farhi, Quirin Fischer, Shariq Hashme, Chris Hesse, et al. Dota 2 with large scale deep reinforcement learning. arXiv preprint arXiv:1912.06680, 2019.
+
+Noam Brown, Anton Bakhtin, Adam Lerer, and Qucheng Gong. Combining deep reinforcement learning and search for imperfect-information games. Advances in neural information processing systems, 33:17057–17069, 2020a.
+
+Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020b.
+
+Chang Chen, Yi-Fu Wu, Jaesik Yoon, and Sungjin Ahn. Transdreamer: Reinforcement learning with transformer world models. arXiv preprint arXiv:2202.09481, 2022.
+
+Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Misha Laskin, Pieter Abbeel, Aravind Srinivas, and Igor Mordatch. Decision transformer: Reinforcement learning via sequence modeling. Advances in neural information processing systems, 34, 2021.
+
+Rémi Coulom. Computing “elo ratings” of move patterns in the game of go. ICGA journal, 30(4): 198–208, 2007.
+
+Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), 2019.
+
+Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021.
+
+Rotem Dror, Segev Shlomov, and Roi Reichart. Deep dominance-how to properly compare deep neural models. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2773–2785, 2019.
+
+Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12873–12883, 2021.
+
+F. A. Gers, J. Schmidhuber, and F. Cummins. Learning to forget: Continual prediction with LSTM. Neural Computation, 12(10):2451–2471, 2000.
+
+David Ha and Jürgen Schmidhuber. Recurrent world models facilitate policy evolution. Advances in neural information processing systems, 31, 2018.
+
+Danijar Hafner. Benchmarking the spectrum of agent capabilities. In International Conference on Learning Representations, 2022.
+
+Danijar Hafner, Timothy Lillicrap, Ian Fischer, Ruben Villegas, David Ha, Honglak Lee, and James Davidson. Learning latent dynamics for planning from pixels. In International conference on machine learning, pp. 2555–2565. PMLR, 2019.
+
+Danijar Hafner, Timothy Lillicrap, Jimmy Ba, and Mohammad Norouzi. Dream to control: Learning behaviors by latent imagination. In International Conference on Learning Representations, 2020.
+
+Danijar Hafner, Timothy P Lillicrap, Mohammad Norouzi, and Jimmy Ba. Mastering atari with discrete world models. In International Conference on Learning Representations, 2021.
+
+Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked autoencoders are scalable vision learners. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16000–16009, 2022.
+
+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 Thirty-second AAAI conference on artificial intelligence, 2018.
+
+Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural Computation, 9(8): 1735–1780, 1997.
+
+Michael Janner, Qiyang Li, and Sergey Levine. Offline reinforcement learning as one big sequence modeling problem. Advances in neural information processing systems, 34, 2021.
+
+Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and super-resolution. In European conference on computer vision, pp. 694–711. Springer, 2016.
+
+Łukasz Kaiser, Mohammad Babaeizadeh, Piotr Miłos, Błazej Osi ˙ nski, Roy H Campbell, Konrad ´ Czechowski, Dumitru Erhan, Chelsea Finn, Piotr Kozakowski, Sergey Levine, et al. Model based reinforcement learning for atari. In International Conference on Learning Representations, 2020.
+
+Anssi Kanervisto, Stephanie Milani, Karolis Ramanauskas, Nicholay Topin, Zichuan Lin, Junyou Li, Jianing Shi, Deheng Ye, Qiang Fu, Wei Yang, Weijun Hong, Zhongyue Huang, Haicheng Chen, Guangjun Zeng, Yue Lin, Vincent Micheli, Eloi Alonso, François Fleuret, Alexander Nikulin, Yury Belousov, Oleg Svidchenko, and Aleksei Shpilman. Minerl diamond 2021 competition: Overview, results, and lessons learned. In Proceedings of the NeurIPS 2021 Competitions and Demonstrations Track, Proceedings of Machine Learning Research, 2022. URL https://proceedings.mlr. press/v176/kanervisto22a.html.
+
+Steven Kapturowski, Georg Ostrovski, John Quan, Remi Munos, and Will Dabney. Recurrent experience replay in distributed reinforcement learning. In International conference on learning representations, 2019.
+
+Andrej Karpathy. minGPT: A minimal PyTorch re-implementation of the OpenAI GPT (Generative Pretrained Transformer) training, 2020. URL https://github.com/karpathy/minGPT.
+
+Levente Kocsis and Csaba Szepesvári. Bandit based monte-carlo planning. In European conference on machine learning, 2006.
+
+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.
+
+Anders Boesen Lindbo Larsen, Søren Kaae Sønderby, Hugo Larochelle, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. In International conference on machine learning, pp. 1558–1566. PMLR, 2016.
+
+Michael Laskin, Aravind Srinivas, and Pieter Abbeel. CURL: Contrastive unsupervised representations for reinforcement learning. In International Conference on Machine Learning, pp. 5639–5650. PMLR, 2020.
+
+Yann LeCun, Bernhard Boser, John S Denker, Donnie Henderson, Richard E Howard, Wayne Hubbard, and Lawrence D Jackel. Backpropagation applied to handwritten zip code recognition. Neural computation, 1(4):541–551, 1989.
+
+Christopher Manning and Anna Goldie. Cs224n natural language processing with deep learning, 2022.
+
+Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
+
+Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International conference on machine learning, pp. 1928–1937. PMLR, 2016.
+
+Sherjil Ozair, Yazhe Li, Ali Razavi, Ioannis Antonoglou, Aaron Van Den Oord, and Oriol Vinyals. Vector quantized models for planning. In International Conference on Machine Learning, pp. 8302–8313. PMLR, 2021.
+
+Emilio Parisotto, Francis Song, Jack Rae, Razvan Pascanu, Caglar Gulcehre, Siddhant Jayakumar, Max Jaderberg, Raphael Lopez Kaufman, Aidan Clark, Seb Noury, et al. Stabilizing transformers for reinforcement learning. In International Conference on Machine Learning, pp. 7487–7498. PMLR, 2020.
+
+Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training, 2018.
+
+Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners, 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.
+
+Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In International Conference on Machine Learning, pp. 8821–8831. PMLR, 2021.
+
+Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. In International Conference on Learning Representations, 2016.
+
+Martin Schmid, Matej Moravcik, Neil Burch, Rudolf Kadlec, Josh Davidson, Kevin Waugh, Nolan Bard, Finbarr Timbers, Marc Lanctot, Zach Holland, et al. Player of games. arXiv preprint arXiv:2112.03178, 2021.
+
+Julian Schrittwieser, Ioannis Antonoglou, Thomas Hubert, Karen Simonyan, L. Sifre, Simon Schmitt, Arthur Guez, Edward Lockhart, Demis Hassabis, Thore Graepel, Timothy P. Lillicrap, and David Silver. Mastering atari, go, chess and shogi by planning with a learned model. Nature, 588(7839): 604–609, 2020.
+
+John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
+
+Mike Schuster and Kaisuke Nakajima. Japanese and korean voice search. In 2012 IEEE international conference on acoustics, speech and signal processing (ICASSP), pp. 5149–5152. IEEE, 2012.
+
+Max Schwarzer, Ankesh Anand, Rishab Goel, R Devon Hjelm, Aaron Courville, and Philip Bachman. Data-efficient reinforcement learning with self-predictive representations. In International Conference on Learning Representations, 2021.
+
+Younggyo Seo, Kimin Lee, Stephen L James, and Pieter Abbeel. Reinforcement learning with actionfree pre-training from videos. In International Conference on Machine Learning, pp. 19561–19579. PMLR, 2022.
+
+David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
+
+David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, et al. A general reinforcement learning algorithm that masters chess, shogi, and go through self-play. Science, 362(6419): 1140–1144, 2018.
+
+Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction. A Bradford Book, Cambridge, MA, USA, 2018.
+
+Aaron Van Den Oord, Oriol Vinyals, et al. Neural discrete representation learning. Advances in neural information processing systems, 30, 2017.
+
+Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017.
+
+Oriol Vinyals, Igor Babuschkin, Wojciech M Czarnecki, Michaël Mathieu, Andrew Dudzik, Junyoung Chung, David H Choi, Richard Powell, Timo Ewalds, Petko Georgiev, et al. Grandmaster level in StarCraft II using multi-agent reinforcement learning. Nature, 575(7782):350–354, 2019.
+
+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, pp. 1995–2003. PMLR, 2016.
+
+Chenfei Wu, Lun Huang, Qianxi Zhang, Binyang Li, Lei Ji, Fan Yang, Guillermo Sapiro, and Nan Duan. Godiva: Generating open-domain videos from natural descriptions. arXiv preprint arXiv:2104.14806, 2021.
+
+Roman V Yampolskiy. Artificial Intelligence Safety and Security. Chapman & Hall/CRC, 2018.
+
+Wilson Yan, Yunzhi Zhang, Pieter Abbeel, and Aravind Srinivas. Videogpt: Video generation using vq-vae and transformers. arXiv preprint arXiv:2104.10157, 2021.
+
+Denis Yarats, Ilya Kostrikov, and Rob Fergus. Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. In International Conference on Learning Representations, 2021.
+
+Weirui Ye, Shaohuai Liu, Thanard Kurutach, Pieter Abbeel, and Yang Gao. Mastering atari games with limited data. Advances in neural information processing systems, 34, 2021.
+
+Qinqing Zheng, Amy Zhang, and Aditya Grover. Online decision transformer. In International Conference on Machine Learning, pp. 27042–27059. PMLR, 2022.
+
+# A MODELS AND HYPERPARAMETERS
+
+# A.1 DISCRETE AUTOENCODER
+
+Our discrete autoencoder is based on the implementation of VQGAN (Esser et al., 2021). We removed the discriminator, essentially turning the VQGAN into a vanilla VQVAE (Van Den Oord et al., 2017) with an additional perceptual loss (Johnson et al., 2016; Larsen et al., 2016).
+
+The training objective is the following:
+
+$$
+\begin{array} { r } { \dot { z } ( E , D , \mathcal { E } ) = \left\| x - D ( z ) \right\| _ { 1 } + \left\| \operatorname { s g } ( E ( x ) ) - \mathcal { E } ( z ) \right\| _ { 2 } ^ { 2 } + \left\| \operatorname { s g } ( \mathcal { E } ( z ) ) - E ( x ) \right\| _ { 2 } ^ { 2 } + \mathcal { L } _ { p e r c e p t u a l } ( x , D ( z ) ) } \end{array}
+$$
+
+Here, the first term is the reconstruction loss, the next two terms constitute the commitment loss (where $\operatorname { s g } ( \cdot )$ is the stop-gradient operator), and the last term is the perceptual loss.
+
+Table 2: Encoder / Decoder hyperparameters. We list the hyperparameters for the encoder, the same ones apply for the decoder.
+
+
Hyperparameter
Value
Frame dimensions (h,w)
64 × 64
Layers
4
Residual blocks per layer
2
Channels in convolutions
64
Self-attention layers at resolution
8/16
+
+Table 3: Embedding table hyperparameters.
+
+
Hyperparameter
Value
Vocabulary size (N)
512
Tokens per frame (K)
16
Token embedding dimension (d)
512
+
+Note that during experience collection in the real environment, frames still go through the autoencoder to keep the input distribution of the policy unchanged. See Algorithm 1 for details.
+
+# A.2 TRANSFORMER
+
+Our autoregressive Transformer is based on the implementation of minGPT (Karpathy, 2020). It takes as input a sequence of $L ( K + 1 )$ tokens and embeds it into a $L ( K + 1 ) \times D$ tensor using an $A \times D$ embedding table for actions, and a $N \times D$ embedding table for frames tokens. This tensor is forwarded through $M$ Transformer blocks. We use GPT2-like blocks (Radford et al., 2019), i.e. each block consists of a self-attention module with layer normalization of the input, wrapped with a residual connection, followed by a per-position multi-layer perceptron with layer normalization of the input, wrapped with another residual connection.
+
+Table 4: Transformer hyperparameters
+
+
Hyperparameter
Value
Timesteps (L)
20
Embedding dimension (D)
256
Layers (M)
10
Attention heads
4
Weight decay
0.01
Embedding dropout
0.1
Attention dropout
0.1
Residual dropout
0.1
+
+# A.3 ACTOR-CRITIC
+
+The weights of the actor and critic are shared except for the last layer. The actor-critic takes as input a $6 4 \times 6 4 \times 3$ frame, and forwards it through a convolutional block followed by an LSTM cell (Mnih et al., 2016; Hochreiter & Schmidhuber, 1997; Gers et al., 2000). The convolutional block consists of the same layer repeated four times: a 3x3 convolution with stride 1 and padding 1, a ReLU activation, and $2 \mathbf { x } 2$ max-pooling with stride 2. The dimension of the LSTM hidden state is 512. Before starting the imagination procedure from a given frame, we burn-in (Kapturowski et al., 2019) the 20 previous frames to initialize the hidden state.
+
+Table 5: Training loop & Shared hyperparameters
+
+
Hyperparameter
Value
Epochs # Collection epochs Environment steps per epoch
600 500
Collection epsilon-greedy Eval sampling temperature Start autoencoder after epochs Start transformer after epochs Start actor-critic after epochs Autoencoder batch size Transformer batch size
200 0.01 0.5 5 25 50 256 64
Actor-critic batch size Training steps per epoch Learning rate Optimizer Adam β1 Adam β2 Max gradient norm
64 200 1e-4 Adam 0.9 0.999 10.0
+
+# B ACTOR-CRITIC LEARNING OBJECTIVES
+
+We follow Dreamer (Hafner et al., 2020; 2021) in using the generic $\lambda$ -return, that balances bias and variance, as the regression target for the value network. Given an imagined trajectory $( \hat { x } _ { 0 } , a _ { 0 } , \hat { r } _ { 0 } , \hat { d } _ { 0 } , \dots , \hat { x } _ { H - 1 } , a _ { H - 1 } , \hat { r } _ { H - 1 } , \hat { \dot { d } } _ { H - 1 } , \hat { x } _ { H } )$ , the $\lambda$ -return can be defined recursively as follows:
+
+$$
+\Lambda _ { t } = \left\{ \begin{array} { l l l } { \hat { r } _ { t } + \gamma ( 1 - \hat { d } _ { t } ) \Big [ ( 1 - \lambda ) V ( \hat { x } _ { t + 1 } ) + \lambda \Lambda _ { t + 1 } \Big ] } & { \mathrm { i f } } & { t < H } \\ { V ( \hat { x } _ { H } ) } & { \mathrm { i f } } & { t = H } \end{array} \right.
+$$
+
+The value network $V$ is trained to minimize ${ \mathcal { L } } _ { V }$ , the expected squared difference with $\lambda$ -returns over imagined trajectories.
+
+$$
+\mathcal { L } _ { V } = \mathbb { E } _ { \pi } \Big [ \sum _ { t = 0 } ^ { H - 1 } \big ( V ( \hat { x } _ { t } ) - \mathrm { s g } ( \Lambda _ { t } ) \big ) ^ { 2 } \Big ]
+$$
+
+Here, $\operatorname { s g } ( \cdot )$ denotes the gradient stopping operation, meaning that the target is a constant in the gradient-based optimization, as classically established in the literature (Mnih et al., 2015; Hessel et al., 2018; Hafner et al., 2020).
+
+As large amounts of trajectories are generated in the imagination MDP, we can use a straightforward reinforcement learning objective for the policy, such as REINFORCE (Sutton & Barto, 2018). To reduce the variance of REINFORCE gradients, we use the value $V ( \hat { x } _ { t } )$ as a baseline (Sutton & Barto, 2018). We also add a weighted entropy maximization objective to maintain a sufficient exploration. The actor is trained to minimize the following REINFORCE objective over imagined trajectories:
+
+$$
+\mathcal { L } _ { \pi } = - \mathbb { E } _ { \pi } \Big [ \sum _ { t = 0 } ^ { H - 1 } \log ( \pi ( a _ { t } | \hat { x } _ { \le t } ) ) \mathrm { s g } ( \Lambda _ { t } - V ( \hat { x } _ { t } ) ) + \eta \mathcal { H } ( \pi ( a _ { t } | \hat { x } _ { \le t } ) ) \Big ]
+$$
+
+Table 6: RL training hyperparameters
+
+
Hyperparameter
Value
Imagination horizon (H)
20
Y
0.995
入
0.95
m
0.001
+
+# C OPTIMALITY GAP
+
+
+Figure 8: Optimality gap, lower is better. The amount by which the algorithm fails to reach a human-level score (Agarwal et al., 2021).
+
+# D IRIS ALGORITHM
+
+# Algorithm 1: IRIS
+
+Procedure training_loop(): for epochs do collect_experience(steps_collect) for steps_world_model do update_world_model() for steps_behavior do update_behavior()
+
+Procedure collect_experience $( n )$ : $x _ { 0 } \gets$ env.reset() for $t = 0$ to $n - 1$ do $\hat { x } _ { t } \gets D ( E ( x _ { t } ) )$ // forward frame through discrete autoencoder Sample $a _ { t } \sim \pi ( a _ { t } | \hat { x } _ { t } )$ $x _ { t + 1 } , r _ { t } , d _ { t } \gets \mathsf { e n v . s t e p } ( a _ { t } )$ if $d _ { t } = 1$ then $\lfloor x _ { t + 1 } \gets \mathrm { e n v . r e s e t \ ( ) }$ ) $\mathcal { D } \mathcal { D } \cup \{ x _ { t } , a _ { t } , r _ { t } , d _ { t } \} _ { t = 0 } ^ { n - 1 }$
+
+Procedure update_world_model():
+
+Sample Compu $\{ x _ { t } , a _ { t } , r _ { t } , d _ { t } \} _ { t = \tau } ^ { \tau + L - 1 } \sim \mathcal { D }$ for $z _ { t } : = E ( x _ { t } )$ $\hat { x } _ { t } : = D ( z _ { t } )$ $t = \tau , \dots , \tau + L - 1$
+Update $E$ and $D$
+Compute $p _ { G } ( \hat { z } _ { t + 1 } , \hat { r } _ { t } , \hat { d } _ { t } \mid z _ { \tau } , a _ { \tau } , \ldots , z _ { t } , a _ { t } ) \mathrm { f o r } t = \tau , \ldots , \tau + L - 1$
+Update $G$
+
+Procedure update_behavior():
+
+Sample $x _ { 0 } \sim \mathcal { D }$
+$z _ { 0 } \gets E ( x _ { 0 } )$
+$\hat { x } _ { 0 } \gets D ( z _ { 0 } )$
+for $t = 0$ to $H - 1$ do Sample $a _ { t } \sim \pi ( a _ { t } | \hat { x } _ { t } )$ Sample $\hat { z } _ { t + 1 } , \hat { r } _ { t } , \hat { d } _ { t } \sim p _ { G } ( \hat { z } _ { t + 1 } , \hat { r } _ { t } , \hat { d } _ { t } \mid z _ { 0 } , a _ { 0 } , \ldots , \hat { z } _ { t } , a _ { t } )$ $\hat { x } _ { t + 1 } \gets D ( \hat { z } _ { t + 1 } )$
+Compute $V ( \hat { x } _ { t } )$ for $t = 0 , \ldots , H$
+Update $\pi$ and $V$
+
+The sequence length of the Transformer is determined by the number of tokens used to encode a single frame and the number of timesteps in memory. Increasing the number of tokens per frame results in better reconstructions, although it requires more compute and memory.
+
+This tradeoff is particularly important in visually challenging games with a high number of possible configurations, where the discrete autoencoder struggles to properly encode frames with only 16 tokens. For instance, Figure 9 shows that, when increasing the number of tokens per frame to 64 in Alien, the discrete autoencoder correctly reconstructs the player, its enemies, and rewards.
+
+
+Figure 9: Tradeoff between the number of tokens per frame and reconstructions quality in Alien. Each column displays a $6 4 \times 6 4$ frame from the real environment (top), its reconstruction with a discrete encoding of 16 tokens (center), and its reconstruction with a discrete encoding of 64 tokens (bottom). In Alien, the player is the dark blue character, and the enemies are the large colored sprites. With 16 tokens per frame, the autoencoder often erases the player, switches colors, and misplaces rewards. When increasing the amount of tokens, it properly reconstructs the frame.
+
+Table 7 displays the final performance of IRIS trained with 64 tokens per frame in three games. Interestingly, even though the world model is more accurate, the performance in Alien only increases marginally $( + 3 6 \% )$ . This observation suggests that Alien poses a hard reinforcement learning problem, as evidenced by the low performance of other baselines in that game. On the contrary, IRIS greatly benefits from having more tokens per frame for Asterix $( + 1 2 1 \% )$ and BankHeist $( + 4 3 2 \% )$ ).
+
+Table 7: Returns on Alien, Asterix, and BankHeist with 64 tokens per frame instead of 16.
+
+
Game
Random
Human
SimPLe
CURL
DrQ
SPR
IRIS (16 tokens)
IRIS (64 tokens)
Alien
227.8
7127.7
616.9
711.0
865.2
841.9
420.0
570.0
Asterix
210.0
8503.3
1128.3
567.2
763.6
962.5
853.6
1890.4
BankHeist
14.2
753.1
34.2
65.3
232.9
345.4
53.1
282.5
+
+# F BEYOND THE SAMPLE-EFFICIENT SETTING
+
+IRIS can be scaled up by increasing the number of tokens used to encode frames, adding capacity to the model, taking more optimization steps per environment steps, or using more data. In this experiment, we investigate data scaling properties by increasing the number of environment steps from $1 0 0 \mathrm { k }$ to 10M. However, to maintain a training time within our computational resources, we lower the ratio of optimization steps per environment steps from 1:1 to 1:50. As a consequence, the results of this experiment at $1 0 0 \mathrm { k }$ frames would be worse than those reported in the paper.
+
+Table 8: Increasing the number of environment steps from 100k to 10M.
+
+
Game
Random
Human
IRIS (100k)
IRIS (10M)
Alien
227.8
7127.7
420.0
1003.1
Amidar
5.8
1719.5
143.0
213.4
Assault
222.4
742.0
1524.4
9355.6
Asterix
210.0
8503.3
853.6
6861.0
BankHeist
14.2
753.1
53.1
921.6
BattleZone
2360.0
37187.5
13074.0
34562.5
Boxing
0.1
12.1
70.1
98.0
Breakout
1.7
30.5
83.7
493.9
ChopperCommand
811.0
7387.8
1565.0
9814.0
CrazyClimber
10780.5
35829.4
59324.2
111068.8
DemonAttack
152.1
1971.0
2034.4
96218.6
Freeway
0.0
29.6
31.1
34.0
Frostbite
65.2
4334.7
259.1
290.3
Gopher
257.6
2412.5
2236.1
97370.6
Hero
1027.0
30826.4
7037.4
19212.0
Jamesbond
29.0
302.8
462.7
5534.4
Kangaroo
52.0
3035.0
838.2
1793.8
Krull
1598.0
2665.5
6616.4
7344.0
KungFuMaster
258.5
22736.3
21759.8
39643.8
MsPacman
307.3
6951.6
999.1
1233.0
Pong
-20.7
14.6
14.6
21.0
PrivateEye
24.9
69571.3
100.0
100.0
Qbert
163.9
13455.0
745.7
4012.1
RoadRunner
11.5
7845.0
9614.6
30609.4
Seaquest
68.4
42054.7
661.3
1815.0
UpNDown
533.4
11693.2
3546.2
114690.1
#Superhuman (↑)
0
N/A
10
15
Mean (↑)
0.000
1.000
1.046
7.488
Median (↑)
0.000
1.000
0.289
1.207
IQM (↑)
0.000
1.000
0.501
2.239
Optimality Gap (↓)
1.000
0.000
0.512
0.282
+
+Table 8 illustrates that increasing the number of environment steps from $1 0 0 \mathrm { k }$ to 10M drastically improves performance for most games, providing evidence that IRIS could be scaled up beyond the sample-efficient regime. On some games, more data only yields marginal improvements, most likely due to hard exploration problems or visually challenging domains that would benefit from a higher number of tokens to encode frames (Appendix E).
+
+# G COMPUTATIONAL RESOURCES
+
+For each Atari environment, we repeatedly trained IRIS with 5 different random seeds. We ran our experiments with 8 Nvidia A100 40GB GPUs. With two Atari environments running on the same GPU, training takes around 7 days, resulting in an average of 3.5 days per environment.
+
+SimPLe (Kaiser et al., 2020), the only baseline that involves learning in imagination, trains for 3 weeks with a P100 GPU on a single environment. As for SPR (Schwarzer et al., 2021), the strongest baseline without lookahead search, it trains notably fast in 4.6 hours with a P100 GPU.
+
+Regarding baselines with lookahead search, MuZero (Schrittwieser et al., 2020) originally used 40 TPUs for 12 hours to train in a single Atari environment. Ye et al. (2021) train both EfficientZero and their reimplementation of MuZero in 7 hours with 4 RTX 3090 GPUs. EfficientZero’s implementation relies on a distributed infrastructure with CPU and GPU threads running in parallel, and a $\mathrm { C } { + } { + } I$ Cython implementation of MCTS. By contrast, IRIS and the baselines without lookahead search rely on straightforward single GPU / single CPU implementations.
+
+# H EXPLORATION IN FREEWAY
+
+The reward function in Freeway is sparse since the agent is only rewarded when it completely crosses the road. In addition, bumping into cars will drag it down, preventing it from smoothly ascending the highway. This poses an exploration problem for newly initialized agents because a random policy will almost surely never obtain a non-zero reward with a $1 0 0 \mathrm { k }$ frames budget.
+
+
+Figure 10: A game of Freeway. Cars will bump the player down, making it very unlikely to cross the road and be rewarded for random policies.
+
+The solution to this problem is actually straightforward and simply requires stretches of time when the UP action is oversampled. Most Atari $1 0 0 \mathrm { k }$ baselines fix the issue with epsilon-greedy schedules and argmax action selection, where at some point the network configuration will be such that the UP action is heavily favored. In this work, we opted for the simpler strategy of having a fixed epsilon-greedy parameter and sampling from the policy. However, we lowered the sampling temperature from 1 to 0.01 for Freeway, in order to avoid random walks that would not be conducive to learning in the early stages of training. As a consequence, once it received its first few rewards through exploration, IRIS was able to internalize the sparse reward function in its world model.
\ No newline at end of file
diff --git a/md/dev/vhKaBdOOobB/vhKaBdOOobB.md b/md/dev/vhKaBdOOobB/vhKaBdOOobB.md
new file mode 100644
index 0000000000000000000000000000000000000000..bb6d2f76ac62fc7c3304df6339d335a27b4c6dc3
--- /dev/null
+++ b/md/dev/vhKaBdOOobB/vhKaBdOOobB.md
@@ -0,0 +1,292 @@
+# GhostNetV2: Enhance Cheap Operation with Long-Range Attention
+
+Yehui Tang1,2, Kai $\mathbf { H a n } ^ { 2 }$ , Jianyuan $\mathbf { G u o } ^ { 2 , 3 }$ , Chang $\mathbf { X } \mathbf { u } ^ { 3 }$ , Chao $\mathbf { X } \mathbf { u } ^ { 1 }$ , Yunhe Wang2∗
+
+1School of Artificial Intelligence, Peking University 2Huawei Noah’s Ark Lab 3School of Computer Science, University of Sydney yhtang@pku.edu.cn, {kai.han, yunhe.wang} $@$ huawei.com
+
+# Abstract
+
+Light-weight convolutional neural networks (CNNs) are specially designed for applications on mobile devices with faster inference speed. The convolutional operation can only capture local information in a window region, which prevents performance from being further improved. Introducing self-attention into convolution can capture global information well, but it will largely encumber the actual speed. In this paper, we propose a hardware-friendly attention mechanism (dubbed DFC attention) and then present a new GhostNetV2 architecture for mobile applications. The proposed DFC attention is constructed based on fully-connected layers, which can not only execute fast on common hardware but also capture the dependence between long-range pixels. We further revisit the expressiveness bottleneck in previous GhostNet and propose to enhance expanded features produced by cheap operations with DFC attention, so that a GhostNetV2 block can aggregate local and long-range information simultaneously. Extensive experiments demonstrate the superiority of GhostNetV2 over existing architectures. For example, it achieves $7 5 . 3 \%$ top-1 accuracy on ImageNet with 167M FLOPs, significantly suppressing GhostNetV1 $( 7 4 . 5 \% )$ with a similar computational cost. The source code will be available at https://github.com/huawei-noah/Efficient-AI-Backbones/ tree/master/ghostnetv2_pytorch and https://gitee.com/mindspore/ models/tree/master/research/cv/ghostnetv2.
+
+# 1 Introduction
+
+In computer vision, the architecture of deep neural network plays a vital role for various tasks, such as image classification [19, 10], object detection [27, 26], and video analysis [18]. In the past decade, the network architecture has been evolving rapidly, and a series of milestones including AlexNet [19], GoogleNet [29], ResNet [10] and EfficientNet [32] have been developed. These networks have pushed the performances of a wide range of visual tasks to a high level.
+
+To deploy neural networks on edge devices like smartphone and wearable devices, we need to consider not only the performance of a model, but also its efficiency especially the actual inference speed. Matrix multiplications occupy the main part of computational cost and parameters. Developing lightweight models is a promising approach to reduce the inference latency. MobileNet [13] factorizes a standard convolution into depthwise convolution and point-wise convolution, which reduces the computational cost drastically. MobileNetV2 [28] and MobileNetV3 [12] further introduce the inverted residual block and improve the network architecture. ShuffleNet [42] utilizes the shuffle operation to encourage the information exchange between channel groups. GhostNet [8] proposes the cheap operation to reduce feature redundancy in channels. WaveMLP [33] replaces the complex
+
+
+Figure 1: Top-1 accuracy vs.FLOPs on ImageNet Figure 2: Top-1 accuracy vs.latency on ImageNet dataset. dataset.
+
+self-attention module with a simple Multi-Layer Perceptron (MLP) to reduce the computational cost.
+These light-weight neural networks have been applied in many mobile applications.
+
+Nevertheless, the convolution-based light-weight models are weak in modeling long-range dependency, which limits further performance improvement. Recently, transformer-like models are introduced to computer vision, in which the self-attention module can capture the global information. The typical self-attention module requires quadratic complexity w.r.t. the size of feature’s shape and is not computationally friendly. Moreover, plenty of feature splitting and reshaping operations are required to calculate the attention map. Though their theoretical complexity is negligible, these operations incur more memory usage and longer latency in practice. Thus, utilizing vanilla self-attention in light-weight models is not friendly for mobile deployment. For example, MobileViT with massive self-attention operations is more than $7 \times$ slower than MobileNetV2 on ARM devices [23].
+
+In this paper, we propose a new attention mechanism (dubbed DFC attention) to capture the longrange spatial information, while keeping the implementation efficiency of light-weight convolutional neural networks. Only fully connected (FC) layers participate in generating the attention maps for simplicity. Specifically, a FC layer is decomposed into horizontal FC and vertical FC to aggregate pixels in a 2D feature map of CNN. The two FC layers involve pixels in a long range along their respective directions, and stacking them will produce a global receptive field. Moreover, starting from ate-of-the-art GhostNet, we revisit its representation bottleneck and enhance the intermediate features with the DFC attention. Then we construct a new light-weight vision backbone, GhostNetV2. Compared with the existing architectures, it can achieve a better tread-off between accuracy and inference speed (as shown in Figures 1 and 2).
+
+# 2 Related Work
+
+It is a challenge to design a light-weight neural architecture with fast inference speed and high performance simultaneously [16, 41, 13, 40, 35]. SqueezeNet [16] proposes three strategies to design a compact model, i.e., replacing $3 \times 3$ filters with $1 \times 1$ filers, decreasing the number of input channels to $3 x 3$ filters, and down-sampling late in the network to keep large feature maps. These principles are constructive, especially the usage of $1 \times 1$ convolution. MobileNetV1 [13] replaces almost all the $3 \times 3$ filers with $1 \times 1$ kernel and depth-wise separable convolutions, which dramatically reduces the computational cost. MobileNetV2 [28] further introduces the residual connection to the light-weight model, and constructs an inverted residual structure, where the intermediate layer of a block has more channels than its input and output. To keep representation ability, a part of non-linear functions are removed. MobileNeXt [44] rethinks the necessary of inverted bottleneck, and claims that the classic bottleneck structure can also achieve high performance. Considering the $1 \times 1$ convolution account for a substantial part of computational cost, ShuffleNet [42] replace it with group convolution. The channel shuffle operation to help the information flowing across different groups. By investigating the factors that affect the practical running speed, ShuffleNet V2 [22] proposes a hardware-friendly new block. By leveraging the feature’s redundancy, GhostNet [8] replaces half channels in $1 \times 1$ convolution with cheap operations. Until now, GhostNet has been the SOTA light-weight model with a good trade-off between accuracy and speed.
+
+Besides manual design, a series of methods try to search for a light-weight architecture. For example, FBNet [39] designs a hardware-aware searching strategy, which can directly find a good trade-off between accuracy and speed on a specific hardware. Based on the inverted residual bottleneck, MnasNet [31], MobileNetV3 [12] search the architecture parameters,such as model width, model depth, convolutional filter’s size, etc. Though NAS based methods achieve high performance, their success is based on well-designed search spaces and architectural units. Automatic searching and manual design can be combined to find a better architecture.
+
+# 3 Preliminary
+
+# 3.1 A Brief Review of GhostNet
+
+GhostNet [8] is SOTA light-weight model designed for efficient inference on mobile devices. Its main component is the Ghost module, which can replace the original convolution by generating more feature maps from cheap operations. Given input feature $X \in \mathbf { \mathbb { R } } ^ { H \times W \times C }$ with height $H$ , width $W$ and channel’s number $C$ , a typical Ghost module can replace a standard convolution by two steps. Firstly, a $1 \times 1$ convolution is used to generate the intrinsic feature, i.e.,
+
+$$
+Y ^ { \prime } = X * F _ { 1 \times 1 } ,
+$$
+
+where $^ *$ denotes the convolution operation. $F _ { 1 \times 1 }$ is the point-wise convolution, and $Y ^ { \prime } \in$ $\mathbb { R } ^ { H \times W \times C _ { o u t } ^ { \prime } }$ is the intrinsic features, whose sizes are usually smaller than the original output features, i.e., $C _ { o u t } ^ { \prime } < C _ { o u t }$ . Then cheap operations (e.g., depth-wise convolution) are used to generate more features based on the intrinsic features. The two parts of features are concatenated along the channel dimension, i.e.,
+
+$$
+Y = \mathrm { C o n c a t } ( [ Y ^ { \prime } , Y ^ { \prime } * F _ { d p } ] ) ,
+$$
+
+where $F _ { d p }$ is the depth-wise convolutional filter, and $Y \in \mathbb { R } ^ { H \times W \times C _ { o u t } }$ is the output feature. Though Ghost module can reduce the computational cost significantly, the representation ability is inevitably weakened. The relationship between spatial pixels is vital to make accurate recognition. While in GhostNet, the spatial information is only captured by the cheap operations (usually implemented by $3 \times 3$ depth-wise convolution) for half of the features. The remaining features are just produced by $1 \times 1$ point-wise convolution, without any interaction with other pixels. The weak ability to capture the spatial information may prevent performance from being further improved.
+
+A block of GhostNet is constructed by stacking two Ghost modules (shown in Figure 4(a)). Similar to MobileNetV2 [28], it is also an inverted bottleneck, i.e., the first Ghost module acts as an expansion layer to increase the number of output channels, and the second Ghost module reduces the channels’ number to match the shortcut path.
+
+# 3.2 Revisit Attention for Mobile Architecture
+
+Originating from the NLP field [36], attention-based models are introduced to computer vision recently [6, 9, 34, 7]. For example, ViT [6] uses the standard transformer model stacked by self-attention modules and MLP modules. Wang et al.insert the selfattention operation into convolutional neural networks to capture the nonlocal information [37]. A typical at
+
+Table 1: The comparison of theoretical FLOPs and practical latency.
+
+
Model
Top-1 Acc. (%)
FLOPs (M)
Latency (ms)
GhostNet
73.9
141
31.1
+ Self Attention [23]
74.4
172
72.3
+ DFC Attention (Ours)
75.3
167
37.5
+
+tention module usually has a quadratic complexity w.r.t. the feature’s size, which is unscalable to high-resolution images in downstream tasks such as object detection and semantic segmentation.
+
+A mainstream strategy to reduce attention’s complexity is splitting images into multiple windows and implementing the attention operation inside windows or crossing windows. For example, Swin Transformer [21] splits the original feature into multiple non-overlapped windows, and the selfattention is calculated within the local windows. MobileViT [23] also unfolds the feature into non-overlapping patches and calculates the attention across these patches. For the 2D feature map in CNN, implementing the feature splitting and attention calculation involves plenty of tensor reshaping and transposing operations. whose theoretical complexity is negligible. In a large model (e.g., Swin-B [21] with several billion FLOPs) with high complexity, these operations only occupy a few portions of the total inference time. While for the light-weight models, their deploying latency cannot be overlooked.
+
+
+Figure 3: The information flow of DFC attention. The horizontal and vertical FC layers capture the long-range information along the two directions, respectively.
+
+For an intuitive understanding, we equip the GhostNet model with the self-attention used in MobileViT [23] and measure the latency on Huawei P30 (Kirin 980 CPU) with TFLite tool. We use the standard input’s resolution of ImageNet, i.e., $2 2 4 \times 2 2 4$ , and show the results in Table 1. The attention mechanism only adds about $20 \%$ theoretical FLOPs, but requires $2 \times$ inference time on a mobile device. The large difference between theoretical and practical complexity shows that it is necessary to design a hard-ware friendly attention mechanism for fast implementation on mobile devices.
+
+# 4 Approach
+
+# 4.1 DFC Attention for Mobile Architecture
+
+In this section, we will discuss how to design an attention module for mobile CNNs. A desired attention is expected to have the following properties:
+
+• Long-range. It is vital to capture the long-range spatial information for attention to enhance the representation ability, as a light-weight CNN (e.g., MobileNet [13], GhostNet [8]) usually adopts small convolution filters (e.g., $1 \times 1$ convolution) to save computational cost. Deployment-efficient. The attention module should be extremely efficient to avoid slowing the inference down. Expensive transformations with high FLOPs or hardware-unfriendly operations are unexpected.
+• Concept-simple. To keep the model’s generalization on diverse tasks, the attention module should be conceptually-simple with little dainty design.
+
+Though self-attention operations [6, 24, 21] can model the long-range dependence well, they are not deployment-efficient as discussed in the above section. Compared with them, fully-connected (FC) layers with fixed weights are simpler and easier to implement, which can also be used to generate attention maps with global receptive fields. The detailed computational process is illustrated as follows.
+
+Given a feature $Z ~ \in ~ \mathbb { R } ^ { H \times W \times C }$ , it can be seen as $H W$ tokens $z _ { i } ~ \in ~ \mathbb { R } ^ { C }$ , i.e., $Z =$ $\{ z _ { 1 1 } , z _ { 1 2 } , \cdots , z _ { H W } \}$ . A direct implementation of FC layer to generate the attention map is formulated as:
+
+$$
+{ \pmb a } _ { h w } = \sum _ { h ^ { \prime } , w ^ { \prime } } F _ { h w , h ^ { \prime } w ^ { \prime } } \odot { \pmb z } _ { h ^ { \prime } w ^ { \prime } } ,
+$$
+
+where $\odot$ is element-wise multiplication, $F$ is the learnable weights in the FC layer, and $A =$ $\{ { \pmb a } _ { 1 1 } , { \pmb a } _ { 1 2 } , \cdot \cdot \cdot , { \pmb a } _ { H W } \}$ is the generated attention map. Eq 3 can capture the global information by aggregating all the tokens together with learnable weights, which is much simpler than the typical self-attention [36] as well. However, its computational process still requires quadratic complexity $w . r . t .$ feature’s size $( i . e . , \mathcal { O } ( H ^ { 2 } W ^ { 2 } ) ) ^ { 2 }$ , which is unacceptable in practical scenarios especially when the input images are of high resolutions. For example, the 4-th layer of GhostNet has a feature map with 3136 $( 5 6 \times 5 6 )$ tokens, which incurs prohibitively high complexity to calculate the attention map. Actually, feature maps in a CNN are usually of low-rank [30, 17], it is unnecessary to connect all the input and output tokens in different spatial locations densely. The feature’s 2D shape naturally provides a perspective to reduce the computation of FC layers, i.e., decomposing Eq. 3 into two FC layers and aggregating features along the horizontal and vertical directions, respectively. It can be formulated as:
+
+
+Figure 4: The diagrams of blocks in GhostNetV1 and GhostNetV2. Ghost block is an inverted residual bottleneck containing two Ghost modules, where DFC attention enhances the expanded features to improve expressiveness ability.
+
+$$
+\begin{array} { l } { { \displaystyle { \pmb a } _ { h w } ^ { \prime } = \sum _ { h ^ { \prime } = 1 } ^ { H } F _ { h , h ^ { \prime } w } ^ { H } \odot { \boldsymbol z } _ { h ^ { \prime } w } , h = 1 , 2 , \cdots , H , w = 1 , 2 , \cdots , W , } } \\ { { \displaystyle { \pmb a } _ { h w } = \sum _ { w ^ { \prime } = 1 } ^ { W } F _ { w , h w ^ { \prime } } ^ { W } \odot { \boldsymbol a } _ { h w ^ { \prime } } ^ { \prime } , h = 1 , 2 , \cdots , H , w = 1 , 2 , \cdots , W , } } \end{array}
+$$
+
+where $F ^ { H }$ and $F ^ { W }$ are transformation weights. Taking the original feature $Z$ as input, Eq. 4 and Eq. 5 are applied to the features sequentially, capturing the long-range dependence along the two directions, respectively. We dub this operation as decoupled fully connected (DFC) attention, whose information flow is shown in Figure 3. Owing to the decoupling of horizontal and vertical transformations, the computational complexity of the attention module can be reduced to $\mathcal { O } ( H ^ { 2 } W + H W ^ { 2 } )$ . In the full attention (Eq. 3), all the patches in a square region participate in the calculation of the focused patch directly. In DFC attention, a patch is directly aggregated by patches in its vertical/horizontal lines, while other patches participate in the generation of those patches in the vertical/horizontal lines, having an indirect relationship with the focused token. Thus the calculation of a patch also involves all the patches in the square region.
+
+Eqs. 4 and 5 denote the general formulation of DFC attention, which aggregates pixels along horizontal and vertical directions, respectively. By sharing a part of transformation weights, it can be conveniently implemented with convolutions, leaving out the time-consuming tensor reshaping and transposing operations that affect the practical inference speed. To process input images with varying resolutions, the filter’s size can be decoupled with feature map’s size, i.e., two depth-wise convolutions with kernel sizes $1 \times K _ { H }$ and $K _ { W } \times 1$ are sequentially applied on the input feature. When implemented with convolution, the theoretical complexity of DFC attention is denoted as $\mathcal { O } ( K _ { H } H W + K _ { W } H W )$ . This strategy is well supported by tools such as TFLite and ONNX for fast inference on mobile devices.
+
+# 4.2 GhosetNet V2
+
+In this section, we use the DFC attention to improve the representation ability of lightweight models and then present the new vision backbone, GhostNetV2.
+
+Enhancing Ghost module. As discussed in 3.1, only half of features in Ghost module (Eqs. 1 and 2) interact with other pixels, which damages its ability to capture spatial information. Hence we use DFC attention to enhance Ghost module’s output feature $Y$ for capturing long-range dependence among different spatial pixels.
+
+The input feature $X \in \mathbb { R } ^ { H \times W \times C }$ is sent to two branches, i.e., one is the Ghost module to produce output feature $Y$ (Eqs. 1 and 2), and the other is the DFC module to generate attention map $A$ (Eqs. 4 and 5). Recalling that in a typical self-attention [36], linear transformation layers are used to transform input feature into query and key for calculating attention maps. Similarly, we also implement a $1 \times 1$ convolution to convert module’s input $X$ into DFC’s input $Z$ . The final output $O \in \bar { \mathbb { R } ^ { H \times W \times C } }$ of the module is the product of two branch’s output, i.e.,
+
+$$
+O = { \mathrm { S i g m o i d } } ( A ) \odot { \mathcal { V } } ( X ) ,
+$$
+
+where $\odot$ is the element-wise multiplication and Sigmoid is the scaling function to normalize the attention map $A$ into range $( 0 , 1 )$ .
+
+The information aggregation process is shown in Figure 5. With the same input, the Ghost module and DFC attention are two parallel branches extracting information from different perspectives. The output is their element-wise product, which contains information from both features of the Ghost module and attentions of the DFC attention module. The calculation of each attention value involves patches in a large range so that the output feature can contain information from these patches.
+
+Feature downsampling. As Ghost module (Eqs. 1 and 2) is an extremely efficient operation, directly paralleling the DFC attention with it will introduces extra computational cost. Hence we reduce the feature’s size by down-sampling it both horizontally and vertically, so that all the operations in DFC attention can be conducted on the smaller features. By default, the width and height are both scaled to half of their original lengths, which reduces $7 5 \%$ FLOPs of DFC attention. Then produced feature map is then upsampled to the original size to match the feature’s size in Ghost branch. We naively use the average pooling and bilinear interpolation for downsampling and upsampling, respectively. Noticing that directly implementing sigmoid (or hard sigmoid) function will incur longer latency, we also deploy
+
+
+Figure 5: The information aggregation process of different patches.
+
+the sigmoid function on the downsampled features to accelerate practical inference. Though the value of attention maps may not be limited in range (0,1) strictly, we empirically find that its impact on the final performance is negligible.
+
+GhostV2 bottleneck. GhostNet adopts an inverted residual bottleneck containing two Ghost modules, where the first module produces expanded features with more channels, while the second one reduces channel’s number to get output features. This inverted bottleneck naturally decouples the “expressiveness” and “capacity” of a model [28]. The former is measured by the expanded features while the latter is reflected by the input/output domains of a block. The original Ghost module generates partial features via cheap operations, which damages both the expressiveness and the capacity. By investigating the performance difference of equipping DFC attention on the expanded features or output features (Table 8 in Section 5.4), we find that enhancing ‘expressiveness’ is more effective. Hence we only multiply the expanded features with DFC attention.
+
+Figure 4(b) shows the diagram of GhostV2 bottleneck. A DFC attention branch is parallel with the first Ghost module to enhance the expanded features. Then the enhanced features are sent to the second Ghost module for producing output features. It captures the long-range dependence between pixels in different spatial locations and enhances the model’s expressiveness.
+
+Table 2: Comparison of SOTA light-weight models over classification accuracy, the number of parameters and FLOPs on ImageNet dataset.
+
+
Model
Params (M)
FLOPs (M)
Top-1 Acc. (%)
Top-5 Acc. (%)
MobileNetV1 0.5× [13]
1.3
150
63.3
84.9
MobileNetV2 0.6× [28]
2.2
141
66.7
-
ShuffleNetV11.0× (g=3) [42]
1.9
138
67.8
87.7
ShuffleNetV21.0× [22]
2.3
146
69.4
88.9
MobileNetV3-L 0.75×[12]
4.0
155
73.3
1
GhostNetV11.0× [8]
5.2
141
73.9
91.4
GhostNetV1 1.1× [8]
5.9
168
74.5
92.0
GhostNetV2 1.0×
6.1
167
75.3
92.4
MobileNetV11.0×[13]
4.2
575
70.6
-
MobileNetV21.0× [28]
3.5
300
72.8
90.8
ShuffleNetV21.5× [22]
3.5
299
72.6
90.6
FE-Net 1.0× [3]
3.7
301
72.9
FBNet-B [39]
4.5
295
74.1
-
ProxylessNAS[1]
4.1
320
74.6
- 92.2
MnasNet-A1[31]
3.9
312
75.2
92.5
MnasNet-A2 [31]
4.8
340
75.6
92.7
MobileNetV3-L 1.0×[12]
5.4
219
75.2
-
MobileNeXt 1.0× [44]
3.4
300
74.0
MobileNeXt+ 1.0× [44]
3.94
330
76.1
=
GhostNetV1 1.3× [8]
7.3
226
75.7
=
GhostNetV1 1.4× [8]
8.2
264
76.1
92.7
GhostNetV2 1.3×
8.9
269
76.9
92.9 93.4
FBNet-C[39] EfficientNet-B0[32]
5.5
375
74.9
-
5.3
390
77.1
93.3
MnasNet-A3 [31]
5.2
403
76.7
93.3
MobileNetV3-L 1.25×[12]
7.5
355
76.6
-
MobileNeXt+ 1.1× [44]
4.28
420
76.7
=
MobileViT-XS[23]
2.3
700
74.8
-
GhostNetV1 1.7× [8]
11.0
378
77.2
93.4
GhostNetV2 1.6×
12.3
399
77.8
93.8
+
+# 5 Experiments
+
+In this section, we empirically investigate the proposed GhostNetV2 model. We conduct experiments on the image classification task with the large-scale ImageNet dataset [5]. To validate its generalization, we use GhostNetV2 as backbone and embed it into a light-weight object detection scheme YOLOV3 [26]. Models with different backbone are compared on MS COCO dataset [20]. At last, we conduct extensive ablation experiments for better understanding GhostNetV2. The practical latency is measured on Huawei P30 (Kirin 980 CPU) with TFLite tool.
+
+# 5.1 Image Classification on ImageNet
+
+Setting. The classification experiments are conducted on the benchmark ImageNet (ILSVRC 2012) dataset, which contains 1.28M training images and 50K validation images from 1000 classes. We follow the training setting in [8] and report results with single crop on ImageNet dataset. All the experiments are conducted with PyTorch [25] and MindSpore [15].
+
+Results. The performance comparison of different models on ImageNet is shown in Table 2, Figure 1 and Figure 2. Several light-weight models are selected as the competing methods. GhostNet [8], MobileNetV2 [28], MobileNetV3 [12], and ShuffleNet [42] are widely-used light-weight CNN models with SOTA performance. By combing CNN and Transformer, MobileViT [24] is a new backbone presented recently. Compared with them, GhostNetV2 achieves significantly higher performance with lower computational cost. For example, GhostNetV2 achieves $7 5 . 3 \%$ top-1 accuracy with only 167 FLOPs, which significantly outperform GhostNet V1 $( 7 4 . 5 \% )$ with similar computational cost (167M FLOPs).
+
+Table 3: Results of object detection on MS COCO dataset. YOLOv3 [26] is used as the detection head.
+
+
Backbone
Resolution
Backbone FLOPs (M)
AP
AP50
AP75
APs
APM
APL
MobileNetV2 1.0×[28] GhostNet V1 1.1×
320× 230
613 338
22.2 21.8
41.9 41.2
21.4 20.8
6.0 5.7
23.6 22.3
35.8 37.3
GhostNetV2 1.0×
342
22.3
41.4
21.9
6.0
22.8
38.1
MobileNetV2 1.0× [28]
416 × 416
1035
23.9
45.4
22.6
10.6
25.1
34.9
GhostNet V1 1.1×
567
23.4
45.2
21.9
9.8
24.4
34.9
GhostNetV2 1.0×
571
24.1
45.7
23.0
10.4
25.0
36.1
+
+Table 4: Effectiveness of DFC attention with MobileNetV2 on ImageNet dataset.
+
+
Model
Params (M)
FLOPs (M)
Top-1 Acc. (%)
Top-5 Acc. (%)
MobileNetV2 1.0 ×
3.5
300
72.8
90.8
MobileNetV2 1.1 ×
4.1
338
73.0
90.0
MobileNetV21.1 × + SE[14]
4.0
338
73.8
91.0
MobileNetV21.1 × +CBAM[38]
4.0
338
74.0
91.4
MobileNetV2 1.1 × + CA[11]
4.1
350
74.5
91.8
MobileNetV2 1.0 × + DFC (Ours)
4.3
344
75.4
92.4
+
+Practical Inference Speed. Considering the light-weight model is designed for mobile applications, we practically measure the inference latency of different models on an arm-based mobile phone, using the TFLite tool [4]. Owing to the deploying efficiency of DFC attention, GhostNetV2 also achieves a good trade-off between accuracy and practical speed. For example, with similar inference latency (e.g., $3 7 ~ \mathrm { m s }$ ), GhostNetV2 achieves $7 5 . 3 \%$ top-1 accuracy, which is obviously GhostNet V1 with $7 4 . 5 \%$ top-1 accuracy.
+
+# 5.2 Object Detection on COCO
+
+Setting. To validate the generalization of GhostNetV2, we further conduct experiments on the object detection task. The experiments are conducted on MS COCO 2017 dataset, composing of $1 1 8 \mathrm { k }$ training images and $5 \mathrm { k }$ validation images. We embed different backbone into a widely-used detection head, YOLOv3 [26] and follow the default training strategy provided by MMDetection 3. Specifically, based on the pre-trained weights on ImageNet, the models are fine-tuned with SGD optimizer for 30 epochs. The batchsize is set to 192 and initial learning to 0.003. The experiments are conducted with input resolutions $3 2 0 \times 3 2 0$ .
+
+Results. Table 3 compares the proposed GhostNetV2 model with GhostNet V1. With different input resolutions, GhostNetV2 shows obvious superiority to the GhostNet V1. For example, with similar computational cost (i.e., 340M FLOPs with $3 2 0 \times 3 2 0$ input resolution), GhostNetV2 achieves $2 2 . 3 \%$ mAP, which suppresses GhostNet V1 by $0 . 5 \mathrm { m A P } .$ . We conclude that capturing the long-range dependence is also vital for downstream tasks, and the proposed DFC attention can effectively endow a large receptive field to the Ghost module, and then construct a more powerful and efficient block.
+
+# 5.3 Semantic Segmentation on ADE20K
+
+We conduct semantic segmentation experiments on ADE20K [43], which contains $2 0 \mathrm { k }$ training, 2k validation, and 3k testing images with 150 semantic categories. We use the DeepLabV3 [2] model as the segmentation head, and follow the default training setting of MMSegmentation 4. From the pre-trained weights on ImageNet, the models are fine-tuned for 160000 iterations with crop size $5 1 2 \times 5 1 2$ . Table 5 show the results with different backbones. In the semantic tasks, GhostNetV2 also achieves significantly higher performance than GhostNetV1, which illustrates the university of GhostNetV2 over different tasks.
+
+Table 5: Results of semantic segmentation on ADE20K dataset.
+
+
+
+Table 7: The location for implementing DFC attention.
+
+
Stage
Top1-Acc. (%)
Params (M)
FLOPs (M)
None
73.9
5.2
141
1
74.8
5.3
150
2
75.0
5.4
152
3
74.7
5.8
147
All
75.3
5.8
168
+
+Table 8: Enhancing expressiveness or capacity.
+
+
Model
Top1-Acc. (%)
Params (M)
FLOPs (M)
Baseline
73.9 (+0.0)
5.2
141
Expressiveness
75.3 (+1.4)
6.1
167
Capacity
74.8 (+0.9)
6.1
162
Both
75.5 (+1.6)
7.0
188
+
+# 5.4 Ablation Studies
+
+In this section, we conduct extensive experiments to investigate the impact of each component in GhostNetV2. The experiments are conducted with GhostNetV2 $1 \times$ on ImageNet.
+
+Experiments with other models. As a universal module, the DFC attention can also be embedded into other architectures for enhancing their performance. The resultsof MobileNetV2 with different attention modules are shown in Table 4. SE [14] and CBAM [38] are two widely-used attention modules, and CA [11] is a SOTA method presented recently. The proposed DFC attention achieves higher performance than these existing methods. For example, the proposed DFC attention improves the top-1 accuracy of MobileNetV2 by $2 . 4 \%$ , which suppresses CA $( 1 . 5 \% )$ by a large margin.
+
+The impact of kernel size in DFC attention. We split the GhostNetV2 architecture into 3 stages by the feature’s size, and apply
+
+Table 6: The impact of kernel size in DFC attention.
+
+
Kernel sizes
Top1-Acc. (%)
(3,3,3) (7,5,5) (7,7,5) (9,7,5)
74.8 75.0 74.2
+
+DFC attention with different kernel size (Table 6). The kernel sizes $1 \times 3$ and $3 \times 1$ cannot capture the long-range dependence well, which results in the worst performance (i.e., $7 4 . 8 \%$ ). Increasing the kernel size to capture the longer range information can significantly improve the performance.
+
+The location for implementing DFC attention. The GhostNetV2 model can be split into 4 stages by the feature’s size, and we empirically investigate how the implementing location affects the final performance. The results are shown in Table 7, which empirically shows that the DFC attention can improve performance when implementing it on any stage. Exhaustively adjusting or searching for proper locations has the potential to further improve the trade-off between accuracy and computational cost, which exceeds the scope of this paper. By default, we deploy the DFC attention on all the layers.
+
+Table 9: The impact of scaling function. ‘BF’ and ‘AF’ denote implementing the scaling function before or after the up-sampling operation, respectively.
+
+
Scaling function
Top1-Acc. (%)
FLOPs (M)
Latency (ms)
Sigmoid (BF)
75.3
167
37.5
Hard simoid (BF)
75.2
167
36.8
Clip (BF)
74.9
167
36.7
Sigmoid (AF)
75.3
167
40.7
Hard simoid (AF)
75.2
167
39.6
Clip (AF)
75.0
167
38.5
+
+The impact of scaling function. For an attention model, it is necessary to scale the feature maps into range (0,1), which can stabilize the training process. Though the theoretical complexity is negligible, these element-wise operations still incur extra latency. Table 9 investigates how the scaling function affects the final performance and latency. Though sigmoid and hard sigmoid functions bring obvious performance improvement, directly implementing them on the large feature maps incur long latency.
+
+Implementing them before up-sampling is much more efficient but results in similar accuracy. By default, we use the sigmoid function and put it before the up-sampling operation.
+
+Enhancing expressiveness or capacity. We implement the DFC attention on two Ghost modules and show the results in Table 8. As discussed in Section 4.2, the former enhances expanded features (expressiveness) while the latter improves the block’s capacity. With similar computational costs, enhancing the expanded features brings $1 . 4 \%$ top-1 accuracy improvement, which is much higher than enhancing the output feature. Though enhancing both of the features can further improve the performance, the computational cost also increases accordingly. By default, we only enhance the expanded features in an inverse residual bottleneck.
+
+The resizing functions for up-sampling and down-sampling. Multiple functions can conduct the up-sampling and downsampling operations, and we investigate several widely-used functions, i.e., average pooling, max pooling, bilinear interpolation for down-sampling, and bilinear, bicubic interpolations for up-sampling (Table 10). The performance of GhostNetV2 is robust to the choice of resizing functions, i.e., all of these methods achieve similar accuracies in ImageNet. Their differences mainly lie in practical deploying efficiency
+
+Table 10: The resizing functions for down-sampling and up-sampling, denoted as $ { ^ 6 } \mathrm { D } ^ { \prime }$ and ‘U’, respectively.
+
+
Resizing function
Top1-Acc. (%)
FLOPs (M)
Latency (ms)
Average Pooling (D)
75.4
167
38.4
Max Pooling (D)
75.3
167
37.5
Bilinear (D)
75.3
167
38.7
Bilinear (U)
75.3
167
37.5
Bicubic (U)
75.4
167
39.9
+
+on mobile devices. Maxing pooling is slightly more efficient than average pooling (37.5 ms vs.38.4 ms), and bilinear interpolation is faster than the bicubic one $( 3 7 . 5 \ \mathrm { m s } \ \nu s . 3 9 . 9 \ \mathrm { m s } )$ . Thus we choose the maxing pooling for down-sampling and bilinear interpolation for up-sampling by default.
+
+Visualization of decoupled attention and full attention. We visualize the decoupled attention produced by stacking vertical and horizontal attentions and compare it with full attention. In low layers, the decoupled attention shows some cross-shaped patterns, indicating patches from the vertical/horizontal lines participate more. As the depth increases, the pattern of the attention map diffuses and becomes more similar to the full attention.
+
+
+Figure 6: Visualization of attention maps.
+
+# 6 Conclusion
+
+This paper proposes a hardware-friendly DFC attention and presents a new GhostNetV2 architecture for mobile applications. The DFC attention can capture the dependence between pixels in long-range spatial locations, which significantly enhances the expressiveness ability of light-weight models. It decomposes a FC layer into horizontal FC and vertical FC, which has large receptive fields along the two directions, respectively. Equipped this computation-efficient and deployment-simple modules, GhostNetV2 can achieve a better trade-off between accuracy and speed. Extensive experiments on benchmark datasets (e.g., ImageNet, MS COCO) validate the superiority of GhostNetV2.
+
+Acknowledgment. This work is supported by National Natural Science Foundation of China under Grant No.61876007, Australian Research Council under Project DP210101859 and the University of Sydney SOAR Prize. We gratefully acknowledge the support of MindSpore, CANN(Compute Architecture for Neural Networks) and Ascend AI Processor used for this research.
+
+# References
+
+[1] Han Cai, Ligeng Zhu, and Song Han. Proxylessnas: Direct neural architecture search on target task and hardware. In ICLR, 2019.
+[2] Liang-Chieh Chen, George Papandreou, Florian Schroff, and Hartwig Adam. Rethinking atrous convolution for semantic image segmentation. arXiv preprint arXiv:1706.05587, 2017. [3] Weijie Chen, Di Xie, Yuan Zhang, and Shiliang Pu. All you need is a few shifts: Designing efficient convolutional neural networks for image classification. In CVPR, 2019. [4] Robert David, Jared Duke, Advait Jain, Vijay Janapa Reddi, Nat Jeffries, Jian Li, Nick Kreeger, Ian Nappier, Meghna Natraj, Tiezhen Wang, et al. Tensorflow lite micro: Embedded machine learning for tinyml systems. Proceedings of Machine Learning and Systems, 3:800–811, 2021. [5] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248–255. Ieee, 2009. [6] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. [7] Kai Han, Jianyuan Guo, Yehui Tang, and Yunhe Wang. Pyramidtnt: Improved transformer-in-transformer baselines with pyramid architecture. arXiv preprint arXiv:2201.00978, 2022. [8] Kai Han, Yunhe Wang, Qi Tian, Jianyuan Guo, Chunjing Xu, and Chang Xu. Ghostnet: More features from cheap operations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1580–1589, 2020. [9] Kai Han, An Xiao, Enhua Wu, Jianyuan Guo, Chunjing Xu, and Yunhe Wang. Transformer in transformer. Advances in Neural Information Processing Systems, 34:15908–15919, 2021.
+[10] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
+[11] Qibin Hou, Daquan Zhou, and Jiashi Feng. Coordinate attention for efficient mobile network design. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13713– 13722, 2021.
+[12] Andrew Howard, Mark Sandler, Grace Chu, Liang-Chieh Chen, Bo Chen, Mingxing Tan, Weijun Wang, Yukun Zhu, Ruoming Pang, Vijay Vasudevan, et al. Searching for mobilenetv3. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1314–1324, 2019.
+[13] 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 arXiv:1704.04861, 2017.
+[14] Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7132–7141, 2018.
+[15] Huawei. Mindspore. https://www.mindspore.cn/, 2020.
+[16] Forrest N Iandola, Song Han, Matthew W Moskewicz, Khalid Ashraf, William J Dally, and Kurt Keutzer. Squeezenet: Alexnet-level accuracy with $5 0 \mathrm { x }$ fewer parameters and $< 0 . 5 \mathrm { m b }$ model size. arXiv preprint arXiv:1602.07360, 2016.
+[17] Max Jaderberg, Andrea Vedaldi, and Andrew Zisserman. Speeding up convolutional neural networks with low rank expansions. arXiv preprint arXiv:1405.3866, 2014.
+[18] Andrej Karpathy, George Toderici, Sanketh Shetty, Thomas Leung, Rahul Sukthankar, and Li Fei-Fei. Large-scale video classification with convolutional neural networks. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pages 1725–1732, 2014.
+[19] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25, 2012.
+[20] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740–755. Springer, 2014.
+[21] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 10012–10022, 2021.
+[22] Ningning Ma, Xiangyu Zhang, Hai-Tao Zheng, and Jian Sun. Shufflenet v2: Practical guidelines for efficient cnn architecture design. In Proceedings of the European conference on computer vision (ECCV), pages 116–131, 2018.
+[23] Sachin Mehta and Mohammad Rastegari. Mobilevit: light-weight, general-purpose, and mobile-friendly vision transformer. arXiv preprint arXiv:2110.02178, 2021.
+[24] Sachin Mehta and Mohammad Rastegari. Mobilevit: Light-weight, general-purpose, and mobile-friendly vision transformer. In International Conference on Learning Representations, 2022.
+[25] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32, 2019.
+[26] Joseph Redmon and Ali Farhadi. Yolov3: An incremental improvement. arXiv preprint arXiv:1804.02767, 2018.
+[27] Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. Advances in neural information processing systems, 28, 2015.
+[28] Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4510–4520, 2018.
+[29] Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1–9, 2015.
+[30] Cheng Tai, Tong Xiao, Yi Zhang, Xiaogang Wang, et al. Convolutional neural networks with low-rank regularization. arXiv preprint arXiv:1511.06067, 2015.
+[31] Mingxing Tan, Bo Chen, Ruoming Pang, Vijay Vasudevan, Mark Sandler, Andrew Howard, and Quoc V Le. Mnasnet: Platform-aware neural architecture search for mobile. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2820–2828, 2019.
+[32] Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International conference on machine learning, pages 6105–6114. PMLR, 2019.
+[33] Yehui Tang, Kai Han, Jianyuan Guo, Chang Xu, Yanxi Li, Chao Xu, and Yunhe Wang. An image patch is a wave: Phase-aware vision mlp. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10935–10944, 2022.
+[34] Yehui Tang, Kai Han, Chang Xu, An Xiao, Yiping Deng, Chao Xu, and Yunhe Wang. Augmented shortcuts for vision transformers. Advances in Neural Information Processing Systems, 34:15316–15327, 2021.
+[35] Yehui Tang, Yunhe Wang, Yixing Xu, Dacheng Tao, Chunjing Xu, Chao Xu, and Chang Xu. Scop: Scientific control for reliable neural network pruning. Advances in Neural Information Processing Systems, 33:10936–10947, 2020.
+[36] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017.
+[37] Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7794–7803, 2018.
+[38] Sanghyun Woo, Jongchan Park, Joon-Young Lee, and In So Kweon. Cbam: Convolutional block attention module. In Proceedings of the European conference on computer vision (ECCV), pages 3–19, 2018.
+[39] Bichen Wu, Xiaoliang Dai, Peizhao Zhang, Yanghan Wang, Fei Sun, Yiming Wu, Yuandong Tian, Peter Vajda, Yangqing Jia, and Kurt Keutzer. Fbnet: Hardware-aware efficient convnet design via differentiable neural architecture search. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10734–10742, 2019.
+[40] Yixing Xu, Kai Han, Chang Xu, Yehui Tang, Chunjing Xu, and Yunhe Wang. Learning frequency domain approximation for binary neural networks. Advances in Neural Information Processing Systems, 34:25553–25565, 2021.
+[41] Yixing Xu, Yunhe Wang, Hanting Chen, Kai Han, Chunjing Xu, Dacheng Tao, and Chang Xu. Positiveunlabeled compression on the cloud. Advances in Neural Information Processing Systems, 32, 2019.
+[42] Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, and Jian Sun. Shufflenet: An extremely efficient convolutional neural network for mobile devices. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 6848–6856, 2018.
+
+[43] Bolei Zhou, Hang Zhao, Xavier Puig, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Scene parsing through ade20k dataset. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 633–641, 2017.
+
+[44] Daquan Zhou, Qibin Hou, Yunpeng Chen, Jiashi Feng, and Shuicheng Yan. Rethinking bottleneck structure for efficient mobile network design. In European Conference on Computer Vision, pages 680–697. Springer, 2020.
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] See Section 1.
+(b) Did you describe the limitations of your work? [Yes]
+(c) Did you discuss any potential negative societal impacts of your work? [No] No potential negative societal impacts.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes]
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No]
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes]
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [No]
+(c) Did you include any new assets either in the supplemental material or as a URL? [No]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/voV_TRqcWh/voV_TRqcWh.md b/md/dev/voV_TRqcWh/voV_TRqcWh.md
new file mode 100644
index 0000000000000000000000000000000000000000..89f45923002cc452d07b2a5ebd6bec464c7ae292
--- /dev/null
+++ b/md/dev/voV_TRqcWh/voV_TRqcWh.md
@@ -0,0 +1,299 @@
+# Poisson Flow Generative Models
+
+Yilun Xu∗ , Ziming Liu∗ , Max Tegmark, Tommi Jaakkola Massachusetts Institute of Technology ylxu, zmliu, tegmark @mit.edu; tommi@csail.mit.edu
+
+# Abstract
+
+We propose a new “Poisson flow” generative model (PFGM) that maps a uniform distribution on a high-dimensional hemisphere into any data distribution. We interpret the data points as electrical charges on the $z = 0$ hyperplane in a space augmented with an additional dimension $z$ , generating a high-dimensional electric field (the gradient of the solution to Poisson equation). We prove that if these charges flow upward along electric field lines, their initial distribution in the $z \ = \ 0$ plane transforms into a distribution on the hemisphere of radius $r$ that becomes uniform in the $r \infty$ limit. To learn the bijective transformation, we estimate the normalized field in the augmented space. For sampling, we devise a backward ODE that is anchored by the physically meaningful additional dimension: the samples hit the (unaugmented) data manifold when the $z$ reaches zero. Experimentally, PFGM achieves current state-of-the-art performance among the normalizing flow models on CIFAR-10, with an Inception score of 9.68 and a FID score of 2.35. It also performs on par with the state-of-the-art SDE approaches while offering $1 0 \times$ to $2 0 \times$ acceleration on image generation tasks. Additionally, PFGM appears more tolerant of estimation errors on a weaker network architecture and robust to the step size in the Euler method. The code is available at https: //github.com/Newbeeer/poisson_flow.
+
+# 1 Introduction
+
+Deep generative models are a prominent approach for data generation, and have been used to produce high quality samples in image [1], text [2] and audio [35], as well as improve semi-supervised learning [20], domain generalization [25] and imitation learning [15]. However, current deep generative models also have limitations, such as unstable training objectives (GANs [1, 12, 17]) and low sample quality (VAEs [21], normalizing flows [6]). New techniques [12, 24] are introduced to stablize the training of CNN-based or ViT-based GAN models. Although recent advances on diffusion [16] and scored-based models [33] achieve comparable sample quality to GAN’s without adversarial training, these models have a slow stochastic sampling process. [33] proposes backward ODE samplers (normalizing flow) that speed up the sampling process but these methods have not yet performed on par with the SDE counterparts.
+
+We present a new “Poisson flow” generative model (PFGM), exploiting a remarkable physics fact that generalizes to $N$ dimensions. As illustrated in Fig. 1(a), motion in a viscous fluid transforms any planar charge distribution into a uniform angular distribution. Specifically, we interpret $N$ - dimensional data points $\mathbf { x }$ (images, say) as positive electric charges in the $z \ = \ 0$ plane of an $N + 1$ -dimensional space (see Fig. 1(a)) filled with a viscous liquid (say honey). A positive charge with $z > 0$ will be repelled by the other charges and move in the direction of their repulsive force, eventually crossing an imaginary hemisphere of radius $r$ . We show that, remarkably, if the the original charge distribution is let loose just above $z = 0$ , this law of motion will cause a uniform distribution for their hemisphere crossings in the $r \infty$ limit.
+
+
+Figure 1: (a) 3D Poisson field trajectories for a heart-shaped distribution (b) The evolvements of a distribution (top) or an (augmented) sample (bottom) by the forward/backward ODEs pertained to the Poisson field.
+
+Our Poisson flow generative process reverses the forward process: we generate a uniform distribution of negative charges on the hemisphere, then track their motion back to the $z = 0$ plane, where they will be distributed as the data distribution. A Poisson flow can be viewed as a type of continuous normalizing flows [4, 10, 33] in the sense that it continuously maps between an arbitrary distribution and an easily sampled one: in the previous works an $N$ -dimensional Gaussian and in PFGM a uniform distribution on an $N$ -dimensional hemisphere. In practice, we implement the Poisson flow by solving a pair of forward/backward ordinary differential equations (ODEs) induced by the electric field (Fig. 1(b)) given by the $N$ -dimensional version of Coulomb’s law (the gradient of the solution to the Poisson’s equation with the data as sources). We will interchangeably refer to this gradient as the Poisson field, since electric fields normally refer to the special case $N = 3$ .
+
+The proposed generative model PFGM has a stable training objective and empirically outperforms previously state-of-the-art continuous flow methods [30, 33]. As a different iterative method, PFGM offers two advantages compared to score-based methods [32, 33]. First, the ODE process of PFGM achieves faster sampling speeds than the SDE samplers in [33]. while retaining comparable performance. Second, our backward ODE exhibits better generation performance than the reverse-time ODEs of VE/VP/sub-VP SDEs [33], as well as greater stability on a weaker architecture NSCNv2 [32]. The rationale for robustness is that the time variables in these ODE baselines are strongly correlated with the sample norms during training time, resulting in a less error-tolerant inference. In contrast, the tie between the anchored variable and the sample norm in PFGM is much weaker.
+
+Experimentally, we show that PFGM achieves current state-of-the-art performance on CIFAR-10 dataset in the normalizing flow family, with FID/Inception scores of $2 . { \bar { 4 } } 8 / 9 . 6 5$ (w/ $\mathrm { { D D P M + + } }$ [33]) and $2 . 3 5 / 9 . 6 8$ (w/ $\mathrm { { D D P M + + } }$ deep [33]). It performs competitively with current state-of-the-art SDE samplers [33] and provides $1 0 \times$ to $2 0 \times$ speed up across datasets. Notably, the backward ODE in PFGM is the only ODE-based sampler that can produce decent samples on its own on NCSNv2 [32], while other ODE baselines fail without corrections. In addition, PFGM demonstrates the robustness to the step size in the Euler method, with a varying number of function evaluations (NFE) ranging from 10 to 100. We further showcase the utility of the invertible forward/backward ODEs of the Poisson field on likelihood evaluation and image manipulations, and its scalability to higher resolution images on LSUN bedroom $2 5 6 \times 2 5 6$ dataset.
+
+# 2 Background and Related works
+
+Poisson equation Let $\mathbf { x } \in \mathbb { R } ^ { N }$ and $\rho ( \mathbf { x } ) : \mathbb { R } ^ { N } \mathbb { R }$ be a source function. We assume that the source function has a compact support, $\rho \in \mathcal { C } ^ { 0 }$ and $N \geq 3$ . The Poisson equation is
+
+$$
+\nabla ^ { 2 } \varphi ( \mathbf { x } ) = - \rho ( \mathbf { x } ) ,
+$$
+
+where $\varphi ( \mathbf { x } ) : \mathbb { R } ^ { N } \mathbb { R }$ is called the potential function, and $\begin{array} { r } { \bigtriangledown ^ { 2 } \equiv \sum _ { i = 1 } ^ { N } \frac { \partial ^ { 2 } } { \partial x _ { i } ^ { 2 } } } \end{array}$ is the Laplacian operator. It is usually helpful to define the gradient field $\mathbf { E } ( \mathbf { x } ) = - \nabla \varphi ( \mathbf { x } )$ and rewrite the Poisson equation as $\nabla \cdot \mathbf { E } = \rho$ , known in physics as Gauss’s law [11]. The Poisson equation is widely used in physics, giving rise to Newton’s gravitational theory [9] and the electrostatic theory [11], when $\rho ( \mathbf { x } )$ is interpreted as mass density or electric charge density, respectively. $\mathbf { E }$ is the $N$ -dimensional analog of the electric field. The Poisson equation Eq. (1) (with zero boundary condition at infinity) admits a unique simple integral solution 2:
+
+$$
+\varphi ( \mathbf { x } ) = \int G ( \mathbf { x } , \mathbf { y } ) \rho ( \mathbf { y } ) d \mathbf { y } , \quad G ( \mathbf { x } , \mathbf { y } ) = \frac { 1 } { ( N - 2 ) S _ { N - 1 } ( 1 ) } \frac { 1 } { | | \mathbf { x } - \mathbf { y } | | ^ { N - 2 } } ,
+$$
+
+where $S _ { N - 1 } ( 1 )$ is a geometric constant representing the surface area of the unit $( N - 1 )$ -sphere 3, and $G ( \mathbf { x } , \mathbf { y } )$ is the extension of Green’s function in $N$ -dimensional space (details in Appendix A.3). The negative gradient field of $\varphi ( \mathbf x )$ , referred as Poisson field of the source $\rho$ , is
+
+$$
+\mathbf { E } ( \mathbf { x } ) = - \nabla \varphi ( \mathbf { x } ) = - \int \nabla _ { \mathbf { x } } G ( \mathbf { x } , \mathbf { y } ) \rho ( \mathbf { y } ) d \mathbf { y } , \quad \nabla _ { \mathbf { x } } G ( \mathbf { x } , \mathbf { y } ) = - \frac { 1 } { S _ { N - 1 } ( 1 ) } \frac { \mathbf { x } - \mathbf { y } } { \left\| \mathbf { x } - \mathbf { y } \right\| ^ { N } } .
+$$
+
+Qualitatively, the Poisson field $\mathbf { E } ( \mathbf { x } )$ points away from sources, or equivalently $- \mathbf { E } ( \mathbf { x } )$ points towards sources, as illustrated in Fig. 1. It is straightforward to check that when $\rho ( { \bf x } ) \delta ( { \bf x - y } )$ , we get $\varphi ( \mathbf x ) G ( \mathbf x , \mathbf y )$ and $\mathbf { E } ( \mathbf { x } ) - \nabla _ { \mathbf { x } } G ( \mathbf { x } , \mathbf { y } )$ . This implies that $G ( \mathbf { x } , \mathbf { y } )$ and $- \nabla _ { \mathbf { x } } G ( \mathbf { x } , \mathbf { y } )$ can be interpreted as the potential function and the gradient field generated by a unit point source, e.g., a point charge, located at $\mathbf { y }$ . When $\rho ( \mathbf { x } )$ takes general forms but has bounded support, simple asymptotics exist for $\left\| \mathbf { x } \right\| \gg \left\| \mathbf { y } \right\|$ . To the lowest order, $\mathbf { E ( x ) } = \nabla _ { \mathbf { x } } G ( \mathbf { x } , \mathbf { y } ) | _ { \mathbf { y } = \mathbf { 0 } } \sim \mathbf { x } / \| \mathbf { x } \| ^ { N }$ behaves as if it were generated by a unit point source at $\mathbf y = 0$ . In physics, the power law decay is considered to be long-range (compared to exponential decay) [11].
+
+Particle dynamics in a Poisson field The Poisson field immediately defines a flow model, where the probability distribution evolves according to the gradient flow $\partial p _ { t } ( \mathbf { x } ) / \partial t = - \nabla \cdot ( p _ { t } ( \mathbf { x } ) \mathbf { E } ( \mathbf { x } ) )$ . The gradient flow is a special case of the Fokker-Planck equation [28], where the diffusion coefficient is zero. Intuitively we can think of $p _ { t } ( \mathbf { x } )$ as represented by a population of particles. The corresponding (non-diffusion) case of the Ito process is the forward ODE ˆ $\begin{array} { r } { \frac { d \mathbf { x } } { d t } \ = \ \mathbf { E } ( \mathbf { x } ) } \end{array}$ . We can interpret the trajectories of the ODE as particles moving according to the Poisson field $\mathbf { E } ( x )$ , with initial states drawn from $p _ { 0 }$ . The physical picture of the forward ODE is a charged particle under the influence of electric fields in the overdamped limit (details in Appendix F).
+
+The dynamics is also rescalable in the sense that the particle trajectory remains the same for $\pm f ( \mathbf { x } ) \mathbf { E } ( \mathbf { x } )$ for $f ( \mathbf { x } ) > 0 , f ( \mathbf { x } ) \in \mathcal { C } ^ { 1 }$ , because the time rescaling $d t \to f ( \mathbf { x } ( t ) ) d t$ recovers $\begin{array} { r } { \frac { d \mathbf { x } } { d t } \ = } \end{array}$ $\begin{array} { r } { \frac { d { \mathbf { x } } } { d t } = } \end{array}$ $\pm \mathbf { E } ( \mathbf { x } )$ . Note that the dynamics is stiff due to the power law factor in the denominator in Eq. (3), posing computational challenges. Luckily the rescalablility allows us to rescale $\mathbf { E } ( \mathbf { x } )$ properly to get new ODEs (formally defined later in Section 3.3) that are more amenable for sampling.
+
+Generative Modeling via ODE Generative modeling can be done by transforming a base distribution to a data distribution via mappings defined by ODEs. The ODE-based samplers allow for adaptive sampling, exact likelihood evaluation and modeling of continuous-time dynamics [4, 33]. Previous works broadly fall into two lines. [4, 3] introduce a continuous-time normalizing flow model that can be trained with maximum likelihood by the instantaneous change-of-variables formula [4]. For sampling, they directly integrate the learned invertiable mapping over time. Another work [33] unifies the scored-based model [31, 32] and diffusion model [16] into a general diffusion process, and uses the reverse-time ODE of the diffusion process for sampling. They show that the reverse-time ODE produces high quality samples with improved architecture.
+
+# 3 Poisson Flow Generative Models
+
+In this section, we start with the properties of the Poisson flow in the augmented space and show how to draw samples from the data distribution by following the backward ODE of the Poisson flow (Section 3.1). We then discuss how to actually learn a normalized Poisson field from data samples through simulations of the forward ODE (Section 3.2) and present an equivalent backward ODE that allows for exponentially decay on $z$ (Section 3.3).
+
+
+Figure 2: (a) Poisson field (black arrows) and particle trajectories (blue lines) of a 2D uniform disk (red). Left (no augmentation, 2D): all particles collapse to the disk center. Right (augmentation, 3D): particles hit different points on the disk. (b) Proof idea of Theorem 1. By Gauss’s Law, the outflow flux $d \Phi _ { o u t }$ equals the inflow flux $d \Phi _ { i n }$ . The factor of two in $p ( \mathbf { x } ) d A / 2$ is due to the symmetry of Poisson fields in $z < 0$ and $z > 0$ .
+
+# 3.1 Augment the data with additional dimension
+
+We wish to generate samples $\mathbf { x } \in \mathbb { R } ^ { N }$ from a distribution $p ( \mathbf { x } )$ supported on a bounded region. We may set the source $\rho ( \mathbf { x } ) = p ( \mathbf { x } ) \in \mathcal { C } ^ { 0 \ }$ 4 and compute the resulting gradient field $\mathbf { E } ( \mathbf { x } )$ from Eq. (3). Since $- \mathbf { E } ( \mathbf { x } )$ points towards sources, the backward ODE ${ d { \bf x } } / { d t } = - { \bf E } ( { \bf x } )$ will take samples close to the sources. One may naively hope that the backward ODE is a generative model that recovers $p ( \mathbf { x } )$ . Unfortunately, the backward ODE has the problem of mode collapse. We illustrate this phenomenon with a 2D uniform disk. The reverse Poisson field $- \mathbf { E } ( \mathbf { x } )$ on the 2D $( x , y )$ -plane points towards the center of the disk $O$ (Fig. 2(a) left), so all particle trajectories (blue lines) will eventually hit $O$ . If we instead add an additional dimension $z$ (Fig. 2(a) right), particles can hit different points on the disk and faithfully recover the data distribution.
+
+Consequently, instead of solving the Poisson equation $\nabla ^ { 2 } \varphi ( \mathbf { x } ) = - p ( \mathbf { x } )$ in the original data space, we solve the Poisson equation in an augmented space $\tilde { \mathbf { x } } = ( \mathbf { x } , z ) \in \mathbb { R } ^ { N + 1 }$ with an additional variable $z \in \mathbb { R }$ . We augment the training data $\tilde { \mathbf { x } }$ in the new space by setting $z = 0$ such that $\tilde { \mathbf { x } } = ( \mathbf { x } , 0 )$ . As a consequence, the data distribution in the augmented space is $\tilde { p } ( \tilde { \mathbf { x } } ) = p ( \mathbf { x } ) \delta ( z )$ , where $\delta$ is the Dirac delta function. By Eq. (3), the Poisson field by solving the new Poisson equation $\nabla ^ { 2 } \varphi ( \tilde { \mathbf { x } } ) = - \tilde { p } ( \tilde { \mathbf { x } } )$ has an analytical form:
+
+$$
+\forall \tilde { { \mathbf { x } } } \in \mathbb { R } ^ { N + 1 } , \mathbf { E } ( \tilde { { \mathbf { x } } } ) = - \nabla \varphi ( \tilde { { \mathbf { x } } } ) = \frac { 1 } { S _ { N } ( 1 ) } \int \frac { \tilde { { \mathbf { x } } } - \tilde { { \mathbf { y } } } } { \left\| \tilde { { \mathbf { x } } } - \tilde { { \mathbf { y } } } \right\| ^ { N + 1 } } \tilde { p } ( \tilde { { \mathbf { y } } } ) d \tilde { { \mathbf { y } } }
+$$
+
+The associated forward/backward ODEs of the Poisson field are $d \tilde { \mathbf { x } } / d t = \mathbf { E } ( \tilde { \mathbf { x } } ) , d \tilde { \mathbf { x } } / d t = - \mathbf { E } ( \tilde { \mathbf { x } } )$ . Intuitively, theses ODEs uniquely define trajectories of particles between the $z = 0$ hyperplane and an enclosing hemisphere (cf. Fig. 1(a)). In the following theorem, we show that the backward ODE defines a transformation between the uniform distribution on an infinite hemisphere and the data distribution $\tilde { p } ( \tilde { { \mathbf x } } )$ in the $z = 0$ plane. We present the formal proof to Appendix A, illustrated by Fig. 2(b). The proof is based on the idea that when the radius of hemisphere $r \infty$ , the data distribution $\tilde { p } ( \tilde { \mathbf { x } } )$ can be effectively viewed as a delta distribution at origin. Consequently, the Poisson field points in the radial direction at $r \infty$ , perpendicular to $S _ { N } ^ { + } ( r )$ (Green arrows in Fig. 2(b)).
+
+Theorem 1. Suppose particles are sampled from a uniform distribution on the upper $( z > 0 ,$ half of the sphere of radius r and evolved by the backward ODE $\begin{array} { r } { \frac { d \tilde { \mathbf { x } } } { d t } = - \mathbf { E } \big ( \tilde { \mathbf { x } } \big ) } \end{array}$ until they reach the $z = 0$ hyperplane, where the Poisson field $\mathbf { E } ( \tilde { \mathbf { x } } )$ is generated by the source $\tilde { p } ( \tilde { { \mathbf x } } )$ . In the $r \infty$ limit, under some mild conditions detailed in Appendix $\cdot$ , this process generates a particle distribution $\tilde { p } ( \tilde { { \mathbf x } } )$ , i.e., a distribution $p ( \mathbf { x } )$ in the $z = 0$ hyperplane.
+
+Proof sketch. Suppose the flux of the backward ODE connects a solid angle $d \Omega$ (on $S _ { N } ^ { + } ( r ) )$ with an area $d A$ (on $\operatorname { s u p p } ( \tilde { p } ( \tilde { \mathbf { x } } ) )$ . According to Gauss’s law, the outflow flux $d \Phi _ { o u t } = d \Omega / S _ { N } \bar { ( 1 ) }$ on the hemisphere (Green arrows in Fig. 2(b)) equals the inflow flux $d \Phi _ { i n } = p ( { \bf x } ) d A / 2$ on $\operatorname { s u p p } ( \tilde { p } ( \tilde { \mathbf { x } } ) )$ (Red arrows in Fig. 2(b)). $d \Phi _ { i n } = d \Phi _ { o u t }$ gives $d \Omega / d A = p ( \mathbf { x } ) S _ { N } ( 1 ) / 2 \propto \tilde { p } ( \mathbf { \tilde { x } } )$ . Together, by change-ofvariable, we conclude that the final distribution in the $z = 0$ hyperplane is $p ( \mathbf { x } )$ . □
+
+The theorem states that starting from an infinite hemisphere, one can recover the data distribution $\tilde { p }$ by following the inverse Poisson field $- \mathbf { E } ( \tilde { \mathbf { x } } )$ . We defer the formal proof and technical assumptions of the theorem to Appendix A. The property allows generative modeling by following the Poisson flow of $\nabla ^ { 2 } \varphi ( \tilde { \mathbf { x } } ) = - \tilde { p } ( \tilde { \mathbf { x } } )$ .
+
+# 3.2 Learning the normalized Poisson Field
+
+Given a set of training data $\mathcal { D } = \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { n }$ i.i.d sampled from the data distribution $p ( \mathbf { x } )$ , we define the =empirical version of the Poisson field (Eq. (4)) as follows:
+
+$$
+\hat { \bf E } ( \tilde { \bf x } ) = c ( \tilde { \bf x } ) \sum _ { i = 1 } ^ { n } \frac { \tilde { \bf x } - \tilde { \bf x } _ { i } } { \| \tilde { \bf x } - \tilde { \bf x } _ { i } \| ^ { N + 1 } }
+$$
+
+where the gradient field is calculated on $n$ augmented datapoints $\{ \tilde { \mathbf { x } } _ { i } = ( \mathbf { x } _ { i } , 0 ) \} _ { i = 1 } ^ { n }$ , and $c ( \tilde { \mathbf { x } } ) =$ $\textstyle 1 / \sum _ { i = 1 } ^ { n } { \frac { 1 } { \left\| \tilde { \mathbf { x } } - \tilde { \mathbf { x } } _ { i } \right\| ^ { N + 1 } } }$ is the multiplier for numerical stability. We further normalize the field to resolve the variations in the magnitude of the norm $\Vert \hat { \textbf { E } } ( \tilde { \textbf { x } } ) \ \Vert _ { 2 }$ , and fit the neural network to the more amenable negative normalized field $\mathbf { v } ( \tilde { \mathbf { x } } ) = - \sqrt { N } \hat { \mathbf { E } } ( \tilde { \mathbf { x } } ) / \| \hat { \mathbf { E } } ( \tilde { \mathbf { x } } ) \| _ { 2 }$ . The Poisson field is rescalable (cf. Section 2) and thus trajectories of its forward/backward ODEs are invariant under normalization. We denote the empirical field calculated on batch data $\boldsymbol { B }$ by $\hat { \mathbf { E } } _ { B }$ and the negative normalized field as $\mathbf { v } _ { B } ( \tilde { \mathbf { x } } ) = - \sqrt { N } \hat { \mathbf { E } } _ { B } ( \tilde { \mathbf { x } } ) / \| \hat { \mathbf { E } } _ { B } ( \tilde { \mathbf { x } } ) \| _ { 2 }$ .
+
+Similar to the scored-based models, we sample points inside the hemisphere by perturbing the augmented training data. Given a training point $\textbf { x } \in \mathcal { D }$ , we add noise to its augmented version $\{ \tilde { \mathbf { x } } _ { i } ^ { - } = ( \mathbf { x } _ { i } , 0 ) \} _ { i = 1 } ^ { n }$ to construct the perturbed point $( \mathbf { y } , z )$ :
+
+$$
+\mathbf { y } = \mathbf { x } + \parallel \epsilon _ { \mathbf { x } } \parallel ( 1 + \tau ) ^ { m } \mathbf { u } , \quad z = | \epsilon _ { z } | ( 1 + \tau ) ^ { m }
+$$
+
+where ${ \epsilon } = \left( { \epsilon } _ { \mathbf { x } } , { \epsilon } _ { z } \right) \sim \mathcal { N } ( 0 , \sigma ^ { 2 } I _ { N + 1 \times N + 1 } )$ , $\mathbf { u } \sim \mathcal { U } ( S _ { N - 1 } ( 1 ) )$ and $m \sim \mathcal { U } [ 0 , M ]$ . The upper limit $M$ , standard deviation $\sigma$ and $\tau$ are hyper-parameters. With fixed $\epsilon$ and $\mathbf { u }$ , the added noise increases exponentially with $m$ . The rationale behind the design is that points farther away from the data support play a less important role in generative modeling, sharing a similar spirit with the choice of noisy scales in score-based models [32, 33].
+
+In practice, we sample the p ts urbing a mini-batch data $B = \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { | B | }$ each iteration. We $m$ $[ 0 , M ]$ =for each datapoint. We select a large $M$ 300) to ensure the perturbed points can reach a large enough hemisphere. We use a larger batch $\boldsymbol { B } _ { L }$ for the estimation of normalized field since the empirical normalized field is biased, which empirically gives better results. Denoting the set of perturbed points as $\{ \tilde { \mathbf { y } } _ { i } \} _ { i = 1 } ^ { | B | }$ , we train the neural network $f _ { \theta }$ =on these points to estimate the negative normalized field by minimizing the following loss:
+
+$$
+\mathcal { L } ( \boldsymbol { \theta } ) = \frac { 1 } { | \mathcal { B } | } \sum _ { i = 1 } ^ { | \mathcal { B } | } \parallel f _ { \boldsymbol { \theta } } \big ( \tilde { \mathbf { y } } _ { i } \big ) - \mathbf { v } _ { \mathcal { B } _ { L } } \big ( \tilde { \mathbf { y } } _ { i } \big ) \parallel _ { 2 } ^ { 2 }
+$$
+
+We summarize the training process in Algorithm 1. In practice, we add a small constant $\gamma$ to the denominator of the normalized field to overcome the numerical issue when $\exists i , \left\| \tilde { \mathbf { x } } - \tilde { \mathbf { x } } _ { i } \right\| \approx 0$ .
+
+# 3.3 Backward ODE anchored by the additional dimension
+
+After estimating the normalized field $\mathbf { v }$ , we can sample from the data distribution by the backward ODE $d { \tilde { \mathbf { x } } } = \mathbf { v } ( { \tilde { \mathbf { x } } } ) d t$ . Nevertheless, the boundary condition of the above ODE is unclear: the starting and terminal time $t$ of the ODE are both unknown. To remedy the issue, we propose an equivalent backward ODE in which $\mathbf { x }$ evolves with the augmented variable $z$ :
+
+$$
+d ( \mathbf { x } , z ) = ( \frac { d \mathbf { x } } { d t } \frac { d t } { d z } d z , d z ) = ( \mathbf { v } ( \tilde { \mathbf { x } } ) _ { \mathbf { x } } \mathbf { v } ( \tilde { \mathbf { x } } ) _ { z } ^ { - 1 } , 1 ) d z
+$$
+
+Algorithm 1 Learning the normalized Poisson Field
+
+
Input: Training iteration T,Initial model fe,dataset D,constant y,learning rate n. fort=1...Tdo
from BL |B|
Simulate the ODE: {yi = perturb(xi) Ji=1 Calculate the normalized field by BL: VB (yi)=-√NEB,(yi)/(ll EB (yi) Il2 +γ), ∀i
|l f(yi)-vBL(yi)l² i1
Update the model parameter: 0 = 0 - nVL(0)
end for
return fe
+
+# Algorithm 2 perturb $\cdot$
+
+
Sample the power m ~U[0,M] Sample the initial noise (∈x,∈z)~N(O,σ²I(N+1)x(N+1))
Uniformly sample the vector from the unit ball u ~U(SN(1))
Construct training point y = x+ | x I (1 + 𝑇)mu, z = |∈zl(1 + T)m
return y = (y, z)
+
+where $\mathbf { v } ( \tilde { \mathbf { x } } ) _ { \mathbf { x } } , \mathbf { v } ( \tilde { \mathbf { x } } ) _ { z }$ are the corresponding components of $\mathbf x , z$ in vector $\mathbf { v } ( \tilde { \mathbf { x } } )$ . In the new ODE, we replace the time variable $t$ with the physically meaningful variable $z$ , permitting explicit starting and terminal conditions: when $z = 0$ , we arrive at the data distribution and we can freely choose a large $z _ { \mathrm { m a x } }$ as the starting point in the backward ODE. The backward ODE is compatible with general-purpose ODE solvers, e.g., RK45 method [23] and forward Euler method. The popular black-box ODE solvers, such as the one in Scipy library [37], typically use a common starting time for the same batch of samples. Since the distribution on the $z = z _ { \mathrm { m a x } }$ hyperplane is no longer uniform, we derive the prior distribution by radially projecting uniform distribution on the hemisphere with radius $r = z _ { \mathrm { m a x } }$ to the $z = z _ { \mathrm { m a x } }$ hyperplane:
+
+$$
+p _ { \mathrm { p r i o r } } ( \mathbf { x } ) = { \frac { 2 z _ { \mathrm { m a x } } ^ { N + 1 } } { S _ { N } { \big ( } z _ { \mathrm { m a x } } { \big ) } { \big ( } \| \mathbf { x } \| _ { 2 } ^ { 2 } + z _ { \mathrm { m a x } } ^ { 2 } { \big ) } ^ { \frac { N + 1 } { 2 } } } } = { \frac { 2 z _ { \mathrm { m a x } } } { S _ { N } { \big ( } 1 { \big ) } { \big ( } \| \mathbf { x } \| _ { 2 } ^ { 2 } + z _ { \mathrm { m a x } } ^ { 2 } { \big ) } ^ { \frac { N + 1 } { 2 } } } }
+$$
+
+where $S _ { N } ( r )$ is the surface area of $N$ -sphere with radius $r$ . The reason behind the radial projection is that the Poisson field points in the radial direction at $r \infty$ . The new backward ODE also defines a bijective transformation between $p _ { \mathrm { p r i o r } } ( \mathbf { x } )$ on the infinite hyperplane $z _ { \mathrm { m a x } } \infty$ ) and the data distribution the norm (r $\tilde { p } ( \tilde { { \mathbf x } } )$ , analogous to Theorem ) from the distribution: $p _ { \mathrm { p r i o r } } ( \mathbf { x } )$ to sampleand then $p _ { \mathrm { r a d i u s } } ( \| \textbf { x } \| _ { 2 } ) \propto \| \textbf { x } \| _ { 2 } ^ { N - 1 } / ( \| \textbf { x } \| _ { 2 } ^ { 2 } + z _ { \operatorname* { m a x } } ^ { 2 } ) ^ { \frac { N + 1 } { 2 } }$ uniformly sample its angle. We provide detailed derivations and practical sampling procedure in Appendix A.4. We further achieve exponential decay on the $z$ dimension by introducing a new variable $t ^ { \prime }$ :
+
+$$
+\begin{array} { r l } { [ \mathrm { B a c k w a r d ~ O D E } ] } & { { } d ( \mathbf { x } , z ) = ( \mathbf { v } ( \tilde { \mathbf { x } } ) _ { \mathbf { x } } \mathbf { v } ( \tilde { \mathbf { x } } ) _ { z } ^ { - 1 } z , z ) d t ^ { \prime } } \end{array}
+$$
+
+The $z$ component in the backward ODE, i.e., $d z = z d t ^ { \prime }$ , can be solved by $z = e ^ { t ^ { \prime } }$ . Since $z$ reaches zero as $t ^ { \prime } \to - \infty$ , we instead choose a tiny positive number $z _ { \mathrm { m i n } }$ as the terminal condition. The corresponding starting/terminal time of the variable $t ^ { \prime }$ are $\log z _ { \operatorname* { m a x } } / \log z _ { \operatorname* { m i n } }$ respectively. Empirically, this simple change of variable leads to $2 \times$ faster sampling with almost no harm to the sample quality. In addition, we substitue the predicted $\mathbf { v } ( \tilde { \mathbf { x } } ) _ { z }$ with a more accurate one when $z$ is small (Appendix B.2.3). We defer more details of the simulation of backward ODE to Appendix B.2.
+
+# 4 Generative Modeling via the Backward ODE
+
+In this section, we demonstrate the effectiveness of the backward ODE associated with PFGM on image generation tasks. In Section 4.1, we show that PFGM achieves currently best in class performance in the normalizing flow family. In comparison to the existing state-of-the-art SDE or MCMC approaches, PFGM exhibits $1 0 \times$ or $2 0 \times$ acceleration while maintaining competitive or higher generation quality. Meanwhile, unlike existing ODE baselines that heavily rely on corrector to generate decent samples on weaker architectures, PFGM exhibits greater stability against error (Section 4.2). Finally, we show that PFGM is robust to the step size in the Euler method (Section 4.3), and its associated ODE allows for likelihood evaluation and image manipulation by editing the latent space (Section 4.4).
+
+Table 1: CIFAR-10 sample quality (FID, Inception) and number of function evaluation (NFE).
+
+
Invertible?
Inception ↑
FID↓
NFE↓
PixelCNN[36]
4.60
65.9
1024
IGEBM[8]
6.02
40.6
60
ViTGAN [24]
9.30
6.66
1
StyleGAN2-ADA [17]
9.83
2.92
1
StyleGAN2-ADA (cond.) [17]
xxxxxxxxxx
10.14
2.42
1
NCSN[31]
8.87
25.32
1001
NCSNv2 [32]
8.40
10.87
1161
DDPM[16]
9.46
3.17
1000
NCSN++ VE-SDE[33]
9.83
2.38
2000
NCSN++ deep VE-SDE [33]
9.89
2.20
2000
Glow [19]
3.92
48.9
1
DDIM,T=50 [30]
-
4.67
50
DDIM, T=100 [30]
1
4.16
100
NCSN++ VE-ODE [33]
9.34
5.29
194
NCSN++ deep VE-ODE[33]
9.17
7.66
194
DDPM++backbone
VP-SDE[33]
9.58
2.55
1000
sub-VP-SDE[33]
xx-
9.56
2.61
1000
VP-ODE [33]
9.46
2.97
134
sub-VP-ODE [33]
9.30
3.16
146
PFGM (ours)
9.65
2.48
104
DDPM++ deep backbone
VP-SDE [33]
9.68
2.41
1000
sub-VP-SDE[33]
xx-
9.57
2.41
1000
VP-ODE [33]
9.47
2.86
134
sub-VP-ODE [33]
9.40
3.05
146
PFGM (ours)
9.68
2.35
110
+
+# 4.1 Efficient image generation by PFGM
+
+Setup For image generation tasks, we consider the CIFAR-10 [22], CelebA $6 4 \times 6 4$ [38] and LSUN bedroom $2 5 6 \times 2 5 6$ [39]. Following [32], we first center-crop the CelebA images and then resize them to $6 4 \times 6 4$ . We choose $M \ : = \ : 2 9 1$ CIFAR-10 and CelebA 356 LSUN bedroom , $\sigma ~ = ~ 0 . 0 1$ and $\tau { \it \Delta \phi } = 0 . 0 3$ for the perturbation Algorithm 2, and $z _ { \mathrm { m i n } } ~ = ~ 1 e \mathrm { ~ - ~ } 3$ , $\begin{array} { r l } { z _ { \operatorname* { m a x } } } & { { } = } \end{array}$ 40 CIFAR-10 60 CelebA $6 4 ^ { 2 }$ 100 LSUN bedroom for the backward ODE. We further clip the norms of initial samples into $( 0 , 3 0 0 0 )$ for CIFAR-10, $( 0 , 6 0 0 0 )$ for CelebA $6 4 ^ { 2 }$ and $( 0 , 3 0 0 0 0 )$ for LSUN bedroom. We adopt the $\mathrm { { D D P M + + } }$ and $\mathrm { { D D P M + + } }$ deep architectures [33] as our backbones. We add the scalar $z$ (resp. predicted direction on $z$ ) as input (resp. output) to accommodate the additional dimension. We take the same set of hyper-parameters, such as batch size, learning rate and training iterations from [33]. We provide more training details in Appendix B.1, and discuss how to set these hyper-parameters for general datasets in B.1.1 and B.2.1.
+
+Baselines We compare PFGM to modern autoregressive model [36], GAN [17, 24], normalizing flow [19] and EBM [8]. We also compare with variants of score-based models such as DDIM [30] and current state-of-the-art SDE/ODE methods [33]. We denote the methods that use forward-time SDEs in [33] such as Variance Exploding (VE) SDE/Variance Preserving (VP) SDE/ sub-Variance Preserving (sub-VP), and the corresponding backward SDE/ODE, as A-B, where $\mathbf { A } \in \{ \mathrm { V E }$ , VP, sub- $\mathrm { V P } \}$ and $\mathbf { B } \in \{ \mathrm { S D E } , \mathrm { O D E } \}$ . We follow the model selection protocol in [33], which selects the checkpoint with the smallest FID score over the course of training every 50k iterations.
+
+
+Figure 3: Uncurated samples on datasets of increasing resolution. From left to right: CIFAR-10 $3 2 \times 3 2$ , CelebA $6 4 \times 6 4$ and LSUN bedroom $2 5 6 \times 2 5 6$ .
+
+Numerical Solvers The backward ODE (Eq. (6)) is compatible with any general purpose ODE solver. In our experiments, the default solver of ODEs is the black box solver in the Scipy library [37] with the RK45 [7] method (RK45), unless otherwise specified. For VE/VP/subVP-SDEs, we use the predictor-corrector (PC) sampler introduced in [33]. For VP/sub-VP-SDEs, we apply the predictor-only sampler, because its performance is on par with the PC sampler while requiring half computation.
+
+Results For quantitative evaluation on CIFAR-10, we report the Inception [29] (higher is better) and FID [13] scores (lower is better) in Table 1. We also include our preliminary experimental results on a weaker architecture NCSNv2 [32] in Appendix D.2. We measure the inference speed by the average NFE (number of function evaluation). We also explicitly indicate which methods belong to the invertible flow family.
+
+Our main findings are: (1) PFGM achieves the best Inception scores and FID scores among the normalizing flow models. Specifically, PFGM obtains an Inception score of 9.68 and a FID score of 2.48 using the $\mathrm { D D P M + + }$ deep architecture. To our best knowledge, these are the highest FID and Inception scores by flow models on CIFAR-10. (2) PFGM achieves a $1 0 \times \sim 2 0 \times$ faster inference speed than the SDE methods using the similar architectures, while retaining comparable sample quality. As shown in Table 1, PFGM requires NFEs of 110 whereas the SDE methods typically use $1 0 0 0 \sim 2 0 0 0$ inference steps. PFGM outperforms all the baselines on $\mathrm { { D D P M + + } }$ in all metrics. In addition, PFGM generally samples faster than other ODE baselines with the same RK45 solver. (3) The backward ODE in PFGM is compatible with architectures with varying capacities. PFGM consistently outperforms other ODE baselines on $\mathrm { D D P M + + }$ (Table 1) or NCSNv2 (Appendix D.2) backbones. (4) PFGM shows scalability to higher resolution datasets. In Appendix D.1, we show that PFGM are capable of scale-up to LSUN bedroom $2 5 6 \times 2 5 6$ . In particular, PFGM has comparable performance with VE-SDE with $1 5 \times$ fewer NFE.
+
+In Fig. 3, we visualize the uncurated samples from PFGM on CIFAR-10, CelebA $6 4 \times 6 4$ and LSUN bedroom $2 5 6 \times 2 5 6$ . We provides more samples in Appendix E.
+
+# 4.2 Failure of VE/VP-ODEs on NCSNv2 architecture
+
+In our preliminary experiments on NCSNv2 architectures, we empirically observe that the VE/VP-ODEs have FID scores greater than 90 on CIFAR-10. In particular, VE/VP-ODEs can only generate decent samples when applying the Langevin dynamics corrector, and even then, their performances are still inferior to PFGM (Table 9, Table 10). The poor performance on NCSNv2 stands in striking contrast to their high sample quality on $\mathrm { N C S N + + / D D P M + + }$ in [33]. It indicates that the VE/VP-ODEs are
+
+
+Figure 4: Sample norm distributions with varying time variables $\sigma$ for VE-ODE and $z$ for PFGM)
+
+
+Figure 5: (a) Norm- $\cdot \sigma ( t )$ relation during the backward sampling of VE-ODE (Euler). (b) Norm- $z ( t ^ { \prime } )$ relation during the backward sampling of PFGM (Euler). The shaded areas mean the standard deviation of norms. (c) Number of steps versus FID score.
+
+more susceptible to estimation errors than PFGM. We hypothesize that the strong norm- $\sigma$ correla tion seen during the training of score-based models causes the problem.
+
+For score-based models, the $l _ { 2 }$ norms of perturbed training samples and the standard deviations $\sigma ( t )$ of Gaussian noises have strong correlation, e. $g . , l _ { 2 } \ \mathrm { n o r m } \approx \sigma ( t ) \sqrt { N }$ for large $\sigma ( t )$ in VE [33]. In contrast, as shown in Fig. 4, PFGM allocates high mass across a wide spectrum of the training sample norms. During sampling, VE/VP-ODEs could break down when the trajectories of backward ODEs deviate from the norm- $\cdot \sigma ( t )$ relation to which most training samples pertain. The weaker NCSNv2 backbone incurs larger errors and thus leads to their failure. The PFGM is more resistant to estimate errors because of the greater range of training sample norms.
+
+To further verify the hypothesis above, we split a batch of VE-ODE samples into cleaner and noisier samples according to visual quality (Fig. 8(a)). In Fig. 5(a), we investigate the relation for cleaner and noisier samples during the forward Euler simulation of VE-ODE when $\sigma ( t ) < 1 5$ . We can see that the trajectory of cleaner samples stays close to the norm- $\sigma ( t )$ relation (the red dash line), whereas that of the noisier samples diverges from the relation. The Langevin dynamics corrector changes the trajectory of noisier samples to align with the relation. Fig. 5(b) further shows that the anchored variable $z ( t ^ { \prime } )$ and the norms in the backward ODE of PFGM are not strongly correlated, giving rise to the robustness against the imprecise estimation on NCSNv2. We defer more details to Appendix C.
+
+# 4.3 Effects of step size in the forward Euler method
+
+In order to accelerate the inference speed of ODEs, we can increase the step size (decrease the NFEs) in numerical solvers such as the forward Euler method. It also enables the trade-off between sample quality and computational efficiency in real-world deployment. We study the effects of increasing step size on PFGM, VP-ODE and DDIM [30] using the forward Euler method, with a varying NFE ranging from 10 to 100.
+
+In Fig. 5(c), we report the sample quality measured by FID scores on CIFAR-10. As expected, all the methods have higher FID scores when decreasing the NFE. We observe that the sample quality of PFGM degrades gracefully as we decrease the NFE. Our method shows significantly better robustness to step sizes than the VP-ODE, especially when only taking a few Euler steps. In addition, PFGM obtains better FID scores than DDIM on most NFEs except for 10 where PFGM is marginally worse. This suggests that the PFGM is a promising method for accommodating instantaneous resource availability, as high-quality samples can be generated in limited steps.
+
+# 4.4 Utilities of ODE: likelihood evaluation and latent representation
+
+Similar to the family of discrete normalizing flows [6, 19, 14] and continuous probability flow [33], the forward ODE in PFGM defines an invertible mapping between the data space and latent space with a known prior. Formally, we define the invertible forward $\mathcal { M }$ mapping by integrating the corresponding forward ODE $\begin{array} { r } { \dot { d } ( \mathbf { x } , z ) = ( \mathbf { v } ( \tilde { \mathbf { x } } ) _ { \mathbf { x } } \mathbf { v } ( \tilde { \mathbf { x } } ) _ { z } ^ { - 1 } z , z ) d t ^ { \prime } } \end{array}$ of Eq. (6):
+
+$$
+\mathbf { x } ( \log z _ { \operatorname* { m a x } } ) = \mathcal { M } ( \mathbf { x } ( \log z _ { \operatorname* { m i n } } ) ) \equiv \mathbf { x } ( \log z _ { \operatorname* { m i n } } ) + \int _ { \log z _ { \operatorname* { m i n } } } ^ { \log z _ { \operatorname* { m a x } } } \mathbf { v } ( \mathbf { x } ( t ^ { \prime } ) ) _ { \mathbf { x } } \mathbf { v } ( \tilde { \mathbf { x } } ( t ^ { \prime } ) ) _ { z } ^ { - 1 } e ^ { t ^ { \prime } } d t ^ { \prime }
+$$
+
+where $\log z _ { \mathrm { m i n } } / \log z _ { \mathrm { m a x } }$ are the starting/terminal time in the forward ODE. The forward mapping transfers the data distribution to the prior distribution $p _ { \mathrm { p r i o r } }$ on the $z = z _ { \mathrm { m a x } }$ hyperplane (cf. Section 3.3): $p _ { \mathrm { p r i o r } } \big ( \mathbf { x } \big ( \log z _ { \mathrm { m a x } } \big ) \big ) = \mathcal { M } \big ( p ( \mathbf { x } ( \log \bar { z } _ { \mathrm { m i n } } ) ) \big )$ . The invertibility enables likelihood evaluation and creates a meaningful latent space on the $z = z _ { \mathrm { m a x } }$ hyperplane. In addition, we can adapt to the computational constraints by adjusting the step size or the precision in numerical ODE solvers.
+
+Likelihood evaluation We evaluate the data likelihood by the instantaneous change-of-variable formula [4, 33]. In Table 2, we report the bits/dim on the uniformly dequantized CIFAR-10 test set and compare with existing baselines that use the same setup. We observe that PFGM achieves better likelihoods than discrete normalizing flow models, even without maximum likelihood training. Among the continuous flow models, sub-VP-ODE shows the lowest bits/dim, although its sample quality is worse than VP-ODE and PFGM (Table 1). The exploration of the seeming trade-off between likelihood and sample quality is left for future works.
+
+Table 2: Bits/dim on CIFAR-10
+
+
bits/dim ↓
RealNVP [6]
3.49
Glow [19] Residual Flow [3]
3.35 3.28
Flow++ [14]
3.29
DDPM(L)[16]
≤3.70*
DDPM++backbone
VP-ODE [33]
3.20
sub-VP-ODE[33]
3.02
PFGM (ours)
3.19
+
+Latent representation Since the samples are uniquely identifiable by their latents via the invertible mapping $\mathcal { M }$ , PFGM further supports image manipulation using its latent representation on the $z =$ $z _ { \mathrm { m a x } }$ hyperplane. We include the results of image interpolation and the temperature scaling [6, 19, 33] to Appendix D.4 and Appendix D.5. For interpolation, it shows that we can travel along the latent space to obtain perceptually consistent interpolations between CelebA images.
+
+# 5 Conclusion
+
+We present a new deep generative model by solving the Poisson equation whose source term is the data distribution. We estimate the normalized gradient field of the solution in an augmented space with an additional dimension. For sampling, we devise a backward ODE that exponential decays on the physically meaningful additional dimension. Empirically, our approach has currently best performance over other normalizing flow baselines, and achieving $1 0 \times$ to $2 0 \times$ acceleration over the stochastic methods. Our backward ODE shows greater stability against errors than popular ODE-based methods, and enables efficient adaptive sampling. We further demonstrate the utilities of the forward ODE on likelihood evaluation and image interpolation. Future directions include improving the normalization of Poisson fields. More principled approaches can be used to get around the divergent near-field behavior. For example, we may exploit renormalization, a useful tool in physics, to make the Poisson field well-behaved in near fields.
+
+# Acknowledgements
+
+We are grateful to Shangyuan Tong, Timur Garipov and Yang Song for helpful discussion. We would like to thank Octavian Ganea and Wengong Jin for reviewing an early draft of this paper. YX and TJ acknowledge support from MIT-DSTA Singapore collaboration, from NSF Expeditions grant (award 1918839) ”Understanding the World Through Code”, and from MIT-IBM Grand Challenge project. ZL and MT would like to thank the Center for Brains, Minds, and Machines (CBMM) for hospitality. ZL and MT are supported by The Casey and Family Foundation, the Foundational Questions Institute, the Rothberg Family Fund for Cognitive Science and IAIFI through NSF grant PHY-2019786.
+
+References
+[1] Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale gan training for high fidelity natural image synthesis. ArXiv, abs/1809.11096, 2019.
+[2] Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, T. J. Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeff Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. ArXiv, abs/2005.14165, 2020.
+[3] Ricky T. Q. Chen, Jens Behrmann, David Kristjanson Duvenaud, and Jorn-Henrik Jacobsen. ¨ Residual flows for invertible generative modeling. ArXiv, abs/1906.02735, 2019.
+[4] Tian Qi Chen, Yulia Rubanova, Jesse Bettencourt, and David Kristjanson Duvenaud. Neural ordinary differential equations. ArXiv, abs/1806.07366, 2018.
+[5] Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems, 34:8780–8794, 2021.
+[6] Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real nvp. ArXiv, abs/1605.08803, 2017.
+[7] J. R. Dormand and P. J. Prince. A family of embedded runge-kutta formulae. Journal of Computational and Applied Mathematics, 6:19–26, 1980.
+[8] Yilun Du and Igor Mordatch. Implicit generation and generalization in energy-based models. ArXiv, abs/1903.08689, 2019.
+[9] Herbert Goldstein, Charles Poole, and John Safko. Classical mechanics, 2002.
+[10] Will Grathwohl, Ricky T. Q. Chen, Jesse Bettencourt, Ilya Sutskever, and David Kristjanson Duvenaud. Ffjord: Free-form continuous dynamics for scalable reversible generative models. ArXiv, abs/1810.01367, 2019.
+[11] David J Griffiths. Introduction to electrodynamics, 2005.
+[12] Ishaan Gulrajani, Faruk Ahmed, Mart´ın Arjovsky, Vincent Dumoulin, and Aaron C. Courville. Improved training of wasserstein gans. In NIPS, 2017.
+[13] 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 NIPS, 2017.
+[14] Jonathan Ho, Xi Chen, A. Srinivas, Yan Duan, and P. Abbeel. Flow $^ { + + }$ : Improving flowbased generative models with variational dequantization and architecture design. ArXiv, abs/1902.00275, 2019.
+[15] Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In NIPS, 2016.
+[16] Jonathan Ho, Ajay Jain, and P. Abbeel. Denoising diffusion probabilistic models. ArXiv, abs/2006.11239, 2020.
+[17] Tero Karras, Miika Aittala, Janne Hellsten, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Training generative adversarial networks with limited data. ArXiv, abs/2006.06676, 2020.
+[18] Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 4401–4410, 2019.
+[19] Diederik P. Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. In NeurIPS, 2018.
+
+[20] Diederik P. Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semisupervised learning with deep generative models. ArXiv, abs/1406.5298, 2014.
+
+[21] Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. CoRR, abs/1312.6114, 2014.
+
+[22] Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-10 (canadian institute for advanced research). 2009.
+
+[23] F Shampine Lawrence. Some practical runge-kutta formulas. Mathematics of Computation, 46:135–150, 1986.
+
+[24] Kwonjoon Lee, Huiwen Chang, Lu Jiang, Han Zhang, Zhuowen Tu, and Ce Liu. Vitgan: Training gans with vision transformers. ArXiv, abs/2107.04589, 2021.
+
+[25] Daiqing Li, Junlin Yang, Karsten Kreis, Antonio Torralba, and Sanja Fidler. Semantic segmentation with generative models: Semi-supervised learning and strong out-of-domain generalization. 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 8296–8307, 2021.
+
+[26] Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. ArXiv, abs/1802.05957, 2018.
+
+[27] Henry Ricardo. A modern introduction to differential equations. 2002.
+
+[28] Hannes Risken. Fokker-planck equation. 1984.
+
+[29] Tim Salimans, Ian J. Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. ArXiv, abs/1606.03498, 2016.
+
+[30] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. ArXiv, abs/2010.02502, 2021.
+
+[31] Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. ArXiv, abs/1907.05600, 2019.
+
+[32] Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. ArXiv, abs/2006.09011, 2020.
+
+[33] Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. ArXiv, abs/2011.13456, 2021.
+
+[34] Christian Szegedy, V. Vanhoucke, S. Ioffe, Jon Shlens, and Z. Wojna. Rethinking the inception architecture for computer vision. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 2818–2826, 2016.
+
+[35] Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex ¨ Graves, Nal Kalchbrenner, Andrew W. Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. In SSW, 2016.
+
+[36] Aaron van den Oord, Nal Kalchbrenner, Lasse Espeholt, Koray Kavukcuoglu, Oriol Vinyals, ¨ and Alex Graves. Conditional image generation with pixelcnn decoders. In NIPS, 2016.
+
+[37] Pauli Virtanen, Ralf Gommers, Travis E. Oliphant, Matt Haberland, Tyler Reddy, David Cournapeau, Evgeni Burovski, Pearu Peterson, Warren Weckesser, Jonathan Bright, Stefan J. ´ van der Walt, Matthew Brett, Joshua Wilson, K. Jarrod Millman, Nikolay Mayorov, Andrew R. J. Nelson, Eric Jones, Robert Kern, Eric Larson, C J Carey, Ilhan Polat, Yu Feng, Eric W. Moore, J. Vanderplas, Denis Laxalde, Josef Perktold, Robert Cimrman, Ian Daniel Henriksen, E. A. Quintero, Charles R. Harris, Anne M. Archibald, Antonio H. Ribeiro, Fabian Pedregosa, ˆ Paul van Mulbregt, Aditya Alessandro Pietro Alex Andreas Andreas Anthony Ant Vijaykumar Bardelli Rothberg Hilboll Kloeckner Sco, Aditya Vijaykumar, Alessandro Pietro Bardelli, Alex Rothberg, Andreas Hilboll, Andre Kloeckner, Anthony M. Scopatz, Antony Lee, Ariel S. Rokem, C. Nathan Woods, Chad Fulton, Charles Masson, Christian Haggstr ¨ om, Clark Fitzgerald, ¨
+
+David A. Nicholson, David R. Hagen, Dmitrii V. Pasechnik, Emanuele Olivetti, Eric Martin, Eric Wieser, Fabrice Silva, Felix Lenders, Florian Wilhelm, Gert Young, Gavin A. Price, GertLudwig Ingold, Gregory E. Allen, Gregory R. Lee, Herve Audren, Irvin Probst, Jorg P. Dietrich, ´ Jacob Silterra, James T. Webber, Janko Slavi, Joel Nothman, Johannes Buchner, Johannes Kulick, Johannes L. Schonberger, Jos ¨ e Vin ´ ´ıcius de Miranda Cardoso, Joscha Reimer, Joseph E. Harrington, Juan Luis Cano Rodr´ıguez, Juan Nunez-Iglesias, Justin Kuczynski, Kevin Lee Tritz, Martin Dr Thoma, Matt Newville, Matthias Kummerer, Maximilian Bolingbroke, Michael ¨ Tartre, Mikhail Pak, Nathaniel J. Smith, Nikolai Nowaczyk, Nikolay Shebanov, Oleksandr Pavlyk, Per Andreas Brodtkorb, Perry Lee, Robert T. McGibbon, Roman Feldbauer, Sam Lewis, Sam Tygier, Scott Sievert, Sebastiano Vigna, Stefan Peterson, Surhud More, Tadeusz Pudlik, Taku Oshima, Thomas J. Pingel, Thomas P. Robitaille, Thomas Spura, Thouis Raymond Jones, Tim Cera, Tim Leslie, Tiziano Zito, Tom Krauss, U. Upadhyay, Yaroslav O. Halchenko, and Y. Vazquez-Baeza. Scipy 1.0: fundamental algorithms for scientific computing in python. ´ Nature Methods, 17:261 – 272, 2020.
+[38] Shuo Yang, Ping Luo, Chen Change Loy, and Xiaoou Tang. From facial parts responses to face detection: A deep learning approach. 2015 IEEE International Conference on Computer Vision (ICCV), pages 3676–3684, 2015.
+[39] 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, abs/1506.03365, 2015.
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes] See Appendix G.
+(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Appendix H.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Appendix A. (b) Did you include complete proofs of all theoretical results? [Yes] See Appendix A.
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See the abstract.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix B.1.
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A]
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] All the experiments are run on a single NVIDIA A100 GPU.
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [N/A] The assets are public/open-source datasets and codes.
+(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/vqGi8Kp0wM/vqGi8Kp0wM.md b/md/dev/vqGi8Kp0wM/vqGi8Kp0wM.md
new file mode 100644
index 0000000000000000000000000000000000000000..d3a4ade8543d906409950c66ae13bf249f09da40
--- /dev/null
+++ b/md/dev/vqGi8Kp0wM/vqGi8Kp0wM.md
@@ -0,0 +1,324 @@
+# MIND THE GAP: DOMAIN GAP CONTROL FOR SINGLESHOT DOMAIN ADAPTATION FOR GENERATIVE AD-VERSARIAL NETWORKS
+
+Peihao Zhu KAUST
+
+Rameen Abdal KAUST
+
+John Femiani Miami University
+
+Peter Wonka KAUST
+
+
+Figure 1: One-shot domain adaptation: (left) a single reference image from domain $B$ is used to refine a GAN $G _ { A }$ to learn $G _ { B }$ ; (center) every image in domain $A$ has an analog in domain $B$ that shares a latent code and many salient attributes; (right) because salient attributes are preserved in the new domain, many latent-edits are meaningful in the new domain.
+
+# ABSTRACT
+
+We present a new method for one shot domain adaptation. The input to our method is a trained GAN that can produce images in domain $A$ and a single reference image $I _ { B }$ from domain $B$ . The proposed algorithm can translate any output of the trained GAN from domain $A$ to domain $B$ . There are two main advantages of our method compared to the current state of the art: First, our solution achieves higher visual quality, e.g. by noticeably reducing overfitting. Second, our solution allows for more degrees of freedom to control the domain gap, i.e. what aspects of the image $I _ { B }$ are used to define the domain $B$ . Technically, we realize the new method by building on a pre-trained StyleGAN generator as GAN and a pre-trained CLIP model for representing the domain gap. We propose several new regularizers for controlling the domain gap to optimize the weights of the pre-trained StyleGAN generator so that it will output images in domain $B$ instead of domain $A$ . The regularizers prevent the optimization from taking on too many attributes of the single reference image. Our results show significant visual improvements over the state of the art as well as multiple applications that highlight improved control1.
+
+# 1 INTRODUCTION
+
+We propose a new method for domain adaptation based on a single target image. As shown in Fig. 1, given a trained GAN for domain $A$ , and a single image $I _ { B }$ from domain $B$ , our approach learns to find a corresponding image in domain $B$ for any image in domain $A$ . We can achieve this by finetuning the GAN for domain $A$ to obtain a second GAN that generates images in domain $B$ . The two GANs share a latent space so that a single latent code will generate two corresponding images, one in domain $A$ and one in domain $B$ . The main selling point of our method is that it achieves superior quality than the state of the art in single shot domain adaption. Our method is computationally lightweight and only takes a few minutes on a single GPU, so that it can be widely applied.
+
+In order to do this, we leverage multiple existing components, including two excellent pre-trained networks: First, we use StyleGAN2 (Karras et al., 2020b) as a pre-trained GAN. A follow-up version has been published on arXiv (Karras et al., 2021), but the code only became available after we finished all experiments. Second, we use a pre-trained network for image embedding, CLIP (Radford et al., 2021), to encode images as vectors. Third, we use the pioneering idea of StyleGANNADA (Gal et al., 2021), which builds upon StyleCLIP (Patashnik et al., 2021), to encode a domain gap (or domain shift) as vector in CLIP embedding space. Fourth, we leverage II2S (Zhu et al., 2020b) as GAN embedding method to transfer image $I _ { B }$ into domain $A$ to obtain a better estimation of the domain gap.
+
+Even though the visual quality of StyleGAN-NADA is already impressive when used as a single image domain adaption method, we identified multiple technical issues that can be improved to achieve another large jump in visual quality. First, and most importantly, StyleGAN-NADA was designed for zero-shot domain adaptation, and does not have a good solution to model the domain gap based on a single example image. Their reference implementation models the domain gap as a vector from the average image in domain $A$ to the given image $I _ { B }$ in CLIP embedding space. However, this leads to overfitting in practice and the transfer results lose attributes of the input images, so that input images from domain $A$ get mapped to images that are all too similar to $I _ { B }$ in domain $B$ . We identify a better solution to this problem. In fact, the domain gap should be modeled as a vector from the image $I _ { B }$ to its analog in domain $A$ , so that the image in domain $A$ shares salient within-domain attributes with the reference image. We therefore need to solve an inverse $B$ -to- $A$ domain-transfer problem, which we propose to tackle using the state-of-the-art GAN embedding method II2S (Zhu et al., 2020b). A key insight is that we can use a heavily regularized version of the II2S GAN inversion method to do the reverse problem of transferring any related image (from a domain $B$ ) into the domain $A$ , helping to characterize the semantic domain gap better than previous work. Further extensions enable us to fine tune the modeling of the domain gap to explicitly model which attributes of the input image should be kept. Second, we propose multiple new regularizers to improve the quality. Third, we propose a technical improvement to the heuristic layer selection proposed in StyleGAN-NADA that is more straightforward and robust.
+
+In summary, we make the following contributions:
+
+1. We reduce the mode collapse/overfitting problem which often occurs in one-shot and fewshot domain adaptation. Our results look similar to the target domain images with fewer artifacts. These results are also faithful to the identities of the source domain images and able to capture fine details.
+2. Our domain adaptation provides more freedom to control the “similarity” between images across domains that share a common latent-code, which makes a large number of downstream applications possible, e.g., pose adaptation, lighting adaptation, expression adaptation, texture adaptation, interpolation, and layer mixing, using state-of-the-art image editing frameworks.
+
+# 2 RELATED WORK
+
+Domain adaptation. Domain adaptation is the task of adapting a model to different domains. Different works in this area (Bousmalis et al., 2016; 2017; Na et al., 2020; Wang & Breckon, 2020; Kang et al., 2019) try to learn diverse domain independent representations using the source domain to make predictions, such as image classification, in the target domains. More importantly, generating diverse representations of images by combining natural language supervision has been of interest to the computer vision and NLP research communities (Frome et al., 2013). Recently, OpenAI’s Contrastive Language-Image Pretraining (CLIP) (Radford et al., 2021) work established that transformer, and large datasets, could generate transferable visual models. In CLIP, both images and text are represented by high dimensional semantic-embedding vectors, which can then be used for zero-shot learning.
+
+GAN-based domain adaptation. In the GAN domain, various models and training strategies have been proposed for few-shot domain adaptation tasks (Bousmalis et al., 2017; ZHANG et al., 2018; Li et al., 2020; Liu et al., 2019). Most relevant to our work, the domain adaptation methods (Patashnik et al., 2021; Gal et al., 2021; Jang et al., 2021; Song et al., 2021) that build upon StyleGAN (Karras et al., 2019; 2020b;a) demonstrate impressive visual quality and semantic interpretability in the target domain. These methods can be broadly classified into few-shot and single-shot domain adaptation methods.
+
+A notable few-shot method, StyleGAN-ADA (Karras et al., 2020a) proposes an adaptive discriminator augmentation method to train StyleGAN on limited data. Another work, DiffAug (Zhao et al., 2020), applies differentiable transformations to the real and generated images for robust training. A discriminator related approach, FreezeD (Mo et al., 2020), freezes lower layers of the discriminator to achieve domain adaptation. Toonify (justinpinkney/toonify) interpolates between the modelweights of different generators to generate samples from a novel domain. A more recent work (Ojha et al., 2021), reduces overfitting on limited data by preserving the relative similarities and differences in the instances of samples in the source domain using cross domain correspondence.
+
+Latent space interpretation and semantic editing. GAN interpretation and understanding of the latent space has been a topic of interest since the advent of GANs. Some notable works in this domain (Bau et al., 2018; 2019; Hark ¨ onen et al., 2020; Shen et al., 2020; Tewari et al., 2020a) ¨ have led to many GAN-based image editing applications. More recent studies into the activation space of StyleGAN have demonstrated that the GAN can be exploited for downstream tasks like unsupervised and few-shot part segmentation (Zhang et al., 2021; Tritrong et al., 2021; Abdal et al., 2021a; Collins et al., 2020; Bielski & Favaro, 2019), extracting 3D models of the objects (Pan et al., 2021; Chan et al., 2020) and other semantic image editing applications (Zhu et al., 2021; Tan et al., 2020; Wu et al., 2020; Patashnik et al., 2021).
+
+Image embedding is one of the approaches used to study the interpretability of the GANs. To enable the semantic editing of a given image using GANs, one needs to embed/project the image into its latent space. Image2StyleGAN (Abdal et al., 2019) embeds images into the extended StyleGAN space called $W +$ space. Some followup works (Zhu et al., 2020a; Richardson et al., 2020; Tewari et al., 2020b) introduce regularizers and encoders to keep the latent code faithful to the original space of the StyleGAN. Improved-Image2StyleGAN (II2S) (Zhu et al., 2020b) uses $P _ { N }$ space to regularize the embeddings for high-quality image reconstruction and image editing. We use this method to embed real images into the StyleGAN and show that our domain adaptation preserves the properties of the original StyleGAN in Sec 4.
+
+Image editing is another tool to identify the concepts learned by a GAN. In the StyleGAN domain, recent works (Hark ¨ onen et al., 2020; Shen et al., 2020; Tewari et al., 2020a; Abdal et al., ¨ 2021b) extract meaningful linear and non-linear paths in the latent space. InterfaceGAN (Shen et al., 2020) finds linear directions to edit latent-codes in a supervised manner. On the other hand, GANSpace (Hark ¨ onen et al., 2020) extracts unsupervised linear directions for editing using PCA ¨ in the $W$ space. Another framework, StyleRig (Tewari et al., 2020a), maps the latent space of the GAN to a 3D model. StyleFlow (Abdal et al., 2021b) extracts non-linear paths in the latent space to enable sequential image editing. In this work, we will use StyleFlow to test the semantic editing of our domain adapted images.
+
+In the area of text-based image editing, StyleCLIP (Patashnik et al., 2021) extends CLIP to perform GAN-based image editing. StyleCLIP uses the CLIP embedding vector to traverse the StyleGAN manifold, by adjusting the latent-codes of a GAN, in order to make a generated image’s CLIP embedding similar to the target vector, while remaining close to the input in latent space. A downside to this approach is that these edits are unable to shift the domain of a GAN outside its original manifold. However, their use of CLIP embeddings inspired StyleGAN-NADA (Gal et al., 2021), which creates a new GAN using refinement learning to do zero-shot domain adaptation. Although unpublished, they also demonstrate one-shot domain adaptation in their accompanying code. The original and target domain are represented by CLIP text embeddings. The difference of the embeddings represents a direction used to shift the domains. Although in the accompanying source-code (rinongal/StyleGAN NADA), they use a bootstrap-estimate of the mean CLIP image embedding of the original domain, and use a reference image or its CLIP image embedding to represent the new domain.
+
+# 3 METHOD
+
+Our approach involves fine-tuning a GAN trained for some original domain $A$ , e.g. FFHQ faces, to adapt it to a new related domain $B$ . In our approach, the images in $A$ and the images in $B$ are related to each-other by a common latent code. Any image which can be generated or embedded in domain $A$ can be transferred to a corresponding and similar image in $B$ . We use the CLIP embeddings as a semantic-space in order to model the difference between domains $A$ and $B$ , and we use StyleGAN (Karras et al., 2018; 2020b) as the image generator. A key to our approach is to preserve directions within and across domains as illustrated in Fig. 3. Before fine-tuning the GAN for domain $A$ (to obtain the GAN for domain $B$ ), we determine a domain-gap direction. This direction, called $v ^ { \mathrm { r e f } }$ , is a vector in CLIP embedding space which points towards a reference image $I _ { B }$ which is in domain $B$ from its corresponding image $I _ { A }$ in which is in domain $A$ . We use the CLIP image-embedding model $E _ { I }$ to find
+
+$$
+v ^ { \mathrm { r e f } } = E _ { I } ( I _ { B } ) - E _ { I } ( I _ { A } ) .
+$$
+
+Finding $I _ { A }$ in domain A for a given image in domain B is a significant limitation in the current state of the art, StyleGAN-NADA (Gal et al., 2021), as they use the mean of domain $A$ . The mean of domain A is a very crude approximation for $I _ { A }$ . Instead, we propose an inverse domain adaption step, by projecting the image $I _ { B }$ into the domain $A$ to find a sample that is more similar and specific to the reference image than the mean of domain $A$ . In principle, this problem is also a domain adaption problem similar to the problem we are trying to solve, just in the inverse direction. The major difference is that we have a pre-trained GAN available in domain A.
+
+We use the II2S GAN-inversion method (Zhu et al., 2020b) in order to find a latent code for an image similar to $I _ { B }$ that is plausibly within domain $A$ . The I2S and II2S methods use an extended version of $W$ space from StyleGAN2. The $W$ code is used 18 times, once for each style block in StyleGAN2. When allowing each element to vary independently, the resulting latent space is called $W +$ space Abdal et al. (2019; 2020); Zhu et al. (2020b). I2S showed that the additional degrees of freedom allow GAN inversion for a wider set of images with very detailed reconstruction capabilities, and II2S showed that an additional regularization term to keep the latent codes close to their original distribution made latent-code manipulation more robust. II2S uses a hyperparameter, $\lambda$ , which can be increased in order to generate latent codes using more regularization, and therefore in higher density regions of the $W +$ latent space. The effect of this parameter is shown in Fig. 2. The value suggested in the original work was $\lambda = 0 . 0 0 1$ , however, low values of lambda allow II2S to find latent codes that are too far away from the latent-codes produced by the mapping network of the original GAN and thus produce images that are less plausible to have come from domain $A$ , underestimating the gap between domains. In the context of domain shift we find it is useful to use $\lambda = 0 . 0 1$ as illustrated in Fig. 2. The result is a latent code $w ^ { \mathrm { r e f } }$ in $W +$ space which is shifted towards a high-density portion of the domain $A$ . Then the image generated from that code, $I _ { A }$ , is an image in domain $A$ that corresponds to $I _ { B }$ .
+
+
+Figure 2: An illustration showing how II2S embeds $I _ { B }$ in the original StyleGAN domain $A$ , shown for two different values of $\lambda$ . Reference images from other domains are shown in the top row. The value recommended by Zhu et al. (2020b) is shown in the second row, and the value used in this work is shown in the third row. Although there is some subjectivity involved, we believe that the large value $\lambda = 1 \mathrm { e } { - 2 }$ is needed for II2S to find images that plausibly could belong to the domain $A$ , which in this case is FFHQ faces.
+
+Training As illustrated in Fig. 2, we use II2S to find an image $I _ { A }$ which we consider to be similar to $I _ { B }$ but still plausibly within a domain $A$ . In principle, it is possible that II2S finds $I _ { A }$ so that $I _ { B }$ is similar enough to be considered the same, in which case the two domains overlap. However, we are concerned with the cases where the domains are different, and the vector $v ^ { \mathrm { r e f } }$ indicates the direction of a gap, or shift, between domain $A$ and domain $B$ . We use refinement learning to train a new generator, $G _ { B }$ , so that images generated from $G _ { B }$ are shifted parallel to $v ^ { \mathrm { r e f } }$ in CLIP space, relative to images from $G _ { A }$ . The desired shift is indicated by the red arrows in Fig. 3. During training, latent codes $w$ are generated using the mapping network of StyleGAN2. Both $G _ { A }$ and $G _ { B }$ are used to generate images from the same latent code, but the weights of $G _ { A }$ are frozen and only $G _ { B }$ is updated during training. The goal of refinement learning is that $G _ { B }$ will preserve semantic information that is within domain $A$ but also that it will generate image shifted across a gap between domains. When refining the generator for domain $B$ , we freeze the weights of the StyleGAN2 ‘ToRGB’ layers, and the mapping network is also frozen. The overall process of training is illustrated in Fig. 4.
+
+
+Figure 3: The vectors in the CLIP image embedding space, $E _ { I }$ , which control domain adaptation. Each domain is depicted here as a dashed outline; the vectors $v ^ { \mathrm { r e f } }$ and $v ^ { \mathrm { s a m p } }$ cross between the two domains and are used to refine a generator for domain $B$ . Corresponding images should be shifted in the same direction. The vectors $v _ { A }$ and $v _ { B }$ model important semantic differences within each domain that should also be preserved by domain transfer. $G _ { A } ( w )$ and $G _ { B } ( w )$ are corresponding images for an arbitrary latent-code $w$ encountered during training. Style mixing (shown on the right) shifts a part of the latent code towards the reference image effecting the result in both domains.
+
+The goal of training is to shift CLIP embeddings from domain $A$ in a direction parallel to $v ^ { \mathrm { r e f } }$ . We use the vector $v ^ { \mathrm { s a m p } }$ to represent the current domain shift of the network $G _ { B }$ during training, on a single sample. We have
+
+$$
+v ^ { \mathrm { s a m p } } = E _ { I } ( G _ { B } ( w ) ) - E _ { I } ( G _ { A } ( w ) )
+$$
+
+as a cross-domain vector for corresponding images generated from the same $w$ latent code using the two generators. We use the loss
+
+$$
+L _ { \mathrm { c l i p . a c r o s s } } = 1 - \mathrm { s i m } ( v ^ { \mathrm { r e f } } , v ^ { \mathrm { s a m p } } ) ,
+$$
+
+where $\begin{array} { r } { \mathrm { s i m } ( \mathbf { a } , \mathbf { b } ) = \frac { \mathbf { a } ^ { T } \mathbf { b } } { \| \mathbf { a } \| \| \mathbf { b } \| } } \end{array}$ is the cosine similarity score. This loss term is minimized when the domain shift vectors are parallel.
+
+It is important that the reference image $I _ { B }$ matches the generated image, $G _ { B } ( \boldsymbol { w } ^ { \mathrm { r e f } } )$ , both in a semantic sense, as measured by the similarity of the CLIP embeddings, and also in a visual sense. We accomplish this using two losses: $L _ { \mathrm { r e f \_ c l i p } }$ and $L _ { \mathrm { r e f . r e c } }$ . The first loss measures the change in the CLIP-embeddings of the original and reconstructed reference image,
+
+$$
+{ \cal L } _ { \mathrm { r e f . c l i p } } = 1 - \sin \left( E _ { I } \left( I _ { B } \right) , E _ { I } \left( G _ { B } ( w ^ { \mathrm { r e f } } ) \right) \right) ,
+$$
+
+ensuring that the $G _ { B }$ can reconstruct the embedding. Unlike $L _ { \mathrm { c l i p . a c c r o s s } }$ , this loss term is not based on a change in embeddings between the two domains, instead it guides $G _ { B }$ by aligning it to a global embedding in CLIP space, ensuring that $I _ { B }$ remains fixed in the domain of $G _ { B }$ .
+
+The second loss term is a reconstruction loss based on perceptual and pixel-level accuracy,
+
+$$
+{ \cal L } _ { \mathrm { r e f . r e c } } = { \cal L } _ { \mathrm { P I P S } } \left( I _ { B } , G _ { B } ( w ^ { \mathrm { r e f } } ) \right) + { \cal L } _ { 2 } \left( I _ { B } , G _ { B } ( w ^ { \mathrm { r e f } } ) \right)
+$$
+
+
+Figure 4: A process diagram for domain transfer. White rectangles indicate calculations, computed values are shown on the connecting lines. The four loss-calculations are indicated by blue rectangles, and the learnable weights of StyleGAN2 (all weights except the mapping network and the ToRGB layers) are indicated in green.
+
+where $L _ { \mathrm { P I P S } }$ is the perceptual loss from Zhang et al. (2018), and $L _ { 2 }$ is the squared euclidean difference between pixels. The purpose of this loss is to ensure that the visual, and not just the semantic, qualities of the image are preserved. This is necessary in addition to $L _ { \mathrm { r e f \_ c l i p } }$ because, while the CLIP embeddings do capture many semantic and visual qualities of the image, there are still many perceptually distinct images that could produce the same CLIP embedding. This is visible in Fig. 6, without the reconstruction loss $G _ { B }$ fails to preserve some important visual qualities (such as symmetry) of the input.
+
+There is a tendency for GANs to reduce the variation during training, especially in few-shot finetuning. We combat this by preserving the semantic information that is not related to the domain gap. A semantic change that is not related to the change in domains should not be affected by $G _ { B }$ . Therefore, the vector connecting the reference and sample images within the domain $A$ should be parallel to the corresponding vector in domain $B$ . Let $v _ { A } = { \dot { E } } _ { I } ( G _ { A } ( w ) ) - E _ { I } ( I _ { A } )$ be a vector connecting a sample image with latent-code $w$ to the reference image in the CLIP space. This vector represents semantic changes that are within domain $A$ , and we want the matching semantic changes to occur within the domain $B$ . Let $v _ { B } = E _ { I } ( G _ { B } ( w ) ) - E _ { I } ( I _ { B } )$ denote the corresponding vector in domain $B$ . We introduce the loss
+
+$$
+{ \cal L } _ { \mathrm { c l i p . w i t h i n } } = 1 - \mathrm { s i m } ( v _ { A } , v _ { B } ) ,
+$$
+
+which is minimized when the two within-domain changes are parallel.
+
+The final loss is then a weighted sum of losses
+
+$$
+L = L _ { \mathrm { c l i p . a c r o s s } } + \lambda _ { \mathrm { c l i p . w i t h i n } } L _ { \mathrm { c l i p . w i t h i n } } + \lambda _ { \mathrm { r e f . c l i p } } L _ { \mathrm { r e f . c l i p } } + \lambda _ { \mathrm { r e f . r e c } } L _ { \mathrm { r e f . r e c } } ,
+$$
+
+with empirically determined weights of $\lambda _ { \mathrm { c l i p . w i t h i n } } = 0 . 5$ , $\lambda _ { \mathrm { { r e f . c l i p } } } = 3 0$ , and $\lambda _ { \mathrm { { r e f . r e c } } } = 1 0$ . Together, these four loss terms guide the refinement process for $G _ { B }$ . Among these losses, $L _ { \mathrm { c l i p . a c r o s s } }$ was proposed by StyleGAN-NADA (Gal et al., 2021). The other losses are novel contributions of this work.
+
+Style Mixing After the training step, the generator $G _ { B }$ generates images that are semantically similar to the reference image $I _ { B }$ . However, we have observed that the visual style may not be sufficiently similar. We attribute this to the idea that the target domain may be a subset of the images produced by the new generator $G _ { B }$ . This issue was addressed in StyleGAN-NADA (Gal et al., 2021) using a second latent-mining network in order to identify a distribution of latent codes within the domain of $G _ { B }$ that better match the reference image. Our approach exploits the structure of latent codes in $W +$ space. Latent vectors in $W +$ space can be divided into 18 blocks of 512 elements, each impacting a different layer of StyleGAN2. Empirically, the latter blocks of the $W +$ code have been shown to have more effect on the style (e.g. texture and color) of the image whereas the earlier layers impact the coarse-structure or content (Zhu et al., 2021) of the image. We partition the latent code in the image into $w = ( w _ { C } , w _ { S } )$ where $w _ { C }$ consists of the first $m$ blocks of the $W +$ latent code that capture the content of the image, and $w _ { S }$ consists of the remaining blocks and captures the style. In this work, we will use $m = 7$ unless otherwise specified. Then we transfer the style from a reference image using linear interpolation, to form $\hat { w } = ( w _ { C } , \hat { w } _ { S } )$ where
+
+$$
+\hat { w } _ { S } = ( 1 - \alpha ) w _ { S } + \alpha ( w _ { S } ^ { \mathrm { r e f } } ) ,
+$$
+
+d d $w _ { S } ^ { \mathrm { r e f } }$ is last accor $( 1 8 - m )$ blocks of e distribut $w ^ { \mathrm { r e f } }$ . Consider the distribution of images generated from randomof latent codes from the mapping network of StyleGAN2. If $w$
+$\alpha = 0$ , then the distribution of images $G _ { B } ( \hat { w } )$ includes the reference image, but encompasses a wide variety of other fine visual styles. If $\alpha = 1$ , then the images $G _ { B } ( \hat { w } )$ will still have a diverse content, but they will all very closely follow the visual style of $I _ { B }$ . An important application of this method is in conditional editing of real photographs. To achieve that, first we take a real input image $I _ { \mathrm { r e a l } }$ and invert it in domain $A$ using II2S on the generator $G _ { A }$ in order to find a $W +$ latent code $w _ { \mathrm { r e a l } }$ . Then $G _ { B } ( w _ { \mathrm { r e a l } } )$ generates a corresponding image in domain $B$ . We can then compute $\hat { w } _ { \mathrm { r e a l } }$ by interpolating the style codes (8) so that the final image $G _ { B } ( \hat { w } _ { \mathrm { r e a l } } )$ is similar to $I _ { \mathrm { r e a l } }$ but has both content and the visual style shifted towards domain $B$ .
+
+# 4 RESULTS
+
+In this section, we will show qualitative and quantitative results of our work. The only other published method that accomplishes similar one-shot GAN domain adaptation which we are aware of is Ojha et al. (2021). They focus on few-shot domain adaptation, but they also demonstrate a capability to solve the one-shot problem. The most closely related work to our approach is StyleGANNADA (Gal et al., 2021), which is unpublished at the time of submission, however we compare to it as the main competitor. The paper mainly discusses zero-shot domain adaptation, but the approach can also accomplish one-shot domain adaptation, as demonstrated in their accompanying sourcecode. Moreover, it demonstrates impressive improvements over the state of the art and even beats many SOTA few-shot methods considering the visual quality. As our method can still significantly improve upon the results shown in StyleGAN-NADA, this underlines the importance of our idea in reducing overfitting. We compare against additional approaches in the appendix.
+
+Training and Inference Time. Given a reference image, the training time for our method is about 15 minutes for 600 iterations on a single Titan XP GPU using ADAM as an optimizer with the same settings as Gal et al. (2021). We use a batch size of 4. At inference time, there are different applications. In a basic operation, GAN generated images can be transferred with a single forward pass through a GAN generator network, which works in 0.34 seconds. Considering a more advanced operation, where existing photographs are embedded into a GAN latent space, the additional embedding time has to be considered. This embedding time is only 0.22 seconds using e4e (Tov et al., 2021) and about two minutes using II2S (Zhu et al., 2020b).
+
+Visual Evaluation. In Fig. 5, we show a comparison of our results on faces against the two most relevant competing methods – StyleGAN-NADA (Gal et al., 2021) and few-shot-domainadaptation (Ojha et al., 2021). The results show that our method remains faithful to the original identity of the embedded images in domain $A$ , while the other two methods suffer from overfitting, i.e., collapsing to narrow distributions which do not preserve salient features (for example the identity of a person). We show additional visual results in the supplemental materials, including results on cars and dogs and results for fine-tuning the domain adaptation.
+
+User Study. We also perform a user study by collecting 187 responses from Amazon Mechanical Turk in order to compare the visual quality and the domain transfer capabilities of our framework compared to the competing methods. When asked which method generates higher quality images from domain $B$ , $73 \%$ of users preferred our approach to StyleGAN-NADA, and $7 7 \%$ selected ours over Few-shot (Ojha et al., 2021). When asked which method is better at maintaining the similarity to a corresponding source image in domain $A$ , we found that $80 \%$ of the responses chose our approach over StyleGAN-NADA, and $91 \%$ preferred our approach to Few-shot. Our method outperforms the competing works in terms of the quality of the generated image, and the similarity of the generated image to the source image from domain $A$ . According to the user study, the other methods produced images that are more similar to $I _ { B }$ , but that is also an indication of overfitting and mode collapse.
+
+
+Figure 5: Comparison of our framework with state-of-the-art frameworks for StyleGAN domain adaptation. We compare with StyleGAN-NADA (Gal et al., 2021) and the few-shot method of Ojha et al. (2021). Each row corresponds to a different reference image $I _ { B }$ , and each column is a different real image $I _ { \mathrm { r e a l } }$ from domain $A$ . Notice that our method is able to match the styles of the reference images, while StyleGAN-NADA fails to maintain the content of the images in domain $A$ (for example the identity of a person is lost). On the other hand, the few-shot method suffers from severe mode collapse.
+
+Ablation study. We perform an ablation study to evaluate each component of our framework. In Fig. 6, we show the effect of II2S embedding, different losses and style mixing/interpolation on the output.
+
+
+Figure 6: Ablation study of the losses and style mixing used in our framework. From left to right: the reference image $I _ { A }$ and several images from domain $A$ , the baseline approach (StyleGAN-NADA), adding II2S instead of using the mean of domain $A$ , adding $L _ { \mathrm { r e f \_ c l i p } }$ , $L _ { \mathrm { c l i p . w i t h i n } }$ , and then using style mixing. The top row shows reconstructions of the image $I _ { A }$ using $\mathbf { \dot { \boldsymbol { G } } } _ { B }$ .
+
+Image editing capabilities. Another important aspect of our method is that we are able to preserve the semantic properties of the original StyleGAN (domain $A$ ) in domain $B$ . We can make edits to the images in domain $B$ via the learned generator $G _ { B }$ without retraining the image editing frameworks on the new domain. Fig. 7 shows image editing capabilities in the new domain $B$ . We use StyleFlow edits such as lighting, pose, gender etc. to show the fine-grained edits possible in the new domain.
+
+
+Figure 7: Image editing capabilities of the new domain $B$ using StyleFlow (Abdal et al., 2021b). This figure shows the editing results of the embedded real image $I _ { r e a l }$ transferred to domain $B$ . Notice that our method preserves the semantic properties of the original StyleGAN.
+
+Limitations Our method has several limitations (See Fig. 8). Some of these limitations are inherent due to the challenging nature of the problem of single-shot domain adaptation. Other limitations can be addressed in future work. First, when we find the initial image in domain $A$ that corresponds to the input in domain $B$ , we do not attempt to control for the semantic similarity. Future work should encourage the images to have similar semantics. Second, we can only transfer between related domains. For example transferring FFHQ faces into the domain of cars is not explored in this paper. Third, also relevant to the original distribution of the StyleGAN, embeddings into the StyleGAN work best when the objects are transformed to the canonical positions (for example face poses that are the same as FFHQ). Extreme poses of the objects in the reference images sometimes fail.
+
+
+
+Figure 8: Some failure cases of our method. In these examples, we observe that the identity of the face is compromised a bit more than in typical examples of our method.
+
+# 5 CONCLUSIONS
+
+We propose a novel method for single shot domain adaption. The main achievement of this work is to obtain results of unprecedented quality while reducing overfitting observed in previous work. The technical key components of our work are a method to model the domain gap as vector in CLIP embedding space, a way to preserve within-domain variation, and several extensions for fine-grained attribute-based control. We also introduce several new regularizers and a style mixing approach.
+
+# REFERENCES
+
+Rameen Abdal, Yipeng Qin, and Peter Wonka. Image2stylegan: How to embed images into the stylegan latent space? In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4432–4441, 2019.
+
+Rameen Abdal, Yipeng Qin, and Peter Wonka. Image2stylegan $^ { + + }$ : How to edit the embedded images? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8296–8305, 2020.
+
+Rameen Abdal, Peihao Zhu, Niloy Mitra, and Peter Wonka. Labels4free: Unsupervised segmentation using stylegan, 2021a.
+
+Rameen Abdal, Peihao Zhu, Niloy J. Mitra, and Peter Wonka. Styleflow: Attribute-conditioned exploration of stylegan-generated images using conditional continuous normalizing flows. ACM Trans. Graph., 40(3), May 2021b. ISSN 0730-0301. doi: 10.1145/3447648. URL https: //doi.org/10.1145/3447648.
+
+David Bau, Jun-Yan Zhu, Hendrik Strobelt, Bolei Zhou, Joshua B. Tenenbaum, William T. Freeman, and Antonio Torralba. Gan dissection: Visualizing and understanding generative adversarial networks, 2018.
+
+David Bau, Jun-Yan Zhu, Jonas Wulff, William Peebles, Hendrik Strobelt, Bolei Zhou, and Antonio Torralba. Seeing what a gan cannot generate. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4502–4511, 2019.
+
+Adam Bielski and Paolo Favaro. Emergence of object segmentation in perturbed generative models. arXiv preprint arXiv:1905.12663, 2019.
+
+Konstantinos Bousmalis, George Trigeorgis, Nathan Silberman, Dilip Krishnan, and Dumitru Erhan. Domain separation networks, 2016.
+
+Konstantinos Bousmalis, Nathan Silberman, David Dohan, Dumitru Erhan, and Dilip Krishnan. Unsupervised pixel-level domain adaptation with generative adversarial networks. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Jul 2017. doi: 10.1109/cvpr. 2017.18. URL http://dx.doi.org/10.1109/CVPR.2017.18.
+
+Eric R. Chan, Marco Monteiro, Petr Kellnhofer, Jiajun Wu, and Gordon Wetzstein. pi-gan: Periodic implicit generative adversarial networks for 3d-aware image synthesis, 2020.
+
+Hila Chefer, Sagie Benaim, Roni Paiss, and Lior Wolf. Image-based clip-guided essence transfer. arXiv preprint arXiv: 2110.12427, 2021.
+
+Edo Collins, Raja Bala, Bob Price, and Sabine Susstrunk. Editing in style: Uncovering the local ¨ semantics of gans, 2020.
+
+Andrea Frome, Greg Corrado, Jonathon Shlens, Samy Bengio, Jeffrey Dean, Marc’Aurelio Ranzato, and Tomas Mikolov. Devise: A deep visual-semantic embedding model. 2013.
+
+Rinon Gal, Or Patashnik, Haggai Maron, Gal Chechik, and Daniel Cohen-Or. Stylegan-nada: Clipguided domain adaptation of image generators, 2021.
+
+Leon A Gatys, Alexander S Ecker, and Matthias Bethge. Image style transfer using convolutional neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2414–2423, 2016.
+
+Erik Hark ¨ onen, Aaron Hertzmann, Jaakko Lehtinen, and Sylvain Paris. Ganspace: Discovering ¨ interpretable gan controls. arXiv preprint arXiv:2004.02546, 2020.
+
+Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In Proceedings of the 31st International Conference on Neural Information Processing Systems, NIPS’17, pp. 6629–6640, Red Hook, NY, USA, 2017. Curran Associates Inc. ISBN 9781510860964.
+
+Xun Huang and Serge Belongie. Arbitrary style transfer in real-time with adaptive instance normalization. In ICCV, 2017.
+
+Wonjong Jang, Gwangjin Ju, Yucheol Jung, Jiaolong Yang, Xin Tong, and Seungyong Lee. Stylecarigan. ACM Transactions on Graphics, 40(4):1–16, Aug 2021. ISSN 1557-7368. doi: 10.1145/3450626.3459860. URL http://dx.doi.org/10.1145/3450626.3459860.
+
+justinpinkney/toonify. Toonify. https://github.com/justinpinkney/toonify.
+
+Guoliang Kang, Lu Jiang, Yi Yang, and Alexander G. Hauptmann. Contrastive adaptation network for unsupervised domain adaptation. 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Jun 2019. doi: 10.1109/cvpr.2019.00503. URL http: //dx.doi.org/10.1109/CVPR.2019.00503.
+
+Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. arXiv preprint arXiv:1812.04948, 2018.
+
+Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4401–4410, 2019.
+
+Tero Karras, Miika Aittala, Janne Hellsten, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Training generative adversarial networks with limited data. In Proc. NeurIPS, 2020a.
+
+Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of StyleGAN. In Proc. CVPR, 2020b.
+
+Tero Karras, Miika Aittala, Samuli Laine, Erik Hark ¨ onen, Janne Hellsten, Jaakko Lehtinen, and ¨ Timo Aila. Alias-free generative adversarial networks. CoRR, abs/2106.12423, 2021.
+
+Tuomas Kynka¨anniemi, Tero Karras, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Improved ¨ precision and recall metric for assessing generative models. CoRR, abs/1904.06991, 2019.
+
+Kai Li, Yulun Zhang, Kunpeng Li, and Yun Fu. Adversarial feature hallucination networks for fewshot learning. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Jun 2020. doi: 10.1109/cvpr42600.2020.01348. URL http://dx.doi.org/10.1109/ cvpr42600.2020.01348.
+
+Ming-Yu Liu, Xun Huang, Arun Mallya, Tero Karras, Timo Aila, Jaakko Lehtinen, and Jan Kautz. Few-shot unsupervised image-to-image translation. 2019 IEEE/CVF International Conference on Computer Vision (ICCV), Oct 2019. doi: 10.1109/iccv.2019.01065. URL http://dx.doi. org/10.1109/ICCV.2019.01065.
+
+Sangwoo Mo, Minsu Cho, and Jinwoo Shin. Freeze the discriminator: a simple baseline for finetuning gans, 2020.
+
+Jaemin Na, Heechul Jung, Hyung Jin Chang, and Wonjun Hwang. Fixbi: Bridging domain spaces for unsupervised domain adaptation, 2020.
+
+Utkarsh Ojha, Yijun Li, Jingwan Lu, Alexei A. Efros, Yong Jae Lee, Eli Shechtman, and Richard Zhang. Few-shot image generation via cross-domain correspondence, 2021.
+
+Xingang Pan, Bo Dai, Ziwei Liu, Chen Change Loy, and Ping Luo. Do 2d {gan}s know 3d shape? unsupervised 3d shape reconstruction from 2d image $\{ \mathrm { g a n } \} \mathrm { s }$ . In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ FGqiDsBUKL0.
+
+Or Patashnik, Zongze Wu, Eli Shechtman, Daniel Cohen-Or, and Dani Lischinski. Styleclip: Textdriven manipulation of stylegan imagery, 2021.
+
+Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision, 2021.
+
+Elad Richardson, Yuval Alaluf, Or Patashnik, Yotam Nitzan, Yaniv Azar, Stav Shapiro, and Daniel Cohen-Or. Encoding in style: a stylegan encoder for image-to-image translation. arXiv preprint arXiv:2008.00951, 2020.
+
+rinongal/StyleGAN NADA. Stylegan-nada. https://github.com/rinongal/ StyleGAN-nada.
+
+Yujun Shen, Ceyuan Yang, Xiaoou Tang, and Bolei Zhou. Interfacegan: Interpreting the disentangled face representation learned by gans. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020.
+
+Guoxian Song, Linjie Luo, Jing Liu, Wan-Chun Ma, Chunpong Lai, Chuanxia Zheng, and Tat-Jen Cham. Agilegan: Stylizing portraits by inversion-consistent transfer learning. ACM Transactions on Graphics (Proc. SIGGRAPH), jul 2021.
+
+Zhentao Tan, Menglei Chai, Dongdong Chen, Jing Liao, Qi Chu, Lu Yuan, Sergey Tulyakov, and Nenghai Yu. Michigan: Multi-input-conditioned hair image generation for portrait editing. ACM Transactions on Graphics (TOG), 39(4):1–13, 2020.
+
+Ayush Tewari, Mohamed Elgharib, Gaurav Bharaj, Florian Bernard, Hans-Peter Seidel, Patrick Perez, Michael Zollhofer, and Christian Theobalt. Stylerig: Rigging stylegan for 3d control over ´ portrait images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6142–6151, 2020a.
+
+Ayush Tewari, Mohamed Elgharib, Mallikarjun BR, Florian Bernard, Hans-Peter Seidel, Patrick Perez, Michael Z ´ ollhofer, and Christian Theobalt. Pie: Portrait image embedding for semantic¨ control. volume 39, December 2020b. doi: 10.1145/3414685.3417803.
+
+Omer Tov, Yuval Alaluf, Yotam Nitzan, Or Patashnik, and Daniel Cohen-Or. Designing an encoder for stylegan image manipulation. arXiv preprint arXiv:2102.02766, 2021.
+
+Nontawat Tritrong, Pitchaporn Rewatbowornwong, and Supasorn Suwajanakorn. Repurposing gans for one-shot semantic part segmentation, 2021.
+
+Qian Wang and Toby Breckon. Unsupervised domain adaptation via structured prediction based selective pseudo-labeling. Proceedings of the AAAI Conference on Artificial Intelligence, 34 (04):6243–6250, Apr 2020. ISSN 2159-5399. doi: 10.1609/aaai.v34i04.6091. URL http: //dx.doi.org/10.1609/AAAI.V34I04.6091.
+
+Zongze Wu, Dani Lischinski, and Eli Shechtman. Stylespace analysis: Disentangled controls for stylegan image generation. arXiv preprint arXiv:2011.12799, 2020.
+
+Richard Zhang, Phillip Isola, Alexei A. Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric, 2018.
+
+Ruixiang ZHANG, Tong Che, Zoubin Ghahramani, Yoshua Bengio, and Yangqiu Song. Metagan: An adversarial approach to few-shot learning. 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/4e4e53aa080247bc31d0eb4e7aeb07a0-Paper.pdf.
+
+Yuxuan Zhang, Huan Ling, Jun Gao, Kangxue Yin, Jean-Francois Lafleche, Adela Barriuso, Antonio Torralba, and Sanja Fidler. Datasetgan: Efficient labeled data factory with minimal human effort, 2021.
+
+Shengyu Zhao, Zhijian Liu, Ji Lin, Jun-Yan Zhu, and Song Han. Differentiable augmentation for data-efficient gan training, 2020.
+
+Jiapeng Zhu, Yujun Shen, Deli Zhao, and Bolei Zhou. In-domain gan inversion for real image editing. In European Conference on Computer Vision, pp. 592–608. Springer, 2020a.
+
+Peihao Zhu, Rameen Abdal, Yipeng Qin, John Femiani, and Peter Wonka. Improved stylegan embedding: Where are the good latents?, 2020b.
+
+Peihao Zhu, Rameen Abdal, John Femiani, and Peter Wonka. Barbershop: Gan-based image compositing using segmentation masks, 2021.
+
+# A APPENDIX: ADDITIONAL RESULTS
+
+A.1 VISUAL EVALUATION OF STYLE TRANSFER.
+
+We provide additional visual evaluation of the results. In Fig. 9 and 10 we show results of domain adaptation applied to faces. The input photographs are in the top row and the reference images are in the first column. We can see that the results take on the style of the reference image, even though the reference image is far outside the original GAN’s latent space. Also, we notice that overfitting is successfully limited, as each result maintains several important aspects of the input image. In Fig. 13 and 14 we show results for cars, cats, and dogs on the same task. This shows that our method is consistent across different StyleGAN objects/datasets.
+
+# A.2 QUANTITATIVE COMPARISON OF SKETCH IMAGES.
+
+We calculate the FID (Heusel et al., 2017) between 1,000 generated images and the entire sketch dataset. Additionally, we report the precision and recall metric (Kynka¨anniemi et al., 2019) to ¨ measure the quality and diversity respectively. As shown in Tab. 1, our method outperforms the contemporary methods Few-Shot (Ojha et al., 2021), and StyleGAN-NADA (Gal et al., 2021) on both metrics.
+
+Another contemporary method, TargetCLIP (Chefer et al., 2021), is capable of one-shot ‘essence transfer’ using a latent-edit, however as the weights of the generator are not modified their approach is restricted to the manifold of the original generator. Because it cannot shift to a completely new domain, TargetCLIP failed to produce any sketch images and has a precision ${ } = 0$ . Because the images it did generate are in the original space of StyleGAN it has high recall (0.29), but this number is not meaningful.
+
+Unsurprisingly, all one-shot domain transfer methods have low recall (low diversity) but it is significant that ours is the only approach with positive recall to within 2 significant digits.
+
+Table 1: Quantitative comparison on one-shot adaptation between few-shot-domain-adaptation, StyleGAN-NADA, and our method. Evaluation metrics include FID, precision, and recall (higher means higher diversity).
+
+
One Shot Method
FID↓
precision↑
recall个
Few-shot (Ojha et al., 2021)
158.86
0.00
0.00
SG-NADA (Gal et al., 2021)
124.55
0.12
0.00
Ours
78.35
0.33
0.02
+
+# A.3 MULTI-SHOT DOMAIN ADAPTATION.
+
+Although it was designed for one-shot domain adaptation, our method can be extended to few-shot domain adaptation by using multiple input/reference image pairs $( I _ { A } , I _ { B } )$ . In Fig. 11, We show the visual improvement obtained using 3-shot reference images.
+
+# A.4 CONTROLLING THE STYLE GAP
+
+Our method provides a way to control the domain gap between the domain $A$ and domain $B$ by explicitly controlling the style of the images sampled from or embedded in domain $A$ . Fig. 12 shows that we can control the degree to which style from the reference image is preserved by increasing the style-mixing parameter $\alpha$ , which is not possible with any of the competing methods. This gives users more control over content generation and editing.
+
+# A.5 ADDITIONAL COMPARISON
+
+In addition to our comparison with StyleGAN-NADA (Gal et al., 2021) and few-shot domain adaptation (Ojha et al., 2021), we compare against three additional methods in Fig. 15. These include one concurrently developed method called TargetCLIP (Chefer et al., 2021) as well as two other methods that work on lower resolution images for one-shot domain transfer. These are the method of Gatys et. al Gatys et al. (2016) and the the AdaIN approach (Huang & Belongie, 2017). Our visual results compare favorably against the new methods in Fig. 15 with respect to preserving the identity of the original image while also generating images that belong to the new domain.
+
+
+Figure 9: Style transfer results obtained by our method after style interpolation in domain $B$ . The top row represents the real images embedded in the latent space of $G _ { A }$ (domain $A$ ) whose latent codes are then used by $G _ { B }$ (domain $B$ ). The first column represents the reference images $I _ { B }$ which are input to our domain adaptation framework.
+
+# A.6 INFERENCE AND EDITING TIME
+
+Our proposed approach uses II2S for training and inference and StyleFlow (Abdal et al., 2021b) for editing in the new domain. GAN inversion using II2S on HD $( 1 0 2 4 \times 1 0 2 4 )$ images takes 150 seconds on average, and each latent-code edit operation takes 0.47 seconds. Generating the images afterwards takes an addition 0.34 seconds. Note that the run-time is dominated by GAN -inversion using II2S, however as we show in Fig. 16 once training is completed, we can use other GAN inversion methods to accomplish the edits. With e4e (Tov et al., 2021) inversion is only 0.22 seconds and the entire process of inversion, editing, and generating the edited image can be accomplished in approximately one second.
+
+
+Figure 10: The structure of rows and columns is the same as in Fig. 9. Note: our method also works well when the reference images are real face images.
+
+single-shot
+
+
+Figure 11: Our method extends to deal with multiple reference images. The figure compares the results using 3 reference images and using single reference image. It can be observed that our method can better catch the general style and achieve more stable results when given multiple reference images.
+
+
+Figure 12: Style interpolation results achieved by our framework. Unlike the competing methods, our method has an explicit control over the styles in the domain $B$ . Each sub figure shows a reference image and images embedded in domain $A$ . Notice that we can control the amount of variation in style depending on a parameter $\alpha$ that can be specified by a user.
+
+
+Figure 13: Our domain transfer results on cars. The structure of rows and columns is the same as in Fig. 9.
+
+
+Figure 14: Our domain transfer results on cats and dogs. The structure of rows and columns is the same as in Fig. 9.
+
+
+Figure 15: Additional comparisons with other baseline methods including the concurrent method TargetCLIP (Chefer et al., 2021) as well as two lower-resolution methods from Gatys et al. (2016) and AdaIN (Huang & Belongie, 2017). One-shot reference images from domain $B$ are shown in the left column. Each image is the result of transferring the image in the top row into the new domain. Compare these images to our method in Fig. 7, our proposed approach has fewer artifacts while preserving the identity of the image in domain $A$ .
+
+
+Figure 16: Comparison domain-transfer and editing using II2S vs e4e. The new GAN is always trained using II2S, but once training is complete, e4e can be used to transfer images into the new domain. II2S takes 2.5 minutes to embed the image, while e4e needs about 0.22 seconds. StyleFlow editing takes 0.47 seconds, and StyleGAN image generation takes about 0.34 seconds.
\ No newline at end of file
diff --git a/md/dev/vruwp11pWnO/vruwp11pWnO.md b/md/dev/vruwp11pWnO/vruwp11pWnO.md
new file mode 100644
index 0000000000000000000000000000000000000000..987aa392ec64708e552a105373cb151c2ba86532
--- /dev/null
+++ b/md/dev/vruwp11pWnO/vruwp11pWnO.md
@@ -0,0 +1,285 @@
+# IMPROVING AND ASSESSING ANOMALY DETECTORS FOR LARGE-SCALE SETTINGS
+
+Anonymous authors Paper under double-blind review
+
+# ABSTRACT
+
+Detecting out-of-distribution examples is important for safety-critical machine learning applications such as detecting novel biological phenomena and self-driving cars. However, existing research mainly focuses on simple small-scale settings. To set the stage for more realistic out-of-distribution detection, we depart from small-scale settings and explore large-scale multiclass and multi-label settings with high-resolution images and thousands of classes. To make future work in real-world settings possible, we create new benchmarks for three large-scale settings. To test ImageNet multiclass anomaly detectors, we introduce a new dataset of anomalous species. We leverage ImageNet-21K to evaluate PASCAL VOC and COCO multilabel anomaly detectors. Third, we introduce a new benchmark for anomaly segmentation by introducing a segmentation benchmark with road anomalies. We conduct extensive experiments in these more realistic settings for out-of-distribution detection and find that a surprisingly simple detector based on the maximum logit outperforms prior methods in all the large-scale multi-class, multi-label, and segmentation tasks, establishing a simple new baseline for future work.
+
+# 1 INTRODUCTION
+
+Out-of-distribution (OOD) detection is a valuable tool for developing safe and reliable machine learning (ML) systems. Detecting anomalous inputs allows systems to initiate a conservative fallback policy or defer to human judgment. As an important component of ML Safety (Hendrycks et al., 2021), OOD detection is important for safety-critical applications such as self-driving cars and detecting novel microorganisms. Accordingly, research on out-of-distribution detection has a rich history spanning several decades (Schölkopf et al., 1999; Breunig et al., 2000; Emmott et al., 2015). Recent work leverages deep neural representations for out-of-distribution detection in complex domains, such as image data (Hendrycks & Gimpel, 2017; Lee et al., 2018a; Mohseni et al., 2020; Hendrycks et al., 2019b). However, these works still primarily use small-scale datasets with low-resolution images and few classes. As the community moves towards more realistic, large-scale settings, strong baselines and high-quality benchmarks are imperative for future progress.
+
+Large-scale datasets such as ImageNet (Deng et al., 2009) and Places365 (Zhou et al., 2017) present unique challenges not seen in small-scale settings, such as a plethora of fine-grained object classes. We demonstrate that the maximum softmax probability (MSP) detector, a state-of-the-art method for small-scale problems, does not scale well to these challenging conditions. Through extensive experiments, we identify a detector based on the maximum logit (MaxLogit) that greatly outperforms the MSP and other strong baselines in large-scale multi-class anomaly segmentation. To facilitate further research in this setting, we also collect a new out-of-distribution test dataset suitable for models trained on highly diverse datasets. Shown in Figure 2, our Species dataset contains diverse, anomalous species that do not overlap ImageNet-21K which has approximately twenty two thousand classes. Species avoids data leakage and enables a stricter evaluation methodology for ImageNet-21K models. Using Species to conduct more controlled experiments without train-test overlap, we find that contrary to prior claims (Fort et al., 2021; Koner et al., 2021), Vision Transformers (Dosovitskiy et al., 2021a) pre-trained on ImageNet-21K are not substantially better at out-of-distribution detection.
+
+Moreover, in the common real-world case of multi-label data, the MSP detector cannot naturally be applied in the first place, as it requires softmax probabilities. To enable research into the multi-label setting for anomaly detection, we contribute a multi-label experimental setup and explore various methods on large-scale multi-label datasets. We find that the MaxLogit detector from our investigation into the large-scale multi-class setting generalizes well to multi-label data and again outperforms all other baselines.
+
+
+Figure 1: We scale up out-of-distribution detection to large-scale multi-class datasets with thousands of classes, multi-label datasets with complex scenes, and anomaly segmentation in driving environments. We introduce new benchmarks for all three settings. In all of these settings, we find that an OOD detector based on the maximum logit outperforms previous methods, establishing a strong and versatile baseline for future work on large-scale OOD detection. The bottom-right shows a scene from our new anomaly segmentation benchmark and the predicted anomaly using a state-of-the-art detector.
+
+In addition to focusing on small-scale datasets, most existing benchmarks for anomaly detection treat entire images as anomalies. In practice, an image could be anomalous in localized regions while being in-distribution elsewhere. Knowing which regions of an image are anomalous could allow for safer handling of unfamiliar objects in the case of self-driving cars. Creating a benchmark for this task is difficult, though, as simply cutting and pasting anomalous objects into images introduces various unnatural giveaway cues such as edge effects, mismatched orientation, and lighting, all of which trivialize the task of anomaly segmentation (Blum et al., 2019).
+
+To overcome these issues, we utilize a simulated driving environment to create the novel StreetHazards dataset for anomaly segmentation. Using the Unreal Engine and the open-source CARLA simulation environment (Dosovitskiy et al., 2017), we insert a diverse array of foreign objects into driving scenes and re-render the scenes with these novel objects. This enables integration of the foreign objects into their surrounding context with correct lighting and orientation, sidestepping giveaway cues.
+
+To complement the StreetHazards dataset, we convert the BDD100K semantic segmentation dataset (Yu et al., 2018) into an anomaly segmentation dataset, which we call BDD-Anomaly. By leveraging the large scale of BDD100K, we reserve infrequent object classes to be anomalies. We combine this dataset with StreetHazards to form the Combined Anomalous Object Segmentation (CAOS) benchmark. The CAOS benchmark improves over previous evaluations for anomaly segmentation in driving scenes by evaluating detectors on realistic and diverse anomalies. We evaluate several baselines on the CAOS benchmark and discuss problems with porting existing approaches from earlier formulations of out-of-distribution detection.
+
+Despite its simplicity, we find that the MaxLogit detector outperforms all baselines on Species, our multi-class benchmark, and CAOS. In each of these three settings, we discuss why MaxLogit provides superior performance, and we show that these gains are hidden if one looks at small-scale problems alone. The code for our experiments and the Species and CAOS datasets are available at [anonymized]. Our new baseline combined with Species and CAOS benchmarks pave the way for future research on large-scale out-of-distribution detection.
+
+# Anomalous Species Dataset
+
+
+Figure 2: The Species out-of-distribution dataset is designed for large-scale anomaly detectors pretrained on datasets as diverse as ImageNet-21K. When models are pretrained on ImageNet-21K, many previous OOD detection datasets may overlap with the pretraining set, resulting in erroneous evaluations. To rectify this, Species is comprised of hundreds of anomalous species that are disjoint from ImageNet-21K classes and enables the evaluation of cutting-edge models.
+
+# 2 RELATED WORK
+
+Multi-Class Out-of-Distribution Detection. A recent line of work leverages deep neural representations from multi-class classifiers to perform out-of-distribution (OOD) detection on highdimensional data, including images, text, and speech data. Hendrycks & Gimpel (2017) formulate the task and propose the simple baseline of using the maximum softmax probability of the classifier on an input to gauge whether the input is out-of-distribution. In particular, they formulate the task as distinguishing between examples from an in-distribution dataset and various OOD datasets. Importantly, entire images are treated as out-of-distribution.
+
+Continuing this line of work, Lee et al. (2018a) propose to improve the neural representation of the classifier to better separate OOD examples. They use generative adversarial networks to produce neardistribution examples and induce uniform posteriors on these synthetic OOD examples. Hendrycks et al. (2019b) observe that outliers are often easy to obtain in large quantity from diverse, realistic datasets and demonstrate that OOD detectors trained on these outliers generalize to unseen classes of anomalies. Other work investigates improving the anomaly detectors themselves given a fixed classifier (DeVries & Taylor, 2018; Liang et al., 2018). However, as Hendrycks et al. (2019b) observe, many of these works tune hyperparameters on a particular type of anomaly that is also seen at test time, so their evaluation setting is more lenient. In this paper, all anomalies seen at test time come from entirely unseen categories and are not tuned on in any way. Hence, we do not compare to techniques such as ODIN (Liang et al., 2018). Additionally, in a point of departure from prior work, we focus primarily on large-scale images and datasets with many classes.
+
+Recent work has suggested that stronger representations from Vision Transformers pre-trained on ImageNet-21K can make out-of-distribution detection trivial (Fort et al., 2021; Koner et al., 2021). They evaluate models on detecting CIFAR-10 when fine-tuned on CIFAR-100 or vice versa, using models pretrained on ImageNet-21K. However, over 1,000 classes in ImageNet-21K overlap with CIFAR-10, so it is still unclear how Vision Transformers perform at detecting entirely unseen OOD categories. We create a new OOD test dataset of anomalous species to investigate how well Vision Transformers perform in controlled OOD detection settings without data leakage and overlap. We find that Vision Transformers pre-trained on ImageNet-21K are far from solving OOD detection in large-scale settings.
+
+
FPR95↓
AUROC↑
AUPR↑
Din
MSP
DeVries
MaxLogit
MSP
DeVries MaxLogit
MSP
DeVries
MaxLogit
ImageNet
44.2
46.0
35.8
84.6
76.9
87.2
38.2
30.5
45.8
Places365
52.6
85.8
36.6
76.0
31.1
85.8
8.2
2.0
19.2
+
+Table 1: Multi-class out-of-distribution detection results using the maximum softmax probability (MSP) baseline (Hendrycks & Gimpel, 2017), the confidence branch detector of DeVries & Taylor (2018), and our maximum logit baseline. All values are percentages and average across five out-ofdistribution test datasets. Full results on individual OOD test datasets are in the Appendix.
+
+Anomaly Segmentation. Several prior works explore segmenting anomalous image regions. One line of work uses the WildDash dataset (Zendel et al., 2018), which contains numerous annotated driving scenes in conditions such as snow, fog, and rain. The WildDash test set contains fifteen “negative images” from different domains for which the goal is to mark the entire image as out-ofdistribution. Thus, while the task is segmentation, the anomalies do not exist as objects within an otherwise in-distribution scene. This setting is similar to that explored by Hendrycks & Gimpel (2017), in which whole images from other datasets serve as out-of-distribution examples.
+
+To approach anomaly segmentation on WildDash, Krešo et al. (2018) train on multiple semantic segmentation domains and treat regions of images from the WildDash driving dataset as out-ofdistribution if they are segmented as regions from different domains, i.e. indoor classes. Bevandic´ et al. (2018) use ILSVRC 2012 images and train their network to segment the entirety of these images as out-of-distribution.
+
+In medical anomaly segmentation and product fault detection, anomalies are regions of otherwise in-distribution images. Baur et al. (2019) segment anomalous regions in brain MRIs using pixelwise reconstruction loss. Similarly, Haselmann et al. (2018) perform product fault detection using pixel-wise reconstruction loss and introduce an expansive dataset for segmentation of product faults. In these relatively simple domains, reconstruction-based approaches work well. In contrast to medical anomaly segmentation and fault detection, we consider complex images from street scenes. These images have high variability in scene layout and lighting, and hence are less amenable to reconstruction-based techniques.
+
+The two works closest to our own are the Lost and Found (Pinggera et al., 2016) and Fishyscapes (Blum et al., 2019) datasets. The Lost and Found dataset consists of real images in a driving environment with small road hazards. The images were collected to mirror the Cityscapes dataset (Cordts et al., 2016) but are only collected from one city and so have less diversity. The dataset contains 35 unique anomalous objects, and methods are allowed to train on many of these. For Lost and Found, only nine unique objects are truly unseen at test time. Crucially, this is a different evaluation setting from our own, where anomalous objects are not revealed at training time, so their dataset is not directly comparable. Nevertheless, the BDD-Anomaly dataset fills several gaps in Lost and Found. First, the images are more diverse, because they are sourced from a more recent and comprehensive semantic segmentation dataset. Second, the anomalies are not restricted to small, sparse road hazards. Concretely, anomalous regions in Lost and Found take up $0 . 1 1 \%$ of the image on average, whereas anomalous regions in the BDD-Anomaly dataset are larger and fill $0 . 8 3 \%$ of the image on average. Finally, although the BDD-Anomaly dataset treats three categories as anomalous, compared to Lost and Found it has far more unique anomalous objects.
+
+The Fishyscapes benchmark for anomaly segmentation consists of cut-and-paste anomalies from out-of-distribution domains. This is problematic, because the anomalies stand out as clearly unnatural in context. For instance, the orientation of anomalous objects is unnatural, and the lighting of the cut-and-paste patch differs from the lighting in the original image, providing an unnatural cue to anomaly detectors that would not exist for real anomalies. Figure 7 shows an example of these inconsistencies. Techniques for detecting image manipulation (Zhou et al., 2018; Johnson & Farid, 2005) are competent at detecting artificial image elements of this kind. Our StreetHazards dataset overcomes these issues by leveraging a simulated driving environment to naturally insert anomalous 3D models into a scene rather than overlaying 2D images. These anomalies are integrated into the scene with proper lighting and orientation, mimicking real-world anomalies and making them significantly more difficult to detect.
+
+
+Figure 3: Small-scale datasets such as CIFAR-10 have relatively disjoint classes, but larger-scale datasets including ImageNet-1K have several classes with high visual similarity to other classes. This implies that large-scale classifiers disperse probability mass among several classes. If the prediction confidence is used for out-of-distribution detection, then images which have similarities to other classes will often wrongly be deemed out-of-distribution due to low and dispersed confidence. This motivates our MaxLogit out-of-distribution detector.
+
+# 3 MULTI-CLASS PREDICTION FOR OOD DETECTION
+
+Problem with existing baselines. Existing baselines for anomaly detection can work well in small-scale settings. However, in more realistic settings image classification networks are often tasked with distinguishing hundreds or thousands of classes, possibly with subtle differences. This is problematic for the maximum softmax probability (MSP) baseline (Hendrycks & Gimpel, 2017), which uses the negative maximum softmax probability as the anomaly score, or $\begin{array} { r } { \dot { { \bf \varphi } } - \operatorname* { m a x } _ { k } \exp f ( x ) _ { k } / \sum _ { i } \exp f ( \bar { x _ { i } } ) _ { i } = - \operatorname* { m a x } _ { k } \hat { p } ( y = k \mid x ) } \end{array}$ , where $f ( x )$ is the unnormalized logits of classifier $f$ on input $x$ . Classifiers tend to have higher confidence on in-distribution examples than out-of-distribution examples, enabling OOD detection. Assuming single-model evaluation and no access to other anomalies or test-time adaptation, the MSP attains state-of-the-art anomaly detection performance in small-scale settings. However, we show that the MSP is problematic for realistic in-distribution datasets with many classes, such as ImageNet and Places365 (Zhou et al., 2017). Probability mass can be dispersed among visually similar classes, as shown in Figure 3. Consequently, a classifier may produce a low confidence prediction for an in-distribution image, not because the image is unfamiliar, but because the object’s exact class is difficult to determine. To circumvent this problem, we propose using the negative of the maximum unnormalized logit for an anomaly score $- \operatorname* { m a x } _ { k } f ( x ) _ { k }$ , which we call MaxLogit. Since the logits are unnormalized, they are not affected by the number of classes and can serve as a better baseline for large-scale out-of-distribution detection.
+
+The Species Out-Of-Distribution Dataset. To enable controlled experiments and high-quality evaluations of anomaly detectors in large-scale settings, we create the Species dataset, a new outof-distribution test dataset that has no overlapping classes with ImageNet-21K. The Species dataset is comprised of images scraped from the iNaturalist website and contains hundreds of anomalous species grouped into seven high-level categories: Plants, Microorganisms, Amphibians, Protozoa, Fungi, Arachnids, and Insects. Example images from the Species dataset are in Figure 2.
+
+Setup. To evaluate the MSP baseline out-of-distribution detector and the MaxLogit detector, we use ImageNet-21K as the in-distribution dataset $\mathcal { D } _ { \mathrm { i n } }$ . To obtain representations for anomaly detection, we use models trained on ImageNet-21K-P, a cleaned version of ImageNet-21K with a train/val split (Ridnik et al., 2021a). We evaluate a TResNet-M, ViT-B-16, and Mixer-B-16 (Ridnik et al., 2021b; Dosovitskiy et al., 2021b; Tolstikhin et al., 2021), and the validation split is used for obtaining in-distribution scores. For out-of-distribution test datasets $\mathcal { D } _ { \mathrm { o u t } }$ , we use categories from the Species dataset, all of which are unseen during training. Results for these experiments are in Table 2. We also use ImageNet-1K and Places365 as in-distribution datasets $\mathcal { D } _ { \mathrm { i n } }$ , for which we use pretrained ResNet-50 models and use several out-of-distribution test datasets $\mathcal { D } _ { \mathrm { o u t } }$ . Full results with ImageNet and Places365 as in-distribution are in the Appendix.
+
+Table 2: Results on Species. Models and the processed version of ImageNet-21K (ImageNet-21K-P) are from Ridnik et al. (2021a). All values are percent AUROC. Species enables evaluating anomaly detectors trained on ImageNet-21K and evades class overlap issues present in prior work. Using Species to conduct more controlled experiments without class overlap issues, we find that contrary to recent claims (Fort et al., 2021), simply scaling up Vision Transformers does not make OOD detection trivial.
+
+
ResNet
ViT
MLPMixer
Din
Dtest out
MSP
MaxLogit
MSP
MaxLogit
MSP
MaxLogit
Plants
80.3
87.8
78.2
84.8
80.3
85.0
Microorganisms
77.4
83.4
71.1
82.4
74.4
86.0
Amphibians
41.8
48.6
41.9
48.8
44.4
51.7
Protozoa
70.7
80.4
69.3
80.9
68.0
77.7
Fungi
66.4
77.4
64.7
76.1
64.1
76.9
het
Arachnids
46.9
56.7
46.6
56.8
48.9
58.8
Insects
47.6
56.4
48.0
54.6
48.6
53.8
Mean
61.6
70.1
60.0
69.2
61.2
70.0
+
+Metrics. To evaluate out-of-distribution detectors in large-scale settings, we use three standard metrics of detection performance: area under the ROC curve (AUROC), false positive rate at $9 5 \%$ recall (FPR95), and area under the precision-recall curve (AUPR). The AUROC and AUPR are important metrics, because they give a holistic measure of performance when the cutoff for detecting anomalies is not a priori obvious or when we want to represent the performance of a detection method across several different cutoffs.
+
+The AUROC can be thought of as the probability that an anomalous example is given a higher score than an ordinary example. Thus, a higher score is better, and an uninformative detector has a AUROC of $50 \%$ . AUPR provides a metric more attuned to class imbalances, which is relevant in anomaly and failure detection, when the number of anomalies or failures may be relatively small. Last, the FPR95 metric consists of measuring the false positive rate at $9 5 \%$ . Since these measures are correlated, we occasionally solely present the AUROC for brevity and to preserve space.
+
+Results. Results on Species are shown in Table 2. Results with ImageNet-1K and Places365 as in-distribution datasets are in Table 1. We find that the proposed MaxLogit method outperforms the maximum softmax probability baseline on all out-of-distribution test datasets $\mathcal { D } _ { \mathrm { o u t } }$ . This holds true for all three models trained on ImageNet-21K. The MSP baseline is not much better than random and is has similar performance for all three model classes. This suggests that contrary to recent claims, (Fort et al., 2021) simply scaling up Vision Transformers does not make OOD detection trivial.
+
+# 4 MULTI-LABEL PREDICTION FOR OOD DETECTION
+
+Current work on out-of-distribution detection primarily considers multi-class or unsupervised settings. Yet as classifiers become more useful in realistic settings, the multi-label formulation becomes increasingly natural. To investigate out-of-distribution detection in multi-label settings, we provide a baseline and evaluation setup.
+
+Setup. For multi-label classification we use PASCAL VOC (Everingham et al., 2009) and MSCOCO (Lin et al., 2014) as in-distribution data. To evaluate anomaly detectors for these in-distribution datasets, we use 20 out-of-distribution classes from ImageNet-21K. These classes have no overlap with ImageNet-1K, PASCAL VOC, or MS-COCO. The 20 classes are chosen not to overlap with ImageNet-1K since the multi-label classifiers models are pre-trained on ImageNet-1K. We list the class WordNet IDs in the Appendix.
+
+Methods. For our experiments, we use a ResNet-101 backbone architecture pre-trained on ImageNet-1K. We replace the final layer with 2 fully connected layers and apply the logistic sigmoid function for multi-label prediction. During training we freeze the batch normalization parameters due to an insufficient number of images for proper mean and variance estimation. We train each model for 50 epochs using the Adam optimizer (Kingma & Ba, 2014) with hyperparameter values $1 0 ^ { - 4 }$ and
+
+Table 3: Multi-label out-of-distribution detection comparison of the Isolation Forest (iForest), Local Outlier Factor (LOF), Dropout, logit average, maximum softmax probability, and maximum logit anomaly detectors on PASCAL VOC and MS-COCO. The same network architecture is used for all three detectors. All results shown are percentages.
+
+
iForest
LOF
Dropout
LogitAvg
MSP
MaxLogit
PASCAL VOC
FPR95
98.6
84.0
97.2
98.2
82.3
35.6
AUROC
46.3
68.4
49.2
47.9
74.2
90.9
AUPR
→↑↑
37.1
58.4
45.3
41.3
65.5
81.2
COCO
FPR95
√
95.6
78.4
93.3
94.5
81.8
40.4
AUROC
个
41.4
70.2
58.0
55.5
70.7
90.3
AUPR
个
63.7
82.0
76.3
74.0
82.9
94.0
+
+$1 0 ^ { - 5 }$ for $\beta _ { 1 }$ and $\beta _ { 2 }$ respectively. For data augmentation we use standard resizing, random crops, and random flips to obtain images of size $2 5 6 \times 2 5 6 \times 3$ . As a result of this training procedure, the mAP of the ResNet-101 on PASCAL VOC is $8 9 . 1 1 \%$ and $7 2 . 0 \%$ for MS-COCO.
+
+As there has been little work on out-of-distribution detection in multilabel settings, we include comparisons to classic anomaly detectors for general settings. Isolation Forest, denoted by iForest, works by randomly partitioning the space into half spaces to form a decision tree. The score is determined by how close a point is to the root of the tree. The local outlier factor (LOF) (Breunig et al., 2000) computes a local density ratio between every element and its neighbors. We set the number of neighbors as 20. iForest and LOF are both computed on features from the penultimate layer of the networks. MSP denotes a natural extension of the maximum softmax probability detector in the multi-label setting, obtained by taking the sigmoid of each output score $f ( { \boldsymbol { x } } ) _ { i }$ and computing $- \operatorname* { m a x } _ { i } \sigma ( f ( x ) _ { i } )$ . Alternatively, one can average the logit values, denoted by LogitAvg. These serve as our baseline detectors for multi-label OOD detection. We compare these baselines to the MaxLogit detector that we introduce in Section 3. As in the multi-class case, the MaxLogit anomaly score for multi-label classification is $- \operatorname* { m a x } _ { i } f ( x ) _ { i }$ .
+
+Results. Results are shown in Table 3. We find that MaxLogit obtains the highest performance in all cases. MaxLogit bears similarity to the MSP baseline (Hendrycks & Gimpel, 2017) but is naturally applicable to multi-label problems. These results establish the MaxLogit as an effective and natural baseline for large-scale multi-label problems. Further, the evaluation setup enables future work in out-of-distribution detection with multi-label datasets.
+
+# 5 THE CAOS BENCHMARK
+
+The Combined Anomalous Object Segmentation (CAOS) benchmark is comprised of two complementary datasets for evaluating anomaly segmentation systems on diverse, realistic anomalies. First is the StreetHazards dataset, which leverages simulation to provide a large variety of anomalous objects realistically inserted into driving scenes. Second is the BDD-Anomaly dataset, which consists of real images taken from the BDD100K dataset (Yu et al., 2018). StreetHazards contains a highly diverse array of anomalies; BDD-Anomaly contains anomalies in real-world images. Together, these datasets allow researchers to judge techniques on their ability to segment diverse anomalies as well as anomalies in real images. All images have $7 2 0 \times 1 2 8 0$ resolution.
+
+The StreetHazards Dataset. StreetHazards is an anomaly segmentation dataset that leverages simulation to provide diverse, realistically-inserted anomalous objects. To create the StreetHazards dataset, we use the Unreal Engine along with the CARLA simulation environment (Dosovitskiy et al., 2017). From several months of development and testing including customization of the Unreal Engine and CARLA, we can insert foreign entities into a scene while having them be properly integrated. Unlike previous work, this avoids the issues of inconsistent chromatic aberration, inconsistent lighting, edge effects, and other simple cues that an object is anomalous. Additionally, using a simulated environment allows us to dynamically insert diverse anomalous objects in any location and have them render properly with changes to lighting and weather including time of day, cloudy skies, and rain.
+
+We use 3 towns from CARLA for training, from which we collect RGB images and their respective semantic segmentation maps to serve as training data for semantic segmentation models. We generate a validation set from the fourth town. Finally, we reserve the fifth and sixth town as our test set. We insert anomalies taken from the Digimation Model Bank Library and semantic ShapeNet (ShapeNetSem) (Savva et al., 2015) into the test set in order to evaluate methods for out-of-distribution detection. In total, we use 250 unique anomaly models of diverse types. There are 12 classes used for training: background, road, street lines, traffic signs, sidewalk, pedestrian, vehicle, building, wall, pole, fence, and vegetation. The thirteenth class is the anomaly class that is only used at test time. We collect 5,125 image and semantic segmentation ground truth pairs for training, 1,031 pairs without anomalies for validation, and 1,500 test pairs with anomalies.
+
+
+Figure 4: A sample of anomalous scenes from the CAOS benchmark with model predictions and anomaly scores. The anomaly scores are thresholded to the top $10 \%$ of values for visualization. GT is ground truth, the autoencoder model is based on the spatial autoencoder used in Baur et al. (2019), MSP is the maximum softmax probability baseline (Hendrycks & Gimpel, 2017), and MaxLogit is the method we propose as a new baseline for large-scale settings. Compared to baselines, the MaxLogit detector places lower scores on in-distribution image regions, including object outlines, while also doing a better job of highlighting anomalous objects.
+
+The BDD-Anomaly Dataset. BDD-Anomaly is an anomaly segmentation dataset with real images in diverse conditions. We source BDD-Anomaly from BDD100K (Yu et al., 2018), a large-scale semantic segmentation dataset with diverse driving conditions. The original data consists in 7,000 images for training and 1,000 for validation. There are 18 original classes. We choose motorcycle, train, and bicycle as the anomalous object classes and remove all images with these objects from the training and validation sets. This yields 6,280 training pairs, 910 validation pairs without anomalies, and 810 testing pairs with anomalous objects.
+
+# 5.1 EXPERIMENTS
+
+Evaluation. In anomaly segmentation experiments, each pixel is treated as a prediction, resulting in many predictions to evaluate. To fit these in memory, we compute the metrics on each image and average over the images to obtain final values.
+
+Methods. Our first baseline is pixel-wise Maximum Softmax Probability (MSP). Introduced by Hendrycks & Gimpel (2017) for multi-class out-of-distribution detection, we directly port this baseline to anomaly segmentation. Alternatively, the background class might serve as an anomaly detector, because it contains everything not in the other classes. To test this hypothesis, “Background” uses the posterior probability of the background class as the anomaly score. The Dropout method leverages MC Dropout (Gal & Ghahramani, 2016) to obtain an epistemic uncertainty estimate. Following Kendall et al. (2015), we compute the pixel-wise posterior variance over multiple dropout masks and average across all classes, which serves as the anomaly score. We also experiment with an autoencoder baseline similar to Baur et al. (2019); Haselmann et al. (2018) where pixel-wise reconstruction loss is used as the anomaly score. This method is called AE. The “Branch” method is a direct port of the confidence branch detector from DeVries & Taylor (2018) to pixel-wise prediction. Finally, we use the MaxLogit method described in earlier sections independently on each pixel.
+
+Table 4: Results on the CAOS benchmark. AUPR is low across the board due to the large class imbalance, but all methods perform substantially better than chance. MaxLogit obtains the best performance. All results are percentages.
+
+
MSP
Branch
Background
Dropout
AE
MaxLogit
StreetHazards
FPR95
33.7
68.4
69.0
79.4
91.7
26.5
AUROC
87.7
65.7
58.6
69.9
66.1
89.3
↓↑ AUPR 个
6.6
1.5
4.5
7.5
2.2
10.6
BDD-Anomaly AUROC
FPR95
24.5
25.6
40.1
16.6
74.1
14.0
87.7
85.6
69.7
90.8
64.0
92.6
AUPR
3.7
3.9
1.1
4.3
0.7
5.4
+
+For all of the baselines except the autoencoder, we train a PSPNet (Zhao et al., 2017) decoder with a ResNet-101 encoder (He et al., 2015) for 20 epochs. We train both the encoder and decoder using SGD with momentum of 0.9, a learning rate of $2 \times 1 0 ^ { - 2 }$ , and learning rate decay of $1 0 ^ { - 4 }$ . For AE, we use a 4-layer U-Net (Ronneberger et al., 2015) with a spatial latent code as in Baur et al. (2019). The U-Net also uses batch norm and is trained for 10 epochs. Results are in Table 4.
+
+Results and Analysis. MaxLogit outperforms all other methods across the board by a substantial margin. The intuitive baseline of using the posterior for the background class to detect anomalies performs poorly, which suggests that the background class may not align with rare visual features. Even though reconstruction-based scores succeed in product fault segmentation, we find that the AE method performs poorly on the CAOS benchmark, which may be due to the more complex domain. AUPR for all methods is low, indicating that the large class imbalance presents a serious challenge. However, the substantial improvements with the MaxLogit method suggest that progress on this task is possible and there is much room for improvement. A comparison with other datasets is in Figure 5 (Pinggera et al., 2016; Blum et al., 2019; Jung et al., 2021).
+
+Figure 5: Auxiliary analysis of the MSP and the MaxLogit AUROCs using prior less comprehensive anomaly segmentation datasets.
+
+
Method
MSP
MaxLogit
FS Lost and Found
87.0%
92.0%
Road Anomaly
73.8%
78.0%
+
+In Figure 4, we see that both MaxLogit and MSP have many false positives, as they assign high anomaly scores to semantic boundaries, a problem also observed in the recent works of (Blum et al., 2019; Angus, 2019). However, the problem is less severe with MaxLogit. A potential explanation for this is that even when the prediction confidence dips at semantic boundaries, the maximum logit can remain the same in a ‘hand-off’ procedure between the classes. Thus, MaxLogit provides a natural mechanism to combat semantic boundary artifacts that could be further explored in future work.
+
+# 6 CONCLUSION
+
+We scaled out-of-distribution detection to settings with thousands of classes and high-resolution images. We identified an issue faced by existing baselines when scaling to these settings and proposed the maximum logit detector as a natural solution. We introduced the Species dataset to enable more controlled experiments without class overlap and also investigated using multi-label classifiers for OOD detection, establishing an experimental setup for this previously unexplored setting. Finally, we introduced the CAOS benchmark for anomaly segmentation, consisting of diverse, naturally-integrated anomalous objects in driving scenes. Baseline methods on the CAOS benchmark substantially improve on random guessing but are still lacking, indicating potential for future work. Interestingly, the MaxLogit detector also provides consistent and significant gains in the multi-label and anomaly segmentation settings, thereby establishing it as a new baseline in place of the maximum softmax probability baseline on large-scale OOD detection problems. In all, we we hope that our contributions will enable further research on out-of-distribution detection for real-world safety-critical environments.
+
+# REFERENCES
+
+Matt Angus. Towards pixel-level ood detection for semantic segmentation, 2019.
+
+Christoph Baur, Benedikt Wiestler, Shadi Albarqouni, and Nassir Navab. Deep autoencoding models for unsupervised anomaly segmentation in brain mr images. Lecture Notes in Computer Science, pp. 161–169, 2019. ISSN 1611-3349. doi: 10.1007/978-3-030-11723-8_16.
+
+Petra Bevandic, Ivan Krešo, Marin Orši ´ c, and Siniša Šegvi ´ c. Discriminative out-of-distribution ´ detection for semantic segmentation, 2018.
+
+Hermann Blum, Paul-Edouard Sarlin, Juan Nieto, Roland Siegwart, and Cesar Cadena. The fishyscapes benchmark: Measuring blind spots in semantic segmentation, 2019.
+
+Markus M Breunig, Hans-Peter Kriegel, Raymond T $\mathrm { N g }$ , and Jörg Sander. Lof: identifying densitybased local outliers. In ACM sigmod record, volume 29, pp. 93–104. ACM, 2000.
+
+M. Cimpoi, S. Maji, I. Kokkinos, S. Mohamed, , and A. Vedaldi. Describing textures in the wild. In Computer Vision and Pattern Recognition, 2014.
+
+Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In Proc. of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
+
+J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A Large-Scale Hierarchical Image Database. In CVPR09, 2009.
+
+Terrance DeVries and Graham W Taylor. Learning confidence for out-of-distribution detection in neural networks. arXiv preprint arXiv:1802.04865, 2018.
+
+Alexey Dosovitskiy, German Ros, Felipe Codevilla, Antonio Lopez, and Vladlen Koltun. CARLA: An open urban driving simulator. In Proceedings of the 1st Annual Conference on Robot Learning, pp. 1–16, 2017.
+
+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. ArXiv, abs/2010.11929, 2021a.
+
+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, 2021b. URL https://openreview. net/forum?id ${ . } = { }$ YicbFdNTTy.
+
+Andrew Emmott, Shubhomoy Das, Thomas Dietterich, Alan Fern, and Weng-Keen Wong. A meta-analysis of the anomaly detection problem, 2015.
+
+Mark Everingham, Luc Van Gool, Christopher K. I. Williams, John M. Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. International Journal of Computer Vision, 88: 303–338, 2009.
+
+Stanislav Fort, Jie Ren, and Balaji Lakshminarayanan. Exploring the limits of out-of-distribution detection. arXiv preprint arXiv:2106.03004, 2021.
+
+Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. International Conference on Machine Learning, 2016.
+
+Matthias Haselmann, Dieter P Gruber, and Paul Tabatabai. Anomaly detection using deep learning based image completion. In 2018 17th IEEE International Conference on Machine Learning and Applications (ICMLA), pp. 1237–1242. IEEE, 2018.
+
+Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CVPR, 2015.
+
+Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. ICLR, 2017.
+
+Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich. Deep anomaly detection with outlier exposure. Proceedings of the International Conference on Learning Representations, 2019a.
+
+Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich. Deep anomaly detection with outlier exposure. In International Conference on Learning Representations, 2019b.
+
+Dan Hendrycks, Mantas Mazeika, Saurav Kadavath, and Dawn Song. Using self-supervised learning can improve model robustness and uncertainty. In NeurIPS, 2019c.
+
+Dan Hendrycks, Nicholas Carlini, John Schulman, and Jacob Steinhardt. Unsolved problems in ml safety. ArXiv, abs/2109.13916, 2021.
+
+Micah K Johnson and Hany Farid. Exposing digital forgeries by detecting inconsistencies in lighting. In Proceedings of the 7th workshop on Multimedia and security, pp. 1–10, 2005.
+
+Sanghun Jung, Jungsoo Lee, Daehoon Gwak, Sungha Choi, and Jaegul Choo. Standardized max logits: A simple yet effective approach for identifying unexpected road obstacles in urban-scene segmentation. ArXiv, abs/2107.11264, 2021.
+
+Alex Kendall, Vijay Badrinarayanan, and Roberto Cipolla. Bayesian segnet: Model uncertainty in deep convolutional encoder-decoder architectures for scene understanding. ArXiv, abs/1511.02680, 2015.
+
+Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. ICLR, 2014.
+
+Rajat Koner, Poulami Sinhamahapatra, Karsten Roscher, Stephan Günnemann, and Volker Tresp. Oodformer: Out-of-distribution detection transformer. ArXiv, 2021.
+
+Ivan Krešo, Marin Oršic, Petra Bevandi ´ c, and Siniša Šegvi ´ c. Robust semantic segmentation with ´ ladder-densenet models, 2018.
+
+Kimin Lee, Honglak Lee, Kibok Lee, and Jinwoo Shin. Training confidence-calibrated classifiers for detecting out-of-distribution samples. International Conference on Learning Representations, 2018a.
+
+Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. ArXiv, abs/1807.03888, 2018b.
+
+Shiyu Liang, Yixuan Li, and R. Srikant. Enhancing the reliability of out-of-distribution image detection in neural networks. International Conference on Learning Representations, 2018.
+
+Tsung-Yi Lin, Michael Maire, Serge Belongie, Lubomir Bourdev, Ross Girshick, James Hays, Pietro Perona, Deva Ramanan, C. Lawrence Zitnick, and Piotr Dollar. Microsoft COCO: Common objects in context. ECCV, 2014.
+
+Sina Mohseni, Mandar Pitale, Jbs Yadawa, and Zhangyang Wang. Self-supervised learning for generalizable out-of-distribution detection. In AAAI, 2020.
+
+Peter Pinggera, Sebastian Ramos, Stefan K. Gehrig, Uwe Franke, Carsten Rother, and Rudolf Mester. Lost and found: Detecting small road hazards for self-driving vehicles. 2016 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 1099–1106, 2016.
+
+T. Ridnik, Emanuel Ben-Baruch, Asaf Noy, and Lihi Zelnik-Manor. Imagenet-21k pretraining for the masses. ArXiv, abs/2104.10972, 2021a.
+
+Tal Ridnik, Hussam Lawen, Asaf Noy, Emanuel Ben Baruch, Gilad Sharir, and Itamar Friedman. Tresnet: High performance gpu-dedicated architecture. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pp. 1400–1409, 2021b.
+
+Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. Medical Image Computing and Computer-Assisted Intervention – MICCAI 2015, pp. 234–241, 2015. ISSN 1611-3349. doi: 10.1007/978-3-319-24574-4_28.
+
+Manolis Savva, Angel X. Chang, and Pat Hanrahan. Semantically-Enriched 3D Models for Commonsense Knowledge. CVPR 2015 Workshop on Functionality, Physics, Intentionality and Causality, 2015.
+
+Bernhard Schölkopf, Robert Williamson, Alex Smola, John Shawe-Taylor, and John Platt. Support vector method for novelty detection. In Proceedings of the 12th International Conference on Neural Information Processing Systems, NIPS’99, pp. 582–588, Cambridge, MA, USA, 1999. MIT Press.
+
+Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, et al. Mlp-mixer: An all-mlp architecture for vision. arXiv preprint arXiv:2105.01601, 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. CoRR, 2015.
+
+Fisher Yu, Wenqi Xian, Yingying Chen, Fangchen Liu, Mike Liao, Vashisht Madhavan, and Trevor Darrell. BDD100K: A diverse driving video database with scalable annotation tooling. CoRR, abs/1805.04687, 2018.
+
+Oliver Zendel, Katrin Honauer, Markus Murschitz, Daniel Steininger, and Gustavo Fernandez Dominguez. Wilddash-creating hazard-aware benchmarks. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 402–416, 2018.
+
+Hengshuang Zhao, Jianping Shi, Xiaojuan Qi, Xiaogang Wang, and Jiaya Jia. Pyramid scene parsing network. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 6230–6239, 2017.
+
+Bolei Zhou, Agata Lapedriza, Aditya Khosla, Aude Oliva, and Antonio Torralba. Places: A 10 million image database for scene recognition. PAMI, 2017.
+
+Peng Zhou, Xintong Han, Vlad I Morariu, and Larry S Davis. Learning rich features for image manipulation detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1053–1061, 2018.
+
+# A APPENDIX
+
+Table 5: B is for the maximum softmax probability baseline, M is for maximum logit, D is for the method in DeVries & Taylor (2018), and K is our own KL method described below. Both M and K are ours. Results are on ImageNet and Places365. All values are percentages and are rounded so that 99.95 rounds to 100.
+
+
Dest
FPR95↓
AUROC ↑
AUPR↑
Din
B
M D
K
B
M
D
K
B
M
D
K
Gaussian
2
0
5
4
100
100 97
98
329252521
98
55
79
1eeeeee
Rademacher
21
4
4
15
89
98 98
93
70
62
54
Blobs
26
32
72
8
80
79 37
99
17
7
93
Textures
68
56
74
59
80
87 76
85
36
16
48
LSUN
66
63
59
60
75 77
76
79
22
19
38
Places365
64
59
63
72
79 83
79
79
27
32
24
46
Mean
41.3
35.8
46
36.1
85.2
87.2
76.9
88.7 37
45.8
30.5
59.7
PPssse536
Gaussian
10
6
71
12
93
96 35
93
16
24
2
16
Rademacher
20
10
91
1
89
93 10
100
11 5
15.9
1.6
88
Blobs
59
6
88
27
72
98 15
93
41
2
31
Textures
86
72
87
74
65
79
43 79
11
1
12
Places69
88
89
92
91
61
64
52 65
6
3
6
Mean
53
36.6
85.8
40.9
76
85.8
31.1
85.8
19.2
2
30.5
+
+# B FULL MULTICLASS OOD DETECTION RESULTS
+
+Datasets. To evaluate the MSP baseline out-of-distribution detector and the MaxLogit detector, we use the ImageNet-1K object recognition dataset and Places365 scene recognition dataset as in-distribution datasets $\mathcal { D } _ { \mathrm { i n } }$ . We use several out-of-distribution test datasets $\mathcal { D } _ { \mathrm { o u t } }$ , all of which are unseen during training. The first out-of-distribution dataset is Gaussian noise, where each example’s pixels are i.i.d. sampled from $\mathcal { N } ( 0 , 0 . 5 )$ and clipped to be contained within $[ - 1 , 1 ]$ . Another type of test-time noise is Rademacher noise, in which each pixel is i.i.d. sampled from 2 · Bernoulli $( 0 . 5 ) - 1$ , i.e. each pixel is 1 or $- 1$ with equal probability. Blob examples are more structured than noise; they are algorithmically generated blob images. Meanwhile, Textures is a dataset consisting in images of describable textures (Cimpoi et al., 2014). When evaluating the ImageNet-1K detector, we use LSUN images, a scene recognition dataset (Yu et al., 2015). Our final $\mathcal { D } _ { \mathrm { o u t } }$ is Places69, a scene classification dataset that does not share classes with Places365. In all, we evaluate against out-of-distribution examples spanning synthetic and realistic images.
+
+KL Matching Method. To verify our intuitions that led us to develop the MaxLogit detector, we developed a less convenient but similarly powerful technique applicable for the multiclass setting. Recall that some classes tend to be predicted with low confidence and others high confidence. The shape of predicted posterior distributions is often class dependent.
+
+We capture the typical shape of each class’s posterior distribution and form posterior distribution templates for each class. During test time, the network’s softmax posterior distribution is compared to these templates and an anomaly score is generated. More concretely, we compute $k$ different distributions $d _ { k }$ , one for each class. We write $d _ { k } = \mathbb { E } _ { x ^ { \prime } \sim \mathcal { X } _ { \mathrm { v a l } } } [ p ( y | x ^ { \prime } ) ]$ where $k = \mathrm { a r g m a x } _ { k } p ( y =$ $k \mid x ^ { \prime } )$ . Then for a new test input $x$ , we calculate the anomaly score $\mathrm { { \ddot { m i n } } } _ { k } ~ \mathrm { K L } [ p ( y \mid x ) \mid \mid d _ { k } ]$ rather than the MSP baseline $- \operatorname* { m a x } _ { k } p ( y = k \mid x ) .$ . Note that we utilize the validation dataset, but our KL matching method does not require the validation dataset’s labels. That said, our KL matching method is less convenient than our MaxLogit technique, and the two perform similarly. Since this technique requires more data than MaxLogit, we opt to simply use the MaxLogit in the main paper.
+
+Results. Observe that the proposed MaxLogit method outperforms the maximum softmax probability baseline for all three metrics on both ImageNet and Places365. These results were computed using a ResNet-50 trained on either ImageNet-1K or Places365. In the case of Places365, the AUROC improvement is over $10 \%$ . We note that the utility of the maximum logit could not be appreciated as easily in previous work’s small-scale settings. For example, using the small-scale CIFAR-10 setup of
+
+Hendrycks et al. Hendrycks et al. (2019a), the MSP attains an average AUROC of $9 0 . 0 8 \%$ while the maximum logit attains $9 0 . 2 2 \%$ , a minor $0 . 1 4 \%$ difference. However, in a large-scale setting, the difference can be over $10 \%$ on individual $\mathcal { D } _ { \mathrm { o u t } }$ datasets. We are not claiming that utilizing the maximum logit is a mathematically innovative formulation, only that it serves as a consistently powerful baseline for large-scale settings that went unappreciated in small-scale settings. In consequence, we suggest using the maximum logit as a new baseline for large-scale multi-class out-of-distribution detection.
+
+Overview of Other Detection Methods. There are other techniques in out-of-distribution detection which require other assumptions such as more training data. For instance, Hendrycks et al. (2019a); Mohseni et al. (2020) use additional training data labeled as out-of-distribution, and the MaxLogit technique can be naturally extended should such data be available. Hendrycks et al. (2019c) use rotation prediction and self-supervised learning, but we found that scaling this to the ImageNet multiclass setting did not produce strong results. The MSP baseline trained with auxiliary rotation prediction has an AUROC of $5 9 . 1 \%$ , and with MaxLogit it attains a $7 3 . 6 \%$ AUROC, over a $10 \%$ absolute improvement with MaxLogit. Nonetheless this technique did not straightforwardly scale, as the network is better without auxiliary rotation prediction. Likewise, Lee et al. (2018b) propose to use Mahalanobis distances, but in scaling this to 1000 classes, we consistently encountered NaN errors due to high condition numbers. This shows the importance of ensuring that out-of-distribution techniques can scale.
+
+ODIN Liang et al. (2018) assumes that, for each OOD example source, we can tune hyperparameters for detection. For this reason we do not evaluate with ODIN in the rest of the paper. However, for thoroughness, we evaluate it here. ODIN uses temperature scaling and adds an epsilon perturbation to the input in order to separate the softmax posteriors between in- and out-of-distribution images; we set these hyperparameters following DeVries & Taylor (2018). Then, MaxLogit combined with ODIN results in an FPR95 of 33.6, an AUROC of 88.8 and an AUPR of 51.3 on ImageNet. On Places365, the FPR95 is 35.3, the AUROC is 86.5, and the AUPR is 24.2. Consequently, techniques built with different assumptions can integrate well with MaxLogit. We do not train ImageNet-21K models from scratch with these methods due to limited compute.
+
+# C MULTI-LABEL OUT-OF-DISTRIBUTION DATASET LIST
+
+For multi-label classification experiments, we choose the following classes from ImageNet-21K to serve as out-of-distribution data: dolphin (n02069412), deer (n02431122), bat (n02139199), rhino (n02392434), raccoon (n02508213), octopus (n01970164), giant clam (n01959492), leech (n01937909), Venus flytrap (n12782915), cherry tree (n12641413), Japanese cherry blossoms (n12649317), red wood (n12285512), sunflower (n11978713), croissant (n07691650), stick cinnamon (n07814390), cotton (n12176953), rice (n12126084), sugar cane (n12132956), bamboo (n12147226), and tumeric (n12356395). These classes were hand-chosen so that they are distinct from VOC and COCO classes.
+
+# D OOD SEGMENTATION
+
+
+Figure 6: ROC curve with VOC as $( \mathcal { D } _ { \mathrm { i n } } )$ and non-overlapping ImageNet classes as $( \mathcal { D } _ { \mathrm { o u t } } ^ { \mathrm { t e s t } } )$ . Curves correspond to an uninformative “Random” detector, Local Outlier Factor, and the MaxLogit detector.
+
+We cover methods used in the paper in more depth and the modifications necessary to make the methods work with OOD detection in semantic segmentation. We use $f$ to denote the function typically a neural network, $x$ is the input image, and $y _ { i , j }$ is the prediction for pixel $i , j$ . We will denote the output probability distribution per pixel as $P$ and locations $i , j$ as the location of the respective pixel in the output. $f ( x ) _ { i , j }$ denotes the ith row and $j ^ { ; }$ ’th column of the output.
+
+Confidence Estimation. The method proposed in DeVries & Taylor (2018) works by training a confidence branch added at the end of the neural network. We denote the network predictions as both $P$ and $\hat { c }$ whereby every pixel is assigned a confidence value.
+
+$$
+\begin{array} { c } { b \sim B ( 0 . 5 ) } \\ { c : = \hat { c } \cdot b + ( 1 - b ) } \\ { P : = P \cdot c + ( 1 - c ) y } \end{array}
+$$
+
+The confidence estimation denoted by $c$ is given “hints” during training to guide what it is learning. The $B$ is a beta distribution and acts as a regularizer similar to dropout so that the network $f$ does not exclusively rely on the true labels being present. The final loss is modified to include the extra term below:
+
+
+Figure 7: A comparison of lighting consistency in the Fishyscapes anomaly segmentation benchmark and our new StreetHazards dataset. The arrows point in the manually estimated direction of light on parts of the scene. In Fishyscapes, inconsistent lighting allows forensics techniques to detect the anomaly (Johnson & Farid, 2005). Unlike cutand-paste anomalies, the anomalies in our StreetHazards dataset are naturally integrated into their environment with proper lighting and orientation, making them more difficult to detect.
+
+$$
+\begin{array} { l } { \displaystyle \mathcal { L } _ { \boldsymbol { p } } = \frac { 1 } { | P | } \sum _ { i } - \log ( p _ { i } ) y _ { i } } \\ { \displaystyle \mathcal { L } _ { \boldsymbol { c } } = \frac { 1 } { | P | } \sum _ { i } - \log ( \hat { c } _ { i } ) } \\ { \displaystyle \mathcal { L } = \mathcal { L } _ { \boldsymbol { p } } + \lambda \mathcal { L } _ { \boldsymbol { c } } } \end{array}
+$$
+
+The reasoning for $\mathcal { L } _ { c }$ is to encourage the network to output confident predictions. Finally $\lambda$ is initialized to 0.1 and is updated by a “budget” parameter which is set to the default of 0.3. The update equation:
+
+$$
+\left\{ \begin{array} { l l } { { \lambda } / { 0 . 9 9 } } & { \sum \hat { c } _ { i } \leq \mathrm { b u d g e t } } \\ { { \lambda } / { 1 . 0 1 } } & { \sum \hat { c } _ { i } > \mathrm { b u d g e t } } \end{array} \right.
+$$
+
+This adaptively adjusts the weighting between the two losses and experimentally the update is not sensitive to the budget parameter.
+
+Semantic Segmentation BDD Anomalies Dataset List. The BDD100K dataset contains 180 instances of the train class, 4296 instances of the motorcycle class, and 10229 instances of the bicycle class.
+
+StreetHazards 3D Models Dataset List. For semantic segmentation experiments, we choose to use the following classes 3D models from Model Bank Library to serve as out-of-distribution data: Meta-categories: Animals, Vehicles, Weapons, Appliances, Household items (furniture, and kitchen items), Electronics, Instruments, and miscellaneous. The specific animals used are kangaroos, whales, dolphins, cows, lions, frogs, bats, insects, mongooses, scorpions, fish, camels, flamingos, apes, horses, mice, spider, dinosaurs, elephants, moose, shrimps, bats, butterflies, turtles, hippopotamuses, dogs, cats, sheep, seahorse, snail and zebra. The specific vehicles used are military trucks, motorcycles, naval ships, pirate ships, submarines, sailing ships, trolleys, trains, airplanes, helicopters, jets, zeppelin, radar tower, construction vehicles (loaders, dump trucks, bulldozer), farming vehicles (harvester, gantry crane, tractor), fire truck, tank, combat vehicles, and trailers. The specific weapons used are guns, missiles, rocket launchers, and grenades. The appliances used are refrigerators, stoves, washing machines, and ovens. The household items used are cabinets, armoire, grandfather clocks, bathtubs, bureaus, night stand, table, bed, bookcase, office desk, glasses (drinking), throne chair, kitchen utensils (knives, forks, spoons), sofa, clothing iron, plates, sewing machine, and dressing mirror. The electronics used are computer monitor, computer mouse, hair dryer, The instruments category includes bassoon, clarinet, drums, guitar, violin, harp, and keyboard. The miscellaneous category includes rocket, space capsule, space shuttle, lunar module, glasses (wearable), weight machine, balance beam, bench press, bowling ball and pins, and pens. Several categories and instances were excluded from Model Bank Library due to their occurrence in the simulation environment such as playground equipment and various types of foliage and trees. The sizes of instances used in the dataset might not reflect the actual scale that would otherwise naturally occur. Similarly the location of instances in the dataset are not necessarily reflective of where they are likely to occur in nature.
\ No newline at end of file
diff --git a/md/dev/w0H2xGHlkw/w0H2xGHlkw.md b/md/dev/w0H2xGHlkw/w0H2xGHlkw.md
new file mode 100644
index 0000000000000000000000000000000000000000..242a7a3aa1e04d0e1d38e098b9b1cd56879b2a47
--- /dev/null
+++ b/md/dev/w0H2xGHlkw/w0H2xGHlkw.md
@@ -0,0 +1,570 @@
+# Visual Instruction Tuning
+
+Haotian $\mathbf { L i u ^ { 1 * } }$ , Chunyuan $\mathbf { L i ^ { 2 * } }$ , Qingyang ${ \bf W } { \bf u } ^ { 3 }$ , Yong Jae Lee1 1University of Wisconsin–Madison 2Microsoft Research 3Columbia University https://llava-vl.github.io
+
+# Abstract
+
+Instruction tuning large language models (LLMs) using machine-generated instruction-following data has been shown to improve zero-shot capabilities on new tasks, but the idea is less explored in the multimodal field. We present the first attempt to use language-only GPT-4 to generate multimodal language-image instruction-following data. By instruction tuning on such generated data, we introduce LLaVA: Large Language and Vision Assistant, an end-to-end trained large multimodal model that connects a vision encoder and an LLM for generalpurpose visual and language understanding. To facilitate future research on visual instruction following, we construct two evaluation benchmarks with diverse and challenging application-oriented tasks. Our experiments show that LLaVA demonstrates impressive multimodal chat abilities, sometimes exhibiting the behaviors of multimodal GPT-4 on unseen images/instructions, and yields a $8 5 . 1 \%$ relative score compared with GPT-4 on a synthetic multimodal instruction-following dataset. When fine-tuned on Science QA, the synergy of LLaVA and GPT-4 achieves a new state-of-the-art accuracy of $9 2 . 5 3 \%$ . We make GPT-4 generated visual instruction tuning data, our model, and code publicly available.
+
+# 1 Introduction
+
+Humans interact with the world through many channels such as vision and language, as each individual channel has a unique advantage in representing and communicating certain concepts, and thus facilitates a better understanding of the world. One of the core aspirations in artificial intelligence is to develop a general-purpose assistant that can effectively follow multi-modal vision-and-language instructions, aligned with human intent to complete various real-world tasks in the wild [4, 26].
+
+To this end, the community has witnessed an emergent interest in developing language-augmented foundation vision models [26, 16], with strong capabilities in open-world visual understanding such as classification [39, 21, 56, 53, 38], detection [28, 61, 32], segmentation [25, 62, 57] and captioning [49, 27], as well as visual generation and editing [41, 42, 55, 15, 43, 29]. We refer readers to the Computer Vision in the Wild reading list for a more up-to-date literature compilation [12]. In this line of work, each task is solved independently by one single large vision model, with the task instruction implicitly considered in the model design. Further, language is only utilized to describe the image content. While this allows language to play an important role in mapping visual signals to language semantics—a common channel for human communication, it leads to models that usually have a fixed interface with limited interactivity and adaptability to the user’s instructions.
+
+Large language models (LLM), on the other hand, have shown that language can play a wider role: a universal interface for a general-purpose assistant, where various task instructions can be explicitly represented in language and guide the end-to-end trained neural assistant to switch to the task of interest to solve it. For example, the recent success of ChatGPT [34] and GPT-4 [35] have demonstrated the power of aligned LLMs in following human instructions, and have stimulated tremendous interest in developing open-source LLMs. Among them, LLaMA [48] is an opensource LLM that matches the performance of GPT-3. Alpaca [47], Vicuna [9], GPT-4-LLM [37] utilize various machine-generated high-quality instruction-following samples to improve the LLM’s alignment ability, reporting impressive performance compared with proprietary LLMs. Importantly, this line of work is text-only.
+
+In this paper, we present visual instruction-tuning, the first attempt to extend instruction-tuning to the language-image multimodal space, to pave the way towards building a general-purpose visual assistant. In particular, our paper makes the following contributions:
+
+• Multimodal instruction-following data. One key challenge is the lack of vision-language instruction-following data. We present a data reformation perspective and pipeline to convert image-text pairs into an appropriate instruction-following format, using ChatGPT/GPT-4. Large multimodal models. We develop a large multimodal model (LMM), by connecting the open-set visual encoder of CLIP [39] with the language decoder Vicuna [9], and fine-tuning end-to-end on our generated instructional vision-language data. Our empirical study validates the effectiveness of using generated data for LMM instruction-tuning, and suggests practical tips for building a general-purpose instruction-following visual agent. When ensembled with GPT-4, our approach achieves SoTA on the Science QA [33] multimodal reasoning dataset. • Multimodal instruction-following benchmark. We present LLaVA-Bench with two challenging benchmarks, with a diverse selection of paired images, instructions and detailed annotations. • Open-source. We release the following assets to the public: the generated multimodal instruction data, the codebase, the model checkpoints, and a visual chat demo.
+
+# 2 Related Work
+
+Multimodal Instruction-following Agents. In computer vision, existing works that build instruction-following agents can be broadly categorized into two classes: $( i )$ End-to-end trained models, which are separately explored for each specific research topic. For example, the visionlanguage navigation task [3, 19] and Habitat [46] require the embodied AI agent to follow natural language instructions and take a sequence of actions to complete goals in visual environments. In the image editing domain, given an input image and a written instruction that tells the agent what to do, InstructPix2Pix [6] edits images by following the human instructions. (ii) A system that coordinates various models via LangChain [1] / LLMs [34], such as Visual ChatGPT [52], X-GPT [62], MM-REACT [54], VisProg [18], and ViperGPT [45]. While sharing the same goal in building instruction-following agents, we focus on developing an end-to-end trained language-vision multimodal model for multiple tasks.
+
+Instruction Tuning. In the natural language processing (NLP) community, to enable LLMs such as GPT-3 [7], T5 [40], PaLM [10], and OPT [59] to follow natural language instructions and complete real-world tasks, researchers have explored methods for LLM instruction-tuning [36, 51, 50], leading to instruction-tuned counterparts such as InstructGPT [36]/ChatGPT [34], FLAN-T5 [11], FLAN-PaLM [11], and OPT-IML [22], respectively. It turns out that this simple approach can effectively improve the zero- and few-shot generalization abilities of LLMs. It is thus natural to borrow the idea from NLP to computer vision. More broadly, the teacher-student distillation ideas with foundation models have been studied in other topics such as image classification [14]. Flamingo [2] can be viewed as the GPT-3 moment in the multimodal domain, due to its strong performance on zero-shot task transfer and in-context-learning. Other LMMs trained on imagetext pairs include BLIP-2 [27], FROMAGe [24], and KOSMOS-1 [20]. PaLM-E [13] is an LMM for embodied AI. Based on the recent “best” open-source LLM LLaMA, OpenFlamingo [5] and LLaMA-Adapter [58] are open-source efforts that enable LLaMA to use image inputs, paving the way to build open-source multimodal LLMs. While these models present promising task transfer generalization performance, they are not explicitly tuned with vision-language instruction data, and their performance in multimodal tasks usually falls short compared to language-only tasks. In this paper, we aim to fill this gap and study its effectiveness. Finally, note that visual instruction tuning is different from visual prompt tuning [23]: the former aims to improve the model’s instructionfollowing abilities, while the latter aims to improve the parameter-efficiency in model adaptation.
+
+# Context type 1: Captions
+
+A group of people standing outside of a black vehicle with various luggage. Luggage surrounds a vehicle in an underground parking area People try to fit all of their luggage in an SUV. The sport utility vehicle is parked in the public garage, being packed for a trip Some people with luggage near a van that is transporting it.
+
+Context type 2: Boxes
+
+person: [0.681, 0.242, 0.774, 0.694], backpack: [0.384, 0.696, 0.485, 0.914], suitcase: ...
+
+
+
+# Response type 1: conversation
+
+Question: What type of vehicle is featured in the image? Answer: The image features a black sport utility vehicle (SUV) ...
+
+Response type 2: detailed description
+
+The image is an underground parking area with a black sport utility vehicle (SUV) parked. There are three people in the scene, with one person standing closer to the left side of the vehicle, another person in the middle, and the third person on the right side. They are all working together to pack their luggage into the SUV for a trip. ...
+
+Response type 3: complex reasoning
+
+Question: What challenges do these people face?
+
+Answer: In the image, a group of people is standing outside a black SUV in a parking area, surrounded by various pieces of luggage, including suitcases and backpacks. They are facing the challenge of fitting all their luggage into the black SUV. There are multiple suitcases and backpacks to be packed, which suggests that the group has a significant amount of belongings ...
+
+Table 1: One example to illustrate the instruction-following data. The top block shows the contexts such as captions and boxes used to prompt GPT, and the bottom block shows the three types of responses. Note that the visual image is not used to prompt GPT, we only show it here as a reference.
+
+# 3 GPT-assisted Visual Instruction Data Generation
+
+The community has witnessed a surge in the amount of public multimodal data such as image-text pairs, ranging from CC [8] to LAION [44]. However, when it comes to multimodal instructionfollowing data, the available amount is limited, partially because the process for creating such data is time-consuming and less well-defined when human crowd-scouring is considered. Inspired by the success of recent GPT models in text-annotation tasks [17], we propose to leverage ChatGPT/GPT-4 for multimodal instruction-following data collection, based on the widely existing image-pair data.
+
+For an image $\mathbf { X } _ { \mathbb { v } }$ and its associated caption $\mathbf { X } _ { \mathsf { c } }$ , it is natural to create a set of questions $\mathbf { X } _ { \mathtt { q } }$ with the intent to instruct the assistant to describe the image content. We prompt GPT-4 to curate such a list of questions (see details in Appendix). Therefore, a simple way to expand an image-text pair to its instruction-following version is Human : $\mathbf { X } _ { \mathtt { q } }$ $\mathbf { X } _ { \mathrm { v } } { < } \mathbf { S } \mathrm { T } 0 \mathsf { P } { > }$ Assistant : $\mathbf { X } _ { \mathsf { c } } { < } \mathbf { S } \mathrm { T } 0 \mathsf { P } { > }$ . Though cheap to construct, this simple expanded version lacks diversity and in-depth reasoning in both the instructions and responses.
+
+To mitigate this issue, we leverage language-only GPT-4 or ChatGPT as the strong teacher (both accept only text as input), to create instruction-following data involving visual content. Specifically, in order to encode an image into its visual features to prompt a text-only GPT, we use two types of symbolic representations: (i) Captions typically describe the visual scene from various perspectives; (ii) Bounding boxes usually localize the objects in the scene, and each box encodes the object concept and its spatial location. One example is shown in the top block of Table 14.
+
+This symbolic representation allows us to encode the image as an LLM-recognizable sequence. We use COCO images [30] and generate three types of instruction-following data. One example per type is shown in the bottom block of Table 14. For each type, we first manually design a few examples. They are the only human annotations we have during data collection, and are used as seed examples in in-context-learning to query GPT-4.
+
+• Conversation. We design a conversation between the assistant and a person asking questions about this photo. The answers are in a tone as if the assistant is seeing the image and answering the question. A diverse set of questions are asked about the visual content of the image, including the object types, counting the objects, object actions, object locations, relative positions between objects. Only questions that have definite answers are considered. Please see Appendix for the detailed prompt.
+
+• Detailed description. To include a rich and comprehensive description for an image, we create a list of questions with such an intent. We prompt GPT-4 then curate the list (see detailed prompts and curation process in Appendix). For each image, we randomly sample one question from the list to ask GPT-4 to generate the detailed description.
+Complex reasoning. The above two types focus on the visual content itself, based on which we further create in-depth reasoning questions. The answers typically require a step-by-step reasoning process by following rigorous logic.
+
+We collect 158K unique language-image instruction-following samples in total, including 58K in conversations, 23K in detailed description, and $7 7 \mathrm { k }$ in complex reasoning, respectively. We ablated the use of ChatGPT and GPT-4 in our early experiments, and found that GPT-4 consistently provides higher quality instruction-following data, such as spatial reasoning.
+
+# 4 Visual Instruction Tuning
+
+# 4.1 Architecture
+
+The primary goal is to effectively leverage the capabilities of both the pre-trained LLM and visual model. The network archtecture is illustrated in Figure 1. We choose Vicuna [9] as our LLM $f _ { \phi } ( \cdot )$ parameterized by $\phi$ , as it has the best instruction following capabilities in language tasks among publicly available checkpoints [47, 9, 37].
+
+
+Figure 1: LLaVA network architecture.
+
+For an input image $\mathbf { X } _ { \mathbb { v } }$ , we consider the pre-trained CLIP visual encoder ViT-L/14 [39], which provides the visual feature ${ \bf Z } _ { \tt v } = g ( { \bf X } _ { \tt v } )$ . The grid features before and after the last Transformer layer are considered in our experiments. We consider a simple linear layer to connect image features into the word embedding space. Specifically, we apply a trainable projection matrix W to convert $\mathbf { Z } _ { \mathbf { y } }$ into language embedding tokens $\mathbf { H } _ { \mathbb { v } }$ , which have the same dimensionality as the word embedding space in the language model:
+
+$$
+\mathbf { H } _ { \mathrm { v } } = \mathbf { W } \cdot \mathbf { Z } _ { \mathrm { v } } , \mathrm { w i t h } \mathbf { Z } _ { \mathrm { v } } = g ( \mathbf { X } _ { \mathrm { v } } )
+$$
+
+Thus, we have a sequence of visual tokens $\mathbf { H } _ { \mathbb { v } }$ . Note that our simple projection scheme is lightweight, which allows us to iterate data centric experiments quickly. More sophisticated schemes to connect the image and language representations can also be considered, such as gated cross-attention in Flamingo [2] and $\mathbf { Q }$ -former in BLIP-2 [27]. We leave exploring possibly more effective and sophisticated architecture designs for LLaVA as future work.
+
+# 4.2 Training
+
+For each image $\mathbf { X } _ { \mathbb { v } }$ , we generate multi-turn conversation data $( \mathbf { X _ { q } ^ { 1 } } , \mathbf { X _ { a } ^ { 1 } } , \cdots , \mathbf { X _ { q } ^ { \cal T } } , \mathbf { X _ { a } ^ { \cal T } } )$ , where $T$ is the total number of turns. We organize them as a sequence, by treating all answers as the assistant’s response, and the instruction $\mathbf { X } _ { \mathrm { i n s t r u c t } } ^ { t ^ { - } }$ at the $t$ -th turn as:
+
+$$
+{ \mathbf { X } _ { \mathrm { i n s t r u c t } } ^ { t } } = \left\{ \begin{array} { l l } { \begin{array} { c } { \mathrm { R a n d o m l y ~ c h o o s e ~ } [ { \mathbf { X } _ { \mathrm { q } } ^ { 1 } } , { \mathbf { X } _ { \mathrm { v } } } ] \mathrm { ~ o r ~ } [ { \mathbf { X } _ { \mathrm { v } } } , { \mathbf { X } _ { \mathrm { q } } ^ { 1 } } ] , \mathrm { ~ t h e ~ f i r s t ~ u r n ~ } t = 1 } \\ { \mathrm { ~ \mathbf { X } _ { \mathrm { q } } ^ { t } } , \qquad \mathrm { t h e ~ r e m a i n i n g ~ t u r n s ~ } t > 1 } \end{array} } \end{array} \right.
+$$
+
+This leads to the unified format for the multimodal instruction-following sequence illustrated in Table 2. We perform instruction-tuning of the LLM on the prediction tokens, using its original auto-regressive training objective.
+
+Xsystem-message ${ \mathrm { < S T 0 P > } }$
+Human : Assistant: ${ \bf X } _ { \mathrm { a } } ^ { 1 }$ TOP> ruct
+Human : X ruct Assistant: X2
+
+Table 2: The input sequence used to train the model. Only two conversation turns are illustrated here; in practice, the number of turns varies based on the instruction-following data. In our current implementation, we follow Vicuna-v0 [9] to set the system message Xsystem-message and we set ${ \tt < S T O P > } =$ ###. The model is trained to predict the assistant answers and where to stop, and thus only green sequence/tokens are used to compute the loss in the auto-regressive model.
+
+Specifically, for a sequence of length $L$ , we compute the probability of the target answers $\mathbf { X } _ { \mathsf { a } }$ by:
+
+$$
+p ( \mathbf { X _ { a } } | \mathbf { X _ { v } } , \mathbf { X _ { i n s t r u c t } } ) = \prod _ { i = 1 } ^ { L } p _ { \theta } ( x _ { i } | \mathbf { X _ { v } } , \mathbf { X _ { i n s t r u c t , < i } } , \mathbf { X _ { a , < i } } ) ,
+$$
+
+where $\pmb { \theta }$ is the trainable parameters, $\mathbf { X } _ { \mathrm { i n s t r u c t } , < i }$ and $\mathbf { X } _ { \mathsf { a } , < i }$ are the instruction and answer tokens in all turns before the current prediction token $\mathbf { \boldsymbol { x } } _ { i }$ , respectively. Please see Table 2 for an illustration of the prediction tokens. For the conditionals in (3), we explicitly add $\mathbf { X } _ { \mathbb { v } }$ to emphasize the fact that the image is grounded for all answers, and we omit $\mathbf { X }$ system-message and all previous ${ \tt { < S T O P > } }$ for better readability. For LLaVA model training, we consider a two-stage instruction-tuning procedure.
+
+Stage 1: Pre-training for Feature Alignment. To strike a balance between concept coverage and training efficiency, we filter CC3M to 595K image-text pairs. Please see Appendix for details of the filtering process. These pairs are converted to the instruction-following data using the naive expansion method describe in Section 3. Each sample can be treated as a single-turn conversation. To construct the input $\mathbf { X } _ { \mathrm { i n s t r u c t } }$ in (2), for an image $\mathbf { X } _ { \mathbb { v } }$ , a question $\mathbf { X } _ { \mathtt { q } }$ is randomly sampled, which is a language instruction to request the assistant to describe the image briefly. The ground-truth prediction answer $\mathbf { X } _ { \mathsf { a } }$ is the original caption. In training, we keep both the visual encoder and LLM weights frozen, and maximize the likelihood of (3) with trainable parameters $\mathbf { \nabla } \theta = \mathbf { W }$ (the projection matrix) only. In this way, the image features $\mathbf { H } _ { \mathbb { v } }$ can be aligned with the pre-trained LLM word embedding. This stage can be understood as training a compatible visual tokenizer for the frozen LLM.
+
+Stage 2: Fine-tuning End-to-End. We always keep the visual encoder weights frozen, and continue to update both the pre-trained weights of the projection layer and LLM in LLaVA; i.e., the trainable parameters are $\pmb { \theta } = \{ \mathbf { W } , \phi \}$ in (3). We consider two specific use case scenarios:
+
+• Multimodal Chatbot. We develop a Chatbot by fine-tuning on the 158K language-image instruction-following data in Section 3. Among the three types of responses, conversation is multi-turn while the other two are single-turn. They are uniformly sampled in training.
+
+• Science $Q A$ . We study our method on the ScienceQA benchmark [33], the first large-scale multimodal science question dataset that annotates the answers with detailed lectures and explanations. Each question is provided a context in the form of natural language or an image. The assistant provides the reasoning process in natural language and selects the answer among multiple choices. For training in (2), we organize the data as a single turn conversation, the question & context as $\mathbf { X } _ { \mathrm { i n s t r u c t } }$ , and reasoning & answer as $\mathbf { X } _ { \mathsf { a } }$ .
+
+# 5 Experiments
+
+We assess the performance of LLaVA in instruction-following and visual reasoning capabilities with two primary experimental settings: multimodal chatbot and the ScienceQA dataset, respectively. We train all models with $8 \times \mathrm { { A l 0 0 s } }$ , following Vicuna’s hyperparameters [9]. We pre-train our model on the filtered CC-595K subset for 1 epoch with a learning rate of 2e-3 and a batch size of 128, and fine-tune on the proposed LLaVA-Instruct-158K dataset for 3 epochs, with a learning rate of 2e-5 and a batch size of 32. See Appendix for more training details.
+
+# 5.1 Multimodal Chatbot
+
+We developed a chatbot demo to show the image understanding and conversation abilities of LLaVA, and to study how well LLaVA is able to digest visual inputs and exhibit instruction-following
+
+# Visual input example, Extreme Ironing:
+
+
+
+Table 3: Example prompt from GPT-4 paper [35] to compare visual reasoning and chat capabilities. Compared to BLIP-2 [27] and OpenFlamingo [5], LLaVA accurately follows the user’s instructions, instead of simply describing the scene. LLaVA offers a more comprehensive response than GPT-4. Even when merely asked to describe the image, LLaVA identifies atypical aspects of the image.
+
+
User LLaVA
Source: https://www.barnorama.com/wp-content/uploads/2016/12/03-Confusing-Pictures.jpg What is unusual about this image? The unusual aspect of this image is a man ironing clothes on the back of a minivan or van.This is not a typical place to perform this activity,as one would usually iron clothes
User LLaVA
in a more stationary and safe location, such as a home,using a regular ironing board. The scene depicted in the image is peculiar as it involves a makeshift ironing setup on a vehicle,which can be both unsafe and unconventional.Additionally,it is not clear how the man is able to maintain balance and stability while ironing clothes in such an unstable environment. [Start a new conversation,and clear the history] What's happening in the scene? The image depicts a man standing on top of a yellow SUV in a busy city street. He is holding a portable ladder,seemingly ironing clothes while standing on the vehicle.Around the scene,there are other cars,a traffc light,and a fire hydrant.Additionally,there are two other people in the vicinity,one close to the man on the car and another further away.
User GPT-4 [35]
The man on the ladder appears to be attracting attention due to his unconventional choice of ironing his clothes on top of a moving car. The city street around him is bustling with activity,adding to the unique nature of the scene. What is unusual about this image? The unusual thing about this image is that a man is ironing clothes on an ironing board
User BLIP-2
attached to the roof of a moving taxi. What is unusual about this image?
User OpenFlamingo
a man is sitting on the back of a yellow cab What is unusual about this image? The man is drying his clothes on the hood of his car.
+
+capabilities. We first use the examples in the original GPT-4 paper [35], shown in Table 3 (more examples in Appendix), that require in-depth image understanding. For comparisons, we quote the prompt and response of the multimodal GPT-4 from their paper, and query BLIP-2 and OpenFlamingo model checkpoints to get their response.
+
+Surprisingly, although LLaVA is trained with a small multimodal instruction-following dataset $\mathord { \sim } 8 0 \mathrm { K }$ unique images), it demonstrates quite similar reasoning results with multimodal GPT-4 on these examples. Note that while these images are out-of-domain for LLaVA, LLaVA is still able to understand the scenes and follow the question instruction to provide a reasonable response. In contrast, BLIP-2 and OpenFlamingo focus on describing the image, instead of following the user instruction to answer in an appropriate manner.
+
+Quantitative Evaluation. To gain a systematic understanding of the performance of LLaVA, we propose a quantitative metric to measure the model’s instruction-following capability on multimodal data. Inspired by [9], we leverage GPT-4 to measure the quality of generated responses. Specifically, we create triplets consisting of image, ground-truth textual descriptions, and question. The candidate models (e.g., LLaVA) predict the answers based on the question and the image. To provide an approximate theoretical upper bound, we create a reference prediction based on the question and the ground-truth textual descriptions, using the text-only GPT-4. After obtaining the responses from both models, we feed the question, visual information (in the format of textual descriptions), and the generated responses from both assistants, to the judge (i.e., text-only GPT-4). It evaluates the helpfulness, relevance, accuracy, and level of detail of the responses from the assistants, and gives an overall score on a scale of 1 to 10, where a higher score indicates better overall performance. It is also asked to provide a comprehensive explanation for the evaluation, for us to better understand the models. We report relative scores w.r.t. the text-only GPT-4 model that uses the textural ground truth description as visual input. We create two benchmarks to evaluate the model’s performance.
+
+Table 4: Ablation on LLaVA-Bench (COCO) with different training data. We report relative scores w.r.t. a text-only GPT-4 model that uses ground truth image captions and bounding boxes as visual input. We prompt GPT-4 with the answers from our model outputs and the answers by GPT-4 (text-only), and let it compare between both responses and give a rating with an explanation.
+
+
Conversation
Detail description
Complex reasoning
All
Full data
83.1
75.3
96.5
85.1
Detail + Complex
81.5 (-1.6)
73.3 (-2.0)
90.8 (-5.7)
81.9 (-3.2)
Conv + 5% Detail + 10% Complex
81.0 (-2.1)
68.4 (-7.1)
91.5 (5.0)
80.5 (-4.4)
Conversation
76.5 (-6.6)
59.8 (-16.2)
84.9 (-12.4)
73.8 (-11.3)
No Instruction Tuning
22.0 (-61.1)
24.0 (-51.3)
18.5 (-78.0)
21.5 (-63.6)
+
+
Conversation
Detail description
Complex reasoning
All
OpenFlamingo [5]
19.3 ± 0.5
19.0 ± 0.5
19.1 ± 0.7
19.1 ± 0.4
BLIP-2 [27]
54.6 ± 1.4
29.1 ± 1.2
32.9 ± 0.7
38.1 ± 1.0
LLaVA
57.3 ± 1.9
52.5 ± 6.3
81.7 ± 1.8
67.3 ± 2.0
LLaVAt
58.8 ±0.6
49.2 ± 0.8
81.4 ± 0.3
66.7 ± 0.3
+
+Table 5: Instruction-following capability comparison using relative scores on LLaVA-Bench (In-theWild). The results are reported in the format of mean $\pm$ std. For the first three rows, we report three inference runs. LLaVA performs significantly better than others. † For a given set of LLaVA decoding sequences, we evaluate by querying GPT-4 three times; GPT-4 gives a consistent evaluation.
+
+LLaVA-Bench (COCO). We randomly select 30 images from COCO-Val-2014, and for each image, we generate three types of questions (conversation, detailed description, complex reasoning) using the proposed data generation pipeline in Sec. 3, totaling 90 questions. This benchmark studies the model’s alignment behavior and capabilities with consistent visual inputs. We vary the training datasets to study the effectiveness of different types of instruction-following data, and show the results in Table 4. First, with instruction tuning, the model’s ability of following user instructions improves significantly by over 50 points. Second, adding a small amount of detailed description and complex reasoning questions contributes to a considerable improvement of the model’s overall capability by 7 points. Furthermore, it also improves the model’s performance on conversational questions, suggesting that improvements in reasoning capabilities complement conversational abilities. Finally, we show that having all three types of data yields the best performance at $8 5 . 1 \%$ .
+
+LLaVA-Bench (In-the-Wild). To evaluate the model’s capability in more challenging tasks and generalizability to novel domains, we collect a diverse set of 24 images with 60 questions in total, including indoor and outdoor scenes, memes, paintings, sketches, etc., and associate each image with a highly-detailed and manually-curated description and a proper selection of questions. We compare LLaVA, BLIP, and OpenFlamingo in Table 5. Thanks to visual instruction tuning, LLaVA achieves significantly better performance compared with BLIP-2 $( + 2 9 \% )$ and OpenFlamingo $( + 4 8 \% )$ . Compared to the text-only GPT-4 that has access to ground-truth labels, LLaVA achieves an impressive $8 1 . 7 \%$ performance on complex reasoning questions, with an overall score of $6 7 . 3 \%$ .
+
+Limitations. This LLaVA-Bench (In-the-Wild) is designed to be challenging and to reveal a model’s weaknesses. We provide two examples with associated captions and questions in Table 6. For the ramen example (left), to correctly answer the name of the restaurant, it requires the model to have a large knowledge coverage and multilingual understanding capability; to correctly describe the side dishes, the model may need to retrieve relevant multimodal information from Internet. For the fridge example (right), perceiving the correct brand of the yogurt requires the model to process high resolution images and possess extensive knowledge coverage. We also observed an interesting failure of LLaVA, as it responds with yes when asked if strawberry-flavored yogurt is present, even though
+
+# Challenging examples from LLaVA-Bench (In-the-Wild):
+
+
ICHIRAN Ramen [source] Filled fridge [source]
Annotation A close-up photo of a meal at ICHI- An open refrigerator filled with a variety of foodRAN.The chashu ramen bowl with items.In the left part of the compartment, towardsa spoon is placed in the center. The the front, there isaplastic box of strawberrieswith aramen is seasoned with chili sauce, small bag of baby carrots on top.Towards the back,chopped scallions,and served with there is a stack of sauce containers.In the middletwo pieces of chashu. Chopsticks are part of the compartment,towards the front, thereplaced to the right of the bowl, still in is a green plastic box,and there is an unidentifiedtheir paper wrap,not yet opened. The plastic bag placed on it.Towards the back, there is aramen is also served with nori on the carton of milk.In the right part of the compartment,left. On top,from left to right, the fol- towards the front,there is a box of blueberries withlowing sides are served:a bowl of or- three yogurts stacked on top.The large bottle ofange spice (possibly garlic sauce),a yogurt is Fage non-fat yogurt, and one of the smallerplate of smoke-flavored stewed pork cups is Fage blueberry yogurt. The brand and flavorwith chopped scallions,and a cup of of the other smaller cup are unknown. Towards thematcha green tea. back,there is a container with an unknown content.
RAN.The chashu ramen bowl with items.In the left part of the compartment, towards
a spoon is placed in the center. The the front, there isaplastic box of strawberrieswith a
ramen is seasoned with chili sauce, small bag of baby carrots on top.Towards the back,
chopped scallions,and served with there is a stack of sauce containers.In the middle
Question 1 What's the name of the restaurant? What is the brand of the blueberry-flavored yogurt?
Question 2 Describe this photo in detail. Is there strawberry-flavored yogurt in the fridge?
+
+Table 6: Challenging examples from LLaVA-Bench (In-the-Wild), we provide extremely-detailed annotation for each image for an accurate evaluation. Some questions require the model to extract details from high resolution image and to have a broad knowledge coverage.
+
+the fridge contains only yogurt and strawberries. This indicates that, at times, LLaVA perceives the image as a “bag of patches”, failing to grasp the complex semantics within the image. We hope LLaVA serves as a solid baseline on the benchmarks, on which our findings can inspire future work in developing more capable LMMs.
+
+# 5.2 ScienceQA
+
+ScienceQA [33] contains 21k multimodal multiple choice questions with rich domain diversity across 3 subjects, 26 topics, 127 categories, and 379 skills. The benchmark dataset is split into training, validation, and test splits with 12726, 4241, and 4241 examples, respectively. We consider two representative methods, including GPT-3.5 model (text-davinci-002) with and without chainof-thought (CoT), LLaMA-Adapter [58], as well as multimodal chain-of-thought (MM-CoT) [60], which is the current SoTA method on this dataset. For more baseline numbers, please see [33].
+
+The results are reported in Table 7. For LLaVA, we use the visual features before the last layer, ask the model to first predict reasons and then the answer, and train it for 12 epochs. It yields $9 0 . 9 2 \%$ accuracy, which is quite close to the SoTA $9 1 . 6 8 \%$ . To explore the limit of LLMs, we also prompt GPT-4 using 2-shot in-context-learning and achieve $8 2 . 6 9 \%$ accuracy, which is a $7 . 5 2 \%$ absolute gain compared with $7 5 . 1 7 \%$ from GPT-3.5. For a substantial number of questions, we note that GPT-4 fails simply because it reports that there is insufficient context such as images or plots. We consider two schemes to combine the outcomes from our model and GPT-4. (i) A GPT-4 complement. Whenever GPT-4 fails to provide answers, we use the prediction from our method. This schemes yields $9 0 . 9 7 \%$ accuracy, which is almost the same as applying our method alone. (ii) GPT-4 as the judge. Whenever GPT-4 and LLaVA produce different answers, we prompt GPT-4 again, asking it to provide its own final answer based on the question and two outcomes. The spirit is similar with CoT, but with the external knowledge from the other model. Surprisingly, this scheme is able to provide consistent improvement over all question classes, and achieves a new SoTA accuracy of $9 2 . 5 3 \%$ . Interestingly, the text-only GPT-4, which cannot process images, improves the overall performance of the model on questions that have an image as context. This is because some of these questions do not actually require the image context for a correct answer. The GPT-4 judge can identify such cases and correct some of the errors that LLaVA makes. See the example in Appendix. To the best of our knowledge, this is the first time that GPT-4 is used for model ensembling. We hope this finding can encourage future research to explore more effective methods to leverage LLMs for model ensembling.
+
+
Method
Subject
Context Modality
Grade
Average
NAT
sOC
LAN
TXT
IMG
NO
G1-6
G7-12
Representative & SoTA methods with numbers reported in the literature
Human [33]
90.23
84.97
87.48
89.60
87.50
88.10
91.59
82.42
88.40
GPT-3.5 [33]
74.64
69.74
76.00
74.44
67.28
77.42
76.80
68.89
73.97
GPT-3.5 w/ CoT [33]
75.44
70.87
78.09
74.68
67.43
79.93
78.23
69.68
75.17
LLaMA-Adapter [58]
84.37
88.30
84.36
83.72
80.32
86.90
85.83
84.05
85.19
MM-CoTBase [60]
87.52
77.17
85.82
87.88
82.90
86.83
84.65
85.37
84.91
MM-CoTLarge [60]
95.91
82.00
90.82
95.26
88.80
92.89
92.44
90.31
91.68
Results with our own experiment runs
GPT-4†
84.06
73.45
87.36
81.87
70.75
90.73
84.69
79.10
82.69
LLaVA
90.36
95.95
88.00
89.49
88.00
90.66
90.93
90.90
90.92
LLaVA+GPT-4† (complement)
90.36
95.50
88.55
89.05
87.80
91.08
92.22
88.73
90.97
LLaVA+GPT-4† (judge)
91.56
96.74
91.09
90.62
88.99
93.52
92.73
92.16
92.53
+
+Table 7: Accuracy $( \% )$ ) on Science QA dataset. Question categories: ${ \bf N A T } =$ natural science, ${ \bf S O C = }$ social science, LAN $=$ language science, $\mathrm { T X T = }$ text context, $\mathbf { I M G } =$ image context, ${ \mathrm { N O } } =$ no context, G1- $6 =$ grades 1-6, $G 7 - 1 2 =$ grades 7-12. †Text-only GPT-4, our eval. Our novel model ensembling with the text-only GPT-4 consistently improves the model’s performance under all categories, setting the new SoTA performance.
+
+Ablations. We ablate several design choices on ScienceQA in Table 8. (i) Visual features. We tried using the last layer feature from CLIP vision encoder, which yields $8 9 . 9 6 \%$ and is $0 . 9 6 \%$ lower than the feature before the last layer. We hypothesize that this is because CLIP’s last layer features may focus more on global and abstract image properties compared to the layer before it, which can focus more on localized properties that are useful for under
+
+Table 8: Design choice ablations $( \% )$ . The difference with the best variant is reported in red text.
+
+
Visual features
Before
Last
Best variant
90.92
89.96 (-0.96)
Predict answer first
-
89.77 (-1.15)
Training from scratch
85.81 (-5.1)
=
7B model size
89.84 (-1.08)
-
+
+standing specific image details. $( i i )$ Chain-of-thought. To decide the order between the answer and reasoning process in the model prediction, we run both variants and observe that answer-first reports the best number $8 9 . 7 7 \%$ accuracy in 12 epochs, while reasoning-first can quickly reach $8 9 . 7 7 \%$ accuracy in 6 epochs, but no further improvement with more training. Training the model for 24 epochs does not improve the performance. We conclude that CoT-like reasoning-first strategy can largely improve convergence, but contributes relatively little to the final performance. (iii) Pre-training. We skip pre-training and directly train on Science QA from scratch – performance drops to $8 5 . 8 1 \%$ accuracy. The $5 . 1 1 \%$ absolute degradation indicates the importance of our pre-training stage, in aligning multimodal features while preserving the vast pre-trained knowledge. $( i v )$ Model size. We keep all configurations the same as our best 13B model, and train a 7B model. This yields $8 9 . 8 4 \%$ accuracy, which is $1 . 0 8 \%$ lower than $9 0 . 9 2 \%$ , demonstrating the importance of model scale.
+
+# 6 Conclusion
+
+This paper demonstrated the effectiveness of visual instruction tuning. We presented an automatic pipeline to create language-image instruction-following data, based on which we train LLaVA, a multimodal model to follow human intent to complete visual tasks. It achieves the new SoTA accuracy when fine-tuned on ScienceQA, and excellent visual chat capabilities when fine-tuned on multimodal chat data. Besides, we present the first benchmark to study multimodal instructionfollowing capability. This paper is an initial step in visual instruction tuning, and mainly focuses on real-life tasks. For more quantitative results of LLaVA on academic benchmarks, please refer to the improved baselines with visual instruction tuning [31]. We hope our work can inspire future research on building more capable multimodal models.
+
+Acknowledgements. We thank Baolin Peng and Pan Lu for valuable discussions on instructiontuning language models and Science QA, respectively. We thank the LLaMA team for giving us access to their models, and open-source projects, including Alpaca and Vicuna. This work was supported in part by NSF CAREER IIS2150012, and Institute of Information & communications Technology Planning & Evaluation(IITP) grants funded by the Korea government(MSIT) (No. 2022- 0-00871, Development of AI Autonomy and Knowledge Enhancement for AI Agent Collaboration) and (No. RS-2022-00187238, Development of Large Korean Language Model Technology for Efficient Pre-training).
+
+# References
+
+[1] Langchain. https://github.com/hwchase17/langchain, 2022. 2
+
+[2] Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katie Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. arXiv preprint arXiv:2204.14198, 2022. 2, 4
+[3] Peter Anderson, Qi Wu, Damien Teney, Jake Bruce, Mark Johnson, Niko Sünderhauf, Ian Reid, Stephen Gould, and Anton Van Den Hengel. Vision-and-language navigation: Interpreting visually-grounded navigation instructions in real environments. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2018. 2
+[4] Amanda Askell, Yuntao Bai, Anna Chen, Dawn Drain, Deep Ganguli, Tom Henighan, Andy Jones, Nicholas Joseph, Ben Mann, Nova DasSarma, et al. A general language assistant as a laboratory for alignment. arXiv preprint arXiv:2112.00861, 2021. 1
+[5] Anas Awadalla, Irena Gao, Joshua Gardner, Jack Hessel, Yusuf Hanafy, Wanrong Zhu, Kalyani Marathe, Yonatan Bitton, Samir Gadre, Jenia Jitsev, Simon Kornblith, Pang Wei Koh, Gabriel Ilharco, Mitchell Wortsman, and Ludwig Schmidt. Openflamingo, March 2023. 2, 6, 7
+[6] Tim Brooks, Aleksander Holynski, and Alexei A Efros. Instruct pix2pix: Learning to follow image editing instructions. arXiv preprint arXiv:2211.09800, 2022. 2
+[7] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. 2
+[8] Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual $1 2 \mathrm { m }$ : Pushing web-scale image-text pre-training to recognize long-tail visual concepts. In CVPR, 2021. 3
+[9] Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E. Gonzalez, Ion Stoica, and Eric P. Xing. Vicuna: An open-source chatbot impressing gpt-4 with $9 0 \% \ast$ chatgpt quality, March 2023. 1, 2, 4, 5, 6
+[10] Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022. 2
+[11] Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, et al. Scaling instruction-finetuned language models. arXiv preprint arXiv:2210.11416, 2022. 2
+[12] CVinW. Computer vision in the wild. https://github.com/ Computer-Vision-in-the-Wild/CVinW_Readings, 2022. 1
+[13] Danny Driess, Fei Xia, Mehdi SM Sajjadi, Corey Lynch, Aakanksha Chowdhery, Brian Ichter, Ayzaan Wahid, Jonathan Tompson, Quan Vuong, Tianhe Yu, et al. PaLM-E: An embodied multimodal language model. arXiv preprint arXiv:2303.03378, 2023. 2
+[14] Fartash Faghri, Hadi Pouransari, Sachin Mehta, Mehrdad Farajtabar, Ali Farhadi, Mohammad Rastegari, and Oncel Tuzel. Reinforce data, multiply impact: Improved model accuracy and robustness with dataset reinforcement. arXiv preprint arXiv:2303.08983, 2023. 2
+[15] Oran Gafni, Adam Polyak, Oron Ashual, Shelly Sheynin, Devi Parikh, and Yaniv Taigman. Make-a-scene: Scene-based text-to-image generation with human priors. ArXiv, abs/2203.13131, 2022. 1
+[16] Zhe Gan, Linjie Li, Chunyuan Li, Lijuan Wang, Zicheng Liu, Jianfeng Gao, et al. Visionlanguage pre-training: Basics, recent advances, and future trends. Foundations and Trends® in Computer Graphics and Vision, 2022. 1
+[17] Fabrizio Gilardi, Meysam Alizadeh, and Maël Kubli. Chatgpt outperforms crowd-workers for text-annotation tasks. arXiv preprint arXiv:2303.15056, 2023. 3
+[18] Tanmay Gupta and Aniruddha Kembhavi. Visual programming: Compositional visual reasoning without training. arXiv preprint arXiv:2211.11559, 2022. 2
+[19] Weituo Hao, Chunyuan Li, Xiujun Li, Lawrence Carin, and Jianfeng Gao. Towards learning a generic agent for vision-and-language navigation via pre-training. In CVPR, 2020. 2
+[20] Shaohan Huang, Li Dong, Wenhui Wang, Yaru Hao, Saksham Singhal, Shuming Ma, Tengchao Lv, Lei Cui, Owais Khan Mohammed, Qiang Liu, et al. Language is not all you need: Aligning perception with language models. arXiv preprint arXiv:2302.14045, 2023. 2
+[21] Gabriel Ilharco, Mitchell Wortsman, Ross Wightman, Cade Gordon, Nicholas Carlini, Rohan Taori, Achal Dave, Vaishaal Shankar, Hongseok Namkoong, John Miller, Hannaneh Hajishirzi, Ali Farhadi, and Ludwig Schmidt. Openclip. July 2021. If you use this software, please cite it as below. 1
+[22] Srinivasan Iyer, Xi Victoria Lin, Ramakanth Pasunuru, Todor Mihaylov, Dániel Simig, Ping Yu, Kurt Shuster, Tianlu Wang, Qing Liu, Punit Singh Koura, et al. Opt-iml: Scaling language model instruction meta learning through the lens of generalization. arXiv preprint arXiv:2212.12017, 2022. 2
+[23] Menglin Jia, Luming Tang, Bor-Chun Chen, Claire Cardie, Serge Belongie, Bharath Hariharan, and Ser-Nam Lim. Visual prompt tuning. In ECCV, 2022. 2
+[24] Jing Yu Koh, Ruslan Salakhutdinov, and Daniel Fried. Grounding language models to images for multimodal generation. arXiv preprint arXiv:2301.13823, 2023. 2
+[25] Boyi Li, Kilian Q Weinberger, Serge Belongie, Vladlen Koltun, and René Ranftl. Languagedriven semantic segmentation. ICLR, 2022. 1
+[26] Chunyuan Li, Haotian Liu, Liunian Harold Li, Pengchuan Zhang, Jyoti Aneja, Jianwei Yang, Ping Jin, Houdong Hu, Zicheng Liu, Yong Jae Lee, and Jianfeng Gao. ELEVATER: A benchmark and toolkit for evaluating language-augmented visual models. In NeurIPS Track on Datasets and Benchmarks, 2022. 1
+[27] Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. Blip-2: Bootstrapping languageimage pre-training with frozen image encoders and large language models. arXiv preprint arXiv:2301.12597, 2023. 1, 2, 4, 6, 7
+[28] Liunian Harold Li, Pengchuan Zhang, Haotian Zhang, Jianwei Yang, Chunyuan Li, Yiwu Zhong, Lijuan Wang, Lu Yuan, Lei Zhang, Jenq-Neng Hwang, et al. Grounded language-image pre-training. In CVPR, 2022. 1
+[29] Yuheng Li, Haotian Liu, Qingyang Wu, Fangzhou Mu, Jianwei Yang, Jianfeng Gao, Chunyuan Li, and Yong Jae Lee. Gligen: Open-set grounded text-to-image generation. arXiv preprint arXiv:2301.07093, 2023. 1
+[30] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft COCO: Common objects in context. In ECCV, 2014. 3
+
+[31] Haotian Liu, Chunyuan Li, Yuheng Li, and Yong Jae Lee. Improved baselines with visual instruction tuning, 2023. 10, 14
+
+[32] Shilong Liu, Zhaoyang Zeng, Tianhe Ren, Feng Li, Hao Zhang, Jie Yang, Chunyuan Li, Jianwei Yang, Hang Su, Jun Zhu, et al. Grounding dino: Marrying dino with grounded pre-training for open-set object detection. arXiv preprint arXiv:2303.05499, 2023. 1
+
+[33] Pan Lu, Swaroop Mishra, Tanglin Xia, Liang Qiu, Kai-Wei Chang, Song-Chun Zhu, Oyvind Tafjord, Peter Clark, and Ashwin Kalyan. Learn to explain: Multimodal reasoning via thought chains for science question answering. Advances in Neural Information Processing Systems, 2022. 2, 5, 8, 9
+
+[34] OpenAI. ChatGPT. https://openai.com/blog/chatgpt/, 2023. 1, 2 [35] OpenAI. Gpt-4 technical report, 2023. 1, 6, 15 [36] Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35:27730–27744, 2022. 2
+
+[37] Baolin Peng, Chunyuan Li, Pengcheng He, Michel Galley, and Jianfeng Gao. Instruction tuning with GPT-4. arXiv preprint arXiv:2304.03277, 2023. 1, 4
+
+[38] Hieu Pham, Zihang Dai, Golnaz Ghiasi, Kenji Kawaguchi, Hanxiao Liu, Adams Wei Yu, Jiahui Yu, Yi-Ting Chen, Minh-Thang Luong, Yonghui Wu, et al. Combined scaling for open-vocabulary image classification. arXiv preprint arXiv: 2111.10050, 2021. 1
+
+[39] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. arXiv preprint arXiv:2103.00020, 2021. 1, 2, 4
+
+[40] 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. The Journal of Machine Learning Research, 2020. 2
+
+[41] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. ArXiv, abs/2204.06125, 2022. 1
+
+[42] Robin Rombach, A. Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. Highresolution image synthesis with latent diffusion models. CVPR, pages 10674–10685, 2022. 1
+
+[43] Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L. Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, Seyedeh Sara Mahdavi, Raphael Gontijo Lopes, Tim Salimans, Jonathan Ho, David J. Fleet, and Mohammad Norouzi. Photorealistic text-to-image diffusion models with deep language understanding. ArXiv, abs/2205.11487, 2022. 1
+
+[44] Christoph Schuhmann, Romain Beaumont, Richard Vencu, Cade Gordon, Ross Wightman, Mehdi Cherti, Theo Coombes, Aarush Katta, Clayton Mullis, Mitchell Wortsman, et al. Laion5b: An open large-scale dataset for training next generation image-text models. arXiv preprint arXiv:2210.08402, 2022. 3
+
+[45] Dídac Surís, Sachit Menon, and Carl Vondrick. Vipergpt: Visual inference via python execution for reasoning. arXiv preprint arXiv:2303.08128, 2023. 2
+
+[46] Andrew Szot, Alex Clegg, Eric Undersander, Erik Wijmans, Yili Zhao, John Turner, Noah Maestre, Mustafa Mukadam, Devendra Chaplot, Oleksandr Maksymets, Aaron Gokaslan, Vladimir Vondrus, Sameer Dharur, Franziska Meier, Wojciech Galuba, Angel Chang, Zsolt Kira, Vladlen Koltun, Jitendra Malik, Manolis Savva, and Dhruv Batra. Habitat 2.0: Training home assistants to rearrange their habitat. In Advances in Neural Information Processing Systems (NeurIPS), 2021. 2
+
+[47] Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model. https://github.com/tatsu-lab/stanford_alpaca, 2023. 1, 4
+[48] Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023. 1
+[49] Jianfeng Wang, Zhengyuan Yang, Xiaowei Hu, Linjie Li, Kevin Lin, Zhe Gan, Zicheng Liu, Ce Liu, and Lijuan Wang. Git: A generative image-to-text transformer for vision and language. arXiv preprint arXiv:2205.14100, 2022. 1
+[50] Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language model with self generated instructions. arXiv preprint arXiv:2212.10560, 2022. 2
+[51] Yizhong Wang, Swaroop Mishra, Pegah Alipoormolabashi, Yeganeh Kordi, Amirreza Mirzaei, Anjana Arunkumar, Arjun Ashok, Arut Selvan Dhanasekaran, Atharva Naik, David Stap, et al. Benchmarking generalization via in-context instructions on $1 { , } 6 0 0 { + }$ language tasks. arXiv preprint arXiv:2204.07705, 2022. 2
+[52] Chenfei Wu, Shengming Yin, Weizhen Qi, Xiaodong Wang, Zecheng Tang, and Nan Duan. Visual chatgpt: Talking, drawing and editing with visual foundation models. arXiv preprint arXiv:2303.04671, 2023. 2
+[53] Jianwei Yang, Chunyuan Li, Pengchuan Zhang, Bin Xiao, Lu Yuan, Ce Liu, and Jianfeng Gao. Unified contrastive learning in image-text-label space. CVPR, 2022. 1
+[54] Zhengyuan Yang, Linjie Li, Jianfeng Wang, Kevin Lin, Ehsan Azarnasab, Faisal Ahmed, Zicheng Liu, Ce Liu, Michael Zeng, and Lijuan Wang. Mm-react: Prompting chatgpt for multimodal reasoning and action. arXiv preprint arXiv:2303.11381, 2023. 2
+[55] Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, Benton C. Hutchinson, Wei Han, Zarana Parekh, Xin Li, Han Zhang, Jason Baldridge, and Yonghui Wu. Scaling autoregressive models for content-rich text-to-image generation. ArXiv, abs/2206.10789, 2022. 1
+[56] Lu Yuan, Dongdong Chen, Yi-Ling Chen, Noel Codella, Xiyang Dai, Jianfeng Gao, Houdong Hu, Xuedong Huang, Boxin Li, Chunyuan Li, et al. Florence: A new foundation model for computer vision. arXiv preprint arXiv:2111.11432, 2021. 1
+[57] Hao Zhang, Feng Li, Xueyan Zou, Shilong Liu, Chunyuan Li, Jianfeng Gao, Jianwei Yang, and Lei Zhang. A simple framework for open-vocabulary segmentation and detection. arXiv preprint arXiv:2303.08131, 2023. 1
+[58] Renrui Zhang, Jiaming Han, Aojun Zhou, Xiangfei Hu, Shilin Yan, Pan Lu, Hongsheng Li, Peng Gao, and Yu Qiao. Llama-adapter: Efficient fine-tuning of language models with zero-init attention. arXiv preprint arXiv:2303.16199, 2023. 2, 8, 9
+[59] Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, et al. OPT: Open pre-trained transformer language models. arXiv preprint arXiv:2205.01068, 2022. 2
+[60] Zhuosheng Zhang, Aston Zhang, Mu Li, Hai Zhao, George Karypis, and Alex Smola. Multimodal chain-of-thought reasoning in language models. arXiv preprint arXiv:2302.00923, 2023. 8, 9
+[61] Yiwu Zhong, Jianwei Yang, Pengchuan Zhang, Chunyuan Li, Noel Codella, Liunian Harold Li, Luowei Zhou, Xiyang Dai, Lu Yuan, Yin Li, et al. Regionclip: Region-based language-image pretraining. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 16793–16803, 2022. 1
+[62] Xueyan Zou, Zi-Yi Dou, Jianwei Yang, Zhe Gan, Linjie Li, Chunyuan Li, Xiyang Dai, Harkirat Behl, Jianfeng Wang, Lu Yuan, et al. Generalized decoding for pixel, image, and language. arXiv preprint arXiv:2212.11270, 2022. 1, 2
+
+# A Broader Impact
+
+The broader impact of LLaVA, a general-purpose visual assistant, has potential benefits and risks associated with its deployment and release. Some considerations are unique to LLaVA due to its visual nature, while others share similarities with existing instruction-following LLMs (e.g., Alpaca, Vicuna, etc.). As LLaVA is built upon LLaMA, Vicuna, and CLIP, it inherits some of the issues associated with LLMs and vision encoders. In the following, we outline both the risks and mitigation strategies in place for the release of this model.
+
+Malicious input. To minimize potential misuse and harmful consequences, we employ two precautionary measures for LLaVA: (1) OpenAI Filter API for user input text to prevent harmful or inappropriate text instructions from being processed by the model, and (2) NSFW Filter for uploaded user images to detect and block Not Safe For Work (NSFW) content or any other potentially harmful image inputs.
+
+Hallucination. Similar to LLMs, LLaVA might generate outputs that aren’t grounded in facts or input data. This raises concerns about inferences made, especially in critical applications (e.g., medical).
+
+Biases. Bias can be transferred from the base models to LLaVA, both from the vision encoder (CLIP) and the language decoder (LLaMA/Vicuna). This may lead to biased outcomes or unfair representations of diverse content.
+
+Energy consumption. Though energy consumption is not a primary concern for LLaVA due to a smaller pretraining dataset (see details in Sec. C), it may become a concern when scaling up the pretraining dataset or increasing the model size, e.g., to a larger LLaMA version like the 65B model.
+
+Evaluation complexities. Assessing the performance of LLaVA is challenging as it involves both language and visual tasks. Our evaluation benchmark covers several aspects, including accuracy, concept coverage, reasoning ability, and creativity. However, additional aspects need consideration, such as the degree of visual content hallucination and fine-grained understanding of visual content. While text-only GPT-4 based multimodal evaluation is consistent and accurate in our study, its robustness in different situations and capability to evaluate other unexplored aspects are subjects for future work.
+
+Despite these risks, we believe that the benefits of releasing LLaVA to the research community outweigh the potential harm. It allows for ongoing investigation and improvement of the model and engages the community in developing better mitigation strategies to address these concerns. Moreover, the release of LLaVA can spur the development of new applications and research directions, ultimately contributing to the progress and responsible deployment of foundation models in vision-language tasks.
+
+# B More Results
+
+We present more qualitative results of LLaVA to analyze its emergent behaviors and observed weaknesses. For more quantitative results of LLaVA on academic benchmarks, please refer to the improved baselines with visual instruction tuning [31]. In Table 9, LLaVA demonstrates a similar behavior as GPT-4 in another example from its paper. Similar to the GPT-4 live demo by OpenAI, LLaVA is capable of generating the HTML/JS/CSS code for an interactive joke website based on a simplified user input sketch in Fig. 2, despite a minor error. As shown in Fig. 3, LLaVA can follow user’s instructions in a conversational style and provide detailed responses or creative writings. Furthermore, LLaVA is able to relate the visual content to the textual knowledge from the pretrained LLM, as demonstrated in Fig. 4 and Fig. 5.
+
+One interesting emergent behavior of LLaVA is that it is able to understand visual contents that are not covered in the training. For example, in Fig. 6, it is able to recognize Elon Musk both in a headshot and in a humorous meme where he is dressed as a doge, even though Elon Musk never appears in the training data for either the visual feature alignment or visual instruction tuning stages of
+
+LLaVA. LLaVA also demonstrates impressive OCR (optical character recognition) ability in Table 9 and Fig. 2, which is rarely covered in our training data.
+
+We hope these additional results and observations showcase the potential of LLaVA in various application areas. In future work, it is important to investigate these emergent behaviors more thoroughly and to understand the underlying mechanisms that enable LLaVA to demonstrate such generalization abilities. This will pave the way towards building better LMMs, including enhancing robustness, reducing biases, and improving the alignment and the scope of the learned vision-language representations.
+
+Table 9: Example prompt comparing LLaVA, GPT-4, BLIP-2, and OpenFlamingo’s visual reasoning capabilities in understanding the humor. BLIP-2 and OpenFlamingo fail to follow the user’s instructions. LLaVA and GPT-4 both explain the meme and its humor, while GPT-4 produces a more concise answer.
+
+
Visual input example, Chicken Nugget Map:
User LLaVA
Sometimes ljust look at pictures of the earth from space and lmarvel at howbeautiful it all is.
Can you explain this meme in detail? The meme in the image is a creative and humorous take on food,with a focus on chicken nuggets,as the center of the universe.The meme begins with the phrase "Sometimes I just look at pictures of the Earth from space and Imarvel at how beautiful it all is..." The main image features a tray of cooked chicken nuggets,with the chicken pieces positioned to resemble the continents and islands on a world map.The meme playfully suggests that the chicken nuggets represent the Earth,and the various locations depicted in the photo are actually chicken nugget versions of different places.The punchline of the meme appears in smaller text at the bottom,reading "I mean,it's not the real Earth,but how beautiful it
is all is."This lighthearted and entertaining meme combines food and humor,using the image of chicken nuggets to create a funny and imaginative representation of the world.
User GPT-4 [35]
Can you explain this meme? This meme is a joke that combines two unrelated things: pictures of the earth from space and chicken nuggets. The text of the meme suggests that the image below is a beautiful picture of the earth from space.However, the image is actually of chicken nuggets
arranged to vaguely resemble a map of the world.The humor in this meme comes from the unexpected juxtaposition of the text and the image.The text sets up an expectation of a
User BLIP-2
majestic image of the earth,but the image is actually something mundane and silly. Can you explain this meme in detail?
sometimes i just look at pictures of the earth from space and marvel how beautiful it is
User OpenFlamingo
Can you explain this meme in detail? It's a picture of a chicken nugget on the International Space Station.
+
+
+Figure 2: LLaVA generates HTML/JS code for an interactive website based on user sketch inputs. The interactive interface works after fixing a minor error (in red) in the generated output. There is room for improvement in LLaVA’s output, such as splitting the joke and punchline into two rows, and only revealing the punchline upon button click, to better reflect the user’s intent.
+
+
+
+
+
+What are the meals that I can cook with these?
+
+With the variety of food items stored in the refrigerator, you can prepare several meals. For example, you can create a fruit salad using the strawberries, blueberries, and carrots. Additionally, you can make a delicious smoothie using the fruits and vegetables, which would be a healthy and nutritious snack or breakfast option. The milk and eggs can be used to create various dishes, such as a milk-based smoothie, a baked casserole, or scrambled eggs. The juice can also be used to make a fresh fruit and juice mix or as a refreshing homemade popsicle. The possibilities are vast, and the meals you can create will depend on your preferences and dietary needs.
+
+I would like to do the fruit salad. Show me the recipe.
+
+
+
+Certainly! Here's a simple fruit salad recipe using the items in your refrigerator:
+
+# Ingredients:
+
+- 2 cups fresh strawberries, sliced
+- 1 cup fresh blueberries
+- 1 large carrot, grated
+- Juice of half a lemon
+- A handful of chopped fresh parsley or mint
+- A few ice cubes
+- Optional: honey or maple syrup (adjust to taste)
+
+# Instructions:
+
+1. In a large bowl, combine the sliced strawberries, blueberries, and carrot. Gently toss them together to mix.
+2. Drizzle the juice of half a lemon over the fruit and vegetables to prevent them from oxidizing and add a refreshing citrus flavor.
+3. Sprinkle the chopped fresh parsley or mint over the fruit and gently toss once more.
+4. If desired, add a drizzle of honey or maple syrup for a touch of sweetness. Adjust the amount according to your taste preferences.
+5. Cover the bowl and refrigerate the fruit salad for at least 30 minutes or up to a few hours. This allows the flavors to meld and creates a
+more refreshing salad.
+6. Serve the fruit salad in cups or bowls, garnished with a sprinkle of fresh parsley or mint, if desired.
+
+This fruit salad recipe is perfect for a healthy snack or side dish, and with the variety of ingredients available in your refrigerator, it should be easy to put together quickly.
+
+
+
+
+
+What are the things I should be cautious about when I visit here?
+
+When visiting this peaceful location with a pier extending over a serene lake, surrounded by mountains, there are several things to be cautious about. First, pay attention to the weather conditions, as sudden changes in weather, especially strong winds or storms, can cause the water to become rough and pose risks to the stability of the pier. Second, be mindful of the structural integrity of the pier; avoid overloading it with too many people or excessive weight, as this could potentially damage the pier or cause it to collapse. Additionally, be aware of the surrounding wildlife and respect their space; do not harm or disturb them in any way. Finally, if you decide to go fishing, ensure that you adhere to any local fishing regulations and use appropriate fishing techniques to keep the lake ecosystem healthy and maintain the balance of the food chain.
+
+Compose an engaging travel blog post about my trip to this place, highlighting the beautiful sceneries, joyful experiences, and include possible anecdotes.
+
+
+
+Traveling to this picturesque location with a serene lake and mountains in the background was a refreshing and rejuvenating experience. The pier extending over the calm water provided an excellent vantage point from which to appreciate the breathtaking scenery. As I stood on the pier, I couldn't help but feel a deep connection with nature, taking a moment to soak in the peaceful atmosphere.
+
+One of the highlights of my trip was undoubtedly the fishing experience. The area is teeming with life, and I was thrilled to land a sizeable catch, despite the modest size of the lake. The joy of fishing in such a beautiful setting was truly rewarding, and it allowed me to take a break from my busy life and truly immerse myself in the tranquility of nature.
+
+While exploring the surrounding area, I came across a family of birds that had built a nest close to the pier, adding to the charm of the location. Interacting with the wildlife and observing their behavior was an enriching experience that I'll cherish for years to come.
+
+In conclusion, this idyllic destination provided me with an opportunity to unwind and recharge, surrounded by mesmerizing natural beauty and the gentle sounds of water and wildlife. If you're looking for a serene escape from the hustle and bustle of everyday life, this pier overlooking the lake is the perfect place to find solace and reconnect with nature.
+
+Figure 3: LLaVA is capable of recognizing the visual content following the user’s intent, without directly prompting for visual recognition. It also provides a detailed response when prompted with a follow-up request, and the generated response is closely related to the provided visual content.
+
+
+
+What's the ending of this movie?
+
+In the image, a young woman is leaning on a man in front of a beautiful sunset, with both of them standing on a boat. They appear to be enjoying a romantic moment together. The scene suggests that they could be depicted as the characters Jack and Rose from the popular movie Titanic. In the movie, their romance blossoms aboard the fictional ocean liner Titanic, with the pair ultimately sharing a passionate kiss as the ship sinks into the ocean. The ending of the movie is known for its emotional and heartfelt scenes, where the characters are forced to say goodbye to each other as they are separated by the sinking ship. The image evokes a sense of romance and nostalgia, paying tribute to the iconic love story portrayed in the movie Titanic.
+
+Figure 4: LLaVA relates the movie scenes to the textual knowledge from the pretrained LLM.
+
+
+
+
+
+Do you know who drew this painting?
+
+The painting depicts a woman, commonly believed to be Mona Lisa, the famous artwork by Leonardo da Vinci. It is a portrait painting that showcases the woman's enigmatic smile and has become one of the most famous and iconic art pieces in the world. The original work is displayed in the Louvre Museum in Paris, and it is known for its intricate details, use of oil paint, and the artist's innovative techniques that contributed to its enduring appeal and mystery.
+
+Start a new conversation, and the history is cleared.
+
+
+
+
+
+Do you know who drew this painting?
+
+The painting depicts a dog in a humorous situation, where it appears to be wearing a woman's dress and standing in front of a landscape. Although the artist of the painting is not explicitly identified, it could be a reference to the famous artist Da Vinci, known for his artistic works, including the Mona Lisa. The painting is likely a creative and comical take on the traditional portrait style, replacing a human figure with a dog dressed in a woman's clothing, making it an interesting and amusing visual piece.
+
+Figure 5: LLaVA recognizes the famous art work, Mona Lisa, by Leonardo da Vinci. When we start a new conversation, it also explains the humourous artwork created on the web, mimicking the Mona Lisa.
+
+
+
+Figure 6: An interesting emergent behavior of LLaVA is its ability to recognize Elon Musk both in a headshot and in a humorous meme where he is dressed as a doge. This implies that the pre-trained CLIP vision encoder may have seen images of Elon Musk. However, it is still surprising because Elon Musk never appears in the training data for either the visual feature alignment or visual instruction tuning stages of LLaVA, which indicates that the base language model generalizes to unseen visual concepts.
+
+# Question:
+
+Which material is this rocking chair made of? Options: (A) wood (B) silk
+
+# LLaVA answer:
+
+
+
+# GPT-4 (text-only) answer:
+
+The answer is A. BECAUSE: Rocking chairs are typically made of sturdy materials that can support the weight of a person and withstand the rocking motion. Wood is a common material used for making rocking chairs due to its strength, durability, and natural appearance.
+
+# GPT-4 (text-only) judge:
+
+Since there is no context or image to refer to, I cannot independently analyze the rocking chair in question. However, I can try to analyze the reasoning given by the assistants.
+Assistant 1, who claims to have seen the image, mentions that the legs of the rocking chair are made of wood, and the back and seat are made of silk, implying that it’s a combination of two materials. However, this response seems less plausible, as silk is not a common material used for the construction of rocking chairs due to issues with stability and durability. Typically, one would expect the frame, legs, and seat or back to be made of wood, with cushions and padding made of fabrics, such as cotton or polyester.
+Assistant 2 argues that rocking chairs are typically made of sturdy materials, and wood is a common material used for making rocking chairs due to its strength, durability, and natural appearance. This reasoning stands true and is based on common knowledge.
+Given the information available, the most plausible answer is that the rocking chair is made of wood, as suggested by Assistant 1. The answer is A.
+
+# C Training Details
+
+We pre-train our model on the filtered CC-595K subset for 1 epoch with a learning rate of 2e-3 and a batch size of 128, and fine-tune on the proposed LLaVA-Instruct-158K dataset for 3 epochs, with a learning rate of 2e-5 and a batch size of 32. Following Vicuna, we use the Adam optimizer with no weight decay and a cosine learning rate with a warmup ratio of $3 \%$ . During finetuning, FSDP (Full Shard Data Parallel) and gradient checkpointing is used to save GPU memory, and offloading is not used. BF16 and TF32 are enabled to achieve a balance between speed and precision.
+
+We train all models with $8 \times \mathrm { { A l 0 0 s } }$ . Pretraining on CC-595K completes within 4 hours. Finetuning on Instruct-158K completes within 10 hours. Finetuning on ScienceQA completes within 4 hours.
+
+# D Assets
+
+Our source code, generated instruction-tuning data, proposed benchmark are uploaded to the anonymized GitHub repository: LLaVA-Annonymous/LLaVA.
+
+1. Source Code: link
+2. README: link
+3. Instructions to launch the demo: link
+4. All prompts and few shot examples for querying GPT-4: link
+5. LLaVA-Instruct-158K: link
+6. LLaVA-Bench: COCO, In-The-Wild
+7. Model checkpoints. The size of the model checkpoints after compression is 25GB, which exceeds the 5GB limit of GitHub LFS (Large File Storage). We’ll release the checkpoint to the public, or upon request with reviewers for this submission.
+
+# E Data
+
+Instructions for brief image description. The list of instructions used to briefly describe the image content are shown in Table 11. They present the same meaning with natural language variance.
+
+• "Describe the image concisely." • "Provide a brief description of the given image." • "Offer a succinct explanation of the picture presented." • "Summarize the visual content of the image." • "Give a short and clear explanation of the subsequent image." "Share a concise interpretation of the image provided." • "Present a compact description of the photo’s key features." • "Relay a brief, clear account of the picture shown." • "Render a clear and concise summary of the photo." • "Write a terse but informative summary of the picture." • "Create a compact narrative representing the image presented."
+
+Table 11: The list of instructions for brief image description.
+
+Instructions for detailed image description. The list of instructions used to describe the image content in detail are shown in Table 12. They present the same meaning with natural language variance.
+
+CC3M. We extract noun-phrases using Spacy for each caption over the whole CC3M dataset, and count the frequency of each unique noun-phrase. We skip noun-phrases whose frequency is smaller than 3, as they are usually rare combinations concept and attributes that has already been covered by other captions. We then start from the noun-phrases with lowest remaining frequency, add the captions that contain this noun-phrase to the candidate pool. If the frequency of the noun-phrase is larger than 100, we randomly choose a subset of size 100 out of all its captions. This results in around 595K image-text pairs.
+
+
"Describe the following image in detail"
"Provide a detailed description of the given image"
"Give an elaborate explanation of the image you see"
"Share a comprehensive rundown of the presented image"
"Offer a thorough analysis of the image"
"Explain the various aspects of the image before you"
"Clarify the contents of the displayed image with great detail"
"Characterize the image using a well-detailed description"
"Break down the elements of the image in a detailed manner"
"Walk through the important details of the image"
"Portray the image with a rich, descriptive narrative"
"Narrate the contents of the image with precision"
"Analyze the image in a comprehensive and detailed manner"
"Ilustrate the image through a descriptive explanation"
"Examine the image closely and share its details"
· "Write an exhaustive depiction of the given image"
+
+Table 12: The list of instructions for detailed image description.
+
+The comparison of noun-phrase statistics before and after filtering CC3M is shown in Figure 7. The filtered dataset shows a good coverage of concepts whose frequency is higher from 3, but with a smaller number of image-text pairs.
+
+
+Figure 7: Comparison of noun-phrase statistics before and after filtering CC3M. The total number of unique noun-phrases are reported in the legend.
+
+# F Prompts
+
+The prompt used to generate image-based conversation from ChatGPT/GPT-4 is shown in Table 13.
+
+messages $=$ [ {"role":"system", "content": f"""You are an AI visual assistant, and you are seeing a single image. What you see are provided with five sentences, describing the same image you are looking at. Answer all questions as you are seeing the image.
+
+Design a conversation between you and a person asking about this photo. The answers should be in a tone that a visual AI assistant is seeing the image and answering the question. Ask diverse questions and give corresponding answers.
+
+Include questions asking about the visual content of the image, including the object types, counting the objects, object actions, object locations, relative positions between objects, etc. Only include questions that have definite answers:
+
+(1) one can see the content in the image that the question asks about and can answer confidently; (2) one can determine confidently from the image that it is not in the image. Do not ask any question that cannot be answered confidently.
+
+for sample in fewshot_samples: messages.append({"role":"user", "content":sample[‘context’]}) messages.append({"role":"assistant", "content":sample[‘response’]} )
+messages.append({"role":"user", "content":‘\n’.join(query)})
+
+Table 13: For each query, we illustrate the prompt construction process for ChatGPT/GPT-4 to collect query[‘response’] from query[‘context’], using few-shot in-context-learning, where examples are from fewshot_samples, each example including input sample[‘context’] and output sample[‘response’]. Note that messages is the final prompt. In this example, we provide the prompt used to generate the conversation response, please see also see its in-context-learning examples in Table 15 and Table 16 for details. We recommend readers to check out the codebase for the prompts to generated two other types of responses, including detailed decription and complex reasoning.
+
+# Context type 1: Captions
+
+A group of people standing outside of a black vehicle with various luggage. Luggage surrounds a vehicle in an underground parking area People try to fit all of their luggage in an SUV. The sport utility vehicle is parked in the public garage, being packed for a trip Some people with luggage near a van that is transporting it.
+
+# Context type 2: Boxes
+
+
+
+person: [0.681, 0.242, 0.774, 0.694], person: [0.63, 0.222, 0.686, 0.516], person: [0.444, 0.233, 0.487, 0.34], backpack: [0.384, 0.696, 0.485, 0.914], backpack: [0.755, 0.413, 0.846, 0.692], suitcase: [0.758, 0.413, 0.845, 0.69], suitcase: [0.1, 0.497, 0.173, 0.579], bicycle: [0.282, 0.363, 0.327, 0.442], car: [0.786, 0.25, 0.848, 0.322], car: [0.783, 0.27, 0.827, 0.335], car: [0.86, 0.254, 0.891, 0.3], car: [0.261, 0.101, 0.787, 0.626]
+
+# Response type 1: conversation
+
+Question: What type of vehicle is featured in the image?
+
+Answer: The image features a black sport utility vehicle (SUV).
+
+Question: Where is the vehicle parked?
+
+Answer: The vehicle is parked in an underground parking area, likely in a public garage.
+
+Question: What are the people in the image doing?
+
+Answer: The people are trying to fit all of their luggage into the SUV, likely preparing for a trip.
+
+# Response type 2: detailed description
+
+The image is an underground parking area with a black sport utility vehicle (SUV) parked. There are three people in the scene, with one person standing closer to the left side of the vehicle, another person in the middle, and the third person on the right side. They are all working together to pack their luggage into the SUV for a trip.
+
+In the parking area, various luggage items are scattered around the vehicle. There are two backpacks, one located near the left rear wheel and the other closer to the right side of the vehicle. Additionally, there are two suitcases, one on the right side of the car and another further away near the center of the parking area. A bicycle can also be seen on the left side of the vehicle.
+
+Other cars are parked around the main SUV, with one car positioned behind it and slightly to the left, another behind and slightly to the right, and the third car further behind on the right side.
+
+# Response type 3: complex reasoning
+
+Question: What challenges do these people face?
+
+Answer: In the image, a group of people is standing outside a black SUV in a parking area, surrounded by various pieces of luggage, including suitcases and backpacks. They are facing the challenge of fitting all their luggage into the black SUV. There are multiple suitcases and backpacks to be packed, which suggests that the group has a significant amount of belongings to accommodate. They might have to strategize and arrange the luggage efficiently to ensure that everything fits properly into the vehicle. Additionally, they need to consider the comfort of the passengers and visibility while driving, so the placement of the luggage must not obstruct the driver’s view or make the passengers uncomfortable during the trip.
+
+# Captions
+
+There is a movie theater that displays the show times above the doors.
+A red fire hydrant is deep in the snow.
+The fire hydrant is in the snow near a recently plowed sidewalk.
+This city has had a very hard winter with snow.
+A hotel for dogs in the snow in winter.
+
+# Conversation
+
+Answer:
+
+The image suggests that the winter season in the city has been quite harsh and challenging. The significant snow accumulation seen in the image indicates that the city has experienced heavy snowfall, which can lead to various difficulties and disruptions for its residents.
+
+For instance, the deep snow covering the fire hydrant could potentially hinder its accessibility in case of emergencies, which poses safety concerns. The recently plowed sidewalk implies that the city’s maintenance crews have been actively working to keep the walkways clear and safe for pedestrians, but the sheer amount of snowfall might make it difficult to keep up with the continuous snow removal efforts.
+
+Furthermore, such extreme winter conditions can impact transportation, leading to traffic issues, delays in public transit, and increased risks of accidents due to slippery roads. It can also cause problems for businesses and schools, as people might face challenges commuting to work or attending classes. Additionally, the heavy snow can put extra strain on infrastructure, such as roofs and power lines, increasing the likelihood of structural damage or power outages.
+
+In conclusion, the image of the red fire hydrant deep in the snow and the recently plowed sidewalk suggest that the city has faced a particularly severe winter season, with substantial snowfall that has likely caused various challenges and disruptions for its residents and infrastructure.
+
+# Captions
+
+A man is skiing in the open snow covered hill
+
+A skier is making his way into the snow. A skier on the foothills of a huge mountain range. A skier looks at mountains while standing near a trail sign. a single person skiing by an area with a lot of bushes
+
+# Conversation
+
+The skier is skiing in the snow-covered hills, making his way through the snow and enjoying the beautiful mountain scenery.
+They are also standing near a trail sign, which indicates their location on the mountain.
+
+No, there is only a single person skiing in the image, and they are surrounded by an area with a lot of bushes.
+
+Question: What kind of skiing is the person doing? Cross-country or downhill?
+
+Answer:
+
+Based on what I can see in the photo, it is not possible to definitively determine whether the skier is doing cross-country or downhill skiing. However, given the presence of a trail sign and the fact that they are skiing in the foothills, it is more likely that the skier is engaged in cross-country skiing. Downhill skiing typically takes place on more steep slopes and involves ski lifts, whereas cross-country skiing often occurs on relatively flatter terrain with marked trails.
+
+$= = =$
+
+Question: Can you explain cross-country and downhill skiing a bit more?
+
+Answer:
+
+Cross-country skiing and downhill skiing are two distinct types of skiing, each with its own techniques, equipment, and terrain preferences.
+
+1. Cross-Country Skiing:
+
+Also known as Nordic skiing, cross-country skiing involves traversing relatively flat terrain or gentle slopes using skis and poles. It is a popular recreational and competitive sport that focuses on endurance, balance, and aerobic fitness. Cross-country skiers use their own locomotion to move across snow-covered terrain, rather than relying on ski lifts or other forms of assistance.
+
+There are two main techniques in cross-country skiing:
+
+- Classic: This technique involves skiing in parallel tracks, using a forward-and-backward gliding motion while keeping the skis parallel to each other. The skier uses their poles to propel themselves forward.
+
+- Skate skiing: This technique is similar to ice skating, where the skier pushes off one ski at an angle and glides on the other. It requires a smooth, groomed surface and is typically faster than the classic technique.
+
+Cross-country ski equipment consists of lightweight skis, boots, bindings, and poles. The boots are more flexible than those used in downhill skiing, allowing for better ankle movement and control.
+
+2. Downhill Skiing:
+
+Also known as alpine skiing, downhill skiing involves descending slopes at high speeds using skis and poles for balance and control. This sport is more focused on speed, technique, and navigating challenging terrain, including steep slopes, moguls, and even jumps.
+
+Downhill skiing can be further categorized into several disciplines, such as slalom, giant slalom, super-G, and downhill racing.
+Each discipline has its own set of rules, courses, and ski equipment.
+
+Downhill ski equipment includes heavier and stiffer skis, boots, bindings, and poles than those used in cross-country skiing. The boots are more rigid to provide better support and control during high-speed descents and sharp turns.
+
+In summary, cross-country skiing is an endurance-based sport that involves traveling across flat or gently sloping terrain, while downhill skiing is focused on speed and technique as skiers navigate steeper slopes and challenging terrain. Both sports require specialized equipment and techniques, but they offer different experiences and challenges to participants.
\ No newline at end of file
diff --git a/md/dev/w1UbdvWH_R3/w1UbdvWH_R3.md b/md/dev/w1UbdvWH_R3/w1UbdvWH_R3.md
new file mode 100644
index 0000000000000000000000000000000000000000..3c96b847d5553747dd843d28fb889c8be7c42434
--- /dev/null
+++ b/md/dev/w1UbdvWH_R3/w1UbdvWH_R3.md
@@ -0,0 +1,1295 @@
+# NEURAL COLLAPSE UNDER MSE LOSS: PROXIMITY TO AND DYNAMICS ON THE CENTRAL PATH
+
+X.Y. Han∗ Cornell University xh332@cornell.edu
+
+Vardan Papyan∗ University of Toronto vardan.papyan@utoronto.ca
+
+David L. Donoho Stanford University donoho@stanford.edu
+
+# ABSTRACT
+
+The recently discovered Neural Collapse (NC) phenomenon occurs pervasively in today’s deep net training paradigm of driving cross-entropy (CE) loss towards zero. During NC, last-layer features collapse to their class-means, both classifiers and class-means collapse to the same Simplex Equiangular Tight Frame, and classifier behavior collapses to the nearest-class-mean decision rule. Recent works demonstrated that deep nets trained with mean squared error (MSE) loss perform comparably to those trained with CE. As a preliminary, we empirically establish that NC emerges in such MSE-trained deep nets as well through experiments on three canonical networks and five benchmark datasets. We provide, in a Google Colab notebook, PyTorch code for reproducing MSE-NC and CE-NC: here. The analytically-tractable MSE loss offers more mathematical opportunities than the hard-to-analyze CE loss, inspiring us to leverage MSE loss towards the theoretical investigation of NC. We develop three main contributions: (I) We show a new decomposition of the MSE loss into (A) terms directly interpretable through the lens of NC and which assume the last-layer classifier is exactly the least-squares classifier; and (B) a term capturing the deviation from this least-squares classifier. (II) We exhibit experiments on canonical datasets and networks demonstrating that term-(B) is negligible during training. This motivates us to introduce a new theoretical construct: the central path, where the linear classifier stays MSE-optimal for feature activations throughout the dynamics. (III) By studying renormalized gradient flow along the central path, we derive exact dynamics that predict NC.
+
+# 1 INTRODUCTION
+
+Modern deep learning includes paradigmatic procedures that are commonly adopted, but not entirely understood. Some examples are multi-layered architectures, stochastic gradient descent, batch normalization, cross-entropy (CE) loss, and training past zero error towards zero loss. Analyzing the properties of these practices is an important research task.
+
+In this work, we theoretically investigate behavior of last-layer features in classification deep nets. In particular, we consider the training of deep neural networks on datasets containing images from $C$ different classes with $N$ examples in each class. After passing the $i$ -th example in the $c$ -th class through all layers except the last-layer of the network, the network outputs some last-layer features $\boldsymbol { h } _ { i , c } \in \mathbb { R } ^ { P }$ . The last-layer of the network—which, for each class $c$ , possesses a classifier ${ \pmb w } _ { c } \in \mathbb { R } ^ { P }$ and bias $b _ { c } \in \mathbb { R }$ —then predicts a label for the example using the rule arg $\mathrm { m a x } _ { c ^ { \prime } }$ $( \langle { \pmb w } _ { c ^ { \prime } } , { \pmb h } _ { i , c } \rangle + b _ { c ^ { \prime } } )$ .
+
+The network’s performance is evaluated by calculating the error defined by
+
+$$
+\mathrm { E r r o r } = \underset { i , c } { \mathrm { A v e } } ~ \mathbf { 1 } \{ c \neq \arg \operatorname* { m a x } _ { c ^ { \prime } } \left( \langle { \pmb w } _ { c ^ { \prime } } , { \pmb h } _ { i , c } \rangle + b _ { c ^ { \prime } } \right) \} ,
+$$
+
+while the weights, biases, and other parameters of the network (that determine the behavior of the layers before the last layer) in the network are updated by minimizing the CE loss defined by
+
+$$
+\mathrm { C E } = - \underset { i , c } { \mathrm { A v e } } \log \frac { \exp \{ \langle \pmb { w } _ { c } , \pmb { h } _ { i , c } \rangle + b _ { c } \} } { \sum _ { c ^ { \prime } = 1 } ^ { C } \exp \{ \langle \pmb { w } _ { c ^ { \prime } } , \pmb { h } _ { i , c } \rangle + b _ { c ^ { \prime } } \} } ,
+$$
+
+where Ave is the operator that averages over its subscript indices.
+
+Prior works such as Zhang et al. (2016); Belkin et al. (2019) have shown that overparameterized classifiers (such as deep nets) can “memorize” their training set without harming performance on unseen test data. Moreover, works such as Soudry et al. (2018) have further shown that continuing to train networks past memorization can still lead to performance improvements1,2. Papyan, Han, and Donoho (2020) recently examined this setting, referring to the phase during which one trains past zero-error towards zero-CE-loss as the Terminal Phase of Training (TPT). During TPT, they exposed a phenomenon called Neural Collapse (NC).
+
+# 1.1 NEURAL COLLAPSE
+
+NC is defined relative to the feature global mean,
+
+$$
+\mu _ { G } = \mathop { \mathrm { A v e } } _ { i , c } h _ { i , c } ,
+$$
+
+the feature class-means,
+
+$$
+\pmb { \mu _ { c } = \mathrm { A v e } h _ { i , c } , } \quad c = 1 , \ldots , C ,
+$$
+
+the feature within-class covariance,
+
+$$
+\pmb { \Sigma } _ { W } = \pmb { \mathrm { A v e } } ( \pmb { h } _ { i , c } - \pmb { \mu } _ { c } ) ( \pmb { h } _ { i , c } - \pmb { \mu } _ { c } ) ^ { \top } ,
+$$
+
+and the feature between-class covariance,
+
+$$
+\begin{array} { r } { \pmb { \Sigma } _ { B } = \underset { c } { \mathrm { A v e } } ( \pmb { \mu } _ { c } - \pmb { \mu } _ { G } ) ( \pmb { \mu } _ { c } - \pmb { \mu } _ { G } ) ^ { \top } . } \end{array}
+$$
+
+
+
+It is characterized by the following four limiting behaviors where limits take place with increasing training epoch $t$ :
+
+(NC1) Within-class variability collapse3:
+
+$$
+\Sigma _ { B } ^ { \dagger } \Sigma _ { W } \mathbf { 0 } ,
+$$
+
+where $\dagger$ denotes the Moore-Penrose pseudoinverse. (NC2) Convergence to Simplex ETF:
+
+$$
+\frac { \langle \pmb { \mu } _ { c } - \pmb { \mu } _ { G } , \pmb { \mu } _ { c ^ { \prime } } - \pmb { \mu } _ { G } \rangle } { \| \pmb { \mu } _ { c } - \pmb { \mu } _ { G } \| _ { 2 } \| \pmb { \mu } _ { c ^ { \prime } } - \pmb { \mu } _ { G } \| _ { 2 } } \{ \begin{array} { l l } { 1 , } & { c = c ^ { \prime } } \\ { \frac { - 1 } { C - 1 } , } & { c \neq c ^ { \prime } } \end{array}
+$$
+
+$$
+\| \pmb { \mu } _ { c } - \pmb { \mu } _ { G } \| _ { 2 } - \| \pmb { \mu } _ { c ^ { \prime } } - \pmb { \mu } _ { G } \| _ { 2 } \to 0 \quad \forall c \neq c ^ { \prime }
+$$
+
+(NC3) Convergence to self-duality:
+
+$$
+{ \frac { { \pmb w } _ { c } } { \| { \pmb w } _ { c } \| _ { 2 } } } - { \frac { { \pmb \mu } _ { c } - { \pmb \mu } _ { G } } { \| { \pmb \mu } _ { c } - { \pmb \mu } _ { G } \| _ { 2 } } } 0
+$$
+
+(NC4): Simplification to nearest class center:
+
+
+Figure 1: Portrait of Neural Collapse. Top figure depicts the last-layer features, classmeans, and classifiers with which NC is defined—as well as the Simplex ETF to which they all converge with training. Bottom figure shows the deviations of features from their corresponding class-means. Reproduced and modified from Figure 1 of Papyan, Han, and Donoho (2020).
+
+$$
+\arg \operatorname* { m a x } _ { c ^ { \prime } } w _ { c ^ { \prime } } , h + b _ { c ^ { \prime } } \arg \operatorname* { m i n } _ { c ^ { \prime } } \| h - \mu _ { c ^ { \prime } } \| _ { 2 }
+$$
+
+The (NC2) property captures convergence to a simple geometric structure called an Equiangular Tight Frame (ETF). An ETF is a collection of vectors $\{ { \pmb v } _ { c } \} _ { c = 1 } ^ { \top }$ having equal lengths and equal, maximally separated pair-wise angles. In classification deep nets, last-layer features are of higher dimension than the number of classes i.e. $P { > } C$ . In this setting, the maximal angles are given by
+
+$$
+\frac { \left. { \pmb v } _ { c } , { \pmb v } _ { c ^ { \prime } } \right. } { \| { \pmb v } _ { c } \| _ { 2 } \| { \pmb v } _ { c ^ { \prime } } \| _ { 2 } } = \left\{ \begin{array} { l l } { 1 , } & { \mathrm { f o r } c = c ^ { \prime } } \\ { - \frac { 1 } { C - 1 } , } & { \mathrm { f o r } c \neq c ^ { \prime } } \end{array} \right. ,
+$$
+
+and the ETF is called a Simplex $\mathrm { E T F ^ { 4 } }$ . Observe that as $C$ increases, the ETF approaches a (partial) orthogonal matrix. Thus, when $C$ is large, this translates to the intuitive notion that classifiers and class-means tend with training to (near) orthogonality.
+
+# 1.2 DEEP NET CLASSIFICATION WITH MSE LOSS
+
+While classification deep nets are typically trained with CE loss, Demirkaya et al. (2020) and Hui & Belkin (2020) recently reported deep nets trained with squared error (MSE) loss,
+
+$$
+\begin{array} { r l r } { { \mathcal { L } ( W , b , H ) = \frac { 1 } { 2 } \operatorname { A v e } \| W h _ { i , c } + b - y _ { i , c } \| _ { 2 } ^ { 2 } + \frac { \lambda } { 2 } ( \| W \| _ { F } ^ { 2 } + \| b \| _ { 2 } ^ { 2 } ) } } \\ & { } & { \quad = \frac { 1 } { 2 C N } \| W H + b \mathbb { 1 } _ { C N } ^ { \top } - { \mathbf { Y } } \| _ { F } ^ { 2 } + \frac { \lambda } { 2 } ( \| W \| _ { F } ^ { 2 } + \| b \| _ { 2 } ^ { 2 } ) , } \end{array}
+$$
+
+achieve comparable test performance as those trained with CE loss. Above, $H \in \mathbb { R } ^ { P \times C N }$ and Y ∈ RC×CN are matrices resulting from stacking5 together the feature vectors $h _ { i , c }$ and one-hot vectors $_ { { \mathbf { \mathit { y } } } _ { i , c } }$ as their respective columns; $\pmb { W } \in \mathbb { R } ^ { C \times P }$ is the matrix resulting from the stacking of classifiers ${ \pmb w } _ { c }$ as rows; $\pmb { b } \in \mathbb { R } ^ { C }$ is the vector resulting from concatenating the scalars $\{ b _ { c } \} _ { c = 1 } ^ { C }$ ; and $\Im { _ { C N } }$ is the length- $C N$ vector of ones. Table 1 in Appendix A shows supplementary measurements affirming the findings of Hui & Belkin (2020); Demirkaya et al. (2020), i.e. the measurements affirm that MSE-trained networks indeed achieve accuracies on testing data comparable to those of CE-trained networks (cf. the analogous Table 1 in Papyan, Han, and Donoho (2020)). The analytically-tractable MSE loss offers more mathematical opportunities than the hard-to-analyze CE loss and inspires this paper’s main theoretical contributions explicitly characterizing MSE-NC.
+
+# 1.3 CONTRIBUTIONS
+
+Our main contributions are as follows:
+
+• We propose a new decomposition of the MSE loss: $\mathcal { L } = \mathcal { L } _ { \mathrm { N C 1 } } + \mathcal { L } _ { \mathrm { N C 2 / 3 } } + \mathcal { L } _ { \mathrm { L S } } ^ { \perp }$ . The terms $\mathcal { L } _ { \mathrm { N C 1 } }$ and $\mathcal { L } _ { \mathrm { N C } 2 / 3 }$ possess interpretations attributable to NC phenomena and assume the classifier $W$ is exactly the least-squares optimal classifier $W _ { \mathrm { L S } }$ (relative to the given $\pmb { H }$ );
+and $\mathcal { L } _ { \mathrm { L S } } ^ { \perp }$ captures the deviation of $W$ from $W _ { \mathrm { L S } }$ . (Section 2)
+• We provide empirical measurements of our decomposition (Figure 2) on realistic datasetnetwork combinations showing that $\mathcal { L } _ { \mathrm { L S } } ^ { \perp }$ becomes negligible during training—leading us to
+define the central path where $\mathcal { L } _ { \mathrm { L S } } ^ { \perp } { = } z e r o$ . (Section 2)
+• We reveal a key invariance property on the central path. The invariance motivates the
+examination of a representative set of features, $\scriptstyle { X = \sum _ { W } ^ { - { \frac { 1 } { 2 } } } H }$ , that we call renormalized
+features. (Sections 3.1-3.2)
+• We study the gradient flow of those renormalized features along the central path and derive exact, closed-form dynamics that imply NC. The dynamics are explicit in terms of the
+
+singular value decomposition of the renormalized feature class-means at initialization. (Section 3.3)
+
+Additionally, we complement this paper with new, extensive measurements on five benchmark datasets—in particular, the MNIST, FashionMNIST, CIFAR10, SVHN, and STL10 datasets6 (Deng et al., 2009; Krizhevsky & Hinton, 2009; LeCun et al., 2010; Xiao et al., 2017)—and three canonical deep nets—in particular, the VGG, ResNet, and DenseNet networks (He et al., 2016; Huang et al., 2017; Simonyan & Zisserman, 2014)—that verify the empirical reality of MSE-NC i.e. they show (NC1)-(NC4) indeed occur for networks trained with MSE loss. These experiments establish that theoretical modeling of MSE-NC is empirically well-motivated. They are lengthy—together spanning four pages with seven figures and a table—so we collectively defer them to Appendix A.
+
+# 2 DECOMPOSITION OF MSE LOSS
+
+Inspired by the community’s interest in the role of the MSE loss in deep net training (Demirkaya et al., 2020; Hui & Belkin, 2020; Mixon et al., 2020; Poggio & Liao, 2020a;b), we derive a new decomposition of the MSE loss that gives insights into the NC phenomenon. First, absorb the bias vector into the weight matrix—by defining the extended weight matrix $\widetilde { W } = [ W , b ] \in \mathbb { R } ^ { C \times ( P + 1 ) }$ and the extended feature vector $\widetilde { \pmb { h } } _ { i , c } = [ \pmb { h } _ { i , c } ; 1 ] \in \mathbb { R } ^ { P + 1 }$ —so that Equation 2 can be rewritten as
+
+$$
+\mathcal { L } ( \widetilde { W } , \widetilde { H } ) = \frac { 1 } { 2 } \mathop { \mathrm { A v e } } _ { i , c } \| \widetilde { W } \widetilde { h } _ { i , c } - y _ { i , c } \| _ { 2 } ^ { 2 } + \frac { \lambda } { 2 } \| \widetilde { W } \| _ { F } ^ { 2 } .
+$$
+
+Using $\left\{ \widetilde { h } _ { i , c } \right\}$ , define the entities $\widetilde { \mu } _ { c } , \widetilde { \mu } _ { G } ,$ $\widetilde { H }$ , and $\widetilde { \pmb { \Sigma } } _ { W }$ analogously to those in Section 1.1. We further define the extended total covariance and extended class-means matrices, respectively, as
+
+$$
+\begin{array} { r l } & { \widetilde { \boldsymbol { \Sigma } } _ { T } = \underset { i , c } { \mathrm { A v e } } ( \widetilde { \boldsymbol { h } } _ { i , c } - \widetilde { \pmb { \mu } } _ { G } ) ( \widetilde { \boldsymbol { h } } _ { i , c } - \widetilde { \pmb { \mu } } _ { G } ) ^ { \top } \in \mathbb { R } ^ { ( P + 1 ) \times ( P + 1 ) } } \\ & { \widetilde { \boldsymbol { M } } = [ \widetilde { \mu } _ { 1 } , \dots , \widetilde { \pmb { \mu } } _ { C } ] \in \mathbb { R } ^ { ( P + 1 ) \times C } . } \end{array}
+$$
+
+Next, we reformulate, with weight decay incorporated, a classic result of Webb & Lowe (1990):
+
+Proposition 1 (Webb & Lowe (1990) with Weight Decay). For fixed extended features $\widetilde { H }$ , the optimal classifier minimizing the MSE loss $\mathcal { L } ( \widetilde { W } , \widetilde { H } )$ is
+
+$$
+\widetilde { \pmb { W } } _ { L S } = \frac { 1 } { C } \widetilde { \pmb { M } } ^ { \top } ( \widetilde { \pmb { \Sigma } } _ { T } + \widetilde { \pmb { \mu } } _ { G } \widetilde { \pmb { \mu } } _ { G } ^ { \top } + \lambda \pmb { I } ) ^ { - 1 } ,
+$$
+
+where $\pmb { I }$ is the identity matrix. Note that $\widetilde { W _ { L S } }$ depends on $\widetilde { H }$ only.
+
+Note that we can interpret $\widetilde { W _ { \mathrm { L S } } }$ as a function of $\widetilde { H }$ , leading us to identify the following decomposition of $\mathcal { L }$ where one term depends on $\widetilde { H }$ only.
+
+Theorem 1. (Decomposition of MSE Loss; Proof in Appendix $\pmb { B }$ ) The MSE loss, $\mathcal { L } ( \widetilde { W } , \widetilde { H } )$ , can be decomposed into two terms, $\mathcal { L } ( \widetilde { W } , \widetilde { H } ) = \mathcal { L } _ { L S } ( \widetilde { H } ) + \mathcal { L } _ { L S } ^ { \perp } ( \widetilde { W } , \widetilde { H } )$ , where
+
+$$
+\mathcal { L } _ { L S } ( \widetilde { H } ) = \frac { 1 } { 2 } \mathop { \mathrm { A v e } } _ { i , c } \Vert \widetilde { W } _ { L S } \widetilde { h } _ { i , c } - \pmb { y } _ { i , c } \Vert _ { 2 } ^ { 2 } + \frac { \lambda } { 2 } \Vert \widetilde { W } _ { L S } \Vert _ { F } ^ { 2 } ,
+$$
+
+and
+
+$$
+\mathcal { L } _ { L S } ^ { \perp } ( \widetilde { W } , \widetilde { H } ) = \frac { 1 } { 2 } \mathrm { t r } \bigg \{ ( \widetilde { W } - \widetilde { W } _ { L S } ) \left( \widetilde { \boldsymbol { \Sigma } } _ { T } + \widetilde { \mu } _ { G } \widetilde { \boldsymbol { \mu } } _ { G } ^ { \top } + \lambda I \right) ( \widetilde { W } - \widetilde { W } _ { L S } ) ^ { \top } \bigg \} .
+$$
+
+In the above, $\mathcal { L } _ { \mathrm { L S } } ( \widetilde { H } )$ is independent of $\widetilde { W }$ . Intuitively, it is the MSE-performance of the optimal classifiers $\widetilde { W _ { \mathrm { L S } } }$ (rather than the “real classifiers” $\widetilde { W }$ ) on input $\widetilde { \pmb { H } }$ .
+
+The component $\mathcal { L } _ { \mathrm { L S } } ^ { \perp } ( \widetilde { W } , \widetilde { H } )$ is non-negative7 and is zero only when $\widetilde { W } = \widetilde { W } _ { \mathrm { L S } }$ . Therefore, $\mathcal { L } _ { \mathrm { L S } } ^ { \perp } ( \widetilde { \pmb { H } } )$ quantifies the distance of $\widetilde { W }$ from $\widetilde { W _ { \mathrm { L S } } }$ . In short, the least-squares component, $\mathcal { L } _ { \mathrm { L S } } ( \widetilde { H } )$ , captures the behavior of the network when the classifier possesses optimal, least squares behavior. Meanwhile, the deviation component, $\mathcal { L } _ { \mathrm { L S } } ^ { \perp } ( \widetilde { W } , \widetilde { H } )$ , captures the divergence from that behavior.
+
+We can further decompose $\mathcal { L } _ { \mathrm { L S } } ( \widetilde { H } )$ into two terms, one capturing activation collapse (NC1) and the other capturing convergence to Simplex ETF of both features and classifiers ((NC2) and (NC3)).
+
+Theorem 2. (Decomposition of Least-Squares Component; Proof in Appendix $c$ ) The least-squares component, $\mathcal { L } _ { L S } ( \widetilde { \pmb { H } } )$ , of the MSE decomposition in Theorem $^ { l }$ can be further decomposed into $\mathcal { L } _ { L S } ( \widetilde { H } ) = \mathcal { L } _ { N C I } ( \widetilde { H } ) + \mathcal { L } _ { N C 2 / 3 } ( \widetilde { H } )$ , where
+
+$$
+\begin{array} { r l r } & { } & { \mathcal { L } _ { N C I } ( \widetilde { \pmb { H } } ) = \frac { 1 } { 2 } \operatorname { t r } \biggr \{ \widetilde { W } _ { L S } \left[ \widetilde { \pmb { \Sigma } } _ { W } + \lambda { \pmb I } \right] \widetilde { W } _ { L S } ^ { \top } \biggr \} , } \\ & { } & { \mathcal { L } _ { N C 2 / 3 } ( \widetilde { \pmb { H } } ) = \frac { 1 } { 2 C } \| \widetilde { W } _ { L S } \widetilde { \pmb { M } } - { \pmb I } \| _ { F } ^ { 2 } . \qquad } \end{array}
+$$
+
+Inspection of these terms is revealing. First, observe that $\mathcal { L } _ { \mathrm { N C } 2 / 3 }$ is a function of the class-means and MSE-optimal classifiers. Minimizing $\mathcal { L } _ { \mathrm { N C } 2 / 3 }$ will push the (unextended) class-means and classifiers towards the same Simpex ETF matrix8 i.e. (NC2)-(NC3). Next, note that the within-class variation is independent of the means. Thus, despite the fact that classifiers are converging towards some (potentially large) ETF matrix, we can always reduce $\mathcal { L } _ { \mathrm { N C 1 } }$ by pushing $\Sigma _ { W }$ towards zero, which corresponds to (NC1) .
+
+This motivates us to formulate the central path:
+
+$$
+\mathcal { P } = \left\{ ( \widetilde { W } _ { \mathrm { L S } } ( \widetilde { H } ) , \widetilde { H } ) | \widetilde { H } \in \mathbb { R } ^ { ( P + 1 ) \times C N } \right\} ,
+$$
+
+where the notation $\widetilde { W } _ { \mathrm { L S } } ( \cdot )$ makes explicit the fact that $\widetilde { W _ { \mathrm { L S } } }$ is a function of $\widetilde { H }$ only. Intuitively, for a classifier-features pair to lie on the central path, i.e. $( \widetilde { W } , \widetilde { H } ) \in \mathcal { P }$ , means that the “real classifier” $\widetilde { W }$ will exactly equal $\widetilde { W _ { \mathrm { L S } } } ( \widetilde { H } )$ —the optimal classifier that would result from fixing $\widetilde { H }$ and minimizing $\mathcal { L }$ w.r.t. just the classifier. Combined with Theorem 1, we see $( \widetilde { W } , \widetilde { H } ) \in \mathcal { P }$ if and only if $\mathcal { L } ( \widetilde { W } , \widetilde { H } ) { = } \mathcal { L } _ { \mathrm { L S } } ( \widetilde { H } )$ . Figure 2 shows that classifier-features pairs lie approximately on the central path during TPT, allowing us to shift focus from $\mathcal { L }$ to $\mathcal { L } _ { \mathrm { L S } }$ .
+
+# 3 EXACT CLOSED-FORM ANALYSIS ON CENTRAL PATH
+
+Consider $\lambda = 0$ in this section. For the subsequent theory, we adopt the unconstrained features (Mixon et al., 2020) or layer-peeled (Fang et al., 2021) modeling perspective9. We consider continuous training dynamics with gradient flow where time-of-training is denoted by the variable $\cdot ^ { 1 0 } t { \geq } 0$ . Within this model, we analyze the dynamics of the renormalized features $\scriptstyle { X = \sum _ { W } ^ { - { \frac { 1 } { 2 } } } H }$ on the central path
+
+$$
+\frac { \mathrm { d } } { \mathrm { d } t } \pmb { X } = - \Pi _ { T \pmb { x } } \pmb { \chi } \left( \nabla \pmb { x } \mathcal { L } _ { \mathrm { L S } } ( \pmb { X } ) \right) ,
+$$
+
+
+Figure 2: Decomposition of MSE loss: Each array column shows a benchmark image classification dataset while each row shows a canonical deep net architecture trained with MSE loss. The red vertical line indicates the epoch at which zero training error was achieved. In each array cell, we plot terms of the MSE loss decomposition $\mathcal { L } ( \widetilde { W } , \widetilde { H } ) = \mathcal { L } _ { \mathrm { N C 1 } } ( \widetilde { H } ) + \mathcal { L } _ { \mathrm { N C 2 / 3 } } ( \widetilde { H } ) + \mathcal { L } _ { \mathrm { L S } } ^ { \perp } ( \widetilde { W } , \widetilde { H } )$ from Section 2. Starting from an early epoch in training, $\mathcal { L } _ { \mathrm { L S } } ^ { \perp } ( \widetilde { W } , \widetilde { H } )$ becomes negligible compared to the dominant term, $\mathcal { L } _ { \mathrm { N C 1 } } ( \widetilde { \pmb { H } } )$ , implying $\mathcal { L } _ { \mathrm { L S } } ^ { \perp } ( \widetilde { W } , \widetilde { H } ) { \ll } \mathcal { L } _ { \mathrm { L S } } ( \widetilde { H } ) { = } \mathcal { L } _ { \mathrm { N C 1 } } ( \widetilde { H } ) { + } \mathcal { L } _ { \mathrm { N C 2 / 3 } } ( \widetilde { H } ) ,$ , i.e. the features and classifiers are effectively on the central path during TPT. Note that $\mathcal { L } _ { \mathrm { N C } 2 / 3 } ( \widetilde { H } )$ diminishes the fastest among all the terms: Intuitively, this shows that the network primarily focuses on distributing the feature class-means into a “uniform” Simplex ETF configuration (NC1)-(NC2) early on and, from there, compresses the activations towards their class-means, i.e. (NC1) , as much as possible. Further experimental details are in Appendix A. Outlier behavior is discussed in Appendix A.7.
+
+where the operator $\Pi _ { T _ { X } \mathcal { X } }$ projects the gradient onto the tangent space of the manifold11, $\mathcal { X }$ , of all identity-covariance features. For $\Sigma _ { W } ^ { - \frac { 1 } { 2 } } H$ to be well-defined, we assume that $\Sigma _ { W }$ remains full-rank12 during training. We call Equation 5 the continually renormalized gradient flow and will motivate it in more detail in later subsections. We now state our main theorem:
+
+Theorem 3. (NC Under Continually Renormalized Gradient Flow) Consider the continually renormalized gradient flow (Equation 5) in which the dynamics are restricted to the central path, and the features are renormalized to identity within-class covariance. Assume the features are initialized with zero global mean. Then, Neural Collapse emerges on the renormalized features with explicit dynamics of the flow given in Proposition 2 as well as Corollaries 1 and 2 later in this paper.
+
+Three assumptions standout which we discuss below:
+
+(A1) Restriction to central path: Figure 2 shows that—in practice, during TPT— $\mathcal { L } _ { \mathrm { L S } } ^ { \perp } ( \widetilde { W } , \widetilde { H } )$ is observed to be negligible compared to the dominant term, $\mathcal { L } _ { \mathrm { L S } } ( \widetilde { H } )$ . This indicates $( \widetilde W , \widetilde H )$ is close to the central path (Equation 4) where $\mathcal { L } ( \widetilde { W } , \widetilde { H } ) = \mathcal { L } _ { \mathrm { L S } } ( \widetilde { H } )$ . One the central path, one is effectively training with $\mathcal { L } _ { \mathrm { L S } }$ as the loss.
+
+(A2) Zero global mean: Proximity to the central path implies that the last-layer biases become close to $b _ { \mathrm { L S } }$ . Having biases $b = b _ { \mathrm { { L S } } }$ is effectively performing classification with no bias term (i.e. using only a linear classifier $W$ ) on zero-mean data. To see this, define the globally-centered features, globally-centered means, and total-covariance matrix in unextended coordinates:
+
+$$
+\overline { { H } } = H - \mu _ { G } \mathbb { 1 } _ { C N } ^ { \top } ; \quad \overline { { M } } = [ \mu _ { 1 } - \mu _ { G } , \ldots , \mu _ { C } - \mu _ { G } ] ; \quad \Sigma _ { T } = \frac { 1 } { C N } \overline { { H } } \overline { { H } } ^ { \top } .
+$$
+
+Proposition 1 then reduces to the following forms for the unextended weights and biases:
+
+$$
+\widetilde { W } _ { \mathrm { L S } } = [ W _ { \mathrm { L S } } , \ b _ { \mathrm { L S } } ] = \left[ C ^ { - 1 } \overline { { { M } } } ^ { \top } \Sigma _ { T } ^ { - 1 } , \quad C ^ { - 1 } \mathbb { 1 } _ { C } - C ^ { - 1 } \overline { { { M } } } ^ { \top } \Sigma _ { T } ^ { - 1 } \mu _ { G } \right] .
+$$
+
+For an arbitrary activation-target pair $( h , y )$ , the prediction error obeys
+
+$$
+\begin{array} { r l } & { W _ { \mathrm { L S } } h + b _ { \mathrm { L S } } - y = C ^ { - 1 } \overline { { M } } ^ { \top } \Sigma _ { T } ^ { - 1 } h + C ^ { - 1 } \mathbb { 1 } _ { C } - C ^ { - 1 } \overline { { M } } ^ { \top } \Sigma _ { T } ^ { - 1 } \mu _ { G } - y } \\ & { ~ = W _ { \mathrm { L S } } ( h - \mu _ { G } ) - ( y - C ^ { - 1 } \mathbb { 1 } _ { C } ) . } \end{array}
+$$
+
+The last line exhibits two terms in parentheses, both traceable to the action of the bias $b _ { \mathrm { L S } }$ . The term $h - \mu _ { G }$ demonstrates that the bias induces a global-mean subtraction on $^ { h }$ , while the term $\pmb { y } - C ^ { - 1 } \pmb { 1 }$ demonstrates that the bias also induces a global-mean subtraction on the one-hot targets.
+
+(A3) Renormalization to identity covariance: Renormalization is ubiquitous in the empirical deep learning literature through works such batch normalization and its variants (Ioffe & Szegedy, 2015; Salimans & Kingma, 2016; Wu & He, 2018; Ulyanov et al., 2016; Ba et al., 2016; Krizhevsky et al., 2012). It is also ideologically precedented in the theoretical ML literature through works such as Douglas et al. (1998); Banburski et al. (2019); Poggio & Liao (2020a;b). Within this paper, the covariance-renormalization is inspired by an invariance property of the loss as well as the intuitive concept of the signal-to-noise ratio from mathematical statistics (discussed later in Sections 3.1-3.2).
+
+In the subsequent sections, we motivate and introduce the theoretical constructs necessary for proving Theorem 3 and for presenting the explicit dynamics of the flow.
+
+# 3.1 INVARIANCE PROPERTY
+
+By Assumption (A2), classification on the central path is equivalent to classification on globallycentered features using only the linear classifier $W _ { \mathrm { L S } }$ . Then, using Equation 6, we can equivalently represent the central path (Equation 4) as follows:
+
+# Definition 1 (Zero Global Mean Central Path).
+
+$$
+\bar { \mathcal { P } } = \left\{ \left( W _ { L S } , \overline { { H } } \right) ~ \bigg | ~ W _ { L S } = C ^ { - 1 } \overline { { M } } ^ { \top } \Sigma _ { T } ^ { - 1 } \right\} .
+$$
+
+An invariance property holds on the central path. Let $\pmb { A }$ denote a symmetric, full-rank matrix. Then, the explicit form in Equation 6 for $W _ { \mathrm { L S } }$ implies
+
+$$
+\begin{array} { r l } & { W _ { \mathrm { L S } } ( A \overline { { H } } ) A \overline { { H } } = C ^ { - 1 } \left( A \overline { { M } } \right) ^ { \top } \left[ \left( A \overline { { H } } \right) \left( A \overline { { H } } \right) ^ { \top } \right] ^ { - 1 } A \overline { { H } } } \\ & { \qquad = C ^ { - 1 } \overline { { M } } ^ { \top } A \left[ A ^ { - 1 } \left( \overline { { H } } \overline { { H } } ^ { \top } \right) ^ { - 1 } A ^ { - 1 } \right] A \overline { { H } } } \\ & { \qquad = C ^ { - 1 } \overline { { M } } ^ { \top } \left( \overline { { H } } \overline { { H } } ^ { \top } \right) ^ { - 1 } \overline { { H } } = C ^ { - 1 } \overline { { M } } ^ { \top } \Sigma _ { T } ^ { - 1 } \overline { { H } } = W _ { \mathrm { L S } } \left( \overline { { H } } \right) \overline { { H } } , } \end{array}
+$$
+
+where the notation $W _ { \mathrm { L S } } ( \cdot )$ makes explicit that $W _ { \mathrm { L S } }$ is a function of a set of input features. Thus, the actual predictions made by the least squares classifier are invariant to choice of the coordinates in which we express $\overline { { H } }$ , i.e. all features $\overline { { A H } }$ are equivalently performing. Among those coordinate systems, we will prefer the one in which the “noise” is “whitened” or “sphered.” Recall that we assume $\dot { \Sigma } _ { W } ( \overline { { \pmb { H } } } )$ —where the notation $\pmb { \Sigma } _ { W } ( \cdot )$ expresses the within-class covariance as a function of the features—is positive-definite. Consider the coordinate transformation $\overline { { H } } \mapsto A \overline { { H } }$ with $\pmb { A } = \pmb { \Sigma } _ { W } ^ { - \frac 1 2 } ( \overline { { \pmb { H } } } )$ . In these coordinates, the features are “renormalized” to spherical covariance,
+
+$$
+\Sigma _ { W } ( A { \overline { { H } } } ) = A \Sigma _ { W } ( { \overline { { H } } } ) A = I ,
+$$
+
+so we will call $A \overline { { H } }$ the renormalized features. The class-means of $A \overline { { H } }$ are
+
+$$
+\overline { { { M } } } ( A \overline { { { H } } } ) = A \overline { { { M } } } ( \overline { { { H } } } ) = \Sigma _ { W } ^ { - \frac 1 2 } ( \overline { { { H } } } ) \overline { { { M } } } ( \overline { { { H } } } ) ,
+$$
+
+where the notation $\overline { { M } } ( \cdot )$ expresses that the means are a function of features. Thus, Equation 5 describes continuous training dynamics where we continually “renormalize” features to their equivalently-performing representer.
+
+The $\Sigma _ { W } ^ { - \frac { 1 } { 2 } } \overline { { M } }$ term evokes the canonical idea of a signal-to-noise ratio from statistics. To see this, note that the classifier in Equation 6 can be rewritten as
+
+$$
+\begin{array} { r } { W _ { \mathrm { L S } } = C ^ { - 1 } \overline { { M } } ^ { \top } \left( C ^ { - 1 } \overline { { M } } \overline { { M } } ^ { \top } + \Sigma _ { W } \right) ^ { - 1 } . } \end{array}
+$$
+
+The combined presence of the terms ${ \overline { { M } } } { \overline { { M } } } ^ { \top }$ and $\Sigma _ { W }$ in the denominator, along with $\bar { M }$ in the numerator, signals to us the presence of the informative signal-to-noise (SNR) ratio matrix:
+
+$$
+\mathrm { S N R } \equiv { \bf C } _ { W } ^ { - \frac { 1 } { 2 } } \overline { { { \cal M } } } .
+$$
+
+Why this terminology? The globally-centered class-means represent the overall “signal” indicating that the class-means are separated from each other: if they were non-separated—e.g. all equal— $\breve { M }$ would be zero. However, a classifier decision must keep in view noise—captured by $\Sigma _ { W }$ —which might confuse the classifier. So, one wishes the signal be large compared to the noise. It may help to consider the mental model—which is not at all necessary to the correctness of our analysis—under which the activations are normally distributed with $\pmb { h } _ { i , c } \sim \mathcal { N } ( \pmb { \mu _ { c } } , \pmb { \Sigma _ { W } } )$ . Under that model, a linear classifier will indeed get confused if the norm $\| \pmb { \mu } _ { c } - \pmb { \mu } _ { G } \| _ { 2 }$ is “small compared” to $\Sigma _ { W }$ . Replacing this somewhat vague statement by a discussion of quantitative properties of the SNR matrix is well understood by mathematical statisticians to be decisive for understanding classification performance in the normal case. Additionally, observe that $\mathrm { S N R } = \overline { { M } } ( \Sigma _ { W } ^ { - \frac { 1 } { 2 } } \overline { { H } } )$ . Thus, connecting back to Section 3.1, the SNR matrix is simply the class-means matrix of the renormalized features.
+
+The SNR can be further understood through its singular value decomposition (SVD).
+
+Definition 2 (SVD of SNR Matrix). Denote the SVD of the SNR matrix (Equation 8) as follows:
+
+$$
+\mathrm { S N R } = U \Omega V ^ { \top } = \sum _ { j = 1 } ^ { C - 1 } \omega _ { j } \pmb { u } _ { j } \pmb { v } _ { j } ^ { \top } .
+$$
+
+Here, $\{ \omega _ { c } \} _ { c = 1 } ^ { C - 1 }$ are the non-zero singular values of SNR; $\Omega = \mathrm { d i a g } \left( \left\{ \omega _ { c } \right\} _ { c = 1 } ^ { C - 1 } , 0 \right) \in \mathbb { R } ^ { C \times C }$ ; and the left and right singular-vectors, $U \in \mathbb { R } ^ { P \times C }$ and $V \in \mathbb { R } ^ { C \times C }$ , are partial orthogonal and orthogonal matrices, respectively, with columns $\{ u _ { j } \} _ { j = 1 } ^ { C }$ and $\{ \pmb { v } _ { j } \} _ { j = 1 } ^ { C }$ . The SNR matrix is rank $C - 1$ since $\Sigma _ { W }$ is assumed full-rank and $\bar { M }$ is rank $C - 1$ due to global-mean subtraction.
+
+The non-zero singular values, $\{ \omega _ { j } \} _ { j = 1 } ^ { C - 1 }$ , are decisive for understanding the separation performance of the least-squares linear classifier. Good performance demands that the singular values be large. Works such as Fukunaga (1972, Chapter 10) and Hastie & Tibshirani (1996) show that the magnitude of each singular value of the SNR matrix is the size of the class separation in the direction of the corresponding singular vector. In this sense, the smallest singular value captures the smallest separation between classes. Consequently, driving-larger the smallest non-zero singular value makes the task of linear separation more immune to (spherical) noise and to Euclidean-norm-constrained adversarial noise. As we will see in the next section, examining the dynamics of these singular-values when the features undergo gradient flow in renormalized coordinates leads to precise characterizations of Neural Collapse13.
+
+# 3.3 DYNAMICS OF SNR
+
+For any matrix $z$ , we use $\scriptstyle { Z _ { t } }$ in this section to denote the state of that matrix at time $t$ . Similarly, we denote with Proposition 2 an $\{ \omega _ { j } ( t ) \} _ { j = 1 } ^ { C - 1 }$ the state of the non-zero SNR singular values at s 1-2 that provide the explicit dynamics referenced $t$ . We now presenty Theorem 3.
+
+Proposition 2 (Dynamics of Singular Values of SNR Matrix; Proof in Appendix D.4). Continually renormalized gradient flow on the central path (Equation 5) induces the following closed-form dynamics on the SNR singular values (Definition 2):
+
+$$
+c _ { 1 } \log ( \omega _ { j } ( t ) ) + c _ { 2 } \omega _ { j } ^ { 2 } ( t ) + c _ { 3 } \omega _ { j } ^ { 4 } ( t ) = a _ { j } + t , \quad t \geq 0 , \quad f o r a l l j = 1 , \ldots , C - 1 .
+$$
+
+$c _ { 1 } , \ : c _ { 2 }$ , and $c _ { 3 }$ are positive constants independent of $j$ , and $a _ { j }$ is a constant depending on $\omega _ { j } ( 0 )$
+
+Corollary 1 (Properties of SNR Singular Values; Proof in Appendix D.5). SNR singular values (Definition 2) following the Equation 9 dynamics satisfy the following limiting behaviors:
+
+$$
+\begin{array} { r l } & { 1 . \ \operatorname* { l i m } _ { t \to \infty } \omega _ { j } ( t ) = \infty \quad a n d \quad \ \operatorname* { l i m } _ { t \to \infty } \frac { \omega _ { j } ( t ) } { \sqrt [ 4 ] { t / c _ { 3 } } } = 1 , \quad f o r a l l \ j = 1 , \ldots , C - 1 . } \\ & { } \\ & { 2 . \ \operatorname* { l i m } _ { t \to \infty } \frac { \operatorname* { m a x } _ { j } \omega _ { j } ( t ) } { \operatorname* { m i n } _ { j } \omega _ { j } ( t ) } = 1 . } \end{array}
+$$
+
+The first fact shows that all non-zero singular values of the SNR matrix, $\Sigma _ { W } ^ { - \frac { 1 } { 2 } } \overline { { M } }$ , grow to infinity at an asymptotic rate of $\sqrt [ 4 ] { t / c _ { 3 } }$ . Intuitively, this shows that the “signal” becomes infinitely large compared to the “noise”, i.e. (NC1). The second fact shows that the singular values of $\Sigma _ { W } ^ { - \frac { 1 } { 2 } } \overline { { M } }$ (which has zero-mean columns) approach equality—implying that the limiting matrix is a Simplex ETF (Lemma 7, Appendix D.6) i.e. (NC2). Finally, Papyan, Han, and Donoho (2020, Theorem 1) show that (NC1-2) imply (NC3-4) on the central path. Corollary 2 formalizes these intuitions.
+
+Corollary 2 (Neural Collapse Under MSE Loss; Proof in Appendix D.6). Under continually renormalized gradient flow (Equation $5$ ), the SNR matrix (Equation 8) converges to
+
+$$
+\operatorname* { l i m } _ { t \infty } \frac { 1 } { \omega _ { \mathrm { m a x } } ( t ) } \mathrm { S N R } _ { t } = \widehat { U } _ { 0 } \widehat { V } _ { 0 } ^ { \top } ,
+$$
+
+where $\widehat { U } _ { 0 } \in \mathbb { R } ^ { P \times ( C - 1 ) }$ and $\widehat { V } _ { 0 } \in \mathbb { R } ^ { C \times ( C - 1 ) }$ are the left and right singular vectors of the SNR matrix (Definition 2) at $t { = } 0$ corresponding to the non-zero singular values; and $\omega _ { \mathrm { m a x } } ( t )$ is the largest singular value at time $t$ . Furthermore, Corollary $^ { l }$ implies the occurrence of (NC1)-(NC4) i.e. renormalized gradient flow on the central path leads to Neural Collapse.
+
+Moreover, denoting the Kronecker product with $\otimes$ , the renormalized features matrix converges to
+
+$$
+\operatorname* { l i m } _ { t \to \infty } \frac { 1 } { \omega _ { \mathrm { m a x } } ( t ) } \Sigma _ { W , t } ^ { - \frac { 1 } { 2 } } \overline { { H } } _ { t } = ( \widehat { U } _ { 0 } \widehat { V } _ { 0 } ^ { \top } ) \otimes \mathbf { 1 } _ { N } ^ { \top } .
+$$
+
+# 4 RELATED WORKS
+
+Since the publication of Papyan, Han, and Donoho (2020), several works (Mixon et al., 2020; Lu & Steinerberger, 2020; E & Wojtowytsch, 2020; Poggio & Liao, 2020a;b; Fang et al., 2021; Ergen & Pilanci, 2020; Zhu et al., 2021) proposed mathematical frameworks ratifying Neural Collapse.
+
+Among them, Mixon et al. (2020) and Poggio & Liao (2020a;b) also examine MSE-NC. Our contributions are distinct from the MSE-NC analyses of Mixon et al. (2020) and Poggio & Liao (2020a;b): The work of Mixon et al. (2020) relies on a linearization of the unconstrained features model ODE while Poggio & Liao (2020a;b)—in a special section co-authored with Andrzej Banburski—examine homogeneous, weight-normalized networks. In contrast, this paper considers the dynamics of the renormalized gradient flow on the central path (motivated by the discussions in Sections 2-3). Neither Mixon et al. (2020) nor Poggio & Liao (2020a;b) provide exact, closed-form dynamics as we do.
+
+Outside the MSE setting, Lu & Steinerberger (2020); E & Wojtowytsch (2020); Ergen & Pilanci (2020); Fang et al. (2021); Zhu et al. (2021) examine the emergence of the NC properties under variants of the unconstrained features/layer-peeled model trained with CE loss. These works focus on characterizing the loss landscape or the global minima without describing the dynamics.
+
+We provide a detailed survey of all above-mentioned papers in Appendix E.
+
+# 5 CONCLUSION
+
+In this paper, after verifying that NC occurs when prototypical classification deep nets are trained with MSE loss on canonical datasets, we then derive and measure a novel decomposition of the MSE loss. We observed that the last-layer classifier tends to the least-squares classifier—motivating us to define the central path on which the classifier behaves exactly as optimal least-squares classifier. On the central path, we showed invariance properties that inspired us to examine the renormalized features and their corresponding continually renormalized gradient flow. This flow induces closed-form dynamics that imply the occurrence of Neural Collapse.
+
+# REPRODUCIBILITY STATEMENT
+
+This paper is reproducible. Experimental details about all empirical results described in this paper are provided in Appendix A. Additionally, we provide PyTorch (Paszke et al., 2019) code for reproducing NC under both MSE and CE—as well as the Figure 2 MSE decomposition—in the following Google Colaboratory notebook: here. Experimental measurements used to generated the plots in this paper have been deposited in the Stanford Digital Repository, here. All datasets and networks used in our experiments originate from the PyTorch Model Zoo with pre-processing details described in Appendix A. Formal statements and proofs of all our theoretical results are provided in Appendices B-D.
+
+# ACKNOWLEDGEMENTS
+
+Some of the computing for this project was performed on the Sherlock cluster. We would like to thank Stanford University and the Stanford Research Computing Center for providing computational resources and support that contributed to these research results.
+
+We acknowledge the support of the Natural Sciences and Engineering Research Council of Canada (NSERC), [funding reference number 512236 and 512265]. This research was funded by a Connaught New Researcher Award at the University of Toronto. This research was enabled in part by support provided by Compute Ontario (www.computeontario.ca) and Compute Canada (www.computecanada.ca). This work was also partially supported by NSF Division of Mathematical Sciences Grants 1407813, 1418362, and 1811614 and by private donors.
+
+# REFERENCES
+
+P-A Absil, Robert Mahony, and Rodolphe Sepulchre. Optimization algorithms on matrix manifolds. Princeton University Press, 2009.
+
+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, 2019.
+
+Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
+
+Andrzej Banburski, Qianli Liao, Brando Miranda, Lorenzo Rosasco, Fernanda De La Torre, Jack Hidary, and Tomaso Poggio. Theory iii: Dynamics and generalization in deep networks. arXiv preprint arXiv:1903.04991, 2019.
+
+Andrzej Banburski, Fernanda De La Torre, Nishka Plant, Ishana Shastri, and Tomaso Poggio. Crossvalidation stability of deep networks. Technical report, Center for Brains, Minds and Machines (CBMM), 2021.
+
+Peter Bartlett, Yoav Freund, Wee Sun Lee, and Robert E Schapire. Boosting the margin: A new explanation for the effectiveness of voting methods. The annals of statistics, 26(5):1651–1686, 1998.
+
+Mikhail Belkin, Daniel Hsu, Siyuan Ma, and Soumik Mandal. Reconciling modern machine-learning practice and the classical bias–variance trade-off. Proceedings of the National Academy of Sciences, 116(32):15849–15854, 2019.
+
+Lenaic Chizat and Francis Bach. On the global convergence of gradient descent for over-parameterized models using optimal transport. Advances in neural information processing systems, 31:3036–3046, 2018.
+
+Lenaic Chizat and Francis Bach. Implicit bias of gradient descent for wide two-layer neural networks trained with the logistic loss. arXiv preprint arXiv:2002.04486, 2020.
+
+Ahmet Demirkaya, Jiasi Chen, and Samet Oymak. Exploring the role of loss functions in multiclass classification. In 2020 54th Annual Conference on Information Sciences and Systems (CISS), pp. 1–5. IEEE, 2020.
+
+Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 248–255. Ieee, 2009.
+
+Scott C Douglas, SY Kung, and Shun-ichi Amari. A self-stabilized minor subspace rule. IEEE Signal Processing Letters, 5(12):328–330, 1998.
+
+Weinan E and Stephan Wojtowytsch. On the emergence of tetrahedral symmetry in the final and penultimate layers of neural network classifiers. arXiv preprint arXiv:2012.05420, 2020.
+
+Tolga Ergen and Mert Pilanci. Revealing the structure of deep neural networks via convex duality. arXiv preprint arXiv:2002.09773, 2020.
+
+Cong Fang, Hangfeng He, Qi Long, and Weijie J Su. Layer-peeled model: Toward understanding well-trained deep neural networks. arXiv preprint arXiv:2101.12699, 2021.
+
+Matthew Fickus and Dustin G Mixon. Tables of the existence of equiangular tight frames. arXiv preprint arXiv:1504.00253, 2015.
+
+Keinosuke Fukunaga. Introduction to Statistical Pattern Recognition. Elsevier, 1972.
+
+Trevor Hastie and Robert Tibshirani. Discriminant analysis by gaussian mixtures. Journal of the Royal Statistical Society: Series B (Methodological), 58(1):155–176, 1996.
+
+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.
+
+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.
+
+Roger A Horn and Charles R Johnson. Matrix analysis. Cambridge university press, 2012.
+
+Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4700–4708, 2017.
+
+Like Hui and Mikhail Belkin. Evaluation of neural architectures trained with square loss vs crossentropy in classification tasks. arXiv preprint arXiv:2006.07322, 2020.
+
+Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International conference on machine learning, pp. 448–456. PMLR, 2015.
+
+Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
+
+Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25:1097–1105, 2012.
+
+Yann LeCun, Corinna Cortes, and CJ Burges. MNIST handwritten digit database. AT&T Labs [Online]. Available: http://yann. lecun. com/exdb/mnist, 2, 2010.
+
+Mingchen Li, Mahdi Soltanolkotabi, and Samet Oymak. Gradient descent with early stopping is provably robust to label noise for overparameterized neural networks. In International conference on artificial intelligence and statistics, pp. 4313–4324. PMLR, 2020.
+
+Jianfeng Lu and Stefan Steinerberger. Neural collapse with cross-entropy loss. arXiv preprint arXiv:2012.08465, 2020.
+
+Song Mei, Andrea Montanari, and Phan-Minh Nguyen. A mean field view of the landscape of twolayer neural networks. Proceedings of the National Academy of Sciences, 115(33):E7665–E7671, 2018.
+
+Dustin G Mixon, Hans Parshall, and Jianzong Pi. Neural collapse with unconstrained features. arXiv preprint arXiv:2011.11619, 2020.
+
+Vardan Papyan, X. Y. Han, and David L. Donoho. Prevalence of Neural Collapse during the terminal phase of deep learning training. Proceedings of the National Academy of Sciences, 117(40): 24652–24663, 2020.
+
+Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. In Advances in neural information processing systems, pp. 8026–8037, 2019.
+
+Tomaso Poggio and Qianli Liao. Explicit regularization and implicit bias in deep network classifiers trained with the square loss. arXiv preprint arXiv:2101.00072, 2020a.
+
+Tomaso Poggio and Qianli Liao. Implicit dynamic regularization in deep networks. Technical report, Center for Brains, Minds and Machines (CBMM), 2020b.
+
+Lutz Prechelt. Early stopping-but when? In Neural Networks: Tricks of the trade, pp. 55–69. Springer, 1998.
+
+Leslie Rice, Eric Wong, and Zico Kolter. Overfitting in adversarially robust deep learning. In International Conference on Machine Learning, pp. 8093–8104. PMLR, 2020.
+
+Grant M Rotskoff and Eric Vanden-Eijnden. Parameters as interacting particles: long time convergence and asymptotic error scaling of neural networks. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, pp. 7146–7155, 2018.
+
+Tim Salimans and Durk P Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. Advances in neural information processing systems, 29:901–909, 2016.
+
+Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition, 2014.
+
+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.
+
+Thomas Strohmer and Robert W Heath Jr. Grassmannian frames with applications to coding and communication. Applied and computational harmonic analysis, 14(3):257–275, 2003.
+
+James Townsend. Differentiating the singular value decomposition. Technical report, Technical Report 2016, https://j-towns. github. io/papers/svd-derivative . . . , 2016.
+
+Dmitry Ulyanov, Andrea Vedaldi, and Victor Lempitsky. Instance normalization: The missing ingredient for fast stylization. arXiv preprint arXiv:1607.08022, 2016.
+
+Andrew R Webb and David Lowe. The optimised internal representation of multilayer classifier networks performs nonlinear discriminant analysis. Neural Networks, 3(4):367–375, 1990.
+
+Yuxin Wu and Kaiming He. Group normalization. In Proceedings of the European conference on computer vision (ECCV), pp. 3–19, 2018.
+
+Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-MNIST: a novel image dataset for benchmarking machine learning algorithms, 2017.
+
+Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. 2016.
+
+Zhihui Zhu, Tianyu Ding, Jinxin Zhou, Xiao Li, Chong You, Jeremias Sulam, and Qing Qu. A geometric analysis of neural collapse with unconstrained features. arXiv preprint arXiv:2105.02375, 2021.
+
+# APPENDIX
+
+# A MSE Neural Collapse experiments 14
+
+A.1 Datasets . . . 14
+A.2 Networks 14
+A.3 Optimization methodology 14
+A.4 Computational resources 14
+A.5 Formatting . . 15
+A.6 Experimental results 15
+A.7 Exceptions: STL10-ResNet and STL10-DenseNet . 21
+A.8 Open Questions: Weight-decay, batch normalization, SGD, generalization, test data 21
+
+B Theorem 1 22
+
+C Theorem 2 22
+C.1 Intuitions for Theorem 2 in unextended coordinates 23
+C.2 Additional intuitions for Theorem 2 terms 23
+
+# D Theorem 3 23
+
+D.1 Implications of invariance . . . 23
+D.2 Aligned SNR coordinates . 25
+D.3 Continually renormalized gradient flow 27
+D.4 Proof of Proposition 2 (gradient flow in aligned SNR coordinates) 28
+D.5 Proof of Corollary 1 . . 31
+D.6 Proof of Corollary 2 . . . . 31
+
+# E Related works examining Neural Collapse 33
+
+E.1 Mixon, Parshall, and Pi (2020) 34
+E.2 Lu and Steinerberger (2020) 34
+E.3 E and Wojtowytsch (2020) 34
+E.4 Poggio & Liao (2020a;b) (with Banburski) . 35
+E.5 Ergen & Pilanci (2020) . . 35
+E.6 Fang, He, Long, and Su (2021) . 35
+E.7 Zhu, Ding, Zhou, Li, You, Sulam, and Qu (2021) 36
+
+# A MSE NEURAL COLLAPSE EXPERIMENTS
+
+The experiments in this section examine the properties of Neural Collapse (NC) on deep nets trained using MSE loss. The direct MSE-analogues to the cross-entropy (CE) loss table and figures in Papyan, Han, and Donoho (2020) are in Table 1 and Figures 3-9 here. Furthermore, Figures 10-11 compares the MSE-NC experiments observed in this paper with the CE-NC behaviors in Papyan, Han, and Donoho (2020). Experimental descriptions and discussions are within the captions. Subsections A.1-A.5 describe formatting and experimental details. Then, Subsection A.6 collectively presents all experimental figures for this section. Subsection A.7 addresses outlier behaviors observed in the plots. Finally, Subsection A.8 discusses open questions inspired by NC.
+
+# A.1 DATASETS
+
+We consider the MNIST, FashionMNIST, CIFAR10, SVHN, and STL10 datasets with pre-processing the same as in Papyan, Han, and Donoho (2020).
+
+# A.1.1 CHOICE OF DATASETS
+
+Demirkaya et al. (2020) and Hui & Belkin (2020) showed multi-class classification deep nets trained with MSE loss—sometimes with a heuristical-scaling—demonstrate comparable test-error performance to those trained with CE loss. Even without additional scaling, i.e. with vanilla MSE loss, we found this true for ten class classification datasets—such as MNIST, FashionMNIST, SVHN, CIFAR10, and STL10—so we focus on these five datasets. For more than ten classes (i.e. datasets such as CIFAR100 and ImageNet), both Demirkaya et al. (2020) and Hui & Belkin (2020) showed that the additional scaling-heuristic does need to be applied to the loss before comparable test-performance can be achieved. In informal, exploratory experiments not reported here, we were able to reproduce their results on datasets with more than ten classes. But, we feel these scaling-heuristics merit further scientific investigation of their own and are beyond the scope of this article14, so we do not include datasets that require scaling-heuristic tuning.
+
+# A.2 NETWORKS
+
+We train VGG, ResNet, and DenseNet models with the same depth-selection procedures and architecture-specification choices as in Papyan, Han, and Donoho (2020). In the MSE setting, the final chosen depths were as follows:
+
+
DATASET
VGG
REsNET
DENSENET
MNIST
VGG11
RESNET18
DENSENET40
FASHIONMNIST
VGG11
RESNET18
DENSENET250
SVHN
VGG13
RESNET34
DENSENET40
CIFAR10
VGG11
RESNET50
DENSENET100
STL10
VGG11
REsNET18
DENSENET201
+
+# A.3 OPTIMIZATION METHODOLOGY
+
+The optimization algorithm, parameters, and hyperparameter tuning are the same as in Papyan, Han, and Donoho (2020).
+
+# A.4 COMPUTATIONAL RESOURCES
+
+The experiments were run on Stanford University’s Sherlock computing cluster. Each dataset-network combination was trained on a single GPU attached to a CPU with at least 32GB of RAM—the specific types of the CPUs/GPUs vary according to whichever was first assigned to us by the HPC cluster scheduler.
+
+# A.5 FORMATTING
+
+The coloring and formatting of the plots are the same as in Papyan, Han, and Donoho (2020).
+
+A.6 EXPERIMENTAL RESULTS
+
+Table 1: Table comparing test-accuracy at moment 0-error is achieved vs. at the end of training. Analogous to Table 1 of Papyan, Han, and Donoho (2020). The median improvement is 0.962 percentage points; the mean is 1.833 percentage points.
+
+
DATASET
NET
ACC.O-ERROR
ACC.FINAL
MNIST
VGG
99.23
99.59
REsNET
99.16
99.70
DENSENET
99.62
99.70
FASHION
VGG
92.76
92.95
REsNET
93.55
93.76
DENSENET
90.56
92.95
SVHN
VGG
89.35
93.91
REsNET
85.18
92.65
DENSENET
95.61
95.23
CIFAR10
VGG
83.13
84.54
RESNET
75.43
76.39
DENSENET
91.77
91.78
STL10
VGG
60.43
67.24
REsNET
59.35
60.56
DENSENET
58.74
60.41
+
+
+Figure 3: Plots analogous to Figure 2 in Papyan et al. (2020), but on networks trained with MSE Loss. Results demonstrate that last-layer features and classifiers approach equinormness.
+
+
+Figure 4: Plots analogous to Figure 3 in Papyan et al. (2020), but on networks trained with MSE Loss. Results demonstrate that last-layer features and classifiers approach equiangularity.
+
+
+Figure 5: Plots analogous to Figure 4 in Papyan et al. (2020), but on networks trained with MSE Loss. Results demonstrate that last-layer features and classifiers approach maximal-equiangularity.
+
+
+Figure 6: Plots analogous to Figure 5 in Papyan et al. (2020), but on networks trained with MSE Loss. Results demonstrate that last-layer features and classifiers approach self-duality.
+
+
+Figure 7: Plots analogous to Figure 6 in Papyan et al. (2020), but on networks trained with MSE Loss. Results demonstrate that last-layer features undergo variability collapse.
+
+
+Figure 8: Plots analogous to Figure 7 in Papyan et al. (2020), but on networks trained with MSE Loss. Results demonstrate that classifier decisions converge to those of the nearest class center decision rule.
+
+
+Figure 9: Plots analogous to Figure 8 in Papyan et al. (2020), but on networks trained with MSE Loss. Results demonstrate that networks become more robust when trained beyond 0-error. The median improvement in the robustness measure in the last epoch over the first epoch achieving zero training error is 0.1762; the mean improvement is 0.9278.
+
+
+Figure 10: Activation collapse under MSE loss vs. $C E$ loss: Comparison of activation collapse observed in this paper for networks trained under MSE loss (Figure 7) with that observed in Papyan et al. (2020) under CE loss. Networks trained with MSE loss tend to achieve faster activation collapse than those trained with CE.
+
+
+Figure 11: Adversarial robustness under MSE loss vs. CE loss: Comparison of adversarial robustness observed in this paper for networks trained under MSE loss (Figure 9) with that observed in Papyan et al. (2020) under CE loss. Robustness tends to be better—sometimes several magnitudes better— when the networks are trained with MSE loss than with CE loss.
+
+
+Figure 12: Activation collapse on test data for both losses: Activation collapse observed on test data for models trained with MSE loss (from this current paper) and CE loss (posted by Papyan, Han, and Donoho (2020) on Stanford Data Repository). On the test data, activation collapse still visibly occurs on multiple dataset-network combinations: Albeit the rate of collapse is much slower on the test data compared to that on the train data, and the plotted measure (described in Figure 6 of Papyan, Han, and Donoho (2020)) at the last epoch is larger than that on the train data. Also interesting is that the value at the last epoch is roughly monotonic with the difficulty of the dataset. See discussion in Section A.8.
+
+A.7 EXCEPTIONS: STL10-RESNET AND STL10-DENSENET
+
+The STL10-ResNet and STL10-DenseNet dataset-network pairs stand out among the experiments described in this section—sometimes displaying outlier behavior either by converging more slowly to Neural Collapse or by exhibiting trends inconsistent with those found in other dataset-network pairs.
+
+STL10 stands apart from the other canonical datasets for multiple reasons15 and is a “less-typical” benchmark compared to more “compulsory” datasets like CIFAR10. In this particular case, we hypothesize that its outlier behavior might be caused by the size of the STL10 images $( 9 6 \times 9 6$ compared to the $3 2 \times 3 2$ , after padding, of the other datasets)—leading to a higher-dimensional problem, which, in turn, induces a harder non-convex optimization problem, which might make SGD less likely to converge to a useful optimum or might make the convergence much slower and harder to observe under a fixed computational budget.
+
+It was previously noted in Hui & Belkin (2020) and Demirkaya et al. (2020) that more challenging classification problems—in those projects, problems with more classes to be labeled—may require modifications to the MSE loss. We decided that such modifications are unnecessary in the ten class problems examined in this paper’s experiments. But perhaps the outlier nature of the STL10-ResNet and STL10-DenseNet combinations signal that the MSE loss modifications proposed by Hui & Belkin (2020) and Demirkaya et al. (2020) ought to have been used.
+
+A.8 OPEN QUESTIONS: WEIGHT-DECAY, BATCH NORMALIZATION, SGD, GENERALIZATION, TEST DATA
+
+The experiments in this paper as well as those in Papyan, Han, and Donoho (2020) were conducted under the canonical setting where deep nets were trained using SGD with weight-decay and batch normalization—leading one to wonder about the roles that these particular ingredients play on the NC phenomena. Additionally, most observables focus on the train data—raising the question of how the NC phenomena behave on test data as well as their relationship to generalization. We find these questions intriguing, but feel each deserves careful experimentation outside the scope of this paper.
+
+Nonetheless, we note here that several existing papers have already begun insightful investigations in these directions. For example, weight-decay, weight-normalization (as a proxy for batchnormalization), and SGD play key roles in the analyses of Banburski et al. (2019); Poggio & Liao (2020a;b) that, along other things, lead to the prediction of NC in homogeneous deep nets. Banburski et al. (2021) also explores the connection between NC and margin distributions with generalization.
+
+Another example is Zhu et al. (2021) in which the authors conduct several experiments on ResNets trained on CIFAR10. On their models, the authors examine NC-related properties relative to the train data, test data, and randomly labeled data; they also conducted ablation studies varying control parameters (weight-decay, width, etc.) and the optimization algorithm (SGD, ADAM, L-BFGS). Based on their results, Zhu et al. (2021) propose thought-provoking conjectures on the role of each of these components (see Section E.7 for a brief survey of their findings).
+
+As a preliminary exploration, we include Figure 12 showing the variability collapse (NC1) behavior on test data for the networks trained with MSE loss (used in this paper) as well as those trained with CE loss (released16 by Papyan, Han, and Donoho (2020)). From Figure 12, we see that variability collapse occurs much slower on the test data than on the train data. Although not shown here, the other NC phenomena behave similarly.
+
+In this Appendix, we show Figure 12 since it is concise, within reach, and may be of interest to readers who share our curiosity. We refrain from presenting the entire series of multi-figure NC measurements on test data because it is outside the scope of this paper and would significantly lengthen this appendix. We also refrain from speculating on any underlying explanations until more meticulous experiments are conducted.
+
+# B THEOREM 1
+
+Theorem 1. (Decomposition of MSE Loss) The MSE loss, $\mathcal { L } ( \widetilde { W } , \widetilde { H } )$ , can be decomposed into two terms, $\mathcal { L } ( \widetilde { W } , \widetilde { H } ) = \bar { \mathcal { L } } _ { L S } ( \widetilde { H } ) + \mathcal { L } _ { L S } ^ { \bot } ( \widetilde { W } , \widetilde { H } )$ , where
+
+$$
+\mathcal { L } _ { L S } ( \widetilde { H } ) = \frac { 1 } { 2 } \mathop { \mathrm { A v e } } _ { i , c } \Vert \widetilde { W } _ { L S } \widetilde { h } _ { i , c } - \pmb { y } _ { i , c } \Vert _ { 2 } ^ { 2 } + \frac { \lambda } { 2 } \Vert \widetilde { W } _ { L S } \Vert _ { F } ^ { 2 } ,
+$$
+
+and
+
+$$
+\mathcal { L } _ { L S } ^ { \perp } ( \widetilde { W } , \widetilde { H } ) = \frac { 1 } { 2 } \mathrm { t r } \bigg \{ ( \widetilde { W } - \widetilde { W } _ { L S } ) \left( \widetilde { \boldsymbol { \Sigma } } _ { T } + \widetilde { \mu } _ { G } \widetilde { \boldsymbol { \mu } } _ { G } ^ { \top } + \lambda I \right) ( \widetilde { W } - \widetilde { W } _ { L S } ) ^ { \top } \bigg \} .
+$$
+
+Proof. Recall the MSE loss:
+
+$$
+\mathcal { L } ( \widetilde { W } , \widetilde { H } ) = \frac { 1 } { 2 } \mathop { \mathrm { A v e } } _ { i , c } \| \widetilde { W } \widetilde { h } _ { i , c } - y _ { i , c } \| _ { 2 } ^ { 2 } + \frac { \lambda } { 2 } \| \widetilde { W } \| _ { F } ^ { 2 } .
+$$
+
+Consider a specific extended activations matrix $\widetilde { H }$ ; the least-squares solution $\widetilde { W }$ minimizing $\mathcal { L } ( \widetilde { W } , \widetilde { H } )$ with $\widetilde { H }$ kept fixed must obey the following first-order optimality condition:
+
+$$
+\underset { i , c } { \mathrm { A v e } } \big ( \widetilde { W } _ { \mathrm { L S } } \widetilde { h } _ { i , c } - { \pmb y } _ { i , c } \big ) \widetilde { { \pmb h } } _ { i , c } ^ { \top } + \lambda \widetilde { { \pmb W } } _ { \mathrm { L S } } = 0 .
+$$
+
+From Proposition 1 in the main manuscript, the solution to the above is given by
+
+$$
+\widetilde { \pmb { W } } _ { \mathrm { L S } } = C ^ { - 1 } \widetilde { \pmb { M } } ^ { \top } ( \widetilde { \pmb { \Sigma } } _ { T } + \widetilde { \pmb { \mu } } _ { G } \widetilde { \pmb { \mu } } _ { G } ^ { \top } + \lambda \pmb { I } ) ^ { - 1 } .
+$$
+
+The loss can be rewritten as
+
+$$
+\frac { 1 } { 2 } \mathop { \mathrm { A v e } } _ { i , c } \| \widetilde { W } _ { \mathrm { L S } } \widetilde { h } _ { i , c } - y _ { i , c } + ( \widetilde { W } - \widetilde { W } _ { \mathrm { L S } } ) \widetilde { h } _ { i , c } \| _ { 2 } ^ { 2 } + \frac { \lambda } { 2 } \| \widetilde { W } \| _ { F } ^ { 2 } .
+$$
+
+Combining the above with Equation 13 gives, after rearranging:
+
+$$
+\frac { 1 } { 2 } \operatorname { A v e } \| \widetilde { W } _ { \mathrm { L S } } \widetilde { h } _ { i , c } - y _ { i , c } \| _ { 2 } ^ { 2 } + \frac { 1 } { 2 } \operatorname { A v e } \| ( \widetilde { W } - \widetilde { W } _ { \mathrm { L S } } ) \widetilde { h } _ { i , c } \| _ { 2 } ^ { 2 } - \lambda \mathrm { t r } \Big \{ \widetilde { W } _ { \mathrm { L S } } ( \widetilde { W } - \widetilde { W } _ { \mathrm { L S } } ) ^ { \top } \Big \} + \frac { \lambda } { 2 } \| \widetilde { W } \| _ { F } ^ { 2 } ,
+$$
+
+which is equivalent to
+
+$$
+\frac { 1 } { 2 } \operatorname { A v e } \| \widetilde { W } _ { \mathrm { L S } } \widetilde { h } _ { i , c } - y _ { i , c } \| _ { 2 } ^ { 2 } + \frac { 1 } { 2 } \operatorname { A v e } \| ( \widetilde { W } - \widetilde { W } _ { \mathrm { L S } } ) \widetilde { h } _ { i , c } \| _ { 2 } ^ { 2 } + \frac { \lambda } { 2 } \| \widetilde { W } _ { \mathrm { L S } } \| _ { F } ^ { 2 } + \frac { \lambda } { 2 } \| \widetilde { W } _ { \mathrm { L S } } - \widetilde { W } \| _ { F } ^ { 2 } .
+$$
+
+Using the above, the loss can indeed be decomposed as
+
+$$
+\mathcal { L } ( \widetilde { W } , \widetilde { H } ) = \mathcal { L } _ { \mathrm { L S } } ( \widetilde { H } ) + \mathcal { L } _ { \mathrm { L S } } ^ { \perp } ( \widetilde { W } , \widetilde { H } ) ,
+$$
+
+where
+
+$$
+\mathcal { L } _ { \mathrm { L S } } ( \widetilde { \pmb { H } } ) \equiv \frac { 1 } { 2 } \underset { i , c } { \mathrm { A v e } } \Vert \widetilde { \pmb { W } } _ { \mathrm { L S } } \widetilde { \pmb { h } } _ { i , c } - \pmb { y } _ { i , c } \Vert _ { 2 } ^ { 2 } + \frac { \lambda } { 2 } \Vert \widetilde { \pmb { W } } _ { \mathrm { L S } } \Vert _ { F } ^ { 2 }
+$$
+
+and
+
+$$
+\begin{array} { l } { \mathcal { L } _ { \mathrm { L S } } ^ { \perp } ( \widetilde { W } , \widetilde { H } ) \equiv \displaystyle \frac { 1 } { 2 } \operatorname { A v e } _ { i , c } \| ( \widetilde { W } - \widetilde { W } _ { \mathrm { L S } } ) \widetilde { h } _ { i , c } \| _ { 2 } ^ { 2 } + \displaystyle \frac { \lambda } { 2 } \| \widetilde { W } _ { \mathrm { L S } } - \widetilde { W } \| _ { F } ^ { 2 } } \\ { \displaystyle \qquad = \displaystyle \frac { 1 } { 2 } \operatorname { t r } \Big \{ ( \widetilde { W } - \widetilde { W } _ { \mathrm { L S } } ) \left( \widetilde { \Sigma } _ { T } + \widetilde { \mu } _ { G } \widetilde { \mu } _ { G } ^ { \top } + \lambda I \right) ( \widetilde { W } - \widetilde { W } _ { \mathrm { L S } } ) ^ { \top } \Big \} . } \end{array}
+$$
+
+This completes the proof.
+
+# C THEOREM 2
+
+Theorem 2. (Decomposition of Least-Squares Component) The least-squares component, $\mathcal { L } _ { L S } ( \widetilde { \pmb { H } } )$ , of the MSE decomposition in Theorem 1 can be further decomposed into $\mathcal { L } _ { L S } ( \widetilde { H } ) = \mathcal { L } _ { N C I } ( \widetilde { H } ) +$ $\mathcal { L } _ { N C 2 / 3 } ( \widetilde { H } )$ , where
+
+$$
+\begin{array} { r l r } & { } & { \mathcal { L } _ { N C I } ( \widetilde { \pmb { H } } ) = \frac { 1 } { 2 } \operatorname { t r } \biggr \{ \widetilde { W } _ { L S } \left[ \widetilde { \pmb { \Sigma } } _ { W } + \lambda { \pmb I } \right] \widetilde { W } _ { L S } ^ { \top } \biggr \} , } \\ & { } & { \mathcal { L } _ { N C 2 / 3 } ( \widetilde { \pmb { H } } ) = \frac { 1 } { 2 C } \| \widetilde { W } _ { L S } \widetilde { \pmb { M } } - { \pmb I } \| _ { F } ^ { 2 } . \qquad } \end{array}
+$$
+
+Proof. Under Euclidean distance, perturbations to the extended activations matrix $\widetilde { H }$ which affect only the class-means or global-mean are orthogonal to perturbations which affect only the within-class covariance. Using this, $\overline { { \mathcal { L } _ { \mathrm { L S } } ( \widetilde { H } ) } }$ can be further decomposed via the Pythagorean theorem:
+
+$$
+\mathcal { L } _ { \mathrm { L S } } ( \widetilde { H } ) = \frac { 1 } { 2 } \mathop { \mathrm { A v e } } _ { i , c } \Vert \widetilde { W } _ { \mathrm { L S } } ( \widetilde { h } _ { i , c } - \widetilde { \mu } _ { c } ) \Vert _ { 2 } ^ { 2 } + \frac { \lambda } { 2 } \Vert \widetilde { W } _ { \mathrm { L S } } \Vert _ { F } ^ { 2 } + \frac { 1 } { 2 } \mathop { \mathrm { A v e } } _ { c } \Vert \widetilde { W } _ { \mathrm { L S } } \widetilde { \mu } _ { c } - y _ { i , c } \Vert _ { 2 } ^ { 2 } .
+$$
+
+The first and second terms above merge into $\mathcal { L } _ { \mathrm { N C 1 } } ( \widetilde { H } )$ , while the third term becomes $\mathcal { L } _ { \mathrm { N C } 2 / 3 } ( \widetilde { H } )$
+
+$$
+\begin{array} { r l } & { \mathcal { L } _ { \mathrm { N C 1 } } ( \widetilde { \pmb { H } } ) = \displaystyle \frac { 1 } { 2 } \mathrm { t r } \Big \{ \widetilde { W } _ { \mathrm { L S } } \left( \widetilde { \pmb { \Sigma } } _ { W } + \lambda I \right) \widetilde { W } _ { \mathrm { L S } } ^ { \top } \Big \} } \\ & { \mathcal { L } _ { \mathrm { N C 2 } / 3 } ( \widetilde { \pmb { H } } ) = \displaystyle \frac { 1 } { 2 C } \| \widetilde { W } _ { \mathrm { L S } } \widetilde { M } - \pmb { I } \| _ { F } ^ { 2 } . } \end{array}
+$$
+
+This completes the proof.
+
+C.1 INTUITIONS FOR THEOREM 2 IN UNEXTENDED COORDINATES
+
+For intuition, consider when $\lambda = 0$ , i.e. the no weight-decay case. Proposition 1 in the main text gives
+
+$$
+\begin{array} { r } { W _ { \mathrm { L S } } = C ^ { - 1 } \overline { { M } } ^ { \top } \Sigma _ { T } ^ { - 1 } , } \end{array}
+$$
+
+where $\overline { { M } } \in \mathbb { R } ^ { P \times C }$ is the matrix with columns $\mu _ { c } - \mu _ { G }$ . Returning to the unextended coordinates, $\mathcal { L } _ { \mathrm { N C 1 } } ( \overline { { H } } )$ simplifies to
+
+$$
+\mathcal { L } _ { \mathrm { N C 1 } } ( \overline { { H } } ) = \frac { 1 } { 2 } \mathrm { t r } \big \{ W _ { \mathrm { L S } } \Sigma _ { W } W _ { \mathrm { L S } } ^ { \top } \big \} ,
+$$
+
+where $\overline { { H } } \in \mathbb { R } ^ { P \times C N }$ has columns $h _ { i , c } - \mu _ { G }$ . The term $\mathcal { L } _ { \mathrm { N C } 2 / 3 } ( \overline { { H } } )$ also simplifies instructively to
+
+$$
+\mathcal { L } _ { \mathrm { N C 2 / 3 } } ( \overline { { H } } ) = \frac { 1 } { 2 C } \| W _ { \mathrm { L S } } \overline { { M } } - \Phi \| _ { F } ^ { 2 } ,
+$$
+
+where $\Phi \in \mathbb { R } ^ { C \times C }$ is the standard Simplex ETF:
+
+$$
+\pmb { \Phi } = \pmb { I } - \frac { 1 } { C } \pmb { 1 } \pmb { 1 } ^ { \top } .
+$$
+
+C.2 ADDITIONAL INTUITIONS FOR THEOREM 2 TERMS
+
+The expressions in Equation 15 and Equation 17 further evoke the intuition that $\mathcal { L } _ { \mathrm { N C 1 } } ( \overline { { H } } )$ is a variance term that goes to zero only under activation collapse (NC1)
+
+More specifically, we see that, with the class-means held constant, the only way to have ${ \mathcal { L } } _ { \mathrm { N C l } } ( { \overline { { H } } } ) \to$ 0 is for $\pmb { \Sigma } _ { W } \mathbf { 0 }$ . Similarly, by examining Equation 18, we see that
+
+$\mathcal { L } _ { \mathrm { N C } 2 / 3 } ( \overline { { H } } )$ quantifies deviations of $W _ { \mathrm { L S } } \overline { { M } }$ —i.e. the matrix of class-mean predictions—from the standard Simplex ETF.
+
+Under (NC2) and (NC3) , both $W _ { \mathrm { L S } }$ and $\bar { M }$ tend to jointly aligned ETF’s, possibly in an alternate pose; so $W _ { \mathrm { L S } } \to \Phi U ^ { T }$ and ${ \overline { { M } } } \to U \Phi$ for a partial orthogonal matrix $U$ satisfying ${ \pmb U } ^ { T } { \pmb U } = { \pmb I } _ { C }$ . Since $\Phi ^ { 2 } \ = \ \Phi$ , (NC2) and (NC3) together demand $W _ { \mathrm { L S } } ^ { \mathrm { { - } } } \overline { { M } } \to \Phi$ . Thus, $\bar { \mathcal { L } } _ { \mathrm { N C } 2 / 3 } ( \overline { { H } } )$ can be interpreted as a semi-metric reflecting the distance from achieving (NC2) and (NC3) .
+
+# D THEOREM 3
+
+# D.1 IMPLICATIONS OF INVARIANCE
+
+In this section, we will discuss in more detail how the invariance observed Section 3.1 leads the the continually renormalized gradient flow (Equation 5). In particular, we have seen in Section 3.1 of the main text that, on the central path, both the predictions $W _ { \mathrm { L S } } ( \overline { { H } } ) \overline { { H } }$ and the MSE loss $\mathcal { L } ( W _ { \mathrm { L S } } ( \overline { { H } } ) , \overline { { M } } ( \overline { { H } } ) )$ are invariant under the transformation ${ \overline { { H } } } \mapsto A { \overline { { H } } }$ when $\pmb { A }$ is a invertible matrix. Since our interest mainly lies with $\pmb { A } = \pmb { \Sigma } _ { W } ^ { - \frac 1 2 }$ , we will restrict the intuitive discussion in this section to positive-definite $\pmb { A }$ .
+
+
+Figure 13: Fiber bundle. Any full-rank features matrix, $\overline { { H } }$ , has a representative element, $\boldsymbol { X }$ , on $\mathcal { X }$ . For any $\mathbf x \in \mathcal X$ , a fiber is the set $s \times x$ i.e. $\{ A X : ~ A \in { \mathcal { S } } \}$ (the Minkowski set product), where $s$ is the set of symmetric positive-definite matrices. Features on the same fiber generate the same class predictions and the same MSE loss. The optimization described in Sections D.1-D.3 moves fiber-to-fiber.
+
+Now, consider the set $\mathcal { H }$ of features $\overline { { H } }$ with with non-singular within-class covariances. We view $\mathcal { H }$ as a fiber bundle17, where—on each fiber—live (apparently) different activations, $\overline { { H } }$ , that (in fact) generate the exact same class predictions and the exact same MSE loss (see Figure 13). The base space—we will denote it $\mathcal { X }$ —can be taken to be the collection of $\mathbf { } X \in { \mathcal { H } }$ where $\Sigma _ { W } ( { \pmb X } ) = { \pmb I }$ . Every $\overline { { H } } \in { \mathcal { H } }$ is representable as ${ \overline { { H } } } = A X$ where ${ \pmb A } = { \pmb \Sigma } _ { W } ^ { - \frac 1 2 } ( \overline { { { \pmb H } } } )$ and $\Sigma _ { W } ( { \pmb X } ) = { \pmb I }$ . The activation matrices $\boldsymbol { X }$ in the base space might be variously called “pre-whitened,” “normalized,” “standardized,” or “sphered.” We shall call $\mathcal { X }$ a normalized features manifold18.
+
+Invoking invariance, we can make the following observations about our optimization task:
+
+1. If, at a specific $t$ , $\pmb { H } _ { t }$ happens to be a normalized set of activations (i.e. $\pmb { H } _ { t } \in \mathcal { X }$ is currently located in the base space $\mathcal { X }$ ), there is no performance benefit to leaving the base space. There is also no performance benefit to moving along a fiber; only by moving from fiber-to-fiber can we improve performance. 2. In some sense, we waste time except when jumping from fiber-to-fiber; we might prefer to stay in the base space all the time by forcing the dynamics to jump from fiber-to-fiber.
+
+On the other hand, we started with the viewpoint of studying gradient flow of the original $\pmb { H }$ . So, we consider the following natural model for the application of gradient descent in $\boldsymbol { X }$ :
+
+1. For a given initial feature activations, $\overline { { { \cal H } } } _ { 0 } \in \mathcal { H }$ , we renormalize—obtaining a starting point $\boldsymbol { X } _ { 0 } \in \mathcal { X }$ ; here $\begin{array} { r } { X _ { 0 } = \Sigma _ { W } ^ { - \frac { 1 } { 2 } } ( \overline { { H } } _ { 0 } ) \overline { { H } } _ { 0 } } \end{array}$ . Class predictions and MSE loss performance for the MSE-optimal classifier do not change from this renormalization.
+
+2. We compute the usual gradient of MSE loss, at $X _ { 0 }$ , obtaining a step $\begin{array} { r l } { \Delta X _ { 0 } } & { { } = } \end{array}$ $- \eta \nabla _ { X } \mathcal { L } _ { \mathrm { L S } } ( X _ { 0 } )$ , where $\eta$ is a step size.
+
+3. We take a step, going to
+
+$$
+\overline { { { \pmb { H } } } } _ { 1 } = { \pmb X } _ { 0 } + \Delta { \pmb X } _ { 0 } .
+$$
+
+4. $\overline { { { \pmb { H } } } } _ { 1 }$ will not necessarily be normalized. We map back along whatever fiber we have landed upon, obtaining a corresponding point in the base space $\mathcal { X }$ , call this $X _ { 1 }$ . Here,
+
+$$
+\begin{array} { r } { { \pmb X } _ { 1 } = \pmb { \Sigma } _ { W } ^ { - \frac { 1 } { 2 } } ( \overline { { \pmb H } } _ { 1 } ) \overline { { \pmb H } } _ { 1 } . } \end{array}
+$$
+
+Class predictions and MSE loss performance do not change from this renormalization.
+
+5. Repeat steps 2, 3, 4 at $X _ { 1 }$ , obtaining thereby $X _ { 2 }$ ; and so on.
+
+This process might be described as gradient descent with continual renormalization:
+
+1. Renormalize the initial features activation matrix;
+2. Compute the ordinary gradient of MSE loss and take the gradient descent step;
+3. Renormalize again after each such step; and
+4. Repeat steps 2 and 3.
+
+While the continual renormalization process differs from usual gradient flow, it is both intuitively understandable and sensible. See discussion of assumption (A3) in Section 3
+
+# D.2 ALIGNED SNR COORDINATES
+
+Analysis of continually renormalized gradient flow can be simplified, without loss of generality, by applying a change of basis in both row and column space:
+
+Definition 3 (Transformation into Aligned SNR Coordinates). Consider the SVD decomposition of the SNR from Definition 2 outputting left singular vectors $U \in \mathbb { R } ^ { P \times C }$ and right singular vectors $V \in$ $\mathbb { R } ^ { C \times C }$ . For any matrix $\boldsymbol { Z } \in \mathbb { R } ^ { P \times C }$ , define the transformation $Z \to U ^ { \top } Z { \bar { V } }$ as the transformation into aligned-SNR coordinates.
+
+The aligned-SNR coordinates is so-named because it diagonalizes i.e. aligns the SNR matrix: Definition 4 (Aligned SNR Matrix). Consider the SVD decomposition of the SNR from Definition 2. Combined with Equation 8, observe that
+
+$$
+\boldsymbol { \Omega } = \mathrm { d i a g } \left( \left\{ \omega _ { c } \right\} _ { c = 1 } ^ { C - 1 } , 0 \right) = \boldsymbol { U } ^ { \top } \boldsymbol { \Sigma } _ { W } ^ { - \frac { 1 } { 2 } } \overline { { \boldsymbol { M } } } \boldsymbol { V }
+$$
+
+We call $\pmb { \Omega }$ the aligned SNR matrix.
+
+The following facts about the aligned SNR matrix becomes useful later in our derivations:
+
+Observation 1 (SVD of Aligned SNR Matrix). The SVD of the aligned SNR matrix itself is simply
+
+$$
+\Omega = \sum _ { j = 1 } ^ { C - 1 } \omega _ { j } \pmb { e } _ { j } \pmb { e } _ { j } ^ { \top } ,
+$$
+
+with the canonical basis $\{ e _ { j } \} _ { j = 1 } ^ { C }$ as its singular vectors.
+
+As discussed in Section 3.2, the $\{ \omega _ { c } \} _ { c = 1 } ^ { C - 1 }$ that comprise $\pmb { \Omega }$ are decisive for understanding separation performance. In fact, when $\lambda { = } 0$ , the MSE loss can be entirely characterized by the SNR singular values on the central path:
+
+Lemma 1 (Spectral Representation of MSE Loss). When $\lambda = 0$ , MSE loss obeys
+
+$$
+\mathcal { L } ( W _ { L S } ( \overline { { H } } ) , \overline { { H } } ) = \mathcal { L } _ { L S } ( W _ { L S } ( \overline { { H } } ) , \overline { { H } } ) = \frac { 1 } { 2 } \sum _ { j = 1 } ^ { C - 1 } \frac { 1 } { \omega _ { j } ^ { 2 } + C } = \mathcal { L } \left( \{ \omega _ { j } \} _ { j = 1 } ^ { C - 1 } \right) ,
+$$
+
+on the central path, and its decomposition obeys
+
+$$
+\begin{array} { l } { { \displaystyle \mathcal { L } _ { N C I } ( \overline { { { H } } } ) = \frac 1 2 \sum _ { j = 1 } ^ { C - 1 } \frac { \omega _ { j } ^ { 2 } } { ( C + \omega _ { j } ^ { 2 } ) ^ { 2 } } = \mathcal { L } _ { N C I } \left( \{ \omega _ { j } \} _ { j = 1 } ^ { C - 1 } \right) } } \\ { { \displaystyle \mathcal { L } _ { N C 2 / 3 } ( \overline { { { H } } } ) = \frac 1 2 \sum _ { j = 1 } ^ { C - 1 } \frac { 1 } { C } \left( \frac { \omega _ { j } ^ { 2 } } { \omega _ { j } ^ { 2 } + C } - 1 \right) ^ { 2 } = \mathcal { L } _ { N C 2 / 3 } \left( \{ \omega _ { j } \} _ { j = 1 } ^ { C - 1 } \right) . } } \end{array}
+$$
+
+Proof. Using Equation 16, Equation 17, and Equation 18, the loss on the central path equals
+
+$$
+\mathcal { L } ( W _ { \mathrm { L S } } , \overline { { { M } } } ) = \frac { 1 } { 2 C } \Vert C ^ { - 1 } \overline { { { M } } } ^ { \top } \Sigma _ { T } ^ { - 1 } \overline { { { M } } } - \Phi \Vert _ { F } ^ { 2 } + \frac { 1 } { 2 } \operatorname { t r } \big \{ C ^ { - 1 } \overline { { { M } } } ^ { \top } \Sigma _ { T } ^ { - 1 } \Sigma _ { W } \Sigma _ { T } ^ { - 1 } \overline { { { M } } } C ^ { - 1 } \big \} .
+$$
+
+Observe $\overline { { M } } ^ { \top } \Sigma _ { T } ^ { - 1 } \overline { { M } }$ and $\Phi$ are simultaneously diagonalizable since they share the same $[ 1 , \ldots , 1 ] ^ { \top }$ null space and $\Phi$ has $C - 1$ equal eigenvalues. Also, observe that
+
+$$
+\Sigma _ { T } = \Sigma _ { W } + \frac { 1 } { C } \overline { { { M } } } \overline { { { M } } } ^ { T } .
+$$
+
+Let $\widehat { \Omega }$ be submatrix of the aligned-SNR matrix $\pmb { \Omega }$ corresponding to the non-zero singular values i.e. $\widehat { \Omega } = \mathrm { d i a g } \left( \{ \omega _ { j } \} _ { c = 1 } ^ { C - 1 } \right)$ . After taking simultaneous-diagonalizations and canceling partial orthogonal matrices, Equation 19 can be written solely in terms of $\widehat { \Omega }$ :
+
+$$
+\mathcal { L } ( \widehat { \Omega } ) = \frac { 1 } { 2 C } \left\| \widehat { \Omega } ^ { \top } \left( \widehat { \Omega } \widehat { \Omega } ^ { \top } + C I _ { C - 1 } \right) ^ { - 1 } \widehat { \Omega } - I _ { C - 1 } \right\| _ { F } ^ { 2 } + \frac { 1 } { 2 } \operatorname { t r } \Big \{ \widehat { \Omega } ^ { \top } ( \widehat { \Omega } \widehat { \Omega } ^ { \top } + C I _ { C - 1 } ) ^ { - 2 } \widehat { \Omega } \Big \} .
+$$
+
+This can be further simplified into
+
+$$
+\begin{array} { l } { \displaystyle \mathcal { L } ( \{ \omega _ { j } \} _ { c = 1 } ^ { C - 1 } \} ) = \frac { 1 } { 2 } \sum _ { j = 1 } ^ { C - 1 } \frac { 1 } { C } \left( \frac { \omega _ { j } ^ { 2 } } { \omega _ { j } ^ { 2 } + C } - 1 \right) ^ { 2 } + \frac { \omega _ { j } ^ { 2 } } { ( C + \omega _ { j } ^ { 2 } ) ^ { 2 } } } \\ { \displaystyle \quad = \frac { 1 } { 2 } \sum _ { j = 1 } ^ { C - 1 } \frac { 1 } { \omega _ { j } ^ { 2 } + C } . } \end{array}
+$$
+
+This completes the proof for Lemma 1.
+
+Thus, the aligned SNR matrix, U ⊤Σ− 12W MĎSNR matrix to a diagonal matrix (Definiti , maximally simplifies analysis by reducing the vanilla on 4) whose entries determine the MSE loss (Lemma 1).
+
+We introduce the alignment of features into their own notion of aligned SNR coordinates:
+
+Definition 5 (Renormalization to aligned SNR Coordinates). Consider $\overline { { \pmb { H } } } ~ \in ~ \mathbb { R } ^ { P \times C N }$ with corresponding SNR left and right singular vectors $U$ and $V$ (Definition 2). Then, define the SNRaligned renormalization of the features as
+
+$$
+\begin{array} { r } { \pmb { X } = \pmb { U } ^ { \top } \left( \pmb { \Sigma } _ { W } \right) ^ { - \frac { 1 } { 2 } } \pmb { \overline { { H } } } ( \pmb { V } \otimes \pmb { I } _ { N } ) = \pmb { U } ^ { \top } \left( \pmb { \overline { { H } } } \pmb { C } \pmb { \overline { { H } } } ^ { \top } \right) ^ { - \frac { 1 } { 2 } } \pmb { \overline { { H } } } ( \pmb { V } \otimes \pmb { I } _ { N } ) \in \mathbb { R } ^ { C \times N C } , } \end{array}
+$$
+
+where $\otimes$ is the Kronecker product and $C$ is a class-centering matrix defined as
+
+$$
+\pmb { C } = \frac { 1 } { C N } \left( \pmb { I } _ { C N } - \frac { 1 } { N } \pmb { Y } ^ { \top } \pmb { Y } \right) .
+$$
+
+As discussed in Section 3.1, the transformation $\overline { { { \pmb { H } } } } \pmb { \Sigma } _ { W } ^ { - \frac { 1 } { 2 } } \overline { { { \pmb { H } } } }$ does not change the predictions of the least squares classifier. Hence, it does not change the MSE loss. It is easy to check that this still holds for $\boldsymbol { X }$ i.e. invariance is preserved by the change into SNR-aligned coordinates.
+
+It is also easy to check that the sphericity of the within-class covariance is preserved as well:
+
+Observation 2 (Sphericity of Within-Class Covariance of SNR Coordinates).
+
+$$
+X C X ^ { \top } = I _ { C }
+$$
+
+Finally, routine applications of Definitions and canceling out of (partial) orthogonal matrix multiplications in aligned SNR coordinates lead to the following simplified representation for $\pmb { \Omega }$ and its differential:
+
+Observation 3 (Relation Between SNR Coordinates and SNR Matrix). The aligned SNR matrix, $\pmb { \Omega }$ (Definition 4) can be expressed as a function of the features in aligned SNR-coordinates $\boldsymbol { X }$ (Definition 5) as simply
+
+$$
+\Omega ( X ) = \frac { 1 } { N } X Y ^ { \top } .
+$$
+
+Moreover, let $\mathrm { d } \Omega _ { i j } ( \cdot ) : T _ { X } \mathcal { X } \mathbb { R }$ be the differential $I$ -form19 associated with the $i j$ -th entry of $\pmb { \Omega } .$ . Define $\mathrm { d } \Omega ( \cdot ) : T _ { X } \mathcal { X } \mathbb { R } ^ { C \times C }$ such that, for some $Z \in T _ { X } \mathcal { X }$ , each entry matrix of the matrix $\mathrm { d } \Omega \left( Z \right)$ is $\mathrm { d } \Omega _ { i , j } \left( Z \right)$ . Then, it follows that
+
+$$
+\mathrm { d } \Omega \left( Z \right) = \frac { 1 } { N } Z Y ^ { \top } , \quad \forall Z \in T _ { \mathbf { X } } \mathcal { X } .
+$$
+
+From a geometric perspective, the transformation in Definition 5 maps the features, $\pmb { H }$ , to $\boldsymbol { X }$ belonging to a Normalized Features Manifold:
+
+# Definition 6 (Normalized Features Manifold).
+
+$$
+\mathcal { X } = \{ \boldsymbol { X } \in \mathbb { R } ^ { C \times C N } \mid \boldsymbol { X } C \boldsymbol { X } ^ { \top } = \boldsymbol { I _ { C } } \}
+$$
+
+To understand the dynamics of the singular values of $\pmb { \Omega }$ —which is connected to the dynamics of the features through Lemma 1—we will analyze the gradient flow on this manifold. To this end, we first identify its tangent space at a particular $\boldsymbol { X }$ as well as the projection operator onto that tangent space.
+
+Proposition 3 (Tangent Space of Normalized Features Manifold).
+
+$$
+T _ { \mathbf { X } } \mathcal { X } = \{ Z \in \mathbb { R } ^ { C \times C N } \mid X C Z ^ { \top } + Z C X = \mathbf { 0 } \}
+$$
+
+Proposition 4 (Projection Onto Tangent Space of Normalized Features Manifold).
+
+$$
+\Pi _ { T \bf { x } } \chi ( Z ) = Z - \frac { 1 } { 2 } ( X C Z ^ { \top } + Z C X ^ { \top } ) X
+$$
+
+# D.3 CONTINUALLY RENORMALIZED GRADIENT FLOW
+
+In fact, gradient flow on the normalized features manifold (Definition 6) is the continuous analogue of the intuitive, discrete algorithm in Subsection D.1. In particular, the intuitive algorithm consists of a gradient step, $\overline { { { \pmb { H } } } } _ { 1 } = \bar { \pmb { X } } _ { 0 } + \Delta { \pmb { X } } _ { 0 }$ followed by a mapping to the base space of the fiber bundle, $\pmb { X } _ { 1 } \overset { \cdot } { = } \pmb { \Sigma } ( \overline { { \pmb { H } } } _ { 1 } ) ^ { - \frac { 1 } { 2 } } \overline { { \pmb { H } } } _ { 1 }$ . For small $\Delta X _ { 0 }$ , these two steps are in fact equivalent (up to a negligible term) to taking a $T _ { X } \mathcal { X }$ -projected gradient step on the manifold $\mathcal { X }$ as proven below:
+
+Lemma 2. Assuming $\boldsymbol { X } _ { 0 } \in \mathcal { X }$ , a renormalized gradient step,
+
+$$
+\begin{array} { r } { \pmb { X } _ { 1 } = \pmb { \Sigma } _ { W } ^ { - \frac { 1 } { 2 } } ( \overline { { \pmb { H } } } _ { 1 } ) \overline { { \pmb { H } } } _ { 1 } = \pmb { \Sigma } _ { W } ^ { - \frac { 1 } { 2 } } ( \pmb { X } _ { 0 } + \Delta \pmb { X } _ { 0 } ) \cdot ( \pmb { X } _ { 0 } + \Delta \pmb { X } _ { 0 } ) , } \end{array}
+$$
+
+is equivalent, up to an $O \left( { \left\| \Delta { { X } _ { 0 } } \right\| ^ { 2 } } \right)$ term, to a $T _ { X } \mathcal { X }$ -projected gradient step, i.e.
+
+$$
+\begin{array} { r } { \pmb { X } _ { 1 } = \pmb { X } _ { 0 } + \Pi _ { T _ { \pmb { X } } } \pmb { \chi } ( \Delta \pmb { X } _ { 0 } ) + O \left( \left. \Delta \pmb { X } _ { 0 } \right. ^ { 2 } \right) . } \end{array}
+$$
+
+Proof. Notice that
+
+$$
+\begin{array} { r l } & { X _ { 1 } = \Sigma _ { W } ^ { - \frac { 1 } { 2 } } ( \overline { H } _ { 1 } ) \overline { H } _ { 1 } } \\ & { \quad = \left( ( X _ { 0 } + \Delta X _ { 0 } ) C ( X _ { 0 } + \Delta X _ { 0 } ) ^ { \top } \right) ^ { - \frac { 1 } { 2 } } \left( X _ { 0 } + \Delta X _ { 0 } \right) } \\ & { \quad = \left( I + \Delta X _ { 0 } C X _ { 0 } ^ { \top } + X _ { 0 } C \Delta X _ { 0 } ^ { \top } + \Delta X _ { 0 } C \Delta X _ { 0 } ^ { T } \right) ^ { - \frac { 1 } { 2 } } ( X _ { 0 } + \Delta X _ { 0 } ) , } \end{array}
+$$
+
+where in the last step we used our assumption that $\boldsymbol { X } _ { 0 } \in \mathcal { X }$ , i.e., $X _ { 0 } C X _ { 0 } = I$ . By Taylor’s Theorem,
+
+$$
+( { \cal I } + { \cal A } ) ^ { - \frac { 1 } { 2 } } = { \cal I } - \frac { 1 } { 2 } { \cal A } + O ( \| { \cal A } \| ^ { 2 } ) .
+$$
+
+Therefore, we get
+
+$$
+\begin{array} { l } { { \displaystyle { \cal X } _ { 1 } = \left( I - \frac 1 2 \left( \Delta X _ { 0 } C X _ { 0 } ^ { \top } + X _ { 0 } C \Delta { \bf X } _ { 0 } ^ { \top } + \Delta { \bf X } _ { 0 } C \Delta { \bf X } _ { 0 } ^ { T } \right) + { \cal O } \left( \| \Delta { \bf X } _ { 0 } \| ^ { 2 } \right) \right) \left( X _ { 0 } + \Delta { \bf X } _ { 0 } \right) } } \\ { ~ } \\ { { \displaystyle ~ = { \cal X } _ { 0 } + \Delta { \bf X } _ { 0 } - \frac 1 2 \left( \Delta X _ { 0 } C X _ { 0 } ^ { \top } - X _ { 0 } C \Delta { \bf X } _ { 0 } ^ { \top } \right) X _ { 0 } + { \cal O } \left( \| \Delta { \bf X } _ { 0 } \| ^ { 2 } \right) } } \\ { { \displaystyle ~ = { \bf X } _ { 0 } + \Pi _ { T _ { \bf X } } \alpha ( \Delta { \bf X } _ { 0 } ) + { \cal O } \left( \| \Delta { \bf X } _ { 0 } \| ^ { 2 } \right) , } } \end{array}
+$$
+
+where the last step follows from Proposition 4.
+
+As we transition from a discrete gradient descent to a continuous gradient flow, the step size $\eta 0$ , and the residual $O \left( { \| \Delta \bar { X _ { 0 } } \| ^ { 2 } } \right)$ in the above lemma becomes negligible, since $\Delta X _ { 0 } =$ $- \eta \nabla _ { X } \mathcal { L } _ { \mathrm { L S } } ( X _ { 0 } )$ . This motivates us to study, in the next section, the continually renormalized gradient flow (as defined in Equation 5 of the main text) of $\boldsymbol { X }$ on $\mathcal { X }$ :
+
+$$
+\frac { \mathrm { d } } { \mathrm { d } t } \pmb { X } = - \Pi _ { T \pmb { x } } \pmb { \chi } \left( \nabla \pmb { x } \mathcal { L } _ { \mathrm { L S } } ( \pmb { X } ) \right) .
+$$
+
+D.4 PROOF OF PROPOSITION 2 (GRADIENT FLOW IN ALIGNED SNR COORDINATES)
+
+To prove Proposition 2, we first set up some auxiliary notation and lemmas. Denote the $j$ -th row (transposed) of $\boldsymbol { X }$ and $\mathbf { Y }$ , respectively, by
+
+$$
+\pmb { x } _ { j } = \pmb { X } ^ { \top } \pmb { e } _ { j }
+$$
+
+and
+
+$$
+\begin{array} { r } { \boldsymbol { y } _ { j } = \boldsymbol { Y } ^ { \top } \boldsymbol { e } _ { j } . } \end{array}
+$$
+
+Recall that—when differentiating SVDs—the derivative of the $j$ -th singular value, $\omega _ { j }$ , only depends on the $j$ -th singular subspace (see Equation 17 of Townsend (2016)). As a consequence, we will see in the following lemma that, for any differential $\mathrm { d } X$ , the corresponding $\mathrm { d } \omega _ { j }$ only depends on $\mathrm { d } \pmb { x } _ { j }$ .
+
+Lemma 3 (Derivative of Singular Values With Respect to SNR Coordinates). Given the differential $I$ -form $\mathrm { d } \omega _ { j } ( \cdot ) : T _ { X } \mathcal { X } \mathbb { R } ,$ , the following holds for all19 $\mathrm { d } X \in \mathbb { R } ^ { C \times C N }$ :
+
+$$
+\mathrm { d } \omega _ { j } \left( \Pi _ { T _ { X } \mathcal { X } } ( \mathrm { d } X ) \right) = \left( \frac { 1 } { N } \pmb { y } _ { j } ^ { \top } - \omega _ { j } \pmb { x } _ { j } ^ { \top } C \right) \mathrm { d } \pmb { x } _ { j } , \quad \forall j = 1 , \ldots , C .
+$$
+
+where (consistent with Definition 2) we adopt the convention that $\omega _ { C } = 0$ is the $C$ -th singular value of the SNR matrix.
+
+Proof. Without loss of generality, assume that $\boldsymbol { X }$ is represented in aligned SNR coordinates (Section D.2). Using Observation 1 and the differential of the singular value decomposition (see Equation 17 of Townsend (2016)):
+
+$$
+\mathrm { d } \omega _ { j } \left( \Pi _ { T _ { \mathbf { X } } \mathcal { X } } ( \mathrm { d } X ) \right) = e _ { j } ^ { \top } \mathrm { d } \Omega \left( \Pi _ { T _ { \mathbf { X } } \mathcal { X } } ( \mathrm { d } X ) \right) e _ { j } ,
+$$
+
+where $\mathrm { d } \Omega \left( \cdot \right)$ is defined as in Observation 3. Next, Observation 3 implies
+
+$$
+\mathrm { d } \Omega \left( \Pi _ { T _ { \mathbf { X } } } \chi ( \mathrm { d } X ) \right) = \frac { 1 } { N } \Pi _ { T _ { \mathbf { X } } } \chi ( \mathrm { d } X ) \mathbf { Y } ^ { \top } .
+$$
+
+Using the projection onto the tangent space, given in Proposition 4 above,
+
+$$
+\Pi _ { T \mathbf { \boldsymbol { x } } \mathbf { \boldsymbol { x } } } ( \mathrm { d } \mathbf { \boldsymbol { X } } ) = \mathrm { d } \mathbf { \boldsymbol { X } } - \frac { 1 } { 2 } ( \mathrm { d } \mathbf { \boldsymbol { X } } \mathbf { \boldsymbol { C } } \mathbf { \boldsymbol { X } } ^ { \top } + \mathbf { \boldsymbol { X } } \mathbf { \boldsymbol { C } } \mathrm { d } \mathbf { \boldsymbol { X } } ^ { \top } ) \mathbf { \boldsymbol { X } } .
+$$
+
+Combining Equation 23, Equation 24, and Equation 25, we obtain:
+
+$$
+\begin{array} { r l } & { \mathrm { d } \omega _ { j } \left( \Pi _ { T _ { X } \mathcal { X } } ( \mathrm { d } X ) \right) = e _ { j } ^ { \top } \mathrm { d } \Omega \left( \Pi _ { T _ { X } \mathcal { X } } ( \mathrm { d } X ) \right) e _ { j } } \\ & { \quad \quad \quad \quad = \cfrac { 1 } { N } e _ { j } ^ { \top } \Pi _ { T _ { X } \mathcal { X } } ( \mathrm { d } X ) Y ^ { \top } e _ { j } } \\ & { \quad \quad \quad \quad = \cfrac { 1 } { N } e _ { j } ^ { \top } \left( \mathrm { d } X - \cfrac { 1 } { 2 } \left( \mathrm { d } X C X ^ { \top } + X C \mathrm { d } X ^ { \top } \right) X \right) Y ^ { \top } e _ { j } . } \end{array}
+$$
+
+Moreover, using Observation 1 and 3, we can simplify these expressions into
+
+$$
+\begin{array} { r l } & { \qquad \displaystyle \frac { 1 } { N } e _ { j } ^ { \top } \mathrm { d } X Y ^ { \top } e _ { j } = \frac { 1 } { N } { \pmb y } _ { j } ^ { \top } \mathrm { d } { \pmb x } _ { j } } \\ & { \qquad \displaystyle \frac { 1 } { N } e _ { j } ^ { \top } \mathrm { d } X C X ^ { \top } X { \pmb Y } ^ { \top } e _ { j } = \omega _ { j } e _ { j } ^ { \top } \mathrm { d } X C X ^ { \top } e _ { j } = \omega _ { j } { \pmb x } _ { j } ^ { \top } C \mathrm { d } { \pmb x } _ { j } } \\ & { \qquad \displaystyle \frac { 1 } { N } e _ { j } ^ { \top } X C \mathrm { d } X ^ { \top } X { \pmb Y } ^ { \top } e _ { j } = \omega _ { j } e _ { j } ^ { \top } X C \mathrm { d } X ^ { \top } e _ { j } = \omega _ { j } { \pmb x } _ { j } ^ { \top } C \mathrm { d } { \pmb x } _ { j } . } \end{array}
+$$
+
+Finally, substituting the above three expressions into Equation 26, we get:
+
+$$
+\mathrm { d } \omega _ { j } \left( \Pi _ { T _ { \mathbf { X } } } \chi ( \mathrm { d } X ) \right) = \left( \frac { 1 } { N } \pmb { y } _ { j } ^ { \top } - \omega _ { j } \pmb { x } _ { j } ^ { \top } \pmb { C } \right) \mathrm { d } \pmb { x } _ { j } ,
+$$
+
+which proves the claim.
+
+Using Lemma 3, we can now obtain the dynamics of $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { j } }$ under gradient flow:
+
+Lemma 4. Under continually renormalized gradient flow (Equation 5),
+
+$$
+\frac { \mathrm { d } } { \mathrm { d } t } { \pmb x } _ { j } = \frac { \omega _ { j } } { ( C + \omega _ { j } ^ { 2 } ) ^ { 2 } } \left( \frac { 1 } { N } { \pmb y } _ { j } - \omega _ { j } C { \pmb x } _ { j } \right) , \quad \forall j = 1 , \ldots , C ,
+$$
+
+where (consistent with Definition 2) we adopt the convention that $\omega _ { C } = 0$ is the $C$ -th singular value of the SNR matrix.
+
+Proof. Recall $\pmb { x } _ { j } \in \mathbb { R } ^ { C N }$ is the $j$ -th row of $\pmb { X } \in \mathbb { R } ^ { C \times C N }$ , which we assume to be in aligned SNR coordinates without loss of generality (Section D.2). Applying the flow definition in Equation 5 to the $i$ -th element of $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { j } }$ gives
+
+$$
+\begin{array} { r l } & { \frac { \mathrm { d } } { \mathrm { d } t } x _ { j i } = - e _ { j } ^ { \top } \Pi _ { T x } x \left( \frac { \mathrm { d } \mathcal { L } _ { \mathrm { L S } } } { \mathrm { d } X } \right) e _ { i } } \\ & { \quad \quad \quad = - \left. \Pi _ { T x } x \left( \frac { \mathrm { d } \mathcal { L } _ { \mathrm { L S } } } { \mathrm { d } X } \right) , e _ { j } e _ { i } ^ { \top } \right. _ { F } } \\ & { \quad \quad \quad = - \left. \frac { \mathrm { d } \mathcal { L } _ { \mathrm { L S } } } { \mathrm { d } X } , \Pi _ { T x } x \big ( e _ { j } e _ { i } ^ { \top } \big ) \right. _ { F } , } \end{array}
+$$
+
+where $\frac { \mathrm { d } \mathcal { L } _ { \mathrm { L S } } } { \mathrm { d } X } \in \mathbb { R } ^ { C \times C N }$ is the standard derivative within the ambient $\mathbb { R } ^ { C \times C N }$ -space, $e _ { i } \in \mathbb { R } ^ { C N }$ and $\boldsymbol { e } _ { j } \in \mathbb { R } ^ { \bar { \boldsymbol { C } } }$ are the canonical basis vectors, and $\langle \cdot , \cdot \rangle _ { F }$ is the Frobenius matrix inner-product. Next, observe that the differential 1-form $\mathrm { d } \mathcal { L } _ { \mathrm { L S } } ( \cdot ) : \dot { T } _ { X } \dot { \mathcal { X } } \mathbb { R }$ satisfies the following:
+
+$$
+\mathrm { d } { \mathcal { L } } _ { \mathrm { L S } } \left( Z \right) = \left. \frac { \mathrm { d } { \mathcal { L } } _ { \mathrm { L S } } } { \mathrm { d } X } , Z \right. _ { F } , \quad \forall Z \in T _ { X } \mathcal { X } .
+$$
+
+Taking $\pmb { Z } = \Pi _ { T \pmb { x } } \pmb { \chi } \big ( \pmb { e } _ { j } \pmb { e } _ { i } ^ { \top } \big )$ then leads to
+
+$$
+\begin{array} { r l } & { \displaystyle \frac { \mathrm { d } } { \mathrm { d } t } x _ { j i } = - \mathrm { d } \mathcal { L } _ { \mathrm { L S } } \left( \Pi _ { T _ { X } } \boldsymbol { x } \big ( e _ { j } e _ { i } ^ { \top } \big ) \right) } \\ & { \quad \quad \quad = - \displaystyle \sum _ { k = 1 } ^ { C - 1 } \frac { \mathrm { d } \mathcal { L } _ { \mathrm { L S } } } { \mathrm { d } \omega _ { k } } \mathrm { d } \omega _ { k } \left( \Pi _ { T _ { X } } \boldsymbol { x } \big ( e _ { j } e _ { i } ^ { \top } \big ) \right) } \\ & { \quad \quad \quad = - \displaystyle \frac { \mathrm { d } \mathcal { L } _ { \mathrm { L S } } } { \mathrm { d } \omega _ { j } } \mathrm { d } \omega _ { j } \left( \Pi _ { T _ { X } } \boldsymbol { x } \big ( e _ { j } e _ { i } ^ { \top } \big ) \right) } \end{array}
+$$
+
+where the second step follows by the chain rule, and the last step follows from Lemma 3 in that $\mathrm { d } \omega _ { k } \left( \Pi _ { T _ { \mathbf { X } } \mathcal { X } } \big ( e _ { j } \pmb { e } _ { i } ^ { \top } \big ) \right) \dot { = } 0$ if $k \neq j$ . Moreover, Lemma 3 also gives
+
+$$
+\mathrm { d } \omega _ { j } \left( \Pi _ { T _ { \mathbf { X } } } \boldsymbol { x } \big ( e _ { j } e _ { i } ^ { \top } \big ) \right) = \left( \frac { 1 } { N } \pmb { y } _ { j } ^ { \top } - \omega _ { j } \pmb { x } _ { j } ^ { \top } \boldsymbol { C } \right) \boldsymbol { e } _ { i } .
+$$
+
+It then follows that
+
+$$
+\begin{array} { r l } & { \displaystyle \frac { \mathrm { d } } { \mathrm { d } t } \pmb { x } _ { j } = - \frac { \mathrm { d } \mathcal { L } _ { \mathrm { L S } } } { \mathrm { d } \omega _ { j } } \left( \frac { 1 } { N } \pmb { y } _ { j } - \omega _ { j } \pmb { C } \pmb { x } _ { j } \right) } \\ & { \quad \quad \quad = \frac { \omega _ { j } } { ( C + \omega _ { j } ^ { 2 } ) ^ { 2 } } \left( \frac { 1 } { N } \pmb { y } _ { j } - \omega _ { j } \pmb { C } \pmb { x } _ { j } \right) , } \end{array}
+$$
+
+where the last step follows from differentiating the expression in Lemma 1.
+
+The gradient flows of $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { j } }$ induce the dynamics of $\omega _ { j }$ , which are described below.
+
+Lemma 5 (Induced Dynamics on SVD of SNR). Under continually renormalized gradient flow (Equation 5), the dynamics for the $j$ -th non-zero SNR singular value (Definition 2) is
+
+$$
+\frac { \mathrm { d } } { \mathrm { d } t } \omega _ { j } = \frac { 1 } { N } \frac { \omega _ { j } } { ( C + \omega _ { j } ^ { 2 } ) ^ { 2 } } , \quad \forall j = 1 , \dots , C - 1 .
+$$
+
+Proof. Without loss of generality, assume $\boldsymbol { X }$ is represented in aligned SNR coordinates (Section D.2). Observation 1, the differential of the singular value decomposition (see Equation 17 of Townsend (2016)), and Observation 3 collectively imply that for any2 $\mathbf { \bar { \Psi } } \mathrm { d } \mathbf { X } \in T _ { X } \mathcal { X }$ ,
+
+$$
+\mathrm { d } \omega _ { j } \left( \mathrm { d } \boldsymbol { X } \right) = e _ { j } ^ { \top } \mathrm { d } \Omega \left( \mathrm { d } \boldsymbol { X } \right) e _ { j } = \frac { 1 } { N } e _ { j } ^ { \top } \mathrm { d } \boldsymbol { X } \boldsymbol { Y } ^ { \top } \boldsymbol { e } _ { j } = \frac { 1 } { N } \boldsymbol { y } _ { j } ^ { \top } \mathrm { d } \boldsymbol { x } _ { j } .
+$$
+
+Recall that the differential of $\omega _ { j }$ only depends on the differential of $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { j } }$ (see Lemma 3). Then, we can apply the chain rule:
+
+$$
+\frac { \mathrm { d } } { \mathrm { d } t } \omega _ { j } = \frac { \mathrm { d } \omega _ { j } } { \mathrm { d } x _ { j } } \frac { \mathrm { d } { \pmb x } _ { j } } { \mathrm { d } t } = \frac { 1 } { N } \frac { \omega _ { j } } { ( C + \omega _ { j } ^ { 2 } ) ^ { 2 } } { \pmb y } _ { j } ^ { \top } \left( \frac { 1 } { N } { \pmb y } _ { j } - \omega _ { j } C { \pmb x } _ { j } \right) ,
+$$
+
+where the last equality results substituting-in Lemma 4 and Equation 28. Since $\boldsymbol { Y } \boldsymbol { Y } ^ { \intercal } = N \boldsymbol { I }$
+
+$$
+{ \frac { 1 } { N ^ { 2 } } } { \pmb y } _ { j } ^ { \top } { \pmb y } _ { j } = { \frac { 1 } { N } } .
+$$
+
+Applying the same relation and Equation 21:
+
+$$
+\boldsymbol { x } _ { j } ^ { \top } \boldsymbol { C } \boldsymbol { y } _ { j } = e _ { j } ^ { \top } \boldsymbol { X } \boldsymbol { C } \boldsymbol { Y } ^ { \top } \boldsymbol { e } _ { j } = \frac { 1 } { \boldsymbol { C } N } e _ { j } ^ { \top } \boldsymbol { X } \left( \boldsymbol { I } - \frac { 1 } { N } \boldsymbol { Y } ^ { \top } \boldsymbol { Y } \right) \boldsymbol { Y } ^ { \top } \boldsymbol { e } _ { j } = 0 .
+$$
+
+Combining all the above equations, we obtain
+
+$$
+\frac { \mathrm { d } } { \mathrm { d } t } \omega _ { j } = \frac { 1 } { N } \frac { \omega _ { j } } { ( C + \omega _ { j } ^ { 2 } ) ^ { 2 } } .
+$$
+
+The closed-form given in Proposition 2 now directly follows.
+
+Proposition 2 (Dynamics of Singular Values of SNR Matrix). Continually renormalized gradient flow on the central path (Equation 5) induces the following closed-form dynamics on the SNR singular values (Definition 2):
+
+$$
+c _ { 1 } \log ( \omega _ { j } ( t ) ) + c _ { 2 } \omega _ { j } ^ { 2 } ( t ) + c _ { 3 } \omega _ { j } ^ { 4 } ( t ) = a _ { j } + t , \quad t \geq 0 , \quad f o r a l l j = 1 , \ldots , C - 1 .
+$$
+
+$c _ { 1 } , \ : c _ { 2 }$ , and $c _ { 3 }$ are positive constants independent of $j$ , and $a _ { j }$ is a constant depending on $\omega _ { j } ( 0 )$ .
+
+Proof. Follows from symbolically solving the ODE in Lemma 5 with routine methods. The constants are ${ \dot { c } } _ { 1 } = C ^ { 2 } N$ , $c _ { 2 } = C N$ , and $\begin{array} { r } { c _ { 3 } = \frac { N } { 4 } } \end{array}$ . □
+
+# D.5 PROOF OF COROLLARY 1
+
+Corollary 1 (Properties of SNR Singular Values). SNR singular values (Definition 2) following the Equation 9 dynamics satisfy the following limiting behaviors:
+
+$$
+\begin{array} { r l } & { 1 . \ \operatorname* { l i m } _ { t \to \infty } \omega _ { j } ( t ) = \infty \quad a n d \quad \ \operatorname* { l i m } _ { t \to \infty } \frac { \omega _ { j } ( t ) } { \sqrt [ 4 ] { t / c _ { 3 } } } = 1 , \quad f o r a l l \ j = 1 , \ldots , C - 1 . } \\ & { } \\ & { 2 . \ \operatorname* { l i m } _ { t \to \infty } \frac { \operatorname* { m a x } _ { j } \omega _ { j } ( t ) } { \operatorname* { m i n } _ { j } \omega _ { j } ( t ) } = 1 . } \end{array}
+$$
+
+Proof. As $t$ tends to infinity, the right-hand side of Equation 9 diverges to infinity and therefore so does the left-hand side (LHS). As the LHS approaches infinity, the logarithmic terms become negligible compared to the dominant quartic term, implying $\omega _ { j } ^ { 4 } ( t ) \bar { \infty }$ . Since $\omega _ { j } ( t )$ are singular values, they must be non-negative—implying $\omega _ { j } ( t ) \to { \dot { \infty } }$ . Based on the same argument, observe that limt→∞ $\begin{array} { r } { \operatorname* { l i m } _ { t \infty } \frac { \omega _ { j } ( t ) } { \sqrt [ 4 ] { \frac { t } { c _ { 3 } } } } = 1 } \end{array}$ for all $j$ . Since the constant $c _ { 3 }$ is independent of $j$ , it follows that $\begin{array} { r } { \operatorname* { l i m } _ { t \infty } \frac { \operatorname* { m a x } _ { j } \omega _ { j } ( t ) } { \operatorname* { m i n } _ { j } \omega _ { j } ( t ) } = 1 } \end{array}$ .
+
+# D.6 PROOF OF COROLLARY 2
+
+Lemma 6. Under continually renormalized gradient flow (Equation 5), the left and right singular vectors of the SNR matrix remain constant i.e. they are independent of t.
+
+Proof. Without loss of generality, assume $\boldsymbol { X }$ is in represented in aligned SNR coordinates (Section D.2). Recall that, in this coordinate system, the corresponding SNR matrix $\Omega = N ^ { - 1 } \dot { X } Y ^ { \top }$ is diagonal, and the left and right singular vectors are simply partial identity matrices.
+
+To show that the singular values of the SNR remain constant, it then suffices to show that $\scriptstyle { \frac { \mathrm { d } \Omega } { \mathrm { d } t } } = { \frac { \mathrm { d } X } { \mathrm { d } t } } Y$ is a diagonal matrix as well21. Lemma 4 gives
+
+$$
+\frac { \mathrm { d } } { \mathrm { d } t } X = \frac { 1 } { N } D _ { 1 } Y - D _ { 2 } X C
+$$
+
+where $D _ { 1 }$ and $D _ { 2 }$ are $C { \times } C$ diagonal matrices with the diagonal entries $\left\{ \frac { \omega _ { j } } { ( C + \omega _ { j } ^ { 2 } ) ^ { 2 } } \right\} _ { c = 1 } ^ { C }$ and $\left\{ \frac { \omega _ { j } ^ { 2 } } { ( C + \omega _ { j } ^ { 2 } ) ^ { 2 } } \right\} _ { c = 1 } ^ { C }$ , respectively. Then,
+
+$$
+{ \frac { \mathrm { d } } { \mathrm { d } t } } \Omega = \left( { \frac { \mathrm { d } } { \mathrm { d } t } } X \right) Y ^ { \top } = { \frac { 1 } { N } } D _ { 1 } Y Y ^ { \top } - D _ { 2 } X C Y ^ { \top } = D _ { 1 } ,
+$$
+
+where, in the last equality, we used the easy-to-check identities that $\boldsymbol { Y } \boldsymbol { Y } ^ { \intercal } = \boldsymbol { N } \boldsymbol { I } _ { \boldsymbol { C } }$ and $C Y { = } \mathbf { 0 }$ . In more detail, the first identity follows from the fact that $\mathbf { Y }$ is the one-hot label vectors stacked as columns; the second identity follows from the facts that $C$ is the class-centering matrix, and the one-hot label is the same for examples from the same class. Thus, we have shown dΩdt is diagonal, which concludes our proof. □
+
+Lemma 7. A matrix $\pmb { { \cal E } } \in \mathbb { R } ^ { P \times C }$ is a Simplex ETF if and only if
+
+1. $\pmb { \cal E }$ has exactly $C { - } 1$ non-zero singular values, which are all equal.
+
+2. $\pmb { \cal E }$ has a rank-1 nullspace spanned by the ones vector, i.e., $\mathbf { \delta E 1 } _ { C } { = } \mathbf { 0 } .$ . In other words, $\pmb { { \cal E } }$ has zero-mean columns.
+
+Proof. First, recall from Papyan, Han, and Donoho (2020, Definition 1) that a $P { \times } C$ matrix $\pmb { \cal E }$ is called a Simplex ETF if it satisfies
+
+$$
+\pmb { E } ^ { \top } \pmb { E } = \alpha \left( \frac { C } { C - 1 } \pmb { I } - \frac { 1 } { C - 1 } \pmb { \mathrm { 1 } } _ { C } \pmb { \mathrm { 1 } } _ { C } ^ { \top } \right)
+$$
+
+for some scaling $\alpha { > } 0$ . We now prove the equivalence.
+
+Simplex ETF implies 1-2: Consider the SVD decomposition $\scriptstyle { E = U _ { E } S _ { E } V _ { E } ^ { \intercal } }$ , where $U _ { E }$ is a $\overline { { P \times ( C - 1 ) } }$ partial orthogonal matrix satisfying $U _ { E } ^ { \top } U _ { E } { = } I$ , $S _ { E }$ is the $( C { - } 1 ) { \times } ( C { - } 1 )$ diagonal matrix of singular values, and $V _ { E } ^ { \top }$ is a $( C { - } 1 ) { \times } C$ partial orthogonal matrix satisfying $V _ { E } ^ { \top } V _ { E } { = } I$ . Since $\pmb { \cal E }$ is a Simplex ETF, by definition,
+
+$$
+\pmb { E } ^ { \top } \pmb { E } = \alpha \left( \frac { C } { C - 1 } \pmb { I } - \frac { 1 } { C - 1 } \pmb { \mathrm { 1 } } _ { C } \pmb { \mathrm { 1 } } _ { C } ^ { \top } \right) ,
+$$
+
+and according to the SVD decomposition
+
+$$
+\begin{array} { r } { \pmb { E } ^ { \top } \pmb { E } = V _ { E } S _ { E } \pmb { U } _ { E } ^ { \top } \pmb { U } _ { E } S _ { E } \pmb { V } _ { E } ^ { \top } = V _ { E } S _ { E } ^ { 2 } \pmb { V } _ { E } ^ { \top } . } \end{array}
+$$
+
+Therefore,
+
+$$
+V _ { E } S _ { E } ^ { 2 } V _ { E } ^ { \top } = \alpha \left( \frac { C } { C - 1 } { \cal I } - \frac { 1 } { C - 1 } \mathbb { 1 } _ { C } \mathbb { 1 } _ { C } ^ { \top } \right) .
+$$
+
+Notice that the right-hand-side has $C { - } 1$ equal singular values. This implies $S _ { E }$ —and, thus, $\pmb { \cal E }$ as well—has $C { - } 1$ equal singular values. In other words, $S _ { E }$ is a $( C - 1 ) \times ( \bar { C } - 1 )$ diagonal matrix equal to $\mathrm { d i a g } ( s , \ldots , s )$ for some scalar $s { > } 0$ .
+
+Next, notice that on the one hand
+
+$$
+\pmb { { E } } ^ { \top } \pmb { { E } } \pmb { 1 } _ { C } = \alpha \left( \frac { C } { C - 1 } \pmb { I } - \frac { 1 } { C - 1 } \pmb { 1 } _ { C } \pmb { 1 } _ { C } ^ { \top } \right) \pmb { 1 } _ { C } = \mathbf { 0 } .
+$$
+
+On the other hand,
+
+$$
+\begin{array} { r } { \pmb { E } ^ { \top } \pmb { E } \mathbb { 1 } _ { C } = V _ { E } \pmb { S } _ { E } \pmb { U } _ { E } ^ { \top } U _ { E } \pmb { S } _ { E } V _ { E } ^ { \top } \mathbb { 1 } _ { C } = V _ { E } \pmb { S } _ { E } ^ { 2 } V _ { E } ^ { \top } \mathbb { 1 } _ { C } = s ^ { 2 } V _ { E } V _ { E } ^ { \top } \mathbb { 1 } _ { C } . } \end{array}
+$$
+
+Combining the above, we get $V _ { E } V _ { E } ^ { \top } \mathbb { 1 } _ { C } { = } \mathbf { 0 }$ . Since $V _ { E } V _ { E } ^ { \top }$ is a $C { \times } C$ matrix of rank $C { - } 1$ , we deduce that the rank-1 nullspace of $V _ { E } ^ { \top }$ is spanned by the $C$ -dimensional ones vector, i.e. $V _ { E } ^ { \top } \mathbb { 1 } _ { C } { = } \mathbf { 0 }$ . Consequently, $\pmb { { \cal E } }$ has zero-mean columns since $\scriptstyle { E \mathbb { 1 } _ { C } = U _ { E } S _ { E } V _ { E } ^ { \top } \mathbb { 1 } _ { C } = \mathbf { 0 } }$ .
+
+1-2 implies Simplex ETF: Assume $\pmb { \cal E }$ has exactly $C { - } 1$ non-zero, equal singular values as well as a rank-1 nullspace spanned by the ones-vector, i.e., $\mathbf { \delta E 1 } _ { C } { = } \mathbf { 0 }$ . Then, $\scriptstyle { E = U _ { E } S _ { E } V _ { E } ^ { \intercal } }$ where
+
+• $U _ { E }$ is a $P { \times } ( C { - } 1 )$ partial orthogonal matrix satisfying $U _ { E } ^ { \top } U _ { E } { = } I$ ; • $\boldsymbol { S _ { E } } = \mathrm { d i a g } ( s , . . . , s )$ is a $( C - 1 ) \times ( C - 1 )$ diagonal matrix for some scalar $s { > } 0$ ; and • $V _ { E } ^ { \top }$ is a $( C { - } 1 ) { \times } C$ partial orthogonal matrix satisfying $V _ { E } ^ { \top } V _ { E } { = } I$ and also satisfying $V _ { E } ^ { \top } \mathbb { 1 } _ { C } { = } \mathbf { 0 }$ .
+
+Therefore,
+
+$$
+\begin{array} { r } { E ^ { \top } E = V _ { E } S _ { E } U _ { E } ^ { \top } U _ { E } S _ { E } V _ { E } ^ { \top } = V _ { E } S _ { E } ^ { 2 } V _ { E } ^ { \top } = s ^ { 2 } V _ { E } V _ { E } ^ { \top } . } \end{array}
+$$
+
+Using our assumptions on $V _ { E }$ ,
+
+$$
+V _ { E } V _ { E } ^ { \top } + \frac { 1 } { C } \mathbf { 1 } _ { C } \mathbf { 1 } _ { C } ^ { \top } = I ,
+$$
+
+where we divide each of the ones-vectors by $\sqrt { C }$ to create a unit vector. Thus, we conclude
+
+$$
+\pmb { E } ^ { \top } \pmb { E } = s ^ { 2 } \left( \pmb { I } - \frac { 1 } { C } \pmb { \mathbb { 1 } } _ { C } \pmb { \mathbb { 1 } } _ { C } ^ { \top } \right) = \alpha \left( \frac { C } { C - 1 } \pmb { I } - \frac { 1 } { C - 1 } \pmb { \mathbb { 1 } } _ { C } \pmb { \mathbb { 1 } } _ { C } ^ { \top } \right) ,
+$$
+
+$\alpha = s ^ { 2 } \frac { C - 1 } { C }$ . Hence, by definition, $\pmb { \cal E }$ is a Simplex ETF.
+
+Corollary 2 (Neural Collapse Under MSE Loss). Under continually renormalized gradient flow (Equation 5), the SNR matrix (Equation 8) converges to
+
+$$
+\operatorname* { l i m } _ { t \infty } \frac { 1 } { \omega _ { \mathrm { m a x } } ( t ) } \mathrm { S N R } _ { t } = \widehat { U } _ { 0 } \widehat { V } _ { 0 } ^ { \top } ,
+$$
+
+where $\widehat { U } _ { 0 } \in \mathbb { R } ^ { P \times ( C - 1 ) }$ and $\widehat { V } _ { 0 } \in \mathbb { R } ^ { C \times ( C - 1 ) }$ are the left and right singular vectors of the SNR matrix (Definition 2) at $t { = } 0$ corresponding to the non-zero singular values; and $\omega _ { \mathrm { m a x } } ( t )$ is the
+
+largest singular value at time t. Furthermore, Corollary 1 implies the occurrence of (NC1)-(NC4) i.e.
+renormalized gradient flow on the central path leads to Neural Collapse.
+
+Moreover, denoting the Kronecker product with $\otimes$ , the renormalized features matrix converges to
+
+$$
+\operatorname* { l i m } _ { t \to \infty } \frac { 1 } { \omega _ { \mathrm { m a x } } ( t ) } \Sigma _ { W , t } ^ { - \frac { 1 } { 2 } } \overline { { H } } _ { t } = ( \widehat { U } _ { 0 } \widehat { V } _ { 0 } ^ { \top } ) \otimes \mathbf { 1 } _ { N } ^ { \top } .
+$$
+
+Proof. Derivation of Equation 10: Corollary 1 proves the singular values $j = 1 , \ldots , C - 1$ of $\mathrm { S N R } _ { t }$ diverge to infinity and that their ratio tends to one. By Lemma 6, the renormalized gradient flow will not change the singular vectors of the SNR matrix, and—combined with the fact that the singular values converge to equality (second fact of Corollary 1)—we get the limit in Equation 10.
+
+Derivation of (NC1): Let $s _ { j } ( \cdot )$ denote the $j$ -th singular value of its argument. Then, observe that
+
+$$
+\begin{array} { r l r } { \operatorname { t r } ( \sum _ { \stackrel { k , l } { n , k } } ^ { 1 } \sum _ { W , k } ) = C \operatorname { t r } ( ( M , M _ { t } ^ { \prime } ) ^ { \top } \Sigma _ { W , k } ) } & { \qquad } & { \mathrm { ( D e f . ~ o f ~ \Sigma _ { B } , \phi ~ ) } } \\ & { = C \operatorname { t r } ( \Sigma _ { W , k } ^ { \uparrow } ( \overline { { M } } _ { t } \overline { { M } } _ { t } ^ { \prime } ) ^ { \top } \Sigma _ { W , k } ^ { \frac { \eta } { \eta } } ) } & { \mathrm { ( C y c l e c ~ \eta ~ o p o r t y ~ o f ~ t r a c e ) } } \\ & { = C \frac { - 1 } { \gamma _ { 2 } } s _ { j } ( \Sigma _ { W , k } ^ { \uparrow } ( M _ { t } M _ { t } ^ { \prime } ) ^ { \top } ) \Sigma _ { W , l } ^ { \frac { 1 } { \eta } } ) } & { \mathrm { ( f r a c t ~ s u s ~ m o f ~ s i n g u l a r ~ v a l u e s ) } } \\ & { = C \frac { - 1 } { \gamma _ { 2 } } s _ { j } ^ { - 1 } ( \Sigma _ { W , k } ^ { - \frac { 1 } { \eta } } ( \overline { { M } } _ { t } \overline { { M } } _ { t } ^ { \prime } ) ^ { \top } \Sigma _ { W , k } ^ { - \frac { 1 } { \eta } } ) } & { \mathrm { ( f r a c t ~ s u p ~ \eta ~ o f ~ \eta ~ s u p i o t i o n v e r s e ) } } \\ & { = C \displaystyle \sum _ { \stackrel { k , l } { n = 1 } } ^ { \infty } s _ { j } ^ { - 1 } ( \Sigma _ { W , k } ^ { - \frac { 1 } { \eta } } \overline { { M } } _ { t } ) \Sigma _ { W , k } ^ { - \frac { 1 } { \eta } } } & { \mathrm { ( D e f . ~ o f ~ p e s u l o n v e r s e ) } } \\ & { = C \displaystyle \sum _ { j = 1 } ^ { \infty } s _ { j } ^ { - 2 } ( \Sigma _ { W , j } ^ { - \frac { 1 } { \eta } } \overline { { M } } _ { j } ) } & \\ & { = \displaystyle \sum _ { j = 1 } ^ { \infty } \frac { 1 } { \gamma _ { 2 } ( j ) } \frac { 1 } { \alpha ^ { j } ( k ) } \exp ( \mathrm { ~ C o v i l l a r ~ \eta ~ } ) } & \mathrm ( C o v e r \end{array}
+$$
+
+By Horn & Johnson (2012, Theorem 1.3.22),
+
+$$
+\begin{array} { r } { \lambda _ { j } ( \Sigma _ { B , t } ^ { \dag } \Sigma _ { W , t } ) = \lambda _ { j } ( \Sigma _ { W , t } ^ { 0 . 5 } \Sigma _ { B , t } ^ { \dag } \Sigma _ { W , t } ^ { 0 . 5 } ) \geq 0 , } \end{array}
+$$
+
+positive-semidefiniteness of Σ0.5W,tΣ†B,tΣ0.5W,t. Since the trace is the sum of eigenvalues, the only way† for the trace of to tend to zero is if all eigenvalues also tend to zero. All eigenvalues tending to zero implies the matrix itself tends to zero, i.e.
+
+$$
+\operatorname* { l i m } _ { t \infty } \Sigma _ { B , t } ^ { \dagger } \Sigma _ { W , t } = \mathbf { 0 } ,
+$$
+
+which is the definition of (NC1) in Section 1.1.
+
+Derivation of (NC2)-(NC4): Recall that the SNR matrix has zero-mean columns and rank $C { - } 1$ (see Definition 2). This, combined with the fact that the singular values converge to equality (second fact of Corollary 1) imply, by Lemma 7, that the renormalized class-means converge to a Simplex ETF i.e. (NC2) .
+
+From Theorem 1 of Papyan, Han, and Donoho (2020), we then know that (NC3) and (NC4) follow from (NC1) and (NC2) on the central path.
+
+Derivation of Equation 11: Combining the limit in Equation 10 with (NC1) proves the limit in Equation 11.
+
+# E RELATED WORKS EXAMINING NEURAL COLLAPSE
+
+In this section, we discuss the contributions and limitations of seven recent works that propose and analyze theoretical abstractions of Neural Collapse. These works are only available in preprint, and may not yet be peer-reviewed. Thus, they might ultimately appear with very different claims or results. Additionally, works such as Poggio & Liao (2020a;b); Ergen & Pilanci (2020) also analyze behaviors other than NC; we will only discuss the parts relevant to Neural Collapse here.
+
+# E.1 MIXON, PARSHALL, AND PI (2020)
+
+Mixon et al. (2020) considered the unconstrained features model in Equation 2 (without weight decay) where, under gradient flow, $( W , H )$ evolve according to a nonlinear ordinary differential equation (ODE). They followed a two-step strategy for studying Neural Collapse. First, they linearized the ODE—claiming nonlinear terms are negligible for models initialized near the origin—and proved the simplified ODE converges to a subspace of $( W , H )$ satisfying (NC1) and (NC3) . Second, they proved that gradient flow, restricted to that subspace, converges to (NC2) .
+
+The assumption of small weights and classifiers leading to the linearized ODE is not aligned with today’s paradigm. Specifically, the most commonly used He initialization (He et al., 2015) is designed: (i) to create weights with non-negligible magnitude; and (ii) to preserve the magnitude of features, as they propagate throughout the layers of the network, exactly so that last-layer features would have non-negligible magnitude. Moreover, the analysis of Mixon et al. essentially assumes that (NC1) and (NC3) occur much sooner than (NC2) . However, from the experiments in both Papyan, Han, and Donoho (2020) and this paper, there is no empirical evidence that (NC2) happens slower than (NC1) and (NC3) in practice.
+
+# E.2 LU AND STEINERBERGER (2020)
+
+While the MSE loss provides a mathematically natural setting for analysis, the modern paradigm in multi-class classification with deep learning involves training with CE loss, which is more challenging to analyze than MSE.
+
+Lu & Steinerberger (2020) studied the (one-example-per-class) unconstrained22 features model with CE loss:
+
+$$
+\operatorname* { m i n } _ { W , M } \mathrm { C E } ( W , M ) \quad \mathrm { s . t . } \quad \| w _ { c } \| _ { 2 } = \| \pmb { \mu } _ { c } \| _ { 2 } = 1 .
+$$
+
+Since under linear separability the CE loss can be driven arbitrarily close to zero, just by re-scaling the norms of $W$ and $M$ , the authors further imposed a norm constraint on ${ \pmb w } _ { c }$ and $\pmb { \mu } _ { c }$ . Lu & Steinerberger observe that the global minimizer of this optimization problem is only achieved once $W$ and $M$ are the same Simplex ETF. This derivation is suggestive, but it does not identify closed-form dynamics which would get gradient flow to such a global minimizer, nor does it address the rate of convergence to Neural Collapse. Additionally, the constraint on $\pmb { \mu } _ { c }$ possesses no immediate or direct analogy to standard deep net training—where procedures often control the norm of the weights $W$ , but not features $\pmb { H }$ —nor class-means $M$ .
+
+# E.3 E AND WOJTOWYTSCH (2020)
+
+E & Wojtowytsch (2020) also consider the unconstrained features model22 with CE loss,
+
+$$
+\operatorname* { m i n } _ { W , H } \quad \mathrm { C r o s s E n t r o p y } ( W H ) \quad \mathrm { s . t . } \quad \| W \| _ { 2 } \leq 1 , \ \| h _ { i , c } \| _ { 2 } \leq 1 ,
+$$
+
+where they adopt a more technical, spectral norm constraint on $W$ to specify their model.
+
+Building on the results of Chizat & Bach (2018; 2020), E & Wojtowytsch also construct a simple counter-example showing that Neural Collapse need not occur in two-layer, infinite-width networks— which have been the focus of intense recent study in the theoretical deep learning community (Mei et al., 2018; Rotskoff & Vanden-Eijnden, 2018; Arora et al., 2019). Thus, E & Wojtowytsch’s counterexample suggests the alternative perspective that, despite the expressiveness of infinite-width, two-layer networks, such abstractions do not capture key aspects of trained deep nets.
+
+As with Lu & Steinerberger (2020), standard deep net training does not possess any direct analogies for constraining the norm of features (as opposed to weights)—nor are there any paradigmatic regularizations that correspond to controlling the spectral norm on $W$ . Moreover, the work does not characterize any closed-form dynamics or the rate of convergence to Neural Collapse.
+
+# E.4 POGGIO & LIAO (2020A;B) (WITH BANBURSKI)
+
+Distinguished from the simplified unconstrained features models in the previously mentioned works is the theoretical analysis of Poggio & Liao (2020a;b) (in a special section, co-authored with Andrzej Banburski).
+
+The authors study deep homogeneous classification networks, with weight normalization layers, trained with stochastic gradient descent and weight decay. This is much closer to today’s training paradigm, but the setting still differs from the one in which Neural Collapse has been empirically observed in Papyan, Han, and Donoho (2020) and in Section A of this paper. In particular, they replace batch normalization with weight normalization and consider deep homogeneous networks; homogeneous networks can not have bias vectors nor skip connections, which are present both in ResNet and DenseNet. Moreover, the work gives explicit descriptions of neither the dynamics nor the rate of convergence to Neural Collapse.
+
+# E.5 ERGEN & PILANCI (2020)
+
+While the above-described works tend to focus on either the used-in-practice CE loss or the theoretically-insightful MSE loss, Ergen & Pilanci (2020) observed that these are both instances of the general class of convex loss functions and, thus, one could derive insights from the classical convex analysis literature. Moreover, compared to Mixon et al. (2020); Lu & Steinerberger (2020); E & Wojtowytsch (2020), this work studies the optimization starting from the second-to-last layer features rather than the last-layer features. In particular, the authors use a strong-duality argument to show that NC emerges in the optimal solution of an equivalent proxy-model to the following optimization:
+
+$$
+\operatorname* { m i n } _ { H _ { L - 1 } , W _ { L - 1 } , W _ { L } , \gamma , \alpha } \mathcal { L } \left( W _ { L } \left( \mathrm { B N } _ { \gamma , \alpha } \left( W _ { L - 1 } H _ { L - 1 } \right) \right) _ { + } , \mathbf { Y } \right) + \frac { \lambda } { 2 } \left( \left\| \gamma \right\| _ { 2 } ^ { 2 } + \left\| \alpha \right\| _ { 2 } ^ { 2 } + \left\| W _ { L } \right\| _ { F } ^ { 2 } \right) ,
+$$
+
+where $\mathcal { L } ( \cdot )$ is a general convex loss, $H _ { L - 1 }$ are the second-to-last layer activations, $W _ { L - 1 }$ are the second-to-last layer weights, $W _ { L }$ are the network classifiers, $\mathbf { Y }$ are the training targets, $\lambda$ is a weight-decay parameter, $\mathrm { B N } _ { \gamma , \alpha } ( \cdot )$ is a batch-norm operator parameterized by $\alpha$ and $\gamma$ , and $( \cdot ) _ { + }$ is a ReLU. The incorporation of batch-normalization and weight-decay ensures the existence of bounded, well-defined optimal solutions—serving a similar role to that of weight-normalization and weight decay in Poggio & Liao (2020a;b) as well as the norm constraints in the other aforementioned related works.
+
+Since strong-duality only characterizes properties of the converged optimal solution of an optimization model, Ergen & Pilanci (2020) does not provide insights into the dynamics with which that solution is achieved which training.
+
+# E.6 FANG, HE, LONG, AND SU (2021)
+
+In Fang et al. (2021), the authors introduce the $\boldsymbol { \mathscr { N } }$ -)layer-peeled model in which one considers only the direct optimization of the $N$ -th-to-last layer features of a deep net along with the weights that come after the $N .$ -th-to-last layer. The motivating philosophy is that, after raw inputs are passed through some initial number of layers, the overparameterization of those layers would allow us to effectively model the $N$ -th-to-last layer features as freely-moving in some subset of Euclidean space. In this terminology, the concurrent works of Mixon et al. (2020); Lu & Steinerberger (2020); E & Wojtowytsch (2020) on the unconstrained (last-layer) features model could be considered instances of a 1-layer-peeled model; while the model of Ergen & Pilanci (2020) could be considered as a 2-layer-peeled model. This perspective is attractive because it gives a name and organization to a common modeling philosophy behind the above-described body of independent works. For comparison, the work of Poggio & Liao (2020a;b) is a non-example of layer-peeled modeling as it considers optimization on the weights of homogeneous deep nets and not the input features.
+
+Fang et al. (2021) then analyzes a convex relaxation of the 1-layer-peeled model—with norm constraints on the weights and features—into a semidefinite program. Not only do the authors show that this model exhibits Neural Collapse in the canonical setting of balanced examples-per-class, but they also analyze the behavior of this model under imbalanced classes. While, in the imbalanced case, one would intuitively expect the Simplex ETF to “skew” to have bigger angles around overrepresented classes and smaller angles around under-represented ones; Fang et al. (2021) identifies the surprising phenomenon—named minority collapse—in their model where, when the imbalances pass a certain threshold, the last-layer features and classifiers of the under-represented classes collapse to be exactly the same. However, their work does not provide closed-form dynamics or rates at which collapse—in either the balanced or imbalance case—occurs.
+
+E.7 ZHU, DING, ZHOU, LI, YOU, SULAM, AND QU (2021)
+
+In Zhu et al. (2021), the authors examine the following unconstrained features model:
+
+$$
+\operatorname* { m i n } _ { W , H , b } \mathrm { C r o s s E n t r o p y } \left( W H + b , \pmb { Y } \right) + \frac { \lambda _ { W } } { 2 } \left. \pmb { W } \right. _ { F } ^ { 2 } + \frac { \lambda _ { H } } { 2 } \left. \pmb { H } \right. _ { F } ^ { 2 } + \frac { \lambda _ { b } } { 2 } \left. \pmb { b } \right. _ { F } ^ { 2 } ,
+$$
+
+where $( W , b )$ are the classifier weights and biases, $\pmb { H }$ are the last layer features, and $\left( \lambda _ { W } , \lambda _ { H } , \lambda _ { b } \right)$ are weight-decay parameters. On this model, the authors not only prove that all minima exhibit Neural Collapse but also that all local minima are global minima. In comparison to our current paper, Zhu et al. (2021) focus on characterizing the landscape of the loss and, thus, do not explore the dynamics and rate at which such minimizers of the loss are achieved.
+
+Zhu et al. (2021) also make notable empirical contributions by conducting a series of experiments on the MNIST and CIFAR10 datasets trained on MLPs, ResNet18, and ResNet50. Their measurements give evidence for the following novel NC-related phenomena in deep classification networks:
+
+1. NC is algorithm independent: NC emerges in realistic classification deep net training regardless of whether the algorithm is SGD, ADAM, or L-BFGS.
+2. NC occurs on random labels: NC emerges even when the one-hot target vectors are completely shuffled.
+3. Width improves NC: Increasing network width expedites NC when training with random labels.
+
+The authors of Zhu et al. (2021) moreover conducted ablation experiments suggesting that the following substitutions can be made to deep neural net architectures without affecting performance:
+
+1. Weight-decay substitution: Replacing (A) weight-decay on the norm of all network parameters with (B) weight-decay just on the norm of the last-layer features and classifiers. 2. Classifier substitution: Replacing (A) the last-layer classifiers that are trained with SGD with (B) Simplex ETF classifiers that are fixed throughout training.
+
+While the authors only demonstrated these new behaviors on limited network-dataset combinations, these experiments indeed inspire interesting conjectures about the generalization behavior of deep nets as well as potential architecture design improvements; Zhu et al. (2021) discuss many of these conjectures and related open-questions in detail.
\ No newline at end of file
diff --git a/md/dev/w4cXZDDib1H/w4cXZDDib1H.md b/md/dev/w4cXZDDib1H/w4cXZDDib1H.md
new file mode 100644
index 0000000000000000000000000000000000000000..87440667d3051a733a09109b8fd78fe36fc1da32
--- /dev/null
+++ b/md/dev/w4cXZDDib1H/w4cXZDDib1H.md
@@ -0,0 +1,419 @@
+# VIDT: AN EFFICIENT AND EFFECTIVEFULLY TRANSFORMER-BASED OBJECT DETECTOR
+
+Hwanjun $\mathbf { S o n g ^ { 1 } }$ , Deqing $\mathbf { S u n ^ { 2 } }$ , Sanghyuk $\mathbf { C h u n ^ { 1 } }$ , Varun Jampani2, Dongyoon $\mathbf { H a n } ^ { 1 }$ , Byeongho $\mathbf { H e o ^ { 1 } }$ , Wonjae $\mathbf { K i m ^ { 1 } }$ , Ming-Hsuan Yang2,3,4 1NAVER AI Lab 2Google Research 3University of California at Merced 4Yonsei University {hwanjun.song, sanghyuk.c, dongyoon.han, bh.heo, wonjae.kim}@navercorp.com {deqingsun, varunjampani}@google.com, mhyang@ucmerced.edu
+
+# ABSTRACT
+
+Transformers are transforming the landscape of computer vision, especially for recognition tasks. Detection transformers are the first fully end-to-end learning systems for object detection, while vision transformers are the first fully transformer-based architecture for image classification. In this paper, we integrate Vision and Detection Transformers (ViDT) to build an effective and efficient object detector. ViDT introduces a reconfigured attention module to extend the recent Swin Transformer to be a standalone object detector, followed by a computationally efficient transformer decoder that exploits multi-scale features and auxiliary techniques essential to boost the detection performance without much increase in computational load. Extensive evaluation results on the Microsoft COCO benchmark dataset demonstrate that ViDT obtains the best AP and latency trade-off among existing fully transformer-based object detectors, and achieves 49.2AP owing to its high scalability for large models. We release the code and trained models at https://github.com/naver-ai/vidt.
+
+# 1 INTRODUCTION
+
+Object detection is the task of predicting both bounding boxes and object classes for each object of interest in an image. Modern deep object detectors heavily rely on meticulously designed components, such as anchor generation and non-maximum suppression (Papageorgiou & Poggio, 2000; Liu et al., 2020). As a result, the performance of these object detectors depend on specific postprocessing steps, which involve complex pipelines and make fully end-to-end training difficult.
+
+Motivated by the recent success of Transformers (Vaswani et al., 2017) in NLP, numerous studies introduce Transformers into computer vision tasks. Carion et al. (2020) proposed Detection Transformers (DETR) to eliminate the meticulously designed components by employing a simple transformer encoder and decoder architecture, which serves as a neck component to bridge a CNN body for feature extraction and a detector head for prediction. Thus, DETR enables end-to-end training of deep object detectors. By contrast, Dosovitskiy et al. (2021) showed that a fully-transformer backbone without any convolutional layers, Vision Transformer (ViT), achieves the state-of-theart results in image classification benchmarks. Approaches like ViT have been shown to learn effective representation models without strong human inductive biases, e.g., meticulously designed components in object detection (DETR), locality-aware designs such as convolutional layers and pooling mechanisms. However, there is a lack of effort to synergize DETR and ViT for a better object detection architecture. In this paper, we integrate both approaches to build a fully transformer-based, end-to-end object detector that achieves state-of-the-art performance without increasing computational load.
+
+A straightforward integration of DETR and ViT can be achieved by replacing the ResNet backbone (body) of DETR with ViT – Figure 2(a). This naive integration, DETR $( \mathbf { V i T } ) ^ { 1 }$ , has two limitations. First, the canonical ViT suffers from the quadratic increase in complexity w.r.t. image size, resulting in the lack of scalability. Furthermore, the attention operation at the transformer encoder and decoder (i.e., the “neck” component) adds significant computational overhead to the detector. Therefore, the naive integration of DETR and ViT show very high latency – the blue lines of Figure 1.
+
+
+Figure 1. AP and latency (milliseconds) summarized in Table 2. The text in the plot indicates the backbone model size.
+
+
+Figure 2. Pipelines of fully transformer-based object detectors. DETR (ViT) means Detection Transformer that uses ViT as its body. The proposed ViDT synergizes DETR (ViT) and YOLOS and achieves best AP and latency trade-off among fully transformer-based object detectors.
+
+Recently, Fang et al. (2021) propose an extension of ViT to object detection, named YOLOS, by appending the detection tokens [DET] to the patch tokens [PATCH] (Figure 2(b)), where [DET] tokens are learnable embeddings to specify different objects to detect. YOLOS is a neck-free architecture and removes the additional computational costs from the neck encoder. However, YOLOS shows limited performance because it cannot use additional optimization techniques on the neck architecture, e.g., multi-scale features and auxiliary loss. In addition, YOLOS can only accommodate the canonical transformer due to its architectural limitation, resulting in a quadratic complexity w.r.t. the input size.
+
+In this paper, we propose a novel integration of Vision and Detection Transformers (ViDT) (Figure 2(c)). Our contributions are three-folds. First, ViDT introduces a modified attention mechanism, named Reconfigured Attention Module (RAM), that facilitates any ViT variant to handle the appended [DET] and [PATCH] tokens for object detection. Thus, we can modify the latest Swin Transformer (Liu et al., 2021) backbone with RAM to be an object detector and obtain high scalability using its local attention mechanism with linear complexity. Second, ViDT adopts a lightweight encoder-free neck architecture to reduce the computational overhead while still enabling the additional optimization techniques on the neck module. Note that the neck encoder is unnecessary because RAM directly extracts fine-grained representation for object detection, i.e., [DET] tokens. As a result, ViDT obtains better performance than neck-free counterparts. Finally, we introduce a new concept of token matching for knowledge distillation, which brings additional performance gains from a large model to a small model without compromising detection efficiency.
+
+ViDT has two architectural advantages over existing approaches. First, similar to YOLOS, ViDT takes [DET] tokens as the additional input, maintaining a fixed scale for object detection, but constructs hierarchical representations starting with small-sized image patches for [PATCH] tokens. Second, ViDT can use the hierarchical (multi-scale) features and additional techniques without a significant computation overhead. Therefore, as a fully transformer-based object detector, ViDT facilitates better integration of vision and detection transformers. Extensive experiments on Microsoft COCO benchmark (Lin et al., 2014) show that ViDT is highly scalable even for large ViT models, such as Swin-base with 0.1 billion parameters, and achieves the best AP and latency trade-off.
+
+# 2 PRELIMINARIES
+
+Vision transformers process an image as a sequence of small-sized image patches, thereby allowing all the positions in the image to interact in attention operations (i.e., global attention). However, the canonical ViT (Dosovitskiy et al., 2021) is not compatible with a broad range of vision tasks due to its high computational complexity, which increases quadratically with respect to image size. The Swin Transformer (Liu et al., 2021) resolves the complexity issue by introducing the notion of shifted windows that support local attention and patch reduction operations, thereby improving compatibility for dense prediction task such as object detection. A few approaches use vision transformers as detector backbones but achieve limited success (Heo et al., 2021; Fang et al., 2021).
+
+Detection transformers eliminate the meticulously designed components (e.g., anchor generation and non-maximum suppression) by combining convolutional network backbones and Transformer encoder-decoders. While the canonical DETR (Carion et al., 2020) achieves high detection performance, it suffers from very slow convergence compared to previous detectors. For example, DETR requires 500 epochs while the conventional Faster R-CNN (Ren et al., 2015) training needs only 37 epochs (Wu et al., 2019). To mitigate the issue, Zhu et al. (2021) propose Deformable DETR which introduces deformable attention for utilizing multi-scale features as well as expediting the slow training convergence of DETR. In this paper, we use the Deformable DETR as our base detection transformer framework and integrate it with the recent vision transformers.
+
+DETR (ViT) is a straightforward integration of DETR and ViT, which uses ViT as a feature extractor, followed by the transformer encoder-decoder in DETR. As illustrated in Figure 2(a), it is a body–neck–head structure; the representation of input [PATCH] tokens are extracted by the ViT backbone and then directly fed to the transformer-based encoding and decoding pipeline. To predict multiple objects, a fixed number of learnable [DET] tokens are provided as additional input to the decoder. Subsequently, output embeddings by the decoder produce final predictions through the detection heads for classification and box regression. Since DETR (ViT) does not modify the backbone at all, it can be flexibly changed to any latest ViT model, e.g., Swin Transformer. Additionally, its neck decoder facilitates the aggregation of multi-scale features and the use of additional techniques, which help detect objects of different sizes and speed up training (Zhu et al., 2021). However, the attention operation at the neck encoder adds significant computational overhead to the detector. In contrast, ViDT resolves this issue by directly extracting fine-grained [DET] features from Swin Transformer with RAM without maintaining the transformer encoder in the neck architecture.
+
+YOLOS (Fang et al., 2021) is a canonical ViT architecture for object detection with minimal modifications. As illustrated in Figure 2(b), YOLOS achieves a neck-free structure by appending randomly initialized learnable [DET] tokens to the sequence of input [PATCH] tokens. Since all the embeddings for [PATCH] and [DET] tokens interact via global attention, the final [DET] tokens are generated by the fine-tuned ViT backbone and then directly generate predictions through the detection heads without requiring any neck layer. While the naive DETR (ViT) suffers from the computational overhead from the neck layer, YOLOS enjoys efficient computations by treating the [DET] tokens as additional input for ViT. YOLOS shows that 2D object detection can be accomplished in a pure sequence-to-sequence manner, but this solution entails two inherent limitations:
+
+1) YOLOS inherits the drawback of the canonical ViT; the high computational complexity attributed to the global attention operation. As illustrated in Figure 1, YOLOS shows very poor latency compared with other fully transformer-based detectors, especially when its model size becomes larger, i.e., small base. Thus, YOLOS is not scalable for the large model. 2) YOLOS cannot benefit from using additional techniques essential for better performance, e.g., multi-scale features, due to the absence of the neck layer. Although YOLOS used the same DeiT backbone with Deformable DETR (DeiT), its AP was lower than the straightforward integration.
+
+In contrast, the encoder-free neck architecture of ViDT enjoys the additional optimization techniques from Zhu et al. (2021), resulting in the faster convergence and the better performance. Further, our RAM enables to combine Swin Transformer and the sequence-to-sequence paradigm for detection.
+
+# 3 VIDT: VISION AND DETECTION TRANSFORMERS
+
+ViDT first reconfigures the attention model of Swin Transformer to support standalone object detection while fully reusing the parameters of Swin Transformer. Next, it incorporates an encoder-free neck layer to exploit multi-scale features and two essential techniques: auxiliary decoding loss and iterative box refinement. We further introduce knowledge distillation with token matching to benefit from large ViDT models.
+
+# 3.1 RECONFIGURED ATTENTION MODULE
+
+Applying patch reduction and local attention scheme of Swin Transformer to the sequence-tosequence paradigm is challenging because (1) the number of [DET] tokens must be maintained at a fixed-scale and (2) the lack of locality between [DET] tokens. To address this challenge, we introduce a reconfigured attention module (RAM)2 that decomposes a single global attention associated with [PATCH] and [DET] tokens into the three different attention, namely $\mathrm { \Delta \left[ P A T C H \right] \times \left[ P A T C H \right] }$ , [DET] × [DET], and $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ attention. Based on the decomposition, the efficient schemes of Swin Transformer are applied only to $\mathrm { \Delta \left[ P A T C H \right] \times \Delta \left[ P A T C H \right] }$ attention, which is the heaviest part in computational complexity, without breaking the two constraints on [DET] tokens. As illustrated in Figure 3, these modifications fully reuse all the parameters of Swin Transformer by sharing projection layers for [DET] and [PATCH] tokens, and perform the three different attention operations:
+
+
+Figure 3. Reconfigured Attention Module (Q: query, K: key, V: value). The skip connection and feedforward networks following the attention operation is omitted just for ease of exposition.
+
+$\mathrm { \Delta \left[ P A T C H \right] \times \left[ P A T C H \right] }$ Attention: The initial [PATCH] tokens are progressively calibrated across the attention layers such that they aggregate the key contents in the global feature map (i.e., spatial form of [PATCH] tokens) according to the attention weights, which are computed by hquery, keyi pairs. For $[ \mathrm { P A T C H } ] \times [ \mathrm { P A T C H } ]$ attention, Swin Transformer performs local attention on each window partition, but its shifted window partitioning in successive blocks bridges the windows of the preceding layer, providing connections among partitions to capture global information. Without modifying this concept, we use the same policy to generate hierarchical [PATCH] tokens. Thus, the number of [PATCH] tokens is reduced by a factor of 4 at each stage; the resolution of feature maps decreases from $H / 4 \times W / 4$ to $H / 3 2 \times W / 3 2$ over a total of four stages, where $H$ and $W$ denote the width and height of the input image, respectively.
+
+• $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ Attention: Like YOLOS, we append one hundred learnable [DET] tokens as the additional input to the [PATCH] tokens. As the number of [DET] tokens specifies the number of objects to detect, their number must be maintained with a fixed-scale over the transformer layers. In addition, [DET] tokens do not have any locality unlike the [PATCH] tokens. Hence, for $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ attention, we perform global self-attention while maintaining the number of them; this attention helps each [DET] token to localize a different object by capturing the relationship between them.
+
+• $[ \mathrm { D E T } ] \times \left[ \mathrm { P A T C H } \right]$ Attention: This is cross-attention between [DET] and [PATCH] tokens, which produces an object embedding per [DET] token. For each [DET] token, the key contents in [PATCH] tokens are aggregated to represent the target object. Since the [DET] tokens specify different objects, it produces different object embeddings for diverse objects in the image. Without the crossattention, it is infeasible to realize the standalone object detector. As shown in Figure 3, ViDT binds $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ and $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ attention to process them at once to increase efficiency.
+
+We replace all the attention modules in Swin Transformer with the proposed RAM, which receives [PATCH] and [DET] tokens (as shown in “Body” of Figure 2(c)) and then outputs their calibrated new tokens by performing the three different attention operations in parallel.
+
+Positional Encoding. ViDT adopts different positional encodings for different types of attention. For $\mathrm { [ P A T C H ] } \times \mathrm { [ P A T C H ] }$ attention, we use the relative position bias (Hu et al., 2019) originally used in Swin Transformer. In contrast, the learnable positional encoding is added for [DET] tokens for $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ attention because there is no particular order between [DET] tokens. However, for $[ \mathrm { D E T } ] \times \left[ \mathrm { P A T C H } \right]$ attention, it is crucial to inject spatial bias to the [PATCH] tokens due to the permutation-equivariant in transformers, ignoring spatial information of the feature map. Thus, ViDT adds the sinusoidalbased spatial positional encoding to the feature map, which is reconstructed from the [PATCH] tokens for $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ attention, as can be seen from the left side of Figure 3. We present a thorough analysis of various spatial positional encodings in Section 4.2.1.
+
+Use of $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ Attention. Applying cross-attention between [DET] and [PATCH] tokens adds additional computational overhead to Swin Transformer, especially when it is activated at the bottom layer due to the large number of [PATCH] tokens. To minimize such computational overhead, ViDT only activates the cross-attention at the last stage (the top level of the pyramid) of Swin Transformer, which consists of two transformer layers that receives [PATCH] tokens of size $H / 3 2 \times W / 3 2$ .
+
+Thus, only self-attention for [DET] and [PATCH] tokens are performed for the remaining stages except the last one. In Section 4.2.2 we show that this design choice helps achieve the highest FPS, while achieving similar detection performance as when cross-attention is enabled at every stage. We provide more details on RAM including its complexity analysis and algorithmic design in Appendix A.
+
+# 3.2 ENCODER-FREE NECK STRUCTURE
+
+To exploit multi-scale feature maps, ViDT incorporates a decoder of multi-layer deformable transformers (Zhu et al., 2021). In the DETR family (Figure 2(a)), a transformer encoder is required at the neck to transform features extracted from the backbone for image classification into the ones suitable for object detection; the encoder is generally computationally expensive since it involves $\mathrm { \Delta \left[ P A T C H \right] \times \Delta \left[ P A T C H \right] }$ attention. However, ViDT maintains only a transformer decoder as its neck, in that Swin Transformer with RAM directly extracts fine-grained features suitable for object detection as a standalone object detector. Thus, the neck structure of ViDT is computationally efficient.
+
+The decoder receives two inputs from Swin Transformer with RAM: (1) [PATCH] tokens generated from each stage (i.e., four multi-scale feature maps, $\{ { \pmb x } ^ { l } \} _ { l = 1 } ^ { L }$ where $L = 4$ ) and (2) [DET] tokens generated from the last stage. The overview is illustrated in “Neck” of Figure 2(c). In each deformable transformer layer, $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ attention is performed first. For each [DET] token, multi-scale deformable attention is applied to produce a new [DET] token, aggregating a small set of key contents sampled from the multi-scale feature maps $\{ \mathbf { } x ^ { l } \} _ { l = 1 } ^ { L }$ ,
+
+$$
+\mathrm { M S D e f o r m A t t n } ( [ \mathbb { D } \mathbb { E } \mathbb { T } ] , \{ \pmb { x } ^ { l } \} _ { l = 1 } ^ { L } ) = \sum _ { m = 1 } ^ { M } { W _ { m } } \bigg [ \sum _ { l = 1 } ^ { L } \sum _ { k = 1 } ^ { K } A _ { m l k } \cdot { W _ { m } ^ { \prime } } { x } ^ { l } \big ( \phi _ { l } ( p ) + \Delta p _ { m l k } \big ) \bigg ] ,
+$$
+
+where $m$ indices the attention head and $K$ is the total number of sampled keys for content aggregation. In addition, $\phi _ { l } ( \pmb { p } )$ is the reference point of the [DET] token re-scaled for the $l$ -th level feature map, while $\Delta p _ { m l k }$ is the sampling offset for deformable attention; and $A _ { m l k }$ is the attention weights of the $K$ sampled contents. $W _ { m }$ and $W _ { m } ^ { \prime }$ are the projection matrices for multi-head attention.
+
+Auxiliary Techniques for Additional Improvements. The decoder of ViDT follows the standard structure of multi-layer transformers, generating refined [DET] tokens at each layer. Hence, ViDT leverages the two auxiliary techniques used in (Deformable) DETR for additional improvements:
+
+• Auxiliary Decoding Loss: Detection heads consisting of two feedforward networks (FNNs) for box regression and classification are attached to every decoding layer. All the training losses from detection heads at different scales are added to train the model. This helps the model output the correct number of objects without non-maximum suppression (Carion et al., 2020). Iterative Box Refinement: Each decoding layer refines the bounding boxes based on predictions from the detection head in the previous layer. Therefore, the box regression process progressively improves through the decoding layers (Zhu et al., 2021).
+
+These two techniques are essential for transformer-based object detectors because they significantly enhance detection performance without compromising detection efficiency. We provide an ablation study of their effectiveness for object detection in Section 4.3.1.
+
+# 3.3 KNOWLEDGE DISTILLATION WITH TOKEN MATCHING FOR OBJECT DETECTION
+
+While a large model has a high capacity to achieve high performance, it can be computationally expensive for practical use. As such, we additionally present a simple knowledge distillation approach that can transfer knowledge from the large ViDT model by token matching. Based on the fact that all ViDT models has exactly the same number of [PATCH] and [DET] tokens regardless of their scale, a small ViDT model (a student model) can easily benefit from a pre-trained large ViDT (a teacher model) by matching its tokens with those of the large one, thereby bringing out higher detection performance at a lower computational cost.
+
+Matching all the tokens at every layer is very inefficient in training. Thus, we only match the tokens contributing the most to prediction. The two sets of tokens are directly related: $( 1 ) \mathcal { P }$ : the set of [PATCH] tokens used as multi-scale feature maps, which are generated from each stage in the body, and $( 2 ) D$ : the set of [DET] tokens, which are generated from each decoding layer in the neck. Accordingly, the distillation loss based on token matching is formulated by
+
+$$
+\ell _ { d i s } ( \mathcal { P } _ { s } , \mathcal { D } _ { s } , \mathcal { P } _ { t } , \mathcal { D } _ { t } ) = \lambda _ { d i s } \Big ( \frac { 1 } { | \mathcal { P } _ { s } | } \sum _ { i = 1 } ^ { | \mathcal { P } _ { s } | } \Big \| \mathcal { P } _ { s } [ i ] - \mathcal { P } _ { t } [ i ] \Big \| _ { 2 } + \frac { 1 } { | \mathcal { D } _ { s } | } \sum _ { i = 1 } ^ { | \mathcal { D } _ { s } | } \Big \| \mathcal { D } _ { s } [ i ] - \mathcal { D } _ { t } [ i ] \Big \| _ { 2 } \Big ) ,
+$$
+
+
Backbone
Type (Size)
Train Data
Epochs
Resolution
Params
ImageNet Acc.
DeiT
DeiT-tiny ()DeiT-small()DeiT-base()
ImageNet-1KImageNet-1KImageNet-1K
300300300
224224384
6M22M87M
74.581.285.2
SwinTransformer
Swin-nanoSwin-tinySwin-smallSwin-base
ImageNet-1KImageNet-1KImageNet-1KImageNet-22K
30030030090
224224224224
6M28M50M88M
74.981.283.286.3
+
+Table 1. Summary on the ViT backbone. $\because \frac { \partial } { \partial x } ^ { , }$ is the distillation strategy for classification (Touvron et al., 2021).
+
+where the subscripts $s$ and $t$ refer to the student and teacher model. $\mathcal { P } [ i ]$ and $\mathcal { D } [ i ]$ return the $i$ -th [PATCH] and [DET] tokens, $n$ -dimensional vectors, belonging to $\mathcal { P }$ and $\mathcal { D }$ , respectively. $\lambda _ { d i s }$ is the coefficient to determine the strength of $\ell _ { d i s }$ , which is added to the detection loss if activated.
+
+# 4 EVALUATION
+
+In this section, we show that ViDT achieves the best trade-off between accuracy and speed (Section 4.1). Then, we conduct detailed ablation study of the reconfigured attention module (Section 4.2) and additional techniques to boost detection performance (Section 4.3). Finally, we provide a complete analysis of all components available for ViDT (Section 4.4).
+
+Dataset. We carry out object detection experiments on the Microsoft COCO 2017 benchmark dataset (Lin et al., 2014). All the fully transformer-based object detectors are trained on 118K training images and tested on 5K validation images following the literature (Carion et al., 2020).
+
+Algorithms. We compare ViDT with two existing fully transformer-based object detection pipelines, namely DETR (ViT) and YOLOS. Since DETR (ViT) follows the general pipeline of (Deformable) DETR by replacing its ResNet backbone with other ViT variants; hence, we use one canonical ViT and one latest ViT variant, DeiT and Swin Transformer, as its backbone without any modification. In contrast, YOLOS is the canonical ViT architecture, thus only DeiT is available. Table 1 summarizes all the ViT models pre-trained on ImageNet used for evaluation. Note that publicly available pretrained models are used except for Swin-nano. We newly configure Swin-nano3 comparable to DeiTtiny, which is trained on ImageNet with the identical setting. Overall, with respect to the number of parameters, Deit-tiny, -small, and -base are comparable to Swin-nano, -tiny, and -base, respectively. Please see Appendix B.2 for the detailed pipeline of compared detectors.
+
+Implementation Details. All the algorithms are implemented using PyTorch and executed using eight NVIDIA Tesla V100 GPUs. We train ViDT using AdamW (Loshchilov & Hutter, 2019) with the same initial learning rate of $1 0 ^ { - 4 }$ for its body, neck and head. In contrast, following the (Deformable) DETR setting, DETR (ViT) is trained with the initial learning rate of $1 0 ^ { - 5 }$ for its pretrained body (ViT backbone) and $1 0 ^ { - 4 }$ for its neck and head. YOLOS and ViDT (w.o. Neck) are trained with the same initial learning rate of $5 \times 1 0 ^ { - 5 }$ , which is the original setting of YOLOS for the neck-free detector. We do not change any hyperparameters used in transformer encoder and decoder for (Deformable) DETR; thus, the neck decoder of ViDT also consists of six deformable transformer layers using exactly the same hyperparameters. The only new hyperparameter introduced, the distillation coefficient $\lambda _ { d i s }$ in Eq. (2), is set to be 4. For fair comparison, knowledge distillation is not applied for ViDT in the main experiment in Section 4.1. The efficacy of knowledge distillation with token matching is verified independently in Section 4.3.2. Auxiliary decoding loss and iterative box refinement are applied to the compared methods if applicable.
+
+Regarding the resolution of input images, we use scale augmentation that resizes them such that the shortest side is at least 480 and at most 800 pixels while the longest at most 1333 (Wu et al., 2019). More details of the experiment configuration can be found in Appendix B.3–B.5. All the source code and trained models will be made available to the public at https://github.com/naver-ai/vidt.
+
+# 4.1 MAIN EXPERIMENTS WITH MICROSOFT COCO BENCHMARK
+
+Table 2 compares ViDT with DETR (ViT) and YOLOS w.r.t their AP, FPS, # parameters, where the two variants of DETR (ViT) are simply named DETR and Deformable DETR. We report the result of ViDT without using knowledge distillation for fair comparison. A summary plot is provided in Figure 1. The experimental comparisons with CNN backbones are provided in Appendix C.1.
+
+
Method
Backbone
Epochs
AP
AP50
AP75
APs
APM
APL
Param.
FPS
DETR
DeiT-tiny DeiT-small DeiT-base
50 50
30.0 32.4
49.2 52.5
30.5 33.2
9.9
30.8
50.6
24M
10.9 (13.1)
11.3
33.5
53.7
39M
7.8 (8.8)
50
37.1
59.2
38.4
14.7
39.4
52.9
0.1B
4.3(4.9)
Swin-nano 50
27.8
47.5
27.4
9.0
29.2
44.9
24M
24.7 (46.1)
Swin-tiny 50
34.1
55.1
35.3
12.7
35.9
54.2
45M
19.3 (28.1)
Swin-small 50 Swin-base
37.6
59.0
39.0
15.9
40.1
58.9
66M
13.5 (17.7)
Deformable DETR
50
40.7
62.9
42.7
18.3
44.1
62.4
0.1B
9.7 (12.6)
DeiT-tiny DeiT-small
50 50
40.8 43.6
60.1 63.7
43.6
21.4
43.4
58.2
18M 35M
12.4 (16.3)
DeiT-base
50
46.4
46.5
23.3
47.1
62.1
8.5 (10.2)
Swin-nano
50
43.1
67.3 61.4
49.4 46.3
26.7
50.1
65.4
0.1B
4.4(5.3)
Swin-tiny
50
47.0
66.8
50.8
25.9 28.1
45.2 49.8
59.4 63.9
18M 39M
7.0 (7.8)
Swin-small
50
49.0
68.9
52.9
30.3
52.8
66.6
60M
6.3 (7.0) 5.5 (6.1)
YOLOS
Swin-base
50
51.4
71.7
56.2
34.5
55.1
67.5
0.1B
4.8 (5.4)
DeiT-tiny
150
30.4
48.6
31.1
12.4
31.8
48.2
6M
28.1 (31.3)
DeiT-small
150
36.1
55.7
37.6
15.6
38.4
55.3
30M
9.3 (11.8)
DeiT-base
150
42.0
62.2
44.5
19.5
45.3
62.1
0.1B
3.9 (5.4)
ViDT (w.0. Neck)
Swin-nano
150
28.7
48.6
28.5
12.3
30.7
44.1
7M
36.5 (64.4)
Swin-tiny
150
36.3
56.3
37.8
16.4
39.0
54.3
29M
28.6 (32.1)
Swin-small
150
41.6
62.7
43.9
20.1
45.4
59.8
52M
16.8 (18.8)
Swin-base
150
43.2
64.2
45.9
21.9
46.9
63.2
91M
11.5 (12.5)
ViDT
Swin-nano
50
40.4
59.6
42.5
55.8
16M
20.0 (45.8)
Swin-tiny
50
44.8
64.5
43.3 48.7
23.2 25.9
47.6
62.1
38M
17.2 (26.5)
Swin-small
50
47.5
67.7
51.4
29.2
50.7
64.8
61M
12.1 (16.5)
Swin-base
50
49.2
69.4
53.1
30.6
52.6
66.9
0.1B
9.0 (11.6)
+
+Table 2. Comparison of ViDT with other compared detectors on COCO2017 val set. Two neck-free detectors, YOLOS and ViDT (w.o. Neck) are trained for 150 epochs due to the slow convergence. FPS is measured with batch size 1 of $8 0 0 \times 1 3 3 3$ resolution on a single Tesla V100 GPU, where the value inside the parentheses is measured with batch size 4 of the same resolution to maximize GPU utilization.
+
+Highlights. ViDT achieves the best trade-off between AP and FPS. With its high scalability, it performs well even for Swin-base of 0.1 billion parameters, which is $2 \mathbf { x }$ faster than Deformable DETR with similar AP. Besides, ViDT shows 40.4AP only with 16M parameters; it is 6.3–12.6AP higher than those of DETR (swin-nano) and DETR (swin-tiny), which exhibit similar FPS of 19.3–24.7.
+
+ViDT vs. Deformable DETR. Thanks to the use of multi-scale features, Deformable DETR exhibits high detection performance in general. Nevertheless, its encoder and decoder structure in the neck becomes a critical bottleneck in computation. In particular, the encoder with multi-layer deformable transformers adds considerable overhead to transform multi-scale features by attention. Thus, it shows very low FPS although it achieves higher AP with a relatively small number of parameters. In contrast, ViDT removes the need for a transformer encoder in the neck by using Swin Transformer with RAM as its body, directly extracting multi-scale features suitable for object detection.
+
+ViDT (w.o. Neck) vs. YOLOS. For the comparison with YOLOS, we train ViDT without using its neck component. These two neck-free detectors show relatively low AP compared with other detectors in general. In terms of speed, YOLOS exhibits much lower FPS than ViDT (w.o. Neck) because of its quadratic computational complexity for attention. However, ViDT (w.o. Neck) extends Swin Transformers with RAM, thus requiring linear complexity for attention. Hence, it shows AP comparable to YOLOS for various backbone size, but its FPS is much higher.
+
+One might argue that better integration could be also achieved by (1) Deformable DETR without its neck encoder because its neck decoder also has $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ cross-attention, or (2) YOLOS with VIDT’s neck decoder because of the use of multiple auxiliary techniques. Such integration is actually not effective; the former significantly drops AP, while the latter has a much greater drop in FPS than an increase in AP. The detailed analysis can be found in Appendix C.2.
+
+# 4.2 ABLATION STUDY ON RECONFIGURED ATTENTION MODULE (RAM)
+
+We extend Swin Transformer with RAM to extract fine-grained features for object detection without maintaining an additional transformer encoder in the neck. We provide an ablation study on the two main considerations for RAM, which leads to high accuracy and speed. To reduce the influence of secondary factors, we mainly use our neck-free version, ViDT (w.o. Neck), for the ablation study.
+
+# 4.2.1 SPATIAL POSITIONAL ENCODING
+
+Spatial positional encoding is essential for [DET] $\times$ [PATCH] attention in RAM. Typically, the spatial encoding can be added to the [PATCH] tokens before or after the projection layer in Figure 3. We call the former “pre-addition” and the latter “postaddition”. For each one, we can design the encoding in a sinusoidal or learnable manner (Carion et al.,
+
+
Method
None
Pre-addition
Post-addition
Type
None
Sin.
Learn.
Sin.
Learn.
AP
23.7
28.7
27.4
28.0
24.1
+
+Table 3. Results for different spatial encodings for $[ \mathsf { D E T } ] \times [ \mathsf { P A T C H } ]$ cross-attention.
+
+2020). Table 3 contrasts the results with different spatial positional encodings with ViDT (w.o. Neck). Overall, pre-addition results in performance improvement higher than post-addition, and specifically, the sinusoidal encoding is better than the learnable one; thus, the 2D inductive bias of the sinusoidal spatial encoding is more helpful in object detection. In particular, pre-addition with the sinusoidal encoding increases AP by 5.0 compared to not using any encoding.
+
+# 4.2.2 SELECTIVE $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ CROSS-ATTENTION
+
+The addition of cross-attention to Swin Transformer inevitably entails computational overhead, particularly when the number of [PATCH] is large. To alleviate such overhead, we selectively enable cross-attention in RAM at the last stage of Swin Transformer; this is shown to greatly improve FPS, but barely drop AP. Table 4 summarizes AP and FPS when used different selective strategies for the cross-attention, where Swin Transformer consists of four stages in total. It is interesting that all the strategies exhibit similar AP as long as cross-attention is activated at the last stage. Since features are extracted in a bottom-up manner as they go through the stages, it seems difficult to directly obtain useful information about the target object at the low level of stages. Thus, only using the last stage is the best design choice in terms of high AP and FPS due to the smallest number of [PATCH] tokens.
+
+Meanwhile, the detection fails completely or the performance significantly drops if all the stages are not involved due to the lack of interaction between [DET] and [PATCH] tokens that spatial positional encoding is associated with. A more detailed analysis of the $[ \mathrm { D E T } ] \stackrel { \cdot } { \times } [ \mathrm { P A T C H } ]$ cross-attention and $[ \mathrm { D E T } ] \times [ \mathrm { D E T } ]$ self-attention is provided in appendices C.3 and C.4.
+
+
Stage Ids
{1,2,3,4}
{2,3,4}
{3,4}
{4}
0
Metric
AP
FPS
AP
FPS
AP
FPS
AP
FPS
AP
FPS
w.o. Neck
29.0
21.8
28.8
29.1
28.5
34.3
28.7
36.5
FAIL
37.7
w. Neck
40.3
14.6
40.1
18.0
40.3
19.5
40.4
20.0
37.1
20.5
+
+Table 4. AP and FPS comparison with different selective cross-attention strategies.
+
+# 4.3 ABLATION STUDY ON ADDITIONAL TECHNIQUES
+
+We analyze the performance improvement of two additional techniques, namely auxiliary decoding loss and iterative box refinement, and the proposed distillation approach in Section 3.3. Furthermore, we introduce a simple technique that can expedite the inference speed of ViDT by dropping unnecessary decoding layers at inference time.
+
+# 4.3.1 AUXILIARY DECODING LOSS AND ITERATIVE BOX REFINEMENT
+
+To thoroughly verify the efficacy of auxiliary decoding loss and iterative box refinement, we extend them even for the neck-free detector like YOLOS; the principle of them is applied to the encoding layers in the body, as opposed to the conventional way of using the decoding layers in the neck. Table 5 shows the performance of the two neck-free detectors, YOLOS and ViDT (w.o. Neck), decreases considerably with the two techniques. The use of them in the encoding layers is likely to negatively affect feature extraction of the transformer encoder. In contrast, an opposite trend is observed with the neck component. Since the neck decoder is decoupled with the feature extraction in the body, the two techniques make a synergistic effect and thus show significant improvement in AP. These results justify the use of the neck decoder in ViDT to boost object detection performance.
+
+
Aux. l Box Ref.
Neck
AP
△
SOTOX
<
√
30.4 29.2 20.1
-1.2 -10.3
广 √
一 一
28.7 27.2 22.9 36.2
-1.6 -5.9 +7.4
√ 1
1
40.4
+11.6
+
+# 4.3.2 KNOWLEDGE DISTILLATION WITH TOKEN MATCHING
+
+We show that a small ViDT model can benefit from a large ViDT model via knowledge distillation. The proposed token matching is a new concept of knowledge distillation for object detection, especially for a fully transformer-based object detector. Compared to very complex distillation methods that rely on heuristic rules with multiple hyperparameters (Chen et al., 2017; Dai et al., 2021), it simply matches some tokens with
+
+
Student
ViDT(Swin-nano)
ViDT (Swin-tiny)
Teacher
ViDT ViDT (small) (base)
ViDT ViDT (small) (base)
入dis=0
40.4
44.8
Xdis=2
41.4 41.4
45.6 46.1
Xdis=4
41.5 41.9
45.8 46.5
+
+Table 6. AP comparison of student models associated with different teacher models.
+
+a single hyperparameter, the distillation coefficient $\lambda _ { d i s }$ . Table 6 summarizes the AP improvement via knowledge distillation with token matching with varying distillation coefficients. Overall, the larger the size of the teacher model, the greater gain to the student model. Regarding coefficients, in general, larger values achieve better performance. Distillation increases AP by 1.0–1.7 without affecting the inference speed of the student model.
+
+# 4.3.3 DECODING LAYER DROP
+
+ViDT has six layers of transformers as its neck decoder. We emphasize that not all layers of the decoder are required at inference time for high performance. Table 7 show the performance of ViDT when dropping its decoding layer one by one from the top in the inference step. Although there is a trade-off relationship between accuracy and speed as the layers are detached from the model, there is no significant AP drop even when the two layers are removed. This technique is not designed for performance evaluation in Table 2
+
+
Model Metric
ViDT(Swin-nano) AP Param.
FPS
AP Param.
ViDT(Swin-tiny) FPS
0 Drop
40.4 16M
20.0
44.8
38M 17.2
1 Drop
40.2 14M
20.9
44.8
37M 18.5
2 Drop
40.0 13M
22.3
44.5
35M 19.6
3 Drop
38.6 12M
24.7
43.6
34M 21.0
4 Drop 5 Drop
36.8 11M 32.5
26.0 10M 28.7
41.9 38.0
33M 22.4 32M 24.4
+
+Table 7. Performance trade-off by decoding layer drop regarding AP, Param, and FPS.
+
+with other methods, but we can accelerate the inference speed of a trained ViDT model to over $1 0 \%$ by dropping its two decoding layers without a much decrease in AP.
+
+# 4.4 COMPLETE COMPONENT ANALYSIS
+
+In this section, we combine all the proposed components (even with distillation and decoding layer drop) to achieve high accuracy and speed for object detection. As summarized in Table 8, there are four components: (1) RAM to extend Swin Transformer as a standalone object detector, (2) the neck decoder to exploit multi-scale features with two auxiliary techniques, (3) knowledge distillation to benefit from a large model, and (4) decoding layer drop to further accelerate inference speed. The performance of the final version is very outstanding; it achieves 41.7AP with reasonable FPS by only using 13M parameters when used Swin-nano as its backbone. Further, it only loses 2.7 FPS while exhibiting 46.4AP when used Swin-tiny. This indicates that a fully transformer-based object detector has the potential to be used as a generic object detector when further developed in the future.
+
+Table 8. Detailed component analysis with Swin-nano and Swin-tiny.
+
+
Component
Swin-nano
#
RAM Neck Distil
Drop
AP
AP50AP75
Param.
FPS
AP
AP50
Swin-tiny AP75
Param.
FPS
(1)
√
28.7
48.6
28.5
7M
36.5
36.3
56.3
37.8
29M
28.6
(2
√
√
40.4
59.6
43.3
16M
20.0
44.8
64.5
48.7
38M
17.2
3
√
√
√
41.9
61.1
45.0
16M
20.0
46.5
66.3
50.2
38M
17.2
(4)
√
√
√
√
41.7
61.0
44.8
13M
22.3
46.4
66.3
50.2
35M
19.6
+
+# 5 CONCLUSION
+
+We have explored the integration of vision and detection transformers to build an effective and efficient object detector. The proposed ViDT significantly improves the scalability and flexibility of transformer models to achieve high accuracy and inference speed. The computational complexity of its attention modules is linear w.r.t. image size, and ViDT synergizes several essential techniques to boost the detection performance. On the Microsoft COCO benchmark, ViDT achieves 49.2AP with a large Swin-base backbone, and 41.7AP with the smallest Swin-nano backbone and only 13M parameters, suggesting the benefits of using transformers for complex computer vision tasks.
+
+# ETHICS STATEMENT
+
+This paper deals with the topic of general object detection in computer vision. We propose a novel integration of vision and detection transformers for a fully transformer-based object detector. Therefore, we do not expect any potential negative social impact of our work.
+
+# REPRODUCIBILITY STATEMENT
+
+For reproducibility, we provide a detailed description of our experiment and hyperparameter settings in Appendix B. It includes the Swin-nano architecture (Appendix B.1), the pipelines of all compared object detectors (Appendix B.2), hyperparameters of neck transformers (Appendix B.3), detailed implementation (Appendix B.4), and training configuration (Appendix B.5). We will release the code and trained models upon acceptance.
+
+# ACKNOWLEDGMENTS
+
+We thank NAVER AI Lab members for valuable discussion and advice. NAVER Smart Machine Learning (NSML) (Kim et al., 2018) has been used for experiment. M.-H. Yang is supported in part by the NSF CAREER grant 1149783.
+
+# REFERENCES
+
+Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, pp. 213–229, 2020. 1, 3, 5, 6, 8, 14, 15
+
+Chun-Fu Chen, Quanfu Fan, and Rameswar Panda. CrossViT: Cross-attention multi-scale vision transformer for image classification. In ICCV, 2021. 13
+
+Guobin Chen, Wongun Choi, Xiang Yu, Tony Han, and Manmohan Chandraker. Learning efficient object detection models with knowledge distillation. In NeurIPS, 2017. 9
+
+Xing Dai, Zeren Jiang, Zhao Wu, Yiping Bao, Zhicheng Wang, Si Liu, and Erjin Zhou. General instance distillation for object detection. In CVPR, pp. 7842–7851, 2021. 9
+
+Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021. 1, 2
+
+Yuxin Fang, Bencheng Liao, Xinggang Wang, Jiemin Fang, Jiyang Qi, Rui Wu, Jianwei Niu, and Wenyu Liu. You only look at one sequence: Rethinking transformer in vision through object detection. arXiv preprint arXiv:2106.00666, 2021. 2, 3, 14, 15
+
+Byeongho Heo, Sangdoo Yun, Dongyoon Han, Sanghyuk Chun, Junsuk Choe, and Seong Joon Oh. Rethinking spatial dimensions of vision transformers. In ICCV, 2021. 2, 13
+
+Han Hu, Zheng Zhang, Zhenda Xie, and Stephen Lin. Local relation networks for image recognition. In CVPR, pp. 3464–3473, 2019. 4
+
+Hanjoo Kim, Minkyu Kim, Dongjoo Seo, Jinwoong Kim, Heungseok Park, Soeun Park, Hyunwoo Jo, KyungHyun Kim, Youngil Yang, Youngkwan Kim, et al. NSML: Meet the mlaas platform with a real-world case study. arXiv preprint arXiv:1810.09957, 2018. 10
+
+Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft COCO: Common objects in context. In ´ ECCV, pp. 740–755, 2014. 2, 6
+
+Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense object ´ detection. In CVPR, pp. 2980–2988, 2017. 14
+
+Li Liu, Wanli Ouyang, Xiaogang Wang, Paul Fieguth, Jie Chen, Xinwang Liu, and Matti Pietikainen. ¨ Deep learning for generic object detection: A survey. International Journal of Computer Vision, 128(2):261–318, 2020. 1
+
+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, 2021. 2, 12
+
+Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In ICLR, 2019. 6, 15
+
+Constantine Papageorgiou and Tomaso Poggio. A trainable system for object detection. International Journal of Computer Vision, 38(1):15–33, 2000. 1
+
+Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster R-CNN: Towards real-time object detection with region proposal networks. NeurIPS, 28:91–99, 2015. 3
+
+Hamid Rezatofighi, Nathan Tsoi, JunYoung Gwak, Amir Sadeghian, Ian Reid, and Silvio Savarese. Generalized intersection over union: A metric and a loss for bounding box regression. In CVPR, pp. 658–666, 2019. 14
+
+Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Herve J ´ egou. Training data-efficient image transformers & distillation through attention. In ´ ICML, pp. 10347–10357, 2021. 6
+
+Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, pp. 5998–6008, 2017. 1, 12, 17
+
+Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In ICCV, 2021. 13
+
+Yuxin Wu, Alexander Kirillov, Francisco Massa, Wan-Yen Lo, and Ross Girshick. Detectron2. https://github.com/facebookresearch/detectron2, 2019. 3, 6
+
+Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable DETR: Deformable transformers for end-to-end object detection. In ICLR, 2021. 3, 5, 14, 15
+
+# An Efficient and Effective Fully Transformer-based Object Detector (Supplementary Material)
+
+A RECONFIGURED ATTENTION MODULE
+
+The proposed RAM in Figure 3 performs three attention operations, namely $\mathrm { \Delta [ P A T C H ] \ \times \ [ P A T C H ] } .$ , $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ , and $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ attention. This section provides (1) computational complexity analysis and (2) further algorithmic design for [DET] tokens.
+
+# A.1 COMPUTATIONAL COMPLEXITY ANALYSIS
+
+We analyze the computational complexity of the proposed RAM compared with the attention used in YOLOS. The analysis is based on the computational complexity of basic building blocks for Canonical and Swin Transformer, which is summarized in Table $9 ^ { 4 }$ , where ${ \sf T } _ { 1 }$ and ${ \sf T } _ { 2 }$ is the number of tokens for self- and cross-attention, and $d$ is the embedding dimension.
+
+
Transformer
Canonical Transformer
Swin Transformer
Attention
Global Self-attention Global Cross-attention
Local Self-attention
Complexity
O(d²T1 + dT²) O(d²(T1 +T2)+dT1T2)
O(d²T1 + dk²T1)
+
+Table 9. Computational complexity of attention modules: In the canonical transformer, the complexity of global self-attention is $\mathcal { O } ( d ^ { 2 } \mathsf { T } _ { 1 } + \mathsf { \dot { d } } \mathsf { T } _ { 1 } ^ { 2 } )$ , where $\mathcal { O } ( d ^ { 2 } \mathsf { T } _ { 1 } )$ is the cost of computing the query, key, and value embeddings and $\mathcal { O } ( d \mathsf { T } _ { 1 } ^ { 2 } )$ is the cost of computing the attention weights. The complexity of global cross-attention is $\mathcal { O } ( \bar { d } ^ { 2 } ( \mathsf { T } _ { 1 } + \mathsf { T } _ { 2 } ) + d \mathsf { T } _ { 1 } \mathsf { T } _ { 2 } )$ , which is the interaction between the two different tokens ${ \sf T } _ { 1 }$ and ${ \mathsf { T } } _ { 2 }$ . In contrast, Swin Transformer achieves much lower attention complexity of $\mathcal { O } ( d ^ { 2 } \mathsf { T } _ { 1 } + d k ^ { 2 } \mathsf { T } _ { 1 } )$ with window partitioning, where $k$ is the width and height of the window $( k < < \mathsf { T } _ { 1 } , \mathsf { T } _ { 2 } )$ .
+
+Let $\mathsf { P }$ and $\mathsf { D }$ be the number of [PATCH] and [DET] tokens ( $\mathsf { D } < < \mathsf { P }$ in practice, e.g., $\mathsf { P } = 6 6 , 6 5 0$ and $\mathsf { D } = 1 0 0$ at the first stage of ViDT). Then, the computational complexity of the attention module for YOLOS and ViDT (RAM) is derived as below, also summarized in Table 10:
+
+• YOLOS Attention: [DET] tokens are simply appended to [PATCH] tokens to perform global selfattention on [PATCH, DET] tokens (i.e., ${ \sf T } _ { 1 } = { \sf P } + { \sf D } )$ . Thus, the computational complexity is $\mathcal { O } ( d ^ { 2 } ( \mathsf { P } + \mathsf { D } ) ^ { } + d ( \mathsf { P } + \bar { \mathsf { D } } ) ^ { 2 } )$ , which is quadratic to the number of [PATCH] tokens. If breaking down the total complexity, we obtain $\mathcal { O } \big ( ( d ^ { 2 } \mathsf { P } + d \mathsf { P } ^ { 2 } ) + ( d ^ { 2 } \mathsf { D } + d \mathsf { D } ^ { 2 } ) + d \mathsf { P } \mathsf { D } \big )$ , where the first and second terms are for the global self-attention for [PATCH] and [DET] tokens, respectively, and the last term is for the global cross-attention between them.
+
+• ViDT (RAM) Attention: RAM performs the three different attention operations: (1) $\left[ \mathrm { P A T C H } \right] \times$ [PATCH] local self-attention with window partition, $\mathcal { O } ( d ^ { 2 } \mathsf { P } + d k ^ { 2 } \mathsf { P } )$ ; (2) $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ global selfattention, $\mathcal { O } ( d ^ { 2 } \mathsf { D } + d \mathsf { D } ^ { 2 } )$ ; (3) $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ global cross-attention, $\bar { \mathcal { O } } ( d ^ { 2 } \bar { ( } \mathsf { D } \doteq \mathsf { P } ) \bar { + } d \mathsf { D } \mathsf { P } )$ . In total, the computational complexity of RAM is $\mathsf { \bar { O } } ( d ^ { 2 } ( \mathsf { D } + \mathsf { P } ) + d k ^ { 2 } \mathsf { P } + d \mathsf { D } ^ { 2 } + d \mathsf { D } \mathsf { P } )$ , which is linear to the number of [PATCH] tokens.
+
+Consequently, the complexity of RAM is much lower than the attention module used in YOLOS since $\mathsf { D } < < \mathsf { P }$ . Note that only RAM achieves the linear complexity to the patch tokens. In addition, one might argue that YOLOS can be efficient if the cross-attention is selectively removed similar to RAM. Even if we remove the complexity $\mathcal { O } ( d \mathsf { P } \mathsf { D } )$ for the global cross-attention, the computational complexity is $\mathcal { O } ( d ^ { 2 } ( \mathsf { P } + \mathsf { D } ) + d \mathsf { P } ^ { 2 } + d \mathsf { D } ^ { \bar { 2 } } )$ , which is still quadratic to the number of [PATCH] tokens.
+
+
Attention Type
YOLOS
ViDT
[PATCH] × [PATCH]
O(d²P +dP²)
O(d²P + dk²P)
[DET] × [DET]
O(d²D +dD²)
O(d²D + dD²)
[DET] × [PATCH]
O(dPD)
O(d²(D +P) + dDP)
Total Complexity
O(d²(P + D)+ d(P + D)²)
O(d²(D+P)+dk²P+dD²+dDP)
+
+Table 10. Summary of computational complexity for different attention operations used in YOLOS and ViDT (RAM), where $\mathsf { P }$ and D are the number of [PATCH] and [DET] tokens, respectively $( \mathsf { D } < < \mathsf { P }$ ).
+
+# A.2 ALGORITHMIC DESIGN FOR [DET] TOKENS
+
+# A.2.1 BINDING $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ AND [DET] $\times$ [PATCH] ATTENTION
+
+Binding the two attention modules is very simple in implementation. $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ and $\left[ \tt D E T \right] \times$ [PATCH] attention is generating a new [DET] token, which aggregates relevant contents in [DET] and [PATCH] tokens, respectively. Since the two attention share exactly the same [DET] query embedding obtained after the projection as shown in Figure 3, they can be processed at once by performing the scaled-dot product between $[ \tt D E T ] _ { Q }$ and $\left[ ^ { - } [ \mathsf { D E T } ] _ { K } , [ \mathsf { P A T C H } ] _ { K } \right]$ embeddings, where $Q , K$ are the key and query, and $[ \cdot ]$ is the concatenation. Then, the obtained attention map is applied to the ${ \left[ \ [ \mathsf { D E T } ] _ { V } , \mathsf { [ P A T C H ] } _ { V } \right] }$ embeddings, where $V$ is the value and $d$ is the embedding dimension,
+
+$$
+\mathsf { \Gamma } [ \mathsf { D E T } ] _ { n e w } = \mathsf { S o f t m a x } \Big ( \frac { \bigl [ \mathsf { D E T } \bigr ] _ { Q } \left[ \bigl [ \mathsf { D E T } \bigr ] _ { K } , \bigl [ \mathsf { P A T C H } \bigr ] _ { K } \right] ^ { \top } } { \sqrt { d } } \big ) \left[ \bigl [ \mathsf { D E T } \bigr ] _ { V } , \bigl [ \mathsf { P A T C H } \bigr ] _ { V } \right] .
+$$
+
+This approach is commonly used in the recent Transformer-based architectures, such as YOLOS.
+
+# A.2.2 EMBEDDING DIMENSION OF [DET] TOKENS
+
+$[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ attention is performed across all the stages, and the embedding dimension of [DET] tokens increases gradually like [PATCH] tokens. For the [PATCH] token, its embedding dimension is increased by concatenating nearby [PATCH] tokens in a grid. However, this mechanism is not applicable for [DET] tokens since we maintain the same number of [DET] tokens for detecting a fixed number of objects in a scene. Hence, we simply repeat a [DET] token multiple times along the embedding dimension to increase its size. This allows [DET] tokens to reuse all the projection and normalization layers in Swin Transformer without any modification.
+
+# B EXPERIMENTAL DETAILS
+
+# B.1 SWIN-NANO ARCHITECTURE
+
+Due to the absence of Swin models comparable to Deit-tiny, we configure Swin-nano, which is a $0 . 2 5 \times$ model of Swin-tiny such that it has 6M training parameters comparable to Deit-tiny. Table 11 summarizes the configuration of Swin Transformer models available, including the newly introduced Swinnano; S1–S4 indicates the four stages in Swin Transformer. The performance of all the pre-trained Swin
+
+
Model Name
Channel Dim.
Layer Numbers S2
Swin-nano
48
S1
S3 6
S4 2
Swin-tiny
96
6
Swin-small
128
18
Swin-base
192
2222
18
222
+
+Table 11. Swin Transformer Architecture.
+
+Transformer models are summarized in Table 1 in the manuscript.
+
+# B.2 DETECTION PIPELINES OF ALL COMPARED DETECTORS
+
+All the compared fully transformer-based detectors are composed of either (1) body–neck–head or (2) body–head structure, as summarized in Table 12. The main difference of ViDT is the use of reconfigured attention modules (RAM) for Swin Transformer, allowing the extraction of fine-grained detection features directly from the input image. Thus, Swin Transformer is extended to a standalone object detector called ViDT (w.o. Neck). Further, its extension to ViDT allows to use multi-scale features and multiple essential techniques for better detection, such as auxiliary decoding loss and iterative box refinement, by only maintaining a transformer decoder at the neck. Except for the two neck-free detector, YOLOS and ViDT (w.o. Neck), all the pipelines maintain multiple FFNs; that is, a single FFNs for each decoding layer at the neck for box regression and classification.
+
+We believe that our proposed RAM can be combined with even other latest efficient vision transformer architectures, such as PiT (Heo et al., 2021), PVT (Wang et al., 2021) and Cross-ViT (Chen et al., 2021). We leave this as future work.
+
+# B.3 HYPERPARAMETERS OF NECK TRANSFORMERS
+
+The transformer decoder at the neck in ViDT introduces multiple hyperparameters. We follow exactly the same setting used in Deformable DETR. Specifically, we use six layers of deformable transformers with width 256; thus, the channel dimension of the [PATCH] and [DET] tokens extracted from Swin Transformer are reduced to 256 to be utilized as compact inputs to the decoder transformer. For each transformer layer, multi-head attention with eight heads is applied, followed by the point-wise FFNs of 1024 hidden units. Furthermore, an additive dropout of 0.1 is applied before the layer normalization. All the weights in the decoder are initialized with Xavier initialization. For (Deformable) DETR, the tranformer decoder receives a fixed number of learnable detection tokens. We set the number of detection tokens to 100, which is the same number used for YOLOS and ViDT.
+
+
Pipeline Method Name
Body Feature Extractor
Neck Tran. Encoder Tran. Decoder
Head Prediction
DETR (DeiT) DETR (Swin)
DeiT Transformer Swin Transformer
8 8
Multiple FFNs
Deformable DETR (DeiT)
O+
Multiple FFNs
DeiT Transformer
O+
Multiple FFNs
Deformable DETR (Swin)
Swin Transformer
0+ 0
Multiple FFNs
YOLOS
DeiT Transformer
× ×
Single FFNs
ViDT(w.o. Neck)
Swin Transformer+RAM
× ×
Single FFNs
ViDT
Swin Transformer+RAM
× O+
Multiple FFNs
+
+Table 12. Comparison of detection pipelines for all available fully transformer-based object detectors, where $\dagger$ indicates that multi-scale deformable attention is used for neck transformers.
+
+# B.4 IMPLEMENTATION
+
+# B.4.1 DETECTION HEAD FOR PREDICTION
+
+The last [DET] tokens produced by the body or neck are fed to a 3-layer FFNs for bounding box regression and linear projection for classification,
+
+$$
+\hat { B } = \mathrm { F F N } _ { \mathrm { 3 - l a y e r } } \left( \mathrm { [ D E T ] } \right) \ \mathrm { a n d } \ \hat { P } = \mathrm { L i n e a r } \big ( \mathrm { [ D E T ] } \big ) .
+$$
+
+For box regression, the FFNs produce the bounding box coordinates for $d$ objects, $\hat { B } \in [ 0 , 1 ] ^ { d \times 4 }$ , that encodes the normalized box center coordinates along with its width and height. For classification, the linear projection uses a softmax function to produce the classification probabilities for all possible classes including the background class, $\hat { P } \in \mathsf { \bar { [ 0 , 1 ] } } ^ { d \times ( c + 1 ) }$ , where $c$ is the number of object classes. When deformable attention is used on the neck in Table 12, only $c$ classes are considered without the background class for classification. This is the original setting used in DETR, YOLOS (Carion et al., 2020; Fang et al., 2021) and Deformable DETR (Zhu et al., 2021).
+
+# B.4.2 LOSS FUNCTION FOR TRAINING
+
+All the methods adopts the loss function of (Deformable) DETR. Since the detection head return a fixed-size set of $d$ bounding boxes, where $d$ is usually larger than the number of actual objects in an image, Hungarian matching is used to find a bipartite matching between the predicted box $\hat { B }$ and the ground-truth box $B$ . In total, there are three types of training loss: a classification loss $\ell _ { c l } { } ^ { 5 }$ , a box distance $\ell _ { l _ { 1 } }$ , and a GIoU loss $\ell _ { i o u }$ (Rezatofighi et al., 2019),
+
+$$
+\begin{array} { r l } & { \ell _ { c l } ( i ) = - \log \hat { P } _ { \sigma ( i ) , c _ { i } } , \ell _ { \ell _ { 1 } } ( i ) = | | B _ { i } - \hat { B } _ { \sigma ( i ) } | | _ { 1 } , \mathrm { ~ a n d ~ } } \\ & { \ell _ { i o u } ( i ) = 1 - \big ( \frac { | B _ { i } \cap \hat { B } _ { \sigma ( i ) } | } { | B _ { i } \cup \hat { B } _ { \sigma ( i ) } | } - \frac { | \mathsf { B } ( B _ { i } , \hat { B } _ { \sigma ( i ) } ) \backslash B _ { i } \cup \hat { B } _ { \sigma ( i ) } | } { | \mathsf { B } ( B _ { i } , \hat { B } _ { \sigma ( i ) } ) | } \big ) , } \end{array}
+$$
+
+where $c _ { i }$ and $\sigma ( i )$ are the target class label and bipartite assignment of the $i$ -th ground-truth box, and $\textsf { B }$ returns the largest box containing two given boxes. Thus, the final loss of object detection is a linear combination of the three types of training loss,
+
+$$
+\ell = \lambda _ { c l } \ell _ { c l } + \lambda _ { \ell _ { 1 } } \ell _ { l _ { 1 } } + \lambda _ { i o u } \ell _ { i o u } .
+$$
+
+Table 13. Evaluations of ViDT with other detectors using CNN backbones on COCO2017 val set. FPS is measured with batch size 1 of $8 0 0 \times 1 3 3 3$ resolution on a single Tesla V100 GPU, where the value inside the parentheses is measured with batch size 4 of the same resolution to maximize GPU utilization.
+
+
Method
Backbone
Epochs
AP
AP50
AP75
APs
APM
APL
Param.
FPS
DETR
ResNet-50
500
42.0
62.4
44.2
20.5
45.8
61.1
41M
22.8 (38.6)
DETR-DC5
ResNet-50
500
43.3
63.1
45.9
22.5
47.3
61.1
41M
12.8 (14.2)
DETR-DC5
ResNet-50
50
35.3
55.7
36.8
15.2
37.5
53.6
41M
12.8 (14.2)
Deform.DETR
ResNet-50
50
45.4
64.7
49.0
26.8
48.3
61.7
40M
13.7 (19.4)
ViDT
Swin-tiny
50
44.8
64.5
48.7
25.9
47.6
62.1
38M
17.2 (26.5)
ViDT
Swin-tiny
150
47.2
66.7
51.4
28.4
50.2
64.7
38M
17.2 (26.5)
+
+
Method
Backbone
AP
AP50
AP75
APs
APM
APL
Param.
FPS
Deformable DETR - neck encoder
Swin-nano
43.1 34.0
61.4 52.8
46.3 35.6
25.9 18.0
45.2 36.3
59.4 48.4
17M 14M
7.0 22.4
YOLOS + neck decoder
DeiT-tiny
30.4 38.1
48.6 57.1
31.1 40.2
12.4 20.1
31.8 40.2
48.2 56.0
6M 14M
28.1 17.1
ViDT + neck encoder
Swin-nano
40.4 46.1
59.6 64.1
43.3 49.7
23.2 28.5
42.5 48.7
55.8 61.7
16M 19M
20.0 6.3
+
+Table 14. Variations of Deformable DETR, YOLOS, and ViDT with respect to their neck structure. They are trained for 50 epochs with the same configuration used in our main experimental results.
+
+The coefficient for each training loss is set to be $\lambda _ { c l } = 1$ , $\lambda _ { \ell _ { 1 } } = 5$ , and $\lambda _ { i o u } = 2$ . If we leverage auxiliary decoding loss, the final loss is computed for every detection head separately and merged with equal importance. Additionally, ViDT adds the distillation loss in Eq. (2) to the final loss if the distillation approach in Section 3.3 is enabled for training.
+
+# B.5 TRAINING CONFIGURATION
+
+We train ViDT for 50 epochs using AdamW (Loshchilov & Hutter, 2019) with the same initial learning rate of $1 0 ^ { - 4 }$ for its body, neck and head. The learning rate is decayed by cosine annealing with batch size of 16, weight decay of $1 \times 1 0 ^ { - 4 }$ , and gradient clipping of 0.1. In contrast, ViDT (w.o. Neck) is trained for 150 epochs using AdamW with the initial learning rate of $5 \times 1 0 ^ { - 5 }$ by cosine annealing. The remaining configuration is the same as for ViDT.
+
+Regarding DETR (ViT), we follow the setting of Deformable DETR. Thus, all the variants of this pipeline are trained for 50 epochs with the initial learning rate of $1 0 ^ { - 5 }$ for its pre-trained body (ViT backbone) and $1 0 ^ { - 4 }$ for its neck and head. Their learning rates are decayed at the 40-th epoch by a factor of 0.1. Meanwhile, the results of YOLOS are borrowed from the original paper (Fang et al., 2021) except YOLOS (DeiT-tiny); since the result of YOLOS (DeiT-tiny) for $8 0 0 \times 1 3 3 3$ is not reported in the paper, we train it by following the training configuration suggested by authors.
+
+# C SUPPLEMENTARY EVALUATION
+
+# C.1 COMPARISON WITH OBJECT DETECTOR USING CNN BACKBONE
+
+We compare ViDT with (Deformable) DETR using the ResNet-50 backbone, as summarized in Table 13, where all the results except ViDT are borrowed from (Carion et al., 2020; Zhu et al., 2021), and DETR-DC5 is a modification of DETR to use a dilated convolution at the last stage in ResNet. For a fair comparison, we compare ViDT (Swin-tiny) with similar parameter numbers. In general, ViDT shows a better trade-off between AP and FPS even compared with (Deformable) DETR with the ResNet-50. Specifically, ViDT achieves FPS much higher than DETR-DC5 and Deformable DETR with competitive AP. Particularly when training ViDT for 150 epochs, ViDT outperforms other compared methods using the ResNet-50 backbone in terms of both AP and FPS.
+
+# C.2 VARIATIONS OF EXISTING PIPELINES
+
+We study more variations of existing detection methods by modifying their original pipelines in Table 12. Thus, we remove the neck encoder of Deformable DETR to increase its efficiency, while adding a neck decoder to YOLOS to leverage multi-scale features along with auxiliary decoding loss and iterative box refinement. Note that these modified versions follow exactly the same detection pipeline with ViDT, maintaining a encoder-free neck between their body and head. Table 14 summarizes the performance of all the variations in terms of AP, FPS, and the number of parameters.
+
+
+Figure 4. Visualization of the attention map for cross-attention with ViDT (Swin-nano).
+
+Deformable DETR shows significant improvement in FPS $( + 1 4 . 4 )$ but its AP drops sharply $( - 9 . 1 )$ when its neck encoder is removed. Thus, it is difficult to obtain fine-grained object detection representation directly from the raw ViT backbone without using an additional neck encoder. However, ViDT compensates for the effect of the neck encoder by adding [DET] tokens into the body (backbone), thus successfully removing the computational bottleneck without compromising AP; it maintains 6.4 higher AP compared with the neck encoder-free Deformable DETR (the second row) while achieving similar FPS. This can be attributed to that RAM has a great contribution to the performance w.r.t AP and FPS, especially for the trade-off between them.
+
+YOLOS shows a significant gain in $\mathrm { A P } ( + 7 . 7 ) $ while losing FPS (−11.0) when the neck decoder is added. Unlike Deformable DETR, its AP significantly increases even without the neck encoder due to the use of a standalone object detector as its backbone (i.e., the modified DeiT in Figure 2(b)). However, its AP is lower than ViDT by 2.3AP. Even worse, it is not scalable for large models because of its quadratic computational cost for attention. Therefore, in the aspects of accuracy and speed, ViDT maintains its dominance compared with the two carefully tuned baselines.
+
+For a complete analysis, we additionally add a neck encoder to ViDT. The inference speed of ViDT degrades drastically by 13.7 because of the self-attention for multi-scale features at the neck encoder. However, it is interesting to see the improvement of AP by 5.7 while adding only 3M parameters; it is 3.0 higher even than Deformable DETR. This indicates that lowering the computational complexity of the encoder and thus increasing its utilization could be another possible direction for a fully transformer-based object detector.
+
+# C.3 $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ ATTENTION IN RAM
+
+In Section 4.2.2, it turns out that the cross-attention in RAM is only necessary at the last stage of Swin Transformer; all the different selective strategies show similar AP as long as cross-attention is activated at the last stage. Hence, we analyze the attention map obtained by the cross-attention in RAM. Figure 4 shows attention maps for the stages of Swin Transformer where cross-attention is utilized; it contrasts (a) ViDT with cross-attention at all stages and (b) ViDT with cross-attention at the last stage. Regardless of the use of cross-attention at the lower stage, it is noteworthy that the finally obtained attention map at the last stage is almost the same. In particular, the attention map at Stage 1–3 does not properly focus the features on the target object, which is framed by the bounding box. In addition, the attention weights (color intensity) at Stage 1–3 are much lower than those at Stage 4. Since features are extracted from a low level to a high level in a bottom-up manner as they go through the stages, it seems difficult to directly get information about the target object with such low-level features at the lower level of stages. Therefore, this analysis provides strong empirical evidence for the use of selective $\mathrm { [ D E T ] } \times \mathrm { [ P A T H ] }$ cross-attention.
+
+# C.4 $[ \mathrm { D E T } ] \times [ \mathrm { D E T } ]$ ATTENTION IN RAM
+
+Another possible consideration for ViDT is the use of $\left[ { \tt D E T } \right] ^ { - } \times \ \left[ { \tt D E T } \right]$ self-attention in RAM. We conduct an ablation study by removing the $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ attention one by one from the bottom stage, and summarize the results in Table 15. When all the $[ \mathrm { D E T } ] \times [ \mathrm { D E T } ]$ self-attention are removed, (5) the AP drops by 0.7, which is a meaningful performance degradation. On the other hand, as long as the selfattention is activated at the last two stages, (1) – (3) all the strategies exhibit similar AP. Therefore, only keeping $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ self-attention at the last two stages can further increase FPS $\left( + 0 . 2 \right)$ without degradation in AP. This observation could be used as another design choice for the AP and FPS trade-off. Therefore, we believe that $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ self-attention is meaningful to use in RAM.
+
+Table 15. AP and FPS comparison with different $[ \tt D E T ] \times [ \tt D E T ]$ self-attention strategies with ViDT.
+
+
#
Stage Id
Swin-nano
1
2
3 4
AP
FPS
(1)
√
√
√ √
40.4
20.0
(2)
√ √
?
40.3
20.1
(3)
1
40.4
20.2
(4)
厂
40.1
20.3
(5)
39.7
20.4
+
+# D PRELIMINARIES: TRANSFORMERS
+
+A transformer is a deep model that entirely relies on the self-attention mechanism for machine translation (Vaswani et al., 2017). In this section, we briefly revisit the standard form of the transformer.
+
+Single-head Attention. The basic building block of the transformer is a self-attention module, which generates a weighted sum of the values (contents), where the weight assigned to each value is the attention score computed by the scaled dot-product between its query and key. Let $W _ { Q }$ , $W _ { K }$ , and $W _ { V }$ be the learned projection matrices of the attention module, and then the output is generated by
+
+$$
+\operatorname { A t t e n t i o n } ( Z ) = \operatorname { s o f t m a x } \Bigl ( \frac { ( Z W _ { Q } ) ( Z W _ { K } ) ^ { \top } } { \sqrt { d } } \Bigr ) ( Z W _ { V } ) \in \mathbb { R } ^ { h w \times d } ,
+$$
+
+Multi-head Attention. It is beneficial to maintain multiple heads such that they repeat the linear projection process $k$ times with different learned projection matrices. Let $W _ { Q _ { i } }$ , $W _ { K _ { i } }$ , and $W _ { V _ { i } }$ be the learned projection matrices of the $i$ -th attention head. Then, the output is generated by the concatenation of the results from all heads,
+
+$$
+\begin{array} { r l } & { \mathbf { M u l t i - H e a d } ( Z ) = [ \mathbf { A t t e n t i o n } _ { 1 } ( Z ) , \mathbf { A t t e n t i o n } _ { 2 } ( Z ) , \dots , \mathbf { A t t e n t i o n } _ { k } ( Z ) ] \in \mathbb { R } ^ { h w \times d } , } \\ & { \qquad \mathrm { w h e r e } ~ \forall _ { i } W _ { Q _ { i } } , W _ { K _ { i } } , W _ { V _ { i } } \in \mathbb { R } ^ { d \times ( d / k ) } . } \end{array}
+$$
+
+Typically, the dimension of each head is divided by the total number of heads.
+
+Feed-Forward Networks (FFNs). The output of the multi-head attention is fed to the point-wise FFNs, which performs the linear transformation for each position separately and identically to allow the model focusing on the contents of different representation subspaces. Here, the residual connec
+
+tion and layer normalization are applied before and after the FFNs. The final output is generated by
+
+where $H ^ { \prime } = \mathrm { F F N } ( H ^ { \prime \prime } )$ $\begin{array} { r } { \begin{array} { r l } & { H = \mathrm { L a y e r N o r m } ( \mathrm { D r o p o u t } ( H ^ { \prime } ) + H ^ { \prime \prime } ) , } \\ & { H ^ { \prime \prime } ) \mathrm { a n d } H ^ { \prime \prime } = \mathrm { L a y e r N o r m } ( \mathrm { D r o p o u t } ( \mathrm { M u l t i \mathrm { - } H e a d } ( Z ) ) + Z ) . } \end{array} } \end{array}$
+
+Multi-Layer Transformers. The output of a previous layer is fed directly to the input of the next layer. Regarding the positional encoding, the same value is added to the input of each attention module for all layers.
\ No newline at end of file
diff --git a/md/dev/w6fj2r62r_H/w6fj2r62r_H.md b/md/dev/w6fj2r62r_H/w6fj2r62r_H.md
new file mode 100644
index 0000000000000000000000000000000000000000..cef069137e5d4b4e355c7ab79d84bc7472adc425
--- /dev/null
+++ b/md/dev/w6fj2r62r_H/w6fj2r62r_H.md
@@ -0,0 +1,377 @@
+# Torsional Diffusion for Molecular Conformer Generation
+
+Bowen Jing,∗ 1 Gabriele Corso,∗ 1 Jeffrey Chang,2 Regina Barzilay,1 Tommi Jaakkola1 1CSAIL, Massachusetts Institute of Technology 2Dept. of Physics, Harvard University
+
+# Abstract
+
+Molecular conformer generation is a fundamental task in computational chemistry. Several machine learning approaches have been developed, but none have outperformed state-of-the-art cheminformatics methods. We propose torsional diffusion, a novel diffusion framework that operates on the space of torsion angles via a diffusion process on the hypertorus and an extrinsic-to-intrinsic score model. On a standard benchmark of drug-like molecules, torsional diffusion generates superior conformer ensembles compared to machine learning and cheminformatics methods in terms of both RMSD and chemical properties, and is orders of magnitude faster than previous diffusion-based models. Moreover, our model provides exact likelihoods, which we employ to build the first generalizable Boltzmann generator. Code is available at https://github.com/gcorso/torsional-diffusion.
+
+# 1 Introduction
+
+Many properties of a molecule are determined by the set of low-energy structures, called conformers, that it adopts in 3D space. Conformer generation is therefore a fundamental problem in computational chemistry [Hawkins, 2017] and an area of increasing attention in machine learning. Traditional approaches to conformer generation consist of metadynamics-based methods, which are accurate but slow [Pracht et al., 2020]; and cheminformatics-based methods, which are fast but less accurate [Hawkins et al., 2010, Riniker and Landrum, 2015]. Thus, there is growing interest in developing deep generative models to combine high accuracy with fast sampling.
+
+Diffusion or score-based generative models [Ho et al., 2020, Song et al., 2021]—a promising class of generative models—have been applied to conformer generation under several different formulations. These have so far considered diffusion processes in Euclidean space, in which Gaussian noise is injected independently into every data coordinate—either pairwise distances in a distance matrix [Shi et al., 2021, Luo et al., 2021] or atomic coordinates in 3D [Xu et al., 2022]. However, these models require a large number of denoising steps and have so far failed to outperform the best cheminformatics methods.
+
+We instead propose torsional diffusion, in which the diffusion process over conformers acts only on the torsion angles and leaves the other degrees of freedom fixed. This is possible and effective because the flexibility of a molecule, and thus the difficulty of conformer generation, lies largely in torsional degrees of freedom [Axelrod and Gómez-Bombarelli, 2022]; in particular, bond lengths and angles can already be determined quickly and accurately by standard cheminformatics methods. Leveraging this insight significantly reduces the dimensionality of the sample space; drug-like molecules2 have, on average, $n = 4 4$ atoms, corresponding to a $3 n$ -dimensional Euclidean space, but only $m = 7 . 9$ torsion angles of rotatable bonds.
+
+
+Figure 1: Overview of torsional diffusion. Left: Extrinsic and intrinsic views of torsional diffusion (only 2 dimensions/bonds shown). Right: In a step of reverse diffusion (A), the current conformer is provided as a 3D structure $\mathbf { ( B ) }$ to the score model, which predicts intrinsic torsional updates (C). The final layer of the score model is constructed to resemble a torque computation around each bond $\mathbf { \eta } ^ { ( \mathbf { D } ) }$ . $Y$ refers to the spherical harmonics and $V _ { b }$ the learned atomic embeddings.
+
+Torsion angle coordinates define not a Euclidean space, but rather an $m$ -dimensional torus $\mathbb { T } ^ { m }$ (Figure 1, left). However, the dimensionality and distribution over the torus vary between molecules and even between different ways of defining the torsional space for the same molecule. To resolve these difficulties, we develop an extrinsic-to-intrinsic score model (Figure 1, right) that takes as input a 3D point cloud representation of the conformer in Euclidean space (extrinsic coordinates), and predicts as output a score on a torsional space specific to that molecule (intrinsic coordinates). To do so, we consider a torsional score for a bond as a geometric property of a 3D point cloud, and use $S E ( 3 )$ -equivariant networks to predict them directly for each bond.
+
+Unlike prior work, our model provides exact likelihoods of generated conformers, enabling training with the ground-truth energy function rather than samples alone. This connects with the literature on Boltzmann generators—generative models which aim to sample the Boltzmann distribution of physical systems without expensive molecular dynamics or MCMC simulations [Noé et al., 2019, Köhler et al., 2021]. Thus, as a variation on the torsional diffusion framework, we develop torsional Boltzmann generators that can approximately sample the conditional Boltzmann distribution for unseen molecules. This starkly contrasts with existing Boltzmann generators, which are specific for the chemical system on which they are trained.
+
+Our main contributions are:
+
+• We formulate conformer generation in terms of diffusion modeling on the hypertorus— the first demonstration of non-Euclidean diffusion on complex datasets—and develop an extrinsic-to-intrinsic score model that satisfies the required symmetries: $S E ( 3 )$ invariance, torsion definition invariance, and parity equivariance.
+• We obtain state-of-the-art results on the GEOM-DRUGS dataset [Axelrod and GómezBombarelli, 2022] and are the first method to consistently outperform the established commercial software OMEGA [Hawkins, 2017]. We do so using two orders of magnitude fewer denoising steps than GeoDiff [Xu et al., 2022], the best Euclidean diffusion approach.
+• We propose torsional Boltzmann generators—the first Boltzmann generator based on diffusion models rather than normalizing flows and the first to be useful for a class of molecules rather than a specific system.
+
+# 2 Background
+
+Diffusion generative models Consider the data distribution as the starting distribution $p _ { 0 } ( \mathbf { x } )$ of a forward diffusion process described by an Ito stochastic differential equation (SDE):
+
+$$
+d \mathbf { x } = \mathbf { f } ( \mathbf { x } , t ) ~ d t + g ( t ) ~ d \mathbf { w } , ~ t \in ( 0 , T )
+$$
+
+where w is the Wiener process and $\mathbf { f } ( \mathbf { x } , t ) , g ( t )$ are chosen functions. With sufficiently large $T$ , the distribution $p _ { T } ( \mathbf { x } )$ —the prior—approaches a simple Gaussian. Sampling from the prior and solving the reverse diffusion
+
+$$
+d \mathbf { x } = \left[ \mathbf { f } ( \mathbf { x } _ { t } , t ) - g ^ { 2 } ( t ) \nabla _ { \mathbf { x } } \log p _ { t } ( \mathbf { x } ) \right] ~ d t + g ( t ) ~ d \mathbf { \bar { w } }
+$$
+
+yields samples from the data distribution $p _ { 0 } ( \mathbf { x } )$ [Anderson, 1982, Song et al., 2021]. Diffusion, or score-based, generative models $[ \mathrm { H o }$ et al., 2020, Song et al., 2021] learn the score $\nabla _ { \mathbf { x } } \log p _ { t } ( \mathbf { x } )$ of the diffused data with a neural network and generate data by approximately solving the reverse diffusion. The score of the diffused data also defines a probability flow ODE—a continuous normalizing flow that deterministically transforms the prior into the data distribution [Song et al., 2021]. We leverage the insight that, in many cases, this flow makes it possible to use diffusion models in place of normalizing flows and highlight one such case with the torsional Boltzmann generator.
+
+Diffusion generative models have traditionally been used to model data on Euclidean spaces (such as images); however, De Bortoli et al. [2022] recently showed that the theoretical framework holds with relatively few modifications for data distributions on compact Riemannian manifolds. The hypertorus $\mathbb { T } ^ { m }$ , which we use to define torsional diffusion, is a specific case of such a manifold.
+
+Several methods [Salimans and Ho, 2022, Vahdat et al., 2021, Nichol and Dhariwal, 2021] have been proposed to improve and accelerate diffusion models in the domain of image generation. Among these, the most relevant to this work is subspace diffusion [Jing et al., 2022], in which the diffusion is progressively restricted to linear subspaces. Torsional diffusion can be viewed in a similar spirit, as it effectively restricts Euclidean diffusion to a nonlinear manifold given by fixing the non-torsional degrees of freedom.
+
+Molecular conformer generation The conformers of a molecule are the set of its energetically favorable 3D structures, corresponding to local minima of the potential energy surface.3 The gold standards for conformer generation are metadynamics-based methods such as CREST [Pracht et al., 2020], which explore the potential energy surface while filling in local minima [Hawkins, 2017]. However, these require an average of 90 core-hours per drug-like molecule [Axelrod and GómezBombarelli, 2022] and are not considered suitable for high-throughput applications. Cheminformatics methods instead leverage approximations from chemical heuristics, rules, and databases for significantly faster generation [Lagorce et al., 2009, Cole et al., 2018, Miteva et al., 2010, Bolton et al., 2011, Li et al., 2007]; while these can readily model highly constrained degrees of freedom, they fail to capture the full energy landscape. The most well-regarded of such methods include the commercial software OMEGA [Hawkins et al., 2010] and the open-source RDKit ETKDG [Landrum et al., 2013, Riniker and Landrum, 2015].
+
+A number of machine learning methods for conformer generation has been developed [Xu et al., 2021a,b, Shi et al., 2021, Luo et al., 2021], the most recent and advanced of which are GeoMol [Ganea et al., 2021] and GeoDiff $[ \mathrm { X u }$ et al., 2022]. GeoDiff is a Euclidean diffusion model that treats conformers as point clouds $\mathbf { x } \in \mathbb { R } ^ { 3 n }$ and learns an $S E ( 3 )$ equivariant score. On the other hand, GeoMol employs a graph neural network that, in a single forward pass, predicts neighboring atomic coordinates and torsion angles from a stochastic seed.
+
+Boltzmann generators An important problem in physics and chemistry is that of generating independent samples from a Boltzmann distribution $p ( \mathbf { \bar { x } } ) \mathbf { \Psi } \stackrel { \mathbf { \bar { \mathbf { \Lambda } } } } { \propto } e ^ { - E ( \mathbf { x } ) / k T }$ with known but unnormalized density.4 Generative models with exact likelihoods, such as normalizing flows, can be trained to match such densities [Noé et al., 2019] and thus provide independent samples from an approximation of the target distribution. Such Boltzmann generators have shown high fidelity on small organic molecules [Köhler et al., 2021] and utility on systems as large as proteins [Noé et al., 2019]. However, a separate model has to be trained for every molecule, as the normalizing flows operate on intrinsic coordinates whose definitions are specific to that molecule. This limits the utility of existing Boltzmann generators for molecular screening applications.
+
+# 3 Torsional Diffusion
+
+Consider a molecule as a graph $G = ( \nu , \mathcal { E } )$ with atoms $v \in \mathcal V$ and bonds $e \in { \mathcal { E } }$ ,5 and denote the space of its possible conformers $\mathcal { C } _ { G }$ . A conformer $C \in { \mathcal { C } } _ { G }$ can be specified in terms of its intrinsic (or internal) coordinates: local structures $L$ consisting of bond lengths, bond angles, and cycle conformations; and torsion angles $\tau$ consisting of dihedral angles around freely rotatable bonds (precise definitions in Appendix A). We consider a bond freely rotatable if severing the bond creates two connected components of $G$ , each of which has at least two atoms.6 Thus, torsion angles in cycles (or rings), which cannot be rotated independently, are considered part of the local structure $L$ .
+
+Conformer generation consists of learning probability distributions $p _ { G } ( L , \tau )$ . However, the set of possible stable local structures $L$ for a particular molecule is very constrained and can be accurately predicted by fast cheminformatics methods, such as RDKit ETKDG [Riniker and Landrum, 2015] (see Appendix F.1 for verification). Thus, we use RDKit to provide approximate samples from $p _ { G } ( L )$ , and develop a diffusion-based generative model to learn distributions $p _ { G } ( \tau \mid L )$ over torsion angles—conditioned on a given graph and local structure.
+
+Our method is illustrated in Figure 1 and detailed as follows. Section 3.1 formulates diffusion modeling on the torus defined by torsion angles. Section 3.2 describes the torsional score framework, Section 3.3 the required symmetries, and Section 3.4 our score model architecture. Section 3.5 discusses likelihoods, and Section 3.6 how likelihoods can be used for energy-based training.
+
+# 3.1 Diffusion modeling on $\mathbb { T } ^ { m }$
+
+Since each torsion angle coordinate lies in $[ 0 , 2 \pi )$ , the $m$ torsion angles of a conformer define a hypertorus $\mathbb { T } ^ { m }$ . To learn a generative model over this space, we apply the continuous score-based framework of Song et al. [2021], which holds with minor modifications for data distributions on compact Riemannian manifolds (such as $\mathbb { T } ^ { m }$ ) [De Bortoli et al., 2022]. Specifically, for Riemannian manifold $M$ let $\mathbf { x } \in M$ , let w be the Brownian motion on the manifold, and let the drift $\mathbf { \boldsymbol { \mathfrak { f } } } ( \mathbf { \boldsymbol { x } } , t )$ , score $\nabla _ { \mathbf { x } } \log p _ { t } ( \mathbf { x } )$ , and score model output $\mathbf { s } ( \mathbf { x } , t )$ be elements of the tangent space $T _ { \mathbf { x } } M$ . Then equation 2 remains valid—that is, discretizing and solving the reverse SDE on the manifold as a geodesic random walk starting with samples from $p _ { T } ( \mathbf { x } )$ approximately recovers the original data distribution $p _ { 0 } ( \mathbf { x } )$ [De Bortoli et al., 2022].
+
+For the forward diffusion we use rescaled Brownian motion given by $\begin{array} { r } { \mathbf { f } ( \mathbf { x } , t ) = 0 , g ( t ) = \sqrt { \frac { d } { d t } \sigma ^ { 2 } ( t ) } } \end{array}$ where $\sigma ( t )$ is the noise scale. Specifically, we use an exponential diffusion $\sigma ( t ) = \sigma _ { \operatorname* { m i n } } ^ { 1 - t } \sigma _ { \operatorname* { m a x } } ^ { t }$ as in Song and Ermon [2019], with $\sigma _ { \mathrm { m i n } } = 0 . 0 1 \pi$ , $\sigma _ { \operatorname* { m a x } } = \pi , t \in ( 0 , 1 )$ . Due to the compactness of the manifold, however, the prior $p _ { T } ( \mathbf { x } )$ is no longer a Gaussian, but a uniform distribution over $M$ .
+
+Training the score model with denoising score matching requires a procedure to sample from the perturbation kernel $p _ { t | 0 } ( \mathbf { x } ^ { \prime } \mid \mathbf { x } )$ of the forward diffusion and compute its score. We view the torus $\mathbb { T } ^ { m } \cong [ 0 , 2 \pi ) ^ { m }$ as the quotient space $\mathbb { R } ^ { m } / 2 \pi \mathbb { Z } ^ { m }$ with equivalence relations $( \tau _ { 1 } , \dots \tau _ { m } ) \sim$ $( \tau _ { 1 } + 2 \pi , \ldots , \tau _ { m } ) \ldots \sim ( \tau _ { 1 } , \ldots \tau _ { m } + 2 \pi )$ . Hence, the perturbation kernel for rescaled Brownian motion on $\mathbb { T } ^ { m }$ is the wrapped normal distribution on $\mathbb { R } ^ { m }$ ; that is, for any $\tau , \tau ^ { \prime } \in [ 0 , 2 \pi ) ^ { m }$ , we have
+
+$$
+p _ { t | 0 } ( \pmb { \tau } ^ { \prime } \mid \pmb { \tau } ) \propto \sum _ { \mathbf { d } \in \mathbb { Z } ^ { m } } \exp \left( - \frac { | | \pmb { \tau } - \pmb { \tau } ^ { \prime } + 2 \pi \mathbf { d } | | ^ { 2 } } { 2 \sigma ^ { 2 } ( t ) } \right)
+$$
+
+where $\sigma ( t )$ is the noise scale of the perturbation kernel $p _ { t | 0 }$ . We thus sample from the perturbation kernel by sampling from the corresponding unwrapped isotropic normal and taking elementwise mod $2 \pi$ . The scores of the kernel are pre-computed using a numerical approximation. During training, we sample times $t$ at uniform and minimize the denoising score matching loss
+
+$$
+J _ { \mathrm { D S M } } ( \theta ) = \mathbb { E } _ { t } \left[ \lambda ( t ) \mathbb { E } _ { \tau _ { 0 } \sim p _ { 0 } , \tau _ { t } \sim p _ { t | 0 } ( \cdot | \tau _ { 0 } ) } \left[ | | \mathbf { s } ( \tau _ { t } , t ) - \nabla _ { \tau _ { t } } \log p _ { t | 0 } ( \tau _ { t } \mid \tau _ { 0 } ) | | ^ { 2 } \right] \right]
+$$
+
+where the weight factors $\lambda ( t ) = 1 / \mathbb { E } _ { \pmb { \tau } \sim p _ { t | 0 } ( \cdot | 0 ) } \left[ | | \nabla _ { \pmb { \tau } } \log p _ { t | 0 } ( \pmb { \tau } \mid \mathbf { 0 } ) | | ^ { 2 } \right]$ are also precomputed. As the tangent space $T _ { \tau } \mathbb { T } ^ { m }$ is just $\mathbb { R } ^ { m }$ , all the operations in the loss computation are the familiar ones.
+
+For inference, we first sample from a uniform prior over the torus. We then discretize and solve the reverse diffusion with a geodesic random walk; however, since the exponential map on the torus (viewed as a quotient space) is just $\exp _ { \tau } ( \delta ) = \tau + \delta$ mod $2 \pi$ , the geodesic random walk is equivalent to the wrapping of the random walk on $\mathbb { R } ^ { m }$ .
+
+# 3.2 Torsional score framework
+
+While we have defined the diffusion process over intrinsic coordinates, learning a score model $\mathbf { s } ( \tau , t )$ directly over intrinsic coordinates is potentially problematic for several reasons. First, the dimensionality $m$ of the torsional space depends on the molecular graph $G$ . Second, the mapping from torsional space to physically distinct conformers depends on $G$ and local structures $L$ , but it is unclear how to best provide these to a model over $\mathbb { T } ^ { m }$ . Third, there is no canonical choice of independent intrinsic coordinates $( L , \tau )$ ; in particular, the torsion angle at a rotatable bond can be defined as any of the dihedral angles at that bond, depending on an arbitrary choice of reference neighbors (Figure 2 and Appendix A). Thus, even with fixed $G$ and $L$ , the mapping from $\mathbb { T } ^ { m }$ to conformers is ill-defined. This posed a significant challenge to prior works using intrinsic coordinates [Ganea et al., 2021].
+
+To circumvent these difficulties, we instead consider a conformer $C \in { \mathcal { C } } _ { G }$ in terms of its extrinsic (or Cartesian) coordinates—that is, as a point cloud in 3D space, defined up to global roto-translation: $\mathcal { C } _ { G } \triangleq \mathbb { R } ^ { 3 n } / S E ( 3 )$ . Then, we construct the score model ${ \bf s } _ { G } ( C , t )$ as a function over $\mathcal { C } _ { G }$ rather than $\mathbb { T } ^ { m }$ . The outputs remain in the tangent space of $\mathbb { T } ^ { m }$ , which is just $\mathbb { R } ^ { m }$ . Such a score model is simply an $S E ( 3 )$ -invariant model over point clouds in 3D space $\mathbf { s } _ { G } : \mathbb { R } ^ { 3 n } \times [ 0 , T ] \mapsto \mathbb { R } ^ { m }$ conditioned on $G$ . Thus, we have reduced the problem of learning a score on the torus, conditioned on the molecular graph and local structure, to the much more familiar problem of predicting $S E ( 3 )$ -invariant scalar quantities—one for each bond—from a 3D conformer.
+
+
+Figure 2: A: The torsion $\tau$ around a bond depends on a choice of neighbors. B: The change $\Delta \tau$ caused by a relative rotation is the same for all choices. C: The sign of $\Delta \tau$ is unambiguous because given the same neighbors, $\tau$ does not depend on bond direction.
+
+It may appear that we still need to choose a definition of each torsion angle $\tau _ { i }$ so that we can sample from $p _ { t | 0 } ( \cdot | \tau )$ during training and solve the reverse SDE over $\tau$ during inference. However, we leverage the following insight: given fixed local structures, the action on $C$ of changing a single torsion angle $\tau _ { i }$ by some $\Delta \tau _ { i }$ can be applied without choosing a definition (Figure 2). Geometrically, this action is a (signed) relative rotation of the atoms on opposite sides of the bond and can be applied directly to the atomic coordinates in 3D. The geometric intuition can be stated as follows (proven in Appendix B and discussed further in Appendix F.2).
+
+Proposition 1. Let $( b _ { i } , c _ { i } )$ be a rotatable bond, let $\mathbf { x } _ { \mathcal { V } ( b _ { i } ) }$ be the positions of atoms on the $b _ { i }$ side of the molecule, and let $R ( \pmb \theta , x _ { c _ { i } } ) \in S E ( 3 )$ be the rotation by Euler vector $\pmb \theta$ about $x _ { c _ { i } }$ . Then for $C , C ^ { \prime } \in { \mathcal { C } } _ { G }$ , if $\tau _ { i }$ is any definition of the torsion angle around bond $( b _ { i } , c _ { i } )$ ,
+
+$$
+\begin{array} { r l } & { \tau _ { i } ( C ^ { \prime } ) = \tau _ { i } ( C ) + \theta } \\ & { \tau _ { j } ( C ^ { \prime } ) = \tau _ { j } ( C ) \quad \forall j \neq i } \end{array} \quad \begin{array} { r l } & { i f \quad \quad \exists \mathbf { x } \in C , \mathbf { x } ^ { \prime } \in C ^ { \prime } . } \\ & { \mathbf { x } ^ { \prime } \in \ l _ { \ l } ( c _ { i } ) = R \left( \theta \hat { \mathbf { r } } _ { b _ { i } c _ { i } } , x _ { c _ { i } } \right) \mathbf { x } _ { \mathcal { V } ( c _ { i } ) } } \end{array}
+$$
+
+where $\hat { \bf r } _ { b _ { i } c _ { i } } = ( x _ { c _ { i } } - x _ { b _ { i } } ) / \vert \vert x _ { c _ { i } } - x _ { b _ { i } } \vert \vert .$
+
+To apply a torsion update $\Delta \tau = \left( \Delta \tau _ { 1 } , \dots \Delta \tau _ { m } \right)$ involving all bonds, we apply $\Delta \tau _ { i }$ sequentially in any order. Then, since training and inference only make use of torsion updates $\Delta \tau$ , we work solely in terms of 3D point clouds and updates applied to them. To draw local structures $L$ from RDKit, we draw full 3D conformers $C \in { \mathcal { C } } _ { G }$ and then randomize all torsion angles to sample uniformly over $\mathbb { T } ^ { m }$ . To solve the reverse SDE, we repeatedly predict torsion updates directly from, and apply them directly to, the 3D point cloud. Therefore, since our method never requires a choice of reference neighbors for any $\tau _ { i }$ , it is manifestly invariant to such a choice. These procedures are detailed in Appendix C.
+
+# 3.3 Parity equivariance
+
+The torsional score framework presented thus far requires an $S E ( 3 )$ -invariant model. However, an additional symmetry requirement arises from the fact that the underlying physical energy is invariant, or extremely nearly so, under parity inversion [Quack, 2002]. Thus our learned density should respect $p ( C ) = p ( { \bar { - } } C )$ where $- C \stackrel { - } { = } \{ - { \bf x } | { \bf x } \in C \}$ . In terms of the conditional distribution over torsion angles, we require $p ( \pmb { \tau } ( C ) \mid L ( \overline { { C } } ) ) = p ( \pmb { \tau } ( \overline { { - C } } ) \mid L ( - C ) )$ . Then,
+
+Proposition 2. I $^ { \prime } p ( \pmb { \tau } ( C ) \mid L ( C ) ) = p ( \pmb { \tau } ( - C ) \mid L ( - C ) )$ , then for all diffusion times $t$
+
+$$
+\nabla _ { \tau } \log { p _ { t } ( \tau ( C ) \mid L ( C ) ) } = - \nabla _ { \tau } \log { p _ { t } ( \tau ( - C ) \mid L ( - C ) ) }
+$$
+
+Because the score model seeks to learn $\mathbf { s } _ { G } ( C , t ) ~ = ~ \nabla _ { \pmb { \tau } } \log p _ { t } ( \pmb { \tau } ( C ) ~ | ~ L ( C ) )$ , we must have ${ \bf s } _ { G } ( C , t ) = - { \bf s } _ { G } ( - C , t )$ . Thus, the score model must be invariant under $S E ( 3 )$ but equivariant (change sign) under parity inversion of the input point cloud— i.e. it must output a set of pseudoscalars in $\mathbb { R } ^ { m }$ .
+
+# 3.4 Score network architecture
+
+Based on sections 3.2 and 3.3, the desiderata for the score model are:
+
+Predict a pseudoscalar $\delta \tau _ { i } : = \partial \log p / \partial \tau _ { i } \in \mathbb { R }$ that is $S E ( 3 )$ -invariant and parity equivariant for every rotatable bond in a $3 D$ point cloud representation of a conformer.
+
+While there exist several GNN architectures which are $S E ( 3 )$ -equivariant [Jing et al., 2021, Satorras et al., 2021], their $S E ( 3 )$ -invariant outputs are also parity invariant and, therefore, cannot satisfy the desired symmetry. Instead, we leverage the ability of equivariant networks based on tensor products [Thomas et al., 2018, Geiger et al., 2022] to produce pseudoscalar outputs.
+
+Our architecture, detailed in Appendix D, consists of an embedding layer, a series of atomic convolution layers, and a final bond convolution layer. The first two closely follow the architecture of Tensor Field Networks [Thomas et al., 2018], and produce learned feature vectors for each atom. The final bond convolution layer constructs tensor product filters spatially centered on every rotatable bond and aggregates messages from neighboring atom features. We extract the pseudoscalar outputs of this filter to produce a single real-valued pseudoscalar prediction $\delta \tau _ { i }$ for each rotatable bond.
+
+Naively, the bond convolution layer could be constructed the same way as the atomic convolution layers, i.e., with spherical harmonic filters. However, to supply information about the orientation of the bond about which the torsion occurs, we construct a filter from the product of the spherical harmonics with a representation of the bond (Figure 1D). Because the convolution conceptually resembles computing the torque, we call this final layer the pseudotorque layer.
+
+# 3.5 Likelihood
+
+By using the probability flow ODE, we can compute the likelihood of any sample $\tau$ as follows [Song et al., 2021, De Bortoli et al., 2022]:
+
+$$
+\log p _ { 0 } ( \tau _ { 0 } ) = \log p _ { T } ( \tau _ { T } ) - \frac { 1 } { 2 } \int _ { 0 } ^ { T } g ^ { 2 } ( t ) \ \nabla _ { \tau } \cdot \mathbf { s } _ { G } ( \tau _ { t } , t ) \ d t
+$$
+
+In Song et al. [2021], the divergence term is approximated via Hutchinson’s method [Hutchinson, 1989], which gives an unbiased estimate of $\log p _ { 0 } ( \tau )$ . However, this gives a biased estimate of $p _ { 0 } ( \tau )$ , which is unsuitable for our applications. Thus, we compute the divergence term directly, which is feasible here (unlike in Euclidean diffusion) due to the reduced dimensionality of the torsional space.
+
+The above likelihood is in torsional space $p _ { G } ( \tau \mid L ) , \tau \in \mathbb { T } ^ { m }$ , but to enable compatibility with the Boltzmann measure $e ^ { - E ( \mathbf { x } ) / k T }$ , it is desirable to interconvert this with a likelihood in Euclidean space $p ( \mathbf { x } \mid L ) , \mathbf { x } \in \mathbb { R } ^ { 3 n }$ . A factor is necessary to convert between the volume element in torsional space and in Euclidean space (full derivation in Appendix B):
+
+Proposition 3. Let $\mathbf { x } \in C ( \tau , L )$ be a centered7 conformer in Euclidean space. Then,
+
+$$
+p _ { G } ( \mathbf { x } \mid L ) = { \frac { p _ { G } ( \tau \mid L ) } { 8 \pi ^ { 2 } { \sqrt { \operatorname* { d e t } g } } \quad { \mathrm { w h e r e } } \ g _ { \alpha \beta } = \sum _ { k = 1 } ^ { n } J _ { \alpha } ^ { ( k ) } \cdot J _ { \beta } ^ { ( k ) } } }
+$$
+
+7Additional formalism is needed for translations, but it is independent of the conformer and can be ignored.
+
+where the indices $\alpha , \beta$ are integers between $^ { l }$ and $m + 3 .$ . For $1 \leq \alpha \leq m$ , $J _ { \alpha } ^ { ( k ) }$ is defined as
+
+$$
+J _ { i } ^ { ( k ) } = \tilde { J } _ { i } ^ { ( k ) } - \frac { 1 } { n } \sum _ { \ell = 1 } ^ { n } \tilde { J } _ { i } ^ { ( \ell ) } \quad \mathrm { w i t h } ~ \tilde { J } _ { i } ^ { ( \ell ) } = \left\{ \begin{array} { l l } { 0 } & { \ell \in \mathcal { V } ( b _ { i } ) , } \\ { \frac { \mathbf { x } _ { b _ { i } } - \mathbf { x } _ { c _ { i } } } { | | \mathbf { x } _ { b _ { i } } - \mathbf { x } _ { c _ { i } } | | } \times ( \mathbf { x } _ { \ell } - \mathbf { x } _ { c _ { i } } ) , } & { \ell \in \mathcal { V } ( c _ { i } ) , } \end{array} \right.
+$$
+
+and for $\alpha \in \{ m + 1 , m + 2 , m + 3 \}$ as
+
+$$
+J _ { m + 1 } ^ { ( k ) } = { \bf x } _ { k } \times \hat { x } , \qquad J _ { m + 2 } ^ { ( k ) } = { \bf x } _ { k } \times \hat { y } , \qquad J _ { m + 3 } ^ { ( k ) } = { \bf x } _ { k } \times \hat { z } ,
+$$
+
+where $( b _ { i } , c _ { i } )$ is the freely rotatable bond for torsion angle i, $\mathcal { V } ( b _ { i } )$ is the set of all nodes on the same side of the bond as $b _ { i }$ , and $\hat { x } , \hat { y } , \hat { z }$ are the unit vectors in the respective directions.
+
+# 3.6 Energy-based training
+
+By computing likelihoods, we can train torsional diffusion models to match the Boltzmann distribution over torsion angles using the energy function. At a high level, we minimize the usual score matching loss, but with simulated samples from the Boltzmann distribution rather than data samples. The procedure therefore consists of two stages: resampling and score matching, which are tightly coupled during training (Algorithm 1). In the resampling stage, we use the model as an importance sampler for the Boltzmann distribution, where Proposition 3 is used to compute the (unnormalized) torsional Boltzmann density $\tilde { p } _ { G } ( \tau \mid L )$ . In the score-matching stage, the importance weights are used to approximate the denoising score-matching loss with expectations taken over $\tilde { p } _ { G } ( \tau \mid L )$ . As the model learns the score, it improves as an importance sampler.
+
+This training procedure differs substantially from that of existing Boltzmann generators, which are trained as flows with a loss that directly depends on the model density. In contrast, we train the model as a score-based model, but use it as a flow—both during training and inference—to generate samples. The model density is needed only to reweight the samples to approximate the target density. Since in principle the model used for resampling does not need to be the same as the model
+
+# Algorithm 1: Energy-based training epoch
+
+Input: Boltzmann density $\tilde { p }$ , training pairs $\{ ( G _ { i } , L _ { i } ) \} _ { i }$ , torsional diffusion model $q$
+for each $( G _ { i } , L _ { i } )$ do Sample $\pmb { \tau } _ { 1 } , \dots \pmb { \tau } _ { K } \sim q _ { G _ { i } } ( \pmb { \tau } \mid L _ { i } )$ ; for $k \gets 1$ to $K$ do $\\begin{array} { r } { \underline { \mathbf { \Omega } } \underline { \mathbf { \Omega } } \tilde { w } _ { k } = \tilde { p } _ { G _ { i } } ( \pmb { \tau } _ { k } \mid L _ { i } ) / q _ { G _ { i } } ( \pmb { \tau } _ { k } \mid L _ { i } ) ; } \end{array}$ Approximate $J _ { \mathrm { D S M } }$ for $p _ { 0 } \propto \tilde { p }$ using $\{ ( \tilde { w } _ { i } , \pmb { \tau } _ { i } ) \} _ { i }$ ; Minimize $J _ { \mathrm { D S M } }$ ;
+
+being trained,8 we can use very few steps (a shallow flow) during resampling to accelerate training, and then increase the number of steps (a deeper flow) for better approximations during inference—an option unavailable to existing Boltzmann generators.
+
+# 4 Experiments
+
+We evaluate torsional diffusion by comparing the generated and ground-truth conformers in terms of ensemble RMSD (Section 4.3) and properties (Section 4.4). Section 4.1 first discusses a preprocessing procedure required to train a conditional model $p _ { G } ( \tau \mid L )$ . Section 4.5 concludes with torsional Boltzmann generators. See Appendix H for additional results, including ablation experiments.
+
+# 4.1 Conformer matching
+
+In focusing on $p _ { G } ( \tau \mid L )$ , we have assumed that we can sample local structures $L \sim p _ { G } ( L )$ with RDKit. While this assumption is very good in terms of RMSD, the RDKit marginal $\hat { p } _ { G } ( L )$ is only an approximation of the ground truth $p _ { G } ( L )$ . Thus, if we train on the denoising score-matching loss with ground truth conformers—i.e., conditioned on ground truth local structures—there will be a distributional shift at test time, where only approximate local structures from $\hat { p } _ { G } ( L )$ are available. We found that this shift significantly hurts performance.
+
+We thus introduce a preprocessing procedure called conformer matching. In brief, for the training split only, we substitute each ground truth conformer $C$ with a synthetic conformer $\hat { C }$ with local structures $\hat { L } \sim \hat { p } _ { G } ( L )$ and made as similar as possible to $C$ . That is, we use RDKit to generate $\hat { L }$ and change torsion angles $\hat { \tau }$ to minimize $\mathrm { R M S D } ( C , { \hat { C } } )$ . Naively, we could sample $\hat { L } \sim \hat { p } _ { G } ( L )$ independently for each conformer, but this eliminates any possible dependence between $L$ and $\tau$ that could serve as training signal. Instead, we view the distributional shift as a domain adaptation problem that can be solved by optimally aligning $p _ { G } ( L )$ and $\hat { p } _ { G } ( L )$ . See Appendix E for details.
+
+Table 1: Quality of generated conformer ensembles for the GEOM-DRUGS test set in terms of Coverage $( \% )$ and Average Minimum RMSD $( \mathring \mathrm { A } )$ . We compute Coverage with a threshold of $\delta =$ $0 . 7 5 \mathring { \mathrm { A } }$ to better distinguish top methods. Note that this is different from most prior works, which used $\delta = 1 . 2 5 \mathrm { ~ \AA ~ }$ .
+
+
Recall
Precision
Coverage ↑
AMR↓
Coverage ↑
AMR↓
Method
Mean
Med
Mean
Med
Mean
Med
Mean
Med
RDKit ETKDG
38.4
28.6
1.058
1.002
40.9
30.8
0.995
0.895
OMEGA
53.4
54.6
0.841
0.762
40.5
33.3
0.946
0.854
GeoMol
44.6
41.4
0.875
0.834
43.0
36.4
0.928
0.841
GeoDiff
42.1
37.8
0.835
0.809
24.9
14.5
1.136
1.090
Torsional Diffusion
72.7
80.0
0.582
0.565
55.2
56.9
0.778
0.729
+
+# 4.2 Experimental setup
+
+Dataset We evaluate on the GEOM dataset [Axelrod and Gómez-Bombarelli, 2022], which provides gold-standard conformer ensembles generated with metadynamics in CREST [Pracht et al., 2020]. We focus on GEOM-DRUGS—the largest and most pharmaceutically relevant part of the dataset— consisting of $3 0 4 \mathrm { k }$ drug-like molecules (average 44 atoms). To test the capacity to extrapolate to the largest molecules, we also collect from GEOM-MoleculeNet all species with more than 100 atoms into a dataset we call GEOM-XL and use it to evaluate models trained on DRUGS. Finally, we train and evaluate models on GEOM-QM9, a more established dataset but with significantly smaller molecules (average 11 atoms). Results for GEOM-XL and GEOM-QM9 are in Appendix H.
+
+Evaluation We use the train/val/test splits from Ganea et al. [2021] and use the same metrics to compare the generated and ground truth conformer ensembles: Average Minimum RMSD (AMR) and Coverage. These metrics are reported both for Recall (R)—which measures how well the generated ensemble covers the ground-truth ensemble—and Precision (P)—which measures the accuracy of the generated conformers. See Appendix G for exact definitions and further details. Following the literature, we generate $2 K$ conformers for a molecule with $K$ ground truth conformers.
+
+Baselines We compare with the strongest existing methods from Section 2. Among cheminformatics methods, we evaluate RDKit ETKDG [Riniker and Landrum, 2015], the most established open-source package, and OMEGA [Hawkins et al., 2010, Hawkins and Nicholls, 2012], a commercial software in continuous development. Among machine learning methods, we evaluate GeoMol [Ganea et al., 2021] and GeoDiff [Xu et al., 2022], which have outperformed all previous models on the evaluation metrics. Note that GeoDiff originally used a small subset of the DRUGS dataset, so we retrained it using the splits from Ganea et al. [2021].
+
+# 4.3 Ensemble RMSD
+
+Torsional diffusion significantly outperforms all previous methods on GEOM-DRUGS (Table 1 and Figure 3), reducing by $30 \%$ the average minimum recall RMSD and by $16 \%$ the precision RMSD relative to the previous state-of-the-art method. Torsional diffusion is also the first ML method to consistently generate better ensembles than OMEGA. As OMEGA is a well-established product used in industry, this represents an essential step towards establishing the utility of conformer generation with machine learning.
+
+Torsional diffusion offers specific advantages over both GeoDiff and GeoMol, the most advanced prior machine learning methods. GeoDiff, a Euclidean diffusion model, requires 5000 denoising steps to obtain the results shown, whereas our model—thanks to the reduced degrees of freedom—requires only 20 steps. In fact, our model outperforms GeoDiff with as few as 5 denoising steps. As seen in Table 2, this translates to enormous runtime improvements.
+
+
+Figure 3: Mean coverage for recall (left) and precision (right) when varying the threshold value $\delta$ on GEOM-DRUGS.
+
+Table 2: Median AMR and runtime (core-secs per conformer) of machine learning methods, evaluated on CPU for comparison with RDKit.
+
+
Method
Steps
AMR-R
AMR-P
Runtime
RDKit
1
1.002
0.895
0.10
GeoMol
1
0.834
0.841
0.18
GeoDiff
5000
0.809
1.090
305
Torsional
5
0.685
0.963
1.76
Diffusion
10
0.580
0.791
2.82
20
0.565
0.729
4.90
+
+Table 3: Median absolute error of generated v.s. ground truth ensemble properties. $E , \Delta \epsilon , E _ { \mathrm { m i n } }$ in kcal/mol, $\mu$ in debye.
+
+
Method
E
μ
△
Emin
RDKit
0.81
0.52
0.75
1.16
OMEGA
0.68
0.66
0.68
0.69
GeoMol
0.42
0.34
0.59
0.40
GeoDiff
0.31
0.35
0.89
0.39
Tor. Diff.
0.22
0.35
0.54
0.13
+
+Compared to torsional diffusion, GeoMol similarly makes use of intrinsic coordinates. However, since GeoMol can only access the molecular graph, it is less suited for reasoning about relationships that emerge only in a spatial embedding, especially between regions of the molecule that are distant on the graph. Our extrinsic-to-intrinsic score framework—which gives direct access to spatial relationships—addresses precisely this issue. The empirical advantages are most evident for the large molecules in GEOM-XL, on which GeoMol fails to improve consistently over RDKit (Appendix H). On the other hand, because GeoMol requires only a single-forward pass, it retains the advantage of faster runtime compared to diffusion-based methods.
+
+# 4.4 Ensemble properties
+
+While RMSD gives a geometric way to evaluate ensemble quality, we also consider the chemical similarity between generated and ground truth ensembles. For a random 100-molecule subset of DRUGS, we generate $\operatorname* { m i n } ( 2 K , 3 2 )$ conformers per molecule, relax the conformers with GFN2-xTB [Bannwarth et al., 2019],9 and compare the Boltzmann-weighted properties of the generated and ground truth ensembles. Specifically, the following properties are computed with xTB [Bannwarth et al., 2019]: energy $E$ , dipole moment $\mu$ , HOMO-LUMO gap $\Delta \epsilon$ , and the minimum energy $E _ { \mathrm { m i n } }$ . The median errors for torsional diffusion and the baselines are shown in Table 4. Our method produces the most chemically accurate ensembles, especially in terms of energy. In particular, we significantly improve over GeoMol and GeoDiff in finding the lowest-energy conformers that are only (on median) $0 . 1 3 \mathrm { k c a l / m o l }$ higher in energy than the global minimum.
+
+# 4.5 Torsional Boltzmann generator
+
+Finally, we evaluate how well a torsional Boltzmann generator trained with MMFF [Halgren, 1996] energies can sample the corresponding Boltzmann density over torsion angles. We train and test on GEOMDRUGS molecules with 3–7 rotatable bonds and use the local structures of the first ground-truth conformers. For the baselines, we implement annealed importance samplers (AIS) [Neal, 2001] with MetropolisHastings steps over the torsional space and tune the variance of the transition kernels.
+
+Table 4 shows the quality of the samplers in terms of the effective sample size (ESS) given by the weights of 32 samples for each test molecule, which measures the $\alpha$ -divergence (with $\alpha = 2$ ) between the model and Boltzmann distributions [Midgley et al., 2021]. Our method significantly outperforms the AIS baseline, and improves with increased step size despite being trained with only a 5-step resampler. Note that, since these evaluations are done on unseen molecules, they are beyond the capabilities of existing Boltzmann generators.
+
+Table 4: Effective sample size (out of 32) given by importance sampling weights over the torsional Boltzmann density.
+
+
Temp. (K)
Method
Steps
1000
500
300
Uniform
1
1.71
1.21
1.02
AIS
5
2.20
1.36
1.18
20
3.12
1.76
1.30
100
6.72
3.12
2.06
Torsional
5
7.28
3.60
3.04
BG
20
11.42
6.42
4.68
+
+# 5 Conclusion
+
+We presented torsional diffusion, a method for generating molecular conformers based on a diffusion process restricted to the most flexible degrees of freedom. Torsional diffusion is the first machine learning model to significantly outperform standard cheminformatics methods and is orders of magnitude faster than previous Euclidean diffusion models. Using the exact likelihoods provided by our model, we also train the first system-agnostic Boltzmann generator.
+
+There are several exciting avenues for future work. A natural extension is to relax the rigid local structure assumption by developing an efficient diffusion-based model over the full space of intrinsic coordinates while still incorporating chemical constraints. Moreover, torsional diffusion—or similar ideas—could be applicable to larger molecular systems, for which fast, parsimonious models of structural flexibility could benefit applications such as drug discovery and protein design.
+
+# Acknowledgments
+
+We pay tribute to Octavian-Eugen Ganea (1987-2022), dear colleague, mentor, and friend without whom this work would have never been possible.
+
+We thank Hannes Stärk, Wenxian Shi, Xiang Fu, Felix Faltings, Jason Yim, Adam Fisch, Alex Wu, Jeremy Wohlwend, Peter Mikhael, and Saro Passaro for helpful feedback and discussions. We thank Lagnajit Pattanaik, Minkai Xu, and Simon Axelrod for their advice and support when working with, respectively, GeoMol, GeoDiff and the GEOM dataset. This work was supported by the Machine Learning for Pharmaceutical Discovery and Synthesis (MLPDS) consortium, the Abdul Latif Jameel Clinic for Machine Learning in Health, the DTRA Discovery of Medical Countermeasures Against New and Emerging (DOMANE) threats program, the DARPA Accelerated Molecular Discovery program and the Sanofi Computational Antibody Design grant. We acknowledge support from the Department of Energy Computational Science Graduate Fellowship (BJ), the Robert Shillman Fellowship (GC), and the NSF Graduate Research Fellowship (JC).
+
+# References
+
+Brian DO Anderson. Reverse-time diffusion equation models. Stochastic Processes and their Applications, 1982.
+
+Simon Axelrod and Rafael Gómez-Bombarelli. Geom, energy-annotated molecular conformations for property prediction and molecular generation. Scientific Data, 2022.
+
+Christoph Bannwarth, Sebastian Ehlert, and Stefan Grimme. Gfn2-xtb—an accurate and broadly parametrized self-consistent tight-binding quantum chemical method with multipole electrostatics and density-dependent dispersion contributions. Journal of chemical theory and computation, 2019.
+
+Simon Batzner, Albert Musaelian, Lixin Sun, Mario Geiger, Jonathan P Mailoa, Mordechai Kornbluth, Nicola Molinari, Tess E Smidt, and Boris Kozinsky. E (3)-equivariant graph neural networks for data-efficient and accurate interatomic potentials. Nature communications, 2022.
+
+Evan E Bolton, Sunghwan Kim, and Stephen H Bryant. Pubchem3d: conformer generation. Journal of cheminformatics, 2011.
+
+Sean M Carroll. Spacetime and geometry. Cambridge University Press, 2019.
+
+Gregory S Chirikjian. Stochastic models, information theory, and Lie groups, volume 2: Analytic methods and modern applications, volume 2. Springer Science & Business Media, 2011.
+
+Jason C Cole, Oliver Korb, Patrick McCabe, Murray G Read, and Robin Taylor. Knowledge-based conformer generation using the cambridge structural database. Journal of Chemical Information and Modeling, 2018.
+
+David F Crouse. On implementing 2d rectangular assignment algorithms. IEEE Transactions on Aerospace and Electronic Systems, 2016.
+
+Valentin De Bortoli, Emile Mathieu, Michael Hutchinson, James Thornton, Yee Whye Teh, and Arnaud Doucet. Riemannian score-based generative modeling. arXiv preprint, 2022.
+
+Edward M Driggers, Stephen P Hale, Jinbo Lee, and Nicholas K Terrett. The exploration of macrocycles for drug discovery—an underexploited structural class. Nature Reviews Drug Discovery, 2008.
+
+Octavian Ganea, Lagnajit Pattanaik, Connor Coley, Regina Barzilay, Klavs Jensen, William Green, and Tommi Jaakkola. Geomol: Torsional geometric generation of molecular 3d conformer ensembles. Advances in Neural Information Processing Systems, 2021.
+
+Mario Geiger, Tess Smidt, Alby M., Benjamin Kurt Miller, Wouter Boomsma, Bradley Dice, Kostiantyn Lapchevskyi, Maurice Weiler, Michał Tyszkiewicz, Simon Batzner, Dylan Madisetti, Martin Uhrin, Jes Frellsen, Nuri Jung, Sophia Sanborn, Mingjian Wen, Josh Rackers, Marcel Rød, and Michael Bailey. Euclidean neural networks: e3nn, April 2022. URL https://doi.org/10.5281/zenodo.6459381.
+
+Thomas A Halgren. Merck molecular force field. i. basis, form, scope, parameterization, and performance of mmff94. Journal of computational chemistry, 1996.
+
+Paul CD Hawkins. Conformation generation: the state of the art. Journal of Chemical Information and Modeling, 2017.
+
+Paul CD Hawkins and Anthony Nicholls. Conformer generation with omega: learning from the data set and the analysis of failures. Journal of chemical information and modeling, 2012.
+
+Paul CD Hawkins, A Geoffrey Skillman, Gregory L Warren, Benjamin A Ellingson, and Matthew T Stahl. Conformer generation with omega: algorithm and validation using high quality structures from the protein databank and cambridge structural database. Journal of chemical information and modeling, 2010.
+
+Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 2020.
+
+Michael F Hutchinson. A stochastic estimator of the trace of the influence matrix for laplacian smoothing splines. Communications in Statistics-Simulation and Computation, 1989.
+
+Bowen Jing, Stephan Eismann, Patricia Suriana, Raphael John Lamarre Townshend, and Ron Dror. Learning from protein structure with geometric vector perceptrons. In International Conference on Learning Representations, 2021.
+
+Bowen Jing, Gabriele Corso, Renato Berlinghieri, and Tommi Jaakkola. Subspace diffusion generative models. arXiv preprint arXiv:2205.01490, 2022.
+
+Leslie Kish. Survey sampling. Number 04; HN29, K5. 1965.
+
+Jonas Köhler, Andreas Krämer, and Frank Noé. Smooth normalizing flows. Advances in Neural Information Processing Systems, 2021.
+
+David Lagorce, Tania Pencheva, Bruno O Villoutreix, and Maria A Miteva. Dg-ammos: A new tool to generate 3d conformation of small molecules using d istance g eometry and a utomated m olecular m echanics o ptimization for in silico s creening. BMC Chemical Biology, 2009.
+
+Greg Landrum et al. Rdkit: A software suite for cheminformatics, computational chemistry, and predictive modeling, 2013.
+
+Jiabo Li, Tedman Ehlers, Jon Sutter, Shikha Varma-O’Brien, and Johannes Kirchmair. Caesar: a new conformer generation algorithm based on recursive buildup and local rotational symmetry consideration. Journal of chemical information and modeling, 2007.
+
+Shitong Luo, Chence Shi, Minkai Xu, and Jian Tang. Predicting molecular conformation via dynamic graph score matching. Advances in Neural Information Processing Systems, 2021.
+
+Oscar Méndez-Lucio, Mazen Ahmad, Ehecatl Antonio del Rio-Chanona, and Jörg Kurt Wegner. A geometric deep learning approach to predict binding conformations of bioactive molecules. Nature Machine Intelligence, 2021.
+
+Laurence Illing Midgley, Vincent Stimper, Gregor NC Simm, and José Miguel Hernández-Lobato. Bootstrap your flow. arXiv preprint, 2021.
+
+Maria A Miteva, Frederic Guyon, and Pierre Tuffery. Frog2: Efficient 3d conformation ensemble generator for small compounds. Nucleic acids research, 2010.
+
+Radford M Neal. Annealed importance sampling. Statistics and computing, 2001.
+
+Alex Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, 2021.
+
+Frank Noé, Simon Olsson, Jonas Köhler, and Hao Wu. Boltzmann generators: Sampling equilibrium states of many-body systems with deep learning. Science, 2019.
+
+Philipp Pracht, Fabian Bohle, and Stefan Grimme. Automated exploration of the low-energy chemical space with fast quantum chemical methods. Physical Chemistry Chemical Physics, 2020.
+
+Martin Quack. How important is parity violation for molecular and biomolecular chirality? Angewandte Chemie International Edition, 2002.
+
+Sereina Riniker and Gregory A Landrum. Better informed distance geometry: using what we know to improve conformation generation. Journal of chemical information and modeling, 2015.
+
+Tim Salimans and Jonathan Ho. Progressive distillation for fast sampling of diffusion models. In International Conference on Learning Representations, 2022.
+
+Vıctor Garcia Satorras, Emiel Hoogeboom, and Max Welling. E (n) equivariant graph neural networks. In International Conference on Machine Learning, 2021.
+
+Kristof Schütt, Pieter-Jan Kindermans, Huziel Enoc Sauceda Felix, Stefan Chmiela, Alexandre Tkatchenko, and Klaus-Robert Müller. Schnet: A continuous-filter convolutional neural network for modeling quantum interactions. Advances in neural information processing systems, 2017.
+
+Chence Shi, Shitong Luo, Minkai Xu, and Jian Tang. Learning gradient fields for molecular conformation generation. In International Conference on Machine Learning, 2021.
+
+Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in Neural Information Processing Systems, 2019.
+
+Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. International Conference on Learning Representations, 2021.
+
+Hannes Stärk, Octavian-Eugen Ganea, Lagnajit Pattanaik, Regina Barzilay, and Tommi Jaakkola. Equibind: Geometric deep learning for drug binding structure prediction. In International Conference on Machine Learning, 2022.
+
+Nathaniel Thomas, Tess Smidt, Steven Kearnes, Lusann Yang, Li Li, Kai Kohlhoff, and Patrick Riley. Tensor field networks: Rotation-and translation-equivariant neural networks for 3d point clouds. arXiv preprint, 2018.
+
+Arash Vahdat, Karsten Kreis, and Jan Kautz. Score-based generative modeling in latent space. In Advances in Neural Information Processing Systems, 2021.
+
+Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 2017.
+
+Minkai Xu, Shitong Luo, Yoshua Bengio, Jian Peng, and Jian Tang. Learning neural generative dynamics for molecular conformation generation. In International Conference on Learning Representations, 2021a.
+
+Minkai Xu, Wujie Wang, Shitong Luo, Chence Shi, Yoshua Bengio, Rafael Gomez-Bombarelli, and Jian Tang. An end-to-end framework for molecular conformation generation via bilevel programming. In International Conference on Machine Learning, 2021b.
+
+Minkai Xu, Lantao Yu, Yang Song, Chence Shi, Stefano Ermon, and Jian Tang. Geodiff: A geometric diffusion model for molecular conformation generation. In International Conference on Learning Representations, 2022.
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes] See Appendix F
+(c) Did you discuss any potential negative societal impacts of your work? [Yes] Conformer generation is useful for many scientific applications, some of which could have negative societal impacts.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Appendix B. (b) Did you include complete proofs of all theoretical results? [Yes] See Appendix B.
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] The code can be found at https://github.com/gcorso/torsional-diffusion.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix G.
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Appendix H.
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] Approximately 2000 GPU-hours on an internal cluster.
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [Yes] We used the code and data released by GeoMol and GeoDiff released under MIT license and the GEOM datasets released under CC0 1.0 license.
+(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] See the instructions in our repository https://github.com/gcorso/ torsional-diffusion.
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] All data used is open-source.
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] No personal data is used.
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/wKhUPzqVap6/wKhUPzqVap6.md b/md/dev/wKhUPzqVap6/wKhUPzqVap6.md
new file mode 100644
index 0000000000000000000000000000000000000000..f2851110fd23baa8d3a106c24d9cf102c766a3a1
--- /dev/null
+++ b/md/dev/wKhUPzqVap6/wKhUPzqVap6.md
@@ -0,0 +1,301 @@
+# On Feature Learning in the Presence of Spurious Correlations
+
+Pavel Izmailov∗ Polina Kirichenko∗ Nate Gruver∗ Andrew Gordon Wilson New York University
+
+# Abstract
+
+Deep classifiers are known to rely on spurious features — patterns which are correlated with the target on the training data but not inherently relevant to the learning problem, such as the image backgrounds when classifying the foregrounds. In this paper we evaluate the amount of information about the core (non-spurious) features that can be decoded from the representations learned by standard empirical risk minimization (ERM) and specialized group robustness training. Following recent work on Deep Feature Reweighting (DFR), we evaluate the feature representations by re-training the last layer of the model on a held-out set where the spurious correlation is broken. On multiple vision and NLP problems, we show that the features learned by simple ERM are highly competitive with the features learned by specialized group robustness methods targeted at reducing the effect of spurious correlations. Moreover, we show that the quality of learned feature representations is greatly affected by the design decisions beyond the training method, such as the model architecture and pre-training strategy. On the other hand, we find that strong regularization is not necessary for learning high-quality feature representations. Finally, using insights from our analysis, we significantly improve upon the best results reported in the literature on the popular Waterbirds, CelebA hair color prediction and WILDS-FMOW problems, achieving $9 7 \%$ , $92 \%$ and $50 \%$ worst-group accuracies, respectively.
+
+# 1 Introduction
+
+In classification problems, a feature is spurious if it is predictive of the label without being causally related to it. Models that exploit the predictive power of spurious features can achieve strong average performance on training and in-distribution test data but often perform poorly on sub-groups of the data where the spurious correlation does not hold [18]. For example, neural networks trained on ImageNet are known to rely on backgrounds [93] or texture [19], which are often correlated with labels without being causally significant. Similarly in natural language processing, models often rely on specific words and syntactic heuristics when predicting the sentiment of a sentence or the relationship between a pair of sentences [56, 22]. In extreme cases, neural networks completely ignore task-relevant core features and only use spurious features in their predictions [97, 79], achieving zero accuracy on the subgroups of the data where the spurious correlation does not hold.
+
+In recent work, Kirichenko et al. [40] showed that, surprisingly, standard Empirical Risk Minimization (ERM) learns a high-quality representation of the core features on datasets with spurious correlations, even when the model primarily relies on spurious features to make predictions. Moreover, they showed that it is often possible to recover state-of-the-art performance on benchmark problems by simply retraining the last layer of the model on a small held-out dataset where the spurious correlation does not hold. This procedure is called Deep Feature Reweighting (DFR).
+
+In this paper, we provide an in-depth study of the factors that affect the quality of learned representations in the presence of spurious correlations: how accurately can we decode the core features from the learned representations. Following Kirichenko et al. [40], we break the problem of training a robust classifier into two tasks: extracting feature representations and training a linear classifier on these features. In order to study the feature learning in isolation, we use the DFR procedure to learn an optimal linear classifier on the feature representations, and evaluate the features learned with different training methods, neural network architectures, and hyper-parameters.
+
+First, on a range of problems with spurious correlations we show that while specialized group robustness methods such as group distributionally robust optimization (group DRO) [76] can significantly outperform the standard ERM training, the quality of the features learned by ERM is highly competitive: by applying the DFR procedure to the features learned by ERM and group DRO we achieve similar performance. Furthermore, we show that the performance improvements of group DRO are largely explained by the better weighting of the learned features in the last classification layer, and not by learning a better representation of the core features. This observation has high practical significance, as the problem of training the last layer of the model is much simpler both conceptually and computationally than training the full model to avoid spurious correlations [40].
+
+Next, focusing on the ERM training, we explore the effect of model class, pretraining strategy and regularization on feature learning. We find a linear dependence between the in-distribution accuracy of the model and the worst group accuracy after applying DFR, meaning that on natural datasets good generalization typically implies good feature learning, even in the presence of spurious features. Further, we show that the pre-training strategy has a very significant effect on the quality of the learned features, while strong regularization does not significantly improve the feature representations on most benchmarks.
+
+Finally, by finetuning a state-of-the-art ConvNext model [52], we significantly outperform the best reported results on the popular Waterbirds [76], CelebA hair color and WILDS FMOW [43] spurious correlation benchmarks, using only simple ERM training followed by DFR.
+
+Our code is available at github.com/izmailovpavel/spurious_feature_learning.
+
+# 2 Related Work
+
+Numerous works describe how neural networks can rely on spurious correlations in real world problems. In vision, neural networks can learn to rely on an image’s background [93, 76, 61], secondary objects [45, 72, 83, 80, 2, 60], object textures [19] and other semantically irrelevant features [9, 49]. Spurious correlations are especially problematic in high-risk domains such as medical imaging, where it was shown that neural networks can use hospital-specific metal tokens [97] or cues of disease treatment [65] rather than symptoms to perform automated diagnosis on chest X-ray images. Spurious features are also extremely prevalent in NLP, where models can achieve good performance on benchmarks without properly solving them, e.g. by using simple syntactic heuristics such as lexical overlap between the two sentences in order to classify the relationship between them [64, 22, 37, 56]. For a comprehensive survey of the area, see Geirhos et al. [19].
+
+Because of the high practical significance of spurious correlations, many group robustness methods have been proposed. These methods aim to reduce the reliance of deep learning models on spurious correlations and improve worst group performance. Group DRO [76] is the state-of-the-art group robustness method, which minimizes the worst-group loss instead of the average loss. Other works focus on automatically identifying the minority group examples [50, 62, 13, 100], learning several diverse classifiers that use different features [48, 66, 85] or using partially available group labels [84, 63]. Group subsampling was shown to be a strong baseline for some benchmarks [34, 78].
+
+In this work, we focus on feature learning in the presence of spurious correlations. Hermann and Lampinen [31] perform a conceptually similar study, but focusing on synthetic datasets. Similar to their work, we explore how well the different features of the data can be decoded from the features learned by deep neural networks, but on large-scale natural datasets. Hermann et al. [30] explore the feature learning in the context of texture bias [19], finding that data augmentation has a profound effect on the texture bias while architectures and training objectives have a relatively small effect. Ghosal et al. [20] show that Vision Transformer models pretrained on ImageNet22k [44] significantly outperform standard CNN models on several spurious correlation benchmarks.
+
+Lovering et al. [54] explore the factors which affect the extractability of features after pre-training and fine-tuning of NLP models. Kaushik et al. [36] construct counterfactually augmented sentiment analysis and naural language inference datasets (CAD) and show that combining CAD with the original data reduces the reliance on spurious correlations on the corresponding benchmarks. Kaushik et al. [38] explain the efficacy of CAD and show that while adding noise to causal features degrades in-distribution and out-of-distribution performance, adding noise to non-causal features improves robustess. Eisenstein [17] and Veitch et al. [86] formally define and study spurious features in NLP from the perspective of causality.
+
+Kirichenko et al. [40] show that models trained with standard ERM training often learn high-quality representations of the core features, and propose the DFR procedure (see Section 3) which we use extensively in this paper. Related observations have also been reported in other works in the context of spurious correlations [58], domain generalization [73] and long-tail classification [35]. While we build on the observations of Kirichenko et al. [40], our work provides profound new insights and greatly expands on the scope of their work. In particular, we investigate the feature representations learned by methods beyond standard ERM, and the role of model architecture, pretraining, regularization and data augmentation on learning semantic structure. We also extend our analysis beyond the standard spurious correlation benchmarks studied by Kirichenko et al. [40], by considering the challenging real world satellite imaging and chest X-ray datasets.
+
+In an independent and concurrent work, Shi et al. [81] also propose an evaluation framework for outof-distribution generalization based on last layer retraining, inspired by the observations of Kirichenko et al. [40] and Kang et al. [35]. They focus on the comparison of supervised, self-supervised and unsupervised training methods, providing complementary observations to our work.
+
+# 3 Background
+
+Preliminaries. We consider classification tasks with inputs $x \in \mathcal { X }$ and classes $y \in \mathcal { V }$ . We assume that the data distribution consists of groups $\mathcal { G }$ which are not equally represented in the training data. The distribution of groups can change between the training and test distributions, with majority groups becoming less common or minority groups becoming more common. Because of the imbalance in training data, models trained with ERM often have a gap between average and worst group performance on test. Throughout this paper, we will be studying worst group accuracy (WGA), i.e. the lowest test accuracy across all the groups $\mathcal { G }$ . For most problems considered in this paper, we assume that each data point has an attribute $s \in S$ which is spuriously correlated with the label $y$ and the groups are defined by a combination of the label and spurious attribute: $\mathcal { G } \in \mathcal { V } \times \mathcal { S }$ . In test distribution we might find that $s$ is no longer correlated with $y$ , and thus a model that has learned to rely on the spurious feature $s$ during training will perform poorly at test time. Models that rely on the spurious features will typically achieve poor worst group accuracy, while models that rely on core features will have more uniform accuracies across the groups. In Appendix A, we describe the groups, spurious and core features in the datasets that we use in this paper.
+
+In order to perform controlled experiments, we assume that we have access to the spurious attributes $s$ (or group labels) for training or validation data, which we use for training of group robustness baselines and feature quality evaluation. However, we emphasize that our results on the features learned by ERM hold generally, even when spurious attributes are unknown, as ERM does not use the information about the spurious features: we only use the spurious attributes to perform analysis.
+
+Deep feature reweighting. Suppose we are given a model $m : \mathcal { X } \mathcal { C }$ , where $\mathcal { X }$ is the input space and $\mathcal { C }$ is the set of classes. Kirichenko et al. [40] assume that the model $m$ consists of a feature extractor (typically, a sequence of convolutional or transformer layers) followed by a classification head (typically, a single linear layer): $m = h \circ e$ , where $e : \mathcal { X } \mathcal { F }$ is a feature extractor and $h : { \mathcal { F } } \to { \mathcal { C } }$ is a classification head. They discard the classification head, and use the feature extractor $e$ to compute the set of embeddings $\hat { \mathcal { D } } _ { e } = \{ ( e ( x _ { i } ) , y _ { i } ) \} _ { i = 1 } ^ { n }$ of all the datapoints in the reweighting dataset $\hat { \mathcal { D } }$ ; the reweighting dataset is used to retrain the last layer of the model, and contains groupbalanced data where the spurious correlation does not hold. Finally, they train a logistic regression classifier $l : \mathcal { F } \mathcal { C }$ on the dataset $\hat { \mathcal { D } } _ { e }$ . For stability, logistic regression models are trained 10 times on different random group-balanced subsets of the reweighting dataset $\hat { \mathcal { D } }$ , and the weights of the learned logistic regression models are averaged (see Appendix $\mathbf { B }$ of Kirichenko et al. [40] for full details on the DFR procedure). Then, the final model used on new test data is given by $m _ { l } = l \circ e$
+
+Thoughout this paper, we use a group-balanced held-out dataset (subset of the validation dataset where each group has the same number of datapoints) as the reweighting dataset $\hat { \mathcal { D } }$ ; Kirichenko et al. [40] denote this variation of the method as $\mathrm { D F R } _ { \mathrm { T r } } ^ { \mathrm { V a l } }$ .
+
+# 4 Experimental Setup and Evaluation Procedure
+
+In this section, we describe the datasets, models and evaluation procedure that we use throughout the paper.
+
+Datasets. In order to cover a broad range of practical scenarios, we consider four image classification and two text classification problems.
+
+• Waterbirds [76] is a binary image classification problem, where the class corresponds to the type of the bird (landbird or waterbird), and the background is spuriously correlated with the class. Namely, most landbirds are shown on land, and most waterbirds are shown over water.
+• CelebA hair color [51] is a binary image classification problem, where the goal is to predict whether a person shown in the image is blond; the gender of the person serves as a spurious feature, as $9 4 \%$ of the images with the “blond” label depict females.
+• WILDS-FMOW [12, 43, 77] is a satellite image classification problem, where the classes correspond to one of 62 land use or building types, and the spurious attribute $s$ corresponds to the region (Africa, Americas, Asia, Europe, Oceania or Other; the “Other” region is not used in the evaluation). We note that for the FMOW datasets the groups $\mathcal { G } _ { s }$ are defined by the value of the spurious attribute, and not the combination of the spurious attribute and the class label $\mathcal { G } _ { y , s }$ , as described in Section 3. Moreover, on FMOW there is also a domain shift: the images for test and validation data (used for last layer retraining) are collected in 2016 and 2017, while the training data is collected before 2016. For more details, please see Appendix A.
+CXR-14 [89] is a dataset with chest X-ray images for which we focus on a binary classification problem of pneumothorax prediction. Oakden-Rayner et al. [65] showed that there is a hidden stratification in the dataset such that most images from the positive class contain a chest drain, which is a non-causal feature related to treatment of the disease. While for all other benchmarks we report WGA on test data, for this dataset, following prior work [65, 48, 70], we report worst group AUC because of the heavy class imbalance.
+• MultiNLI [91, 76] is a text classification problem, where the task is to classify the relationship between a given pair of sentences as a contradiction, entailment or neither of them. In this dataset, the presence of negation words (e.g. “never”) in the second sentence is spuriously correlated with the “contradiction” class.
+CivilComments [8, 43] is a text classification problem, where the goal is to classify whether a given comment is toxic. We follow Idrissi et al. [34] and use the coarse version of the dataset both for training and evaluation, where the spurious attribute is $s = 1$ if the comment mentions at least one of the following categories: male, female, LGBT, black, white, Christian, Muslim, other religion; otherwise, the spurious label is 0. The presence of the eight categories above is spuriously correlated with the comment being classified as toxic.
+
+The Waterbirds, CelebA, CivilComments and MultiNLI datasets are commonly used to benchmark the performance of group robustness methods [see e.g. 34, 50, 63]. The FMOW and CXR-14 datasets present challenging real-world problems with spurious correlations. In these datasets, the inputs do not resemble natural images from datasets such as ImageNet [75], so models have to learn the relevant features from data to achieve good performance, and cannot simply rely on feature transfer. We provide detailed descriptions of the data and show example datapoints in Appendix A, Figures 6 and 7.
+
+Models. Following prior work [76, 34] we use a ResNet-50 [26] model pretrained on ImageNet1k [75] on Waterbirds, CelebA and FMOW. For the NLP problems, we use a BERT model [14] pretrained on Book Corpus and English Wikipedia data. On CXR-14, following prior work [e.g. 70, 65, 48] we use a DenseNet-121 model [32] pretrained on ImageNet1k. In Section 6, we provide an extensive study of the effect of architecture and pretraining on the image classification problems, and in Appendix $\mathrm { E }$ we perform a similar study on the MultiNLI text classification problem.
+
+Evaluation strategy. We use DFR to evaluate the quality of the learned feature representations, as described in Section 3: we measure how well the core features can be decoded from the learned representations with last layer retraining. In some of the experiments, we also train a classifier to predict the spurious attribute $s$ instead of the class label $y$ . Using this classifier, we can evaluate the decodability of the spurious feature from the learned feature representation. We refer to this procedure as $s$ -DFR and the corresponding worst group accuracy (in predicting the spurious attribute $s$ ) as DFR $s$ -WGA. Additionally, we evaluate the worst group accuracy and mean2 accuracy of the base model without applying DFR, which we refer to as base WGA and base accuracy respectively.
+
+# 5 ERM vs Group Robustness Training
+
+Multiple methods have been proposed for training classifiers which are more robust to spurious correlations, with significant improvements in worst group accuracy compared to standard training. In this section, we use DFR to investigate whether the improvements of group robustness methods are caused by better feature representations or by better weighting of the learned features.
+
+Methods. We consider 4 methods for learning the features. ERM or Empirical Risk Minimization is the standard training on the original training data, without any techniques targeted at improving worst group performance. RWG reweights the loss on each of the groups according to the size of the group and RWY reweights the loss on each class according to the size of the class [34]. Group DRO [76] is a state-of-the-art method which uses the group information on the training data to minimize the worst group loss instead of the average loss. Group DRO is often considered as an oracle method or upper-bound on the worst group performance under spurious correlations [50, 13].
+
+On the CXR dataset the group labels are not available on the train data, so we cannot apply RWG or group DRO; on this dataset we compare ERM to RWY. On several datasets, the performance of RWY and RWG methods deteriorates during training. For these datasets, we additionally report the results for the checkpoint obtained with early stopping (RWY-ES and RWG-ES). For group DRO, we report the performance with early stopping on all datasets except for CXR (GDRO-ES). In all cases, early stopping is performed based on the worst-group accuracy on the validation set.
+
+Hyper-parameters selection. We train ERM models, RWG and RWY with the same hyperparameters shared between all the image datasets (apart from batch size which is set to 32 on Waterbirds, and 100 on the other datasets) and between the natural language datasets. We do not tune the hyper-parameters of these methods for worst group accuracy. For group DRO, we run a grid search over the values of the generalization adjustment $C$ , weight decay and learning rate hyper-parameters, and select the best combination according to the worst-group accuracy on validation data with early stopping. For details, please see Appendix B.
+
+# 5.1 Results
+
+We compare feature learning methods on all datasets in Figure 1. As expected, the worst group accuracy of group robustness methods is significantly better than the ERM worst group accuracy on most datasets. For example, on Waterbirds, ERM only gets $6 8 . 8 \%$ WGA, while group DRO with early stopping gets $9 0 . 6 \%$ . However, after applying DFR the performance of ERM and group DRO is very close, with a slight advantage for ERM $( 9 1 . 1 \%$ for ERM and $9 0 \%$ for group DRO), and similar observations hold on all datasets.
+
+The results for RWG and RWY are analogous. Namely, when combined with early stopping, these methods outperform ERM on base model performance. Once we apply DFR, however, the gap in performance between the methods becomes very small. In fact, on all the datasets and for all the methods the improvement in worst group accuracy from using any of the considered group robustness methods compared to ERM does not exceed $1 { - } 2 \%$ after applying DFR.
+
+
+Figure 1: ERM vs group robustness methods. Performance of ERM on group robustness methods on vision and NLP benchmark problems. $E S$ stands for early stopping. For each method on each dataset we report the base model worst group accuracy (shown with the number inside each bar), and the worst group accuracy after applying DFR (shown above each bar). On CXR-14, we report worst group AUC. While on many datasets the base performance of ERM is much worse compared to group robustness methods, the performance of the different methods is similar after we apply DFR, suggesting that the strong performance of group robustness methods is largely caused by better weighting of the learned features rather than better feature representations.
+
+These results suggest that the improvements over ERM in base model performance for methods such as group DRO and RWG are largely the result of better weighting of the learned features rather than learning better representations of the core features. Indeed, if the core feature was better represented by group robustness methods, we would expect to see a significant improvement over ERM after applying DFR.
+
+This observation is significant both practically and scientifically. Practically, the problem of training the last layer is simpler, more data efficient and less compute intensive than retraining the full model [40]. Our results suggest that for many problems, practitioners can primarily focus on retraining the last layer, as training the feature extractor model with group robustness methods does not provide significant improvements. Scientifically, robustness to spurious correlations is often implicitly or explicitly associated with the quality of learned feature representations [e.g. 3, 4, 74, 100, 48, 99]. Our results suggest that the quality of feature representations is not significantly affected by group DRO, refining our understanding of group robustness training and representation learning in the presence of spurious correlations.
+
+Effect of early stopping. Early stopping is crucial to achieving strong base model performance with RWY, RWG and group DRO on many of the datasets. In Figure 1 we report the results both with and without early stopping on datasets where the validation worst group accuracy significantly degrades over the course of training. Generally, early stopping does not appear to significantly improve the quality of the learned feature representations even in these problems: after applying DFR, methods with and without early stopping achieve similar performance. This observation suggests that late in training, neural networks may start to assign a higher weight to the spurious features, but the information about the core features is still preserved in the learned representations. For ERM and Group DRO, we explore the DFR WGA performance as a function of the training iteration in Appendix D, also finding that the length of training has a relatively small effect on the final DFR WGA.
+
+
+Figure 2: Group DRO. Worst group accuracy before and after applying DFR for a range of group DRO runs. DFR does not improve the best runs, indicating that group DRO already learns a nearly optimal last layer.
+
+Group DRO analysis. In Figure 2 we report the worst group accuracy of multiple group DRO runs before and after applying DFR. For each run, we evaluate the best checkpoint according to validation accuracy (i.e. the checkpoint selected by early stopping) and the last checkpoint saved after a fixed number of epochs. We observe that while the last checkpoints perform poorly in terms of base WGA in most runs, DFR can significantly improve their performance, removing the need for early stopping. Interestingly, we find that the best performing group DRO models cannot be improved by DFR on each of the datasets. This result suggests that the weighting of the features learned by group DRO is already close to optimal, again indicating that the success of group DRO can largely be attributed to learning a better weighting for the features in the last linear layer, rather than learning better features.
+
+Group robustness methods (e.g. group DRO) perform well because they improve the last linear layer, not the underlying feature representations.
+
+# 6 Effect of the Base Model
+
+Most of the prior work on spurious correlation considers a fixed model class for each problem: for example, on Waterbirds and CelebA datasets almost all the papers use a ResNet-50 base model pre-trained on ImageNet1k [e.g. 76, 50, 48, 40, 84, 63, 100]. Recently, Ghosal et al. [20] showed that vision transformer models [15] may provide better robustness to spurious correlations if pretrained on a large dataset. Here, we perform a systematic large-scale evaluation of the effect of base model choice on the quality of learned feature representations.
+
+We repeat the experiments on the effect of base model, pretraining, and training on the target dataset presented in this section on the MultiNLI text classification task in Appendix E, with similar observations.
+
+# 6.1 Effect of the architecture and pretraining strategy
+
+In Figure 3, we plot the base model mean and worst group accuracy and DFR worst group accuracy for a wide range of models and pretraining strategies on each of the four image classification datasets. We provide model descriptions and training hyper-parameters in Appendix C. We train a total of 78 models on Waterbirds, 78 on CelebA, 40 on FMOW and 40 on CXR.
+
+Accuracy on the line. Miller et al. [59] showed that for many distribution shifts in practice the outof-distribution performance is highly correlated with the in-distribution generalization performance. In Figure 3 (top row), for each dataset we show scatter plots of base model mean accuracy vs base model worst group accuracy, analogously to Miller et al. [59]. For FMOW (which was also considered by Miller et al. [59]) we observe a linear correlation between the base model mean and worst group accuracies. On CXR, the dependence is also roughly linear. However, both on CelebA and on Waterbirds, the correlation does not appear entirely linear. In particular, on Waterbirds there is a large number of models that have similar worst group accuracy $\approx \hat { 2 } 0 \%$ , for which there appears to be little correlation between the base model WGA and mean accuracy. On CelebA, the same phenomenon occurs for the best performing models, with WGA between $4 0 \%$ and $5 0 \%$ .
+
+DFR accuracy is on the line. Next, in the bottom panels of Figure 3, for each of the datasets we report the base model mean accuracy vs DFR WGA. On all datasets other than $\mathrm { C X R } ^ { 3 }$ , we observe a high linear correlation between the metrics, including the Waterbirds and CelebA. In particular, the models with the best mean (in-distribution) accuracy also achieve the best DFR WGA. Note that this is not the case for the base model WGA on CelebA, where the best base model WGA is $5 1 \%$ achieved by a ResNet-101 model pretrained on ImageNet1k; this model only achieves mean accuracy of $9 5 . 4 5 \%$ compared to $9 6 . 2 \%$ accuracy for the ConvNext XLarge model. The results in Figure 3 confirm that models that achieve better accuracy on the training data distribution generally learn better representations of the core features, and provide better worst group accuracies with DFR.
+
+Are VITs more robust than CNNs? Ghosal et al. [20] noted that vision transformers pre-trained on ImageNet22k achieved better worst group accuracies on benchmarks with spurious correlations than popular CNN models. In particular, with a VIT-B/16 model, they achieve $8 9 . 3 \%$ worst group accuracy on Waterbirds. With the ConvNext Large model pretrained on ImageNet22k with ImageNet1k finetuning, we achieve $8 8 . 9 \%$ worst group accuracy on the Waterbirds dataset. Notably, ConvNext is a CNN model and not a vision transformer. Generally, we observe that the models that provide the best in-distribution performance also provide better WGA. In our experiments, we did not observe qualitative differences between the results for vision transformers and CNN models.
+
+
+Figure 3: Effect of the model architecture and pretraining. Base model in-distribution accuracy plotted against base worst-group accuracy (top row) and DFR worst group accuracy (bottom row). For each panel, we additionally estimate the slope and the $r ^ { 2 }$ score for the linear fit to the data. On all datasets other than CXR, the DFR WGA is linearly correlated with base model in-distribution performance. For the base model WGA, the correlation with in-distribution performance is not entirely linear. Generally, models with better in-distribution performance provide better worst-group performance and better core feature representations.
+
+ERM features are sufficient for SOTA performance. The DFR WGA results for the Waterbirds, CelebA and FMOW datasets significantly improve upon the previous best reported results, to the best of our knowledge. In particular, the ConvNext Large model pretrained on ImageNet22k with ImageNet1k finetuning achieves $9 7 . 2 \%$ DFR WGA on Waterbirds and $9 2 . 2 \%$ on CelebA; on FMOW, we only considered smaller ConvNext versions due to computational constraints, still achieving $5 0 . 6 \%$ DFR WGA with ConvNext Small pretrained on ImageNet22k; the current best results on the WILDS leaderboard for this dataset are $4 7 . 6 \%$ followed by $3 5 . 5 \%$ [43]. We note that our DFR evaluation uses the validation set to train the last layer of the model, similarly to e.g. Nam et al. [63], and unlike most standard group robustness methods which only use the validation set to tune the parameters. However, the results presented in this section prove that standard ERM with a strong pretrained model can achieve outstanding results on the robustness benchmarks, significantly improving upon specialized group robustness methods using a weaker model.
+
+Strong in-distribution generalization correlates with improved robustness to spurious correlations (measured by the DFR worst group accuracy), and this trend holds regardless of the underlying architecture (CNN or ViT).
+
+# 6.2 Does training on the target data improve features?
+
+Above, we have shown that the choice of the base model architecture and pretraining has a large effect on the quality of the learned feature representations, as measured by DFR WGA. It is then natural to ask how much of the feature learning happens during training on the target data, and how much is simply transferred from the pretraining task. To answer this question, for the models trained in the previous section, we run the DFR evaluation on the initial weights of the models, without training the feature extractor on the target data. We report the DFR WGA and DFR $s$ -WGA results in Figure 4. We repeat this experiment on the MultiNLI dataset in Appendix Table 5.
+
+
+Figure 4: Effect of training on target data. DFR WGA (top 4 panels) and DFR $s$ -WGA (bottom 3 panels) before and after training. On Waterbirds, the results do not significantly improve from training on the target data. On the other datasets, the performance improves consistently after training on the target data. Interestingly, on CelebA the DFR $s$ -WGA decreases during training for many models, meaning that the spurious gender feature becomes less predictable from the learned representations.
+
+Surprisingly, we find that on Waterbirds, for most models the improvement from training on the target (Waterbirds) data is very small, if any. For example, for the ImageNet1k-pretrained ResNet-50 model that was not trained on Waterbirds data at $\mathrm { { a l l } ^ { 4 } }$ , we get $8 8 . 2 \%$ worst group accuracy by simply training the last layer on the validation data with DFR. If we finetune the feature extractor on the Waterbirds training data, we can achieve $9 2 . 9 \%$ DFR WGA. For reference, the state-of-the-art group DRO method achieves $9 1 \%$ WGA on Waterbirds with this architecture.
+
+Furthermore, with the ConvNext Large model pretrained on ImageNet22k, we get $9 4 \%$ DFR WGA without training the feature extractor on the Waterbirds data, exceeding the best results previously reported in the literature, to the best of our knowledge. This strong performance is not particularly surprising, as ImageNe $2 2 \mathrm { k }$ has many of the Waterbirds bird types as classes. The performance is almost unchanged by training on the target data: DFR WGA after training is $9 4 . 3 \%$ . From these results, we can conclude that Waterbirds performance should not be used as a primary metric for feature learning performance, especially if large-scale pretraining is used! Indeed, it is possible to achieve outstanding performance, exceeding the previously reported state-of-the-art, without training the features on the target data.
+
+On the other datasets, the feature learning is more pronounced: the DFR WGA improves after training for all the models considered. However, on CelebA it is still possible to achieve $8 8 . 3 \%$ WGA without training on CelebA data, with ConvNext XLarge pretrained on ImageNet22k, while the best result that we were able to achieve with feature extractors trained on CelebA is $9 2 . 2 \%$ .
+
+Is the spurious feature representation improved during training? We additionally explore the quality of representation of the spurious feature via DFR $s$ -WGA. We show the results in Figure 4 (bottom row). Interestingly, on CelebA the spurious gender feature becomes less predictable during training for many of the models. On FMOW and Waterbirds there is no consistent trend, and the spurious feature does not become significantly more or less predictable during training.
+
+Strong feature extractors trained on large-scale datasets are sufficient for outstanding performance on benchmark spurious correlation datasets, without any finetuning on the target data. Finetuning can improve the quality of the learned representations but often only to a relatively small degree (e.g. Waterbirds).
+
+# 6.3 Effect of pretraining strategy
+
+Finally, using a fixed ResNet-50 model architecture we evaluate the effect of pretraining strategy. On each of the four datasets, we train a ResNet-50 model initialized with (1) random initialization, (2) supervised pretraining, (3) DINO pretraining [10], (4) SimCLR pretraining [11] and (5) Barlow Twins pretraining [96] on ImageNet1k. We report the results in Figure 5. On Waterbirds and FMOW datasets, the randomly initialized model does not provide competitive performance. On CelebA, it still underperforms the pretrained models, but the gap is much smaller. Among all pretraining methods, supervised is preferable, but the contrastive methods are highly competitive.
+
+
+Figure 5: Effect of pretraining. Supervised pretraining provides the best performance, but contrastive methods are competitive. Random initialization performs poorly.
+
+In Appendix Table 4 on MultiNLI with BERT models, we also show that pretraining is crucial for strong performance, while the specific choice of pretraining data has a smaller effect. In Appendix D we provide further ablations exploring the effect of weight decay and data augmentation on the learned feature representations. We find that while appropriate regularization can be helpful, models trained with no weight decay and no data augmentation can achieve highly competitive DFR WGA, especially on the standard Waterbirds and CelebA benchmarks.
+
+ImageNet pretraining improves the representation of core features on many image datasets with spurious correlations.
+
+# 7 Discussion
+
+The worst group performance of a model is affected by two factors: the quality of the representation of the core features produced by the feature extractor and the weight assigned to the core features in the last classification layer. In contrast to prior work, we consider the quality of the feature extractor in isolation, focusing on realistic datasets and large-scale models. We find that many of the popular group robustness methods improve the worst group performance primarily by learning a better last layer and not by learning a better feature representation. Similarly, regularization techniques such as early stopping and strong weight decay can improve the worst group accuracy by learning a better last layer, but do not lead to a consistent improvement in terms of the quality of the learned feature representations. On the other hand, the base model architecture and pre-training strategy have a major effect on the quality of the feature representations.
+
+Our observations suggest an important open question: is it possible to significantly improve upon standard ERM in terms of the quality of the learned representations for a given base model? In the future work, we will evaluate methods such as Rich Feature Construction [99], gradient starvation [68], ensembling [47] and other techniques for increasing feature diversity [e.g. 48]. We hope that our work will also inspire new group robustness methods targeted specifically at improving the quality of the core feature representations.
+
+Acknowledgements. This research is supported by NSF CAREER IIS-2145492, NSF I-DISRE 193471, NIH R01DA048764-01A1, NSF IIS-1910266, NSF 1922658 NRT-HDR: FUTURE Foundations, Translation, and Responsibility for Data Science, NSF Award 1922658, Meta Core Data Science, Google AI Research, BigHat Biosciences, Capital One, and an Amazon Research Award. This work was supported in part through the NYU IT High Performance Computing resources, services, and staff expertise.
+
+References
+[1] Agarwal, A., Beygelzimer, A., Dudík, M., Langford, J., and Wallach, H. (2018). A reductions approach to fair classification. In International Conference on Machine Learning, pages 60–69. PMLR. (Cited on page 28)
+[2] Alcorn, M. A., Li, Q., Gong, Z., Wang, C., Mai, L., Ku, W.-S., and Nguyen, A. (2019). Strike (with) a pose: Neural networks are easily fooled by strange poses of familiar objects. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4845–4854. (Cited on page 2)
+[3] Arjovsky, M., Bottou, L., Gulrajani, I., and Lopez-Paz, D. (2019). Invariant risk minimization. arXiv preprint arXiv:1907.02893. (Cited on page 6)
+[4] Bahng, H., Chun, S., Yun, S., Choo, J., and Oh, S. J. (2020). Learning de-biased representations with biased representations. In International Conference on Machine Learning, pages 528–539. PMLR. (Cited on page 6)
+[5] Balestriero, R., Bottou, L., and LeCun, Y. (2022). The effects of regularization and data augmentation are class dependent. arXiv e-prints, pages arXiv–2204. (Cited on page 26)
+[6] Bao, H., Dong, L., and Wei, F. (2021). Beit: Bert pre-training of image transformers. arXiv preprint arXiv:2106.08254. (Cited on page 22)
+[7] Biewald, L. (2020). Experiment tracking with weights and biases. Software available from wandb.com. (Cited on page 18)
+[8] Borkan, D., Dixon, L., Sorensen, J., Thain, N., and Vasserman, L. (2019). Nuanced metrics for measuring unintended bias with real data for text classification. In Companion proceedings of the 2019 world wide web conference, pages 491–500. (Cited on page 4, 19)
+[9] Brendel, W. and Bethge, M. (2019). Approximating cnns with bag-of-local-features models works surprisingly well on imagenet. arXiv preprint arXiv:1904.00760. (Cited on page 2)
+[10] Caron, M., Touvron, H., Misra, I., Jégou, H., Mairal, J., Bojanowski, P., and Joulin, A. (2021). Emerging properties in self-supervised vision transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9650–9660. (Cited on page 10, 22)
+[11] Chen, T., Kornblith, S., Norouzi, M., and Hinton, G. (2020). A simple framework for contrastive learning of visual representations. In International conference on machine learning, pages 1597–1607. PMLR. (Cited on page 10, 22)
+[12] Christie, G., Fendley, N., Wilson, J., and Mukherjee, R. (2018). Functional map of the world. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. (Cited on page 4, 18)
+[13] Creager, E., Jacobsen, J.-H., and Zemel, R. (2021). Environment inference for invariant learning. In International Conference on Machine Learning, pages 2189–2200. PMLR. (Cited on page 2, 5)
+[14] Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. (2018). Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805. (Cited on page 5)
+[15] Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al. (2020). An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929. (Cited on page 7, 22)
+[16] Dwork, C., Hardt, M., Pitassi, T., Reingold, O., and Zemel, R. (2012). Fairness through awareness. In Proceedings of the 3rd innovations in theoretical computer science conference, pages 214–226. (Cited on page 28)
+[17] Eisenstein, J. (2022). Informativeness and invariance: Two perspectives on spurious correlations in natural language. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 4326–4331. (Cited on page 3)
+[18] Geirhos, R., Jacobsen, J.-H., Michaelis, C., Zemel, R., Brendel, W., Bethge, M., and Wichmann, F. A. (2020). Shortcut learning in deep neural networks. Nature Machine Intelligence, 2(11):665–673. (Cited on page 1)
+[19] Geirhos, R., Rubisch, P., Michaelis, C., Bethge, M., Wichmann, F. A., and Brendel, W. (2018). Imagenettrained cnns are biased towards texture; increasing shape bias improves accuracy and robustness. arXiv preprint arXiv:1811.12231. (Cited on page 1, 2) [20] Ghosal, S. S., Ming, Y., and Li, Y. (2022). Are vision transformers robust to spurious correlations? arXiv e-prints, pages arXiv–2203. (Cited on page 2, 7) [21] Goyal, P., Duval, Q., Reizenstein, J., Leavitt, M., Xu, M., Lefaudeux, B., Singh, M., Reis, V., Caron, M., Bojanowski, P., Joulin, A., and Misra, I. (2021). Vissl. https://github.com/facebookresearch/vissl. (Cited on page 18) [22] Gururangan, S., Swayamdipta, S., Levy, O., Schwartz, R., Bowman, S. R., and Smith, N. A. (2018). Annotation artifacts in natural language inference data. arXiv preprint arXiv:1803.02324. (Cited on page 1,
+2) [23] Hardt, M., Price, E., and Srebro, N. (2016). Equality of opportunity in supervised learning. Advances in neural information processing systems, 29. (Cited on page 28) [24] Harris, C. R., Millman, K. J., van der Walt, S. J., Gommers, R., Virtanen, P., Cournapeau, D., Wieser, E., Taylor, J., Berg, S., Smith, N. J., Kern, R., Picus, M., Hoyer, S., van Kerkwijk, M. H., Brett, M., Haldane, A., del Río, J. F., Wiebe, M., Peterson, P., Gérard-Marchant, P., Sheppard, K., Reddy, T., Weckesser, W., Abbasi, H., Gohlke, C., and Oliphant, T. E. (2020). Array programming with NumPy. Nature, 585(7825):357–362. (Cited on page 18) [25] He, K., Chen, X., Xie, S., Li, Y., Dollár, P., and Girshick, R. (2021a). Masked autoencoders are scalable vision learners. arXiv preprint arXiv:2111.06377. (Cited on page 22) [26] He, K., Zhang, X., Ren, S., and Sun, J. (2016). Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778. (Cited on page 5, 22) [27] He, P., Gao, J., and Chen, W. (2021b). Debertav3: Improving deberta using electra-style pre-training with gradient-disentangled embedding sharing. arXiv preprint arXiv:2111.09543. (Cited on page 27) [28] He, P., Liu, X., Gao, J., and Chen, W. (2020). Deberta: Decoding-enhanced bert with disentangled attention. arXiv preprint arXiv:2006.03654. (Cited on page 27) [29] Hendrycks, D., Mu, N., Cubuk, E. D., Zoph, B., Gilmer, J., and Lakshminarayanan, B. (2019). Augmix: A simple data processing method to improve robustness and uncertainty. arXiv preprint arXiv:1912.02781. (Cited on page 22, 26) [30] Hermann, K., Chen, T., and Kornblith, S. (2020). The origins and prevalence of texture bias in convolutional neural networks. Advances in Neural Information Processing Systems, 33:19000–19015. (Cited on page 2) [31] Hermann, K. and Lampinen, A. (2020). What shapes feature representations? exploring datasets, architectures, and training. Advances in Neural Information Processing Systems, 33:9995–10006. (Cited on page
+2) [32] Huang, G., Liu, Z., Van Der Maaten, L., and Weinberger, K. Q. (2017). Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages
+4700–4708. (Cited on page 5, 22) [33] Hunter, J. D. (2007). Matplotlib: A 2d graphics environment. Computing in Science & Engineering,
+9(3):90–95. (Cited on page 18) [34] Idrissi, B. Y., Arjovsky, M., Pezeshki, M., and Lopez-Paz, D. (2021). Simple data balancing achieves competitive worst-group-accuracy. arXiv preprint arXiv:2110.14503. (Cited on page 2, 4, 5, 19, 24) [35] Kang, B., Xie, S., Rohrbach, M., Yan, Z., Gordo, A., Feng, J., and Kalantidis, Y. (2019). Decoupling representation and classifier for long-tailed recognition. arXiv preprint arXiv:1910.09217. (Cited on page 3) [36] Kaushik, D., Hovy, E., and Lipton, Z. (2020). Learning the difference that makes a difference with counterfactually-augmented data. In International Conference on Learning Representations. (Cited on page
+3) [37] Kaushik, D. and Lipton, Z. C. (2018). How much reading does reading comprehension require? a critical investigation of popular benchmarks. arXiv preprint arXiv:1808.04926. (Cited on page 2) [38] Kaushik, D., Setlur, A., Hovy, E., and Lipton, Z. C. (2021). Explaining the efficacy of counterfactually augmented data. International Conference on Learning Representations (ICLR). (Cited on page 3) [39] Khani, F., Raghunathan, A., and Liang, P. (2019). Maximum weighted loss discrepancy. arXiv preprint arXiv:1906.03518. (Cited on page 28)
+
+[40] Kirichenko, P., Izmailov, P., and Wilson, A. G. (2022). Last layer re-training is sufficient for robustness to spurious correlations. arXiv preprint arXiv:2204.02937. (Cited on page 1, 2, 3, 4, 5, 6, 7, 24, 25)
+
+[41] Kleinberg, J., Mullainathan, S., and Raghavan, M. (2016). Inherent trade-offs in the fair determination of risk scores. arXiv preprint arXiv:1609.05807. (Cited on page 28)
+
+[42] Kluyver, T., Ragan-Kelley, B., Pérez, F., Granger, B., Bussonnier, M., Frederic, J., Kelley, K., Hamrick, J., Grout, J., Corlay, S., Ivanov, P., Avila, D., Abdalla, S., and Willing, C. (2016). Jupyter notebooks – a publishing format for reproducible computational workflows. In Loizides, F. and Schmidt, B., editors, Positioning and Power in Academic Publishing: Players, Agents and Agendas, pages 87 – 90. IOS Press. (Cited on page 18)
+
+[43] Koh, P. W., Sagawa, S., Marklund, H., Xie, S. M., Zhang, M., Balsubramani, A., Hu, W., Yasunaga, M., Phillips, R. L., Gao, I., et al. (2021). Wilds: A benchmark of in-the-wild distribution shifts. In International Conference on Machine Learning, pages 5637–5664. PMLR. (Cited on page 2, 4, 8, 18, 19)
+
+[44] Kolesnikov, A., Beyer, L., Zhai, X., Puigcerver, J., Yung, J., Gelly, S., and Houlsby, N. (2020). Big transfer (bit): General visual representation learning. In European conference on computer vision, pages 491–507. Springer. (Cited on page 2)
+
+[45] Kolesnikov, A. and Lampert, C. H. (2016). Improving weakly-supervised object localization by microannotation. arXiv preprint arXiv:1605.05538. (Cited on page 2)
+
+[46] Krizhevsky, A. (2014). One weird trick for parallelizing convolutional neural networks. arXiv preprint arXiv:1404.5997. (Cited on page 22)
+
+[47] Lakshminarayanan, B., Pritzel, A., and Blundell, C. (2017). Simple and scalable predictive uncertainty estimation using deep ensembles. Advances in neural information processing systems, 30. (Cited on page 10)
+
+[48] Lee, Y., Yao, H., and Finn, C. (2022). Diversify and disambiguate: Learning from underspecified data. arXiv preprint arXiv:2202.03418. (Cited on page 2, 4, 5, 6, 7, 10, 19, 28)
+
+[49] Li, Y., Li, Y., and Vasconcelos, N. (2018). Resound: Towards action recognition without representation bias. In Proceedings of the European Conference on Computer Vision (ECCV), pages 513–528. (Cited on page 2)
+
+[50] Liu, E. Z., Haghgoo, B., Chen, A. S., Raghunathan, A., Koh, P. W., Sagawa, S., Liang, P., and Finn, C. (2021). Just train twice: Improving group robustness without training group information. In International Conference on Machine Learning, pages 6781–6792. PMLR. (Cited on page 2, 4, 5, 7)
+
+[51] Liu, Z., Luo, P., Wang, X., and Tang, X. (2015). Deep learning face attributes in the wild. In Proceedings of the IEEE international conference on computer vision, pages 3730–3738. (Cited on page 4, 18)
+
+[52] Liu, Z., Mao, H., Wu, C.-Y., Feichtenhofer, C., Darrell, T., and Xie, S. (2022). A convnet for the 2020s. arXiv preprint arXiv:2201.03545. (Cited on page 2, 22)
+
+[53] Loshchilov, I. and Hutter, F. (2017). Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101. (Cited on page 24, 28)
+
+[54] Lovering, C., Jha, R., Linzen, T., and Pavlick, E. (2020). Predicting inductive biases of pre-trained models. In International Conference on Learning Representations. (Cited on page 3)
+
+[55] Marcel, S. and Rodriguez, Y. (2010). Torchvision the machine-vision package of torch. In Proceedings of the 18th ACM international conference on Multimedia, pages 1485–1488. (Cited on page 18)
+
+[56] McCoy, R. T., Pavlick, E., and Linzen, T. (2019). Right for the wrong reasons: Diagnosing syntactic heuristics in natural language inference. arXiv preprint arXiv:1902.01007. (Cited on page 1, 2)
+
+[57] McKinney, W. (2010). Data structures for statistical computing in python. In van der Walt, S. and Millman, J., editors, Proceedings of the 9th Python in Science Conference, pages 51 – 56. (Cited on page 18)
+
+[58] Menon, A. K., Rawat, A. S., and Kumar, S. (2020). Overparameterisation and worst-case generalisation: friend or foe? In International Conference on Learning Representations. (Cited on page 3)
+
+[59] Miller, J. P., Taori, R., Raghunathan, A., Sagawa, S., Koh, P. W., Shankar, V., Liang, P., Carmon, Y., and Schmidt, L. (2021). Accuracy on the line: on the strong correlation between out-of-distribution and in-distribution generalization. In International Conference on Machine Learning, pages 7721–7735. PMLR. (Cited on page 7)
+
+[60] Mo, S., Kang, H., Sohn, K., Li, C.-L., and Shin, J. (2021). Object-aware contrastive learning for debiased scene representation. Advances in Neural Information Processing Systems, 34. (Cited on page 2)
+[61] Moayeri, M., Pope, P., Balaji, Y., and Feizi, S. (2022). A comprehensive study of image classification model sensitivity to foregrounds, backgrounds, and visual attributes. arXiv preprint arXiv:2201.10766. (Cited on page 2)
+[62] Nam, J., Cha, H., Ahn, S., Lee, J., and Shin, J. (2020). Learning from failure: De-biasing classifier from biased classifier. Advances in Neural Information Processing Systems, 33:20673–20684. (Cited on page 2)
+[63] Nam, J., Kim, J., Lee, J., and Shin, J. (2022). Spread spurious attribute: Improving worst-group accuracy with spurious attribute estimation. In International Conference on Learning Representations. (Cited on page 2, 4, 7, 8)
+[64] Niven, T. and Kao, H.-Y. (2019). Probing neural network comprehension of natural language arguments. arXiv preprint arXiv:1907.07355. (Cited on page 2)
+[65] Oakden-Rayner, L., Dunnmon, J., Carneiro, G., and Ré, C. (2020). Hidden stratification causes clinically meaningful failures in machine learning for medical imaging. In Proceedings of the ACM conference on health, inference, and learning, pages 151–159. (Cited on page 2, 4, 5, 18, 19)
+[66] Pagliardini, M., Jaggi, M., Fleuret, F., and Karimireddy, S. P. (2022). Agree to disagree: Diversity through disagreement for better transferability. arXiv preprint arXiv:2202.04414. (Cited on page 2)
+[67] Paszke, A., Gross, S., Chintala, S., Chanan, G., Yang, E., DeVito, Z., Lin, Z., Desmaison, A., Antiga, L., and Lerer, A. (2017). Automatic differentiation in pytorch. (Cited on page 18)
+[68] Pezeshki, M., Kaba, O., Bengio, Y., Courville, A. C., Precup, D., and Lajoie, G. (2021). Gradient starvation: A learning proclivity in neural networks. Advances in Neural Information Processing Systems, 34. (Cited on page 10)
+[69] Pleiss, G., Raghavan, M., Wu, F., Kleinberg, J., and Weinberger, K. Q. (2017). On fairness and calibration. Advances in neural information processing systems, 30. (Cited on page 28)
+[70] Rajpurkar, P., Irvin, J., Zhu, K., Yang, B., Mehta, H., Duan, T., Ding, D., Bagul, A., Langlotz, C., Shpanskaya, K., et al. (2017). Chexnet: Radiologist-level pneumonia detection on chest x-rays with deep learning. arXiv preprint arXiv:1711.05225. (Cited on page 4, 5, 19)
+[71] Robbins, H. and Monro, S. (1951). A stochastic approximation method. The annals of mathematical statistics, pages 400–407. (Cited on page 24)
+[72] Rosenfeld, A., Zemel, R., and Tsotsos, J. K. (2018). The elephant in the room. arXiv preprint arXiv:1808.03305. (Cited on page 2)
+[73] Rosenfeld, E., Ravikumar, P., and Risteski, A. (2022). Domain-adjusted regression or: Erm may already learn features sufficient for out-of-distribution generalization. arXiv preprint arXiv:2202.06856. (Cited on page 3)
+[74] Ruan, Y., Dubois, Y., and Maddison, C. J. (2021). Optimal representations for covariate shift. arXiv preprint arXiv:2201.00057. (Cited on page 6)
+[75] Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., Huang, Z., Karpathy, A., Khosla, A., Bernstein, M., et al. (2015). Imagenet large scale visual recognition challenge. International journal of computer vision, 115(3):211–252. (Cited on page 4, 5)
+[76] Sagawa, S., Koh, P. W., Hashimoto, T. B., and Liang, P. (2019). Distributionally robust neural networks for group shifts: On the importance of regularization for worst-case generalization. arXiv preprint arXiv:1911.08731. (Cited on page 2, 4, 5, 7, 18, 23, 24, 26, 27)
+[77] Sagawa, S., Koh, P. W., Lee, T., Gao, I., Xie, S. M., Shen, K., Kumar, A., Hu, W., Yasunaga, M., Marklund, H., et al. (2021). Extending the wilds benchmark for unsupervised adaptation. arXiv preprint arXiv:2112.05090. (Cited on page 4, 18, 19)
+[78] Sagawa, S., Raghunathan, A., Koh, P. W., and Liang, P. (2020). An investigation of why overparameterization exacerbates spurious correlations. In International Conference on Machine Learning, pages 8346–8356. PMLR. (Cited on page 2)
+[79] Shah, H., Tamuly, K., Raghunathan, A., Jain, P., and Netrapalli, P. (2020). The pitfalls of simplicity bias in neural networks. Advances in Neural Information Processing Systems, 33:9573–9585. (Cited on page 1)
+[80] Shetty, R., Schiele, B., and Fritz, M. (2019). Not using the car to see the sidewalk–quantifying and controlling the effects of context in classification and segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8218–8226. (Cited on page 2)
+[81] Shi, Y., Daunhawer, I., Vogt, J. E., Torr, P. H., and Sanyal, A. (2022). How robust are pre-trained models to distribution shift? arXiv preprint arXiv:2206.08871. (Cited on page 3)
+[82] Simonyan, K. and Zisserman, A. (2014). Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556. (Cited on page 22)
+[83] Singla, S. and Feizi, S. (2021). Salient imagenet: How to discover spurious features in deep learning? arXiv preprint arXiv:2110.04301. (Cited on page 2)
+[84] Sohoni, N., Sanjabi, M., Ballas, N., Grover, A., Nie, S., Firooz, H., and Ré, C. (2021). Barack: Partially supervised group robustness with guarantees. arXiv preprint arXiv:2201.00072. (Cited on page 2, 7)
+[85] Teney, D., Abbasnejad, E., Lucey, S., and Hengel, A. v. d. (2021). Evading the simplicity bias: Training a diverse set of models discovers solutions with superior ood generalization. arXiv preprint arXiv:2105.05612. (Cited on page 2, 28)
+[86] Veitch, V., D’Amour, A., Yadlowsky, S., and Eisenstein, J. (2021). Counterfactual invariance to spurious correlations: Why and how to pass stress tests. arXiv preprint arXiv:2106.00545. (Cited on page 3)
+[87] Virtanen, P., Gommers, R., Oliphant, T. E., Haberland, M., Reddy, T., Cournapeau, D., Burovski, E., Peterson, P., Weckesser, W., Bright, J., van der Walt, S. J., Brett, M., Wilson, J., Millman, K. J., Mayorov, N., Nelson, A. R. J., Jones, E., Kern, R., Larson, E., Carey, C. J., Polat, ˙I., Feng, Y., Moore, E. W., VanderPlas, J., Laxalde, D., Perktold, J., Cimrman, R., Henriksen, I., Quintero, E. A., Harris, C. R., Archibald, A. M., Ribeiro, A. H., Pedregosa, F., van Mulbregt, P., and SciPy 1.0 Contributors (2020). SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python. Nature Methods, 17:261–272. (Cited on page 18)
+[88] Wah, C., Branson, S., Welinder, P., Perona, P., and Belongie, S. (2011). The caltech-ucsd birds-200-2011 dataset. (Cited on page 18)
+[89] Wang, X., Peng, Y., Lu, L., Lu, Z., Bagheri, M., and Summers, R. M. (2017). Chestx-ray8: Hospitalscale chest x-ray database and benchmarks on weakly-supervised classification and localization of common thorax diseases. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2097–2106. (Cited on page 4, 18)
+[90] Wightman, R. (2019). Pytorch image models. https://github.com/rwightman/ pytorch-image-models. (Cited on page 18)
+[91] Williams, A., Nangia, N., and Bowman, S. R. (2017). A broad-coverage challenge corpus for sentence understanding through inference. arXiv preprint arXiv:1704.05426. (Cited on page 4, 29)
+[92] Wolf, T., Debut, L., Sanh, V., Chaumond, J., Delangue, C., Moi, A., Cistac, P., Rault, T., Louf, R., Funtowicz, M., et al. (2019). Huggingface’s transformers: State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771. (Cited on page 18)
+[93] Xiao, K., Engstrom, L., Ilyas, A., and Madry, A. (2020). Noise or signal: The role of image backgrounds in object recognition. arXiv preprint arXiv:2006.09994. (Cited on page 1, 2)
+[94] Xie, S., Girshick, R., Dollár, P., Tu, Z., and He, K. (2017). Aggregated residual transformations for deep neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1492–1500. (Cited on page 22)
+[95] Zagoruyko, S. and Komodakis, N. (2016). Wide residual networks. arXiv preprint arXiv:1605.07146. (Cited on page 22)
+[96] Zbontar, J., Jing, L., Misra, I., LeCun, Y., and Deny, S. (2021). Barlow twins: Self-supervised learning via redundancy reduction. In International Conference on Machine Learning, pages 12310–12320. PMLR. (Cited on page 10, 22)
+[97] Zech, J. R., Badgeley, M. A., Liu, M., Costa, A. B., Titano, J. J., and Oermann, E. K. (2018). Variable generalization performance of a deep learning model to detect pneumonia in chest radiographs: a crosssectional study. PLoS medicine, 15(11):e1002683. (Cited on page 1, 2)
+[98] Zhang, H., Cisse, M., Dauphin, Y. N., and Lopez-Paz, D. (2017). mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412. (Cited on page 22, 26)
+[99] Zhang, J., Lopez-Paz, D., and Bottou, L. (2022). Rich feature construction for the optimizationgeneralization dilemma. arXiv preprint arXiv:2203.15516. (Cited on page 6, 10)
+[100] Zhang, M., Sohoni, N. S., Zhang, H. R., Finn, C., and Ré, C. (2021). Correct-n-contrast: A contrastive approach for improving robustness to spurious correlations. In NeurIPS 2021 Workshop on Distribution Shifts: Connecting Methods and Applications. (Cited on page 2, 6, 7)
+[101] Zhong, Z., Zheng, L., Kang, G., Li, S., and Yang, Y. (2020). Random erasing data augmentation. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pages 13001–13008. (Cited on page 22, 26)
+[102] Zhou, B., Lapedriza, A., Khosla, A., Oliva, A., and Torralba, A. (2017). Places: A 10 million image database for scene recognition. IEEE transactions on pattern analysis and machine intelligence, 40(6):1452– 1464. (Cited on page 18)
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes] Limitations are described in the appendix.
+(c) Did you discuss any potential negative societal impacts of your work? [Yes] Broader impact is descussed in the appendix.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [N/A] No theoretical results. (b) Did you include complete proofs of all theoretical results? [N/A] No theoretical results.
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes]
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] We report errorbars for the main experimental results in the appendix.
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] We include an estimate of the total compute used in the appendix.
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [Yes] We mention the license of all assets in the appendix.
+(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] Not including new assets.
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] Not including new assets
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] Not including new assets
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] No research on human subjects or crowdsourcing.
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] No research on human subjects or crowdsourcing.
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] No research on human subjects or crowdsourcing.
\ No newline at end of file
diff --git a/md/dev/wYqLTy4wkor/wYqLTy4wkor.md b/md/dev/wYqLTy4wkor/wYqLTy4wkor.md
new file mode 100644
index 0000000000000000000000000000000000000000..89726eee5ad3233ffa64b8f9e5e5c3554f7fb5ed
--- /dev/null
+++ b/md/dev/wYqLTy4wkor/wYqLTy4wkor.md
@@ -0,0 +1,273 @@
+# GROUNDING ALEATORIC UNCERTAINTY IN UNSUPERVISED ENVIRONMENT DESIGN
+
+Anonymous authors Paper under double-blind review
+
+# ABSTRACT
+
+In reinforcement learning (RL), adaptive curricula have proven highly effective for learning policies that generalize well under a wide variety of changes to the environment. Recently, the framework of Unsupervised Environment Design (UED) generalized notions of curricula for RL in terms of generating entire environments, leading to the development of new methods with robust minimaxregret properties. However, in partially-observable or stochastic settings (those featuring aleatoric uncertainty), optimal policies may depend on the groundtruth distribution over the aleatoric features of the environment. Such settings are potentially problematic for curriculum learning, which necessarily shifts the environment distribution used during training with respect to the fixed groundtruth distribution in the intended deployment environment. We formalize this phenomenon as curriculum-induced covariate shift, and describe how, when the distribution shift occurs over such aleatoric environment parameters, it can lead to learning suboptimal policies. We then propose a method which, given black-box access to a simulator, corrects this resultant bias by aligning the advantage estimates to the ground-truth distribution over aleatoric parameters. This approach leads to a minimax-regret UED method, SAMPLR, with Bayes-optimal guarantees.
+
+# 1 INTRODUCTION
+
+Adaptive curricula, which dynamically adjust the distribution of training environments to optimize the performance of the resulting policy, have played a key role in many recent achievements in deep reinforcement learning (RL). Applications have spanned both single-agent RL (Portelas et al., 2020; Wang et al., 2019; Zhong et al., 2020; Justesen et al., 2018), where adaptation occurs over environment variations, and multi-agent RL (MARL), where adaptation can additionally occur over co-players (Silver et al., 2016; Vinyals et al., 2019; Stooke et al., 2021). By presenting the agent with challenges at the threshold of its abilities, such methods demonstrably improve the sample efficiency and the generality of the final policy (Matiisen et al., 2017; Dennis et al., 2020; Jiang et al., 2021b;a).
+
+This work introduces a fundamental problem relevant to adaptive curriculum learning methods for RL, which we call curriculum-induced covariate shift (CICS). Analogous to the covariate shift that occurs in supervised learning (SL), CICS refers to a mismatch between the input distribution at training and test time, and in this case, specifically when the distribution shift is caused by the selective sampling performed by an adaptive curriculum. While there may be cases in which CICS impacts model performance in SL, adaptive curricula for SL have generally not been found to be as impactful as in RL (Wu et al., 2021). Therefore, here we focus on addressing this problem specifically as it arises in the RL setting, and leave investigation of its potential impact in SL to future work.
+
+To establish precise language around adaptive curricula, we cast our discussion under the lens of Unsupervised Environment Design (UED, Dennis et al., 2020). UED provides a formal problem description for which curriculum learning is the solution, by defining the Underspecified POMDP (UPOMDP; see Section 2), which expands the classic POMDP with a set of free parameters $\Theta$ , representing the dimensions along which the environment may vary across episodes. The goal of UED is then to adapt distributions over $\Theta$ , so to maximize some objective, which could be tied to an RL agent’s performance over this distribution. This allows us to view adaptive curricula as emerging via a multi-agent game between a teacher that proposes environments with parameters $\theta \sim \Theta$ and a student that learns to solve them. In addition to the notational clarity it provides, this formalism lends the analysis of adaptive curricula to useful game theoretic constructs, such as Nash equilibria (NE, Nash et al., 1950).
+
+
+Figure 1: Adaptive curricula can result in covariate shifts in environment parameters with respect to a fixed ground-truth distribution ${ \overline { { P } } } ( \theta )$ (see top path), e.g. whether apple or banana is the correct fruit to choose per level. Here, the policy $\pi _ { > }$ $( \pi _ { \mathcal { J } } )$ always chooses apple (banana). Our method, SAMPLR (bottom path) matches the advantages in sampled levels to the advantages observed if sampling levels from ${ \overline { { P } } } ( \theta )$ (blue triangles), thus constraining the optimal policy under the curriculum distribution $P ( \theta )$ to match that under ${ \overline { { P } } } ( \theta )$ .
+
+This game-theoretic view has led to the development of curriculum methods with principled robustness guarantees, such as PAIRED (Dennis et al., 2020) and Prioritized Level Replay (PLR, Jiang et al., 2021a), which showed that curricula optimizing for the student’s regret lead to minimax regret (Savage, 1951) policies at Nash equilibria, implying the agent can solve all solvable environments within the training domain. While other methods can also be cast in this framework, they do not hold the same desirable property at equilibrium. For this reason, we will focus on addressing CICS for regret-maximizing UED, but note that our solution can be used with other UED methods.
+
+To see how the CICS can be problematic, consider the simplified case of training a self-driving car in simulation, so it learns to take the fastest route from home to office. Suppose traffic data shows on $70 \%$ of the days, Route 1 is faster than Route 2. Moreover, on any given day the self-driving car cannot infer which route is faster ahead of time, so always picking Route 1 is faster in expectation. To support training a policy using an adaptive curriculum, one could build a simulator which sets road conditions per episode based on a random day sampled from the traffic data. However, adaptive curriculum over the traffic settings may oversample days when Route 1 is closed—perhaps because it finds the agent needs more practice on Route 2—shifting the best choice to Route 2 in training. In fact, methods for minimax regret UED like PLR would keep shifting the distribution of fastest route, to maximize the agent’s regret. Their curriculum dynamics would map to the zero-sum game of matching pennies, in which one player wins for guessing whether the other chose heads or tails; the NE corresponds to each player randomly playing each option half the time. Randomly picking the route in this way is suboptimal, because in reality Route 1 is faster in expectation. This example is depicted in Figure 1, where the two routes are replaced by an apple and banana.
+
+If, on a given day, the faster route could be identified before having to pick one, the agent could choose optimally. Instead, it is an aleatoric parameter, inducing irreducible uncertainty in the limit of infinite experiential data (Der Kiureghian & Ditlevsen, 2009). When CICS occurs over such parameters, with respect to a ground-truth distribution of environments $\overline { { P } } ( \boldsymbol { \theta } )$ , the learned policy can be suboptimal with respect to $\overline { { P } }$ . It can therefore be useful to ground—that is, to constrain—the aleatoric parameters $\Theta ^ { \prime } \subset \Theta$ to $\overline { { P } } ( \theta ^ { \prime } )$ when it is known or can be learned, as in simulation or from real-world data. However, grounding all $\theta$ is undesirable, preventing the curriculum from sampling enough opportunities to learn from useful scenarios with low support under ${ \overline { { P } } } ( \theta )$ .
+
+In this work, we formalize the problem of CICS in RL, and provide a solution by proposing a UED method to find robustly Bayes-optimal policies where $\theta ^ { \prime }$ is grounded to $\overline { { P } } ( \theta ^ { \prime } )$ . Our solution called Sample-Matched PLR (SAMPLR) extends PLR, a state-of-the-art UED algorithm, by constraining the advantage estimates to match those observed if training under $\overline { { P } } ( \theta ^ { \prime } )$ . This advantage correction adapts Off-Belief Learning (Hu et al., 2021) from cooperative MARL, revealing an intriguing connection between curriculum biases observed in single and multi-agent RL. Our experiments in challenging environments based on the NetHack Learning Environment (NLE, Küttler et al., 2020) demonstrate that SAMPLR learns near-optimal policies under CICS, in cases where standard PLR fails.
+
+# 2 BACKGROUND
+
+# 2.1 UNSUPERVISED ENVIRONMENT DESIGN
+
+The problem of Unsupervised Environment Design (UED, Dennis et al. (2020)) is the problem of automatically generating an adaptive distribution of environments which will lead to policies that successfully transfer within a target domain. The domain of possible environments is represented by an Underspecified POMDP (UPOMDP), which adds a set of free parameters to the standard definition of a POMDP, along which each concrete instantiation, or level, of the UPOMDP. For instance, these free parameters can be the position of obstacles in a maze, or friction coefficients in a physics-based task. Formally a UPOMDP is defined as a tuple $\mathcal { M } = \langle A , O , \Theta , S , T , \mathcal { I } , \mathcal { R } , \gamma \rangle$ , where $A$ is a set of actions, $O$ is a set of observations, $\Theta$ is a set of free parameters, $S$ is a set of states, $\mathcal { T } : S \times A \times \Theta \to \Delta ( S )$ is a transition function, $\mathcal { T } : S O$ is an observation (or inspection) function, $\mathcal { R } : S \mathbb { R }$ is a reward function, and $\gamma$ is a discount factor. UED typically approaches the curriculum design problem as training a teacher agent that co-evolves an adversarial curriculum for a student agent, for example, by maximizing the student’s regret.
+
+We will focus on a recent UED algorithm called Robust Prioritized Level Replay $( { \mathrm { P L R } } ^ { \perp }$ , Jiang et al., 2021b), which performs environment design via random search. PLR maintains a buffer of the most useful levels for training, according to some learning potential score—typically based on a regret approximation, such as the positive value loss—and with probability $p$ , actively samples the next training level from this level buffer instead of the ground-truth training distribution. This selective-sampling mechanism has been demonstrated to greatly improve sample-efficiency and generalization in several domains, while provably leading to a minimax regret policy for the student at NE. In maximizing regret, PLR curricula naturally avoid unsolvable levels, which have no regret.
+
+# 2.2 OFF-BELIEF LEARNING
+
+In cooperative MARL, self-play promotes the formation of cryptic conventions—arbitrary sequences of actions that allow agents to communicate information about the environment state. These conventions are learned jointly among all agents during training, but are arbitrary and hence, indecipherable to independently-trained agents or humans at test time. Crucially, this leads to policies that fail to perform zero-shot coordination (ZSC, Hu et al., 2020), where independentlytrained agents must cooperate successfully without additional learning steps, or ad-hoc team play. Off-Belief Learning (OBL) resolves this problem by forcing agents to assume their co-players act according to a fixed, known policy $\pi _ { 0 }$ until the current time $t$ , and optimally afterwards, conditioned on this assumption. If $\pi _ { 0 }$ is playing uniformly random, this removes the possibility of forming arbitrary conventions.
+
+Formally, let $G$ be a decentralized, partially-observable MDP (Dec-POMDP, Bernstein et al., 2002), with state $s$ , joint action $a$ , observation function ${ \mathcal { T } } ^ { i } ( s )$ for each player $i$ , and transition function ${ \mathcal { T } } ( s , a )$ . Let the historical trajectory $\tau = ( s _ { 1 } , a _ { 1 } , . . . a _ { t - 1 } , s _ { t } )$ , and the action-observation history (AOH) for agent $i$ be $\tau ^ { i } = ( \mathcal { T } ^ { i } ( s _ { 1 } ) , a _ { 1 } , . . . , a _ { t - 1 } , \mathcal { T } ^ { i } ( s _ { t } ) )$ . Further, let $\pi _ { 0 }$ be an arbitrary policy, such as a uniformly random policy, and $B _ { \pi _ { 0 } } ( \tau | \tau ^ { i } ) = P ( \tau _ { t } | \tau _ { t } ^ { i } , \pi _ { 0 } )$ , a belief model predicting the current state, conditioned on the AOH of agent $i$ and the assumption of co-players playing policy $\pi _ { 0 }$ until the current time $t$ , and optimally according to $\pi _ { 1 }$ from $t$ and beyond. OBL aims to find the policy $\pi _ { 1 }$ with the optimal, counter-factual value function,
+
+$$
+V ^ { \pi _ { 0 } \pi _ { 1 } } ( \tau ^ { i } ) = \mathbb { E } _ { \tau \sim \mathcal { B } _ { \pi _ { 0 } } ( \tau ^ { i } ) } [ V ^ { \pi _ { 1 } } ( \tau ) ] .
+$$
+
+As the agent conditions its policy on the realized $\operatorname { A O H } \tau ^ { i }$ , while transition dynamics are based on states sampled from $\boldsymbol { B }$ , this mechanism is called a fictitious transition. In Section 5, we show how OBL’s fictitious transition can be adapted to the single-agent curriculum learning setting to address CICS, by interpreting the curriculum designer in UED as a co-player.
+
+# 3 RELATED WORK
+
+The mismatch between training and testing distributions of input features is referred to as covariate shift, and has long served as a fundamental problem for the machine learning community. Covariate shifts have been extensively studied in supervised learning (Vapnik & Chervonenkis, 1971; Huang et al., 2006; Bickel et al., 2009; Arjovsky et al., 2019). In RL, prior works have largely focused on covariate shifts due to training on off-policy data (Sutton et al., 2016; Rowland et al., 2020; Espeholt et al., 2018; Hallak & Mannor, 2017; Gelada & Bellemare, 2019; Thomas & Brunskill, 2016) including the important case of learning from demonstrations (Pomerleau, 1988; Ross & Bagnell, 2010). Recent work also aims to learn invariant representations robust to covariate shifts (Zhang et al., 2019; 2021). More generally, CICS can be interpreted as a kind of sample-selection bias (Heckman, 1979). We believe this work to be the first to formalize and provide a solution to the problem of covariate shifts in reinforcement learning due to curriculum learning.
+
+Our method fixes a critical flaw that can cause curricula to fail under CICS—an important problem as curricula have been shown to be essential for training RL agents across many of the most challenging domains, including combinatorial gridworlds (Zhong et al., 2020), Go (Silver et al., 2016), StarCraft 2 (Vinyals et al., 2019), and achieving comprehensive task mastery in open-ended environments (Stooke et al., 2021). While this work focuses on PLR, other recent methods include minimax adversarial curricula (Wang et al., 2019; 2020) and curricula based on changes in return (Matiisen et al., 2017; Portelas et al., 2020). Most similar to our work, OFFER (Ciosek & Whiteson, 2017) adapts a curriculum over transition functions and uses importance sampling to correct for biased gradient estimates. Unlike this work, Ciosek & Whiteson (2017) requires whitebox access to the transition function and does not directly study the impact of CICS on the learning dynamics. Curriculum methods have also been studied in goal-conditioned RL (Florensa et al., 2018; Campero et al., 2021; Sukhbaatar et al., 2018; OpenAI et al., 2021), though CICS does not occur here as goals are observed by the agent. Lastly, domain randomization (DR, Sadeghi & Levine, 2017; Peng et al., 2017) can be seen as a degenerate form of UED, though curriculum-based extensions of DR have also been studied (Jakobi, 1997; Tobin et al., 2017).
+
+Prior work has also investigated methods for learning Bayes optimal policies under uncertainty about the task (Zintgraf et al., 2020; Osband et al., 2013), based on the framework of Bayes-adaptive MDPs (BAMDPs) (Bellman, 1956; Duff, 2002). In this setting, the agent can adapt to an unknown MDP over several episodes by acting to reduce its uncertainty about the identity of the MDP. In contrast, SAMPLR learns a robustly Bayes optimal policy for the case of zero-shot transfer. Further unlike these works, our setting assumes the distribution of certain aleatoric parameters are biased during training, which would lead to biased a posteriori uncertainty estimates with respect to the ground-truth distribution when optimizing for the BAMDP objective. Instead, SAMPLR proposes a means to correct for this bias assuming knowledge of the true environment parameters for each level, to which we can safely assume access in curriculum learning.
+
+# 4 CURRICULUM-INDUCED COVARIATE SHIFT
+
+As UED algorithms formulate curriculum learning as a multi-agent game between teacher and student agents, we can formalize when CICS become problematic by considering the equilibrium point of this game: Let $\theta$ be the environment parameters controlled by UED, $\overline { { P } } ( \boldsymbol { \theta } )$ , the ground truth distribution of $\theta$ , and $P ( \theta )$ , the curriculum distribution at equilibrium. Further, let $\tau _ { t }$ be $\mathbf { \bar { \rho } } ( o _ { 1 } , a _ { 1 } , . . . , a _ { t - 1 } , o _ { t } )$ , the student agent’s action-observation history (AOH) until time $t$ (though we will use simply $\tau$ when clear from context). The optimal action-value function $Q ^ { * }$ with respect to ${ \overline { { P } } } ( \theta )$ can then be expressed as a marginalization over $\theta$ :
+
+$$
+\begin{array} { r l } & { \overline { { \boldsymbol { Q } } } ^ { * } ( \boldsymbol { a } _ { t } | \tau _ { t } ) = \underbrace { \mathbb { E } \tau _ { t + 1 : \infty } } _ { \approx \pi ^ { * } } \left[ \displaystyle \sum _ { l = 0 } ^ { \infty } \gamma ^ { l } \boldsymbol { r } _ { t + l } \right] = \displaystyle \sum _ { \theta } \overline { { P } } ( \theta | \tau _ { t } ) \overline { { Q } } _ { \overline { { P } } } ^ { * } ( \boldsymbol { a } _ { t } | \tau _ { t } , \theta ) } \\ & { \qquad \propto \displaystyle \sum _ { \theta } \overline { { P } } ( \theta ) \overline { { P } } ( \tau _ { t } | \theta ) \overline { { Q } } _ { \overline { { P } } } ^ { * } ( \boldsymbol { a } _ { t } | \tau _ { t } , \theta ) . } \end{array}
+$$
+
+From Equation 2, we see that $\overline { { Q } } ^ { * } ( a _ { t } | \tau _ { t } )$ remains optimal under different values of ${ \overline { { P } } } ( \theta )$ at each time $t$ as long as it is possible to infer $\theta$ deterministically from $\tau _ { t }$ , implying that $\overline { { P } } ( \theta ^ { \prime } | \tau _ { t } ) = 1$ for some $\theta$ , in which case the RHS of Equation 1 reduces to the LHS. If $\overline { { P } } ( \theta | \tau _ { t } ) < 1$ for all $\theta$ , then some subset $\theta ^ { \prime } \subset \Theta$ results in irreducible uncertainty at time $t$ , thereby constituting aleatoric parameters. Letting $Q ^ { * } ( a _ { t } | \tau _ { t } )$ be the optimal action-value function when $\overline { { P } } ( \overline { { \theta } } )$ is replaced with $P ( \theta )$ in Equation 2, we can then state that curriculum-induced covariate shift results in suboptimal policies with respect to the ground truth distribution when
+
+
+Figure 2: A standard RL transition (left) and the fictitious transition used by SAMPLR (right).
+
+$$
+\arg \operatorname* { m a x } _ { a } Q ^ { * } ( a | \tau _ { t } ) \neq \arg \operatorname* { m a x } _ { a } \overline { { Q } } ^ { * } ( a | \tau _ { t } ) .
+$$
+
+Moreover, this formulation highlights how this effect results from the presence of aleatoric parameters.
+
+This description categorizes errors made by a policy trained on $P$ evaluated on levels drawn from ${ \overline { { P } } } ( \theta )$ into two categories: The first type of error, which we call a mistake, simply arises when $P ( \theta ^ { \prime \prime } ) = \dot { 0 }$ for some non-aleatoric $\theta ^ { \prime \prime }$ where $\overline { { P } } ( \theta ^ { \prime \prime } ) > 0$ , i.e. the policy did not train on trajectories needed to learn to behave optimally under some set of otherwise identifiable level parameters. This is distinct from the second kind of error, which we call a misunderstanding, and which corresponds to the problematic mismatch between training and test time distributions of specifically aleatoric parameters $\theta ^ { \prime }$ , so that $P ( \theta ^ { \prime } ) \neq \overline { { P } } ( \theta ^ { \prime } )$ , as we just previously characterized.
+
+This taxonomy also clarifies errors in cooperative MARL, where the co-players shape environment interactions, and thus play a similar role to the UED teacher. Failures in ZSC can then be diagnosed as due to (i) a mistake, because the co-players fail to generate trajectories that occur with test-time co-players; or (ii), a misunderstanding, because the train-time co-players shift the training distribution of aleatoric parameters $P ( \theta ^ { \prime } )$ , which impacts the inference of $\begin{array} { r } { \overline { { P } } \dot { ( \tau ) } = \sum _ { \theta ^ { \prime } } \overline { { P } } ( \theta ^ { \prime } ) \overline { { P } } ( \tau | \theta ^ { \prime } ) } \end{array}$ needed for optimal cooperation—for example, through the use of cryptic conventions. This view then connects generalization errors in cooperative MARL to those in single-agent RL, implying that methods like OBL devised to solve one type of error in one of the settings may be adapted for the other. Indeed, we now describe our method, which does exactly this: By adapting OBL to single-agent curriculum learning, we can ground the values of $\overline { { P } } ( \theta ^ { \prime } | \tau _ { t } )$ by forcing $P ( { \hat { \theta } } ^ { \prime } ) = \overline { { P } } ( \theta ^ { \prime } )$ , thereby ensuring that the distribution of the aleatoric parameters at equilibrium is equivalent to their ground truth distribution.
+
+# 5 SAMPLE-MATCHED PLR (SAMPLR)
+
+We now describe how OBL’s fictitious transition can be adapted for $\mathrm { \bf P I R ^ { \perp } }$ (Jiang et al., 2021a) to address CICS, resulting in Sample-Matched PLR (SAMPLR). To avoid CICS, we must ground $\theta ^ { \prime }$ to the ground-truth distribution $\overline { { P } } ( \theta ^ { \prime } )$ , while allowing the remaining parameters in $\Theta$ to vary under UED, so as to still benefit from a curriculum. To achieve this, we adapt the fictitious transition to single-agent curriculum learning by treating the UED teacher as a co-player—one that performs the single action of choosing the level $\theta$ at the start of each episode, and subsequently performs no-ops. Under this fictitious transition, we ground the teacher’s choice of $\theta$ such that the aleatoric parameters $\theta ^ { \prime }$ are assumed to be sampled from ${ \overline { { P } } } ( \theta )$ .
+
+Thus, at each time $t$ , the agent takes actions $a _ { t }$ based on its AOH as usual, but estimates the advantage $A ( a _ { t } , s _ { t } )$ using fictitious transitions, which assume subsequent state transitions and rewards occur with $\Theta ^ { \prime }$ fixed to $\theta ^ { \prime } \sim \overline { { P } } ( \theta ^ { \prime } )$ , sampled at the start of the episode. More formally, the fictitious transition is performed as $s _ { t } ^ { \prime } \sim \dot { B } ( \dot { s } _ { t } ^ { \prime } | \tau )$ , $\bar { a } _ { t } \sim \pi ( \cdot | \tau )$ , $s _ { t + 1 } ^ { \prime } = \dot { \mathcal T } ( s _ { t } ^ { \prime } , a _ { t } )$ , and $r _ { t } ^ { \prime } = \dot { \mathcal { R } } ( s _ { t + 1 } )$ , where $\tau$ is the
+
+Algorithm 1: Sample-Matched PLR (SAMPLR)
+
+
Randomly initialize policyπ(Φ),an empty level buffer Λof size K,and belief model B(st|T). while not converged do Sample replay-decision Bernoulli,d~ PD(d)
if d=O or|A|=O then
Sample level θ from level generator
Collect π's trajectory T on θ, with a stop-gradient Φ⊥
Use observed ground-truth states to update B
else
Use PLR to sample a replay level from the level store,θ ~ Λ
Collect fictitious trajectory T' on 0,based on s't ~ B
Update π with rewards R(T')
end
Compute PLR score, S = score(T',π)
Update Λ with θ using score S end
+
+AOH of the student. Figure 2 summarizes this transition mechanism. Here, the belief model $\boldsymbol { B } ( \boldsymbol { s } _ { t } | \tau )$ can be expressed as
+
+$$
+B ( s _ { t } | \tau ) = \sum _ { \theta ^ { \prime } } \overline { { P } } ( s _ { t } | \tau , \theta ^ { \prime } ) \overline { { P } } ( \theta ^ { \prime } | \tau ) .
+$$
+
+This shows that, assuming blackbox simulator access, we can generally implement $\boldsymbol { B }$ as follows: Periwith $\theta ^ { \prime } \sim \overline { { P } } ( \theta ^ { \prime } )$ ring training, . We use these $\{ ( \theta _ { k } ^ { \prime } , \tau _ { k } ) \} _ { k = 1 } ^ { N }$ $N$ trajectories, such that each is gepairs to update a posterior model ${ \overline { { P } } } ( \theta ^ { \prime } | \tau )$ under a level that predicts the underlying $\theta ^ { \prime }$ given $\tau$ . We can then sample from by first sampling $\theta \sim \overline { { P } } ( \theta ^ { \prime } | \tau )$ , followed by stepping forward a parallel simulator that has been initially reset to the current AOH $\tau$ , with fixed $\Theta ^ { \prime } = \theta ^ { \prime }$ , thereby yielding a desired sample of $s _ { t }$ according to $\boldsymbol { B }$ .
+
+In practice, it is often the case that $\theta ^ { \prime }$ can be uniquely identified by some revelatory event by time $t$ , so that $\overline { { { \cal P } } } ( \theta ^ { \prime } | \tau ) = 1$ for some $\theta ^ { \prime }$ and $\tau$ , and $\overline { { P } } ( s _ { t } | \tau , \mathbf { \dot { \theta } } ^ { \prime } ) = \overline { { P } } ( s _ { t } | \check { \tau } )$ otherwise. In this case, we can implement the fictitious transition by setting $\theta ^ { \prime } \sim \overline { { P } } ( \theta ^ { \prime } )$ at the start of each episode; subsequent transitions will then be consistent with $\boldsymbol { B }$ . For example, in the fruit choice example, whether apple or banana was the right goal is deterministically revealed by the final reward, and otherwise, does not impact transition dynamics. Additionally, we often only have limited access to $\overline { { P } } ( \theta )$ throughout training, for example, if sampling ${ \overline { { P } } } ( \theta )$ is costly. In this case, we can learn an estimate $\hat { P } ( \theta ^ { \prime } )$ using the samples we do collect from ${ \overline { { P } } } ( \theta )$ , which can occur online. We then use $\hat { P } ( \theta ^ { \prime } )$ in sampling fictitious transitions during UED. We refer to the resulting $\hat { P } ( \theta ^ { \prime } )$ as a learned belief prior.
+
+SAMPLR, summarized in Algorithm 1, incorporates this fictitious transition by replacing the advantages of trajectories on replay levels sampled by $\mathrm { P L R ^ { \perp } }$ with their fictitious counterparts, as only these trajectories are used by $\mathrm { P L R ^ { \perp } }$ for training. To reduce the cost of sampling $\overline { { { \cal P } } } ( \theta ^ { \prime } )$ , we can use the new levels regularly sampled by $\mathrm { P L R ^ { \perp } }$ to estimate the learned belief prior $\overline { { P } } ( \theta ^ { \prime } )$ , and use $\overline { { P } } ( \theta ^ { \prime } )$ in sampling fictitious transitions on replay levels.
+
+# 6 GROUNDED POLICIES ARE ROBUSTLY BAYES OPTIMAL
+
+We can view OBL-based correction as a method for training a policy to be optimal with respect to the ground-truth value function, with levels sampled from some generating distribution $\Lambda$ defined as:
+
+$$
+\overline { { { V } } } ^ { \Lambda } ( \pi ) = \mathbb { E } _ { \tau \sim { \mathcal { M } } ^ { \Lambda } ( \pi ) } \left[ \overline { { { V } } } ^ { \pi } ( \tau ) \right] .
+$$
+
+Note that when $\Lambda = \overline { { { \cal P } } } ( \theta )$ this reduces to the ground-truth value function notated simply as $\overline { { V } } ( \pi )$ . First, we will note that, for any UED method, our OBL-based correction will ensure that, in equilibrium, the resulting policy is Bayes-optimal on the ground truth beliefs, on any trajectory sampled from $\mathcal { M } ^ { \Lambda } ( \pi )$ , the distribution of trajectories of $\pi$ in levels sampled from $\Lambda$ .
+
+Remark 1. If π is optimal with respect to the grounded value function $\overline { { V } } ^ { \Lambda } ( \pi )$ then it is Bayes optimal with respect to the ground-truth parameter distribution ${ \overline { { P } } } ( \theta )$ on the support of $\mathcal { M } ^ { \Lambda } ( \pi )$ .
+
+Proof. By definition we have that $\pi \in \underset { \pi \in \Pi } { \arg \operatorname* { m a x } } \{ \overline { { V } } ^ { \Lambda } ( \pi ) \} = \underset { \pi \in \Pi } { \arg \operatorname* { m a x } } \big \{ \mathbb { E } _ { \tau \sim \mathcal { M } ^ { \Lambda } ( \pi ) } \left[ \overline { { V } } ^ { \pi } ( \tau ) \right] \big \}$ . Since $\pi$ can condition on the initial trajectory $\tau$ , the action selected after each trajectory can be independently optimized. Thus we have, for all $\tau \in \mathcal { M } ^ { \Lambda } ( \pi )$ , $\pi \in \arg \operatorname* { m a x } _ { \pi \in \Pi } \{ { \overline { { V } } } ^ { \pi } ( \tau ) \}$ implying that $\pi$ is the optimal grounded policy and V π = V ∗.
+
+Thus, assuming the base RL algorithm finds Bayes optimal policies, a UED method that optimizes the grounded value function, as done by SAMPLR, will result in Bayes optimal performance over the ground-truth distribution. When the UED method aims to maximize worst-case regret, we can prove an even stronger property we call robust $\epsilon$ -Bayes optimality.
+
+Let $\overline { { V } } ^ { \theta } ( \pi )$ be the value function for $\pi$ evaluated on a specific level $\theta$ . We will say that a policy is robustly $\epsilon$ -Bayes optimal iff for all $\theta$ in the domain of ${ \overline { { P } } } ( \theta )$ and for all $\pi ^ { \prime }$ we have
+
+$$
+\overline { { { V } } } ^ { \theta } ( \pi ) \geq \overline { { { V } } } ^ { \theta } ( \pi ^ { \prime } ) - \epsilon .
+$$
+
+Note how this differs from being only $\epsilon$ -Bayes optimal, which means for all $\pi ^ { \prime }$ ,
+
+$$
+\overline { { { V } } } ( \pi ) \geq \overline { { { V } } } ( \pi ^ { \prime } ) - \epsilon
+$$
+
+With robust $\epsilon$ -Bayes optimality, we must be $\epsilon$ -optimal even on levels which are rarely sampled from the ground-truth distribution. We will show that if SAMPLR is in an $\epsilon$ -Nash Equilibrium, then a policy is robustly $\epsilon$ -Bayes optimal with respect to the grounded value function $\overline { { { V } } } ( \dot { \pi } )$ rather than only $\epsilon$ -Bayes optimal as one would expect from training directly on the true distribution of levels.
+
+Theorem 1. If $\pi$ is $\epsilon$ -Bayes optimal by $\overline { { V } } ^ { \Lambda } ( \pi )$ for $\Lambda$ minimizing worst-case regret as is done in SAMPLR, then it is robustly $\epsilon$ -Bayes optimal with respect to the grounded value function, $\overline { { V } } ( \pi )$ .
+
+Proof. Let $\pi$ be $\epsilon$ -optimal with respect to $\overline { { V } } ^ { \Lambda } ( \pi )$ where $\Lambda$ minimizing worst-case regret with respect to $\pi$ . Let $\overline { { \pi } } ^ { * }$ be an optimal grounded policy, and let $\theta$ be arbitrary. Then we have:
+
+$$
+\overline { { { V } } } ^ { \theta } ( \overline { { { \pi } } } ^ { * } ) - \overline { { { V } } } ^ { \theta } ( \pi ) \le \overline { { { V } } } ^ { \Lambda } ( \overline { { { \pi } } } ^ { * } ) - \overline { { { V } } } ^ { \Lambda } ( \pi ) \le \epsilon
+$$
+
+Where the first inequality follows from $\Lambda$ minimizing worst-case regret with respect to $\pi$ , and the second follows from $\pi$ being $\epsilon$ -optimal on $\Lambda$ . Rearranging terms gives the desired condition. □
+
+# 7 EXPERIMENTS
+
+We investigate the performance of SAMPLR with respect to the the standard PLR and domain randomization in environments based on MiniHack (Samvelyan et al., 2021), a library for creating custom environments based on the runtime of the NetHack Learning Environment (NLE) (Küttler et al., 2020). Acting optimally in our environments requires grounding to the ground-truth distribution.
+
+Our agents are trained using PPO (Schulman et al., 2017), using the best hyperparameters found via grid search, and use the policy architecture in Küttler et al. (2020). We tune the PLR-specific hyperparameters shared among $\mathrm { \dot { P L } } \mathrm { \mathbf { R } } ^ { \perp }$ and SAMPLR variants for each environment, based on the performance of $\mathrm { \bf P } \mathrm { \bf L } { \bf R } ^ { \perp }$ . Full details of our environments, agent architecture, and hyperparameters are provided in Appendix A, and our SAMPLR implementation, in Appendix B. We compare both standard SAMPLR and a variant called LP-SAMPLR that learns a belief prior over the true goal, against $\mathrm { P L R ^ { \perp } }$ and standard PPO baselines. These baselines allows us to separate the relative changes in performance metrics due to curriculum learning and our proposed correction for CICS.
+
+
+Figure 4: Episodic returns (left) and number of rooms in solved levels (middle) during training (dotted lines) and test on the ground-truth distribution (solid lines), for $q = 0 . 7$ . Normalized test returns and proportion of apple goals during training for various $q$ are shown on the right. Plots show mean and standard error of 10 runs.
+
+In our experiments, we first adapt the apple and banana example, depicted in Figure 3 into a fully procedurally-generated RL environment set in the world of NetHack. For each level, the agent can only learn to choose optimally in expectation at test time by grounding to the distribution of correct choices in the deployment domain. Specifically, in each level, the agent must traverse between one to eight randomly generated rooms, and in the final room, the agent must choose to eat the apple or the banana. The correct choice is fixed for each level, but indiscernible to the agent. Thus, the identity of the true goal acts as the aleatoric parameter. Figure 3 shows example levels from this environment.
+
+This environment presents a hard exploration challenge for standard RL algorithms, as it requires learning to both navigate multiple rooms, as well as the NLE-specific skills of kicking doors and eating. The doors opening into adjacent rooms are locked. In order to go from one room to the next, the agent must learn to, potentially repeatedly, kick the locked door until it opens. Likewise, upon reaching a piece of fruit in the final room, the agent must learn to deliberately choose to eat the fruit. If the right choice of fruit were determinable per episode, we expect $\mathrm { P L R ^ { \perp } }$ ’s adaptive curriculum to improve learning by selectively sampling levels at the threshold of the agent’s abilities.
+
+Let $\pi _ { A }$ be the policy in which the agent always chooses the apple, and $\pi _ { B }$ , the banana. If the probability of the goal being apple ${ \overline { { P } } } ( A ) = q$ , the expected return of the agent is $R _ { A } q$ under $\pi _ { A }$ and $R _ { B } ( 1 - q )$ under $\pi _ { B }$ . The optimal policy is then to act according to $\pi _ { A }$ when $q > R _ { B } / ( R _ { A } \bar { + } R _ { B } ) \bar { }$ , and according to $\pi _ { B }$ otherwise. We expect training under domain randomization, which samples each level completely at random from the ground-truth distribution ${ \overline { { P } } } ( \theta )$ , defined by the environment parameterization, would converge to the correct choice of $\pi _ { A }$ or $\pi _ { B }$ , assuming the environment is learnable by the choice of RL algorithm. In contrast, PLR evolves an adversarial curriculum, incentivizing PLR to shift the distribution over goals throughout training. For example, PLR is incentivized to flip the curriculum distribution to favor eating apples whenever the agent begins to consistently succeed at eating bananas. We thus expect the PLR curriculum to continually oscillate the preferred choice of goal.
+
+
+Figure 3: Levels from the stochastic fruit-choice environment. Across levels, the correct choice of fruit is distributed according to $\overline { { P } }$ .
+
+In our experiments, we set $R _ { A } = 3$ , $R _ { B } = 1 0$ , and $q$ in $\{ 0 . 7 , 0 . 5 , 0 . 3 \}$ , making it always optimal to follow the banana-eating policy $\pi _ { B }$ , but with the marginal benefit of doing so varying with $q$ . We report train and test performance of each agent over 200M training steps in Figure 4. We find that DR struggles to learn an effective policy, plateauing at an expected return under 1.0; PLR performs even worse, due to its adversarial curriculum shifting the distribution over the correct goal, leading to rapid oscillations in the optimal choice of fruit under the curriculum distribution, as visible in the high-variance oscillations in the proportion of apple goals selected by PLR for each value of $q$ in 4). This makes it difficult for the agent to settle on the optimal policy with respect to any ground-truth distribution. The proportion of each choice outcome, shown in Figure 5, reveals that both DR and PLR policies fail to eat any fruit most of the time, even after 200M training steps. In contrast, both SAMPLR and LP-SAMPLR realize a marked improvement in test performance by grounding PLR’s otherwise wild shifts in $q$ . Figure 4 shows this improvement is most pronounced when the expected difference in $\pi _ { A }$ and $\pi _ { B }$ is smaller, and therefore easier for PLR to flip the agent’s policy. Moreover, we see in Figure 5 that both SAMPLR methods present levels with higher room counts on average, indicating that early in training, it is able to discover easier, few-room levels in which the agent can capture reward signal, and which can then be made more complex to push the agent along its threshold of abilities.
+
+
+Figure 5: Left: Proportion of training episodes in which the agent fails to eat any fruit; eats the apple; or eats the banana. Right: Number of rooms in levels during training. Plots show mean and standard error of 10 runs.
+
+
+Figure 6: Left: Levels from FireDungeon. Middle: Test return on the ground-truth distribution of FireDungeon. Right: Proportion of training levels with fireproof armor. Plots show mean and standard error of 10 runs.
+
+We next turn to a more challenging environment that introduces additional NetHack-specific dynamics. The FireDungeon environment (see Figure 6 for example levels), requires the agent to navigate through up to 13 chambers, and ultimately choose between chamber A or B, each containing a valid goal. Reaching this goal ends the episode and provides the agent with a sparse reward. Further, in this penultimate chamber, there is an armor, which if worn grants the agent with fire resistance with probability $q$ . Chamber B is marked by a red gemstone by the door and contains enemy units, whose fire attack will instantly kill the agent. Killing each enemy grants the agent with $+ 1$ final reward, which is only provided upon reaching either goal. The agent thus stands to attain a higher reward by attacking the enemies in Chamber B, before reaching the goal, only if the armor is fireproof. This environment presents an even more difficult exploration problem for the agent, yet we see in Figure 6, both SAMPLR variants begin to learn to solve this environment with significantly greater sample-efficiency than DR, while PLR again struggles to learn. As in the case of the previous stochastic choice environment, we see that PLR rapidly oscillates the key aleatoric parameter, which in this case, determines whether the armor is fireproof.
+
+# 8 CONCLUSION
+
+Using the formal notions of environment parameterizations in the framework of UED, we defined the problem of curriculum-induced covariate shift in RL. Our definition highlights the issues that can arise when there is persisitent uncertainty over the environment parameters, either because the uncertainty is irreducible or because reducing the uncertainty is costly. We then adapted a fictitious transition mechanism previously used to improve zero-shot coordination in cooperative MARL to correct for this covariate shift. We demonstrated that our resulting algorithm, SAMPLR, avoids the pitfalls of this type of covariate shift, while preserving the benefits of curriculum learning.
+
+# REFERENCES
+
+Martín Arjovsky, Léon Bottou, Ishaan Gulrajani, and David Lopez-Paz. Invariant risk minimization. CoRR, abs/1907.02893, 2019. URL http://arxiv.org/abs/1907.02893.
+
+Richard Bellman. A problem in the sequential design of experiments. Sankhya: The Indian Journal ¯ of Statistics (1933-1960), 16(3/4):221–229, 1956.
+
+Daniel S Bernstein, Robert Givan, Neil Immerman, and Shlomo Zilberstein. The complexity of decentralized control of markov decision processes. Mathematics of operations research, 27(4): 819–840, 2002.
+
+Steffen Bickel, Michael Brückner, and Tobias Scheffer. Discriminative learning under covariate shift. J. Mach. Learn. Res., 10:2137–2155, 2009. URL https://dl.acm.org/citation.cfm? id=1755858.
+
+Andres Campero, Roberta Raileanu, Heinrich Kuttler, Joshua B. Tenenbaum, Tim Rocktäschel, and Edward Grefenstette. Learning with AMIGo: Adversarially motivated intrinsic goals. In International Conference on Learning Representations, 2021.
+
+Kamil Andrzej Ciosek and Shimon Whiteson. OFFER: off-environment reinforcement learning. In Satinder P. Singh and Shaul Markovitch (eds.), Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, February 4-9, 2017, San Francisco, California, USA, pp. 1819–1825. AAAI Press, 2017. URL http://aaai.org/ocs/index.php/AAAI/AAAI17/paper/ view/14378.
+
+Michael Dennis, Natasha Jaques, Eugene Vinitsky, Alexandre Bayen, Stuart Russell, Andrew Critch, and Sergey Levine. Emergent complexity and zero-shot transfer via unsupervised environment design. In Advances in Neural Information Processing Systems, volume 33, 2020.
+
+Armen Der Kiureghian and Ove Ditlevsen. Aleatory or epistemic? does it matter? Structural safety, 31(2):105–112, 2009.
+
+Michael O’Gordon Duff. Optimal Learning: Computational procedures for Bayes-adaptive Markov decision processes. University of Massachusetts Amherst, 2002.
+
+Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Vlad Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Dunning, Shane Legg, and Koray Kavukcuoglu. IMPALA: Scalable distributed deep-RL with importance weighted actor-learner architectures. 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. 1407–1416. PMLR, 10–15 Jul 2018.
+
+Carlos Florensa, David Held, Xinyang Geng, and Pieter Abbeel. Automatic goal generation for reinforcement learning agents. 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. 1515–1528. PMLR, 10–15 Jul 2018. URL http://proceedings. mlr.press/v80/florensa18a.html.
+
+Carles Gelada and Marc G. Bellemare. Off-policy deep reinforcement learning by bootstrapping the covariate shift. In The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI 2019, The Thirty-First Innovative Applications of Artificial Intelligence Conference, IAAI 2019, The Ninth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2019, Honolulu, Hawaii, USA, January 27 - February 1, 2019, pp. 3647–3655. AAAI Press, 2019. URL https: //doi.org/10.1609/aaai.v33i01.33013647.
+
+Assaf Hallak and Shie Mannor. Consistent on-line off-policy evaluation. 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. 1372–1383. PMLR, 06–11 Aug 2017. URL https://proceedings.mlr.press/v70/hallak17a.html.
+
+James J Heckman. Sample selection bias as a specification error. Econometrica: Journal of the econometric society, pp. 153–161, 1979.
+
+Hengyuan Hu, Adam Lerer, Alex Peysakhovich, and Jakob Foerster. “Other-play” for zero-shot coordination. 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. 4399–4410. PMLR, 13–18 Jul 2020. URL https://proceedings.mlr.press/v119/ hu20a.html.
+
+Hengyuan Hu, Adam Lerer, Brandon Cui, Luis Pineda, Noam Brown, and Jakob N. Foerster. Offbelief learning. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, volume 139 of Proceedings of Machine Learning Research, pp. 4369–4379. PMLR, 2021. URL http: //proceedings.mlr.press/v139/hu21c.html.
+
+Jiayuan Huang, Arthur Gretton, Karsten Borgwardt, Bernhard Schölkopf, and Alex Smola. Correcting sample selection bias by unlabeled data. Advances in neural information processing systems, 19: 601–608, 2006.
+
+Nick Jakobi. Evolutionary robotics and the radical envelope-of-noise hypothesis. Adaptive Behavior, 6(2):325–368, 1997.
+
+Minqi Jiang, Michael Dennis, Jack Parker-Holder, Jakob Foerster, Edward Grefenstette, and Tim Rocktäschel. Replay guided adversarial environment design. arXiv, 2021a.
+
+Minqi Jiang, Edward Grefenstette, and Tim Rocktäschel. Prioritized level replay. In Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, volume 139 of Proceedings of Machine Learning Research, pp. 4940–4950. PMLR, 2021b. URL http://proceedings.mlr.press/v139/jiang21b.html.
+
+Niels Justesen, Ruben Rodriguez Torrado, Philip Bontrager, Ahmed Khalifa, Julian Togelius, and Sebastian Risi. Procedural level generation improves generality of deep reinforcement learning. CoRR, abs/1806.10729, 2018. URL http://arxiv.org/abs/1806.10729.
+
+Heinrich Küttler, Nantas Nardelli, Alexander H. Miller, Roberta Raileanu, Marco Selvatici, Edward Grefenstette, and Tim Rocktäschel. The NetHack Learning Environment. In Proceedings of the Conference on Neural Information Processing Systems (NeurIPS), 2020.
+
+Tambet Matiisen, Avital Oliver, Taco Cohen, and John Schulman. Teacher-student curriculum learning. IEEE Transactions on Neural Networks and Learning Systems, PP, 07 2017.
+
+John F Nash et al. Equilibrium points in n-person games. Proceedings of the national academy of sciences, 36(1):48–49, 1950.
+
+OpenAI OpenAI, Matthias Plappert, Raul Sampedro, Tao Xu, Ilge Akkaya, Vineet Kosaraju, Peter Welinder, Ruben D’Sa, Arthur Petron, Henrique Ponde de Oliveira Pinto, Alex Paino, Hyeonwoo Noh, Lilian Weng, Qiming Yuan, Casey Chu, and Wojciech Zaremba. Asymmetric self-play for automatic goal discovery in robotic manipulation, 2021.
+
+Ian Osband, Daniel Russo, and Benjamin Van Roy. (more) efficient reinforcement learning via posterior sampling. In Christopher J. C. Burges, Léon Bottou, Zoubin Ghahramani, and Kilian Q. Weinberger (eds.), Advances in Neural Information Processing Systems 26: 27th Annual Conference on Neural Information Processing Systems 2013. Proceedings of a meeting held December 5-8, 2013, Lake Tahoe, Nevada, United States, pp. 3003–3011, 2013. URL https://proceedings.neurips.cc/paper/2013/hash/ 6a5889bb0190d0211a991f47bb19a777-Abstract.html.
+
+Xue Bin Peng, Marcin Andrychowicz, Wojciech Zaremba, and Pieter Abbeel. Sim-to-real transfer of robotic control with dynamics randomization. CoRR, abs/1710.06537, 2017.
+
+Dean Pomerleau. ALVINN: an autonomous land vehicle in a neural network. In David S. Touretzky (ed.), Advances in Neural Information Processing Systems 1, [NIPS Conference, Denver, Colorado, USA, 1988], pp. 305–313. Morgan Kaufmann, 1988. URL http://papers.nips.cc/ paper/95-alvinn-an-autonomous-land-vehicle-in-a-neural-network.
+
+Rémy Portelas, Cédric Colas, Katja Hofmann, and Pierre-Yves Oudeyer. Teacher algorithms for curriculum learning of deep rl in continuously parameterized environments. In Leslie Pack Kaelbling, Danica Kragic, and Komei Sugiura (eds.), Proceedings of the Conference on Robot Learning, volume 100 of Proceedings of Machine Learning Research, pp. 835–853. PMLR, 30 Oct– 01 Nov 2020. URL https://proceedings.mlr.press/v100/portelas20a.html.
+
+Stephane Ross and Drew Bagnell. Efficient reductions for imitation learning. In Yee Whye Teh and Mike Titterington (eds.), Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, volume 9 of Proceedings of Machine Learning Research, pp. 661–668, Chia Laguna Resort, Sardinia, Italy, 13–15 May 2010. PMLR. URL https://proceedings. mlr.press/v9/ross10a.html.
+
+Mark Rowland, Will Dabney, and Remi Munos. Adaptive trade-offs in off-policy learning. In Silvia Chiappa and Roberto Calandra (eds.), Proceedings of the Twenty Third International Conference on Artificial Intelligence and Statistics, volume 108 of Proceedings of Machine Learning Research, pp. 34–44. PMLR, 26–28 Aug 2020. URL https://proceedings.mlr.press/v108/ rowland20a.html.
+
+Fereshteh Sadeghi and Sergey Levine. CAD2RL: real single-image flight without a single real image. In Nancy M. Amato, Siddhartha S. Srinivasa, Nora Ayanian, and Scott Kuindersma (eds.), Robotics: Science and Systems XIII, Massachusetts Institute of Technology, Cambridge, Massachusetts, USA, July 12-16, 2017, 2017.
+
+Mikayel Samvelyan, Robert Kirk, Vitaly Kurin, Jack Parker-Holder, Minqi Jiang, Eric Hambro, Fabio Petroni, Heinrich Kuttler, Edward Grefenstette, and Tim Rocktäschel. Minihack the planet: A sandbox for open-ended reinforcement learning research. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track, 2021.
+
+Leonard J Savage. The theory of statistical decision. Journal of the American Statistical association, 46(253):55–67, 1951.
+
+John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms, 2017.
+
+David Silver, Aja Huang, Chris J. Maddison, Arthur Guez, Laurent Sifre, George van den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Vedavyas Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy P. Lillicrap, Madeleine Leach, Koray Kavukcuoglu, Thore Graepel, and Demis Hassabis. Mastering the game of go with deep neural networks and tree search. Nat., 529(7587):484–489, 2016. URL https://doi.org/10.1038/nature16961.
+
+Adam Stooke, Anuj Mahajan, Catarina Barros, Charlie Deck, Jakob Bauer, Jakub Sygnowski, Maja Trebacz, Max Jaderberg, Michaël Mathieu, Nat McAleese, Nathalie Bradley-Schmieg, Nathaniel Wong, Nicolas Porcel, Roberta Raileanu, Steph Hughes-Fitt, Valentin Dalibard, and Wojciech Marian Czarnecki. Open-ended learning leads to generally capable agents. CoRR, abs/2107.12808, 2021. URL https://arxiv.org/abs/2107.12808.
+
+Sainbayar Sukhbaatar, Zeming Lin, Ilya Kostrikov, Gabriel Synnaeve, Arthur Szlam, and Rob Fergus. Intrinsic motivation and automatic curricula via asymmetric self-play. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum? id=SkT5Yg-RZ.
+
+Richard S. Sutton, A. Rupam Mahmood, and Martha White. An emphatic approach to the problem of off-policy temporal-difference learning. Journal of Machine Learning Research, 17(73):1–29, 2016. URL http://jmlr.org/papers/v17/14-488.html.
+
+Philip Thomas and Emma Brunskill. Data-efficient off-policy policy evaluation for reinforcement learning. In Maria Florina Balcan and Kilian Q. Weinberger (eds.), Proceedings of The $3 3 r d$ International Conference on Machine Learning, volume 48 of Proceedings of Machine Learning Research, pp. 2139–2148, New York, New York, USA, 20–22 Jun 2016. PMLR.
+
+Josh Tobin, Rachel Fong, Alex Ray, Jonas Schneider, Wojciech Zaremba, and Pieter Abbeel. Domain randomization for transferring deep neural networks from simulation to the real world. In 2017 IEEE/RSJ International Conference on Intelligent Robots and Systems, IROS 2017, Vancouver, BC, Canada, September 24-28, 2017, pp. 23–30. IEEE, 2017.
+
+Vladimir N Vapnik and A Ya Chervonenkis. On the uniform convergence of relative frequencies of events to their probabilities. Theory of Probability and Its Applications, pp. 264–280, 1971.
+
+Oriol Vinyals, Igor Babuschkin, Wojciech M. Czarnecki, Michaël Mathieu, Andrew Dudzik, Junyoung Chung, David H. Choi, Richard Powell, Timo Ewalds, Petko Georgiev, Junhyuk Oh, Dan Horgan, Manuel Kroiss, Ivo Danihelka, Aja Huang, Laurent Sifre, Trevor Cai, John P. Agapiou, Max Jaderberg, Alexander Sasha Vezhnevets, Rémi Leblond, Tobias Pohlen, Valentin Dalibard, David Budden, Yury Sulsky, James Molloy, Tom L. Paine, Çaglar Gülçehre, Ziyu Wang, Tobias Pfaff, Yuhuai Wu, Roman Ring, Dani Yogatama, Dario Wünsch, Katrina McKinney, Oliver Smith, Tom Schaul, Timothy P. Lillicrap, Koray Kavukcuoglu, Demis Hassabis, Chris Apps, and David Silver. Grandmaster level in starcraft II using multi-agent reinforcement learning. Nat., 575(7782): 350–354, 2019. doi: 10.1038/s41586-019-1724-z. URL https://doi.org/10.1038/ $\mathtt { s 4 1 5 8 6 - 0 1 9 - 1 7 2 4 - z }$ .
+
+Rui Wang, Joel Lehman, Jeff Clune, and Kenneth O. Stanley. Paired open-ended trailblazer (POET): endlessly generating increasingly complex and diverse learning environments and their solutions. CoRR, abs/1901.01753, 2019.
+
+Rui Wang, Joel Lehman, Aditya Rawal, Jiale Zhi, Yulun Li, Jeffrey Clune, and Kenneth Stanley. Enhanced POET: Open-ended reinforcement learning through unbounded invention of learning challenges and their solutions. In Proceedings of the 37th International Conference on Machine Learning, pp. 9940–9951, 2020.
+
+Xiaoxia Wu, Ethan Dyer, and Behnam Neyshabur. When do curricula work? In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. URL https://openreview.net/forum?id ${ . } = { }$ tW4QEInpni.
+
+Amy Zhang, Zachary C. Lipton, Luis Pineda, Kamyar Azizzadenesheli, Anima Anandkumar, Laurent Itti, Joelle Pineau, and Tommaso Furlanello. Learning causal state representations of partially observable environments. CoRR, abs/1906.10437, 2019. URL http://arxiv.org/abs/ 1906.10437.
+
+Amy Zhang, Rowan Thomas McAllister, Roberto Calandra, Yarin Gal, and Sergey Levine. Learning invariant representations for reinforcement learning without reconstruction. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. URL https://openreview.net/forum?id $=$ -2FCwDKRREu.
+
+Victor Zhong, Tim Rocktäschel, and Edward Grefenstette. RTFM: generalising to new environment dynamics via reading. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. URL https:// openreview.net/forum?id $=$ SJgob6NKvH.
+
+Luisa M. Zintgraf, Kyriacos Shiarlis, Maximilian Igl, Sebastian Schulze, Yarin Gal, Katja Hofmann, and Shimon Whiteson. Varibad: A very good method for bayes-adaptive deep RL via meta-learning. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. URL https://openreview.net/forum?id $=$ Hkl9JlBYvr.
\ No newline at end of file
diff --git a/md/dev/wiBEFdAvl8L/wiBEFdAvl8L.md b/md/dev/wiBEFdAvl8L/wiBEFdAvl8L.md
new file mode 100644
index 0000000000000000000000000000000000000000..3b09180f269800535f537bdf35ea240aa9c33eb0
--- /dev/null
+++ b/md/dev/wiBEFdAvl8L/wiBEFdAvl8L.md
@@ -0,0 +1,309 @@
+# GLIPv2: Unifying Localization and VL Understanding
+
+Haotian Zhang∗1†, Pengchuan Zhang $\ast 2 \dagger \spadesuit$ , Xiaowei $\mathbf { H } \mathbf { u } ^ { 3 }$ , Yen-Chun Chen3, Liunian Harold Li4† Xiyang $\mathbf { D a i } ^ { 3 }$ , Lijuan Wang3, Lu Yuan3, Jenq-Neng Hwang1, Jianfeng Gao3
+
+1University of Washington, 2Meta AI, 3Microsoft, 4UCLA {haotiz,hwang}@uw.edu,pengchuanzhang@fb.com,liunian.harold.li@cs.ucla.edu, {Xiaowei.Hu,Yen-Chun.Chen,Xiyang.Dai,lijuanw,luyuan,jfgao}@microsoft.com
+
+# Abstract
+
+We present GLIPv2, a grounded VL understanding model, that serves both localization tasks (e.g., object detection, instance segmentation) and Vision-Language (VL) understanding tasks (e.g., VQA, image captioning). GLIPv2 elegantly unifies localization pre-training and Vision-Language Pre-training (VLP) with three pre-training tasks: phrase grounding as a VL reformulation of the detection task, region-word contrastive learning as a novel region-word level contrastive learning task, and the masked language modeling. This unification not only simplifies the previous multi-stage VLP procedure but also achieves mutual benefits between localization and understanding tasks. Experimental results show that a single GLIPv2 model (all model weights are shared) achieves near SoTA performance on various localization and understanding tasks. The model also shows (1) strong zero-shot and few-shot adaption performance on open-vocabulary object detection tasks and (2) superior grounding capability on VL understanding tasks. Code is released at https://github.com/microsoft/GLIP.
+
+# 1 Introduction
+
+Recently, a general interest arises in building general-purpose vision systems [21, 24, 56, 42], also called vision foundation models [6, 57], that solve various vision tasks simultaneously, such as image classification [30], object detection [39], and Visual-Language (VL) understanding [3, 11, 27]. Of particular interest, is the unification between localization tasks (e.g., object detection [39] and segmentation [8, 20]) and VL understanding tasks (e.g., VQA [3] and image captioning [11]). Localization pre-training benefits VL tasks [1, 59], and the “localization- $\mathrm { . > V L P ^ { \prime } }$ two-stage pretraining procedure [41, 49, 13, 48, 34, 32, 61, 37, 35] is the common practice in VL community. A long-standing challenge is the unification of localization and understanding, which aims at mutual benefit between these two kinds of tasks, simplified pre-training procedure, and reduced pre-training cost.
+
+However, these two kinds of tasks appear to be dramatically different: localization tasks are visiononly and require fine-grained output (e.g., bounding boxes or pixel masks), while VL understanding tasks emphasize fusion between two modalities and require high-level semantic outputs (e.g., answers or captions).
+
+[21, 24, 56] have made early attempts at unifying these tasks in a straightforward multi-task manner, where a low-level visual encoder is shared across tasks, and two separate high-level branches are designed for localization and VL understanding, respectively. The localization tasks are still vision-only and do not benefit from the rich semantics in vision-language data. As a result, such unified models see the marginal mutual benefit or even performance degradation [24] compared with task-specific models.
+
+In this paper, we identify “VL grounding” as a “meta”-capability for localization and understanding capabilities. VL grounding involves not only understanding an input sentence but also localizing the mentioned entities in the image (see an example in Figure 1). We build a grounded VL understanding model (GLIPv2) as a unified model for localization and VL understanding tasks.
+
+
+Figure 1: Left: GLIPv2, a pre-trained grounded VL understanding model, unifies various localization and VL understanding tasks. These two kinds of tasks mutually benefit each other, and enables new capabilities such as language-guided detection/segmentation and grounded VQA/captioning. Right: Additional examples from ODinW (detection), LVIS (segmentation), VQA, COCO Captioning.
+
+Localization ${ \bf \Pi } + { \bf \delta V L }$ understanding $=$ grounded VL understanding. Localization tasks involve both localization and semantic classification, where classification can be cast as a VL understanding problem using the classification-to-matching trick (Section 3.1). Therefore, we reformulate localization tasks as VL grounding tasks, in which the language input is a synthesized sentence as the concatenation of category names [36]. Localization data are turned into VL grounding data, accordingly. The massive VL understanding data (image-text pairs) can be easily turned into VL grounding data in a self-training manner [36]. Therefore, GLIPv2 has a unified pre-training process: all task data are turned into grounding data and GLIPv2 is pre-trained to perform grounded VL understanding.
+
+A stronger VL grounding task: inter-image region-word contrastive learning. GLIP [36] proposes the phrase grounding task as its pre-training task, which we argue is an easy task and does not fully utilize data information. For example, in the VL grounding task in Figure 1, the phrase grounding task only requires the model to match a given image region to one of the three phrases in the text input, i.e., “green, pink striped, or plain white umbrella?”. This 1-in-3 choice is very easy, only requires color understanding, but loses lots of information in this grounding data: the umbrellas are not any other colors, like black, yellow, etc; objects in those regions are umbrellas but not any other categories, like car, bike, etc. From a contrastive learning view, this phrase grounding task only has two negatives. More negatives can be created from this annotation and thus enable stronger contrastive learning. In GLIPv2, we introduce the novel inter-image region-word contrastive learning task, which leverages phrases from other sentences in the same batch as potential negatives, as another much stronger VL grounding task. This new region-word contrastive loss enables GLIPv2 to learn more discriminative region-word features and demonstrates improvements over all downstream tasks.
+
+GLIPv2 achieves mutual benefit between localization and VL understanding. 1) Experimental results (Table 2) show that a single GLIPv2 model (all model weights are shared) achieves near SoTA performance on various localization and understanding tasks. 2) Thanks to semantic-rich annotations from the image-text data, GLIPv2 shows superior zero-shot and few-shot transfer learning ability to open-world object detection and instance segmentation tasks, evaluated on the LVIS dataset and the "Object Detection in the Wild (ODinW)" benchmark. 3) GLIPv2 enables language-guided detection and segmentation ability, and achieves new SoTA performance on the Flick30K-entities phrase grounding and PhraseCut referring image segmentation tasks. 4) Inherently a grounding model, GLIPv2 leads to VL understanding models with strong grounding ability, which are self-explainable and easy to debug. For example, GLIPv2, when GLIPv2 is finetuned on VQA, it can answer questions while localizing mentioned entities (see Figure 1 and Section 4.4).
+
+# 2 Related Work
+
+Localization models. Traditionally, localization tasks such as object detection and segmentation are single-modality and output bounding boxes or pixel masks [45, 38, 23, 14, 46, 10, 9]. One challenge of these single-modality models lies in generalization to rare and novel concepts: it is hard to collect localization data that cover many rare categories [20]. A long line of research focuses on this generalization problem, under the name of zero-shot [4, 62, 7, 63], weakly-supervised [18, 5, 52], or open-vocabulary [58, 19] localization. Built upon MDETR [25] and GLIP [36], GLIPv2 converts localization tasks into a grounded vision-language task using the classification-to-matching trick (Section 3). Thus GLIPv2 can learn from the semantic-rich vision-language data and shows strong performance on open-vocabulary localization tasks.
+
+Vision-language understanding models. Vision-language (VL) understanding tasks such as VQA [3], image captioning [11], and image-text retrieval [26] involve understanding visual semantics and how they are expressed in natural language. Many VL models (e.g., BUTD) [2, 59] rely on a pre-trained localization model as their visual encoder; the downside is the pro-longed “localization- $\mathrm { . > V L P ^ { \prime } }$ pre-training pipeline [41, 49, 13, 48, 34, 32, 61, 37, 35]. In contrast, GLIPv2 simplifies the pre-training pipeline and enables grounded VL understanding for better interpretability (Section 4.4).
+
+Unifying localization and understanding. [21, 24, 56] made pioneering efforts in unifying localization and understanding. However, localization tasks are still treated as single-modality tasks, while VL tasks involve two modalities. The unification is achieved via straightforward multi-tasking: a low-level visual encoder is shared across tasks and two separate branches are designed for localization and VL understanding. Such unified models do not bring evident mutual benefit and often underperform task-specific models. In contrast, GLIPv2 identifies grounded VL understanding as a meta-task for localization and understanding. The task unification brings architecture unification: the unified grounded VL understanding model empowers a localization branch with VL capacity, arriving at a unified branch that excels at both tasks.
+
+GLIPv2 vs GLIP. 1) GLIP shows that grounded pre-training improves localization. GLIPv2 further shows grounded pre-training improves VL understanding and thus leads to a unified model for localization and VL understanding. 2) GLIPv2 introduces the inter-image region-word contrastive loss, which is another and stronger grounding task than the pre-training task in GLIP. The proposed loss can be viewed as a region-word level generalization of the prevalent image-level contrastive learning [33, 44, 55]. 3) GLIPv2 outperforms GLIP on all benchmarks with the same pre-training data.
+
+# 3 GLIPv2: Unifying Localization and VL Understanding
+
+Based on the reformulation of object detection as a generalized phrase grounding task in GLIP [36], we unify both localization and VL understanding tasks as grounded vision-language tasks. A grounded vision-language task takes both image and text as inputs, and outputs region-level understanding results (e.g., detection, segmentation) and/or image-level understanding results with associated grounding/localization information (e.g., VQA, image captioning). We will present the unified grounded VL formulation and architecture in Section 3.1, the pre-training losses in Section 3.2, and transfer to downstream tasks in Section 3.3.
+
+# 3.1 A Unified VL Formulation and Architecture
+
+At the center of GLIPv2’s unified formulation is the classification-to-matching trick, which reformulates any task-specific fixed-vocab classification problem as an task-agnostic open-vocabulary vision-language matching problem. The best example is the reformulation of image classification as image-text matching in CLIP [44], which enables the model to learn from raw image-text data directly, and achieves strong zero-shot results on open-vocabulary classification tasks. In GLIPv2, we replace every semantic classification linear layer in traditional single-modality vision models with a vision-language matching dot-product layer.
+
+As illustrated in Figure 1, GLIPv2’s unified VL architecture is based on the generic architecture we term Architecture $\mathbf { I I }$ . It consists of a dual encoder, denoted as $\operatorname { E n c } _ { V }$ and $\mathrm { E n c } _ { L }$ , and a fusion encoder, denoted as $\mathtt { E n c } _ { V L }$ . The model takes an image-text pair (Img, Text) as input, and extract visual and text features as below:
+
+$$
+\begin{array} { r } { \dot { O } = \mathrm { E n c } _ { V } ( \mathrm { I m g } ) , \quad \mathring { P } = \mathrm { E n c } _ { L } ( \mathrm { T e x t } ) , \quad O , P = \mathrm { E n c } _ { V L } ( \mathring { O } , \mathring { P } ) , } \end{array}
+$$
+
+where $( \mathring { O } , \mathring { P } )$ and $( O , P )$ denote the image/text features before and after VL fusion, respectively.
+
+Vision-Language understanding tasks. Arch $\mathbf { I I }$ is the most popular model architecture for VL understanding tasks. Given the cross-modality fused representations $O$ and $P$ , it is straightforward to add lightweight task-specific heads for various VL tasks. For example, GLIPv2 adds a two-layer MLP on top of text features $P$ as the masked language modeling (MLM) head, to perform the MLM pre-training. We provide model details of VQA and image captioning in Section 3.3.
+
+(Language-guided) object detection and phrase grounding. Following GLIP [36], GLIPv2 uses the classification-to-matching trick to unify detection and grounding. More specifically, for detection, we simply replace the class logits $S _ { \mathrm { c l s } } = \dot { O } W ^ { T }$ , where $W$ is the weight matrix of the box classifier, with a task-agnostic region-word similarity logits $S _ { \mathrm { g r o u n d } } = O P ^ { T }$ , where text features $P$ are label embeddings from a task-agnostic language encoder. As shown in Figure 1, object detection and phrase grounding share the same input/output format and model architecture. See GLIP [36] for more details. Their only difference is the input text format: (1) for object detection, the text input is a string of concatenated candidate object labels; (2) for phrase grounding, the text input is a natural language sentence. We refer to GLIP [36] for more details.
+
+(Language-guided) instance segmentation and referring image segmentation. Given the object detection results, an instance segmentation head is added to classify each pixel within the box into a semantic class. Again, GLIPv2 uses the classification-to-matching trick to produce a unified instance segmentation head for the standard instance segmentation tasks and the referring image segmentation tasks and leverage both types of data for its pre-training. This classification-to-matching trick can also apply to many other semantic classification heads in single modality CV models (e.g., semantic segmentation) and thus transfers them to language-guided CV models.
+
+# 3.2 GLIPv2 Pre-training
+
+The GLIPv2 is pre-trained with three pre-training losses: phrase grounding loss $\mathcal { L } _ { \mathrm { g r o u n d } }$ from a vision-language reformulation of the object detection task, region-word contrastive loss ${ \mathcal { L } } _ { \mathrm { { i n t e r } } }$ from a novel region-word level contrastive learning task, and the standard masked language modeling loss ${ \mathcal { L } } _ { \mathrm { m l m } }$ proposed in BERT [16].
+
+$$
+{ \mathcal { L } } _ { \mathrm { G L I P v 2 } } = \underbrace { { \mathcal { L } } _ { \mathrm { l o c } } + { \mathcal { L } } _ { \mathrm { i n t r a } } } _ { { \mathcal { L } } _ { \mathrm { g r o u n d } } } + { \mathcal { L } } _ { \mathrm { i n t e r } } + { \mathcal { L } } _ { \mathrm { m l m } }
+$$
+
+Similar to losses in detection tasks, the grounding loss $\mathcal { L } _ { \mathrm { g r o u n d } }$ has two parts: the localization loss $\mathcal { L } _ { \mathrm { l o c } }$ trains localization heads with bounding-box supervision, e.g., RPN loss, box regression loss and/or centerness loss [50]; the intra-image region-word alignment loss ${ \mathcal { L } } _ { \mathrm { { i n t r a } } }$ is essentially the semantic classification/retrieval loss for each region.
+
+Intra-image region-word alignment loss. Given one image-text pair (Img, Text), we obtain the image and text features after cross-modality fusion $O$ and $P$ . The Intra-image region-word alignment loss is computed by
+
+$$
+\mathcal { L } _ { \mathrm { i n t r a } } = l o s s ( O P ^ { T } ; T ) ,
+$$
+
+where $O P ^ { T }$ is the similarity score between image regions and word tokens, and $T$ is the target affinity matrix determined by the ground-truth annotations. The loss function loss is typically a cross-entropy loss for two-stage detectors [46] and a focal loss [38] for one-stage detectors.
+
+However, as discussed in Section 1, this intra-image region-word contrastive learning is rather weak in the sense of contrastive learning, due to the limited number of phrases that can one caption can contain. GLIP [36] alleviates this problem by appending a few negative sentences to form a longer text input with more (negative) phrases. However, constrained by the maximal length of text tokens (256 in GLIP and GLIPv2), only a few negative sentences can be added and the number of negative phrases remains in the order of $1 0 \mathrm { { ^ { \circ } s } }$ . This small-negative-example problem also exists in detection data [36] when the input text cannot include all class names in a detection dataset, e.g., Objects365.
+
+Inter-image region-word contrastive loss. In GLIPv2, we propose using phrases from other imagetext pairs in the same batch as negative examples, which effectively increases the number of negative examples to the order of 1000’s, with nearly negligible additional computational cost.
+
+As in (1), given a batch of image-text pairs $( \mathrm { I m } { \bf g } ^ { i } , \mathrm { T e x t } ^ { i } ) _ { i = 1 } ^ { B }$ and their ground-truth annotations $( T ^ { i } ) _ { i = 1 } ^ { B }$ , the model produces the image and text features before and after VL fusion, denoted as $( \mathring { O } ^ { i } , \mathring { P } ^ { i } ) _ { i = 1 } ^ { B }$ and $( O ^ { i } , P ^ { i } ) _ { i = 1 } ^ { B }$ , respectively. Then as illustrated in Figure 2 (Left), a batch-wise similarity matrix Sbatchground and a batch-wise target affinity matrix $T ^ { \mathrm { b a t c h } }$ are constructed by considering all the image regions and text phrases across this batch. Their $( i , j )$ ’th blocks are obtained as below:
+
+$$
+S _ { \mathrm { g r o u n d } } ^ { \mathrm { b a t c h } } [ i , j ] = \bar { O } ^ { i } ( \bar { P } ^ { j } ) ^ { T } , \quad T ^ { \mathrm { b a t c h } } [ i , j ] = \left\{ \begin{array} { l l } { T ^ { i } , } & { \mathrm { i f ~ } i = j } \\ { \mathrm { o b t a i n e d ~ b y ~ l a b e l ~ p r o p a g a t i o n , } } & { \mathrm { o t h e r w i s e . } } \end{array} \right.
+$$
+
+The inter-image region-word contrastive loss is then defined as the standard bi-directional contrastive loss applied on all image regions and phrases in this batch:
+
+${ \mathrm { ~ \dot { \ z } _ { \mathrm { { i n t e r } } } = \ c r o s s \_ e n t r o p y \mit \mathrm { \mit \mathrm { \ l o s s } ( \cal S \mit _ { \mathrm { { g r o u n d } } } ^ { \mathrm { b a t c h } } , \mit T \mathrm { ^ { b a t c h } , \ a x i s = 0 ) + \ c r o s s \mit \mathrm { _ { - } \ e n t r o p y \mit \mathrm { \mit { \mit \mathrm { \ l o s s } ( \cal S \mit _ { \mathrm { { g r o u n d } } } ^ { \mathrm { b a t c h } } , \mathrm { T \mathrm { ^ { b a t c h } , \ a x i s = 1 ) \mit . } } } } } } } } } $ (5)
+
+Compared with that in the inter-image contrastive loss (3), the number of negatives is multiplied by batch size $B$ in this inter-image contrastive loss (5). We elaborate two important details in (4). (1) GLIPv2 uses the image text features $( \mathring { O } ^ { i } , \mathring { P } ^ { i } ) _ { i = 1 } ^ { B }$ before VL fusion, not $( O ^ { i } , P ^ { i } ) _ { i = 1 } ^ { B }$ after VL fusion, to compute the batch-wise similarity matrix in the inter-image contrastive loss (4). Otherwise, the image and text features after VL fusion would have seen the paired information (1), and thus the model can easily rule out the negatives from misaligned images/texts. (2) We cannot simply assign all regions and texts from unpaired image-text as negative pairs, as done in the standard contrastive loss in CLIP [44]. Instead, we determine the off-diagonal blocks in the target affinity matrix $T ^ { \mathrm { b a t c h } }$ by label propagation. For example, as illustrated in Figure 2 (Left), if a region is annotated as “person”, it should be a positive pair with all “person” phrases in detection-type texts. We do not propagate positives to grounding-type texts (natural sentences) because phrases in sentences carry contexts that are unique to that image-sentence pair.
+
+Pre-training with both detection and paired-image-text data. GLIPv2 pre-training data is in the image-text-target triplet format (Img, Text, $T$ ), where the target affinity matrix $T$ contains the box-label localization annotations. We also use massive image-text pair data (Img, Text) to pre-train GLIPv2, by generating grounding boxes $\hat { T }$ for phrases in the text with the GLIP pre-trained model from [36]. The human-annotated OD/grounding data provides high-fidelity localization supervision, while the massive image-text data greatly improves the concept diversity for GLIPv2.
+
+Second-stage pre-training of the segmentation head. GLIPv2 performs a second-stage pre-training of the language-guided segmentation head on both instance segmentation and image referring segmentation data, while fixing all other parts of the model.
+
+# 3.3 Transfer GLIPv2 to Localization and VL Tasks
+
+We introduce two ways to easily transfer GLIPv2 to various downstream tasks. In addition, GLIPv2 can perform conventional VL tasks (e.g., VQA) along with localization, effectively making every task we consider a “grounded VL understanding” task.
+
+One model architecture for all. GLIPv2 can be transferred to downstream tasks by fine-tuning the model with an (optional) task-specific head. 1) For detection and segmentation tasks, no task-specific head is needed as the pre-training architecture can inherently perform detection and segmentation. 2) For $V L$ tasks: for VQA, a classification head is added on top of the hidden representation of the start-of-sequence token; for caption generation, we train with a unidirectional language modeling loss, which maximizes the likelihood of the next word given context. We use a unidirectional attention mask and prevent the image part from attending to the text in the fusion layers.
+
+One set of weights for all. There is a growing interest in developing models that can be transferred to various tasks while only changing the least amount of parameters to save training time and storage cost [47, 31]. Following GLIP, GLIPv2 can be transferred to localization tasks in a zero-shot or a prompt-tuning setting (Section 4.2). One single GLIPv2 model can serve various tasks, where each task only keeps few or no parameters. Of particular interest is the prompt tuning setting. For a certain localization task, the text prompt is the same for all input images; thus, we could directly tune $\mathring { P }$ , a small prompt embedding matrix, to adapt GLIPv2 to new tasks. Prompt tuning in a deep-fused model such as GLIPv2 is different from the conventional linear probing/prompt tuning setting [53, 44, 60] in shallow-interacting vision models such as CLIP. The latter can also be viewed as only tuning a small prompt/softmax embedding $P$ ; however, tuning $P$ only affects the very last layer of the model while the visual representation is still frozen. In contrast, GLIP/GLIPv2’s visual representation is conditioned on the prompt embedding $\mathring { P }$ ; tuning $\mathring { P }$ changes the text, visual, as well as fused embeddings. As a result, prompt tuning in GLIPv2 is highly effective, often matching the performance of fine-tuning (see Table 2). This is in contrast to the common observation in CV that linear probing lags behind fine-tuning by a large gap [22].
+
+
+Figure 2: GLIPv2 pre-training losses: the intra-image alignment loss ${ \mathcal { L } } _ { \mathrm { { i n t r a } } }$ (right) takes features after VL fusion and compute loss over region-word pairs within each image-text pair; the inter-image contrastive loss (left) ${ \mathcal { L } } _ { \mathrm { { i n t e r } } }$ takes features before VL fusion and computes loss over all region-word pairs across a batch of image-text pairs. Label propagation is used to determine the off-diagonal blocks of the ${ \mathcal { L } } _ { \mathrm { { i n t e r } } }$ target matrix (4).
+
+Grounded VL understanding. GLIPv2 also enables grounded VL understanding, where we retain the ability to perform grounding when fine-tuning the model to a downstream VL task. This increases the interpretability of the model. Specifically, we first turn the VL data of the downstream task into grounded VL data using a pre-trained GLIP model. Then we train the model with both the downstream task head and grounding head. For VQA, the model is trained to predict the answer and ground entities in the question as well as the implied entity in the answer; for captioning, the model is trained to predict the next word given the context and ground the current decoded word. By tuning localization tasks into a grounded VL task and augmenting VL tasks with grounding ability, we effectively turn every task into a grounded VL understanding task (see examples in Figure 1).
+
+# 4 Experiments
+
+In this section, we show that GLIPv2 serves as a performant and easy-to-deploy general-purpose vision system. 1) One Model Architecture for All (Section 4.1). GLIPv2 can be directly fine-tuned to both localization and VL understanding tasks with minimal architecture change. It achieves performance on par with SOTA models with specialized architectures. 2) One Model Weight for All (Section 4.2). GLIPv2 can be transferred to localization tasks in a zero-shot manner with zero parameter update; with prompt tuning, a single GLIPv2 model can achieve comparable performance with fully fine-tuned settings on both localization and understanding tasks.
+
+
Model
Model Type
COCO-Det (test-dev)
ODinW (test)
LVIS (minival)
COCO-Mask (test-dev)
Flickr30K PhraseCut (test)
(test)
VQA (test-dev/test-std) (Karpathy-test)
Captioning
Mask R-CNN [23]
39.8
-
33.3/-
-/37.1
=
=
DETR[9]
42.0
17.8/-
=
=
DyHead-T[15]
49.7
60.8
=
=
=
DyHead-L [15]
60.3*
=
=
=
VisualBERT[34]
Understanding
=
71.33
=
70.8/71.0
=
UNITER[12]
=
=
73.8/74.0
=
VinVL[59]
=
76.5/76.6
130.8
GPV[21]
Localization &
=
·
=
62.5/-
102.3
UniT[24]
42.3
=
67.6/-
=
MDETR[25]
=
=
24.2/-
=
84.3
53.7
70.6 /70.6
■
Unicorn [56]
Understanding Localization &
=
■
=
80.4
=
69.2/69.4
119.1
GLIP-T[36]
55.2
64.9
=
=
85.7
-
=
-
GLIP-L [36]
Understanding 61.5*
68.9
=
=
87.1
-
=
-
GLIPv2-T(Ours)
Localization
55.5
66.5
50.6/41.4
53.5/42.0
86.5
59.4
71.6/71.8
122.1
GLIPv2-B (Ours)
&
58.8
69.4
57.3/46.2
59.0/45.8
87.5
61.3
73.1/73.3
128.5
GLIPv2-H(Ours)
Understanding
60.6 (62.4*)
70.4
59.8 / 48.8
59.8 / 48.9
87.7
61.3
74.6/74.8
131.0
+
+Table 1: One model architecture results. For COCO-Det test-dev, \* indicates multi-scale evaluation. For LVIS, we report the numbers for both bbox and segm on minival to avoid data contamination due to the pre-training. For Flickr30K test, we report the metric under R@1. For COCO-Mask, we also report both bbox and segm on test-dev.
+
+Following GLIP [36], we adopt Swin Transformer [40] as the image encoder $\operatorname { E n c } _ { V }$ , text transformers [51, 44] as the text encoder $\mathrm { E n c } _ { L }$ , Dynamic Head [15] with language-aware deep fusion [36] as the fusion encoder $\mathtt { E n c } _ { V L }$ , and Hourglass network [43] as instance segmentation head feature extractor. We train GLIPv2 at three scales: GLIPv2-T, GLIPv2-B, and GLIPv2-H.
+
+GLIPv2-T has the same model config and initialization as GLIP-T: Swin-Tiny and BERT-Base as the dual encoder. The model is pre-trained on the following data: 1) O365, 2) GoldG as in GLIP-T (C), and 3) Cap4M, 4M image-text pairs collected from the web with boxes generated by GLIP-T [36]. GLIPv2-B/GLIPv2-H are based on Swin-Base/Swin-Huge and the pre-layernorm text transformer [17] as dual encoder, and are initialized from the UniCL [55] checkpoints. We observe much stabler training with GPT-type pre-layernorm transformer [17] than BERT-type post-layernorm transformer. The training data contain: 1) FiveODs (2.78M data) 1; 2) GoldG as in MDETR [25]; and 3) C $\mathrm { C 1 5 M + S B U }$ , 16M public image-text data with generated boxes by GLIP-L [36]. Segmentation heads of GLIPv2 models are pre-trained on COCO, LVIS [20] and PhraseCut [54], with all other model parameters are frozen.
+
+Note All datasets above were collected by the creators (cited) and consent for any personally identifiable information (PII) was ascertained by the authors where necessary. Due to limited space, we refer to supplementary for details of training recipes and hyper-parameters.
+
+# 4.1 One Model Architecture for All
+
+We compare GLIPv2 to existing object detection and vision-language pre-training methods on a wide range of tasks. We fine-tune the model on 8 different downstream tasks and report the performance in Table 1. We make the following observations.
+
+GLIPv2 v.s. specialized Localization methods. GLIPv2 outperforms previous localization models on generalization to both common and rare classes and domains with a single model architecture and pre-training stage. 1) OD on common categories (COCO-Det), GLIPv2-T achieves 5.8 improvement compared to the standard DyHead-T trained on O365 (55.5 v.s. 49.7). GLIPv2-H reaches $6 2 . 4 \mathrm { A P }$ on test-dev, and surpass the performance of the previous SoTA model GLIP-L. 2) OD on rare / unseen categories (LVIS), GLIPv2-T outperforms a supervised MDETR on the bbox by a great margin (59.8 v.s. 24.2). 3) Generalization to diverse real-word tasks (ODinw), GLIPv2-T (55.5) performs better than original GLIP-T (64.9) on the average of 13 public datasets; GLIPv2-B outperforms GLIP-L by 0.5 AP. 4) Instance segmentation (COCO-Mask & PhraseCut), for traditional instance segmentation (i.e., COCO-Mask), GLIPv2-H outperforms the well-known Mask R-CNN by a great margin on segm.
+
+Table 2: One set of weights results v.s. Original GLIP. \* indicates multi-scale evaluation. Numbers in red clearly points out the difference between the prompt tuning and full fine-tuning results (see Table 1). Numbers in gray mean that they are not in zero-shot manner. $\dagger$ : these two numbers are artificially high due to some overlap between COCO-minival and VisualGenome-train.
+
+
Model
Direct Evaluation
Prompt Tuning
COCO-Mask (minival)
ODinW (test)
LVIS-Det (minival)
Flickr30K (minival)
COCO-Det (test-dev)
ODinW (test)
LVIS (minival)
COCO-Mask (test-dev)
PhraseCut (test)
GLIP-T
46.6/-
46.5
26.0
85.7
二
46.5
-
-
-
GLIP-L
49.8/-
52.1
37.3
87.1
58.8
67.9
=
=
-
GLIPv2-T
47.3/35.7
48.5
29.0
86.0
53.4 (-2.1)
64.8 (-1.7)
49.3 / 34.8 (-13/-6.6)
53.2 / 41.2 (-0.3/-0.8)
49.4
GLIPv2-B
61.9†/43.4
54.2
48.5
87.2
59.0 (+0.2)
67.3 (-2.1)
56.8 / 41.7 (-0.5/-4.5)
58.8 / 44.9 (-0.2/-0.9)
55.9
GLIPv2-H
64.1/47.4
55.5
50.1
87.7
60.2 /61.9* (-0.4 /-0.5)
69.1 (-1.3)
59.2 / 43.2 (-0.6/-5.7)
59.8 / 47.2 (-0.0/-1.7)
56.1
+
+
+Figure 3: Data efficiency of GLIPv2 on ODinW. The $\mathbf { X }$ -axis is the amount of task-specific data, from zero-shot to all data. Y-axis is the average AP across 13 datasets.
+
+Table 3: Zero-shot, prompt tuning, and full finetuning performance on ODinW. GLIPv2 models exhibit superior data efficiency.
+
+
Model
Zero-Shot 0
Prompt Tuning /Fine Tuning
1
3
5
10
All
DyHead-T 0365 [36]
-
=
-
-
-
33.8
43.6
46.4
50.8
60.8
Lloc + Lintra (GLIP-T)
46.5
49.9
53.7
55.5
56.6
62.4
51.3
54.9
56.4
58.4
64.9
Lloc + Lintra +Linter
48.4
52.1
55.6
56.7
58.3
62.9
51.4
55.3
56.6
59.5
66.3
Lloc +Lintra +Linter +Cmm
48.5
52.4
55.6
57.4
58.8
64.8
52.8
55.6
57.4
59.7
66.5
+
+For language-guided segmentation (i.e., PhraseCut), compared to MDETR, GLIPv2-T achieves an improvement of 5.7 mask AP.
+
+GLIPv2 v.s. specialized VL Understanding methods. GLIPv2 rivals with SoTA specialized models for VL tasks. 1) For VQA, GLIPv2 outperforms VisualBERT and UNITER and approaches the previous SoTA model VinVL. 2) For Captioning, the best GLIPv2 even surpasses VinVL (VinVL and GLIPv2 are not trained with CIDEr optimization).
+
+GLIPv2 v.s. localization and VL models. Prior works such GPV, UniT and Unicorn have also explored unifying localization and VL models (see a discussion in Section 2). GLIPv2 outperforms all previous systems on both localization and VL tasks. For the best GLIPv2-H, it outperforms the UniT by a great margin (18.3 AP) on COCO object detection tasks. Meanwhile, it also surpasses UniT’s performance on VQA by 6.9 points and GPV’s peformance on Image Captioning as well.
+
+Takeaway. Most notably, GLIPv2 outperforms previous “unified” models (GPV, UniT, MDETR, Unicorn) by a large margin. This is the first time that a single model architecture could achieve near SoTA performance on both localization and understanding. In contrast, in prior work, there exists certain trade-off between localization and understanding: models that aim to achieve high understanding performance tend to have lower localization performance (e.g., UNiT’s detection performance is limited to the DETR [9] architecture), as it is not trivial to merge a SoTA localization branch and a SoTA VL branch into a single model.
+
+# 4.2 One Set of Model Parameters for All
+
+GLIPv2 is pre-trained to perform grounding; thus it can be transferred to various localization tasks with changing zero or few parameters. We evaluate GLIPv2 under two such settings: 1) direct evaluation, where we transfer the model “as is” without any parameter change, and 2) prompt tuning, where only the prompt embedding is tuned for specific tasks (Section 3.3).
+
+Direct evaluation. The pre-trained GLIPv2 can be directly evaluated on any object detection task (by concatenating the object categories into a text prompt) and visual grounding task without any further tuning. We evaluate the models on four localization tasks: COCO, ODinW, LVIS, and Flickr30, and their results are presented in Table 2. Note that for GLIPv2-B and GLIPv2-H, the training sets of Flick30K and LVIS are present in the pre-training data. Thus, reported numbers on these metrics are not zero-shot evaluation (we have marked them gray). For all other evaluation results, the models are evaluated in zero-shot settings without any further tuning.
+
+GLIPv2 can be effortlessly transferred to different localization tasks without further tuning. 1) For COCO, GLIPv2-T achieves a zero-shot performance of 47.3 without seeing any COCO training images. This surpasses well-established supervised systems (e.g., Mask R-CNN) and also outperforms GLIP-T by 0.7 AP. 2) For ODinW, GLIPv2 also shows strong zero-shot performance. GLIPv2-T (48.5) surpasses the GLIP-T (46.5). Meanwhile, the zero-shot performance of GLIPv2-B and GLIPv2- H even surpasses the 10-shot tuning performance of DyHead-T (to be introduced in Figure 3). 3) For LVIS, GLIPv2-T achieves a 3 AP improvement performance compared to the GLIP-T. 4) For Flickr30K, GLIPv2-B achieves even higher number (87.2) compared to original GLIP-L (87.1).
+
+Prompt Tuning. Following GLIP, GLIPv2 supports efficient prompt tuning: the visual representation is heavily conditioned on the text representation due to the deep fusion block (Section 3.3); thus we could fine-tune only the prompt embedding for each task but still maintain high performance.
+
+Prompt tuning $G L I P \nu 2$ achieves similar performance as full fine-tuning. When comparing the performance of each task in Table 1 and 2 at the same time, for GLIPv2, prompt tuning performance almost matches the one model architecture results on localization tasks, without changing any of the grounding model parameters.
+
+# 4.3 GLIPv2 as a Strong Few-Shot Learner
+
+We demonstrate GLIPv2’s performance on ODinW datasets with respect to different amounts of training data in Figure 3. The performance improvement between GLIPv2-T and GLIP-T exhibits more superior data efficiency for prompt tuning. We compare with the SoTA detector DyHead-T, pre-trained on Objects365 in Table 3. It can be seen that a zero-shot GLIPv2-T (48.5) outperforms a outperforms 5-shot DyHead-T (46.4) while the performance of one-shot GLIPv2-H (61.3) surpasses a all-shot fully supervised DyHead-T (60.8).
+
+# 4.4 Analysis
+
+Pre-training losses Table 4 shows the performance of the downstream tasks with different variants of our method. Compared to the GLIP pre-training tasks with only intra-image region-word contrastive loss (Row 3), adding inter-image word-region loss (Row 5) substantially improves the pre-trained model performance across all the object detection tasks (COCO, ODinW, and LVIS) on both zero-shot and fine-tuned manner. Consistent with common observations from most VL understanding methods, adding MLM loss (Row4) benefits for learning the representation for understanding tasks (Flick30k, VQA, and Captioning). Furthermore, using all three losses together at the 1st stage pre-training and doing the 2nd stage pre-training without MLM on OD and GoldG data, GLIPv2 (Row6) can perform well on both the localization and VL understanding tasks.
+
+An additional stage of pre-training is applied for small models (GLIPv2-T and GLIPv2-B) due to limited model capacity. In order to achieve higher performance on both localization and understanding tasks, we find that including all data (even with some noise) and MLM loss in the first stage of pre-training will benefit the model for learning a better representation of both localization and understanding capability. Since the OD tasks require the model with more accurate localization ability, in our 2nd stage of pre-training, we decide to eliminate the MLM loss. The large model (GLIPv2-H) does not need this additional stage because it has enough capacity to learn both wordregion alignment and MLM together in a single stage.
+
+Pre-training data Table 5 reports the last checkpoint results on GLIPv2 when we do the scaling up of pre-training data. As more weak image-text pair data (Cap) is involved in our training, it benefits both standard/in-domain (i.e., COCO, Flickr30K) and large-domain gap (i.e., ODinW, LVIS) tasks. We also show that by adding the inter-image region-word contrastive helps when we are fixing the data at the same scale. For large-domain gap tasks, adding the inter-image region-word contrastive
+
+
Row Model
COCO
ODinW
LVIS|Flickr30K VQA Captioning
1
No pre-train
-/50.6
-/60.8
1
1
64.6
111.5
2
+Lmlm
-/48.5
-/37.4
1
1
64.6
110.9
3
+ Lloc+Lintra
46.6/55.2 46.5/64.9
26.0
85.7
69.4
119.7
4
+Lloc+Lintra+Lmlm
47.0/55.2 47.6/66.2
28.5
86.5
69.8
120.7
5
+Lloc+Lintra+Linter
47.1/55.4 48.4/66.3
28.6
85.8
68.7
120.4
6
+Lloc+Lintra+Linter+Lmlm
47.3/55.5 48.5/66.5
29.0
86.3
70.7
122.1
+
+Table 4: Pre-training losses on Tiny-scale model. Involving intra-image region-word alignment loss $\mathcal { L } _ { \mathrm { { i n t r a } } }$ , inter-image region-word contrastive loss ${ \mathcal { L } } _ { \mathrm { i n t e r } }$ and MLM loss ${ \mathcal { L } } _ { \mathrm { m l m } }$ will benefit both localization and understanding tasks.
+
+Table 5: Pre-train data scale up on Base-scale model. Results are reported at the last checkpoint. See supplementary for results at all checkpoints.
+
+
Linter
Pre-train Data
CoCo
ODinW
LVIS
Flick30K
X
0365,GoldG
48.06
43.14
25.6
84.36
0365,GoldG
48.59
42.64
26.9
83.90
0365,GoldG,Cap4M
48.21
51.35
34.2
85.56
X
0365,GoldG,Cap4M
48.79
52.70
35.0
85.50
×
0365,GoldG,Cap12M
48.50
49.32
35.5
85.79
√
0365,GoldG,Capl2M
49.26
53.15
36.6
85.84
+
+Table 6: GLIPv2 can perform captioning and grounding at the same time (a.k.a., grounded VL understanding).
+
+
Model
COCO Caption B4 CIDEr
SPICE
R@1 R@5
Flickr30K Grounding
R@10°
GLIPv2-T
36.5
119.8 21.6
80.8
94.4
96.5
GLIPv2-B
37.4
123.0 21.9
81.0
94.5
96.5
+
+loss will further boost the model to learn better representation. For more detailed scaling-up effects on various tasks under all the checkpoints for GLIP and GLIPv2, refer to Appendix.
+
+Note that the (Img, Text, $T$ ) data used in GLIPv2 pre-training can be just human-annotated data (Row1&2 in Table 5), with which GLIPv2 pre-training does not involve any pseudo data from a pre-trained grounding/localization model. In order to achieve the best performance, GLIPv2 uses image-text pair data with pseudo boxes (Cap) from a pre-trained GLIP model (Row3-6 in Table 4), which is trained with the same "grounded VL understanding" task but just with smaller data.
+
+Grounded Vision-Language Understanding GLIPv2 can be trained to perform a VL task and grounding at the same time (Section 3.3). We denote such an ability as grounded VL understanding. In Figure 1, we showcase grounded predictions of GLIPv2 on VQA and COCO captions. We also conduct quantitative evaluations (Table 6). The model achieves strong performance for both VL understanding (on COCO Caption) and localization (on Flickr30K Grounding). Such an ability to produce high-level semantic outputs (i.e., answers and captions) and supporting localization results is another appealing trait of GLIPv2, as potential users can have a better understanding of the model behaviour. See more detailed analysis and qualitative examples in the Appendix.
+
+# 5 Conclusion and Social Impacts
+
+This paper proposes GLIPv2, a unified framework for VL representation learning that serves both localization tasks and VL understanding tasks. We experimentally verify the effectiveness of the unified model and the novel region-word contrastive learning. Compared to existing methods, GLIPv2 achieves competitive near SoTA performance on various localization and understanding tasks. However, additional analysis of the data and the model is necessary before deploying it in practice since large-scale web data may contain unintended private information, unsuitable images/text, or some bias leakage. Further investigation may be needed for web data due to the above issues.
+
+# 6 Acknowledgement
+
+We thank anonymous reviewers for their comments and suggestions. Additional thanks go to the Microsoft Research Horizontal AI Team and Microsoft Alexander Multi-modal Team for providing computer resources for large-scale training. The baseline models used in our experiments are based on the open-source code released in the GitHub repository; we acknowledge all the authors who made their code public, which tremendously accelerates our project progress.
+
+# References
+
+top-down attention for image captioning and visual question answering. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR). pp. 6077–6086. IEEE (2018)
+[2] Anderson, P., He, X., Buehler, C., Teney, D., Johnson, M., Gould, S., Zhang, L.: Bottom-up and top-down attention for image captioning and visual question answering. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 6077–6086 (2018)
+[3] Antol, S., Agrawal, A., Lu, J., Mitchell, M., Batra, D., Zitnick, C.L., Parikh, D.: VQA: Visual Question Answering. In: International Conference on Computer Vision (ICCV) (2015)
+[4] Bansal, A., Sikka, K., Sharma, G., Chellappa, R., Divakaran, A.: Zero-shot object detection. In: Proceedings of the European Conference on Computer Vision (ECCV). pp. 384–400 (2018)
+[5] Bilen, H., Vedaldi, A.: Weakly supervised deep detection networks. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. pp. 2846–2854 (2016)
+[6] Bommasani, R., Hudson, D.A., Adeli, E., Altman, R., Arora, S., von Arx, S., Bernstein, M.S., Bohg, J., Bosselut, A., Brunskill, E., et al.: On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258 (2021)
+[7] Bucher, M., Vu, T.H., Cord, M., Pérez, P.: Zero-shot semantic segmentation. Advances in Neural Information Processing Systems 32 (2019)
+[8] Caesar, H., Uijlings, J., Ferrari, V.: Coco-stuff: Thing and stuff classes in context. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 1209–1218 (2018)
+[9] Carion, N., Massa, F., Synnaeve, G., Usunier, N., Kirillov, A., Zagoruyko, S.: End-to-end object detection with transformers. In: European Conference on Computer Vision. pp. 213–229. Springer (2020)
+[10] Chen, K., Pang, J., Wang, J., Xiong, Y., Li, X., Sun, S., Feng, W., Liu, Z., Shi, J., Ouyang, W., et al.: Hybrid task cascade for instance segmentation. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 4974–4983 (2019)
+[11] Chen, X., Fang, H., Lin, T.Y., Vedantam, R., Gupta, S., Dollár, P., Zitnick, C.L.: Microsoft COCO captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325 (2015)
+[12] Chen, Y.C., Li, L., Yu, L., El Kholy, A., Ahmed, F., Gan, Z., Cheng, Y., Liu, J.: UNITER: Universal image-text representation learning. In: Proceedings of the European Conference on Computer Vision (ECCV). pp. 104–120. Springer (2020)
+[13] Chen, Y.C., Li, L., Yu, L., Kholy, A.E., Ahmed, F., Gan, Z., Cheng, Y., Liu, J.: Uniter: Learning universal image-text representations. arXiv preprint arXiv:1909.11740 (2019)
+[14] Dai, J., Li, Y., He, K., Sun, J.: R-fcn: Object detection via region-based fully convolutional networks. In: Advances in neural information processing systems. pp. 379–387 (2016)
+[15] Dai, X., Chen, Y., Xiao, B., Chen, D., Liu, M., Yuan, L., Zhang, L.: Dynamic head: Unifying object detection heads with attentions. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 7373–7382 (2021)
+[16] Devlin, J., Chang, M.W., Lee, K., Toutanova, K.: Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805 (2018)
+[17] Gao, P., Geng, S., Zhang, R., Ma, T., Fang, R., Zhang, Y., Li, H., Qiao, Y.: Clip-adapter: Better vision-language models with feature adapters. arXiv preprint arXiv:2110.04544 (2021)
+[18] Gokberk Cinbis, R., Verbeek, J., Schmid, C.: Multi-fold mil training for weakly supervised object localization. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 2409–2416 (2014)
+[19] Gu, X., Lin, T.Y., Kuo, W., Cui, Y.: Zero-shot detection via vision and language knowledge distillation. arXiv preprint arXiv:2104.13921 (2021)
+[20] Gupta, A., Dollar, P., Girshick, R.: Lvis: A dataset for large vocabulary instance segmentation. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 5356–5364 (2019)
+[21] Gupta, T., Kamath, A., Kembhavi, A., Hoiem, D.: Towards general purpose vision systems. arXiv preprint arXiv:2104.00743 (2021)
+[22] He, K., Chen, X., Xie, S., Li, Y., Dollár, P., Girshick, R.: Masked autoencoders are scalable vision learners. arXiv preprint arXiv:2111.06377 (2021)
+[23] He, K., Gkioxari, G., Dollár, P., Girshick, R.: Mask r-cnn. In: Proceedings of the IEEE international conference on computer vision. pp. 2961–2969 (2017)
+[24] Hu, R., Singh, A.: Unit: Multimodal multitask learning with a unified transformer. In: Proceedings of the IEEE/CVF International Conference on Computer Vision. pp. 1439–1449 (2021)
+[25] Kamath, A., Singh, M., LeCun, Y., Synnaeve, G., Misra, I., Carion, N.: Mdetr-modulated detection for end-to-end multi-modal understanding. In: Proceedings of the IEEE/CVF International Conference on Computer Vision. pp. 1780–1790 (2021)
+[26] Karpathy, A., Joulin, A., Fei-Fei, L.F.: Deep fragment embeddings for bidirectional image sentence mapping. Advances in neural information processing systems 27 (2014)
+[27] Kiros, R., Salakhutdinov, R., Zemel, R.S.: Unifying visual-semantic embeddings with multimodal neural language models. arXiv preprint arXiv:1411.2539 (2014)
+[28] Krasin, I., Duerig, T., Alldrin, N., Ferrari, V., Abu-El-Haija, S., Kuznetsova, A., Rom, H., Uijlings, J., Popov, S., Veit, A., et al.: Openimages: A public dataset for large-scale multi-label and multi-class image classification. Dataset available from https://github. com/openimages 2(3), 18 (2017)
+[29] Krishna, R., Zhu, Y., Groth, O., Johnson, J., Hata, K., Kravitz, J., Chen, S., Kalantidis, Y., Li, L.J., Shamma, D.A., et al.: Visual Genome: Connecting language and vision using crowdsourced dense image annotations. International Journal of Computer Vision (IJCV) 123(1), 32–73 (2017)
+[30] Krizhevsky, A., Sutskever, I., Hinton, G.E.: Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems 25, 1097–1105 (2012)
+[31] Lester, B., Al-Rfou, R., Constant, N.: The power of scale for parameter-efficient prompt tuning. arXiv preprint arXiv:2104.08691 (2021)
+[32] Li, G., Duan, N., Fang, Y., Jiang, D., Zhou, M.: Unicoder-VL: A universal encoder for vision and language by cross-modal pre-training. arXiv preprint arXiv:1908.06066 (2019)
+[33] Li, J., Selvaraju, R., Gotmare, A., Joty, S., Xiong, C., Hoi, S.C.H.: Align before fuse: Vision and language representation learning with momentum distillation. Advances in Neural Information Processing Systems 34 (2021)
+[34] Li, L.H., Yatskar, M., Yin, D., Hsieh, C.J., Chang, K.W.: Visualbert: A simple and performant baseline for vision and language. arXiv preprint arXiv:1908.03557 (2019)
+[35] Li, L.H., You, H., Wang, Z., Zareian, A., Chang, S.F., Chang, K.W.: Unsupervised vision-andlanguage pre-training without parallel images and captions. arXiv preprint arXiv:2010.12831 (2020)
+[36] Li, L.H., Zhang, P., Zhang, H., Yang, J., Li, C., Zhong, Y., Wang, L., Yuan, L., Zhang, L., Hwang, J.N., et al.: Grounded language-image pre-training. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 10965–10975 (2022)
+[37] Li, X., Yin, X., Li, C., Zhang, P., Hu, X., Zhang, L., Wang, L., Hu, H., Dong, L., Wei, F., et al.: Oscar: Object-semantics aligned pre-training for vision-language tasks. In: Proceedings of the European Conference on Computer Vision (ECCV). pp. 121–137. Springer (2020)
+[38] Lin, T.Y., Goyal, P., Girshick, R., He, K., Dollár, P.: Focal loss for dense object detection. In: Proceedings of the IEEE international conference on computer vision. pp. 2980–2988 (2017)
+[39] Lin, T.Y., Maire, M., Belongie, S., Hays, J., Perona, P., Ramanan, D., Dollár, P., Zitnick, C.L.: Microsoft coco: Common objects in context. In: European conference on computer vision. pp. 740–755. Springer (2014)
+[40] Liu, Z., Lin, Y., Cao, Y., Hu, H., Wei, Y., Zhang, Z., Lin, S., Guo, B.: Swin transformer: Hierarchical vision transformer using shifted windows. arXiv preprint arXiv:2103.14030 (2021)
+[41] Lu, J., Batra, D., Parikh, D., Lee, S.: ViLBERT: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. In: Advances in Neural Information Processing Systems (NeurIPS). pp. 13–23 (2019)
+[42] Lu, J., Clark, C., Zellers, R., Mottaghi, R., Kembhavi, A.: Unified-io: A unified model for vision, language, and multi-modal tasks. arXiv preprint arXiv:2206.08916 (2022)
+[43] Newell, A., Yang, K., Deng, J.: Stacked hourglass networks for human pose estimation. In: European conference on computer vision. pp. 483–499. Springer (2016)
+[44] Radford, A., Kim, J.W., Hallacy, C., Ramesh, A., Goh, G., Agarwal, S., Sastry, G., Askell, A., Mishkin, P., Clark, J., et al.: Learning transferable visual models from natural language supervision. In: International Conference on Machine Learning (ICML) (2021)
+[45] Redmon, J., Divvala, S., Girshick, R., Farhadi, A.: You only look once: Unified, real-time object detection. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 779–788 (2016)
+[46] Ren, S., He, K., Girshick, R., Sun, J.: Faster r-cnn: Towards real-time object detection with region proposal networks. Advances in neural information processing systems 28, 91–99 (2015)
+[47] Shin, T., Razeghi, Y., Logan IV, R.L., Wallace, E., Singh, S.: Autoprompt: Eliciting knowledge from language models with automatically generated prompts. arXiv preprint arXiv:2010.15980 (2020)
+[48] Su, W., Zhu, X., Cao, Y., Li, B., Lu, L., Wei, F., Dai, J.: VL-BERT: Pre-training of generic visual-linguistic representations. arXiv preprint arXiv:1908.08530 (2019)
+[49] Tan, H., Bansal, M.: Lxmert: Learning cross-modality encoder representations from transformers. arXiv preprint arXiv:1908.07490 (2019)
+[50] Tian, Z., Shen, C., Chen, H., He, T.: Fcos: Fully convolutional one-stage object detection. In: Proceedings of the IEEE/CVF international conference on computer vision. pp. 9627–9636 (2019)
+[51] Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A.N., Kaiser, Ł., Polosukhin, I.: Attention is all you need. In: Advances in neural information processing systems. pp. 5998–6008 (2017)
+[52] Wang, P., Cai, Z., Yang, H., Swaminathan, G., Vasconcelos, N., Schiele, B., Soatto, S.: Omnidetr: Omni-supervised object detection with transformers. arXiv preprint arXiv:2203.16089 (2022)
+[53] Wang, X., Huang, T.E., Darrell, T., Gonzalez, J.E., Yu, F.: Frustratingly simple few-shot object detection. arXiv preprint arXiv:2003.06957 (2020)
+[54] Wu, C., Lin, Z., Cohen, S., Bui, T., Maji, S.: Phrasecut: Language-based image segmentation in the wild. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 10216–10225 (2020)
+[55] Yang, J., Li, C., Zhang, P., Xiao, B., Liu, C., Yuan, L., Gao, J.: Unified contrastive learning in image-text-label space. arXiv preprint arXiv:2204.03610 (2022)
+[56] Yang, Z., Gan, Z., Wang, J., Hu, X., Ahmed, F., Liu, Z., Lu, Y., Wang, L.: Crossing the format boundary of text and boxes: Towards unified vision-language modeling. arXiv preprint arXiv:2111.12085 (2021)
+[57] Yuan, L., Chen, D., Chen, Y.L., Codella, N., Dai, X., Gao, J., Hu, H., Huang, X., Li, B., Li, C., et al.: Florence: A new foundation model for computer vision. arXiv preprint arXiv:2111.11432 (2021)
+[58] Zareian, A., Rosa, K.D., Hu, D.H., Chang, S.F.: Open-vocabulary object detection using captions. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 14393–14402 (2021)
+[59] Zhang, P., Li, X., Hu, X., Yang, J., Zhang, L., Wang, L., Choi, Y., Gao, J.: Vinvl: Revisiting visual representations in vision-language models. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 5579–5588 (2021)
+[60] Zhou, K., Yang, J., Loy, C.C., Liu, Z.: Learning to prompt for vision-language models. arXiv preprint arXiv:2109.01134 (2021)
+[61] Zhou, L., Palangi, H., Zhang, L., Hu, H., Corso, J.J., Gao, J.: Unified vision-language pretraining for image captioning and VQA. AAAI (2020)
+[62] Zhu, P., Wang, H., Saligrama, V.: Zero shot detection. IEEE Transactions on Circuits and Systems for Video Technology 30(4), 998–1010 (2019)
+
+[63] Zhu, P., Wang, H., Saligrama, V.: Don’t even look once: Synthesizing features for zero-shot detection. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 11693–11702 (2020)
+
+# Checklist
+
+The checklist follows the references. Please read the checklist guidelines carefully for information on how to answer these questions. For each question, change the default [TODO] to [Yes] , [No] , or [N/A] . You are strongly encouraged to include a justification to your answer, either by referencing the appropriate section of your paper or providing a brief inline description. For example:
+
+• Did you include the license to the code and datasets? [Yes]
+• Did you include the license to the code and datasets? [No] The code and the data are proprietary.
+• Did you include the license to the code and datasets? [N/A]
+
+Please do not modify the questions and only use the provided macros for your answers. Note that the Checklist section does not count towards the page limit. In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below.
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes]
+(c) Did you discuss any potential negative societal impacts of your work? [Yes]
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes]
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes]
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes]
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [Yes]
+(c) Did you include any new assets either in the supplemental material or as a URL? [No]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/wlEOsQ917F/wlEOsQ917F.md b/md/dev/wlEOsQ917F/wlEOsQ917F.md
new file mode 100644
index 0000000000000000000000000000000000000000..404fb81cae421f0fccd3d0f06616beab57fc0b1d
--- /dev/null
+++ b/md/dev/wlEOsQ917F/wlEOsQ917F.md
@@ -0,0 +1,362 @@
+# A framework for bilevel optimization that enables stochastic and global variance reduction algorithms
+
+# Mathieu Dagréou
+
+Inria, CEA Université Paris-Saclay Palaiseau, France mathieu.dagreou@inria.fr
+
+Pierre Ablin CNRS Université Paris-Dauphine, PSL-University Paris, France pierre.ablin@cnrs.fr
+
+# Samuel Vaiter
+
+# Thomas Moreau
+
+CNRS Université Côte d’Azur, LJAD Nice, France samuel.vaiter@cnrs.fr
+
+Inria, CEA Université Paris-Saclay Palaiseau, France thomas.moreau@inria.fr
+
+# Abstract
+
+Bilevel optimization, the problem of minimizing a value function which involves the arg-minimum of another function, appears in many areas of machine learning. In a large scale empirical risk minimization setting where the number of samples is huge, it is crucial to develop stochastic methods, which only use a few samples at a time to progress. However, computing the gradient of the value function involves solving a linear system, which makes it difficult to derive unbiased stochastic estimates. To overcome this problem we introduce a novel framework, in which the solution of the inner problem, the solution of the linear system, and the main variable evolve at the same time. These directions are written as a sum, making it straightforward to derive unbiased estimates. The simplicity of our approach allows us to develop global variance reduction algorithms, where the dynamics of all variables is subject to variance reduction. We demonstrate that SABA, an adaptation of the celebrated SAGA algorithm in our framework, has $O \big ( \frac { 1 } { T } \big )$ convergence rate, and that it achieves linear convergence under Polyak-Łojasciewicz assumption. This is the first stochastic algorithm for bilevel optimization that verifies either of these properties. Numerical experiments validate the usefulness of our method.
+
+# 1 Introduction
+
+Bilevel optimization is attracting more and more attention in the machine learning community thanks to its wide range of applications. Typical examples are hyperparameters selection [5, 38, 17, 6], data augmentation [11, 42], implicit deep learning [3] or neural architecture search [33]. Bilevel optimization aims at minimizing a function whose value depends on the result of another optimization problem:
+
+$$
+\operatorname* { m i n } _ { x \in \mathbb { R } ^ { d } } h ( x ) = F ( z ^ { * } ( x ) , x ) , \quad \mathrm { s u c h t h a t } z ^ { * } ( x ) \in \arg \operatorname* { m i n } _ { z \in \mathbb { R } ^ { p } } G ( z , x ) ,
+$$
+
+where $F$ and $G$ are two real valued functions defined on $\mathbb { R } ^ { p } \times \mathbb { R } ^ { d }$ . $G$ is called the inner function, $F$ is the outer function and $h$ is the value function. Similarly, $z$ is the inner variable and $x$ is the outer variable. In most cases, the function $z ^ { * }$ can only be approximated by an optimization algorithm, which makes bilevel optimization problems challenging. Under appropriate hypotheses, the function $h$ is differentiable, and the chain rule and implicit function theorem give for any $\boldsymbol { x } \in \mathbb { R } ^ { d }$
+
+$$
+\nabla h ( x ) = \nabla _ { 2 } F ( z ^ { * } ( x ) , x ) + \nabla _ { 2 1 } ^ { 2 } G ( z ^ { * } ( x ) , x ) v ^ { * } ( x ) \ ,
+$$
+
+36th Conference on Neural Information Processing Systems (NeurIPS 2022).
+
+where $v ^ { \ast } ( x ) \in \mathbb { R } ^ { p }$ is the solution of a linear system
+
+$$
+\boldsymbol { v } ^ { * } ( \boldsymbol { x } ) = - \left[ \nabla _ { 1 1 } ^ { 2 } G ( \boldsymbol { z } ^ { * } ( \boldsymbol { x } ) , \boldsymbol { x } ) \right] ^ { - 1 } \nabla _ { 1 } F ( \boldsymbol { z } ^ { * } ( \boldsymbol { x } ) , \boldsymbol { x } ) \ .
+$$
+
+In the light of (2) and (3), it turns out that the derivation of the gradient of $h$ at each iteration is cumbersome because it involves two subproblems: the resolution of the inner problem to find an approximation of $z ^ { * } ( x )$ and the resolution of a linear system to find an approximation of $v ^ { * } ( x )$ . It makes the practical implementation of first order methods like gradient descent for (1) challenging.
+
+As is the case in many machine learning problems, we suppose in this paper that $F$ and $G$ are empirical means:
+
+$$
+F ( z , x ) = \frac { 1 } { m } \sum _ { j = 1 } ^ { m } F _ { j } ( z , x ) , \quad G ( z , x ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } G _ { i } ( z , x )
+$$
+
+This structure suggests the use of stochastic methods to solve (1). For single-level problems (that is, classical optimization problems where one function should be minimized), using Stochastic Gradient Descent (SGD; [41, 7]) and variants is natural because individual gradients are straightforward unbiased estimators of the gradient. In the bilevel framework, we want to develop algorithms that make progress on problem (1) by using only a few functions $F _ { j }$ and $G _ { i }$ at a time. However, since $\nabla h$ involves the inverse of the Hessian of $G$ , building such stochastic algorithms is quite challenging, one of the difficulties being that there is no straightforward unbiased estimator of $\nabla h$ . Still, in settings where $m$ or $n$ are large, where computing even a single evaluation of $F$ or $G$ is extremely expensive, stochastic methods are the only scalable algorithms.
+
+
+Figure 1: Convergence curves of the two proposed methods on a toy problem. SABA is a stochastic method that achieves fast convergence on the value function.
+
+Variance reduction [27, 13, 43, 15, 12] is a popular technique to obtain fast stochastic algorithms. In a single-level setting, these methods build an approximation of the gradient of the objective function using only stochastic gradients. Contrary to SGD, the variance of the approximation goes to 0 as the algorithm progresses, allowing for faster convergence. For instance, the SAGA method [13] achieves linear convergence if the objective function satisfies a Polyak-Łojasciewicz inequality, and $O ( { \textstyle { \frac { 1 } { T } } } )$ convergence rate on smooth non-convex functions [40]. The extension of these methods to bilevel optimization is a natural idea to develop faster algorithms. However, this idea is hard to implement because it is hard to derive unbiased estimators of $\nabla h$ , let alone variance reduction ones.
+
+Contributions. We introduce a novel framework for bilevel optimization in Section 2, where the inner variable, the solution of the linear system (3) and the outer variable evolve jointly. The evolution directions are written as sums of derivatives of $F _ { j }$ and $G _ { i }$ , which allows us to derive simple unbiased stochastic estimators. In this framework, we propose SOBA, an extension of SGD (Section 2.1), and SABA (Section 2.2), an extension of the variance reduction algorithm SAGA [13]. In Section 3 we analyse the convergence of our methods. SOBA is shown to achieve $\begin{array} { r } { \operatorname* { i n f } _ { t \leq T } \mathbb { E } [ \| \nabla h ( x ^ { t } ) \| ^ { 2 } ] = O ( \log ( T ) T ^ { - \frac { 1 } { 2 } } ) } \end{array}$ with decreasing step sizes. We prove that SABA with fixed step sizes achieves $\begin{array} { r } { \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \mathbb { E } [ \| \nabla h ( x ^ { t } ) \| ^ { 2 } ] = O ( \frac { 1 } { T } ) } \end{array}$ . SABA is therefore, to the best of our knowledge, the first stochastic bilevel algorithm that matches the convergence rate of gradient descent on $h$ . We also prove that SABA achieves linear convergence under the assumption that $h$ satisfies a Polyak-Łojasciewicz inequality. To the best of our knowledge, SABA is also the first stochastic bilevel algorithm to feature such a property. Importantly, these rates match the rates of the single level counterparts of each algorithm in non-convex setting (SGD for SOBA and SAGA for SABA). Finally, in Section 4, we provide an extensive benchmark of many stochastic bilevel methods on hyperparameters selection and data hyper-cleaning, and illustrate the usefulness of our approach.
+
+Related work. The bilevel optimization problem has a strong history in the optimization community, taking root in game theory [45]. Gradient-based algorithms to solve (1) can be mainly classified in two different categories depending on how $\nabla h$ is computed, by automatic or implicit differentiation.
+
+Since the solution of the inner problem $z ^ { * } ( x )$ is approximated by the output of an iterative algorithm, it is possible to use automatic differentiation [46, 31] to approximate $\nabla h ( x )$ . It consists in differentiating the different steps of the inner optimization algorithm – see [4] for a review – and has been applied successfully to several bilevel problems arising in machine learning [14, 16]. One of the main drawbacks of this approach is that it requires to store in memory each iterate of the inner optimization algorithm, although this problem can sometimes be overcome using invertible optimization algorithms [34] or truncated backpropagation [44].
+
+The use of the implicit function theorem to obtain (2) and (3) is known as implicit differentiation [5]. While the cost of computing exactly (2) can be prohibitive for large scale problems, Pedregosa [38] showed that we can still converge to a stationary point of the problem by using approximate solutions of the inner problem and linear system (3), if the approximation error goes to 0 sufficiently quickly. The complexity of approximate implicit differentiation has been studied in [20]. Ramzi et al. [39] propose to reuse the computations done in the forward pass to approximate the solution of the linear system (3) when the inner problem is solved thanks to a quasi-Newton method.
+
+In the last few years, several works have proposed different strategies to solve (1) in a stochastic fashion. A first set of methods relies on two nested loops: one inner loop to solve the inner problem with a stochastic method, and one outer loop to update the outer variable with an approximate gradient direction. In [19, 26, 9] the authors use several SGD iterations for the inner problem and then use stochastic Neumann approximations to get an estimate solution of the linear system, which provides them with an approximation of $\nabla h$ used to update $x$ . The analysis of this kind of method was refined by Chen et al. [9], allowing to achieve the same convergence rates as those of SGD. The convergence of the hypergradient when using stochastic solvers for the inner problem and the linear system has been studied in [21]. Arbel and Mairal [2] replace the Neumann approximation by SGD steps to estimate (3). Other authors have proposed single loop algorithms, alternating steps in the inner and the outer problem. Hong et al. [24] propose to perform Neumann approximations of the inverse Hessian and use a single SGD step for the inner problem. It was refined in [23] and [47] where the optimization procedure uses a momentum acceleration. Other variations around this idea include [25, 28, 10, 22, 30]. We refer to Table 1 in appendix for a detailed comparison of these methods.
+
+Notation. The set of integers between 1 and $n$ (included) is denoted $[ n ]$ . For $f : \mathbb { R } ^ { p } \times \mathbb { R } ^ { d } \to \mathbb { R }$ we denote $\nabla _ { i } f ( z , x )$ its gradient w.r.t. the $i ^ { \mathrm { { t h } } }$ variable. The Hessian of $f$ with respect to the first variable is denoted $\nabla _ { 1 1 } ^ { 2 } f ( z , x ) \in \mathbb { R } ^ { p \times p }$ , and the cross-derivatives matrix is $\nabla _ { 2 1 } ^ { 2 } f ( z , x ) \in \mathbb { R } ^ { d \times p }$ . If $v$ is a vector, $\lVert v \rVert$ is its Euclidean norm. If $M$ is a matrix, $\lVert M \rVert$ is its spectral norm. A function is said to be $L$ -smooth, for $L > 0$ , if it is differentiable, and its gradient is $L$ -Lipschitz.
+
+# 2 Proposed framework
+
+In this section, we introduce our framework in which the solution of the inner problem, the solution of the linear system (3) and the outer variable all evolve at the same time, following directions that are written as a sum of derivatives of $F _ { j }$ and $G _ { i }$ . We define
+
+# Algorithm 1 General framework
+
+Input: initializations $z _ { 0 } \in \mathbb { R } ^ { p }$ , $\overline { { x _ { 0 } \in \mathbb { R } ^ { d } } }$ $v _ { 0 } \in \mathbb { R } ^ { p }$ , number of iterations $T$ , step size sequences $( \rho ^ { t } ) _ { t < T }$ and $( \gamma ^ { t } ) _ { t < T }$ .
+
+$$
+D _ { z } ( z , v , x ) = \nabla _ { 1 } G ( z , x ) ,
+$$
+
+$$
+D _ { v } ( z , v , x ) = \nabla _ { 1 1 } ^ { 2 } G ( z , x ) v + \nabla _ { 1 } F ( z , x ) ,
+$$
+
+$$
+D _ { x } ( z , v , x ) = \nabla _ { 2 1 } ^ { 2 } G ( z , x ) v + \nabla _ { 2 } F ( z , x ) .
+$$
+
+These directions are motivated by the fact that we have $\nabla h ( x ) ~ = ~ D _ { x } ( z ^ { * } ( x ) , v ^ { * } ( \bar { x } ) , x )$ , with $z ^ { * } ( x )$ the minimizer of $G ( \cdot , x )$ and $v ^ { * } ( x )$ the solution of $\nabla _ { 1 1 } ^ { 2 } G ( z ^ { * } ( x ) , x ) v \ : = \ : - \nabla _ { 1 } F ( z ^ { * } ( x ) , x )$ . When $x$ is
+
+# end for
+
+fixed, we approximate $z ^ { * }$ by doing a gradient descent on $G$ , following the direction $- D _ { z } ( z , v , x )$ . Finally, when $z$ and $x$ are fixed, we find $v ^ { * }$ by following the direction $- D _ { v } ( z , v , x )$ , which corresponds to a gradient descent on $\begin{array} { r } { v \mapsto \frac { 1 } { 2 } \langle \nabla _ { 1 1 } ^ { 2 } G ( z , x ) v , v \rangle + \langle \nabla _ { 1 } F ( z , x ) , v \rangle } \end{array}$ . The rest of the paper is devoted to the study of the global dynamics where the three variables $z , v$ and $x$ evolve at the same time, following stochastic approximations of $D _ { z } , D _ { v }$ and $D _ { x }$ . The next proposition motivates the choice of these directions.
+
+Proposition 2.1. Assume that for all $x \in \mathbb { R } ^ { d } , G ( \cdot , x )$ is strongly convex. If $( z , v , x )$ is a zero of $( D _ { z } , D _ { v } , D _ { x } )$ , then $z = z ^ { * } ( x )$ , $v = v ^ { * } ( x )$ and $\nabla h ( x ) = ~ 0$ .
+
+We also note that the computation of these directions does not require to compute the matrices $\nabla _ { 1 1 } ^ { 2 } G ( z , x )$ and $\nabla _ { 2 1 } ^ { 2 } G ( z , \bar { x } )$ : we only need to compute their product with a vector, which can be computed at a cost similar to that of computing a gradient.
+
+The framework we propose is summarized in Algorithm 1. It consists in following a joint update rule in $( z , v , x )$ that follows directions $D _ { z } ^ { t } , D _ { v } ^ { t }$ and $D _ { x } ^ { t }$ that are unbiased estimators of $D _ { z } , D _ { v } , D _ { x }$ The first and most important remark is that whereas $\nabla h$ cannot be written as a sum over samples, the directions $D _ { z } , D _ { v }$ and $D _ { x }$ involve only simple sums, since their expressions are “linear” in $F$ and $G$ :
+
+$$
+\begin{array} { r l } & { D _ { z } ( z , v , x ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \nabla _ { 1 } G _ { i } ( z , x ) ~ , } \\ & { D _ { v } ( z , v , x ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \nabla _ { 1 1 } ^ { 2 } G _ { i } ( z , x ) v + \frac { 1 } { m } \sum _ { j = 1 } ^ { m } \nabla _ { 1 } F _ { j } ( z , x ) ~ , } \\ & { D _ { x } ( z , v , x ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \nabla _ { 2 1 } ^ { 2 } G _ { i } ( z , x ) v + \frac { 1 } { m } \sum _ { j = 1 } ^ { m } \nabla _ { 2 } F _ { j } ( z , x ) ~ . } \end{array}
+$$
+
+It is therefore straightforward to derive unbiased estimators of these directions. In [30], the authors considered one particular case of our framework, where each direction is estimated by using the STORM variance reduction technique (see [12]). Taking a step back by proposing the framework summarized in Algorithm 1 opens the way to potential new algorithms that implement other techniques that exist in stochastic single level optimization. In what follows, we study two of them.
+
+# 2.1 First example: the SOBA algorithm
+
+The simplest unbiased estimator is obtained by replacing each mean by one of its terms chosen uniformly at random, akin to what is done in classical single-level SGD. We call the resulting algorithm SOBA (StOchastic Bilevel Algorithm). To do so, we choose two independent random indices $i \in [ n ]$ and $j \in [ m ]$ uniformly and estimate each term coming from $G$ using $G _ { i }$ and each term coming from $F$ using $F _ { j }$ . This gives the unbiased SOBA directions
+
+$$
+\boxed { \begin{array} { r l } & { D _ { z } ^ { t } = \nabla _ { 1 } G _ { i } ( z ^ { t } , x ^ { t } ) ~ , } \\ & { D _ { v } ^ { t } = \nabla _ { 1 1 } ^ { 2 } G _ { i } ( z ^ { t } , x ^ { t } ) v ^ { t } + \nabla _ { 1 } F _ { j } ( z ^ { t } , x ^ { t } ) ~ , } \\ & { D _ { x } ^ { t } = \nabla _ { 2 1 } ^ { 2 } G _ { i } ( z ^ { t } , x ^ { t } ) v ^ { t } + \nabla _ { 2 } F _ { j } ( z ^ { t } , x ^ { t } ) ~ . } \end{array} }
+$$
+
+This provides us with a first algorithm, SOBA, where we plug Equations (10a) to (10c) in Algorithm 1. We defer its analysis to the next section. Importantly, we use different step sizes for the update in $( z , v )$ and for the update in $x$ . We use the same step size in $z$ and in $v$ since the inner problem and the linear system have similar conditioning, which is that of $\nabla _ { 1 1 } ^ { 2 } G ( z ^ { t } , x ^ { t } )$ . The need for a different step size for the outer and inner problem is clear: both problems can have a different conditioning.
+
+An important remark for SOBA is that all the stochastic directions used are computed at the same point $\bar { z } ^ { t } , v ^ { t }$ and $x ^ { t }$ with the same indices $( i , j )$ . The update of $z$ , $v$ and $x$ can thus be performed in parallel instead of sequentially, benefiting from hardware parallelism. Moreover, this enables to share the computations between the different directions. This is the case in hyperparameters selection where $\begin{array} { r } { \bar { G } _ { i } ( z , x ) = \ell _ { i } ( \langle z , d _ { i } \rangle ) + \frac { x } { 2 } \| z \| ^ { 2 } } \end{array}$ , with $d _ { i }$ a training sample, and $\ell _ { i }$ that measures how good is the prediction $\langle z , d _ { i } \rangle$ . In this setting, we have $\nabla _ { 1 } G _ { i } ( z , x ) = \ell _ { i } ^ { \prime } ( \langle z , d _ { i } \rangle ) d _ { i } + x z$ and $\nabla _ { 1 1 } ^ { 2 } \bar { G } _ { i } ( z , x ) v \stackrel { - } { = } \ell _ { i } ^ { \prime \prime } ( \langle z , d _ { i } \rangle ) \langle v , d _ { i } \rangle d _ { i }$ . The prediction $\langle z , d _ { i } \rangle$ can thus be computed only once to obtain both quantities. For more complicated models, where automatic differentiation is used to compute the different derivatives and Jacobian-vector products, we can store the computational graph only once to compute at the same time $\nabla _ { 1 } G _ { i } ( z , x ) , \dot { \nabla _ { 1 1 } ^ { 2 } } G _ { i } ( z , x ) v$ and $\nabla _ { 2 1 } ^ { 2 } G _ { i } ( z , x ) \dot { v }$ , requiring only one backward pass, thanks to the $\mathcal { R }$ technique [37].
+
+Finally, like all single loop bilevel algorithms, our method updates at the same time the inner and outer variable, avoiding unnecessary optimization of the inner problem when $x$ is far from the optimum.
+
+# 2.2 Global variance reduction with the SABA algorithm
+
+In classical optimization, SGD fails to reach optimal rates because of the variance of the gradient estimator. Variance reduction algorithms aim at reducing this variance, in order to follow directions that are closer to the true gradient, and to achieve superior practical and theoretical convergence.
+
+In our framework, since the directions $D _ { z } , D _ { v }$ and $D _ { x }$ are all written as sums of derivatives of $F _ { j }$ and $G _ { i }$ , it is easy to adapt most classical variance reduction algorithms. We focus on the celebrated SAGA algorithm [13]. The extension we propose is called SABA (Stochastic Average Bilevel Algorithm). The general idea is to replace each sum in the directions $D$ by a sum over a memory, updating only one term at each iteration. To help the exposition, we denote $y = ( z , x , v )$ the vector of joint variables. Since we have sums over $i$ and over $j$ , we have two memories for each variable: $\boldsymbol { w } _ { i } ^ { t }$ for $i \in [ n ]$ and $\tilde { w } _ { j } ^ { t }$ for $j \in [ m ]$ , which keep track of the previous values of the variable $y$ .
+
+At each iteration $t$ , we draw two random independent indices $i \in [ n ]$ and $j \in [ m ]$ uniformly and update the memories. To do so, we put $w _ { i } ^ { t + 1 } = y ^ { t }$ and $w _ { i ^ { \prime } } ^ { t + 1 } = w _ { i ^ { \prime } } ^ { t }$ for $i ^ { \prime } \neq i$ , and $\tilde { w } _ { j } ^ { t + 1 } = y ^ { t }$ and $\tilde { w } _ { j ^ { \prime } } ^ { t + 1 } = \tilde { w } _ { j ^ { \prime } } ^ { t }$ for $\boldsymbol { j ^ { \prime } } \neq \boldsymbol { j }$ . Each sum in the directions $D$ is then approximated using SAGA-like rules: given $n$ functions $\phi _ { i ^ { \prime } }$ for $i ^ { \prime } \in [ n ]$ , we define $\begin{array} { r } { S [ \phi , w ] _ { i } ^ { t } = \phi _ { i } ( w _ { i } ^ { t + 1 } ) - \phi _ { i } ( w _ { i } ^ { t } ) + \frac { 1 } { n } \sum _ { i ^ { \prime } = 1 } ^ { n } \phi _ { i ^ { \prime } } ( w _ { i ^ { \prime } } ^ { t } ) . } \end{array}$ This is an unbiased estimators of the average of the $\phi$ ’s since $\begin{array} { r } { \mathbb E _ { i } \Big [ S [ \phi , w ] _ { i } ^ { t } \Big ] = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \phi _ { i } ( y ^ { t } ) } \end{array}$ .
+
+With a slight abuse of notation, we call $\nabla _ { 1 1 } ^ { 2 } G v$ the sequence of functions $( y \mapsto \nabla _ { 1 1 } ^ { 2 } G _ { i } ( z , x ) v ) _ { i \in [ n ] }$ and $\nabla _ { 2 1 } ^ { 2 } G v$ the sequence of functions $( y \mapsto \nabla _ { 2 1 } ^ { 2 } G _ { i } ( z , x ) v ) _ { i \in [ n ] }$ . We define the SABA directions as
+
+$$
+\begin{array} { r c l } { { } } & { { } } & { { D _ { z } ^ { t } = S [ \nabla _ { 1 } G , w ] _ { i } ^ { t } ~ , } } \\ { { } } & { { } } & { { D _ { v } ^ { t } = S [ \nabla _ { 1 1 } ^ { 2 } G v , w ] _ { i } ^ { t } + S [ \nabla _ { 1 } F , \tilde { w } ] _ { j } ^ { t } ~ , } } \\ { { } } & { { } } & { { D _ { x } ^ { t } = S [ \nabla _ { 2 1 } ^ { 2 } G v , w ] _ { i } ^ { t } + S [ \nabla _ { 2 } F , \tilde { w } ] _ { j } ^ { t } ~ . } } \end{array}
+$$
+
+These estimators are unbiased estimators of the directions $D _ { z } , D _ { v }$ and $D _ { x }$ . The SABA algorithm corresponds to Algorithm 1 where we use Equations (11a) to (11c) as update directions. When taking a step size $\gamma ^ { t } = \bar { 0 }$ in the outer problem, hereby stopping progress in $x$ , we recover the iterations of the SAGA algorithm on the inner problem. In practice, the sum in $S$ is computed by doing a rolling average (see Appendix B for precision), and the quantities $\phi _ { i } ( w _ { i } ^ { t } )$ are stored rather than recomputed: the cost of computing the SABA directions is the same as that of SGD. It requires an additional memory for the five quantities, of total size $n \times p + ( n + m ) \times ( p + d )$ floats that can be reduced by using larger batch sizes. Indeed, if $b _ { \mathrm { i n } }$ and $b _ { \mathrm { o u t } }$ are respectively the inner and the outer batch sizes, the memory load is reduced to nb × p + (nb + mb) × (p × d) with nb = ⌈ nbinn ⌉ and $\begin{array} { r } { m _ { b } = \left\lceil \frac { m } { b _ { \mathrm { o u t } } } \right\rceil } \end{array}$ which are smaller than the number of samples. This memory load can also be reduced in specific cases, for instance when $G$ and $F$ correspond to linear models, where the individual gradients and Hessian-vector products are proportional to the samples. In this case, we only store the proportionality ratio, reducing the memory load to $3 n + 2 m$ floats. Like for SOBA, the computations of the new quantities $\phi _ { i } ( w _ { i } ^ { t + 1 } )$ are done in parallel, thus benefiting from hardware acceleration and shared computations. Despite this memory load, using SAGA-like variance reduction instead of STORM as done in [30, 47, 28] has the advantage to bring the variance of the estimate directions to zero, enabling faster $O ( { \textstyle { \frac { 1 } { T } } } )$ convergence.
+
+In the next section, we show that SABA is fast. It essentially has the same properties as SAGA: despite being stochastic, it converges with fixed step sizes, and reaches the same rate of convergence as gradient descent on $h$ .
+
+# 3 Theoretical analysis
+
+In this section, we provide convergence rates of SOBA and SABA under some classical assumptions. Note that, unlike most of the stochastic bilevel optimization papers, we work in finite sample setting rather than the more general expectation setting. Actually, SABA does not make any sense for functions that don’t have a finite sum structure. However, we stress that SOBA could be studied in a more general setting to obtain the same bounds as here. Also, the finite sum setting is still interesting since doing empirical risk minimization is very common in practice in machine learning. The proofs and the constants in big- $O$ are deferred in Appendix C.
+
+# 3.1 Background and assumptions
+
+We start by stating some regularity assumptions on the functions $F$ and $G$ .
+
+Assumption 3.1. The function $F$ is twice differentiable. The derivatives $\nabla F$ and $\nabla ^ { 2 } F$ are Lipschitz continuous in $( z , x )$ with respective Lipschitz constants $L _ { 1 } ^ { F }$ and $L _ { 2 } ^ { F }$ .
+
+Note that the above assumption is typically verified in the machine learning context, e.g., when $F$ is the ordinary least squares (OLS) loss or the logistic loss.
+
+Assumption 3.2. The function $G$ is three times continuously differentiable on $\mathbb { R } ^ { p } \times \mathbb { R } ^ { d }$ . For any $x \in \mathbb { R } ^ { d } , G ( \cdot , x )$ is $\mu _ { G }$ -strongly convex. The derivatives $\overrightarrow { \nabla G }$ , $\nabla ^ { 2 } G$ and $\nabla ^ { 3 } G$ are Lipschitz continuous in $( z , x )$ with respective Lipschitz constants $L _ { 1 } ^ { G }$ , $L _ { 2 } ^ { G }$ and $L _ { 3 } ^ { G }$ .
+
+Strong convexity and smoothness with respect to $z$ of $G$ are verified when $G$ is a regularized leastsquares/logistic regression with a full rank design matrix, when the data is not separable for the logistic regression. Moreover, the strong convexity ensures the existence and uniqueness of the inner optimization problem for any $x \in \mathbb { R } ^ { d }$ .
+
+Assumption 3.3. There exists $C _ { F } ~ > ~ 0$ such that for any $x$ we have $\| \nabla _ { 1 } F ( z ^ { * } ( x ) , x ) \| \leq C _ { F } .$
+
+This assumption, combined with the strong convexity of $G ( \cdot , x )$ , shows boundedness of $v ^ { * }$ . This assumption holds, for instance, in the case of hyperparameters selection for a Ridge regression problem. Note that in Assumptions 3.1 and 3.2, we assume more regularity of $F$ and $G$ than in stochastic bilevel optimization literature (see for instance [19, 24, 26, 2]). It is necessary to get the smoothness of $v ^ { * }$ which will allow to adapt the proof of Chen et al. [9] and get tight convergence rates. The following lemma gives us some smoothness properties of the considered directions that will be useful to derive convergence rates of our methods.
+
+Lemma 3.4. Under the Assumptions 3.1 to 3.3, there exist constants $L _ { z }$ , $L _ { v }$ and $L _ { x }$ such that $\begin{array} { r } { \| D _ { z } ( z , v , x ) \| ^ { 2 } \leq L _ { z } ^ { 2 } \| z - z ^ { * } ( \hat { x } ) \| ^ { 2 } , \ \| D _ { v } ( z , v , x ) \| ^ { 2 } \leq L _ { v } ^ { 2 } ( \| z - z ^ { * } ( x ) \| ^ { 2 } + \| v - v ^ { * } ( x ) \| ^ { 2 } ) } \end{array}$ and $\| D _ { x } ( z , v , x ) - \nabla h ( x ) \| ^ { 2 } \leq L _ { x } ^ { 2 } ( \| z - z ^ { * } ( x ) \| ^ { 2 } + \| v - v ^ { * } ( x ) \| ^ { 2 } )$ .
+
+In first order optimization, a fundamental assumption on the objective function is the smoothness assumption. In the case of vanilla gradient descent applied to a function $f$ , it allows to get a convergence rate of $\| \nabla f ( x ^ { t } ) \| ^ { 2 }$ in $O ( \bar { 1 } / T )$ , i.e. convergence to a stationary point [36]. The following lemma proved by Ghadimi and Wang [19, Lemma 2.2] ensures the smoothness of $h$ .
+
+Lemma 3.5. Under the Assumptions 3.1 to 3.3, the function $h$ is $L ^ { h }$ -smooth for some $L ^ { h } > 0$ .
+
+The constant $L ^ { h }$ is specified in Appendix C.3. As usual with the analysis of stochastic methods, we define the expected norms of the directions $V _ { z } ^ { t } = \mathbb { E } [ \| D _ { z } ^ { t } \| ^ { 2 } ]$ , $V _ { v } ^ { t } = \dot { \mathbb { E } } [ \| D _ { v } ^ { t } \| ^ { 2 } ]$ and $V _ { x } ^ { t } = \mathbb { E } [ \| D _ { x } ^ { t } \| ^ { 2 } ]$ , where the expectation is taken over the past. Thanks to variance-bias decomposition, they are the sum of the variance of the stochastic direction and the squared-norm of the unbiased direction. For SOBA, we use classical bounds on variances like those found for instance in [24]:
+
+Assumption 3.6. There exists $B _ { z }$ , $B _ { v }$ and $B _ { x }$ such that for all $t$ , $\begin{array} { r l r } { \mathbb { E } _ { t } [ \| D _ { z } ^ { t } \| ^ { 2 } ] } & { { } \le } & { B _ { z } ^ { 2 } ( 1 + \| D _ { z } ( z ^ { t } , v ^ { t } , x ^ { t } ) \| ^ { 2 } ) } \end{array}$ and $\begin{array} { r } { \mathbb { E } _ { t } [ \| D _ { v } ^ { t } \| ^ { 2 } ] \ \leq \ B _ { v } ^ { 2 } ( 1 + \| D _ { v } ( z ^ { t } , v ^ { t } , x ^ { t } ) \| ^ { 2 } ) } \end{array}$ where $\mathbb { E } _ { t }$ denotes the expectation conditionally to $( z ^ { t } , v ^ { t } , \ddot { x } ^ { t } )$ .
+
+For SOBA and SABA, we need to bound the expected norm of $D _ { x } ^ { t }$ . For SABA, this assumption allows to get a the same sample complexity as SAGA for single level problems.
+
+Assumption 3.7. There exists $B _ { x }$ such that for all $t$ , $\mathbb { E } _ { t } [ \| D _ { x } ^ { t } \| ^ { 2 } ] \leq B _ { x } ^ { 2 }$ .
+
+Assumptions 3.6 and 3.7 are verified for instance, if all the $G _ { i }$ and $\nabla _ { 1 } G _ { i }$ have at most quadratic growth, and if $F$ has bounded gradients. They are also verified if the iterates remain in a compact set. Note that we do not assume that $G$ has bounded gradients, as this would contradict its strong-convexity. Finally, for the analysis of SABA, we need regularity on each $G _ { i }$ and $F _ { j }$ :
+
+Assumption 3.8. For all $i \in [ n ]$ and $j \in [ m ]$ , the functions $\nabla G _ { i }$ , $\nabla F _ { j }$ , $\nabla _ { 1 1 } ^ { 2 } G _ { i }$ and $\nabla _ { 2 1 } ^ { 2 } G _ { i }$ are Lipschitz continuous in $( z , x )$ .
+
+# 3.2 Fundamental descent lemmas
+
+Our analysis for SOBA and SABA is based on the control of both $\delta _ { z } ^ { t } = \mathbb { E } [ \| z ^ { t } - z ^ { * } ( x ^ { t } ) \| ^ { 2 } ]$ and $\delta _ { v } ^ { t } = \mathbb E [ | | \bar { v } ^ { t } - v ^ { * } ( x ^ { t } ) | | ^ { 2 } ]$ , Strong convexity of $G$ and smoothness of $z ^ { * } ( x )$ and $v ^ { * } ( x )$ allow to obtain the following lemma by adapting the proof of Chen et al. [9]. In what follows, we drop the dependency of the step sizes $\rho$ and $\gamma$ in $t$ for clarity.
+
+Lemma 3.9. Assume that $\begin{array} { r } { \gamma ^ { 2 } \leq \operatorname* { m i n } \left( \frac { \mu _ { G } L _ { * } ^ { 2 } } { 4 B _ { x } ^ { 2 } L _ { z x } ^ { 2 } } , \frac { \mu _ { G } L _ { * } ^ { 2 } } { 8 B _ { x } ^ { 2 } L _ { v x } ^ { 2 } } \right) \rho } \end{array}$ . We have:
+
+$$
+\begin{array} { r l } & { \delta _ { z } ^ { t + 1 } \leq \left( 1 - \frac { \rho \mu _ { G } } { 4 } \right) \delta _ { z } ^ { t } + 2 \rho ^ { 2 } V _ { z } ^ { t } + \beta _ { z x } \gamma ^ { 2 } V _ { x } ^ { t } + \overline { { \beta } } _ { z x } \frac { \gamma ^ { 2 } } { \rho } \mathbb { E } [ \| D _ { x } ( z ^ { t } , v ^ { t } , x ^ { t } ) \| ^ { 2 } ] } \\ & { \delta _ { v } ^ { t + 1 } \leq \left( 1 - \frac { \rho \mu _ { G } } { 8 } \right) \delta _ { v } ^ { t } + \beta _ { v z } \rho \delta _ { z } ^ { t } + 2 \rho ^ { 2 } V _ { v } ^ { t } + \beta _ { v x } \gamma ^ { 2 } V _ { x } ^ { t } + \overline { { \beta } } _ { z x } \frac { \gamma ^ { 2 } } { \rho } \mathbb { E } [ \| D _ { x } ( z ^ { t } , v ^ { t } , x ^ { t } ) \| ^ { 2 } ] } \end{array}
+$$
+
+where $\beta _ { z x } = \beta _ { v x } = 3 L _ { * } ^ { 2 }$ , $\begin{array} { r } { \overline { { \beta } } _ { z x } \ : = \ : \frac { 8 L _ { * } ^ { 2 } } { \mu _ { G } } } \end{array}$ , $\begin{array} { r } { \overline { { \beta } } _ { v x } = { \frac { 1 6 L _ { * } ^ { 2 } } { \mu _ { G } } } } \end{array}$ , $L _ { * }$ is the maximum between the Lipschitz constants of and ∗ zx (see Lemma ), , , and are respectively $z ^ { * }$ $v ^ { * }$ $C . I$ $\begin{array} { r } { \beta _ { v z } = \frac { \mathrm { ~ i ~ } } { \mu _ { G } ^ { 3 } } ( L _ { 1 } ^ { F } \mu _ { G } + L _ { 2 } ^ { G } ) ^ { 2 } } \end{array}$ $L _ { z x }$ $L _ { v x }$ the smoothness constants of $z ^ { * }$ and $v ^ { * }$ .
+
+We insist that this result is obtained in general for Algorithm 1 with arbitrary unbiased directions. We can therefore invoke this lemma for the analysis of both SOBA and SABA. We use the smoothness of $h$ to get the following lemma, which is similar to [9, Lemma 1].
+
+Lemma 3.10. Let $h ^ { t } = \mathbb { E } [ h ( x ^ { t } ) ]$ and $g ^ { t } = \mathbb { E } [ \| \nabla h ( x ^ { t } ) \| ^ { 2 } ]$ . We have
+
+$$
+h ^ { t + 1 } \leq h ^ { t } - \frac { \gamma } { 2 } g ^ { t } - \frac { \gamma } { 2 } \mathbb { E } [ \| D _ { x } ( z ^ { t } , v ^ { t } , x ^ { t } ) \| ^ { 2 } ] + \frac { \gamma } { 2 } L _ { x } ^ { 2 } ( \delta _ { z } ^ { t } + \delta _ { v } ^ { t } ) + \frac { L ^ { h } } { 2 } \gamma ^ { 2 } V _ { x } ^ { t } ~ .
+$$
+
+If $z ^ { t } = z ^ { * } ( x ^ { t } )$ , $v ^ { t } = v ^ { * } ( x ^ { t } )$ , that is $\delta _ { z } , \delta _ { v }$ both cancel and $D _ { x } ( z ^ { t } , v ^ { t } , x ^ { t } ) = \nabla h ( x ^ { t } )$ , we get an inequality reminiscent of the smoothness inequality for SGD on $h$ .
+
+# 3.3 Analysis of SOBA
+
+The analysis of SOBA is based on Lemmas 3.5 and 3.9. We have the following theorem, with fixed step sizes depending on the number of iterations:
+
+Theorem 1 (Convergence of SOBA, fixed step size). Fix an iteration $T > 1$ and assume that Assumptions 3.1 to 3.7 hold. We consider fixed steps $\begin{array} { r } { \rho ^ { t } = \frac { \overline { { \rho } } } { \sqrt { T } } } \end{array}$ and $\gamma ^ { t } = \xi \rho ^ { t }$ with $\overline { \rho }$ and $\xi$ precised in the appendix. Let $( x ^ { t } ) _ { t \geq 1 }$ the sequence of outer iterates for SOBA. Then,
+
+$$
+\frac { 1 } { T } \sum _ { t = 1 } ^ { T } \mathbb { E } [ \| \nabla h ( x ^ { t } ) \| ^ { 2 } ] = O ( T ^ { - \frac { 1 } { 2 } } ) \mathrm { ~ . ~ }
+$$
+
+As opposed to [24], we do not need that the ratio $\frac { \gamma } { \rho }$ goes to 0, which allows to get a complexity (that is, the number of call to oracles to have an $\epsilon$ -stationary solution) in $O ( \epsilon ^ { - 2 } )$ better than the $\tilde { O } ( \epsilon ^ { - \frac { 5 } { 2 } } )$ they have. Also, note that this rate is the same as the one of SGD for non-convex and smooth objective [18, 8]. We obtain a similar rate using decreasing step sizes:
+
+Theorem 2 (Convergence of SOBA, decreasing step size). Assume that Assumptions 3.1 to 3.7 hold. We consider steps $\rho ^ { t } = \overline { { \rho } } t ^ { - \frac { 1 } { 2 } }$ and $\gamma ^ { t } = \xi \rho$ . Let $x ^ { t }$ the sequence of outer iterates for SOBA. Then,
+
+$$
+\operatorname* { i n f } _ { t \leq T } \mathbb { E } [ \| \nabla h ( x ^ { t } ) \| ^ { 2 } ] = O ( \log ( T ) T ^ { - { \frac { 1 } { 2 } } } ) \enspace .
+$$
+
+As for SGD, SOBA suffers from the need of decreasing step sizes to get actual convergence because of the variance of the estimation on each directions. On the other hand, the analysis of SABA leverages the dynamic of all three variables, resulting in fast convergence with fixed step sizes.
+
+# 3.4 SABA: a stochastic method with optimal rates
+
+In what follows, we denote $N = n + m$ the total number of samples. The following theorem shows $O ( N ^ { \frac { 2 } { 3 } } T ^ { - 1 } )$ convergence for the SABA algorithm in the general case where we only assume smoothness of $h$ . Our analysis of SABA is inspired by the analysis of single-level SAGA by Reddi et al. [40].
+
+Theorem 3 (Convergence of SABA, smooth case). Assume that Assumptions 3.1 to 3.3 and 3.7 to 3.8 hold. We suppose $\rho = \rho ^ { \prime } N ^ { - \frac { 2 } { 3 } }$ and $\gamma = \xi \rho$ , where $\rho ^ { \prime }$ and $\xi$ depend only on $F$ and $G$ and are specified in appendix. Let $x ^ { t }$ the iterates of SABA. Then,
+
+$$
+\frac { 1 } { T } \sum _ { t = 1 } ^ { T } \mathbb { E } [ \| \nabla h ( x ^ { t } ) \| ^ { 2 } ] = O \left( N ^ { \frac { 2 } { 3 } } T ^ { - 1 } \right) \ .
+$$
+
+To prodefine $\begin{array} { r } { { S } ^ { t } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \| y ^ { t } - w _ { i } ^ { t } \| ^ { 2 } + \frac { 1 } { m } \sum _ { j = 1 } ^ { m } \| y ^ { t } - \tilde { w } _ { j } ^ { t } \| ^ { 2 } } \end{array}$ m the memory to the current variables. We. In appendix, we show that we can find $\phi _ { s } , \phi _ { z } , \phi _ { v } > 0$ such that the quantity $\mathcal { L } ^ { t } = h ^ { t } + \phi _ { s } S ^ { t } + \phi _ { z } \delta _ { z } ^ { t } + \phi _ { v } \delta _ { v } ^ { t }$
+Summing these inequalities for $t = 1 \dots T$ and using the fact that $\textstyle { \mathcal { L } } ^ { t }$ is lower bounded demonstrates
+the theorem.
+
+Note that the step sizes are constant with respect to the time, but they scale with $N ^ { - \frac { 2 } { 3 } }$ . As a consequence, the sample complexity is $O ( N ^ { \frac { 2 } { 3 } } \epsilon ^ { - 1 } )$ which is analogous of the one of SAGA for non-convex single level problems [40]. This is better than the sample complexity of Algorithm 1 with full batch directions, which is $O ( N \epsilon ^ { - 1 } )$ . Hence, with SABA, we get the best of both worlds: the stochasticity makes the scaling in $N$ of the sample complexity goes from $N$ in full batch mode to $N ^ { \frac { 2 } { 3 } }$ for SABA, and the variance reduction makes the scaling in $\epsilon$ goes from $\epsilon ^ { - 2 }$ for SOBA to $\epsilon ^ { - 1 }$ for SABA. Our experiments in Section 4 confirm this gain.
+
+Furthermore, if we assume that $h$ satisfies a Polyak-Łojasiewicz (PL) inequality, we recover linear convergence. Recall that $h$ has the PL property if there exists $\mu _ { h } > 0$ such that for all $x \in \mathbb { R } ^ { d }$ $\begin{array} { r } { \frac { 1 } { 2 } \| \nabla h ( \bar { \boldsymbol { x } } ) \| ^ { 2 } \geq \mu _ { h } ( h ( \boldsymbol { x } ) - h ^ { * } ) } \end{array}$ with $h ^ { * }$ the minimum of $h$ .
+
+Theorem 4 (Convergence of SABA, PL case). Assume that $h$ satisfies the PL inequality and that Assumptions 3.1 to 3.3 and 3.7 to 3.8 hold. We suppose $\rho = \rho ^ { \prime } N ^ { - \frac { 2 } { 3 } }$ and $\gamma = \xi \rho ^ { \prime } N ^ { - 1 }$ , where $\rho ^ { \prime }$ and $\xi$ depend only on $F$ and $G$ and are specified in appendix. Let $x ^ { t }$ the iterates of SABA and $\begin{array} { r } { c ^ { \prime } \triangleq \operatorname* { m i n } \left( \mu _ { h } , \frac { 1 } { 1 6 P ^ { \prime } } \right) } \end{array}$ with $P ^ { \prime }$ specified in the appendix. Then,
+
+$$
+\mathbb { E } [ h ^ { T } ] - h ^ { * } = ( 1 - c ^ { \prime } \gamma ) ^ { T } ( h ^ { 0 } - h ^ { * } + C ^ { 0 } )
+$$
+
+where $C ^ { 0 }$ is a constant specified in appendix that depends on the initialization of $z , v , x$ and memory.
+
+The proof is similar to that of the previous theorem: we find coefficients $\phi _ { s } , \phi _ { z } , \phi _ { v }$ such that $\mathcal { L } ^ { t } \stackrel { } { = } h ^ { t } + \phi _ { s } S ^ { t } + \phi _ { z } \delta _ { z } ^ { t } + \phi _ { v } \delta _ { v } ^ { t }$ satisfies the inequality $\mathcal { L } ^ { t + 1 } \leq ( 1 - c ^ { \prime } \gamma ) \mathcal { L } ^ { t }$ , which is then unrolled. Note that in the case where we initialize $z$ and $v$ with $z ^ { 0 } = z ^ { * } ( x ^ { 0 } )$ , $v ^ { 0 } = v ^ { * } ( x ^ { 0 } )$ , and the memories $w _ { i } ^ { 0 } = w ^ { 0 }$ , $\tilde { w } _ { j } ^ { 0 } = w ^ { 0 }$ for all $i , j$ , the constant $C ^ { 0 }$ cancels and the bound simplifies to $\mathbb { E } [ h ( x ^ { T } ) ] - h ^ { * } \leq ( 1 - c ^ { \prime } \gamma ) ^ { T } ( h ( x ^ { 0 } ) - h ^ { * } )$ .
+
+Just like classical variance reduction methods in single-level optimization, this theorem shows that our method achieves linear convergence under PL assumption on the value function. To the best of our knowledge, our method is the first stochastic bilevel optimization method that enjoys such property. We note that the PL hypothesis is more general than $\mu _ { h }$ -strong convexity of $h - \mathrm { i t }$ is a necessary condition for strong convexity.
+
+We see here the importance of global variance reduction. Indeed, using variance reduction only on $z$ and SGD on $x$ would lead to sub-linear convergence in $x$ . This would be the case even with a perfect estimation of $z ^ { * } ( x )$ . Similarly, using variance reduction only on $x$ and SGD on $z$ would lead to sub-linear convergence in $z$ , and hence in $x$ . Using global variance reduction with respect to each variable as we propose here is the only way to achieve linear convergence. We now turn to experiments, where we find that our method is also promising from a practical point of view.
+
+# 4 Experiments
+
+Here we compare the performances of SOBA and SABA with competitor methods on different tasks. The different methods being compared are stocBiO [26], AmiGO [2], FSLA [30], MRBO [47], TTSA [24], BSA [19] and SUSTAIN [28]. A detailed account of the experiments is provided in Appendix B. 1
+
+# 4.1 Hyperparameters selection
+
+The first task we perform is hyperparameters selection to choose regularization parameters on $\ell ^ { 2 }$ logistic regression. Let us denote $( ( d _ { i } ^ { \mathrm { t r a i n } } , y _ { i } ^ { \mathrm { t r a i n } } ) ) _ { 1 \leq i \leq n }$ and $( ( d _ { i } ^ { \mathrm { v a l } } , y _ { i } ^ { \mathrm { v a l } } ) ) _ { 1 \leq i \leq m }$ the training and the validation sets. In this case, the inner variable $\bar { \theta }$ corresponds to the parameters of the model, and the outer variable $\lambda$ to the regularization. The functions $F$ and $G$ of the problem (1) are the logistic loss, with $\ell ^ { 2 }$ penalty for $G$ , that is to say $\begin{array} { r } { F ( \theta , \lambda ) = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \varphi ( y _ { i } ^ { \mathrm { v a l } } \langle \bar { d } _ { i } ^ { \mathrm { v a l } } , \theta \rangle ) } \end{array}$ and $\begin{array} { r } { G ( \theta , \lambda ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \varphi ( y _ { i } ^ { \mathrm { t r a i n } } \langle d _ { i } ^ { \mathrm { t r a i n } } , \theta \rangle ) + \frac { 1 } { 2 } \sum _ { k = 1 } ^ { p } e ^ { \lambda _ { k } } \theta _ { k } ^ { 2 } } \end{array}$ where $\varphi ( u ) = \log ( 1 + e ^ { - u } )$ . We fit a binary classification model on the IJCNN $1 ^ { 2 }$ dataset. Here, $n = 4 9 9 9 0$ , $m = 9 1 7 0 1$ and $p = 2 2$ .
+
+The suboptimality gap is plotted in Figure $2 \mathrm { a }$ for each method. The lowest values are reached by SABA. Moreover, SABA is the only single-loop method that reaches a suboptimality below $1 0 ^ { - 5 }$ SOBA reaches a quite high final value but slightly better than TTSA and FSLA. The gap between
+
+
+Figure 2: Comparison of SOBA and SABA with other stochastic bilevel optimization methods. For each algorithm, we plot the median performance over 10 runs. In both experiments, SABA achieves the best performance. The dashed lines are for one loop competitor methods, the dotted lines are for two loops methods and the solid lines are the proposed methods. Left: hyperparameter selection for $\ell ^ { 2 }$ penalized logistic regression on IJCNN1 dataset , Right: data hyper-cleaning on MNIST with $p = 0 . 5$ corruption rate.
+
+SOBA and SABA highlights the benefits of variance reduction: it gives us a lower plateau and the fixed step sizes enable faster convergence.
+
+# 4.2 Data hyper-cleaning
+
+The second task we perform is data hyper-cleaning introduced in [16] on the $\mathsf { M N I S T } ^ { 3 }$ dataset. The data is patitioned into a training set $( d _ { i } ^ { \mathrm { t r a i \bar { n } } } , y _ { i } ^ { \mathrm { t r a i n } } )$ , a validation set $( d _ { i } ^ { \mathrm { v a l } } , y _ { i } ^ { \mathrm { v a l } } )$ , and a test set. The training set contains 20000 samples, the validation set 5000 samples and the test set 10000 samples. The targets $y$ take values in $\{ 0 , \ldots , 9 \}$ and the samples $x$ are in dimension 784. Each sample in the training set is corrupted with probability $p$ : a sample is corrupted when we replace its label $y _ { i }$ by a random label in $\{ 0 , \ldots , 9 \}$ . Samples in the validation and test sets are not corrupted. The goal of datacleaning is to train a multinomial logistic regression on the train set and learn a weight per training sample, that should go to 0 for corrupted samples. This is formalized by the bilevel optimization problem (1) with $\begin{array} { r } { F ( \mathbf { \Sigma } \breve { \theta , \lambda } ) = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \dot { \ell } ( \theta d _ { i } ^ { \mathrm { v a l } } , \dot { y _ { i } ^ { \mathrm { v a l } } } ) } \end{array}$ and $\begin{array} { r } { G ( \theta , \lambda ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n ^ { - } } \sigma ( \lambda _ { i } ) \ell ( \theta d _ { i } ^ { \mathrm { t r a i n } } , y _ { i } ^ { \mathrm { t r a i n } } ) \dot { + } C _ { r } \| \theta \| ^ { 2 } } \end{array}$ where $\ell$ is the cross entropy loss and $\sigma$ is the sigmoid function. The inner variable $\theta$ is a matrix of size $1 0 \times 7 8 4$ , and the outer variable $\lambda$ is a vector in dimension $n _ { \mathrm { t r a i n } } = 2 0 0 0 0$ .
+
+For the estimated parameters $\theta$ during optimization, we report in Figure 2b the test error, i.e., the percent of wrong predictions on the testing data. We use for this experiment a corruption probability $p = 0 . 5$ . In general, the error decreases quickly until it reaches a final value. We observe that our method SABA outperforms all the other methods by reaching faster its smallest error, which is smaller than the ones of the other methods. For SOBA, it reaches a lower final error than stocBiO and BSA. In appendix, we provide other convergence curves, and find that for higher values of $p$ , SABA is still the fastest algorithm to reach its final accuracy. Overall, we find that among all methods, even those that implement variance reduction (that is FSLA, MRBO, SUSTAIN, SABA), SABA is the one that demonstrates the best empirical performance.
+
+# 5 Conclusion
+
+In this paper, we have presented a framework for bilevel optimization that enables the straightforward development of stochastic algorithms. The gist of our framework is that the directions in Equations (4) to (6) are all written as simple sums of samples derivatives. We leveraged this fact to propose SOBA, an extension of SGD to our framework, and SABA, an extension of SAGA to our framework, which both achieve similar convergence rates as their single level counterparts. Finally, we think that our framework opens a large panel of potential methods for stochastic bilevel optimization involving techniques of extrapolation, variance reduction, momentum and so on.
+
+# Acknowledgments and Disclosure of Funding
+
+We thank Othmane Sebbouh, Zaccharie Ramzi and Benoît Malézieux for their precious comments. The authors acknowledge the support of the ANER RAGA BFC. SV acknowledges the support of the ANR GraVa ANR-18-CE40-0005. This work is supported by a public grant overseen by the French National Research Agency (ANR) through the program UDOPIA, project funded by the ANR-20-THIA-0013-01 and DATAIA convergence institute (ANR-17-CONV-0003).
+
+References
+[1] Zeeshan Akhtar, Amrit Singh Bedi, Srujan Teja Thomdapu, and Ketan Rajawat. Projection-Free Algorithm for Stochastic Bi-level Optimization. preprint ArXiv 2110.11721, 2021.
+[2] Michael Arbel and Julien Mairal. Amortized Implicit Differentiation for Stochastic Bilevel Optimization. In International Conference on Learning Representations (ICLR), 2022.
+[3] Shaojie Bai, J. Zico Kolter, and Vladlen Koltun. Deep Equilibrium Models. In Advances in Neural Information Processing Systems (NeurIPS). Curran Associates, Inc., 2019.
+[4] Atilim Gunes Baydin, Barak A. Pearlmutter, Alexey Andreyevich Radul, and Jeffrey Mark Siskind. Automatic differentiation in Machine Learning: A survey. Journal of Machine Learning Research, 18(153):1–43, 2018.
+[5] Yoshua Bengio. Gradient-Based Optimization of Hyperparameters. Neural Computation, 12(8): 1889–1900, 2000.
+[6] Quentin Bertrand, Quentin Klopfenstein, Mathieu Blondel, Samuel Vaiter, Alexandre Gramfort, and Joseph Salmon. Implicit differentiation of lasso-type models for hyperparameter optimization. In International Conference on Machine Learning (ICML), pages 810–821. PMLR, 2020.
+[7] Léon Bottou. Large-Scale Machine Learning with Stochastic Gradient Descent. In Proceedings of COMPSTAT, pages 177–186. Physica-Verlag HD, Heidelberg, 2010.
+[8] Léon Bottou, Frank E. Curtis, and Jorge Nocedal. Optimization methods for large-scale Machine Learning. Siam Reviews, 60(2):223–311, 2018.
+[9] Tianyi Chen, Yuejiao Sun, and Wotao Yin. Closing the Gap: Tighter Analysis of Alternating Stochastic Gradient Methods for Bilevel Problems. In Advances in Neural Information Processing Systems (NeurIPS). Curran Associates, Inc., 2021.
+[10] Tianyi Chen, Yuejiao Sun, and Wotao Yin. A Single-Timescale Stochastic Bilevel Optimization Method. In International Conference on Artificial Intelligence and Statistics (AISTATS), 2022.
+[11] Ekin D. Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V. Le. AutoAugment: Learning Augmentation Strategies From Data. In CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 113–123. IEEE, 2019.
+[12] Ashok Cutkosky and Francesco Orabona. Momentum-based variance reduction in non-convex SGD. In Advances in Neural Information Processing Systems (NeurIPS). Curran Associates, Inc., 2019.
+[13] Aaron Defazio, Francis Bach, and Simon Lacoste-Julien. SAGA: A Fast Incremental Gradient Method With Support for Non-Strongly Convex Composite Objectives. In Advances in Neural Information Processing Systems (NeurIPS), volume 28, pages 1646–1654, Montreal, QC, Canada, December 2014. Curran Associates, Inc.
+[14] Justin Domke. Generic methods for optimization-based modeling. In International Conference on Artificial Intelligence and Statistics (AISTAT), volume 22, pages 318–326. PMLR, 2012.
+[15] Cong Fang, Chris Junchi Li, Zhouchen Lin, and Tong Zhang. SPIDER: Near-Optimal NonConvex Optimization via Stochastic Path Integrated Differential Estimator. In Advances in Neural Information Processing Systems (NeurIPS), 2018.
+[16] Luca Franceschi, Michele Donini, Paolo Frasconi, and Massimiliano Pontil. Forward and reverse gradient-based hyperparameter optimization. In International Conference on Machine Learning (ICML), pages 1165–1173. PMLR, 2017.
+[17] Luca Franceschi, Paolo Frasconi, Saverio Salzo, Riccardo Grazzi, and Massimiliano Pontil. Bilevel programming for hyperparameter optimization and meta-learning. In International Conference on Machine Learning (ICML), pages 1568–1577. PMLR, 2018.
+[18] Saeed Ghadimi and Guanghui Lan. Stochastic first- and zeroth-order methods for nonconvex stochastic programming. SIAM Journal on Optimization, 23(4):2341–2368, 2013. doi: 10.1137/ 120880811.
+[19] Saeed Ghadimi and Mengdi Wang. Approximation Methods for Bilevel Programming. preprint ArXiv 1802.02246, 2018.
+[20] Riccardo Grazzi, Luca Franceschi, Massimiliano Pontil, and Saverio Salzo. On the iteration complexity of hypergradient computation. In International Conference on Machine Learning (ICML), pages 3748–3758. PMLR, 2020.
+[21] Riccardo Grazzi, Massimiliano Pontil, and Saverio Salzo. Convergence properties of stochastic hypergradients. In International Conference on Artificial Intelligence and Statistics (AISTAT), pages 3826–3834. PMLR, 2021.
+[22] Zhishuai Guo, Quanqi Hu, Lijun Zhang, and Tianbao Yang. Randomized Stochastic VarianceReduced Methods for Multi-Task Stochastic Bilevel Optimization. preprint ArXiv 2105.02266, 2021.
+[23] Zhishuai Guo, Yi Xu, Wotao Yin, Rong Jin, and Tianbao Yang. On Stochastic Moving-Average Estimators for Non-Convex Optimization. preprint ArXiv 2104.14840, 2021.
+[24] Mingyi Hong, Hoi-To Wai, Zhaoran Wang, and Zhuoran Yang. A Two-Timescale Framework for Bilevel Optimization: Complexity Analysis and Application to Actor-Critic. preprint ArXiv 2007.05170, 2021.
+[25] Feihu Huang and Heng Huang. BiAdam: Fast Adaptive Bilevel Optimization Methods. preprint ArXiv 2106.11396, 2021.
+[26] Kaiyi Ji, Junjie Yang, and Yingbin Liang. Bilevel optimization: Convergence analysis and enhanced design. In International Conference on Machine Learning (ICML), pages 4882–4892. PMLR, 2021.
+[27] Rie Johnson and Tong Zhang. Accelerating stochastic gradient descent using predictive variance reduction. In Advances in Neural Information Processing Systems (NeurIPS), volume 26. Curran Associates, Inc., 2013.
+[28] Prashant Khanduri, Siliang Zeng, Mingyi Hong, Hoi-To Wai, Zhaoran Wang, and Zhuoran Yang. A Near-Optimal Algorithm for Stochastic Bilevel Optimization via Double-Momentum. In Advances in Neural Information Processing Systems (NeurIPS). Curran Associates, Inc., 2021.
+[29] Siu Kwan Lam, Antoine Pitrou, and Stanley Seibert. Numba: A llvm-based python jit compiler. In Proceedings of the Second Workshop on the LLVM Compiler Infrastructure in HPC, pages 1–6, 2015.
+[30] Junyi Li, Bin Gu, and Heng Huang. A Fully Single Loop Algorithm for Bilevel Optimization without Hessian Inverse. In Proceedings of the Thirty-sixth AAAI Conference on Artificial Intelligence, AAAI’22, 2022.
+[31] Seppo Linnainmaa. Taylor expansion of the accumulated rounding error. BIT Numerical Mathematics, 16(2):146–160, 1976.
+[32] Dong C. Liu and Jorge Nocedal. On the limited memory BFGS method for large scale optimization. Mathematical Programming, 45(1-3):503–528, 1989.
+[33] Hanxiao Liu, Karen Simonyan, and Yiming Yang. Darts: Differentiable architecture search. In International Conference on Learning Representations (ICLR), 2018.
+[34] Dougal Maclaurin, David Duvenaud, and Ryan Adams. Gradient-based hyperparameter optimization through reversible learning. In International Conference on machine learning (ICML), pages 2113–2122. PMLR, 2015.
+[35] Thomas Moreau, Mathurin Massias, Alexandre Gramfort, Pierre Ablin, Pierre-Antoine Bannier Benjamin Charlier, Mathieu Dagréou, Tom Dupré la Tour, Ghislain Durif, Cassio F. Dantas, Quentin Klopfenstein, Johan Larsson, En Lai, Tanguy Lefort, Benoit Malézieux, Badr Moufad, Binh T. Nguyen, Alain Rakotomamonjy, Zaccharie Ramzi, Joseph Salmon, and Samuel Vaiter. Benchopt: Reproducible, efficient and collaborative optimization benchmarks. In Advances in Neural Information Processing Systems (NeurIPS), 2022.
+[36] IU E. Nesterov. Introductory Lectures on Convex Optimization: A Basic Course. Number v. 87 in Applied Optimization. Kluwer Academic Publishers, Boston, 2004.
+[37] Barak A Pearlmutter. Fast exact multiplication by the hessian. Neural computation, 6(1): 147–160, 1994.
+[38] Fabian Pedregosa. Hyperparameter optimization with approximate gradient. In International Conference on Machine Learning (ICML), pages 737–746. PMLR, 2016.
+[39] Zaccharie Ramzi, Florian Mannel, Shaojie Bai, Jean-Luc Starck, Philippe Ciuciu, and Thomas Moreau. SHINE: SHaring the INverse Estimate from the forward pass for bi-level optimization and implicit models. In International Conference on Learning Representations (ICLR), 2022.
+[40] Sashank J. Reddi, Suvrit Sra, Barnabas Poczos, and Alex Smola. Fast Incremental Method for Nonconvex Optimization. In 2016 IEEE 55th Conference on Decision and Control (CDC), IEEE, pages 1971–1977, 2016.
+[41] Herbert Robbins and Sutton Monro. A stochastic approximation method. The Annals of Mathematical Statistics, 22(3):400–407, 1951.
+[42] Cédric Rommel, Thomas Moreau, Joseph Paillard, and Alexandre Gramfort. CADDA: Classwise Automatic Differentiable Data Augmentation for EEG Signals. In International Conference on Learning Representations (ICLR), 2022.
+[43] Mark Schmidt, Nicolas Le Roux, and Francis Bach. Minimizing finite sums with the stochastic average gradient. Mathematical Programming, 162(1-2):83–112, 2017.
+[44] Amirreza Shaban, Ching-An Cheng, Nathan Hatch, and Byron Boots. Truncated Backpropagation for Bilevel Optimization. In Artificial Intelligence and Statistics (AISTAT), pages 1723–1732, Okinawa, Japan, 2019.
+[45] Heinrich von Stackelberg. Theory of the market economy. Oxford University Press, 1952.
+[46] R. Wengert. A simple automatic derivative evaluation program. Communications of the ACM, 7 (8):463–464, 1964.
+[47] Junjie Yang, Kaiyi Ji, and Yingbin Liang. Provably Faster Algorithms for Bilevel Optimization. In Advances in Neural Information Processing Systems (NeurIPS). Curran Associates, Inc., 2021.
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] See Section 3 and Section 4
+(b) Did you describe the limitations of your work? [Yes]
+(c) Did you discuss any potential negative societal impacts of your work? [N/A]
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 3.1 (b) Did you include complete proofs of all theoretical results? [Yes] See Appendix C
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes]
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix B
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix B
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [Yes]
+(c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/wmwgLEPjL9/wmwgLEPjL9.md b/md/dev/wmwgLEPjL9/wmwgLEPjL9.md
new file mode 100644
index 0000000000000000000000000000000000000000..871dde3b4fa22e94b88d81aa1a653759b2a0e3a9
--- /dev/null
+++ b/md/dev/wmwgLEPjL9/wmwgLEPjL9.md
@@ -0,0 +1,304 @@
+# In Defense of the Unitary Scalarization for Deep Multi-Task Learning
+
+Vitaly Kurin∗ University of Oxford vitaly.kurin@cs.ox.ac.uk
+
+Alessandro De Palma∗ University of Oxford adepalma@robots.ox.ac.uk
+
+Shimon Whiteson University of Oxford
+
+Ilya Kostrikov University of California, Berkeley New York University
+
+M. Pawan Kumar University of Oxford
+
+# Abstract
+
+Recent multi-task learning research argues against unitary scalarization, where training simply minimizes the sum of the task losses. Several ad-hoc multi-task optimization algorithms have instead been proposed, inspired by various hypotheses about what makes multi-task settings difficult. The majority of these optimizers require per-task gradients, and introduce significant memory, runtime, and implementation overhead. We show that unitary scalarization, coupled with standard regularization and stabilization techniques from single-task learning, matches or improves upon the performance of complex multi-task optimizers in popular supervised and reinforcement learning settings. We then present an analysis suggesting that many specialized multi-task optimizers can be partly interpreted as forms of regularization, potentially explaining our surprising results. We believe our results call for a critical reevaluation of recent research in the area.
+
+# 1 Introduction
+
+Multi-Task Learning (MTL) [5] exploits similarities between tasks to yield models that are more accurate, generalize better and require less training data. Owing to the success of MTL on traditional machine learning models [3, 16, 22] and of deep single-task learning across a variety of domains, a growing body of research has focused on deep MTL. The most straightforward way to train a neural network for multiple tasks at once is to minimize the sum of per-task losses. Adopting terminology from multi-objective optimization, we call this approach unitary scalarization.
+
+While some work shows that multi-task networks trained via unitary scalarization exhibit superior performance to independent per-task models [29, 35], others suggest the opposite [30, 54, 58]. As a result, many explanations for the difficulty of MTL have been proposed, each motivating a new Specialized Multi-Task Optimizer (SMTO) [11, 42, 54, 62, 66]. These works typically claim that the proposed SMTO outperforms unitary scalarization, in addition to relevant prior work. However, SMTOs usually require access to per-task gradients either with respect to the shared parameters, or to the shared representation. Therefore, their reported performance gain comes at significant computation and memory cost, the overhead scaling linearly with the number of tasks. By contrast, unitary scalarization requires only the average of the gradients across tasks, which can be computed via a single backpropagation.
+
+Existing SMTOs were introduced to solve challenges related to the optimization of the deep MTL problem. We instead postulate that the reported weakness of unitary scalarization is linked to experimental variability or to a lack of regularization, leading to the following contributions:
+
+• A comprehensive experimental evaluation $( \ S 4 )$ of recent SMTOs on popular multi-task benchmarks, showing that no SMTO consistently outperforms unitary scalarization in spite of the added complexity and overhead. In particular, either the differences between unitary scalarization and SMTOs are not statistically significant, or they can be bridged by standard regularization and stabilization techniques from the single-task literature. Our reinforcement learning (RL) experiments include optimizers previously applied only to supervised learning. • An empirical and technical analysis of the considered SMTOs, suggesting that they reduce overfitting on the multi-task problem and hence act as regularizers (§5). We conduct an ablation study and provide a collection of novel and existing technical results that support this hypothesis. • Code to reproduce the experiments, including a unified PyTorch [50] implementation of the considered SMTOs, is available at https://github.com/yobibyte/ unitary-scalarization-dmtl.
+
+We believe that our results suggest that the considered SMTOs can be often replaced by less expensive techniques. We hope that these surprising results stimulate the search for a deeper understanding of MTL.
+
+# 2 Related Work
+
+Before diving into details of specific SMTOs in Section 5, we provide a high-level overview of the deep MTL research. Seminal work in MTL includes hard parameter sharing [6]: sharing neural network parameters between all tasks with, possibly, a separate part of the model for each task. Hard parameter sharing is still the major MTL approach adopted in natural language processing [9, 12], computer vision [46], and speech recognition [53]. In this work, we implicitly assume that each parameter update employs information from all tasks. However, not all works satisfy this assumption, either due to a large number of tasks [4, 36], or simply as an implementation decision [25, 37]. In this setting, MTL resembles other problems dealing with multiple tasks, i.e., continual [32], curriculum [47], and meta-learning [24], which are not the focus of this work.
+
+Many works strive to improve the performance of deep multi-task models. One line of research hypothesizes that conflicting per-task gradient directions lead to suboptimal models, and focuses on explicitly removing such conflicts [11, 28, 41, 42, 62, 66]. Some authors postulate that loss imbalances across tasks hinder learning, proposing loss reweighting methods [10, 30, 40]. Sener and Koltun [54] and Navon et al. [48] propose that tasks compete for model capacity and interpret MTL as multi-objective optimization in order to cope with inter-task competition. Here, we focus on algorithms that explicitly rely on per-task gradients to try to outperform unitary scalarization (§5). Research on multi-task architectures [19, 46] or MTL algorithms exclusively motivated by deterministic loss reweighting [18, 30, 43] are orthogonal to our work. Both topics are investigated by a recent survey on pixel-level multi-task computer vision problems [61], which found that the minimization of tuned weighted sums of losses (scalarizations) is empirically competitive with deterministic loss reweighting and MGDA in the considered settings. These results are extended to popular SMTOs by a critical review from Xin et al. [63], concurrent to our work, which argues that the optimization and generalization performance of SMTOs can be matched by tuning scalarization coefficients. Our work reaches a similar conclusion, demonstrating that unitary scalarization performs on par with SMTOs when coupled with standard and inexpensive regularization or stabilization techniques. In other words, Xin et al. [63] provide complementary support for the link between SMTOs and regularization by showing that tuning scalarization weights positively affects generalization.
+
+In addition to the common supervised settings, we also consider multi-task RL, whose research can be grouped into three categories: the first adds auxiliary tasks providing additional inductive biases to speed up learning [27] on a target task. The second, based on policy distillation, uses per-task teacher models to provide labels for a multi-task model or per-task policies as regularizers [49, 51, 57]. The third directly learns a shared policy [29], possibly via an SMTO [66]. We focus on the third category, whose literature reports varying performance for unitary scalarization (better [29] or worse [66] than per-task models), indicating confounding factors in evaluation pipelines and further motivating our work. PopArt [23, 60] performs scale-invariant value function updates in order to address differences in returns across environments, showing improvements in the multi-task setting while still using unitary scalarization. PopArt does not require per-task gradients but introduces additional hyperparameters. In our work, we address the differences in rewards by normalizing them at the replay buffer level. However, we believe both unitary scalarization and SMTOs might equally benefit from PopArt.
+
+# 3 Multi-Task Learning Optimizers
+
+We will now describe the deep MTL training problem and popular algorithms employed for its solution. Let $( X , Y ) \in \mathbb { R } ^ { d \times n } \times \mathbb { R } ^ { o \times n }$ be the training set, composed of $^ { n d }$ -dimensional points and $o$ -dimensional labels. In addition, $\mathcal { L } _ { i } : \mathbb { R } ^ { o \times n } \times \mathbb { R } ^ { o \times n ^ { \top } } \mathbb { R }$ denotes the loss for the $i$ -th task, $\pmb \theta \in \mathbb { R } ^ { S }$ the parameter space, $\mathcal { T } : = \{ 1 , \dots , m \}$ the set of $m$ tasks. The goal of MTL is to learn a single (generally task-aware) parametrized model $f : \mathbb { R } ^ { S } \times \mathbb { R } ^ { d \times n } \times \mathcal { T } \mathbb { R } ^ { o \times n }$ that performs well on all tasks $\tau$ . The parameter space is often split into a set of shared parameters across tasks (generally the majority of the architecture), denoted $\theta _ { \parallel }$ , and (possibly empty) task-specific parameters, denoted $\pmb { \theta } _ { \bot }$ , so that $\pmb { \theta } : = [ \pmb { \theta } _ { | | } , \pmb { \theta } _ { \perp } ] ^ { T }$ . In this context, the model $f$ often takes on an encoder-decoder architecture, where the encoder $g$ learns a shared representation across tasks, and the decoders $h _ { i }$ are task-specific predictive heads: $f ( \pmb \theta , X , i ) = h _ { i } ( g ( \pmb \theta _ { \parallel } , X ) , \pmb \theta _ { \perp } )$ . In this case, we denote by $\mathbf { z } = g ( \pmb { \theta } _ { \parallel } , X ) \in \mathbb { R } ^ { r \times n }$ the $r .$ -dimensional shared representation of $X$ .
+
+The training problem for MTL is typically formulated as the sum of the per-task losses [11, 54, 66]:
+
+$$
+\begin{array} { r } { \underset { \pmb { \theta } } { \operatorname* { m i n } } \left[ \begin{array} { l } { \mathcal { L } ^ { \mathrm { M T } } ( \pmb { \theta } ) : = \sum _ { i \in \mathcal { T } } \mathcal { L } _ { i } ( f ( \pmb { \theta } , X , i ) , Y ) } \end{array} \right] . } \end{array}
+$$
+
+Unitary Scalarization The obvious way to minimize the multi-task training objective in equation (1) is to rely on a standard gradient-based algorithm. While, for simplicity, we focus on standard gradient descent rather than mini-batch stochastic gradient descent, the notation can be adapted by replacing the dataset size $n$ by the mini-batch size $b$ . Equation (1) corresponds to a linear scalarization with unitary weights under a multi-objective interpretation of MTL; hence, we call the direct application of gradient descent on equation (1) unitary scalarization. For vanilla gradient descent, this corresponds to taking a step in the opposite direction as the one given by the sum of per-task gradients: $\begin{array} { r } { \nabla _ { \theta } \mathcal { L } ^ { \mathrm { { M T } } } = \sum _ { i \in \mathcal { T } } \bar { \nabla _ { \theta } } \mathcal { L } _ { i } } \end{array}$ . Per-task gradients are not required, as it suffices to directly compute the gradient of the sum $\mathcal { L } ^ { \mathrm { M T } }$ . Hence, when relying on deep learning frameworks based on reverse-mode differentiation, such as PyTorch [50], the backward pass is performed once per iteration (rather than $m$ times). Furthermore, the memory cost is a factor $m$ less than most SMTOs, which require access to each $\nabla _ { \pmb { \theta } } \mathcal { L } _ { i }$ . As a consequence, unitary scalarization is simple, fast, and memory efficient. Our experiments demonstrate that, when possibly coupled with single-task regularization such as early stopping, $\ell _ { 2 }$ penalty or dropout layers [56], this simple optimizer is strongly competitive with SMTOs.
+
+MGDA Sener and Koltun [54] point out that equation (1) can be cast as a multi-objective optimization problem with the following objective: $\mathcal { L } ^ { \mathrm { M T } } ( \pmb { \theta } ) : = [ \mathcal { L } _ { 1 } ( \pmb { \theta } ) , \dots , \mathcal { L } _ { m } ( \pmb { \theta } ) ] ^ { T }$ . A commonly employed solution concept in multi-objective optimization is Pareto optimality. A point $\pmb { \theta } ^ { * }$ is called Pareto-optimal if, for any another point $\mathbf { \hat { \theta } } ^ { \dagger }$ such that $\exists i \in T : \bar { \mathcal { L } } _ { i } ( \pmb { \theta } ^ { \dagger } ) ^ { \cdot } < \bar { \mathcal { L } } _ { i } ( \pmb { \theta } ^ { * } )$ , then $\exists j \in \mathcal { T } : \mathcal { L } _ { j } ( \pmb { \theta } ^ { \dag } ) > \mathcal { L } _ { j } ( \pmb { \theta } ^ { * } )$ . A necessary condition for Pareto optimality at a point is Pareto stationarity, defined as the lack of a shared descent direction across all losses at that point. Sener and Koltun [54] rely on Multiple-Gradient Descent Algorithm (MGDA) [14] to reach a Pareto-stationary point for shared parameters $\theta _ { \parallel }$ . Intuitively, MGDA proceeds by repeatedly stepping in a shared descent direction [14, 17], which can be found by solving the following optimization problem:
+
+$$
+\operatorname* { m i n } _ { \mathbf { g } , \epsilon } \left[ \epsilon + 1 / 2 \left. \mathbf { g } \right. _ { 2 } ^ { 2 } \right] \quad \mathrm { s . t . } \ \nabla _ { \theta _ { \parallel } } \mathcal { L } _ { i } ^ { T } \mathbf { g } \leq \epsilon \quad \forall \ : i \in \mathcal { T } ,
+$$
+
+whose dual takes the following form (corresponding to the formulation from Désidéri [14]):
+
+$$
+\operatorname* { m a x } _ { \alpha \geq 0 } - 1 / 2 \left\| \mathbf { g } \right\| _ { 2 } ^ { 2 } \quad \mathrm { s . t . } \ \sum _ { i } \alpha _ { i } \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i } = - \mathbf { g } , \quad \sum _ { i \in \mathcal { T } } \alpha _ { i } = 1 .
+$$
+
+In other words, MGDA takes a step in a direction $\mathbf { g }$ given by the negative convex combination of per-task gradients, whose coefficients are given by solving equation (3). In practice, per-task gradients are rescaled before applying MGDA: the original authors’ implementation [54] relies on $\nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i } \gets \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i } \Big / \Big \| \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i } \Big \| \mathcal { L } _ { i } ( \pmb { \theta } )$ . The convergence of MGDA to a Pareto-stationary point is still guaranteed after normalization [14].
+
+IMTL Impartial Multi-Task Learning (IMTL) [42] is presented as an SMTO that is not biased against any single task. It is composed of two complementary algorithmic blocks: IMTL-L, acting on task losses, and IMTL-G, acting on per-task gradients. IMTL-G follows the intuition that a multi-task optimizer should proceed along a direction $\begin{array} { r } { \mathbf { g } = - \sum _ { i } \alpha _ { i } \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i } } \end{array}$ that equally represents per-task gradients. This is formulated analytically by requiring that the cosine similarity between $\mathbf { g }$ and each $\nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i }$ be the same. To prevent the resulting problem from being underdetermined, Liu et al. [42] add the constraint $\textstyle \sum _ { i \in { \mathcal { T } } } \alpha _ { i } = 1$ , resulting in a problem that admits a closed-form solution for $\mathbf { g }$ :
+
+$$
+\begin{array} { r } { \mathbf { g } ^ { T } \frac { \nabla \theta _ { \parallel } \mathcal { L } _ { 1 } } { \left\| \nabla \theta _ { \parallel } \mathcal { L } _ { 1 } \right\| } = \mathbf { g } ^ { T } \frac { \nabla \theta _ { \parallel } \mathcal { L } _ { i } } { \left\| \nabla \theta _ { \parallel } \mathcal { L } _ { i } \right\| } \ \forall i \in \mathcal { T } \setminus \{ 1 \} , \quad \mathbf { g } = - \sum _ { i } \alpha _ { i } \nabla \theta _ { \parallel } \mathcal { L } _ { i } , \quad \sum _ { i \in \mathcal { T } } \alpha _ { i } = 1 . } \end{array}
+$$
+
+IMTL-L, instead, aims to reweight task losses so that they are all constant over time, and equal to 1. In order to limit oscillations of the scaling factors, the authors propose to learn them jointly with the network by minimizing a common objective via gradient descent. In particular, given $s _ { i } \in \mathbb { R } \forall i \in \mathcal { T }$ , Liu et al. [42] derive the following form for the joint minimization problem: $\begin{array} { r } { \operatorname* { m i n } _ { \mathbf { s } , \pmb { \theta } } \left[ \sum _ { i } \left( e ^ { s _ { i } } \mathcal { L } _ { i } ( \pmb { \theta } ) - s _ { i } \right) \right] . } \end{array}$ . As proved by Liu et al. [42], IMTL-L only has a rescaling effect on the update direction of IMTL-G. Unlike IMTL-G and the other SMTOs presented in this section, IMTL-L rescaling is designed to affect the updates for task-specific parameters $\pmb { \theta } _ { \perp }$ as well.
+
+PCGrad Let us write $\cos ( \mathbf { x } , \mathbf { z } )$ for the cosine similarity between vectors $\mathbf { x }$ and $\mathbf { z }$ . Yu et al. [66] postulate that multi-task convergence is severely slowed down if the following three conditions (named the tragic triad) hold at once: (i) conflicting gradient directions: $\cos ( \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i } , \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { j } ) < 0$ for some $i , j \in \mathcal { T }$ ; (ii) differing gradient magnitudes: $\lVert \nabla _ { { \pmb \theta } _ { \parallel } } \mathcal { L } _ { i } \rVert \gg \lVert \nabla _ { { \pmb \theta } _ { \parallel } } \mathcal { L } _ { j } \rVert$ for some $i , j \in \mathcal { T }$ ; and (iii) the unitary scalarization $\mathcal { L } ^ { \mathrm { M T } }$ has high curvature along $\nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { \vphantom { \parallel } } ^ { \mathrm { M T } }$ . The PCGrad [66] SMTO is presented as a solution to the tragic triad, targeted at the first condition. Consistent with the previous sections, let us denote the update direction by g. Furthermore, let $[ \mathbf { x } ] _ { + } : = \mathrm { m a x } ( \mathbf { x } , \mathbf { 0 } )$ . Given per-task gradients $\nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i }$ , PCGrad iteratively projects each task gradient onto the normal plane of all the gradients with which it conflicts:
+
+$$
+\left[ \mathbf { g } _ { i } \gets \nabla _ { \theta _ { 1 } } \mathcal { L } _ { i } , \ \mathbf { g } _ { i } \gets \mathbf { g } _ { i } + \left[ \frac { - \mathbf { g } _ { i } ^ { T } \nabla _ { \theta _ { 1 } } \mathcal { L } _ { j } ( \mathbf { x } ) } { \left\| \nabla _ { \theta _ { 1 } } \mathcal { L } _ { j } \right\| ^ { 2 } } \right] \nabla _ { \theta _ { 1 } } \mathcal { L } _ { j } \ \forall j \in T \setminus \{ i \} \right] \forall i \in T , \quad \mathbf { g } = - \sum _ { i \in T } \mathbf { g } _ { i } ,
+$$
+
+where the iterative updates of $\mathbf { g } _ { i }$ with respect to $\nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { j }$ are performed in random order.
+
+GradDrop Chen et al. [11] focus on conflicting signs across task gradient entries, arguing that such conflicts lead to gradient “tug-of-wars". The GradDrop SMTO [11], presented as a solution to this problem, proposes to randomly mask per-task gradients $\nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i }$ so as to minimize such conflicts. Specifically, GradDrop computes the “positive sign purity" $p _ { j }$ for the task gradient’s $j$ -th entry and then masks the $j$ -th entry of each per-task gradient with probability increasing with $p _ { j }$ , if the entry is negative, or decreasing with $p _ { j }$ , if the entry is positive. Let us write $\mathbf { p } : = [ p _ { 1 } , \hdots , p _ { S } ]$ , where $S$ is the dimensionality of the parameter space (see $\ S 3$ ), $\odot$ for the Hadamard product and $\mathbb { 1 } _ { \mathbf { a } }$ for the indicator vector on condition a. Given a vector $\mathbf { u } _ { i }$ , uniformly sampled in $[ \mathbf { 0 } , \mathbf { 1 } ]$ at each iteration, GradDrop takes a step in the direction given by:
+
+$$
+\mathbf { g } = \sum _ { i \in \mathcal { T } } \left( \begin{array} { l } { - \nabla _ { \theta _ { \parallel } } \mathcal { L } _ { i } \odot \mathbb { 1 } _ { \left( \nabla _ { \theta _ { \parallel } } \mathcal { L } _ { i } > 0 \right) } \odot \mathbb { 1 } _ { \left( \mathbf { u } _ { i } > \mathbf { p } \right) } } \\ { - \nabla _ { \theta _ { \parallel } } \mathcal { L } _ { i } \odot \mathbb { 1 } _ { \left( \nabla _ { \theta _ { \parallel } } \mathcal { L } _ { i } < 0 \right) } \odot \mathbb { 1 } _ { \left( \mathbf { u } _ { i } < \mathbf { p } \right) } } \end{array} \right) , \mathrm { w i t h } \mathbf { p } = \frac { 1 } { 2 } \left( 1 + \frac { \sum _ { i \in \mathcal { T } } \nabla _ { \theta _ { \parallel } } \mathcal { L } _ { i } } { \sum _ { i \in \mathcal { T } } \left| \nabla _ { \theta _ { \parallel } } \mathcal { L } _ { i } \right| } \right) .
+$$
+
+# 4 Experimental Evaluation
+
+Relying on a unified experimental pipeline, we present an empirical evaluation on common MTL benchmarks of unitary scalarization (§3), of the popular SMTOs presented in $\ S 3$ , and of the recent RLW algorithms [40] due to their similarities with PCGrad and GradDrop (see $\ S 5 . 2 )$ . We benchmark against the two RLW instances that showed the best average performance in the original paper: RLW with weights sampled from a Dirichlet distribution (“RLW Diri.”), and RLW with weights sampled from a Normal distribution (“RLW Norm.”). The goal of this section is to assess the efficacy of a popular line of previous work, focusing on a few representative or well-established optimizers. Therefore, we forego comparison with more recent SMTOs [28, 41, 48]. Nevertheless, we point out that these algorithms often lack significant enough improvements over the optimizers we consider, or may have substantial commonalities with them (see $\ S 5 . 2$ for Nash-MTL [48], which was published concurrently to the finalization of this work). Whenever appropriate, we employ “Unit. Scal.” as shorthand for unitary scalarization. We first present supervised learning experiments $( \ S 4 . 1 )$ , and then evaluate on a popular reinforcement learning benchmark $( \ S 4 . 2 )$ .
+
+
+(a) Avg. task test accuracy: mean and $9 5 \%$ CI (10 runs). (b) Box plots for the training time of an epoch (10 runs).
+
+
+Figure 1: No algorithm outperforms unitary scalarization on the Multi-MNIST dataset.
+
+Our experiments indicate that the performance of unitary scalarization has been consistently underestimated in the literature. By showing the variability between runs and by relying on standard regularization and stabilization techniques from the single-task literature, we demonstrate that no SMTO consistently outperforms unitary scalarization across the considered settings. This result holds in spite of the added complexity and computational overhead associated with most SMTOs. Furthermore, in supervised learning, most methods drive the training loss of all tasks in the proximity of the respective global minima. This suggests that the main difficulty of MTL is not associated with the optimization of its training objective, but rather to incorporating adequate regularization (cf. $\ S 5 _ { , }$ ).
+
+# 4.1 Supervised Learning
+
+All the architectures employed in the supervised learning experiments conform to the encoder-decoder structure detailed in $\ S 3$ . Whenever suggested by the original authors for this context, the SMTO implementations rely on per-task gradients with respect to the last shared activation, $\nabla _ { \mathbf { z } }$ , rather than on the usually more expensive $\nabla _ { \theta } \mathcal { L } _ { i }$ . In particular, this is the case for MGDA, IMTL and GradDrop. See appendix B for details concerning each individual algorithm. Surprisingly, several MTL works [11, 40, 42, 66] report validation results, making it easier to overfit. Instead, following standard machine learning practice, we select a model on the validation set, and later report test metrics for all benchmarks. Validation results are also available in appendix D. Appendix C.1 reports dataset descriptions, the computational setup, hyperparameter and tuning details.
+
+# 4.1.1 Multi-MNIST
+
+We present results on the Multi-MNIST [54] dataset, a simple two-task supervised learning benchmark. We employ a popular architecture from previous work [54, 66] (see appendix C.1), where a single dropout layer [56] (with dropout probability 0.5) is employed in both the encoder and the decoder. $\ell _ { 2 }$ regularization did not improve validation performance and was therefore omitted. Figure 1 reports the average task test accuracy, and the training time per epoch. For each run, the test model was selected as the model with the largest average task validation accuracy across the training epochs. Appendix D presents the results of Figure 1 in tabular form, as well as the average task validation accuracy per epoch. As seen from the overlapping confidence intervals, none of the considered algorithms clearly outperforms the others. However, GradDrop displays higher experimental variability. Furthermore, Figure 7(b) shows that the sums of the task cross-entropy losses is driven nearly to zero by most methods. Finally, Figure 1(b) shows that unitary scalarization also has among the lowest training times.
+
+# 4.1.2 CelebA
+
+We now show results for the CelebA [44] dataset, a challenging 40-task multi-label classification problem. We employ the same architecture as many previous studies [40, 42, 54, 66] (see appendix C.1). We tuned $\ell _ { 2 }$ regularization terms $\lambda$ for all SMTOs in the following grid: $\lambda \in \{ 0 , 1 0 ^ { - 4 } , \bar { 1 } 0 ^ { - 3 } \} .$ . The best validation performance was attained with $\lambda = 1 0 ^ { - 3 }$ for unitary scalarization, IMTL and PCGrad, and with $\lambda = \mathrm { \dot { 1 0 } ^ { - 4 } }$ for MGDA, GradDrop, and RLW. Validation performance was further stabilized
+
+(a) Avg. task test accuracy: mean and $9 5 \%$ CI (3 runs).
+
+
+Figure 2: While SMTOs display larger runtimes, none of them outperforms the unitary scalarization on the CelebA dataset.
+
+
+(b) Box plots for the training time of an epoch (10 runs).
+
+
+(e) Box plots for the training time of an epoch (10 runs).
+algorithm. Subfigures (a)-(d) report means for three runs, and their $9 5 \%$ CIs.
+
+by the addition of several dropout layers (see Figure 5), with dropout probabilities from 0.25 to 0.5. We present an ablation study on the effect of regularization on this experiment in $\ S 5 . 1$ . Figure 10 (appendix D.2) shows that regularization improves the peak average validation performance for all the considered methods. Analogously to our Multi-MNIST results, Figure 2 plots the distribution of the training time per epoch, and the average test task accuracy. As with Multi-MNIST, the test model for each run was the one with maximal average validation task accuracy across epochs. In other words, if the peak is attained before the last epoch, we perform early stopping: as shown in Figure 8(a) in appendix D this is the case for most methods. Due to the large number of tasks, Figure 2(b) shows relatively large runtime differences across methods. PCGrad is the slowest (roughly 35 times slower than unitary scalarization). In fact, amongst the considered algorithms, it is the only one that computes per-task gradients over the parameters $( \nabla _ { \pmb { \theta } } \mathcal { L } _ { i } \forall i \in \mathcal { T } )$ at each iteration. GradDrop, MGDA and IMTL have overhead factors (compared to unitary scalarization) ranging from roughly 1.05 to 2.4 due to the relatively small size of $\mathbf { z }$ for the employed architecture. The overhead of RLW is negligible: roughly $5 \%$ . Nevertheless, due to largely overlapping confidence intervals in Figure 2(a), none of the methods consistently outperforms unitary scalarization. In fact, owing to our adoption of explicit regularization techniques (see $\ S 5 . 1 \ r ,$ ) its average performance is superior to that reported in the literature [42, 54]. As with Multi-MNIST, Figure 9(a) demonstrates that the cross-entropy loss of each task can be driven near to its global optimum by most optimizers.
+
+# 4.1.3 Cityscapes
+
+In order to complement the multi-task classification experiments for Multi-MNIST and CelebA, we present results for Cityscapes [13], a dataset for semantic understanding of urban street scenes. We rely on a common encoder architecture from the literature [40, 42] (see appendix C.1), with a single dropout layer in the task-specific heads [40]. As for CelebA, unitary scalarization, IMTL, and PCGrad benefit from more regularization than the other optimizers: we employ $\lambda = 1 0 ^ { - 5 }$ for these three algorithms, as it resulted in better validation performance on the majority of metrics, and $\lambda = 0$ for the remaining methods. Cityscapes is a heterogeneous MTL problem: it contains tasks of different types whose validation metrics cannot be averaged to perform model selection. Considering the lack of an established procedure in this context, we potentially evaluate a different model for each metric, chosen as the one with the best (maximal or minimal, depending on the metric) validation performance across epochs (we perform per-run early stopping). This procedure maximizes per-task performance, at the cost of increased inference time. If inference time is a priority, an alternative model selection procedure could rely on relative task improvement [28, 41, 48], assuming that per-metric improvements are to be weighted linearly. Nevertheless, any consistently applied model selection scheme serves the main goal of our work: evaluating all SMTOs on a fair ground. Figure 3 shows test results for two metrics per task, and the distribution of the training time per epoch. As with Multi-MNIST and CelebA, no training algorithm clearly outperforms unitary scalarization (significant overlaps across confidence intervals exist), which is again the least expensive method. In contrast with a popular hypothesis [10, 30, 42], this holds in spite of relatively large loss imbalances. In fact, the loss for the depth task is roughly 10 times smaller than that of the segmentation task: see figures 17(f)-17(g). Nevertheless, both losses are rapidly driven towards their respective global minima. Unlike CelebA (see Figure 2(b)), IMTL, MGDA and GradDrop are significantly slower than unitary scalarization (factors from 1.6 to 2.3), due to the relatively (compared to the parameter space) large size of $\mathbf { z }$ in the employed architecture. PCGrad, instead, appears to be less expensive $3 0 \%$ more than the baseline), demonstrating the benefits of working on $\nabla _ { \pmb { \theta } } \mathcal { L } _ { i }$ on this model.
+
+
+Figure 4: On Metaworld, none of the SMTOs significantly outperforms Unit. Scal., which is the least expensive method. Subfigures (a)-(b) report mean and $9 5 \%$ CI for the best (over the updates) average success rate. Subfigures (c)-(d) show box plots for the training time of 10,000 updates.
+
+# 4.2 Reinforcement Learning
+
+For RL experiments, we use Meta-World [65] and the Soft Actor-Critic [20] implementation from [55]. Unlike $\ S 4 . 1$ , the employed network architecture (see appendix C.1) is fully shared across tasks. Therefore, all SMTO implementations for these experiments rely on per-task gradients with respect to network parameters $\nabla _ { \pmb { \theta } } \mathcal { L } _ { i }$ (see $\ S 5$ ). Among the SMTOs we consider, PCGrad is the only one developed with the RL setting in mind. For fairness and completeness, we add all the other SMTOs from the supervised learning experiments, and are the first to test these optimizers in the RL setting. To stabilize learning, we increase the replay buffer size, a well known technique in single-task RL, add actor $l _ { 2 }$ regularization, and modify the reward normalization employed by Sodhani et al. [55]. The unitary scalarization performance reported by Yu et al. [66] is considerably lower than that of Sodhani et al. [55], which we believe is due to the lack of reward normalization in the former. Sodhani et al. [55] keep a moving average of rewards in the environment, with a hyperparameter controlling the speed of the moving average. As we show in Figure 16, the learning algorithm is sensitive to that hyperparameter. Moreover, such normalization might make similar transitions have drastically different rewards stored in the replay buffer. To alleviate these issues, we store the raw rewards in the buffer, and normalize only when a mini-batch is sampled.
+
+Figure 4 reports the best average success rate across the updates and the runtime for 10,000 updates. In addition to these summary statistics, reported for consistency with $\ S 4 . 1$ , the learning curves are shown in appendix E. Our MT10 (10 tasks) results in Figure 4(a) show that by stabilizing the baseline using standard RL techniques, unitary scalarization performs on par with other SMTOs, mirroring our findings in $\ S 4 . 1$ . This is in contrast with the previous literature, which reported that PCGrad outperforms unitary scalarization [55, 66]. Figure 4(b) presents results on MT50 (50 tasks): similarly to MT10, none of the SMTOs significantly outperforms unitary scalarization, with PCGrad’s average being slightly above unitary scalarization. We speculate that the stochastic loss rescaling performed by PCGrad (see Proposition 3) reduces the differences in task return scales, and expect that methods like PopArt [60] would have a similar effect without requiring access to per-task gradients. While we did not tune hyperparameters for MT50 (we employed those found for MT10), it would be much easier to do that for unitary scalarization due to its lower runtime. In fact, Figure 4(d) shows that a single unitary scalarization run takes roughly 15 hours, whereas PCGrad, MGDA and GradDrop require more than a week. Similarly to MT10, actor regularization pushes the average performance of unitary scalarization higher (see in appendix E.2). Overall, as in the supervised learning setting, unitary scalarization performs comparably to SMTOs despite being simpler and less demanding in both memory and compute. IMTL was unstable on this RL benchmark and all of the runs crashed due to numerical overflow. We hence omit IMTL results from the main body of the paper and show its results in Figure 13 in appendix E, which also describes a possible explanation. We hypothesize that the instability of IMTL is due to lack of bounds on scaling coefficients. See appendix C.2 for hyperparameter settings and ablation studies.
+
+# 5 Regularization in Specialized Multi-Task Optimizers
+
+The empirical results presented in $\ S 4$ motivate the need to carefully analyze existing SMTOs. We make an initial attempt in this direction by viewing their effects through the lens of regularization. Let us define a regularizer as a technique to reduce overfitting [15]. We first show that the SMTOs considered in $\ S 4$ empirically act as regularizers via an ablation study (§5.1). We then take a closer look at their behavior, presenting technical results that support their alternative interpretation as regularizers (§5.2). Finally, $\ S 5 . 3$ provides additional empirical backing for some of the technical results. Unless otherwise stated, we assume that MTL methods apply only to $\theta _ { \parallel }$ and that standard gradient-based updates are employed for tasks-specific parameters $\theta _ { \perp }$ . We furthermore adopt the following shorthands: $\mathcal { L } _ { i } ( \pmb { \theta } )$ for $\bar { \mathcal { L } _ { i } } ( f ( \pmb { \theta } , X , i ) , \bar { Y ) }$ , and $\nabla _ { \theta } \mathcal { L } _ { i }$ for $\nabla _ { \pmb { \theta } } \mathcal { L } _ { i } ( f ( \pmb { \theta } , X , i ) , Y )$ .
+
+# 5.1 Ablation Study
+
+We repeat the experiment from $\ S 4 . 1 . 2$ and remove explicit regularization: no dropout layers are added to the encoder-decoder architecture, and $\lambda = 0$ for all optimizers. In addition, we examine the behavior of two different $\ell _ { 2 }$ -regularized instances of unitary scalarization: $\lambda = 1 0 ^ { - 4 }$ for “Unit. Scal. $\ell _ { 2 } { } ^ { , , }$ , $\lambda = 2 \times 1 0 ^ { - 3 }$ for “Unit. Scal. $\ell _ { 2 } + \mathbf { \vec { \mu } } ^ { \mathbf { > } }$ . Figure 5 shows that SMTOs behave similarly to an $\ell _ { 2 }$ -penalized unitary scalarization. Importantly, SMTOs delay overfitting, requiring less early stopping compared to unitary scalarization to obtain comparable performance. In other words, early stopping is sufficient for unitary scalarization to perform on par with SMTOs. Finally, overfitting is further reduced by “Unit. Scal. Reg.”, which plots the regularized unitary scalarization from $\ S 4 . 1 . 2$ , with dropout layers and a weight decay of $\lambda \overset { \cdot } { = } 1 0 ^ { - 3 }$ . Further results are presented in appendix D.2.
+
+# 5.2 Technical Results
+
+All the methods considered in $\ S 5 . 1$ regularize more than unitary scalarization. While RLW was shown to reduce overfitting by the original authors [40, theorem 2], we now provide a collection of novel and existing technical results that potentially explain the regularizing behavior of each of the other algorithms, complementing the presentation from $\ S 3$ . In particular, we show that MGDA, IMTL and PCGrad have a larger convergence set than unitary scalarization, reducing the chances to land on sharp local minima [15]. Furthermore, GradDrop and PCGrad introduce significant stochasticity, which is often linked to the same effect [31, 34]. We hope these observations will steer further research.
+
+MGDA Let us denote the convex hull of a set $\mathcal { A }$ by $\operatorname { C o n v } ( \mathcal { A } )$ . We now recall a well-known property of MGDA [14] and relate it to the behavior of unitary scalarization.
+
+Proposition 1. The MGDA SMTO [54] converges to a superset of the convergence points of unitary scalarization. More specifically, it converges to any point $\theta _ { \parallel } ^ { * }$ such that: $\mathbf { 0 } \in C o n \nu ( \{ \nabla _ { \theta _ { \parallel } ^ { * } } \mathcal { L } _ { i } | i \in \mathcal { T } \} )$ .
+
+See appendix B.1 for a simple proof. As a consequence of Proposition 1, MGDA does not necessarily reach a stationary point for $\dot { \mathcal { L } } ^ { \mathrm { M T } }$ (that is, a point for which $\begin{array} { r } { \sum _ { i \in \mathcal { T } } \nabla _ { \theta _ { \parallel } } \mathcal { L } _ { i } = \mathbf { 0 } ) } \end{array}$ or for any of the losses $\mathcal { L } _ { i }$ $\nabla _ { \pmb { \theta } _ { | | } } \mathcal { L } _ { i } = \mathbf { 0 }$ ). For example, any point $\theta _ { \parallel }$ for which two per-task gradients point in opposite directions is Pareto stationary. On account of the well-known [15] relationship between underoptimizing (e.g., early stopping [7, 39]) and overfitting, proposition 1 supports the interpretation of MGDA as a regularizer for equation (1). Empirical evidence that MGDA under-optimizes is provided in $\ S 5 . 3$ , Figure 9(a), and Figure 5, which shows over-regularization. Proposition 1 can be trivially extended to the recent Nash-MTL, which shares the same convergence set [48, Theorem 5.4].
+
+
+Figure 5: Mean and $9 5 \%$ CI (3 runs) avg. task validation accuracy over epochs on CelebA. SMTOs postpone the onset of overfitting, mirroring the effect of $\ell _ { 2 }$ regularization on unitary scalarization.
+
+
+Figure 6: Mean and $9 5 \%$ CI (3 runs) for $\begin{array} { r } { \big \| \breve { \sum } _ { i \in \mathcal { T } } \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i } \big \| _ { 2 } } \end{array}$ on CelebA. MGDA and IMTL converge away from stationary points of unitary scalarization, indicating under-optimization.
+
+IMTL We now show that aggregating per-task gradients so that their cosine similarity is the same (equation (4)) yields a constrained steepest-descent algorithm (Proposition 2). This view on the update step of IMTL leads to a novel analysis of its convergence points (corollary 1). Proofs can be found in appendix B.2. We will denote by $\operatorname { A f f } ( A )$ the affine hull of a set $\mathcal { A }$ .
+
+Proposition 2. IMTL by Liu et al. [42] updates $\theta _ { \parallel }$ by taking a step in the steepest descent direction whose cosine similarity with per-task gradients is the same across tasks.
+
+Corollary 1. IMTL by Liu et al. $I 4 2 J$ converges to a superset of the Pareto-stationary points for $\theta _ { \parallel }$ (and hence of the convergence points of the unitary scalarization). More specifically, it converges to any point $\theta _ { \parallel } ^ { * }$ such that: $\mathbf { 0 } \in \bar { A } \bar { f f } \left( \left\{ \nabla _ { \pmb { \theta } _ { \parallel } ^ { * } } \mathcal { L } _ { i } / \left\| \nabla _ { \pmb { \theta } _ { \parallel } ^ { * } } \mathcal { L } _ { i } \right\| | i \in T \right\} \right)$ .
+
+As seen for MGDA, corollary 1 implies that, even if the employed model $f$ has the capacity to reach the minimal loss on ${ \mathcal { L } } ^ { \mathrm { M } \mathbf { \bar { T } } }$ , IMTL may stop before reaching a stationary point. Recalling the relationship between under-optimizing and overfitting [15], this supports the interpretation of IMTL as a regularizer for equation (1). This is empirically shown in $\ S 5 . 3$ , Figures 5, 9(a). In particular, unitary scalarization reaches the same average performance of IMTL but requires earlier stopping.
+
+PCGrad We provide an alternative characterization of the PCGrad update rule, highlighting its stochasticity in the context of its interpretation as loss rescaling [40, 42]. See appendix B.3 for a proof.
+
+Proposition 3. PCGrad is equivalent to a dynamic, and possibly stochastic, loss rescaling for $\theta _ { \parallel }$ . $A t$ each iteration, per-task gradients are rescaled as follows:
+
+$$
+\begin{array} { r } { \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i } \gets \left( 1 + \sum _ { j \in \mathcal { T } \backslash \{ i \} } d _ { j i } \right) \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i } , d _ { j i } \in \left[ 0 , \frac { \left\| \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { j } \right\| } { \left\| \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i } \right\| } \right] . } \end{array}
+$$
+
+Furthermore, $i f | \mathcal { T } | > 2$ , $d _ { j i }$ is a random variable, and the above range contains its support.
+
+The results from proposition 3 can be easily extended to GradVac [62], which generalizes PCGrad’s projection onto the normal vector to arbitrary target cosine similarities between per-task gradients. When $| \mathcal T | > 2$ , PCGrad corresponds to a stochastic loss re-weighting. As such, PCGrad bears many similarities with Random Loss Weighting (RLW) [40]. RLW proposes to sample scalarization weights from standard probability distributions at each iteration, and proves that this leads the better generalization [40, theorem 2]. Indeed, it is well-known that adding noise to stochastic gradient estimations leads the optimization towards flatter minima, and that such minima may reduce overfitting [31, 34]. In line with the main technical results by Yu et al. [66], we now restrict our focus to two-task problems, which allow for an easy description of PCGrad’s convergence points. The result is largely based on [66, theorem 1]: we relax some of the assumptions and provide a proof in appendix B.3.
+
+Corollary 2. If $| \tau | = 2$ , PCGrad will stop at any point where $\cos ( \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { 1 } , \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { 2 } ) = - 1 .$ . Furthermore, if $\mathcal { L } _ { 1 }$ and $\mathcal { L } _ { 2 }$ are differentiable, and $\nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } ^ { M T }$ is $L$ -Lipschitz with $L > 0$ , PCGrad with step size $\begin{array} { r } { t < \frac { 1 } { L } } \end{array}$ converges to a superset of the convergence points of the unitary scalarization.
+
+Corollary 2 implies that, when $| \tau | = 2$ , PCGrad may under-optimize equation (1) as MGDA and IMTL. In particular, if $\cos ( \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { 1 } , \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { 2 } ) = - 1$ , then $\mathbf { 0 } \in \mathrm { C o n v } ( \{ { \nabla } \theta _ { \parallel } \mathcal { L } _ { 1 } , \nabla \theta _ { \parallel } \mathcal { L } _ { 2 } \} )$ (see proposition 1). We believe that PCGrad’s stochasticity and enlarged convergence set potentially explain its regularizing effect.
+
+GradDrop While the motivation behind GradDrop is to avoid entry-wise gradient conflicts across tasks, the main property of the method is to drive the optimization towards “joint minima": points that are stationary for all the individual tasks at once [11, proposition 1]. In other words: $\nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i } = \mathbf { 0 } \forall i \in$ $\tau$ . While this property is desirable, we show that it holds beyond GradDrop, and independently of the gradient directions. Under strong assumptions on the model capacity, the above property would trivially hold for unitary scalarization (proposition 5, appendix B.4). Proposition 4 shows that it holds for a simple randomized version of unitary scalarization, which we name Random Grad Drop (RGD).
+
+Proposition 4. Let $\begin{array} { r } { \mathcal { L } ^ { R G D } ( \pmb { \theta } _ { \parallel } ) : = \sum _ { i \in \mathcal { T } } u _ { i } \mathcal { L } _ { i } ( \pmb { \theta } _ { \parallel } ) } \end{array}$ , where $u _ { i } \sim B e r n o u l l i ( p ) \forall i \in \mathcal { T }$ and $p \in ( 0 , 1 ]$ The gradient $\nabla _ { \pmb { \theta } _ { | | } } \mathcal { L } _ { \mathbf { \lambda } } ^ { R G D }$ is always zero if and only if $\nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i } = \mathbf { 0 } \forall i \in \mathcal { T }$ . In other words, the result from $_ { I I I }$ , proposition $I J$ can be obtained without any information on the sign of per-task gradients.
+
+Proposition 4 (see appendix B.4 for a simple proof) shows that an inexpensive sign-independent stochastic scalarization shares GradDrop’s main reported property. $\mathcal { L } ^ { \mathrm { { R G D } } }$ can be directly cast an instance of RLW, and hence as a regularization method [31, 34]. Furthermore, Figure 12 in appendix D.3 shows that the empirical results of GradDrop on CelebA [44] are closely matched by a sign-agnostic gradient masking, partly undermining the conflicting gradients assumption. We believe that the above results, along with the authors’ original experiments showing that GradDrop delays overfitting on CelebA [11, figure 3], suggest that GradDrop behaves as a regularizer.
+
+# 5.3 Under-Optimization: Empirical Study
+
+As seen in $\ S 5 . 2$ , MGDA and IMTL might under-optimize equation (1) compared to unitary scalarization due to their larger convergence sets. In order to assess whether this is empirically the case, we estimate $\begin{array} { r } { \big \| \sum _ { i \in \mathcal { T } } \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i } \big \| _ { 2 } } \end{array}$ , the norm of the unitary scalarization update on shared parameters $\theta _ { \parallel }$ , for all optimizers throughout the unregularized CelebA experiment from $\ S 5 . 1$ . Large magnitudes for $\begin{array} { r } { \big \| \sum _ { i \in \mathcal { T } } \mathbf { \dot { V } } _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i } \big \| _ { 2 } } \end{array}$ towards convergence would indicate that SMTOs steer optimization far from stationary points of unitary scalarization, resulting in under-optimization. We compute the update norm on the mini-batch loss every 100 updates, and report the per-epoch average in Figure 6. Most SMTOs have a smaller update magnitude than unitary scalarization in the first 15 epochs. However, towards convergence, SMTOs display larger $\begin{array} { r } { \big \| \sum _ { i \in \mathcal { T } } \nabla _ { \pmb { \theta } _ { \parallel } } \mathcal { L } _ { i } \big \| _ { 2 } } \end{array}$ compared to unitary scalarization. In particular, IMTL and MGDA have the largest norm, denoting significant empirical under-optimization. The additional stochasticity of RLW, PCGrad, and GradDrop also appears to lead to larger norm values than unitary scalarization, yet to a lesser degree. Given that MGDA and IMTL incur a larger loss than unitary scalarization in later epochs (see Figure 9(a) in appendix D.2), we can conclude that they guide optimization towards regions of the parameter space that under-optimize equation (1), providing empirical support for our analysis.
+
+# 6 Conclusions
+
+This paper made two main contributions. First, we evaluated popular SMTOs using a single experimental pipeline, including previously unpublished results of MGDA, IMTL, RLW, and GradDrop in the RL setting. Surprisingly, our evaluation showed that none of the SMTOs consistently outperform unitary scalarization, the simplest and least expensive method. Second, in order to explain our surprising results, we postulate that SMTOs act as regularizers and present an analysis that supports our hypothesis. We believe our work calls for further reevaluation of progress in developing principled and efficient MTL algorithms.
+
+We conclude by addressing the limitations of our work. While we covered a wide range of popular benchmarks, we do not exclude the existence of settings where unitary scalarization underperforms: discovering them is an interesting direction for future work. Furthermore, our experimental results were obtained via grid searches under limited compute resources: some of the methods might benefit from further fine-tuning. Nevertheless, we remark that fine-tuning will be easier for unitary scalarization due to its shorter runtimes. Finally, we presented the regularization hypothesis only as a partial explanation of our results: we hope it will steer further analysis and consequently improve the understanding of MTL.
+
+# Acknowledgements
+
+VK was funded by Samsung R&D Institute UK through the EPSRC Centre for Doctoral Training (CDT) in Autonomous Intelligent Machines and Systems (AIMS) at the University of Oxford . ADP was funded by EPSRC for the AIMS CDT, grant EP/L015987/1, and by an IBM PhD fellowship. SW has received funding from the European Research Council under the European Union’s Horizon 2020 research and innovation programme (grant agreement number 637713). The experiments were made possible by a generous equipment grant from NVIDIA. We would like to thank Lin et al. [40], Sodhani et al. [55] and Sener and Koltun [54] for publicly releasing their code. The authors thank Kristian Hartikainen for helpful comments on the RL experiments. VK thanks Ryota Tomioka for useful discussions on multitask optimization.
+
+# References
+
+[1] Z. Allen-Zhu, Y. Li, and Z. Song. A convergence theory for deep learning via overparameterization. In International Conference on Machine Learning, 2019.
+[2] V. Badrinarayanan, A. Kendall, and R. Cipolla. Segnet: A deep convolutional encoder-decoder architecture for image segmentation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017.
+[3] B. Bakker and T. Heskes. Task clustering and gating for bayesian multitask learning. Journal of Machine Learning Research, 2003.
+[4] Q. Cappart, D. Chételat, E. B. Khalil, A. Lodi, C. Morris, and P. Velickovic. Combinatorial optimization and reasoning with graph neural networks. In Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, IJCAI 2021, Virtual Event / Montreal, Canada, 19-27 August 2021, 2021.
+[5] R. Caruana. Multitask learning. Machine Learning, 28(1):41–75, 1997.
+[6] R. Caruana. Multitask learning. PhD thesis, School of Computer Science, Carnegie Mellon University, Pittsburgh, PA 15213, 1997.
+[7] R. Caruana, S. Lawrence, and L. Giles. Overfitting in neural nets: Backpropagation, conjugate gradient, and early stopping. In Neural Information Processing Systems, 2000. [8] L.-C. Chen, Y. Zhu, G. Papandreou, F. Schroff, and H. Adam. Encoder-decoder with atrous separable convolution for semantic image segmentation. In European Conference on Computer Vision, 2018.
+[9] S. Chen, Y. Zhang, and Q. Yang. Multi-task learning in natural language processing: An overview. CoRR, 2021.
+[10] Z. Chen, V. Badrinarayanana, C.-Y. Lee, and A. Rabinovich. Gradnorm: Gradient normalization for adaptive loss balancing in deep multitask networks. In International Conference on Machine Learning, 2018.
+[11] Z. Chen, J. Ngiam, Y. Huang, T. Luong, H. Kretzschmar, Y. Chai, and D. Anguelov. Just pick a sign: Optimizing deep multitask models with gradient sign dropout. In Neural Information Processing Systems, 2020.
+[12] R. Collobert and J. Weston. A unified architecture for natural language processing: deep neural networks with multitask learning. In Machine Learning, Proceedings of the Twenty-Fifth International Conference (ICML 2008), Helsinki, Finland, June 5-9, 2008, 2008.
+[13] M. Cordts, M. Omran, S. Ramos, T. Rehfeld, M. Enzweiler, R. Benenson, U. Franke, S. Roth, and B. Schiele. The cityscapes dataset for semantic urban scene understanding. In Conference on Computer Vision and Pattern Recognition, 2016.
+[14] J. Désidéri. Multiple-gradient descent algorithm (MGDA) for multiobjective optimization. Comptes Rendus Mathematique, 350:313–318, 2012.
+[15] T. Dietterich. Overfitting and undercomputing in machine learning. ACM Computing Surveys, page 326–327, sep 1995.
+[16] T. Evgeniou and M. Pontil. Regularized multi–task learning. In ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2004.
+[17] J. Fliege and B. F. Svaiter. Steepest descent methods for multicriteria optimization. Mathematical Methods of Operations Research, 2000.
+[18] M. Guo, A. Haque, D.-A. Huang, S. Yeung, and L. Fei-Fei. Dynamic task prioritization for multitask learning. In Proceedings of the European Conference on Computer Vision (ECCV), September 2018.
+[19] P. Guo, C.-Y. Lee, and D. Ulbricht. Learning to branch for multi-task learning. 2020.
+[20] T. Haarnoja, A. Zhou, P. Abbeel, and S. Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In International Conference on Machine Learning, 2018.
+[21] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. Conference on Computer Vision and Pattern Recognition, 2016.
+[22] T. Heskes. Empirical bayes for learning to learn. In International Conference on Machine Learning, 2000.
+[23] M. Hessel, H. Soyer, L. Espeholt, W. Czarnecki, S. Schmitt, and H. van Hasselt. Multi-task deep reinforcement learning with popart. In The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI 2019, The Thirty-First Innovative Applications of Artificial Intelligence Conference, IAAI 2019, The Ninth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2019, Honolulu, Hawaii, USA, January 27 - February 1, 2019, pages 3796–3803. AAAI Press, 2019.
+[24] T. M. Hospedales, A. Antoniou, P. Micaelli, and A. J. Storkey. Meta-learning in neural networks: A survey. CoRR, 2020.
+[25] W. Huang, I. Mordatch, and D. Pathak. One policy to control them all: Shared modular policies for agent-agnostic control. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, 2020.
+[26] S. Ioffe and C. Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning, 2015.
+[27] M. Jaderberg, V. Mnih, W. M. Czarnecki, T. Schaul, J. Z. Leibo, D. Silver, and K. Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017.
+[28] A. Javaloy and I. Valera. Rotograd: Gradient homogenization in multitask learning. In International Conference on Learning Representations, 2022.
+[29] D. Kalashnikov, J. Varley, Y. Chebotar, B. Swanson, R. Jonschkowski, C. Finn, S. Levine, and K. Hausman. Mt-opt: Continuous multi-task robotic reinforcement learning at scale. CoRR, 2021.
+[30] A. Kendall, Y. Gal, and R. Cipolla. Multi-task learning using uncertainty to weigh losses for scene geometry and semantics. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
+[31] N. S. Keskar, D. Mudigere, J. Nocedal, M. Smelyanskiy, and P. T. P. Tang. On large-batch training for deep learning: Generalization gap and sharp minima. International Conference on Learning Representations, 2017.
+[32] K. Khetarpal, M. Riemer, I. Rish, and D. Precup. Towards continual reinforcement learning: A review and perspectives. arXiv preprint arXiv:2012.13490, 2020.
+[33] D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. In Y. Bengio and Y. LeCun, editors, International Conference on Learning Representations, 2015.
+[34] B. Kleinberg, Y. Li, and Y. Yuan. An alternative view: When does SGD escape local minima? In International Conference on Machine Learning, 2018.
+[35] I. Kokkinos. Ubernet: Training a universal convolutional neural network for low-, mid-, and high-level vision using diverse datasets and limited memory. IEEE Conference on Computer Vision and Pattern Recognition, 2017.
+[36] V. Kurin, S. Godil, S. Whiteson, and B. Catanzaro. Can q-learning with graph networks learn a generalizable branching heuristic for a SAT solver? In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
+[37] V. Kurin, M. Igl, T. Rocktäschel, W. Boehmer, and S. Whiteson. My body is a cage: the role of morphology in graph-based incompatible control. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021, 2021.
+[38] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. IEEE, 1998.
+[39] M. Li, M. Soltanolkotabi, and S. Oymak. Gradient descent with early stopping is provably robust to label noise for overparameterized neural networks. In International Conference on Artificial Intelligence and Statistics, 2020.
+[40] B. Lin, F. Ye, and Y. Zhang. A closer look at loss weighting in multi-task learning. In arXiv preprint arXiv:2111.10603, 2022.
+[41] B. Liu, X. Liu, X. Jin, P. Stone, and Q. Liu. Conflict-averse gradient descent for multi-task learning. Advances in Neural Information Processing Systems, 2021.
+[42] L. Liu, Y. Li, Z. Kuang, J.-H. Xue, Y. Chen, W. Yang, Q. Liao, and W. Zhang. Towards impartial multi-task learning. In International Conference on Learning Representations, 2021.
+[43] S. Liu, E. Johns, and A. J. Davison. End-to-end multi-task learning with attention. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 1871–1880, 2019.
+[44] Z. Liu, P. Luo, X. Wang, and X. Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), 2015.
+[45] S. Ma, R. Bassily, and M. Belkin. The power of interpolation: Understanding the effectiveness of sgd in modern over-parametrized learning. In International Conference on Machine Learning, 2018.
+[46] I. Misra, A. Shrivastava, A. Gupta, and M. Hebert. Cross-stitch networks for multi-task learning. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, 2016.
+[47] S. Narvekar, B. Peng, M. Leonetti, J. Sinapov, M. E. Taylor, and P. Stone. Curriculum learning for reinforcement learning domains: A framework and survey. J. Mach. Learn. Res., 2020.
+[48] A. Navon, A. Shamsian, I. Achituve, H. Maron, K. Kawaguchi, G. Chechik, and E. Fetaya. Multi-task learning as a bargaining game. In International Conference on Machine Learning, 2022.
+[49] E. Parisotto, L. J. Ba, and R. Salakhutdinov. Actor-mimic: Deep multitask and transfer reinforcement learning. In Y. Bengio and Y. LeCun, editors, 4th International Conference on Learning Representations, ICLR 2016, San Juan, Puerto Rico, May 2-4, 2016, Conference Track Proceedings, 2016.
+[50] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, A. Desmaison, A. Kopf, E. Yang, Z. DeVito, M. Raison, A. Tejani, S. Chilamkurthy, B. Steiner, L. Fang, J. Bai, and S. Chintala. Pytorch: An imperative style, high-performance deep learning library. In Neural Information Processing Systems. 2019.
+[51] A. A. Rusu, S. G. Colmenarejo, Ç. Gülçehre, G. Desjardins, J. Kirkpatrick, R. Pascanu, V. Mnih, K. Kavukcuoglu, and R. Hadsell. Policy distillation. In Y. Bengio and Y. LeCun, editors, 4th International Conference on Learning Representations, ICLR 2016, San Juan, Puerto Rico, May 2-4, 2016, Conference Track Proceedings, 2016.
+[52] S. Sabour, N. Frosst, and G. E. Hinton. Dynamic Routing between Capsules. 2017.
+[53] M. L. Seltzer and J. Droppo. Multi-task learning in deep neural networks for improved phoneme recognition. In IEEE International Conference on Acoustics, Speech and Signal Processing, ICASSP 2013, Vancouver, BC, Canada, May 26-31, 2013, 2013.
+[54] O. Sener and V. Koltun. Multi-task learning as multi-objective optimization. In Neural Information Processing Systems, 2018.
+[55] S. Sodhani, A. Zhang, and J. Pineau. Multi-task reinforcement learning with context-based representations. In M. Meila and T. Zhang, editors, International Conference on Machine Learning, 2021.
+[56] N. Srivastava, G. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 2014.
+[57] Y. W. Teh, V. Bapst, W. M. Czarnecki, J. Quan, J. Kirkpatrick, R. Hadsell, N. Heess, and R. Pascanu. Distral: Robust multitask reinforcement learning. In I. Guyon, U. von Luxburg, S. Bengio, H. M. Wallach, R. Fergus, S. V. N. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 4496–4506, 2017.
+[58] Y. W. Teh, V. Bapst, W. M. Czarnecki, J. Quan, J. Kirkpatrick, R. Hadsell, N. Heess, and R. Pascanu. Distral: Robust multitask reinforcement learning. In Neural Information Processing Systems, 2017.
+[59] W.-C. Tseng. Weichengtseng/pytorch-pcgrad, 2020. URL https://github.com/ WeiChengTseng/Pytorch-PCGrad.git.
+[60] H. P. van Hasselt, A. Guez, M. Hessel, V. Mnih, and D. Silver. Learning values across many orders of magnitude. Advances in Neural Information Processing Systems, 29:4287–4295, 2016.
+[61] S. Vandenhende, S. Georgoulis, W. Van Gansbeke, M. Proesmans, D. Dai, and L. Van Gool. Multi-task learning for dense prediction tasks: A survey. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021.
+[62] Z. Wang, Y. Tsvetkov, O. Firat, and Y. Cao. Gradient vaccine: Investigating and improving multi-task optimization in massively multilingual models. In International Conference on Learning Representations, 2021.
+[63] D. Xin, B. Ghorbani, A. Garg, O. Firat, and J. Gilmer. Do current multi-task optimization methods in deep learning even help? In Neural Information Processing Systems, 2022.
+[64] F. Yu, V. Koltun, and T. Funkhouser. Dilated residual networks. In Computer Vision and Pattern Recognition, 2017.
+[65] T. Yu, D. Quillen, Z. He, R. Julian, K. Hausman, C. Finn, and S. Levine. Meta-world: A benchmark and evaluation for multi-task and meta reinforcement learning. In L. P. Kaelbling, D. Kragic, and K. Sugiura, editors, 3rd Annual Conference on Robot Learning, 2019.
+[66] T. Yu, S. Kumar, A. Gupta, S. Levine, K. Hausman, and C. Finn. Gradient surgery for multi-task learning. In Neural Information Processing Systems, 2020.
+
+# Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes] see $\ S 6$ .
+(c) Did you discuss any potential negative societal impacts of your work? [Yes] due to space constraints, we provide a discussion in appendix A.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes] we provide full proofs in the Appendix, and refer to them in the main body of the paper.
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] we provide the code and the instructions in the supplemental material.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] see appendix C.1.
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [Yes] appendix C.3 describes licenses of all benchmarks and implementations we used for our work.
+(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] we include the code and the instructions on how to replicate the experiments into the supplemental material.
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/wqD6TfbYkrn/wqD6TfbYkrn.md b/md/dev/wqD6TfbYkrn/wqD6TfbYkrn.md
new file mode 100644
index 0000000000000000000000000000000000000000..e04a7a76de0de9116028500d46fb70ce07235d1c
--- /dev/null
+++ b/md/dev/wqD6TfbYkrn/wqD6TfbYkrn.md
@@ -0,0 +1,403 @@
+# A CONDITIONAL POINT DIFFUSION-REFINEMENTPARADIGM FOR 3D POINT CLOUD COMPLETION
+
+Zhaoyang Lyu1,2∗ Zhifeng Kong3∗ Xudong $\mathbf { X } \mathbf { u } ^ { 1 }$ Liang Pan4 Dahua Lin1,2 1CUHK-SenseTime Joint Lab, The Chinese University of Hong Kong 2Shanghai AI Laboratory 3University of California, San Diego $^ 4 { \cal S }$ -Lab, Nanyang Technological University lyuzhaoyang@link.cuhk.edu.hk, z4kong@eng.ucsd.edu
+xx018@ie.cuhk.edu.hk, liang.pan@ntu.edu.sg, dhlin@ie.cuhk.edu.hk
+
+# ABSTRACT
+
+3D point cloud is an important 3D representation for capturing real world 3D objects. However, real-scanned 3D point clouds are often incomplete, and it is important to recover complete point clouds for downstream applications. Most existing point cloud completion methods use Chamfer Distance (CD) loss for training. The CD loss estimates correspondences between two point clouds by searching nearest neighbors, which does not capture the overall point density distribution on the generated shape, and therefore likely leads to non-uniform point cloud generation. To tackle this problem, we propose a novel Point Diffusion-Refinement (PDR) paradigm for point cloud completion. PDR consists of a Conditional Generation Network (CGNet) and a ReFinement Network (RFNet). The CGNet uses a conditional generative model called the denoising diffusion probabilistic model (DDPM) to generate a coarse completion conditioned on the partial observation. DDPM establishes a one-to-one pointwise mapping between the generated point cloud and the uniform ground truth, and then optimizes the mean squared error loss to realize uniform generation. The RFNet refines the coarse output of the CGNet and further improves quality of the completed point cloud. Furthermore, we develop a novel dual-path architecture for both networks. The architecture can (1) effectively and efficiently extract multi-level features from partially observed point clouds to guide completion, and (2) accurately manipulate spatial locations of 3D points to obtain smooth surfaces and sharp details. Extensive experimental results on various benchmark datasets show that our PDR paradigm outperforms previous state-of-the-art methods for point cloud completion. Remarkably, with the help of the RFNet, we can accelerate the iterative generation process of the DDPM by up to 50 times without much performance drop.
+
+# 1 INTRODUCTION
+
+With the rapid developments of 3D sensors, 3D point clouds are an important data format that captures 3D information owing to their ease of acquisition and efficiency in storage. Unfortunately, point clouds scanned in the real world are often incomplete due to partial observation and self occlusion. It is important to recover the complete shape by inferring the missing parts for many downstream tasks such as 3D reconstruction, augmented reality and scene understanding. To tackle this problem, many learning-based methods (Yuan et al., 2018; Yang et al., 2018; Tchapmi et al., 2019; Xie et al., 2020; Liu et al., 2020; Pan et al., 2021) are proposed, which are supervised by using either the Chamfer Distance (CD) or Earth Mover Distance (EMD) to penalize the discrepancies between the generated complete point cloud and the ground truth. However, CD loss is not sensitive to overall density distribution, and thus networks trained by CD loss could generate non-uniform point cloud completion results (See Figure 10 and 11 in Appendix). EMD is more distinctive to measure density distributions, but it is too expensive to compute in training. The absence of an effective and efficient training loss highly limits the capabilities of many existing point cloud completion networks.
+
+
+Figure 1: Our Conditional Point Diffusion-Refinement (PDR) paradigm first moves a Gaussian noise step by step towards a coarse completion of the partial observation through a diffusion model (DDPM). Then it refines the coarse point cloud by one step to obtain a high quality point cloud.
+
+We find that denoising diffusion probabilistic models (DDPM) (Sohl-Dickstein et al., 2015; Ho et al., 2020) can potentially generate uniform and high quality point clouds with an effective and efficient loss function. It can iteratively move a set of Gaussian noise towards a complete and clean point cloud. DDPM defines a one-to-one pointwise mapping between two consecutive point clouds in the diffusion process, which enables it to use a simple mean squared error loss function for training. This loss function is efficient to compute and explicitly requires the generated point cloud to be uniform, as a one-to-one point mapping is naturally established between the generated point cloud and the ground truth. Point cloud completion task can be treated as a conditional generation problem in the framework of DDPM (Zhou et al., 2021; Luo & Hu, 2021). Indeed, we find the complete point clouds generated by a conditional DDPM often have a good overall distribution that uniformly covers the shape of the object.
+
+Nonetheless, due to the probabilistic nature of DDPM and the lack of a suitable network architecture to train the conditional DDPM for 3D point cloud completion in previous works, we find DDPM completed point clouds often lack smooth surfaces and sharp details (See Figure 1 and Appendix Figure 12), which is also reflected by their high CD loss compared with state-of-the-art point cloud completion methods in our experiments. Another problem with DDPM is its inefficiency in the inference phase. It usually takes several hundreds and even up to one thousand forward steps to generate a single point cloud. Several methods (Song et al., 2020; Nichol & Dhariwal, 2021; Kong & Ping, 2021) are proposed to accelerate DDPM using jumping steps without retraining networks, which however, leads to an obvious performance drop when using a small number of diffusion steps.
+
+In this work, we propose the Conditional Point Diffusion-Refinement (PDR) paradigm to generate both uniform and high quality complete point clouds. As shown in Figure 1, our PDR paradigm performs point cloud completion in a coarse-to-fine fashion. Firstly, we use the Conditional Generation Network (CGNet) to generate a coarse complete point cloud by the DDPM conditioned on the partial point cloud. It iteratively moves a set of Gaussian noise towards a complete point cloud. Following, the ReFinement Network (RFNet) further refines the coarse complete point cloud generated from the Conditional Generation Network with the help of partial point clouds. In addition, RFNet can be used to refine the low quality point clouds generated by an accelerated DDPM, so that we could enjoy an acceleration up to 50 times, while minimizing the performance drop. In this way, the completion results generated by our PDR paradigm demonstrate both good overall density distribution (i.e. uniform) and sharp local details.
+
+Both CGNet and RFNet have a novel dual-path network architecture shown in Figure 2, which is composed of two parallel sub-networks, a Denoise subnet and a Condition Feature Extraction subnet for noisy point clouds and partial point clouds, respectively. Specifically, we propose Point Adaptive Deconvolution (PA-Deconv) operation for upsampling, which can effectively manipulate spatial locations of 3D points. Furthermore, we propose the Feature Transfer (FT) module to directly transmit encoded point features at different scales from the Condition Feature Extraction subnet to the corresponding hierarchy in the Denoise subnet. Extensive experimental results show that our PDR paradigm can provide new state-of-the-art performance for point cloud completion.
+
+Our Key contributions can be summarized as: 1) We identify conditional DDPM to be a good model with an effective and efficient loss function to generate uniform point clouds in point cloud completion task. 2) By using RFNet to refine the coarse point clouds, our PDR paradigm can generate complete point cloud with both good overall density distribution (i.e. uniform) and sharp local details. 3) We design novel point learning modules, including PA-Deconv and Feature Transfer modules, for constructing CGNet in DDPM and RFNet, which effectively and efficiently utilizes multi-level features extracted from incomplete point clouds for point cloud completion. 4) With the help of our proposed RFNet, we can accelerate the generation process of DDPM up to 50 times without a significant drop in point cloud quality.
+
+
+Figure 2: Network architecture of the Conditional Generation Network (CGNet) and ReFinement Network (RFNet). It consists of the Condition Feature Extraction subnet and the Denoise subnet.
+
+# 2 PROBLEM STATEMENT
+
+In this paper, we focus on the 3D point cloud completion task. A 3D point cloud is represented by $N$ points in the 3D space: $X = \{ x _ { j } | 1 \leq j \leq N \}$ , where each $x _ { j } \in \mathbb { R } ^ { \hat { 3 } }$ is the 3D coordinates of the $j$ -th point. We assume the dataset is composed of $M$ data pairs $\mathsf { \bar { \{ } } ( X _ { i } , C _ { i } ) | 1 \leq i \leq M \}$ , where $X _ { i }$ is the $i$ -th ground-truth point cloud, and $C _ { i }$ is the incomplete point cloud from a partial observation of $X _ { i }$ . The goal is to develop a model that completes the partial observation $C _ { i }$ and outputs a point cloud as close to the ground truth $X _ { i }$ as possible. For algebraic convenience, we let $\pmb { x } \in \mathbb { R } ^ { 3 N }$ be the vector form of a point cloud $\boldsymbol { X }$ , and similarly $^ c$ be the vector form of $C$ .
+
+# 3 METHODOLOGY
+
+We consider the point cloud completion task as a conditional generation problem, where the incomplete point cloud $C$ serves as the conditioner. We use the powerful generative model called denoising diffusion probabilistic models (DDPM) (Sohl-Dickstein et al., 2015; Ho et al., 2020; Kong et al., 2020) to first generate a coarse completion of the partial observation. Then we use another network to refine the coarse point cloud to improve its visual quality. Our point cloud completion pipeline is shown in Figure 1. We first briefly introduce the theory of DDPM in Section 3.1, and then describe detailed architecture of the Conditional Generation Network (CGNet) and ReFinement Network (RFNet) in Section 3.2 and Section 3.3.
+
+# 3.1 BACKGROUND ON CONDITIONAL DENOISING DIFFUSION PROBABILISTIC MODELS
+
+We assume $p _ { \mathrm { d a t a } }$ to be the distribution of the complete point cloud $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ in the dataset, and $p _ { \mathrm { l a t e n t } } =$ $\mathcal { N } ( \mathbf { 0 } _ { 3 N } , I _ { 3 N \times 3 N } )$ to be the latent distribution, where $\mathcal { N }$ is the Gaussian distribution. Then, the conditional DDPM consists of two Markov chains called the diffusion process and the reverse process. Both processes have length equal to $T$ . We set $T = 1 0 0 0$ in this paper.
+
+The Diffusion Process. The diffusion process is a Markov process that adds Gaussian noise into the clean data distribution $p _ { \mathrm { d a t a } }$ until the output distribution is close to $p _ { \mathrm { l a t e n t } }$ . The diffusion process is irrelevant of the conditioner, the incomplete point cloud $c _ { i }$ . Formally, let $\mathbf { \boldsymbol { x } } ^ { 0 } \sim p _ { \mathrm { d a t a } }$ . We use the superscript to denote the diffusion step $t$ . For conciseness, we omit the subscription $i$ in the following discussion. The diffusion process from clean data $\mathbf { \boldsymbol { x } } ^ { 0 }$ to $\mathbf { x } ^ { T }$ is defined as
+
+$$
+q ( \pmb { x } ^ { 1 } , \cdots , \pmb { x } ^ { T } | \pmb { x } ^ { 0 } ) = \prod _ { t = 1 } ^ { T } q ( \pmb { x } ^ { t } | \pmb { x } ^ { t - 1 } ) , \mathrm { ~ w h e r e ~ } q ( \pmb { x } ^ { t } | \pmb { x } ^ { t - 1 } ) = \mathcal { N } ( \pmb { x } ^ { t } ; \sqrt { 1 - \beta _ { t } } \pmb { x } ^ { t - 1 } , \beta _ { t } I ) .
+$$
+
+The hyperparameters $\beta _ { t }$ are pre-defined, small positive constants (See details in Appendix Section A.1). According to Ho et al. (2020), there is a closed form expression for $q ( \pmb { x } ^ { t } | \pmb { x } ^ { 0 } )$ . We first define constants $\alpha _ { t } = 1 - \beta _ { t }$ , $\begin{array} { r } { \bar { \alpha } _ { t } = \prod _ { i = 1 } ^ { t } \alpha _ { i } } \end{array}$ . Then, we have ${ q ( { \pmb x } ^ { t } | { \pmb x } ^ { 0 } ) = \mathcal { N } \left( { \pmb x } ^ { t } ; \sqrt { { \bar { \alpha } } _ { t } } { \pmb x } ^ { 0 } , ( 1 - { \bar { \alpha } } _ { t } ) { \pmb I } \right) }$ .
+
+Therefore, when $T$ is large enough, $\bar { \alpha } _ { t }$ goes to 0, and $q ( \pmb { x } ^ { T } | \pmb { x } ^ { 0 } )$ becomes close to the latent distribution $p _ { \mathrm { l a t e n t } } ( \pmb { x } ^ { T } )$ . Note that $\mathbf { \boldsymbol { x } } ^ { t }$ can be directly sampled through the following equation:
+
+${ \pmb x } ^ { t } = \sqrt { \bar { \alpha } _ { t } } { \pmb x } ^ { 0 } + \sqrt { 1 - \bar { \alpha } _ { t } } { \epsilon }$ , where $\epsilon$ is a standard Gaussian noise.
+
+We emphasize that $q ( \mathbf { \boldsymbol { x } } ^ { t } | \mathbf { \boldsymbol { x } } ^ { t - 1 } )$ can be seen as a one-to-one pointwise mapping as $\mathbf { \boldsymbol { x } } ^ { t }$ can be sampled through the equation $\pmb { x } ^ { t } = \sqrt { 1 - \beta _ { t } } \pmb { x } ^ { t - 1 } + \beta _ { t } \pmb { \epsilon }$ . Therefore, the order of points in $\pmb { x } ^ { 0 }$ is preserved in the diffusion process. However, it does not matter what kind of order we input the points in $\mathbf { \boldsymbol { x } } ^ { 0 }$ . That is because when $T$ is large enough, $\mathbf { \boldsymbol { x } } ^ { T }$ will become a Gaussian distribution. Every point in a Gaussian distribution is equivalent and there is no way to distinguish one point from another.
+
+The Reverse Process. The reverse process is a Markov process that predicts and eliminates the noise added in the diffusion process. The reverse process is conditioned on the conditioner, the incomplete point cloud $^ c$ . Let $\mathbf { \boldsymbol { x } } ^ { T } \sim p _ { \mathrm { l a t e n t } }$ be a latent variable. The reverse process from latent $\mathbf { \boldsymbol { x } } ^ { T }$ to clean data $\mathbf { \boldsymbol { x } } ^ { 0 }$ is defined as
+
+$$
+\ L _ { \theta } ( { \boldsymbol x } ^ { 0 } , \dots , { \boldsymbol x } ^ { T - 1 } | { \boldsymbol x } ^ { T } , c ) = \prod _ { t = 1 } ^ { T } p _ { \theta } ( { \boldsymbol x } ^ { t - 1 } | { \boldsymbol x } ^ { t } , c ) , { \mathrm { ~ w h e r e ~ } } p _ { \theta } ( { \boldsymbol x } ^ { t - 1 } | { \boldsymbol x } ^ { t } , c ) = \mathcal { N } ( { \boldsymbol x } ^ { t - 1 } ; \mu _ { \theta } ( { \boldsymbol x } ^ { t } , c , t ) , \sigma _ { t } ^ { 2 } I )
+$$
+
+The mean $\mu _ { \theta } ( \pmb { x } ^ { t } , \pmb { c } , t )$ is a neural network parameterized by $\pmb \theta$ and the variance $\sigma _ { t } ^ { 2 }$ is a time-step dependent constant. To generate a sample conditioned on $^ c$ , we first sample $\pmb { x } ^ { T } \sim \mathrm { \mathcal { N } } ( \mathbf { 0 } _ { 3 N } , \pmb { I } _ { 3 N \times 3 N } )$ , then draw $\pmb { x } ^ { t - 1 } \sim p _ { \pmb { \theta } } \bar { ( \pmb { x } ^ { t - 1 } | \pmb { x } ^ { t } , \pmb { c } ) }$ for $t = T , T - 1 , \cdots , 1$ , and finally outputs $\mathbf { \boldsymbol { x } } ^ { 0 }$ .
+
+Training. DDPM is trained via variational inference. Ho et al. (2020) introduced a certain parameterization for $\mu _ { \theta }$ that can largely simplify the training objective. The parameterization is $\begin{array} { r } { \sigma _ { t } ^ { 2 } \ = \ \frac { 1 - \bar { \alpha } _ { t - 1 } } { 1 - \bar { \alpha } _ { t } } \beta _ { t } } \end{array}$ 1−α¯t−11−α¯ βt, and µθ(xt, c, t) = $\begin{array} { r } { \mu _ { \theta } ( x ^ { t } , c , t ) ~ = ~ \frac { 1 } { \sqrt { \alpha _ { t } } } \left( x ^ { t } - \frac { \beta _ { t } } { \sqrt { 1 - \bar { \alpha } _ { t } } } \epsilon _ { \theta } ( x ^ { t } , c , t ) \right) } \end{array}$ , where $\epsilon _ { \theta }$ is a neural network taking noisy point cloud $\mathbf { \boldsymbol { x } } ^ { t } \sim q ( \mathbf { \boldsymbol { x } } ^ { t } | \mathbf { \boldsymbol { x } } ^ { 0 } )$ in equation (2), diffusion step $t$ , and conditioner $^ c$ as inputs. Then, the simplified training objective becomes
+
+$$
+{ \cal L } ( \pmb { \theta } ) = \mathbb { E } _ { i \sim { \mathcal { U } } ( [ M ] ) , t \sim { \mathcal { U } } ( [ T ] ) , \epsilon \sim { \mathcal { N } } ( 0 , I ) } \parallel \epsilon - \epsilon _ { \theta } \bigl ( \sqrt { \bar { \alpha } _ { t } } \pmb { x } _ { i } ^ { 0 } + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon , \pmb { c } _ { i } , t \bigr ) \parallel ^ { 2 } ,
+$$
+
+where $\mathcal { U } ( [ M ] )$ is the uniform distribution over $\{ 1 , 2 , \cdots , M \}$ . The neural network $\epsilon _ { \theta }$ learns to predict the noise $\epsilon$ added to the clean point cloud √ $\mathbf { \boldsymbol { x } } ^ { 0 }$ , which can be used to denoise the noisy point cloud $\pmb { x } ^ { t } = \sqrt { \bar { \alpha } _ { t } } \pmb { x } ^ { 0 } + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon$ . Note that traditional CD loss or EMD loss is NOT present in Equation 4. The reason that we are able to use the simple mean squared error is because DDPM naturally defines a one-to-one pointwise mapping between two consecutive point clouds in the diffusion process as shown in Equation 1. Note that at each training step, we not only need to sample a pair of point clouds ${ \mathbf { \mathit { x } } } _ { i } , { \mathbf { \mathit { c } } } _ { i }$ , but also a diffusion step $t$ and a Gaussian noise $\epsilon$ .
+
+# 3.2 CONDITIONAL GENERATION NETWORK
+
+In this section, we introduce the architecture of Conditional Generation Network (CGNet) $\epsilon _ { \theta }$ . The inputs of this network are the noisy point cloud $\mathbf { \boldsymbol { x } } ^ { t }$ , the incomplete point cloud $^ c$ , and the diffusion step $t$ . We can intuitively interpret the output of $\epsilon _ { \theta }$ as per-point difference between $\mathbf { \boldsymbol { x } } ^ { t }$ and ${ \pmb x } ^ { t - 1 }$ (with some arithmetic ignored). In addition, $\epsilon _ { \theta }$ should also effectively incorporate multi-level information from $^ c$ . The goal is to infer not only the overall shape but also the fine-grained details based on $^ c$ . We design a neural network that achieves these features. The overall architecture is shown in Figure 2. It is composed of two parallel sub-networks similar to PointNet+ $^ +$ (Qi et al., 2017b), and they have the same hierarchical structure.
+
+The upper subnet, which we refer as the Condition Feature Extraction subnet, extracts multi-level features from the incomplete point cloud $^ c$ . The lower subnet, which we refer as the Denoise subnet, takes the noisy point cloud $\mathbf { \boldsymbol { x } } ^ { t }$ as input. We also add the diffusion step $t$ , the global feature extracted from $^ c$ , and multi-level features extracted by the Condition Feature Extraction subnet to the Denoise subnet. The diffusion step $t$ is first transformed into a 512-dimension step embedding vector through positional encoding and fully connected (FC) layers (See Appendix Section A.1 for details), and then inserted to every level of the Denoise subnet. Similarly, the conditioner $^ c$ is first transformed into a 1024-length global feature through a two-stage PointNet, and then inserted to every level of the Denoise subnet. The multi-level features extracted by the Condition Feature Extraction subnet are inserted to every level of the Denoise subnet through Feature Transfer modules. Finally, the Denoise subnet is connected to a shared MLP and outputs $\bar { \mathbf { \Psi } } _ { \epsilon _ { \theta } ( \mathbf { \mathcal { x } } ^ { t } , c , t ) }$ .
+
+
+Figure 3: (a) Insert information of the diffusion step embedding and the global feature to the shared MLP. (b) The Feature Transfer module maps features from the incomplete point cloud to the noisy point cloud. (c) Refine and upsample the coarse points at the same time.
+
+Additionally, while Zhou et al. (2021) argues PointNet $^ { + + }$ cannot be used in a DDPM that generates point clouds, we find attaching the absolute position of each point to its feature solves this problem. See Appendix Section A.3 for detailed analysis. We also improve the backbone PointNet+ $^ { \cdot + }$ so that it manipulates positions of points more accurately.
+
+In the next paragraphs, we elaborate on the building blocks of the improved PointNet+ $^ +$ : Set Abstraction modules in the encoder, and Feature Propagation modules in the decoder, and Feature Transfer modules between the Condition Feature Extraction subnet and the Denoise subnet.
+
+Set Abstraction (SA) Module. Similar to PointNet $^ { + + }$ , this module subsamples the input point cloud and propagates the input features. Assume the input is $\{ x _ { j } | 1 \le j \le N _ { l } \}$ , where $x _ { j }$ is the 3D coordinate of the $j$ -th point and $N _ { l }$ is the number of input points to the Set Abstraction module of level $l$ . Each point has a feature of dimension $d _ { l }$ . We concatenate these features with their corresponding 3D coordinates and group them together to form a matrix $\pmb { F } _ { l }$ of shape $N _ { l } \times ( d _ { l } + 3 )$ . The SA module first uses iterative farthest point sampling (FPS) to subsample the input points to $N _ { l + 1 }$ points: $\{ y _ { k } | 1 \le k \le N _ { l + 1 } \}$ . Then it finds $K$ neighbors in the input $\mathbf { \bar { \{ x } } _ { j } | 1 \leq \mathbf { \bar { \{ j } } \leq N _ { l } \mathbf \bar \{$ for each $y _ { k }$ . We denote the $K$ neighbors of $y _ { k }$ as $\{ x _ { j } | j \in B _ { x } ( y _ { k } ) \}$ , where $B _ { x } ( y _ { k } )$ is the index set of the $K$ neighbors. See definition of neighbors in Appendix A.2. These neighbors and their features are grouped together to form a matrix $G _ { i n }$ of shape $N _ { l + 1 } \times K \times ( d _ { l } + \bar { 3 } )$ . Then a shared multilayer perceptron (MLP) is applied to transform the grouped feature $G _ { i n }$ to $G _ { o u t }$ , which is of shape $N _ { l + 1 } \times K \times d _ { l + 1 }$ and $d _ { l + 1 }$ is the dimension of the output feature. Finally, a max-pooling is applied to aggregate features from the $K$ neighbors $\{ x _ { j } | j \in B _ { x } ( y _ { k } ) \}$ to $y _ { k }$ . We obtain the output of the SA module, the matrix $\mathbf { \Delta } F _ { l + 1 }$ , which is of shape $N _ { l + 1 } \times d _ { l + 1 }$ .
+
+Note that we need to incorporate information of the diffusion step embedding and global feature extracted from the incomplete point cloud $^ c$ to every SA module in the Denoise subnet as shown in Figure 2. We insert these information to the shared MLP that transforms $G _ { i n }$ to $G _ { o u t }$ mentioned in the above paragraph. Specifically, we add them to the channel dimension of the intermediate feature maps in the shared MLP. Figure 3(a) illustrates this process in details. Inspired by the works (Pan et al., 2021; Zhao et al., 2020), we also replace the max-pooling layer in the SA module with a self-attention layer. Feature at $y _ { k }$ is obtained by a weighted sum of the features of its $K$ neighbors $\{ x _ { j } | j \in B _ { x } ( y _ { k } ) \}$ instead of max-pooling, and the weights are adaptively computed through the attention mechanism. See Appendix A.4 for details of this attention layer.
+
+Feature Propagation (FP) Module. Similar to PointNet++, this module upsamples the input point cloud and propagates the input features. In PointNet++, the features are upsampled from $\{ y _ { k } | 1 \le$ $k \leq N _ { l + 1 } \mathrm { \hat { j } }$ to $\{ x _ { j } | 1 \le j \le N _ { l } \}$ by three interpolation: Feature at $x _ { j }$ is a weighted sum of the features of its three nearest neighbors in $\{ y _ { k } | 1 \le k \le N _ { l + 1 } \}$ . We think that the three interpolation operation is not suitable in our task, because the interpolation operation may lose some information about the accurate positions of the points. See a detailed analysis in Appendix Section A.5.
+
+We propose to use a Point Adaptive Deconvolution (PA-Deconv) module to upsample the point features. In the SA module, the features are mapped from set $\{ x _ { j } | 1 \le j \le N _ { l } \}$ to $\bar { \{ y _ { k } \vert 1 \le k \le } $ $N _ { l + 1 } \}$ . The key step is to find the neighbors $\{ x _ { j } | j \in \mathcal { B } _ { x } ( y _ { k } ) \} \subseteq \{ x _ { j } | 1 \leq j \leq N _ { l } \}$ for each $y _ { k }$ . Features at $\{ x _ { j } | \bar { j } \in B _ { x } ( y _ { k } ) \}$ are transformed and then aggregated to the point $y _ { k }$ through either max-pooling or attention mechanism. Now in the FP module, we need to map features the other way around: from $\{ y _ { k } | 1 \le k \le N _ { l + 1 } \}$ to $\{ x _ { j } | 1 \le j \le N _ { l } \}$ . We can achieve this goal through a similar method. We find the neighbors $\{ y _ { k } | \bar { k } \in B _ { y } ( x _ { j } ) \} \subseteq \{ y _ { k } | 1 \leq k \leq N _ { l + 1 } \}$ for each $x _ { j }$ . Features at $\{ y _ { k } | k \in B _ { y } ( x _ { j } ) \}$ are transformed through a shared MLP, and then aggregated to the point $x _ { j }$ through attention mechanism. Similar to SA modules, we insert information of the diffusion step embedding and the global feature extracted from the incomplete point cloud $^ c$ to the shared MLP in every FP module in the Denoise subnet. Finally, same as the original FP module in PointNet++, the upsampled features are concatenated with skip linked point features from the corresponding SA module, and then passed through a unit PointNet. The Feature Propagation module are applied four times and features are eventually propagated to the original input point cloud.
+
+Feature Transfer (FT) Module. The FT module transmits information from the Condition Feature Extraction subnet to the Denoise subnet. Assume the point cloud at level $l$ in the Condition Feature Extraction subnet is $\{ z _ { l } | 1 \le l \le S _ { l } \}$ , where $S _ { l }$ is the number of points at level $l$ in the Condition Feature Extraction subnet. The FT module maps the features at points $\{ z _ { r } | 1 \le r \le S _ { l } \}$ to points at the same level in the Denoise subnet, which are $\{ x _ { j } | 1 \le j \le \mathsf { N } _ { l } \}$ . Then the mapped features are concatenated with the original features at $\{ x _ { j } | 1 \le { \bar { \jmath } } \le N _ { l } \}$ . Next, the concatenated features are fed to the next level of the Denoise subnet. In this way, the Denoise subnet can utilize local features at different levels of the incomplete point cloud to manipulate the noisy input point cloud to form a clean and complete point cloud. The key step in this process is to map features at $\{ z _ { r } | 1 \le r \le S _ { l } \}$ to $\{ x _ { j } | 1 \le { \mathsf { \bar { j } } } \le { \mathsf { \bar { N } } } _ { l } \}$ . We adopt a similar strategy in the SA module. We find the neighbors $\{ z _ { r } | r \in \bar { \mathcal { B } } _ { z } ( x _ { j } ) \} \subseteq \{ z _ { r } | 1 \leq r \leq S _ { l } \}$ for each $x _ { j }$ . Features at $\{ z _ { r } | r \in B _ { z } ( x _ { j } ) \}$ are transformed through a shared MLP, and then aggregated to the point $x _ { j }$ through the attention mechanism, which is a weighted sum of the features at $\bar { \{ z _ { r } | r \in B _ { z } ( \bar { x _ { j } } ) \} }$ .
+
+We set a small distance to define neighbors in low level FT modules, so that they only query the adjacent parts of the incomplete point cloud $^ c$ to preserve local details in it. Large distances are set to define neighbors in high level FT modules. This makes high-level FT modules have large receptive fields, so that they can query a large part of the incomplete point cloud to infer high level 3D structural relations. See detailed neighbor definitions in Appendix Section A.2.
+
+# 3.3 REFINEMENT NETWORK
+
+We denote the coarse point cloud generated by the Conditional Generation Network as $U$ . We use another network of the same architecture shown in Figure 2 to predict a per-point displacement for $U$ to refine it. The differences are that the input to the Denoise subnet becomes $U$ and we do not need to insert the diffusion step embedding to the Denoise subnet. The predicted displacement are added to $U$ to obtain the refined point cloud $V \colon v = u + \gamma \epsilon _ { f } ( u , c )$ , where $v , u , c$ are the concatenated 3D coordinates of the point clouds $V , U , C$ , respectively. $\gamma$ is a small constant and we set it to 0.001 in all our experiments. $\epsilon _ { f }$ is the ReFinement Network. We use the Chamfer Distance (CD) loss between the refined point cloud $V$ and ground truth point cloud $\boldsymbol { X }$ to supervise the network $\epsilon _ { f }$ :
+
+$$
+\mathcal { L } _ { \mathrm { C D } } ( { \boldsymbol { V } } , { \boldsymbol { X } } ) = \frac { 1 } { | V | } \sum _ { v \in V } \operatorname* { m i n } _ { x \in { \boldsymbol { X } } } | | v - x | | ^ { 2 } + \frac { 1 } { | \boldsymbol { X } | } \sum _ { x \in { \boldsymbol { X } } } \operatorname* { m i n } _ { v \in V } | | v - x | | ^ { 2 } ,
+$$
+
+where $| V |$ means number of points in $V$ . If we also want to upsample points in $U$ by a factor of $\lambda$ , we can simply increase the output dimension of the network $\epsilon _ { f }$ . In addition to predicting one 3D displacement of each point in $U$ , we predict another $\lambda$ displacements. We consider each point in the refined point cloud $V$ as the center of a group of $\lambda$ points in the dense point cloud that we want to generate. The additional $\lambda$ displacements are added to every point in $V$ to form a dense point cloud. Figure 3(c) illustrates how we upsample every point in $V$ by a factor of $\lambda = 8$ .
+
+When training the ReFinement Network $\epsilon _ { f }$ , parameters in the Conditional Generation Network $\epsilon _ { \theta }$ are fixed. It is not practical to generate coarse point clouds $U$ on the fly in the training process of $\epsilon _ { f }$ , because the generation process of DDPM is slow. Instead, we generate and save the coarse point clouds in advance. Due to the probabilistic nature of DDPM, we generate 10 coarse point clouds for each incomplete point cloud in the dataset to increase diversity of training data.
+
+# 4 RELATED WORKS
+
+Point cloud completion. Inspired by the pioneering work, PointNet (Qi et al., 2017a), researchers focus on learning global feature embeddings from 3D point clouds for completion (Yuan et al., 2018; Tchapmi et al., 2019), which however cannot predict local and thin shape structures. To address these challenges, following research works (Pan, 2020; Xie et al., 2020; Zhang et al., 2020; Wen et al., 2021; Yu et al., 2021; Pan et al., 2021) exploit multi-scale local point features to reconstruct complete point clouds with fine-grained geometric details. Recently, PointTr (Yu et al., 2021) and VRCNet (Pan et al., 2021) provide impressive point cloud completion results with the help of attention-based operations. Nonetheless, as a challenging conditional generation problem, point cloud completion has not been fully resolved.
+
+DDPM for point cloud generation. Luo & Hu (2021) are the first to use DDPM for unconditional point cloud generation. They use a Pointwise-net to generate point clouds, which is similar to a 2-stage PointNet used for point cloud part segmentation. However, the Pointwise-net could only receive a global feature. It can not leverage fine-grained local structures in the incomplete point cloud. Zhou et al. (2021) further use conditional DDPM for point cloud completion by training a point-voxel CNN (Liu et al., 2019), but the way they use the incomplete point cloud $^ c$ is different from ours. They directly concatenate $^ c$ with the noisy input $\mathbf { \boldsymbol { x } } ^ { t }$ , and feed them to a single pointvoxel CNN. This may hurt performance of the network, because the concatenated point cloud is very likely to be non-uniform. In addition, $\mathbf { \boldsymbol { x } } ^ { t }$ is very different from $^ c$ for large $t$ ’s due to the large noise magnitude in $\mathbf { \boldsymbol { x } } ^ { t }$ . Feeding two point clouds of very different properties to a single network at once could be quite confusing for the network. The other major difference is that they do not refine or upsample the coarse point cloud generated by DDPM like we do.
+
+# 5 EXPERIMENTS
+
+# 5.1 DATASETS
+
+We conduct point cloud completion experiments on the following three datasets. MVP. The MVP dataset (Pan et al., 2021) has 62400 training partial-complete point cloud pairs and 41600 testing pairs sampled from ShapeNet (Chang et al., 2015). Every partial point cloud has 2048 points. In particular, MVP dataset provides ground truth point clouds with different resolutions, including 2048, 4096, 8192, and 16384 points. MVP-40. The MVP-40 dataset (Pan et al., 2021) consists of 41600 training samples and 64168 testing samples from 40 categories in ModelNet40 (Wu et al., 2015). Its partial point clouds are sampled from complete point clouds with a pre-defined missing ratio, i.e., $50 \%$ , $2 5 \%$ and $1 2 . 5 \%$ missing. Both the partial and complete point clouds have 2048 points. Completion3D. It (Tchapmi et al., 2019) consists of 28974 point cloud pairs for training and 1184 for testing from 8 object categories in ShapeNet. Both the partial and complete point clouds have 2048 points. We find some pairs of the incomplete point cloud and complete point cloud have inconsistent scales in the Completion3D dataset. We correct the scales and use the corrected dataset in our experiments. See details in Appendix Section B.4.
+
+# 5.2 EVALUATION METRICS
+
+We use the Chamfer Distance (CD), Earth Mover Distance (EMD), and F1 score to evaluate the quality of the generated point clouds. CD distance is defined in Equation 5.
+
+Earth Mover Distance. Consider the predicted point cloud $V$ and the ground truth point cloud $\boldsymbol { X }$ of equal size $N = | V | = | X |$ , the EMD loss penalizes their shape discrepancy by optimizing a transportation problem. It estimates a bijection $\phi : V \longleftrightarrow X$ between $V$ and $\boldsymbol { X }$ :
+
+$$
+\mathcal { L } _ { \mathrm { E M D } } ( V , X ) = \operatorname* { m i n } _ { \phi : V : \longrightarrow X } \sum _ { v \in V } \big \| v - \phi ( v ) \big \| _ { 2 } .
+$$
+
+F1 score. To compensate the problem that CD loss can be sensitive to outliers, we follow previous methods (Pan et al., 2021; Tatarchenko et al., 2019) and use F1 score to explicitly evaluates the distance between object surfaces, which is defined as the harmonic mean between precision ${ \mathcal { L } } _ { \mathrm { P } } ( \rho )$ and recall $\mathcal { L } _ { \mathrm { R } } ( { \boldsymbol \rho } )$ : $\begin{array} { r } { \mathcal { L } _ { \mathrm { F 1 } } = \frac { 2 \mathcal { L } _ { \mathrm { P } } ( \rho ) \mathcal { L } _ { \mathrm { R } } ( \rho ) } { \mathcal { L } _ { \mathrm { P } } ( \rho ) + \mathcal { L } _ { \mathrm { R } } ( \rho ) } } \end{array}$ , where $\mathcal { L } _ { \mathrm { P } } ( \boldsymbol { \rho } ) = \frac { 1 } { | \boldsymbol { V } | } \sum _ { \boldsymbol { v } \in \boldsymbol { V } } \left[ \operatorname* { m i n } _ { \boldsymbol { x } \in \boldsymbol { X } } \big | \big | \boldsymbol { x } - \boldsymbol { v } \big | \big | ^ { 2 } < \boldsymbol { \rho } \right] , \mathcal { L } _ { \mathrm { R } } ( \boldsymbol { \rho } ) =$ $\frac { 1 } { | X | } \sum _ { x \in X } \left[ \operatorname* { m i n } _ { v \in V } \left\| x - v \right\| ^ { 2 } < \rho \right] .$ , and $\rho$ is a predefined distance threshold. We set $\rho = 1 0 ^ { - 4 }$ for the MVP and Completion3D datasets, and set $\rho = 1 0 ^ { - 3 }$ for the MVP-40 dataset.
+
+Table 1: Point cloud completion results on MVP, MVP-40 and Completion3D datasets at the resolution of 2048 points. CD loss is multiplied by $1 0 ^ { 4 }$ . EMD loss is multiplied by $\mathrm { \dot { 1 } 0 ^ { 2 } }$ . Scale factors of the two losses are the same in all the other tables. The two losses are the lower the better, while F1 score is the higher the better. Note that MVP-40 dataset has larger CD and EMD losses because objects in it have larger scales than the other two datasets. Results of MVP-40 dataset at $2 5 \%$ missing ratio is complemented in Appendix Table 5.
+
+
Method
MVP
MVP40 (50% missing)
MVP40 (12.5% missing)
Completion3D
CD
EMD
F1
CD
EMD
F1
CD
EMD
F1
CD
EMD
F1
PCN (Yuan et al., 2018)
8.65
1.95
0.342
39.67
6.37
0.581
32.56
6.18
0.619
8.81
3.03
0.315
TopNet (Tchapmi et al., 2019)
10.19
2.44
0.299
48.52
8.75
0.506
40.12
9.08
0.542
11.56
3.69
0.257
FoldingNet (Yang et al., 2018)
10.54
3.64
0.256
51.89
11.66
0.441
46.03
8.93
0.480
14.32
4.81
0.186
MSN (Liu et al., 2020)
7.08
1.71
0.434
34.33
9.70
0.646
20.20
4.54
0.728
8.88
2.69
0.359
Cascade (Wang et al., 2020)
6.83
2.14
0.436
34.16
15.40
0.635
26.73
5.71
0.657
7.31
2.70
0.408
ECG (Pan, 2020)
7.06
2.36
0.443
34.06
16.19
0.671
40.00
6.98
0.597
10.43
3.63
0.300
GRNet (Xie et al., 2020)
7.61
2.36
0.353
35.99
12.33
0.589
22.04
6.43
0.646
8.54
2.87
0.314
PMPNet (Wen et al.,2021)
5.85
3.42
0.475
25.41
29.92
0.721
13.00
8.92
0.815
7.45
4.85
0.386
VRCNet (Pan et al.,2021)
5.82
2.31
0.495
25.70
18.40
0.736
14.20
5.90
0.807
6.69
3.57
0.433
PDR paradigm (Ours)
5.66
1.37
0.499
27.20
2.68
0.739
12.70
1.39
0.827
7.10
1.75
0.451
+
+Table 2: Completion results on MVP dataset at the resolution of 4096, 8192, 16384 points.
+
+
#Points
4096
8192
16384
CD F1
CD F1
CD F1
PCNTopNet
7.140.4697.690.434
6.020.5776.640.526
5.180.6505.140.618
FoldingNet
8.760.351
6.900.433
6.980.464
MSN
5.370.583
4.400.663
4.090.696
Cascade
5.460.579
4.510.686
3.900.743
ECG
7.310.506
3.990.717
3.320.774
GRNet
5.730.493
4.510.616
3.540.700
PoinTrVRCNet
4.290.6384.620.629
3.520.7253.390.734
2.950.7832.810.780
Ours
4.260.649
3.350.754
2.610.817
+
+Table 3: Comparison of different network structures in term of training the conditional generation network and refinement network.
+
+
+
+# 5.3 POINT CLOUD COMPLETION
+
+We compare our point cloud completion method with previous state-of-the-art point cloud completion methods. The comparison is performed on MVP, MVP-40, and Completion3D datasets. Results are shown in Table 1. We also conduct multi-resolution experiments on the MVP dataset, and results are shown in Table 2. Detailed experimental setups are provided in Appendix Section B.1. We can see that our Conditional Point Diffusion-Refinement (PDR) paradigm outperforms other methods by a large margin in terms of EMD loss, which is highly indicative of uniformness (Zhang et al., 2021). We also achieve the highest F1 score and very low CD loss. Although VRCNet sometimes has lower CD loss than ours, it tends to put more points in the parts that are known in the incomplete point clouds, while put less points in the missing part (See Figure 10 in Appendix). In this way, its CD loss could be very low, but this non-uniformness is undesired and leads to very high EMD loss. We compare our method with other baselines in terms of visual quality of completed point clouds in Figure 4. We can see that our method generally has better visual quality. More samples are provided in Figure 9 and Figure 11 in Appendix. We also find that our PDR paradigm demonstrate some diversity in completion results as discussed in Appendix B.8.
+
+Ablation Study. We study the effect of attention mechanism, Point Adaptive Deconvolution (PADeconv) module, and Feature Transfer (FT) module in term of training the Conditional Generation Network and the Refinement Network. The experiments are conducted on MVP dataset at the resolution of 2048 points and results are shown in Table 3. “PA-Deonv & Att.” is our proposed complete network shown in Figure 2. “PA-Deonv” removes attention mechanism. “PointNet $+ + ^ { \prime }$ further removes PA-Deconv module. “Concate $\mathbf { \boldsymbol { x } } ^ { t }$ & $c ^ { \prime \prime }$ removes FT modules. It concatenates $^ c$ with $\mathbf { \boldsymbol { x } } ^ { t }$ as Zhou et al. (2021) do, and feed them to a single PointNe $^ { + + }$ with attention mechanism and PADeconv. “Pointwise-net” only utilizes a global feature extracted from the incomplete point cloud. We can see that these proposed modules indeed improve the networks’ performance. Note that the conditional generation networks in Table 3 are trained without data augmentation. Complete experimental results with data augmentation are presented in Appendix Section B.6. All the refinement networks are trained using data generated by our proposed complete dual-path network trained with data augmentation. If the other ablated networks use training data generated by themselves, they would have worse refinement results.
+
+
+Figure 4: Visual comparison of point cloud completion results on the MVP dataset (16384 points).
+
+
+Figure 5: Our method can be extended to controllable point cloud generation.
+
+DDPM acceleration. Kong & Ping (2021) propose to accelerate the generation process of DDPM by jumping steps in the reverse process. The method does not need retraining of the DDPM. We directly apply their method to our 3D point cloud generation network. However, we observe a considerable performance drop in the accelerated DDPM. On the MVP dataset (2048 points), the original 1000-step DDPM achieves $1 0 . 7 \times 1 0 ^ { - 4 }$ CD loss. CD losses of the accelerated 50-step and 20-step DDPMs increase to $1 3 . 2 \times 1 0 ^ { - 4 }$ and $1 8 . 1 \times 1 0 ^ { - 4 }$ , respectively. Fortunately, we can generate coarse point clouds using the accelerated DDPMs and use another Refinement Network to refine them. The refined point clouds of the 50-step and 20-step DDPMs bear CD losses of $5 . 6 8 \times 1 0 ^ { - 4 }$ and $5 . 7 8 \times 1 0 ^ { - 4 }$ , respectively. Compared with the original 1000-step DDPM, which has a CD loss of $5 . 6 6 \times 1 0 ^ { - 4 }$ , it’s quite temping to accept a slight drop in performance for an acceleration up to 50 times. Complete results of the acceleration experiment are presented in Appendix Section B.7.
+
+# 5.4 EXTENSION TO CONTROLLABLE GENERATION
+
+Our conditional PDR paradigm can be readily extended to controllable point cloud generation conditioned on bounding boxes of every part of an object. We sample points on the surfaces of the bounding boxes and regard this point cloud as the conditioner, just like the incomplete point cloud serves as the conditioner for point cloud completion. We conduct experiments on the chair category of PartNet (Mo et al., 2019) dataset. Two examples are shown in Figure 5. It’s interesting that our method can generate a shape different from the ground truth in some details, but be still plausible.
+
+# 6 CONCLUSION
+
+In this paper, we propose the Conditional Point Diffusion-Refinement (PDR) paradigm for point cloud completion. Our method effectively leverages the strong spatial correspondence between the adjacent parts of the incomplete point cloud and the complete point cloud through the proposed Feature Transfer module, which could also infer high-level 3D structural relations. We make improvements of the backbone PointNe $^ { + + }$ to make it capable of accurately manipulating positions of input points. Our method demonstrate significant advantages over previous methods, especially in terms of the overall distribution of the generated point cloud. We also find that our method has great potential to be applied in other conditional point cloud generation tasks such as controllable point cloud generation.
+
+# 7 ACKNOWLEDGEMENTS
+
+This work is partially supported by General Research Fund (GRF) of Hong Kong (No. 14205719).
+The authors thank useful discussions with Quan Wang from SenseTime and Tong Wu from CUHK.
+
+# REFERENCES
+
+Angel X. Chang, Thomas Funkhouser, Leonidas Guibas, Pat Hanrahan, Qixing Huang, Zimo Li, Silvio Savarese, Manolis Savva, Shuran Song, Hao Su, Jianxiong Xiao, Li Yi, and Fisher Yu. ShapeNet: An Information-Rich 3D Model Repository. Technical Report arXiv:1512.03012 [cs.GR], Stanford University — Princeton University — Toyota Technological Institute at Chicago, 2015.
+
+Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. arXiv preprint arXiv:2006.11239, 2020.
+
+Zhifeng Kong and Wei Ping. On fast sampling of diffusion probabilistic models. arXiv preprint arXiv:2106.00132, 2021.
+
+Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. DiffWave: A versatile diffusion model for audio synthesis. arXiv preprint arXiv:2009.09761, 2020.
+
+Minghua Liu, Lu Sheng, Sheng Yang, Jing Shao, and Shi-Min Hu. Morphing and sampling network for dense point cloud completion. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 11596–11603, 2020.
+
+Zhijian Liu, Haotian Tang, Yujun Lin, and Song Han. Point-voxel cnn for efficient 3d deep learning. arXiv preprint arXiv:1907.03739, 2019.
+
+Shitong Luo and Wei Hu. Diffusion probabilistic models for 3d point cloud generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2837–2845, 2021.
+
+Kaichun Mo, Shilin Zhu, Angel X Chang, Li Yi, Subarna Tripathi, Leonidas J Guibas, and Hao Su. Partnet: A large-scale benchmark for fine-grained and hierarchical part-level 3d object understanding. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 909–918, 2019.
+
+Alex Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. arXiv preprint arXiv:2102.09672, 2021.
+
+Liang Pan. Ecg: Edge-aware point cloud completion with graph convolution. IEEE Robotics and Automation Letters, 2020.
+
+Liang Pan, Xinyi Chen, Zhongang Cai, Junzhe Zhang, Haiyu Zhao, Shuai Yi, and Ziwei Liu. Variational relational point completion network. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8524–8533, 2021.
+
+Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 652–660, 2017a.
+
+Charles Ruizhongtai Qi, Li Yi, Hao Su, and Leonidas J Guibas. Pointnet++: Deep hierarchical feature learning on point sets in a metric space. 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., 2017b. URL https://proceedings.neurips.cc/paper/2017/file/ d8bf84be3800d12f74d8b05e9b89836f-Paper.pdf.
+
+Prajit Ramachandran, Barret Zoph, and Quoc V Le. Swish: a self-gated activation function. arXiv preprint arXiv:1710.05941, 7:1, 2017.
+
+Jascha Sohl-Dickstein, Eric A Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. arXiv preprint arXiv:1503.03585, 2015.
+
+Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020.
+
+Maxim Tatarchenko, Stephan R Richter, Rene Ranftl, Zhuwen Li, Vladlen Koltun, and Thomas ´ Brox. What do single-view 3d reconstruction networks learn? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3405–3414, 2019.
+
+Lyne P Tchapmi, Vineet Kosaraju, Hamid Rezatofighi, Ian Reid, and Silvio Savarese. Topnet: Structural point cloud decoder. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 383–392, 2019.
+
+Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
+
+Xiaogang Wang, Marcelo H Ang Jr, and Gim Hee Lee. Cascaded refinement network for point cloud completion. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 790–799, 2020.
+
+Xin Wen, Peng Xiang, Zhizhong Han, Yan-Pei Cao, Pengfei Wan, Wen Zheng, and Yu-Shen Liu. Pmp-net: Point cloud completion by learning multi-step point moving paths. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7443–7452, 2021.
+
+Zhirong Wu, Shuran Song, Aditya Khosla, Fisher Yu, Linguang Zhang, Xiaoou Tang, and Jianxiong Xiao. 3d shapenets: A deep representation for volumetric shapes. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1912–1920, 2015.
+
+Yaqi Xia, Yan Xia, Wei Li, Rui Song, Kailang Cao, and Uwe Stilla. Asfm-net: Asymmetrical siamese feature matching network for point completion, 2021.
+
+Haozhe Xie, Hongxun Yao, Shangchen Zhou, Jiageng Mao, Shengping Zhang, and Wenxiu Sun. Grnet: Gridding residual network for dense point cloud completion. arXiv preprint arXiv:2006.03761, 2020.
+
+Yaoqing Yang, Chen Feng, Yiru Shen, and Dong Tian. Foldingnet: Point cloud auto-encoder via deep grid deformation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 206–215, 2018.
+
+Xumin Yu, Yongming Rao, Ziyi Wang, Zuyan Liu, Jiwen Lu, and Jie Zhou. Pointr: Diverse point cloud completion with geometry-aware transformers. arXiv preprint arXiv:2108.08839, 2021.
+
+Wentao Yuan, Tejas Khot, David Held, Christoph Mertz, and Martial Hebert. Pcn: Point completion network. In 2018 International Conference on 3D Vision (3DV), pp. 728–737. IEEE, 2018.
+
+Junzhe Zhang, Xinyi Chen, Zhongang Cai, Liang Pan, Haiyu Zhao, Shuai Yi, Chai Kiat Yeo, Bo Dai, and Chen Change Loy. Unsupervised 3d shape completion through gan inversion. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1768–1777, 2021.
+
+Wenxiao Zhang, Qingan Yan, and Chunxia Xiao. Detail preserved point cloud completion via separated feature aggregation. arXiv preprint arXiv:2007.02374, 2020.
+
+Hengshuang Zhao, Li Jiang, Jiaya Jia, Philip Torr, and Vladlen Koltun. Point transformer. arXiv preprint arXiv:2012.09164, 2020.
+
+Linqi Zhou, Yilun Du, and Jiajun Wu. 3d shape generation and completion through point-voxel diffusion. arXiv preprint arXiv:2104.03670, 2021.
+
+# APPENDIX
+
+# A METHODOLOGY DETAILS
+
+# A.1 DETAILS OF THE DDPM
+
+Hyperparameters $\beta _ { t }$ . We define hyperparameters $\beta _ { t }$ in the diffusion process according to a linear schedule. We let $\beta _ { 1 } = 1 \times 1 0 ^ { - 4 }$ and $\bf { \dot { \beta } } _ { T } = 2 \times 1 0 ^ { - 2 }$ . Then, we define $\begin{array} { r } { \beta _ { t } = \frac { t - 1 } { T - 1 } \cdot ( \beta _ { T } - \beta _ { 1 } ) , t = } \end{array}$ $1 , 2 , \cdots , T$ .
+
+Diffusion step embedding. The network $\epsilon$ needs to output different $\epsilon _ { \theta } ( \pmb { x } ^ { t } , \pmb { c } , t )$ for different diffusion steps $t \in \{ 1 , \cdots , T \}$ . We first use positional encoding (Vaswani et al., 2017) to encode each $t$ into a $2 d _ { t }$ dimensional vector $\phi _ { \mathrm { e m b } } ( t ) = [ \sin ( \psi ( t ) ) , \cos ( \psi ( t ) ) ]$ , where
+
+$$
+\psi ( t ) = \left[ 1 0 ^ { \frac { 4 \times 0 } { d _ { t } } t } , 1 0 ^ { \frac { 4 \times 1 } { d _ { t } } t } , \cdot \cdot \cdot , 1 0 ^ { \frac { 4 \times ( d _ { t } - 1 ) } { d _ { t } } t } \right] .
+$$
+
+We set $d _ { t } = 6 4$ in experiments. Then, we use two fully-connected (FC) layers to transform $\phi _ { \mathrm { e m b } } ( t )$ into a 512 dimensional embedding vector (Ho et al., 2020). The first FC layer has input dimension $2 d _ { t } = 1 2 8$ and output dimension 512. The second FC layer has input dimension 512 and output dimension 512. Both layers are followed by the Swish activation function (Ramachandran et al., 2017).
+
+# A.2 NEIGHBOR DEFINITION
+
+In the Set Abstraction module and the Feature Transfer module, the neighbors are defined as the points that are within a specified distance to the center point. If a center point has more than $K$ neighbors, we randomly select $K$ neighbors from its neighbors. If a center point has less than $K$ neighbors, we pad it with dummy neighbors that has the same position as the center point, and has features of zeros. These dummy neighbors are excluded from the max-pooling operation. And in the attention mechanism, the weights of the dummy neighbors are manually set to 0. In this way, we can guarantee that a center point can always find $K$ neighbors. We set $K = 3 2$ in the Set Abstraction module and the Feature Transfer module. In the 4 levels of the Set Abstraction modules, the neighboring distance are set to 0.1, 0.2, 0.4, 0.8, respectively. In the 9 Feature Transfer modules, the neighboring distance are set to $0 . 1 , 0 . 2 , 0 . 4 , 0 . 8 , 1 , 6 , 0 . 8 , 0 . 4 , 0 . 2 , 0 . 1$ , respectively. Coordinates of samples in all datasets are normalized to the range $[ - 1 , 1 ]$ .
+
+In the Point Adaptive Deconvolution (PA-Deconv) modules of the Feature Propagation modules, the $K$ neighbors are defined as the $K$ nearest neighbors of the center point, and we set $K = 8$ for all Feature Propagation modules.
+
+# A.3 PROBLEMS OF VANILLA POINTNET $^ { + + }$
+
+Zhou et al. (2021) argue that PointNet $^ { + + }$ can not be used to train a DDPM. We observe the same phenomenon in our experiments. We find that this is because the density of the input noisy cloud $\bar { \boldsymbol { x } } ^ { t }$ is too low for large $t$ ’s. Recall that $\pmb { x } ^ { t } = \sqrt { \bar { \alpha } _ { t } } \pmb { x } ^ { 0 } + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon$ , where $\epsilon$ is a Gaussian noise. $\bar { \alpha } _ { t }$ goes to 0 for large $t$ ’s. This means $\mathbf { \boldsymbol { x } } ^ { t }$ is close to a Gaussian noise when $t$ is large. The density of a Gaussian noise is much lower than the complete point cloud $\pmb { x } ^ { 0 }$ . This is because points in $\mathbf { x } ^ { \mathrm { { 0 } } }$ concentrate on the surface of some object and $\mathbf { x } ^ { 0 }$ is normalized to the range $[ - 1 , 1 ]$ , while points from a standard Gaussian distribution could fill the whole space in the range of $[ - 3 , 3 ]$ .
+
+PointNet++ is originally designed to process point clouds like $\mathbf { \boldsymbol { x } } ^ { 0 }$ . It’s selection of distances to define neighbors described in Appendix Section A.2 is suitable for point clouds that have the same level of density as $\mathbf { \boldsymbol { x } } ^ { 0 }$ , but can not handle point clouds close to a Gaussian noise. Indeed, we find the average number of neighbors for each point in the four levels of the Set Abstraction modules are 22.3984, 29.9133, 29.3266, 27.8375, respectively, for 10 random shapes sampled from the MVP dataset. In constrast, the average number of neighbors for each point in the four levels are $1 . 0 8 6 4 , 1 , 1 , 1$ for 10 random point clouds sampled from the Gaussian distribution. Note that each point itself is considered to be a neighbor of itself. This means most points do not have any neighbors besides itself in a Gaussian noise.
+
+PointNet $^ { + + }$ only utilizes the relative positions of input points. The input feature of each point to the first Set Abstraction module is its relative position to the center point, which is subsampled from the original input points by farthest point sampling. No information can be extracted when points do not have neighbors. This is the reason why PointNet $^ { + + }$ can not be directly used to train a DDPM.
+
+Our solution is to attach the absolute position of each point to its feature. This guarantees that a point at least can utilize its own position to decide which direction to move when it does not have neighbors. Afterall, a point cloud with large magnitude noises does not have many meaningful structures. There is not much information in the relative positions of points. Another solution is to change the definition of neighbors: From points within a specified distance to K-nearest neighbors. This guarantees that a point always has $K$ neighbors. We conduct experiments to compare these two solutions, and we find that their performances are basically the same. Therefore, we just stick to the original neighbor definitions in PointNet++.
+
+# A.4 ATTENTION MECHANISM
+
+In Section 3.2 in the main text, we mentioned that we use the attention mechanism instead of maxpooling to aggregate features at the neighboring points to the center point. We take the Set Abstraction module as an example to elaborate on the attention mechanism. Attention mechanism in the Feature Propagation module and Feature Transfer module is similarly designed.
+
+Assume we want to propagate features from $\{ x _ { j } | 1 \le j \le N _ { l } \}$ to $\{ y _ { k } | 1 \le k \le N _ { l + 1 } \}$ . Each point in $\{ x _ { j } | 1 \le j \le N _ { l } \}$ has a feature of dimension $d _ { l }$ . We concatenate these features with their corresponding 3D coordinates and group them together to form a matrix $\pmb { F } _ { l }$ of shape $N _ { l } \times ( d _ { l } + 3 )$ . We finds $K$ neighbors in the input set $\bar { \{ x _ { j } \vert 1 \leq \bar { j } } \leq N _ { l } \}$ for each $y _ { k }$ . These neighbors together with their features are grouped together to form a matrix $G _ { i n }$ of shape $N _ { l + 1 } \times K \times ( d _ { l } + 3 )$ . Then a shared multi-layer perceptron (MLP) is applied to transform the grouped feature $G _ { i n }$ to $G _ { o u t }$ , which is a matrix of shape $N _ { l + 1 } \times K \times d _ { l + 1 }$ and $d _ { l + 1 }$ is the dimension of the output feature.
+
+In our attention mechanism, $G _ { i n }$ (shape $N _ { l + 1 } \times K \times ( d _ { l } + 3 ) )$ will act like keys, $G _ { o u t }$ (shape $N _ { l + 1 } \times K \times d _ { l + 1 } )$ will act like values, while the original features at $\{ y _ { k } | 1 \le k \le N _ { l + 1 } \}$ will act like queries. Since $\{ y _ { k } | 1 \le k \le N _ { l + 1 } \}$ is a subset of $\{ x _ { j } | 1 \le j \le N _ { l } \}$ , we can group the original features at $\{ y _ { k } | 1 \le k \le N _ { l + 1 } \}$ to form a matrix $Q$ , which is of shape $N _ { l + 1 } \times ( d _ { l } + 3 ) . 6$ $Q$ is first repeated $K$ times into a matrix of shape $N _ { l + 1 } \times K \times ( d _ { l } + 3 )$ . Then this matrix is passed through a shared MLP and transformed into a matrix $\pmb { Q } ^ { \prime }$ , which is of shape $N _ { l + 1 } \times K \times d _ { q u e r y }$ . Next, we pass $G _ { i n }$ through a shared MLP to transform it into a new matrix ${ \bf { { G } } } _ { i n } ^ { \prime }$ , which is of shape $N _ { l + 1 } \times K \times d _ { k e y }$ . We concatenate the query matrix $\pmb { Q } ^ { \prime }$ with the key matrix ${ \bf { { G } } } _ { i n } ^ { \prime }$ along the feature dimension. We denote this matrix as $[ \bar { Q ^ { \prime } } , \bar { G } _ { i n } ^ { \prime } ]$ , which is of shape $N _ { l + 1 } \times K \stackrel { \cdots } { \times } ( d _ { q u e r y } + d _ { k e y } )$ . $[ Q ^ { \prime } , G _ { i n } ^ { \prime } ]$ is passed through a shared MLP to obtain the scores of all the $K$ neighbors. We denote the scores as matrix $_ { s }$ of shape $N _ { l + 1 } \times K \times d _ { l + 1 }$ . Note that $_ { s }$ has the same shape as $G _ { o u t }$ . And the scores $\pmb { S }$ of the $K$ neighbors are adaptively computed according to the feature at the center point $y _ { k }$ and features at its $K$ neighbors $\{ x _ { j } | j \in B _ { x } ( y _ { k } ) \}$ . We apply a softmax operation along the neighbor dimension (the second dimension) of $_ { s }$ to obtain the weight matrix of all the $K$ neighbors. We denote it as $W$ , which is of shape $N _ { l + 1 } \times K \times d _ { l + 1 }$ . Note that we manually set the weights of the padded dummy neighbors to 0 in $W$ . Then the weight matrix $W$ and the value matrix $G _ { o u t }$ are dot producted along the neighbor dimension (the second dimension) to form the output matrix ${ \pmb F } ^ { \prime }$ , which is of shape $N _ { l + 1 } \times d _ { l + 1 }$ . Finally, $\pmb { F } ^ { \prime }$ is concatenated with the 3D coordinates of the set $\{ y _ { k } | 1 \le k \le N _ { l + 1 } \}$ to form output of the Set Abstraction module, $\mathbf { \Delta } F _ { l + 1 }$ , which is a matrix of shape $N _ { l + 1 } \times ( d _ { l + 1 } + 3 ) .$
+
+# A.5 PROBLEMS WITH THREE INTERPOLATION
+
+The original PointNet $^ { + + }$ uses three interpolation to upsample features in the Feature Propagation module. We think that the three interpolation operation is suitable for tasks like point cloud part segmentation, but not suitable in our task. Interpolation means that points close to each other have similar features. Points close to each other tend to have similar semantic labels in a clean point cloud, therefore it is meaningful to use interpolation operation to upsample features in the part segmentation task. However, in our task, the network need to predict a per-point displacement for all points in a noisy point cloud and move it towards a clean point cloud. Points close to each other do not need to move in a similar direction in general. In fact, they may just need to move towards the opposite direction to form a smooth surface.
+
+We also find that the three interpolation operation lacks the ability to manipulate positions of points accurately in small scales. We first elaborate on the three interpolation operation used in the original PointNet $^ { + + }$ . Assume we want to upsample features at $\{ y _ { k } | 1 \stackrel { \cdot } { \leq } k \leq \dot { N } _ { l + 1 } \}$ to $\{ x _ { j } | 1 \le j \le \mathsf { \bar { N } } _ { l } \}$ , where $\{ y _ { k } | 1 \le k \le N _ { l + 1 } \}$ is a subset of $\{ x _ { j } | 1 \le j \le \dot { N _ { l } } \}$ .
+
+For each $x _ { j }$ , assume its three nearest neighbors in $\{ y _ { k } | 1 \le k \le N _ { l + 1 } \}$ are $\{ y _ { k } | k \in B _ { y , 3 } ( x _ { j } ) \}$ . Then feature at $x _ { j }$ is obtained through the following equation:
+
+$$
+f ( x _ { j } ) = \frac { \sum _ { k \in \mathcal { B } _ { y , 3 } ( x _ { j } ) } w ( y _ { k } , x _ { j } ) f ( y _ { k } ) } { \sum _ { k \in \mathcal { B } _ { y , 3 } ( x _ { j } ) } w ( y _ { k } , x _ { j } ) } , \mathrm { ~ w h e r e ~ } w ( y _ { k } , x _ { j } ) = \frac { 1 } { | | y _ { k } - x _ { j } | | ^ { 2 } } ,
+$$
+
+$f ( y _ { k } )$ and $f ( x _ { j } )$ are features at $y _ { k }$ and $x _ { j }$ , respectively. We can see that the value of $f ( x _ { j } )$ is determined by the relative distances between itself and its three nearest neighbors. However, in 3D space, the point that has a specific relative distances to three fixed points is not unique. In fact, the point can move freely on a curve.
+
+Let’s take a very simple example, assume the three nearest neighbors of $x _ { j }$ forms a regular triangle. If we move $x _ { j }$ along the straight line that passes the center of the triangle and is perpendicular to the plane determined by the triangle, then $x _ { j }$ will always have the same relative distances from the three points, which means $x _ { j }$ will always have the same interpolated feature, as long as its movement is small enough that its three nearest neighbors do not change.
+
+This property makes the three interpolation operation not able to distinguish some specific points in a small scale, since these points could have the same interpolated value. Therefore, three interpolation operation is not suitable for our task, as we need to accurately manipulate positions of points to make them form a meaningful shape with smooth surfaces and sharp details.
+
+# B EXPERIMENT
+
+# B.1 DETAILED EXPERIMENTAL SETUP
+
+In all experiments, we use the Adam optimizer with a learning rate of $2 \times 1 0 ^ { - 4 }$ . For experiments of our PDR paradigm in Table 1 and Table 2 in the main text, we use data augmentation described in Appendix Section B.3. We train our Conditional Generation Network for 340 epochs, 200 epochs, and 500 epochs on the MVP, MVP-40, and Completion3D datasets, respectively. We save a checkpoint and evaluate the network’s performance on both the training set and the test set every 20 epochs. Since the generation process of DDPM is very slow, we randomly select 1600 samples from the training set and test set respectively for evaluation. (Test set of the Completion3D dataset has less than 1600 samples. Therefore, we use all samples in the test set for evaluation.) The checkpoint with the lowest CD loss is chosen as the best network. It is used to generate training data for the Refinement Network. We train the Refinement Network for 100 epochs, 150 epochs and 200 epochs on the MVP, MVP-40, and Completion3D datasets, respectively.
+
+Note that we subsampling the test set only when we try to choose a best checkpoint in the training process of the conditional generation network in DDPM. After choosing the best checkpoint, we use it to generate training data to train the refinement network. However, when we evaluate the whole PDR paradigm (composed of the conditional generation network and refinement network) and compare with previous methods, we evaluate them on the complete test set. Therefore, the comparison result in Table 1 and Table 2 in the main text is reliable and fair.
+
+For ablation studies in Table 3, the Conditional Generation Networks are trained without data augmentation for 300 epochs. All the Refinement Networks are trained on the same data generated by our proposed Conditional Generation Network trained with data augmentation. The Refinement Networks are trained for 100 epochs.
+
+All baseline methods are rerun under the data augmentation described in Appendix Section B.3 according to their open source codes. And CD loss is chosen to train all the baseline methods.
+
+
+Figure 6: Detailed network structure.
+
+# B.2 DETAILS OF THE NETWORK STRUCTURE.
+
+Detailed network structure is shown in Figure 6. We present the number of points and feature dimension in each level of the Feature Extraction network and the Denoise network. The distances to define neighbors are provided in Appendix Section A.2.
+
+# B.3 DATA AUGMENTATION
+
+We use rotation, mirror, translation, and scaling as data augmentation methods during training. Rotation is performed along the upward direction of the shapes. The upward direction is the $y$ -axis in MVP dataset and Completion3D dataset, while upward direction in the MVP-40 dataset is the $z$ - axis. And the rotation angle is uniformly sampled from the interval $[ - a , a ]$ , where $a$ is a predefined hyper-parameter that controls the magnitude of the rotation.
+
+Mirror operation is performed with respect to the two planes that are parallel to the upward direction: $x = 0$ plane and $z = 0$ plane for MVP dataset and Completion3D dataset, $x = 0$ plane and $y = 0$ plane for MVP-40 dataset. The mirror operation is performed with a probability of $m / 2$ with respect to the two planes, respectively. $m$ is a predefined hyper-parameter the controls the probability of the mirror operation.
+
+Same as some previous works (Wang et al., 2020; Xia et al., 2021), we observe that most objects in the MVP dataset and Completion3D dataset have reflection symmetry with respect to the $x y$ plane. Therefore, we mirror the partial input with respect to this plane and concatenate the mirrored points with the original partial input for these two datasets. We subsample this concatenated point cloud from 4096 points to 3072 points by farthest point sampling to obtain a uniform point cloud. We label the original points with 1 and the mirrored points with $- 1$ . This concatenated point cloud is feed to both the Conditional Generation Network and the Refinement Network, so that they could learn whether an object has reflection symmetry and determine whether to utilize the mirrored points according to their $- 1$ label.
+
+Translation is achieved by adding a randomly sampled 3D vector to every point in the incomplete point cloud and the complete point cloud. Each component of the 3D translation vector is sampled from a Gaussian distribution with zero mean and standard deviation of $\sigma$ , where $\sigma$ is a predefined hyper-parameter the controls the magnitude of the translation operation.
+
+We also randomly samples a scaling factor uniformly from the interval $[ \delta _ { l o w } , \delta _ { h i g h } ]$ when loading a training pair. The scaling factor is multiplied to the coordinates of all points in the incomplete point cloud and the complete point cloud.
+
+We observe that data augmentations can prevent the network from overfitting on the training set, but could also lead to performance drop on the test set. Therefore, we use different data augmentation schemes to train the Conditional Generation Network in the DDPM and the Refinement Network. When training the Conditional Generation Network, we hope the network does not overfit on the training set, because we need it to generate training samples to train the Refinement Network. Therefore, we use data augmentations of large magnitudes to train the Conditional Generation Network. However, when training the Refinement Network, high performance is the top priority. Therefore, we use data augmentations of small magnitudes to train the Refinement Network. We also use data augmentation to train baseline methods. The data augmentations are the same ones that we use to train the Refinement Network. The details of the data augmentation is shown in Table 4.
+
+Table 4: Data augmentations used in MVP, MVP-40 and Completion3D dataset by the conditional generation network, refinement network, and all baselines.
+
+
Conditional Generation Network
Refinement Network and other Baselines
Rotation
Mirror
Translation
Scaling
Rotation
Mirror
Translation
Scaling
MVP
a =90°
m =0.5
σ=0.1
[1/1.2,1.2]
a=3°
m=0.5
σ = 0.005
[1/1.01,1.01]
MVP-40
a=0°
m = 0.5
σ=0
[1/1.2,1.2]
a =3°
m = 0.5
g= 0.005
[1/1.01,1.01]
Completion3D
a =10°
m =0.2
σ= 0.01
[0.66,1]
a=3°
m=0.1
σ = 0.005
[0.66,1]
+
+# B.4 SCALE-INCONSISTENCY ISSUE OF THE COMPLETION3D DATASET
+
+We find that many pairs of incomplete-complete point clouds have inconsistent scales in the Completion3D dataset. A few inconsistent examples are shown in Figure 7. Ideally, the incomplete point should overlap with the complete point cloud in 3D space, but many incomplete-complete pairs in the Completion3D dataset cannot overlap with each other due to inconsistent scales, which misleads the network training. Moreover, the scale-inconsistency issue also gives rise to unreliable evaluation results, as we expect the network to predict a complete point cloud of a consistent scale with the incomplete point cloud. Therefore, it is necessary to correct the scales of these pairs before using the dataset.
+
+
+Figure 7: The first row shows some inconsistent pairs of the incomplete point cloud and complete point cloud from the Completion3D dataset. The second row are the corrected pairs by minimizing the one-side CD loss.
+
+We leverage the one-side CD loss to identify and correct these pairs. For a consistent pair of the incomplete point cloud $C$ and complete point cloud $\boldsymbol { X }$ , the one-side CD loss should be very low:
+
+$$
+\mathcal { L } _ { \mathrm { 1 - S i d e C D } } ( C , X ) = \frac { 1 } { | C | } \sum _ { c \in C } \operatorname* { m i n } _ { x \in X } | | c - x | | ^ { 2 } .
+$$
+
+We find the correct scale of the incomplete point cloud by optimizing the following problem
+
+$$
+\operatorname* { m i n } _ { \delta } \mathcal { L } _ { \mathrm { 1 - S i d e } \mathrm { C D } } ( \delta C , X ) .
+$$
+
+This optimization problem is solved by using the python package scipy.optimize.fmin for every pair of point clouds in the Completion3D dataset. We consider the pairs with a scale factor $\delta$ greater than 1.05 or less than 0.95 as inconsistent pairs, and then correct its scale inconsistency by multiplying the scale factor $\delta$ to these incomplete point clouds. In the training set, we find $2 . { \dot { 8 } } 1 \%$ pairs are inconsistent. The inconsistent pairs are also discovered in the validation set. We can not verify the test set because the ground truth complete point cloud is not released.
+
+We did not use the online Completion3D benchmark server to evaluate our method and previous methods for the following reasons: 1) the website server was out of service, as it gave no feedback for any submissions at the time we conduct this work; 2) the ground truth complete point clouds in test set of the Completion3D dataset are not released, and hence we can not verify whether this inconsistency problem is also present in the test set. Therefore, we use the test set provided in the work (Wang et al., 2020), which contains 1200 pairs of incomplete-complete point clouds for testing. It contains the same set of objects as the test set of the original Completion3D dataset. After correcting inconsistent pairs in this test set, we evaluate our method and previous methods on this revised test set to achieve fair and reliable comparisons.
+
+# B.5 COMPLETE EXPERIMENT RESULTS FOR MVP-40 DATASET
+
+In Table 1 in the main text, we only present the completion result at the missing ratio of $50 \%$ and $12 . 5 \%$ for the MVP-40 dataset. We present the complete experiment result on MVP-40 dataset including result at the $2 5 \%$ missing ratio in Table 5 below.
+
+Table 5: Complete Point cloud completion results on MVP-40 dataset. The missing ratio is at $50 \%$ $2 5 \%$ and $1 2 . 5 \%$ , respectively. CD loss is multiplied by $1 0 ^ { 4 }$ . EMD loss is multiplied by $1 0 ^ { 2 }$ .
+
+
Method
MVP40 (50% missing)
MVP40 (25%6missing)
MVP40 (12.5% missing)
CD EMD F1
CD EMD F1
CD EMD F1
PCN (Yuan et al., 2018)TopNet (Tchapmi et al., 2019)FoldingNet (Yang et al., 2018)
39.67 6.37 0.581
34.40 6.21 0.606
32.566.18 0.619
48.52 8.75 0.506
42.3910.25 0.520
40.129.08 0.542
51.8911.66 0.441
45.99 9.85 0.475
46.038.93 0.480
MSN (Liu et al., 2020)Cascade (Wang et al., 2020)ECG (Pan,2020)
MSN (Liu et al., 2020)Cascade (Wang et al., 2020)
34.33 9.70 0.646
23.14 6.59 0.712
20.204.54 0.728
34.1615.40 0.635
29.13 8.16 0.647
26.735.71 0.657
ECG (Pan,2020)
34.0616.19 0.671
28.01 10.79 0.717
16.906.20 0.774
GRNet (Xie et al.,2020)PMPNet (Wen et al., 2021)VRCNet (Pan et al.,2021)
35.9912.33 0.589
25.84 8.43 0.626
25.4129.92 0.72125.7018.40 0.736
15.73 16.08 0.815
13.008.92 0.815
18.2810.96 0.776
14.205.90 0.807
PDR paradigm (Ours)
27.20 2.68 0.739
16.54 1.68 0.800
12.701.39 0.827
+
+B.6 COMPLETE EXPERIMENT RESULTS FOR NETWORK ABLATION STUDY
+
+Table 6: Comparison of coarse point clouds generated by conditional generation networks of different structures on MVP dataset at the resolution of 2048 points. Experiments are conducted under two circumstances: with and without data augmentation. The networks without data augmentation are trained for 300 epochs, and networks with data augmentation are trained for 600 epochs. The data augmentation we use is specified in Table 4 for the MVP dataset. We report the networks’ performance on both the training set and the test set. We can see the overfitting problem is largely mitigated by data augmentation.
+
+
+
+In Section 5.3 in the main text, we conduct ablation study of our proposed network architecture, and results are shown in Table 3. Note that the conditional generation networks in DDPM in Table 3 are trained without data augmentation. However, it is actually very important to train the conditional generation networks with data augmentation, because we need to prevent it from overfitting on the training set, so that they can generate coarse point clouds of consistent distribution on the training set and test set to train the refinement network. Therefore, we provide the training results with data augmentation in Table 6. The data augmentation is specified in Table 4 for MVP dataset.
+
+Same as Table 3 in the main text, “PA-Deonv & Att.” is our proposed complete network shown in Figure 2. “PA-Deonv” is our network without attention mechanism. “PointNet $+ + { } ^ { \because }$ further removes the PA-Deconv module. “Concate $\mathbf { \boldsymbol { x } } ^ { t }$ & $c ^ { \prime \prime }$ removes FT modules. It concatenates $^ c$ with $\mathbf { \boldsymbol { x } } ^ { t }$ as Zhou et al. (2021) do, and feed them to a single PointNe $^ { + + }$ with attention mechanism and PA-Deconv. “Pointwise-net” only utilizes a global feature extracted from the incomplete point cloud. We can see that these proposed modules indeed improve the networks’ performance. Our proposed networks achieve superior results both with and without data augmentation.
+
+We also observe that networks generally achieve better performance on both the training set and test set without data augmentation, but they tend to overfit on the training set. This is undesirable because we need these conditional generation networks to generate training data for the refinement networks. It is very important for them to generate coarse point clouds that have consistent distributions on the training set and the test set. Indeed, we can see that the overfitting problem is largely mitigated in the presence of data augmentation.
+
+# B.7 COMPLETE EXPERIMENT RESULTS FOR DDPM ACCELERATION
+
+The complete experiment results of the DDPM acceleration is shown in Table 7. We can see that the quality of coarse point clouds generated by the accelerated DDPMs has dropped considerably. However, with the help of the Refinement Network, the performance drop of the final refined point clouds is slight. This demonstrates the strong refinement capability of our proposed network architecture shown in Figure 2 in the main text.
+
+Table 7: Refine coarse point clouds generated by the accelerated DDPMs on the MVP dataset at the resolution of 2048 points. We can see performance drop is slight for the refined point clouds. We also report the average generation time of a single point cloud evaluated on one NVIDIA GEFORCE RTX 2080 Ti GPU for DDPM of different reverse steps.
+
+
Number of Reverse Steps
Average Generation Time
CD
EMD
F1
Coarse
Refined
Coarse
Refined
Coarse
Refined
1000 (Original)
16.86 s
10.69
5.66
1.46
1.37
0.400
0.499
50
0.78 s
13.19
5.68
1.65
1.47
0.341
0.493
20
0.32 s
18.12
5.78
1.99
1.56
0.255
0.474
+
+
+Figure 8: Our PDR paradigm demonstrates diversity in the completion results. For each object, the two images in the first row are coarse completion results from a trained DDPM generated in two trials for the same incomplete point cloud. The two images in the second row are refined results for the two coarse point clouds, respectively. We can see that some diversity is preserved after the refinement.
+
+# B.8 GENERATION DIVERSITY OF THE PDR PARADIGM
+
+In this section, we discuss whether the PDR Paradigm can generate diverse completion results for the same incomplete point cloud. Although there is no stochasticity in the refinement network, we find our PDR paradigm still demonstrates some kind of diversity in the completion results.
+
+We know that DDPM itself is a probabilistic model and can generate diverse completion results. The refinement network receives a coarse completion from the DDPM and then refines it according to the condition point cloud, i.e., the incomplete point cloud. The final refined result surely depends on the condition point cloud, but also depends on the coarse point cloud received from the DDPM. The refinement network can only refine the coarse point cloud in a small scale, because we multiply the output of the refinement network by a small constant $\gamma = 0 . 0 0 1$ as described in Section 3.3 in the main text. Therefore, the overall sketch of the coarse point cloud will be preserved after the refinement. This explains why the PDR paradigm still bears low EMD loss as the DDPM, even though we use CD loss to train the refinement network, because the refinement network does not change the overall distribution of the coarse shape generated by DDPM.
+
+Back to the diversity issue, if the coarse completion results from DDPM demonstrate diversity for the same incomplete point cloud, the refined point clouds will also demonstrate some diversity because the inputs to the refinement network are different. Figure 8 shows some examples where the PDR paradigm demonstrate diversity in the completion results.
+
+
+Figure 9: Visual comparison of our method and other baselines. Samples are from the MVP dataset at the resolution of 16384 points. We can see that point clouds generated by our method generally have better visual quality.
+
+
+Figure 10: Visual comparison of our method and VRCNet. Samples are from the MVP dataset at the resolution of 16384 points. We can see that VRCNet sometimes tend to predict more points to the parts that are known in the incompelte point cloud, while put less points at the missing part. This could effectively reduce CD loss, but leads to large EMD loss. Compared with VRCNet, our method generally generates more uniform point clouds.
+
+
+Figure 11: Visual comparison of our method and PoinTr. Samples are from the MVP dataset at the resolution of 16384 points. We can see that PoinTr sometimes tend to predict more points at the skeleton of objects, while points on surfaces seem sparse. Compared with PoinTr, our method generally generates more uniform point clouds.
+
+
+Figure 12: Visual comparison of coarse point clouds generated by the Conditional Generation Network in DDPM and point clouds after refinement. Samples are from the MVP dataset at the resolution of 2048 points. We can see that coarse point clouds generated by the Conditional Generation Network basically uniformly cover the overall shape of objects, but tend to be noisy. After refinement, point clouds demonstrate both good overall density distribution and sharp local details.
\ No newline at end of file
diff --git a/md/dev/wtqb7pNL4e/wtqb7pNL4e.md b/md/dev/wtqb7pNL4e/wtqb7pNL4e.md
new file mode 100644
index 0000000000000000000000000000000000000000..bf5c522b73c3f896cb1fbe4d059995a095aae291
--- /dev/null
+++ b/md/dev/wtqb7pNL4e/wtqb7pNL4e.md
@@ -0,0 +1,281 @@
+# Can ChatGPT Assess Human Personalities? A General Evaluation Framework
+
+Haocong Rao1,2 Cyril Leung2,3 Chunyan Miao1,2∗ $^ { 1 }$ School of Computer Science and Engineering, Nanyang Technological University, Singapore 2LILY Research Centre, Nanyang Technological University, Singapore 3Department of Electrical and Computer Engineering The University of British Columbia, Canada {haocong001,ascymiao}@ntu.edu.sg {cleung}@ece.ubc.ca
+
+# Abstract
+
+Large Language Models (LLMs) especially ChatGPT have produced impressive results in various areas, but their potential human-like psychology is still largely unexplored. Existing works study the virtual personalities of LLMs but rarely explore the possibility of analyzing human personalities via LLMs. This paper presents a generic evaluation framework for LLMs to assess human personalities based on Myers–Briggs Type Indicator (MBTI) tests. Specifically, we first devise unbiased prompts by randomly permuting options in MBTI questions and adopt the average testing result to encourage more impartial answer generation. Then, we propose to replace the subject in question statements to enable flexible queries and assessments on different subjects from LLMs. Finally, we re-formulate the question instructions in a manner of correctness evaluation to facilitate LLMs to generate clearer responses. The proposed framework enables LLMs to flexibly assess personalities of different groups of people. We further propose three evaluation metrics to measure the consistency, robustness, and fairness of assessment results from state-ofthe-art LLMs including ChatGPT and GPT-4. Our experiments reveal ChatGPT’s ability to assess human personalities, and the average results demonstrate that it can achieve more consistent and fairer assessments in spite of lower robustness against prompt biases compared with InstructGPT†.
+
+# 1 Introduction
+
+Pre-trained Large Language Models (LLMs) have been widely used in many applications including translation, storytelling, and chatbots (Devlin et al., 2019; Raffel et al., 2020; Yang et al., 2022; Yuan et al., 2022; Ouyang et al., 2022; Bubeck et al.,
+
+2023). ChatGPT (Ouyang et al., 2022) and its enhanced version GPT-4 are currently recognized as the most capable chatbots, which can perform context-aware conversations, challenge incorrect premises, and reject inappropriate requests with a vast knowledge base and human-centered finetuning. These advantages make them well-suited for a variety of real-world scenarios such as business consultation and educational services (Zhai, 2022; van Dis et al., 2023; Bubeck et al., 2023).
+
+Recent studies have revealed that LLMs may possess human-like self-improvement and reasoning characteristics (Huang et al., 2022; Bubeck et al., 2023). The latest GPT series can pass over $90 \%$ of Theory of Mind (ToM) tasks with strong analysis and decision-making capabilities (Kosinski, 2023; Zhuo et al., 2023; Moghaddam and Honey, 2023). In this context, LLMs are increasingly assumed to have virtual personalities and psychologies, which plays an essential role in guiding their responses and interaction patterns (Jiang et al., 2022). Based on this assumption, a few works (Li et al., 2022; Jiang et al., 2022; Karra et al., 2022; Caron and Srivastava, 2022; Miotto et al., 2022) apply psychological tests such as Big Five Factors (Digman, 1990) to evaluate their pseudo personalities (e.g., behavior tendency), so as to detect societal and ethical risks (e.g., racial biases) in their applications.
+
+Although existing works have investigated the personality traits of LLMs, they rarely explored whether LLMs can assess human personalities. This open problem can be the key to verifying the ability of LLMs to perform psychological (e.g., personality psychology) analyses and revealing their potential understanding of humans, i.e., “How do LLMs think about humans?”. Specifically, assessing human personalities from the point of LLMs (1) enables us to access the perception of LLMs on humans to better understand their potential response motivation and communication patterns (Jiang et al., 2020); (2) helps reveal whether LLMs possess biases on people so that we can optimize them (e.g., add stricter rules) to generate fairer contents; (3) helps uncover potential ethical and social risks (e.g., misinformation) of LLMs (Weidinger et al., 2021) which can affect their reliability and safety, thereby facilitating the development of more trustworthy and human-friendly LLMs.
+
+To this end, we introduce the novel idea of letting LLMs assess human personalities, and propose a general evaluation framework (illustrated Fig. 1) to acquire quantitative human personality assessments from LLMs via Myers–Briggs Type Indicators (MBTI) (Myers and McCaulley, 1985). Specifically, our framework consists of three key components: (1) Unbiased prompts, which construct instructions of MBTI questions using randomlypermuted options and average testing results to achieve more consistent and impartial answers; (2) Subject-replaced query, which converts the original subject of the question statements into a target subject to enable flexible queries and assessments from LLMs; (3) Correctness-evaluated instruction, which re-formulates the question instructions for LLMs to analyze the correctness of the question statements, so as to obtain clearer responses. Based on the above components, the proposed framework re-formulates the instructions and statements of MBTI questions in a flexible and analyzable way for LLMs, which enables us to query them about human personalities. Furthermore, we propose three quantitative evaluation metrics to measure the consistency of LLMs’ assessments on the same subject, their assessment robustness against random perturbations of input prompts (defined as “prompt biases”), and their fairness in assessing subjects with different genders. In our work, we mainly focus on evaluating ChatGPT and two representative state-of-the-art LLMs (InstructGPT, GPT4) based on the proposed metrics. Experimental results showcase the ability of ChatGPT in analyzing personalities of different groups of people. This can provide valuable insights for the future exploration of LLM psychology, sociology, and governance.
+
+Our contributions can be summarized as follows:
+
+• We for the first time explore the possibility of assessing human personalities by LLMs, and propose a general framework for LLMs to conduct quantitative evaluations via MBTI.
+
+• We devise unbiased prompts, subject-replaced queries, and correctness-evaluated instructions to encourage LLMs to perform a reliable flexible assessment of human personalities.
+
+• We propose three evaluation metrics to measure the consistency, robustness, and fairness of LLMs in assessing human personalities.
+
+• Our experiments show that both ChatGPT and its counterparts can independently assess human personalities. The average results demonstrate that ChatGPT and GPT-4 achieve more consistent and fairer assessments with less gender bias than InstructGPT, while their results are more sensitive to prompt biases.
+
+# 2 Related Works
+
+Personality Measurement. The commonly-used personality modeling schemes include the three trait personality measure (Eysenck, 2012), the Big Five personality trait measure (Digman, 1990), the Myers–Briggs Type Indicator (MBTI) (Myers, 1962; Myers and McCaulley, 1985), and the 16 Personality Factor questionnaire (16PF) (Schuerger, 2000). Five dimensions are defined in the Big Five personality traits measure (Digman, 1990) to classify major sources of individual differences and analyze a person’s characteristics. MBTI (Myers and McCaulley, 1985) identifies personality from the differences between persons on the preference to use perception and judgment. (Karra et al., 2022; Caron and Srivastava, 2022) leverage the Big Five trait theory to quantify the personality traits of language models, while (Jiang et al., 2022) further develops machine personality inventory to standardize this evaluation. In (Li et al., 2022), multiple psychological tests are combined to analyze the LLMs’ safety. Unlike existing studies that evaluate personalities of LLMs, our work is the first attempt to explore human personality analysis via LLMs.
+
+Biases in Language Models. Most recent language models are pre-trained on the large-scale datasets or Internet texts that usually contains unsafe (e.g., toxic) contents, which may cause the model to generate biased answers that violate prevailing societal values (Bolukbasi et al., 2016; Sheng et al., 2019; Bordia and Bowman, 2019; Nadeem et al., 2021; Zong and Krishnamachari, 2022; Zhuo et al., 2023). (Bolukbasi et al., 2016) shows that biases in the geometry of wordembeddings can reflect gender stereotypes. The gender bias in word-level language models is quantitatively evaluated in (Bordia and Bowman, 2019).
+
+In (Nadeem et al., 2021), the authors demonstrate that popular LLMs such as GPT-2 (Radford et al., 2019) possess strong stereotypical biases on gender, profession, race, and religion. To reduce such biases, many state-of-the-art LLMs such as ChatGPT apply instruction-finetuning with non-toxic corpora and instructions to improve their safety. (Zhuo et al., 2023) reveals that ChatGPT can generate socially safe responses with fewer biases than other LLMs under English lanuage settings. In contrast to previous works, our framework enables us to evaluate whether LLMs possess biased perceptions and assessments on humans (e.g., personalities), which helps us better understand the underlying reasons for the LLMs’ aberrant responses.
+
+
+Figure 1: Overview of our framework: (a) The queried subject is replaced in the original statements of MBTI questions; (b) We construct correctness-evaluated instructions and (c) randomly permute options to build unbiased prompts with the subject-replaced statements (d), which are assessed by LLMs to infer the personality.
+
+# 3 The Proposed Framework
+
+# 3.1 Unbiased Prompt Design
+
+LLMs are typically sensitive to prompt biases (e.g., varying word orders), which can significantly influence the coherence and accuracy of the generated responses especially when dealing with long text sequences (Zhao et al., 2021). To encourage more consistent and impartial answers, we propose to design unbiased prompts for the input questions. In particular, for each question in an independent testing (i.e., MBTI questionnaire), we randomly permute all available options (e.g., agree, disagree) in its instruction while not changing the question statement, and adopt the average results of multiple independent testings as the final result.
+
+Formally, the instruction and statement for the $i ^ { t h }$ question are defined as $I _ { i }$ and $S _ { i }$ , where $i \in$ $\{ 1 , \cdots , n \}$ and $n$ is the total number of questions in the testing. We have $m$ available options $O _ { I } = \{ o _ { 1 } , o _ { 2 } , \cdots , o _ { m } \}$ in the instruction, which corresponds to $\{ A g r e e$ , Generally agree, Partially agree, Neither agree nor disagree, Partially disagree, Generally disagree, Disagree} including seven levels (i.e., $m = 7$ ) from agreement to disagreement in the MBTI questionnaire. We use $\Omega ( O _ { I } )$ to denote all possible permutations of options in $O _ { I }$ , and a random permutation can be represented as ${ \cal O } _ { \mathcal { R } } = \{ o _ { r _ { 1 } } , o _ { r _ { 2 } } , \cdots , o _ { r _ { m } } \} \in \Omega ( { \cal O } _ { I } )$ where $r _ { i } \in \{ 1 , 2 , \cdots , m \}$ , and $o _ { r _ { i } } \neq o _ { r _ { j } }$ iff $i \neq j$ Then, we utilize the randomly permuted options $O _ { \mathcal { R } }$ to construct the instruction $I _ { i }$ for the $i ^ { t h }$ question with:
+
+Instruction: Do you $o _ { r _ { 1 } } , o _ { r _ { 2 } } , \cdots$ or $o _ { r _ { m } }$ with the following statement. Why?
+
+We combine the above instruction and the question statement as the prompt to query LLMs. An example prompt for a question in the MBTI questionnaire is provided as follows.
+
+Instruction: Do you disagree, agree, generally disagree, generally agree, neither agree nor disagree, partially disagree or partially agree with the following statement. Why?
+
+Statement: You usually stay calm, even under a lot of pressure.
+
+Answer: “As an AI language model, I do not have personal experiences or emotions, so I cannot agree or disagree with the statement. However, I can provide some general information on the topic. Some individuals are naturally more composed under pressure, while others may ......”
+
+However, such a query, conducted in a selftesting manner, can only elicit neutral answers as shown above, since LLMs such as ChatGPT are trained to not possess personal thinking (e.g., emotions). This motivates us to propose the subjectreplaced query and correctness-evaluated instruction as illustrated below.
+
+# 3.2 Subject-Replaced Query
+
+As our goal is to let LLMs analyze human personalities instead of querying itself (i.e., self-reporting), we propose the subject-replaced query (SRQ) by converting the original subject (i.e., “You”) of each question into a specific subject-of-interest. For example, when we hope to let LLMs assess the general personality of men, we can replace the subject “You” with “Men”, and correspondingly change the pronoun “your” to “their” (see the example below). Original Statement: You spend a lot of your free time exploring various random topics that pique your interest.
+
+SRQ Statement: Men spend a lot of their free time exploring various random topics that pique their interests.
+
+In this way, we can request the LLMs to analyze and infer the choices/answers of a specific subject, so as to query LLMs about the personality of such subject based on a certain personality measure (e.g., MBTI). The proposed SRQ is general and scalable. By simply replacing the subject in the test (see Fig. 1), we can convert the original selfreport questionnaire into an analysis of expected subjects from the point of LLMs.
+
+In our work, we choose large groups of people (e.g., “Men”, “Barbers”) instead of certain persons as the assessed subjects. First, as our framework only uses the subject name without extra personal information to construct MBTI queries, it is unrealistic to let LLMs assess the MBTI answers or personality of a certain person who is out of their learned knowledge. Second, the selected subjects are common in the knowledge base of LLMs and can test the basic personality assessment ability of LLMs, which is the main focus of our work. Moreover, subjects with different professions such as “Barbers” are frequently used to measure the bias in LLMs (Nadeem et al., 2021), thus we select such representative professions to better evaluate the consistency, robustness, and fairness of LLMs.
+
+# 3.3 Correctness-Evaluated Instruction
+
+Directly querying LLMs about human personalities with the original instruction can be intractable, as LLMs such as ChatGPT are trained to NOT possess personal emotions or beliefs. As shown in Fig. 2, they can only generate a neutral opinion when we query their agreement or disagreement, regardless of different subjects. To solve this challenge, we propose to convert the original agreement-measured instruction (i.e., querying degree of agreement) into correctness-evaluated instruction (CEI) by letting LLMs evaluate the correctness of the statement in questions. Specifically, we convert the original options $\{ A g r e e$ , Generally agree, Partially agree, Neither agree nor disagree, Partially disagree, Generally disagree, Disagree} into {Correct, Generally correct, Partially correct, Neither correct nor wrong, Partially wrong, Generally wrong, Wrong}, and then construct an unbiased prompt (see Sec. 3.1) based on the proposed CEI.
+
+As shown in Fig. 2, using CEI enables ChatGPT to provide a clearer response to the question instead of giving a neutral response. Note that the CEI is essentially equivalent to the agreement-measured instruction and can be flexibly extended with other forms (e.g., replacing “correct” by “right”).
+
+
+Figure 2: Comparison of answers generated by ChatGPT when adopting different types of instructions. Note that the agreement-measured instruction always leads to a neutral answer in practice.
+
+# 3.4 The Entire Framework
+
+The overview of our framework is shown in Fig. 1. Given the original statement $S _ { i }$ and instruction $I _ { i }$ of the $i ^ { t h }$ question, we construct the new statement $S _ { i } ^ { \prime }$ based on SRQ (Sec. 3.2) and the new instruction $I _ { i } ^ { \prime }$ based on CEI (Sec. 3.3), which are combined to construct the unbiased prompt $P _ { i }$ (Sec. 3.1). We query the LLM to obtain the answer $A _ { i }$ by
+
+$$
+A _ { i } \sim { \mathcal { M } } _ { \tau } ( P _ { i } ) ,
+$$
+
+where $\mathcal { M } _ { \tau }$ denotes the LLM trained with the temperature $\tau$ , $\mathcal { M } _ { \tau } ( P _ { i } )$ represents the answer sampling distribution of LLM conditioned on the input prompt $P _ { i }$ , $A _ { i }$ represents the most likely answer generated from $\mathcal { M } _ { \tau } ( P _ { i } )$ , $i \in \{ 1 , 2 , \cdots , n \}$ is the index of different questions, and $n$ is the number of all questions in MBTI. We adopt the default temperature used in training standard GPT models. The generated answer is further parsed with several simple rules, which ensures that it contains or can be transformed to an exact option. For instance, when we obtain the explicit option “generally incorrect”, the parsing rules can convert this answer to “generally wrong” to match the existing options.
+
+We query the LLM with the designed prompt $P _ { i }$ (see Eq. 1) in the original order of the questionnaire to get all parsed answers. Based on the complete answers, we obtain the testing result (e.g., MBTI personality scores) of a certain subject from the view of LLM. Then, we independently repeat this process for multiple times, and average all results as the final result. It is worth noting that every question is answered only once in each independent testing, so as to retain a continuous testing context to encourage the coherence of LLM’s responses.
+
+# 3.5 Evaluation Metrics
+
+To systematically evaluate the ability of LLMs to assess human personalities, we propose three metrics in terms of consistency, robustness, and fairness as follows.
+
+Consistency Scores. The personality results of the same subject assessed by an LLM should be consistent. For example, when we perform different independent assessments of a specific subject via the LLM, it is desirable to achieve an identical or highly similar assessment. Therefore, we propose to use the similarity between personality scores of all independent testing results and their final result (i.e., mean scores) to compute the consistency score of assessments.
+
+Formally, we define $X ^ { i } = ( x _ { 1 } ^ { i } , x _ { 2 } ^ { i } , \cdot \cdot \cdot , x _ { k } ^ { i } )$ as the personality scores assessed by the LLM in the $i ^ { t h }$ independent testing, where $x _ { j } ^ { i } \in [ 0 , 1 0 0 ]$ is the score of the $j ^ { t h }$ personality dimension in the $i ^ { t h }$ testing, $j \in \{ 1 , 2 , \cdots , k \}$ , and $k$ is total number of personality dimensions. Taking the MBTI test as an example, $k = 5$ and $X ^ { i } = ( x _ { 1 } ^ { i } , x _ { 2 } ^ { i } , x _ { 3 } ^ { i } , x _ { 4 } ^ { i } , x _ { 5 } ^ { i } )$ represents extraverted, intuitive, thinking, judging, and assertive scores. The consistency score $s _ { c }$ can be computed by:
+
+$$
+s _ { c } = \frac { \alpha } { \alpha + \frac { 1 } { N } \sum _ { i = 1 } ^ { N } D _ { E } ( X ^ { i } , \overline { { X } } ) } ,
+$$
+
+where
+
+$$
+D _ { E } ( X ^ { i } , { \overline { { X } } } ) = \| X ^ { i } - { \overline { { X } } } \| _ { 2 } .
+$$
+
+In Eq. (2), $s _ { c } \in ( 0 , 1 ]$ , $\alpha$ is a positive constant to adjust the output magnitude, $D _ { E } ( X ^ { i } , { \overline { { X } } } )$ denotes the Euclidean distance between the $i ^ { t h }$ personality score $X ^ { i }$ and the mean score $\begin{array} { r } { \overline { { \boldsymbol X } } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } { \boldsymbol X ^ { i } } } \end{array}$ and $N$ is the total number of testings. $\| \cdot \| _ { 2 }$ denotes the $\ell _ { 2 }$ norm. Here we assume that each personality dimension corresponds to a different dimension in the Euclidean space, and the difference between two testing results can be measured by their Euclidean distance. We set $\alpha = 1 0 0$ to convert such Euclidean distance metric into a similarity metric with a range from 0 to 1. Intuitively, a smaller average distance between all testing results and the final average result can indicate a higher consistency score $s _ { c }$ of these assessments.
+
+Robustness Scores. The assessments of the LLM should be robust to the random perturbations of input prompts (“prompt biases”) such as randomly-permuted options. Ideally, we expect that the LLM can classify the same subject as the same personality, regardless of option orders in the question instruction. We compute the similarity of average testing results between using fixed-order options (i.e., original order) and using randomlypermuted options to measure the robustness score of assessments, which is defined as
+
+$$
+s _ { r } = { \frac { \alpha } { \alpha + D _ { E } ( \overline { { X ^ { \prime } } } , \overline { { X } } ) } } ,
+$$
+
+where $\overline { { X ^ { \prime } } }$ and $\overline { { X } }$ represent the average testing results when adopting the original fixed-order options and randomly-permuted options, respectively. We employ the same constant $\alpha = 1 0 0$ used in Eq. (2). A larger similarity between ${ \overline { { X ^ { \prime } } } }$ and $\overline { { X } }$ with smaller distance leads to a higher $s _ { r }$ , which indicates that the LLM has higher robustness against prompt biases to achieve more similar results.
+
+Fairness Scores. The assessments of the LLM on different groups of people should be unbiased and match prevailing societal values. For example, an LLM should NOT possess stereotypical biases on people with different genders, races, and religions. When not specifying backgrounds such as professions, a fair personality assessment on the general people such as the subjects “Men” or “Women” is supposed to be similar. Considering that races and religions are highly controversial topics and typically lack a universal standard to evaluate, we only analyze the fairness of LLMs’ assessment on different genders. We propose to use the assessment similarity of subjects with different genders to measure the fairness of assessments on genders. The fairness score is calculated by
+
+$$
+s _ { f } = { \frac { \alpha s _ { c } ^ { M } s _ { c } ^ { F } } { \alpha + D _ { E } ( \overline { { X ^ { M } } } , \overline { { X ^ { F } } } ) } } ,
+$$
+
+where $\overline { { X ^ { M } } }$ and $\overline { { X ^ { F } } }$ represent the average testing results of male (e.g., “Men”, “Boys”) and female subjects (e.g., “Women”, “Girls”), respectively.
+
+Table 1: Personality types and scores assessed by InstructGPT, ChatGPT, and GPT-4 when we query different subjects. The score results are averaged from multiple independent testings. We present the assessed scores of five dimensions that dominate the personality types. Bold indicates the same personality role assessed from all LLMs, while the underline denotes the highest score among LLMs when obtaining the same assessed personality type.
+
+
LLM
Subject
People
Men
Women
Barbers
Accountants
Doctors
Artists
Mathematicians
Politicians
InstructGPT
Personality Types/Scores
E=64
E=66
E=66
E=53
I=53
E=52
E=59
I= 51
E=59
N= 65
N= 64
N= 71
N= 52
N= 52
N= 58
N= 69
N= 56
N= 62
T= 53
T=50
F= 55
F= 53
F=51
F= 54
F= 59
T= 54
T= 54
J= 62
J= 56
J= 61
J= 66
J= 72
J= 71
J= 60
J= 67
J= 59
Personality Role
T= 60
T= 62
T= 58
A= 53
T= 62
T= 53
A= 50
A= 52
T= 54
Commander
Commander
Protagonist
Protagonist
Adventurer
Protagonist
Protagonist
Architect
Commander
E=57
E= 55
E= 54
E=50
I=56
E= 54
E=58
I= 61
E=63
ChatGPT
Personality Types /Scores
N= 60
N= 52
N= 51
S= 51
S= 59
N= 52
N= 67
N= 54
N= 50
T=51
T= 52
T=51
T=53
T=60
F= 54
F= 60
T=64
T=58
J= 57
J= 54
J= 53
J= 56
J= 68
J= 64
P=58
J= 62
J= 56
T=59
T=51
A= 50
T=51
A=50
T= 56
T= 64
A=50
T= 59
Personality Commander
Commander
Commander
Executive
Logistician
Protagonist
Campaigner
Architect
Commander
GPT-4 Types /Scores
Role Personality
E=53
E=57
N= 61
N= 53
E= 61 N= 58
E=52 N= 50
I= 54 S= 55
E=54 N= 51
E=58 N= 67
I= 61
E=64
T= 54
T= 55
F= 58
T=51
T= 57
F= 55
F= 56
N= 56 T= 64
S=51 T= 57
J= 54
= 56
J= 57
J= 56
J= 68
J= 66
P=58
J= 64
J= 55
T= 68
T= 63
T= 61
A=51
A=50
T= 53
T= 63
T = 51
Personality Role
Commander
Commander
Protagonist
Commander
Logistician
Protagonist
Campaigner
Architect
T= 57 Executive
+
+
+Figure 3: The most frequent option for each question in multiple independent testings of InstructGPT (Left), ChatGPT (Middle), and GPT-4 (Right) when we query the subject “People” (Top row),or “Artists” (Bottom row). “GC”, “PC”, “NCNW”, “PW”, and “GW” denote “Generally correct”, “Partially correct”, “Neither correct nor wrong”, “Partially wrong”, and “Generally wrong”.
+
+Here we multiply their corresponding consistency scores sMc and s Fc since a higher assessment consistency of subjects can contribute more to their inherent similarity. A larger $s _ { f }$ indicates that the assessments on different genders are more fair with higher consistency and less bias.
+
+# 4 Experimental Setups
+
+GPT Models. InstructGPT (text-davinci-003 model) (Ouyang et al., 2022) is a fine-tuned series of GPT-3 (Brown et al., 2020) using reinforcement learning from human feedback (RLHF). Compared with InstructGPT, ChatGPT (gpt-3.5-turbo model) is trained on a more diverse range of internet text (e.g., social media, news) and can better and faster respond to prompts in a conversational manner. GPT-4 (gpt-4 model) (Bubeck et al., 2023) can be viewed as an enhanced version of ChatGPT, and it can solve more complex problems and support multi-modal chat with broader general knowledge and stronger reasoning capabilities.
+
+Myers–Briggs Type Indicator. The Myers–Briggs Type Indicator (MBTI) (Myers and McCaulley, 1985) assesses the psychological preferences of individuals in how they perceive the world and make decisions via an introspective questionnaire, so as to identify different personality types based on five dichotomies1: (1) Extraverted versus Introverted (E vs. I); (2) Intuitive versus Observant (N vs. S); (3) Thinking versus Feeling (T vs. F); (4) Judging versus Prospecting (J vs. P); (5) Assertive versus Turbulent (A vs. T) (see Appendix C).
+
+Implementation Details. The number of independent testings for each subject is set to $N = 1 5$ We evaluate the consistency and robustness scores of LLMs’ assessments on the general population (“People”, “Men”, “Women”) and specific professions following (Nadeem et al., 2021). The fairness score is measured based on two gender pairs, namely (“Men”, “Women”) and (“Boys”, “Girls”). More details are provided in the appendices.
+
+# 5 Results and Analyses
+
+We query ChatGPT, InstructGPT, and GPT-4 to assess the personalities of different subjects, and
+
+Table 2: Consistency scores $( s _ { c } )$ and robustness scores $\left( s _ { r } \right)$ comparison between InstructGPT, ChatGPT, and GPT-4 in assessing different subjects. Bold shows the highest average scores among them.
+
+
Metric
LLM
People
Men
Women
Barbers
Accountants
Doctors
Artists
Mathematicians
Politicians
Average
Consistency Score
InstructGPT ChatGPT
0.916
0.888
0.905
0.898
0.925
0.901
0.900
0.897
0.914
0.905
0.907
0.895
0.913
0.922
0.932
0.922
0.918
0.932
0.919
0.918
GPT-4
0.936
0.927
0.911
0.909
0.928
0.916
0.927
0.922
0.911
0.921
Robustness
InstructGPT
0.936
0.924
0.944
0.925
0.965
0.936
0.936
0.956
0.952
0.942
ChatGPT
0.888
0.917
0.960
0.927
0.958
0.967
0.940
0.920
0.935
0.935
Score
GPT-4
0.970
0.893
0.885
0.965
0.961
0.980
0.928
0.934
0.905
0.936
+
+Table 3: Fairness scores $( s _ { f } )$ comparison between InstructGPT, ChatGPT, and GPT-4 in assessing different gender pairs. Bold indicates the highest average score.
+
+
LLM
Menvs.Women
Boys vs. Girls
Average
InstructGPT
0.723
0.783
0.753
ChatGPT
0.796
0.756
0.776
GPT4
0.786
0.770
0.778
+
+compare their assessment results in Table 1. The consistency, robustness, and fairness scores of their assessments are reported in Table 2 and 3.
+
+# 5.1 Can ChatGPT Assess Human Personalities?
+
+As shown in Fig. 3, most answers and their distributions generated by three LLMs are evidently different, which suggests that each model can be viewed as an individual to provide independent opinions in assessing personalities. Notably, ChatGPT and GPT-4 can respond to questions more flexibly (i.e., more diverse options and distributions) compared with InstructGPT. This is consistent with their property of being trained on a a wider range of topics, enabling them to possess stronger model capacity (e.g., reasoning ability) for better assessment.
+
+Interestingly, in spite of possibly different answer distributions, the average results in Table 1 show that four subjects are assessed as the same personality types by all LLMs. This could suggest the inherent similarity of their personality assessment abilities. In most of these cases, ChatGPT tends to achieve medium personality scores, implying its more neutral assessment compared with other two LLMs. It is worth noting that some assessment results from ChatGPT and GPT-4 are close to our intuition: (1) Accountants are assessed as “Logistician” that is usually a reliable, practical and fact-minded individual. (2) Artists are classified as the type “ENFP-T” that often possesses creative and enthusiastic spirits. (3) Mathematicians are assessed to be the personality role "Architect" that are thinkers with profound ideas and strategic plans. To a certain extent, these results demonstrate their effectiveness on human personality assessment. Moreover, it is observed that “People” and “Men” are classified as leader roles (“Commander”) by all LLMs. We speculate that it is a result of the human-centered fine-tuning (e.g., reinforcement learning from human feedback (RLHF)), which encourages LLMs to follow the prevailing positive societal conceptions and values such as the expected relations between human and LLMs. In this context, the assessed personality scores in Table 1 can shed more insights on “how LLMs view humans” and serve as an indicator to better develop human-centered and socially-beneficial LLMs.
+
+# 5.2 Is the Assessment Consistent, Robust and Fair?
+
+As shown in Table 2, ChatGPT and GPT-4 achieve higher consistency scores than InstructGPT in most cases when assessing different subjects. This suggests that ChatGPT and GPT-4 can provide more similar and consistent personality assessment results under multiple independent testings. However, their average robustness scores are slightly lower than that of InstructGPT, which indicates that their assessments could be more sensitive to the prompt biases (e.g., changes of option orders). This might lead to their more diverse answer distributions in different testings as shown in Fig. 3. It actually verifies the necessity of the proposed unbiased prompts and the averaging of testing results to encourage more impartial assessments. As presented in Table 3, ChatGPT and GPT-4 show higher average fairness scores than InstructGPT when assessing different genders. This indicates that they are more likely to equally assess subjects with less gender bias, which is consistent with the finding of (Zhuo et al., 2023). In summary, although the assessments of ChatGPT and GPT-4 can be influenced by random input perturbations, their overall assessment results are more consistent and fairer compared with InstructGPT.
+
+Table 4: Personality types and roles assessed by ChatGPT and GPT-4 when we query subjects with different income levels (low, middle, high), age levels (children, adolescents, adults, old adults) or different education levels (junior/middle/high school students, undergraduate/master/PhD students). The results are averaged from multiple independent testings. Bold indicates the same personality types/role assessed from all LLMs.
+
+
LLM
Background
Income Level
AgeLevel
evel
Edu
Education Level
Low
Middle
High
Children
Adolescents
Adults
Old Adults
Junior
Middle
High
Undergraduate
Master
PhD
ChatGPT
PersonalityTypes
INFJ-T
ENFJ-T
ENTJ-T
ENFP-T
ENFP-T
ENTJ-T
INFJ-T
ESFP-T
ENFP-T
ENFJ-T
ENFJ-T
INTJ-T
INTJ-T
PersonalityRole
Advocate
Protagonist
Commander
Campaigner
Campaigner
Commander
Advocate
Entertainer
Campaigner
Protagonist
Protagonist
Architect
Architect
GPT-4
PersonalityTypes
ENFJ-T
ENFJ-T
ENTJ-T
ENFP-T
ENFP-T
ENTJ-T
ENFJ-T
ENTP-T
ENTP-T
ENTP-T
ENTJ-T
ENTJ-T
ENTJ-T
PersonalityRole
Protagonist
Protagonist
Commander
Campaigner
Campaigner
Commander
Protagonist
Debater
Debater
Debater
Commander
Commander
Commander
+
+
+Figure 4: The most frequent option for each question in multiple independent testings of InstructGPT (Left), ChatGPT (Middle), GPT-4 (Right) when we query the subject “Artists” without using unbiased prompts. “W” denotes “Wrong”, and other legends are same as Fig. 3.
+Figure 6: An example of uncertain answers generated from ChatGPT when querying a specific individual.
+
+
+Figure 5: Personality scores of different subjects in five dimensions of MBTI results assessed from InstructGPT (Blue), ChatGPT (Orange), and GPT-4 (Green).
+
+# 6 Discussions
+
+Effects of Unbiased Prompts. Fig. 4 shows that using the same-order options leads to a higher frequency of the same option (i.e., more fixed answers) for many questions compared with employing unbiased prompts (see Fig. 3). This suggests the effectiveness and necessity of the proposed unbiased prompts, which introduce random perturbations into question inputs and average all testing results to encourage more impartial assessment.
+
+Effects of Background Prompts. We show the effects of background prompts on LLM’s assessments by adding different income, age or education information of the subject. As shown in Table 4, “Middle-income people” is assessed as the type “ENFJ-T” that is slightly different from the type “ENTJ-T” of “People”. Interestingly, high education level subjects such as “Master” and “PhD” are
+
+Statement: Taylor Swift spends a lot of her free time exploring various random topics that pique her interests.
+
+Answer: It is neither correct nor wrong. Without more information on her personal lifeand interests,it is difficult to determine the full accuracy of the statement...
+
+assessed as the “INTJ-T” or “ENTJ-T” type that often possesses strategic plans, profound ideas or rational minds, while junior/middle school students are classified to the types that are usually energetic or curious. This implies that ChatGPT and GPT-4 may be able to to understand different backgrounds of subjects, and an appropriate background prompt could facilitate reliable personality assessments.
+
+Visualization of Different Assessments. Fig. 5 visualizes three subjects with different assessed types or scores. ChatGPT and GPT-4 achieve very close scores in each dimension despite different assessed types, which demonstrates their higher similarity in personality assessment abilities.
+
+Assessment of Specific Individuals. Querying LLMs about the personality of a certain person might generate uncertain answers due to the insufficiency of personal backgrounds (e.g., behavior patterns) in its knowledge base (see Fig. 6). Considering the effects of background prompts, providing richer background information through subject-specific prompts or fine-tuning can help achieve a more reliable assessment. More results and analyses are provided in Appendix B.
+
+# 7 Conclusion
+
+This paper proposes a general evaluation framework for LLMs to assess human personalities via MBTI. We devise unbiased prompts to encourage LLMs to generate more impartial answers. The subject-replaced query is proposed to flexibly query personalities of different people. We further construct correctness-evaluated instructions to enable clearer LLM responses. We evaluate LLMs’ consistency, robustness, and fairness in personality assessments, and demonstrate the higher consistency and fairness of ChatGPT and GPT-4 than InstructGPT.
+
+# 8 Acknowledgements
+
+This research is supported by the National Research Foundation, Singapore under its AI Singapore Programme (AISG Award No: AISG2-PhD/2022-01- 034[T]).
+
+# Limitations
+
+While our study is a step toward the promising open direction of LLM-based human personality and psychology assessment, it possesses limitations and opportunities when applied to the real world. First, our work focuses on ChatGPT model series and the experiments are conducted on a limited number of LLMs. Our framework is also scalable to be applied to other LLMs such as LLaMA, while its performance remains to be further explored. Second, although most independent testings of the LLM under the same standard setting yield similar assessments, the experimental setting (e.g., hyper-parameters) or testing number can be further customized to test the reliability of LLMs under extreme cases. We will leverage the upcoming API that supports controllable hyper-parameters to better evaluate GPT models. Third, the representations of different genders might be insufficient. For example, the subjects “Ladies” and “Gentlemen” also have different genders, while they can be viewed as groups that differ from “Men” and “Women”. As the focus of this work is to devise a general evaluation framework, we will further explore the assessment of more diverse subjects in future works. Last, despite the popularity of MBTI in different areas, its scientific validity is still under exploration. In our work, MBTI is adopted as a representative personality measure to help LLMs conduct quantitative evaluations. We will explore other tests such as Big Five Inventory (BFI) (John et al., 1999) under our scalable framework.
+
+# Ethics Considerations
+
+Misuse Potential. Due to the exploratory nature of our study, one should not directly use, generalize or match the assessment results (e.g., personality types of different professions) with certain realworld populations. Otherwise, the misuse of the proposed framework and LLM’s assessments might lead to unrealistic conclusions and even negative societal impacts (e.g., discrimination) on certain groups of people. Our framework must not be used for any ethically questionable applications.
+
+Biases. The LLMs used in our study are pretrained on the large-scale datasets or Internet texts that may contain different biases or unsafe (e.g., toxic) contents. Despite with human fine-tuning, the model could still generate some biased personality assessments that might not match the prevailing societal conceptions or values. Thus, the assessment results of LLMs via our framework must be further reviewed before generalization.
+
+Broader Impact. Our study reveals the possibility of applying LLMs to automatically analyze human psychology such as personalities, and opens a new avenue to learn about their perceptions and assessments on humans, so as to better understand LLMs’ potential thinking modes, response motivations, and communication principles. This can help speed up the development of more reliable, human-friendly, and trustworthy LLMs, as well as facilitate the future research of AI psychology and sociology. Our work suggests that LLMs such as InstructGPT may have biases on different genders, which could incur societal and ethical risks in their applications. Based on our study, we advocate introducing more human-like psychology and personality testings into the design and training of LLMs, so as to improve model safety and user experience.
+
+# References
+
+Tolga Bolukbasi, Kai-Wei Chang, James Y Zou, Venkatesh Saligrama, and Adam T Kalai. 2016. Man is to computer programmer as woman is to homemaker? debiasing word embeddings. Advances in Neural Information Processing Systems (NeurIPS), 29. Shikha Bordia and Samuel Bowman. 2019. Identifying and reducing gender bias in word-level language models. In Proceedings of the North American Chapter of the Association for Computational Linguistics (NAACL): Student Research Workshop, pages 7–15. Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. 2020. Language models are few-shot learners. Advances in Neural Information Processing Systems (NeurIPS), 33:1877–1901.
+
+Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. 2023. Sparks of artificial general intelligence: Early experiments with GPT-4. arXiv preprint arXiv:2303.12712.
+
+Graham Caron and Shashank Srivastava. 2022. Identifying and manipulating the personality traits of language models. arXiv preprint arXiv:2212.10276.
+
+Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL-HLT), pages 4171–4186.
+
+John M Digman. 1990. Personality structure: Emergence of the five-factor model. Annual review of psychology, 41(1):417–440.
+
+Hans Jurgen Eysenck. 2012. A model for personality. Springer Science & Business Media.
+
+Jiaxin Huang, Shixiang Shane Gu, Le Hou, Yuexin Wu, Xuezhi Wang, Hongkun Yu, and Jiawei Han. 2022. Large language models can self-improve. arXiv preprint arXiv:2210.11610.
+
+Guangyuan Jiang, Manjie Xu, Song-Chun Zhu, Wenjuan Han, Chi Zhang, and Yixin Zhu. 2022. MPI: Evaluating and inducing personality in pre-trained language models. arXiv preprint arXiv:2206.07550.
+
+Zhengbao Jiang, Frank F Xu, Jun Araki, and Graham Neubig. 2020. How can we know what language models know? Transactions of the Association for Computational Linguistics, 8:423–438.
+
+Oliver P John, Sanjay Srivastava, et al. 1999. The bigfive trait taxonomy: History, measurement, and theoretical perspectives.
+
+Saketh Reddy Karra, Son Nguyen, and Theja Tulabandhula. 2022. AI personification: Estimating the personality of language models. arXiv preprint arXiv:2204.12000.
+
+Michal Kosinski. 2023. Theory of mind may have spontaneously emerged in large language models. arXiv preprint arXiv:2302.02083.
+
+Xingxuan Li, Yutong Li, Linlin Liu, Lidong Bing, and Shafiq Joty. 2022. Is GPT-3 a psychopath? evaluating large language models from a psychological perspective. arXiv preprint arXiv:2212.10529.
+
+Marilù Miotto, Nicola Rossberg, and Bennett Kleinberg. 2022. Who is GPT-3? An exploration of personality, values and demographics. In Conference on Empirical Methods in Natural Language Processing (EMNLP) Workshop.
+
+Shima Rahimi Moghaddam and Christopher J Honey. 2023. Boosting theory-of-mind performance in large language models via prompting. arXiv preprint arXiv:2304.11490.
+
+Isabel Briggs Myers. 1962. The Myers-Briggs Type Indicator: Manual (1962).
+
+Isabel Briggs Myers and Mary H. McCaulley. 1985. Manual: A guide to the development and use of the Myers-Briggs Type Indicator. Consulting Psychologists Press.
+
+Moin Nadeem, Anna Bethke, and Siva Reddy. 2021. StereoSet: Measuring stereotypical bias in pretrained language models. In Proceedings of the Annual Meeting of the Association for Computational Linguistics and the International Joint Conference on Natural Language Processing (ACL-IJCNLP), pages 5356– 5371.
+
+Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Gray, et al. 2022. Training language models to follow instructions with human feedback. In Advances in Neural Information Processing Systems (NeurIPS).
+
+Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. 2019. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9.
+
+Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. The Journal of Machine Learning Research, 21(1):5485–5551.
+
+James M Schuerger. 2000. The sixteen personality factor questionnaire (16PF). Testing and assessment in counseling practice, pages 73–110.
+
+Emily Sheng, Kai-Wei Chang, Prem Natarajan, and Nanyun Peng. 2019. The woman worked as a babysitter: On biases in language generation. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3407–3412.
+
+Eva AM van Dis, Johan Bollen, Willem Zuidema, Robert van Rooij, and Claudi L Bockting. 2023. ChatGPT: Five priorities for research. Nature, 614(7947):224–226.
+
+Laura Weidinger, John Mellor, Maribeth Rauh, Conor Griffin, Jonathan Uesato, Po-Sen Huang, Myra Cheng, Mia Glaese, Borja Balle, Atoosa Kasirzadeh, et al. 2021. Ethical and social risks of harm from language models. arXiv preprint arXiv:2112.04359.
+
+Zhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Yumao Lu, Zicheng Liu, and Lijuan Wang. 2022.
+
+An empirical study of GPT-3 for few-shot knowledgebased VQA. In Proceedings of the AAAI Conference on Artificial Intelligence (AAAI), volume 36, pages 3081–3089.
+
+Ann Yuan, Andy Coenen, Emily Reif, and Daphne Ippolito. 2022. Wordcraft: Story writing with large language models. In 27th International Conference on Intelligent User Interfaces. ACM.
+
+Xiaoming Zhai. 2022. ChatGPT user experience: Implications for education. Available at SSRN 4312418.
+
+Zihao Zhao, Eric Wallace, Shi Feng, Dan Klein, and Sameer Singh. 2021. Calibrate before use: Improving few-shot performance of language models. In International Conference on Machine Learning (ICML), pages 12697–12706. PMLR.
+
+Terry Yue Zhuo, Yujin Huang, Chunyang Chen, and Zhenchang Xing. 2023. Exploring AI ethics of ChatGPT: A diagnostic analysis. arXiv preprint arXiv:2301.12867.
+
+Mingyu Zong and Bhaskar Krishnamachari. 2022. A survey on GPT-3. arXiv preprint arXiv:2212.00857.
\ No newline at end of file
diff --git a/md/dev/wu1Za9dY1GY/wu1Za9dY1GY.md b/md/dev/wu1Za9dY1GY/wu1Za9dY1GY.md
new file mode 100644
index 0000000000000000000000000000000000000000..27266fb0f20c401b07822cc186c0a8c262993474
--- /dev/null
+++ b/md/dev/wu1Za9dY1GY/wu1Za9dY1GY.md
@@ -0,0 +1,320 @@
+# Graph Neural Networks are Dynamic Programmers
+
+Andrew Dudzik∗ DeepMind adudzik@deepmind.com
+
+Petar Velickovi ˇ c´∗ DeepMind petarv@deepmind.com
+
+# Abstract
+
+Recent advances in neural algorithmic reasoning with graph neural networks (GNNs) are propped up by the notion of algorithmic alignment. Broadly, a neural network will be better at learning to execute a reasoning task (in terms of sample complexity) if its individual components align well with the target algorithm. Specifically, GNNs are claimed to align with dynamic programming (DP), a general problem-solving strategy which expresses many polynomial-time algorithms. However, has this alignment truly been demonstrated and theoretically quantified? Here we show, using methods from category theory and abstract algebra, that there exists an intricate connection between GNNs and DP, going well beyond the initial observations over individual algorithms such as Bellman-Ford. Exposing this connection, we easily verify several prior findings in the literature, produce better-grounded GNN architectures for edge-centric tasks, and demonstrate empirical results on the CLRS algorithmic reasoning benchmark. We hope our exposition will serve as a foundation for building stronger algorithmically aligned GNNs.
+
+# 1 Introduction
+
+One of the principal pillars of neural algorithmic reasoning [27] is training neural networks that execute algorithmic computation in a high-dimensional latent space. While this process is in itself insightful, and can lead to stronger combinatorial optimisation systems [21], it is valuable in terms of expanding the applicability of classical algorithms. Evidence of this value are emerging, with pre-trained algorithmic reasoners utilised in implicit planning [11] and self-supervised learning [28].
+
+A fundamental question in this space is: which architecture should be used to learn a particular algorithm (or collection of algorithms [36])? Naturally, we seek architectures that have low sample complexity, as they will allow us to create models that generalise better with fewer training examples.
+
+The key theoretical advance towards achieving this aim has been made by [37]. Therein, the authors formalise the notion of algorithmic alignment, which states that we should favour architectures that align better to the algorithm, in the sense that we can separate them into modules, which individually correspond to the computations of the target algorithm’s subroutines. It can be proved that architectures with higher algorithmic alignment will have lower sample complexity in the NTK regime [20]. Further, the theory of [37] predicts that graph neural networks (GNNs) algorithmically align with dynamic programming [3, DP]. The authors demonstrate this by forming an analogy to the Bellman-Ford algorithm [2].
+
+Since DP is a very general class of problem-solving techniques that can be used to express many classical algorithms, this finding has placed GNNs as the central methodology for neural algorithmic execution [7]. However, it quickly became apparent that it is not enough to just train any GNN—for many algorithmic tasks, careful attention is required. Several papers illustrated special cases of GNNs that align with sequential algorithms [31], linearithmic sequence processing [16], physics simulations [23], iterative algorihtms [26], data structures [29] or auxiliary memory [24]. Some explanations for this lack of easy generalisation have arisen—we now have both geometric [38] and causal [4] views into how better generalisation can be achieved.
+
+We believe that the fundamental reason why so many isolated efforts needed to look into learning specific classes of algorithms is the fact the GNN-DP connection has not been sufficiently explored. Indeed, the original work of [37] merely mentions in passing that the formulation of DP algorithms seems to align with GNNs, and demonstrates one example (Bellman-Ford). Our thorough investigation of the literature yielded no concrete follow-up to this initial claim. But DP algorithms are very rich and diverse, often requiring a broad spectrum of computations. Hence what we really need is a framework that could allow us to identify GNNs that could align particularly well with certain classes of DP, rather than assuming a “one-size-fits-all” GNN architecture will exist.
+
+As a first step towards this, in this paper we interpret the operations of both DP and GNNs from the lens of category theory and abstract algebra. We elucidate the GNN-DP connection by observing a diagrammatic abstraction of their computations, recasting algorithmic alignment to aligning the diagrams of (G)NNs to ones of the target algorithm class. In doing so, several previously shown results will naturally arise as corollaries, and we propose novel GNN variants that empirically align better to edge-centric algorithms. We hope our work opens up the door to a broader unification between algorithmic reasoning and the geometric deep learning blueprint [5].
+
+# 2 GNNs, dynamic programming, and the categorical connection
+
+Before diving into the theory behind our connection, we provide a quick recap on the methods being connected: graph neural networks and dynamic programming. Further, we cite related work to outline why it is sufficient to interpret DP from the lens of graph algorithms.
+
+We will use the definition of GNNs based on [5]. Let a graph be a tuple of nodes and edges, $G = ( V , E )$ , with one-hop neighbourhoods defined as $\mathcal { N } _ { u } \mathbf { \bar { \Gamma } } = \{ v \in V \mid \mathbf { \bar { ( } } v , u ) \in E \}$ . Further, a node feature matrix $\mathbf { X } \in \mathbb { R } ^ { | V | \times k }$ gives the features of node $u$ as $\mathbf { x } _ { u }$ ; we omit edge- and graph-level features for clarity. A (message passing) GNN over this graph is then executed as:
+
+$$
+\mathbf { h } _ { u } = \phi \left( \mathbf { x } _ { u } , \bigoplus _ { v \in \mathcal { N } _ { u } } \psi ( \mathbf { x } _ { u } , \mathbf { x } _ { v } ) \right)
+$$
+
+where $\psi : \mathbb { R } ^ { k } \times \mathbb { R } ^ { k } \to \mathbb { R } ^ { k }$ is a message function, $\phi : \mathbb { R } ^ { k } \times \mathbb { R } ^ { k } \mathbb { R } ^ { k }$ is a readout function, and $\oplus$ is a permutation-invariant aggregation function (such as $\displaystyle \sum$ or max). Both $\psi$ and $\phi$ can be realised as MLPs, but many special cases exist, giving rise to, e.g., attentional GNNs [30].
+
+Dynamic programming is defined as a process that solves problems in a divide et impera fashion: imagine that we want to solve a problem instance $x$ . DP proceeds to identify a set of subproblems, $\eta ( x )$ , such that solving them first, and recombining the answers, can directly lead to the solution for $x$ : $f ( x ) = \rho ( \{ f ( y ) \mid y \in \eta ( x ) \} )$ . Eventually, we decompose the problem enough until we arrive at an instance for which the solution is trivially given (i.e. $f ( y )$ which is known upfront). From these “base cases”, we can gradually build up the solution for the problem instance we initially care for in a bottom-up fashion. This rule is often expressed programmatically:
+
+$$
+\mathsf { d p } [ \mathbf { x } ] \gets \mathbf { r e c o m b i n e } ( \mathbf { s c o r e } ( \mathrm { d p } [ \mathbf { y } ] , \mathrm { d p } [ \mathbf { x } ] ) \mathrm { ~ f o r ~ y ~ i n ~ e x p a n d } ( \mathbf { x } ) )
+$$
+
+To initiate our discussion on why DP can be connected with GNNs, it is a worthwhile exercise to show how Equation 2 induces a graph structure. To see this, we leverage a categorical analysis of dynamic programming first proposed by [10]. Therein, dynamic programming algorithms are reasoned about as a composition of three components (presented here on a high level):
+
+$$
+\mathrm { d } \boldsymbol { \mathrm { p } } = \underbrace { \rho } _ { \mathrm { r e c o m b i n e } } ^ { \mathrm { ~ \tiny ~ { ~ \circ ~ } ~ } } \underbrace { \sigma } _ { \mathrm { s c o r e } } ^ { \mathrm { ~ \tiny ~ { ~ \circ ~ } ~ } } \underbrace { \eta } _ { \mathrm { e x p a n d } }
+$$
+
+Expansion selects the relevant subproblems; scoring computes the quality of each individual subproblem’s solution w.r.t. the current problem, and recombining combines these solutions into a solution for the original problem (e.g. by taking the max, or average).
+
+Therefore, we can actually identify every subproblem as a node in a graph. Let $V$ be the space of all subproblems, and $R$ an appropriate value space (e.g. the real numbers). Then, expansion is defined as $\eta : V \to { \mathcal { P } } ( V )$ , giving the set of all subproblems relevant for a given problem. Note that this also induces a set of edges between subproblems, $E$ ; namely, $( x , y ) \in { \bar { E } }$ if $x \in \eta ( y )$ . Each subproblem is scored by using a function $\sigma : { \mathcal { P } } ( V ) \to { \mathcal { P } } ( R )$ . Finally, the individual scores are recombined using the recombination function, $\rho : \mathcal { P } ( R ) R$ . The final dynamic programming primitive therefore computes a function $\mathrm { d } \mathsf { p } : V \to R$ in each of the subproblems of interest.
+
+Therefore, dynamic programming algorithms can be seen as performing computations over a graph of subproblems, which can usually be precomputed for the task at hand (since the outputs of $\eta$ are assumed known upfront for every subproblem). One specific popular example is the Bellman-Ford algorithm [2], which computes single-source shortest paths from a given source node, $s$ , in a graph $G = ( V , E )$ . In this case, the set of subproblems is exactly the set of nodes, $V$ , and the expansion $\eta ( u )$ is exactly the set of one-hop neighbours of $u$ in the graph. The algorithm maintains distances of every node to the source, $d _ { u }$ . The rule for iteratively recombining these distances is as follows:
+
+$$
+d _ { u } \gets \operatorname* { m i n } \Big ( d _ { u } , \operatorname* { m i n } _ { v \in \mathcal { N } _ { u } } d _ { v } + w _ { v \to u } \Big )
+$$
+
+where $w _ { v u }$ is the distance between nodes $v$ and $u$ . The algorithm’s base cases are $d _ { s } = 0$ for the source node, $d _ { u } = + \infty$ otherwise. Note that more general forms of Bellman-Ford pathfinding exist, for appropriate definitions of $^ +$ and min (in general known as a semiring). Several recent research papers such as NBFNet [39] explicitly call on this alignment in their motivation.
+
+# 3 The difficulty of connecting GNNs and DP
+
+The basic technical obstacle to establishing a rigorous correspondence between neural networks and DP is the vastly different character of the computations they perform. Neural networks are built from linear algebra over the familiar real numbers, while DP, which is often a generalisation of path-finding problems, typically takes place over “tropical” objects like $( \mathbb { N } \cup \{ \infty \} , { \overline { { \operatorname* { m i n } } } } , + ) ^ { 2 }$ , which are usually studied in mathematics as “degenerations” of Euclidean space. The two worlds cannot clearly be reconciled, directly, with simple equations.
+
+However, if we define an arbitrary “latent space” $R$ and make as few assumptions as possible, we can observe that many of the behaviors we care about, for both GNNs and $D P$ , arise from looking at functions $S R$ , where $S$ is a finite set. $R$ can be seen as the set of real-valued vectors in the case of GNNs, and the tropical numbers in the case of DP.
+
+So our principal object of study is the category of finite sets, and “ $R$ -valued quantities” on it. By “category” here we mean a collection of objects (all finite sets) together with a notion of composable arrows (functions between finite sets).
+
+To draw our GNN-DP connection, we need to devise an abstract object which can capture both the GNN’s message passing/aggregation stages (Equation 1) and the DP’s scoring/recombination stages (Equation 2). It may seem quite intuitive that these two concepts can and should be relatable, and category theory is a very attractive tool for “making the obvious even more obvious” [15]. Indeed, recently concepts from category theory have enabled the construction of powerful GNN architectures beyond permutation equivariance [9]. Here, we propose integral transforms as such an object.
+
+We will construct the integral transform by composing transformations over our input features in a way that will depend minimally on the specific choice of $R$ . In doing so, we will build a computational diagram that will be applicable for both GNNs and DP (and their own choices of $R$ ), and hence allowing for focusing on making components of those diagrams as aligned as possible.
+
+# 4 The integral transform
+
+An integral transform can be encoded in a diagram of this form, which we call a polynomial span:
+
+$$
+\begin{array} { l c c c c } { X } & { \quad } & { p \longrightarrow Y } \\ { \big | } & { } & { } & { \big | } \\ { i } & { } & { } & { \begin{array} { l } { { } } \\ { { } } \end{array} } \\ { \big \downarrow } & { } & { } & { \begin{array} { l } { { } } \\ { { } } \end{array} } \end{array}
+$$
+
+where $W , X , Y$ and $Z$ are finite sets. The arrows $i , p , o$ stand, respectively, for “input”, “process”, and “output”. In context, the sets will have the following informal meaning: $W$ represents the set over which we define our inputs, $Z$ the set over which we define outputs. $X$ and $Y$ are, respectively, carrier sets for the arguments, and the messages3—we will clarify their meaning shortly.
+
+Before proceeding, it is worthy to note the special case of $X = Y = E$ , with $p$ being the identity map. Such a diagram is commonly known as a span. A span that additionally has $W = Z = V$ is equivalent to a representation of a directed graph with vertex set $Z$ and edge set $Y$ $V \left. E \right. V )$ ; in this case $i ( e )$ and $o ( e )$ are the functions identifying the source and target nodes of each edge.
+
+The key question is: given input data $f$ on $W$ , assigning features $f ( w )$ to each $w \in W$ , how to transform it, via the polynomial span, into data on $Z ?$ If we can do this, we will be able to characterise both the process of sending messages between nodes in GNNs and scoring subproblems in DP.
+
+For us, data on a carrier set $S$ consists of an element of $[ S , R ] : = \{ f : S \to R \}$ , where $R$ is a “set of possible values”. For now, we will think of $R$ as an arbitrary (usually infinite) set, though we will see later that it should possess some algebraic structure; it should be a semiring.
+
+The transform proceeds in three steps, following the edges of the polynomial span:
+
+
+
+We call the three arrows $i ^ { * } , p _ { \otimes } , o _ { \oplus }$ the pullback, the argument pushfoward, and the message pushforward. Taken together, they form an integral transform—and we conjecture that this transform can be described as a polynomial functor, where $p _ { \otimes }$ and $o _ { \oplus }$ correspond to the dependent product and dependent sum from type theory (cf. Appendix $\mathbf { D }$ for details).
+
+The pullback $i ^ { * }$ is the easiest to define. Since we have a function $i : X \to W$ (part of the polynomial span) and a function $f : W \to R$ (our input data), we can produce data on $X$ , that is, a function in $X R$ , by composition. We hence define $i ^ { * } f = f \circ i$ .
+
+Unfortunately, the other two arrows of the polynomial span point in the wrong direction for naïve composition. For the moment, we will focus on how to define $o _ { \oplus }$ and leave $p _ { \otimes }$ for later.
+
+We start with message data $m : Y R$ . It may be attractive to invert the output arrow $o$ in order to define a composition with $o ^ { - 1 }$ , as was done in the case of the pullback. However, unless $o$ is bijective, the preimage $o ^ { - 1 } : Z \to { \mathcal { P } } ( Y )$ takes values in the power set of $Y$ . There is an additional technicality: if the composition $m \circ o ^ { - 1 }$ takes values in ${ \mathcal { P } } ( R )$ , it will fail to detect multiplicities; we are unable to tell from a subset of $R$ whether multiple messages had the same value.
+
+So instead, our pushforward takes values in $\mathtt { b a g } ( R )$ , the set of finite multisets (or bags) of $R$ , which we describe in more detail in appendix B. For the moment, it is enough to know that a bag is equivalent to a formal sum, and we define an intermediate message pushforward $( { \overline { { o _ { \oplus } } } } m ) ( u ) : =$ $\bar { \Sigma _ { e \in t ^ { - 1 } ( u ) } m ( e ) } \in [ Z , \mathtt { b a g } ( R ) ]$ .
+
+
+Figure 1: The illustration of how pullback and pushforward combine to form the integral transform, for two specific cases. Left: Polynomial span $V E E V$ with trivial argument pushforward (identity). Each edge $e _ { u v }$ is connected to its sender and receiver nodes $( u , v )$ via the span (black arrows). The pullback then “pulls” the node features $f ( u )$ along the span, which the argument pushforward folds into edge features $g ( e _ { v u } ) = f ( u )$ . Once all sender features are pulled back to their edges, the message pushforward then “collects” all of the edge features that send to a particular receiver, by pushing them along the span. Right: Polynomial span $V E + E \mathbf { \bar { { E } } } V$ , a situation more commonly found in GNNs. In this case, the pullback pulls sender and receiver node features into the argument function, $h$ . The argument pushforward then computes, from these arguments, the edge messages, $g$ , which are sent to receivers via the message pushforward, as before. See Appendix A for a visualisation of how these arrows translate into GNN code.
+
+All that is missing to complete our definition of $o _ { \oplus }$ is an aggregator $\oplus : \mathtt { b a g } ( R ) \to R$ . As we will see later, specifying a well-behaved aggregator is the same as imposing a commutative monoid structure on $R$ . With such an aggregator on $R$ , we can define $( o _ { \oplus } m ) ( u ) : = \bigoplus ( \overline { { \upsilon _ { \oplus } } } m ) ( u )$ .
+
+We return to $p _ { \otimes }$ , which is constructed very similarly. The only difference is that, while we deliberately regard the collection of messages as unordered, the collection of arguments used to compute a message has an ordering we wish to respect. So instead of the type $\mathtt { b a g } ( R )$ , we use the type $\mathtt { l i s t } ( R )$ of finite lists of elements of $R$ , and our aggregator $\otimes : { \mathrm { l i s t } } ( R ) \to R$ is now akin to a fold operator.
+
+We illustrate the use of these two aggregators in a decomposed diagram:
+
+
+
+Note that any semiring $( R , \otimes , \oplus )$ comes equipped with binary operators $\otimes , \oplus$ that allow aggregators $\otimes , \oplus$ to be defined inductively. In fact, the converse—that every set with two such aggregators is a semiring—is also true, if we assume some reasonable conditions on the aggregators, which we can explain in terms of one of the most utilised concepts in category theory and functional programming—monads [33]. Due to space constraints, we refer the interested reader to Appendices $\mathbf { B }$ and C for a full exposition of how we can use monads over lists and bags to constrain the latent space $R$ to respect a semiring structure.
+
+For now, it’s enough to know that our key examples of the real numbers (with multiplication and addition, for GNNs) and the tropical natural numbers (with addition and minimum, for DP) both allow for natural interpretations of $\otimes$ and $\oplus$ in the integral transform.
+
+We are now ready to show how the integral transform can be used to instantiate popular examples of algorithms and GNNs. We start with the Bellman-Ford algorithm [2] (Equation 4) that was traditionally used to demonstrate the concept of algorithmic alignment.
+
+# 5 Bellman-Ford
+
+Let $R = ( \mathbb { N } \cup \{ \infty \} , + , \operatorname* { m i n } )$ be the “min-plus” semiring of extended natural numbers, with $\otimes = +$ and $\oplus = \operatorname* { m i n }$ . This is the coefficient semiring over which the Bellman-Ford algorithm takes place.
+
+Let $( V , E )$ be a weighted graph with source and target maps $s , t : E \to V$ and edge weights $w : E R$ . For purely technical reasons, we also need to explicitly materialise a bias function $b : V R$ , which is, in practice, a constant-zero function $( b ( v ) = 0$ for all $v \in V .$ ) but will prove necessary for defining the argument pushforward.
+
+We interpret Bellman-Ford as the following polynomial span:
+
+$$
+\begin{array} { c c c } { { ( V + E ) + ( V + E ) \ --- p \longrightarrow V + E } } & { { } } & { { } } \\ { { \big | } } & { { } } & { { \big | } } \\ { { \begin{array} { c c c } { { \scriptstyle \dot { i } } } & { { } } & { { } } \\ { { \big \downarrow } } & { { } } & { { \big \downarrow } } \\ { { \scriptstyle V + ( V + E ) } } & { { } } & { { \scriptstyle V } } \end{array} } } & { { } } \end{array}
+$$
+
+Here “ $+ ^ { \dag }$ is the disjoint union of sets, defined as $A + B = \{ ( a , 1 ) \mid a \in A \} \cup \{ ( b , 2 ) \mid b \in B \} .$ . Note that $[ S + T , R ] \cong [ S , R ] \times [ T , R ]$ , i.e. specifying data on a disjoint union is equivalent to specifying data on each component separately.
+
+Initially, we describe each of the four sets of the polynomial span, making their role clear:
+
+• Input: $W = V + ( V + E )$ . Our input to Bellman-Ford includes: the current estimate of node distances $\dot { \ b { d } } _ { \ b { u } }$ ; a function in $[ V , R ] )$ , edge weights ( $\dot { \boldsymbol { w } }$ ; a function in $[ E , R ] )$ , and the previously discussed bias $b$ , a function in $[ V , R ]$ . Hence our overall inputs are members of $[ V , R ] \times [ E , R ] \times [ V , R ] \cong [ V + ( V + E ) , R ]$ , justifying our choice of input space.
+
+• Arguments: $X = ( V + E ) + ( V + E )$ . Here we collect the ingredients necessary to compute Bellman-Ford’s subproblem solutions coming from neighbouring nodes. To do this, we need to combine data in the nodes with data living on edges—those are the arguments to the function. And since they meet in the edges, we “lift” our node distances $[ V , R ]$ to edges they are sending from, giving us an additional function in $[ E , R ]$ . Hence our argument carrier space is now $( V + E ) + ( V + E )$ (the remaining three inputs remain unchanged).
+
+• Message: $Y = V + E$ . Once the arguments are combined to compute messages, we are left with signal in each edge (containing the sum of corresponding $d _ { u }$ and $w _ { u v . }$ ), and each node (containing just $d _ { u }$ , for the purposes of access to the previous optimal solution). Hence our messages are members of $[ \bar { V } , \bar { R } ] \times [ E , R ]$ , justifying our choice of message space.
+
+• Output: $Z = V$ . Lastly, the output of one step of Bellman-Ford are updated values $d _ { u } ^ { \prime }$ , which we can interpret as just (output) data living on $V$ .
+
+We now describe how to propagate data along each arrow of the diagram in turn, beginning with inputs $( f , b , w )$ of node features $f : V \to R$ , a bias $b : V R$ , and edge weights $w : E R$ :
+
+• Pullback, $i ^ { * }$ : First, we can note the input function $i : ( V + E ) + ( V + E ) V + ( V + E )$ decomposes as the sum of two arrows. $i _ { 1 } : V + E \to V$ is the identity function on $V$ and the source function on $E$ , and $i _ { 2 } : V + E \to V + E$ is just the identity. So we calculate the pullback $i ^ { * } ( f , b , w ) = ( f , f \circ s , b , w )$ , giving us the arguments to compute messages.
+
+• Argument pushforward, $p _ { \otimes }$ : Next, the process function $p$ simply identifies the two copies of $V + E$ , and sums their values. So the argument pushforward is $p _ { \otimes } ( f , f \circ s , b , w ) =$ $( f , f \circ s ) \otimes ( b , w ) = ( f + b , ( f \circ s ) + w )$ . This also allows us to interpret the bias function, $b$ , as a “self-edge” in the graph with weight 0.
+
+• Message pushforward, $o _ { \oplus }$ : The output function $o : V + E V$ is the identity function on $V$ and the target function on $E$ . So the message pushforward gives us $( o _ { \oplus } ( f + b , ( f \circ s ) +$ $\begin{array} { r } { w ) ) ( u ) = ( f ( u ) + b ( u ) ) \oplus \bigoplus _ { t ( e ) = u } ( f \circ s ) ( e ) = \operatorname* { m i n } ( f ( u ) + b ( u ) , \operatorname* { m i n } _ { v \to u } f ( v ) + w _ { v \to u } ) ( f ( u ) + f ( e ) ) } \end{array}$ ).
+
+Letting $b ( u ) = 0$ , we can see that this is exactly Equation 4. So we have produced the formula for the Bellman-Ford algorithm directly from the polynomial span in Diagram 6.
+
+Note that $p _ { \oplus }$ is aligned with using max aggregation in neural networks—directly explaining several previous proposals, such as [31]. But additionally, $p _ { \otimes }$ , as defined, is aligned with concatenating all message arguments together and passing them through a linear function, which is how such a step is implemented in GNNs’ message functions. We now direct our polynomial span analysis at GNNs.
+
+# 6 GNNs
+
+We study the popular message passing neural network (MPNN) model [19], which can be interpreted using the following polynomial span diagram:
+
+$$
+\begin{array} { c c c } { E + ( E + E ) + E } & { \longrightarrow } & { \longrightarrow E } \\ { \big | } & { \big | } & { \big | } \\ { \begin{array} { c c c } { \underline { { i } } } & { \qquad \underline { { o } } } & { \qquad \underline { { o } } } \\ { \big \downarrow } & { \qquad \downarrow } & { \qquad \downarrow } \\ { 1 + V + E } & { } & { } & { V } \end{array} } \end{array}
+$$
+
+Here the set 1 refers to a singleton set—sometimes also called (), or unit—which is used as a carrier for graph-level features. This implies the graph features will be specified as $[ 1 , R ] \cong R$ , as expected.
+
+Given all these features, how would we compute messages? The natural way is to combine the features of the sender and receiver node of each edge, features of said edge, and graph-level features— these will form our arguments, and they need to all “meet” in the edges. This motivates our argument space as $E + ( E + E ) + E$ : all of the above four, accordingly broadcast into their respective edge(s).
+
+The input map, $i$ , is then the unique map to the singleton, the sender and receiver functions on the two middle copies of $E$ , and the identity on the last copy of $E$ , i.e. $i ( a , b , c , d ) = \{ ( ) , s ( b ) , t ( c ) , d \}$ . The process map, $p$ , collapses the four copies of $E$ into just one, to hold the computed message. Lastly, the output map, $o$ , is the target function, identifying the node to which the message will be delivered.
+
+The actual computation performed by the network (over real values in $\mathbb { R }$ , which can support various semirings of interest) is exactly an integral transform, with an extra MLP processing step on messages:
+
+$$
+\begin{array} { r l r } { \left[ E + ( E + E ) + E , \mathbb { R } \right] \longrightarrow p _ { \otimes } \longrightarrow [ E , \mathbb { R } ] \longleftrightarrow \scriptscriptstyle M L P } & { } & \\ { \uparrow } & { \underset { \textit { i } ^ { * } } { \bigcap } } & { } & { \underset { \textit { i } ^ { * } } { \bigcap } } \\ { \Big | } & { } & { \underset { \textit { i } ^ { * } } { \bigcup } } & { } \\ { \left[ 1 + V + E , \mathbb { R } \right] } & { } & { \left[ V , \mathbb { R } \right] } \end{array}
+$$
+
+It is useful to take a moment to discuss what was just achieved: with a single abstract template (the polynomial span), we have successfully explained both a dynamic programming algorithm, and a GNN update rule—merely by choosing the correct support sets and latent space.
+
+# 7 Improving GNNs with edge updates, with experimental evaluation
+
+From now on, we will set $E = V ^ { 2 }$ , as all our baseline GNNs will use fully connected graphs, and it will accentuate the polynomial nature of our construction.
+
+We now show how our polynomial span view can be used to directly propose better-aligned GNN architectures for certain algorithmic tasks. Since the MPNN diagram above outputs only node features, to improve predictive performance on edge-centric algorithms, it is a natural augmentation to also update edge features, by adding edges to the output carrier (as done by, e.g., [1]):
+
+$$
+\begin{array} { c c c } { { V ^ { 2 } + ( V ^ { 2 } + V ^ { 2 } ) + V ^ { 2 } ~ { \longrightarrow } ~ } } & { { V ~ { \longrightarrow } ~ V ^ { 2 } } } \\ { { \big \downarrow } } & { { } } & { { } } \\ { { \begin{array} { l } { { i } } \\ { { \downarrow } } \\ { { \downarrow } } \end{array} } } & { { \begin{array} { r } { { } } \\ { { } } \\ { { } } \\ { { { } } } \end{array} } } \\ { { 1 + V + V ^ { 2 } } } & { { } } & { { V + V ^ { 2 } } } \end{array}
+$$
+
+But notice that there is a problem with the output arrow. Since we are using each message twice, $o$ is no longer a function—it’d have to send each edge message to two different objects! To resolve this, we need to appropriately augment the messages and the arguments. This is equivalent to specifying a new polynomial span with output $V ^ { 2 }$ , which we can then recombine with Diagram 7:
+
+$$
+\begin{array} { l l l l } { { } } & { { ? ~ - } } & { { ~ p ~ - } } & { { ~ ? ~ } } \\ { { } } & { { } } & { { } } & { { } } \\ { { } } & { { \stackrel { i } { \downarrow } ~ } } & { { } } & { { ~ \stackrel { i } { \downarrow } ~ } } \\ { { } } & { { } } & { { } } & { { ~ \downarrow } } \\ { { 1 + V + V ^ { 2 } } } & { { } } & { { } } & { { ~ V ^ { 2 } } } \end{array}
+$$
+
+Most edge-centric algorithms of interest (such as the Floyd-Warshall algorithm for all-pairs shortest paths [14]), compute edge-level outputs by reducing over a choice of “intermediate” node. Hence, it would be beneficial to produce messages with shape $V ^ { 3 }$ , which would then reduce to features over $V ^ { 2 }$ . There are three possible ways to broadcast both node and edge features into $V ^ { 3 }$ , so we propose the following polynomial span, which materialises each of those arguments:
+
+$$
+\begin{array} { c c c } { { V ^ { 3 } + ( V ^ { 3 } + V ^ { 3 } + V ^ { 3 } ) + ( V ^ { 3 } + V ^ { 3 } + V ^ { 3 } ) \longleftarrow \longrightarrow V ^ { 3 } } } & { { \nonumber } } & { { \nonumber } } \\ { { \big \downarrow } } & { { \big \downarrow } } & { { \big \downarrow } } \\ { { \big \downarrow } } & { { \big \downarrow } } & { { \big \downarrow } } \\ { { 1 + V + V ^ { 2 } } } & { { { } } } & { { V ^ { 2 } } } \end{array}
+$$
+
+Finally, inserting this into Diagram 7 gives us a corrected polynomial span with output $V + V ^ { 2 }$ :
+
+$$
+\begin{array} { l c c } { { 4 { \cal V } ^ { 2 } + 7 { \cal V } ^ { 3 } ~ --- ~ p ~ { \longrightarrow } ~ { \cal V } ^ { 2 } + { \cal V } ^ { 3 } } } \\ { { \mid ~ } } \\ { { ~ \stackrel { i } { \downarrow } ~ } } \\ { { ~ \downarrow ~ } } \\ { { 1 + { \cal V } + { \cal V } ^ { 2 } ~ } } & { { ~ { \cal V } + { \cal V } ^ { 2 } } } \end{array}
+$$
+
+Here we have collapsed the copies of $V ^ { 2 }$ and $V ^ { 3 }$ in the argument position for compactness.
+
+While Diagram 7 doesn’t make sense as a polynomial diagram of sets, we can clearly still implement it as an architecture [1], since nothing stops us from sending the same tensor to two places. We want to investigate whether our proposed modification of Diagram 10, which materialises order3 messages, leads to improved algorithmic alignment on edge-centric algorithms. To support this evaluation, we initially use a set of six tasks from the recently proposed CLRS Algorithmic Reasoning Benchmark [32], which evaluates how well various (G)NNs align to classical algorithms, both inand out-of-distribution. We reuse exactly the data generation and base model implementations in the publicly available code for the CLRS benchmark.
+
+We implemented each of these options by making our GNN’s message and update functions be two-layer MLPs with embedding dimension 24, and hidden layers of size 8 and 16. Our test results (out-of-distribution) are summarised in Table 1. For convenience, we also illustrate the in-distribution performance of our models via plots given in Appendix E.
+
+Lastly, we scale up our experiments to 27 different tasks in CLRS, 96-dimensional embeddings, and using the PGN processor [29], which is the current state-of-the-art model on CLRS in terms of task win count [32]. We summarise the performance improvement obtained by our $V ^ { 3 }$ variant of PGN in Table 2, aggregated across edge-centric tasks as well as ones that do not require explicit edge-level reasoning. For convenience, we provide the per-task test performance in Appendix F (Table 3).
+
+We found that the $V ^ { 3 }$ architecture was equivalent to, or outperformed, the non-polynomial $( V ^ { 2 } )$ one in all edge-centric algorithms (up to standard error). Additionally, this architecture appears to also provide some gains on tasks without explicit edge-level reasoning requirements, albeit smaller on average and less consistently. Our result directly validates our theory’s predictions, in the context of presenting a better-aligned GNN for edge-centric algorithmic targets.
+
+Table 1: Test (out-of-distribution) results of our models on all models on the six algorithms studied. $V ^ { 2 }$ corresponds to the baseline model offered by Diagram 7, while $V ^ { 3 }$ corresponds to our proposal in Diagram 10, which respects the polynomial span.
+
+
Algorithm
V2-large
V3-large
V2-small
V3-small
Dijkstra
59.58% ± 2.82
68.53%± 2.40
56.10%± 3.25
60.32%± 2.70
Find Maximum Subarray
8.33%± 0.50
9.06%±0.65
8.46%± 0.55
7.89%±0.64
Floyd-Warshall
7.46%±0.63
9.00%±0.81
6.66%± 0.62
8.23%±0.62
Insertion Sort
15.39% ± 1.27
24.67%±2.44
14.69% ± 1.32
20.23%± 2.21
Matrix Chain Order
67.64% ± 1.23
70.79% ± 1.54
68.85%± 2.26
68.76%± 1.21
Optimal BST
53.03%± 2.80
54.56%± 4.34
46.65% ± 3.82
51.94% ± 4.60
Overall average
35.24%
39.43%
33.57%
36.23%
+
+Table 2: Test (out-of-distribution) results across 27 tasks in CLRS, for the PGN processor network, averaged across edge-centric and other tasks. See Appendix F for the per-task test performances.
+
+
Algorithms
V2-PGN
V3-PGN
Average Improvement
Edge-centric algorithms
35.03%
39.08%
4.44% ± 1.06
Other algorithms
35.37%
36.33%
1.01% ± 0.11
Average of the two groups
35.20%
37.70%
2.73%
+
+# 8 Conclusions
+
+In this paper, we describe the use of category theory and abstract algebra to explicitly expand on the GNN-DP connection, which was previously largely handwaved on specific examples. We derived a generic diagram of an integral transform (based on standard categorical concepts like pullback, pushforward and commutative monoids), and argued why it is general enough to support both GNN and DP computations. With this diagram materialised, we were able to immediately unify large quantities of prior work as simply manipulating one arrow or element in the integral transform. We also provided empirical evidence of the utility of polynomial spans for analysing GNN architectures, especially in terms of algorithmic alignment. It is our hope that our findings inspire future research into better-aligned neural algorithmic reasoners, especially focusing on generalising or diving into several aspects of this diagram.
+
+Lastly, it is not at all unlikely that analyses similar to ours have already been used to describe other fields of science—beyond algorithmic reasoners. The principal ideas of span and integral transform are central to defining Fourier series [35], and appear in the analysis of Yang-Mills equations in particle physics [13]. Properly understanding the common ground behind all of these definitions may, in the very least, lead to interesting connections, and a shared understanding between the various fields they span.
+
+# Acknowledgments and Disclosure of Funding
+
+We would like to thank Charles Blundell, Tai-Danae Bradley, Taco Cohen, Bruno Gavranovic, Bogdan ´ Georgiev, Razvan Pascanu, Karolis Špukas, Grzegorz Swirszcz, and Vincent Wang-Ma ´ scianica for ´ the very useful discussions and feedback on prior versions of this work.
+
+Special thanks to Tamara von Glehn for key comments helping us to formally connect integral transforms to polynomial functors.
+
+This research was funded by DeepMind.
+
+# References
+
+[1] Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018.
+[2] Richard Bellman. On a routing problem. Quarterly of applied mathematics, 16(1):87–90, 1958.
+[3] Richard Bellman. Dynamic programming. Science, 153(3731):34–37, 1966.
+[4] Beatrice Bevilacqua, Yangze Zhou, and Bruno Ribeiro. Size-invariant graph representations for graph classification extrapolations. In International Conference on Machine Learning, pages 837–851. PMLR, 2021.
+[5] Michael M Bronstein, Joan Bruna, Taco Cohen, and Petar Velickovi ˇ c. Geometric deep learning: ´ Grids, groups, graphs, geodesics, and gauges. arXiv preprint arXiv:2104.13478, 2021.
+[6] Francesca Cagliari and Sandra Mantovani. Cartesianness: topological spaces, uniform spaces, and affine schemes. Topology and its Applications, 41:263–272, 1991.
+[7] Quentin Cappart, Didier Chételat, Elias Khalil, Andrea Lodi, Christopher Morris, and Petar Velickovi ˇ c. Combinatorial optimization and reasoning with graph neural networks. ´ arXiv preprint arXiv:2102.09544, 2021.
+[8] Eugenia Cheng. Iterated distributive laws. In Mathematical Proceedings of the Cambridge Philosophical Society, volume 150, pages 459–487. Cambridge University Press, 2011.
+[9] Pim de Haan, Taco S Cohen, and Max Welling. Natural graph networks. Advances in Neural Information Processing Systems, 33:3636–3646, 2020.
+[10] Oege De Moor. Categories, relations and dynamic programming. Mathematical Structures in Computer Science, 4(1):33–69, 1994.
+[11] Andreea-Ioana Deac, Petar Velickovi ˇ c, Ognjen Milinkovic, Pierre-Luc Bacon, Jian Tang, and ´ Mladen Nikolic. Neural algorithmic reasoners are implicit planners. Advances in Neural Information Processing Systems, 34, 2021.
+[12] Andrew Dudzik. Quantales and hyperstructures: Monads, mo’problems. arXiv preprint arXiv:1707.09227, 2017.
+[13] Michael G Eastwood, Roger Penrose, and RO Wells. Cohomology and massless fields. Commun. Math. Phys, 78(3):305–351, 1981.
+[14] Robert W Floyd. Algorithm 97: shortest path. Communications of the ACM, 5(6):345, 1962.
+[15] Brendan Fong and David I Spivak. An invitation to applied category theory: seven sketches in compositionality. Cambridge University Press, 2019.
+[16] Karlis Freivalds, Em¯ıls Ozolin, š, and Agris Šostaks. Neural shuffle-exchange networks-sequence processing in o (n log n) time. Advances in Neural Information Processing Systems, 32, 2019.
+[17] Nicola Gambino and Joachim Kock. Polynomial functors and polynomial monads. In Mathematical proceedings of the cambridge philosophical society, volume 154, pages 153–192. Cambridge University Press, 2013.
+[18] Jeffrey Giansiracusa and Noah Giansiracusa. Equations of tropical varieties. Duke Mathematical Journal, 165(18):3379–3433, 2016.
+[19] Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In International conference on machine learning, pages 1263–1272. PMLR, 2017.
+[20] Arthur Jacot, Franck Gabriel, and Clément Hongler. Neural tangent kernel: Convergence and generalization in neural networks. Advances in neural information processing systems, 31, 2018.
+[21] Vinod Nair, Sergey Bartunov, Felix Gimeno, Ingrid von Glehn, Pawel Lichocki, Ivan Lobov, Brendan O’Donoghue, Nicolas Sonnerat, Christian Tjandraatmadja, Pengming Wang, et al. Solving mixed integer programs using neural networks. arXiv preprint arXiv:2012.13349, 2020.
+[22] Susan Niefield. Cartesianness: topological spaces, uniform spaces, and affine schemes. J. Pure Appl. Alg., 23:147–163, 1982.
+[23] Alvaro Sanchez-Gonzalez, Jonathan Godwin, Tobias Pfaff, Rex Ying, Jure Leskovec, and Peter Battaglia. Learning to simulate complex physics with graph networks. In International Conference on Machine Learning, pages 8459–8468. PMLR, 2020.
+[24] Heiko Strathmann, Mohammadamin Barekatain, Charles Blundell, and Petar Velickovi ˇ c. Persis-´ tent message passing. arXiv preprint arXiv:2103.01043, 2021.
+[25] Daisuke Tambara. On multiplicative transfer. Communications in Algebra, 21(4):1393–1420, 1993.
+[26] Hao Tang, Zhiao Huang, Jiayuan Gu, Bao-Liang Lu, and Hao Su. Towards scale-invariant graph-related problem solving by iterative homogeneous gnns. Advances in Neural Information Processing Systems, 33:15811–15822, 2020.
+[27] Petar Velickovi ˇ c and Charles Blundell. Neural algorithmic reasoning. ´ Patterns, 2(7):100273, 2021.
+[28] Petar Velickovi ˇ c, Matko Bošnjak, Thomas Kipf, Alexander Lerchner, Raia Hadsell, Raz- ´ van Pascanu, and Charles Blundell. Reasoning-modulated representations. arXiv preprint arXiv:2107.08881, 2021.
+[29] Petar Velickovi ˇ c, Lars Buesing, Matthew Overlan, Razvan Pascanu, Oriol Vinyals, and Charles ´ Blundell. Pointer graph networks. Advances in Neural Information Processing Systems, 33:2232–2244, 2020.
+[30] Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017.
+[31] Petar Velickovi ˇ c, Rex Ying, Matilde Padovano, Raia Hadsell, and Charles Blundell. Neural ´ execution of graph algorithms. arXiv preprint arXiv:1910.10593, 2019.
+[32] Petar Velickovi ˇ c, Adrià Puigdomènech Badia, David Budden, Razvan Pascanu, Andrea Ban- ´ ino, Misha Dashevskiy, Raia Hadsell, and Charles Blundell. The clrs algorithmic reasoning benchmark. arXiv preprint arXiv:2205.15659, 2022.
+[33] Philip Wadler. Comprehending monads. In Proceedings of the 1990 ACM Conference on LISP and Functional Programming, pages 61–78, 1990.
+[34] Mark Weber. Polynomials in categories with pullbacks. Theory and Applications of Categories, 30(16):533–598, 2015.
+[35] Simon Willerton. Integral transforms and the pull-push perspective, i. The n-Category Café, 2020.
+[36] Louis-Pascal Xhonneux, Andreea-Ioana Deac, Petar Velickovi ˇ c, and Jian Tang. How to transfer ´ algorithmic reasoning knowledge to learn new algorithms? Advances in Neural Information Processing Systems, 34, 2021.
+[37] Keyulu Xu, Jingling Li, Mozhi Zhang, Simon S Du, Ken-ichi Kawarabayashi, and Stefanie Jegelka. What can neural networks reason about? arXiv preprint arXiv:1905.13211, 2019.
+[38] Keyulu Xu, Mozhi Zhang, Jingling Li, Simon S Du, Ken-ichi Kawarabayashi, and Stefanie Jegelka. How neural networks extrapolate: From feedforward to graph neural networks. arXiv preprint arXiv:2009.11848, 2020.
+[39] Zhaocheng Zhu, Zuobai Zhang, Louis-Pascal Xhonneux, and Jian Tang. Neural bellman-ford networks: A general graph neural network framework for link prediction. Advances in Neural Information Processing Systems, 34, 2021.
+
+# Checklist
+
+The checklist follows the references. Please read the checklist guidelines carefully for information on how to answer these questions. For each question, change the default [TODO] to [Yes] , [No] , or [N/A] . You are strongly encouraged to include a justification to your answer, either by referencing the appropriate section of your paper or providing a brief inline description. For example:
+
+• Did you include the license to the code and datasets? [Yes] See Section ??.
+• Did you include the license to the code and datasets? [No] The code and the data are proprietary.
+• Did you include the license to the code and datasets? [N/A]
+
+Please do not modify the questions and only use the provided macros for your answers. Note that the Checklist section does not count towards the page limit. In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below.
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] We propose a novel approach to reinterpret both graph neural networks and dynamic programming, and show empirical gains from an architecture motivated by our blueprint.
+(b) Did you describe the limitations of your work? [Yes]
+(c) Did you discuss any potential negative societal impacts of your work? [N/A] Our work is of a theoretical nature.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes] Appropriate references to proofs are provided in all areas where proofs are missing.
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No] We aim to release the code at a future point. The data is publicly available.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] The data generation and base model implementation is publicly available within the CLRS benchmark. We detail the model extensions we made.
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes]
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes] We cite the CLRS benchmark.
+(b) Did you mention the license of the assets? [N/A]
+(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] Our data is abstract and algorithmically generated.
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/wv79UiY5U7/wv79UiY5U7.md b/md/dev/wv79UiY5U7/wv79UiY5U7.md
new file mode 100644
index 0000000000000000000000000000000000000000..21b6e6f5fa3c325adad7b099ef7365483c653a69
--- /dev/null
+++ b/md/dev/wv79UiY5U7/wv79UiY5U7.md
@@ -0,0 +1,437 @@
+# Data Curation for Image Captioning with Text-to-Image Generative Models
+
+Anonymous Author(s)
+Affiliation
+Address
+email
+
+# Abstract
+
+1 Recent advances in image captioning are driven by increasingly larger-scale vision–
+2 language pretraining, relying on massive computational resources and increasingly
+3 large datasets. Instead of solely focusing on scaling pretraining, we ask whether
+4 it is possible to improve performance by improving the quality of the samples in
+5 existing datasets. We pursue this question through two approaches to data curation:
+6 one that assumes that some examples should be avoided due to mismatches between
+7 the image and caption, and one that assumes that the mismatch can be addressed by
+8 replacing the image, for which we use the state-of-the-art Stable Diffusion model.
+9 These approaches are evaluated using the BLIP model on the COCO and Flickr30K
+10 datasets. Models trained with our data curation approaches consistently outperform
+11 their baselines, indicating that better image captioning models can be trained by
+12 curating existing resources. Finally, we conduct a human study to understand the
+13 errors made by the Stable Diffusion model and highlight directions for future work
+14 in text-to-image generation.
+
+# 15 1 Introduction
+
+16 Large-scale vision–language pretraining has been the driving force behind recent advances in image
+17 captioning [14]. The amount of image–text data needed to pretrain recent generative language
+18 models [28, 23, 53] has made it necessary to train on “noisy” samples harvested from the web
+19 [46, 45], as opposed to crowdsourced captions [32]. This emerging reliance on harvested data has
+20 made it important to perform additional filtering steps to remove low-quality data [28], in addition to
+21 more resource-intensive pretraining. Given that computing resources are not equally distributed [21],
+22 there is a need to also pursue less resource-intensive research directions.
+23 We show how to improve image captioning by improving the quality of the downstream task data
+24 through data curation: the process of dynamically updating the samples during training. We devise
+25 three techniques for data curation that are designed to prevent the total size of the dataset from
+26 increasing: the complete removal of an image–caption sample from a dataset; replacing a caption
+27 with another caption; and replacing images using a text-to-image generation model [41]. These
+28 curation techniques are used to update image–caption samples that have outlier losses, with respect
+29 to the rest of a training dataset, under the current model parameters. In other words, the samples that
+30 are proving difficult to model. Also, the synthesis of completely new images is radically different
+31 from standard data augmentation techniques, such as random cropping or color manipulation [47], or
+32 swapping and mask words in text [12].
+33 We conduct experiments using BLIP [28], a strong image captioning model, on the Flickr30K [56]
+34 and MS COCO datasets [32]. The results show that the sample removal and image replacement
+35 techniques lead to consistent improvements of 1–3 CIDEr points compared to not curating the
+36 dataset. Our analyses show that Flickr30K benefits from more curation than COCO due to differences
+37 in the distribution of long captions in each dataset. Finally, we find that it is better to curate the
+38 data dynamically while training instead of replacing images before starting to train the model.
+39 Taken together, these findings show the promise of model-in-the-loop text-to-image generation for
+40 multimodal learning, while highlighting that improvements in text-to-image generation are likely to
+41 further enhance the effectiveness of data curation.
+
+
+Figure 1: Overview of our data curation approaches. For dynamic removal or replacement of captions, high loss image-text pairs are either removed or the image is paired with an alternative caption in the following training epoch. For image replacement, captions of original images are used as prompts for text-to-image generation to synthesize new image–text pairs. We experiment with both options of replacing the image only, or pair another relevant caption to the synthesized image.
+
+# 42 2 Related work
+
+43 Image Captioning Image Captioning is the task of describing images with syntactically and
+44 semantically sentences. Current deep learning-based image captioning models have evolved as
+45 the encode-decoder frameworks with multi-modal connection [8, 9], attentive [24, 16] and fusion
+46 strategies [58]. Standard captioning datasets contain Flickr30K [56] and the commonly used MS
+47 COCO [32], which consisting of images with events, objects and scenes. Each image is paired with
+48 five captions. Some works have demonstrated the benefits of training on synthetic captions [29, 3] or
+49 datasets collected from other vision-and-language learning tasks [38, 7].
+50 Data Augmentation Data augmentation [13] has achieved increasing attention in both natural
+51 language processing [33] and vision-and-language learning [27]. Early methods generate augmented
+52 examples in the model’s feature space [54] or interpolate the inputs and labels of few examples [57].
+53 For downstream tasks in the text domain, Yang et al. [55] and Anaby-Tavor et al. [1] generate
+54 synthetic text examples through state-of-the-art pretrained language models and show improved
+55 performance on common-sense reasoning and text-classification. For image captioning, BERT [11]
+56 has been used to generate additional captions to improve the diversity of the captioning datasets [3].
+57 Hossain et al. [22] used GAN-synthesized images as additional augmentation training set to improve
+58 image captioning models.
+59 Diffusion Models and Application Diffusion models [49, 35] have grown rapidly and become
+60 the powerful deep generative models. They have shown potential in a variety of applications,
+61 including text-to-image generation [36, 15], image-to-image translation [42], as well as semantic
+62 segmentation [26, 5] and video generation [20, 48, 52]. While recent large scale latent diffusion
+63 models have shown strong capability in generating both artistic and photo-realistic high-resolution
+64 images [41, 34, 39, 43], applying large-scale stable diffusion models in vision-language downstream
+65 tasks remains under-explored. Concurrently, Azizi et al. [4] and Jain et al. [25] show that image
+66 classifiers can be improved by learning from augmentation images generated by finetuned stable
+67 diffusion models. To the best of our knowledge, we are the first to explore how image captioning
+68 models can benefit from simple data curation without scaling up existing datasets, and how stable
+69 diffusion text-to-image models can be applied and contribute in the process.
+
+# 70 3 Data Curation for Captioning
+
+71 Our goal is to improve image captioning models by preventing the model from training on difficult
+72 samples. There are many reasons for the possible existence of these difficult samples, including
+73 mismatches or inconsistencies between the image and caption [3]. More formally, given an image
+74 captioning training dataset $\mathcal { D }$ with $K$ images, let $\mathrm { I } _ { k }$ be the $k$ -th image. Each image is paired with
+75 $J$ captions; let $\mathrm { C } _ { k } ^ { j }$ be $j$ th caption of image $k$ , and thus, let $( \boldsymbol { \mathrm { I } } _ { k } , \boldsymbol { \mathrm { C } } _ { k } ^ { j } )$ be an image–caption sample in
+76 the dataset. Assume the existence of model $\mathcal { M }$ , which is being trained on dataset $\mathcal { D }$ , from which we
+77 can calculate the loss of each sample at each epoch $t$ : $\mathcal { L } _ { \mathcal { M } } ^ { t } ( \mathrm { I } _ { k } , \mathrm { C } _ { k } ^ { j } )$ , which can be used to track the
+78 difficult samples. At the end of each epoch, the difficult samples are candidates for our data curation
+79 techniques, resulting in dynamic updates to the training dataset $\mathcal { D } \to \mathcal { D } _ { 1 } \to \cdots \to \mathcal { D } _ { T }$ .
+
+# 3.1 Identifying the difficult samples
+
+81 Difficult training samples may contain mismatches or inconsis
+82 tencies between the image and the caption [3]. We propose to
+83 use the captioning model that is being trained to automatically
+84 identify such samples. After each epoch, we compute the loss
+85 of each sample in the current training dataset, given the current
+86 model parameters. The highest loss samples are targets for our
+87 data curation methods; more specifically, we focus on samples
+88 with losses that are either two standard deviations from the mean,
+89 or a fixed $X \%$ away e.g. $10 \%$ , $20 \%$ , etc. In this way, the training
+90 dataset is dynamically updated at the end of each epoch according
+91 to the model’s captioning capability. The adjacent figure shows
+92 the empirical distribution of losses in the training samples of
+93 the Flickr30K dataset. It is clear that, without data curation, the
+94 high-loss samples remain high-loss during five epochs of training.
+
+
+Figure 2: Distribution of persample losses in Flickr30K.
+
+# 95 3.2 Sample Removal / Caption Replacement
+
+The simplest approach to data curation is to remove or replace the high-loss samples. In REMOVE, the high-loss samples are completely removed from the remainder of the training process, reducing the total number of image–caption training samples. In REPLACECAP, we simply replace the caption in the image–caption sample with a different caption taken from the other captions that describe the image, effectively creating a duplicate. With the caption replacement method, the total number of samples used to train the model remains the same, as well as the total number of the unique images. This creates a clean control condition for the subsequent experiments.
+
+# 103 3.3 Image Generation-based Replacement
+
+An alternative to removing difficult samples or replacing captions is to pair an existing caption with a new image. This has the benefit of training the model on the same total number of samples while exposing it to more unique images. The new image could be found by humans, in a long-running human-in-the-loop cycle. Instead, we use a text-to-image generation model, in a rapid model-inthe-loop step, to synthesize images based on the other sentences that describe the image. Some representative examples of images generated using this technique can be seen in Figure 10.
+
+Our methodology is based on the open source Stable Diffusion model [41], which can generate images given a textual prompt. 1 We integrate this into training as follows: Given an image $I _ { k }$ in the training data and its captions $\{ ( I _ { k } , C _ { k } ^ { 1 } ) , \ldots , ( I _ { k } , C _ { k } ^ { J } ) \}$ , we synthesize a new image $\hat { I } _ { k }$ without increasing the total number of samples in the original dataset. Instead, we replace the original image in the sample with the generated image. Specifically, for image $I _ { k }$ , we replace a high-loss sample $( I _ { k } , C _ { k } ^ { j } )$ with the synthesized image-text pair $( \hat { I } _ { k } , C _ { k } ^ { j } )$ .
+
+# 116 Round-trip captioning evaluation
+
+117 In order to effectively use a text-to-image generation model for data curation, we need an objec
+118 tive measure that can estimate the expected quality of a generated image. Most previous work
+119 uses image-oriented measures like FID [19] or CLIPScore [17] but these measures are claimed
+120 to lack alignment with perceptual quality [44]. We also found they were not suitable for our
+121 purpose, and that CLIPScore cannot distinguish between low- and high-loss samples in the cap
+122 tioning model (Figure 9). Here, we propose an alternative that is directly related to our task: given
+123 the generated image, measure the quality of the caption that can be generated by a fixed model.
+124 Our assumption is that if the generated images
+125 are of a similar quality to the original images,
+126 the resulting captions should be similar to each
+127 other. We call this a round-trip captioning evalu
+128 ation, which comprises three steps illustrated in
+129 Figure 3. In Step (1), we use the captions in the
+130 validation set to generate images using a text-to
+131 image generation model. In Step (2), we use an
+132 existing image-captioning model to predict cap
+133 tions for the generated images. Specifically, we
+134 use BLIP fine-tuned on the COCO dataset but
+135 any other strong captioning model could be used
+136 instead. Finally, in Step (3), we compare the pre
+137 dicted captions against the original captions. We
+138 now discuss the the factors that we found make
+139 a difference when generating images.
+
+
+Figure 3: Round-trip captioning evaluation.
+
+# 140 Prompt engineering matters
+
+Recall that text-to-image generation models produce images based on a textual prompts. Given a set of five captions that describe an image, there are several options for how to prompt the image generation model. We experiment with three options:
+
+• Single caption: Each caption is used in isolation to generate a new image. • Sentence-BERT selection: There is a lot of variety in how different captions describe the same image. Instead of using all captions, we can use a representative caption from the set. This is achieved using the Sentence-BERT [40] model to find the caption that is closest to the average embedding of all captions. • Concatenation: All five captions are concatenated as the text prompt for generation.
+
+For all three approaches mentioned above, we can append an additional string to the prompt as a styler to force a specific style in the generated image $+ \cal S$ tyler). The styler used here is: "national geographic, high quality photography, Canon EOS R3, Flickr".2
+
+# Finetuning improves image relevance
+
+Table 1 shows the results of the round-trip captioning evaluation on the Flickr30K dataset using different textual prompts and whether or not to fine-tune the diffusion model. When we fine-tune StableDiffusion, we use the MS COCO [32] dataset with a prompt consisting of a concatenation of all 5 captions, for 15,000 steps with a constant learning rate of $1 e { - } 5$ and a batch size of 32. The best performance is clearly found by fine-tuning Stable Diffusion 1.5 and using a prompt with a concatenation of the captions and the styler. We use this configuration in the remainder of the paper.
+
+Table 1: Round-trip captioning evaluation on Flickr30K with different Stable Diffusion models, prompts, and fine-tuning. BLEU, CIDEr, Meteor.
+
+
Model
FT
Prompt
B
C
M
Upper-bound
37.6
27.2
57.1
SD 1.5
=
concat
31.0
24.7
52.5
SD 1.5
-
+ styler
30.8
24.2
52.5
SD 1.5
F
+ styler
33.5
25.0
53.5
SD 1.5
F
SBERT + styler
30.6
24.1
52.0
SD 2.0
-
concat + styler
31.2
24.8
52.0
+
+
+Figure 4: Qualitative examples from the COCO dataset of captions generated by the BLIP model (top), and the same model trained using our REPLACEIMG data curation (bottom). The errors made by the BLIP model (shown in red) are avoided by REPLACEIMG curation (shown in blue).
+
+# 167 4 Experiments
+
+168 We evaluate our data curation methods on the MS COCO and Flickr30K datasets when finetuning the
+169 pretrained BLIP [28] model. We evaluate the captions using BLEU [37], METEOR [10], ROUGE
+170 [31], CIDEr [51], SPICE [2], CLIPScore, and RefCLIPScore [18].
+171 We use the ViT-based BLIP model [28] as our captioning model. We note that BLIP has a captioning
+172 and filtering (CapFilt) data augmentation process during its pretraining, where both components were
+173 finetuned on the COCO dataset. Therefore we use pretrained checkpoint $\mathrm { B L I P } _ { C a p F i l t }$ for Flick $3 0 \mathrm { k }$
+174 and $\mathrm { B L I P } _ { b a s e }$ for COCO in our experiment, removing the effects from the CapFilt process. We
+175 finetune BLIP using a batch size of 128 for 5 epochs on $4 \times$ A100 GPUs.
+
+# 4.1 Results
+
+Removal/Caption Replacement As shown in Table 2, dynamically removing mismatched imagetext pairs or replacing captions can effectively improve performance on both datasets over baselines on all metrics. For Flickr30K, the dynamic updates work best when apply to the top $1 \%$ of high-loss samples for REPLACECAP, and to samples whose loss are two standard deviations higher than the mean for REMOVE. For COCO, both REPLACECAP and REMOVE works best when curating the top $1 \%$ of high-loss samples. We repeat that during the curation process, no additional data samples or computation cost is introduced. We further study the effect of the amount of curation in Section 5.
+
+184 Image Generation-based Replacement We evaluate Image Generation-based Replacement on
+185 both the Flickr30K and COCO dataset. During finetuning, we replace images in the original text
+186 image pairs with Stable Diffusion-synthesized images (ReplaceImg in Table 2). The results show
+187 improvements compared to the baseline in every evaluation measure with best performance obtained
+188 at replacement ratio of $40 \%$ for Flickr30K and at $10 \%$ for COCO. We show qualitative examples in
+189 Figure 4, where models finetuned with our proposed curation method can generate better captions for
+190 some scenes that may confuse the standard finetuned model. In Section 5.1, we analyze the effects of
+191 varying the amount of synthetic images replaced, and in Section 5.2, we conduct a human study of
+192 the types of errors found in the generated images.
+
+
+Figure 5: Effects of the amount of data curated when finetuning the captioning model. We can observe that Flickr30K needs more curation $40 \%$ REPLACEIMG or 2 std REMOVE) than COCO ( $10 \%$ REPLACEIMG or $1 \%$ REPLACECAP). Flickr30K benefits more from removing high-loss training samples, indicating the original dataset may be noisier than MS COCO. For the 2 std approach, the number of samples curated is not fixed after each epoch and varies between $5 \%$ to $10 \%$ .
+
+# 193 5 Analysis and Discussion
+
+# 5.1 Data Curation: how much and when?
+
+We analyze how the amount of curation affects image captioning performance. We examine different ratios of training samples that are removed, replaced with an alternative caption, or replaced with a synthesized image. For REMOVE and REPLACECAP, we consider curation ratio of $1 \%$ , $5 \%$ and $10 \%$ of high-loss samples. For REPLACEIMG, we consider $10 \% { - } 8 0 \%$ curation ratio. In addition to fixed $X \%$ ratios, we also intereven on samples that have losses two standard deviations worse than the mean.
+
+201 Flickr30K needs more curation than COCO. The results of this analysis are shown in Figure 5.
+202 The best improvement in performance for Flickr30K is achieved either through removing high loss
+203 samples that are two standard deviations away, or replacing images for $40 \%$ of the high loss samples.
+204 In the COCO dataset, replacing images for $10 \%$ of the
+205 high loss samples gives the best improvement compared
+206 to no data curation. The second best performing method
+207 for COCO is removing or replacing captions of only $1 \%$
+208 of the high loss samples. This indicates that Flickr30K
+209 may contain more noisy samples than the MS COCO
+210 dataset. Compared to MS COCO, Flickr30K contains
+211 more samples with long captions (Figure 6), which may
+212 include overly-specific details that are inconsistent with
+213 other captions and are hard for the model to learn. See
+214 more examples in our supplemental materials. Through
+215 our curation-based finetuning, these samples can be effec
+216 tively identified, removed or replaced, which indicates that
+217 our method is efficient when training with noisy datasets. We note that curating more than $50 \%$ of
+218 the data does not benefit training and actually harms performance.
+219 Static image replacement versus dynamic replacement In REPLACEIMG (Section 3.3), we
+220 dynamically replace images for the difficult training samples. Another static approach is to replace
+221 the identical images, i.e. $I _ { k }$ in $\{ ( I _ { k } , C _ { k } ^ { 1 } ) , \ldots , ( I _ { k } , \check { C } _ { k } ^ { J } ) \}$ , with unique SD-synthesized images before
+222 training, instead of updating the training samples while training. With static image replacement, for
+223 each of the reference captions, we replace their original image with a SD-synthesized image. Static
+224 replacement with $20 \% { - } 8 0 \%$ curation ratio corresponds to replacing images for one–four captions of
+
+
+Figure 6: Distribution of caption lengths.
+
+
+Figure 7: Dynamic image replacement against static replacement, as a function of the number of samples replaced.
+
+
+Figure 8: Loss distribution of training samples across epochs with different curation methods.
+
+
+(a) Distribution of text-to-image generation errors.
+
+
+(b) Human evaluation versus CLIPScore.
+
+Figure 9: Results of the human study of the errors made by the Stable Diffusion model in 100 images. The images used in the study were chosen to represent either low or high model loss. (a) Histogram of the number of errors annotated in each category. The most frequently occurring annotations concern weird deformations in the expected objects or humans. (b) Relationship between average number of identified errors by human annotations for each synthesized image and its captioning loss with regard to original captions. More errors are identified in images of higher loss. However, CLIPScore appears to fail in validating qualities of the synthesized images, as the score ranges are almost identical for samples that contain more errors.
+
+225 the original five. The $50 \%$ replacement ratio mimics a fair coin-flip, where for each of the text-image
+226 samples, there is $50 \%$ probability for the image to be replaced by a synthesized image.
+227 We compare the efficacy of these two approaches in Figure 7. When evaluating on the original
+228 1k validation set, we see that for both approaches, incorporating synthesized images of $20 \%$ or
+229 $40 \%$ can assist finetuning and achieves higher BLEU4 and CIDEr scores. Nevertheless, dynamic
+230 image replacement consistently performs better than the static method, showing focusing on the hard
+231 samples is effective. For both replacement methods, performance starts to decrease when the curation
+232 ratio is too high. This may indicate that when incorporating too many images from the synthetic
+233 distribution, the gap increases between the training and evaluation sets.
+234 Figure 8 shows the effect of the curation techniques in the training loss distributions across epochs.
+235 For the REMOVE approach, training samples with loss that are two standard deviations worse than the
+236 mean are dynamically removed during training, leading to the shrinking tail of the loss distribution.
+237 SD-based image replacement gradually reduces losses through learning from a mixture of Gaussian
+238 distribution from original image-text pairs and the ones contain synthesized images.
+
+
Image
Caption
CLIPScore Loss
Categorized Errors
A picture of two women with one in lacy white dress with handbag and leggings and the other with a tall red hat, black mid-dress,and frame like plastic dress on top.
84.1
181.0
type/color of clothing, color-clothing, weird-face
A man in a black suit with tie and corsage smiles77.6 at a girl who smiles back,both are sitting at a tableat a semi formal event such as a wedding or reunion.
Many children are playing and swimming in the water.
78.2
26.9
weird-face, weird-body-parts
+
+Figure 10: Examples of synthesized images that are of high losses (top) and examples of synthesized images that are of low losses (bottom). Human annotations show that consistent error types have been recognized for the high loss samples while CLIPScore fails to align with human judgement. The low loss synthesized images are visually less complicated than the higher loss ones, but can still often look weird and contain errors in color or objects.
+
+# 239 5.2 Human Study: Errors made by SD models
+
+Finally, we conduct a human study of the errors present in the SD-synthesized images. This will serve to better understand any shortcomings with this approach that is not captured by automatic evaluation measures.
+
+243 We first ranked SD-synthesized images by model loss from the 1K images in the validation set. This
+244 validation set of synthesized images was generated using the best performing configuration of the
+245 Stable Diffusion model (see Section 3.3). We then sampled a subset for human annotation using the
+246 top and bottom 50 images based on their loss using our fine-tuned captioning model. These images
+247 are uniformly divided into 5 sets, each containing 20 images with equal number of the high loss
+248 ones and the low loss ones. The data was annotated by 12 people, members of a university research
+249 lab with a basic understanding of Stable Diffusion but no knowledge of the bi-modal distribution
+250 of images. The annotators were asked to categorize the errors they observed in the synthesized
+251 images, given both the image and the reference sentences that were used to generate the images. Each
+252 participant annotated one set of 20 images.
+253 Starting from the categories defined by van Miltenburg and Elliott [50], we predefined 25 categories
+254 including general errors such as color, or number mismatches, and errors related to people and
+255 objects in the images. Please see the user interface in supplemental materials. We analyze the human
+256 judgements for the images that have at least three annotations, yielding 74 unique images.
+257 As shown in Figure 9a, the most common problem of SD-synthesized images are that they often
+258 generate weird face or body parts, which makes the images less natural or pleasant. The Stable
+259 Diffusion model is also weak at generating the correct number of people or objects. From Figure 9b
+260 we confirm the quality of our collected annotations that high loss figures often contain more errors
+261 on average. Furthermore, we note that CLIPScore does not appear to align with human judgements,
+262 indicating its weak capability of evaluating quality of generated images. Please see more concrete
+263 examples in Figure 10.
+
+# 264 6 Conclusion
+
+65 In this paper, we have shown a simple, yet effective, data curation framework that can improve the
+66 performance of image captioning models. We investigated three approaches to data curation that
+67 dynamically update the training dataset based on high-loss image-caption samples. The methods
+68 involved either removing a sample, replacing the caption in a sample, or generating a new image
+69 from existing captions. Experimental results on the Flickr30K and MS COCO datasets show the
+70 effectiveness of these approaches to data curation without increasing the total size of the training
+71 dataset. A deeper analysis of the images synthesized by Stable Diffusion shows frequent errors on
+72 generating objects of a certain amount or color, and struggles with human body features. A human
+73 evaluation of the errors in those images shows a clear difference in images with high or low losses.
+274 In the future, we expect that better text-to-image generation models will lead to further improvements
+275 from using synthesized images for difficult captions in existing training datasets. We plan on
+276 verifying whether these findings extend to other image captioning models, which was not possible
+277 here due to computational issues. Finally, we are interested in applying the same framework to other
+278 multimodal tasks, especially those with undercomplete datasets that cannot comprehensively cover
+279 the distributional space due to the cost of crowdsourcing enough data, e.g. visual question answering,
+280 or visually-grounded dialog.
+
+# 281 Limitations
+
+While our curation methods being effective on image-captioning in the finetuning and fewshotlearning settings, it is not clear if the same strategy can be scaled and adapted also to vision-language pretraining. Currently our data curation methods also rely on state-of-the art pretrained models for both image understanding and text-to-image generation. In pretraining, models will often be trained from scratch and pretraining data are often collected from multiple datasets and resources.
+
+Moreover, while we take an online approach to data curation, our current approach is upper bounded in speed and performance of the text-to-image generation model. This might be a large bottle neck for adapting the strategy for more complicated vision-and-language tasks.
+
+# 290 Ethics Statement
+
+Text-to-image generation with Stable Diffusion is controversial in the broader AI and ethics community[6]. For example, it can generate images according to gender or racial stereotypes, which may prove harmful to members of those communities [30]. In this paper, we use Stable Diffusion to improve the quality of an image captioning model, given a specific set of crowdsourced captions. Those captions may themselves contain harmful stereotypes that would become more prevalent in our dynamically updated training datasets. As we dynamically update the model with new images based on loss values, we remove the water-marker in our generated images to prevent information leak to the model. Use of the synthesized images will strictly follow community guidelines.
+
+# References
+
+[1] Ateret Anaby-Tavor, Boaz Carmeli, Esther Goldbraich, Amir Kantor, George Kour, Segev Shlomov, Naama Tepper, and Naama Zwerdling. Do not have enough data? deep learning to the rescue! In AAAI, pages 7383–7390. AAAI Press, 2020. 2
+
+304 [2] Peter Anderson, Basura Fernando, Mark Johnson, and Stephen Gould. Spice: Semantic
+305 propositional image caption evaluation. In European conference on computer vision, pages
+306 382–398. Springer, 2016. 5
+307 [3] Viktar Atliha and Dmitrij Šešok. Text augmentation using bert for image captioning. Applied
+308 Sciences, 2020. 2, 3
+309 [4] Shekoofeh Azizi, Simon Kornblith, Chitwan Saharia, Mohammad Norouzi, and David J. Fleet.
+310 Synthetic data from diffusion models improves imagenet classification, 2023. 2
+311 [5] Dmitry Baranchuk, Andrey Voynov, Ivan Rubachev, Valentin Khrulkov, and Artem Babenko.
+312 Label-efficient semantic segmentation with diffusion models. In International Conference on
+313 Learning Representations, 2022. URL https://openreview.net/forum?id $\underset { . } { = }$ SlxSY2UZQT.
+314 2
+315 [6] Nicholas Carlini, Jamie Hayes, Milad Nasr, Matthew Jagielski, Vikash Sehwag, Florian Tramèr,
+316 Borja Balle, Daphne Ippolito, and Eric Wallace. Extracting training data from diffusion models.
+317 arXiv preprint arXiv:2301.13188, 2023. 9
+318 [7] Soravit Changpinyo, Doron Kukliansy, Idan Szpektor, Xi Chen, Nan Ding, and Radu Sori
+319 cut. All you may need for VQA are image captions. In Marine Carpuat, Marie-Catherine
+320 de Marneffe, and Iván Vladimir Meza Ruíz, editors, NAACL, pages 1947–1963. Association for
+321 Computational Linguistics, 2022. 2
+322 [8] Fuhai Chen, Rongrong Ji, Jinsong Su, Yongjian Wu, and Yunsheng Wu. Structcap: Structured
+323 semantic embedding for image captioning. In Qiong Liu, Rainer Lienhart, Haohong Wang,
+324 Sheng-Wei "Kuan-Ta" Chen, Susanne Boll, Yi-Ping Phoebe Chen, Gerald Friedland, Jia Li, and
+325 Shuicheng Yan, editors, MM, pages 46–54. ACM, 2017. 2
+326 [9] Fuhai Chen, Rongrong Ji, Xiaoshuai Sun, Yongjian Wu, and Jinsong Su. Groupcap: Group
+327 based image captioning with structured relevance and diversity constraints. In CVPR, pages
+328 1345–1353. Computer Vision Foundation / IEEE Computer Society, 2018. 2
+329 [10] Michael Denkowski and Alon Lavie. Meteor universal: Language specific translation evaluation
+330 for any target language. In Proceedings of the ninth workshop on statistical machine translation,
+331 pages 376–380, 2014. 5
+332 [11] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of
+333 deep bidirectional transformers for language understanding. In Proceedings of the 2019 Confer
+334 ence of the North American Chapter of the Association for Computational Linguistics: Human
+335 Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis,
+336 Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423.
+337 URL https://aclanthology.org/N19-1423. 2
+338 [12] Steven Y. Feng, Varun Gangal, Jason Wei, Sarath Chandar, Soroush Vosoughi, Teruko Mitamura,
+339 and Eduard Hovy. A survey of data augmentation approaches for NLP. In Findings of the
+340 Association for Computational Linguistics: ACL-IJCNLP 2021, pages 968–988, Online, August
+341 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.findings-acl.84. URL
+342 https://aclanthology.org/2021.findings-acl.84. 1
+343 [13] Steven Y. Feng, Varun Gangal, Jason Wei, Sarath Chandar, Soroush Vosoughi, Teruko Mitamura,
+344 and Eduard H. Hovy. A survey of data augmentation approaches for NLP. In Chengqing Zong,
+345 Fei Xia, Wenjie Li, and Roberto Navigli, editors, ACL, volume ACL/IJCNLP 2021 of Findings
+346 of ACL, pages 968–988. Association for Computational Linguistics, 2021. 2
+347 [14] Zhe Gan, Linjie Li, Chunyuan Li, Lijuan Wang, Zicheng Liu, and Jianfeng Gao. Vision-language
+348 pre-training: Basics, recent advances, and future trends, 2022. 1
+349 [15] Shuyang Gu, Dong Chen, Jianmin Bao, Fang Wen, Bo Zhang, Dongdong Chen, Lu Yuan, and
+350 Baining Guo. Vector quantized diffusion model for text-to-image synthesis. In CVPR, pages
+351 10686–10696. IEEE, 2022. 2
+
+352 [16] Longteng Guo, Jing Liu, Xinxin Zhu, Peng Yao, Shichen Lu, and Hanqing Lu. Normalized and geometry-aware self-attention network for image captioning. In CVPR, pages 10324–10333. Computer Vision Foundation / IEEE, 2020. 2
+355 [17] Jack Hessel, Ari Holtzman, Maxwell Forbes, Ronan Le Bras, and Yejin Choi. CLIPScore: a reference-free evaluation metric for image captioning. In EMNLP, 2021. 4 [18] Jack Hessel, Ari Holtzman, Maxwell Forbes, Ronan Le Bras, and Yejin Choi. CLIPScore: A reference-free evaluation metric for image captioning. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 7514–7528, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. doi: 10. 18653/v1/2021.emnlp-main.595. URL https://aclanthology.org/2021.emnlp-main. 595. 5 [19] 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 NIPS, 2017. 4
+[20] Jonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J Fleet. Video diffusion models. arXiv:2204.03458, 2022. 2
+368 [21] Sara Hooker. The hardware lottery, 2020. 1
+369 [22] Md. Zakir Hossain, Ferdous Sohel, Mohd Fairuz Shiratuddin, Hamid Laga, and Mohammed Bennamoun. Text to image synthesis for improved image captioning. IEEE Access, 9:64918– 64928, 2021. doi: 10.1109/ACCESS.2021.3075579. 2 [23] Xiaowei Hu, Zhe Gan, Jianfeng Wang, Zhengyuan Yang, Zicheng Liu, Yumao Lu, and Lijuan Wang. Scaling up vision-language pre-training for image captioning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 17980–17989, 2022. 1 [24] Lun Huang, Wenmin Wang, Jie Chen, and Xiaoyong Wei. Attention on attention for image captioning. In ICCV, pages 4633–4642. IEEE, 2019. 2 [25] Saachi Jain, Hannah Lawrence, Ankur Moitra, and Aleksander Madry. Distilling model failures as directions in latent space. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id $\equiv$ 99RpBVpLiX. 2 [26] Peng Jiang, Fanglin Gu, Yunhai Wang, Changhe Tu, and Baoquan Chen. Difnet: Semantic segmentation by diffusion networks. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. CesaBianchi, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc., 2018. URL https://proceedings.neurips.cc/paper_files/ paper/2018/file/c2626d850c80ea07e7511bbae4c76f4b-Paper.pdf. 2
+386 [27] Guodun Li, Yuchen Zhai, Zehao Lin, and Yin Zhang. Similar scenes arouse similar emotions: Parallel data augmentation for stylized image captioning. In Heng Tao Shen, Yueting Zhuang, John R. Smith, Yang Yang, Pablo César, Florian Metze, and Balakrishnan Prabhakaran, editors, MM, pages 5363–5372. ACM, 2021. 2 [28] Junnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping language-image pre-training for unified vision-language understanding and generation. In ICML, 2022. 1, 5 [29] Junnan Li, Dongxu Li, Caiming Xiong, and Steven C. H. Hoi. BLIP: bootstrapping languageimage pre-training for unified vision-language understanding and generation. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvári, Gang Niu, and Sivan Sabato, editors, ICML, volume 162 of Proceedings of Machine Learning Research, pages 12888–12900. PMLR, 2022. 2
+397 [30] Minghui Li, Yan Wan, and Jinping Gao. What drives the ethical acceptance of deep synthesis applications? a fuzzy set qualitative comparative analysis. Computers in Human Behavior, 133: 107286, 2022. ISSN 0747-5632. doi: https://doi.org/10.1016/j.chb.2022.107286. 9
+
+400 [31] Chin-Yew Lin. ROUGE: A package for automatic evaluation of summaries. In Text Summariza
+401 tion Branches Out, pages 74–81, Barcelona, Spain, July 2004. Association for Computational
+402 Linguistics. URL https://aclanthology.org/W04-1013. 5
+403 [32] Tsung-Yi Lin, Michael Maire, Serge J. Belongie, Lubomir D. Bourdev, Ross B. Girshick, James
+404 Hays, Pietro Perona, Deva Ramanan, Piotr Doll’a r, and C. Lawrence Zitnick. Microsoft COCO:
+405 common objects in context. CoRR, abs/1405.0312, 2014. 1, 2, 4
+406 [33] Ruibo Liu, Guangxuan Xu, Chenyan Jia, Weicheng Ma, Lili Wang, and Soroush Vosoughi. Data
+407 boost: Text data augmentation through reinforcement learning guided conditional generation.
+408 In Bonnie Webber, Trevor Cohn, Yulan He, and Yang Liu, editors, EMNLP, pages 9031–9041.
+409 Association for Computational Linguistics, 2020. 2
+410 [34] Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew,
+411 Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing
+412 with text-guided diffusion models, 2022. 2
+413 [35] Alexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic
+414 models. In Marina Meila and Tong Zhang, editors, ICML, volume 139, pages 8162–8171.
+415 PMLR, 2021. 2
+416 [36] Alexander Quinn Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin,
+417 Bob McGrew, Ilya Sutskever, and Mark Chen. GLIDE: towards photorealistic image generation
+418 and editing with text-guided diffusion models. In Kamalika Chaudhuri, Stefanie Jegelka,
+419 Le Song, Csaba Szepesvári, Gang Niu, and Sivan Sabato, editors, ICML, volume 162, pages
+420 16784–16804, 2022. 2
+421 [37] Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic
+422 evaluation of machine translation. In Proceedings of the 40th annual meeting of the Association
+423 for Computational Linguistics, pages 311–318, 2002. 5
+424 [38] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agar
+425 wal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya
+426 Sutskever. Learning transferable visual models from natural language supervision. In Ma
+427 rina Meila and Tong Zhang, editors, ICML, volume 139 of Proceedings of Machine Learning
+428 Research, pages 8748–8763. PMLR, 2021. 2
+429 [39] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical
+430 text-conditional image generation with clip latents, 2022. 2
+431 [40] Nils Reimers and Iryna Gurevych. Sentence-BERT: Sentence embeddings using Siamese
+432 BERT-networks. In Proceedings of the 2019 Conference on Empirical Methods in Nat
+433 ural Language Processing and the 9th International Joint Conference on Natural Lan
+434 guage Processing (EMNLP-IJCNLP), pages 3982–3992, Hong Kong, China, November
+435 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1410. URL
+436 https://aclanthology.org/D19-1410. 4
+437 [41] Robin Rombach, A. Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High
+438 resolution image synthesis with latent diffusion models. 2022 IEEE/CVF Conference on
+439 Computer Vision and Pattern Recognition (CVPR), pages 10674–10685, 2022. 1, 2, 3
+440 [42] Chitwan Saharia, William Chan, Huiwen Chang, Chris A. Lee, Jonathan Ho, Tim Salimans,
+441 David J. Fleet, and Mohammad Norouzi. Palette: Image-to-image diffusion models. In
+442 Munkhtsetseg Nandigjav, Niloy J. Mitra, and Aaron Hertzmann, editors, SIGGRAPH, pages
+443 15:1–15:10. ACM, 2022. 2
+444 [43] Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed
+445 Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S. Sara Mahdavi, Rapha Gontijo Lopes, Tim
+446 Salimans, Jonathan Ho, David J Fleet, and Mohammad Norouzi. Photorealistic text-to-image
+447 diffusion models with deep language understanding, 2022. 2
+
+448 [44] Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L. Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, Seyedeh Sara Mahdavi, Raphael Gontijo Lopes, Tim Salimans, Jonathan Ho, David J. Fleet, and Mohammad Norouzi. Photorealistic text-to-image diffusion models with deep language understanding. arXiv preprint, 2022. URL https://doi.org/10.48550/arXiv.2205.11487. 4 [45] Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion- $. 4 0 0 \mathrm { m }$ : Open dataset of clip-filtered 400 million image-text pairs. arXiv preprint, 2021. URL https: //doi.org/10.48550/arXiv.2111.02114. 1 [46] Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2556–2565, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1238. URL https://aclanthology.org/P18-1238. 1 [47] Connor Shorten and Taghi M Khoshgoftaar. A survey on image data augmentation for deep learning. Journal of big data, 6(1):1–48, 2019. 1 [48] Uriel Singer, Adam Polyak, Thomas Hayes, Xi Yin, Jie An, Songyang Zhang, Qiyuan Hu, Harry Yang, Oron Ashual, Oran Gafni, Devi Parikh, Sonal Gupta, and Yaniv Taigman. Make-a-video: Text-to-video generation without text-video data, 2022. 2 [49] Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In ICLR, 2021. 2 [50] Emiel van Miltenburg and Desmond Elliott. Room for improvement in automatic image description: an error analysis. CoRR, abs/1704.04198, 2017. 8 [51] Ramakrishna Vedantam, C Lawrence Zitnick, and Devi Parikh. Cider: Consensus-based image description evaluation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4566–4575, 2015. 5 [52] Ruben Villegas, Mohammad Babaeizadeh, Pieter-Jan Kindermans, Hernan Moraldo, Han Zhang, Mohammad Taghi Saffar, Santiago Castro, Julius Kunze, and Dumitru Erhan. Phenaki: Variable length video generation from open domain textual description, 2022. 2 [53] Zirui Wang, Jiahui Yu, Adams Wei Yu, Zihang Dai, Yulia Tsvetkov, and Yuan Cao. Simvlm: Simple visual language model pretraining with weak supervision. Learning, 2021. 1 [54] Jason W. Wei and Kai Zou. EDA: easy data augmentation techniques for boosting performance on text classification tasks. In Kentaro Inui, Jing Jiang, Vincent $\mathrm { N g }$ , and Xiaojun Wan, editors, EMNLP-IJCNLP, pages 6381–6387. Association for Computational Linguistics, 2019. 2 [55] Yiben Yang, Chaitanya Malaviya, Jared Fernandez, Swabha Swayamdipta, Ronan Le Bras, Ji-Ping Wang, Chandra Bhagavatula, Yejin Choi, and Doug Downey. G-daug: Generative data augmentation for commonsense reasoning. In Trevor Cohn, Yulan He, and Yang Liu, editors, EMNLP, volume EMNLP 2020 of Findings of ACL, pages 1008–1025. Association for Computational Linguistics, 2020. 2 [56] Peter Young, Alice Lai, Micah Hodosh, and Julia Hockenmaier. From image descriptions to visual denotations: New similarity metrics for semantic inference over event descriptions. TACL, 2:67–78, 2014. 1, 2 [57] Hongyi Zhang, Moustapha Cissé, Yann N. Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In ICLR. OpenReview.net, 2018. 2 [58] Luowei Zhou, Hamid Palangi, Lei Zhang, Houdong Hu, Jason J. Corso, and Jianfeng Gao. Unified vision-language pre-training for image captioning and VQA. In AAAI, pages 13041– 13049. AAAI Press, 2020. 2
\ No newline at end of file
diff --git a/md/dev/x1FgW3vSM6/x1FgW3vSM6.md b/md/dev/x1FgW3vSM6/x1FgW3vSM6.md
new file mode 100644
index 0000000000000000000000000000000000000000..706084e9b8c21f48a6d5a9b1193397de20375c02
--- /dev/null
+++ b/md/dev/x1FgW3vSM6/x1FgW3vSM6.md
@@ -0,0 +1,407 @@
+# Flag Aggregator: Distributed Training under Failures and Augmented Losses using Convex Optimization
+
+Anonymous Author(s)
+Affiliation
+Address
+email
+
+# Abstract
+
+1 Modern ML applications increasingly rely on complex deep learning models and
+2 large datasets. There has been an exponential growth in the amount of computa
+3 tion needed to train the largest models. Therefore, to scale computation and data,
+4 these models are inevitably trained in a distributed manner in clusters of nodes,
+5 and their updates are aggregated before being applied to the model. However, a
+6 distributed setup is prone to Byzantine failures of individual nodes, components,
+7 and software. With data augmentation added to these settings, there is a critical
+8 need for robust and efficient aggregation systems. We define the quality of workers
+9 as reconstruction ratios $\in ( 0 , 1 ]$ , and formulate aggregation as a Maximum Like
+10 lihood Estimation procedure using Beta densities. We show that the Regularized
+11 form of log-likelihood wrt subspace can be approximately solved using iterative
+12 least squares solver, and provide convergence guarantees using recent Convex
+13 Optimization landscape results. Our empirical findings demonstrate that our ap
+14 proach significantly enhances the robustness of state-of-the-art Byzantine resilient
+15 aggregators. We evaluate our method in a distributed setup with a parameter server,
+16 and show simultaneous improvements in communication efficiency and accuracy
+17 across various tasks.
+
+# 18 1 Introduction
+
+19 How to Design Aggregators? We consider the problem of designing aggregation functions that can
+20 be written as optimization problems of the form,
+
+$$
+\ A ( g _ { 1 } , \ldots , g _ { p } ) \in \arg \operatorname* { m i n } _ { Y \in C } A _ { g _ { 1 } , \ldots , g _ { p } } ( Y ) ,
+$$
+
+21 where $\{ g _ { i } \} _ { i = 1 } ^ { p } \subseteq \mathbb { R } ^ { n }$ are given estimates of an unknown summary statistic used to compute the
+22 Aggregator $Y ^ { * }$ . If we choose $A$ to be a quadratic function that decomposes over $g _ { i }$ ’s, and $C = \mathbb { R } ^ { n }$ ,
+23 then we can see $\mathcal { A }$ is simply the standard mean operator. There is a mature literature of studying such
+24 functions for various scientific computing applications [1]. More recently, from the machine learning
+25 standpoint there has been a plethora of work [2, 3, 4, 5] on designing provably robust aggregators $\mathcal { A }$
+26 for mean estimation tasks under various technical assumptions on the distribution or moments of $g _ { i }$
+27 Distributed ML Use Cases. Consider training a model with a large dataset such as ImageNet-1K
+28 [6] or its augmented version which would require data to be distributed over $p$ workers and uses
+29 back propagation. Indeed, in this case, $g _ { i }$ ’s are typically the gradients computed by individual
+30 workers at each iteration. In settings where the training objective is convex, the convergence and
+31 generalization properties of distributed optimization can be achieved by defining $\mathcal { A }$ as a weighted
+32 combination of gradients facilitated by a simple consensus matrix, even if some $g _ { i }$ ’s are noisy [7, 8].
+33 In a distributed setup, as long as the model is convex we can simultaneously minimize the total
+34 iteration or communication complexity to a significant extent i.e., it is possible to achieve convergence
+35 and robustness under technical assumptions on the moments of (unknown) distribution from which
+36 $g _ { i }$ ’s are drawn. However, it is still an open problem to determine the optimality of these procedures
+37 in terms of either convergence or robustness [9, 10].
+38 Potential Causes of Noise. When data is distributed among workers, hardware and software failures
+39 in workers [11, 12, 13] can cause them to send incorrect gradients, which can significantly mislead
+40 the model [14]. To see this, let’s consider a simple experiment with 15 workers, that $f$ of them
+41 produce uniformly random gradients. Figure 2 shows that the model accuracy is heavily impacted
+42 when $f > 0$ when mean is used to aggregate the gradients.
+43 The failures can occur due to component or software failures and
+44 their probability increases with the scale of the system [15, 16, 17].
+45 Reliability theory is used to analyze such failures, see Chapter 9
+46 in [18], but for large-scale training, the distribution of total system
+47 failures is not independent over workers, making the total noise in
+48 gradients dependent and a key challenge for large-scale training.
+49 Moreover, even if there are no issues with the infrastructure, our
+50 work is motivated by the prevalence of data augmentation, including
+51 hand-chosen augmentations. Since number of parameters $n$ is often
+52 greater than number of samples, data augmentation improves the
+53 generalization capabilities of large-scale models under technical con
+54 ditions [19, 20, 21]. In particular, Adversarial training is a common
+55 technique that finds samples that are close to training samples but
+56 classified as a different class at the current set of parameters, and
+57 then use such samples for parameter update purposes [22]. Unfortunately, computing adversarial
+58 samples is often difficult [23], done using randomized algorithms [24] and so may introduce depen
+59 dent (across samples) noise themselves. In other words, using adversarial training paradigm, or the
+60 so-called inner optimization can lead to noise in gradients, which can cause or simulate dependent
+61 “Byzantine” failures in the distributed context.
+62 Available Computational Solutions. Most existing open source implementations of $\mathcal { A }$ rely just
+63 on (functions of) pairwise distances to filter gradients from workers using suitable neighborhood
+64 based thresholding schemes, based on moment conditions [25, 26, 27]. While these may be a good
+65 strategy when the noise in samples/gradients is somewhat independent, these methods are suboptimal
+66 when the noise is dependent or nonlinear, especially when $n$ is large. Moreover, choosing discrete
+67 hyperparameters such as number of neighbors is impractical in our use cases since they hamper
+68 convergence of the overall training procedure. To mitigate the suboptimality of existing aggregation
+69 schemes, we explicitly estimate a subspace $Y$ spanned by “most” of the gradient workers, and then
+70 use this subspace to estimate that a sparse linear combination of $g _ { i }$ gradients, acheiving robustness.
+71 We present a new optimization based formulation for generalized gradient aggregation purposes in
+72 the context of distributed training of deep learning architectures, as shown in Figure 1.
+73 Summary of our Contributions. From the theoretical perspective, we present a simple Maximum
+74 Likelihood Based estimation procedure for aggregation purposes, with novel regularization functions.
+75 Algorithmically, we argue that any procedure used to solve Flag Optimization can be directly used to
+76 obtain the optimal summary statistic $Y ^ { * }$ for our aggregation purposes. Experimentally, our results
+77 show resilience against Byzantine attacks, encompassing physical failures, while effectively managing
+78 the stochasticity arising from data augmentation schemes. In practice, we achieve a significantly
+79 $( \approx 2 0 \% )$ ) better accuracy on standard datasets. Our implementation offers substantial advantages in
+80 reducing communication complexity across diverse noise settings through the utilization of our novel
+81 aggregation function, making it applicable in numerous scenarios.
+
+
+Figure 1: Robust gradient aggregation in our distributed training framework. In our applications, each of the $p$ workers provides gradients computed using a random sample obtained from given training data, derived synthetic data from off-the-shelf Diffusion models, and random noise in each iteration. Our Flag Aggregator (FA) removes high frequency noise components by using few rounds of Singular Value Decomposition of the concatenated Gradient Matrix $G$ , and provides new update $Y ^ { * }$ .
+
+
+Figure 2: Tolerance to $f$ Byzantine workers for a nonrobust aggregator (mean).
+
+# 2 Robust Aggregators as Orthogonality Constrained Optimization
+
+83 In this section, we first provide the basic intuition of our proposed approach to using subspaces for
+84 aggregation purposes using linear algebra, along with connections of our approach standard eigende
+85 composition based denoising approaches. We then present our overall optimization formulation in
+86 two steps, and argue that it can be optimized using existing methods.
+
+# 87 2.1 Optimal Subspace Hypothesis for Distributed Descent
+
+We will use lowercase letters $y , g$ to denote vectors, and uppercase letters $Y , G$ to denote matrices. We will use boldfont 1 to denote the vector of all ones in appropriate dimensions.
+
+is an orthogonal matrix representation of a subspace that gradients could live in such that $m \le p$ . Now, we may interpret each column of $Y$ as a basis function that act on $g _ { i } \in \mathbb { R } ^ { n }$ , i.e., $j$ −th coordinate of $( Y ^ { T } g ) _ { j }$ for $1 \leq j \leq m$ is the application of $j \mathrm { - t h }$ basis or column of $Y$ on $g$ . Recall that by definition of dot product, we have that if $Y _ { : , j } ~ \perp ~ x$ , then $( Y ^ { T } g ) _ { j }$ will be close to zero. Equivalently, if $g \in \mathsf { s p a n } ( Y )$ , then $( Y ^ { T } g ) ^ { T } Y ^ { T } g$ will be bounded away from zero, see Chapter 2 in [28]. Assuming that $G \in \mathbb { R } ^ { n \times p }$ is the gradient matrix of $p$ workers, $Y Y ^ { T } G \in { \overline { { \mathbb { R } } } } ^ { n \times p }$ is the reconstruction of $G$ using $Y$ as basis. That is, $i ^ { t h }$ column of $Y ^ { T } G$ specifies the amount of gradient from worker $i$ as a function of $Y$ , and high $l _ { 2 }$ norm of $Y ^ { \pi } g _ { i }$ implies that there is a basis in $Y$ such that $Y \ne g _ { i }$ . So it is easy to see that the average over columns of 03 $Y Y ^ { T } G$ would give the final gradient for update.
+
+
+Figure 3: Distributions of Explained Variances on Minibatches
+
+104 105 Explainedof gradient $g _ { i }$ riato $z _ { i }$ e of wusing $Y$ ker , th $i$ . n, $0 \leq \| z _ { i } \| _ { 2 } ^ { 2 } = z _ { i } ^ { T } z _ { i } \overset { } { = } ( Y ^ { T } g ) ^ { T } \dot { Y } ^ { T } g = g _ { i } ^ { \overline { { T } } } Y Y ^ { T } g _ { i }$ $z _ { i } = Y ^ { T } g _ { i } \in \mathbb { R } ^ { m }$ sformationis a scalar,
+106 and so is equal to its trace tr $\left( g _ { i } ^ { T } Y Y ^ { T } g _ { i } \right)$ . Moreover, when $Y$ is orthogonal, we have $0 \leq \| z _ { i } \| _ { 2 } =$
+107 $\| Y ^ { T } g _ { i } \| _ { 2 } \leq \| Y \| _ { 2 } \| g _ { i } \| _ { 2 } \leq \| g _ { i } \| _ { 2 }$ since the operator norm (or largest singular value) $\| Y \| _ { 2 }$ of $Y$ is at
+108 most 1. Our main idea is to use $\| z _ { i } \| _ { 2 } ^ { 2 } , \| g _ { i } \| _ { 2 } ^ { 2 }$ to define the quality of the subspace $Y$ for aggregation,
+109 as is done in some previous works for Robust Principal Component Estimation [29] – the quantity
+110 $\| z _ { i } \| _ { 2 } ^ { 2 } / \| g _ { i } \| _ { 2 } ^ { 2 }$ is called as Explained/Expressed variance of subspace $Y$ wrt $i -$ th worker [30, 31] – we
+111 refer to $\| z _ { i } \| _ { 2 } ^ { 2 } / \| g _ { i } \| _ { 2 } ^ { 2 }$ as the “value” of $i -$ th worker. In Figure 3, we can see from the spike near 1.0
+112 that if we choose the subspace carefully (blue) as opposed to merely choosing the mean gradient
+113 (with unit norm) of all workers, then we can increase the value of workers.
+114 Advantages of Subspace based Aggregation. We can see that using subspace $Y$ , we can easily: 1.
+115 handle different number of gradients from each worker, 2. compute gradient reconstruction ${ Y Y ^ { T } G }$
+116 efficiently whenever $Y$ is constrained to be orthogonal $\begin{array} { r } { Y = \sum _ { i } y _ { i } y _ { i } ^ { T } } \end{array}$ where $y _ { i }$ is the $i -$ th column
+117 of $Y$ , otherwise have to use eigendecomposition of $Y$ to measure explained variance which can
+118 be time consuming. In (practical) distributed settings, the quality (or noise level) of gradients in
+119 each worker may be different, and/or each worker may use a different batch size. In such cases,
+120 handcrafted aggregation schemes may be difficult to maintain, and fine-tune. For these purposes with
+121 an Orthogonal Subspace $Y$ , we can simply reweigh gradients of worker $i$ according to its noise level,
+122 and/or use $g _ { i } \in \mathbb { R } ^ { n \times b _ { i } }$ where $b _ { i }$ is the batch size of $i -$ th worker with $\mathrm { t r } ( z _ { i } ^ { T } z _ { i } )$ instead.
+123 Why is optimizing over subspaces called “Flag” Optimization? Recent optimization results
+124 suggest that we can exploit the finer structure available in Flag Manifold to specify $Y$ more precisely
+125 [32]. For example, $Y \in \mathbb { R } ^ { m \times n }$ can be parametrized directly as a subspace of dimension $m$ or
+126 as a nested sequence of $Y _ { k } \ \in \ \mathbb { R } ^ { m _ { k } \times n } , \bar { k } \ = \ 1 , . . . , K$ where $m _ { k } < m _ { k + 1 } \leq p \leq n$ such that
+127 $\mathsf { s p a n } ( Y _ { k } ) \subseteq \mathsf { s p a n } ( Y _ { k + 1 } )$ with $Y _ { K } \in \mathbb { R } ^ { m \times n }$ . When $m _ { k + 1 } = m _ { k } = 1$ , we have the usual (real)
+128 Grassmanian Manifold (quotient of orthogonal group) whose coordinates can be used for optimization,
+129 please see Section 5 in [33] for details. In fact, [34] used this idea to extend median in one-dimensional
+130 vector spaces to different finite dimensional subspaces using the so-called chordal distance between
+131 them. In our distributed training context, we use the explained variance of each worker instead. Here,
+132 workers may specify dimensions along which gradient information is relevant for faster convergence
+133 – an advantage currently not available in existing aggregation implementations – which may be used
+134 for smart initialization also. We use “Flag” to emphasize this additional nested structure available in
+135 our formulation for distributed training purposes.
+
+# 2.2 Approximate Maximum Likelihood Estimation of Optimal Subspace
+
+137 Now that we can evaluate a subspace $Y$ on individual gradients $g _ { i }$ , we now show that finding subspace
+138 $Y$ can be formulated using standard maximum likelihood estimation principles [35]. Our formulation
+139 reveals that regularization is critical for aggregation especially in distributed training. In order to
+140 write down the objective function for finding optimal $Y$ , we proceed in the following two steps:
+141 Step 1. Assume that each worker provides a single gradient for simplicity. Now, denoting the value of
+142 information $v$ of worker $i$ by $\begin{array} { r } { v _ { i } = \frac { z _ { i } ^ { T } z _ { i } } { g _ { i } ^ { T } g _ { i } } } \end{array}$ , we have $v _ { i } \in [ 0 , 1 ]$ . Now by assuming that $v _ { i }$ ’s are observed
+143 from Beta distribution with $\alpha = 1$ and $\begin{array} { r } { \beta = \frac { 1 } { 2 } } \end{array}$ (for simplicity), we can see that the likelihood $\mathbb { P } ( v _ { i } )$ is,
+
+$$
+\mathbb { P } ( v _ { i } ) : = \frac { ( 1 - v _ { i } ) ^ { - \frac { 1 } { 2 } } } { B ( 1 , \frac { 1 } { 2 } ) } = \frac { \left( 1 - \frac { z _ { i } ^ { T } z _ { i } } { g _ { i } ^ { T } g _ { i } } \right) ^ { - \frac { 1 } { 2 } } } { B ( 1 , \frac { 1 } { 2 } ) } ,
+$$
+
+144 where $B ( a , b )$ is the normalization constant. Then, the total log-likelihood of observing gradients $g _ { i }$
+145 as a function of $Y$ (or $v _ { i }$ ’s) is given by taking the log of product of $\mathbb { P } ( v _ { i } )$ ’s as (ignoring constants),
+
+$$
+\log \left( \prod _ { i = 1 } ^ { p } \mathbb { P } ( v _ { i } ) \right) = \sum _ { i = 1 } ^ { p } \log { \left( \mathbb { P } ( v _ { i } ) \right) } = - \frac { 1 } { 2 } \sum _ { i = 1 } ^ { p } \log ( 1 - v _ { i } ) .
+$$
+
+147 146 Step 2. Now we use Taylor’s series with constant likelihoods $\log ( 1 - v _ { i } ) \approx a ( 1 - v _ { i } ) ^ { \frac { 1 } { a } } - a$ as follows: first, we know that $a > 0$ to approximate individual worker log- $\begin{array} { r } { \exp \left( \frac { \log ( v _ { i } ) } { a } \right) = v _ { i } ^ { \frac { 1 } { a } } } \end{array}$ = v 1ai . On
+148 the other hand, using Taylor expansion of exp about the origin (so large $a > 1$ is better), we have that
+149 $\begin{array} { r } { \exp \left( \frac { \log \left( v _ { i } \right) } { a } \right) \approx 1 + \frac { \log \left( v _ { i } \right) } { a } } \end{array}$ . Whence, we have that $\begin{array} { r } { 1 + \frac { \log ( v _ { i } ) } { a } \approx v _ { i } ^ { \frac { 1 } { a } } } \end{array}$ which immediately implies
+150 that $\log ( v _ { i } ) \approx a v _ { i } ^ { \frac { 1 } { a } } - a$ . So, by substituting the Taylor series approximation of log in Equation 3, we
+151 obtain the negative log-likelihood approximation to be minimized for robust aggregation purposes as,
+
+$$
+- \log \left( \prod _ { i = 1 } ^ { p } \mathbb { P } ( v _ { i } ) \right) \approx \frac { 1 } { 2 } \sum _ { i = 1 } ^ { p } \left( a \left( 1 - v _ { i } \right) ^ { \frac { 1 } { a } } - a \right) ,
+$$
+
+152 where $a > 1$ is a sufficiently large constant. In the above mentioned steps, the first step is standard.
+153 Our key insight is using Taylor expansion in (4) with a sufficiently large $a$ to eliminate log optimization
+154 which are known to be computationally expensive to solve, and instead solve smooth $\ell _ { a } , a > 1$ norm
+155 based optimization problems which can be done efficiently by modifying existing procedures [36].
+156 Extension to general beta distributions, and gradients $\alpha > 0 , \beta > 0 , g _ { i } \in \mathbb { R } ^ { n \times k }$ . Note that our
+157 derivation in the above two steps can be extended to any beta shape parameters $\alpha > 0 , \beta > 0$ – there
+158 will be two terms in the final negative log-likelihood expression in our formulation (4), one for each
+159 $\alpha , \beta$ . Similarly, by simply using $\begin{array} { r } { v _ { i } = { \mathrm { t r } } \left( g _ { i } ^ { T } Y Y ^ { T } g _ { i } \right) } \end{array}$ to define value of worker $i$ in equation (2), and
+160 then in our estimator in (4), we can easily handle multiple $k$ gradients from a single worker $i$ for $Y$ .
+
+Input: Number of workers $p$ , loss functions $l _ { 1 } , l _ { 2 } , . . . , l _ { p }$ , per-worker minibatch size $B$ , learning rate schedule $\alpha _ { t }$ , initial parameters $w _ { 0 }$ , number of iterations T
+
+Output: Updated parameters $w _ { T }$ from any worker
+
+1 for $t = 1$ to $T$ do
+
+2 for ${ \mathfrak { p } } = 1$ to a $p$ in paralleinibatch: $\begin{array} { r } { i _ { \mathfrak { p } , 1 , t } , i _ { \mathfrak { p } , 2 , t } , . . . , i _ { \mathfrak { p } , B , t } \quad g _ { \mathfrak { p } , t } \gets \frac { 1 } { B } \sum _ { b = 1 } ^ { B } \nabla l _ { i _ { \mathfrak { p } , b , t } } ( w _ { t - 1 } ) } \end{array}$
+4 $G _ { t } \gets \{ g _ { 1 , t } , \cdots , g _ { p , t } \} / /$ Parameter Server receives gradients from $p$ workers
+5 $\hat { Y } _ { t } \gets \mathrm { I R L S } ( \hat { G } _ { t } )$ with $\hat { G } _ { t } = G _ { t } + \lambda \nabla \mathcal { R } ( Y ) \mathbf { 1 } ^ { T } / /$ Do IRLS at the Parameter Server for $\hat { Y }$
+6 Obtain gradient direction $d _ { t }$ : $d _ { t } = \frac { 1 } { p } \hat { Y } _ { t } \hat { Y } _ { t } ^ { T } G _ { t } { \bf 1 } / /$ Compute, Send $d _ { t }$ to all $p$ machines
+7 for ${ \mathfrak { p } } = 1$ to p in parallel on machine $\mathfrak { p }$ do
+8 update model: $w _ { t } w _ { t - 1 } - \alpha _ { t } \cdot d _ { t }$
+
+9 Return $w _ { T }$
+
+# 161 2.3 Flag Aggregator for Distributed Optimization
+
+162 It is now easy to see that by choosing $a = 2$ , in equation (4), we obtain the negative loglikelihood
+163 (ignoring constants) as $\textstyle \bigl ( \sum _ { i = 1 } ^ { p } \sqrt { 1 - g _ { i } ^ { T } Y Y ^ { T } g _ { i } } \bigr )$ showing that Flag Median can indeed be seen as
+164 an Maximum Likelihood Estimator (MLE). In particular, Flag Median can be seen as an MLE of
+165 Beta Distribution with parameters $\alpha = 1$ and $\beta = \textstyle { \frac { 1 } { 2 } }$ . Recent results suggest that in many cases, MLE
+166 is ill-posed, and regularization is necessary, even when the likelihood distribution is Gaussian [37].
+167 So, based on the Flag Median estimator for subspaces, we propose an optimization based subspace
+168 estimator $Y ^ { * }$ for aggregation purposes. We formulate our Flag Aggregator (FA) objective function
+169 with respect to $Y$ as a regularized sum of likelihood based (or data) terms in (4) using trace operators
+170 $\operatorname { t r } ( \cdot )$ as the solution to the following constrained optimization problem:
+
+$$
+\operatorname* { m i n } _ { Y : Y ^ { T } Y = I } A ( Y ) : = \sum _ { i = 1 } ^ { p } \sqrt { \left( 1 - \frac { \mathrm { t r } \left( Y ^ { T } g _ { i } g _ { i } ^ { T } Y \right) } { \| g _ { i } \| _ { 2 } ^ { 2 } } \right) } + \lambda \mathcal { R } ( Y )
+$$
+
+171 where $\lambda > 0$ is a regularization hyperparameter. In our analysis, and implementation, we provide
+172 support for two possible choices for $\mathcal { R } ( Y )$ :
+
+(1) Mathematical norms: 173 $\mathcal { R } ( Y )$ can be a form of norm-based regularization other than $\| Y \| _ { \mathrm { F r o } } ^ { 2 }$ since 174 it is constant over the feasible set in (5). For example, it could be convex norm with efficient 175 subgradient oracle such as, i.e. element-wise: $\begin{array} { r } { \sum _ { i = 1 } ^ { n } { \stackrel { . } { \sum } } _ { j = 1 } ^ { m } \| Y _ { i j } \| _ { 1 } } \end{array}$ or $\textstyle \sum _ { i = 1 } ^ { m } \| Y _ { i , i } \| _ { 1 }$ ,
+
+176 (2) Data-dependent norms: Following our subspace construction in Section 2.1, we may choose
+177 $\begin{array} { r } { \mathcal { R } ( Y ) = \frac { 1 } { p - 1 } \sum _ { i , j = 1 , i \neq j } ^ { p } \sqrt { \left( 1 - \frac { \mathrm { t r } ( Y ^ { T } ( g _ { i } - g _ { j } ) ( g _ { i } - g _ { j } ) ^ { T } Y ) } { D _ { i j } ^ { 2 } } \right) } } \end{array}$ where $D _ { i j } ^ { 2 } = \| g _ { i } - g _ { j } \| _ { 2 } ^ { 2 }$ denotes the
+178 distance between gradient vectors $g _ { i } , g _ { j }$ from workers $i , j$ . Intuitively, the pairwise terms in our
+179 loss function (5) favors subspace $Y$ that also reconstructs the pairwise vectors $g _ { i } - g _ { j }$ that are close
+180 to each other. So, by setting $\lambda = \Theta ( p )$ , that is, the pairwise terms dominate the objective function
+181 in (5). Hence, $\lambda$ regularizes optimal solutions $Y ^ { * }$ of (5) to contain $g _ { i }$ ’s with low pairwise distance
+182 in its span – similar in spirit to AggregaThor in [38].
+183 Convergence of Flag Aggregator (FA) Algorithm 1. With these, we can state our main algorithmic
+184 result showing that our FA (5) can be solved efficiently using standard convex optimization proof
+185 techniques. In particular, in supplement, we present a smooth Semi-Definite Programming (SDP)
+186 relaxation of FA in equation (5) using the Flag structure. This allows us to view the IRLS procedure
+187 in 1 as solving the low rank parametrization of the smooth SDP relaxation, thus guaranteeing fast
+188 convergence to second order optimal (local) solutions. Importantly, our SDP based proof works for
+189 any degree of approximation of the constant $a$ in equation (4) and only relies on smoothness of the
+190 loss function wrt $Y$ , although speed of convergence is reduced for higher values of $a \neq 2$ , see [39].
+191 We leave determining the exact dependence of $a$ on rate of convergence for future work.
+192 How is FA aggregator different from (Bulyan and Multi-Krum)? Bulyan is a strong Byzantine
+193 resilient gradient aggregation rule for $p \geq 4 f + 3$ where $p$ is the total number of workers and $f$ is
+194 the number of Byzantine workers. Bulyan is a two-stage algorithm. In the first stage, a gradient
+195 aggregation rule $R$ like coordinate-wise median [40] or Krum [9] is recursively used to select
+196 $\theta = p - 2 f$ gradients. The process uses $R$ to select gradient vector $g _ { i }$ which is closest to $R$ ’s output
+197 (e.g. for Krum, this would be the gradient with the top score, and hence the exact output of $R$ ). The
+198 chosen gradient is removed from the received set and added to the selection set $S$ repeatedly until
+199 $| S | = \theta$ . The second stage produces the resulting gradient. If $\beta = \theta - 2 f$ , each coordinate would
+200 be the average of $\beta$ -nearest to the median coordinate of the $\theta$ gradients in $S$ . In matrix terms, if we
+201 consider $S \in \mathbb { R } ^ { p \times m }$ as a matrix with each column having one non-zero entry summing to 1, Bulyan
+202 would return $\scriptstyle { \frac { 1 } { m } } \mathrm { R e L U } ( G S ) \mathbf { 1 } _ { m }$ , where $\mathbf { 1 } _ { m } \in \mathbb { R } ^ { m }$ is the vector of all ones, while FA would return
+203 ${ \scriptstyle { \frac { 1 } { p } } } Y Y ^ { T } G \mathbf { 1 } _ { p }$ . Importantly, the gradient matrix is being right-multiplied in Bulyan, but left-multiplied
+204 in FA, before getting averaged. While this may seem like a discrepancy, in supplement we show that
+205 by observing the optimality conditions of (5) wrt $Y$ , we show that ${ \frac { 1 } { m } } { \dot { Y } } Y ^ { T } { \dot { G } }$ can be seen as a right
+206 multiplication by a matrix parametrized by lagrangian multipliers associated with the orthogonality
+207 constraints in (5). This means it should be possible to combine both approaches for faster aggregation.
+
+# 208 3 Experiments
+
+209 In this section, we conduct experiments to test our proposed FA in the context of distributed training
+210 in two testbeds. First, to test the performance of our FA scheme solved using IRLS (Flag Mean) on
+211 standard Byzantine benchmarks. Then, to evaluate the ability of existing state-of-the-art gradient
+212 aggregators we augment data via two techniques that can be implemented with Sci-kit package.
+213 Implementation Details. We implement FA in Pytorch [41], which is popular but does not support
+214 Byzantine resilience natively. We adopt the parameter server architecture and employ Pytorch’s
+215 distributed RPC framework with TensorPipe backend for machine-to-machine communication. We
+216 extend Garfield’s Pytorch library [42] with FA and limit our IRLS convergence criteria to a small
+217 error, $1 0 ^ { - 1 0 }$ , or 5 iterations of flag mean for SVD calculation. We set $m = \textstyle { \left\lceil { \frac { p + 1 } { 2 } } \right\rceil }$ .
+
+# 3.1 Setup
+
+Baselines: We compare FA to several existing aggregation rules: (1) coordinate-wise Trimmed Mean [40] (2) coordinate-wise Median [40] (3) mean-around-median (MeaMed) [43] (4) Phocas [44] (5) Multi-Krum [9] (6) Bulyan [45].
+
+Accuracy: The fraction of correct predictions among all predictions, using the test dataset (top-1 cross-accuracy).
+
+Testbed: We used 4 servers as our experimental platform. Each server has 2 Intel(R) Xeon(R) Gold 6240 18-core CPU $\textcircled { a } 2 . 6 0 \mathrm { G H z }$ with Hyper-Threading and 384GB of RAM. Servers have a Tesla V100 PCIe 32GB GPU and employ a Mellanox ConnectX-5 100Gbps NIC to connect to a switch. We use one of the servers as the parameter server and instantiate 15 workers on other servers, each hosting 5 worker nodes, unless specified differently in specific experiments. For the experiments designed to show scalability, we instantiate 60 workers.
+
+Dataset and model: We focus on the image classification task since it is a widely used task for benchmarking in distributed training [46]. We train ResNet-18 [47] on CIFAR-10 [48] which has $6 0 , 0 0 0 3 2 \times 3 2$ color images in 10 classes. For the scalability experiment, we train a CNN with two convolutional layers followed by two fully connected layers on MNIST [49] which has $7 0 { , } 0 0 0 2 8 \times$ 28 grayscale images in 10 classes. We also run another set of experiments on Tiny ImageNet [50] in the supplement. We use SGD as the optimizer, and cross-entropy to measure loss. The batch size for each worker is 128 unless otherwise stated. Also, we use a learning decay strategy where we decrease the learning rate by a factor of 0.2 every 10 epochs.
+
+Threat models: We evaluate FA under two classes of Byzantine workers. They can send uniformly random gradients that are representative of errors in the physical setting, or use non-linear augmented data described as below.
+
+41 Evaluating resilience against nonlinear data augmentation: In order to induce Byzantine behavior
+42 in our workers we utilize ODE solvers to approximately solve 2 non-linear processes, Lotka Volterra
+243 [51] and Arnold’s Cat Map [52], as augmentation methods. Since the augmented samples are
+244 deterministic, albeit nonlinear functions of training samples, the “noise” is dependent across samples.
+
+
+Figure 4: Tolerance to the number of Byzantine workers for robust aggregators for batch size 128.
+
+245 In Lotka Volterra, we use the following linear gradient transformation of 2D pixels:
+
+$$
+( x , y ) ( \alpha x - \beta x y , \delta x y - \gamma y ) ,
+$$
+
+where $\alpha , \beta , \gamma$ and $\delta$ are hyperparameters. We choose them to be ${ \frac { 2 } { 3 } } , \ { \frac { 4 } { 3 } }$ , $- 1$ and $- 1$ respectively.
+
+247 Second, we use a nonsmooth transformation called Arnold’s Cat Map as a data augmentation scheme.
+248 Once again, the map can be specified using a two-dimensional matrix as,
+
+$$
+( x , y ) \to \left( { \frac { 2 x + y } { N } } , { \frac { x + y } { N } } \right) \mod 1 ,
+$$
+
+249 where mod represents the modulus operation, $x$ and $y$ are the coordinates or pixels of images and $N$
+250 is the height/width of images (assumed to be square). We also used a smooth approximation of the
+251 Cat Map obtained by approximating the mod function as,
+
+$$
+( x , y ) \to { \frac { 1 } { n } } \left( { \frac { 2 x + y } { ( 1 + \exp ( - m \log ( \alpha _ { 1 } ) } } , { \frac { x + y } { ( 1 + \exp ( - m \log ( \alpha _ { 2 } ) } } \right) ,
+$$
+
+52 where $\textstyle \alpha _ { 1 } = { \frac { 2 x + y } { n } }$ , $\textstyle \alpha _ { 2 } = { \frac { x + y } { n } }$ , and $m$ is the degree of approximation, which we choose to be 0.95 in
+253 our data augmentation experiments.
+
+How to perform nonlinear data augmentation? In all three cases, we used SciPy’s [53] solve_ivp method to solve the differential equations, by using the LSODA solver. In addition to the setup described above, we also added a varying level of Gaussian noise to each of the training images. All the images in the training set are randomly chosen to be augmented with varying noise levels of the above mentioned augmentation schemes. We have provided the code that implements all our data augmentation schemes in the supplement zipped folder.
+
+# 3.2 Results
+
+Tolerance to the number of Byzantine workers: In this experiment, we show the effect of Byzantine behavior on the convergence of different gradient aggregation rules in comparison to FA. Byzantine workers send random gradients and we vary the number of them from 1 to 3. Figure 4 shows that for some rules, i.e. Trimmed Mean, the presence of even a single Byzantine worker has a catastrophic impact. For other rules, as the number of Byzantine workers increases, filtering out the outliers becomes more challenging because the amount of noise increases. Regardless, FA remains more robust compared to other approaches.
+
+# 268 Marginal utility of larger batch sizes under a fixed noise level:
+
+269 We empirically verified the batch size required to identify our optimal $Y ^ { * }$ - the FA matrix at each
+270 iteration. In particular, we fixed the noise level to $f = 3$ Byzantine workers and varied batch sizes.
+271 We show the results in Figure 5. Our results indicate that, in cases where a larger batch size is
+272 a training requirement, FA achieves a significantly better accuracy compared to the existing
+273 state of the art aggregators. This may be useful in some large scale vision applications, see [54, 55]
+274 for more details. Empirically, we can already see that our spectral relaxation to identify gradient
+275 subspace is effective in practice in all our experiments.
+276 Tolerance to communication loss: To analyze the effect of unreliable communication channels
+277 between the workers and the parameter server on convergence, we design an experiment where the
+278 physical link between some of the workers and the parameter server randomly drops a percentage of
+279 packets. Here, we set the loss rate of three links to $10 \%$ i.e., there are 3 Byzantine workers in our
+280 setting. The loss is introduced using the netem queuing discipline in Linux designed to emulate the
+281 properties of wide area networks [56]. The two main takeaways in Figure 6a are:
+
+
+Figure 5: Marginal utility of larger batch sizes under a fixed noise level $f = 3$
+
+
+Figure 6: We present results under two different gradient attacks. The attack in (a) corresponds to simply dropping $1 0 \%$ of gradients from $f$ workers. The attacks in (b)-(d) correspond to generic $f$ workers sending random gradient vectors, i.e. we simply fix noise level while adding more workers.
+
+1. FA converges to a significantly higher accuracy than other aggregators, and thus is more robust to unreliable underlying network transports. 2. Considering time-to-accuracy for comparison, FA reaches a similar accuracy in less total number of training iterations, and thus is more robust to slow underlying network transports.
+
+282 Analyzing the marginal utility of additional workers. To see the effect of adding more workers
+283 to a fixed number of Byzantine workers, we ran experiments where we fixed $f$ , and increased $p$
+284 Our experimental results shown in Figures 6b-6d indicate that our FA algorithm possesses strong
+285 resilience property for reasonable choices of $p$ .
+
+The effect of having augmented data during training in Byzantine workers: Figure 7 shows FA can handle nonlinear data augmentation in a much more stable fashion. Please see supplement for details on the level of noise, and exact solver settings that were used to obtain augmented images.
+
+The effect of the regularization parameter in FA: The data-dependent regularization parameter $\lambda$ in FA provides flexibility in the loss function to cover aggregators that benefit from pairwise distances such as Bulyan and Multi-Krum. To verify whether varying $\lambda$ can interpolate Bulyan and Multi-Krum, we change $\lambda$ in Figure 8. We can see when FA improves or performs similarly for a range of $\lambda$ . Here, we set $p$ and $f$ to satisfy the strong Byzantine resilience condition of Bulyan, i.e, $p \geq 4 f + 3$ .
+
+Scaling out to real-world situations with more workers: In distributed ML, $p$ and $f$ are usually large. To test high-dimensional settings commonly dealt in Semantic Vision with our FA, we used ResNet-18. Now, to specifically test the scalability of FA, we fully utilized our available GPU servers and set up to $p = 6 0$ workers (up to $f = 1 4$ Byzantine) with the MNIST dataset and a simple CNN with two convolutional layers followed by two fully connected layers (useful for simple detection). Figure 9 shows evidence that FA is feasible for larger setups.
+
+
+Figure 7: Accuracy of us- Figure 8: CIFAR10 with Figure 9: Scaling FA to ing augmented data in $f =$ ResNet-18, $p \ = \ 7$ , and larger setups 3 workers
+
+
+Figure 10: Wall clock time comparison
+
+# 300 4 Discussion and Limitation
+
+Is it possible to fully “offload” FA computation to switches? Recent work propose that aggregation be performed entirely on network infrastructure to alleviate any communication bottleneck that may arise [57, 58]. However, to the best of our knowledge, switches that are in use today only allow limited computation to be performed on gradient $g _ { i }$ as packets whenever they are transmitted [59, 60]. That is, programmability is restrictive at the moment— switches used in practice have no floating point, or loop support, and are severely memory/state constrained. Fortunately, solutions seem near. For instance, [61] have already introduced support for floating point arithmetic in programmable switches. We may use quantization approaches for SVD calculation with some accuracy loss [62] to approximate floating point arithmetic. Offloading FA to switches has great potential in improving its computational complexity because the switch would perform as a high-throughput streaming parameter server to synchronize gradients over the network. Considering that FA’s accuracy currently outperforms its competition in several experiments, an offloaded FA can reach their accuracy even faster or it could reach a higher accuracy in the same amount of time.
+
+314 Potential Limitation. Because in every iteration of FA, we perform SVD, the complexity of the
+315 algorithm would be $\begin{array} { r } { O ( n N _ { \delta } ( \sum _ { i = 1 } ^ { p } k _ { i } ) ^ { 2 } ) } \end{array}$ with $N _ { \delta }$ being the number of iterations for the algorithm.
+316 Figure 10 show the wall clock time it takes for FA to reach a certain accuracy (10a) or epoch(10b)
+317 compared to other methods under a fixed amount of random noise $f = 3$ with $p = 1 5$ workers.
+318 Although the iteration complexity of FA is higher, here each iteration has a higher utility as reflected in
+319 the time-to-accuracy measures. This makes FA comparable to others in a shorter time span, however,
+320 if there is more wall clock time to spare, FA converges to a better state as shown in Figure 10c where
+321 we let the same number of total iterations finish for all methods.
+
+# 5 Conclusion
+
+In this paper we proposed Flag Aggregator (FA) that can be used for robust aggregation of gradients in distributed training. FA is an optimization-based subspace estimator that formulates aggregation as a Maximum Likelihood Estimation procedure using Beta densities. We perform extensive evaluations of FA and show it can be effectively used in providing Byzantine resilience for gradient aggregation. Using techniques from convex optimization, we theoretically analyze FA and with tractable relaxations show its amenability to be solved by off-the-shelf solvers or first-order reweighing methods.
+
+329 References [1] Michel Grabisch, Jean-Luc Marichal, Radko Mesiar, and Endre Pap. Aggregation functions, volume 127. Cambridge University Press, 2009. [2] Sivaraman Balakrishnan, Simon S. Du, Jerry Li, and Aarti Singh. Computationally efficient robust sparse estimation in high dimensions. In Satyen Kale and Ohad Shamir, editors, Proceedings of the 2017 Conference on Learning Theory, volume 65 of Proceedings of Machine Learning Research, pages 169–212. PMLR, 07–10 Jul 2017. URL https: //proceedings.mlr.press/v65/balakrishnan17a.html. [3] Ilias Diakonikolas, Daniel Kane, Sushrut Karmalkar, Eric Price, and Alistair Stewart. Outlierrobust high-dimensional sparse estimation via iterative filtering. Advances in Neural Information Processing Systems, 32, 2019. [4] Yu Cheng, Ilias Diakonikolas, Rong Ge, Shivam Gupta, Daniel M. Kane, and Mahdi Soltanolkotabi. Outlier-robust sparse estimation via non-convex optimization. Advances in Neural Information Processing Systems, 2022. [5] Ilias Diakonikolas, Daniel M. Kane, Sushrut Karmalkar, Ankit Pensia, and Thanasis Pittas. Robust sparse mean estimation via sum of squares. In Po-Ling Loh and Maxim Raginsky, editors, Proceedings of Thirty Fifth Conference on Learning Theory, volume 178 of Proceedings of Machine Learning Research, pages 4703–4763. PMLR, 02–05 Jul 2022. URL https: //proceedings.mlr.press/v178/diakonikolas22e.html. [6] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. doi: 10.1007/s11263-015-0816-y. [7] Konstantinos I Tsianos and Michael G Rabbat. Distributed strongly convex optimization. In 2012 50th Annual Allerton Conference on Communication, Control, and Computing (Allerton), pages 593–600. IEEE, 2012. [8] Tao Yang, Xinlei Yi, Junfeng Wu, Ye Yuan, Di Wu, Ziyang Meng, Yiguang Hong, Hong Wang, Zongli Lin, and Karl H Johansson. A survey of distributed optimization. Annual Reviews in Control, 47:278–305, 2019. [9] Peva Blanchard, El Mahdi El Mhamdi, Rachid Guerraoui, and Julien Stainer. Machine learning with adversaries: Byzantine tolerant gradient descent. In Proceedings of the 31st International Conference on Neural Information Processing Systems, NIPS’17, page 118–128. Curran Associates Inc., 2017. ISBN 9781510860964. [10] Sadegh Farhadkhani, Rachid Guerraoui, Nirupam Gupta, Rafael Pinot, and John Stephan. Byzantine machine learning made easy by resilient averaging of momentums. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato, editors, Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pages 6246–6283. PMLR, 17–23 Jul 2022. URL https://proceedings.mlr.press/v162/farhadkhani22a.html. [11] Leonardo Bautista-Gomez, Ferad Zyulkyarov, Osman Unsal, and Simon McIntosh-Smith. Unprotected computing: A large-scale study of dram raw error rate on a supercomputer. In $S C$ ’16: Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, pages 645–655, 2016. doi: 10.1109/SC.2016.54. [12] Bianca Schroeder and Garth A. Gibson. Disk failures in the real world: What does an mttf of 1,000,000 hours mean to you? In Proceedings of the 5th USENIX Conference on File and Storage Technologies, FAST ’07, page 1–es, USA, 2007. USENIX Association. [13] Phillipa Gill, Navendu Jain, and Nachiappan Nagappan. Understanding network failures in data centers: Measurement, analysis, and implications. SIGCOMM Comput. Commun. Rev., 41(4):350–361, aug 2011. ISSN 0146-4833. doi: 10.1145/2043164.2018477. URL https://doi.org/10.1145/2043164.2018477.
+
+379 [14] Gilad Baruch, Moran Baruch, and Yoav Goldberg. A little is enough: Circumventing defenses for distributed learning. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/ file/ec1c59141046cd1866bbbcdfb6ae31d4-Paper.pdf. [15] Guosai Wang, Lifei Zhang, and Wei Xu. What can we learn from four years of data center hardware failures? In 2017 47th Annual IEEE/IFIP International Conference on Dependable Systems and Networks (DSN), pages 25–36, 2017. doi: 10.1109/DSN.2017.26. [16] Devesh Tiwari, Saurabh Gupta, James Rogers, Don Maxwell, Paolo Rech, Sudharshan Vazhkudai, Daniel Oliveira, Dave Londo, Nathan DeBardeleben, Philippe Navaux, Luigi Carro, and Arthur Bland. Understanding gpu errors on large-scale hpc systems and the implications for system design and operation. In 2015 IEEE 21st International Symposium on High Performance Computer Architecture (HPCA), pages 331–342, 2015. doi: 10.1109/HPCA.2015.7056044. [17] Bin Nie, Devesh Tiwari, Saurabh Gupta, Evgenia Smirni, and James H. Rogers. A large-scale study of soft-errors on gpus in the field. In 2016 IEEE International Symposium on High Performance Computer Architecture (HPCA), pages 519–530, 2016. doi: 10.1109/HPCA.2016. 7446091. [18] Sheldon M Ross. Introduction to probability models. Academic press, 2014. [19] Fanny Yang, Zuowen Wang, and Christina Heinze-Deml. Invariance-inducing regularization using worst-case transformations suffices to boost accuracy and spatial robustness. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/file/ 1d01bd2e16f57892f0954902899f0692-Paper.pdf. [20] Christina Heinze-Deml and Nicolai Meinshausen. Conditional variance penalties and domain shift robustness, 2017. URL https://arxiv.org/abs/1710.11469. [21] Saeid Motiian, Marco Piccirilli, Donald A. Adjeroh, and Gianfranco Doretto. Unified deep supervised domain adaptation and generalization. In IEEE International Conference on Computer Vision (ICCV), 2017. [22] Sravanti Addepalli, Samyak Jain, et al. Efficient and effective augmentation strategy for adversarial training. Advances in Neural Information Processing Systems, 35:1488–1501, 2022. [23] Eric Wong, Leslie Rice, and J Zico Kolter. Fast is better than free: Revisiting adversarial training. arXiv preprint arXiv:2001.03994, 2020. [24] Jeremy Cohen, Elan Rosenfeld, and Zico Kolter. Certified adversarial robustness via randomized smoothing. In international conference on machine learning, pages 1310–1320. PMLR, 2019. [25] Youssef Allouah, Rachid Guerraoui, Nirupam Gupta, Rafael Pinot, and John Stephan. Distributed learning with curious and adversarial machines. arXiv preprint arXiv:2302.04787, 2023. [26] Youssef Allouah, Sadegh Farhadkhani, Rachid Guerraoui, Nirupam Gupta, Rafaël Pinot, and John Stephan. Fixing by mixing: A recipe for optimal byzantine ml under heterogeneity. In International Conference on Artificial Intelligence and Statistics, pages 1232–1300. PMLR, 2023. [27] Sadegh Farhadkhani, Rachid Guerraoui, Nirupam Gupta, Rafael Pinot, and John Stephan. Byzantine machine learning made easy by resilient averaging of momentums. In International Conference on Machine Learning, pages 6246–6283. PMLR, 2022.
+24 [28] P-A Absil. Optimization algorithms on matrix manifolds. Princeton University Press, 2008.
+25 [29] John Wright, Arvind Ganesh, Shankar Rao, Yigang Peng, and Yi Ma. Robust principal component analysis: Exact recovery of corrupted low-rank matrices via convex optimization. Advances in neural information processing systems, 22, 2009.
+8 [30] Matthias Hein and Thomas Bühler. An inverse power method for nonlinear eigenproblems with applications in 1-spectral clustering and sparse pca. Advances in neural information processing systems, 23, 2010. [31] Rudrasis Chakraborty, Soren Hauberg, and Baba C Vemuri. Intrinsic grassmann averages for online linear and robust subspace learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6196–6204, 2017. [32] D. Monk. The geometry of flag manifolds. Proceedings of the London Mathematical Society, s3-9(2):253–286, 1959. doi: https://doi.org/10.1112/plms/s3-9.2.253. URL https: //londmathsoc.onlinelibrary.wiley.com/doi/abs/10.1112/plms/s3-9.2.253. [33] Ke Ye, Ken Sze-Wai Wong, and Lek-Heng Lim. Optimization on flag manifolds. Mathematical Programming, 194(1-2):621–660, 2022. [34] Nathan Mankovich, Emily J King, Chris Peterson, and Michael Kirby. The flag median and flagirls. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10339–10347, 2022.
+2 [35] Kevin P Murphy. Probabilistic machine learning: an introduction. MIT press, 2022.
+3 [36] Massimo Fornasier, Holger Rauhut, and Rachel Ward. Low-rank matrix recovery via iteratively reweighted least squares minimization. SIAM Journal on Optimization, 21(4):1614–1640, 2011. [37] Toni Karvonen and Chris J Oates. Maximum likelihood estimation in gaussian process regression is ill-posed. Journal of Machine Learning Research, 24(120):1–47, 2023. [38] Georgios Damaskinos, El-Mahdi El-Mhamdi, Rachid Guerraoui, Arsany Guirguis, and Sébastien Rouault. Aggregathor: Byzantine machine learning via robust gradient aggregation. Proceedings of Machine Learning and Systems, 1:81–106, 2019. [39] Yuxin Chen, Yuejie Chi, Jianqing Fan, Cong Ma, and Yuling Yan. Noisy matrix completion: Understanding statistical guarantees for convex relaxation via nonconvex optimization. SIAM journal on optimization, 30(4):3098–3121, 2020. [40] Dong Yin, Yudong Chen, Ramchandran Kannan, and Peter Bartlett. Byzantine-robust distributed learning: Towards optimal statistical rates. In Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 5650– 5659. PMLR, 10–15 Jul 2018. [41] 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, volume 32, 2019. [42] Rachid Guerraoui, Arsany Guirguis, Jérémy Plassmann, Anton Ragot, and Sébastien Rouault. Garfield: System support for byzantine machine learning (regular paper). In 2021 51st Annual IEEE/IFIP International Conference on Dependable Systems and Networks (DSN), pages 39–51, 2021. doi: 10.1109/DSN48987.2021.00021. [43] Cong Xie, Oluwasanmi Koyejo, and Indranil Gupta. Generalized byzantine-tolerant sgd, 2018.
+[44] Cong Xie, Oluwasanmi Koyejo, and Indranil Gupta. Phocas: dimensional byzantine-resilient stochastic gradient descent, 2018.
+[45] El Mahdi El Mhamdi, Rachid Guerraoui, and Sébastien Rouault. The hidden vulnerability of distributed learning in Byzantium. In Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 3521–3530. PMLR, 10–15 Jul 2018.
+474 [46] Trishul Chilimbi, Yutaka Suzue, Johnson Apacible, and Karthik Kalyanaraman. Project adam: Building an efficient and scalable deep learning training system. In Proceedings of the 11th USENIX Conference on Operating Systems Design and Implementation, OSDI’14, page 571–582, USA, 2014.
+478 [47] 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), pages 770–778, 2016. doi: 10.1109/CVPR.2016.90.
+481 [48] Alex Krizhevsky. Learning multiple layers of features from tiny images, 2009. URL https: //www.cs.toronto.edu/\~kriz/learning-features-2009-TR.pdf.
+483 [49] Yann LeCun and Corinna Cortes. MNIST handwritten digit database, 2010. URL http: //yann.lecun.com/exdb/mnist/.
+485 [50] Ya Le and Xuan S. Yang. Tiny imagenet visual recognition challenge, 2015.
+486 [51] David Kelly. Rough path recursions and diffusion approximations. The Annals of Applied Probability, 26(1):425–461, 2016.
+488 [52] Jianghong Bao and Qigui Yang. Period of the discrete arnold cat map and general cat map. Nonlinear Dynamics, 70(2):1365–1375, 2012.
+490 [53] Fundamental algorithms for scientific computing in python. https://scipy.org/, 2023.
+491 [54] 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 $\bar { }$ H1oyRlYgg. [55] Yang You, Jonathan Hseu, Chris Ying, James Demmel, Kurt Keutzer, and Cho-Jui Hsieh. Large-batch training for lstm and beyond. In Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, SC ’19, 2019.
+498 [56] Kevin Hsieh, Aaron Harlap, Nandita Vijaykumar, Dimitris Konomis, Gregory R. Ganger, Phillip B. Gibbons, and Onur Mutlu. Gaia: Geo-distributed machine learning approaching lan speeds. In Proceedings of the 14th USENIX Conference on Networked Systems Design and Implementation, page 629–647, 2017.
+502 [57] Amedeo Sapio, Marco Canini, Chen-Yu Ho, Jacob Nelson, Panos Kalnis, Changhoon Kim, Arvind Krishnamurthy, Masoud Moshref, Dan Ports, and Peter Richtárik. Scaling distributed machine learning with {In-Network} aggregation. In 18th USENIX Symposium on Networked Systems Design and Implementation (NSDI 21), pages 785–808, 2021. [58] ChonLam Lao, Yanfang Le, Kshiteej Mahajan, Yixi Chen, Wenfei Wu, Aditya Akella, and Michael Swift. $\{ \mathrm { A T P } \}$ : In-network aggregation for multi-tenant learning. In 18th USENIX Symposium on Networked Systems Design and Implementation (NSDI 21), pages 741–761, 2021. [59] Pat Bosshart, Glen Gibb, Hun-Seok Kim, George Varghese, Nick McKeown, Martin Izzard, Fernando Mujica, and Mark Horowitz. Forwarding metamorphosis: Fast programmable matchaction processing in hardware for sdn. In Proceedings of the ACM SIGCOMM 2013 Conference on SIGCOMM, SIGCOMM ’13, page 99–110, New York, NY, USA, 2013. Association for Computing Machinery. ISBN 9781450320566. doi: 10.1145/2486001.2486011. URL https: //doi.org/10.1145/2486001.2486011.
+516 [60] N McKeown. Pisa: Protocol independent switch architecture. In P4 Workshop, 2015.
+517 [61] Yifan Yuan, Omar Alama, Jiawei Fei, Jacob Nelson, Dan RK Ports, Amedeo Sapio, Marco Canini, and Nam Sung Kim. Unlocking the power of inline {Floating-Point} operations on programmable switches. In 19th USENIX Symposium on Networked Systems Design and Implementation (NSDI 22), pages 683–700, 2022.
\ No newline at end of file
diff --git a/md/dev/x2WTG5bV977/x2WTG5bV977.md b/md/dev/x2WTG5bV977/x2WTG5bV977.md
new file mode 100644
index 0000000000000000000000000000000000000000..6471cde9a20a9f952efa6f835e80a735b79808e7
--- /dev/null
+++ b/md/dev/x2WTG5bV977/x2WTG5bV977.md
@@ -0,0 +1,404 @@
+# The Curse of Low Task Diversity: On the Failure of Transfer Learning to Outperform MAML and their Empirical Equivalence
+
+Anonymous Author(s)
+Affiliation
+Address
+email
+
+# Abstract
+
+1 Recently, it has been observed that a transfer learning solution might be all we need
+2 to solve many few-shot learning benchmarks – thus raising important questions
+3 about when and how meta-learning algorithms should be deployed. In this paper,
+4 we seek to clarify these questions by 1. proposing a novel metric – the diversity
+5 coefficient – to measure the diversity of tasks in a few-shot learning benchmark
+6 and 2. by comparing MAML and transfer learning under fair conditions (same
+7 architecture, same optimizer and all models trained to convergence). Using the
+8 diversity coefficient, we show that the popular MiniImagenet and Cifar-fs few-shot
+9 learning benchmarks have low diversity. This novel insight contextualizes claims
+10 that transfer learning solutions are better than meta-learned solutions in the regime
+11 of low diversity under a fair comparison. Specifically, we empirically find that a low
+12 diversity coefficient correlates with a high similarity between transfer learning and
+13 Model-Agnostic Meta-Learning (MAML) learned solutions in terms of accuracy
+14 at meta-test time and classification layer similarity (using feature based distance
+15 metrics like SVCCA, PWCCA, CKA, and OPD). To further support our claim,
+16 we find this meta-test accuracy holds even as the model size changes. Therefore,
+17 we conclude that in the low diversity regime, MAML and transfer learning have
+18 equivalent meta-test performance when both are compared fairly. We also hope
+19 our work inspires more thoughtful constructions and quantitative evaluations of
+20 meta-learning benchmarks in the future.
+
+# 21 1 Introduction
+
+22 The success of deep learning in computer vision (1; 2), natural language processing (3; 4), game
+23 playing $\textcircled { 5 } \textcircled { 6 } \textcircled { 7 }$ and more, keeps motivating a growing body of applications of deep learning on
+24 an increasingly wide variety of domains. In particular, deep learning is now routinely applied to
+25 few-shot learning – a research challenge that assesses a model’s ability to learn to adapt to new tasks,
+26 new distributions, or new environments. This has been the main research area where meta-learning
+27 algorithms have been applied – since such a strategy seems promising in a small data regime due to
+28 its potential to learn to learn or learn to adapt. However, it was recently shown $\textcircled{8}$ that a transfer
+29 learning model with a fixed embedding can match and outperform many modern sophisticated meta
+30 learning algorithms on numerous few-shot learning benchmarks $\bigoplus \iiiint \bigoplus \iiiint \bigoplus \iiiint$ . This growing body of
+31 evidence – coupled with these surprising results in meta-learning – raise the question if researchers are
+32 applying meta-learning with the right inductive biases $\textcircled { 1 3 } ; \textcircled { 1 4 }$ and designing appropriate benchmarks
+33 for meta-learning. Our evidence suggests this is not the case.
+34 In this work, we show that when the task diversity – a novel measure of variability across tasks – is
+35 low, then MAML (Model Agnostic Meta-Learning) $\textcircled{1 1 5 }$ learned solutions have the same accuracy
+36 as transfer learning (i.e., a supervised learned model with a fine-tuned final linear layer). We want
+37 to emphasize the importance of doing such an analysis fairly: with the same architecture, same
+38 optimizer and all models trained to convergence. This empirical equivalence remained true even as
+39 the model size changed – thus further suggesting this equivalence is more a property of the data than
+40 of the model. Therefore, we suggest taking a problem-centric approach to meta-learning and suggest
+41 applying Marr’s level of analysis $\textcircled { 1 6 } ; \textcircled { 1 7 } \textcircled { }$ to few-shot learning – to identify the family of problems
+42 suitable for meta-learning. Marr emphasized the importance of understanding the computational
+43 problem being solved and not only analyzing the algorithms or hardware that attempts to solve
+44 them. An example given by Marr is marveling at the rich structure of bird feathers without also
+45 understanding the problem they solve is flight. Similarly, there has been analysis of MAML solutions
+46 and transfer learning without putting the problem such solutions should solve into perspective $( \overline { { 1 8 } } ; \overline { { 1 9 } } )$ .
+47 Therefore, in this work, we hope to clarify some of these results by partially placing the current
+48 state of affairs in meta-learning from a problem-centric view. In addition, the novelty of our analysis
+49 compared to previous work is that we make analysis intrinsic of the data as a first class citizen.
+
+50 Our contributions summarized as follows:
+
+1. We propose a novel metric that quantifies the intrinsic diversity of the data of a few-shot learning benchmark. We call it the diversity coefficient. It enables analysis of meta-learning algorithms through a problem-centric framework. It also goes beyond counting the number of classes or number of data points or counting the number concatenated data sets – and instead quantifies the expected diversity/variability of tasks in a few-shot learning benchmark.
+
+2. We analyze the two most prominent few-shot learning benchmarks – MiniImagenet and Cifar-fs – and show that their diversity is low. These results are robust across different ways to measure the diversity coefficient, suggesting that our approach is robust.
+
+3. With this context, we partially clarify the surprising results from $\textcircled { 1 1 9 }$ by comparing their transfer learning method against models trained with MAML $\textcircled{1 1 5 }$ . In particular, when making a fair comparison, transfer learning method with a fixed feature extractor fails to outperform MAML. We define a fair comparison when the two methods are compared using the same architecture (backbone), same optimizer and all models trained to convergence. We also show that their final layer makes similar predictions according to neural network distance techniques like distance based Singular Value Canonical Correlation Analysis (SVCCA), Projection Weighted (PWCCA), Linear Centered Kernel Analysis (LINCKA) and Orthogonal Procrustes Distance (OPD). This equivalence holds even as the model size increases.
+
+4. Interestingly, we also find that even in the regime where task diversity is low (in MiniImagenet and Cifar-fs), the features extracted by supervised learning and MAML are different – implying that the mechanism by which they function is different despite the similarity of their final predictions.
+
+5. As an actionable conclusion, we provide a metric that can be used to analyze the intrinsic diversity of the data in a few-shot learning benchmarks and therefore build more thoughtful environments to drive research in meta-learning. In addition, our evidence suggests the following test to predict the empirical equivalence of MAML and transfer learning: if the task diversity is low, then transfer learned solutions might fail to outperform meta-learned solutions. This test is easy to run because our diversity coefficient can be done using the Task2Vec method $\textcircled { 1 2 0 }$ using pre-trained neural network. We also found that random networks were consistent with the results of pre-trained networks on Imagenet.
+
+81 We hope that this line of work inspires a problem-centric first approach to meta-learning – which
+82 appears to be especially sensitive to the properties of the problem in question. Therefore, we hope
+83 future work takes a more thoughtful and quantitative approach to benchmark creation – instead of
+84 focusing only on making huge data sets.
+
+# 2 Background
+
+In this section, we provide a summary of the background needed to understand our main results.
+
+87 Model-Agnostic Meta-Learning (MAML): The MAML algorithm $\textcircled{1 1 5 }$ attempts to meta-learn
+88 an initialization of parameters for a neural network so that it is primed for fast gradient descent
+
+adaptation. It consists of two main optimization loops: 1) an outer loop used to prime the parameters for fast adaptation, and 2) an inner loop that does the fast adaptation. During meta-testing, only the inner loop is used to adapt the representation learned by the outer loop.
+
+92 Transfer Learning with Union Supervised Learning (USL): Previous work $\textcircled { 1 9 }$ shows that
+93 an initialization trained with supervised learning, on a union of all tasks, can outperform many
+94 sophisticated methods in meta-learning. In particular, their method consists of two stages: 1) first
+95 they use a union of all the labels in the few-shot learning benchmark during meta-training and train
+96 with standard supervised learning (SL), then 2) during the meta-testing, they use an inference method
+97 common in transfer learning: extract a fixed feature from the neural network and fully fine-tune the
+98 final classification layer (i.e., the head). Note that our experiments only consider when the final layer
+99 is regularized Logistic Regression trained with LBGFS.
+100 Distances for Deep Neural Network Feature Analysis: To compute the distance between neural
+101 networks we use the distance versions of Singular Value Canonical Correlation Analysis (SVCCA)
+102 $\textcircled { 2 1 }$ , Projection Weighted Canonical Correlation (PWCCA) $\textcircled { 1 2 2 }$ , Linear Centered Kernel Analysis
+103 (LINCKA) $\textcircled { 1 2 3 }$ and Orthogonal Procrustes Distance (OPD) $\textcircled { 1 2 4 }$ . These distances are in the interval
+104 $[ 0 , 1 ]$ and are not necessarily a formal distance metric but are guaranteed to be zero when their
+105 inputs are equal and nonzero otherwise. This is true because SVCCA, PWCCA, LINCKA are based
+106 on similarity metrics and OPD is already a distance. Note that we use the formula $d ( X , Y ) =$
+107 $1 - s i m ( X , Y )$ for our distance metrics where sim is one either SVCCA, PWCCA, LINCKA
+108 similarity metric and $X , Y$ are matrices of activations (called layer matrices). The distance between
+109 two models is computed by choosing a layer and then comparing the features/activations after
+110 adaptation for that layer given a batch of tasks represented as a support and query set. A more
+111 thorough overview of these metrics for the analysis of internal representations for convolutional
+112 neural networks (CNNS) can be found in the appendix, section G.
+113 Task2Vec Embeddings for Distances between Tasks: The diversity coefficient we propose is
+114 the expectation of distance between tasks (explain in more detail in section $\textcircled { 3 }$ ). Therefore, it is
+115 essential to define the distance between different pairs of tasks. We choose the cosine distance
+116 between Task2Vec (vectorial) embeddings as in $\textcircled { 1 2 0 }$ . Therefore, we provide a summary of the
+117 Task2Vec method to compute task embeddings. The vectorial representation of tasks provided by
+118 Task2Vec $\textcircled { 1 2 0 }$ is the vector of diagonal entries of the Fisher Information Matrix (FIM) given a fix
+119 neural network as a feature extractor – also called a probe network – after fine-tuning the final
+120 classification layer to the task. The authors explain this is a good vectorial representation of tasks
+121 because 1. It approximately indicates the most informative weights for solving the current task
+122 (up to a second order approximation) 2. For rich probe networks like CNNs, the diagonal is more
+123 computationally tractable. We choose Task2Vec because the original authors provide extensive
+124 evidence that their embeddings correlate with semantic and taxonomic relations between different
+125 visual classes – making it a convincing embedding for tasks $\textcircled { 1 2 0 }$ . The Task2Vec embedding of task $\tau$
+126 is the diagonal of the following matrix:
+
+$$
+\hat { F } _ { D _ { \tau } , f _ { w } } = \hat { F } ( D _ { \tau } , f _ { w } ) = \mathbb { E } _ { \boldsymbol { x } , \boldsymbol { y } \sim \hat { p } ( \boldsymbol { x } | \tau ) p ( \boldsymbol { y } | \boldsymbol { x } , f _ { w } ) } [ \nabla _ { w } \log p ( \boldsymbol { y } \mid \boldsymbol { x } , f _ { w } ) \nabla _ { w } p ( \boldsymbol { y } \mid \boldsymbol { x } , f _ { w } ) ^ { \top } ]
+$$
+
+127 where $f _ { w }$ is the neural networks used as a feature extractor with architecture $f$ and weights $w$ ,
+128 $\hat { p } ( x \mid \tau )$ is the empirical distribution defined by the training data $D _ { \tau } = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { \bar { n } }$ for task $\tau$ , and
+129 $p ( y \mid x , f _ { w } )$ is a deep neural network trained to approximate the (empirical) posterior $\hat { p } ( y \mid x , \tau )$ .
+130 We’d like to emphasize that the there is a dependence on target label since Task2Vec fixes the
+131 feature extractor (using $f _ { w , }$ ) and then fits the final layer (or “head") to approximate the task posterior
+132 distribution $\hat { p } ( y \mid x , \tau )$ .
+
+# 133 3 Definition of the Diversity Coefficient
+
+134 The diversity coefficient aims to measure the intrinsic diversity (or variability) of tasks in a few-shot
+135 learning benchmark. At a high level, the diversity coefficient is the expected distance between a
+136 pair of different tasks given a fixed probe network. In this work, we choose the distance to be the
+137 cosine distance between vectorial representations (i.e. embeddings) of tasks according to Task2Vec
+138 as described in section $2 .$ Using a fixed probe networks is essential because: 1. Using a fixed probe
+139 network means that the distances between different tasks are comparable, as discussed in the original
+140 Task2Vec $\textcircled{20 }$ and 2. Since we are computing the distance between different tasks, we need to make
+141 sure the difference comes from intrinsic properties of the data and not from a different source, e.g. if
+142 one uses different models then this might confound the source of variability in our metric. We define
+143 the diversity coefficient of a few-shot learning benchmark $B$ as follows:
+
+$$
+\begin{array} { r } { \hat { d i } v ( B ) = \mathbb { E } _ { \tau _ { 1 } \sim \hat { p } ( \tau | B ) , \tau _ { 2 } \sim \hat { p } ( \tau | B ) } \mathbb { E } _ { D _ { 1 } \sim \hat { p } ( x _ { 1 } , y _ { 1 } | \tau _ { 1 } ) , D _ { 2 } \sim \hat { p } ( x _ { 2 } , y _ { 2 } | \tau _ { 2 } ) } \left[ d ( \hat { F } _ { D _ { 1 } , f _ { w } } , \hat { F } _ { D _ { 2 } , f _ { w } } ) \right] } \end{array}
+$$
+
+144 where $f _ { w }$ is the neural networks used as a feature extractor with architecture $f$ and weights $w$ ,
+145 $\hat { p } ( x \mid \tau )$ is the empirical distribution defined by the training data $D _ { \tau } = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n }$ for task $\tau$
+146 $\tau _ { 1 } , \tau _ { 2 }$ are tasks sampled from the empirical distribution of tasks $\hat { p } ( \tau \mid B )$ for the current benchmark
+147 $B$ (i.e. a batch of tasks with their data sets $\mathcal { D } = ( \tau _ { i } , D _ { \tau _ { i } } ) _ { i = 1 } ^ { N } )$ , a task $\tau _ { i }$ is the probability distribution
+148 $p ( x , y \mid \tau )$ of the data, is a distance metric (for us cosine), $f _ { w }$ is the neural networks used as
+149 a feature extractor with architecture $f$ and weights $w$ , and $\hat { p } ( x \mid \tau )$ is the empirical distribution
+150 defined by the training data $D _ { \tau } = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n }$ for task $\tau$ . We’d also like to recall the reader that the
+151 definition of a task in this setting is of a n-way, $\mathbf { k }$ -shot few-shot learning task. Therefore, each task has
+152 n classes sampled with $\mathrm { k }$ examples used for the adaptation. We’d like to emphasize that the adaptation
+153 here is only to fine-tune the final layer according to the Task2Vec method for the correct computation
+154 of the FIM. Therefore, in this setting we combine the support and query set as the split is not relevant
+155 for the computation of the task embedding using Task2Vec. Note that the above formulation can be
+156 easily adapted to any distance function between tasks, and is not necessarily specific to using the
+157 FIM or cosine distance. For example, given the true distributions for tasks one can use real distances
+158 between probability distributions e.g. Hellinger distance. In addition, it is obvious one can use a
+159 distance function besides the cosine distance – but choose it in accordance to the original work of
+160 Task2Vec $\textcircled { 1 2 0 }$ .
+
+# 4 Experiments
+
+62 This section explains the experiments backing up our main results outlined in our list of contributions.
+63 Experimental details are provided in the supplementary section $\bigstar$ and the learning curves displaying
+64 the convergence for a fair comparison are in supplementary section B.
+
+# 165 4.1 The Diversity Coefficient of MiniImagenet and Cifar-fs
+
+66 To put our analysis into a problem-centric framework, we first analyze the problem they are trying
+7 to solve through the diversity coefficient. Recall that the diversity coefficient aims to quantify the
+8 intrinsic variation of tasks in a few-shot learning benchmark. We show that the diversity coefficient
+69 of the popular MiniImagenet and Cifar-fs benchmarks are low with good confidence intervals using
+70 four different probe networks in table 1.
+
+
Probe Network
Diversity on MI
Diversity on Cifar-fs
Resnet18 (pt)
0.117 ± 2.098e-5
0.100 ± 2.18e-5
Resnet18 (rand)
0.0955 ± 1.29e-5
0.103 ± 1.05e-5
Resnet34 (pt)
0.0999 ± 1.95e-5
0.0847 ± 3.06e-5
Resnet34 (rand)
0.0620 ± 8.12e-6
0.0643 ± 9.64e-6
+
+Table 1: The diversity coefficient of MiniImagenet (MI) and Cifar-fs is low. The diversity coefficient was computed using the cosine distance between different standard n-way, $\mathbf { k }$ -shot classification tasks from the few-shot learning benchmark using the Task2Vec method described in section $3 .$ We used $\mathrm { n } { = } 5$ (number of classes) and ${ \bf k } = 2 0$ (number of examples per class) since we can use the whole task data to compute the diversity coefficient (no splitting of support and query set required). We used Resnet18 and Resnet34 networks as probe networks – both pre-trained on ImageNet (indicated as “pt" on table) and randomly initialized (indicated as “rand" on table). We observe that both type of networks and weights give similar diversity results. All confidence intervals were at $9 5 \%$ . To compute results, we used 500 few-shot learning tasks and only compare pairs of different tasks. This results in $( 5 0 0 ^ { 2 } - 5 0 0 ) / 2 = 1 2 4 ,$ 750 pair-wise distances used to compute the diversity coefficient.
+
+# 171 4.2 Low Diversity Correlates with Equivalence of MAML and Transfer Learning
+
+172 Now that we have placed ourselves in a problem-centric framework and shown the diversity coefficient
+173 of the popular MiniImagenet and Cifar-fs benchmarks are low – we proceed to show the failure of
+174 transfer learning (with USL) to outperform MAML. Crucially, the analysis was done using a fair
+175 comparison: using the same model architecture, optimizer, and training all models to convergence
+176 – details in section A. We used the five-layer CNN used in $\textcircled { 1 5 } \textcircled { 2 5 }$ and Resnet12 as in $\textcircled { 1 9 }$ . We
+177 provide evidence that in the setting of low diversity:
+
+1. The accuracy of an adapted MAML meta-learner vs. an adapted USL pre-trained model are similar and statistically significant, except for one result where transfer learning with USL is worse. This is shown in table 2 and 1.
+2. The distance for the classification layer decreases sharply according to four distance-based metrics – SVCCA, PWCCA, LINCKA, and OPD – as shown in figure $2 .$ This implies the predictions of the two are similar.
+
+184 For the first point, we emphasize that tables 1 and table 2 taken together support our central hypothesis:
+185 that models trained with meta-learning are not inferior to transfer learning models (using USL) when
+186 the diversity coefficient is low. Careful inspection reveals that the methods have the same meta-test
+187 accuracy with intersecting confidence intervals – making the results statistically significant across
+188 few-shot benchmarks and architectures. The one exception is the third set of bar plots, where transfer
+189 learning with USL is in fact worse.
+190 For the second point, refer to figure $\nsubseteq$ and observe that as the depth of the network increases, the
+191 distance between the activation layers of a model trained with MAML vs USL increases until it
+192 reaches the final classification layer – where all four metrics display a noticeable dip. In particular,
+193 PWCCA considers the two prediction layers identical (approximately zero distance). This final point
+194 is particularly interesting because PWCCA is weighted according to the CCA weights that stabilize
+195 with the final predictions of the network. This means that the PWCCA distance value is reflective of
+196 what the networked actually learned and gives a more reliable distance metric (for details, refer to the
+197 appendix section G.5). This is important because this supports our main hypothesis: that at prediction
+198 time there is an equivalence between transfer learning and MAML when the diversity coefficient is
+199 low.
+
+
+Figure 1: MAML trained models and union supervised trained (USL) models have statistically equivalent meta-test accuracy for MiniImagenet and Cifar-fs with Resnet12 and five layer CNNs. This holds for both the Resnet12 architecture used in $\textcircled { 1 9 }$ and the 5 layer CNN (indicated as “5CNN") in $\textcircled { 1 2 5 }$ . Results used a (meta) batch-size of 100 tasks and $9 5 \%$ confidence intervals. All MAML models were trained with 5 inner steps during meta-training. “MAML5" and “MAML10" in the bar plot indicates the adaptation method used at test time i.e. we used 5 inner steps and 10 inner steps at test time. MiniImagenet is abbreviated as “MI" in the figure.
+
+# 00 4.3 Is the Equivalence of MAML and Transfer Learning related to Model Size or Low 01 Diversity?
+
+An alternative hypothesis to explain the equivalence of transfer learning (with USL) and MAML could be due to the capabilities of large neural networks to be better meta-learners in general. Inspired by the impressive ability of large language models to be few-shot (or even zero-shot) learners $\textcircled { 1 4 } \textcircled { 2 7 } \textcircled { 2 8 } \textcircled { 3 } \textcircled { - }$ we hypothesized that perhaps the meta-learning capabilities of deep learning models is a function of the model size. If this were true, then we expected to see the difference in meta-test accuracy
+
+
Meta-train Initialization
Adaptation at Inference
Meta-test Accuracy
Random
no adaptation
19.3 ± 0.80
MAML0
no adaptation
20.0 ± 0.00
USL
no adaptation
15.0 ± 0.26
Random
MAML5 adaptation
34.2 ± 1.16
MAML5
MAML5 adaptation
62.4 ± 1.64
USL
MAML5 adaptation
25.1 ± 0.98
Random
MAML10 adaptation
34.1 ± 1.23
MAML5
MAML10 adaptation
62.3 ± 1.50
USL
MAML10 adaptation
25.1 ± 0.97
Random
Adapt Head only (with LR)
40.2 ± 1.30
MAML5
Adapt Head only (with LR)
59.7 ± 1.37
USL
Adapt Head only (with LR)
60.1 ± 1.37
+
+Table 2: MAML trained representations and supervised trained representation have statistically equivalent meta-test accuracy on MiniImagenet – which has low diversity. The transfer model’s adaptation is labeled as “Adapted Head only (with LR)" – which stands for “Logistic Regression (LR)" used in $\textcircled{1 1 9 }$ . More precisely, we used Logistic Regression (LR) with LBFGS with the default value for the l2 regularization parameter given by Python’s Sklearn. Note that an increase in inner steps from 5 to 10 with the MAML5 trained model does not provide an additional meta-test accuracy boost, consistent with previous work $\textcircled { 1 2 6 }$ . Note that the fact that the MAML5 representation matches the USL representation when both use the same adaptation method is not surprising – given that: 1) previous work has shown that the distance between the body of an adapted MAML model is minimal compared to the unadapted MAML (which we reproduce in $\boxed { 5 }$ in the green line) and 2) the fact that a MAML5 adaptation is only 5 steps of MAML while LR fully converges the prediction layer. We want to highlight that only the MAML5 model achieved the maximum meta-test performance of 0.6 with the MAML5 adaptation – suggesting that the USL and MAML5 meta-learning algorithms might learn different representations. For USL to have a fair comparison during meta-test time when using the MAML adaptation, we provide the MAML final layer learned initialization parameters to the USL model (but any is fine due to convexity when using a fixed feature extractor). This is needed since during meta-training USL is trained with a union of all the labels (64) – so it does not even have the right output size of 5 for few-shot prediction. Meta-testing was done in the standard 5-way, 5-shot regime.
+
+207 of MAML and USL to be larger for smaller models and the difference to decrease as the model
+208 size increased. Once the two models were, of the same size but large enough, we hypothesized that
+209 the meta-test accuracy would be the same. We tested this to rule out that our observations were a
+210 consequence of the model size. The results were negative and surprisingly the equivalence between
+211 MAML and USL seems to hold even as the model increased – strengthening our hypothesis that the
+212 low task diversity might be a bigger factor explaining our observations. We show this in figure $^ { 3 , }$
+213 and we want to draw attention to the fact this statistical equivalence holds even when using only four
+214 filters – the case where we expected the biggest difference.
+
+# 15 4.4 MAML learns a different base model compared to Union Supervised Learned models – 16 even in the presence of low task diversity
+
+The first four layers of figure 2 shows how large the distance is of a MAML representation compared to a SL representation. In particular, it is much larger than the distance value in the range $[ 0 , 0 . 1 ]$ from previous work that compared MAML vs. adapted MAML $\textcircled { 1 8 }$ . We reproduced that and indeed MAML vs. adapted MAML has a small difference (smaller for us) – supporting our observations that a MAML vs. a USL learned representations are different at the feature extractor layer even when the diversity is low. Results are statistically significant.
+
+
+Figure 2: The classification layer of transfer learning and a MAML5 model decrease in distance – implying similar predictions. More precisely, an initialization trained with 5 inner steps (MAML5) has an increasingly similar head (classifier) after adaptation with MAML5 compared to the classifier layer of the union supervise learned (USL) model that has been adapted only at the final layer. In particular, the USL model has been adapted with Logistic Regression (LR) with LBFGS with the default value for the l2 regularization parameter given by Python’s Sklearn (as in $\textcircled { 1 1 9 }$ ). We showed this trend with four different distance metrics SVCCA, PWCCA, LICKA, and OPD referenced in section $\bigstar$ Observe that according to PWCCA the distance between the predictions is zero. This is true because the distance of classification layer (indicated as “head" in the figure) is zero. The architecture used here is a five layer CNN as in $\textcircled { 1 5 } , \textcircled { 2 5 } )$ with their same setup. The benchmark used for this analysis is MiniImagenet.
+
+
+Figure 3: The meta-test accuracy of MAML and transfer learning using USL is similar in a statistically significant way – regardless of the model size. In this experiment, we used the MiniImagenet benchmark, the five layer CNN used in $\textcircled { 1 5 } \textcircled { 2 5 }$ , and only increased the filter size using sizes 4, 8, 16, and 32. We made sure the comparison was fair by using the same architecture, optimizer, and trained all models to convergence. During meta-training, the MAML model was trained using 5 inner steps. The legends indicating MAMl5 and MAML10 refer to the number of inner steps used at test time. We used a (meta) batch size of 100 tasks.
+
+In this section, we show the closeness of MAML and transfer learning (with USL) for synthetic experiments for low and high diversity regimes in Figure $\textcircled { 4 }$ In the low regime, the two methods are equivalent in a statistically significant way – which supports the main claims of our paper. As the diversity increases, however, the difference between USL and MAML increases (in favor of USL). This will be explored further in future work.
+
+The task is the usual n-way, $\mathbf { k }$ -shot tasks, but the data comes from a Gaussian and the meta-learners are tasked with classifying from which Gaussian the data points came from in a few-shot learning manner. Benchmarks are created by sampling a Gaussian distribution with means moving away from the origin as the benchmark changes. Therefore, the Gaussian benchmark with the highest diversity coefficient has Gaussians that are the furthest from the origin. We computed the diversity coefficient using a proper distance between distributions using the Hellinger distance eluded in section $3$ instead of the FIM distance. We can do this because we know the ground truth distribution in our synthetic experiments, and Gaussians have a closed form Hellinger distance. Details on the n-way Gaussian benchmark and diversity coefficient using the Hellinger distance can be found in supplementary section E and F.
+
+
+Figure 4: The meta-test accuracy of MAML and transfer learning using USL is similar in a statistically equivalent way in the low diversity regime in the 5-way, 10-shot Gaussian Benchmarks. MAML models were trained with 5 inner steps. MAML5 and MAML10 indicate the adaptation procedure at test time. Results used a (meta) batch-size of 500 tasks and $9 5 \%$ confidence intervals. As the diversity of the benchmark increases, the Gaussian tasks are sampled further away from the origin. Note, as the diversity increases, the difference between USL and MAML increases (in favor of USL).
+
+# 240 5 Related Work
+
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+
+Our work proposes a problem-centric framework for the analysis of meta-learning algorithms inspired from previous puzzling results $\textcircled { 1 9 }$ . We propose to use a pair-wise distance between tasks and analyze how this metric might correlate with meta-learning. The closest line of work for this is the long line of work by $\textcircled { 1 2 0 }$ where they suggest methods to analyze the complexity of a task, propose unsymmetrical distance metrics for data sets, reachability of tasks with SGD, ways to embed entire data sets and more $( | 2 0 ; | 2 9 ; | 3 0 ; | 3 1 | )$ . We believe this line of work to be very fruitful and hope that more people adopt tools like the ones they suggest and we propose in this paper before researching or deploying meta-learning algorithms. We hope this helps meta-learning methods succeed in practice – since cognitive science suggests meta-learning is a powerful method humans use to learn $\textcircled{3 2 }$ . In the future, we hope to compare $\textcircled { 1 2 0 }$ ’s distance metrics between tasks with ours to provide a further unified understanding of meta-learning and transfer learning. A contrast between their work and ours is that we focus our analysis from a meta-learning perspective applied to few-shot learning – while their focus is understanding transfer learning methods between data sets.
+
+The use of a distance metric in our definition of the diversity coefficient is inspired by the analysis 255 done by $\textcircled { 1 8 }$ . They showed that MAML functions mainly via feature re-use than by rapid learning i.e., 256 that a model trained with MAML changes very little after the MAML adaptation. The main difference
+
+257 of their work with our is: 1) that we compare MAML trained models against union supervised learned
+258 models (USL) instead of only comparing MAML against adapted MAML, and 2) that we explicitly
+259 analyzed properties of the data sets. In addition, we use a large set of distance metrics for our analysis
+260 including: SVCCA, PWCCA, LINCKA and OPD as proposed by (21; 22; 23; 24).
+
+Our work is most influenced by previous work suggesting modern meta-learning requires rethinking $\textcircled{1 1 9 }$ The main difference of our work with theirs is that we analyzed the internal representation of the meta-learning algorithms and contextualize these with quantifiable metrics of the problem being solved. Unlike their work, we focused on a fair comparison between meta-learning methods by ensuring the same neural network backbone was used. Another difference is that they gained further accuracy gains by using distillation – a method we did not analyze and leave for future work.
+
+267 A related line of work $\textcircled { 1 3 3 } \textcircled { 2 6 }$ first showed that there exist synthetic data sets that are capable of
+268 exhibiting higher degrees of adaptation as compared to the original work by $\textcircled { 1 1 8 }$ . The difference is
+269 that they did not compare MAML models against transfer learning methods like we did here. Instead,
+270 they focused on comparing adapted MAML models vs. unadapted MAML models.
+271 Another related line of work is the predictability of adversarial transferability and transfer learning.
+272 They show this both theoretically and with extensive experiments $\textcircled{3 4 }$ . The main difference between
+273 their work and ours is that they focus their analysis mainly on transfer learning, while we concentrated
+274 on meta-learning for few-shot learning. In addition, we did not consider adversarial transferability –
+275 while that was a central piece of their analysis. Further, related work is outlined in the supplementary
+276 section I.
+
+# 77 6 Discussion and Future Work
+
+In this work, we presented a problem-centric framework when comparing transfer learning methods with meta-learning algorithms – using USL and MAML as the canonical representatives of transfer and meta-learning methods respectively. We showed the diversity coefficient of the popular MiniImagenet and Cifar-fs benchmark is low and that under a fair comparison – MAML is very similar to transfer learning with USL. This was also true even when decreasing the model size – removing the alternative hypothesis that the equivalence of MAML and transfer learning with USL held due to large models. Instead, this suggests strengthens our hypothesis that the diversity of the data might be the driving factor. The equivalence of MAML and USL also replicated in our synthetic experiments. Therefore, we challenge the suggestions from previous work $\textcircled { 1 1 9 }$ that only a good embedding can beat more effective than sophisticated meta-learning – especially in the low diversity regime. In addition, our synthetic experiments show a promising scenario where we can systematically differentiate meta-learning algorithms from transfer learning algorithms – which supports our actionable suggestion to use the diversity coefficient to effectively study meta-learning and transfer learning algorithms. We hope to study this in more depth in the future with real and synthetic data.
+
+We also have theoretical results from a statistical decision perspective in the supplementary section ?? that inspired this work and suggest that when the distance between tasks is zero – then the predictions of transfer learning, meta-learning and even a fixed model with no adaptation are all equivalent (with the l2 loss). The results are theoretically limited because we can only reason when the diversity is exactly zero, but regardless provided an interesting perspective to study and inspire empirical work.
+
+We hope this work inspires the community in meta-learning and machine learning to construct benchmarks from a problem-centric perspective – that go beyond large scale data sets – using have quantitative metrics.
+
+# References
+
+[1] A. Krizhevsky, I. Sutskever, and G. E. Hinton, “ImageNet Classification with Deep Convolutional Neural Networks,”
+[2] K. He, X. Zhang, S. Ren, and J. Sun, “Deep Residual Learning for Image Recognition,” Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition, vol. 2016-December, pp. 770–778, dec 2015.
+[3] J. Devlin, M. W. Chang, K. Lee, and K. Toutanova, “BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding,” NAACL HLT 2019 - 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies - Proceedings of the Conference, vol. 1, pp. 4171–4186, oct 2018.
+[4] T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, S. Agarwal, A. Herbert-Voss, G. Krueger, T. Henighan, R. Child, A. Ramesh, D. M. Ziegler, J. Wu, C. Winter, C. Hesse, M. Chen, E. Sigler, M. Litwin, S. Gray, B. Chess, J. Clark, C. Berner, S. Mccandlish, A. Radford, I. Sutskever, and D. A. Openai, “Language Models are Few-Shot Learners,” tech. rep., 2020.
+[5] D. Silver, A. Huang, C. J. Maddison, A. Guez, L. Sifre, G. Van Den Driessche, J. Schrittwieser, I. Antonoglou, V. Panneershelvam, M. Lanctot, S. Dieleman, D. Grewe, J. Nham, N. Kalchbrenner, I. Sutskever, T. Lillicrap, M. Leach, K. Kavukcuoglu, T. Graepel, and D. Hassabis, “Mastering the game of Go with deep neural networks and tree search,” Nature 2016 529:7587, vol. 529, pp. 484–489, jan 2016.
+[6] V. Mnih, K. Kavukcuoglu, D. Silver, A. Graves, I. Antonoglou, D. Wierstra, and M. Riedmiller, “Playing Atari with Deep Reinforcement Learning,”
+[7] W. Ye, S. Liu, T. Kurutach, P. Abbeel, Y. Gao, T. University, U. C. Berkeley, S. Qi, and Z. Institute, “Mastering Atari Games with Limited Data,” oct 2021.
+[8] Y. Tian, Y. Wang, D. Krishnan, J. B. Tenenbaum, and P. Isola, “Rethinking Few-Shot Image Classification: a Good Embedding Is All You Need?,” 2020.
+[9] W.-Y. Chen, Y.-C. Liu, Z. Kira, Y.-C. F. Wang, and J.-B. Huang, “A Closer Look at Few-shot Classification,” 7th International Conference on Learning Representations, ICLR 2019, 2019.
+[10] Y. Chen, X. Wang, Z. Liu, H. Xu, and T. Darrell, “A New Meta-Baseline for Few-Shot Learning,” tech. rep.
+[11] G. S. Dhillon, P. Chaudhari, A. Ravichandran, and S. Soatto, “A Baseline for Few-Shot Image Classification,” 2019.
+[12] S. Huang and D. Tao, “All you need is a good representation: A multi-level and classifier-centric representation for few-shot learning,” 2019.
+[13] T. M. Mitchell, “The Need for Biases in Learning Generalizations by The Need for Biases in Learning Generalizations,” 1980.
+[14] S. B.-D. Shai Shalev-Shwartz, “Understanding Machine Learning: From Theory to Algorithms,” Cambridge University Press, 2014.
+[15] C. Finn, P. Abbeel, and S. Levine, “Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks,” 2017.
+[16] J. B. Hamrick Deepmind and S. M. Deepmind, “LEVELS OF ANALYSIS FOR MACHINE LEARNING,” 2020.
+[17] D. Marr, “Vision: A Computational Investigation into the Human Representation and Processing of Visual Information,” Phenomenology and the Cognitive Sciences, vol. 8, no. 4, p. 397, 1982.
+[18] A. Raghu, M. Raghu, S. Bengio, and G. Brain, “Rapid Learning or Feature Reuse? Towards Understanding the Effectiveness of MAML,” tech. rep., 2020.
+[19] Y. Tian, Y. Wang, D. Krishnan, J. B. Tenenbaum, and P. Isola, “Rethinking Few-Shot Image Classification: a Good Embedding Is All You Need?,” 2020.
+[20] A. Achille UCLA, M. Lam AWS, R. Tewari AWS, A. Ravichandran AWS, S. Maji UMass, S. Soatto UCLA, and P. Perona Caltech, “TASK2VEC: Task Embedding for Meta-Learning Charless Fowlkes UCI and AWS,” tech. rep., 2019.
+[21] M. Raghu, J. Gilmer, J. Yosinski, and J. Sohl-Dickstein, “SVCCA: Singular Vector Canonical Correlation Analysis for Deep Learning Dynamics and Interpretability,” tech. rep., 2017.
+
+353 [22] A. S. Morcos, Deepmind, M. Raghu, S. Bengio, and G. Brain, “Insights on representational
+354 similarity in neural networks with canonical correlation,” tech. rep., 2018.
+355 [23] S. Kornblith, M. Norouzi, H. Lee, and G. Hinton, “Similarity of Neural Network Representations
+356 Revisited,” tech. rep., may 2019.
+357 [24] F. Ding, J.-S. Denain, and J. Steinhardt, “Grounding Representation Similarity with Statistical
+358 Testing,” 2021.
+359 [25] S. Ravi and H. Larochelle, “Optimization as a model for few-shot learning,” tech. rep., 2017.
+360 [26] B. Miranda, “An empirical study of the properties of meta-learning - presentation,” Illinois
+361 Digital Environment for Access to Learning and Scholarship (IDEALS), dec 2020.
+362 [27] R. Bommasani, D. A. Hudson, E. Adeli, R. Altman, S. Arora, S. von Arx, M. S. Bernstein,
+363 J. Bohg, A. Bosselut, E. Brunskill, E. Brynjolfsson, S. Buch, D. Card, R. Castellon, N. Chatterji,
+364 A. Chen, K. Creel, J. Q. Davis, D. Demszky, C. Donahue, M. Doumbouya, E. Durmus, S. Ermon,
+365 J. Etchemendy, K. Ethayarajh, L. Fei-Fei, C. Finn, T. Gale, L. Gillespie, K. Goel, N. Goodman,
+366 S. Grossman, N. Guha, T. Hashimoto, P. Henderson, J. Hewitt, D. E. Ho, J. Hong, K. Hsu,
+367 J. Huang, T. Icard, S. Jain, D. Jurafsky, P. Kalluri, S. Karamcheti, G. Keeling, F. Khani,
+368 O. Khattab, P. W. Kohd, M. Krass, R. Krishna, R. Kuditipudi, A. Kumar, F. Ladhak, M. Lee,
+369 T. Lee, J. Leskovec, I. Levent, X. L. Li, X. Li, T. Ma, A. Malik, C. D. Manning, S. Mirchandani,
+370 E. Mitchell, Z. Munyikwa, S. Nair, A. Narayan, D. Narayanan, B. Newman, A. Nie, J. C.
+371 Niebles, H. Nilforoshan, J. Nyarko, G. Ogut, L. Orr, I. Papadimitriou, J. S. Park, C. Piech,
+372 E. Portelance, C. Potts, A. Raghunathan, R. Reich, H. Ren, F. Rong, Y. Roohani, C. Ruiz,
+373 J. Ryan, C. Ré, D. Sadigh, S. Sagawa, K. Santhanam, A. Shih, K. Srinivasan, A. Tamkin,
+374 R. Taori, A. W. Thomas, F. Tramèr, R. E. Wang, and W. Wang, “On the Opportunities and Risks
+375 of Foundation Models,” aug 2021.
+376 [28] A. Radford, J. W. Kim, C. Hallacy, A. Ramesh, G. Goh, S. Agarwal, G. Sastry, A. Askell,
+377 P. Mishkin, J. Clark, G. Krueger, and I. Sutskever, “Learning Transferable Visual Models From
+378 Natural Language Supervision,” feb 2021.
+379 [29] “The Dynamic Distance Between Learning Tasks: \* From Kolmogorov Complexity to Transfer
+380 Learning via Quantum Physics and the Information Bottleneck of the Weights of Deep Networks,”
+381 2018.
+382 [30] A. Achille, G. B. Mbeng, and S. Soatto, “Dynamics and Reachability of Learning Tasks,” 2019.
+383 [31] A. Achille, G. Paolini, G. Mbeng, and S. Soatto, “The Information Complexity of Learning
+384 Tasks, their Structure and their Distance,” 2020.
+385 [32] B. M. Lake, T. D. Ullman, J. B. Tenenbaum, and S. J. Gershman, “Building Machines That
+386 Learn and Think Like People,” Behavioral and Brain Sciences, vol. 40, 2016.
+387 [33] B. Miranda, “An empirical study of the properties of meta-learning - presentation,” Illinois
+388 Digital Environment for Access to Learning and Scholarship (IDEALS), 2020.
+389 [34] K. Liang, J. Y. Zhang, B. Wang, Z. Yang, O. Koyejo, and B. Li, “Uncovering the Connections
+390 Between Adversarial Transferability and Knowledge Transferability,” 2021.
+
+# Checklist
+
+The checklist follows the references. Please read the checklist guidelines carefully for information on how to answer these questions. For each question, change the default [TODO] to [Yes] , [No] , or [N/A] . You are strongly encouraged to include a justification to your answer, either by referencing the appropriate section of your paper or providing a brief inline description. For example:
+
+• Did you include the license to the code and datasets? [Yes] See Section ??. • Did you include the license to the code and datasets? [No] Code and data will be released if accepted.
+
+400 Please do not modify the questions and only use the provided macros for your answers. Note that the
+401 Checklist section does not count towards the page limit. In your paper, please delete this instructions
+402 block and only keep the Checklist section heading above along with the questions/answers below.
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes]
+(c) Did you discuss any potential negative societal impacts of your work? [No]
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes]
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [No]
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes]
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+(b) Did you mention the license of the assets? [No]
+(c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [TODO]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [TODO]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [TODO]
\ No newline at end of file
diff --git a/md/dev/x5mtJD2ovc/x5mtJD2ovc.md b/md/dev/x5mtJD2ovc/x5mtJD2ovc.md
new file mode 100644
index 0000000000000000000000000000000000000000..7d2fbb3506673619ee87581eeeef0c1628a379f4
--- /dev/null
+++ b/md/dev/x5mtJD2ovc/x5mtJD2ovc.md
@@ -0,0 +1,430 @@
+# KNN-DIFFUSION: IMAGE GENERATION VIA LARGESCALE RETRIEVAL
+
+Shelly Sheynin∗, Oron Ashual∗,
+Adam Polyak, Uriel Singer, Oran Gafni, Eliya Nachmani, Yaniv Taigman
+∗Equal Contribution Meta AI
+{shellysheynin,oron}@meta.com
+
+
+Figure 1: (a) Samples of stickers generated from text inputs, (b) Semantic text-guided manipulations applied to the "Original" image without using edit masks.
+
+# ABSTRACT
+
+Recent text-to-image models have achieved impressive results. However, since they require large-scale datasets of text-image pairs, it is impractical to train them on new domains where data is scarce or not labeled. In this work, we propose using large-scale retrieval methods, in particular, efficient $k$ -Nearest-Neighbors (kNN), which offers novel capabilities: (1) training a substantially small and efficient text-to-image diffusion model using only pre-trained multi-modal embeddings, but without an explicit text-image dataset, (2) generating out-of-distribution images by simply swapping the retrieval database at inference time, and (3) performing text-driven local semantic manipulations while preserving object identity. To demonstrate the robustness of our method, we apply our kNN approach on two state-of-the-art diffusion backbones, and show results on several different datasets. As evaluated by human studies and automatic metrics, our method achieves stateof-the-art results compared to existing approaches that train text-to-image generation models using images-only dataset.
+
+# 1 INTRODUCTION
+
+Large-scale generative models have been applied successfully to image generation tasks (Gafni et al., 2022; Ramesh et al., 2021; Nichol et al., 2021; Saharia et al., 2022; Yu et al., 2022), and have shown outstanding capabilities in extending human creativity using editing and user control. However, these models face several significant challenges: (i) Large-scale paired data requirement. To achieve high-quality results, text-to-image models rely heavily on large-scale datasets of (text, image) pairs collected from the internet. Due to the requirement of paired data, these models cannot be applied to new or customized domains with only unannotated images. (ii) Computational cost and efficiency. Training these models on highly complex distributions of natural images usually requires scaling the size of the model, data, batch-size, and training time, which makes them challenging to train and less accessible to the community. Recently, several works proposed text-to-image models trained without an explicit paired text-image datasets. Liu et al. (2021) performed a direct optimization to a pre-trained model based on a CLIP loss (Radford et al., 2021). Such approaches are time-consuming, since they require optimization for each input. Zhou et al. (2021) proposed training with CLIP image embedding perturbed with Gaussian noise. However, to achieve high-quality results, an additional model needs to be trained with an annotated text-image pairs dataset.
+
+In this work, we introduce a novel generative model, kNN-Diffusion, which tackles these issues and progresses towards more accessible models for the research community and other users. Our model leverages a large-scale retrieval method, $k$ -Nearest-Neighbors (kNN) search, in order to train the model without an explicit text-image dataset. Specifically, our diffusion model is conditioned on two inputs: (1) image embedding (at training time) or text embedding (at inference), extracted using pre-trained CLIP encoder, and (2) kNN embeddings, representing the $k$ most similar images in the CLIP latent space. During training, we assume that no paired text is available, hence condition only on CLIP image embedding and on $k$ additional image embeddings, selected using the retrieval model. At inference, only text inputs are given, so instead of image embeddings, we use the text embedding that shares a joint embedding space with the image embeddings. Here, the kNN image embeddings are retrieved using the text embeddings.
+
+The additional kNN embeddings have three main benefits: (1) they extend the distribution of conditioning embeddings and ensure the distribution is similar in train and inference, thus helping to bridge the gap between the image and text embedding distributions (see Fig. 5); (2) they teach the model to learn to generate images from a target distribution by using samples from that distribution. This allows generalizing to different distributions at test time and generating out-of-distribution samples; (3) they hold information that does not need to be present in the model, which allows it to be substantially smaller. We demonstrate the effectiveness of our kNN approach in Sec. 4.
+
+To assess the performance of our method, we train our model on two large-scale datasets: the Public Multimodal Dataset (Singh et al., 2021) and an image-only stickers dataset collected from the Internet. We show state-of-the-art zero-shot results on MS-COCO (Lin et al., 2014), LN-COCO (PontTuset et al., 2020) and CUB (Wah et al., 2011). To further demonstrate the advantage of retrieval methods in text-to-image generation, we train two diffusion backbones using our kNN approach: continuous (Ramesh et al., 2022) and discrete (Gu et al., 2021). In both cases we outperform the model trained without kNN. In comparison to alternative methods presented in Sec. 4, we achieve state-of-the-art results in both human evaluations and FID score, with only 400 million parameters and 7 seconds inference time.
+
+Lastly, we introduce a new approach for local and semantic manipulations that is based on CLIP and kNN, without relying on user-provided masks. Specifically, we fine-tune our model to perform local and complex modifications that satisfies a given target text prompt. For example, given the teddy bear’s image in Fig. 4, and the target text "holds a heart", our method automatically locates the local region that should be modified and synthesizes a high-resolution manipulated image in which (1) the teddy bear’s identity is accurately preserved and (2) the manipulation is aligned with the target text. We demonstrate our qualitative advantage by comparing our results with two state-of-the-art models, Text2Live (Bar-Tal et al., 2022) and Textual Inversion (Gal et al., 2022), that perform image manipulations without masks (Fig. 4, 21 and 22).
+
+We summarize the contributions of this paper as follows: (1) We propose kNN-Diffusion, a novel and efficient model that utilizes a large-scale retrieval method for training a text-to-image model with only pre-trained multi-modal embeddings, but without an explicit text-image dataset. (2) We demonstrate efficient out-of-distribution generation, which is achieved by substituting retrieval databases. (3) We present a new approach for local and semantic image manipulation, without utilizing masks. (4) We evaluate our method on two diffusion backbones, discrete and continuous, as well as on several datasets, and present state-of-the-art results compared to baselines.
+
+# 2 RELATED WORK
+
+Text-to-image models. Text-to-image generation is a well-studied task that focuses on generating images from text descriptions. While GANs (Xu et al., 2018; Zhu et al., 2019; Zhang et al., 2021) and Transformer-based methods (Ramesh et al., 2021; Gafni et al., 2022; Yu et al., 2022; Ding et al., 2021) have shown remarkable results, recently impressive results have been attained with discrete (Gu et al., 2021) and continuous (Nichol et al., 2021; Saharia et al., 2022; Ramesh et al., 2022; Rombach et al., 2022) diffusion models. Most recent works trained diffusion models conditioned on text embeddings extracted using a pre-trained text encoder (Saharia et al., 2022; Yu et al., 2022) or image embedding extracted using CLIP (Ramesh et al., 2022). While producing impressive results, all previous works described above are supervised and trained with paired text-image datasets. Several works have proposed training text-to-image models without an explicit text-image dataset. FuseDream (Liu et al., 2021) proposed a direct optimization to a pre-trained generative model based on CLIP loss. This method relies on a pre-trained GAN and requires a time-consuming optimization process for each image. LAFITE (Zhou et al., 2021) recently demonstrated text-to-image generation results without requiring paired text-image datasets. Here, the CLIP embeddings are used interchangeably at train and test to condition a GAN-based model. The joint text-image embedding enables inference given a text input, whereas in training the model is fed with the visual embedding only. However, the gap between the text and image distributions in the joint embeddings space leads to results with substantially lower quality, as we show in our experiments. To overcome this gap, LAFITE added noise to the image embeddings during training. Our remedy to this gap is to condition the model on the retrieval of an actual image embeddings, using a text-image joint space.
+
+
+Figure 2: Qualitative comparisons with baselines. Nearest Neighbor is the first kNN of the text in PMD dataset.
+
+Retrieval for generation. The Information Retrieval (IR) literature tackles the challenge of retrieving a small amount of information from a large database, given a user’s query. A simple, yet efficient retrieval mechanism is to retrieve the $K$ nearest neighbors (kNN) between the query and the entities in the database in some pre-calculated embedding space (Bijalwan et al., 2014). The database allows the model to leverage extensive world-knowledge for its specific task Borgeaud et al. (2021). Recently, language models were augmented with a memory component, allowing them to store representations of past inputs (Wu et al., 2022). The latter were then queried using a lookup operation, improving performance in various benchmarks and tasks. Retrieval models have been used for various tasks in learning problems, for example, language modeling (Borgeaud et al., 2021), machine translation (Gu et al., 2018), question answering (Lee et al., 2019) and image generation (Tseng et al., 2020; Qi et al., 2018). RetrieveGAN (Tseng et al., 2020) uses a differentiable retrieval module for image generation from a scene description, RetrievalFuse (Siddiqui et al., 2021) proposed a neural 3D scene reconstruction based on a retrieval system. SIMS (Qi et al., 2018) proposed generating an image using semantic layout and compatible image segments that are retrieved from image segments database, and (Iskakov, 2018) showed that the use of retrieval database in inpainting task significantly boosts visual quality. In this work we utilize the kNN retrieval mechanism over the shared text-image embedding space, CLIP (Radford et al., 2021). Using extensive ablation studies, we show the importance of the retrieval model both for training and inference, and demonstrate its large impact on performance. kNN-Diffusion significantly outperforms prior work with zero-shot FID of 12.5, including RDM (Blattmann et al., 2022)(with FID of 22.1), a concurrent work which similarly to our approach, proposes conditioning LDM (Rombach et al., 2022) on kNN.
+
+
+Figure 3: The overall framework of our kNN-Diffusion model. In both training and inference, the decoder is conditioned on CLIP embedding, and kNN image embeddings. During training, we condition the model on image CLIP embedding, and its kNN image embeddings extracted using the retrieval method. At inference time, given an input text, the kNN image embeddings are retrieved based on the CLIP text embedding that shares a joint embedding space with the image embedding.
+
+Multi-modal feature learning. Learning a joint and aligned feature space for several modalities is challenging, as it requires alignment between the modalities (paired datasets), whose distributions may vary. Specifically, the joint feature space of vision-and-language has been a long-standing problem. CLIP (Radford et al., 2021) successfully tackled this by leveraging contrastive learning over a large dataset of text-image pairs. BLIP (Li et al., 2022), (Mu et al., 2021) and FLAVA (Singh et al., 2021), followed this idea and further improved the joint representation. The joint representation was shown to hold a strong semantic alignment between the two modalities, enabling image generation (Liu et al., 2021; Wang et al., 2022), image manipulation (Patashnik et al., 2021; Avrahami et al., 2022b), and image captioning (Mokady et al., 2021). In this work we leverage the joint representation in two ways: (i) enabling textless training with only visual data, while using text at inference time, and (ii) creating an efficient embedding space for the use of the retrieval model.
+
+# 3 METHOD
+
+Our main goal is to facilitate language-guided generation of user-specified concepts while using an images-only dataset during training. A possible way to achieve this goal is to use a shared textimage encoder that will map text-image pairs into the same latent space, thus allowing training with an image embedding, and inferring from text embedding. A candidate for this encoder is CLIP, which has been trained with a contrastive loss on a large-scale dataset of text-image pairs. However, as we show quantitatively in Tab. 1, 2 and qualitatively in Fig. 15, 16, 5, CLIP embeddings alone cannot accurately bridge the gap between the text and image distributions. In order to reduce this gap, several methods have been proposed. The closest work to ours is LAFITE, which perturbs the CLIP image embedding with adaptive Gaussian noise. Under the assumption that there is a large paired text-image dataset, Ramesh et al. (2022) have proposed a prior that is used during inference, and is trained to generate possible CLIP image embeddings from a given text caption. In this regard, we propose using a large-scale and non-trainable image embedding index as an integral part of the diffusion process. Our method, kNN-Diffusion, assumes that only image data and a pre-trained multi-modal text-image encoder are provided during training. As shown in Fig. 3, our model is comprised of three main components: (1) A multi-modal text-image encoder (CLIP); (2) A retrieval model - A data structure containing image embeddings, which is indexed for a fast kNN search; (3) An image generation network - A trainable diffusion-based image generation model, conditioned on the projected retrievals. For both training and inference, the image generation network is conditioned on $K$ additional image embeddings, chosen using the retrieval model to ensure a similar distribution of the condition in training and inference. The following sections describe these components.
+
+Retrieval model. Our retrieval model has three non-trainable modules: a pre-trained text encoder $f _ { t x t }$ (CLIP text encoder), a pre-trained image encoder $f _ { i m g }$ (CLIP image encoder) and an index $\mathcal { H }$ . The encoders map text descriptions and image samples to a joint multi-modal $d$ - dimensional feature space $\mathbb { R } ^ { d }$ . The index stores an efficient representation of the images database $\mathcal { H } : = \{ f _ { i m g } ( i ) \in \mathbf { \hat { \mathbb { R } } } ^ { d } | i \in \mathcal { I } \}$ where $\mathcal { T }$ denotes the dataset of images. During training, we use the index to efficiently extract the $k$ nearest neighbors in the feature space of the image embedding $\begin{array} { r } { f _ { i m g } ( \mathrm { I } ) \in \mathbb { R } ^ { d } \cdot \mathrm { k n n } _ { i m g } ( \mathrm { I } , k ) : = \arg \operatorname* { m i n } _ { h \in \mathcal { H } } ^ { k } \mathbf { s } ( f _ { i m g } ( \mathrm { I } ) , h ) } \end{array}$ where s is a distance function and arg $\operatorname* { m i n } ^ { k }$ output the minimal $k$ elements. The set $\{ f _ { i m g } ( \mathrm { I } ) , \mathrm { k n n } _ { i m g } ( \mathrm { I } , k ) \}$ is used as the condition to the generative model. During inference, given a query text $t$ , an embedding $f _ { t x t } ( t )$ is extracted. The generative model is conditioned on this embedding and its $k$ nearest neighbors from the database - $\begin{array} { r } { \mathbf { k n n } _ { t x t } ( t , k ) : = \arg \operatorname* { m i n } _ { h \in \mathcal { H } } ^ { k } \mathbf { s } ( f _ { t x t } ( t ) , h ) } \end{array}$ . During training, we add embeddings of real images, by applying the retrieval method to the input image embedding. The extracted kNN should have a large enough distribution to cover the potential text embedding. During inference, the kNN are retrieved using the text embedding (See Fig. 17). In all of our experiments we use the cosine similarity metric as the distance function s, $k = 1 0$ for the number of nearest neighbors and $d = 5 1 2$ . The full implementation details can be found in Sec. 6.6 in the supplement.
+
+
+Figure 4: Results for text-guided image manipulations without using masks. The original image is shown in the left column, our manipulated images are shown in the center. The images of Bar-Tal et al. (2022); Gal et al. (2022) were generated using the authors’ official code. The full comparison is available in the supplement.
+
+Image generation network. In order to demonstrate the robustness of our method, we apply our kNN approach on two different diffusion backbones: Discrete (Gu et al., 2021) and Continuous (Nichol et al., 2021; Sohl-Dickstein et al., 2015; Ho et al., 2020; Dhariwal & Nichol, 2021). Although very different in practice, these models share the same theoretical idea. Let $x _ { 0 } \sim q ( x _ { 0 } )$ be a sample from our images distribution. A forward diffusion process is a Markov chain that adds noise at each step $q ( x _ { n } | x _ { n - 1 } )$ . The reverse process, $p _ { \theta } ( x _ { n - 1 } | x _ { n } , x _ { 0 } )$ , is a denoising process that removes noise from an initialized noise state. At inference time, the model can generate an output, starting with noise and gradually removing it using $p _ { \theta }$ . For additional background on diffusion models please refer to Sec. 6.1 in the supplement.
+
+In the discrete diffusion model, $\bar { q } ( x _ { n } | x _ { n - 1 } ) : = v ^ { T } ( x _ { n } ) \mathbf { Q } _ { n } v ( x _ { n - 1 } )$ where $v ( x _ { n } )$ is a one-hot vector with entry 1 at $x _ { n }$ , and $\mathbf { Q } _ { n }$ is a transition matrix, modeling the probability to move from state $x _ { n - 1 }$ to $x _ { n }$ , using uniform probability over the vocabulary and a pre-defined probability for additional special $I M A S K J$ token. We can compute the reverse transition distribution according to: $\begin{array} { r } { p _ { \theta } ( x _ { n - 1 } | x _ { n } , y ) : = \sum _ { \hat { x } _ { 0 } = 1 } ^ { k } q ( x _ { n - 1 } | x _ { n } , \hat { x _ { 0 } } ) p _ { \theta } ( \hat { x _ { 0 } } | x _ { n } , x _ { 0 } , y ) } \end{array}$ where $x _ { 0 }$ is a discrete vector, tokenized by the VQGAN (Esser et al., 2021) encoder and $y$ is the conditioning signal. For modeling $p _ { \theta }$ we have followed (Gu et al., 2021) and used a conditional Transformer (Vaswani et al., 2017).
+
+In the continuous diffusion model, $\begin{array} { r c l } { q ( x _ { n } | x _ { n - 1 } ) } & { : = } & { \mathcal { N } ( x _ { n } ; \sqrt { \alpha _ { t } } x _ { n - 1 } , ( 1 ~ - ~ \alpha _ { n } ) x _ { 0 } ) } \end{array}$ and $p _ { \theta } ( x _ { n - 1 } | x _ { n } , \mathbf { \theta } ) : = \mathcal { N } ( \mu _ { \theta } ( x _ { n } , \mathbf { \theta } ) , \Sigma _ { \theta } ( x _ { n } , \mathbf { \theta } ) )$ . Here, the noise function is Gaussian noise. Following (Ho et al., 2020; Nichol et al., 2021) we trained a model $\epsilon _ { \theta }$ to predict the added noise using a standard mean-squared error loss: $L : = E _ { n \sim [ 1 , N ] , x _ { 0 } \sim q ( x _ { 0 } ) , \epsilon \sim { \mathcal { N } } ( 0 , \mathbf { I } ) } [ | | \epsilon - \epsilon _ { \theta } ( x _ { n } , n , y | | ^ { 2 } ]$ where $\epsilon _ { \theta }$ is a U-net model and $y$ is the conditioning signal.
+
+
+Figure 5: tSNE visualization of 500 random text-image CLIP embeddings pairs taken from COCO validation. The leftmost figure demonstrates the gap between the text and image distributions. By gradually adding kNN to the mean CLIP embedding of the text, the gap decreases, demonstrating the importance of the kNN.
+
+
+Figure 6: FID on MS-COCO, including models trained on image-only datasets and text-image datasets.
+
+Table 1: Results for zero-shot Text-to-Image generation on the MS-COCO, CUB and LN-COCO test sets. Imagequality and Text-alignment report the percentage of majority human raters votes in favor of our method when comparing between a certain model and ours.
+
+
Model
MS-COCOIm.TxtFID↓qual. align.
CUBFID↓Im.Txtqual. align.
LN-COCOFID↓Im.Txtqual. align.
LAFITEFuseDream
26.972.1 65.3
89.7 74.059.6
42.8 68.4 61.937.5 71.1 59.065.061.4 59.835.6 - 1
Fuse
21.2
21.2 64.0 79.3
50.279.1
50.279.160.9
no-kNNOurs
32.8 70.8 68.312.5 - -
0.868.3
95.1
+
+In both cases, we condition our model on $y = ( f _ { i m g } ( x _ { 0 } ) , \mathrm { k n n } _ { i m g } ( x _ { 0 } , k ) )$ where $f _ { i m g } ( x _ { 0 } )$ is the CLIP image embedding, $\mathrm { k m } \mathrm { n } _ { i m g } ( x _ { 0 } , k )$ is the $k$ nearest neighbors in the feature space of the image embedding. Following (Ramesh et al., 2022; Rombach et al., 2022) conditional injection, we condition our model on the image CLIP embedding, and the $\mathbf { k N N }$ clip embeddings by applying cross attention in the attention layers of the architecture. We sample both our models using Classifier Free Guidance (CFG) (Nichol et al., 2021; Ho & Salimans, 2021). Since CFG was originally proposed for continuous models, we propose a method for using it with discrete models as well. Full implementation details of the discrete and continuous models can be found in Sec. 6.7 and Sec. 6.8, respectively, in the supplement.
+
+# 3.1 TEXT-ONLY IMAGE MANIPULATION
+
+The majority of previous works in the task of image manipulation either rely on user-provided masks (Nichol et al., 2021; Avrahami et al., 2022b;a), or are limited to global editing (Crowson et al., 2022; Kim et al., 2022). Recently, several works (Bar-Tal et al., 2022; Hertz et al., 2022; Gal et al., 2022) have made progress with local manipulations without relying on user edited masks. Nevertheless, most of the techniques suffer from several shortcomings: (1) They enable local texture changes, yet cannot modify complex structures, (2) they struggle to preserve the identity of the object, for example, when manipulating humans, (3) they require optimization for each input.
+
+We address these issues by extending kNN-Diffusion to perform local and semantic-aware image manipulations without any provided mask. Illustration of the approach is provided in Fig. 18 and Fig. 19 in the supplement. For this task, the model is trained to predict the original image from a manipulated version. Specifically, we create a manipulated version of the image, which differs from the original image only in some local area. Given a random local area $M$ in the image I, the manipulated image $\mathrm { I } _ { m a n i p }$ is constructed by replacing the area with the corresponding nearest neighbor: $\mathrm { I } _ { m a n i p } = \mathrm { I } \cdot ( 1 - \mathrm { \ ' } M ) + \boldsymbol { \mathrm { n n } } _ { i m g } ( \mathrm { \mathbf { I } } , 1 ) \cdot \boldsymbol { M }$ , where $\mathbf { n n } _ { i m g } ( \mathbf { I } , 1 )$ is the the nearest neighbor obtained after aligning it with I using the ECC alignment algorithm (Evangelidis & Psarakis, 2008). The model then receives as input the manipulated image, together with the CLIP embedding of the original image only in the local area: $f _ { i m g } ( \mathbf { I } \cdot M )$ . This CLIP embedding represents the required modification that should be applied to the manipulated image in order to predict the original image. During inference, instead of using the CLIP embedding of the local area, the desired modification is represented using the CLIP embedding of the user text query. We modified the model to be capable of receiving as a condition both the manipulated image and the CLIP embedding of the local area.
+
+Table 2: Results on the stickers dataset. We report the percentage of human raters prefer our method over the baselines with respect to image quality and text alignment. Discrete no-kNN refers to VQ-diffusion, and Continuous no-kNN, to DALL·E2 decoder, both trained without an explicit text-image dataset.
+
+
Ours Discrete
Ours Continuous
Model
FID↓
Image quality
Text alignment
Image quality
Text alignment
DALL·E2+ClipCap
55.5
71.6
69.2
67.0
68.3
LAFITE
58.7
63.5
59.9
76.0
71.2
no-kNN
52.7
72.1
67.6
66.8
69.4
Ours
40.8
1
1
-
1
+
+# 4 EXPERIMENTS
+
+First, we conduct qualitative and quantitative comparisons on MS-COCO, LN-COCO and CUB datasets. To further demonstrate the advantage of our method, we provide comparison on an imageonly stickers dataset, where we apply our approach on two diffusion backbones. Next, we demonstrate image manipulation and out-of-distribution capabilities. Finally, to better assess the effect of each contribution, an ablation study is provided.
+
+Datasets and Metrics. For photo-realistic experiments, our model was trained only on the images (omitting the text) of a modified version of the Public Multimodal Dataset (PMD) used by FLAVA (Singh et al., 2021). More information about the dataset is available in Sec. 6.4 of the supplement. To further demonstrate the capabilities of our method, we collected 400 million sticker images from the web, containing combinations of concepts such as objects, characters/avatars and text. The collected stickers do not have paired text, and are substantially different from photorealistic data. Furthermore, since they have no paired text, they were not part of CLIP’s training data, which makes the text-to-image generation task more challenging.
+
+Evaluation metrics are based on objective and subjective metrics: (i) FID (Heusel et al., 2017) is an objective metric used to assess the quality of synthesized images, (ii) human evaluation - we ask human raters for their preference, comparing two methods based on image quality and text alignment. We used 600 image pairs; five raters rated each pair. The results are shown as a percentage of majority votes in favor of our method over the baselines. We report the full human evaluation protocol in the supplement. We chose to omit Inception-Score, since it is shown by Barratt & Sharma (2018) to be a misleading metric for models that were not trained on Imagenet.
+
+# 4.1 QUALITATIVE AND QUANTITATIVE RESULTS
+
+We begin by comparing our model, trained on the PMD dataset, with the previous works LAFITE and FuseDream, that trained on image-only datasets. To demonstrate the advantage of using a retrieval method in text-to-image generation, we trained a model variant, no-kNN . This baseline was trained solely on image embeddings (omitting the kNN), while during inference, the images were generated using the text embedding. Tab. 1 displays zero-shot results on three different datasets: MS-COCO, CUB and LN-COCO. We follow the evaluation protocol of LAFITE, reporting our results on 30,000 images from MS-COCO validation set without training, nor using it’s training partition in the kNN index. Similarly, we follow LAFITE for CUB and LN-COCO evaluation. As can be seen, our model achieves the lowest FID score in all scenarios. In addition, human evaluations rate our method as better aligned to text and with the highest images quality. In Fig. 2, 15 and 11 we present a qualitative comparison between the methods. One can observe that while the simple retrieval baseline outputs non-generated images with high-quality, the images generated by our method are more faithful to the input text. To further demonstrate the effectiveness of our method, we present in Fig. 6 a comparison of our model with the latest text-to-image models trained on paired text-image datasets: DALL·E, CogView, VQ-Diffusion, GLIDE, LDM, Make-A-Scene, DALL·E2, Parti and Imagen. As can be seen, our model achieves comparable results to recent models trained with full text-image pairs (e.g LDM, GLIDE), despite being trained on an imageonly dataset, with significantly lower computational costs. The results demonstrate that leveraging an external retrieval database allows to compensate for different trade-offs, in particular, reducing the number of parameters in the model. Additional samples are provided in Fig. 13 in the supplement.
+
+
+Figure 7: Comparison between various indexes used by the same model. (1) Aesthetic. Images from the first quantile of an aesthetic classifier, (2) Unaesthetic. Images from the last quantile of an aesthetic classifier, (3) Image search engine. Images retrieved from Google Images, (4) The stickers index.
+
+Text-to-sticker generation. As the sticker dataset does not have paired text, and is substantially different from photo-realistic data, it allows us to illustrate the advantage of our model on an imageonly dataset. A selection of stickers generated by our model is presented in Fig. 1 and Fig. 14, 12. To demonstrate the importance of using kNN on image-only datasets, we evaluate our approach on two diffusion backbones. To this end, we trained a continuous diffusion model (Ramesh et al., 2022) and a discrete diffusion model (Gu et al., 2021), both conditioned on the kNN image embeddings. For each backbone, we compare our method with the following baselines: (1) no-kNN - this baseline was trained using both the continuous and the discrete methods conditioned only on image CLIP embedding, without using kNN. In the discrete case, we trained a VQ-diffusion model, while in the continuous case, we trained a re-implementation of DALL·E2’s decoder (without prior). (2) $D A L L { \cdot } E 2 { + } C l i p C a p$ baseline - here, we first captioned the entire sticker dataset using ClipCap (Mokady et al., 2021), then trained DALL·E2 decoder on the captioned dataset. (3) LAFITE - we trained LAFITE language-free model on our stickers dataset using the authors’ published code. We present the results in Tab. 2. The FID is calculated over a subset of 3, 000 stickers, generated from the ClipCap captioned dataset. As can be seen, our model achieves the lowest FID score. In addition, it outperforms all baselines in human evaluation comparison, using continuous and discrete backbones. In particular, compared with the same model trained without kNN, our model achieves significantly higher favorability in both text alignment and image quality.
+
+# 4.2 APPLICATIONS
+
+Text-only image manipulation. We demonstrate the manipulation capabilities of our model in Fig. 1, 4 and 20. Furthermore, we qualitatively compare our model with Text2LIVE (Bar-Tal et al., 2022) and Textual Inversion (Gal et al., 2022), using the authors’ published code. Text2LIVE proposed generating an edit layer that is composed over the original input, using a generator trained for each training image. Textual Inversion utilized the pre-trained Latent Diffusion model to invert the input image into a token embedding. The embedding is then used to compose novel textual queries for the generative model. Fig. 4 shows representative results, and the rest are included in Fig. 21 and 22 in the supplement. In contrast to our model, baseline methods lack text correspondence or they do not preserve the identity of the object. Since Text2LIVE is optimized to perform local changes, it has the difficulty changing the structure of the object (e.g. the "raising his hand" example in Fig. 4). Textual Inversion baseline changes the identity of the object because it struggles reconstructing the textual representation of the source image. Our model, on the other hand, can perform challenging manipulations that are aligned with the text, while preserving the object identity.
+
+
+Figure 8: Mean aesthetics score of the generated images as a function of the conditioned kNN mean aesthetics score.
+
+
+Figure 9: MS-COCO test FID score on various K’s in: (1) Zero-Shot (2) Index includes MS-COCO train subset. No kNN trained with kNN, but did not employ kNN in inference.
+
+
+Figure 10: MS-COCO test FID score for different model sizes. As can be seen, adding kNN to the model allows it to be smaller, while having better performance.
+
+Out-of-distribution generation. Using the retrieval index as part of the generation process enables using different databases during inference, without fine-tuning. This allows generatig images from distributions that were not part of the training set, enabling out-of-distribution generation. This novel capability is demonstrated with the same model trained on PMD, using three different retrieval databases: $( i ) A$ stickers database presented in Sec. 4. (ii) Aesthetic database: This database is constructed by filtering images according to a classifier score. Let $C$ be a classifier that for each image $i \in I$ outputs a score $s = C ( i )$ . This classifier enables filtering the kNN using $L \leq s < H$ , where $L$ and $H$ are low and high thresholds, respectively. Here, we use an open source pre-trained aesthetics classifier $A$ (Christoph Schuhmann, 2022): For each text input $t \in T$ , we apply $A$ on the kNN, and then divide the kNN into five equal quantiles based on $A$ score. As can be seen in Fig. 8, using kNN with higher aesthetics score result in generated images with higher aesthetics mean score. (iii) Image search engine: Generative models are stationary in the sense that they are unable to learn new concepts after being trained, hence fine-tuning is required to represent new styles and concepts. Here, we use an online image search engine, which allows the model to adapt to new data without additional fine-tuning. A qualitative comparison of all three methods is shown in Fig.7.
+
+# 4.3 ABLATION STUDY
+
+We conclude our experiments with an ablation study, to quantify the contribution of our different components. We provide ablation study on index size and different kNN conditioning approaches in Sec. 6.5 of the supplement. Number of nearest neighbors. The results in Fig. 9 demonstrate the importance of applying the retrieval mechanism during training and inference. Here, we evaluate our model, trained on PMD dataset, with different numbers of kNN during inference. Furthermore, we examined the baseline no-kNN, in which during inference, the model is conditioned only on the text embedding $f _ { t x t } ( t )$ , without using kNN. Best performance is achieved using 10 neighbors. Scalability analysis. To evaluate the effectiveness of our approach at different model sizes, we trained three additional models with varying sizes for both settings - with and without kNN. As can be seen in Fig. 10, utilizing kNN consistently improves performance for all sizes. Furthermore, a performance improvement can be achieved using much smaller models with kNN. For example, the $3 5 M$ kNN model outperforms the $4 0 0 M$ model without kNN.
+
+# 5 CONCLUSION
+
+“We shall always find, that every idea which we examine is copied from a similar impression", Hume (1748). In this paper, we propose using a large-scale retrieval method in order to train a novel textto-image model, with only pre-trained multi-modal embeddings, but without an explicit text-image dataset. Our extensive experiments demonstrate that using an external knowledge-base alleviates much of the model’s burden of learning novel concepts, enabling the use of a relatively small model. In addition, it provides the model the capability of learning to adapt to new samples, which it only observes during test time. Lastly, we present a new technique utilizing the retrieval method for textdriven semantic manipulations without user-provided masks. As evaluated by human studies and automatic metrics, our method is significantly preferable to the baselines in terms of image quality and text alignment.
+
+# REFERENCES
+
+Omri Avrahami, Ohad Fried, and Dani Lischinski. Blended latent diffusion. arXiv preprint arXiv:2206.02779, 2022a.
+
+Omri Avrahami, Dani Lischinski, and Ohad Fried. Blended diffusion for text-driven editing of natural images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18208–18218, 2022b.
+
+Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
+
+Artem Babenko and Victor Lempitsky. The inverted multi-index. IEEE transactions on pattern analysis and machine intelligence, 37(6):1247–1260, 2014.
+
+Omer Bar-Tal, Dolev Ofri-Amar, Rafail Fridman, Yoni Kasten, and Tali Dekel. Text2live: Textdriven layered image and video editing. arXiv preprint arXiv:2204.02491, 2022.
+
+Shane Barratt and Rishi Sharma. A note on the inception score. arXiv preprint arXiv:1801.01973, 2018.
+
+Vishwanath Bijalwan, Vinay Kumar, Pinki Kumari, and Jordan Pascual. Knn based machine learning approach for text and document mining. International Journal of Database Theory and Application, 7(1):61–70, 2014.
+
+Andreas Blattmann, Robin Rombach, Kaan Oktay, Jonas Müller, and Björn Ommer. Semiparametric neural image synthesis. In Advances in Neural Information Processing Systems, 2022.
+
+Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George van den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, et al. Improving language models by retrieving from trillions of tokens. arXiv preprint arXiv:2112.04426, 2021.
+
+Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual 12M: Pushing webscale image-text pre-training to recognize long-tail visual concepts. In CVPR, 2021.
+
+Romain Beaumont Christoph Schuhmann. Aesthetic predictor. https://github.com/ LAION-AI/aesthetic-predictor, 2022.
+
+Katherine Crowson, Stella Biderman, Daniel Kornis, Dashiell Stander, Eric Hallahan, Louis Castricato, and Edward Raff. Vqgan-clip: Open domain image generation and editing with natural language guidance. arXiv preprint arXiv:2204.08583, 2022.
+
+Karan Desai, Gaurav Kaul, Zubin Aysola, and Justin Johnson. RedCaps: Web-curated image-text data created by the people, for the people. In NeurIPS Datasets and Benchmarks, 2021.
+
+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.
+
+Prafulla Dhariwal and Alex Nichol. Diffusion models beat gans on image synthesis. arXiv preprint arXiv:2105.05233, 2021.
+
+Ming Ding, Zhuoyi Yang, Wenyi Hong, Wendi Zheng, Chang Zhou, Da Yin, Junyang Lin, Xu Zou, Zhou Shao, Hongxia Yang, et al. Cogview: Mastering text-to-image generation via transformers. Advances in Neural Information Processing Systems, 34, 2021.
+
+Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12873–12883, 2021.
+
+Georgios D Evangelidis and Emmanouil Z Psarakis. Parametric image alignment using enhanced correlation coefficient maximization. IEEE transactions on pattern analysis and machine intelligence, 30(10):1858–1865, 2008.
+
+Oran Gafni, Adam Polyak, Oron Ashual, Shelly Sheynin, Devi Parikh, and Yaniv Taigman. Make-a-scene: Scene-based text-to-image generation with human priors. arXiv preprint arXiv:2203.13131, 2022.
+
+Rinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H Bermano, Gal Chechik, and Daniel Cohen-Or. An image is worth one word: Personalizing text-to-image generation using textual inversion. arXiv preprint arXiv:2208.01618, 2022.
+
+Tiezheng Ge, Kaiming He, Qifa Ke, and Jian Sun. Optimized product quantization for approximate nearest neighbor search. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2013.
+
+Jiatao Gu, Yong Wang, Kyunghyun Cho, and Victor OK Li. Search engine guided neural machine translation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
+
+Shuyang Gu, Dong Chen, Jianmin Bao, Fang Wen, Bo Zhang, Dongdong Chen, Lu Yuan, and Baining Guo. Vector quantized diffusion model for text-to-image synthesis. ArXiv, abs/2111.14822, 2021.
+
+Amir Hertz, Ron Mokady, Jay Tenenbaum, Kfir Aberman, Yael Pritch, and Daniel Cohen-Or. Prompt-to-prompt image editing with cross attention control. arXiv preprint arXiv:2208.01626, 2022.
+
+Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. Advances in neural information processing systems, 30, 2017.
+
+Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. In NeurIPS 2021 Workshop on Deep Generative Models and Downstream Applications, 2021.
+
+Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. arXiv preprint arXiv:2006.11239, 2020.
+
+David Hume. An enquiry concerning human understanding, 1748.
+
+Karim Iskakov. Semi-parametric image inpainting. arXiv preprint arXiv:1807.02855, 2018.
+
+Herve Jegou, Matthijs Douze, and Cordelia Schmid. Product quantization for nearest neighbor search. IEEE transactions on pattern analysis and machine intelligence, 33(1):117–128, 2010.
+
+Jeff Johnson, Matthijs Douze, and Hervé Jégou. Billion-scale similarity search with GPUs. IEEE Transactions on Big Data, 7(3):535–547, 2019.
+
+Gwanghyun Kim, Taesung Kwon, and Jong Chul Ye. Diffusionclip: Text-guided diffusion models for robust image manipulation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2426–2435, 2022.
+
+Ivan Krasin, Tom Duerig, Neil Alldrin, Andreas Veit, Sami Abu-El-Haija, Serge Belongie, David Cai, Zheyun Feng, Vittorio Ferrari, and Victor Gomes. Openimages: A public dataset for largescale multi-label and multi-class image classification., 01 2016.
+
+Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, Michael Bernstein, and Li Fei-Fei. Visual genome: Connecting language and vision using crowdsourced dense image annotations. 2016. URL https://arxiv.org/abs/1602.07332.
+
+Kenton Lee, Ming-Wei Chang, and Kristina Toutanova. Latent retrieval for weakly supervised open domain question answering. arXiv preprint arXiv:1906.00300, 2019.
+
+Junnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping languageimage pre-training for unified vision-language understanding and generation. arXiv preprint arXiv:2201.12086, 2022.
+
+Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pp. 740–755. Springer, 2014.
+
+Xingchao Liu, Chengyue Gong, Lemeng Wu, Shujian Zhang, Hao Su, and Qiang Liu. Fusedream: Training-free text-to-image generation with improved clip $^ +$ gan space optimization. arXiv preprint arXiv:2112.01573, 2021.
+
+Ron Mokady, Amir Hertz, and Amit H Bermano. Clipcap: Clip prefix for image captioning. arXiv preprint arXiv:2111.09734, 2021.
+
+Norman Mu, Alexander Kirillov, David Wagner, and Saining Xie. Slip: Self-supervision meets language-image pre-training. arXiv preprint arXiv:2112.12750, 2021.
+
+Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741, 2021.
+
+Vicente Ordonez, Girish Kulkarni, and Tamara Berg. Im2text: Describing images using 1 million captioned photographs. In J. Shawe-Taylor, R. Zemel, P. Bartlett, F. Pereira, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems, volume 24. Curran Associates, Inc., 2011. URL https://proceedings.neurips.cc/paper/2011/file/ 5dd9db5e033da9c6fb5ba83c7a7ebea9-Paper.pdf.
+
+Or Patashnik, Zongze Wu, Eli Shechtman, Daniel Cohen-Or, and Dani Lischinski. Styleclip: Textdriven manipulation of stylegan imagery. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 2085–2094, 2021.
+
+Jordi Pont-Tuset, Jasper Uijlings, Soravit Changpinyo, Radu Soricut, and Vittorio Ferrari. Connecting vision and language with localized narratives. In European Conference on Computer Vision, pp. 647–664. Springer, 2020.
+
+Xiaojuan Qi, Qifeng Chen, Jiaya Jia, and Vladlen Koltun. Semi-parametric image synthesis. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8808– 8816, 2018.
+
+Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. CoRR, abs/2103.00020, 2021. URL https://arxiv.org/abs/2103.00020.
+
+Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In International Conference on Machine Learning, pp. 8821–8831. PMLR, 2021.
+
+Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
+
+Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. Highresolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10684–10695, 2022.
+
+Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S Sara Mahdavi, Rapha Gontijo Lopes, et al. Photorealistic text-to-image diffusion models with deep language understanding. arXiv preprint arXiv:2205.11487, 2022.
+
+Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2556–2565, 2018.
+
+Yawar Siddiqui, Justus Thies, Fangchang Ma, Qi Shan, Matthias Nießner, and Angela Dai. Retrievalfuse: Neural 3d scene reconstruction with a database. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 12568–12577, 2021.
+
+Amanpreet Singh, Ronghang Hu, Vedanuj Goswami, Guillaume Couairon, Wojciech Galuba, Marcus Rohrbach, and Douwe Kiela. Flava: A foundational language and vision alignment model. arXiv preprint arXiv:2112.04482, 2021.
+
+Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pp. 2256–2265. PMLR, 2015.
+
+Krishna Srinivasan, Karthik Raman, Jiecao Chen, Michael Bendersky, and Marc Najork. Wit: Wikipedia-based image text dataset for multimodal multilingual machine learning. In Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 2443–2449, 2021.
+
+Bart Thomee, David A. Shamma, Gerald Friedland, Benjamin Elizalde, Karl Ni, Douglas Poland, Damian Borth, and Li-Jia Li. The new data and new challenges in multimedia research. CoRR, abs/1503.01817, 2015. URL http://arxiv.org/abs/1503.01817.
+
+Hung-Yu Tseng, Hsin-Ying Lee, Lu Jiang, Ming-Hsuan Yang, and Weilong Yang. Retrievegan: Image synthesis via differentiable patch retrieval. In European Conference on Computer Vision, pp. 242–257. Springer, 2020.
+
+Aaron Van Den Oord, Oriol Vinyals, et al. Neural discrete representation learning. Advances in neural information processing systems, 30, 2017.
+
+Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017.
+
+Catherine Wah, Steve Branson, Peter Welinder, Pietro Perona, and Serge Belongie. The caltech-ucsd birds-200-2011 dataset. 2011.
+
+Xintao Wang, Liangbin Xie, Chao Dong, and Ying Shan. Real-esrgan: Training real-world blind super-resolution with pure synthetic data. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 1905–1914, 2021.
+
+Zihao Wang, Wei Liu, Qian He, Xinglong Wu, and Zili Yi. Clip-gen: Language-free training of a text-to-image generator with clip. arXiv preprint arXiv:2203.00386, 2022.
+
+Yuhuai Wu, Markus N Rabe, DeLesley Hutchins, and Christian Szegedy. Memorizing transformers. arXiv preprint arXiv:2203.08913, 2022.
+
+Tao Xu, Pengchuan Zhang, Qiuyuan Huang, Han Zhang, Zhe Gan, Xiaolei Huang, and Xiaodong He. Attngan: Fine-grained text to image generation with attentional generative adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1316–1324, 2018.
+
+Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, et al. Scaling autoregressive models for contentrich text-to-image generation. arXiv preprint arXiv:2206.10789, 2022.
+
+Han Zhang, Jing Yu Koh, Jason Baldridge, Honglak Lee, and Yinfei Yang. Cross-modal contrastive learning for text-to-image generation. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 833–842, 2021.
+
+Yufan Zhou, Ruiyi Zhang, Changyou Chen, Chunyuan Li, Chris Tensmeyer, Tong Yu, Jiuxiang Gu, Jinhui Xu, and Tong Sun. LAFITE: towards language-free training for text-to-image generation. CoRR, abs/2111.13792, 2021. URL https://arxiv.org/abs/2111.13792.
+
+Minfeng Zhu, Pingbo Pan, Wei Chen, and Yi Yang. Dm-gan: Dynamic memory generative adversarial networks for text-to-image synthesis. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 5802–5810, 2019.
+
+# 6 APPENDIX
+
+A neat and clean bathroom in blue and white
+
+
+Figure 11: Samples from COCO validation set.
+
+
+Figure 12: A selection of stickers generated using the continuous kNN-Diffusion model.
+
+
+Figure 13: Additional samples generated from challenging text inputs using the photo-realistic model
+
+
+Figure 14: A selection of stickers generated using the discrete kNN-Diffusion model.
+
+# 6.1 BACKGROUND
+
+Continuous diffusion process Diffusion models are latent variable models that aim to model a distribution $p _ { \theta } ( x _ { 0 } )$ that approximates the data distribution $q ( x _ { 0 } )$ . Specifically, they model a forward process in the space of $x _ { 0 }$ from data to noise. Given a sample from the data distribution $x _ { 0 } ~ \sim$ $q ( x _ { 0 } )$ , this process produces a Markov chain of latent variables $x _ { 1 } , \ldots , x _ { T }$ by progressively adding Gaussion noise to the sample:
+
+$$
+q ( x _ { t } | x _ { t - 1 } ) : = \mathcal { N } ( x _ { t } ; \sqrt { 1 - \beta _ { t } } x _ { t - 1 } , \beta _ { t } \mathbb { Z } )
+$$
+
+where $\beta _ { t }$ is a variance schedule. As presented previously by (Ho et al., 2020), the latent variable $x _ { t }$ can be expressed directly as a linear combination of noise and $x _ { 0 }$ :
+
+$$
+x _ { t } = \sqrt { \overline { { \alpha } } _ { t } } x _ { 0 } + \epsilon \sqrt { 1 - \overline { { \alpha } } _ { t } } , \quad \epsilon \sim \mathcal { N } ( 0 , \mathcal { T } )
+$$
+
+where $\alpha _ { t } : = \Pi _ { i = 1 } ^ { t } ( 1 - \beta _ { i } )$ . In order to sample from the data distribution $q ( x _ { 0 } )$ , we define the "reverse process" $p ( x _ { t - 1 } | x _ { t } )$ which samples first from $q ( x _ { T } )$ and then samples reverse steps $q \big ( x _ { t - 1 } | x _ { t } \big )$ until $x _ { 0 }$ .
+
+Since the data distribution is unknown, we need to train a model to approximate it. Note that when $T$ is large enough, the noise vector $x _ { T }$ nearly follows an isotropic Gaussian distribution. This suggests learning a model $p _ { \theta } ( x _ { t - 1 } | x _ { t } )$ to predict mean $\mu _ { \theta }$ and covariance matrix $\Sigma _ { \theta }$ :
+
+$$
+p _ { \theta } ( x _ { t - 1 } | x _ { t } ) : = \mathcal { N } ( x _ { t - 1 } ; \mu _ { \theta } ( x _ { t } , t ) , \Sigma _ { \theta } ( x _ { t } , t ) )
+$$
+
+To train this model, we can replace $\mu _ { \theta } ( x _ { t } , t )$ by predicting the noise $\epsilon _ { \theta } ( x _ { t } , t )$ added to $x _ { 0 }$ using equation 2 and we get this objective function:
+
+$$
+L : = E _ { t \sim [ 1 , T ] , x _ { 0 } \sim q ( x _ { 0 } ) , \epsilon \sim \mathcal { N } ( 0 , \mathbf { I } ) } [ | | \epsilon - \epsilon _ { \theta } ( x _ { t } , t , y | | ^ { 2 } ]
+$$
+
+where $y$ is an optional conditioning signal (such as text/image embedding or a low resolution ima
+
+Discrete diffusion process Let $x _ { n } \in \{ 1 , \ldots , V \} ^ { h \times w }$ be the indices of the allocated codebook vectors extracted by a pre-trained VQGAN (Esser et al., 2021) encoder. The forward process of a diffusion model $q ( x _ { n } | x _ { n - 1 } )$ is a Markov chain that adds noise at each step. Moreover, the reverse process $q ( x _ { n - 1 } | x _ { n } , x _ { 0 } )$ , is a denoising process that removes noise from an initialized noise state.As presented by (Gu et al., 2021), the forward diffusion process is given by:
+
+$$
+q ( x _ { n } | x _ { n - 1 } ) = v ^ { T } ( x _ { n } ) \mathbf { Q } _ { n } v ( x _ { n - 1 } )
+$$
+
+where $v ( x _ { n } )$ is a one-hot vector with entry 1 at $x _ { n }$ , and $\mathbf { Q } _ { n }$ is the probability transition matrix from state $x _ { n - 1 }$ to $x _ { n }$ .
+
+The reverse process is given by the posterior distribution:
+
+$$
+\begin{array} { r } { q ( x _ { n - 1 } | x _ { n } , x _ { 0 } ) = \frac { \left( v ^ { T } ( x _ { n } ) \mathbf { Q } _ { n } v ( x _ { n - 1 } ) \right) \left( v ^ { T } ( x _ { n - 1 } ) \bar { \mathbf { Q } } _ { n - 1 } v ( x _ { 0 } ) \right) } { v ^ { T } ( x _ { n } ) \bar { \mathbf { Q } } _ { n } v ( x _ { 0 } ) } } \end{array}
+$$
+
+where $\bar { \mathbf Q } _ { n } = \mathbf Q _ { n } \cdot \cdot \cdot \mathbf Q _ { 1 }$
+
+Inspired from mask language modeling (Devlin et al., 2018), they proposes corrupting the tokens by stochastically masking some of them. Specifically, an additional special token $[ \bar { M } A \bar { S } K ]$ is proposed, so for each token there are $( \mathsf { V } { + } 1 )$ discrete states. The transition matrix is formulated as, By adding a small amount of unifrom noise to the categorial distribution, the transition matrix can be formulated as,
+
+$$
+\mathbf { Q } _ { n } = \left[ \begin{array} { c c c c c } { \alpha _ { n } + \beta _ { n } } & { \beta _ { n } } & { \beta _ { n } } & { \cdots } & { 0 } \\ { \beta _ { n } } & { \alpha _ { n } + \beta _ { n } } & { \beta _ { n } } & { \cdots } & { 0 } \\ { \beta _ { n } } & { \beta _ { n } } & { \alpha _ { n } + \beta _ { n } } & { \cdots } & { 0 } \\ { \vdots } & { \vdots } & { \vdots } & { \ddots } & { \vdots } \\ { \gamma _ { n } } & { \gamma _ { n } } & { \gamma _ { n } } & { \cdots } & { 1 } \end{array} \right]
+$$
+
+where $\alpha _ { n } \in [ 0 , 1 ]$ , $\beta _ { n } = ( 1 - \alpha _ { n } - \gamma _ { n } ) / V$ and $\gamma _ { n }$ the probability of a token to be replaced with a $[ M A S K ]$ token. Each token has a probability of $\gamma _ { n }$ to be replaced by the $[ M A S K ]$ token, $V \beta _ { n }$ to be resampled uniformly and $\alpha _ { n } = ( 1 - V \beta _ { n } - \gamma _ { n } )$ to be unchanged.
+
+# 6.2 ADDITIONAL SAMPLES
+
+In Fig. 16 and 15 we present a visual comparison of our discrete model, trained on the stickers dataset with (1) the kNN extracted during inference, (2) the same model without using kNN in inference. As can be seen, the images generated by our model are better aligned to the corresponding text compared to the baselines. While the baselines fail with challenging prompts, our model produces high-quality images that align with the text, and composes multiple concepts correctly.
+
+COCO Validation Set Comparison Fig. 11 presents a qualitative comparison with FuseDream (Liu et al., 2021), CogView (Ding et al., 2021) and VQ-Diffusion (Gu et al., 2021) on the COCO validation set. Note that both CogView and VQ-Diffusion have been trained on an ImageText paired dataset, whereas our model was not trained on the COCO dataset, nor used it in the retrieval model.
+
+
+Figure 15: Comparison of our model, trained on PMD with (1) kNN extracted in inference, (2) the same model without using kNN in inference. While the kNN lack information regarding text semantics, our model considers both text semantics and the kNN, thus proving the advantage of using both the text and the kNN embeddings.
+
+
+Figure 16: Qualitative comparison of stickers generated using the discrete kNN-Diffusion model, 10 Nearest Neighbors to the text in the CLIP embedding and a discrete model that does not use kNN.
+
+# 6.3 HUMAN EVALUATION PROTOCOL
+
+For all of our human evaluation experiments, we used Amazon Mechanical Turk. For each experiment, we used 600 samples, each scored by five different people. The preferred sample was determined according to majority opinion. For each baseline comparison, we asked two questions (in different experiments): "Which image is of a higher quality?" and "Which image best matches the text?".
+
+# 6.4 DATASETS
+
+The modified PMD dataset is composed of the following set of publicly available text-image datasets: SBU Captions (Ordonez et al., 2011), Localized Narratives (Pont-Tuset et al., 2020), Conceptual Captions (Sharma et al., 2018), Visual Genome (Krishna et al., 2016), Wikipedia Image Text (Srinivasan et al., 2021), Conceptual Captions 12M (Changpinyo et al., 2021), Red Caps (Desai et al., 2021), and a filtered version of YFCC100M (Thomee et al., 2015). In total, the dataset contains 69 million text-image pairs.
+
+# 6.5 ABLATION STUDY
+
+Index size As one can expect, increasing the index size at inference time improves performance. To demonstrate this hypothesis, we evaluated our model with an index containing $10 \%$ , $30 \%$ , $50 \%$ and $70 \%$ images of PMD dataset, and obtained FID scores of 13.92, 13.85, 13.72, and 13.65 respectively.
+
+kNN conditioning We examined several different approaches to kNN input conditioning: (i) forwarding the kNN embeddings and the single image embedding through a self-attention layer before feeding the contextualized $K + 1$ embeddings to the model, (ii) feeding the model with one embedding, computed using cross-attention between the image embedding and the kNN embeddings, and, (iii) feeding the model with the image embedding concatenated with a learned linear projection of the kNN embeddings. These variants received FID scores of 18.3, 22.4, 34.1 respectively.
+
+# 6.6 RETRIEVAL MODEL
+
+The retrieval model is implemented using FAISS (Johnson et al., 2019). FAISS is an efficient database, capable of storing billions of elements and finding their nearest neighbors in milliseconds. In the pre-processing phase, for each image in the dataset, we store the image index and its corresponding CLIP image embedding. During training, given a training image, we extract its CLIP image embedding and search for its 10 (see Fig. 9) nearest neighbors in the dataset based on the cosine similarity distance.
+
+For an efficient search during training and inference, we use a non-exhaustive search: For this, we use an inverted file index. As in Babenko & Lempitsky (2014), we define Voronoi cells in the $d$ - dimensional space (where $d = 5 1 2$ is the CLIP embedding dimensional space), s.t each database vector falls in one of the cells. During search time, only the embeddings contained in the cell the query falls in and a few neighboring ones are compared against the query vector. In addition, to fit the index of our large-scale datasets on a 128GB RAM server, we compress the code size from $5 1 2 \times 3 2 / 8 = 2 0 4 8$ Bytes to 256 Bytes using optimized product quantization (Ge et al., 2013; Jegou et al., 2010). In Algorithm 1 we include pseudocode of the core of the implementation of the retrieval database.
+
+# 6.7 DISCRETE KNN MODEL
+
+We provide additional implementation details for the discrete diffusion model. Additional training details can be found in Tab. 3.
+
+Vector Quantization For token quantization, we use VQ-VAE and adapt the publicly available VQGAN(Esser et al., 2021) model, trained on the OpenImages(Krasin et al., 2016) dataset. The encoder downsamples images to $3 2 \times 3 2$ tokens and uses a codebook vocabulary with 2887 elements.
+
+Image Tokenization In our discrete generative model we model images as a sequence of discrete tokens. To this end, we utilize a vector-quantized variational auto-encoder (VQ-VAE) (Van Den Oord et al., 2017) as image tokenizer. VQ-VAE consists of three components: (i) an encoder, (ii) a learned codebook, and, (iii) a decoder. Given an image, the encoder extracts a latent representation. The codebook then maps each latent vector representation to its nearest vector in the codebook. Finally, the decoder reconstructs the image from the codebook representation. VQ-VAE is trained with the objectives of reconstruction and codebook learning. VQ-GAN (Esser et al., 2021) adds an adversarial loss term that tries to determine whether the generated image is fake or real. This added term was shown to improve reconstruction quality.
+
+Transformer We follow Gu et al. (2021) and train a decoder-only Transformer. The decoder module contains 24 transformer blocks, each containing full attention, cross-attention for the concatenated conditioner, and a feed-forward network. The timestamp $n$ is injected using Adaptive Layer Normalization (Ba et al., 2016). The decoder contains 400 million parameters.
+
+Classifier-free guidance We sample our diffusion models using classifier-free guidance (CFG) (Ho & Salimans, 2021; Nichol et al., 2021; Ramesh et al., 2022). CFG is performed by extrapolating an unconditional sample in the direction of a conditional sample. To support unconditional sampling, previous work had to fine-tune (Nichol et al., 2021) their models with $20 \%$ of the conditional features nullified. This enabled them to sample unconditional images from the model using the null condition, $y ^ { \prime } = \overrightarrow { 0 }$ , the null vector. We found that we can generate unconditional samples from our model using null conditioning without fine-tuning it. We hypothesize that by conditioning the model on a null vector, the cross-attention component is also nullified, resulting in no contribution to the diffusion process. During inference, in each step of the diffusion process we generate two images: conditional image logits, $p _ { \theta } ( x _ { n - 1 } | x _ { n } , y )$ , conditioned on the desired multi-modal embedding $y$ , and the unconditional image logits, $p _ { \theta } ( x _ { n - 1 } | x _ { n } , y ^ { \prime } )$ , conditioned on the null embedding. Then, the final image for a diffusion step $n$ is sampled from
+
+$$
+\begin{array} { r l } & { p _ { \theta } ( x _ { n - 1 } | x _ { n } , y ) = p _ { \theta } ( x _ { n - 1 } | x _ { n } , y ^ { \prime } ) + } \\ & { \qquad \lambda \big ( p _ { \theta } ( x _ { n - 1 } | x _ { n } , y ) - p _ { \theta } ( x _ { n - 1 } | x _ { n } , y ^ { \prime } ) \big ) } \end{array}
+$$
+
+where $\lambda$ is a scale coefficient. In all of our experiments, we set $\lambda = 8$ , which was found to yield the highest FID scores on the validation set. Note that the above extrapolation occurs directly on the logits output by $p _ { \theta }$ , in contrast to GLIDE (Nichol et al., 2021), which extrapolates the pixel values.
+
+Training Objective For completeness we are adding the training objective of the discrete model. The network is trained to minimize the variational lower bound (VLB):
+
+$$
+\begin{array} { r l } & { \mathcal { L } _ { \mathrm { v l b } } = \mathcal { L } _ { 0 } + \mathcal { L } _ { 1 } + \cdot \cdot \cdot + \mathcal { L } _ { N - 1 } + \mathcal { L } _ { N } , } \\ & { \quad \mathcal { L } _ { 0 } = - \log p _ { \theta } ( x _ { 0 } | x _ { 1 } , f _ { i m g } ( I ) , \mathrm { k n n } _ { i m g } ( \mathbf { I } , k ) ) , } \\ & { \mathcal { L } _ { n - 1 } = D _ { K L } ( q ( x _ { n - 1 } | x _ { n } , x _ { 0 } ) \mid \mid p _ { \theta } ( x _ { n - 1 } | x _ { n } , f _ { i m g } ( I ) , \mathrm { k n n } _ { i m g } ( \mathbf { I } , k ) ) ) , } \\ & { \quad \mathcal { L } _ { N } = D _ { K L } ( q ( x _ { N } | x _ { 0 } ) \mid \mid p ( x _ { N } ) ) } \end{array}
+$$
+
+Where $p ( { \pmb x } _ { N } )$ is the prior distribution of timestep $N = 1 0 0$ , $f _ { i m g } ( I )$ is the CLIP image embedding, $\mathrm { k n n } _ { i m g } ( \mathrm { I } , k )$ is the $k$ nearest neighbors in the feature space of the image embedding. The full details can be found in Gu et al. (2021).
+
+# 6.8 CONTINUOUS KNN MODEL
+
+We provide additional implementation details for the continuous diffusion model. Additional training details can be found in Tab. 3.
+
+Decoder. We followed (Nichol et al., 2021; Ho et al., 2020; Ramesh et al., 2022) and re-implemented a diffusion $U _ { ☉ }$ -net model. Specifically, we modify the architecture described in (Ramesh et al., 2022) by allowing multiple CLIP embeddings as the condition to the model. Since we do not have a paired text-image dataset, we removed the text transformer, and thus the text embedding. In particular, we use 512 convolution channels, 3 residual blocks, 64 heads channels and attention resolution of 32, 16 and 8. Similarly to our discrete model, we trained two models (1)
+
+
+Figure 17: During training, only the image I is given (red), whereas during inference only the text $t$ is given (blue). In order to bridge the gap between the two distributions during training, we leverage the K nearest neighbors that should have a large enough distribution (dashed cone) to cover the potential text embedding (i.e. $c o s ( b ) < c o s ( a ) )$ . During inference, the opposite is applied.
+
+a no-kNN conditioned only on CLIP image embedding during training, (2) a kNN conditioned on CLIP image embedding and its kNN. Finally, we enable classifier-free guidance by randomly setting the CLIP embeddings to zero $10 \%$ of the time. As demonstrated in Tab. 2, we find that humans prefer our model over $n o \mathrm { - } k N N 6 6 . 8 \%$ of the time for image quality and $6 9 . 4 \%$ of the time for text alignment.
+
+Super-Resolution. As the decoder generates images with $6 4 \times 6 4$ resolution, we up-sampled the images to $2 5 6 \times 2 5 6$ using the open-source super resolution of (Nichol et al., 2021). To further upsample the images to $5 1 2 \times 5 1 2$ and $1 0 2 4 \times 1 0 2 4$ we used the open-source super resolution provided by (Wang et al., 2021).
+
+Training Objectives For completeness we are addding the training objective of our continuous model. Following Ho et al. (2020); Nichol et al. (2021) we are using mean-squared error loss to predict the noise:
+
+$$
+L : = E _ { n \sim [ 1 , N ] , x _ { 0 } \sim q ( x _ { 0 } ) , \epsilon \sim \mathcal { N } ( 0 , \mathbf { I } ) } [ | | \epsilon - \epsilon _ { \theta } ( x _ { n } , n , y ) | | ^ { 2 } ]
+$$
+
+where $\epsilon _ { \theta }$ is a $U - n e t$ model and $\boldsymbol { y } = ( f _ { i m g } ( x _ { 0 } ) , \mathrm { k n n } _ { i m g } ( x _ { 0 } , k ) )$ .
+
+Table 3: Training details of our models
+
+
Discrete
Continuous
Number of nearest neighbors
10
10
Diffusion steps
100
1000
Noise schedule
=
cosine
Sampling steps
100
250
Model size
400M
1B
Sampling variance method
-
analytic
Dropout
=
0.1
Weight decay
4.5e-2
-
Batch size
512
1600
Iterations
150K
500K
Learning rate
4.05-4
1.4e-4
optimizer
AdamW
AdamW
Adam β2
0.96
0.9999
Adam ∈
1.0e-8
1.0e-8
EMA decay
0.99
0.9999
warmup
5000
25000
#GPUs
128 A100
200 A100
+
+Algorithm 1 Pseudo-code implementation for the construction of the retrieval model, training and sampling using conditioning kNN.
+
+
Retrieval model construction
def training(dataset: train image dataset)://inverted index of 50k centroids, 2//with optimized product quantization to 256B 3idx_cfg = "OPQ256_IVF50000_PQ256x8" 4index = faiss.index_factory(d,idx_cfg,faiss.METRIC_INNER_PRODUCT) 5
def sampling(I:FAISS index,text,k : Number of NN):text_encoding = CLIP_text_encoder(text) 2kNN = I.search(text_encoding,k) 3condition = concatenate([text_encoding,kNN]) 4image = sample_noise(T) 5for t in [T-1,T-2,...,0]: 6image = diffusion_model(image,t,condition) 7return image 8
+
+Our approach is illustrated in Fig. 18. Additional manipulation examples are provided in Figs. 20. The full comparison with the baselines is provided in Fig. 21 and 22. We also provide in Fig. 19 several examples for the process of the manipulated images construction.
+
+
+Figure 18: An illustration of our manipulation approach. During training: Given a training image (1), the model extracts its first nearest neighbor (2). Next, a random local area in the training image is selected (3), and the manipulated image is constructed by replacing the area with the corresponding nearest neighbor (4). The model then receives as input the manipulated image and the clip embedding of the local area that needs to be restored (5). During inference: Given an input image and a text query "A face of a male child", the model receives as input the image (4) and the clip embedding of the modifying text (5).
+
+
+Figure 19: Illustration of the manipulated image construction process during training. Given an original image, we select a random local area, and extract the first nearest neighbor (1-NN). Using ECC alignment, we align the nearest neighbor with the original image and replace the random local area with it’s corresponding nearest neighbor local area. The model then receives as input the manipulated image, together with the CLIP embedding of the local area, and tries to predict the original image.
+
+
+Figure 20: Additional manipulation examples, generated using our model.
+
+
+Figure 21: comparison to Text2LIVE (Bar-Tal et al., 2022). For each input image, the bottom row corresponds to images generated by our model, and the top row corresponds to images generated by the Text2LIVE model.
+
+
+Figure 22: comparison to Textual Inversion (Gal et al., 2022). For each input image, the bottom row corresponds to images generated by our model, and the top row corresponds to images generated by the Textual Inversion model.
\ No newline at end of file
diff --git a/md/dev/x6INXlnUGro/x6INXlnUGro.md b/md/dev/x6INXlnUGro/x6INXlnUGro.md
new file mode 100644
index 0000000000000000000000000000000000000000..e6b5c5557e0f7058a4163c7de4cdfbc9f81559fc
--- /dev/null
+++ b/md/dev/x6INXlnUGro/x6INXlnUGro.md
@@ -0,0 +1,237 @@
+# Learning Agile Skills via Adversarial Imitation of Rough Partial Demonstrations
+
+Chenhao $\mathbf { L i } ^ { 1 , 2 }$ , Marin Vlastelica1, Sebastian Blaes1, Jonas Frey2,1, Felix Grimminger1, Georg Martius1 1Max Planck Institute for Intelligent Systems, Germany 2 Robotic Systems Lab, ETH Zurich, Switzerland chenhao.li@tuebingen.mpg.de
+
+Abstract: Learning agile skills is one of the main challenges in robotics. To this end, reinforcement learning approaches have achieved impressive results. These methods require explicit task information in terms of a reward function or an expert that can be queried in simulation to provide a target control output, which limits their applicability. In this work, we propose a generative adversarial method for inferring reward functions from partial and potentially physically incompatible demonstrations for successful skill acquirement where reference or expert demonstrations are not easily accessible. Moreover, we show that by using a Wasserstein GAN formulation and transitions from demonstrations with rough and partial information as input, we are able to extract policies that are robust and capable of imitating demonstrated behaviors. Finally, the obtained skills such as a backflip are tested on an agile quadruped robot called Solo 8 and present faithful replication of hand-held human demonstrations.
+
+Keywords: Adversarial, Imitation Learning, Legged Robots
+
+
+Figure 1: Our method (WASABI) achieves agile physical behaviors from rough (hand-held) and partial (robot base) motions. The illustrated performance measure is the Dynamic Time Warping distance of the base trajectories (left). A learned backflip policy is deployed on Solo 8 (right).
+
+# 1 Introduction
+
+Obtaining dynamic skills for autonomous machines has been a cardinal challenge in robotics. In the field of legged systems, many attempts have been made to attain diverse skills using conventional inverse kinematics techniques [1, 2]. In recent years, learning-based quadrupedal locomotion has been achieved by reinforcement learning (RL) approaches to address more complex environments and improve performance [3, 4, 5, 6]. However, the demand for acquiring more highly dynamic motions has brought new challenges to robot learning. A primary shortage of motivating desired behaviors by reward engineering is the arduous reward-shaping process involved. It can sometimes become extremely demanding in developing highly dynamic skills such as jumping and backflipping, where various terms of motivation and regularization require elaborated refinement.
+
+Given the availability of some expert references, one possible solution is Imitation Learning (IL), which aims to mimic expert behaviors in a given task. In this framework, the agent is trained to perform a task from demonstrations by learning a mapping between observations and actions with either offline (e.g. behavioral cloning [7, 8]) or interactive (e.g. DAgger, SMILe [9]) methods. Generic IL methods could potentially reduce the problem of teaching a task to that of providing demonstrations, without the need for explicit programming or designing reward functions specific to the task [10]. Another related approach to replicating exerted motions of an expert is Inverse Reinforcement Learning (IRL). In IRL, the expert reward function is inferred given its policy or observed behaviors [11, 12, 13]. IRL is in general computationally expensive, and efforts are required to deal with ambiguous reward functions without making strong assumptions [14].
+
+More recently, Generative Adversarial Imitation Learning (GAIL) [15] draws a connection between IL and generative adversarial networks (GANs) [16], which train a generative model (generator) by having it deceive a discriminative classifier (discriminator). The task of the discriminator is to distinguish between data generated by the generator and the true data distribution. In the setting of GAIL, the true data distribution is the expert state-action distribution, while the learned policy is treated as the generator. The output of the discriminator can then be used as a reward that encourages the learning agent to generate similar behaviors to the demonstration. Analogously, the technique has been used for learning adversarial motion priors (AMP) [17], where the output of the discriminator is used as an additional style reward to the actual task reward, that is available beforehand. In a sense, AMP enables solving well-defined tasks in a specific style specified by a reference motion, without requiring access to underlying expert actions.
+
+In this work, we present a novel adversarial imitation learning method named Wasserstein Adversarial Behavior Imitation (WASABI). We show that we are able to extract sensible task rewards from rough and partial demonstrations by utilizing adversarial training for obtaining agile skills in a sim-to-real setting. In contrast to Peng et al. [17], our approach does not require any prior information about the task at hand in form of a specific reward function, but only reasonable task-agnostic regularization terms in addition to the adversarial reward that make the robot motion more stable. Most importantly, we achieve this without having access to samples from an expert policy, but rather hand-held human demonstrations that are physically incompatible with the robot itself. To the best of our knowledge, this is the first time that highly dynamic skills are obtained from limited reference information. In summary, our contributions include: (i) An adversarial approach for learning from partial, physically incompatible demonstrations. (ii) Analysis of the Least-Squares vs. Wasserstein GAN loss for reward inference. (iii) Experimental validation in simulation and on a quadruped robot. Supplementary videos for this work are available at https://sites.google.com/view/ corl2022-wasabi/home.
+
+# 2 Related Work
+
+Advances in robotics have spawned many potential applications that require intelligent systems to be able to not only make decisions but also to perform physical movements expectedly. However, in many cases, the desired behavior may not be discovered by a learning agent due to sub-optimal parameter settings or algorithmic limitations [18, 19]. While learning a task might be stated as an optimization problem, it has become widely accepted that having prior knowledge provided by an expert is more effective and efficient than attempting to solve the problem from scratch [20, 21].
+
+The idea of IL has been formed decades ago, raising solutions in conceptual and computational models to replicate motions from demonstrations [22, 23, 24]. It has been commonly acknowledged that IL entails three major approaches: model-based IL, learning a control policy directly, and learning from demonstrated trajectories. In the first approach, algorithms are applied to learn the parameters of the dynamics model to ensure that all executed motions closely follow the demonstration [25, 26, 27]. In the second approach, also known as behavioral cloning, the agent tries to reproduce the observed state-action pairs of the expert policy [7, 8]. Behavioral cloning often faces the problems of error compounding and poor generalization, which can lead to unstable policy output, particularly in out-of-distribution regions [28]. Alternatively, reference motions can be learned using an imitation goal, which is often implemented as a tracking objective that aims to reduce the pose error between the simulated character and target poses from a reference motion [29, 30, 31, 32]. A common strategy to estimate the pose error is to use a phase variable as an additional input to the controller to synchronize the agent with a specific reference motion [33, 32, 34]. This method typically works well for replicating single motion clips, but it may fail to scale to datasets with multiple reference motions which may not be synchronized and aligned according to a single-phase variable [17].
+
+Instead of employing a handcrafted imitation objective, adversarial IL techniques train an adversarial discriminator to distinguish between behaviors generated by an agent and demonstrations [14, 15]. While these methods have shown some promise for motion imitation tasks [35, 36], adversarial learning algorithms are notoriously unstable, and the resulting motion quality still lags well behind that of state-of-the-art tracking-based systems. Especially in the low-data regime, adversarial models can take a long time to converge [37, 17]. In some cases, adversarial IL techniques show limited robustness against different environment dynamics, as it fails to generalize to tasks where there is considerable variability in the environment from the demonstrations [38].
+
+With the ability to encompass multiple reference motions, AMP decouples task specification from style specification by combining GAIL with extra task objectives [17, 39]. The use of AMP reduces efforts in the selection of distance error metrics, phase indicators, and appropriate motion clips. This allows the learning agent to execute tasks that may not be portrayed in the original demonstrations. To enable active style control, Multi-AMP allows for the switching of multiple different style rewards by training multiple discriminators encoding different reference motions in parallel [40].
+
+# 3 Approach
+
+In this section, we describe our method, WASABI, which involves generative adversarial learning of an imitation reward from rough and partial demonstrations using a GAN framework.
+
+# 3.1 Learning Task Reward from Limited Demonstration Information
+
+We consider partial demonstrations that are given in terms of limited state observations, for instance only local velocities of the robot’s base. The demonstrations are formulated as sequences of $o _ { t } \in \mathcal { O }$ , where the full state space $s$ of the underlying Markov Decision Process can be mapped to the observation space $\mathcal { O }$ with a function $\Phi : S \mathcal { O }$ . We utilize generative adversarial learning for inferring the task reward function from such demonstrated transitions $( o , o ^ { \prime } )$ in a reference motion. As such, the discriminator in this setup is to distinguish samples of the policy transition distribution $d ^ { \pi }$ from the reference motion distribution $d ^ { \mathcal { M } }$ . The policy $\pi$ takes on the role of the generator.
+
+The original GAN min-max loss (CEGAN) formulation has shown to suffer from vanishing gradients due to saturation regions of the cross-entropy loss function which slows down training [41]. If the discriminator performs excessively well and thus becomes saturated, the policy will not be able to learn any information, since it receives a constant penalty for being far away from the demonstrations. For this reason, Peng et al. [17] propose to use the least-squares GAN (LSGAN) loss [42] in AMP as a substitute for reward function learning. The LSGAN loss is formulated as
+
+$$
+\underset { D } { \arg \operatorname* { m i n } } \mathbb { E } _ { d ^ { \mathcal { M } } } \left[ \left( D ( o , o ^ { \prime } ) - 1 \right) ^ { 2 } \right] + \mathbb { E } _ { d ^ { \pi } } \left[ \left( D ( \Phi ( s ) , \Phi ( s ^ { \prime } ) ) + 1 \right) ^ { 2 } \right] .
+$$
+
+The discriminator is defined as a mapping $D : { \mathcal { O } } \times { \mathcal { O } } \mapsto \mathbb { R }$ and can be used, together with $\Phi$ , as a drop-in replacement for the unknown reward function $r ( s , s ^ { \prime } )$ . Intuitively, the LSGAN loss forces the discriminator to output $+ 1$ for samples from the reference motion and $- 1$ for those from the policy. It not only prevents vanishing gradients but also provides a well-scaled output that eases downstream policy learning. However, when faced with demonstrations that initially seem beyond what the agent can achieve, the discriminator is prone to be driven to optimality, prohibiting a more fine-grained evaluation of the policy transitions with respect to their closeness to the reference motion. Moreover, the LSGAN discriminator output does not directly lead to a practical reward function by itself, since an increase in its value does not always represent close replications of demonstrated transitions. This is a consequence of the least-squares loss symmetricity around $- 1$ and $+ 1$ , therefore a suitable mapping is typically needed to transform the output into a well-behaved reward function. For this reason, we propose to use the Wasserstein loss
+
+$$
+\underset { { D } } { \arg \operatorname* { m i n } } - \mathbb { E } _ { d ^ { \mathcal { M } } } \left[ D ( o , o ^ { \prime } ) \right] + \mathbb { E } _ { d ^ { \pi } } \left[ D ( \Phi ( s ) , \Phi ( s ^ { \prime } ) ) \right] ,
+$$
+
+especially for highly dynamic motions where the discriminator is more likely to optimally distinguish between the reference and the generated motions. Under conditions of Lipschitz continuity, the Wasserstein loss is an efficient approximation to the earth mover’s distance which effectively measures the distance between two probability distributions [43]. In the original Wasserstein GAN (WGAN), Arjovsky et al. [44] enforce Lipschitz continuity by projected gradient descent, i.e. clipping the network weights. Similarly, we apply $L _ { 2 }$ regularization on the discriminator for the sake of simplicity. In addition, discriminator weight regularization also controls the scale of its output, which results in stable imitation rewards.
+
+# 3.2 Preventing Mode Collapse in Adversarial Reward Learning
+
+Mode collapse is a common problem in GAN training, which manifests itself by the generator being able to produce only a small set of outputs. In our framework, mode collapse is reflected by the policy trying to replicate only a subset of the reference motion which gives a high reward.
+
+The Wasserstein loss can alleviate mode collapse by allowing training of the discriminator to optimality while avoiding vanishing gradients [44]. In fact, if the discriminator does not get stuck in the local minimum, it learns to reject partial behaviors on which the policy stabilizes. As a result, the policy will have to attempt something different, if possible. In addition to the implementation of the Wasserstein loss, we extend the capability of the discriminator by allowing more than one state transition as input, i.e. we extend the input to $H$ consecutive observations. Note that this is typically not applicable to CEGAN or LSGAN, as a longer horizon makes the discriminator even stronger. By taking more sequential states into account, the policy reduces its chance to resort to the same safe transition patterns that are present in the reference motion.
+
+We denote trajectory segments of length $H$ preceding time $t$ by $o _ { t } ^ { H } = \left( o _ { t - H + 1 } , \ldots , o _ { t } \right)$ for the reference observations and $s _ { t } ^ { H } = ( s _ { t - { H + 1 } } , \cdot \cdot \cdot , s _ { t } )$ − for the states induced by the policy. For clarity, we omit the time index in the following. To simplify notation, we write $\bar { \Phi ( s ^ { H } ) }$ to express that each state in $s ^ { H }$ is mapped to $\mathcal { O }$ . In our experiments, we select linear and angular velocities $v , \omega$ of the robot base in the robot frame, measurement of the gravity vector in the robot frame $g$ , and the base height $z$ as the observation space $\mathcal { O }$ . More information on the state space and demonstration space is detailed in Suppl. B. Note that in this example, no joint information is required by the discriminator. This facilitates the process to obtain the expert motion, as one can simply move the robot base by hand along the desired trajectory without any joint actuation.
+
+Using $H$ -step inputs and a gradient penalty, Eq. 2 turns into
+
+$$
+\arg \operatorname* { m i n } _ { D } w ^ { \mathrm { D } } ( - \mathbb { E } _ { d ^ { \mathcal { M } } } [ D ( \boldsymbol { o } ^ { H } ) ] + \mathbb { E } _ { d ^ { \mathcal { \pi } } } [ D ( \Phi ( \boldsymbol { s } ^ { H } ) ) ] ) + w ^ { \mathrm { G P } } \mathbb { E } _ { d ^ { \mathcal { M } } } [ \| \nabla _ { \Omega } D ( \Omega ) \vert _ { \Omega = \boldsymbol { o } ^ { H } } ) \| _ { 2 } ^ { 2 } ] ,
+$$
+
+where the last term denotes the penalty for nonzero gradients on samples from the dataset [17]. $w ^ { \mathrm { D } }$ and $w ^ { \mathrm { G P } }$ denote the weights on the Wasserstein loss and the gradient penalty, respectively. In our experiments, they are set to $w ^ { \mathrm { D } } = 0 . 5$ and $w ^ { \mathrm { G P } } = 5 . 0$ for all tasks.
+
+# 3.3 Reward Formulation
+
+Despite discriminator regularization, due to the unbounded discriminator output, the scale of the reward can be arbitrary which makes it difficult to introduce additional regularization terms for stabilizing the robot motion. Therefore, we normalize the reward to have zero mean and unit variance in the policy training loop by maintaining its running mean $\widehat { \mu }$ and variance $\widehat { \sigma } ^ { 2 }$ . With this formulation, the imitation reward is then given by
+
+$$
+r ^ { \mathrm { I } } = \frac { D \left( \Phi ( s ^ { H } ) \right) - \widehat { \mu } } { \widehat { \sigma } } ,
+$$
+
+where $D \left( \Phi ( s ^ { H } ) \right)$ denotes the output of the discriminator.
+
+To increase policy learning efficiency, a common practice is to define a termination condition for rollouts. In our work, an instantaneous environment reset is triggered when a robot base collision against the ground is detected. Since the imitation reward has zero mean and difficult behaviors are likely to result in negative rewards initially, the policy may attempt to end the episode early. To circumvent this, a termination penalty is imposed at the last transition before a collision happens. As the normalized reward follows a distribution with zero mean and unit variance, $- 5 \sigma$ is a lower bound on the reward with a probability greater than $9 9 . 9 9 \%$ . We use this to derive a reasonable termination penalty, based on the geometric series, by a high-probability lower bound on the return
+
+$$
+r ^ { \mathrm { T } } = \mathbb { I } s \in \mathcal { T } \mathbb { I } \frac { - 5 \sigma } { 1 - \gamma } ,
+$$
+
+
+Figure 2: System overview. Given a reference dataset defining the desired base motion, the system trains a discriminator that learns an imitation reward for the policy training. This imitation reward is then combined with a regularization reward and termination penalty to train a policy that enables the robot to replicate the demonstrated motion while maintaining feasible and stable joint actuation.
+
+where $\gamma$ is the discount factor, $\tau$ is the set of early termination states, and $[ [ \cdot ] ]$ is the Iverson bracket (1 J Kif true, 0 otherwise). Putting everything together, the total reward that the policy receives encompasses three parts, the imitation reward $\dot { \boldsymbol { r } } ^ { \mathrm { I } }$ defined by the normalized discriminator output, the termination reward $r ^ { \mathrm { T } }$ , and the regularization reward $r ^ { \mathrm { R } }$ to guarantee stable policy outputs (detailed in Suppl. C)
+
+$$
+\begin{array} { r } { r = w ^ { \mathrm { I } } ( r ^ { \mathrm { I } } + r ^ { \mathrm { T } } ) + r ^ { \mathrm { R } } , } \end{array}
+$$
+
+where $w ^ { \mathrm { I } }$ is a motion-specific scaling factor controlling the relative importance of the imitation reward (and the termination penalty) with respect to the regularization terms.
+
+Note that our reward formulation enables the robot to learn highly dynamic skills without any explicitly defined desired-motion-incentivizing reward, as is used in AMP, where an a priori designed reward still has to motivate the policy to execute a specific movement [17]. It is also noteworthy that the LSGAN formulation in our setting can be viewed as an implementation of AMP modified for task reward learning with substantial adaptations as detailed in Suppl. D. Figure 2 provides a schematic overview of our method, and an algorithm overview is detailed in Algorithm 1.
+
+# Algorithm 1 WASABI
+
+1: Input: dataset of reference motions $\mathcal { M }$ , feature map $\Phi$
+2: initialize discriminator $D$ , policy $\pi$ , value function $V$ , state transition buffer $s ^ { H }$ , replay buffer $B$
+3: for learning iterations $= 1 , 2 , \ldots$ do
+4: collect $N + H$ transitions $\left( s _ { t } , a _ { t } , r _ { t } ^ { \mathrm { R } } , s _ { t + 1 } \right) _ { t - H } ^ { t + N }$ with policy $\pi$
+5: compute $r _ { \tau } ^ { \mathrm { I } }$ using discriminator outputs $D$ $) \left( \Phi ( s _ { i } ^ { H } ) \right)$ for $i = t , \ldots , t + N$
+6: calculate transition rewards ${ \boldsymbol { r } } _ { t } = { \boldsymbol { w } } ^ { \mathrm { I } } \left( { \boldsymbol { r } } _ { t } ^ { \mathrm { I } } + { \boldsymbol { r } } _ { t } ^ { \mathrm { T } } \right) + { \boldsymbol { r } } _ { t } ^ { \mathrm { R } }$ according to Equations 4, 5, and 6
+7: fill replay buffer $B$ with $\left( s _ { t } , a _ { t } , r _ { t } , s _ { t + 1 } , \Phi ( s _ { t } ^ { H } ) \right) _ { t } ^ { t + N }$
+8: for policy learning epoch $\mathfrak { l } = 1 , 2 , \ldots , n _ { \pi }$ do
+9: sample transition mini-batches $b ^ { \pi } \sim B$
+10: update $V$ and $\pi$ by PPO objective or another RL algorithm
+11: end for
+12: for discriminator learning epoch $= 1 , 2 , \dotsc , n _ { D }$ do
+13: sample transition mini-batches $b ^ { \pi } \sim B$ and $b ^ { \mathcal { M } } \sim \mathcal { M }$
+14: update discriminator $D$ using $b ^ { \pi }$ and $b ^ { \mathcal { M } }$ according to the loss associated with Eq. 3
+15: end for
+16: end for
+
+# 4 Experiments
+
+We evaluate WASABI on the Solo 8 robot, an open-source research quadruped robot that performs a wide range of physical actions [45], in simulation and on the real system (Fig. 3). For evaluation, we introduce 4 different robotics tasks. In SOLOLEAP, the robot is asked to move forward with a jumping motion. SOLOWAVE requires the robot to produce a wave-like locomotion behavior. For
+
+
+Figure 3: Solo 8 (left). Backflip motion in Isaac Gym (right).
+
+
+Figure 4: Adversarial imitation rewards for SOLOBACKFLIP. Imitation reward heatmap for LSGAN (a) and WASABI (b) around reference trajectories (blue) generated in varying pitch rate $\dot { \theta }$ and base height $z$ . (c) Distribution of imitation rewards for LSGAN and WASABI during training. WASABI provides a more fine-grained reward function.
+
+SOLOSTANDUP we require the robot to stand up on its hind legs. In SOLOBACKFLIP the robot is asked to generate motions of a full backflip. We provide rough demonstrations of these motions by manually carrying the robot through the motion and recording only the base information. The demonstrations are then used to infer an adversarial imitation reward for training a control policy that outputs target joint positions, as outlined in Sec. 3.1. An overview of the desired movements is provided in Suppl. G, we also provide further ablation studies in Suppl. I.
+
+In all of our experiments, we use Proximal Policy Optimization (PPO) [46] in Isaac Gym [47] and make use of domain randomization [48] for sim-to-real transfer. Further details on the training procedure can be found in Suppl. A.
+
+# 4.1 Induced Imitation Reward Distributions
+
+The LSGAN loss is proposed to alleviate the saturation problem that is encountered for the CEGAN loss. Yet, as outlined in Sec. 3.1, it does not directly yield a practical reward function. Peng et al. [17] remedy this by using $r ^ { \mathrm { I } } = \operatorname* { m a x } \left[ 0 , 1 - 0 . 2 5 ( \bar { D } ( \mathbf { \dot { \Phi } } ( s ) , \hat { \Phi ( s ^ { \prime } ) } ) - 1 ) ^ { 2 } \right]$ to map the discriminator output to the imitation reward and bound it between 0 and 1. However, with the effective clipping at 0, information about the distance from the policy to the demonstration transitions is lost with discriminator prediction smaller than $- 1$ (Fig. 4c). In addition, we show in Fig. 4a that the imitation reward learned using LSGAN yields a less informative signal for policy training, which is rather uniformly distributed across pitch rate $\dot { \theta }$ and base height $z$ dimensions. In comparison, WASABI can use the discriminator output directly, learning a more characteristic reward function across the state space where reference trajectories are clearly outlined to yield high rewards in contrast to the off-trajectory states (Fig. 4b).
+
+# 4.2 Learning to Mimic Rough Demonstrations
+
+Since we record the base motion of the robot carried by a human demonstrator, we do not have access to a reward function evaluating learned behaviors or measuring the closeness between the demonstrated and the policy trajectories. In addition, these trajectories are largely misaligned. For this reason, we make use of Dynamic Time Warping (DTW) [49] with the $L _ { 2 }$ norm metric for comparing policy trajectories and reference demonstrations. DTW allows us to match and compute the distance between the trajectories in a time-consistent manner (Fig. 1). Concretely, we use $\mathbb { E } \left[ d ^ { \mathrm { D T W } } ( \Phi ( \tau _ { \pi } ) , \tau _ { \mathcal { M } } ) \right]$ as the evaluation metric, where $\tau _ { \pi } \sim d ^ { \pi }$ is a state trajectory from a policy
+
+
Method
SOLOLEAP
SoLOWAVE
SOLOSTANDUP
SOLOBACKFLIP
WASABI
131.70 ± 16.44
247.29 ± 11.59
351.13 ± 88.60
477.43 ± 56.77
LSGAN
155.31 ± 18.10
230.91 ± 5.95
678.21 ± 6.71
813.76 ± 19.75
Stand Still
216.41
460.15
494.40
877.74
+
+Table 1: Comparison of performances for LSGAN and WASABI trained with hand-held demonstrations in terms of DTW distance $d ^ { \mathrm { D T W } }$ (lower is better), successful runs are in bold font. As a reference, we provide also $d ^ { \mathrm { D T W } }$ of a constantly standing trajectory.
+
+
+Figure 5: Performance of WASABI and LSGAN in terms of the handcrafted task reward for SOLOSTANDUP (left) and SOLOBACKFLIP (right). Dashed lines indicate partial information $( \dag )$ .
+
+rollout and $\tau _ { \mathcal { M } } \sim d ^ { \mathcal { M } }$ denotes a reference motion from the dataset. We provide further details about this metric in Suppl. H. In Table 1 we compare performances in simulation for the different reference motions.
+
+In order to confirm that WASABI is indeed able to extract a sensible reward function that motivates the desired motion, we compare the performance of LSGAN and WASABI in SOLOSTANDUP and SOLOBACKFLIP using an expert baseline that is trained on a handcrafted task reward for generating demonstrations in simulation. Details on the handcrafted task reward formulation are given in Suppl. E. The learned policies are evaluated with the same task rewards that are used to obtain the expert policies. A comparison of training performance curves in terms of the corresponding handcrafted task rewards is detailed in Fig. 5. In Table 2 we show the performance evaluation of the best runs. Observe that the policies trained by WASABI perform comparably to the expert policies trained with the handcrafted rewards. Interestingly, learning from partial state information may sometimes facilitate policy learning, since a decrease in discriminator observation dimensions could potentially alleviate the problem of discriminator becoming too strong as indicated in Fig. 5.
+
+# 4.3 Evaluation on Real Robot
+
+To evaluate our method on real system, we trained policies for sim-to-real transfer with WASABI for the SOLOLEAP, SOLOWAVE and SOLOBACKFLIP. The Solo 8 robot is powered by an external battery and driven by a controller on an external operating machine. It receives root state estimation using 10 markers attached around the base which are tracked using a Vicon motion capture system operating at $1 0 0 \mathrm { H z }$ . During deployment, we recorded the robot base information for evaluation by $d ^ { \mathrm { D T W } }$ . As detailed in Suppl. F, the policy observation space, reward, and training hyperparameters are adapted to facilitate sim-to-real transfer for these tasks specifically. The resulting performance on the real system, as shown in Table 3, resembles the performance obtained in simulation.
+
+
Method
SOLOSTANDUp†
SOLOSTANDUp*
SOLOBACKFLIPt
SOLOBACKFLIP*
WASABI
1.54 ± 0.51
1.68 ± 0.51
0.36 ± 0.05
0.28 ±0.02
LSGAN
1.07 ± 0.5
0.44 ± 0.14
0.12 ± 0.01
0.06 ± 0.01
Handcrafted
2.24 ± 0.05
0.77 ± 0.04
+
+Table 2: Performance comparison in terms of handcrafted task reward (higher is better). We denote with $^ *$ where the full robot configuration is given to the discriminator and $\dagger$ where only base information is given. Successful runs are in bold font. Std-dev. is over 5 independent random seeds.
+
+Table 3: Sim-to-real performance on the Solo 8 in terms of DTW distance (lower is better). Values are computed from the recorded data of the learned policies with respect to the reference trajectories.
+
+
SOLOLEAP
SOLOWAVE
SOLOBACKFLIP
WASABI (Real)
153.64± 7.08
215.38 ± 21.82
504.26 ± 18.90
WASABI (Sim)
131.70 ± 16.44
247.29 ± 11.59
477.43 ± 56.77
+
+
+Figure 6: ANYmal C (left). Wave motion in Isaac Gym (right).
+
+# 4.4 Cross-platform Imitation
+
+As the reference motion in WASABI contains only base information, it does not restrict itself to be obtained only from any specific robotic platform. This provides the possibility of cross-platform imitation. Using the reference trajectories recorded from Solo 8, with a manual offset of $\mathrm { 0 . 2 5 ~ m }$ on the base height dimension addressing different sizes of the robots, we apply WASABI to ANYmal [50], a four-legged dog-like robot for research and industrial maintenance (Fig. 6). To confirm that WASABI applies to cross-platform imitation, we define ANYMALWAVE and ANYMALBACKFLIP tasks for the corresponding wave and backflip motions learned by ANYmal, yet from the reference data recorded from Solo 8. The performance in terms of the DTW distance is detailed in Table 4.
+
+Table 4: Performance of cross-platform imitation of ANYmal using WASABI trained with hand-held demonstrations from Solo 8 in terms of DTW distance $d ^ { \mathrm { D T W } }$ , successful runs are in bold font.
+
+
Method
SoLOWAVE
ANYMALWAVE
SOLOBACKFLIP
ANYMALBACKFLIP
WASABI
247.29 ± 11.59
193.08 ± 14.52
477.43 ± 56.77
572.60 ± 12.18
Stand Still
460.15
877.74
+
+# 5 Conclusion
+
+In this work, we propose an adversarial imitation method named WASABI for inferring reward functions that is capable of learning agile skills from partial and physically incompatible demonstrations without any a priori known reward terms. Our results indicate that WASABI allows extracting robust policies that are able to transfer to the real system and enables cross-platform imitation. Furthermore, our experiments confirm that imitation learning using the LSGAN fits style transfer settings where desired motions are more achievable. For highly agile or incompatible motions which initially seem beyond the robot’s capability, WASABI outperforms LSGAN by successful and faithful replication of roughly demonstrated behaviors. Further extensions and applications are presented in Suppl. J.
+
+# 6 Limitations
+
+While saving the effort of developing a specific task reward that motivates desired motions, providing a good evaluation metric in terms of a distance to the reference motion is not straightforward for generic rough demonstrations. Although DTW is a feasible option, it still requires a reasonable distance metric and careful choice of the warping procedure, which might be task-dependent. Moreover, since our method works with rough demonstrations, even a good distance metric to the reference may not help inform about closeness to feasible, desirable motions from the robot’s perspective. Finally, we do not intensively study to what extent our method is robust against the degree of incompatibility of the demonstrations.
+
+# Acknowledgments
+
+Georg Martius is a member of the Machine Learning Cluster of Excellence, EXC number 2064/1 – Project number 390727645. We acknowledge the support from the German Federal Ministry of Education and Research (BMBF) through the Tübingen AI Center (FKZ: 01IS18039B). The authors thank the International Max Planck Research School for Intelligent Systems (IMPRS-IS) for supporting Marin Vlastelica and Sebastian Blaes, and Max Planck ETH Center for Learning Systems for supporting Jonas Frey.
+
+# References
+
+[1] M. Raibert, K. Blankespoor, G. Nelson, and R. Playter. Bigdog, the rough-terrain quadruped robot. IFAC Proceedings Volumes, 41(2):10822–10825, 2008.
+[2] J. Di Carlo, P. M. Wensing, B. Katz, G. Bledt, and S. Kim. Dynamic locomotion in the mit cheetah 3 through convex model-predictive control. In 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 1–9. IEEE, 2018.
+[3] J. Hwangbo, J. Lee, A. Dosovitskiy, D. Bellicoso, V. Tsounis, V. Koltun, and M. Hutter. Learning agile and dynamic motor skills for legged robots. Science Robotics, 4(26):eaau5872, 2019.
+[4] J. Lee, J. Hwangbo, L. Wellhausen, V. Koltun, and M. Hutter. Learning quadrupedal locomotion over challenging terrain. Science robotics, 5(47):eabc5986, 2020.
+[5] A. Kumar, Z. Fu, D. Pathak, and J. Malik. RMA: Rapid motor adaptation for legged robots. In Robotics: Science and Systems XVII (RSS), 2021.
+[6] T. Miki, J. Lee, J. Hwangbo, L. Wellhausen, V. Koltun, and M. Hutter. Learning robust perceptive locomotion for quadrupedal robots in the wild. Science Robotics, 7(62):eabk2822, 2022.
+[7] D. A. Pomerleau. Efficient training of artificial neural networks for autonomous navigation. Neural Computation, 3(1):88–97, 1991.
+[8] F. Torabi, G. Warnell, and P. Stone. Behavioral cloning from observation. ArXiv, abs/1805.01954, 2018.
+[9] S. Ross, G. Gordon, and D. Bagnell. A reduction of imitation learning and structured prediction to no-regret online learning. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pages 627–635. JMLR Workshop and Conference Proceedings, 2011.
+[10] A. Hussein, M. M. Gaber, E. Elyan, and C. Jayne. Imitation learning: A survey of learning methods. ACM Computing Surveys (CSUR), 50(2):1–35, 2017.
+[11] B. D. Ziebart, A. L. Maas, J. A. Bagnell, A. K. Dey, et al. Maximum entropy inverse reinforcement learning. In AAAI, volume 8, pages 1433–1438. Chicago, IL, USA, 2008.
+[12] E. Bashir and M. Luštrek. Inverse reinforcement learning through max-margin algorithm. In Intelligent Environments 2021: Workshop Proceedings of the 17th International Conference on Intelligent Environments, volume 29, page 190. IOS Press, 2021.
+[13] D. Garg, S. Chakraborty, C. Cundy, J. Song, and S. Ermon. Iq-learn: Inverse soft-q learning for imitation. Advances in Neural Information Processing Systems, 34, 2021.
+[14] P. Abbeel and A. Y. Ng. Apprenticeship learning via inverse reinforcement learning. In Proceedings of the Twenty-first International Conference on Machine Learning, page 1, 2004.
+[15] J. Ho and S. Ermon. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems, volume 29, 2016.
+[16] I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial networks. In Advances in Neural Information Processing Systems, volume 3, 06 2014.
+[17] X. B. Peng, Z. Ma, P. Abbeel, S. Levine, and A. Kanazawa. AMP: Adversarial motion priors for stylized physics-based character control. ACM Transactions on Graphics (TOG), 40(4):1–20, 2021.
+[18] D. Pathak, D. Gandhi, and A. Gupta. Self-supervised exploration via disagreement. In International Conference on Machine Learning, pages 5062–5071. PMLR, 2019.
+[19] Q. Cai, Z. Yang, C. Jin, and Z. Wang. Provably efficient exploration in policy optimization. In International Conference on Machine Learning, pages 1283–1294. PMLR, 2020.
+[20] A. Billard, S. Calinon, R. Dillmann, and S. Schaal. Survey: Robot programming by demonstration. Technical report, Springrer, 2008.
+[21] B. D. Argall, S. Chernova, M. Veloso, and B. Browning. A survey of robot learning from demonstration. Robotics and Autonomous Systems, 57(5):469–483, 2009.
+[22] S. Schaal. Learning from demonstration. Advances in Neural Information Processing Systems, 9, 1996.
+[23] C. G. Atkeson and S. Schaal. Robot learning from demonstration. In ICML, volume 97, pages 12–20, 1997.
+[24] S. Schaal. Is imitation learning the route to humanoid robots? Trends in Cognitive Sciences, 3 (6):233–242, 1999.
+[25] S. Calinon, F. D’halluin, E. L. Sauser, D. G. Caldwell, and A. G. Billard. Learning and reproduction of gestures by imitation. IEEE Robotics & Automation Magazine, 17(2):44–54, 2010.
+[26] S. M. Khansari-Zadeh and A. Billard. Learning stable nonlinear dynamical systems with gaussian mixture models. IEEE Transactions on Robotics, 27(5):943–957, 2011.
+[27] A. J. Ijspeert, J. Nakanishi, H. Hoffmann, P. Pastor, and S. Schaal. Dynamical movement primitives: learning attractor models for motor behaviors. Neural Computation, 25(2):328–373, 2013.
+[28] F. Codevilla, E. Santana, A. M. López, and A. Gaidon. Exploring the limitations of behavior cloning for autonomous driving. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9329–9338, 2019.
+[29] Y. Lee, S. Kim, and J. Lee. Data-driven biped control. ACM Trans. Graph., 29(4), jul 2010. ISSN 0730-0301.
+[30] L. Liu, K. Yin, M. van de Panne, T. Shao, and W. Xu. Sampling-based contact-rich motion control. ACM SIGGRAPH 2010 papers, 2010.
+[31] L. Liu, M. V. D. Panne, and K. Yin. Guided learning of control graphs for physics-based characters. ACM Transactions on Graphics (TOG), 35(3):1–14, 2016.
+[32] X. B. Peng, P. Abbeel, S. Levine, and M. van de Panne. Deepmimic: Example-guided deep reinforcement learning of physics-based character skills. ACM Transactions on Graphics (TOG), 37(4):1–14, 2018.
+[33] S. Lee, M. Park, K. Lee, and J. Lee. Scalable muscle-actuated human simulation and control. ACM Transactions On Graphics (TOG), 38(4):1–13, 2019.
+[34] X. B. Peng, A. Kanazawa, J. Malik, P. Abbeel, and S. Levine. Sfv: Reinforcement learning of physical skills from videos. ACM Transactions On Graphics (TOG), 37(6):1–14, 2018.
+[35] J. Merel, Y. Tassa, D. TB, S. Srinivasan, J. Lemmon, Z. Wang, G. Wayne, and N. Heess. Learning human behaviors from motion capture by adversarial imitation. arXiv preprint arXiv:1707.02201, 2017.
+[36] Z. Wang, J. S. Merel, S. E. Reed, N. de Freitas, G. Wayne, and N. Heess. Robust imitation of diverse behaviors. Advances in Neural Information Processing Systems, 30, 2017.
+[37] R. Jena and K. P. Sycara. Loss-annealed gail for sample efficient and stable imitation learning. ArXiv, abs/2001.07798, 2020.
+[38] J. Fu, K. Luo, and S. Levine. Learning robust rewards with adversarial inverse reinforcement learning. arXiv preprint arXiv:1710.11248, 2017.
+[39] A. Escontrela, X. B. Peng, W. Yu, T. Zhang, A. Iscen, K. Goldberg, and P. Abbeel. Adversarial motion priors make good substitutes for complex reward functions. arXiv preprint arXiv:2203.15103, 2022.
+[40] E. Vollenweider, M. Bjelonic, V. Klemm, N. Rudin, J. Lee, and M. Hutter. Advanced skills through multiple adversarial motion priors in reinforcement learning. arXiv preprint arXiv:2203.14912, 2022.
+[41] M. Arjovsky and L. Bottou. Towards principled methods for training generative adversarial networks. arXiv preprint arXiv:1701.04862, 2017.
+[42] X. Mao, Q. Li, H. Xie, R. Y. Lau, Z. Wang, and S. Paul Smolley. Least squares generative adversarial networks. In Proceedings of the IEEE International Conference on Computer Vision, pages 2794–2802, 2017.
+[43] Y. Rubner, C. Tomasi, and L. J. Guibas. A metric for distributions with applications to image databases. In Sixth international conference on computer vision (IEEE Cat. No. 98CH36271), pages 59–66. IEEE, 1998.
+[44] M. Arjovsky, S. Chintala, and L. Bottou. Wasserstein gan. ArXiv, abs/1701.07875, 2017.
+[45] F. Grimminger, A. Meduri, M. Khadiv, J. Viereck, M. Wüthrich, M. Naveau, V. Berenz, S. Heim, F. Widmaier, T. Flayols, J. Fiene, A. Badri-Spröwitz, and L. Righetti. An open torque-controlled modular robot architecture for legged locomotion research. IEEE Robotics and Automation Letters, 5(2):3650–3657, 2020. doi:10.1109/LRA.2020.2976639.
+[46] J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
+[47] V. Makoviychuk, L. Wawrzyniak, Y. Guo, M. Lu, K. Storey, M. Macklin, D. Hoeller, N. Rudin, A. Allshire, A. Handa, et al. Isaac gym: High performance gpu-based physics simulation for robot learning. arXiv preprint arXiv:2108.10470, 2021.
+[48] J. Tobin, R. Fong, A. Ray, J. Schneider, W. Zaremba, and P. Abbeel. Domain randomization for transferring deep neural networks from simulation to the real world. In 2017 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 23–30. IEEE, 2017.
+[49] D. J. Berndt and J. Clifford. Using dynamic time warping to find patterns in time series. In KDD Workshop, 1994.
+[50] Anymal c – the next step in robotic industrial inspection, August 2019. URL https://www. anybotics.com/the-next-step-in-robotic-industrial-inspection/.
\ No newline at end of file
diff --git a/md/dev/xDaoT2zlJ0r/xDaoT2zlJ0r.md b/md/dev/xDaoT2zlJ0r/xDaoT2zlJ0r.md
new file mode 100644
index 0000000000000000000000000000000000000000..ef830d4bfa754d47c10ebea9dc0a69053c4b7716
--- /dev/null
+++ b/md/dev/xDaoT2zlJ0r/xDaoT2zlJ0r.md
@@ -0,0 +1,506 @@
+# FINDE: Neural Differential Equations for Finding and Preserving Invariant Quantities
+
+Anonymous Author(s)
+Affiliation
+Address
+email
+
+# Abstract
+
+1 Neural networks have shown promise for modeling dynamical systems from data.
+2 Recent models, such as Hamiltonian neural networks, have been designed to
+3 ensure known geometric structures of target systems and have shown excellent
+4 modeling accuracy. However, in most situations where neural networks learn
+5 unknown systems, their underlying structures are also unknown. Even in such
+6 cases, one can expect that target systems are associated with first integrals (a.k.a. in
+7 variant quantities), which are quantities remaining unchanged over time. First
+8 integrals come from the conservation laws of system energy, momentum, and mass,
+9 from constraints on states, and from other features of governing equations. By
+10 leveraging projection methods and discrete gradient methods, we propose first
+11 integral-preserving neural differential equations (FINDE). The proposed FINDE
+12 finds and preserves first integrals from data, even in the absence of prior knowl
+13 edge about the underlying structures. Experimental results demonstrate that the
+14 proposed FINDE is able to predict future states of given systems much longer and
+15 find various quantities consistent with well-known first integrals of the systems in
+16 a unified manner.
+
+# 17 1 Introduction
+
+18 Although neural networks have achieved remarkable results in image and natural language pro
+19 cessing [17, 28], they have also been actively investigated for modeling dynamical systems [41].
+20 Target systems include the chemical dynamics to accelerate computer simulations [46], the climate
+21 dynamics for climate change prediction and weather forecasting [47, 52], and the physical dynamics
+22 of vehicles and robots for optimal control [41]. Their history dates back to at least the 1990s, and
+23 many approaches have been proposed so far (see [7, 12, 35, 40, 49, 55] for example). Recently,
+24 neural ordinary differential equation (NODE) has redefined neural networks for continuous-time
+25 dynamics [8]. A target system is described by an ordinary differential equation (ODE) $\begin{array} { r } { \frac { \mathrm { d } } { \mathrm { d } t } \pmb { u } = \pmb { f } ( t , \pmb { u } ) } \end{array}$
+26 where $\textbf { \em u }$ denotes the system state. Then, a NODE replaces the vector field $f$ with a neural network
+27 and employs a numerical integrator to obtain a solution ${ \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } \mathbf { } { \mathbf { } } \mathbf { } { \mathbf { } } \mathbf { } { \mathbf { } } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \Psi \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf \Psi { } \mathbf \Psi \mathbf { } \mathbf { } \mathbf \Psi \Psi \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \Psi \mathbf { } \mathbf \mathbf { } \mathbf \Psi \mathbf { } \mathbf \mathbf { } \mathbf \mathbf \Psi \Psi \mathbf { } \mathbf \mathbf \Psi \Psi \mathbf { } \mathbf \mathbf \Psi \mathbf { } \mathbf \mathbf \Psi \mathbf \Psi \Psi \mathbf \Psi \mathbf { \mathbf } \mathbf \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \mathbf \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \mathbf \Psi \mathbf \Psi \mathbf \mathbf \Psi \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf $ .
+28 Most real-world systems are associated with first integrals (a.k.a. invariant quantities), which are
+29 quantities remaining unchanged over time [27]. If a system has a first integral $V ( { \pmb u } )$ , the solution
+30 ${ \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } \mathbf { } { \mathbf { } } \mathbf { } { \mathbf { } } \mathbf { } { \mathbf { } } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf \Psi { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf \Psi { } \mathbf \Psi { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { \Psi } \mathbf \mathbf \Psi \mathbf { } \mathbf \mathbf \Psi \Psi \mathbf { } \mathbf \mathbf \mathbf { \Psi \mathbf } \mathbf \mathbf \Psi \Psi \mathbf \Psi \mathbf { \mathbf } \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf $ for the initial condition $\pmb { u } ( 0 )$ remains at a contour line $V ( \mathbf { \boldsymbol { u } } ( t ) ) = V ( \mathbf { \boldsymbol { u } } ( 0 ) )$ over time. Many
+31 previous studies have attempted to learn a target system accurately by incorporating prior knowledge
+32 about first integrals. Greydanus et al. [26] proposed Hamiltonian neural network (HNN), which
+33 employs a neural network to approximate Hamilton’s equation, thereby conserving the system energy
+34 called the Hamiltonian. Finzi et al. [19] proposed neural network architectures that conserve linear
+35 and angular momenta by utilizing the graph structure. Finzi et al. [20] also extended HNN to a system
+36 with holonomic constraints, which lead to first integrals such as a pendulum length. Matsubara et al.
+37 [38] proposed a model that preserves the total mass of a discretized partial differential equation
+38 (PDE). These studies have demonstrated that a neural network with more prior knowledge about first
+39 integrals predicts the dynamics of the target system more accurately. See Table 1 for comparison.
+40 Previous studies have mainly attempted to preserve known first integrals. However, in situations
+41 where a neural network learns an unknown target system, it is naturally expected that first integrals
+42 associated with the target system are also unknown, and it is not clear which of the above methods are
+43 available. Given the above, this study proposes First Integral-preserving Neural Differential Equation
+44 (FINDE) to find and preserve first integrals from data. FINDE has the following advantages.
+45 Learning First Integrals For modeling continuous-time dynamics with known first integrals, many
+46 studies have designed architectures or operations of neural networks [13, 19, 20, 26, 38]. For each
+47 type of first integral, one dedicated method was proposed. However, the properties of a target system
+48 are generally unknown in practice. In contrast, the proposed FINDE finds various kinds of first
+49 integrals from data in a unified manner and preserves them in predictions. A symbolic regression
+50 confirms that the learned first integrals are consistent with well-known first integrals of target systems.
+
+Table 1: Comparison between Related Studies on Preservation of First Integrals.
+
+
energy
monentum mass
constraint learning invariants exact conservation
NODE [8]
HNN [26]
√
LieConv [19]
√
厂
DGNet [38]
√
√
CHNN [20]
√
√
continuous FINDE (proposed)
√
√
√
√
√
discrete FINDE (proposed)
√
厂
厂
丁
+
+Combination with Known First Integrals The proposed FINDE can be combined with previously proposed neural networks designed to preserve known first integrals, such as HNN. Therefore, FINDE is available in various situations.
+
+54 Exact Preservation of First Integrals Even if a first integral is associated with a continuous-time
+55 system, it is destroyed after the system is discretized in time for computer simulations. This is true
+56 even when using a symplectic integrator, which preserves the system energy only approximately [27].
+57 By leveraging discrete gradients [38], the discrete-time version of FINDE preserves first integrals
+58 exactly (up to rounding errors) in discrete time and further improves the prediction performance.
+
+# 59 2 Background and Related Work
+
+60 First Integrals Let us consider a time-invariant differential system $\begin{array} { r } { \frac { \mathrm { d } } { \mathrm { d } t } \pmb { u } \ = \ f ( \pmb { u } ) } \end{array}$ on an $N$ -
+61 dimensional manifold $\mathcal { M }$ , where $\textbf { \em u }$ denotes the system state and $f : \mathcal { M } ^ { } \to \mathcal { T } _ { u } \mathcal { M }$ represents a
+62 vector field on the manifold $\mathcal { M }$ . The manifold $\mathcal { M }$ can be $\mathcal { M } = S ^ { 1 } \times \mathbb { R } ^ { 1 }$ for a pendulum. In this
+63 paper, we suppose the manifold $\mathcal { M }$ be a Eucleadian space $\mathbb { R } ^ { N }$ for simplicity.
+64 Definition 1 (first integral). $A$ quantity $V : { \mathcal { M } } \mathbb { R }$ is referred to as a first integral of a system
+65 $\begin{array} { r } { \frac { \mathrm { d } } { \mathrm { d } t } \pmb { u } = f ( \pmb { u } ) } \end{array}$ if it remains constant along with any solution ${ \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } { \mathbf { } } \mathbf { } { \mathbf { } } \mathbf { } { \mathbf { } } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf { } \mathbf { } \mathbf \Psi { } \mathbf \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf \Psi { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \Psi \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \mathbf \Psi \mathbf { } \mathbf \mathbf { } \mathbf \mathbf \mathbf { } \mathbf \mathbf \mathbf { } \mathbf \mathbf \mathbf { \mathbf } \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \Psi \mathbf { } \mathbf \mathbf \mathbf \mathbf \mathbf { } \mathbf \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf { } \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf$ , i.e., $\begin{array} { r } { \frac { \mathrm { d } } { \mathrm { d } t } V ( \pmb { u } ) = 0 } \end{array}$ .
+
+ntial system $\begin{array} { r } { \frac { \mathrm { d } } { \mathrm { d } t } { \pmb u } = f ( { \pmb u } ) } \end{array}$ is associate ith $K$ functionally independent first integrals $V _ { 1 } , \dots , V _ { K }$ ${ \bf \ddot { u } } ( t )$ given an initial value $\mathbf { \delta } \mathbf { u } _ { 0 }$ stays at the
+
+$$
+\mathcal { M } ^ { \prime } = \{ \pmb { u } \in \mathcal { M } : V _ { 1 } ( \pmb { u } ) = V _ { 1 } ( \pmb { u } _ { 0 } ) , \allowbreak \dots , V _ { K } ( \pmb { u } ) = V _ { K } ( \pmb { u } _ { 0 } ) \} .
+$$
+
+69 The tangent space $\mathcal { T } _ { u } \mathcal { M } ^ { \prime } \subset \mathcal { T } _ { u } \mathcal { M }$ of the submanifold $\mathcal { M } ^ { \prime } \subset \mathcal { M }$ at a point $\textbf { \em u }$ is the orthogonal
+70 complement to the space spanned by the gradients $\nabla V _ { k } ( { \boldsymbol { \mathbf { \mathit { u } } } } )$ of the first integrals $V _ { k }$ for $k = 1 , \ldots , K$ ,
+71 that is,
+
+$$
+\mathcal { T } _ { \boldsymbol { u } } \mathcal { M } ^ { \prime } = \{ \pmb { w } \in \mathcal { T } _ { \boldsymbol { u } } \mathcal { M } : \nabla V _ { k } ( \boldsymbol { u } ) ^ { \top } \pmb { w } = 0 \mathrm { ~ f o r ~ } k = 1 , \dots , K \}
+$$
+
+If a quantity 72 $V _ { k }$ is a first integral of the system $\begin{array} { r } { \frac { \mathrm { d } } { \mathrm { d } t } \pmb { u } = f ( \pmb { u } ) } \end{array}$ , the time-derivative $f$ at point $\textbf { \em u }$ is on the 73 tangent space $\mathcal { T } _ { u } \mathcal { M } ^ { \prime }$ , being orthogonal to the gradient $\nabla V _ { k }$ of the first integral $V _ { k }$ . Then, it holds that 74 $\begin{array} { r } { \frac { \mathrm { d } } { \mathrm { d } t } \dot { V _ { k } ( \pmb { u } ) } = \nabla V _ { k } ( \pmb { u } ) ^ { \top } \frac { \mathrm { d } } { \mathrm { d } t } \pmb { u } = \bar { \nabla } V _ { k } ( \pmb { u } ) ^ { \top } \pmb { f } ( \bar { \pmb { u } } ) = 0 } \end{array}$ .
+
+75 One of the most well-known first integrals is the Hamiltonian $H$ , which represents the system energy
+76 of a Hamiltonian system. Noether’s theorem states that a continuous symmetry of a system leads to a
+77 conservation law (and hence a first integral) [27]; a Hamiltonian system is symmetric to translation
+78 in time and conserves the Hamiltonian. Symmetries to translation and rotation in space lead to the
+79 conservation of linear and angular momenta. Not all first integrals are related to symmetries. A
+80 pendulum can be expressed in Cartesian coordinates, and then the rod length constrains the mass
+81 position. This kind of constraint is called a holonomic constraint and leads to a first integral. A model
+82 for disease spreading called an susceptible-infected-recovered (SIR) model and the dynamics of
+83 chemical reactions have the total mass (population) as a first integral. Also for a system described by
+84 a PDE, the total mass is sometimes a first integral [23]. See Appendix A for theoretical classification
+85 of dynamics.
+86 First Integrals in Numerical Analysis For computer simulations, a differential system is dis
+87 cretized in time and solved by numerical integration. Then, the geometric structures of the system
+88 are often destroyed, and most first integrals are no longer preserved. A common remedy is a sym
+89 plectic integrator, which preserves the symplectic structure and integrates a Hamiltonian system
+90 accurately [27]. However, Ge–Marsden theorem states that a symplectic integrator conserves the
+91 Hamiltonian only approximately [56]. Hence, many numerical schemes have also been investigated
+92 for preserving first integrals exactly, while they cannot preserve the symplectic structure.
+93 Let a superscript $s$ denote the state $\pmb { u } ^ { s }$ or time $t ^ { s }$ at $s$ -th time step, and $\Delta t ^ { s } = t ^ { s + 1 } - t ^ { s }$ denote a
+94 time step size. A projection method predicts a next state $\tilde { \pmb u } ^ { s + 1 }$ from the current state $\pmb { u } ^ { s }$ using a
+95 numerical integrator and projects it onto the submanifold $\mathcal { M } ^ { \prime }$ , obtaining the projected state $\pmb { u } ^ { s + 1 }$ that
+96 preserves the first integrals $V _ { k }$ [24] (see also [27, Section IV.4]). In particular, the projected state
+97 $\mathbf { \Delta } _ { \mathbf { u } } { } ^ { s + 1 }$ is obtained by solving the optimization problem
+
+$$
+\boldsymbol { u } ^ { s + 1 } = \operatorname * { a r g m i n } _ { \boldsymbol { u } ^ { \prime } ^ { s + 1 } } | | \boldsymbol { u } ^ { \prime * s + 1 } - \tilde { \boldsymbol { u } } ^ { s + 1 } | | \operatorname * { s u b j e c t } \operatorname { t o } V _ { k } ( \boldsymbol { u } ^ { \prime * s + 1 } ) = V _ { k } ( \boldsymbol { u } ^ { s } ) \operatorname { f o r } k = 1 , \dots , K .
+$$
+
+98 A local coordinate method defines a coordinate system to the neighborhood of the current state $\pmb { u } ^ { s }$
+99 and integrates a differential equation on it [43] (see also [27, Section IV.5]). A discrete gradient
+100 method defines a discrete analogue to a given differential system and integrates it in discrete time [6,
+101 23, 25, 29, 44, 45]. This method eliminates numerical errors caused by temporal discretization and is
+102 used to preserve the Hamiltonian exactly (up to rounding errors) in discrete time.
+103 Except for DGNet, which used discrete gradients to preserve the Hamiltonian [38], all the above
+104 methods have never been applied to neural networks due to difficulties that we will introduce later. To
+105 our best knowledge, the discrete-time version of FINDE is the first projection method for dynamical
+106 systems modeled using neural networks.
+107 Preservation of First Integrals by Neural Networks NODE defines an ODE using a neural net
+108 work in the most general way with no associated first integrals [8]. NODE is a universal approximator
+109 to ODEs [51], and it can approximate any ODE with arbitrary accuracy if there is an infinite amount
+110 of training data. In practice, the amount of training data is limited, and prior knowledge about the
+111 target system is helpful for learning (see [48] for the case with convolutional neural networks). HNN
+112 assumes the target system to be a Hamiltonian system in the canonical form [26]. HNN guarantees
+113 various properties of Hamiltonian systems by definition, including the conservation of the energy
+114 and the preservation of the symplectic structure in continuous time [27]. Some studies employed a
+115 symplectic integrator for HNN to preserve the energy and symplectic structure with smaller numerical
+116 errors [10]. LieConv and EMLP-HNN employed neural network architectures with translational
+117 and rotational symmetries to preserve momenta [19, 21]. CHNN incorporates a known holonomic
+118 constraint in the dynamics [20]. Deep conservation extracts latent dynamics of a PDE system and
+119 preserves a quantity of interest by forcing its flux to be zero [34]. $\mathrm { H N N + + }$ also guarantees the
+120 conservation of the mass in PDE systems by using a coefficient matrix derived from differential
+121 operators [38].
+122 Several studies proposed neural networks to learn Lyapunov functions, which are expected to be
+123 non-increasing over time, in contrast to first integrals [37, 50]. If the state moves in the direction of
+124 increasing the function, it is projected onto or moved inside the counter line of the gradient of the
+125 Lyapunov function. Their idea is similar to the continuous-time version of FINDE but limited to a
+126 single non-increasing quantity in continuous time. On the other hand, our proposed FINDE preserves
+127 multiple quantities in both continuous and discrete time.
+28 Previous studies aimed to preserve known first integrals. Moreover, except for DGNet [38], all
+29 the above methods suffer from numerical errors caused by temporal discretization. In contrast, our
+30 proposed FINDE learns first integrals from data and can eliminate discretization errors.
+
+# 131 3 First Integral-Preserving Neural Differential Equation
+
+132 The main purpose is to find and preserve first integrals from data by neural networks. We suppose
+133 that a target system has at least $K$ unknown functionally independent first integrals. Even when
+134 a NODE learns the target system, it is not guaranteed to learn these first integrals. Hence, we
+135 introduce a neural network with $K$ outputs, each of which is expected to learn one of first integrals
+136 expressed as $V _ { k } : \mathbb { R } ^ { N } \mathbb { R }$ for $k = 1 , \dots , K$ . We denote the set of first integrals by a vector
+137 $\pmb { V } ( \pmb { u } ) = ( V _ { 1 } ( \pmb { u } ) V _ { 2 } ( \pmb { u } ) \dotsm V _ { K } ( \pmb { u } ) ) ^ { \top }$ . Then, the submanifold $\mathcal { M } ^ { \prime }$ is defined using the neural
+138 network $V$ as in Eq. (1).
+139 Because there is no way to define local coordinates on such submanifolds, a local coordinate method
+140 is not applicable. When using a projection method, the optimization problem in Eq. (3) should
+141 be solved at every training iteration as well as in the prediction phase. Optimization problems are
+142 computationally expensive, and common libraries for neural networks do not provide backpropagation
+143 algorithms for optimization problems [1, 42].1 Until a recent study has proposed an algorithm [38],
+144 there was no way to obtain discrete gradients of neural networks. Because of these difficulties,
+145 no methods for preserving first integrals have been applied to neural networks. By leveraging a
+146 projection method and a discrete gradient method, we propose FINDE as follows.
+
+# 3.1 Continuous FINDE: Time-Derivative Projection Method
+
+First, we propose a time-derivative projection method called continuous FINDE (cFINDE) for neural networks, which projects the time-derivative onto the tangent space $\mathcal { T } _ { u } \mathcal { M } ^ { \prime }$ . While it still suffers from numerical errors, it is sufficient to find first integrals from data.
+
+We suppose that a neural network called a base model defines the time-derivative $\hat { f } : \mathbb { R } ^ { N } \to \mathbb { R } ^ { N }$ Then, we define the time-derivative $f$ of the cFINDE $\begin{array} { r } { \frac { \mathrm { d } } { \mathrm { d } t } \pmb { u } = f ( \pmb { u } ) } \end{array}$ as
+
+$$
+\begin{array} { r } \boldsymbol { f } ( \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol { \mathbf { \rho } } \boldsymbol \mathbf { \rho } \boldsymbol { \rho } \boldsymbol \end{array}
+$$
+
+where 153 $\lambda _ { k }$ is a Lagrange multiplier, $\begin{array} { r } { M \mathrm { ~ = ~ } \frac { \partial V } { \partial \mathbf { u } } } \end{array}$ , and $\lambda ( { \pmb u } ) = ( \lambda _ { 1 } ( { \pmb u } ) \lambda _ { 2 } ( { \pmb u } ) \dots \lambda _ { K } ( { \pmb u } ) ) ^ { \top }$ . If $V _ { k }$
+
+$$
+\begin{array} { r } { \mathbf { 0 } = \frac { \mathrm { d } } { \mathrm { d } t } { \pmb V } ( { \pmb u } ( t ) ) = M ( \pmb { u } ) \frac { \mathrm { d } } { \mathrm { d } t } { \pmb u } = M ( \pmb { u } ) f ( \pmb { u } ) = M ( \pmb { u } ) ( \hat { f } ( \pmb { u } ) - M ( \pmb { u } ) ^ { \top } \pmb { \lambda } ( \pmb { u } ) ) , } \end{array}
+$$
+
+where 155 $\mathbf { 0 } = ( 0 \ldots 0 ) ^ { \top }$ . By transforming Eq. (5), we obtain the Lagrange multiplier $\lambda ( { \pmb u } ) =$ 156 $( M ( \pmb { \mathscr { u } } ) M ( \pmb { \mathscr { u } } ) ^ { \top } ) ^ { - 1 } M ( \pmb { \mathscr { u } } ) \hat { f } ( \pmb { \mathscr { u } } )$ . By eliminating it, the cFINDE $\begin{array} { r } { \frac { \mathrm { d } } { \mathrm { d } t } \pmb { u } = f ( \pmb { u } ) } \end{array}$ is given by
+
+Remark 1 (continuous-time first integral preservation). The cFINDE 57 $\begin{array} { r } { \frac { \mathrm { d } } { \mathrm { d } t } \pmb { u } = f ( \pmb { u } ) } \end{array}$ preserves all first integrals 58 $V _ { k }$ for $k = 1 , \ldots , K$ in continuous time, i.e., $\begin{array} { r } { { \frac { \mathrm { d } } { \mathrm { d } t } } V _ { k } = 0 } \end{array}$ .
+
+159 The base model $\hat { f }$ can be a NODE, an HNN, or other models depending on available prior knowledge.
+160 Also, if a first integral is already known, one can use it directly as one of first integrals $V _ { k }$ instead
+161 of learning it using a neural network. Note that even though the base model $\hat { f }$ is an HNN, due to
+162 projection, the cFINDE $f$ is no longer a Hamiltonian system in the strict sense.
+
+Compared to the base model $\hat { f }$ , the cFINDE requires the additional computation of the neural network $V$ , several matrix multiplications, and an inverse operation. The inverse operation needs a computational cost of $O ( K ^ { 3 } )$ , which is not costly if the number $K$ of first integrals is small. For satisfying the constraints and geometric structures, many previous models also need the inverse operation, such as Lagrangian neural network (LNN) [13], neural symplectic form [9], and CHNN [20].
+
+69 To eliminate numerical errors caused by temporal discretization, we employ discrete gradients and
+70 propose a projection method called discrete FINDE (dFINDE).
+
+A discrete gradient $\overline { { \nabla } } V$ is a discrete analogue to a gradient $\nabla V$ [6, 23, 25, 29, 44, 45]. Recall that a gradient $\nabla V$ of a function $V : \mathbb { R } ^ { N } \mathbb { R }$ can be regarded as a function $\mathbb { R } ^ { N } \to \mathbb { R } ^ { N }$ that satisfies the chain rule $\begin{array} { r } { \frac { \mathrm { d } } { \mathrm { d } t } V ( \pmb { u } ) = \nabla V ( \pmb { u } ) ^ { \top } \frac { \mathrm { d } } { \mathrm { d } t } \pmb { u } } \end{array}$ . Analogously, a discrete gradient $\overline { \nabla }$ is defined as follows.
+
+Definition 2 (discrete gradient). A discrete gradient $\overline { { \nabla } } V$ of a function $V : \mathbb { R } ^ { N } \mathbb { R }$ is a function $\mathbb { R } ^ { N } \times \mathbb { R } ^ { N } \xrightarrow [ ] { } \mathbb { R } ^ { N }$ that satisfies
+
+$$
+V ( \pmb { v } ) - V ( \pmb { u } ) = \overline { { \nabla } } V ( \pmb { v } , \pmb { u } ) ^ { \top } ( \pmb { v } - \pmb { u } ) ~ a n d ~ \overline { { \nabla } } V ( \pmb { u } , \pmb { u } ) = \nabla V ( \pmb { u } ) .
+$$
+
+176 The first condition is a discrete analogue to the chain rule when replacing the time-derivatives ${ \frac { \mathrm { d } } { \mathrm { d } t } } V$
+177 and ${ \frac { \mathrm { d } } { \mathrm { d } t } } { \pmb u }$ with finite differences $( V ( \pmb { v } ) - V ( \pmb { u } ) )$ and $( { \pmb v } - { \pmb u } )$ , respectively, and the second condition
+178 ensures the consistency with the ordinary gradient $\nabla V$ . A discrete gradient $\overline { { \nabla } } V$ is not uniquely
+179 determined and has been obtained manually. Recently, the automatic discrete differentiation algorithm
+180 (ADDA) has been proposed in [38], which obtains a discrete gradient of a neural network in a similar
+181 way to the automatic differentiation algorithm [1, 42]. The discrete gradient is defined in discrete
+182 time, and hence a numerical integration using the discrete gradient is free from numerical errors
+183 caused by temporal discretization. See Appendix $\mathbf { B }$ and the references [6, 23, 38] for more details.
+
+Following [11, 15], we introduce a discrete analogue to the tangent space 184 $\mathcal { T } _ { \mathbf { \ b { u } } } \mathcal { M } ^ { \prime }$ called the discrete tangent space 185 $\mathcal { T } _ { ( \pmb { v } , \pmb { u } ) } \mathcal { M } ^ { \prime }$ . In particular, for a pair $( \pmb { v } , \pmb { u } ) \in \mathcal { M } ^ { \prime }$ of points, it is defined as
+
+$$
+\mathcal { T } _ { ( v , u ) } \mathcal { M } ^ { \prime } = \{ \pmb { w } \in \mathbb { R } ^ { N } : \overline { { \nabla } } V _ { k } ( \pmb { v } , \pmb { u } ) ^ { \top } \pmb { w } = 0 \mathrm { ~ f o r ~ } k = 1 , \ldots , K \} .
+$$
+
+186 If the finite difference $( \pmb { u } ^ { s + 1 } - \pmb { u } ^ { s } )$ between the predicted and current states is on the discrete
+187 tangent space $\mathcal { T } _ { \left( \pmb { u } ^ { s + 1 } , \pmb { u } ^ { s } \right) } \mathcal { M } ^ { \prime }$ , the first integrals $V _ { k }$ are preserved because $V _ { k } ( { \pmb u } ^ { s + 1 } ) - V _ { k } ( { \pmb u } ^ { s } ) =$
+188 $\overline { { \nabla } } V _ { k } ( \pmb { u } ^ { s + 1 } , \pmb { u } ^ { s } ) ^ { \top } ( \pmb { u } ^ { s + 1 } - \pmb { u } ^ { s } ) = 0$ . Note that similar concepts defined in different ways are also
+189 referred to as discrete tangent spaces [14, 16].
+
+Let ψˆ denote a discrete-time base model that satisfies u˜s+1−us∆ts 190 $\begin{array} { r } { \frac { \tilde { \mathbf { u } } ^ { s + 1 } - \mathbf { u } ^ { s } } { \Delta t ^ { s } } = \hat { \psi } ( \mathbf { u } ^ { s } ; \Delta t ^ { s } ) } \end{array}$ , where $\tilde { { \pmb u } } ^ { s + 1 }$ denotes 191 the predicted state. We assume that the base model $\hat { \psi }$ is composed of a continuous-time base model 192 ˆf and a numerical integrator. Then, the dFINDE us+1−∆ts $\begin{array} { r } { \frac { { \pmb u } ^ { s + 1 } - { \pmb u } ^ { s } } { \Delta t ^ { s } } = \psi ( { \pmb u } ^ { s + 1 } , { \pmb u } ^ { s } ; \Delta t ^ { s } ) } \end{array}$ is given by
+
+$$
+\psi ( \pmb { u } ^ { s + 1 } , \pmb { u } ^ { s } ; \Delta t ^ { s } ) = \hat { \psi } ( \pmb { u } ^ { s } ; \Delta t ^ { s } ) - \overline { { M } } ( \pmb { u } ^ { s + 1 } , \pmb { u } ^ { s } ) ^ { \top } \lambda ( \pmb { u } ^ { s + 1 } , \pmb { u } ^ { s } ) ,
+$$
+
+where 193 $\overline { { M } } ( { \pmb u } ^ { s + 1 } , { \pmb u } ^ { s } ) = ( \overline { { \nabla } } V _ { 1 } ( { \pmb u } ^ { s + 1 } , { \pmb u } ^ { s } )$ . . . $\overline { { \nabla } } V _ { K } ( \pmb { u } ^ { s + 1 } , \pmb { u } ^ { s } ) ) ^ { \top }$ . As is the case in continuous time, 194 the preservation of the first integrals $V _ { k }$ leads to
+
+$$
+\begin{array} { r } { \mathbf { 0 } = \frac { V ( u ^ { s + 1 } ) - V ( u ^ { s } ) } { \Delta t ^ { s } } = \overline { { M } } ( u ^ { s + 1 } , u ^ { s } ) \frac { u ^ { s + 1 } - u ^ { s } } { \Delta t ^ { s } } = \overline { { M } } ( u ^ { s + 1 } , u ^ { s } ) \psi ( u ^ { s + 1 } , u ^ { s } ; \Delta t ^ { s } ) . } \end{array}
+$$
+
+195 Substituting Eq. (9) and eliminating the Lagrange multiplier $\boldsymbol { \lambda }$ , we obtain
+
+$$
+\psi ( \pmb { u } ^ { s + 1 } , \pmb { u } ^ { s } ; \Delta t ^ { s } ) = ( I - \overline { { Y } } ( \pmb { u } ^ { s + 1 } , \pmb { u } ^ { s } ) ) \hat { \psi } ( \pmb { u } ^ { s } ; \Delta t ^ { s } )
+$$
+
+Remark 2 (discrete-time first integral preservation). The dFINDE us+1−us∆ts preserves all first integrals $V _ { k }$ for $k = 1 , \ldots , K$ in discrete time, i.e., $V _ { k } ( { \pmb u } ^ { s + 1 } ) - V _ { k } ( { \pmb u } ^ { s } ) = 0$ $\begin{array} { r } { \frac { { \pmb u } ^ { s + 1 } - { \pmb u } ^ { s } } { \Delta t ^ { s } } = \psi ( { \pmb u } ^ { s + 1 } , { \pmb u } ^ { s } ; \Delta t ^ { s } ) } \end{array}$
+
+198 Due to projection, dFINDE can be regarded as a projection method using discrete gradients. For the
+199 base model $\hat { \psi }$ , the continuous-time base model $\hat { f }$ can be a NODE, an HNN, or other models, and the
+200 numerical integrator can be a Runge–Kutta method, the leapfrog integrator, or others.
+201 Because dFINDE is an implicit method, it is computationally expensive for prediction. However, the
+202 next state $\boldsymbol { u } ^ { s + 1 }$ is given for training, and the ADDA can explicitly obtain the discrete gradient w.r.t. the
+203 pair $( { \pmb u } ^ { s + 1 } , { \pmb u } ^ { s } )$ as well as its computational graph. Thus, dFINDE can be computed explicitly and
+204 optimized by standard backpropagation algorithms. Moreover, we suppose that dFINDE projects
+205 the finite difference $\hat { \psi }$ only at every time step, whereas cFINDE projects the time-derivative $\hat { f }$ at
+206 every substep inside a numerical integrator. Therefore, dFINDE is less computationally expensive
+207 than cFINDE for training. In contrast, a typical projection method requires much computational
+208 cost to solve an optimization problem for training, and standard backpropagation algorithms are not
+209 applicable to it.
+10 Remark 3 (trainability). The dFINDE can be trained using the standard backpropagation algorithm,
+211 whereas a straightforward application of a projection method cannot.
+
+Table 2: Datasets, Dynamics, and First Integrals.
+
+
Dataset
Dynamics
N
First Integrals
Energy
Momentum
Mass
Constraint
Two-body problem
Canonical Hamiltonian
8
1
Discretized KdV equation
Non-canonical Hamiltonian
50
广
1
Double pendulum
Poisson
8
√
√
FitzHugh-Nagumo model
Dirac
4
√
+
+# 4 Experiments
+
+# 4.1 Experimental Settings
+
+Target Systems We evaluated FINDE and base models using datasets associated with first integrals, summarized in Table 2. A gravitational two-body problem (2-body) on a 2-dimensional configuration space is a typical Hamiltonian system in the canonical form. In addition to the total energy, it has first integrals related to symmetries in space, namely, the linear and angular momenta. The Korteweg–De Vries (KdV) equation is a PDE model of shallow water waves. This is a Hamiltonian system in a non-canonical form and has the Hamiltonian, total mass, and many other quantities as first integrals. A double pendulum (2-pend) is a Hamiltonian system in polar coordinates. However, we transformed it to Cartesian coordinates; it was no longer a Hamiltonian system but a Poisson system. The lengths of two rods work as holonomic constraints and lead to four first integrals. The FitzHugh–Nagumo model is a biological neuron model as an electric circuit, which exhibits a rapid and transient change of voltage called a spike. As an electric circuit, the currents through and voltages applied to the inductor and capacitor can be regarded as system states, and the states are constrained by the circuit topology and Kirchhoff’s current and voltage laws. Then, this system has a state of four elements and two first integrals. Due to energy dissipation in the resistor, the model is not a Poisson system, but one can find a Dirac structure [53]. See Appendix C for more details.
+
+Implementation We implemented the proposed FINDE and evaluated it under the following settings. We implemented all codes by modifying the officially released codes of HNN [26] 2 and DGNet $[ 3 8 ] ^ { 3 }$ . We used Python v3.8.12 with packages scipy v1.7.3, pytorch v1.10.2, torchdiffeq v0.1.1, functorch v1.10 preview, and gplearn v0.4.2. We used the Dormand–Prince method (dopri5) [18] as the numerical integrator, unless otherwise stated. All experiments were performed on a single NVIDIA A100 provided by (ANONYMOUS PROVIDER).
+
+Following HNN [26] and DGNet [38], we represented the first integrals $V$ , NODE, and HNN $H$ using fully-connected neural networks with two hidden layers. Each hidden layer had 200 units and preceded a hyperbolic tangent activation function. Each weight matrix was initialized as an orthogonal matrix. The input was the state $\textbf { \em u }$ , and the output represented the first integrals $V$ for FINDE, time-derivative $\hat { f }$ for NODE, and the Hamiltonian $H$ for HNN. For the KdV dataset, we used a 1-dimensional convolutional neural network (CNN), each of whose layers had a kernel size of 3. The double pendulum is a second–order system, implying that the time-derivative ddt q of the position $\pmb q$ is known as the velocity $\textbf { { v } }$ . Hence, we treated only the acceleration $\begin{array} { r } { \frac { \mathrm { d } } { \mathrm { d } t } \pmb { v } } \end{array}$ as the output to learn. This assumption slightly improved the absolute performances but did not change the relative trends.
+
+We used the $I$ -step error as the loss function to be minimized. In particular, it is the mean squared error (MSE) between the ground truth state $\pmb { u } _ { \mathrm { G T } } ^ { s }$ and the state $\pmb { u } _ { \mathrm { p r e d . } } ^ { s }$ . predicted from the previous step $u _ { \mathrm { G T } } ^ { s - 1 }$ . The base model and FINDE were jointly trained using the Adam optimizer [33] with the parameters $( \beta _ { 1 } , \beta _ { 2 } ) = ( 0 . 9 , 0 . 9 9 9 )$ and a batch size of 200. The learning rate was initialized to $1 0 ^ { - 3 }$ and decayed to zero with a cosine annealing [36].
+
+249 Evaluation Metric As an evaluation metric, we used the 1-step error, which is identical to the loss
+250 function. We displayed it at the scale of $\times 1 0 ^ { - 9 }$ . The lower this indicator, the better, as emphasized
+251 by $\downarrow$ . While several studies used the MSEs of the state or system energy over the whole time
+252 series [26, 38], we consider these indicators are misleading, as pointed in several studies [4]. For
+253 example, in the case of a periodic orbit, an orbit that is correctly learned except for a slight difference
+254 in angular velocity will have the same MSE as an orbit that never moves from its initial position.
+255 Instead, we used the valid prediction time $( V P T )$ [4, 32, 54]. VPT denotes the time point $s$ divided by
+256 the length $S$ of time series at which the MSE of the predicted state $\pmb { u } _ { \mathrm { p r e d . } } ^ { s }$ . exceeds a given threshold $\theta$
+257 for the first time in an initial value problem, that is,
+
+$$
+\begin{array} { r } { V P T ( u _ { \mathrm { p r e d . } } ; u _ { \mathrm { G T } } ) = \frac { 1 } { S } \arg \operatorname* { m a x } _ { s _ { f } } \{ s _ { f } | \mathrm { M S E } ( u _ { \mathrm { p r e d . } } ^ { s } , u _ { \mathrm { G T } } ^ { s } ) < \theta \mathrm { f o r } \mathrm { a l l } s \leq s _ { f } \} . } \end{array}
+$$
+
+258 To obtain VPTs, we normalized each element of state to have zero mean and unit variance in the
+259 training data and set $\theta$ to 0.01. The higher this indicator, the better, as emphasized by $\uparrow$ . Because of
+260 the “spiking” behavior of the FitzHugh–Nagumo model, a small error in phase is regarded as a large
+261 error in state. To measure the qualitative performance, we calculated VPTs by allowing for a delay
+262 and advance of up to 5 steps.
+
+# 4.2 First Integral Preservation for Hamiltonian System
+
+Before learning first integrals from data, we first evaluated FINDE as a numerical integrator using a known mass-spring system. The system has the state $\mathbf { \boldsymbol { \mathscr { u } } } \doteq ( q v ) ^ { \top }$ , the dynamics ddt q = v and d $\begin{array} { r } { { \frac { \mathrm { d } } { \mathrm { d } t } } v \ = - q } \end{array}$ , and the system energy $E ( q , v ) =$ ${ \scriptstyle { \frac { 1 } { 2 } } } ( q ^ { 2 } + v ^ { 2 } )$ . Using the initial value $( 1 . 0 \ 0 . 0 ) ^ { \top }$ and the time step size $\Delta t = 0 . 2$ , we solved the initial value problem of the true ODE using the leapfrog integrator. We applied FINDE with the true system energy $E$ as the first integral $V$ . Note that no neural networks nor training were involved.
+
+
+Figure 1: Integration of a known mass-spring system.
+
+273 The results with the analytical solution are shown in Fig. 1. The upper panel shows that the time series
+274 predicted by comparison methods overlap each other and are apparently almost identical. However,
+275 the lower panel shows that the energy obtained from the states predicted by the leapfrog integrator is
+276 fluctuating. The same is true for the case with the cFINDE. This is because the symplectic integrator
+277 and the cFINDE suffer from numerical errors caused by temporal discretization. In contrast, the
+278 dFINDE preserves the energy accurately. This is because, at every step, the dFINDE projects the state
+279 $( q v ) ^ { \top }$ onto the discrete tangent space $\mathcal { T } _ { ( \pmb { v } , \pmb { u } ) } \mathcal { M } ^ { \prime }$ . Although a smaller step size reduces numerical
+280 errors, this result demonstrates the advantage of dFINDE.
+
+# 281 4.3 Learning First Integrals from Data of Hamiltonian System
+
+82 We evaluated FINDE on learning from the 2-body dataset. We used HNN as the base model $\hat { f }$ . We
+83 found that the FINDE got better performances if it did not treat the Hamiltonian $H$ of the HNN
+84 as one of first integrals $V _ { k }$ . The medians and standard deviations of 5 trials are summarized in the
+85 leftmost column of Table 3. The cFINDE achieved better VPTs than the vanilla HNN with $K = 1$
+86 to 2, and the performance was suddenly degraded for $K = 3$ . The dFINDE showed a similar trend
+7 with slightly better performances. The HNN with FINDE found two first integrals in addition to the
+88 Hamiltonian $H$ of the HNN. Even though a two-body problem is a Hamiltonian system that HNN
+89 can learn, the prior knowledge that there exist first integrals other than the Hamiltonian $H$ can be
+90 a clue to better learning. The HNN with FINDE got worse 1-step errors, suggesting that without
+FINDE, HNN overfitted short-term change and had difficulty predicting long-term dynamics.
+
+We performed a symbolic regression of first integrals $V$ learned by the neural network. For $K = 2$ , the learned first integrals $V$ were identical to the linear momenta in the $x$ - and $y$ -directions up to affine transformation in most cases. See Appendix D.1 for more details.
+
+We depict example results in Fig. 2. In the absence of FINDE, the mass positions $( x _ { 1 } , y _ { 1 } ) , ( x _ { 2 } , y _ { 2 } )$ became inaccurate in a short time and the center-of-gravity position $\textstyle ( x _ { c } , y _ { c } ) = ( { \frac { x _ { 1 } + x _ { 2 } } { 2 } } , { \frac { y _ { 1 } + y _ { 2 } } { 2 } } )$ deviated rapidly. The HNN with cFINDE accurately predicted the state for a longer period. Even after errors in the mass positions became non-negligible, errors in the center-of-gravity position were still small. We show the absolute errors averaged over all trials in Fig. 3. In each of $x$ - and $y$ -directions,
+
+Table 3: Results of FINDE.
+
+
2-body + HNN
KdV
2-pend
FitzHugh-Nagumo
Model
K
1-step↓
VPT个
1-step↓
VPT个
1-step↓
VPT个
1-step↓
VPT个
base model -
5.17 ±0.57 0.362 ±0.026
5.59 ±0.30
0.339 ±0.038
0.82 ±0.02
0.110±0.035
73.66 ±12.59 0.236 ±0.053
+ cFINDE
1
7.10 ±1.25
0.374 ±0.036
6.24 ±0.44
0.371 ±0.088
0.75 ±0.04
0.156±0.042
54.18 ±8.12
0.127 ±0.148
2
7.78 ±1.39
0.450 ±0.052
2.59 ±0.11
0.608 ±0.085
0.73±0.05
0.198 ±0.088
37.03 ±3.81
0.437 ±0.084
3
>103
0.147 ±0.146*
3.19 ±0.37
0.730 ±0.091
0.69 ±0.03
0.411 ±0.093
>106
0.007 ±0.007*
4
>103
0.101 ±0.005
3.65 ±0.30
0.641 ±0.071
0.77 ±0.07
0.395 ±0.083
一
5
>103
0.080±0.014
4.68 ±0.43
0.601 ±0.069
0.80±0.07
0.585 ±0.097
6
>10³
0.070 ±0.019
7.79 ±0.51
0.425 ±0.067
12.53±0.00
0.005 ±0.000*
+ dFINDE
1
7.01 ±1.06
0.379 ±0.040
11.61 ±6.60
0.288 ±0.083
0.75 ±0.10
0.152 ±0.017
47.07 ±8.03
0.117 ±0.122
2
7.03 ±1.00
0.475 ±0.022
2.70 ±0.26
0.598 ±0.059
0.74±0.05
0.271 ±0.111
33.24 ±3.40
0.455 ±0.032
3 54.78 ±36.39 0.309 ±0.024
3.78±0.27
0.636 ±0.024
0.69±0.05
0.447 ±0.081
319.70 ±91.11 0.049 ±0.007
4
>10
0.102 ±0.015
3.48±0.32
0.780 ±0.059
0.71 ±0.03
0.454 ±0.060
5
>103
0.086±0.011*
5.26 ±0.15
0.718±0.038
0.86 ±0.09
0.591 ±0.087
6
>103
0.059 ±0.017
9.60 ±3.61
0.573 ±0.121 58.88 ±22.98 0.037 ±0.039
+
+A standard deviation follows $\pm$ symbol. Underlines indicate results better than the base models’ results, and bolded fonts indicate the best results. ∗ denotes that some trials failed in training because of the underflow of the step size. A dash denotes a case we did not try.
+
+
+Figure 2: Example results of the 2-body dataset.
+
+
+Figure 3: Mean absolute errors of states for the 2-body dataset with or without cFINDE.
+
+300 the HNN without FINDE produced errors in the center-of-gravity position $x _ { c }$ (or $y _ { c }$ ) and those in the
+301 mass positions $x _ { 1 } , x _ { 2 }$ (or $y _ { 1 } , y _ { 2 } )$ at almost the same level. In contrast, when the cFINDE is present,
+302 errors in the center-of-gravity position were much smaller than those in the mass positions, implying
+303 that errors in one mass position canceled out errors in the other mass position.
+
+Therefore, we conclude that FINDE not only had better prediction accuracy but also found and preserved linear momenta (which are related to symmetries in space) more accurately despite not having prior knowledge about symmetries.
+
+# 307 4.4 Learning First Integrals from Data of Unknown Systems
+
+308 It is often unclear whether a target system is a Hamiltonian system or not, but one can expect that the
+309 target system has several first integrals. We evaluated FINDE using NODE as the base model. We
+310 summarized the results in Table 3.
+311 For the KdV dataset, the NODE with FINDE got much better 1-step errors and VPTs for a wide
+312 range of $K$ . Figure 4 shows an example result. The top panels show that the prediction results were
+313 apparently similar. The bottom panels summarize mean absolute errors in states $\textbf { \em u }$ , total mass $\textstyle \sum _ { k } u _ { k }$
+314 and energy. In the absence of FINDE, the NODE increased all of its errors in proportion to time. With
+315 the cFINDE, the error in total mass increased at the point where the two solitons collided but then
+316 returned to the original level. Although the calculation is slightly inaccurate, the cFINDE learned
+317 to preserve the total mass. The rightmost panel shows that the error in energy continued to increase
+318 for $K = 2$ , but it stayed within a small range for $K = 3$ . These results suggest that the first or
+319 second quantity learned by the cFINDE was total mass, the third quantity was system energy, and the
+320 remaining quantity may correspond to one of the many first integrals of the KdV equation.
+321 For the 2-pend dataset, the NODE with FINDE got better 1-step errors and VPTs for $K = 1$ to 5
+322 except for the 1-step error of the dFINDE with $K = 5$ . In addition to the system energy, the double
+323 pendulum has two holonomic constraints on the position, which lead to two additional constraints
+324 involving the velocity (see Appendix C for details). Thus, it is reasonable that the NODE with FINDE
+325 got the best VPTs for $K = 5$ first integrals and totally failed when assuming $K > 5$ first integrals.
+326 As exemplified in Fig. 5, the NODE without FINDE did not preserve the lengths of rods, making
+327 the states deviate gradually. See Appendix D.2 for the case when actual constraints are known. For
+328 the FitzHugh–Nagumo dataset, the NODE with FINDE got much better 1-step errors and VPTs for
+329 $K = 2$ . As exemplified in Fig. 6, the ground truth state converged to a periodic orbit, and only the
+330 NODE with cFINDE for $K = 2$ reproduced such dynamics. On the other hand, the state did not
+331 stay at a limited region without FINDE and converged to a wrong equilibrium with the cFINDE for
+332 $K = 1$ . For $K = 1$ , the sole quantity $V _ { 1 }$ may have tried to learn both of the two first integrals and
+333 remained under-trained. In these two cases, FINDE found all first integrals; $K = 5$ for the 2-pend
+334 dataset and $K = 2$ for the FitzHugh–Nagumo dataset.
+
+
+Figure 4: Example results of the KdV dataset. (top) Predicted states. Red belts denote moving solitons. (bottom) Mean absolute errors.
+
+
+Figure 5: Example results of the 2-pend dataset for 2,000 steps.
+
+
+Figure 6: Example results of the FitzHugh–Nagumo dataset.
+
+# 335 5 Conclusion
+
+This study proposed first integral-preserving neural differential equation (FINDE). FINDE projects the time evolution onto the submanifold defined using the (discrete) gradients of first integrals represented by a neural network. With an appropriate number of assumed first integrals, FINDE predicted future states more accurately than base models. Not only that, FINDE found and preserved the system energy and the total mass as first integrals, first integrals related to symmetries in space, and first integrals led by constraints in a unified manner. Therefore, FINDE has the potential to make a scientific discovery by revealing unknown properties of target dynamical systems.
+
+The 1-step errors were on the order of $1 0 ^ { - 5 }$ to $1 0 ^ { - 4 }$ in absolute error, being much larger than the numerical error tolerance of $1 0 ^ { - 9 }$ used in the experiments; numerical errors were negligible compared to modeling errors. However, the dFINDE tended to get VPTs better than the cFINDE despite the fact that its advantage is to eliminate numerical errors caused by temporal discretization. This result suggests that a method leading to smaller numerical errors results in a model with smaller modeling errors. Similar tendencies have been observed in previous works [10, 38], and these results may form a new frontier for integrating numerical and modeling errors.
+
+# References
+
+[1] Abadi, M., Agarwal, A., Barham, P., Brevdo, E., Chen, Z., Citro, C., Corrado, G. S., Davis, A., Dean, J., Devin, M., Ghemawat, S., Goodfellow, I., Harp, A., Irving, G., Isard, M., Jozefowicz, R., Jia, Y., Kaiser, L., Kudlur, M., Levenberg, J., Mané, D., Schuster, M., Monga, R., Moore, S., Murray, D., Olah, C., Shlens, J., Steiner, B., Sutskever, I., Talwar, K., Tucker, P., Vanhoucke, V., Vasudevan, V., Viégas, F., Vinyals, O., Warden, P., Wattenberg, M., Wicke, M., Yu, Y., and Zheng, X. (2016). TensorFlow: Large-scale machine learning on heterogeneous systems. USENIX Symposium on Operating Systems Design and Implementation (OSDI).
+58 [2] Bai, S., Kolter, J. Z., and Koltun, V. (2019). Deep Equilibrium Models. In Advances in Neural Information Processing Systems (NeurIPS).
+60 [3] Barrett, D. G. T. and Dherin, B. (2021). Implicit Gradient Regularization. In International Conference on Learning Representations (ICLR).
+[4] Botev, A., Jaegle, A., Wirnsberger, P., Hennes, D., and Higgins, I. (2021). Which priors matter? Benchmarking models for learning latent dynamics. In Advances in Neural Information Processing Systems (NeurIPS) Track on Datasets and Benchmarks. [5] Cao, Y., Fang, Z., Wu, Y., Zhou, D. X., and Gu, Q. (2021). Towards Understanding the Spectral Bias of Deep Learning. International Joint Conference on Artificial Intelligence (IJCAI), pages 2205–2211.
+7 [6] Celledoni, E., Grimm, V., McLachlan, R., McLaren, D., O’Neale, D., Owren, B., and Quispel, G. (2012). Preserving energy resp. dissipation in numerical PDEs using the “Average Vector Field” method. Journal of Computational Physics, 231(20):6770–6789. [7] Chen, S., Billings, S. A., and Grant, P. M. (1990). Non-linear system identification using neural networks. International Journal of Control, 51(6):1191–1214. [8] Chen, T. Q., Rubanova, Y., Bettencourt, J., Duvenaud, D., Chen, R. T. Q., Rubanova, Y., Bettencourt, J., and Duvenaud, D. (2018). Neural Ordinary Differential Equations. In Advances in Neural Information Processing Systems (NeurIPS), pages 1–19. [9] Chen, Y., Matsubara, T., and Yaguchi, T. (2021). Neural Symplectic Form $:$ Learning Hamiltonian Equations on General Coordinate Systems. In Advances in Neural Information Processing Systems (NeurIPS). [10] Chen, Z., Zhang, J., Arjovsky, M., and Bottou, L. (2020). Symplectic Recurrent Neural Networks. In International Conference on Learning Representations (ICLR), pages 1–23. [11] Christiansen, S. H., Munthe-Kaas, H. Z., and Owren, B. (2011). Topics in structure-preserving discretization. Acta Numerica, 20:1–119. [12] Clouse, D. S., Giles, C. L., Horne, B. G., and Cottrell, G. W. (1997). Time-delay neural networks: representation and induction of finite-state machines. IEEE Transactions on Neural Networks, 8(5):1065–70. [13] Cranmer, M., Greydanus, S., Hoyer, S., Battaglia, P., Spergel, D., and Ho, S. (2020). Lagrangian Neural Networks. In ICLR Deep Differential Equations Workshop, pages 1–9. [14] Cuell, C. and Patrick, G. W. (2009). Geometric discrete analogues of tangent bundles and constrained Lagrangian systems. Journal of Geometry and Physics, 59(7):976–997. [15] Dahlby, M., Owren, B., and Yaguchi, T. (2011). Preserving multiple first integrals by discrete gradients. Journal of Physics A: Mathematical and Theoretical, 44(30). [16] Dehmamy, N., Walters, R., Liu, Y., Wang, D., and Yu, R. (2021). Automatic Symmetry Discovery with Lie Algebra Convolutional Network. In Advances in Neural Information Processing Systems (NeurIPS), number 2018, pages 1–30. [17] Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. (2018). BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. arXiv, pages 1–15. [18] Dormand, J. R. and Prince, P. J. (1986). A reconsideration of some embedded Runge-Kutta formulae. Journal of Computational and Applied Mathematics, 15(2):203–211. [19] Finzi, M., Stanton, S., Izmailov, P., and Wilson, A. G. (2020a). Generalizing Convolutional Neural Networks for Equivariance to Lie Groups on Arbitrary Continuous Data. In International Conference on Machine Learning (ICML), pages 3146–3157.
+[20] Finzi, M., Wang, K. A., and Wilson, A. G. (2020b). Simplifying Hamiltonian and Lagrangian Neural Networks via Explicit Constraints. In Advances in Neural Information Processing Systems (NeurIPS).
+[21] Finzi, M., Welling, M., and Wilson, A. G. (2021). A Practical Method for Constructing Equivariant Multilayer Perceptrons for Arbitrary Matrix Groups. In International Conference on Machine Learning (ICML).
+[22] Furihata, D. (2001). A stable and conservative finite difference scheme for the Cahn-Hilliard equation. Numerische Mathematik, 87(4):675–699.
+[23] Furihata, D. and Matsuo, T. (2010). Discrete Variational Derivative Method: A Structure-Preserving Numerical Method for Partial Differential Equations. Chapman and Hall/CRC.
+[24] Gear, C. W. (1986). Maintaining Solution Invariants in the Numerical Solution of ODE s. SIAM Journal on Scientific and Statistical Computing, 7(3):734–743.
+[25] Gonzalez, O. (1996). Time integration and discrete Hamiltonian systems. Journal of Nonlinear Science, 6(5):449–467.
+[26] Greydanus, S., Dzamba, M., and Yosinski, J. (2019). Hamiltonian Neural Networks. In Advances in Neural Information Processing Systems (NeurIPS), pages 1–16.
+[27] Hairer, E., Lubich, C., and Wanner, G. (2006). Geometric Numerical Integration: Structure-Preserving Algorithms for Ordinary Differential Equations, volume 31 of Springer Series in Computational Mathematics. Springer-Verlag, Berlin/Heidelberg.
+[28] He, K., Zhang, X., Ren, S., and Sun, J. (2016). Deep Residual Learning for Image Recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1–9.
+[29] Hong, J., Zhai, S., and Zhang, J. (2011). Discrete Gradient Approach to Stochastic Differential Equations with a Conserved Quantity. SIAM Journal on Numerical Analysis, 49(5):2017–2038.
+[30] Izhikevich, E. M. and FitzHugh, R. (2006). FitzHugh-Nagumo model.
+[31] Jin, P., Zhang, Z., Kevrekidis, I. G., and Karniadakis, G. E. (2020a). Learning Poisson systems and trajectories of autonomous systems via Poisson neural networks. pages 1–12.
+[32] Jin, P., Zhu, A., Karniadakis, G. E., and Tang, Y. (2020b). Symplectic networks: Intrinsic structurepreserving networks for identifying Hamiltonian systems. Neural Networks, 132:166–179.
+[33] Kingma, D. P. and Ba, J. (2015). Adam: A Method for Stochastic Optimization. In International Conference on Learning Representations (ICLR), pages 1–15.
+[34] Lee, K. and Carlberg, K. (2021). Deep Conservation: A latent-dynamics model for exact satisfaction of physical conservation laws. In AAAI Conference on Artificial Intelligence (AAAI).
+[35] Levin, A. U. and Narendra, K. S. (1995). Recursive identification using feedforward neural networks. International Journal of Control, 61(3):533–547.
+[36] Loshchilov, I. and Hutter, F. (2017). SGDR: Stochastic gradient descent with warm restarts. In International Conference on Learning Representations (ICLR), pages 1–16.
+[37] Manek, G. and Kolter, J. Z. (2019). Learning Stable Deep Dynamics Models. In Advances in Neural Information Processing Systems (NeurIPS), pages 1–9.
+[38] Matsubara, T., Ishikawa, A., and Yaguchi, T. (2020). Deep Energy-Based Modeling of Discrete-Time Physics. In Advances in Neural Information Processing Systems (NeurIPS).
+[39] Miura, R. M., Gardner, C. S., and Kruskal, M. D. (1968). Korteweg-de Vries equation and generalizations. II. Existence of conservation laws and constants of motion. Journal of Mathematical Physics, 9(8):1204–1209.
+[40] Narendra, K. S. and Parthasarathy, K. (1990). Identification and Control of Dynamical Systems Using Neural Networks. IEEE Transactions on Neural Networks, 1(1):4–27.
+[41] Nelles, O. (2001). Nonlinear System Identification. Springer Berlin Heidelberg, Berlin, Heidelberg.
+[42] Paszke, A., Chanan, G., Lin, Z., Gross, S., Yang, E., Antiga, L., and Devito, Z. (2017). Automatic differentiation in PyTorch. In Autodiff Workshop on Advances in Neural Information Processing Systems, pages 1–4.
+
+446 [43] Potra, F. A. and Yen, J. (1991). Implicit numerical integration for euler-lagrange equations via tangent
+447 space parametrization. Mechanics of Structures and Machines, 19(1):77–98.
+448 [44] Quispel, G. R. and Capel, H. W. (1996). Solving ODEs numerically while preserving a first integral.
+449 Physics Letters, Section A: General, Atomic and Solid State Physics, 218(3-6):223–228.
+450 [45] Quispel, G. R. and Turner, G. S. (1996). Discrete gradient methods for solving ODEs numerically while
+451 preserving a first integral. Journal of Physics A: Mathematical and General, 29(13).
+452 [46] Raff, L., Komanduri, R., Hagan, M., and Bukkapatnam, S. (2012). Neural Networks in Chemical Reaction
+453 Dynamics.
+454 [47] Rasp, S., Dueben, P. D., Scher, S., Weyn, J. A., Mouatadid, S., and Thuerey, N. (2020). WeatherBench: A
+455 Benchmark Data Set for Data-Driven Weather Forecasting. Journal of Advances in Modeling Earth Systems,
+456 12(11).
+457 [48] Sannai, A., Imaizumi, M., and Kawano, M. (2021). Improved Generalization Bounds of Group Invariant
+458 / Equivariant Deep Networks via Quotient Feature Spaces. In Conference on Uncertainty in Artificial
+459 Intelligence (UAI).
+460 [49] Sjöberg, J., Hjalmarsson, H., and Ljung, L. (1994). Neural Networks in System Identification. IFAC
+461 Proceedings Volumes, 27(8):359–382.
+462 [50] Takeishi, N. and Kawahara, Y. (2020). Learning dynamics models with stable invariant sets. In AAAI
+463 Conference on Artificial Intelligence (AAAI).
+464 [51] Teshima, T., Tojo, K., Ikeda, M., Ishikawa, I., and Oono, K. (2020). Universal Approximation Property
+465 of Neural Ordinary Differential Equations. In NeurIPS Workshop on Differential Geometry meets Deep
+466 Learning (DiffGeo4DL).
+467 [52] Trigo, R. M. and Palutikof, J. P. (1999). Simulation of daily temperatures for climate change scenarios
+468 over Portugal: A neural network model approach. Climate Research, 13(1):45–59.
+469 [53] van der Schaft, A. and Jeltsema, D. (2014). Port-Hamiltonian Systems Theory: An Introductory Overview.
+470 Foundations and Trends® in Systems and Control, 1(2):173–378.
+471 [54] Vlachas, P. R., Pathak, J., Hunt, B. R., Sapsis, T. P., Girvan, M., Ott, E., and Koumoutsakos, P. (2020).
+472 Backpropagation algorithms and Reservoir Computing in Recurrent Neural Networks for the forecasting of
+473 complex spatiotemporal dynamics. Neural Networks, 126:191–217.
+474 [55] Wang, Y. J. and Lin, C. T. (1998). Runge-Kutta neural network for identification of dynamical systems in
+475 high accuracy. IEEE Transactions on Neural Networks, 9(2):294–307.
+476 [56] Zhong, G. and Marsden, J. E. (1988). Lie-Poisson Hamilton-Jacobi Theory and Lie-Poisson Integrators.
+477 Physics Letters A, 133(3):3–8.
+478 [57] Zhong, Y. D., Dey, B., and Chakraborty, A. (2020). Dissipative SymODEN: Encoding Hamiltonian
+479 Dynamics with Dissipation and Control into Deep Learning. arXiv, pages 1–6.
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] The theoretical contributions are summarized in Remarks 1 and 2. The performance improvements were validated numerically in Table 3 and visually in Figs. 1–6.
+(b) Did you describe the limitations of your work? [Yes] We have discussed an increase in computational complexity at the bottoms of Sections 3.1 and 3.2. We also presented the limitations in Appendix D.2 while their situations were originally outside the scope of the proposed method.
+(c) Did you discuss any potential negative societal impacts of your work? [N/A] No societal impact is supposed.
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [N/A] We have read the guidelines carefully, but no ethical impact is supposed.
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [Yes] We have introduced the background of the proposed method and provided the full set of assumptions in Section 2. Even though a slight modification may make the proposed method available on a general manifold, we have clearly stated that our theoretical and experimental results were limited to the finite-dimensional Eucleadian spaces.
+(b) Did you include complete proofs of all theoretical results? [Yes] We have provided a proof just before each of Remarks 1 and 2.
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We have enclosed the source code to reproduce all experiments in supplemental materials.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We have provided the software and hardware environment, network architectures, and hyperparameters in Section 4.1. We have also provided detailed hyperparameters to generate datasets in Appendix C.
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] We have summarized the standard deviations over five trials in Table 3.
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] We have provided the hardware environment in Section 4.1, but we have anonymized the cloud service providers to avoid a potential violation of the double-blind policy.
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes] We have made the source code for all experiments by modifying the source codes of HNN [26] and DGNet [38]. We have cited these references and added links to respective repositories in the footnotes.
+(b) Did you mention the license of the assets? [Yes] We have verified that the source codes of HNN [26] and DGNet [38] are provided in Apache-2.0 License and MIT License, respectively. We have clearly stated these facts in the footnotes.
+(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We have enclosed the source code to generate datasets in supplemental materials.
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+
+534 (b) Did you describe any potential participant risks, with links to Institutional Review
+535 Board (IRB) approvals, if applicable? [N/A]
+536 (c) Did you include the estimated hourly wage paid to participants and the total amount
+537 spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/xENf4QUL4LW/xENf4QUL4LW.md b/md/dev/xENf4QUL4LW/xENf4QUL4LW.md
new file mode 100644
index 0000000000000000000000000000000000000000..0ac493f1cd8c30ea3035ce047f912097c4acb05d
--- /dev/null
+++ b/md/dev/xENf4QUL4LW/xENf4QUL4LW.md
@@ -0,0 +1,663 @@
+# SAMPLE SELECTION WITH UNCERTAINTY OF LOSSES FOR LEARNING WITH NOISY LABELS
+
+Xiaobo Xia1 Tongliang $\mathbf { L i u ^ { \mathrm { 1 \dagger } } }$ Bo Han2
+Mingming Gong3 Jun $\mathbf { V } \mathbf { u } ^ { 4 }$ Gang $\mathbf { N i u ^ { \mathrm { 5 } } }$ Masashi Sugiyama5,6
+1TML Lab, The University of Sydney 2Hong Kong Baptist University
+3The University of Melbourne 4University of Science and Technology of China
+5RIKEN AIP 6The University of Tokyo
+
+# ABSTRACT
+
+In learning with noisy labels, the sample selection approach is very popular, which regards small-loss data as correctly labeled during training. However, losses are generated on-the-fly based on the model being trained with noisy labels, and thus large-loss data are likely but not certain to be incorrect. There are actually two possibilities of a large-loss data point: (a) it is mislabeled, and then its loss decreases slower than other data, since deep neural networks “learn patterns first”; (b) it belongs to an underrepresented group of data and has not been selected yet. In this paper, we incorporate the uncertainty of losses by adopting interval estimation instead of point estimation of losses, where lower bounds of the confidence intervals of losses derived from distribution-free concentration inequalities, but not losses themselves, are used for sample selection. In this way, we also give large-loss but less selected data a try; then, we can better distinguish between the cases (a) and (b) by seeing if the losses effectively decrease with the uncertainty after the try. As a result, we can better explore underrepresented data that are correctly labeled but seem to be mislabeled at first glance. Experiments demonstrate that the proposed method is superior to baselines and robust to a broad range of label noise types.
+
+# 1 INTRODUCTION
+
+Learning with noisy labels is one of the most challenging problems in weakly-supervised learning, since noisy labels are ubiquitous in the real world (Mirzasoleiman et al., 2020; Yu et al., 2019; Nishi et al., 2021; Arazo et al., 2019; Yang et al., 2021a; Bai & Liu, 2021). For instance, both crowdsourcing and web crawling yield large numbers of noisy labels everyday (Han et al., 2018). Noisy labels can severely impair the performance of deep neural networks with strong memorization capacities (Zhang et al., 2017; Zhang & Sabuncu, 2018; Pleiss et al., 2020; Lukasik et al., 2020; Chen et al., 2022).
+
+To reduce the influence of noisy labels, a lot of approaches have been recently proposed (Natarajan et al., 2013; Liu & Tao, 2016; Ma et al., 2018; Yang et al., 2021b; Zheng et al., 2020; Xia et al., 2019; 2020; Tanaka et al., 2018; Malach & Shalev-Shwartz, 2017; Li et al., 2020b; Menon et al., 2018; Thekumparampil et al., 2018; Xu et al., 2019; Kim et al., 2019; Jiang et al., 2020; Harutyunyan et al., 2020). They can be generally divided into two main categories. The first one is to estimate the noise transition matrix (Patrini et al., 2017; Shu et al., 2020; Hendrycks et al., 2018; Yang et al., 2021c; Wu et al., 2022), which denotes the probabilities that clean labels flip into noisy labels. However, the noise transition matrix is hard to be estimated accurately, especially when the number of classes is large (Yu et al., 2019). The second approach is sample selection, which is our focus in this paper. This approach is based on selecting possibly clean examples from a mini-batch for training (Han et al., 2018; Wang et al., 2018; Yao et al., 2020a; Wang et al., 2019; Yu et al., 2019; Lee et al., 2019; Wang et al., 2019; Yao et al., 2022). Intuitively, if we can exploit less noisy data for network parameter updates, the network will be more robust.
+
+A major question in sample selection is what criteria can be used to select possibly clean examples. At the present stage, the selection based on the small-loss criteria is the most common method, and has been verified to be effective in many circumstances (Han et al., 2018; Jiang et al., 2018; Yu et al.,
+
+
+
+
+Figure 1: Illustrations of uncertainty of losses. Experiments are conducted on the imbalanced noisy MNIST dataset. Left: uncertainty of small-loss examples. At the beginning of training (Epochs 1 and 2), due to the instability of the current prediction, the network gives a larger loss to the clean example and does not select it for updates. If we consider the mean of training losses at different epochs, the clean example can be equipped with a smaller loss and then selected for updates. Right: uncertainty of large-loss examples. Since the deep network learns easy examples at the beginning of training, it gives a large loss to clean imbalanced data with non-dominant labels, which causes such data unable to be selected and severely influence generalization.
+
+2019; Wei et al., 2020; Yao et al., 2020a). Specifically, since deep networks learn patterns first (Arpit et al., 2017), they would first memorize training data of clean labels and then those of noisy labels with the assumption that clean labels are of the majority in a noisy class. Small-loss examples can thus be regarded as clean examples with high probability. Therefore, in each iteration, prior methods (Han et al., 2018; Wei et al., 2020) select the small-loss examples based on the predictions of the current network for robust training.
+
+However, such a selection procedure is debatable, since it arguably does not consider uncertainty in selection. The uncertainty comes from two aspects. First, this procedure has uncertainty about small-loss examples. Specifically, the procedure uses limited time intervals and only exploits the losses provided by the current predictions. For this reason, the estimation for the noisy class posterior is unstable (Yao et al., 2020b), which causes the network predictions to be equally unstable. It thus takes huge risks to only use losses provided by the current predictions (Figure 1, left). Once wrong selection is made, the inferiority of accumulated errors will arise (Yu et al., 2019). Second, this procedure has uncertainty about large-loss examples. To be specific, deep networks learn easy examples at the beginning of training, but ignore some clean examples with large losses. Nevertheless, such examples are always critical for generalization. For instance, when learning with imbalanced data, distinguishing the examples with non-dominant labels are more pivotal during training (Menon et al., 2020; Wei et al., 2021). Deep networks often give large losses to such examples (Figure 1, right). Therefore, when learning under the realistic scenes, e.g., learning with noisy imbalanced data, prior sample selection methods cannot address such an issue well.
+
+To relieve the above issues, we study the uncertainty of losses in the sample selection procedure to combat noisy labels. To reduce the uncertainty of small-loss examples, we extend time intervals and utilize the mean of training losses at different training iterations. In consideration of the bad influence of mislabeled data on training losses, we build two robust mean estimators from the perspectives of soft truncation and hard truncation w.r.t. the truncation level, respectively. Soft truncation makes the mean estimation more robust by holistically changing the behavior of losses. Hard truncation makes the mean estimation more robust by locally removing outliers from losses. To reduce the uncertainty of large-loss examples, we encourage networks to pick the sample that has not been selected in a conservative way. Furthermore, to address the two issues simultaneously, we derive concentration inequalities (Boucheron et al., 2013) for robust mean estimation and further employ statistical confidence bounds (Auer, 2002) to consider the number of times an example was selected during training.
+
+The study of uncertainty of losses in learning with noisy labels can be justified as follows. In statistical learning, it is known that uncertainty is related to the quality of data (Vapnik, 2013). Philosophically, we need variety decrease for selected data and variety search for unselected data, which share a common objective, i.e., reduce the uncertainty of data to improve generalization (Moore, 1990). This is our original intention, since noisy labels could bring more uncertainty because of the low quality of noisy data. Nevertheless, due to the harm of noisy labels for generalization, we need to strike a good balance between variety decrease and search. Technically, our method is specially designed for handling noisy labels, which robustly uses network predictions and conservatively seeks less selected examples meanwhile to reduce the uncertainty of losses and then generalize well.
+
+Before delving into details, we clearly emphasize our contributions in two folds. First, we reveal prior sample selection criteria in learning with noisy labels have some potential weaknesses and discuss them in detail. The new selection criteria are then proposed with detailed theoretical analyses. Second, we experimentally validate the proposed method on both synthetic noisy balanced/imbalanced datasets and real-world noisy datasets, on which it achieves superior robustness compared with the stateof-the-art methods in learning with noisy labels. The rest of the paper is organized as follows. In Section 2, we propose our robust learning paradigm step by step. Experimental results are discussed in Section 3. The conclusion is given in Section 4.
+
+# 2 METHOD
+
+In this section, we first introduce the problem setting and some background (Section 2.1). Then we discuss how to exploit training losses at different iterations (Section 2.2). Finally, we introduce the proposed method, which exploits training losses at different iterations more robustly and encourages networks to pick the sample that is less selected but could be correctly labeled (Section 2.3).
+
+# 2.1 PRELIMINARIES
+
+Let $\mathcal { X }$ and $\mathcal { V }$ be the input and output spaces. Consider a $k$ -class classification problem, i.e., $\mathcal { V } = [ k ]$ , where $[ k ] = \{ 1 , \dots , k \}$ . In learning with noisy labels, the training data are all sampled from a corrupted distribution on $\mathcal { X } \times \mathcal { V }$ . We are given a sample with noisy labels, i.e., $\tilde { S } = \{ ( \mathbf { x } , \tilde { y } ) \}$ , where $\tilde { y }$ is the noisy label. The aim is to learn a robust classifier that could assign clean labels to test data by only exploiting a training sample with noisy labels.
+
+Let $f : \mathcal { X } \to \mathbb { R } ^ { k }$ be the classifier with learnable parameters w. At the $i$ -th iteration during training, the parameters of the classifier $f$ can be denoted as $\mathbf { w } _ { i }$ . Let $\ell : \mathbb { R } ^ { k } \times \mathcal { Y } \mathbb { R }$ be a surrogate loss function for $k$ -class classification. We exploit the softmax cross entropy loss in this paper. Given an arbitrary training example $( \mathbf { x } , \tilde { y } )$ , at the $i$ -th iteration, we can obtain a loss $\ell _ { i }$ , i.e., $\ell _ { i } = \bar { \ell ( } f ( \mathbf { w } _ { i } ; \mathbf { x } ) , \tilde { y } )$ . Hence, until the $t$ -th iteration, we can obtain a training loss set $L _ { t }$ about the example $( \mathbf { x } , \tilde { y } )$ , i.e., $L _ { t } = \{ \ell _ { 1 } , \ldots , \ell _ { t } \}$ .
+
+In this paper, we assume that the training losses in $L _ { t }$ conform to a Markov process, which is to represent a changing system under the assumption that future states only depend on the current state (the Markov property). More specifically, at the $i$ -th iteration, if we exploit an optimization algorithm for parameter updates (e.g., the stochastic gradient descent algorithm (Bottou, 2012)) and omit other dependencies (e.g., $\tilde { S }$ ), we will have $P ( \mathbf { w } _ { i } | \mathbf { w } _ { i - 1 } , \ldots , \mathbf { w } _ { 0 } ) = P ( \mathbf { w } _ { i } | \mathbf { w } _ { i - 1 } )$ , which means that the future state of the classifier $f$ only depends on the current state. Furthermore, given a training example and the parameters of the classifier $f$ , we can determine the loss of the training example as discussed. Therefore, the training losses in $L _ { t }$ will also conform to a Markov process.
+
+# 2.2 EXTENDED TIME INTERVALS
+
+As limited time interval cannot address the instability issue of the estimation for the noisy class posterior well (Pleiss et al., 2020), we extend time intervals and exploit the training losses at different training iterations for sample selection. One straightforward idea is to use the mean of training losses at different training iterations. Hence, the selection criterion could be
+
+$$
+\tilde { \mu } = \frac { 1 } { t } \sum _ { i = 1 } ^ { t } \ell _ { i } .
+$$
+
+It is intuitive and reasonable to use such a selection criterion for sample selection, since the operation of averaging can mitigate the risks caused by the unstable estimation for the noisy class posterior, following better generalization. Nevertheless, such a method could arguably achieve suboptimal classification performance for learning with noisy labels. The main reason is that, due to the great harm of mislabeled data, part of training losses are with too large uncertainty and could be seen as outliers. Therefore, it could be biased to use the mean of training losses consisting of such outliers (Diakonikolas et al., 2020), which further influences sample selection. More evaluations for our claims are provided in Section 3.
+
+# 2.3 ROBUST MEAN ESTIMATION AND CONSERVATIVE SEARCH
+
+We extend time intervals and meanwhile exploit the training losses at different training iterations more robustly. Specifically, we build two robust mean estimators from the perspectives of soft truncation and hard truncation (Catoni, 2012). Note that for specific tasks, it is feasible to decide the types of robust mean estimation with statistical tests based on some assumptions (Chakrabarty & Samorodnitsky, 2012). We leave the analysis as future work. Two distribution-free robust mean estimators are introduced as follows.
+
+Soft truncation. We extend a classical M-estimator from (Catoni, 2012) and exploit the widest possible choice of the influence function. More specifically, give a random variable $X$ , let us consider a non-decreasing influence function $\psi : \mathbb { R } \to \mathbb { R }$ such that
+
+$$
+\psi ( X ) = \log ( 1 + X + X ^ { 2 } / 2 ) , X \geq 0 .
+$$
+
+The choice of $\psi$ is inspired by the Taylor expansion of the exponential function, which can make the estimation results more robust by reducing the side effect of extremum holistically. The illustration for this influence function is provided in Appendix A.1. For our task, given the observations on training losses, i.e., $L _ { t } = \{ \ell _ { 1 } , \ldots , \ell _ { t } \}$ , we estimate the mean robustly as follows:
+
+$$
+\tilde { \mu } _ { s } = \frac { 1 } { t } \sum _ { i = 1 } ^ { t } \psi ( \ell _ { i } ) .
+$$
+
+We term the above robust mean estimator (3) the soft estimator.
+
+Hard truncation. We propose a new robust mean estimator based on hard truncation. Specifically, given the observations on training losses $L _ { t }$ , we first exploit the $\mathbf { K }$ -nearest neighbor (KNN) algorithm (Liao & Vemuri, 2002) to remove some underlying outliers in $L _ { t }$ . The number of outliers is denoted by $t _ { \mathrm { o } } ( t _ { \mathrm { o } } < t )$ , which can be adaptively determined as discussed in (Zhao et al., 2019). Note that we can also employ other algorithms, e.g., principal component analysis (Shyu et al., 2003) and the local outlier factor (Breunig et al., 2000), to identify underlying outliers in $L _ { t }$ . The main reason we employ KNN is because of its relatively low computation costs (Zhao et al., 2019).
+
+The truncated loss observations on training losses are denoted by $L _ { t - t _ { \mathrm { o } } }$ . We then utilize $L _ { t - t _ { \mathrm { o } } }$ for the mean estimation. As the potential outliers are removed with high probability, the robustness of the estimation results will be enhanced. We denote such an estimated mean as $\tilde { \mu } _ { h }$ . We have
+
+$$
+\tilde { \mu } _ { h } = \frac { 1 } { t - t _ { \mathrm { o } } } \sum _ { \ell _ { i } \in L _ { t - t _ { \mathrm { o } } } } \ell _ { i } .
+$$
+
+The corresponding estimator (4) is termed the hard estimator.
+
+We derive concentration inequalities for the soft and hard estimators respectively. The search strategy for less selected examples and overall selection criterion are then provided. Note that we do not need to explicitly quantify the mean of training losses. We only need to sort the training examples based on the proposed selection criterion and then use the selected examples for robust training.
+
+Theorem 1 Let $Z _ { n } = \{ z _ { 1 } , \cdot \cdot \cdot , z _ { n } \}$ be an observation set with mean $\mu _ { z }$ and variance $\sigma ^ { 2 }$ . By exploiting the non-decreasing influence function $\psi ( z ) = \log ( 1 + z + z ^ { 2 } / 2 )$ . For any $\epsilon > 0$ , we have
+
+$$
+\left| \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \psi ( z _ { i } ) - \mu _ { z } \right| \leq \frac { \sigma ^ { 2 } ( n + \frac { \sigma ^ { 2 } \log ( \epsilon ^ { - 1 } ) } { n ^ { 2 } } ) } { n - \sigma ^ { 2 } } ,
+$$
+
+with probability at least $1 - 2 \epsilon$ .
+
+Proof can be found in Appendix A.1.
+
+Theorem 2 Let $Z _ { n } = \{ z _ { 1 } , \ldots , z _ { n } \}$ be a (not necessarily time homogeneous) Markov chain with mean $\mu _ { z }$ , taking values in a Polish state space $\Lambda _ { 1 } \times \ldots \times \Lambda _ { n }$ , and with a minimal mixing time $\tau _ { \mathrm { m i n } }$ The truncated set with hard truncation is denoted by $Z _ { n _ { o } }$ , with $n _ { o } < n . \ I f { \mid } z _ { i } { \mid }$ is upper bounded by $Z$ For any $\epsilon _ { 1 } > 0$ and $\epsilon _ { 2 } > 0$ , we have
+
+$$
+\left| \frac { 1 } { n - n _ { o } } \sum _ { z _ { i } \in Z _ { n } \setminus Z _ { n _ { o } } } - \mu _ { z } \right| \leq \frac { 1 } { n - n _ { o } } \left( 2 Z \sqrt { 2 \tau _ { \mathrm { m i n } } \log \frac { 2 } { \epsilon _ { 1 } } } + \frac { 2 Z n _ { o } } { n } \sqrt { 2 \tau _ { \mathrm { m i n } } \log \frac { 2 n } { \epsilon _ { 2 } } } \right) ,
+$$
+
+with probability at least $1 - \epsilon _ { 1 } - \epsilon _ { 2 }$
+
+Proof can be found in Appendix A.2. For our task, let the training loss be upper-bounded by $L$ . The value of $L$ can be determined easily by training networks on noisy datasets and observing the loss distribution (Arazo et al., 2019).
+
+Conservative search and selection criteria. In this paper, we will use the concentration inequalities (5) and (6) to present conservative search and the overall sample selection criterion. Specifically, we exploit their lower bounds and consider the selected number of examples during training. The selection of the examples that are less selected is encouraged.
+
+Denote the number of times one example was selected by $n _ { t } ( n _ { t } ~ \leq ~ t )$ . Let $\begin{array} { r } { \epsilon = \frac { 1 } { 2 t } } \end{array}$ . For the
+
+$$
+\ell _ { s } ^ { \star } = \tilde { \mu } _ { s } - \frac { \sigma ^ { 2 } ( t + \frac { \sigma ^ { 2 } \log ( 2 t ) } { t ^ { 2 } } ) } { n _ { t } - \sigma ^ { 2 } } .
+$$
+
+Let $\begin{array} { r } { \epsilon _ { 1 } = \epsilon _ { 2 } = \frac { 1 } { 2 t } } \end{array}$ , for the situation with hard truncation, by rewriting (6), the selection criterion is
+
+$$
+\ell _ { h } ^ { \star } = \tilde { \mu } _ { h } - \frac { 2 \sqrt { 2 \tau _ { \mathrm { m i n } } } L ( t + \sqrt { 2 } t _ { \mathrm { o } } ) } { ( t - t _ { \mathrm { o } } ) \sqrt { t } } \sqrt { \frac { \log ( 4 t ) } { n _ { t } } } .
+$$
+
+Note that we directly replace $t$ with $n _ { t }$ . If an example is rarely selected during training, $n _ { t }$ will be far less than $n$ , which causes the lower bounds to change drastically. Hence, we do not use the mean of all training losses, but use the mean of training losses in fixed-length time intervals. More details about this can be checked in Section 3.
+
+For the selection criteria (7) and (8), we can see that they consist of two terms and have one term with a minus sign. The first term in Eq. (7) (or Eq. (8)) is to reduce the uncertainty of small-loss examples, where we use robust mean estimation on training losses. The second term, i.e., the statistical confidence bound, is to encourage the network to choose the less selected examples (with a small $n _ { t }$ ). The two terms are constraining and balanced with $\sigma ^ { 2 }$ or $\tau _ { \mathrm { m i n } }$ . To avoid introducing strong assumptions on the underlying distribution of losses (Chakrabarty & Samorodnitsky, 2012), we tune $\sigma$ and $\tau _ { \mathrm { m i n } }$ with a noisy validation set. For the mislabeled data, although the model has high uncertainties on them (i.e., a small $n _ { t }$ ) and tends to pick them, the overfitting to the mislabeled data is harmful. Also, the mislabeled data and clean data are rather hard to distinguish in some cases as discussed. Thus, we should search underlying clean data in a conservative way. In this paper, we initialize $\sigma$ and $\tau _ { \mathrm { m i n } }$ with small values. This way can reduce the adverse effects of mislabeled data and meanwhile select the clean examples with large losses, which helps generalize. More evaluations will be presented in Section 3.
+
+# Algorithm 1 CNLCU Algorithm.
+
+1: Input $\theta _ { 1 }$ and $\theta _ { 2 }$ , learning rate $\eta$ , fixed $\tau$ , epoch $T _ { k }$ and $T _ { \mathrm { m a x } }$ , iteration $t _ { \mathrm { m a x } }$ ; for $T = 1 , 2 , \dots , T _ { \mathrm { m a x } } \mathbf { d o }$
+2: Shuffle training dataset $\tilde { S }$ ; for $t = 1 , \ldots , t _ { \operatorname* { m a x } } \cdot$ do
+3: Fetch mini-batch $\bar { S }$ from $\tilde { S }$ ;
+4: Obtain $\bar { S } _ { 1 } = \arg \operatorname* { m i n } _ { S ^ { \prime } : | S ^ { \prime } | \geq R ( T ) | \bar { S } | } \ell ^ { \star } ( \theta _ { 1 } , S ^ { \prime } )$ ; // calculated with Eq. (7) or Eq. (8)
+5: Obtain $\bar { S } _ { 2 } = \mathrm { a r g } \operatorname* { m i n } _ { S ^ { \prime } : | S ^ { \prime } | \geq R ( T ) | \bar { S } | } \ell ^ { \star } ( \theta _ { 2 } , S ^ { \prime } )$ ; // calculated with Eq. (7) or Eq. (8)
+6: Update $\theta _ { 1 } = \theta _ { 1 } - \eta \nabla \ell ( \theta _ { 1 } , \bar { S } _ { 2 } )$ ;
+7: Update $\theta _ { 2 } = \theta _ { 2 } - \eta \nabla \ell ( \theta _ { 2 } , \bar { S } _ { 1 } )$ ; end
+8: Update $\begin{array} { r } { R ( T ) = 1 - \operatorname* { m i n } \left\{ \frac { T } { T _ { k } } \tau , \tau \right\} } \end{array}$ ;
+
+The overall procedure of the proposed method, which combats noisy labels by concerning uncertainty (CNLCU), is provided in Algorithm 1. CNLCU works in a mini-batch manner since all deep learning training methods are based on stochastic gradient descent. Following (Han et al., 2018), we exploit two networks with parameters $\theta _ { 1 }$ and $\theta _ { 2 }$ respectively to teach each other. Specifically, when a mini-batch $\bar { S }$ is formed (Step 3), we let two networks select a small proportion of examples in this mini-batch with Eq. (7) or (8) (Step 4 and Step 5). The number of instances is controlled by the function $R ( T )$ , and two networks only select $R ( T )$ percentage of examples out of the mini-batch. The value of $R ( T )$ should be larger at the beginning of end 9: Output $\theta _ { 1 }$ and $\theta _ { 2 }$ .
+
+training, and be smaller when the number of epochs goes large, which can make better use of memorization effects of deep networks (Han et al., 2018) for sample selection. Then, the selected instances are fed into its peer network for parameter updates (Step 6 and Step 7).
+
+# 3 EXPERIMENTS
+
+In this section, we evaluate the robustness of our proposed method to noisy labels with comprehensive experiments on the synthetic balanced noisy datasets (Section 3.1), synthetic imbalanced noisy datasets (Section 3.2), and real-world noisy dataset (Section 3.3).
+
+# 3.1 EXPERIMENTS ON SYNTHETIC BALANCED NOISY DATASETS
+
+Datasets. We verify the effectiveness of our method on the manually corrupted version of the following datasets: MNIST (LeCun et al.), $F$ -MNIST (Xiao et al., 2017), CIFAR-10 (Krizhevsky, 2009), and CIFAR-100 (Krizhevsky, 2009), because these datasets are popularly used for the evaluation of learning with noisy labels in the literature (Han et al., 2018; Yu et al., 2019; Wu et al., 2021; Lee et al., 2019). The four datasets are class-balanced. The important statistics of the used synthetic datasets are summarized in Appendix B.1.
+
+Generating noisy labels. We consider broad types of label noise: (1). Symmetric noise (abbreviated as Sym.) (Wu et al., 2020; Ma et al., 2018). (2) Asymmetric noise (abbreviated as Asym.) (Ma et al., 2020; Xia et al., 2021; Wei et al., 2020). (3) Pairflip noise (abbreviated as Pair.) (Han et al., 2018; Yu et al., 2019; Zheng et al., 2020). (4). Tridiagonal noise (abbreviated as Trid.) (Zhang et al., 2021). (5). Instance noise (abbreviated as Ins.) (Cheng et al., 2020; Xia et al., 2020). The noise rate is set to $20 \%$ and $40 \%$ to ensure clean labels are diagonally dominant (Ma et al., 2020). More details about above noise are provided in Appendix B.1. We leave out $10 \%$ of noisy training examples as a validation set.
+
+Baselines. We compare the proposed method (Algorithm 1) with following methods which focus on sample selection, and implement all methods with default parameters by PyTorch, and conduct all the experiments on NVIDIA Titan Xp GPUs. (1). S2E (Yao et al., 2020a), which properly controls the sample selection process so that deep networks can better benefit from the memorization effects. (2). MentorNet (Jiang et al., 2018), which learns a curriculum to filter out noisy data. We use self-paced MentorNet in this paper. (3). Co-teaching (Han et al., 2018), which trains two networks simultaneously and cross-updates parameters of peer networks. (4). SIGUA (Han et al., 2020), which exploits stochastic integrated gradient underweighted ascent to handle noisy labels. We use self-teaching SIGUA in this paper. (5). JoCor (Wei et al., 2020), which reduces the diversity of networks to improve robustness. To avoid too dense tables, we provide results of other sample selection methods and other types of baselines such as adding regularization. All results are presented in Appendix B.2. Here, we term our methods with soft truncation and hard truncation as CNLCU-S and CNLCU-H respectively.
+
+Network structure and optimizer. For MNIST, $F$ -MNIST, and CIFAR-10, we use a 9-layer CNN structure from (Han et al., 2018). Due to the limited space, the experimental details on CIFAR-100 are provided in Appendix B.3. All network structures we used here are standard test beds for weaklysupervised learning. For all experiments, the Adam optimizer (Kingma & Ba, 2014) (momentum $_ { 1 = 0 . 9 }$ ) is used with an initial learning rate of 0.001, and the batch size is set to 128 and we run 200 epochs. We linearly decay learning rate to zero from 80 to 200 epochs as did in (Han et al., 2018). We take two networks with the same architecture but different initializations as two classifiers as did in (Han et al., 2018; Yu et al., 2019; Wei et al., 2020), since even with the same network and optimization method, different initializations can lead to different local optimal (Han et al., 2018). The details of network structures can be checked in Appendix C.
+
+For the hyper-parameters $\sigma ^ { 2 }$ and $\tau _ { \mathrm { m i n } }$ , we determine them in the range $\{ 1 0 ^ { - 1 } , 1 0 ^ { - 2 } , 1 0 ^ { - 3 } , 1 0 ^ { - 4 } \}$ with a noisy validation set. Note that the use of hyperparameters aims to reduce the dependency on strong assumptions and thus make our methods perform well in practice. We provide more details about this in Appendix D. Here, we assume the noise level $\tau$ is known and set $R ( T ) =$ $\begin{array} { r } { 1 - \operatorname* { m i n } \{ \frac { T } { T _ { k } } \tau , \tau \} } \end{array}$ with ${ \mathit { T } } _ { k } { = } 1 0$ . If $\tau$ is not known in advanced, it can be inferred using validation sets (Liu & Tao, 2016; Yu et al., 2018). As for performance measurement, we use test accuracy, i.e., test accuracy $=$ (# of correct prediction) / (# of testing). All experiments are repeated five times. We report the mean and standard deviation of experimental results.
+
+Experimental results. The experimental results about test accuracy are provided in Tables 1, 2, and 3. Specifically, for MNIST, as can be seen, our proposed methods, i.e., CNLCU-S and CNLCU-H, produce the best results in the vast majority of cases. In some cases such as asymmetric noise, the baseline S2E outperforms ours, which benefits the accurate estimation for the number of selected small-loss examples. For $F$ -MNIST, the training data becomes complicated. S2E cannot achieve the accurate estimation in such situation and thus has no great performance like it got on MNIST. Our methods achieve varying degrees of lead over baselines. For CIFAR-10, our methods once again outperforms all the baseline methods. Although some baseline, e.g., Co-teaching, can work well in some cases, experimental results show that it cannot handle various noise types. In contrast, the proposed methods achieve superior robustness against broad noise types. The results mean that our methods can be better applied to actual scenarios, where the noise is diversiform.
+
+Table 1: Test accuracy $( \% )$ on MNIST over the last ten epochs. The best two results are in bold.
+
+
Noise type
Sym.
Asym.
Pair.
Trid.
Ins.
Method/Noise
20%
40%
20%
40%
20%
40%
20%
40%
20%
40%
S2E
98.46 ±0.06
95.62 ±0.91
99.05 ±0.02
98.45 ±0.26
98.56 ±0.32
94.22 ±0.79
99.02 ±0.09
97.23 ±1.26
97.93 ±1.26
94.02 ±2.39
MentorNet
95.04 ±0.03
92.08 ±0.42
96.32 ±0.17
90.86 ±0.97
93.19 ±0.17
90.93 ±1.54
96.42 ±0.09
93.28 ±1.37
94.65 士0.73
90.11 ±1.26
Co-teaching
97.53 ±0.12
95.62 ±0.30
98.25 ±0.08
95.08 ±0.43
96.05 ±0.96
94.16 ±1.37
98.05 ±0.06
96.18 士0.85
97.96 ±0.09
95.02 ±0.39
SIGUA
92.31 ±1.10
91.88 ±0.92
93.96 ±0.82
62.59 ±0.15
93.77 ±1.40
86.22 ±1.75
94.92 ±0.83
83.46 ±2.98
92.90 士1.82
86.34 ±3.51
JoCor
98.42 ±0.14
98.04 ±0.07
98.05 士0.37
94.55 ±1.08
98.01 ±0.19
96.85 ±0.43
98.45 ±0.17
96.98 ±0.25
98.62 ±0.06
96.07 ±0.31
CNLCU-S
98.82 ±0.03
98.31 ±0.05
98.93 ±0.06
97.67
98.86
97.71
99.09
98.02
98.77
97.78 士0.25
CNLCU-H
98.70 ±0.06
98.24 ±0.06
99.01 ±0.04
±0.22 98.01
±0.06 98.44 ±0.19
±0.64 97.37 ±0.32
±0.04 98.89 ±0.15
±0.17 97.92
±0.08 98.74
97.42 ±0.39
+
+
Noise type
Sym.
Asym.
Pair.
Trid.
Ins.
Method/Noise
20%
40%
20%
40%
20%
40%
20%
40%
20%
40%
S2E
89.99 ±2.07
75.32 ±5.84
89.00
81.03
88.66
67.09
89.53
77.29
88.65
79.35
MentorNet
90.37
86.53
±0.95 89.69
±1.93 67.21
±1.32 87.92
±4.03 83.70
±2.63
±3.97
±2.12
±3.04 83.27
88.74
85.63
87.52
Co-teaching
±0.17
±0.65
±0.19
±2.94
±1.08
±0.49
±0.33
±0.59
±0.15
±1.42
91.48
88.80
91.03
68.07
90.77
86.91
91.24
89.18
90.60
87.90
SIGUA
±0.10
±0.29
±0.14
士4.58
±0.23
±0.71
±0.11
±0.36
±0.12
士0.45
87.64
87.23
76.97
45.96
69.59
68.93
79.97
76.14
76.92
74.89
JoCor
±1.29
±0.72
±2.59
±3.40
±5.75
±2.80
士3.23
士4.24
±5.09
±4.84
91.97
89.96
90.95
79.79
91.52
87.40
92.01
89.42
91.43
87.59
±0.13
±0.19
±0.21
±2.39
±0.24
±0.58
±0.17
±0.33
±0.71
±0.94
92.37
91.45
92.57
83.14
92.04
88.20
92.24
90.08
91.69
89.02
CNLCU-S
±0.15
±0.28
±0.15
±1.77
±0.26
±0.44
±0.17
±0.34
±0.10
±1.02
92.42
91.60
92.60
82.69
91.70
87.70
92.33
90.22
91.50
88.79
CNLCU-H
±0.21
±0.19
±0.18
士0.43
±0.18
±0.69
±0.26
±0.71
±0.21
±1.22
+
+Table 2: Test accuracy on $F$ -MNIST over the last ten epochs. The best two results are in bold.
+
+Ablation study. We first conduct the ablation study to analyze the sensitivity of the length of time intervals. In order to avoid too dense figures, we exploit MNIST and $F$ -MNIST with the mentioned noise settings as representative examples. For CNLCU-S, the length of time intervals is chosen in the range from 3 to 8. For CNLCU-H, the length of time intervals is chosen in the range from 10 to 15. Note that the reason for their different lengths is that their different mechanisms. Specifically, CNLCU-S holistically changes the behavior of losses, but does not remove any loss from the loss set. We thus do not need too long length of time intervals. As a comparison, CNLCU-H needs to remove some outliers from the loss set as discussed. The length should be longer to guarantee the number of examples available for robust mean estimation. The experimental results are provided in Appendix B.4, which show the proposed CNLCU-S and CNLCU-H are robust to the choices of the length of time intervals. Such robustness to hyperparameters means our methods can be applied in practice and does not need too much effect to tune the hyperparameters.
+
+Furthermore, since our methods concern uncertainty from two aspects, i.e., the uncertainty from both small-loss and large-loss examples, we conduct experiments to analyze each part of our methods. Also, as mentioned, we compare robust mean estimation with non-robust mean estimation when learning with noisy labels. More details are provided in Appendix B.4.
+
+
Noise type
Sym.
Asym.
Pair.
Trid.
Ins.
Method/Noise
20%
40%
20%
40%
20%
40%
20%
40%
20%
40%
S2E
80.78
69.72
84.03
75.04
81.72
61.50
81.44
64.39
79.89
62.42
±0.88
±3.94
±1.01
±1.24
±0.93
士4.63
±0.59
±2.82
±0.26
±3.11
MentorNet
80.92
74.67
80.37
71.69
77.98
69.39
78.02
71.56
77.02
68.17
±0.48
±1.17
±0.26
±1.06
±0.31
±1.73
±0.29
±0.93
±0.71
±2.52
Co-teaching
82.35
77.96
83.87
73.43
80.94
72.81
81.17
74.37
79.92
73.29
±0.16
±0.39
±0.24
±0.62
±0.46
±0.92
±0.60
±0.64
±0.57
±1.62
SIGUA
78.19
77.67
75.14
52.76
74.41
61.91
75.75
74.05
74.34
67.98
±0.22
±0.41
士0.36
±0.68
±0.81
±5.27
±0.53
士0.41
±0.39
±1.34
JoCor
80.96
76.65
81.39
69.92
80.33
71.62
79.03
74.33
78.21
71.46
±0.25
±0.43
±0.74
±1.63
±0.20
±1.05
±0.13
±1.09
±0.34
±1.27
CNLCU-S
83.03
78.25
85.06
75.34
83.16
73.19
82.77
74.37
82.03
73.67
±0.21
±0.70
±0.17
±0.32
士0.25
±1.25
±0.32
±1.37
±0.37
±1.09
CNLCU-H
83.03
78.33
84.95
75.29
83.39
73.40
82.52
74.79
81.93
73.58
±0.47
±0.50
±0.27
±0.80
±0.68
±1.53
±0.71
±1.13
±0.25
±1.39
+
+Table 3: Test accuracy $( \% )$ on CIFAR-10 over the last ten epochs. The best two results are in bold.
+
+# 3.2 EXPERIMENTS ON SYNTHETIC IMBALANCED NOISY DATASETS
+
+Experimental setup. We exploit MNIST and $F$ -MNIST. For these two datasets, we reduce the number of training examples along with the labels from $ { { } ^ { 6 } } 0 ^ { 9 }$ to $" 4 "$ to $1 \%$ of previous numbers. We term such synthetic imbalanced noisy datasets as IM-MNIST and IM- $F$ -MNIST respectively. This setting aims to simulate the extremely imbalanced circumstance, which is common in practice. Moreover, we exploit asymmetric noise, since these types of noise can produce more imbalanced case (Patrini et al., 2017; Ma et al., 2020). Other settings such as the network structure and optimizer are the same as those in experiments on synthetic balanced noisy datasets.
+
+As for performance measurements, we use test accuracy. In addition, we exploit the selected ratio of training examples with the imbalanced classes, i.e., selected ratio $\scriptstyle = ( { \# }$ of selected imbalanced labels / # of all selected labels). Intuitively, a higher selected ratio means the proposed method can make better use of training examples with the imbalanced classes, following better generalization (Kang et al., 2020).
+
+Experimental results. The test accuracy achieved on IM-MNIST and IM-F-MNIST is presented in Figure 2. Recall the experimental results in Tables 1 and 2, we can see that the imbalanced issue is catastrophic to the sample selection approach when learning with noisy labels. For IM-MNIST, as can be seen, all the baselines have serious overfitting in the early stages of training. The curves of test accuracy drop dramatically. As a comparison, the proposed CNLCU-S and CNLCU-H can give a try to large-loss but less selected data which are possible to be clean but equipped with imbalanced labels. Therefore, our methods always outperform baselines clearly. In the case of Asym. $10 \%$ , our methods achieve nearly $30 \%$ lead over baselines. For IM-F-MNIST, we can also see that our methods perform well and always achieve about $5 \%$ lead over all the baselines. Note that due to the huge challenge of this task, some baseline, e.g., S2E, has a large error bar. In addition, the baseline SIGUA performs badly. It is because SIGUA exploits stochastic integrated gradient underweighted ascent on large-loss examples, which makes the examples with imbalanced classes more difficult to be selected than them in other sample selection methods. Due to the limited space, the selected ratio achieved on IM-MNIST and IM- $F$ -MNIST is presented in Appendix B.5, which explain well why our methods perform better than multiple baselines.
+
+# 3.3 EXPERIMENTS ON REAL-WORLD NOISY DATASETS
+
+Experimental setup. To verify the efficacy of our methods in the real-world scenario, we conduct experiments on the noisy dataset Clothing1M (Xiao et al., 2015). Specifically, for experiments on Clothing1M, we use the 1M images with noisy labels for training and $1 0 \mathrm { k }$ clean data for test respectively. Note that we do not use the 50k clean training data in all the experiments. For preprocessing, we resize the image to $2 5 6 \times 2 5 6$ , crop the middle $2 2 4 \times 2 2 4$ as input, and perform normalization. The experiments on Clothing1M are performed once due to the huge computational cost. We leave $10 \%$ noisy training data as a validation set for model selection. Note that we do not exploit the resampling trick during training (Li et al., 2020a). Here, Best denotes the test accuracy of the epoch where the validation accuracy was optimal. Last denotes test accuracy of the last epoch. For the experiments on Clothing1M, we use ResNet-18 and ResNet-50 which are pretrained on ImageNet. We also use the Adam optimizer and set the batch size to 64. During the training stage, we run 15 epochs in total and set the learning rate $8 \times 1 0 ^ { - 4 }$ , $5 \times 1 0 ^ { - 4 }$ , and $5 \times 1 0 ^ { - 5 }$ for 5 epochs each.
+
+
+Figure 2: Test accuracy vs. number of epochs on IM-MNIST and IM- $F$ -MNIST. The error bar for standard deviation in each figure has been shaded.
+
+Experimental results. The results on Clothing1M are provided in Table 4. Specifically, the proposed methods get better results than state-of-the-art methods on Best. With ResNet-18, we achieve improvements of $+ 1 . 2 8 \%$ and $+ 0 . 9 9 \%$ . With ResNet-50, we achieve improvements of $+ 2 . 5 1 \%$ and $+ 2 . 1 6 \%$ . Likewise, the proposed methods outperform all the baselines on Last. We achieve improvements of $+ 1 . 0 1 \%$ and $+ 0 . 5 4 \%$ with ResNet-18, and improvements of $+ 2 . 4 7 \%$ and $+ 2 . 0 5 \%$ with ResNet-50. All these results verify the effectiveness of the proposed methods.
+
+
Methods
S2E
MentorNet
Co-teaching
SIGUA
JoCor
CNLCU-S
CNLCU-H
Best (R-18)
67.34
68.36
69.37
62.89
70.09
71.37
71.08
Last (R-18)
65.90
67.42
68.62
58.73
69.75
70.76
70.29
Best (R-50)
68.03
67.25
67.94
65.37
69.06
71.57
71.22
Last (R-50)
66.25
66.59
67.05
60.77
68.41
70.88
70.46
+
+Table 4: Test accuracy $( \% )$ on Clothing1M. “R-18” (resp. “R-50”) means that we exploit ResNet-18 (resp. ResNet-50). The best two results are in bold.
+
+
Methods
Food-101
WebVision (Mini)
Clothing1M
DivideMix
86.73
77.32
74.76
DivideMix-S
86.92
77.53
74.90
DivideMix-H
86.88
77.48
74.82
+
+Combining with semi-supervised learning. For combating noisy labels in real-world noisy datasets, the stateof-the-art methods, e.g., DivideMix (Li et al., 2020a), always employ the semi-supervised learning technology. As our methods mainly focus on sample selection, to make the comparison fair, we combine our methods with
+
+Table 5: The test accuracy $( \% )$ on three real-world datasets. DivideMix-S (resp. DivideMix-H) means that our CNLCU-S (resp. CNLCU-H) is combined with the advanced techniques in DivideMix. The best two results are in bold.
+
+semi-supervised learning. The sample selection procedure in DivideMix is replaced by our methods. Other settings are kept the same. Following prior works (Ma et al., 2020), the experiments are conducted on three real-world noisy datasets, i.e., Food-101 (Bossard et al., 2014), WebVision (Mini) (Li et al., 2017), and Clothing1M (Xiao et al., 2015). The results are provided in Table 5. As can be seen, the proposed methods are superior and can be used to improve the cutting edge performance.
+
+# 4 CONCLUSION
+
+In this paper, we focus on promoting the prior sample selection in learning with noisy labels, which starts from concerning the uncertainty of losses during training. We robustly use the training losses at different iterations to reduce the uncertainty of small-loss examples, and adopt confidence interval estimation to reduce the uncertainty of large-loss examples. Experiments are conducted on benchmark datasets, demonstrating the effectiveness of our method. We believe that this paper opens up new possibilities in the topics of using sample selection to handle noisy labels, especially in improving the robustness of models on imbalanced noisy datasets.
+
+# 5 ETHICS STATEMENT
+
+This paper doesn’t raise any ethics concerns. This study doesn’t involve any human subjects, practices to data set releases, potentially harmful insights, methodologies and applications, potential conflicts of interest and sponsorship, discrimination/bias/fairness concerns, privacy and security issues, legal compliance, and research integrity issues.
+
+# ACKNOWLEDGMENT
+
+XBX is supported by Australian Research Council Projects DE-190101473. TLL is partially supported by Australian Research Council Projects DE-190101473, IC-190100031, and DP-220102121. BH was supported by the RGC Early Career Scheme No. 22200720 and NSFC Young Scientists Fund No. 62006202. MMG is supported by Australian Research Council Projects DE-210101624. JY is sponsored by CAAI-Huawei MindSpore Open Fund (CAAIXSJLJJ-2021-016B). GN and MS are supported by JST AIP Acceleration Research Grant Number JPMJCR20U3, Japan. MS is also supported by the Institute for AI and Beyond, UTokyo.
+
+# REFERENCES
+
+Eric Arazo, Diego Ortego, Paul Albert, Noel O’Connor, and Kevin McGuinness. Unsupervised label noise modeling and loss correction. In ICML, pp. 312–321, 2019.
+
+Devansh Arpit, Stanisław Jastrz˛ebski, Nicolas Ballas, David Krueger, Emmanuel Bengio, Maxinder S Kanwal, Tegan Maharaj, Asja Fischer, Aaron Courville, Yoshua Bengio, et al. A closer look at memorization in deep networks. In ICML, pp. 233–242, 2017.
+
+Peter Auer. Using confidence bounds for exploitation-exploration trade-offs. Journal of Machine Learning Research, 3(Nov):397–422, 2002.
+
+Yingbin Bai and Tongliang Liu. Me-momentum: Extracting hard confident examples from noisily labeled data. In ICCV, pp. 9312–9321, 2021.
+
+Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101–mining discriminative components with random forests. In ECCV, pp. 446–461, 2014.
+
+Léon Bottou. Stochastic gradient descent tricks. In Neural networks: Tricks of the trade, pp. 421–436. Springer, 2012.
+
+Stéphane Boucheron, Gábor Lugosi, and Pascal Massart. Concentration inequalities: A nonasymptotic theory of independence. Oxford university press, 2013.
+
+Markus M Breunig, Hans-Peter Kriegel, Raymond T Ng, and Jörg Sander. Lof: identifying densitybased local outliers. In SIGMOD, pp. 93–104, 2000.
+
+Olivier Catoni. Challenging the empirical mean and empirical variance: a deviation study. In Annales de l’IHP Probabilités et statistiques, volume 48, pp. 1148–1185, 2012.
+
+Arijit Chakrabarty and Gennady Samorodnitsky. Understanding heavy tails in a bounded world or, is a truncated heavy tail heavy or not? Stochastic models, 28(1):109–143, 2012.
+
+Haw-Shiuan Chang, Erik Learned-Miller, and Andrew McCallum. Active bias: Training more accurate neural networks by emphasizing high variance samples. In NeurIPS, pp. 1002–1012, 2017.
+
+Ling-Hao Chen, He Li, and Wenhao Yang. Anomman: Detect anomaly on multi-view attributed networks. arXiv preprint arXiv:2201.02822, 2022.
+
+Peng Chen, Xinghu Jin, Xiang Li, and Lihu Xu. A generalized catoni’s $m$ -estimator under finite $\alpha$ -th moment assumption with $\alpha \in ( 1 , 2 )$ . arXiv preprint arXiv:2010.05008, 2020.
+
+Pengfei Chen, Ben Ben Liao, Guangyong Chen, and Shengyu Zhang. Understanding and utilizing deep neural networks trained with noisy labels. In ICML, pp. 1062–1070, 2019.
+
+Jiacheng Cheng, Tongliang Liu, Kotagiri Ramamohanarao, and Dacheng Tao. Learning with bounded instance-and label-dependent label noise. In ICML, 2020.
+
+Ilias Diakonikolas and Daniel M Kane. Recent advances in algorithmic high-dimensional robust statistics. arXiv preprint arXiv:1911.05911, 2019.
+
+Ilias Diakonikolas, Daniel M Kane, and Ankit Pensia. Outlier robust mean estimation with subgaussian rates via stability. arXiv preprint arXiv:2007.15618, 2020.
+
+Evarist Giné, Rafał Latała, and Joel Zinn. Exponential and moment inequalities for u-statistics. In High Dimensional Probability II, pp. 13–38. Springer, 2000.
+
+Bo Han, Quanming Yao, Xingrui Yu, Gang Niu, Miao Xu, Weihua Hu, Ivor Tsang, and Masashi Sugiyama. Co-teaching: Robust training of deep neural networks with extremely noisy labels. In NeurIPS, pp. 8527–8537, 2018.
+
+Bo Han, Gang Niu, Xingrui Yu, Quanming Yao, Miao Xu, Ivor Tsang, and Masashi Sugiyama. Sigua: Forgetting may make learning with noisy labels more robust. In ICML, pp. 4006–4016, 2020.
+
+Hrayr Harutyunyan, Kyle Reing, Greg Ver Steeg, and Aram Galstyan. Improving generalization by controlling label-noise information in neural network weights. In ICML, pp. 4071–4081, 2020.
+
+Dan Hendrycks, Mantas Mazeika, Duncan Wilson, and Kevin Gimpel. Using trusted data to train deep networks on labels corrupted by severe noise. In NeurIPS, 2018.
+
+Lu Jiang, Zhengyuan Zhou, Thomas Leung, Li-Jia Li, and Li Fei-Fei. MentorNet: Learning datadriven curriculum for very deep neural networks on corrupted labels. In ICML, pp. 2309–2318, 2018.
+
+Lu Jiang, Di Huang, Mason Liu, and Weilong Yang. Beyond synthetic noise: Deep learning on controlled noisy labels. In ICML, pp. 4804–4815, 2020.
+
+Bingyi Kang, Saining Xie, Marcus Rohrbach, Zhicheng Yan, Albert Gordo, Jiashi Feng, and Yannis Kalantidis. Decoupling representation and classifier for long-tailed recognition. In ICLR, 2020.
+
+Youngdong Kim, Junho Yim, Juseung Yun, and Junmo Kim. Nlnl: Negative learning for noisy labels. In ICCV, pp. 101–110, 2019.
+
+Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
+
+Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
+
+Yann LeCun, Corinna Cortes, and Christopher J.C. Burges. The MNIST database of handwritten digits. http://yann.lecun.com/exdb/mnist/.
+
+Kimin Lee, Sukmin Yun, Kibok Lee, Honglak Lee, Bo Li, and Jinwoo Shin. Robust inference via generative classifiers for handling noisy labels. In ICML, pp. 3763–3772, 2019.
+
+Junnan Li, Richard Socher, and Steven C.H. Hoi. Dividemix: Learning with noisy labels as semisupervised learning. In ICLR, 2020a.
+
+Mingchen Li, Mahdi Soltanolkotabi, and Samet Oymak. Gradient descent with early stopping is provably robust to label noise for overparameterized neural networks. In AISTATS, 2020b.
+
+Wen Li, Limin Wang, Wei Li, Eirikur Agustsson, and Luc Van Gool. Webvision database: Visual learning and understanding from web data. arXiv preprint arXiv:1708.02862, 2017.
+
+Yihua Liao and V Rao Vemuri. Use of k-nearest neighbor classifier for intrusion detection. Computers & security, 21(5):439–448, 2002.
+
+Liu Liu, Tianyang Li, and Constantine Caramanis. High dimensional robust m-estimation: Arbitrary corruption and heavy tails. arXiv preprint arXiv:1901.08237, 2019.
+
+Tongliang Liu and Dacheng Tao. Classification with noisy labels by importance reweighting. IEEE Transactions on pattern analysis and machine intelligence, 38(3):447–461, 2016.
+
+Eyal Lubetzky and Allan Sly. Cutoff for the ising model on the lattice. Inventiones mathematicae, 191(3):719–755, 2013.
+
+Michal Lukasik, Srinadh Bhojanapalli, Aditya Menon, and Sanjiv Kumar. Does label smoothing mitigate label noise? In ICML, pp. 6448–6458, 2020.
+
+Yueming Lyu and Ivor W Tsang. Curriculum loss: Robust learning and generalization against label corruption. In ICLR, 2020.
+
+Xingjun Ma, Yisen Wang, Michael E Houle, Shuo Zhou, Sarah M Erfani, Shu-Tao Xia, Sudanthi Wijewickrema, and James Bailey. Dimensionality-driven learning with noisy labels. In ICML, pp. 3361–3370, 2018.
+
+Xingjun Ma, Hanxun Huang, Yisen Wang, Simone Romano, Sarah Erfani, and James Bailey. Normalized loss functions for deep learning with noisy labels. In ICML, pp. 6543–6553, 2020.
+
+Eran Malach and Shai Shalev-Shwartz. Decoupling" when to update" from" how to update". In NeurIPS, pp. 960–970, 2017.
+
+Aditya Krishna Menon, Brendan Van Rooyen, and Nagarajan Natarajan. Learning from binary labels with instance-dependent noise. Machine Learning, 107(8-10):1561–1595, 2018.
+
+Aditya Krishna Menon, Sadeep Jayasumana, Ankit Singh Rawat, Himanshu Jain, Andreas Veit, and Sanjiv Kumar. Long-tail learning via logit adjustment. arXiv preprint arXiv:2007.07314, 2020.
+
+Baharan Mirzasoleiman, Kaidi Cao, and Jure Leskovec. Coresets for robust training of neural networks against noisy labels. In NeurIPS, 2020.
+
+Mehryar Mohri, Afshin Rostamizadeh, and Ameet Talwalkar. Foundations of Machine Learning. MIT Press, 2018.
+
+David S Moore. Uncertainty. On the shoulders of giants: New approaches to numeracy, pp. 95–137, 1990.
+
+Nagarajan Natarajan, Inderjit S Dhillon, Pradeep K Ravikumar, and Ambuj Tewari. Learning with noisy labels. In NeurIPS, pp. 1196–1204, 2013.
+
+Kento Nishi, Yi Ding, Alex Rich, and Tobias Höllerer. Augmentation strategies for learning with noisy labels. arXiv preprint arXiv:2103.02130, 2021.
+
+Laura Niss and Ambuj Tewari. What you see may not be what you get: Ucb bandit algorithms robust to $\epsilon$ -contamination. In UAI, pp. 450–459, 2020.
+
+Giorgio Patrini, Alessandro Rozza, Aditya Krishna Menon, Richard Nock, and Lizhen Qu. Making deep neural networks robust to label noise: A loss correction approach. In CVPR, pp. 1944–1952, 2017.
+
+Daniel Paulin et al. Concentration inequalities for markov chains by marton couplings and spectral methods. Electronic Journal of Probability, 20, 2015.
+
+Geoff Pleiss, Tianyi Zhang, Ethan R Elenberg, and Kilian Q Weinberger. Identifying mislabeled data using the area under the margin ranking. In NeurIPS, 2020.
+
+Gareth O Roberts, Jeffrey S Rosenthal, et al. General state space markov chains and mcmc algorithms. Probability surveys, 1:20–71, 2004.
+
+Jun Shu, Qian Zhao, Zengben Xu, and Deyu Meng. Meta transition adaptation for robust deep learning with noisy labels. arXiv preprint arXiv:2006.05697, 2020.
+
+Mei-Ling Shyu, Shu-Ching Chen, Kanoksri Sarinnapakorn, and LiWu Chang. A novel anomaly detection scheme based on principal component classifier. Technical report, 2003.
+
+Hwanjun Song, Minseok Kim, Dongmin Park, Yooju Shin, and Jae-Gil Lee. Learning from noisy labels with deep neural networks: A survey. arXiv preprint arXiv:2007.08199, 2020.
+
+Daiki Tanaka, Daiki Ikami, Toshihiko Yamasaki, and Kiyoharu Aizawa. Joint optimization framework for learning with noisy labels. In CVPR, 2018.
+
+Kiran K Thekumparampil, Ashish Khetan, Zinan Lin, and Sewoong Oh. Robustness of conditional gans to noisy labels. In NeurIPS, pp. 10271–10282, 2018.
+
+Vladimir Vapnik. The nature of statistical learning theory. Springer science & business media, 2013.
+
+Xiaobo Wang, Shuo Wang, Jun Wang, Hailin Shi, and Tao Mei. Co-mining: Deep face recognition with noisy labels. In ICCV, pp. 9358–9367, 2019.
+
+Yisen Wang, Weiyang Liu, Xingjun Ma, James Bailey, Hongyuan Zha, Le Song, and Shu-Tao Xia. Iterative learning with open-set noisy labels. In CVPR, pp. 8688–8696, 2018.
+
+Hongxin Wei, Lei Feng, Xiangyu Chen, and Bo An. Combating noisy labels by agreement: A joint training method with co-regularization. In CVPR, pp. 13726–13735, 2020.
+
+Tong Wei, Jiang-Xin Shi, Wei-Wei Tu, and Yu-Feng Li. Robust long-tailed learning under label noise. arXiv preprint arXiv:2108.11569, 2021.
+
+Kirk M Wolter. Introduction to variance estimation, volume 53. Springer, 2007.
+
+Pengxiang Wu, Songzhu Zheng, Mayank Goswami, Dimitris Metaxas, and Chao Chen. A topological filter for learning with label noise. In NeurIPS, 2020.
+
+Songhua Wu, Xiaobo Xia, Tongliang Liu, Bo Han, Mingming Gong, Nannan Wang, Haifeng Liu, and Gang Niu. Class2simi: A noise reduction perspective on learning with noisy labels. In ICML, 2021.
+
+Songhua Wu, Mingming Gong, Bo Han, Yang Liu, and Tongliang Liu. Fair classification with instance-dependent label noise. In Clear, 2022.
+
+Xiaobo Xia, Tongliang Liu, Nannan Wang, Bo Han, Chen Gong, Gang Niu, and Masashi Sugiyama. Are anchor points really indispensable in label-noise learning? In NeurIPS, pp. 6835–6846, 2019.
+
+Xiaobo Xia, Tongliang Liu, Bo Han, Nannan Wang, Mingming Gong, Haifeng Liu, Gang Niu, Dacheng Tao, and Masashi Sugiyama. Part-dependent label noise: Towards instance-dependent label noise. In NeurIPS, 2020.
+
+Xiaobo Xia, Tongliang Liu, Bo Han, Chen Gong, Nannan Wang, Zongyuan Ge, and Yi Chang. Robust early-learning: Hindering the memorization of noisy labels. In ICLR, 2021.
+
+Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017.
+
+Tong Xiao, Tian Xia, Yi Yang, Chang Huang, and Xiaogang Wang. Learning from massive noisy labeled data for image classification. In CVPR, pp. 2691–2699, 2015.
+
+Bing Xu, Naiyan Wang, Tianqi Chen, and Mu Li. Empirical evaluation of rectified activations in convolutional network. arXiv preprint arXiv:1505.00853, 2015.
+
+Yilun Xu, Peng Cao, Yuqing Kong, and Yizhou Wang. L_dmi: A novel information-theoretic loss function for training deep nets robust to label noise. In NeurIPS, pp. 6222–6233, 2019.
+
+Shuo Yang, Lu Liu, and Min Xu. Free lunch for few-shot learning: Distribution calibration. In ICLR, 2021a.
+
+Shuo Yang, Songhua Wu, Tongliang Liu, and Min Xu. Bridging the gap between few-shot and manyshot learning via distribution calibration. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021b.
+
+Shuo Yang, Erkun Yang, Bo Han, Yang Liu, Min Xu, Gang Niu, and Tongliang Liu. Estimating instance-dependent label-noise transition matrix using dnns. arXiv preprint arXiv:2105.13001, 2021c.
+
+Quanming Yao, Hansi Yang, Bo Han, Gang Niu, and James Tin-Yau Kwok. Searching to exploit memorization effect in learning with noisy labels. In ICML, pp. 10789–10798, 2020a.
+
+Yu Yao, Tongliang Liu, Bo Han, Mingming Gong, Jiankang Deng, Gang Niu, and Masashi Sugiyama. Dual t: Reducing estimation error for transition matrix in label-noise learning. In NeurIPS, 2020b.
+
+Yu Yao, Tongliang Liu, Mingming Gong, Bo Han, Gang Niu, and Kun Zhang. Instance-dependent label-noise learning under a structural causal model. In NeurIPS, 2021.
+
+Yu Yao, Tongliang Liu, Bo Han, Mingming Gong, Gang Niu, Masashi Sugiyama, and Dacheng Tao. Rethinking class-prior estimation for positive-unlabeled learning. In ICLR, 2022.
+
+Xingrui Yu, Bo Han, Jiangchao Yao, Gang Niu, Ivor W Tsang, and Masashi Sugiyama. How does disagreement benefit co-teaching? In ICML, 2019.
+
+Xiyu Yu, Tongliang Liu, Mingming Gong, Kayhan Batmanghelich, and Dacheng Tao. An efficient and provable approach for mixture proportion estimation using linear independence assumption. In CVPR, pp. 4480–4489, 2018.
+
+Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In ICLR, 2017.
+
+Yivan Zhang, Gang Niu, and Masashi Sugiyama. Learning noise transition matrix from only noisy labels via total variation regularization. In ICML, 2021.
+
+Zhilu Zhang and Mert Sabuncu. Generalized cross entropy loss for training deep neural networks with noisy labels. In NeurIPS, pp. 8778–8788, 2018.
+
+Yue Zhao, Zain Nasrullah, and Zheng Li. Pyod: A python toolbox for scalable outlier detection. Journal of Machine Learning Research, 20(96):1–7, 2019.
+
+Songzhu Zheng, Pengxiang Wu, Aman Goswami, Mayank Goswami, Dimitris Metaxas, and Chao Chen. Error-bounded correction of noisy labels. In ICML, pp. 11447–11457, 2020.
+
+# APPENDIX
+
+The appendices are organized as follows. Section A details the proofs for our theorems. Section B presents more experimental results. Section C shows the details of used network structures. Section D gives more justifications for our theoretical analyses. Section E provides more discussions on learning by considering uncertainty. Section F provides more discussions on sample selection methods.
+
+# A PROOF OF THEORETICAL RESULTS
+
+# A.1 PROOF OF THEOREM 1
+
+For the circumstance with soft truncation, $\begin{array} { r } { \tilde { \mu } _ { z } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \psi ( z _ { i } ) } \end{array}$ . As suggested in (Catoni, 2012), we can exploit $\tilde { \mu } _ { z } ^ { - }$ and $\tilde { \mu } _ { z } ^ { + }$ such that
+
+$$
+\tilde { \mu } _ { z } ^ { - } \le \tilde { \mu } _ { z } \le \tilde { \mu } _ { z } ^ { + } ,
+$$
+
+to derive a bound for $\tilde { \mu } _ { z }$ . For some positive real parameter $\alpha$ , we define
+
+$$
+r ( \tilde { \mu } _ { z } ) = \sum _ { i = 1 } ^ { n } \psi \left[ \alpha ( z _ { i } - \tilde { \mu } _ { z } ) \right] = 0 .
+$$
+
+Let us introduce the quantity
+
+$$
+r ( \theta ) = \frac { 1 } { \alpha n } \sum _ { i = 1 } ^ { n } \psi \left[ \alpha ( z _ { i } - \theta ) \right] .
+$$
+
+With the exponential moment inequality (Giné et al., 2000) and the $\mathrm { C } _ { r }$ inequality (Mohri et al., 2018), we have
+
+$$
+\begin{array} { r l r } & { } & { \exp \{ \alpha n r ( \theta ) \} \leq \left\{ 1 + \alpha ( \mu _ { z } - \theta ) + \alpha ^ { 2 } [ \sigma ^ { 2 } + ( \mu _ { z } - \theta ) ^ { 2 } ] \right\} ^ { n } } \\ & { } & { \leq \exp \{ n \alpha ( \mu _ { z } - \theta ) + n \alpha ^ { 2 } [ \sigma ^ { 2 } + ( \mu _ { z } - \theta ) ^ { 2 } ] \} . } \end{array}
+$$
+
+In the same way,
+
+$$
+\begin{array} { r } { \exp \{ - \alpha n r ( \theta ) \} \leq \exp \{ - n \alpha ( \mu _ { z } - \theta ) + n \alpha ^ { 2 } [ \sigma ^ { 2 } + ( \mu _ { z } - \theta ) ^ { 2 } ] \} . } \end{array}
+$$
+
+If we define for any $\mu _ { s } \in \mathbb { R }$ the bounds
+
+$$
+B _ { - } ( \theta ) = \mu _ { z } - \theta - \alpha [ \sigma ^ { 2 } + ( \mu _ { z } - \theta ) ^ { 2 } ] - \frac { \log ( \epsilon ^ { - 1 } ) } { \alpha n }
+$$
+
+and
+
+$$
+B _ { + } ( \theta ) = \mu _ { z } - \theta + \alpha [ \sigma ^ { 2 } + ( \mu _ { z } - \theta ) ^ { 2 } ] + \frac { \log ( \epsilon ^ { - 1 } ) } { \alpha n } .
+$$
+
+From (Chen et al., 2020) (Lemma 2.2), we obtain that
+
+$$
+P ( r ( \theta ) > B _ { - } ( \theta ) ) \geq 1 - \epsilon \quad \mathrm { a n d } \quad P ( r ( \theta ) < B _ { + } ( \theta ) ) \geq 1 - \epsilon .
+$$
+
+Let $\tilde { \mu } _ { z } ^ { - }$ be the largest solution of the quadratic equation $B _ { - } ( \theta )$ and $\tilde { \mu } _ { z } ^ { + }$ be the smallest solution of the quadratic equation $B _ { + } ( \theta )$ . Also, to guarantee the solution of the quadratic equation, we assume
+
+$$
+4 \alpha ^ { 2 } \sigma ^ { 2 } + \frac { 4 \log ( \epsilon ^ { - 1 } ) } { n } \leq 1 .
+$$
+
+From (Chen et al., 2020) (Theorem 2.6), we then have
+
+and
+
+$$
+\begin{array} { r l } & { \tilde { \mu } _ { z } ^ { - } \geq \mu _ { z } - \frac { \alpha \sigma ^ { 2 } + \frac { \log ( \epsilon ^ { - 1 } ) } { \alpha n } } { \alpha - 1 } , } \\ & { } \\ & { \tilde { \mu } _ { z } ^ { + } \leq \mu _ { z } + \frac { \alpha \sigma ^ { 2 } + \frac { \log ( \epsilon ^ { - 1 } ) } { \alpha n } } { \alpha - 1 } . } \end{array}
+$$
+
+With probability at least $1 - 2 \epsilon$ , we have $\tilde { \mu } _ { z } ^ { - } \le \tilde { \mu } _ { z } \le \tilde { \mu } _ { z } ^ { + }$ . We can choose $\textstyle \alpha = { \frac { n } { \sigma ^ { 2 } } }$ . Then we have
+
+$$
+| \tilde { \mu } _ { z } - \mu _ { z } | \leq \frac { \sigma ^ { 2 } ( n + \frac { \sigma ^ { 2 } \log ( \epsilon ^ { - 1 } ) } { n ^ { 2 } } ) } { n - \sigma ^ { 2 } } ,
+$$
+
+which holds with probability at least $1 - 2 \epsilon$
+
+We exploit the lower bound and let $\textstyle \epsilon = { \frac { 1 } { 2 t } }$ . Then we have
+
+$$
+\ell _ { s } ^ { \star } = \tilde { \mu } _ { s } - \frac { \sigma ^ { 2 } ( t + \frac { \sigma ^ { 2 } \log ( 2 t ) } { t ^ { 2 } } ) } { n _ { t } - \sigma ^ { 2 } } ,
+$$
+
+where $n _ { t }$ denotes the number of times that the example was selected in the time intervals.
+
+
+Figure 3: The illustration of the influence function for the soft estimator.
+
+Here, we provide the graph of the used influence function for the soft estimator, which explains the mechanism of the function $y = \log ( 1 + x + x ^ { 2 } / 2 )$ more clearly. The illustration is presented in Figure 3. As can be seen, when $x$ is large and may be an outlier, the influence function can reduce its negative impact for mean estimation. Therefore, we exploit such an influence function for robust mean estimation, which brings better classification performance.
+
+# A.2 PROOF OF THEOREM 2
+
+Lemma 1 ((Paulin et al., 2015)) Let $Z _ { n } = \{ z _ { 1 } , \ldots , z _ { n } \}$ be a (not necessarily time homogeneous) Markov chain with mean $\mu _ { z }$ , taking values in a Polish state space $\Lambda _ { 1 } \times \ldots \times \Lambda _ { n }$ , with a mixing time $\tau ( v )$ (for $0 \leq v \leq 1 .$ ). Let
+
+$$
+\tau _ { \operatorname* { m i n } } = \operatorname* { i n f } _ { 0 \leq v < 1 } \tau ( v ) \cdot \left( \frac { 2 - v } { 1 - v } \right) ^ { 2 } .
+$$
+
+For some $\eta \in \mathbb { R } ^ { + }$ , suppose that $f : \Lambda \to \mathbb { R }$ satisfies the following inequality:
+
+$$
+f ( a ) - f ( b ) \leq \sum _ { i = 1 } ^ { n } \eta \mathbb { 1 } [ a _ { i } \neq b _ { i } ] ,
+$$
+
+for every $a , b \in \Lambda$ . Then for any $\epsilon \geq 0$ , we have
+
+$$
+P ( | f ( Z _ { n } ) - \mathbb { E } f ( Z _ { n } ) | \geq \epsilon ) \leq 2 \exp \left( \frac { - 2 \epsilon ^ { 2 } } { \eta ^ { 2 } \tau _ { \operatorname* { m i n } } } \right) .
+$$
+
+The detailed definition of the mixing time for the Markov chain can be found in (Paulin et al., 2015; Roberts et al., 2004). Let $f$ be the mean function. Following the prior work on mean estimation (Liu et al., 2019; Diakonikolas et al., 2020; Diakonikolas & Kane, 2019; Niss & Tewari, 2020), without loss of generality, we assume $\mu _ { z } = 0$ for the underlying true distribution, and $| z _ { i } |$ is upper bounded by $Z$ . Then we can set $\eta$ to $4 Z / n$ for Eq. (23). Combining the above analyses, we can revise Eq. (24) as follows:
+
+$$
+P \left( \left| \frac { 1 } { n } \sum _ { i = 1 } ^ { n } z _ { i } \right| \geq \frac { 2 Z } { n } \sqrt { 2 \tau _ { \operatorname* { m i n } } \log \frac { 2 } { \epsilon _ { 1 } } } \right) \leq \epsilon _ { 1 } ,
+$$
+
+and
+
+$$
+P \left( \underset { i \in [ n ] } { \operatorname* { m a x } } | z _ { i } | \geq \frac { 2 Z } { n } \sqrt { 2 \tau _ { \operatorname* { m i n } } \log \frac { 2 n } { \epsilon _ { 2 } } } \right) \leq \epsilon _ { 2 } ,
+$$
+
+for $\epsilon _ { 1 } > 0$ and $\epsilon _ { 2 } > 0$ . If we remove the potential outliers $Z _ { n _ { o } }$ from $Z _ { n }$ . Therefore, we have
+
+$$
+\begin{array} { r l } { \displaystyle \left. \frac { 1 } { n - n _ { o } } \sum _ { z _ { 1 } \in \mathcal { L } _ { n } \setminus \mathcal { Z } _ { n o } } - \mu _ { z } \right. = \displaystyle \frac { 1 } { n - n _ { o } } \left. \sum _ { z _ { 1 } \in \mathcal { Z } _ { n } } - \sum _ { z _ { 1 } \in \mathcal { Z } _ { n o } } \right. } & { } \\ { \displaystyle } & { \leq \frac { 1 } { n - n _ { o } } \left( \left. \sum _ { z _ { 1 } \in \mathcal { Z } _ { n o } } \right. + \left. \sum _ { z _ { 1 } \in \mathcal { Z } _ { n o } } \right. \right) } \\ { \displaystyle } & { \leq \frac { 1 } { n - n _ { o } } \left( \left. \sum _ { z _ { 1 } \in \mathcal { Z } _ { n } } \right. + n _ { o } \operatorname* { m a x } _ { i \in \left[ n \right] } \lvert z _ { i } \rvert \right) } \\ { \displaystyle } & { \leq \frac { 1 } { n - n _ { o } } \left( 2 Z \sqrt { 2 \tau _ { \operatorname* { m i n } } \log \frac { 2 } { \epsilon _ { 1 } } } + \frac { 2 Z n _ { o } } { n } \sqrt { 2 \tau _ { \operatorname* { m i n } } \log \frac { 2 n } { \epsilon _ { 2 } } } \right) , } \end{array}
+$$
+
+which holds with probability at least $1 - \epsilon _ { 1 } - \epsilon _ { 2 }$ .
+
+For our task, we exploit the concentration inequality. Let $\begin{array} { r } { \epsilon _ { 1 } = \epsilon _ { 2 } = \frac { 1 } { 2 t } } \end{array}$ , and the losses be bounded by $L$ . Next we can obtain
+
+$$
+\begin{array} { c } { \displaystyle { \left| \tilde { \mu } _ { h } - \mu \right| \leq \frac { 2 L } { t - t _ { o } } \left( \sqrt { 2 \tau _ { \operatorname* { m i n } } \log ( 4 t ) } + \frac { t _ { o } } { t } \sqrt { 4 \tau _ { \operatorname* { m i n } } \log ( 4 t ) } \right) } } \\ { \displaystyle { = \frac { 2 \sqrt { 2 \tau _ { \operatorname* { m i n } } } L ( t + \sqrt { 2 } t _ { o } ) } { ( t - t _ { o } ) t } \sqrt { \log ( 4 t ) } } } \end{array}
+$$
+
+with the probability at least $\textstyle 1 - { \frac { 1 } { t } }$ . In practice, it is easy to identify the value of $L$ . For example, we can training deep networks on noisy datasets to observe the loss distributions. Then, we exploit the lower bound such that
+
+$$
+\ell _ { h } ^ { \star } = \tilde { \mu } _ { h } - \frac { 2 \sqrt { 2 \tau _ { \mathrm { m i n } } } L ( t + \sqrt { 2 } t _ { o } ) } { ( t - t _ { o } ) \sqrt { t } } \sqrt { \frac { \log ( 4 t ) } { n _ { t } } }
+$$
+
+for sample selection.
+
+# B COMPLEMENTARY EXPERIMENTAL ANALYSES
+
+Table 6: Summary of synthetic datasets used in the experiments.
+
+
# of training
# of testing
# of class
size
MNIST
60,000
10,000
10
28×28×1
F-MNIST
60,000
10,000
10
28×28×1
CIFAR-10
50,000
10,000
10
32×32×3
CIFAR-100
50,000
10,000
100
32×32×3
+
+# B.1 THE DETAILS OF DATASETS AND GENERATING NOISY LABELS
+
+For the details of datasets, the important statistics of the used datasets are summarized in Table 6.
+
+For the details of generating noisy labels, we exploit both class-dependent and instance-dependent label noise which include five types of synthetic label noise to verify the effectiveness of the proposed method. Here, we describe the details of the noise setting as follows:
+
+(1). Class-dependent label noise:
+
+• Symmetric noise: this kind of label noise is generated by flipping labels in each class uniformly to incorrect labels of other classes.
+
+
+Figure 4: Synthetic class-dependent transition matrices used in our experiments on MNIST. The noise rate is set to $20 \%$ .
+
+
Noise type
Sym.
Asym.
Pair.
Trid.
Ins.
Method/Noise
20%
40%
20%
40%
20%
40%
20%
40%
20%
40%
NPCL
98.66
98.21
98.89
96.14
98.06
97.50
98.84
97.62
97.25
95.75
±0.03
±0.11
±0.02
±1.21
±0.24
±0.18
±0.05
±0.29
±0.63
±1.04
INCV
98.58
98.37
98.89
97.67
97.98
97.21
98.74
97.65
96.83
94.97
±0.14
±0.06
±0.06
士0.26
±0.21
±0.39
±0.17
±0.32
±1.04
±1.35
APL
98.76
94.92
98.63
88.65
98.66
68.44
98.93
76.44
97.63
87.90
±0.06
±0.31
±0.05
±1.72
±0.10
±2.95
±0.04
±3.04
±0.73
±1.94
CDR
94.77
92.16
96.73
91.05
93.25
71.02
94.06
70.28
93.17
77.45
±0.17
±0.73
±0.19
±0.76
±0.90
±3.89
±0.92
±4.01
±0.96
±3.04
+
+Table 7: Test accuracy $( \% )$ on MNIST over the last ten epochs.
+
+• Asymmetic noise : this kind of label noise is generated by flipping labels within a set of similar classes. In this paper, for MNIST, flipping $2 { } 7$ , $3 { } 8$ , $5 { } 6$ . For $F$ -MNIST, flipping TSHIR $\Gamma { } \mathrm { S H I R T }$ , PULLOVER ${ } \mathrm { C O A T }$ , SANDALS SNEAKER. For CIFAR-10, flipping TRUCK AUTOMOBILE, BIRD AIRPLANE, DEER HORSE, $\mathrm { C A T } \mathrm { D O G }$ . For CIFAR-100, the 100 classes are grouped into 20 super-classes, and each has 5 sub-classes. Each class is then flipped into the next within the same super-class.
+
+• Pairflip noise: the noise flips each class to its adjacent class.
+
+• Tridiagonal noise: the noise corresponds to a spectral of classes where adjacent classes are easier to be mutually mislabeled, unlike the unidirectional pair flipping. It can be implemented by two consecutive pair flipping transformations in the opposite direction.
+
+(2). Instance-dependent label noise:
+
+• Instance noise: the noise is quite realistic, where the probability that an instance is mislabeled depends on its features. We generate this type of label noise to validate the effectiveness of the proposed method as did in (Xia et al., 2020; Yao et al., 2021).
+
+We use synthetic noisy MNIST as an example and plot the noise transition matrices in Figure 4. The noise rate is set to $20 \%$ .
+
+# B.2 COMPARISON WITH OTHER BASELINES
+
+We focus on the sample selection approach in learning with noisy labels. In the main paper (Section 3.1), we fairly compare our methods with the baselines which also focus on sample selection. We add two other sample-selection baselines here. As suggested by the related survey (Song et al., 2020), the sample selection methods can be divided into three categories: (a) “Multi-network Learning”, (b) “Multi-round Learning”, and (c) “Hybrid Approach”. As our method belongs to (a), we exploit INCV (Chen et al., 2019) which belongs to (b), and NPCL (Lyu & Tsang, 2020) which belongs to (c), to make the comparison more comprehensive.
+
+Here, we also evaluate other types of baselines. We exploit APL (Ma et al., 2020) and CDR (Xia et al., 2021), which add implicit regularization from different perspectives. The experiments are conducted on MNIST and $F$ -MNIST. Other experimental settings are the same as those in the main paper. The experimental results are provided in Tables 7 and 8, which show that the proposed methods are superior to these baselines with respect to classification performance.
+
+
Noise type
Sym.
Asym.
Pair.
Trid.
Ins.
Method/Noise
20%
40%
20%
40%
20%
40%
20%
40%
20%
40%
NPCL
91.65
86.72
91.20
70.65
91.07
85.03
90.99
88.79
90.77
86.34
±0.37
±2.30
±0.06
±2.83
±0.22
±1.94
±0.15
±1.04
±0.85
±2.78
INCV
91.66
85.39
91.35
65.82
90.26
85.73
91.76
88.42
89.54
86.21
±0.31
±1.14
±0.70
±4.32
±0.38
±1.92
±0.17
士1.55
士1.79
±2.86
APL
91.73
89.06
90.13
80.34
90.22
78.54
90.84
86.53
90.96
85.55
±0.20
±0.41
±0.17
±0.63
±0.80
士4.33
±0.22
±0.76
±0.77
±2.86
CDR
85.62
71.83
89.78
79.05
85.72
69.07
86.75
73.63
85.92
73.14
±0.96
±1.37
±0.41
±1.39
±0.65
±2.31
±1.19
±2.82
±1.43
±3.12
+
+Table 8: Test accuracy on $F$ -MNIST over the last ten epochs.
+
+# B.3 EXPERIMENTS ON SYNTHETIC CIFAR-100
+
+For CIFAR-100, we use a 7-layer CNN structure from (Yu et al., 2019; Yao et al., 2020a). Other experimental settings are the same as those in the experiments on MNIST, $F$ -MNIST, and CIFAR-10. The results are provided in Table 9. We can see the proposed method outperforms all the baselines.
+
+
Noise type
Sym.
Asym.
Pair.
Trid.
Ins.
Method/Noise
20%
40%
20%
40%
20%
40%
20%
40%
20%
40%
S2E
44.59
25.78
42.18
26.81
42.99
26.96
43.16
27.72
43.13
27.12
士0.32
±5.44
±1.73
士2.25
士1.54
±2.48
±0.93
士3.56
±0.67
士3.86
MentorNet
43.15
37.62
41.03
28.27
40.06
27.17
42.20
31.74
40.54
33.09
±0.42
±0.89
±0.22
±0.41
±0.37
±0.92
±0.30
±0.88
±0.69
±1.53
Co-teaching
45.17
40.95
42.76
30.27
42.50
30.07
44.41
34.96
42.23
35.87
士0.25
±0.52
±0.34
±0.33
±0.39
±0.17
±0.41
±0.35
±0.52
±1.47
SIGUA
42.03
40.53
36.67
26.71
36.48
26.73
39.21
32.69
39.19
33.51
±0.33
±0.49
士0.25
±0.42
士0.37
±0.33
±0.40
±0.36
±0.32
±0.43
JoCor
45.93
41.56
42.89
29.19
42.12
30.12
44.98
±0.21
±0.57
±0.37
±1.42
±0.35
±0.65
±0.27
34.23
44.28
35.60 ±0.99
CNLCU-S
46.09
42.11
43.06
30.47
43.08
30.33
45.19
±1.13 35.49
±0.59 44.80
36.23
±0.29
±0.70
±0.28
±0.37
±0.92
士0.74
±0.90
±1.30
±0.70
±0.49
CNLCU-H
46.27
42.05
43.21
30.55
43.25
30.79
45.02
35.24
45.02
36.17
±0.38
±0.87
±0.93
±0.72
±0.75
±0.86
±1.06
±0.93
±1.07
±1.54
+
+Table 9: Test accuracy $( \% )$ on CIFAR-100 over the last ten epochs. The best two results are in bold.
+
+# B.4 EXPERIMENTS FOR ABLATION STUDY
+
+We conduct the ablation study to analyze the sensitivity of the length of time intervals. The results are shown in Figure 5 and 6. As we can seen, the proposed method, i.e., CNLCU-S and CNLCU-H are robust to the choices of hyperparameters.
+
+
+Figure 5: Illustrations of the hyperparameter sensitivity for the proposed CNLCU-S. The error bar for standard deviation in each figure has been shaded.
+
+Note that in this paper, we concern uncertainty from two aspects, i.e., the uncertainty about small-loss examples and the uncertainty about large-loss examples. Here, we conduct ablation study to show the effect of removing different components to provide insights into what makes the proposed methods successful. The experiments are conducted on MNIST and $F .$ -MNIST. Other experimental settings are the same as those in the main paper (Section 3.1). Note that we employ two networks to teach each other following (Han et al., 2018). Therefore, when we do not consider uncertainty in sample selection, the proposed methods will reduce to the baseline Co-teaching (Han et al., 2018).
+
+
+Figure 6: Illustrations of the hyperparameter sensitivity for the proposed CNLCU-H. The error bar for standard deviation in each figure has been shaded.
+
+To study the effect of concerning uncertainty about small-loss examples, we remove the concerns about large-loss examples, i.e., the network is not encouraged to choose the less selected examples for updates. We express such a setting as “without concerning about large-loss examples” (abbreviated as w/o $c l$ ). To study the effect of concerning uncertainty about large-loss examples, we remove the concerns about small-loss examples, i.e., we only exploit the predictions of the current network. We express such a setting as “without concerning about small-loss examples” (abbreviated as w/o cs). Besides, we express the setting which directly uses non-robust mean as Co-teaching-M.
+
+The experimental results of ablation study are provided in Tables 10 and 11. As can be seen, both aspects of uncertainty concerns can improve the robustness of models. Therefore, combining two uncertainty concerns, we can better combat noisy labels. In addition, robust mean estimation is superior to the non-robust mean in learning with noisy labels.
+
+Table 10: Test accuracy $\%$ ) on MNIST over last ten epochs.
+
+
Noise type
Sym.
Asym.
Pair.
Trid.
Ins.
Method/Noise
20%
40%
20%
40%
20%
40%
20%
40%
20%
40%
CNLCU-S
98.82 ±0.03
98.31 ±0.05
98.93 ±0.06
97.67 ±0.22
98.86 ±0.06
97.71 ±0.64
99.09 ±0.04
98.02 ±0.17
98.77 ±0.08
97.78 士0.25
CNLCU-S w/o cl
98.02 ±0.08
96.83 ±0.29
98.50 ±0.04
96.25 ±0.13
98.22 ±0.13
96.08 ±0.75
98.64 ±0.31
97.25 ±0.24
98.17 ±0.20
97.13 ±0.40
CNLCU-S w/o cs
98.15 ±0.20
97.12 ±0.22
98.36 ±0.07
96.39 ±0.48
98.04 ±0.24
96.12 ±0.68
98.74 ±0.05
97.30 士0.52
98.11 ±0.15
97.32 ±0.43
CNLCU-H
98.70 ±0.06
98.24 ±0.06
99.01 ±0.04
98.01 ±0.03
98.44 ±0.19
97.37 ±0.32
98.89 ±0.15
97.92 ±0.05
98.74 ±0.16
97.42 ±0.39
CNLCU-H w/o cl
98.06 ±0.13
96.92 ±0.23
98.39 ±0.04
96.51 ±0.57
97.04 ±0.87
95.62 ±0.93
98.33 ±0.47
97.41 ±0.92
98.01 ±0.20
96.15 ±0.28
CNLCU-H w/o cs
98.19 ±0.22
97.05 ±0.49
98.76 ±0.59
97.17 ±0.60
97.26 ±1.19
96.31 ±0.25
98.29 ±0.17
97.65 ±0.92
98.34 ±0.36
96.49 ±0.48
Co-teaching-M
97.72 ±0.08
97.78 ±0.32
98.27 ±0.03
95.42 ±0.42
96.22 ±0.10
95.01 士0.65
97.92 ±0.14
96.64 ±0.77
98.02 ±0.04
96.03 ±0.57
Co-teaching
97.53 ±0.12
95.62 ±0.30
98.25 ±0.08
95.08 ±0.43
96.05 ±0.96
94.16 ±1.37
98.05 ±0.06
96.18 ±0.85
97.96 ±0.09
95.02 ±0.39
+
+# B.5 RESULTS ON SYNTHETIC IMBALANCED NOISY DATASETS
+
+In the main paper, we have provided the test accuracy on synthetic imbalanced noisy datasets in Figure 2. Due to the limited space, we provide the selected ratio achieved on IM-MNIST and IM-FMNIST in Table 12. The results explain well why our methods perform better on synthetic imbalanced noisy datasets, i.e., our methods can make better use of training examples with the imbalanced classes. Note that since we give a try to large-loss but less selected data in a conservative way, the selected ratio is still far away from the class prior probability on the test set, i.e., $10 \%$ . However, a little improvement of the selection ratio can bring a considerable improvement of test accuracy. These results tell us that, in the sample selection approach when learning with noisy labels, improving the selected ratio of training examples with the imbalanced classes is challenging but promising for generalization. This practical problem deserves to be studied in depth.
+
+Table 11: Test accuracy $( \% )$ on $F$ -MNIST over last ten epochs.
+
+
Noise type
Sym.
Asym.
Pair.
Trid.
Ins.
Method/Noise
20%
40%
20%
40%
20%
40%
20%
40%
20%
40%
CNLCU-S
92.37 ±0.15
91.45 ±0.28
92.57 士0.15
83.14 ±1.77
92.04 ±0.26
88.20 ±0.44
92.24 ±0.17
90.08 ±0.34
91.69 ±0.10
89.02 ±1.02
CNLCU-S w/o cl
91.77
89.40
91.25
72.93
91.53
87.31
91.31
89.50
91.09
88.45
±0.35
±0.26
±0.30
±2.63
±0.17
士0.59
±0.52
士0.32
±0.13
±0.57
CNLCU-S w/o cs
91.85
90.76
91.94
80.99
91.28
87.31
91.39
89.29
90.98
88.73
±0.33
±0.28
±0.09
±2.74
±0.20
±0.72
±0.07
±0.51
±0.43
±0.62
CNLCU-H
92.42
91.60
92.60
82.69
91.70
87.70
92.33
90.22
91.50
±0.21
±0.19
±0.18
±0.43
±0.18
±0.69
±0.71
88.79
CNLCU-H w/o cl
91.70
90.05
91.08
71.35
91.03
87.22
±0.26
±0.21
±1.22
±0.04
±0.31
±0.06
±2.30
±0.29
91.59
90.01
90.80
88.31
CNLCU-H w/o cs
91.82
90.92
92.45
80.73
91.21
±0.72 87.49
±0.07
±0.24
士0.27
±1.09
±0.13
±0.42
±0.25
±1.63
±0.17
±0.32
92.08
89.72
91.21
88.62
Co-teaching-M
91.33
89.05
91.14
71.03
90.85
86.95
±0.13
±0.24
±0.38
±0.73
±0.18
±0.73
±0.90
±3.73
±0.61
±0.19
91.50 士0.46
89.18 ±0.44
90.74
88.25
Co-teaching
91.48
88.80
91.03
68.07
90.77
86.91
91.24
89.18
±1.06 90.60
±0.92
±0.10
±0.29
±0.14
±4.58
±0.23
±0.71
±0.11
±0.36
±0.12
87.90 ±0.45
+
+Table 12: Selected ratio $( \% )$ on IM-MNIST and IM- $F$ -MNIST. The best two results are in bold.
+
+
Dataset
IM-MNIST
IM-F-MNIST
Method/Noise
10%
20%
30%
40%
10%
20%
30%
40%
S2E
0.13 ±0.12
0.11 ±0.05
0.09 ±0.02
0.05 ±0.01
0.13 ±0.04
0.17 ±0.03
0.16 ±0.02
0.12 ±0.04
MentorNet
0.10 ±0.02
0.15 ±0.02
0.12 ±0.03
0.13 ±0.02
0.12 ±0.01
0.15 ±0.03
0.09 ±0.01
0.14 ±0.02
Co-teaching
0.09 ±0.03
0.07 ±0.02
0.05 ±0.01
0.12 ±0.01
0.17 ±0.05
0.04 ±0.00
0.13 ±0.04
0.07 ±0.01
SIGUA
0.04 ±0.00
0.04 ±0.00
0.01 ±0.00
0.02 ±0.00
0.03 ±0.00
0.02 ±0.00
0.04 ±0.00
0.00 ±0.00
JoCor
0.11 ±0.04
0.08 ±0.01
0.07 ±0.03
0.06 ±0.02
0.05 ±0.01
0.13 ±0.04
0.13 ±0.03
0.07 ±0.02
CNLCU-S
0.60 ±0.11
0.37 ±0.09
0.39 ±0.04
0.38 ±0.06
0.35 ±0.03
0.39 ±0.04
0.36 ±0.03
0.30 ±0.02
CNLCU-H
0.57 ±0.13
0.32 ±0.01
0.37 ±0.07
0.32 ±0.05
0.34 ±0.02
0.35 ±0.06
0.32 ±0.04
0.28 ±0.03
+
+# B.6 EXPERIMENTS WITH HIGH NOISE LEVELS
+
+In the main paper, we set the noise rates to be smaller than $50 \%$ , which ensures that clean labels in noisy classes are diagonally dominant in all label noise settings. To demonstrate the effectiveness of our method with high noise levels, we conduct experiments on MNIST and $F$ -MNIST with $50 \%$ , $60 \%$ , and $70 \%$ symmetric noise. The experimental results are presented in Table 13. As can be seen, the proposed methods can achieve the best performance in almost all cases.
+
+# C COMPLEMENTARY EXPLANATION FOR NETWORK STRUCTURES
+
+Table 14 describes the 9-layer CNN (Han et al., 2018) used on MNIST, $F$ -MNIST, and CIFAR-10. Table 15 describes the 7-layer CNN (Yu et al., 2019) used on CIFAR-100. Here, LReLU stands for Leaky ReLU (Xu et al., 2015). The slopes of all LReLU functions in the networks are set to 0.01. Note that that the 7/9-layer CNN is a standard and common practice in weakly supervised learning. We decided to use these CNNs, since then the experimental results are directly comparable with previous approaches in the same area, i.e., learning with noisy labels.
+
+Table 13: Test accuracy on MNIST and $F$ -MNIST with high noise levels over the last ten epochs. The best two results are in bold.
+
+
+
+Table 14: The CNN on MNIST, $F$ -MNIST, and CIFAR10.
+
+Table 15: The CNN on CIFAR-100.
+
+
CNN on CIFAR-100
32×32RGBImage
3×3 conv,64ReLU3×3 conv, 64 ReLU
2×2 max-pool
3×3conv,128ReLU3×3 conv,128 ReLU
2×2 max-pool
3×3conv,196ReLU3×3 conv, 196 ReLU
2×2 max-pool
dense 256-→100
+
+# D NEEDED ASSUMPTIONS WITHOUT NOISY VALIDATION SETS
+
+In the main paper, a noisy validation set is exploited to determine $\sigma ^ { 2 }$ and $\tau _ { \mathrm { m i n } }$ . We discuss, if we do not use the noisy validation set, what assumptions we will need.
+
+• In statistical learning, it is an important problem for estimating the variance of a data distribution. However, it is hard to obtain an accurate estimation from a finite sample. To reduce the estimation errors, some kinds of assumptions are often needed, e.g., random sampling assumptions, replacement assumptions, and strict distribution assumptions. We suggest the readers to refer (Wolter, 2007) for more details.
+• For the accurate estimation of $\tau _ { \mathrm { m i n } }$ , we have to assume that the Markov chain can exhibit a cutoff, which means that the total variation distance decreases very rapidly in a small interval (Paulin et al., 2015). Readers can check the Figure 1 of (Lubetzky & Sly, 2013) for better understanding.
+
+# E FURTHER DISCUSSION ON LEARNING BY UNCERTAINTY
+
+We discuss a related work named ActiveBias (Chang et al., 2017) on learning with uncertainty, although it studies the predicted probability, rather than the loss. In general, the differences between our work and ActiveBias lie in the different problems, different focuses, and different technical implementation. In more detail, we summarize the main differences between the two works in the following:
+
+• ActiveBias mainly focuses on mining hard examples to help generalization. Although it mentions the label-noise problem, it does not consider comprehensive noise settings. Also,
+
+the baselines are SGD, ADAM, and other optimization methods, but not the methods are specially designed for learning with noisy labels. In contrast, our work mainly focuses on learning with noisy labels and has more comprehensive experiments, which explore the performance of different label-noise methods under noisy supervision. • ActiveBias focuses on using the hard examples, but not too difficult examples, which is stated in the original paper. In the imbalanced setting of this paper, clean imbalanced data are too difficult to distinguish with the predictions of models (Figure 1, right) and therefore are too difficult examples. Our methods aim to make use of such examples. Experiments show that such examples are of great importance for generalization. • The introduction of uncertainty in ActiveBias relies on the estimation of the prediction variance but does not consider the bad influence of mislabeled data/outliers on this estimation. Our methods use the loss distribution and the side effect of mislabeled data is considered by robust mean estimators.
+
+# F RELATED WORK ON SAMPLE SELECTION
+
+In this paper, we focus on the procedure of using the small-loss criterion for sample selection, which is very commonly used in learning with noisy labels and shared by the state-of-the-art methods. We review prior effects in this line. Existing methods (Jiang et al., 2018; Han et al., 2018; Yu et al., 2019; Wei et al., 2020; Lyu & Tsang, 2020) focus on the class-balanced problem. Based on the memorization effect of deep networks, they select examples with small losses for network updates and drop examples with large losses. The main reason is that clean examples are more likely to have small losses, but mislabeled examples are more likely to have large losses in class-balanced cases. Distinctly, these methods ignore the clean examples with large losses, following suboptimal generalization. When the training dataset is noisy and extremely imbalanced, prior methods are weak. It is because since they cannot select clean hard examples within non-dominant classes effectively based on losses, which is shown in the main paper. Unfortunately, such examples are critical for generalization. We are the first one to focus on this important problem and tackle it by considering the uncertainty of losses.
\ No newline at end of file
diff --git a/md/dev/xMJWUKJnFSw/xMJWUKJnFSw.md b/md/dev/xMJWUKJnFSw/xMJWUKJnFSw.md
new file mode 100644
index 0000000000000000000000000000000000000000..9393be63ea722e244e763ff3e5c2c940d740e6d2
--- /dev/null
+++ b/md/dev/xMJWUKJnFSw/xMJWUKJnFSw.md
@@ -0,0 +1,495 @@
+# NODEPIECE: COMPOSITIONAL AND PARAMETEREFFICIENT REPRESENTATIONS OF LARGE KNOWLEDGE GRAPHS
+
+Mikhail Galkin, Etienne Denis, Jiapeng Wu and William L. Hamilton
+Mila, McGill University
+Montreal, Canada
+{mikhail.galkin,deniseti,jiapeng.wu,hamilton}@mila.quebec
+
+# ABSTRACT
+
+Conventional representation learning algorithms for knowledge graphs (KG) map each entity to a unique embedding vector. Such a shallow lookup results in a linear growth of memory consumption for storing the embedding matrix and incurs high computational costs when working with real-world KGs. Drawing parallels with subword tokenization commonly used in NLP, we explore the landscape of more parameter-efficient node embedding strategies. To this end, we propose NodePiece, an anchor-based approach to learn a fixed-size entity vocabulary. In NodePiece, a vocabulary of subword/sub-entity units is constructed from anchor nodes in a graph with known relation types. Given such a fixed-size vocabulary, it is possible to bootstrap an encoding and embedding for any entity, including those unseen during training. Experiments show that NodePiece performs competitively in node classification, link prediction, and relation prediction tasks while retaining less than $10 \%$ of explicit nodes in a graph as anchors and often having $1 0 \mathrm { x }$ fewer parameters. To this end, we show that a NodePiece-enabled model outperforms existing shallow models on a large OGB WikiKG 2 graph having $\mathrm { \sim } 7 0 \mathrm { x }$ fewer parameters1.
+
+# 1 INTRODUCTION
+
+Representation learning tasks on knowledge graphs (KGs) often require a parameterization of each unique atom in the graph with a vector or matrix. Traditionally, in multi-relational KGs such atoms constitute a set of all nodes $n \in N$ (entities) and relations (edge types) $r \in R$ (Nickel et al., 2016). Assuming parameterization with vectors, atoms are mapped to $d$ -dimensional vectors through shallow encoders $f _ { n } : n \to \mathbb { R } ^ { d }$ and $f _ { r } : r \to \mathbb { R } ^ { d }$ which scale linearly to the number of nodes and edge types2, i.e., having $O ( | N | )$ space complexity of the entity embedding matrix. Albeit efficient on small conventional benchmarking datasets based on Freebase (Toutanova & Chen, 2015) $( \sim 1 5 \mathrm { K }$ nodes) and WordNet (Dettmers et al., 2018) $- 4 0 \mathrm { K }$ nodes), training on larger graphs (e.g., YAGO 3-10 (Mahdisoltani et al., 2015) of 120K nodes) becomes computationally challenging. Scaling it further up to larger subsets (Hu et al., 2020; Wang et al., 2021; Safavi & Koutra, 2020) of Wikidata (Vrandecic & Krötzsch, 2014) requires a top-level GPU or a CPU cluster as done in, e.g., PyTorch-BigGraph (Lerer et al., 2019) that maintains a $7 8 \mathbf { M } \times 2 0 0 d$ embeddings matrix in memory (we list sizes of current best performing models in Table 1).
+
+Taking the perspective from NLP, shallow node encoding in KGs corresponds to shallow word embedding popularized with word2vec (Mikolov et al., 2013) and GloVe (Pennington et al., 2014) that learned a vocabulary of 400K-2M most frequent words, treating rarer ones as out-of-vocabulary (OOV). The OOV issue was resolved with the ability to build infinite combinations with a finite vocabulary enabled by subword units. Subword-powered algorithms such as fastText (Bojanowski et al., 2017), Byte-Pair Encoding (Sennrich et al., 2016), and WordPiece (Schuster & Nakajima, 2012) became a standard step in preprocessing pipelines of large language models and allowed to construct fixed-size token vocabularies, e.g., BERT (Devlin et al., 2019) contains $\mathord { \sim } 3 0 \mathrm { K }$ tokens and
+
+Table 1: Node embedding sizes of state-of-the-art KG embedding models compared to BERT Large. Parameters of type float32 take 4 bytes each. FB15k-237, WN18RR, and YAGO3-10 models as reported in Sun et al. (2019), OGB WikiKG2 as in Zhang et al. (2020c), Wikidata 5M as in Wang et al. (2021), PBG Wikidata as in Lerer et al. (2019), and BERT Large as in Devlin et al. (2019).
+
+
FB15k-237
WN18RR
YAGO3-10
OGBWikiKG2
Wikidata 5M
PBG Wikidata
BERT Large
Vocabulary size
15k
40k
120k
2.5M
5M
78M
30k
Embedding dim
2000
1000
1000
200
512
200
1024
GPU RAM, GB
0.12
0.15
0.46
1.87
9.69
58.1
0.12
+
+GPT-2 (Radford et al., 2019) employs $\mathord { \sim } 5 0 \mathrm { K }$ tokens. Importantly, relatively small input embedding matrices enabled investing the parameters budget into more efficient encoders (Kaplan et al., 2020).
+
+Drawing inspiration from subword embeddings in NLP, we explore how similar strategies for tokenizing entities in large graphs can dramatically reduce parameter complexity, increase generalization, and naturally represent new unseen entities as using the same fixed vocabulary. To do so, tokenization has to rely on atoms akin to subword units and not the total set of nodes.
+
+To this end, we propose NodePiece, an anchor-based approach to learn a fixed-size vocabulary $V$ $( | V | \ll | N | )$ of any connected multi-relational graph. In NodePiece, the set of atoms consists of anchors and all relation types that, together, allow to construct a combinatorial number of sequences from a limited atoms vocabulary. In contrast to shallow approaches, each node $n$ is first tokenized into a unique $h a s h ( n )$ of $k$ closest anchors and $m$ immediate relations. A key element to build a node embedding is a proper encoder function $e n c ( n ) : h a s h ( n ) \mathbb { R } ^ { d }$ which can be designed leveraging inductive biases of an underlying graph or downstream tasks. Therefore, the overall parameter budget is now defined by a small fixed-size vocabulary of atoms and the complexity of the encoder function.
+
+Our experimental findings suggest that a fixed-size NodePiece vocabulary paired with a simple encoder still yields competitive results on a variety of tasks including link prediction, node classification, and relation prediction. Furthermore, anchor-based hashing enables conventional embedding models to work in the inductive and out-of-sample scenarios when unseen entities arrive at inference time, which otherwise required tailored learning mechanisms.
+
+# 2 RELATED WORK
+
+Conventional KG embedding approaches. To the best of our knowledge, all contemporary embedding algorithms (Ji et al., 2020; Ali et al., 2020) for link prediction on KGs employ shallow embedding lookups mapping each entity to a unique embedding vector thus being linear $O ( | N | )$ to the total number of nodes $| N |$ and size of an embedding matrix. This holds for different embedding families, e.g., translational (Sun et al., 2019), tensor factorization (Lacroix et al., 2018), convolutional (Dettmers et al., 2018), and hyperbolic (Chami et al., 2020; Balazevic et al., 2019). The same applies to relation-aware graph neural network (GNN) encoders (Schlichtkrull et al., 2018; Vashishth et al., 2020) who still initialize each node with a learned embedding or feature vector before message passing. Furthermore, shallow encoding is also used in higher-order KG structures such as hypergraphs (Fatemi et al., 2020) and hyper-relational graphs (Rosso et al., 2020; Galkin et al., 2020). NodePiece can be used as a drop-in replacement of the embedding lookup with any of those models.
+
+Distillation and compression. Several recent techniques for reducing memory footprint of embedding matrices follow successful applications of distilling large language models in NLP (Sanh et al., 2019), i.e., distillation (Wang et al., 2020; Zhu et al., 2020) into low-dimensional counterparts, and compression of trained matrices into discrete codes (Sachan, 2020). However, all of them require a full embedding matrix as input which we aim to avoid designing NodePiece.
+
+Vocabulary reduction in recommender systems. Commonly, recommender systems operate on thousands of categorical features combined in sparse high-dimensional vectors.Recent approaches (Medini et al., 2021; Liang et al., 2021) employ anchor-based hashing techniques to factorize sparse feature vectors into dense embeddings. Contrary to those setups, we do not expect availability of feature vectors for arbitrary KGs and rather learn vocabulary embeddings from scratch.
+
+
+Figure 1: NodePiece tokenization strategy. Given three anchors $a _ { 1 } , a _ { 2 } , a _ { 3 }$ , a target node can be tokenized into a hash of top- $k$ closest anchors, their distances to the target node, and the relational context of outgoing relations from the target node. This hash sequence is passed through an injective encoder to obtain a unique embedding. Inverse relations are added to ensure connectivity.
+
+Entity descriptions and language models. A recent line of work such as KG-BERT (Yao et al., 2019), MLMLM (Clouâtre et al., 2021), BLP (Daza et al., 2021) utilize entity descriptions passed through a language model (LM) encoder as entity embeddings suitable for link prediction. We would like to emphasize that such approaches are rather orthogonal to NodePiece. Textual features are mostly available in Wikipedia-derived KGs like Wikidata but are often missing in domain-specific graphs like social networks and product graphs. We therefore assume textual features are not available and rather learn node representations based on their spatial characteristics. Still, textual features can be easily added by concatenating NodePiece-encoded features with LM-produced features.
+
+Out-of-sample representation learning. This task focuses on predictions involving previously unseen, or out-of-sample, entities that attach to a known KG with a few edges. These new edges are then utilized as a context to compute its embedding. Previous work (Wang et al., 2019; Hamaguchi et al., 2017; Albooyeh et al., 2020) proposed different neighborhood aggregation functions for this process or resorted to meta-learning (Chen et al., 2019; Baek et al., 2020; Zhang et al., 2020a). However, all of them follow the shallow embedding paradigm. Instead, NodePiece uses the new edges as a basis for anchor-based tokenization of new nodes in terms of an existing vocabulary.
+
+# 3 NODEPIECE VOCABULARY CONSTRUCTION
+
+Given a directed KG $G = ( N , E , R )$ consisting of $| N |$ nodes, $| E |$ edges, and $| R |$ relation types, our task is to reduce the original vocabulary size of $| N |$ nodes to a smaller, fixed-size vocabulary of node pieces akin to subword units. In this work, we represent node pieces through anchor nodes $a \in A , A \subset N$ , a pre-selected set of nodes in a graph following a deterministic or stochastic strategy. A full NodePiece vocabulary is then constructed from anchor nodes and relation types, i.e, $V = A + R$ . Note that in order to maintain reachability of each node and balance in- and out-degrees we enrich $G$ with inverse edges with inverse relation types, such that $| R | _ { i n v e r s e } = | R | _ { d i r e c t }$ and $| R | = | R | _ { d i r e c t } + | R | _ { i n v e r s e }$ . Using elements of the constructed vocabulary each node $n$ can be tokenized into $h a s h ( n )$ as a sequence of $k$ closest anchors, discrete anchor distances, and a relational context of $m$ immediate relations. Then, any encoder function $e n c ( n ) : h a s h ( n ) \to \mathbb { R } ^ { d }$ can be applied to embed the hash into a $d$ -dimensional vector. An intuition of the approach is presented in Fig. 1 with each step explained in more detail below.
+
+# 3.1 ANCHOR SELECTION
+
+Subword tokenization algorithms such as BPE (Sennrich et al., 2016) employ deterministic strategies to create tokens and construct a vocabulary, e.g., based on frequencies of co-occurring n-grams, such that more frequent words are tokenized with fewer subword units. On graphs, such strategies might employ centrality measures like degree centrality or Personalized PageRank (Page et al., 1999). However, in our preliminary experiments, we found random anchor selection to be as effective as centrality-based strategies. A choice for deterministic strategies might be justified when optimizing for certain task-specific topological characteristics, e.g., degree and PPR strategies indeed skew the distribution of shortest anchor distances towards smaller values thus increasing chances to find anchors in 2- or 3-hop neighborhood of any node (we provide more evidence for that in Appendix C).
+
+# 3.2 NODE TOKENIZATION
+
+Once the vocabulary $V = A + R$ is constructed, each node $n$ can be hashed (or tokenized) into a $h a s h ( n )$ using 1) $k$ nearest anchors and their discrete distances; 2) $m$ immediate outgoing relations from the relational context of $n$ . Since anchor nodes are concrete nodes in $G$ , they get hashed in the same way as other non-anchor nodes.
+
+Anchors per node. Given $| A |$ anchor nodes, it is impractical to use all of them for encoding each node. Instead, we select $k$ anchors per node and describe two possible strategies for that, i.e., random and deterministic. The basic random strategy uniformly samples an unordered set of $k$ anchors from $A$ yielding $\binom { | A | } { k }$ possible combinations. To avoid collisions when hashing the nodes, $| A |$ and $k$ are to be chosen according to the lower bound on possible combinations that is defined by the total number of nodes, e.g., $\bar { \binom { | A | } { k } } \geq | N |$ . Note that running depth-first search (DFS) to random anchors at inference time is inefficient and, therefore, $h a s h ( n )$ of the random strategy has to be pre-computed.
+
+On the other hand, the deterministic strategy selects an ordered sequence of $k$ nearest anchors. Hence, the anchors can be obtained via breadth-first search (BFS) in the $l$ -hop neighborhood of $n$ at inference time (or pre-computed for speed reasons). However, the combinatorial bound is not applicable in this strategy and we need more discriminative signals to avoid hash collisions since nearby nodes will have similar anchors (we elaborate on the uniqueness issue in Appendix K). Such signals have to better ground anchors to the underlying graph structure, and we accomplish that using anchor distances3 and relational context described below.
+
+A node residing in a disconnected component is assigned with an auxiliary [DISCONNECTED] token or can be turned into an anchor. However, the majority of existing KGs are graphs with one large connected component with very few disconnected nodes, such that this effect is negligible.
+
+Anchor Distances. Given a target node $n$ and an anchor $a _ { i }$ , we define anchor distance $z _ { a _ { i } } \in$ [0; diameter $\cdot ( G ) ]$ as an integer denoting the shortest path distance between $a _ { i }$ and $n$ in the original graph $G$ . Note that when tokenizing an anchor $a _ { j }$ with the deterministic strategy, the nearest anchor among top- $k$ is always $a _ { j }$ itself with distance 0. We then map each integer to a learnable $d$ -dimensional vector $f _ { z } : z _ { a _ { i } } \to \mathbb { R } ^ { d }$ akin to relative distance encoding scheme.
+
+Relational Context. We also leverage the multi-relational nature of an underlying KG. Commonly4, the amount of unique edge types in $G$ is orders of magnitude smaller than the total number of nodes, i.e., $| R | \ll | N |$ . This fact allows to include the entire $| R |$ in the NodePiece vocabulary $V _ { N P }$ and further featurize each node with a unique relational context. We construct a relational context of a node $n$ by randomly sampling a set of $m$ immediate unique outgoing relations starting from $n$ , i.e., $r c o n _ { n } = \mathsf { \bar { \{ } } r _ { j } \mathsf { \} } ^ { m } \subseteq \mathsf { \bar { \mathcal { N } } } _ { r } ( n ) \mathsf { \bar { \Psi } }$ where $\mathcal { N } _ { r } ( n )$ denotes all outgoing relation types. Due to a non-uniform degree distribution, if $| { \mathcal { N } } _ { r } ( n ) | < m$ , we add auxiliary [PAD] tokens to complete $r c o n _ { n }$ to size $m$ .
+
+# 3.3 ENCODING
+
+At this step, a node $n$ is tokenized into a sequence of $k$ anchors, their $k$ respective distances, and relational context of size $m$ :
+
+$$
+h a s h ( n ) = \Bigl [ \{ a _ { i } \} ^ { k } , \{ z _ { a _ { i } } \} ^ { k } , \{ r _ { j } \} ^ { m } \Bigr ]
+$$
+
+Taking anchors vectors $\mathbf { a _ { n } }$ and relation vectors $\mathbf { r _ { n } }$ from the learnable NodePiece vocabulary $\textbf { V } \in$ $\mathbb { R } ^ { | V | \times \bar { d } }$ , and anchor distances $\mathbf { z _ { a _ { n } } }$ from $\mathbf { Z } \in \mathbb { R } ^ { ( d i a m e t e r ( G ) + 1 ) \times d }$ , we obtain a vectorized hash:
+
+$$
+h a s h ( n ) = \left[ \mathbf { a _ { n } } + \mathbf { z _ { a _ { n } } } , \mathbf { r _ { n } } \right] = \left[ \hat { \mathbf { a } } _ { \mathbf { n } } , \mathbf { r _ { n } } \right] \in \mathbb { R } ^ { ( k + m ) \times d }
+$$
+
+Although other operations are certainly possible, in this work, we use anchor distances as positional encodings of corresponding anchors and sum up their representations that helps to maintain the overall hash dimension of $( \bar { k } + m ) \times d$ .
+
+Finally, an encoder function $e n c : \mathbb { R } ^ { ( k + m ) \times d } \mathbb { R } ^ { d }$ is applied to the vectorized hash to bootstrap an embedding of $n$ . In our experiments, we probe two basic encoders: 1) MLP that takes as input a concatenated hash vector $\mathbb { R } ^ { 1 \times ( k + m ) d }$ projecting it down to $\mathbb { R } ^ { d }$ ; 2) Transformer encoder (Vaswani et al., 2017) with average pooling that takes as input an original sequence $\mathbb { R } ^ { ( k + m ) \times d }$ . While MLP is faster and better scales to graphs with more edges, Transformer is slower but requires less trainable parameters. As the two encoders were chosen to illustrate the general applicability of the whole approach, we leave a study of even more efficient and effective encoders for future work.
+
+While the nearest-neighbor hashing function has a greater number of collisions, its non-arbitrary mapping means that it is effectively permutation invariant. We show this in Proposition 1 through the framework of Janossy pooling and permutation sampling based SGD, $\pi$ -SGD (Murphy et al., 2019). A proof is provided in Appendix H.
+
+Proposition 1. The nearest-anchor encoder with $\textstyle { \binom { | A | } { k } }$ anchors and $| m |$ subsampled relations, can be considered a $\pi$ -SGD approximation of $( k + | m | )$ -ary Janossy pooling with a canonical ordering induced by the anchor distances.
+
+Janossy pooling with $\pi$ -SGD can be used to learn a permutation-invariant function from a broad class of permutation-sensitve functions such as MLPs (Murphy et al., 2019). The permutation-invariant nature of the nearest-neighbor encoding scheme combined with the lack of transductive features such as node-specific embeddings mean that NodePiece can be used for inductive learning tasks as well.
+
+With a fixed-size vocabulary $V _ { N P }$ , the overall complexity and parameter budget of downstream models are largely defined by the complexity of the encoder and its inductive biases. By design, the NodePiece smaller vocabulary - larger encoder framework is similar to various Transformer-based language models (Qiu et al., 2020) whose vocabulary size remains rather stable with the encoder being the most important part responsible for the final performance.
+
+# 4 EXPERIMENTS
+
+We design the experimental program not seeking to outperform the best existing approaches but to show the versatility of NodePiece on a variety of KG-related tasks: transductive, inductive, out-ofsample link prediction, and node classification (with relation prediction results in Appendix I). With this desiderata, we formulate the following research questions: RQ 1) Is it necessary to map each node to a unique vector for an acceptable performance on KG tasks?; RQ 2) What is the effect of hashing features?; RQ 3) Is there an optimal number of anchors per node, after which diminishing returns hit the performance?
+
+# 4.1 TRANSDUCTIVE LINK PREDICTION
+
+Setup. We run experiments on five KGs of different sizes (Appendix A.1) varying the total number of nodes from $\mathord { \sim } 1 5 \mathrm { K }$ to ${ \sim } 2 . 5 \mathbf { M }$ . As a baseline, we compare to RotatE (Sun et al., 2019) that remains one of state-of-the-art shallow embedding models for transductive link prediction tasks. To balance with NodePiece, RotatE operates on a graph with added inverse edges as well. We report MRR with Hits $@ 1 0$ in the filtered (Bordes et al., 2013) setting as evaluation metrics, and count parameters for all models. On larger KGs, we also compare to a smaller RotatE with a similar parameter budget.
+
+In this task, NodePiece is equipped with a 2-layer MLP encoder. For a fair comparison, we also adopt the RotatE scoring function as a link prediction decoder. As to the NodePiece configuration, we generally keep the number of anchors below $10 \%$ of total nodes in respective graphs. We select $1 \mathrm { k } / 2 0$ for FB15k-237 (i.e., total 1000 anchors and 20 anchors per tokenized node) with 15 unique outgoing relations in the relational context; 500/50 with 4 relations for WN18RR; $7 \mathrm { k } / 2 0$ with 6 relations for CoDEx-L; $1 0 \mathrm { k } / 2 0$ with 5 relations for YAGO 3-10. Other hyperparameters are listed in Appendix A.
+
+Discussion. Generally, the results suggest that a fixed-size NodePiece vocabulary of ${ < } 1 0 \%$ of nodes sustains $80 \%$ of Hits $@ 1 0$ compared to 10x larger best shallow models. Some performance loss is expected due to the compositional and compressive nature of entity tokenization. On smaller graphs (Table 2), parameter saving might not be well pronounced due to the overall small number of nodes to embed. Still, taking even as few as 500 nodes as anchors on WN18RR retains $90 \%$ of the best model performance. On bigger graphs (Table 3), parameter efficiency is more pronounced, i.e., on YAGO 3-10, a RotatE model of comparable size is $2 0 \mathrm { H i t s } @ 1 0$ points worse than a NodePiece-based one. This observation can be attributed to the fact the shrinking shallow models results in shrinking the embedding dimension of each node (20d for RotatE) which is inefficient on small parameter budgets. In contrast, a small fixed-size vocabulary allows for larger anchor embedding dimensions (100d for NodePiece with RotatE) since most of the parameter budget is defined by the encoder.
+
+Table 2: Transductive link prediction on smaller KGs. $\dagger$ results taken from (Sun et al., 2019). $| V |$ denotes vocabulary size (anchors $^ +$ relations), $\# \mathrm { P }$ is a total parameter count (millions). $\%$ denotes the Hits $@ 1 0$ ratio based on the strongest model.
+
+
FB15k-237
WN18RR
IV
#P (M)
MRR
H@10
%
|VI
#P (M)
MRR
H@10
%
RotatE
15k + 0.5k
29
0.338t
0.533t
100
40k +22
41
0.476t
0.571t
100
NodePiece + RotatE
1k + 0.5k
3.2
0.256
0.420
79
500+22
4.4
0.403
0.515
90
- no rel. context
1k + 0.5k
2
0.258
0.425
80
500+22
4.2
0.266
0.465
81
- no distances
1k + 0.5k
3.2
0.254
0.421
79
500+22
4.4
0.391
0.510
89
- no anchors,rels only
0+ 0.5k
1.4
0.204
0.355
67
0+22
0.3
0.011
0.019
0.3
+
+Table 3: Transductive link prediction on bigger KGs. The same denotation as in Table 2. Second RotatE has a similar parameter budget as a NodePiece-based model.
+
+
CoDEx-L
YAGO 3-10
IVI
#P(M)
MRR
H@10
%
|VI
#P (M)
MRR
H@10
%
RotatE (500d)
77k + 138
77
0.258
0.387
100
123k + 74
123
0.495t
0.670t
100
RotatE (20d)
77k + 138
3.8
0.196
0.322
83
123k + 74
4.8
0.121
0.262
39
NodePiece+RotatE
7k +138
3.6
0.190
0.313
81
10k +74
4.1
0.247
0.488
73
- no rel. context
7k +138
3.1
0.201
0.332
86
10k+74
3.7
0.249
0.482
72
- no distances
7k +138
3.6
0.179
0.302
78
10k + 74
4.1
0.250
0.491
73
- no anchors,rels only
0+138
0.6
0.063
0.121
31
0+74
0.5
0.025
0.041
6
+
+We further study the effect of different anchor selection combinations (Fig. 2). On WN18RR, fewer anchors with fewer anchors per node $( | A | / k )$ yield relatively low accuracy but starting from 50/20 $( \sim 0 . 1 \%$ of $4 0 \mathrm { k }$ nodes in the graph) the Hits $@ 1 0$ performance starts to saturate. On FB15k-237, as few as 25 anchors already exhibit the signs of saturation where a further increase to 500 or 1000 anchors only marginally improves the performance. We hypothesize such a difference can be explained by graph density, e.g., WN18RR is a sparse graph with a diameter of 23 and average anchor distance of 6 hops; while FB15k-237 is a denser graph with an average anchor distance of 2-3. Hence, on a sparse graph with longer distances, it takes more anchors to properly encode a node.
+
+However, more precise predictions (e.g., Hits $@ 1$ ) reflected in the MRR metric (see Appendix E) still remain a challenging task for small vocabulary NodePiece setups, and bigger $| A | / k$ combinations alleviate this issue. We also observe that diminishing returns, which make further vocabulary increase less rewarding, start to appear from anchor set sizes of ${ \sim } 1 \%$ of total nodes.
+
+Ablations. In the ablation study, we measure the impact of relational context and anchor distances on link prediction (Table 2). Removing relational context and anchor distances does not tangibly affect the denser FB15k-237 data but does impair the accuracy on the sparser WN18RR. Pushing vocabulary sizes to the limit, we also investigate NodePiece behavior in the absence of anchors at all, i.e., when hashes are defined only by the relational context of size $m$ . Interestingly, this still yields fair performance on FB15k-237 with just 7 points $\mathrm { H i t s } @ 1 0$ drop, but drops to zero the WN18RR performance. The fact that node embeddings might not be at all necessary but relations are more important supports the recent findings of Teru et al. (2020) that relies only on relations seen in a small subgraph around a target node. However, at this point, it seems to be a virtue of graphs with a diverse set of unique relations. That is, FB15k-237 has $2 0 \mathrm { x }$ more unique relations than WN18RR and resulting hashes have more diverse combinations of relations which lead to more discriminative node representations. Additionally, we visualize anchor embedding projections in Appendix D.
+
+
+Figure 2: Combinations of total anchors $A$ and anchors per node. Denser FB15k-237 saturates faster on smaller $A$ while sparse WN18RR saturates at around 500 anchors.
+
+# 4.1.1 OGB WIKIKG 2
+
+To measure the benefits of NodePiece on large-scale KGs, we run a link prediction experiment on OGB WikiKG 2 (Hu et al., 2020), a subset of Wikidata that consists of $2 . 5 \mathbf { M }$ nodes and 16M edges. NodePiece is configured to sample a vocabulary 20K anchor nodes $( < 1 \%$ of total nodes) where each node is represented with $k = 2 0$ nearest anchors and a relational context of size $m = 1 2$ , and we use a 2-layer MLP as a hash encoder (other hyperparameters as in Appendix A). Generally, such a NodePiece configuration can be paired with any link prediction decoder and we chose a non-parametric AutoSF (Zhang et al., 2020b) as one of the strongest decoders on this graph. Overall, the NodePiece $^ +$ AutoSF model has only 6.9M parameters, about $7 0 \times$ smaller than top shallow models. Compared to the best reported shallow approaches, the NodePiece-enabled model exhibits (cf. Table 4, averaged over 10 seeds) even better performance achieved with a orders of magnitude smaller parameter budget. We believe this result shows the effectiveness of NodePiece on large KGs with a dramatic parameter size reduction without significant performance losses. Ablations report the duality of a relational context, i.e., removing it from hashes leads to even higher MRR scores. On the other hand, the relational context alone with 0 learnable anchors still yields considerably better results than $1 0 0 0 \times$ larger shallow models RotatE and TransE.
+
+Table 4: Test MRR and parameter budget on OGB WikiKG 2.
+
+
Model
#Params
MRR
NP + AutoSF - rel. context
6.9M 5.9M
0.570 ±0.003 0.592 ±0.003
- anc.dists - no anchors
6.9M 1.3M
0.570 ±0.004 0.476 ±0.001
AutoSF
500M
PairRE
0.546 ±0.005
500M
0.521 ±0.003
RotatE
1250M
0.433 ±0.002
TransE
1250M
0.426 ±0.003
+
+# 4.2 INDUCTIVE LINK PREDICTION
+
+We conduct a set of experiments on the inductive link prediction benchmark introduced by Teru et al. (2020) to measure the performance of NodePiece features in the extreme case when anchor nodes are not available and only relational context can be used to compose entity representations.
+
+Setup. The unique feature of this benchmark compared to other evaluated tasks is that training and inference graphs are disjoint, i.e., inference at validation and test time is performed on a completely new graph comprised of new entities, and link prediction involves only entities unseen during training. As inference graphs are disconnected from training ones, learning anchors from the training graph is useless, so node hashes are built only using the $m$ -sized relational context. On top of the obtained NodePiece features we then employ a relational message passing GNN, CompGCN (Vashishth et al., 2020), with RotatE (Sun et al., 2019) as a scoring function for triples. More details on the setup and best hyperparameters for NodePiece are presented in Appendix J.
+
+Baselines. We compare NodePiece $^ +$ CompGCN with two families of models applicable in the inductive setting, i.e., rule-based methods, Neural LP (Yang et al., 2017), DRUM (Sadeghian et al., 2019), RuleN (Meilicke et al., 2018), and GNNs: GraIL (Teru et al., 2020) and recently proposed Neural Bellman-Ford Nets (NBFNet) (Zhu et al., 2021).
+
+Discussion. Generally, the results confirm the trend identified previously: relation-only features are strong performers in dense relation-rich graphs. NodePiece features paired with CompGCN significantly improve over path-based methods where performance gap might reach 37 absolute Hits $@ 1 0$ points, e.g., in FB15k-237 V1 and NELL-995 V1. Comparing to GNNs, NodePiece $^ +$
+
+Table 5: Inductive link prediction results, $\mathrm { H i t s } @ 1 0 .$ . Best results are in bold, second best are underlined. $\dagger$ results taken from Teru et al. (2020). NBFNet results taken from Zhu et al. (2021).
+
+
Class
Method
FB15k-237
WN18RR
NELL-995
V1
V2
V3
V4
v1
V2
V3
V4
V1
V2
V3
V4
Path
Neural LP †
0.529
0.589
0.529
0.559
0.744
0.689
0.462
0.671
0.408
0.787
0.827
0.806
DRUM+
0.529
0.587
0.529
0.559
0.744
0.689
0.462
0.671
0.194
0.786
0.827
0.806
RuleN†
0.498
0.778
0.877
0.856
0.809
0.782
0.534
0.716
0.535
0.818
0.773
0.614
GNN
GraIL +
0.642
0.818
0.828
0.893
0.825
0.787
0.584
0.734
0.595
0.933
0.914
0.732
NBFNet
0.834
0.949
0.951
0.960
0.948
0.905
0.893
0.890
-
、
-
-
NP + CompGCN
0.873
0.939
0.944
0.949
0.830
0.886
0.785
0.807
0.890
0.901
0.936
0.893
+
+Table 6: Node classification results. $| V |$ denotes vocabulary size (anchors $^ +$ relations), #P is a total parameter count (millions).
+WD50K labeled)
+
+
+
WD50K (5%labeled)
WD50K(10%labeled)
|VI
#P (M)
ROC-AUC
PRC-AUC
Hard Acc
ROC-AUC
PRC-AUC
Hard Acc
MLP
46k + 1k
4.1
0.503
0.016
0.001
0.510
0.017
0.002
CompGCN
46k + 1k
4.4
0.836
0.280
0.176
0.834
0.265
0.161
NodePiece +GNN
50+1k
0.75
0.981
0.443
0.513
0.981
0.450
0.516
- no rel. context
50+1k
0.64
0.982
0.446
0.534
0.982
0.449
0.530
- no distances
50+1k
0.74
0.981
0.448
0.516
0.981
0.448
0.513
- no anchors,rels only
0+ 1k
0.54
0.984
0.453
0.532
0.984
0.456
0.533
+
+CompGCN outperforms GraIL by a large margin in all (except one) experiments and is competitive to NBFNet on relation-rich FB15k-237 splits. As expected, NodePiece features are less efficient on sparse graphs (like WN18RR with few unique relations) but still outperform topology-based GraIL.
+
+# 4.3 NODE CLASSIFICATION
+
+Setup. Due to the lack of established node classification datasets on multi-relational KGs, we design a multi-class multi-label task based on a triple version of a recent WD50K (Galkin et al., 2020) extracted from Wikidata. The pre-processing steps are described in Appendix F, and the final graph consists of 46K nodes and 222K edges. The task belongs to the family of transductive (the whole graph is seen during training) semi-supervised (only a fraction of nodes are labeled) problems, where labels are 465 classes as seen in Wikidata. In a semi-supervised mode, we test the models on a graph with $5 \%$ and $10 \%$ of labeled nodes. Node features have to be learned as node embeddings.
+
+As baselines, we compare to a 2-layer MLP and CompGCN (Vashishth et al., 2020) in a full-batch mode which is one of the strongest GNN encoders for multi-relational KGs. Both baselines learn a full entity vocabulary. We report ROC-AUC, PRC-AUC, and Hard Accuracy metrics as commonly done in standard graph benchmarks like OGB (Hu et al., 2020). For PRC-AUC and Hard Accuracy, we binarize predicted logits using a threshold of 0.5. Hard Accuracy corresponds to the exact match of a predicted sparse 465-dimensional vector to a sparse 465-dimensional labels vector.
+
+NodePiece is configured to have only 50 anchors and use 10 nearest anchors per node with 5 unique relations in the relational context. The dimensionality of anchors and relations is the same as in the baseline CompGCN. Each epoch, we first materialize all entity embeddings through the NodePiece encoder and then send the materialized matrix to CompGCN with the class predictor.
+
+Discussion. Surprisingly, ${ \sim } 1 0 0 0 \mathrm { x }$ vocabulary reduction ratio (50 anchors against 46k for shallow models) greatly outperforms the baselines (Table 6). MLP, as expected, is not able to cope with the task producing random predictions. CompGCN, in turn, outperforms MLP demonstrating nonrandom outputs as seen by the ROC-AUC score of 0.836 and higher PRC-AUC and Hard Accuracy metrics. Still, a NodePiece-equipped CompGCN with 50 anchors reaches even higher ROC-AUC of 0.98 with considerable improvements along other metrics, i.e., $+ 1 6 - 1 9$ PRC-AUC points and $3 \mathbf { x }$ boost along the hardest accuracy metric. We attribute such a noticeable performance difference to better generalization capabilities of the NodePiece model. That is, a generalization gap between training and validation metrics of the NodePiece $^ +$ CompGCN is much smaller compared to the baselines who overfit rather heavily ( cf. the training curves in the Appendix G). The effect remains after increasing the number of labeled nodes to $10 \%$ . Even with 50 anchors, the overall performance is saturated as the further increase of the vocabulary size did not bring any improvements.
+
+Table 7: Out-of-sample link prediction. $\dagger$ results are taken from (Albooyeh et al., 2020). $| V |$ denotes vocabulary size (anchors $^ +$ relations), #P is a total parameter count (millions).
+
+
oFB15k-237
0YAGO 3-10 (117k)
|VI
#P (M)
MRR
H@10
%
|VI
#P (M)
MRR
H@10
%
oDistMult-ERAvg
11k + 0.5k
2.4
0.256t
0.420t
100
117k + 74
23.4
0OM
0OM
-
NodePiece +DistMult
1k + 0.5k
1
0.206
0.372
88
10k+74
2.7
0.133
0.261
100
- no rel. context
1k + 0.5k
1
0.173
0.329
78
10k +74
2.7
0.125
0.245
94
- no distances
1k + 0.5k
1
0.208
0.372
88
10k + 74
2.7
0.133
0.260
99
- no anchors,rels only
0+ 0.5k
0.8
0.069
0.127
30
0+74
0.7
0.015
0.017
6
+
+Ablations. We probe setups where NodePiece hashes use only anchors or only relational context, and find they both deliver a similar performance. Following the previous experiments on dense graphs with lots of unique relations, it appears that node classification can be performed rather accurately based only on the node relational context which is captured by NodePiece hashes.
+
+# 4.4 OUT-OF-SAMPLE LINK PREDICTION
+
+Setup. In the out-of-sample setup, validation and test splits contain unseen entities that arrive with a few edges connected to the seen nodes. For this experiment, we use the out-of-sample FB15k237 split (oFB15k-237) as designed in Albooyeh et al. (2020). We do not employ their version of WN18RR as the split contains too many disconnected entities and components in the train graph. Instead, using the authors script, we sample a much bigger out-of-sample version of YAGO 3-10.
+
+As a baseline, we compare to oDistMult (Albooyeh et al., 2020) which aggregates embeddings of all seen neighboring nodes around the unseen one (akin to 1-layer message passing with mean aggregator). We adopt the same evaluation protocol - given an unseen node with its connecting edges, we mask one of the edges and predict its tail or head using the rest of the edges, repeating this procedure for each edge. We report filtered MRR and Hits $@ 1 0$ as main metrics.
+
+NodePiece enables traditional transductive-only models to perform inductive inference as both seen and unseen nodes are tokenized using the same vocabulary. For a smaller oFB15k-237 the NodePiece vocabulary has $1 \mathrm { k } / 2 0$ configuration with 15 relations, while in a bigger oYAGO 3-10 we use $1 0 \mathrm { k } / 2 0$ with 5 relations. For this task, we apply a transformer encoder instead of MLP. For a fair comparison, we use DistMult as a scoring function as well.
+
+Discussion. The results in Table 7 show that a simple NodePiece-based model retains ${ \sim } 9 0 \%$ of the baseline performance on oFB15k-237, but achieved faster and computationally inexpensive compared to oDistMult. Moreover, while oDistMult is tailored specifically for the out-of-sample task, we did not do any task-specific modifications to the NodePiece-enabled model as it is inductive by design. Furthermore, oDistMult is not able to scale to a bigger oYAGO 3-10 on a 256 GB RAM machine due to the out of memory crash. Conversely, a NodePiece-equipped model has the same computational requirements as in other tasks and converges rather quickly (40 epochs). Performed ablations underline the importance of having both anchors and relational context for tokenizing unseen entities. We elaborate more on possible inference strategies for transductive and inductive tasks in Appendix A.6.
+
+# 5 CONCLUSION
+
+In this paper, we have introduced NodePiece, a compositional approach for representing nodes in multi-relational graphs with a fixed-size vocabulary. Similar to subword units, NodePiece allows to tokenize every node as a combination of anchors and relations where the number of anchors can be $1 0 { - } 1 0 0 \times$ smaller than the total number of nodes. We show that in some tasks, node embeddings are not even necessary for getting an acceptable accuracy thanks to a rich set of relation types. Moreover, NodePiece is inductive by design and is able to tokenize unseen entities and perform downstream prediction tasks in the same fashion as on seen ones.
+
+Reproducibility Statement. The source code is openly available on GitHub. All hyperparameters and implementation details are presented in Appendix A. Information on the used datasets is presented in Table 8 and we provide more details on dataset construction for node classification and out-ofsample link prediction tasks in Appendix F. The proof for Proposition 1 is given in the Appendix H.
+
+Ethics Statement. As NodePiece is a general graph representation learning method, we do not foresee immediate ethical consequences pertaining to the method itself.
+
+Acknowledgements. The authors would like to thank Koustuv Sinha, Gaurav Maheshwari, and Priyansh Trivedi for insightful and valuable discussions at earlier stages of this work. We also thank anonymous reviewers for the helpful comments. This work is partially supported by the Canada CIFAR AI Chair Program and Samsung AI grant (held at Mila). We thank Mila and Compute Canada for access to computational resources.
+
+# REFERENCES
+
+Marjan Albooyeh, Rishab Goel, and Seyed Mehran Kazemi. Out-of-sample representation learning for knowledge graphs. In Findings of the Association for Computational Linguistics: EMNLP 2020, pp. 2657–2666, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.findings-emnlp.241. URL https://www.aclweb.org/anthology/ 2020.findings-emnlp.241.
+
+Mehdi Ali, Max Berrendorf, Charles Tapley Hoyt, Laurent Vermue, Mikhail Galkin, Sahand Sharifzadeh, Asja Fischer, Volker Tresp, and Jens Lehmann. Bringing light into the dark: A largescale evaluation of knowledge graph embedding models under a unified framework. CoRR, abs/2006.13365, 2020.
+
+Mehdi Ali, Max Berrendorf, Charles Tapley Hoyt, Laurent Vermue, Sahand Sharifzadeh, Volker Tresp, and Jens Lehmann. PyKEEN 1.0: A Python Library for Training and Evaluating Knowledge Graph Embeddings. Journal of Machine Learning Research, 22(82):1–6, 2021. URL http: //jmlr.org/papers/v22/20-825.html.
+
+Jinheon Baek, Dong Bok Lee, and Sung Ju Hwang. Learning to extrapolate knowledge: Transductive few-shot out-of-graph link prediction. Advances in Neural Information Processing Systems, 33, 2020.
+
+Ivana Balazevic, Carl Allen, and Timothy M. Hospedales. Multi-relational poincaré graph embeddings. In Hanna M. Wallach, Hugo Larochelle, Alina Beygelzimer, Florence d’Alché-Buc, Emily B. Fox, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pp. 4465–4475, 2019.
+
+Piotr Bojanowski, Edouard Grave, Armand Joulin, and Tomas Mikolov. Enriching word vectors with subword information. Transactions of the Association for Computational Linguistics, 5:135– 146, 2017. doi: 10.1162/tacl_a_00051. URL https://www.aclweb.org/anthology/ Q17-1010.
+
+Antoine Bordes, Nicolas Usunier, Alberto García-Durán, Jason Weston, and Oksana Yakhnenko. Translating embeddings for modeling multi-relational data. In Christopher J. C. Burges, Léon Bottou, Zoubin Ghahramani, and Kilian Q. Weinberger (eds.), Advances in Neural Information Processing Systems 26: 27th Annual Conference on Neural Information Processing Systems 2013. Proceedings of a meeting held December 5-8, 2013, Lake Tahoe, Nevada, United States, pp. 2787–2795, 2013.
+
+Ines Chami, Adva Wolf, Da-Cheng Juan, Frederic Sala, Sujith Ravi, and Christopher Ré. Lowdimensional hyperbolic knowledge graph embeddings. In Dan Jurafsky, Joyce Chai, Natalie Schluter, and Joel R. Tetreault (eds.), Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pp. 6901–6914. Association for Computational Linguistics, 2020.
+
+Mingyang Chen, Wen Zhang, Wei Zhang, Qiang Chen, and Huajun Chen. Meta relational learning for few-shot link prediction in knowledge graphs. 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. 4208–4217, 2019.
+
+Louis Clouâtre, Philippe Trempe, Amal Zouaq, and Sarath Chandar. MLMLM: link prediction with mean likelihood masked language model. In Chengqing Zong, Fei Xia, Wenjie Li, and Roberto Navigli (eds.), Findings of the Association for Computational Linguistics: ACL/IJCNLP 2021, Online Event, August 1-6, 2021, volume ACL/IJCNLP 2021 of Findings of ACL, pp. 4321–4331. Association for Computational Linguistics, 2021.
+
+Daniel Daza, Michael Cochez, and Paul Groth. Inductive entity representations from text via link prediction. In Jure Leskovec, Marko Grobelnik, Marc Najork, Jie Tang, and Leila Zia (eds.), WWW ’21: The Web Conference 2021, Virtual Event / Ljubljana, Slovenia, April 19-23, 2021, pp. 798–808. ACM / IW3C2, 2021.
+
+Tim Dettmers, Pasquale Minervini, Pontus Stenetorp, and Sebastian Riedel. Convolutional 2d knowledge graph embeddings. In Sheila A. McIlraith and Kilian Q. Weinberger (eds.), Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI-18), the 30th innovative Applications of Artificial Intelligence (IAAI-18), and the 8th AAAI Symposium on Educational Advances in Artificial Intelligence (EAAI-18), New Orleans, Louisiana, USA, February 2-7, 2018, pp. 1811–1818. AAAI Press, 2018.
+
+Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. In Jill Burstein, Christy Doran, and Thamar Solorio (eds.), Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pp. 4171–4186. Association for Computational Linguistics, 2019.
+
+Bahare Fatemi, Perouz Taslakian, David Vázquez, and David Poole. Knowledge hypergraphs: Prediction beyond binary relations. In Christian Bessiere (ed.), Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence, IJCAI 2020, pp. 2191–2197. ijcai.org, 2020.
+
+Matthias Fey and Jan E. Lenssen. Fast graph representation learning with PyTorch Geometric. In ICLR Workshop on Representation Learning on Graphs and Manifolds, 2019.
+
+Mikhail Galkin, Priyansh Trivedi, Gaurav Maheshwari, Ricardo Usbeck, and Jens Lehmann. Message passing for hyper-relational knowledge graphs. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 7346–7359. Association for Computational Linguistics, 2020.
+
+Takuo Hamaguchi, Hidekazu Oiwa, Masashi Shimbo, and Yuji Matsumoto. Knowledge transfer for out-of-knowledge-base entities : A graph neural network approach. In Carles Sierra (ed.), Proceedings of the Twenty-Sixth International Joint Conference on Artificial Intelligence, IJCAI 2017, Melbourne, Australia, August 19-25, 2017, pp. 1802–1808. ijcai.org, 2017.
+
+Weihua Hu, Matthias Fey, Marinka Zitnik, Yuxiao Dong, Hongyu Ren, Bowen Liu, Michele Catasta, and Jure Leskovec. Open graph benchmark: Datasets for machine learning on graphs. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin (eds.), Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
+
+Shaoxiong Ji, Shirui Pan, Erik Cambria, Pekka Marttinen, and Philip S. Yu. A survey on knowledge graphs: Representation, acquisition and applications. CoRR, abs/2002.00388, 2020.
+
+Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
+
+Timothée Lacroix, Nicolas Usunier, and Guillaume Obozinski. Canonical tensor decomposition for knowledge base completion. In Jennifer G. Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmässan, Stockholm, Sweden, July 10-15, 2018, volume 80 of Proceedings of Machine Learning Research, pp. 2869–2878. PMLR, 2018.
+
+Adam Lerer, Ledell Wu, Jiajun Shen, Timothee Lacroix, Luca Wehrstedt, Abhijit Bose, and Alex Peysakhovich. PyTorch-BigGraph: A Large-scale Graph Embedding System. In Proceedings of the 2nd SysML Conference, Palo Alto, CA, USA, 2019.
+
+Paul Pu Liang, Manzil Zaheer, Yuan Wang, and Amr Ahmed. Anchor & transform: Learning sparse embeddings for large vocabularies. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id $\ c =$ Vd7lCMvtLqg.
+
+Farzaneh Mahdisoltani, Joanna Biega, and Fabian M. Suchanek. YAGO3: A knowledge base from multilingual wikipedias. In Seventh Biennial Conference on Innovative Data Systems Research, CIDR 2015, Asilomar, CA, USA, January 4-7, 2015, Online Proceedings. www.cidrdb.org, 2015.
+
+Tharun Medini, Beidi Chen, and Anshumali Shrivastava. {SOLAR}: Sparse orthogonal learned and random embeddings. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ fw-BHZ1KjxJ.
+
+Christian Meilicke, Manuel Fink, Yanjie Wang, Daniel Ruffinelli, Rainer Gemulla, and Heiner Stuckenschmidt. Fine-grained evaluation of rule- and embedding-based systems for knowledge graph completion. In The Semantic Web - ISWC 2018 - 17th International Semantic Web Conference, Monterey, CA, USA, October 8-12, 2018, Proceedings, Part I, volume 11136 of Lecture Notes in Computer Science, pp. 3–20. Springer, 2018.
+
+Tomás Mikolov, Ilya Sutskever, Kai Chen, Gregory S. Corrado, and Jeffrey Dean. Distributed representations of words and phrases and their compositionality. In Christopher J. C. Burges, Léon Bottou, Zoubin Ghahramani, and Kilian Q. Weinberger (eds.), Advances in Neural Information Processing Systems 26: 27th Annual Conference on Neural Information Processing Systems 2013. Proceedings of a meeting held December 5-8, 2013, Lake Tahoe, Nevada, United States, pp. 3111–3119, 2013.
+
+Ryan L. Murphy, Balasubramaniam Srinivasan, Vinayak Rao, and Bruno Ribeiro. Janossy pooling: Learning deep permutation-invariant functions for variable-size inputs, 2019.
+
+Maximilian Nickel, Kevin Murphy, Volker Tresp, and Evgeniy Gabrilovich. A review of relational machine learning for knowledge graphs. Proc. IEEE, 104(1):11–33, 2016.
+
+Lawrence Page, Sergey Brin, Rajeev Motwani, and Terry Winograd. The pagerank citation ranking: Bringing order to the web. Technical Report 1999-66, Stanford InfoLab, November 1999. Previous number $=$ SIDL-WP-1999-0120.
+
+Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Köpf, 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: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pp. 8024–8035, 2019.
+
+Jeffrey Pennington, Richard Socher, and Christopher D. Manning. Glove: Global vectors for word representation. In Alessandro Moschitti, Bo Pang, and Walter Daelemans (eds.), Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing, EMNLP 2014, October 25-29, 2014, Doha, Qatar, A meeting of SIGDAT, a Special Interest Group of the ACL, pp. 1532–1543. ACL, 2014.
+
+Xipeng Qiu, Tianxiang Sun, Yige Xu, Yunfan Shao, Ning Dai, and Xuanjing Huang. Pre-trained models for natural language processing: A survey. Science China Technological Sciences, pp. 1–26, 2020.
+
+Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
+
+Paolo Rosso, Dingqi Yang, and Philippe Cudré-Mauroux. Beyond triplets: Hyper-relational knowledge graph embedding for link prediction. In Proceedings of The Web Conference 2020, pp. 1885–1896, 2020.
+
+Mrinmaya Sachan. Knowledge graph embedding compression. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 2681–2691, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.238. URL https: //www.aclweb.org/anthology/2020.acl-main.238.
+
+Ali Sadeghian, Mohammadreza Armandpour, Patrick Ding, and Daisy Zhe Wang. DRUM: end-to-end differentiable rule mining on knowledge graphs. In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pp. 15321–15331, 2019.
+
+Tara Safavi and Danai Koutra. CoDEx: A Comprehensive Knowledge Graph Completion Benchmark. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 8328–8350, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.669. URL https://www.aclweb.org/anthology/ 2020.emnlp-main.669.
+
+Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. Distilbert, a distilled version of BERT: smaller, faster, cheaper and lighter. CoRR, abs/1910.01108, 2019. URL http://arxiv. org/abs/1910.01108.
+
+Michael Sejr Schlichtkrull, Thomas N. Kipf, Peter Bloem, Rianne van den Berg, Ivan Titov, and Max Welling. Modeling relational data with graph convolutional networks. In The Semantic Web - 15th International Conference, ESWC 2018, Heraklion, Crete, Greece, June 3-7, 2018, Proceedings, volume 10843 of Lecture Notes in Computer Science, pp. 593–607. Springer, 2018.
+
+Mike Schuster and Kaisuke Nakajima. Japanese and korean voice search. In 2012 IEEE International Conference on Acoustics, Speech and Signal Processing, ICASSP 2012, Kyoto, Japan, March 25-30, 2012, pp. 5149–5152. IEEE, 2012. doi: 10.1109/ICASSP.2012.6289079. URL https: //doi.org/10.1109/ICASSP.2012.6289079.
+
+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, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1162. URL https://www.aclweb. org/anthology/P16-1162.
+
+Zhiqing Sun, Zhi-Hong Deng, Jian-Yun Nie, and Jian Tang. Rotate: Knowledge graph embedding by relational rotation in complex space. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net, 2019.
+
+Komal K. Teru, Etienne Denis, and Will Hamilton. Inductive relation prediction by subgraph reasoning. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, volume 119 of Proceedings of Machine Learning Research, pp. 9448–9457. PMLR, 2020.
+
+Kristina Toutanova and Danqi Chen. Observed versus latent features for knowledge base and text inference. In Proceedings of the 3rd Workshop on Continuous Vector Space Models and their Compositionality, pp. 57–66, Beijing, China, July 2015. Association for Computational Linguistics. doi: 10.18653/v1/W15-4007. URL https://www.aclweb.org/anthology/ W15-4007.
+
+Shikhar Vashishth, Soumya Sanyal, Vikram Nitin, and Partha Talukdar. Composition-based multirelational graph convolutional networks. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id ${ . } = { }$ BylA_C4tPr.
+
+Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pp. 5998–6008, 2017.
+
+Denny Vrandecic and Markus Krötzsch. Wikidata: a free collaborative knowledgebase. Commun. ACM, 57(10):78–85, 2014.
+
+Kai Wang, Yu Liu, Qian Ma, and Quan Z Sheng. Mulde: Multi-teacher knowledge distillation for low-dimensional knowledge graph embeddings. arXiv preprint arXiv:2010.07152, 2020.
+
+Peifeng Wang, Jialong Han, Chenliang Li, and Rong Pan. Logic attention based neighborhood aggregation for inductive knowledge graph embedding. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 7152–7159, 2019.
+
+Xiaozhi Wang, Tianyu Gao, Zhaocheng Zhu, Zhengyan Zhang, Zhiyuan Liu, Juanzi Li, and Jian Tang. KEPLER: A unified model for knowledge embedding and pre-trained language representation. Trans. Assoc. Comput. Linguistics, 9:176–194, 2021.
+
+Fan Yang, Zhilin Yang, and William W. Cohen. Differentiable learning of logical rules for knowledge base reasoning. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pp. 2319–2328, 2017.
+
+Liang Yao, Chengsheng Mao, and Yuan Luo. KG-BERT: BERT for knowledge graph completion. CoRR, abs/1909.03193, 2019. URL http://arxiv.org/abs/1909.03193.
+
+Chuxu Zhang, Huaxiu Yao, Chao Huang, Meng Jiang, Zhenhui Li, and Nitesh V Chawla. Few-shot knowledge graph completion. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 3041–3048, 2020a.
+
+Yongqi Zhang, Quanming Yao, Wenyuan Dai, and Lei Chen. Autosf: Searching scoring functions for knowledge graph embedding. In 36th IEEE International Conference on Data Engineering, ICDE 2020, Dallas, TX, USA, April 20-24, 2020, pp. 433–444. IEEE, 2020b.
+
+Yongqi Zhang, Quanming Yao, Wenyuan Dai, and Lei Chen. Autosf: Searching scoring functions for knowledge graph embedding. In 2020 IEEE 36th International Conference on Data Engineering (ICDE), pp. 433–444. IEEE, 2020c.
+
+Yushan Zhu, Wen Zhang, Hui Chen, Xu Cheng, Wei Zhang, and Huajun Chen. Distile: Distiling knowledge graph embeddings for faster and cheaper reasoning. arXiv preprint arXiv:2009.05912, 2020.
+
+Zhaocheng Zhu, Zuobai Zhang, Louis-Pascal Xhonneux, and Jian Tang. Neural bellman-ford networks: A general graph neural network framework for link prediction. In Neural Information Processing Systems, NeurIPS, 2021.
+
+# A IMPLEMENTATION & HYPERPARAMETERS
+
+Table 8: Dataset statistics. LP - link prediction, RP - relation prediction, NC - node classification, OOS - out-of-sample. In OOS-LP, Nodes also shows the amount of unseen nodes in validation/test.
+
+
Dataset
Task
Nodes
Relations
Edges
Train
Validation
Test
FB15k-237(Toutanova & Chen,2015)
LP,RP
14,505
237
310.079
272,115
17,526
20.438
WN18RR (Dettmers et al.,2018)
LP,RP
40,559
11
92.583
86.835
2824
2924
CoDEx-Large (Safavi & Koutra,2020)
LP
77,951
69
612,437
551,193
30,622
30,622
YAGO 3-10 (Mahdisoltani et al., 2015)
LP,RP
123,143
37
1,089,000
1,079,040
4978
4982
OGB WikiKG 2 (Hu et al.,2020)
LP
2,500,604
535
17,137,181
16,109,182
429,456
598,543
WD50K
NC
46,164
526
222.563
4600 (N)
4600 (N)
4600 (N)
oFB15k-237 (Albooyeh et al.,2020)
OOS-LP
11k/1395/1395
234
292,173
193,490
44,601
54,082
oYAGO 3-10
OOS-LP
117k/2960/2959
37
1,086,416
988,124
47,112
51,180
+
+Table 9: Inductive relation prediction dataset statistics. Facts denote the size of the input graph while queries denote the triples to be predicted. Training sets contain all queries as facts. Note that in validation and test we receive a new graph disjoint from the training one, and queries are sent against this new inference graph (hence the number of entities and facts for validation and test is the same).
+
+
Dataset
Relations
Train
Validation
Test
Entity
Query
Facts
Entity
Query
Fact
Entity
Query
Facts
FB15k-237
v1
183
2.000
4,245
4,245
1,500
206
1,993
1,500
205
1,993
v2
203
3,000
9,739
9,739
2,000
469
4,145
2.000
478
4,145
v3
218
4,000
17,986
17,986
3.000
866
7,406
3,000
865
7,406
Vv4
222
5,000
27,203
27,203
3,500
1,416
11,714
3,500
1,424
11,714
WN18RR
v1
9
2,746
5,410
5,410
922
185
1,618
922
188
1,618
v2
10
6,954
15,262
15,262
2,923
411
4,011
2.923
441
4,011
v3
11
12.078
25,901
25,901
5,084
538
6,327
5.084
605
6.327
V4
9
3,861
7,940
7,940
7,208
1,394
12,334
7,208
1,429
12.334
NELL-995
v1
14
3,103
4,687
4,687
225
101
833
225
100
833
v2
88
2,564
8,219
8,219
4,937
459
4,586
4,937
476
4,586
v3
142
4,647
16,393
16,393
4,921
811
8.048
4,921
809
8.048
v4
77
2,092
7,546
7,546
3,294
716
7,073
3,294
731
7,073
+
+NodePiece is implemented in Python using igraph library (licensed under GNU GPL 2) for computing centrality measures and perform basic tokenization. Downstream tasks employ NodePiece in conjunction with PyTorch (Paszke et al., 2019) (BSD-style license), PyKEEN (Ali et al., 2021) (MIT License), and PyTorch-Geometric (Fey & Lenssen, 2019) (MIT License). We ran experiments on a machine with one RTX 8000 GPU and 64 GB RAM. The OGB WikiKG 2 experiments were executed on a single Tesla V100 16 GB VRAM and 64 GB RAM. All used datasets are available under open licenses.
+
+For all downstream tasks and datasets we employ the deterministic anchor selection strategy where $40 \%$ of the total number of anchors $| A |$ are nodes with top PPR scores, $40 \%$ are top degree nodes, and remaining $20 \%$ are selected randomly. All anchor sets are non-overlapping and disjoint, i.e., if some top degree nodes have already been selected with the PPR policy, they will be skipped in favor of next nodes in the sorted list. The choice for this strategy is motivated in Appendix C.
+
+# A.1 DATASETS
+
+Details on the datasets for transductive link prediction, out-of-sample link prediction, relation prediction and node classification are collected in Table 8. The inductive link prediction benchmark introduced by Teru et al. (2020) includes 3 graphs, FB15k-237, WN18RR, and NELL-995, each has 4 different splits that vary in the number of unique relations, number of nodes and triples at training and inference time. Full dataset statistics is provided in Table 9. FB15k-237 and most splits of NELL-995 can be considered as relation-rich graphs while WN18RR is a sparse graph with few relation types.
+
+# A.2 TRANSDUCTIVE LINK PREDICTION
+
+The optimizer is Adam for all experiments. As RotatE is a scoring function in the complex space, the reported embedding dimensions are a sum of real and imaginary dimensions, e.g., 1000d means that both real and imaginary vectors are 500d.
+
+Table 10: NodePiece hyperparameters for transductive link prediction experiments
+
+
Parameter
FB15k-237
WN18RR
CoDEx-L
YAGO 3-10
OGB WikiKG 2
# Anchors, |A|
1000
500
7000
10000
20000
# Anchors per node,k
20
50
20
20
20
Relational context, m
15
4
6
5
12
Vocabulary dim, d
200
200
200
200
200
Batch size
512
512
256
512
512
Learning rate
0.0005
0.0005
0.0005
0.00025
0.0001
Epochs
400
600
120
600
300k (steps)
Encoder type
MLP
MLP
MLP
MLP
MLP
Encoder dim
400
400
400
400
400
Encoder layers
2
2
2
2
2
Encoder dropout
0.1
0.1
0.1
0.1
0.1
Loss function
BCE
NSSAL
BCE
NSSAL
NSSAL
Margin
-
15
-
50
50
# Negative samples
=
20
1
10
128
Label smoothing
0.4
1
0.3
1
1
Training time, hours
7
5.5
26
23
11
+
+Table 11: RotatE hyperparameters for transductive link prediction experiments. CoDEx-L and YAGO 3-10 also list the hyperparameters (after the symbol / ) for smaller models (reported in Table 3) of the same parameter budget as NodePiece
+
+
Parameter
FB15k-237
WN18RR
CoDEx-L
YAGO 3-10
Embedding dim, d
2000
1000
1000 /50
1000 /40
Batch size
1024
512
512/512
1024 /512
Loss function
NSSAL
NSSAL
NSSAL
NSSAL
Margin
9
6
25/9
24/15
# Negative samples
256
1024
100 /100
400/100
+
+# A.3 RELATION PREDICTION
+
+Configurations (Table 12) for the compared models are almost identical to those of the transductive link prediction experiment. We mostly reduce the number of epochs and negative samples as models converge faster on this task.
+
+# A.4 NODE CLASSIFICATION
+
+In this experiment (Table 13), NodePiece is used at the initial step to bootstrap a node embeddings matrix which is then sent to the CompGCN graph encoder. In contrast, CompGCN and MLP baselines use directly a trained node embedding matrix as their initial input.
+
+# A.5 OUT-OF-SAMPLE LINK PREDICTION
+
+The set of NodePiece hyperparameters (Table 14) is similar to the set of the transductive experiments except the scoring function (DistMult), encoder function (Transformer), and number of epochs as the model converges faster. We do not provide a setup for the baseline oDistMult on oYAGO 3-10 as the model was not able to pre-process the dataset on a machine with 256 GB RAM. Reported training times for NodePiece models exclude evaluation. Training times of the baseline oDistMult were not reported by its authors.
+
+Table 12: Hyperparameters for relation prediction experiments. The content is largely identical to Table 10, only changed parameters are listed
+
+
NodePiece+RotatE
RotatE
Parameter
FB15k-237
WN18RR
YAGO 3-10
FB15k-237
WN18RR
YAGO 3-10
Batch size
512
512
512
512
512
512
Epochs
20
150
7
150
150
150
Loss function
NSSAL
NSSAL
NSSAL
NSSAL
NSSAL
NSSAL
Margin
15
12
25
9
3
5
# Negative samples
20
20
20
20
20
20
Training time,min
25
30
25
28
10
57
+
+Table 13: Hyperparameters for node classification experiments
+
+
Parameter
NodePiece + CompGCN
CompGCN
MLP
# Anchors, |Al
50
=
# Anchors per node, k
10
=
Relational context,m
5
=
1
Vocabulary dim, d
100
100
100
Batch size
512
512
512
Learning rate
0.001
0.001
0.001
Epochs
4000
4000
4000
NodePiece encoder
MLP
-
-
NodePiece encoder dim
200
1
NodePiece encoder layers
2
NodePiece encoder dropout
0.1
=
=
GNN (MLP) layers
3
3
3
GNN (MLP) dropout
0.5
0.5
0.5
Loss function
BCE
BCE
BCE
Label smoothing
0.1
0.1
0.1
Training time, hours
14
22
6
+
+A.6 DEPLOYMENT IN REAL-WORLD DYNAMIC KNOWLEDGE GRAPHS
+
+NodePiece, on account of its compositional representation, can be applied to dynamic real-world knowledge graphs where nodes are added and removed over time. That is, training on a graph snapshot we can obtain the embeddings of new nodes without re-computing and updating representations of every other node in the graph. This is valuable in settings where there are latency requirements such as many online services. For example, if a user creates an account on a social media service and begins liking content (represented as a “like” edge in the social network graph between the user and the content), it would be desirable to make future content recommendations rapidly reflect this new data without waiting for the next batched retraining to update the users embedding. In order to reduce latency the entire embedding matrix can be materialized and cached ahead of time, updating embeddings as new nodes and edges are added. The parameter efficiency and compositionality of NodePeice means that for large real-world graphs NodePiece subsumes what would before have been a complex system of a large-scale embedding framework like Pytorch-BigGraph (Lerer et al., 2019), an OOV embedding method (e.g,. ERAvg) and a shallow embedding method (e.g., RotatE).
+
+Table 14: Hyperparameters for out-of-sample link prediction experiments. The content is largely identical to Table 10, only changed parameters are listed
+
+
Parameter
NodePiece+DistMult
oDistMult
oFB15k-237
oYAGO 3-10
# Anchors, |A|
1000
10000
# Anchors per node,k
20
20
=
Relational context, m
15
5
=
Vocabulary dim,d
200
200
200
Batch size
256
256
1000
Learning rate
0.0005
0.0005
0.01
Epochs
40
40
1000
NodePiece encoder
Transformer
Transformer
-
NodePiece encoder dim
512
512
■
NodePiece encoder layers
2
2
NodePiece encoder dropout
0.1
0.1
Loss function
Softplus
Softplus
Softplus
# Negative samples
5
5
1
Training time,hours
2
8
+
+# B LIMITATIONS AND FUTURE WORK
+
+Our experimental results demonstrate the promise of using NodePeice to significantly reduce the parameter complexity of node embeddings. While it is difficult to prove, we also hypothesize that the parameters required by NodePeice to maintain the same level of performance (as the graph scales) increase sublinearly according to the size of the graph. The intuition for this is twofold. First, the number of unique anchor combinations of size $k$ that can be encoded increases according to $\textstyle { \binom { | A | } { k } }$ (i.e. $\mathcal { O } ( | A | ^ { k } ) )$ if randomly sampled — if the sampling is done via nearest neighbor anchor selection then the number of unique permutations is expected to increase polynomially. Second, increasing the size of the graph will only require sublinear increase in the number of anchors in order to maintain the same average node-anchor distance. Although proving causality is difficult, we believe that maintaining hashing uniqueness and node-anchor distances stable will be sufficient to maintain equivalent performance.
+
+# C ANCHOR SELECTION STRATEGIES
+
+Here, we provide more details as to anchor configurations ( $k$ nearest from total $A$ anchors) and anchor distances. Recall that there exist several ways to select the total set of anchors $A$ as stated in Section 3.1, i.e., random or centrality-measure based. Then, $k$ anchors per node can be chosen either as $k$ nearest (default NodePiece mode) or $k$ random anchors. Figure 3 depicts the effect of those strategies on the distribution of anchor distances (number of hops between a target node and its anchors). We use the configurations used in the main experiments, i.e., 1000 anchors and 20 anchors per node for FB15k-237, and 500 anchors with 50 anchors per node on WN18RR.
+
+First, we observe that PPR, degree, and mixed ( $40 \%$ PPR, $40 \%$ degree, $20 \%$ random) strategies generally skew the distribution towards smaller anchor distances compared to random strategies. This fact supports the hypothesis that deterministic strategies improve the chances to find an anchor in a closer $l$ -hop neighborhood of a target node. Second, varying the way of selecting $k$ anchors per node between nearest (left column) and random (right column), we also observe the skew of a distribution of anchor distances.
+
+Next, we fix the anchor selection strategy to the mix, fix the number of anchors per node (50 for WN18RR and 20 for FB15k-237), and vary a total number of anchors $A$ (50 to 1000 for WN18RR and 20 to 1000 for FB15k-237) along with the method of sampling $k$ anchors per node, i.e., nearest and random. Figure 4 shows that increasing the total number of anchors together with $k$ nearest anchors again skews the distribution of anchor distances towards smaller values and, hence, to higher probabilities of finding anchors in a closer neighborhood of a target node.
+
+
+Figure 3: Distribution of anchor distances under various anchor selection strategies. Top-bottom: mixed, degree-based, PPR-based, random. For each dataset, left: selecting $k$ nearest anchors, right: $k$ random anchors. (a) Selecting a fixed 500/50 configuration on WN18RR; (b) Selecting a fixed 1000/20 configuration on FB15k237. Generally, all strategies except random ones skew the distributions towards nearest anchors.
+
+
+Figure 4: Distribution of anchor distances under the fixed mix anchor selection strategy when varying the total number of anchors $A$ (50–1000 for WN18RR, 20–1000 for $\mathbf { F b 1 5 k - 2 3 7 }$ ). For each dataset, left column - $k$ nearest anchors, right - $k$ random anchors. On both graphs, increase in $A$ with the nearest anchors always leads to shorter anchor distances.
+
+We would recommend using centrality-based strategies to select $A$ with $k$ nearest anchors per node if anchor distances and probability of finding anchors in a closer neighborhood are of higher importance.
+
+Finally, we fix the anchor selection strategy as mix, obtain nearest anchors per node, and under this setup study average anchor distances varying $k$ - the number of anchors per node in various combinations of total anchors $A$ . The results presented on Figure 5 suggest that sparser graphs (like WN18RR) benefit more from increasing the number of anchors $A$ , i.e., the delta between distances is much larger than that of dense FB15k-237. The difference in distances on Figure 5 might also explain the performance on Figure 8, i.e., generally, smaller $A / k$ configurations like 25/5 are inferior on sparser graphs but perform competitively on denser ones.
+
+
+Figure 5: Average node-anchor distances when varying the total number of anchors $A$ from 25 to 1000 and $k$ nearest anchors per node from 5 to 50. Note that on a sparser WN18RR the gap between min and max values is much wider than of denser FB15k-237. Signs of saturation suggest that further increasing $A$ is not beneficial.
+
+# D EMBEDDING VISUALIZATIONS
+
+To further study learned representations of anchors and capabilities of the encoder, we build tSNE and UMAP projections from subsamples of FB15k-237 and WN18RR based on trained models from the transductive link prediction experiments (hyperparameters listed in Table A).
+
+For FB15k-237, we randomly sample 1000 entities (out of total 15K) and find their top-100 most common anchors. The anchor embeddings are extracted from the learned tensor while 1000 entity embeddings are obtained through the NodePiece encoder. Similarly for WN18RR, we sample 4000 entities (out of total 40K) keeping their top-100 most common anchors. As we use the RotatE decoder that assumes entities and anchors are modeled in a complex space, we visualize their real parts (e.g., first 100 dimensions out of 200).
+
+Recalling that link prediction performance of NodePiece $^ +$ RotatE retains $80 \%$ of the state of the art models performance, the results on Fig. 6 and Fig. 7 demonstrate that (1) NodePiece encoder is able to reconstruct clusters of similar entities; (2) anchors are well-scattered among communities. Albeit entity embeddings are built as a composition of $k$ anchors, it can be seen that all communities have "specialized" nearby anchors. On a higher level, common anchors tend to be well-scattered in the space. Less common anchors, as seen on FB15k-237 and Fig. 6, tend to group together. However, thanks to the non-linear nature of the NodePiece encoder, resulting entity embeddings still form different clusters and communities not concentrated around one point. We believe this is the effect of a compositional encoder and plan to investigate this phenomenon further.
+
+# E TRANSDUCTIVE LINK PREDICTION RESULTS: MRR
+
+In addition to Figure 2 that presents Hits $@ 1 0$ , we report variations of mean reciprocal rank (MRR) depending on combinations of $A$ and $k$ on Figure 8 from the same set of experiments. On sparser WN18RR, smaller $A / k$ combinations like 25/5 or 50/10 struggle with more precise predictions like
+
+
+Figure 6: tSNE (left) and UMAP (right) projections of 1000 encoded entities sampled randomly from FB $1 5 \mathrm { k }$ -237 and their top 100 most common anchors.
+
+
+Figure 7: tSNE (left) and UMAP (right) projections of 4000 encoded entities sampled randomly from WN18RR and their top 100 most common anchors.
+
+Hits $@ 1$ which is captured by low values of MRR. Starting from 500/10, the WN18RR performance starts to saturate. On the other hand, on denser FB15k-237, the difference between minimum and maximum MRR is less than 4 points, and performance exhibits signs of saturation already at 50/10.
+
+# F DATASETS CONSTRUCTION
+
+# F.1 NODE CLASSIFICATION: WD50K NC
+
+The original WD50K (Galkin et al., 2020) contains a triple-only KG version on which we base a new dataset for semi-supervised multi-class multi-label node classification. First, we remove all triples containing Wikidata properties P31 (instance of ) and P279 (subclass of ) as they already contain class information. We then remove nodes that became disconnected after removing those edges. Third, using SPARQL queries, for each remaining node in a graph, we extract a 3-hop class hierarchy of Wikidata classes and their superclasses. We only keep class labels that occur at least 50 times in the training set. Then, we sample $10 \%$ of nodes with labels for validation and $10 \%$ for test, and of remaining $80 \%$ we sample a set of nodes for the semi-supervised setup, i.e., we keep only $5 \%$ and
+
+
+Figure 8: Combinations of total anchors $A$ and anchors per node. Denser FB15k-237 saturates faster on smaller $A$ while sparse WN18RR saturates at around 500 anchors. MRR metric captures all ranks. Note that performance gap on FB15k-237 is very small indicating that saturation has occurred already with small anchor configurations.
+
+$10 \%$ of those nodes. The resulting graph has 46k nodes, 526 distinct relation types, and 465 class labels.
+
+# F.2 OUF-OF-SAMPLE LINK PREDICTION: OYAGO 3-10
+
+For sampling the out-of-sample version of a bigger YAGO 3-10 we largely follow the same original procedure described in Section 4 of (Albooyeh et al., 2020). We first merge the train, validation and test triples from the original dataset for transductive link prediction. Then, from all entities appearing in at least two triples, we randomly sample $5 \%$ of nodes to be the out-of-sample entities for validation and $5 \%$ for test. All triples containing the out-of-sample entities on subject or object positions are put into validation or test, respectively, as edges that connect an unseen entity with the seen graph.
+
+# G NODE CLASSIFICATION: TRAINING CURVES
+
+Figure 9 depicts train and validation values of Hard Accuracy and PRC-AUC metrics for all the compared models on WD50K NC with $5 \%$ of labeled nodes. The NodePiece model has only 50 total anchors with 10 nearest anchors per node, and 5 unique relation types in the relational context. The performance on the dataset with $10 \%$ of nodes is almost the same, so we report the charts only on $5 \%$ dataset. By the generalization gap we understand the delta between training and validation values.
+
+The MLP baseline quickly overfits but fails to generalize on the validation. The generalization gap of CompGCN is smaller compared to MLP but is still significant, i.e., validation performance is $2 { - } 3 \times$ smaller than train. Finally, the NodePiece-enabled model has the smallest generalization gaps, especially along the Hard Accuracy metric where the validation performance is very close to that of train. Similarly, the gap on PRC-AUC is smaller than 10 points.
+
+As shown in the ablation study in Table 6, it appears that explicit node embeddings do not contribute to the classification performance. Hence, the baseline models tend to be overparameterized where learnable node embeddings add noise, while the NodePiece model has only a few anchors (or no anchors at all when using only the relational context), much fewer parameters, and therefore generalizes better. This hypothesis also explains the observation that the node classification performance does not improve when increasing $A / k$ anchor configurations.
+
+# H PROOFS
+
+Proposition 2. The nearest-anchor encoder with $\binom { | A | } { k }$ anchors and $| m |$ subsampled relations, can be considered a $\pi$ -SGD approximation of $( k + | m | )$ -ary Janossy pooling with a canonical ordering induced by the anchor distances.
+
+
+Figure 9: Generalization gap on WD50K $5 \%$ labeled nodes). NodePiece-based model has observably smaller generalization gaps compared to the baselines.
+
+# Proof.
+
+We begin by providing the definition of Janossy pooling as it was presented in the original paper Murphy et al. (2019).
+
+Definition 1 (Janossy pooling). Let $\mathbb { H } ^ { \cup }$ be the union of all anchors and relations. Consider a function $\vec { f } : \mathbb { N } \times \mathbb { H } ^ { \cup } \times \mathbb { R } ^ { d } \stackrel { \left. } { \right. } \mathbb { F }$ on variable-length but finite sequences h, parameterized by $\pmb { \theta } ^ { ( f ) } \in \mathbb { R } ^ { d }$ , $d > 0$ . A permutation-invariant function $\overline { { \overline { { f } } } } : \mathbb { N } \times \mathbb { H } ^ { \cup } \times \mathbb { R } ^ { d } \mathbb { F }$ is the Janossy function associated with $\vec { \boldsymbol { f } }$ if
+
+$$
+\overline { { \overline { { f } } } } ( | { \bf h } | , { \bf h } ; \theta ^ { ( f ) } ) = \frac { 1 } { | { \bf h } | ! } \sum _ { \pi \in \Pi _ { | { \bf h } | } } \vec { f } ( | { \bf h } | , { \bf h } _ { \pi } ; \theta ^ { ( f ) } ) ,
+$$
+
+where $\Pi _ { | \mathbf { h } | }$ is the set of all permutations of the integers 1 to $| \mathbf { h } |$ , and $\mathbf { h } _ { \pi }$ represents a particular reordering of the elements of sequence h according to $\pi \in \Pi _ { | \mathbf { h } | }$ . We refer the operation used to construct $\overline { { \overline { { f } } } }$ from $\vec { \boldsymbol { f } }$ as Janossy pooling.
+
+While Janossy pooling provides a simple approach to construct permutation-invariant functions from arbitrary permutation sensitive functions, it is computationally intractable due to the need to sum over all computations. Three general strategies proposed under this framework to overcome this combinatorial challenge: canonical orderings, $k$ -ary Janossy pooling, and $\pi$ -SGD approximations.
+
+A very effective way of reducing the complexity is to constrain the permutations to a canonical ordering that is independent of a specific adjacency matrix ordering over a given graph. More precisely, one defines as a function CANONICAL : $\mathbb { H } ^ { \cup } \mathbb { H } ^ { \cup }$ such that CANONICAL $( { \bf h } ) =$ $\mathrm { C A N O N I C A L } ( \mathbf { h } _ { \pi } ) \forall \pi \in \Pi _ { | \mathbf { h } | }$ and only considers functions $\vec { \boldsymbol { f } }$ based on the composition ${ \vec { f } } =$ $\mathrm { C A N O N I C A L } \circ \vec { f } ^ { \prime }$ (Murphy et al., 2019). In the case of NodePiece we are able to define this ordering for the anchors according to their distance to the target node. Assuming that the number of relations is fixed or grows at slow rate throughout the life-cycle of a graph we can define an arbitrary ordering for relations as a canonical ordering for the relational context. However, since anchors can be equidistant such a canonical ordering does fully satisfy permutation invariance. We propose a trivial relaxation of the original definition of canonical orderings simply requiring that an ordering greatly reduce the number of unique permutations since in practice an exact canonical ordering is rarely feasible. Specifically, $| \{ \mathrm { C A } \mathrm { \hat { N } O N I C A L } ( \mathbf { h } _ { \pi } ) \forall \pi \in \Pi _ { | \mathbf { h } | } \} | \ll | \{ ( \mathbf { h } _ { \pi } ) \forall \pi \in \Pi _ { | \mathbf { h } | } \} |$ .
+
+To further reduce the number of permutations we can truncate our ordered sequence $\mathbf { h }$ . This is known as $k$ -ary Janossy pooling pooling (Definition 2) and is implicitly performed by the NodePeice algorithm by varying the anchor per node parameter, $k$ , and the size of the relational context, $| m |$ .
+
+Definition 2 ( $k$ -ary Janossy pooling). Fix $k \in \mathbb N$ . For any sequence h, define $\downarrow _ { k }$ (h) as its projection to a length $k$ sequence; in particular, if $| { \bf h } | \ge k$ , we keep the first $k$ elements. Then, a $k$ -ary permutation-invariant Janossy function $\overline { { \overline { { f } } } }$ is given by
+
+Table 15: Relation prediction results. $| V |$ denotes vocabulary size (anchors $^ +$ relations).
+
+
FB15k-237
WN18RR
YAGO 3-10
|V|
MRR
H@10
|V|
MRR
H@10
|VI
MRR
H@10
RotatE
15k +0.5k
0.905
0.979
40k +22
0.774
0.897
123k +74
0.909
0.992
NodePiece +RotatE
1k + 0.5k
0.874
0.971
500 +22
0.761
0.985
10k + 74
0.951
0.997
- no rel. context
1k + 0.5k
0.876
0.968
500+22
0.541
0.958
10k + 74
0.898
0.993
- no distances
1k + 0.5k
0.877
0.970
500+22
0.746
0.975
10k + 74
0.943
0.997
- no anchors,rels only
0+ 0.5k
0.873
0.971
0+22
0.545
0.947
0+74
0.951
0.998
+
+$$
+\overline { { \overline { { f } } } } ( | { \bf h } | , { \bf h } ; \pmb { \theta } ^ { ( f ) } ) = \frac { 1 } { | { \bf h } | ! } \sum _ { \pi \in \Pi _ { | { \bf h } | } } \vec { f } ( | { \bf h } | , \downarrow _ { k } ( { \bf h } _ { \pi } ) ; \pmb { \theta } ^ { ( f ) } ) .
+$$
+
+Since an imperfect truncated canonical ordering may still result in a potentially intractable number of permutations, we use permutation sampling also known as $\pi$ -SGD to learn arbitrary functions that approximate $( k + | m | )$ -ary Janossy pooling. This is done by randomly ordering anchors that are equidistant resulting in a uniform sampling of possible permutations during training and evaluation. For more details on the formal definition of $\pi$ -SGD we point the reader to the original paper (Murphy et al., 2019).
+
+# I RELATION PREDICTION
+
+Setup. We conduct the relation prediction experiment on the same FB15k-237, WN18RR, and YAGO 3-10 datasets. While link prediction deals with entities, the relation prediction model has to rank a correct relation given a (head, ?, tail) query. We report MRR and Hits $@ 1 0$ in the filtered setting as evaluation metrics. Similar to the link prediction configuration, we use NodePiece $^ { + 2 }$ -layer MLP and compare against RotatE of the same total parameter count.
+
+Discussion. The reported results (Table 15) demonstrate a competitive performance of NodePiecebased models with reduced vocabulary sizes bringing more than $9 7 \%$ Hits $@ 1 0$ across graphs of different sizes. In the case of WN18RR and YAGO 3-10, NodePiece models with fewer anchors even slightly improve the accuracy upon the shallow embedding baseline. The ablation study suggests that on dense graphs with a reasonable amount of unique relations having explicit learnable node embeddings might not be needed at all for this task. That is, we see that on $\mathrm { F B } 1 5 \mathrm { k } { - } 2 3 7$ and YAGO 3-10 the NodePiece hashes comprised only of the relational context deliver the same performance without any performance drop confirming the findings from the previous experiment.
+
+# J INDUCTIVE LINK PREDICTION
+
+Setup. Nodes in the inference graphs do not have any associated feature vectors which makes this benchmark very relevant for graph representation learning. Importantly, the set of relation types in the inference graphs is a subset of those seen in the training set. Since the relation embedding matrix can be learned on the training graph, we therefore have a uniform method for constructing node representations both on seen and unseen graphs. As an encoder we try MLP and Transformer.
+
+Evaluation Protocol. Following the original work (Teru et al., 2020), we employ a filtered setting and rank each triple against 50 random negative triples reporting the Hits $@ 1 0$ metric. This setup is motivated by computational complexity of GraIL at inference time, while NodePiece $^ +$ CompGCN is as fast in the inductive inference as in the transductive regime reported in other experiments.
+
+Discussion. For each KG, there are 4 splits of increasing size of train and inference nodes and edges. The empirical results on this spectrum of various sizes demonstrates interesting scalability properties of NodePiece in inductive settings. Without anchor nodes, the NodePiece vocabulary size is independent of the number of nodes and edges, depending only on the number of relation types. On dense relation-rich graphs such a vocabulary is enough to yield very competitive performance.
+
+Table 16: Hyperparameters for inductive link prediction experiments. Entries are shared among 4 splits of each graph if not particularly specified. V1 | V2 | V3 | V4 otherwise.
+
+
Parameter
FB15k-237
WN18RR
NELL-995
# Anchors, |A|
# Anchors per node,k
=
Relational context, m
12
4141413
4161416
Vocabulary dim, d
100
100
100
Batch size
512
512
512
Learning rate
0.0001
0.0001
0.0001
Num negatives
32
32
32
Epochs
2500 V1|2000 rest
590|2000|210丨2000
2000
NodePiece encoder
MLP
MLP
MLPIMLPIMLP|Trf
NodePiece encoder dim
200
200
200
NodePiece encoder layers
2
2
2
NodePiece encoder dropout
0.1
0.1
0.1
CompGCNlayers
3
31616110
3141313
CompGCN attention
yes
yes
yes
CompGCN dropout
0.1
0.1
0.210.110.110.1
Loss function
NSSAL
NSSAL
NSSAL
Margin
25115115125
1511515120
15|20|30120
Training time, hours
214116119
1118|4110
6151818
+
+# K UNIQUENESS OF NODE HASHES
+
+NodePiece represents nodes as a sequence of tokens and a natural question in this context is how unique such sequences can be in light of different anchor selection and tokenization strategies.
+
+Assuming the input graph is a single connected component, when sampling $| A |$ total anchors and selecting randomly $k$ anchors per node, the number of possible hash combinations is bounded by $\textstyle { \binom { | A | } { k } }$ . In this scenario, uniqueness of hashes is achieved by having this number bigger than the number $N$ of nodes in a graph, $\binom { | A | } { k } > N$ , and this happens with high probability for any reasonably large $| A |$ , eg, $\binom { 5 0 } { 2 0 }$ encodes about $4 . 7 \cdot 1 0 ^ { 1 3 }$ combinations which covers all existing public KGs combined.
+
+In the deterministic selection of nearest anchors per node we do not have such guarantees. Nevertheless, additional sequences of relational contexts and anchor distances help to obtain more unique hashes. Collisions are possible in highly regular graphs like Wordnet, but real-world KGs like Wikidata and DBpedia do not exhibit such a regular structure. Similar to homonyms whose meaning depends on the surrounding context in a sentence, we hypothesize that adding message passing layers (that can be seen as encoding of a neighboring context for a given node) on top of NodePiece hashes might further improve the diversity of node representations. That said, the future work research agenda might include proving tighter theoretical bounds on hashes uniqueness and developing new anchor sampling and tokenization strategies.
\ No newline at end of file
diff --git a/md/dev/xT5rDp5VqKO/xT5rDp5VqKO.md b/md/dev/xT5rDp5VqKO/xT5rDp5VqKO.md
new file mode 100644
index 0000000000000000000000000000000000000000..2ab776891d34500eb736878b30b5301bb7d3e1b2
--- /dev/null
+++ b/md/dev/xT5rDp5VqKO/xT5rDp5VqKO.md
@@ -0,0 +1,134 @@
+# Coincidence Detection Is All You Need
+
+Anonymous Author(s)
+Affiliation
+Address
+email
+
+# Abstract
+
+1 This paper demonstrates that the performance of coincidence detection - a classic
+2 neuromorphic signal processing method found in Rosenblatt’s perceptrons with
+3 distributed transmission times, can be competitive to a state-of-the-art deep learning
+4 method for pattern recognition. Hence, we cannot remain comfortably numb to the
+5 prevailing dogma that efficient matrix-vector operations is all we need; but should
+6 enquire with greater vigour if more advanced continual learning methods (running
+7 on spiking neural network hardware with neuromodulatory mechanisms at multiple
+8 timescales) can beat the accuracy of task-specific deep learning methods.
+
+# 9 1 Introduction
+
+10 Frank Rosenblatt and his team (1957-1971) built and analyzed several kinds of perceptrons [1, 2, 3, 4]
+11 - networks of sensory, association and receptor neurons; which in contemporary deep learning termi
+12 nology relates to the input, hidden and output layers. The propagating signals were binary (compatible
+13 with a spike-based view), the synaptic delays (transmission times) and weights (memory states) could
+14 be analog, the network could be recurrent and was often randomly interconnected, and learning
+15 often meant tuning the weights of the association-receptor subnetwork by some error-corrective
+16 reinforcement. The synaptic delays were not learnt but instead randomly distributed in Rosenblatt’s
+17 Tobermory perceptrons [5], and this was rich enough to realize concentration-invariant and uniform
+18 time-warp invariant spatiotemporal classification by logarithmic encoding and coincidence detection.
+19 However, the processing speed of commercial Von Neumann computers advanced exponentially
+20 and outperformed neuromorphic hardware on yesterdecade’s benchmarks [6]. The Tobermory per
+21 ceptron was forgotten, nevertheless, the utility of logarithmic encoding and coincidence detection
+22 was formalized by John Hopfield [7] as an efficient solution to the analog match problem in pattern
+23 recognition.
+24 Now, half a century after the accidental demise of Rosenblatt, neuromorphic signal processors are
+25 making a comeback. For example, (1) Intel’s Loihi with spike-time dependent plasticity mechanisms
+26 for learning olfactory pattern recognizers [8]; (2) Physical reservoir computing networks [9] where
+27 the interconnectivity of the hidden layer is unchanged, closer to the spirit of Rosenblatt’s randomly
+28 interconnected sensory-association subnetwork.
+29 Here, to strengthen the case for revisiting classic methods on novel and modern hardware, we evaluate
+30 the performance of coincidence detection in comparison to a deep learning method. Nothing more,
+31 nothing less, although this work was triggered by a rabid interest in employing artificial intelligence
+32 to sniff out infections and prevent future pandemics.
+
+Table 1: Test accuracy $( \% )$
+
+
ResNet-26
Coincidence detection
82.2±0.3 (from [10])
82.7 (this work)
+
+# 33 2 Methods
+
+34 Here, we consider the work [10] of an interdisciplinary team, where a 26 layer convolutional neural
+35 network with residual connections (ResNet-26) was successfully trained for classifying pathogenic
+36 bacteria by Raman spectroscopy. In their work, there are $N = 3 0$ classes of bacterial isolates and
+37 they begin with a ResNet-26 pre-trained on $N { \times } 2 0 0 0$ spectra, then for each class $n = 1 : N$ there are
+38 $M = 1 0 0$ training spectra, and similarly $N \times M = 3 0 0 0$ test spectra. Each spectrum $_ { \textbf { \em x } }$ contains 1000
+39 floating-point numbers ranging between 0 and 1. Although compute intensive, their deep learning
+40 method proved to be a tool of great convenience for pattern recognition in a challenging dataset,
+41 where intra-isolate spectra were often more dissimilar than inter-isolate spectra.
+42 Our method to tackle the above dataset, is inspired by the theory of how coincidence detection [7]
+43 in animal brains is fundamental for odour classification in complex and turbulent mixtures. Each
+44 class $n$ has a vector representation ${ \pmb w } _ { n }$ that is learnt, and an input vector $_ { \textbf { \em x } }$ results in an output
+45 class $y ( \pmb { x } ) = \arg _ { n } \operatorname* { m a x } ( \pmb { x } \wedge \pmb { w } _ { n } )$ where we introduce the operator $\Lambda$ to represent the coincidence
+46 between two signals. The analytical nature of coincidence detection depends on the specificities of the
+47 ion-channels and the membranes involved [11], and may even incorporate nonlinear leaky-integrate
+48 [12] multiple timescale mechanisms. We do not yet have a complete theory of neuromorphic signal
+49 processing, so here we introduce an approximation for the translation and scale-invariant property of
+50 coincidence detection as
+
+$$
+\operatorname { a r g } _ { n } \operatorname * { m a x } ( { \pmb x } \bigwedge { \pmb w } _ { n } ) \approx \arg _ { n } \operatorname * { m a x } ( { \pmb w } _ { n } \cdot { \hat { \pmb x } } ) ,
+$$
+
+51 where $\hat { \pmb x }$ is the zero-mean unit-variance normalization of $_ { \textbf { \em x } }$ .
+
+52 Thus, the approximation in Eq. (1) allows $y ( \pmb { x } )$ to be learnt by a logistic regression on the normalized
+53 dataset. We discard the pre-training data, pre-process the training and test spectra by a range-1 mean
+54 filter, and use the default method for logistic regression in Wolfram Mathematica (L2-regularization
+55 $= 0 . 0 0 0 1$ , optimization method $=$ limited-memory BFGS). Code is provided in the supplemental
+56 material for reproducibility.
+
+# 57 3 Result and outlook
+
+58 The coincidence detection (via normalized logistic regression) method introduced here achieves a test
+59 accuracy greater than ResNet-26 (see Table 1), and it took less than 3 seconds to train the classifier
+60 on a modern desktop (without any special-purpose GPUs). Check the Appendix for a confusion
+61 matrix plot of the training and test data. Note that the training data was fit all at once to a $100 \%$
+62 accuracy. With a more neuromorphic coincidence detection method and a learning method that adapts
+63 the synaptic delays $\pmb { w }$ continually, to keep track under changing environmental conditions, we may
+64 achieve even greater accuracies.
+
+# 5 References
+
+6 [1] Frank Rosenblatt. The perceptron, a perceiving and recognizing automaton Project Para.
+Cornell Aeronautical Laboratory, Inc. Report no. 85-460-1, 1957.
+8 [2] Frank Rosenblatt. The perceptron: A theory of statistical separability in cognitive systems.
+9 Cornell Aeronautical Laboratory, Inc. Report no. VG-1196-G-1, 1958.
+0 [3] Frank Rosenblatt. Principles of neurodynamics. perceptrons and the theory of brain mechanisms.
+1 Cornell Aeronautical Laboratory, Inc. Report no. 1196-G-8, 1961.
+
+[4] Frank Rosenblatt. Cognitive systems research program. Technical report, Cornell University, Ithaca, New York, 1971. [5] Frank Rosenblatt. A description of the tobermory perceptron. In Collected Technical Papers, volume 2. Cornell University, Ithaca, New York, 1963. [6] George Nagy. Neural networks-then and now. IEEE Transactions on Neural Networks, 2(2):316– 318, 1991.
+[7] John J Hopfield. Pattern recognition computation using action potential timing for stimulus representation. Nature, 376(6535):33–36, 1995. [8] Nabil Imam and Thomas A Cleland. Rapid online learning and robust recall in a neuromorphic olfactory circuit. Nature Machine Intelligence, 2(3):181–191, 2020. [9] G. Tanaka, T. Yamane, J.B. Héroux, R. Nakane, N. Kanazawa, S. Takeda, H. Numata, D. Nakano, and A. Hirose. Recent advances in physical reservoir computing: A review. Neural Networks, 115:100–123, 2019.
+[10] Chi-Sing Ho, Neal Jean, Catherine A Hogan, Lena Blackmon, Stefanie S Jeffrey, Mark Holodniy, Niaz Banaei, Amr AE Saleh, Stefano Ermon, and Jennifer Dionne. Rapid identification of pathogenic bacteria using raman spectroscopy and deep learning. Nature communications, 10(1):1–8, 2019.
+[11] Nelson Spruston. Pyramidal neurons: dendritic structure and synaptic integration. Nature Reviews Neuroscience, 9(3):206–221, 2008.
+[12] Wondimu Teka, Toma M Marinov, and Fidel Santamaria. Neuronal spike timing adaptation described with a fractional leaky integrate-and-fire model. PLoS computational biology, 10(3):e1003526, 2014.
+
+# 94 Checklist
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] See Table 1.
+(b) Did you describe the limitations of your work? [Yes] Equation (1) makes it clear that we employ an approximation for coincidence detection.
+(c) Did you discuss any potential negative societal impacts of your work? [N/A]
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Check supplemental material
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A]
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] qualitatively, in the results section
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes]
+
+
118
(b) Did you mention the license of the assets? [Yes] In the supplemental information
119
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
120 121
(d) Did you discuss whether and how consent was obtained from people whose data you're using/curating?[N/A]
122 123
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
124
5. If you used crowdsourcing or conducted research with human subjects...
125 126
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
127 128
(b) Did you describe any potential participant risks,with links to Institutional Review Board (IRB) approvals, if applicable?[N/A]
129 130
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
+
+# 131 A Appendix
+
+
\ No newline at end of file
diff --git a/md/dev/xijYyYFlRIf/xijYyYFlRIf.md b/md/dev/xijYyYFlRIf/xijYyYFlRIf.md
new file mode 100644
index 0000000000000000000000000000000000000000..0dc8190d09d9f832ba1947ca75a3873863b805d9
--- /dev/null
+++ b/md/dev/xijYyYFlRIf/xijYyYFlRIf.md
@@ -0,0 +1,296 @@
+# GAUDI: A Neural Architect for Immersive 3D Scene Generation
+
+Miguel Angel Bautista⇤ Pengsheng Guo⇤ Samira Abnar Walter Talbott
+
+# Alexander Toshev Zhuoyuan Chen Laurent Dinh Shuangfei Zhai Hanlin Goh
+
+Daniel Ulbricht
+
+Afshin Dehghan
+
+Josh Susskind
+
+Apple https://github.com/apple/ml-gaudi
+
+# Abstract
+
+We introduce GAUDI, a generative model capable of capturing the distribution of complex and realistic 3D scenes that can be rendered immersively from a moving camera. We tackle this challenging problem with a scalable yet powerful approach, where we first optimize a latent representation that disentangles radiance fields and camera poses. This latent representation is then used to learn a generative model that enables both unconditional and conditional generation of 3D scenes. Our model generalizes previous works that focus on single objects by removing the assumption that the camera pose distribution can be shared across samples. We show that GAUDI obtains state-of-the-art performance in the unconditional generative setting across multiple datasets and allows for conditional generation of 3D scenes given conditioning variables like sparse image observations or text that describes the scene.
+
+# 1 Introduction
+
+In order for learning systems to be able to understand and create 3D spaces, progress in generative models for 3D is sorely needed. The quote "The creation continues incessantly through the media of man." is often attributed to Antoni Gaudí, who we pay homage to with our method’s name. In this paper we ask the question: can creation continue through the media of learning machines? We are interested in generative models that can capture the distribution of 3D scenes and then render views from scenes sampled from the learned distribution. Extensions of such generative models to conditional inference problems could have tremendous impact in a wide range of tasks in machine learning and computer vision. For example, one could sample plausible scene completions that are consistent with an image observation, or a text description (see Fig. 1 for 3D scenes sampled from GAUDI). In addition, such models would be of great practical use in model-based reinforcement learning and planning [14], SLAM [43], or 3D content creation.
+
+Recent works on generative modeling for 3D objects or scenes [60, 6, 8] employ a Generative Adversarial Network (GAN) where the generator explicitly encodes radiance fields — a parametric function that takes as input the coordinates of a point in 3D space and camera pose, and outputs a density scalar and RGB value for that 3D point. Images can be rendered from the radiance field generated by the model by passing the queried 3D points through the volume rendering equation to project onto any 2D camera view. While compelling on small or simple 3D datasets (e.g. single objects or a small number of indoor scenes), GANs suffer from training pathologies including mode collapse $\pm \pm \pm \pm \pm \pm \pm \pm \pm$ and are difficult to train on data for which a canonical coordinate system does not exist, as is the case for 3D scenes $\left[ \left[ 6 1 \right] \right]$ . In addition, one key difference between modeling distributions of 3D objects vs. scenes is that when modeling objects, the distribution of valid camera poses does not depend on each object and is defined per dataset (i.e. typically as $S O ( 3 )$ ), which is not true for scenes. See Fig. $\bar { \bigtriangledown ( \mathfrak { b } ) }$ and note how the two scene layouts define different areas of navigable space (different dark grey shaded areas) where valid camera poses can be placed, revealing a strong dependency between scenes and their camera pose distributions. GAUDI captures this dependency by modeling the joint distribution of scenes and camera poses.
+
+
+Figure 1: GAUDI allows to model both conditional and unconditional distributions over complex 3D scenes. Sampled scenes and poses from (left) the unconditional distribution, and (right) a distribution conditioned on an image observation or a text prompt.
+
+In GAUDI, we map each trajectory (i.e. a sequence of posed images from a 3D scene) into a latent representation that encodes a radiance field (e.g. the 3D scene) and camera path in a completely disentangled way. We find these latent representations by interpreting them as free parameters and formulating an optimization problem where the latent representation for each trajectory is optimized via a reconstruction objective. This simple training process is scalable to thousands of trajectories. Interpreting the latent representation of each trajectory as a free parameter also makes it simple to handle a large and variable number of views for each trajectory rather than requiring a sophisticated encoder architecture to pool across a large number of views. After optimizing latent representations for an observed empirical distribution of trajectories, we learn a generative model over the set of latent representations. In the unconditional case, the model can sample radiance fields entirely from the prior distribution learned by the model, allowing it to synthesize scenes by interpolating within the latent space. In the conditional case, conditional variables available to the model at training time (e.g. images, text prompts, etc.) can be used to generate radiance fields consistent with those variables. Our contributions can be summarized as:
+
+We scale 3D scene generation to thousands of indoor scenes containing hundreds of thousands of images, without suffering from mode collapse or canonical orientation issues during training.
+
+• We introduce a novel denoising optimization objective to find latent representations that jointly model a radiance field and the camera poses in a disentangled manner.
+
+• Our approach obtains state-of-the-art generation performance across multiple datasets.
+
+• Our approach allows for various generative setups: unconditional generation as well as conditional on images or text.
+
+# 2 Related Work
+
+In recent years the field has witnessed outstanding progress in generative modeling for the 2D image domain, with most approaches focusing either on adversarial $\mathbb { \left[ \left[ 2 1 \right] , \left[ 2 2 \right] \right] }$ or auto-regressive models [69, 46, 11]. More recently, score matching based approaches [18, 62] have gained popularity. In particular, Denoising Diffusion Probabilistic Models (DDPMs) [ $\boxed { 1 7 } \boxed { 3 7 } \boxed { 5 2 } \boxed { 6 8 }$ have emerged as strong contenders to both adversarial and auto-regressive approaches. In DDPMs, the goal is to learn a step-by-step inversion of a fixed diffusion Markov Chain that gradually transforms an empirical data distribution to a fixed posterior, which typically takes the form of an isotropic Gaussian distribution. In parallel, the last couple of years have seen a revolution in how 3D data is represented within neural networks. By representing a 3D scene as a radiance field, NeRF $[ \left| 3 3 \right| ]$ introduces an approach to optimize the weights of a MLP to represent the radiance of 3D points that fall inside the field-of-view of a given set of posed RGB images. Given the radiance for a set of 3D points that lie on a ray shot from a given camera pose, NeRF $\mathbb { B } 3 \mathbb { I }$ uses volumetric rendering to compute the color for the corresponding pixel and optimizes the MLP weights via a reconstruction loss in image space.
+
+A few attempts have also been made at incorporating a radiance field representation within generative models. Most approaches have focused on the problem of single objects with known canonical orientations like faces or Shapenet objects with shared camera pose distributions across samples in a dataset [60, 6, 38, 25, 5, 12, 75, 47, 10]. Extending these approaches from single objects to completely unconstrained 3D scenes is an unsolved problem. One paper worth mentioning in this space is GSN $\textcircled { 8 }$ , which breaks the radiance field into a grid of local radiance fields that collectively represent a scene. While this decomposition of radiance fields endows the model with high representational capacity, GSN still suffers from the standard training pathologies of GANs, like mode collapse $\mathbb { \lVert \rVert }$ , which are exacerbated by the fact that unconstrained 3D scenes do not have a canonical orientation. As we show in our experiments (cf. Sect. 4), these issues become prominent as the training set size increases, impacting the capacity of the generative model to capture complex distributions. Separately, a line of recent approaches have also studied the problem of learning generative models of scenes without employing radiance fields [40, 70, 51]. These works assume that the model has access to room layouts and a database of object CAD models during training, simplifying the problem of scene generation to a selection of objects from the database and pose predictions for each object.
+
+Finally, approaches that learn to predict a target view given a single (or multiple) source view and relative pose transformation have been recently proposed [27, 74, 57, 9, 13]. The pure reconstruction objective employed by these approaches forces them to learn a deterministic conditional function that maps a source image and a relative camera transformation to a target image. The first is that this scene completion problem is ill-posed (e.g. given a single source view of a scene there are multiple target completions that are equally likely). Attempts at modeling the problem in a probabilistic manner have been proposed $\underline { { \lVert 5 3 \rVert } } , \boxed { 4 9 }$ . However, these approaches suffer from inconsistency in predicted scenes because they do not explicitly model a 3D consistent representation like a radiance field.
+
+# 3 GAUDI
+
+Our goal is to learn a generative model given an empirical distribution of trajectories over 3D scenes. Let $X = \{ x _ { i \in \{ 0 , . . . , n \} } \}$ denote a collection of examples defining an empirical distribution, where each example $x _ { i }$ is a trajectory. Every trajectory $x _ { i }$ is defined as a variable length sequence of corresponding RGB, depth images and 6DOF camera poses (see Fig. 3).
+
+We decompose the task of learning a generative model in two stages. First, we obtain a latent representation $\mathbf { z } = [ \mathbf { z } _ { \mathrm { s c e n e } } , \mathbf { z } _ { \mathrm { p o s e } } ]$ for each example $x \in X$ that represents the scene radiance field and pose in separate disentangled vectors. Second, given a set of latents $Z = \{ \mathbf { z } _ { i \in \{ 0 , \dots , n \} } \}$ we learn the distribution $p ( Z )$ .
+
+# 3.1 Optimizing latent representations for radiance fields and camera poses
+
+We now turn to the task of finding a latent representation $\mathbf { z } \in Z$ for each example $x \in X$ (i.e. for each trajectory in the empirical distribution). To obtain this latent representation we take an encoder-less view and interpret $\mathbf { z }$ ’s as free parameters to be found via an optimization problem $\mathbb { D } \mathbb { B }$ . To map latents $\mathbf { z }$ to trajectories $x$ , we design a network architecture (i.e. a decoder) that disentangles camera poses and radiance field parameterization. Our decoder architecture is composed of 3 networks (shown in Fig. 2):
+
+• The camera pose decoder network $c$ (parameterized by $\theta _ { c . }$ ), is responsible for predicting camera poses $\hat { \mathbf { T } } _ { s } \in S E ( 3 )$ at the normalized temporal position $s \in [ - 1 , 1 ]$ in the trajectory, conditioned on $\mathbf { z } _ { \mathrm { p o s e } }$ which represents the camera poses for the whole trajectory. To ensure that the output of $c$ is a valid camera pose (e.g. an element of $S E ( 3 )$ ), we output a 3D vector representing a normalized quaternion $\mathbf { q } _ { s }$ for the orientation and a 3D translation vector $\mathbf { t } _ { s }$ .
+
+
+Figure 2: Architecture of the decoder model that disentangles camera poses from 3D geometry and appearance of the scene. Our decoder is composed by 3 submodules. A decoder $d$ that takes as input a latent code representing the scene $\mathbf { z } _ { \mathrm { s c e n e } }$ and produces a factorized representation of 3D space via a tri-plane latent encoding $\mathbf { W }$ . A radiance field network $f$ that takes as input points $ { \mathbf { p } } \in { \mathbf { R } } ^ { 3 }$ and is conditioned on W to predict a density $\sigma$ and a signal a to be rendered via volumetric rendering (Eq. 1). Finally, we decode the camera poses through a network $c$ that takes as input a normalized temporal position $s \in [ - 1 , 1 ]$ and is conditioned on $\mathbf { z } _ { \mathrm { p o s e } }$ which represents camera poses for the whole trajectory $x$ to predict the camera pose $\hat { \mathbf { T } } _ { s } \in S E ( 3 )$ .
+
+• The scene decoder network $d$ (parameterized by $\theta _ { d }$ ), is responsible for predicting a conditioning variable for the radiance field network $f$ . This network takes as input a latent code that represents the scene $\mathbf { z } _ { \mathrm { s c e n e } }$ and predicts an axis-aligned tri-plane representation $[ \mathbb { A } 1 ] , \bigstar ]$ $\mathbf { W } \in \mathbb { R } ^ { 3 \times S \times S ^ { \star } \times F }$ . Which correspond to 3 feature maps $[ \mathbf { W } _ { x y } , \mathbf { \bar { W } } _ { x z } , \mathbf { \bar { W } } _ { y z } ]$ of spatial dimension $S \times S$ and $F$ channels, one for each axis aligned plane: $x y$ , $x z$ and $y z$ .
+
+• The radiance field decoder network $f$ (parameterized by $\theta _ { f }$ ), is tasked with reconstructing image level targets using the volumetric rendering equation in Eq. $^ { 1 }$ . The input to $f$ is $ { \mathbf { p } } \in \mathbb { R } ^ { 3 }$ and the tri-plane representation $\mathbf { W } = [ \mathbf { W } _ { x y } , \mathbf { W } _ { x z } , \mathbf { \bar { W } } _ { y z } ]$ (we do not condition on the camera orientation to improve consistency $\pmb { \mathbb { I } } \mathbf { \varOmega }$ ). Given a 3D point $\overset { \circ } { \mathbf { p } } = [ i , j , k ]$ for which radiance is to be predicted, we orthogonally project $\mathbf { p }$ into each plane in W and perform bi-linear sampling. We concatenate the 3 bi-linearly sampled vectors into $\mathbf { \bar { w } } _ { x y z } = [ \mathbf { W } _ { x y } ( i , j ) , \mathbf { W } _ { x z } ( j , k ) , \mathbf { W } _ { y z } ( i , k ) ] \in \mathbb { R } ^ { 3 F }$ , which is used to condition the radiance field function $f$ . We implement $f$ as a MLP that outputs a density value $\sigma$ and a signal a. To predict the value $\mathbf { v }$ of a pixel, the volumetric rendering equation is used (cf. Eq. 1) where a 3D point is expressed as ray direction $\mathbf { r }$ (corresponding with the pixel location) at particular depth $u$ .
+
+$$
+\begin{array} { r l r } & { } & { { \bf v } ( { \bf r } , { \bf W } ) = \int _ { u _ { n } } ^ { u _ { f } } T r ( u ) \sigma \left( { \bf r } ( u ) , { \bf w } _ { x y z } \right) { \bf a } \left( { \bf r } ( u ) , { \bf w } _ { x y z } \right) d u } \\ & { } & { T r ( u ) = \exp \left( - \int _ { u _ { n } } ^ { u } \sigma ( { \bf r } ( u ) , { \bf w } _ { x y z } ) d u \right) . } \end{array}
+$$
+
+We formulate a reconstruction objective to jointly optimize for $\theta _ { d } , \theta _ { c } , \theta _ { f }$ and $\{ \mathbf { z } \} _ { i = \{ 0 , \ldots , n \} }$ , shown in Eq. 2. Note that while latents $\mathbf { z }$ are optimized for each example $x$ independently, the parameters of the networks $\theta _ { d } , \theta _ { c } , \theta _ { f }$ are amortized across all examples $x \in X$ . As opposed to previous auto-decoding approaches $\textcircled { 1 2 } , \textcircled { 3 9 } \textcircled { 1 }$ , each latent $\mathbf { z }$ is perturbed during training with additive noise that is proportional to the empirical standard deviation across all latents, $\mathbf { z } = \mathbf { z } + \beta \mathcal { N } ( 0 , \mathrm { s t d } ( Z ) )$ , inducing a contractive representation $\left[ \left[ 5 0 \right] \right]$ . In this setting, $\beta$ controls the trade-off between the entropy of the distribution of latents $\mathbf { z } \in Z$ and the reconstruction quality. With $\beta = 0$ the distribution of $\mathbf { z }$ ’s becomes a set of indicator functions (i.e. similar as one would get from a vanilla auto-encoder). For large $\beta > 0$ the structure in distribution of $\mathbf { z }$ ’s is destroyed, as latents are perturbed with large magnitudes of noise. We use a small $\beta > 0$ value to enforce a latent space in which interpolated samples (or samples that contain small deviations from the empirical distribution, as the ones that one might get from sampling a subsequent generative model) are included in the support of the decoder function, sacrificing a small cost in reconstruction fidelity.
+
+$$
+\operatorname* { m i n } _ { \theta _ { d } , \theta _ { f } , \theta _ { c } , Z } \mathbb { E } _ { x \sim X } \left[ \mathcal { L } _ { \mathrm { s c e n e } } ( \mathbf { x } _ { s } ^ { \mathrm { i m } } , \mathbf { z } _ { \mathrm { s c e n e } } , \mathbf { T } _ { s } ) + \lambda \mathcal { L } _ { \mathrm { p o s e } } ( \mathbf { T } _ { s } , \mathbf { z } _ { \mathrm { p o s e } } , s ) \right]
+$$
+
+We optimize parameters $\theta _ { d } , \theta _ { f } , \theta _ { c }$ and latents $\mathbf { z } \in Z$ with two different losses. The first loss function $\mathcal { L } _ { \mathrm { s c e n e } }$ measures the reconstruction between the radiance field encoded in $\mathbf { z } _ { \mathrm { s c e n e } }$ and the images in the trajectory $\mathbf { x } _ { s } ^ { \mathrm { { i m } } }$ (where $s$ denotes the normalized temporal position of the frame in the trajectory), given ground-truth camera poses $\mathbf { T } _ { s }$ required for rendering. We use an $l _ { 2 }$ loss for RGB and $l _ { 1 }$ for depth 1. The second loss function $\mathcal { L } _ { \mathrm { p o s e } }$ measures the camera pose reconstruction error between the poses $\hat { \mathbf { T } } _ { s }$ encoded in $\mathbf { z } _ { \mathrm { p o s e } }$ and the ground-truth poses. We employ an $l _ { 2 }$ loss on translation and $l _ { 1 }$ loss for the normalized quaternion part of the camera pose. Although theoretically normalized quaternions are not necessarily unique (e.g. q and $- \mathbf { q } )$ we do not observe any issues empirically during training.
+
+# 3.2 Prior Learning
+
+Given a set of latents $\mathbf { z } \in Z$ resulting from minimizing the objective in Eq. $2 ,$ our goal is to learn a generative model $p ( Z )$ that captures their distribution (i.e. after minimizing the objective in Eq. $2$ we interpret $\mathbf { z } \in Z$ as examples from an empirical distribution in latent space). In order to model $p ( Z )$ we employ a Denoising Diffusion Probabilistic Model (DDPM) [17], a recent score-matching $[ \overline { { 1 8 } } ]$ based model that learns to reverse a diffusion Markov Chain with a large but finite number of timesteps. In DDPMs $\mathbb { \lVert 1 7 \rVert }$ it is shown that this reverse process is equivalent to learning a sequence of denoising auto-encoders with tied weights. The supervised denoising objective in DDPMs makes learning $p ( Z )$ simple and scalable. This allows us to learn a powerful generative model that enables both unconditional and conditional generation of 3D scenes. For training our prior $p _ { \theta _ { p } } ( Z )$ we take the objective function in $ { \mathbb { I } } ^ { [ 1 2 ] }$ defined in Eq. $\textcircled { 3 }$ In Eq. $\sum t$ denotes the timestep, $\epsilon \sim \mathcal { N } ( 0 , \mathbf { I } )$ is the noise and $\bar { \alpha } _ { t }$ is a noise magnitude parameter with a fixed scheduling. Finally, $\epsilon _ { \theta _ { p } }$ denotes the denoising model.
+
+$$
+\operatorname* { m i n } _ { \theta _ { p } } \mathbb { E } _ { t , \mathbf { z } \sim Z , \epsilon \sim \mathcal { N } ( 0 , \mathbf { I } ) } \left[ \| \epsilon - \epsilon _ { \theta _ { p } } \big ( \sqrt { \bar { \alpha } _ { t } } \mathbf { z } + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon , t \big ) \| ^ { 2 } \right]
+$$
+
+At inference time, we sample $\mathbf { z } \sim p _ { \theta _ { p } } ( Z )$ by following the inference process in DDPMs. We start by sampling $\mathbf { z } _ { T } \sim \mathcal { N } ( 0 , \mathbf { I } )$ and iteratively apply $\epsilon _ { \theta _ { p } }$ to gradually denoise $\mathbf { z } _ { T }$ , thus reversing the diffusion Markov Chain to obtain $\mathbf { z } _ { 0 }$ . We then feed $\mathbf { z } _ { 0 }$ as input to the decoder architecture (cf. Fig. $2 )$ and reconstruct a radiance field and a camera path.
+
+If the goal is to learn a conditional distribution of the latents $p ( Z | Y )$ , given paired data $\{ \mathbf { z } \in Z , y \in$ $Y \}$ , the denoising model $\epsilon _ { \theta }$ is augmented with a conditioning variable $y$ , resulting in $\epsilon _ { \theta _ { p } } ( \mathbf { z } , t , y )$ , implementation details about how the conditioning variable is used in the denoising architecture can be found in the appendix C.
+
+# 4 Experiments
+
+In this section we show the applicability of GAUDI to multiple problems. First, we evaluate reconstruction quality and performance of the reconstruction stage. Then, we evaluate the performance of our model in generative tasks including unconditional and conditional inference, in which radiance fields are generated from conditioning variables corresponding to images or text prompts. Full experimental settings and details can be found in the appendix B
+
+# 4.1 Data
+
+We report results on 4 datasets: Vizdoom $\mathbb { \left| \left[ 2 . 3 \right] \right| }$ , Replica [64], VLN-CE [26] and ARKit Scenes [1], which vary in number of scenes and complexity (see Fig. 3 and Tab. 1).
+
+Vizdoom $\pmb { \mathbb { Z } 3 } \|$ : Vizdoom is a synthetic simulated environment with simple texture and geometry. We use the data provided by $\pmb { \mathbb { B } } ] \mathbf { l }$ to train our model. It is the simplest dataset in terms of number of scenes and trajectories, as well as texture, serving as a test bed to examine GAUDI in the simplest setting.
+
+Replica $\pmb { \mathbb { \lVert 6 4 \rVert } }$ : Replica is a dataset comprised of 18 realistic scenes from which trajectories are rendered via Habitat $\mathbb { \boldsymbol { 9 } }$ . We used the data provided by $\textcircled { 8 }$ to train our model.
+
+VLN-CE $\left[ \left[ 2 6 \right] \right]$ : VLN-CE is a dataset originally designed for vision and language navigation in continuous environments. This dataset is composed of 3.6K trajectories of an agent navigating between two points in a 3D scene from the Matterport 3D dataset $\mathbb { H }$ . We render observations via
+
+
+Figure 3: (a) Examples of the 4 datasets we use in this paper (from left to right): Vizdoom $[ [ 2 3 ] ]$ , Replica $\pmb { \| 6 4 \| }$ , VLN-CE $\left[ \left[ 2 6 \right] \right]$ , ARKitScenes [1]. (b) Layouts for two scenes in VLN-CE $\pmb { \Vert 2 6 \Vert }$ , where navigable areas are shaded in dark gray. Blue and red dots represent start-end positions and the camera path is highlighted in blue.
+
+Habitat $\mathbb { \left[ \left. 5 9 \right. \right. }$ . Notably, this dataset contains also textual descriptions of the trajectories taken by an agent. In Sect. 4.5 we train GAUDI in a conditional manner to generate 3D scenes given a description.
+
+ARKitScenes [1]: ARKitScenes is a dataset of scans of indoor spaces. This dataset contains more than 5K scans of about 1.6K different indoor spaces. As opposed to the previous datasets where RGB, depth and camera poses are obtained via rendering in a simulation (i.e. either Vizdoom $\mathbb { \left[ \left. 2 3 \right] \right. }$ or Habitat [59]), ARKitScenes provides raw RGB and depth of the scans and camera poses estimated using ARKit SLAM. In addition, whereas trajectories from the previous datasets are point-to-point, as typically done in navigation, the camera trajectories for ARKitScenes resembles a natural scan a of full indoor space. In our experiments we use a subset of 1K scans from ARKitScenes to train our models.
+
+# 4.2 Reconstruction
+
+We first validate the hypothesis that the optimization problem described in Eq. $2$ can find latent codes $\mathbf { z }$ that are able reconstruct the trajectories in the empirical distribution in a satisfactory way. In Tab. 1 we report reconstruction performance of our model across all datasets. Fig. $\sharp$ shows reconstructions of random trajectories for each dataset. For all our experiments we set the dimension of $\mathbf { z } _ { \mathrm { s c e n e } }$ and $\mathbf { z } _ { \mathrm { p o s e } }$ to 2048 and $\beta = 0 . 1$ unless otherwise stated. During training, we normalize camera poses for each trajectory so that the middle frame in a trajectory becomes the origin of the coordinate system. See appendix $\boxed { \ E }$ for ablation experiments.
+
+
+Figure 4: Qualitative reconstruction results of random trajectories on different datasets (one for each column): Vizdoom $\pmb { \left. \pmb { \left. \bar { 2 3 } \right. } \right. }$ , Replica $\pmb { \mathbb { \lVert 6 4 \rVert } }$ , VLN-CE $\left[ \left[ 2 6 \right] \right]$ and ARKitScenes [1]. For each pair of images the left is ground-truth and right is reconstruction.
+
+
#sc-#tr-#im
11↓
PSNR↑
SSIM个
Rot Err. ↓
Trans. Err ↓
Vizdoom 2
1-32-1k
0.004
44.42
0.98
0.01
1.26
Replica √
18-100-1k
0.006
38.86
0.99
0.03
0.01
VLN-CE [26
90-3.6k-600k
0.031
25.17
0.73
0.30
0.02
ARKitScenes
300-1k-600k
0.039
24.51
0.76
0.16
0.04
+
+Table 1: Reconstruction results of the optimization process described in Eq. 2. The first column shows the number of scenes (#sc), trajectories (#tr) and images (#im) per dataset. Due to the large number of images on VLN-CE $\mathbb { \left[ \left[ 2 6 \right] \right] }$ and ARKitScenes $\mathbb { I I }$ datasets we sample 10 random images per trajectory to compute the reconstruction metrics.
+
+# 4.3 Interpolation
+
+In addition, to evaluate the structure of the latent representation obtained from minimizing the optimization problem in Eq. $\bigstar ,$ we show interpolation results between pairs of latents $( \mathbf { z } _ { i } , \mathbf { z } _ { j } )$ in
+
+
+Fig. $\boxed { 5 }$ To render images while interpolating the scene we place a fixed camera at the origin of the coordinate system. We observe a smooth transition of scenes in both geometry (walls, ceilings) and texture (stairs, carpets). More visualizations are included in the appendix H.
+Figure 5: Interpolation of 3D scenes in latent space (e.g. interpolating the encoded radiance field) for the VLN-CE dataset $\pmb { \mathbb { Z } } 6 \|$ . Each row corresponds to a different interpolation path.
+
+# 4.4 Unconditional generative modeling
+
+Given latent representations $\textbf { z } \in \ Z$ that can reconstruct samples $x \in X$ with high accuracy as shown in Sect. $\boxed { 4 . 2 }$ we now evaluate the capacity of the prior $p _ { \theta _ { p } } ( Z )$ to capture the empirical distribution $x \in \mathcal { X }$ by learning the distribution of latents $\mathbf { z } _ { i } \in Z$ . To do so we sample $\mathbf { z } \sim p _ { \theta _ { p } } ( Z )$ by following the inference process in DDPMs, and then feed $\mathbf { z }$ through the decoder network, which results in trajectories of RGB images that are then used for evaluation. We compare our approach with the following baselines: GRAF $\pmb { \| 6 0 \| }$ , $\pi$ -GAN $\pmb { \mathbb { H } }$ and GSN $\textcircled { 8 }$ , where all models have access to ground-truth depth information during training. We sample 5k images from predicted and target distributions for each model and dataset and report both FID $\mathbb { \left[ \left[ 1 6 \right] \right] }$ and SwAV-FID $\begin{array} { r l } { { \bigl [ \bigl | 3 5 \bigr | \bigr ] } } \end{array}$ scores. We report quantitative results in Tab. $^ { 2 , }$ where we can see that GAUDI obtains state-of-the-art performance across all datasets and metrics. We attribute this performance improvement to the fact that GAUDI learns disentangled yet corresponding latents for radiance fields and camera poses, which is key when modeling scenes (see ablations in the appendix $\mathbf { E } )$ . We note that to obtain these great empirical results GAUDI needs to simultaneously find latents with high reconstruction fidelity while also efficiently learning their distribution.
+
+
VizDoom 因
Replica 国
VLN-CE 回
ARKitScenes
FID↓
SwAV-FID↓
FID↓
SwAV-FID↓
FID↓
SwAV-FID↓
FID↓
SwAV-FID↓
GRAF60
47.50 ± 2.13
5.44 ± 0.43
65.37 ± 1.64
5.76 ± 0.14
90.43±4.83
8.65±0.27
87.06±9.99
13.44±0.26
π-GAN
143.55 ± 4.81
15.26 ±0.15
166.55 ± 3.61
13.17 ±0.20
151.26 ± 4.19674 14.07 ±0.56
134.80±10.60
15.58 ±0.13
GSN
37.21 ± 1.17
4.56±0.19
41.75 ±1.33
4.14±0.02
43.32 ±8.86
6.19±0.49
79.54 ± 2.60
10.21 ± 0.15
GAUDI
33.70±1.27
3.24±0.12
18.75±0.63
1.76 ±0.05
18.52 ±0.11
3.63±0.65
37.35 ±0.38
4.14±0.03
+
+Table 2: Generative performance of state-of-the-art approaches for generative modelling of radiance fields on 4 scene datasets: Vizdoom $\mathbb { \left[ \left. 2 3 \right\| \right. }$ , Replica $\textcircled { 6 4 } \textcircled { 1 6 }$ , VLN-CE $\dot { \left\| 2 6 \right\| }$ and ARKitScenes [1], according to FID [16] and SwAV-FID $\pmb { \Vert 3 5 \Vert }$ metrics.
+
+In Fig. $\boxed { 6 }$ we show samples from the unconditional distribution learnt by GAUDI for different datasets. We observe that GAUDI is able to generate diverse and realistic 3D scenes from the empirical distribution which can be rendered from the sampled camera poses.
+
+# 4.5 Conditional Generative Modeling
+
+GAUDI can also tackle conditional generative problems of the form $p ( Z | Y )$ , where a conditioning variable $y \in Y$ is given to condition $p ( Z )$ . For a given conditional inference problem we assume the existence of paired data [46, 11, 45]. As an example, for training a text-conditional model we assume the existence of pairs $\left\{ \mathbf { z } _ { i } , y _ { i } \right\}$ , where $\mathbf { z } _ { i }$ is a latent scene representation and $y _ { i }$ is its corresponding text prompt. In this section we show both quantitative and qualitative results for conditional inference problems. The first conditioning variable we consider are textual descriptions of trajectories. Second, we consider a model where randomly sampled RGB images in a trajectory act as conditioning. Finally, we use a categorical variable that indicates the 3D environment (i.e. the particular indoor space) from which each trajectory was obtained. Tab. $3$ shows quantitative results for the different conditional inference problems. Details on the implementation of the conditional DDPM are given in Sect. D
+
+
+
+
Avg.△Per-Environment
FID↓
SwAV-FID↓
-50.79
-4.10
+
+Table 3: Quantitative results of Conditional Generative Modeling on VLN-CE [26] dataset. GAUDI is able to produce high-quality scene renderings with low FID and SwAV-FID scores. In the right table we show the difference in average per-environment FID score between the conditional and unconditional models.
+
+
Text Conditioning
Image Conditioning
Categorical Conditioning
FID↓
SwAV-FID↓
FID↓
SwAV-FID↓
FID↓
SwAV-FID↓
18.50
3.75
19.51
3.93
18.74
3.61
+
+# 4.5.1 Text Conditioning
+
+We tackle the challenging task of training a text conditional model for 3D scene generation. We use the navigation text descriptions provided in VLN-CE $\left[ \left[ 2 6 \right] \right]$ to condition our model. These text descriptions contain high level information about the scene as well as the navigation path (i.e. "Walk out of the bedroom and into the living room", "Exit the room through the swinging doors and then enter the bedroom"). We employ a pre-trained RoBERTa-base $\dot { \left\| 2 9 \right\| }$ text encoder and use its intermediate representation to condition the diffusion model. Fig. $^ { 7 }$ shows qualitative results of GAUDI for this task. To the best of our knowledge, this is the first model that allows for conditional 3D scene generation from text in an amortized manner (i.e. without distilling CLIP $\mathbb { \lVert H \ 4 \rVert }$ through a costly optimization problem [19, 32]).
+
+
+Figure 7: Text conditional 3D scene generation using GAUDI (one sample per row). Our model is able to capture the conditional distributions of scenes by generating multiple plausible scenes and camera paths that match the given text prompts.
+
+# 4.5.2 Image Conditioning
+
+We now analyze whether GAUDI is able to pick up information from the RGB images to predict a distribution over $Z$ . In this experiment we randomly pick images in a trajectory $x \in X$ and use it as a conditioning variable $y$ . For this experiment we use trajectories in the VLN-CE dataset $\pmb { \left. 2 6 \right. }$ . During each training iteration we sample a random image for each trajectory $x$ and use it as a conditioning variable. We employ a pre-trained ResNet-18 [15] as an image encoder. During inference, the resulting conditional GAUDI model is able to sample radiance fields where the given image is observed from a stochastic viewpoint. In Fig. $\textcircled { 8 }$ we show samples from the model conditioned on different RGB images.
+
+
+Figure 8: Image conditional 3D scene generation using GAUDI (one sample per row). Given a conditioned image (top row), our model is able to sample scenes where the same or contextually similar view is observed from a stochastic viewpoint.
+
+
+Figure 9: Samples from the GAUDI model conditioned on a categorical variable denoting the indoor scene (one sample per row).
+
+# 4.5.3 Categorical Conditioning
+
+Finally, we analyze how GAUDI performs when conditioned on a categorical variable that indicates the underlying 3D indoor environment in which each trajectory was recorded. We perform experiments in the VLN-CE $[ \overline { { 2 6 } } ]$ dataset, where we employ a trainable embedding layer to learn a representation for categorical variables indicating each environment. We compare the per-environment FID score of conditional model with its unconditional counterpart. This per-enviroment FID score is computed only on real images of the same indoor environment that the model is conditioned on. Our hypothesis is that if the model efficiently captures the information in the conditioning variable it should capture the environment specific distribution better than its unconditional counterpart trained on the same data. In Tab. $\textcircled { 3 }$ the last column shows difference (e.g. the $\Delta$ ) on the average per-environment FID score between the conditional and unconditional model on VLN-CE dataset. We observe that the conditional model consistently obtains a better FID score than the unconditional model across all indoor environments, resulting in a sharp reduction of average FID and SwAV-FID scores. In addition, in Fig. 9 we show samples from the model conditioned on a given categorical variable.
+
+# 5 Conclusion
+
+We have introduced GAUDI, a generative model that captures distributions of complex and realistic 3D scenes. GAUDI uses a scalable two-stage approach which first involves learning a latent representation that disentangles radiance fields and camera poses. The distribution of disentangled latent representations is then modeled with a powerful prior. Our model obtains state-of-the-art performance when compared with recent baselines across multiple 3D datasets and metrics. GAUDI can be used both for conditional and unconditional problems, and enabling new tasks like generating 3D scenes from text descriptions.
+
+# References
+
+[1] Gilad Baruch, Zhuoyuan Chen, Afshin Dehghan, Yuri Feigin, Peter Fu, Thomas Gebauer, Daniel Kurz, Tal Dimry, Brandon Joffe, Arik Schwartz, et al. Arkitscenes: A diverse real-world dataset for 3d indoor scene understanding using mobile rgb-d data. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 1), 2021.
+[2] Piotr Bojanowski, Armand Joulin, David Lopez-Paz, and Arthur Szlam. Optimizing the latent space of generative networks. arXiv preprint arXiv:1707.05776, 2017.
+[3] Marcus Carter and Ben Egliston. Ethical implications of emerging mixed reality technologies. 2020.
+[4] Lluis Castrejon, Nicolas Ballas, and Aaron Courville. Improved conditional vrnns for video prediction. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 7608–7617, 2019.
+[5] Eric R Chan, Connor Z Lin, Matthew A Chan, Koki Nagano, Boxiao Pan, Shalini De Mello, Orazio Gallo, Leonidas Guibas, Jonathan Tremblay, Sameh Khamis, et al. Efficient geometry-aware 3d generative adversarial networks. arXiv preprint arXiv:2112.07945, 2021.
+[6] Eric R Chan, Marco Monteiro, Petr Kellnhofer, Jiajun Wu, and Gordon Wetzstein. pi-GAN: Periodic implicit generative adversarial networks for 3d-aware image synthesis. arXiv preprint arXiv:2012.00926, 2020.
+[7] Angel Chang, Angela Dai, Thomas Funkhouser, Maciej Halber, Matthias Niessner, Manolis Savva, Shuran Song, Andy Zeng, and Yinda Zhang. Matterport3d: Learning from rgb-d data in indoor environments. arXiv preprint arXiv:1709.06158, 2017.
+[8] Terrance DeVries, Miguel Angel Bautista, Nitish Srivastava, Graham W Taylor, and Joshua M Susskind. Unconstrained scene generation with locally conditioned radiance fields. ICCV, 2021.
+[9] Emilien Dupont, Miguel Angel Bautista, Alex Colburn, Aditya Sankar, Carlos Guestrin, Josh Susskind, and Qi Shan. Equivariant neural rendering. In International Conference on Machine Learning, pages 2761–2770. PMLR, 2020.
+[10] Emilien Dupont, Hyunjik Kim, SM Ali Eslami, Danilo Jimenez Rezende, and Dan Rosenbaum. From data to functa: Your data point is a function and you can treat it like one. In International Conference on Machine Learning, pages 5694–5725. PMLR, 2022.
+[11] Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12873–12883, 2021.
+[12] Jiatao Gu, Lingjie Liu, Peng Wang, and Christian Theobalt. Stylenerf: A style-based 3d-aware generator for high-resolution image synthesis. arXiv preprint arXiv:2110.08985, 2021.
+[13] Pengsheng Guo, Miguel Angel Bautista, Alex Colburn, Liang Yang, Daniel Ulbricht, Joshua M Susskind, and Qi Shan. Fast and explicit neural view synthesis. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 3791–3800, 2022.
+[14] David Ha and Jürgen Schmidhuber. World models. arXiv preprint arXiv:1803.10122, 2018.
+[15] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
+[16] 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. arXiv preprint arXiv:1706.08500, 2017.
+[17] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020.
+[18] Aapo Hyvärinen and Peter Dayan. Estimation of non-normalized statistical models by score matching. Journal of Machine Learning Research, 6(4), 2005.
+[19] Ajay Jain, Ben Mildenhall, Jonathan T Barron, Pieter Abbeel, and Ben Poole. Zero-shot text-guided object generation with dream fields. arXiv preprint arXiv:2112.01455, 2021.
+[20] Niharika Jain, Alberto Olmo, Sailik Sengupta, Lydia Manikonda, and Subbarao Kambhampati. Imperfect imaganation: Implications of gans exacerbating biases on facial data augmentation and snapchat selfie lenses. arXiv preprint arXiv:2001.09528, 2020.
+[21] Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4401–4410, 2019.
+[22] Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of stylegan. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8110–8119, 2020.
+[23] Michał Kempka, Marek Wydmuch, Grzegorz Runc, Jakub Toczek, and Wojciech Jaskowski. Vizdoom: ´ A doom-based ai research platform for visual reinforcement learning. In 2016 IEEE Conference on Computational Intelligence and Games (CIG), pages 1–8. IEEE, 2016.
+[24] Seung Wook Kim, Jonah Philion, Antonio Torralba, and Sanja Fidler. Drivegan: Towards a controllable high-quality neural simulation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5820–5829, 2021.
+[25] Adam R Kosiorek, Heiko Strathmann, Daniel Zoran, Pol Moreno, Rosalia Schneider, Sona Mokrá, and Danilo Jimenez Rezende. Nerf-vae: A geometry aware 3d scene generative model. In International Conference on Machine Learning, pages 5742–5752. PMLR, 2021.
+[26] Jacob Krantz, Erik Wijmans, Arjun Majundar, Dhruv Batra, and Stefan Lee. Beyond the nav-graph: Vision and language navigation in continuous environments. In European Conference on Computer Vision (ECCV), 2020.
+[27] Zihang Lai, Sifei Liu, Alexei A Efros, and Xiaolong Wang. Video autoencoder: self-supervised disentanglement of static 3d structure and motion. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9730–9740, 2021.
+[28] Lingjie Liu, Jiatao Gu, Kyaw Zaw Lin, Tat-Seng Chua, and Christian Theobalt. Neural sparse voxel fields. arXiv preprint arXiv:2007.11571, 2020.
+[29] Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
+[30] Willi Menapace, Stéphane Lathuilière, Sergey Tulyakov, Aliaksandr Siarohin, and Elisa Ricci. Playable video generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10061–10070, 2021.
+[31] Lars Mescheder, Michael Oechsle, Michael Niemeyer, Sebastian Nowozin, and Andreas Geiger. Occupancy networks: Learning 3d reconstruction in function space. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4460–4470, 2019.
+[32] Oscar Michel, Roi Bar-On, Richard Liu, Sagie Benaim, and Rana Hanocka. Text2mesh: Text-driven neural stylization for meshes. arXiv preprint arXiv:2112.03221, 2021.
+[33] Ben Mildenhall, Pratul P Srinivasan, Matthew Tancik, Jonathan T Barron, Ravi Ramamoorthi, and Ren Ng. Nerf: Representing scenes as neural radiance fields for view synthesis. arXiv preprint arXiv:2003.08934, 2020.
+[34] Yisroel Mirsky and Wenke Lee. The creation and detection of deepfakes: A survey. ACM Computing Surveys (CSUR), 54(1):1–41, 2021.
+[35] Stanislav Morozov, Andrey Voynov, and Artem Babenko. On self-supervised image representations for GAN evaluation. In International Conference on Learning Representations, 2021.
+[36] Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741, 2021.
+[37] Alexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, pages 8162–8171. PMLR, 2021.
+[38] Michael Niemeyer and Andreas Geiger. Giraffe: Representing scenes as compositional generative neural feature fields. arXiv preprint arXiv:2011.12100, 2020.
+[39] Jeong Joon Park, Peter Florence, Julian Straub, Richard Newcombe, and Steven Lovegrove. Deepsdf: Learning continuous signed distance functions for shape representation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 165–174, 2019.
+[40] Despoina Paschalidou, Amlan Kar, Maria Shugrina, Karsten Kreis, Andreas Geiger, and Sanja Fidler. Atiss: Autoregressive transformers for indoor scene synthesis. Advances in Neural Information Processing Systems, 34, 2021.
+[41] Songyou Peng, Michael Niemeyer, Lars Mescheder, Marc Pollefeys, and Andreas Geiger. Convolutional occupancy networks. arXiv preprint arXiv:2003.04618, 2, 2020.
+[42] Ethan Perez, Florian Strub, Harm De Vries, Vincent Dumoulin, and Aaron Courville. Film: Visual reasoning with a general conditioning layer. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
+[43] Benjamin Planche, Xuejian Rong, Ziyan Wu, Srikrishna Karanam, Harald Kosch, YingLi Tian, Jan Ernst, and Andreas Hutter. Incremental scene synthesis. In Advances in Neural Information Processing Systems, pages 1668–1678, 2019.
+[44] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pages 8748–8763. PMLR, 2021.
+[45] Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In International Conference on Machine Learning, pages 8821–8831. PMLR, 2021.
+[46] Ali Razavi, Aaron Van den Oord, and Oriol Vinyals. Generating diverse high-fidelity images with vq-vae-2. Advances in neural information processing systems, 32, 2019.
+[47] Daniel Rebain, Mark Matthews, Kwang Moo Yi, Dmitry Lagun, and Andrea Tagliasacchi. Lolnerf: Learn from one look. arXiv preprint arXiv:2111.09996, 2021.
+[48] Christian Reiser, Songyou Peng, Yiyi Liao, and Andreas Geiger. Kilonerf: Speeding up neural radiance fields with thousands of tiny mlps. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 14335–14345, 2021.
+[49] Xuanchi Ren and Xiaolong Wang. Look outside the room: Synthesizing a consistent long-term 3d scene video from a single image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
+[50] Salah Rifai, Grégoire Mesnil, Pascal Vincent, Xavier Muller, Yoshua Bengio, Yann Dauphin, and Xavier Glorot. Higher order contractive auto-encoder. In Joint European conference on machine learning and knowledge discovery in databases, pages 645–660. Springer, 2011.
+[51] Daniel Ritchie, Kai Wang, and Yu-an Lin. Fast and flexible indoor scene synthesis via deep convolutional generative models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6182–6190, 2019.
+[52] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. arXiv preprint arXiv:2112.10752, 2021.
+[53] Robin Rombach, Patrick Esser, and Björn Ommer. Geometry-free view synthesis: Transformers and no 3d priors, 2021.
+[54] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 2015.
+[55] Negar Rostamzadeh, Emily Denton, and Linda Petrini. Ethics and creativity in computer vision. arXiv preprint arXiv:2112.03111, 2021.
+[56] Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S. Sara Mahdavi, Rapha Gontijo Lopes, Tim Salimans, Jonathan Ho, David J Fleet, and Mohammad Norouzi. Photorealistic text-to-image diffusion models with deep language understanding, 2022.
+[57] Mehdi S. M. Sajjadi, Henning Meyer, Etienne Pot, Urs Bergmann, Klaus Greff, Noha Radwan, Suhani Vora, Mario Lucic, Daniel Duckworth, Alexey Dosovitskiy, Jakob Uszkoreit, Thomas Funkhouser, and Andrea Tagliasacchi. Scene Representation Transformer: Geometry-Free Novel View Synthesis Through Set-Latent Scene Representations. CVPR, 2022.
+[58] Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. NeurIPS’16, page 2234–2242, Red Hook, NY, USA, 2016. Curran Associates Inc.
+[59] Manolis Savva, Abhishek Kadian, Oleksandr Maksymets, Yili Zhao, Erik Wijmans, Bhavana Jain, Julian Straub, Jia Liu, Vladlen Koltun, Jitendra Malik, et al. Habitat: A platform for embodied ai research. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9339–9347, 2019.
+[60] Katja Schwarz, Yiyi Liao, Michael Niemeyer, and Andreas Geiger. GRAF: Generative radiance fields for 3d-aware image synthesis. arXiv preprint arXiv:2007.02442, 2020.
+[61] Edward J Smith and David Meger. Improved adversarial systems for 3d object generation and reconstruction. In Conference on Robot Learning, pages 87–96. PMLR, 2017.
+[62] Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pages 2256–2265. PMLR, 2015.
+[63] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020.
+[64] Julian Straub, Thomas Whelan, Lingni Ma, Yufan Chen, Erik Wijmans, Simon Green, Jakob J Engel, Raul Mur-Artal, Carl Ren, Shobhit Verma, et al. The replica dataset: A digital replica of indoor spaces. arXiv preprint arXiv:1906.05797, 2019.
+[65] Hoang Thanh-Tung and Truyen Tran. Catastrophic forgetting and mode collapse in gans. In 2020 International Joint Conference on Neural Networks (IJCNN), pages 1–10. IEEE, 2020.
+[66] Patrick Tinsley, Adam Czajka, and Patrick Flynn. This face does not exist... but it might be yours! identity leakage in generative models. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 1320–1328, 2021.
+[67] Thomas Unterthiner, Sjoerd van Steenkiste, Karol Kurach, Raphael Marinier, Marcin Michalski, and Sylvain Gelly. Towards accurate generative models of video: A new metric & challenges. arXiv preprint arXiv:1812.01717, 2018.
+[68] Arash Vahdat, Karsten Kreis, and Jan Kautz. Score-based generative modeling in latent space. Advances in Neural Information Processing Systems, 34:11287–11302, 2021.
+[69] Aaron Van Den Oord, Oriol Vinyals, et al. Neural discrete representation learning. Advances in neural information processing systems, 30, 2017.
+[70] Xinpeng Wang, Chandan Yeshwanth, and Matthias Nießner. Sceneformer: Indoor scene generation with transformers. In 2021 International Conference on 3D Vision (3DV), pages 106–115. IEEE, 2021.
+[71] Daniel Watson, William Chan, Jonathan Ho, and Mohammad Norouzi. Learning fast samplers for diffusion models by differentiating through sample quality. In International Conference on Learning Representations, 2021.
+[72] Daniel Watson, Jonathan Ho, Mohammad Norouzi, and William Chan. Learning to efficiently sample from diffusion probabilistic models. arXiv preprint arXiv:2106.03802, 2021.
+[73] Alex Yu, Sara Fridovich-Keil, Matthew Tancik, Qinhong Chen, Benjamin Recht, and Angjoo Kanazawa. Plenoxels: Radiance fields without neural networks. arXiv preprint arXiv:2112.05131, 2021.
+
+[74] Alex Yu, Vickie Ye, Matthew Tancik, and Angjoo Kanazawa. pixelnerf: Neural radiance fields from one or few images. arXiv preprint arXiv:2012.02190, 2020.
+
+[75] Peng Zhou, Lingxi Xie, Bingbing Ni, and Qi Tian. Cips-3d: A 3d-aware generator of gans based on conditionally-independent pixel synthesis. arXiv preprint arXiv:2110.09788, 2021.
+
+# Checklist
+
+The checklist follows the references. Please read the checklist guidelines carefully for information on how to answer these questions. For each question, change the default [TODO] to [Yes] , [No] , or [N/A] . You are strongly encouraged to include a justification to your answer, either by referencing the appropriate section of your paper or providing a brief inline description. For example:
+
+• Did you include the license to the code and datasets? [Yes] See Section ??.
+• Did you include the license to the code and datasets? [No] The code and the data are proprietary.
+• Did you include the license to the code and datasets? [N/A]
+
+Please do not modify the questions and only use the provided macros for your answers. Note that the Checklist section does not count towards the page limit. In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below.
+
+1. For all authors...
+
+(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
+(b) Did you describe the limitations of your work? [Yes] These will be discussed in appendix A
+(c) Did you discuss any potential negative societal impacts of your work? [Yes] These will be discussed in appendix A
+(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
+
+2. If you are including theoretical results...
+
+(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
+
+3. If you ran experiments...
+
+(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We will release code publicly upon acceptance.
+(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] These details will be clarified in B
+(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
+(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] These details will be clarified in B
+
+4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
+
+(a) If your work uses existing assets, did you cite the creators? [Yes] See Sect. 4
+(b) Did you mention the license of the assets? [Yes]
+(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
+(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
+(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
+
+5. If you used crowdsourcing or conducted research with human subjects...
+
+(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
+(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
+(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
\ No newline at end of file
diff --git a/md/dev/xkjqJYqRJy/xkjqJYqRJy.md b/md/dev/xkjqJYqRJy/xkjqJYqRJy.md
new file mode 100644
index 0000000000000000000000000000000000000000..bfa51d587ed7ac39d436a12889c5b021ffa252cd
--- /dev/null
+++ b/md/dev/xkjqJYqRJy/xkjqJYqRJy.md
@@ -0,0 +1,658 @@
+# BAYESIAN NEURAL NETWORK PRIORS REVISITED
+
+Vincent Fortuin∗ ETH Zürich, Switzerland fortuin@inf.ethz.ch
+
+Adrià Garriga-Alonso∗
+University of Cambridge, United Kingdom
+ag919@cam.ac.uk
+Sebastian W. Ober
+University of Cambridge, United Kingdom
+swo25@cam.ac.uk
+
+Florian Wenzel Google AI Berlin, Germany florianwenzel@google.com
+
+Gunnar Rätsch ETH Zürich, Switzerland raetsch@inf.ethz.ch
+
+Richard E. Turner University of Cambridge, United Kingdom ret26@eng.cam.ac.uk
+
+Mark van der Wilk† Imperial College London, United Kingdom m.vdwilk@imperial.ac.uk
+
+Laurence Aitchison† University of Bristol, United Kingdom laurence.aitchison@bristol.ac.uk
+
+# ABSTRACT
+
+Isotropic Gaussian priors are the de facto standard for modern Bayesian neural network inference. However, it is unclear whether these priors accurately reflect our true beliefs about the weight distributions or give optimal performance. To find better priors, we study summary statistics of neural network weights in networks trained using stochastic gradient descent (SGD). We find that convolutional neural network (CNN) and ResNet weights display strong spatial correlations, while fully connected networks (FCNNs) display heavy-tailed weight distributions. We show that building these observations into priors can lead to improved performance on a variety of image classification datasets. Surprisingly, these priors mitigate the cold posterior effect in FCNNs, but slightly increase the cold posterior effect in ResNets.
+
+# 1 INTRODUCTION
+
+In a Bayesian neural network (BNN), we specify a prior $p ( w )$ over the neural network parameters, and compute the posterior distribution over parameters conditioned on training data, $\bar { p ( w | x , y ) = }$ $p ( y | w , x ) p ( w ) / p ( y | x )$ . This procedure should give considerable advantages for reasoning about predictive uncertainty, which is especially relevant in the small-data setting. Crucially, to perform Bayesian inference, we need to choose a prior that accurately reflects our beliefs about the parameters before seeing any data (Bayes, 1763; Gelman et al., 2013). However, the most common choice of prior for BNN weights is the simplest one: the isotropic Gaussian. Isotropic Gaussians are used across almost all fields of Bayesian deep learning, ranging from variational inference (e.g., Hernández-Lobato & Adams, 2015; Louizos & Welling, 2017; Dusenberry et al., 2020), samplingbased inference (e.g., Neal, 1992; Zhang et al., 2019), and Laplace’s method (e.g., Osawa et al., 2019; Immer et al., 2021b), to even infinite networks (e.g., Lee et al., 2017; Garriga-Alonso et al., 2019). It is troubling that no alternatives are usually considered, since better choices likely exist.
+
+Indeed, despite the progress on more accurate and efficient inference procedures, in some settings, the posterior predictive distribution of BNNs using Gaussian priors still leads to worse predictive performance than a baseline obtained by training the network with standard stochastic gradient descent (SGD) (e.g., Zhang et al., 2019; Heek & Kalchbrenner, 2019; Wenzel et al., 2020a). Surprisingly, these issues can largely be fixed by artificially reducing posterior uncertainty using “cold posteriors” (Wenzel et al., 2020a). The cold posterior is $p ( w | x , y ) ^ { \frac { 1 } { T } }$ for a temperature $0 < T < 1$ , where the original Bayes posterior would be obtained by setting $T = 1$ (see Eq. 1). Using cold posteriors can be interpreted as overcounting the data and, hence, deviating from the Bayesian paradigm. This should not happen if the prior and likelihood accurately reflect our beliefs. Assuming inference is working correctly, the Bayesian solution, $T = 1$ , really should be optimal (Gelman et al., 2013). Hence, it raises the possibility that either the prior (Wenzel et al., 2020a) or likelihood (Aitchison, 2020b) (or both) are misspecified.
+
+In this work, we study empirically whether isotropic Gaussian priors are indeed suboptimal for BNNs and whether this can explain the cold posterior effect. We analyze the performance of different BNN priors for different network architectures and compare them to the empirical weight distributions of standard SGD-trained neural networks. We conclude that correlated Gaussian priors are better in ResNets, while uncorrelated heavy-tailed priors are better in fully connected neural networks (FCNNs). Thus, we would recommend these choices instead of the widely-used isotropic Gaussian priors. While these priors eliminate the cold posterior effect in FCNNs, they slightly increase the cold posterior effect in ResNets. This provides evidence that the cold posterior effect arises due to a misspecification of the prior (Wenzel et al., 2020a) in FCNNs. In ResNets, it is difficult to draw any strong conclusions about the cold posterior effect from our results. Our observations are compatible with the hypothesis that the cold posterior effect arises in large-scale image models due to a misspecified likelihood (Aitchison, 2020b) or due to data augmentation (Izmailov et al., 2020), but there could of course be a prior that we did not consider that improves performance and eliminates the cold posterior effect. We make our library available on Github1, inviting other researchers to join us in studying the role of priors in BNNs using state-of-the-art inference.
+
+# 1.1 CONTRIBUTIONS
+
+Our main contributions are:
+
+• An analysis of the empirical weight distributions of SGD-trained neural networks with different architectures, suggesting that FCNNs learn heavy-tailed weight distributions (Sec. 3.1), while CNN and ResNet weight distributions show significant spatial correlations (Sec. 3.2).
+
+• Experiments in Bayesian FCNNs showing that heavy-tailed priors give better classification performance than the widely-used Gaussian priors (Sec. 4.2).
+
+• Experiments in Bayesian ResNets showing that spatially correlated Gaussian priors give better classification performance than isotropic priors (Sec. 4.3).
+
+
+Figure 1: Empirical marginal weight distributions of a layer of FCNNs and CNNs trained with SGD on MNIST, and an early layer of several ResNets trained on CIFAR-10. We show weight histograms (left) and quantile-quantile (Q-Q) plots with different distributions (right). The empirical weights are clearly heavier-tailed than a Gaussian (green line), and better fit by a Laplace (orange line).
+
+• Experiments showing that the cold posterior effect can be reduced by choosing better, heavy-tailed priors in FCNNs, while the cold posterior is slightly increased when using better, spatially correlated priors in ResNets (Sec. 4).
+
+# 2 BACKGROUND: THE COLD POSTERIOR EFFECT
+
+When performing inference in Bayesian models, we can temper the posterior by a positive temperature $T$ , giving
+
+$$
+\log p ( w | x , y ) ^ { \frac { 1 } { T } } = { \frac { 1 } { T } } [ \log p ( y | w , x ) + \log p ( w ) ] + Z ( T )
+$$
+
+for neural network weights $w$ , inputs $x$ regression targets or class-labels $y$ , prior $p ( w )$ , likelihood $p ( y | w , x )$ , and a normalizing constant $Z ( T )$ . Setting $T = 1$ yields the standard Bayesian posterior. The temperature parameter can be easily handled when simulating Langevin dynamics, as used in molecular dynamics and MCMC (Leimkuhler & Matthews, 2012).
+
+In their recent work, Wenzel et al. (2020a) have drawn attention to the fact that cooling the posterior in BNNs (i.e., setting $T < 1$ ), often improves performance. Testing different hypotheses for potential problems with the inference, likelihood, and prior, they conclude that the BNN priors (which were Gaussian in their experiments) are misspecified—at least when used in conjuction with standard neural network architectures on standard benchmark tasks—which could be one of the main causes of the cold posterior effect (c.f., Germain et al., 2016; van der Wilk et al., 2018). Reversing this argument, we can hypothesize that choosing better priors for BNNs may lead to a less pronounced cold posterior effect, which we can use to evaluate different candidate priors.
+
+# 3 EMPIRICAL ANALYSIS OF NEURAL NETWORK WEIGHTS
+
+As we have discussed, standard Gaussian priors may not be the optimal choice for modern BNN architectures. But how can we find more suitable priors? Since it is hard to directly formulate reasonable prior beliefs about neural network weights, we turn to an empirical approach. We trained fully connected neural networks (FCNNs), convolutional neural networks (CNNs), and ResNets with SGD on various image classification tasks to obtain an approximation of the empirical distribution of the fitted weights, that is, the distribution of the maximum a posteriori (MAP) solutions reached by SGD. If the distributions over SGD-fitted weights differ strongly from the usual isotropic Gaussian prior, that provides evidence that those features should be incorporated into the prior. Hence, we can use our insights by inspecting the empirical weight distribution to propose better-suited priors.
+
+Formally, this procedure can be viewed as approximate human-in-the-loop expectation maximization (EM). In particular, in expectation maximization, we alternate expectation $\mathrm { ( E ) }$ and maximization (M) steps. In the expectation (E) step, we infer the posterior $p ( w | x , y , \theta _ { t - 1 } )$ over the weights, $w$ , given the parameters of the prior from the previous step, $\theta _ { t - 1 }$ . In our case, we approximately infer the weights using SGD. Then, in the maximization step, we compute new prior parameters $\theta _ { t }$ , by sampling weights $w$ from the posterior computed in the E step, and maximizing the joint probability of sampled weights and data. As $y$ is independent of the prior parameters if the weights are known, the M-step reduces to fitting a prior distribution to the weights sampled from the posterior, that is,
+
+$$
+\begin{array} { r l } & { \mathcal { L } _ { t } ( \theta ) = \mathbb { E } _ { p ( w | x , y , \theta _ { t - 1 } ) } [ \log p ( y | x , w ) + \log p ( w | \theta ) ] } \\ & { \qquad = \mathbb { E } _ { p ( w | x , y , \theta _ { t - 1 } ) } [ \log p ( w | \theta ) ] + \mathrm { c o n s t } } \\ & { \qquad \theta _ { t } = \arg \operatorname* { m a x } \mathcal { L } _ { t } ( \theta ) ~ . } \end{array}
+$$
+
+Intuitively, this procedure allows the prior (and therefore the posterior) to assign more probability mass to the SGD solutions, which are known to work well in practice. This is also related to ideas from empirical Bayes (Robbins, 1992), where the (few) hyperparameters of the prior are fit to the data, and to recent ideas in PAC-Bayesian theory, where data-dependent priors have been shown to improve generalization guarantees over data-independent ones (Rivasplata et al., 2020; Dziugaite et al., 2021). While such approaches introduce a certain risk of overfitting (Ober et al., 2021), we would argue that standard BNNs are typically thought to be underfitting (Neal, 1996; Wenzel et al., 2020a; Dusenberry et al., 2020) and that we do not directly fit the prior parameters, but merely draw inspiration for the choice of prior family from the qualitative shape of the empirical weight distributions.
+
+We begin by considering whether the weights of FCNNs and CNNs are heavy-tailed, and move on to look at correlational structure in the weights of CNNs and ResNets. Note that in the exploratory experiments here, we used SGD to perform MAP inference with a uniform prior (that is, maximum likelihood fitting). This avoids any prior assumptions obscuring interesting patterns in the inferred weights. These patterns inspired our choice of priors, and we then evaluated these priors in BNNs, showing that they improved classification performance (see Sec. 4).
+
+
+Figure 2: (a) Degrees of freedom for Student-t distributions fitted to the weights of a ResNet20 trained on CIFAR-10. The degrees of freedom get larger in deeper layers, implying that the weight distributions become less heavy-tailed and more similar to Gaussians. The layers marked with asterisks $( ^ { * } )$ are the first layers of their respective ResNet blocks. (b) Spatial covariance of the weights within CNN filters for a three-hidden layer network trained on MNIST, normalized by the number of channels. The weights correlate strongly with neighboring pixels, and anti-correlate (layer 1) or do not correlate (layer 2) with distant ones. Each delineated square shows the covariances of a filter location (marked with $\times$ ) with all other locations.
+
+# 3.1 FCNN WEIGHTS ARE HEAVY-TAILED
+
+We trained an FCNN (Fig. 1, top) and a CNN (Fig. 1, middle) on MNIST (LeCun et al., 1998). The FCNN is a three layer network with 100 hidden units per layer and ReLU nonlinearities. The CNN is a three layer network, with two convolutional layers and one fully connected layer. The convolutional layers have 64 channels and use $3 \times 3$ convolutions, followed by $2 \times 2$ max-pooling layers. All layers use ReLU nonlinearities. Networks were trained with SGD for 450 epochs using a learning rate schedule of 0.05, 0.005, and 0.0005 for 150 epochs each. We can see in Figure 1 that the weight values of the FCNNs and CNNs follow a more heavy-tailed distribution than a Gaussian, with the tails being reasonably well approximated by a Laplace distribution. This suggests that “true” BNN priors might be more heavy-tailed than isotropic Gaussians.
+
+Next, we did a similar analysis for a ResNet20 trained on CIFAR-10 (Krizhevsky, 2009) (Fig. 1, bottom). Since this network had many layers, we quantified the degree of heavy-tailedness by fitting the degrees of freedom parameter $\nu$ of a Student-t distribution. For $\nu \to \infty$ , the Student-t becomes Gaussian, so large values of $\nu$ indicate that the weights are approximately Gaussian, whereas smaller values indicate heavy-tailed behavior (see Sec. 4.1). We found that at lower layers, $\nu$ was small, so the weights were somewhat heavy-tailed, whereas at higher layers, $\nu$ became much larger, so the weights were approximately Gaussian (Fig. 2a).
+
+These results are perhaps expected if we assume that the filters have (using neuroscience terminology) “localized receptive fields”, like those in Olshausen & Field (1997). Such filters contain a large number of near-zero weights outside the receptive field, with a number of very large weights inside the receptive field (Sahani & Linden, 2003; Smyth et al., 2003), and thus will follow a heavy-tailed distribution. As we get into the deeper layers of the networks, receptive fields are expected to become larger, so this effect may be less relevant.
+
+# 3.2 CNN WEIGHTS ARE SPATIALLY CORRELATED
+
+In the second part of our empirical inspection of fitted weight distributions, we looked at spatial correlations in CNN filters. In particular, we considered 9-dimensional vectors formed by the $3 \times 3$ filters for every input and output channel. We studied our three-layer network trained on MNIST and found strong correlations between nearby pixels, and lesser (layer 2) or even negative (layer 1) correlations at more distant pixels (Fig. 2b). We found similar spatial correlations in a ResNet20 trained on CIFAR-10, across all layers, with correlation strength increasing as we move to later layers (Fig. 3). We found by far the strongest evidence of correlations spatially, that is, between weights within the same convolutional filter. This could potentially be due to the smoothness and translation equivariance properties of natural images (Simoncelli, 2009). However, we also found some evidence for spatial correlations in the input layer of an FCNN (Fig. A.1 in the appendix), but no evidence for correlations between the channels of a convolutional layer (Fig. A.5 in the appendix). Note though that this methodology cannot find structured correlations between channels, except at the input and output. This is because NN functions are invariant to permutations of channels (Sussmann, 1992; MacKay, 1992; Bishop et al., 1995; Aitchison, 2020a; Aitchison et al., 2020).
+
+
+Figure 3: Spatial covariances for the convolutional weights of the layers of a ResNet-20, normalized by the maximum variance for each layer, which is shown on the bottom right. We trained the network with SGD on CIFAR-10 with data augmentation (10 times). Layer 1 is the closest to the input. The first layer of every ResNet block is marked with an asterisk $( ^ { \ast } )$ . We see that there are significant covariances in all layers, but that their strength increases for later layers.
+
+These findings suggest that better priors could be designed by explicitly taking this correlation structure into account. We hypothesize that multivariate distributions with non-diagonal covariance matrices could be good candidates for convolutional layer priors, especially when the covariances are large for neighboring pixels within the convolutional filters (see Sec. 4.3).
+
+Additional evidence for the usefulness of correlated weights comes from the theory of infinitely wide CNNs and ResNets. Novak et al. (2019) noticed that the effect of weight-sharing disappears when infinite filters are used with isotropic priors. More recently, Garriga-Alonso & van der Wilk (2021) showed that this effect can be avoided by using spatially correlated priors, leading to improved performance. Our experiments investigate whether this prior is also useful in the finite-width case.
+
+# 4 EMPIRICAL STUDY OF BAYESIAN NEURAL NETWORK PRIORS
+
+We performed experiments on MNIST and on CIFAR-10. We compare Bayesian FCNNs, CNNs, and ResNets on these tasks. For the BNN inference, we used Stochastic Gradient Markov Chain Monte Carlo (SG-MCMC), in order to scale to large training datasets. To obtain posterior samples that are close to the true posterior, we used an inference method that builds on the inference approach used in Wenzel et al. (2020a), which has been shown to produce high-quality samples. In particular, we combined the gradient-guided Monte Carlo (GG-MC) scheme from Garriga-Alonso & Fortuin (2021) with the cyclical learning rate schedule from Zhang et al. (2019) and the preconditioning and convergence diagnostics from Wenzel et al. (2020a). We ran each chain for 60 cycles of 45 epochs each, taking one sample at the end of each of the last five epochs of each cycle, thus yielding 300 samples after 2,700 epochs, out of which we discarded the first 50 samples as a burn-in. Per temperature setting, dataset, model, and prior, we ran five such chains as replicates. Additional experimental results can be found in Appendix A, details about the evaluation metrics in Appendix B, about the priors in Appendix C, and about the implementation in Appendix D. In the figures, we generally include an SGD baseline for the predictive error, where it is often competitive with some of the priors. For the likelihood, calibration, and OOD detection, the SGD baselines were out of the plotting range and are therefore not shown. For completeness, we show them in Appendix A.4. We show results for higher temperatures $T > 1 \AA ,$ ) in Appendix A.6, for different prior variances in Appendix A.7, and for different network architectures in Appendix A.8. Moreover, while we focus on image classification tasks in this section, we provide results on UCI regression tasks in Appendix A.9. We also show inference diagnostics highlighting the accuracy of our MCMC sampling in Appendix A.10. Finally, we replicate our experiments on ResNets and CIFAR-10 for mean-field variational inference (Blundell et al., 2015) in Appendix A.11.
+
+# 4.1 PRIORS UNDER CONSIDERATION
+
+We contrast the widely used isotropic Gaussian priors with heavy-tailed distributions, including the Laplace and Student-t distributions, and with correlated Gaussian priors. We chose these distributions based on our observations of the empirical weight distributions of SGD-trained networks (see Sec. 3) and for their ease of implementation and optimization. Further details on the distributions and their density functions can be found in Appendix C.
+
+The isotropic Gaussian distribution (Gauss, 1809) is the de-facto standard for BNN priors in recent work (e.g., Hernández-Lobato & Adams, 2015; Louizos & Welling, 2017; Dusenberry et al., 2020; Wenzel et al., 2020a; Neal, 1992; Zhang et al., 2019; Osawa et al., 2019; Immer et al., 2021b; Lee et al., 2017; Garriga-Alonso et al., 2019). However, its tails are relatively light compared to some of the other distributions that we will consider and compared to the empirical weight distributions described above. The Laplace distribution (Laplace, 1774), for instance, has heavier tails than the Gaussian. It is often used in the context of (frequentist) lasso regression (Tibshirani, 1996). Similarly, the Student-t distribution is also heavy-tailed. Moreover, it can be seen as a Gaussian scale-mixture, where the scales are inverse-Gamma distributed (Helmert, 1875; Lüroth, 1876).
+
+For our correlated Bayesian CNN priors, we use multivariate Gaussian priors and define the covariance $\pmb { \Sigma }$ to be block-diagonal, such that the covariance between weights in different filters is 0 and between weights in the same filter is given by a Matérn kernel $( \nu = 1 / 2$ ) on the pixel distances. Formally, for the weights $w _ { i , j }$ and $w _ { i ^ { \prime } , j ^ { \prime } }$ in filters $i$ and $i ^ { \prime }$ and for pixels $j$ and $j ^ { \prime }$ , the covariance is
+
+$$
+\begin{array} { r } { \mathrm { c o v } ( w _ { i , j } , w _ { i ^ { \prime } , j ^ { \prime } } ) = \left\{ \begin{array} { l l } { \sigma ^ { 2 } \exp \left( \frac { - d ( j , j ^ { \prime } ) } { \lambda } \right) } & { \mathrm { i f ~ } i = i ^ { \prime } } \\ { 0 } & { \mathrm { o t h e r w i s e } } \end{array} \right. , } \end{array}
+$$
+
+where $d ( \cdot , \cdot )$ is the Euclidean distance between pixel positions and we set $\sigma = \lambda = 1$ . This kernel was chosen to capture the decay with distance of spatial correlations (Fig. 3).
+
+# 4.2 BAYESIAN FCNN PERFORMANCE WITH DIFFERENT PRIORS
+
+Following our observations from the empirical weight distributions (Sec. 3.1), we hypothesized that heavy-tailed priors should work better than Gaussian priors for Bayesian FCNNs. We tested this hypothesis by performing BNN inference with the same network architecture as in Sec. 3, using different priors. We report the predictive error and log likelihood on the MNIST test set. We follow Ovadia et al. (2019) in reporting the calibration of the uncertainty estimates on rotated MNIST digits and the out-of-distribution (OOD) detection accuracy on FashionMNIST (Xiao et al., 2017). For more details about our evaluation metrics, see Appendix B.
+
+We observe that the heavy-tailed priors indeed outperform the Gaussian prior in terms of test error and test NLL in all cases, except for the Student-t distribution on MNIST at low temperatures (Fig. 4). That said, calibration and OOD metrics are less clear, with heavy-tailed priors giving worse calibration and roughly similar OOD detection on MNIST and better calibration but worse OOD detection on FashionMNIST. Despite the unclear results on calibration and OOD detection, the error and NLL performance improvement for heavy-tailed priors at $T = 1$ is considerable, and suggests that Gaussian priors over the weights of FCNNs induce poor priors in the function space and inhibit the posterior from assigning probability mass to high-likelihood solutions, such as the SGD solutions analyzed above (Sec. 3). Finally, the cold posterior effect is removed—or even inverted—when using heavy-tailed priors, which supports the hypothesis that it is caused by prior misspecification in
+
+
+Figure 4: Performances of fully connected BNNs with different priors on MNIST and FashionMNIST (see Sec. 4.2). The heavy-tailed priors generally perform better, especially at higher temperatures, and lead to a less pronounced cold posterior effect. Note the reversed y-axis for OOD detection on the right to ensure that lower values are better in all plots. Shaded regions represent one standard error.
+
+
+Figure 5: Performances of convolutional BNNs with different priors on MNIST, FashionMNIST, and CIFAR-10 (see Sec. 4.3). The (Fashion)MNIST experiments used CNNs, while the CIFAR-10 experiments used ResNet20. The correlated prior generally performs better than the isotropic ones, but still exhibits a cold posterior effect, while the heavy-tailed priors reduce the cold posterior effect, but yield a worse performance. Note the reversed y-axis for OOD detection on the right to ensure that lower values are better in all plots. Shaded regions represent one standard error.
+
+FCNNs. Note that the cold posterior effect is typically observed in terms of performance metrics like error and NLL, and not calibration and OOD detection performance (Wenzel et al., 2020a). As such, even with Gaussian priors, we do not necessarily expect calibration and OOD detection to exhibit a cold posterior effect. Indeed, only calibration for FashionMNIST exhibits a cold posterior effect, with calibration for MNIST and all OOD detection results exhibiting an inverted cold posterior effect. Notably, we see in Appendix A.5 and Appendix A.7 that these observations generalize to different activation functions and prior variances and in Appendix A.6 that warm posteriors $( T > 1 )$ ) deteriorate the performance for all considered priors, such that for the heavy-tailed priors, $T \approx 1$ is indeed ideal.
+
+# 4.3 BAYESIAN CNN AND RESNET PERFORMANCE WITH DIFFERENT PRIORS
+
+We repeated the same experiment for Bayesian CNNs on MNIST and FashionMNIST (Fig. 5, first two rows). Given our observations about SGD-trained weights (Sec. 3.1), we might again expect heavy-tailed priors to outperform Gaussian priors. However, this is not the case: the Gaussian and correlated Gaussian priors perform better in almost all cases, with the exception of calibration for
+
+FashionMNIST. Interestingly, the performance of different methods tends to be very similar at $T = 1$ , and to diverge for lower temperatures, with performance improving for Gaussian and correlated Gaussian priors (indicating a cold posterior effect), and worsening for heavy-tailed priors, indicating no cold posterior effect.
+
+Our analysis of SGD-trained weights (Sec. 3.2) also suggested that introducing spatial correlations in the prior (Sec. 4.1) might help. We observe that introducing correlations indeed improves performance compared to the isotropic Gaussian prior (Fig. 5). Notably, the performance improvement is small for CNNs trained on MNIST and FashionMNIST, and for ResNets trained on CIFAR-10 at higher temperatures, but more considerable for ResNets at lower temperatures. As such, correlated priors actually increase the magnitude of the cold posterior effect in ResNets trained on CIFAR-10. This might be because ResNets trained at very low temperatures on CIFAR-10 have a tendency to overfit, and imposing the prior helps to mitigate this overfitting. To support this hypothesis, we indeed see that correlated priors considerably improve over all other methods in terms of calibration and OOD detection at low temperatures for ResNets trained on CIFAR-10.
+
+To reiterate a point raised in Sec. 4.2, the original cold posterior paper (Wenzel et al., 2020a) considered only predictive performance (error and likelihood), and not other measures of uncertainty such as calibration and OOD detection. Indeed, we see different effects of temperature on these measures, with calibration improving for FashionMNIST at lower temperatures, but worsening for MNIST and CIFAR-10. At the same time, we see performance at OOD detection worsen at lower temperatures in the smaller CNN model trained on MNIST and FashionMNIST, but increase at lower temperatures in the ResNet trained on CIFAR-10. These results are consistent with other observations that measures of uncertainty do not necessarily correlate with predictive performance (Ovadia et al., 2019; Izmailov et al., 2021), and indicate that the cold posterior effect is a complex phenomenon that demands careful future investigation. Again, we see in Appendix A.5 and Appendix A.7 that these observations generalize to different activation functions and prior variances and in Appendix A.6 that warm posteriors $( T > 1$ ) deteriorate the performance for all considered priors.
+
+In practice, models on this dataset are often trained using data augmentation (as is our model in Fig. 5). While this does indeed improve the performance (Fig. A.11 in the appendix), it also strengthens the cold posterior effect. When we do not use data augmentation, the cold posterior effect (at least between $T = 1$ and lower temperatures) is almost entirely eliminated (see Fig. A.11 in the appendix and Wenzel et al., 2020a; Izmailov et al., 2021). This observation raises the question of why data augmentation drives the cold posterior effect. Given that data augmentation adds terms to the likelihood while leaving the prior unchanged, we could expect that the problem is in the likelihood, as was recently argued by Aitchison (2020b). On the other hand, van der Wilk et al. (2018) argued that treating synthetic augmented data as extra datapoints for the purposes of the likelihood is incorrect from a Bayesian point of view. Instead, they express data augmentation in the prior, by constraining the classification functions to be invariant to certain transformations. More investigation is hence needed into how data augmentation and the cold posterior effect relate.
+
+# 5 RELATED WORK
+
+Empirical analysis of weight distributions. There is some history in neuroscience of analysing the statistics of data to inform inductive priors for learning algorithms, especially when it comes to vision (Simoncelli, 2009). For instance, it has been noted that correlations help in modeling natural images (Srivastava et al., 2003), as well as sparsity in the parameters (Smyth et al., 2003; Sahani & Linden, 2003). In the context of machine learning, the empirical weight distributions of standard neural networks have also been studied before (Bellido & Fiesler, 1993; Go & Lee, 1999), including the insight that SGD can produce heavy-tailed weights (Gurbuzbalaban & Simsekli, 2020), but these works have not systematically compared different architectures and did not use their insights to inform Bayesian prior choices.
+
+BNNs in practice. Since the inception of Bayesian neural networks, scholars have thought about choosing good priors for them, including hierarchical (MacKay, 1992) and heavy-tailed ones (Neal, 1996). In the context of infinite-width limits of such networks (Lee et al., 2017; Matthews et al., 2018; Garriga-Alonso et al., 2019; Yang, 2019; Tsuchida et al., 2019) it has also been shown that networks with very heavy-tailed (i.e., infinite variance) priors have different properties from finite-variance priors (Neal, 1996; Peluchetti et al., 2020). However, most modern applications of BNNs still relied on simple Gaussian priors. Although a few different priors have been proposed for BNNs, these were mostly designed for specific tasks (Atanov et al., 2018; Ghosh & Doshi-Velez, 2017; Overweg et al., 2019; Nalisnick, 2018; Cui et al., 2020; Hafner et al., 2020) or relied heavily on non-standard inference methods (Sun et al., 2019; Ma et al., 2019; Karaletsos & Bui, 2020; Pearce et al., 2020). Moreover, while many interesting distributions have been proposed as variational posteriors for BNNs (Louizos & Welling, 2017; Swiatkowski et al., 2020; Dusenberry et al., 2020; Ober & Aitchison, 2020; Aitchison et al., 2020), these approaches have still used Gaussian priors. Others use a nonGaussian prior, but approximate the posterior with a diagonal Gaussian (Blundell et al., 2015; Ghosh & Doshi-Velez, 2017; Nalisnick et al., 2015), somewhat limiting the prior’s effect. Another BNN posterior approximation is dropout (Gal & Ghahramani, 2016; Kingma et al., 2015), which is often poorly calibrated (Foong et al., 2019), but can also be seen to induce a scale-mixture prior, similar to our heavy-tailed priors (Molchanov et al., 2017).
+
+BNN priors. Finally, previous work has investigated the performance of neural network priors chosen without reference to the empirical distributions of SGD-trained networks (Blundell et al., 2015; Ghosh & Doshi-Velez, 2017; Wu et al., 2018; Atanov et al., 2018; Nalisnick, 2018; Overweg et al., 2019; Farquhar et al., 2019; Cui et al., 2020; Rothfuss et al., 2020; Hafner et al., 2020; Matsubara et al., 2020; Tran et al., 2020; Ober & Aitchison, 2020; Garriga-Alonso & van der Wilk, 2021; Fortuin, 2021; Immer et al., 2021a). While these priors might in certain circumstances offer performance improvements, they did not offer a recipe for finding potentially valuable features to incorporate into the weight priors. In contrast, we offer such a recipe by examining the distribution of weights trained under a uniform prior with SGD. Importantly, unlike prior work, we use SG-MCMC with carefully evaluated convergence metrics and systematically address the cold posterior effect.
+
+Contemporaneous work2 (Izmailov et al., 2021) compared gold-standard HMC inference with the more practical cyclical SG-MCMC used in our work. They confirmed that cyclical SG-MCMC methods indeed have high-fidelity to the true posterior, and interestingly show that heavy-tailed priors offer slight performance improvements for language modeling tasks (though they do not assess the interaction of the cold posterior effect with these priors).
+
+# 6 CONCLUSION
+
+We consider empirical weight distributions in non-Bayesian networks trained using SGD, finding that FCNNs displayed heavy-tailed weight distributions, and CNNs and ResNets displayed spatial correlations in the convolutional filters. We therefore tested the performance of these priors and their interaction with the cold posterior effect. Indeed, we found that these priors improved performance, but their impact on the cold posterior effect was more complex, with heavy-tailed priors in FCNNs eliminating the cold posterior effect, correlated priors in CNNs trained on MNIST and FashionMNIST leaving the cold posterior largely unchanged, and correlated priors in ResNets trained on CIFAR-10 actually increasing the cold posterior effect, as they yield much larger performance improvements at lower temperatures. Importantly though, we do not expect there to be one “universal” prior that improves performance in all architectures and all tasks. The best prior is almost certain to be highly task- and architecture-dependent, and indeed we found that heavy-tailed priors offer little or no benefits for regression on UCI datasets (Sec. A.9).
+
+Thus, we can conclude that isotropic Gaussian priors are often non-optimal, and that it is worth exploring other priors more generally (as always though, the correct prior will heavily depend on the architecture and dataset). However, it is difficult to come to any strong conclusions regarding the origin of the cold posterior effect. At least in FCNNs, it does indeed appear that a misspecified prior can cause the cold posterior effect. However, in perhaps more relevant large-scale image models, we found that better (correlated) priors actually increase the cold posterior effect, which is consistent with other hypotheses, such as a misspecified likelihood (Aitchison, 2020b), though of course we cannot rule out that there is a better prior that eliminates the cold posterior effect that we did not consider. We hope that our PyTorch library for BNN inference with different priors will catalyze future research efforts in this area and will also be useful on real-world tasks.
+
+# ACKNOWLEDGMENTS
+
+VF was supported by a PhD fellowship from the Swiss Data Science Center. AGA was supported by a UK Engineering and Physical Sciences Research Council studentship [1950008]. We thank Alexander Immer, Andrew Foong, David Burt, Seth Nabarro, and Kevin Roth for helpful discussions and the anonymous reviewers for valuable feedback. We also thank Edwin Thompson Jaynes for constant inspiration.
+
+# REFERENCES
+
+Laurence Aitchison. Why bigger is not always better: on finite and infinite neural networks. In International Conference on Machine Learning, pp. 156–164. PMLR, 2020a.
+
+Laurence Aitchison. A statistical theory of cold posteriors in deep neural networks. arXiv preprint arXiv:2008.05912, 2020b.
+
+Laurence Aitchison, Adam X Yang, and Sebastian W Ober. Deep kernel processes. arXiv preprint arXiv:2010.01590, 2020.
+
+Andrei Atanov, Arsenii Ashukha, Kirill Struminsky, Dmitry Vetrov, and Max Welling. The deep weight prior. arXiv preprint arXiv:1810.06943, 2018.
+
+Thomas Bayes. An essay towards solving a problem in the doctrine of chances. Philosophical transactions of the Royal Society of London, 53:370–418, 1763. By the late Rev. Mr. Bayes, FRS communicated by Mr. Price, in a letter to John Canton, AMFRS.
+
+I Bellido and Emile Fiesler. Do backpropagation trained neural networks have normal weight distributions? In International Conference on Artificial Neural Networks, pp. 772–775. Springer, 1993.
+
+Patrick Billingsley. The Lindeberg-Lévy theorem for martingales. Proceedings of the American Mathematical Society, 12(5):788–792, 1961.
+
+Christopher M Bishop. Pattern recognition and machine learning. Springer, 2006.
+
+Christopher M Bishop et al. Neural networks for pattern recognition. Oxford university press, 1995.
+
+Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural network. In Proceedings of the 32nd International Conference on Machine Learning, 2015.
+
+Luis Pedro Coelho. Jug: Software for parallel reproducible computation in Python. Journal of Open Research Software., 5:30, 2017. doi: 10.5334/jors.161.
+
+Tianyu Cui, A. Havulinna, P. Marttinen, and S. Kaski. Informative Gaussian scale mixture priors for Bayesian neural networks. arXiv preprint arXiv:2002.10243, 2020.
+
+Michael W Dusenberry, Ghassen Jerfel, Yeming Wen, Yi-an Ma, Jasper Snoek, Katherine Heller, Balaji Lakshminarayanan, and Dustin Tran. Efficient and scalable Bayesian neural nets with rank-1 factors. arXiv preprint arXiv:2005.07186, 2020.
+
+Gintare Karolina Dziugaite, Kyle Hsu, Waseem Gharbieh, Gabriel Arpino, and Daniel Roy. On the role of data in PAC-Bayes. In International Conference on Artificial Intelligence and Statistics, pp. 604–612. PMLR, 2021.
+
+Sebastian Farquhar, Michael Osborne, and Yarin Gal. Radial Bayesian neural networks: Robust variational inference in big models. arXiv preprint arXiv:1907.00865, 2019.
+
+Andrew YK Foong, David R Burt, Yingzhen Li, and Richard E Turner. On the expressiveness of approximate inference in Bayesian neural networks. arXiv preprint arXiv:1909.00719, 2019.
+
+Vincent Fortuin. Priors in Bayesian deep learning: A review. arXiv preprint arXiv:2105.06868, 2021.
+
+Yarin Gal and Zoubin Ghahramani. Dropout as a Bayesian approximation: Representing model uncertainty in deep learning. In International Conference on Machine Learning, pp. 1050–1059. PMLR, 2016.
+
+Adrià Garriga-Alonso and Vincent Fortuin. Exact Langevin dynamics with stochastic gradients. arXiv preprint arXiv:2102.01691, 2021.
+
+Adrià Garriga-Alonso and Mark van der Wilk. Correlated weights in infinite limits of deep convolutional neural networks. arXiv preprint arXiv:2101.04097, 2021.
+
+Adrià Garriga-Alonso, Carl Edward Rasmussen, and Laurence Aitchison. Deep convolutional networks as shallow Gaussian processes. In 7th International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $=$ Bklfsi0cKm.
+
+Carl Friedrich Gauss. Theoria motvs corporvm coelestivm in sectionibvs conicis solem ambientivm. Sumtibus F. Perthes et IH Besser, 1809.
+
+Andrew Gelman, John B Carlin, Hal S Stern, David B Dunson, Aki Vehtari, and Donald B Rubin. Bayesian data analysis. CRC press, 2013.
+
+Pascal Germain, Francis Bach, Alexandre Lacoste, and Simon Lacoste-Julien. PAC-Bayesian theory meets Bayesian inference. arXiv preprint arXiv:1605.08636, 2016.
+
+Soumya Ghosh and Finale Doshi-Velez. Model selection in Bayesian neural networks via horseshoe priors. arXiv preprint arXiv:1705.10388, 2017.
+
+Tilmann Gneiting and Adrian E Raftery. Strictly proper scoring rules, prediction, and estimation. Journal of the American Statistical Association, 102(477):359–378, 2007.
+
+Jinwook Go and Chulhee Lee. Analyzing weight distribution of neural networks. In IJCNN’99. International Joint Conference on Neural Networks. Proceedings (Cat. No. 99CH36339), volume 2, pp. 1154–1157. IEEE, 1999.
+
+Alex Graves. Practical variational inference for neural networks. In J. Shawe-Taylor, R. Zemel, P. Bartlett, F. Pereira, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems, volume 24. Curran Associates, Inc., 2011. URL https://proceedings.neurips. cc/paper/2011/file/7eb3c8be3d411e8ebfab08eba5f49632-Paper.pdf.
+
+Klaus Greff, Aaron Klein, Martin Chovanec, Frank Hutter, and Jürgen Schmidhuber. The Sacred Infrastructure for Computational Research. In Katy Huff, David Lippa, Dillon Niederhut, and M Pacer (eds.), Proceedings of the 16th Python in Science Conference, pp. 49 – 56, 2017. doi: 10.25080/shinma-7f4c6e7-008.
+
+Mert Gurbuzbalaban and Lingjiong Simsekli, Umut an Zhu. The heavy-tail phenomenon in SGD. arXiv preprint arXiv:2006.04740, 2020.
+
+Danijar Hafner, Dustin Tran, Timothy Lillicrap, Alex Irpan, and James Davidson. Noise contrastive priors for functional uncertainty. In Uncertainty in Artificial Intelligence, pp. 905–914. PMLR, 2020.
+
+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.
+
+Jonathan Heek and Nal Kalchbrenner. Bayesian inference for large scale image classification. arXiv preprint arXiv:1908.03491, 2019.
+
+Friedrich Robert Helmert. Über die Berechnung des wahrscheinlichen Fehlers aus einer endlichen Anzahl wahrer Beobachtungsfehler. Z. Math. U. Physik, 20(1875):300–303, 1875.
+
+José Miguel Hernández-Lobato and Ryan Adams. Probabilistic backpropagation for scalable learning of Bayesian neural networks. In International Conference on Machine Learning, pp. 1861–1869. PMLR, 2015.
+
+Alexander Immer, Matthias Bauer, Vincent Fortuin, Gunnar Rätsch, and Mohammad Emtiyaz Khan. Scalable marginal likelihood estimation for model selection in deep learning. arXiv preprint arXiv:2104.04975, 2021a.
+
+Alexander Immer, Maciej Korzepa, and Matthias Bauer. Improving predictions of Bayesian neural nets via local linearization. In International Conference on Artificial Intelligence and Statistics, pp. 703–711. PMLR, 2021b.
+
+Pavel Izmailov, Wesley J Maddox, Polina Kirichenko, Timur Garipov, Dmitry Vetrov, and Andrew Gordon Wilson. Subspace inference for Bayesian deep learning. In Uncertainty in Artificial Intelligence, pp. 1169–1179. PMLR, 2020.
+
+Pavel Izmailov, Sharad Vikram, Matthew D Hoffman, and Andrew Gordon Wilson. What are Bayesian neural network posteriors really like? arXiv preprint arXiv:2104.14421, 2021.
+
+Theofanis Karaletsos and Thang D Bui. Hierarchical Gaussian process priors for Bayesian neural network weights. arXiv preprint arXiv:2002.04033, 2020.
+
+Alex Kendall and Yarin Gal. What uncertainties do we need in Bayesian deep learning for computer vision? In Advances in neural information processing systems, pp. 5574–5584, 2017.
+
+Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
+
+Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. In International Conference on Learning Representations, ICLR, 2014.
+
+Diederik P Kingma, Tim Salimans, and Max Welling. Variational dropout and the local reparameterization trick. In Proceedings of the 28th International Conference on Neural Information Processing Systems-Volume 2, pp. 2575–2583, 2015.
+
+Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
+
+Ravin Kumar, Colin Carroll, Ari Hartikainen, and Osvaldo Martin. ArviZ a unified library for exploratory analysis of Bayesian models in Python. Journal of Open Source Software, 4(33):1143, 2019. doi: 10.21105/joss.01143. URL https://doi.org/10.21105/joss.01143.
+
+Pierre Simon Laplace. Mémoire sur la probabilité de causes par les évenements. Memoire de l’Academie Royale des Sciences, 1774.
+
+Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
+
+Jaehoon Lee, Yasaman Bahri, Roman Novak, Samuel S Schoenholz, Jeffrey Pennington, and Jascha Sohl-Dickstein. Deep neural networks as Gaussian processes. arXiv preprint arXiv:1711.00165, 2017.
+
+Benedict Leimkuhler and Charles Matthews. Rational Construction of Stochastic Numerical Methods for Molecular Sampling. Applied Mathematics Research eXpress, 2013(1):34–56, 06 2012. ISSN 1687-1200. doi: 10.1093/amrx/abs010.
+
+Christos Louizos and Max Welling. Multiplicative normalizing flows for variational Bayesian neural networks. arXiv preprint arXiv:1703.01961, 2017.
+
+J Lüroth. Vergleichung von zwei Werthen des wahrscheinlichen Fehlers. Astronomische Nachrichten, 87:209, 1876.
+
+Chao Ma, Yingzhen Li, and José Miguel Hernández-Lobato. Variational implicit processes. In International Conference on Machine Learning, pp. 4222–4233, 2019.
+
+David J.C. MacKay. A practical Bayesian framework for backpropagation networks. Neural computation, 4(3):448–472, 1992.
+
+Takuo Matsubara, Chris J Oates, and François-Xavier Briol. The ridgelet prior: A covariance function approach to prior specification for Bayesian neural networks. arXiv preprint arXiv:2010.08488, 2020.
+
+Alexander G de G Matthews, Mark Rowland, Jiri Hron, Richard E Turner, and Zoubin Ghahramani. Gaussian process behaviour in wide deep neural networks. arXiv preprint arXiv:1804.11271, 2018.
+
+Dmitry Molchanov, Arsenii Ashukha, and Dmitry Vetrov. Variational dropout sparsifies deep neural networks. In International Conference on Machine Learning, pp. 2498–2507. PMLR, 2017.
+
+Mahdi Pakdaman Naeini, Gregory F Cooper, and Milos Hauskrecht. Obtaining well calibrated probabilities using Bayesian binning. In Proceedings of the... AAAI Conference on Artificial Intelligence. AAAI Conference on Artificial Intelligence, volume 2015, pp. 2901. NIH Public Access, 2015.
+
+Eric T Nalisnick. On priors for Bayesian neural networks. PhD thesis, UC Irvine, 2018.
+
+Eric T Nalisnick, Anima Anandkumar, and Padhraic Smyth. A scale mixture perspective of multiplicative noise in neural networks. arXiv preprint arXiv:1506.03208, 2015.
+
+Radford M. Neal. Bayesian training of backpropagation networks by the Hybrid Monte Carlo method. Technical report, University of Toronto, 1992.
+
+Radford M. Neal. Bayesian learning for neural networks, volume 118. Springer, 1996.
+
+Roman Novak, Lechao Xiao, Yasaman Bahri, Jaehoon Lee, Greg Yang, Daniel A. Abolafia, Jeffrey Pennington, and Jascha Sohl-dickstein. Bayesian deep convolutional networks with many channels are Gaussian processes. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $_ { \cdot } =$ B1g30j0qF7.
+
+Sebastian W Ober and Laurence Aitchison. Global inducing point variational posteriors for Bayesian neural networks and deep Gaussian processes. arXiv preprint arXiv:2005.08140, 2020.
+
+Sebastian W Ober, Carl E Rasmussen, and Mark van der Wilk. The promises and pitfalls of deep kernel learning. arXiv preprint arXiv:2102.12108, 2021.
+
+Bruno A Olshausen and David J Field. Sparse coding with an overcomplete basis set: A strategy employed by v1? Vision research, 37(23):3311–3325, 1997.
+
+Kazuki Osawa, Siddharth Swaroop, Mohammad Emtiyaz E Khan, Anirudh Jain, Runa Eschenhagen, Richard E Turner, and Rio Yokota. Practical deep learning with Bayesian principles. In Advances in neural information processing systems, pp. 4287–4299, 2019.
+
+Yaniv Ovadia, Emily Fertig, Jie Ren, Zachary Nado, David Sculley, Sebastian Nowozin, Joshua Dillon, Balaji Lakshminarayanan, and Jasper Snoek. Can you trust your model’s uncertainty? Evaluating predictive uncertainty under dataset shift. In Advances in Neural Information Processing Systems, pp. 13991–14002, 2019.
+
+Hiske Overweg, Anna-Lena Popkes, Ari Ercole, Yingzhen Li, José Miguel Hernández-Lobato, Yordan Zaykov, and Cheng Zhang. Interpretable outcome prediction with sparse Bayesian neural networks in intensive care. arXiv preprint arXiv:1905.02599, 2019.
+
+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, pp. 8024–8035. 2019.
+
+Tim Pearce, Russell Tsuchida, Mohamed Zaki, Alexandra Brintrup, and Andy Neely. Expressive priors in Bayesian neural networks: Kernel combinations and periodic functions. In Uncertainty in Artificial Intelligence, pp. 134–144. PMLR, 2020.
+
+Stefano Peluchetti, Stefano Favaro, and Sandra Fortini. Stable behaviour of infinitely wide deep neural networks. In International Conference on Artificial Intelligence and Statistics, pp. 1137–1146. PMLR, 2020.
+
+Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In International Conference on Machine Learning, 2014.
+
+Omar Rivasplata, Ilja Kuzborskij, Csaba Szepesvári, and John Shawe-Taylor. PAC-Bayes analysis beyond the usual bounds. arXiv preprint arXiv:2006.13057, 2020.
+
+Herbert E Robbins. An empirical Bayes approach to statistics. In Breakthroughs in statistics, pp. 388–394. Springer, 1992.
+
+Jonas Rothfuss, Vincent Fortuin, and Andreas Krause. PACOH: Bayes-optimal meta-learning with PAC-guarantees. arXiv preprint arXiv:2002.05551, 2020.
+
+Maneesh Sahani and Jennifer F Linden. Evidence optimization techniques for estimating stimulusresponse functions. Advances in neural information processing systems, pp. 317–324, 2003.
+
+Eero P Simoncelli. Capturing visual image properties with probabilistic models. In The Essential Guide to Image Processing, pp. 205–223. Elsevier, 2009.
+
+Darragh Smyth, Ben Willmore, Gary E Baker, Ian D Thompson, and David J Tolhurst. The receptivefield organization of simple cells in primary visual cortex of ferrets under natural scene stimulation. Journal of Neuroscience, 23(11):4746–4759, 2003.
+
+Anuj Srivastava, Ann B Lee, Eero P Simoncelli, and S-C Zhu. On advances in statistical modeling of natural images. Journal of mathematical imaging and vision, 18(1):17–33, 2003.
+
+Student. The probable error of a mean. Biometrika, pp. 1–25, 1908.
+
+Shengyang Sun, Guodong Zhang, Jiaxin Shi, and Roger Grosse. Functional variational Bayesian neural networks. arXiv preprint arXiv:1903.05779, 2019.
+
+Héctor J Sussmann. Uniqueness of the weights for minimal feedforward nets with a given input-output map. Neural networks, 5(4):589–593, 1992.
+
+Jakub Swiatkowski, Kevin Roth, Bastiaan S Veeling, Linh Tran, Joshua V Dillon, Stephan Mandt, Jasper Snoek, Tim Salimans, Rodolphe Jenatton, and Sebastian Nowozin. The k-tied normal distribution: A compact parameterization of Gaussian mean field posteriors in Bayesian neural networks. arXiv preprint arXiv:2002.02655, 2020.
+
+Robert Tibshirani. Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society: Series B (Methodological), 58(1):267–288, 1996.
+
+Ba-Hien Tran, Simone Rossi, Dimitrios Milios, and Maurizio Filippone. All you need is a good functional prior for Bayesian deep learning. arXiv preprint arXiv:2011.12829, 2020.
+
+Brian Trippe and Richard Turner. Overpruning in variational Bayesian neural networks. arXiv preprint arXiv:1801.06230, 2018.
+
+Russell Tsuchida, Fred Roosta, and Marcus Gallagher. Richer priors for infinitely wide multi-layer perceptrons. arXiv preprint arXiv:1911.12927, 2019.
+
+Mark van der Wilk, Matthias Bauer, ST John, and James Hensman. Learning invariances using the marginal likelihood. In Advances in Neural Information Processing Systems, volume 31, pp. 9938–9948, 2018. URL https://proceedings.neurips.cc/paper/2018/file/ d465f14a648b3d0a1faa6f447e526c60-Paper.pdf.
+
+Aki Vehtari, Andrew Gelman, Daniel Simpson, Bob Carpenter, and Paul-Christian Bürkner. Ranknormalization, folding, and localization: an improved $\widehat { R }$ for assessing convergence of MCMC. Bayesian analysis, 1(1):1–28, 2021.
+
+Martin J Wainwright, Michael I Jordan, et al. Graphical models, exponential families, and variational inference. Foundations and Trends $\textsuperscript { \textregistered }$ in Machine Learning, 2008.
+
+Florian Wenzel, Kevin Roth, Bastiaan S Veeling, Jakub Swi atkowski, Linh Tran, Stephan Mandt, ´ Jasper Snoek, Tim Salimans, Rodolphe Jenatton, and Sebastian Nowozin. How good is the Bayes posterior in deep neural networks really? In International Conference on Machine Learning, 2020a.
+
+Florian Wenzel, Jasper Snoek, Dustin Tran, and Rodolphe Jenatton. Hyperparameter ensembles for robustness and uncertainty quantification. In Advances in Neural Information Processing Systems, 2020b.
+
+Anqi Wu, Sebastian Nowozin, Edward Meeds, Richard E Turner, José Miguel Hernández-Lobato, and Alexander L Gaunt. Deterministic variational inference for robust Bayesian neural networks. arXiv preprint arXiv:1810.03958, 2018.
+
+Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-MNIST: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017.
+
+Greg Yang. Wide feedforward or recurrent neural networks of any architecture are Gaussian processes. In Advances in Neural Information Processing Systems, pp. 9951–9960, 2019.
+
+Wenzhao Yang, Chunyu Chen, and Robert J Tempelman. Improving the computational efficiency of fully Bayes inference and assessing the effect of misspecification of hyperparameters in wholegenome prediction models. Genetics Selection Evolution, 47(1):1–14, 2015.
+
+Ruqi Zhang, Chunyuan Li, Jianyi Zhang, Changyou Chen, and Andrew Gordon Wilson. Cyclical stochastic gradient MCMC for Bayesian deep learning. arXiv preprint arXiv:1902.03932, 2019.
+
+# A ADDITIONAL EXPERIMENTAL RESULTS
+
+A.1 COVARIANCE MATRICES OF FCNN, CNN AND RESNET
+
+Here we report the full covariance matrices for the layers that were analyzed above (Sec. 3.2). We display the covariances for the FCNN for layer 1 (Fig. A.1), layer 2 (Fig. A.2) and layer 3 (Fig. A.3). The only discernable structure is in the first layer, presumably because the weights from neighboring pixels will be correlated. The other plots are less smooth than an empirical covariance matrix from an isotropic Gaussian (left image of every pair), but tend to have no discernible structure.
+
+Next, we give the covariances of CNN weights in layer 1 (Fig. A.4) and layer 2 (Fig. A.5). We have omitted layer 3 of the CNN because it is just a fully connected layer and also showed no interesting structure.
+
+Finally, Fig. A.6 (left) measures the amount of covariance of every layer in the ResNet. We fit the lengthscale of a Gaussian distribution with squared exponential kernel, on the spatial correlations of the convolutional filters. The right-hand figure is the same as Fig. 2a.
+
+# A.2 EMPIRICAL OFF-DIAGONAL COVARIANCES
+
+We report results for the distributions of off-diagonal covariances for the respective second layers of our FCNN and CNN in Figure A.7. The empirical distribution of off-diagonal elements in the covariance matrices is shown as a histogram, overlayed with a kernel density estimate of the expected distribution if the weights were samples from an isotropic Gaussian. We see that the empirical covariance distributions are generally more heavy-tailed than the ideal ones, that is, the empirical weights generally have larger covariances than would be expected from isotropic Gaussian weights. Note that, as observed above, the strongest covariances by far are found spatially in the CNN weights, that is, between weights within the same CNN filter. We report the same results for the other layers in the following. The FCNN results are shown in Figures A.8 and A.9 and the CNN results in Figure A.10.
+
+# A.3 THE INFLUENCE OF DATA AUGMENTATION ON THE COLD POSTERIOR EFFECT
+
+When running the CIFAR-10 experiments with Bayesian ResNets with and without data augmentation, we find that data augmentation seems to significantly increase the cold posterior effect (Fig. A.11). Moreover, data augmentation seems to increase the performance of the models a lot at colder temperatures, but not at the true Bayes posterior $T = 1$ . This suggests that data augmentation can also be one of the reasons for the cold posterior effect, as already hypothesized by Wenzel et al. (2020a) and Aitchison (2020b).
+
+# A.4 SGD BASELINES
+
+In terms of likelihood, calibration, and OOD detection, almost all our BNN models consistently outperformed the SGD baselines. The results including SGD are shown for FCNNs in Figure A.12, for CNNs in Figure A.13, and for ResNets in Figure A.14.
+
+# A.5 ALTERNATIVE ACTIVATION FUNCTIONS
+
+We repeated the experiments on MNIST with Bayesian FCNNs and CNNs and replaced the ReLU activation functions from Figure 4 and Figure 5 with sigmoid (see Fig. A.15) and tanh (see Fig. A.16) activations respectively. We observe that while the performances are overall worse than with ReLU activations (as is generally expected), the effects of the different priors are qualitatively very similar.
+
+# A.6 HIGHER TEMPERATURES
+
+In the main body of the paper, we followed Wenzel et al. (2020a) in showing only posteriors with temperatures $T \leq 1$ , because we were interested in studying cold posteriors. Here, we also show results for warm posteriors, that is, $T > 1$ . We see in Figure A.17 and Figure A.18 that these
+
+
+Figure A.1: FCNN layer 1 empirical covariances of the weights, trained with SGD on MNIST. We can see correlations in the spatial direction in the weights of the input layer (left). In the other directions, the covariance matrix is less smooth than we would expect from an isotropic Gaussian draw of the same size (left matrix of every pair), but otherwise has no discernible structure. This suggests that the weights are not isotropic Gaussian.
+
+
+Figure A.2: FCNN layer 2 empirical covariances of the weights, trained with SGD on MNIST. The covariance matrix is less smooth than we would expect from an isotropic Gaussian draw, but has no discernible structure.
+
+
+Figure A.3: FCNN layer 3 empirical covariances of the weights, trained with SGD on MNIST. The covariance matrix is less smooth than we would expect from an isotropic Gaussian draw, but has no discernible structure.
+
+
+Figure A.4: CNN layer 1 empirical covariance of the weights, trained with SGD on MNIST. The input (also spatial) direction has correlations, also shown in Figure 2b. The output direction has no discernible structure.
+
+
+Figure A.5: CNN layer 2 empirical covariance of the weights, trained with SGD on MNIST. The input direction is less smooth than the isotropic Gaussian, and some low-rank structures can be observed. It should display the spatial correlation of Figure 2b. The output direction has no discernible structure.
+
+warm posteriors generally do not improve the performance and that hence some of the priors (e.g., heavy-tailed priors in FCNNs) do indeed achieve their optimal performance for $T \approx 1$ .
+
+# A.7 DIFFERENT PRIOR VARIANCES
+
+In the main text, we use models where the prior variance is chosen according to the He initialization (He et al., 2016), which is motivated by the conservation of the activation norm across the depth of the networks. Here, we see in Figures A.19, A.20, A.21, A.22, and A.23 that our main observations regarding the ordering of the different priors and the cold posterior effect still hold, even for different prior variances (in this case, four times larger and smaller than the He variance).
+
+# A.8 DIFFERENT FCNN ARCHITECTURES
+
+In the main text, we use FCNN models with three layers. Here, we see in Figure A.24 that our main observations regarding the ordering of the different priors and the cold posterior effect still hold, even for different architectures (in this case, between 2 and 4 layers).
+
+# A.9 UCI REGRESSION
+
+While the experiments in the main paper focus on image classification, we also performed BNN experiments on UCI regression tasks. The architecture is a 3-layer FCNN, the hidden layers are 64 units wide. We run GGMC for 30,000 epochs without minibatching on “boston”, “energy”, “yacht”, and “wine”, discarding runs where the potential diverges. For the other datasets, which are larger, we run 3000 epochs, also without minibatching. The learning rate is a flat $5 \cdot 1 0 ^ { - 5 }$ , and we do not use a cosine schedule.
+
+Even with full batch MCMC, it is clear that the dynamics for regression networks are much less stable, especially at lower temperatures (which have a “sharper” potential landscape). Figure A.25 shows that $T = 1$ is best for all datasets, in terms of the median mean squared error (MSE) as well as the quantiles and outliers. The priors are generally reasonably close in performance, such that it is harder in this case to strongly prescribe a certain prior choice. Of course, it is absolutely expect that different priors will be appropriate for different problems, especially when those problems are quite so distinct as regression and image classification.
+
+
+Figure A.6: Left: fitted lengthscale of a multivariate Gaussian with a squared exponential kernel (see eq. 4) to the data of Figure 3. All the entries of the SE covariance are positive, so this cannot capture all the features of the data, which has negative empirical covariance. Right: fitted degrees of freedom of a multivariate t-distribution, to same data. The empirical covariance was used in this case. The fitting criterion is the log-likelihood of the data. This is the same plot as Figure 2a.
+
+
+Figure A.7: Distributions of off-diagonal elements in the empirical covariances of the layer 2 weights of FCNNs and CNNs trained with SGD on MNIST. The empirical distributions are plotted as histograms, while the idealized random Gaussian weights are overlaid in orange. We see that the covariances of the empirical weights are more heavy-tailed than for the Gaussian weights.
+
+
+Figure A.8: Distributions of off-diagonal elements in the empirical covariances of the weights of the FCNN in layers 1 and 3. The empirical distributions are plotted as histograms, while the idealized random Gaussian weights are overlaid in orange. We see that the covariances of the empirical weights are more heavy-tailed than for the Gaussian weights.
+
+
+Figure A.9: Distributions of singular values of the weight matrices of the FCNN in layers 1 and 3. We see that the spectra of the empirical weights decay faster than the ones of the Gaussian weights.
+
+The split- $\widehat { R }$ diagnostics are considerably higher for regression (Table A.1) than for the classification setting (Sec. A.10.2, for which the diagnostics look very good). Thus, the results here should be taken with a grain of salt. They are representative of how GGMC-trained BNNs behave at each of these temperatures and priors, but the results may be different for other (more accurate) ways of approximating the posterior. However, one thing is clear: UCI regression datasets exhibit no cold posterior effect, and for lower temperatures, the GGMC chains are less stable.
+
+Table A.1: Diagnostics and median performance at temperature $T = 1$ for every prior and UCI dataset. The split- $\widehat { R }$ is generally high, which shows the chain has not fully explored the posterior. The best prior (in terms of median mean squared error, MSE) for each dataset is bolded, no prior is better overall. Additionally, each prior’s performance is very similar for each dataset, which implies that the choice of prior does not matter much here (at least among these three).
+
+
split-R diagnostic
Median MSE
laplace
gaussian
student-t
laplace
gaussian
student-t
boston
1.984856
1.664200
2.164047
0.051899
0.061199
0.056180
concrete
1.923906
1.960722
1.654736
0.962948
0.802203
0.728850
energy
2.026471
1.939554
2.309070
0.000759
0.000705
0.001500
kin8nm
1.523657
1.795404
1.609185
0.976947
1.520133
0.958203
naval
1.506857
1.700794
1.583324
1.241157
1.146679
1.679176
power
1.666368
1.738743
2.471113
0.156302
0.286625
0.148974
protein
1.574833
2.037037
1.510434
1.151049
1.296588
1.259395
wine
2.133220
1.936430
1.844044
0.674713
0.617795
0.604185
yacht
2.034536
1.880282
2.414279
0.000612
0.000559
0.000599
+
+# A.10 INFERENCE DIAGNOSTICS
+
+One of the main goals of our work is to make statements about the true BNN posteriors that are as accurate as possible. To this end, we closely monitored the accuracy of our inference algorithm. In order to check the correctness of our SG-MCMC inference, we estimated the temperature of the sampler using the two diagnostics from Wenzel et al. (2020a), namely the kinetic temperature and the configurational temperature.
+
+The kinetic temperature is derived from the sampler’s momentum $\ b { m } \in \mathbb { R } ^ { d }$ . The inner product $\scriptstyle { \frac { 1 } { d } } m ^ { \mathsf { T } } M ^ { - 1 } m$ , for the (in this case diagonal) mass matrix $M$ , is an estimate of the scaled variance of the momenta. If the sampler is correct it should, in expectation, be equal to the desired temperature. The configurational temperature is slightly more involved and is discussed in Appendix A.10.1.
+
+As an example, we show the estimated kinetic temperatures for our ResNet experiment on CIFAR-10 in Figure A.26. The desired temperature is shown as a dotted horizontal line. The kinetic temperatures for the other experiments look qualitatively similar and are shown in Appendix A.10.1. We see that the kinetic temperatures generally agree well with the true temperatures, so the sampler works as expected there. In contrast, the configurational temperature estimates can be somewhat larger than $T$ , especially when $T$ is small (see Appendix A.10.1). This suggests that there could be small inference inaccuracies at low temperatures. However, these inaccuracies are small, and the configurational temperature certainly decreases as $T$ decreases, so there should be no impact on the overall trends.
+
+We also computed the rank-normalized split- $\widehat { R }$ diagnostic Vehtari et al. (2021), which measures how well a collection of independent Markov chains have mixed. The split- $\widehat { R }$ is related to the ratio of between-chain and within-chain variances, and should be as close to 1 as possible. Given the complexity of neural network weight posteriors, we report the $\widehat { R }$ for the quantities we are interested in estimating (the y-values in Figs. 4 and 5). For every considered model and function, Table A.2 contains the worst (highest) $\widehat { R }$ estimate we obtained across all priors. Appendix A.10.2 contains a more detailed explanation and empirical $\widehat { R }$ estimates for different priors.
+
+We can see that, for most experiments, the chains have mixed sufficiently. Only for the larger models (CIFAR10 ResNets)—and, to a lesser extent, Student-t FCNNs—the chains have mixed less well. Interestingly, for all convolutional networks, the correlated prior mixes best. This further supports its suitability as a prior for image data and CNNs.
+
+# A.10.1 KINETIC AND CONFIGURATIONAL TEMPERATURE ESTIMATES
+
+As described above, we use two temperature diagnostics (inspired by Wenzel et al. (2020a)): the kinetic temperature and the configurational temperature. The kinetic temperature is derived from the sampler’s momentum $\pmb { m } \in \mathbb { R } ^ { d }$ . The inner product $\scriptstyle { \frac { 1 } { d } } m ^ { \mathsf { T } } M ^ { - 1 } m$ , for the (in this case diagonal) mass matrix $M$ , is an estimate of the scaled variance of the momenta. It is always positive and should, in expectation, be equal to the desired temperature. In contrast, the configurational temperature is $\begin{array} { r } { \frac { 1 } { d } \pmb { \theta } ^ { \top } \dot { \nabla } H ( \pmb { \theta } , \pmb { m } ) } \end{array}$ , where $\begin{array} { r } { H ( \pmb \theta , \pmb m ) = - \log \hat { p } ( \pmb \theta | \mathcal { D } ) _ { + } + \frac { 1 } { 2 } \pmb { m } ^ { \top } M ^ { - 1 } \pmb { m } + \mathrm { c o n s } } \end{array}$ t is the Hamiltonian. In expectation, this should also equal $T$ . Unlike the kinetic temperature estimator, the configurational temperature estimator is not guaranteed to be always positive, even though the temperature is always positive. Using subsets of a parameter or momentum also yields estimators of the temperature.
+
+In both cases, we estimate the mean and its standard error from a weighted average of parameters or momenta. That is, for each separate NN weight matrix or bias vector, we estimate its kinetic and configurational temperature using the expressions above. Then, we take their average and standard-deviation, weighted by the number of elements in that parameter matrix or vector.
+
+We show the estimated temperatures of all our BNN experiments in Figures A.27, A.28, A.29, A.30, A.31, and A.32, as a mean $\pm$ one standard error. The desired temperature is shown as a dotted horizontal line. The kinetic temperatures generally agree well with the true temperatures, so our sampler works as expected there.
+
+The configurational temperature estimates have a higher variance than the kinetic ones. Especially in the regime of small true temperatures, they often tend to slightly over- or underestimate the temperature. This is not surprising, since at low temperatures the noise in the gradients is dominated by the minibatching as opposed to the temperature noise. Correctly estimating the temperature from the gradients thus becomes harder.
+
+Note that while the relative deviations can seem large in this regime, the absolute deviations are still quite small. Note also that while the conditioned momenta are strictly positive, the inner products between gradients and parameters can become negative in principle, which is why at low temperatures (close to 0) the configurational temperature estimates might sometimes be a bit below 0. Overall, the sampler is still within the tolerance levels of working correctly here, but there could be some small inaccuracies at low temperatures. However, judging from the shape of the actual tempering curves (see Sec. 4), the measures usually change more in the higher temperature regimes than in the lower ones, so there is no strong reason to believe that the inference at low temperatures was too inaccurate to support the results.
+
+# A.10.2 BETWEEN-CHAIN AND WITHIN-CHAIN VARIANCES
+
+The split- $\widehat { R }$ estimator measures the difference between posterior variance estimate in each chain, and between chains. It is roughly the square root of the between-chain variance divided by the within-chain variance (Vehtari et al., 2021, eq. 1–3). Its value is usually not smaller than 1, and a chain that has mixed well should have a value no larger than $\widehat { R } \leq 1 . 0 1$ (Vehtari et al., 2021). (Previously, a threshold of 1.1 was considered enough (Gelman et al., 2013, Section 11.5).)
+
+Neural network functional forms have a large number of parameter symmetries (for example, permutation invariance). Accordingly, the true BNN posterior should sample from all these modified parameters with probability proportional to their prior. However, for prediction purposes, it does not matter if the parameters are stuck in a single “permutation” and do not mix.
+
+Therefore, for the purposes of this paper, we calculate the $\widehat { R }$ diagnostic not directly on the parameters, but on symmetry-invariant functions of the parameters. In practice, this amounts to evaluating the NN on a test set, and calculating the $\widehat { R }$ diagnostic for functions of the logits and the prior probability.
+
+Table A.3: Estimated $\widehat { R }$ values for the different models and priors with respect to the loss.
+
+
Gaussian
Laplace
Student-t
Correlated
MNISTFCNN
1.000
1.001
1.006
一
FashionMNISTFCNN
1.000
1.000
1.007
=
MNIST CNN
1.000
1.000
1.002
1.000
FashionMNIST CNN
1.001
1.003
1.009
1.001
CIFAR10ResNet
1.115
1.115
1.125
1.109
CIFAR10 ResNet (augmented)
1.057
1.054
1.047
1.066
+
+Table A.4: Estimated $\widehat { R }$ values for the different models and priors with respect to the potential.
+
+
Gaussian
Laplace
Student-t
Correlated
MNISTFCNN
1.000
1.002
1.023
=
FashionMNISTFCNN
1.000
1.000
1.013
=
MNISTCNN
1.000
1.000
1.001
1.000
FashionMNIST CNN
1.000
1.002
1.007
1.000
CIFAR10 ResNet
1.166
1.147
1.171
1.139
CIFAR10 ResNet (augmented)
1.085
1.083
1.073
1.090
+
+Tables A.3, A.4 and A.5 display the value of the diagnostic $\hat { R }$ for different such functions: the log-likelihood, the unnormalized log-posterior (potential), and the log-prior, respectively.
+
+We employ the rank-normalized $\widehat { R }$ estimator (Vehtari et al., 2021, eq. 14) as implemented in the ArviZ library (Kumar et al., 2019).
+
+The diagnostics are generally favorable $ { \widehat { R } } \leq 1 . 0 1$ , mostly) for smaller NNs (FCNNs and 2-layer CNNs) and for MNIST. Within the ResNets applied to CIFAR10, the prior distribution with the $\widehat { R }$ closer to 1 is the correlated Gaussian. This provides evidence that inference is easier in the case of the correlated Gaussian, and therefore that the correlated Gaussian is a better prior (Gelman et al., 2013; Yang et al., 2015). This is because if the prior is good, the data are plausible simulations from it; so the posterior is close to the prior and will be easy to approximate.
+
+# A.11 VARIATIONAL INFERENCE
+
+In this paper, our experimental results have focused on inference with SG-MCMC, as we wished to obtain the most reliable posterior possible. However, non-sampling approaches such as variational inference (VI; e.g., Graves, 2011; Blundell et al., 2015; Dusenberry et al., 2020) and Laplace’s method (e.g. Immer et al., 2021b) remain popular in the literature. Therefore, it might be valuable to understand the effect of the prior on the performance of these methods. In this section, we focus on variational inference (Wainwright et al., 2008), in particular the mean-field VI (MFVI) approach (Graves, 2011; Blundell et al., 2015).
+
+Table A.5: Estimated $\widehat { R }$ values for the different models and priors with respect to the log prior.
+
+
Gaussian
Laplace
Student-t
Correlated
MNISTFCNN
1.000
1.005
1.101
FashionMNISTFCNN
1.000
1.003
1.104
MNIST CNN
1.001
1.002
1.013
1.001
FashionMNISTCNN
1.002
1.006
1.013
1.001
CIFAR10ResNet
1.404
1.232
1.366
1.195
CIFAR10 ResNet (augmented)
1.274
1.346
1.264
1.198
+
+Variational inference attempts to approximate the true intractable posterior $p ( w | x , y )$ by a tractable approximate posterior $q ( w )$ from an approximating family $\mathcal { Q }$ by maximizing the evidence lower bound (ELBO):
+
+$$
+q ^ { * } ( w ) = \underset { q \in \mathcal { Q } } { \arg \operatorname* { m a x } } \mathcal { L } ( q ; \lambda ) = \underset { q \in \mathcal { Q } } { \arg \operatorname* { m a x } } \mathbb { E } _ { q } [ \log p ( y | x , w ) ] - \lambda \mathrm { K L } ( q ( w ) | | p ( w ) ) .
+$$
+
+For $\lambda = 1$ , the ELBO is a true lower bound to the marginal likelihood of the model, and the true posterior is recovered as the optimal solution when $Q$ is the family of all distributions over $w$ . For MFVI, we restrict the approximating distribution to be a fully-factorized Gaussian, that is, $\begin{array} { r } { q ( w ) = \prod _ { i } \mathcal { N } ( w _ { i } | \mu _ { i } , \sigma _ { i } ^ { 2 } ) } \end{array}$ , so that there is no correlation structure in the approximate posterior. The variational parameters $\{ \mu _ { i } , \sigma _ { i } \}$ can then be optimized using the reparameterization trick (Kingma & Welling, 2014; Rezende et al., 2014).
+
+As with (SG-)MCMC, we can temper the posterior by adjusting $\lambda$ , with $0 < \lambda < 1$ resulting in a “cold posterior”. However, we note that apart from the case $\lambda = T = 1$ , where we target the true posterior in both VI and MCMC, there is no straightforward, direct relationship between the cold posterior obtained in Eq. 1 and that obtained from Eq. 5 (for discussion see Wenzel et al. (2020a), particularly App. E).
+
+# A.11.1 EXPERIMENTAL DETAILS AND RESULTS
+
+We replicate the experiment in Sec. 4.3 for the ResNet architecture using CIFAR-10. We train each model for 1,000 epochs on batches of 500 augmented datapoints, using Adam (Kingma & Ba, 2015) with an initial learning rate of 0.01, which we reduce to 0.001 after 500 epochs. We are able to use these relatively high learning rates because we follow the parameterization introduced in Ober & Aitchison (2020); we also follow their step-wise tempering scheme for the first 100 epochs, which gradually increases the influence of the KL term. We use 1 sample from the approximate posterior for training and 10 samples for testing. Finally, we again run 5 replicates for each model.
+
+We plot the results of this experiment in Figure A.33. We immediately make a few observations. First, the performance of MFVI is far worse than that of SG-MCMC on all metrics with the exception of calibration. We note that the performance at $\lambda = 1$ is particularly bad, which reflects the welldocumented behavior that tempering with $\lambda < 1$ is required for decent performance with MFVI (e.g., Wenzel et al., 2020a). Finally, it does not seem that the choice of prior has much effect on the performance of MFVI, as all priors perform similarly. We hypothesize that this is largely due to the mean-field assumption imposed on the approximate posterior, which severely restricts its expressiveness and can lead to pathological behavior (Foong et al., 2019; Trippe & Turner, 2018). The mean-field assumption leads to a poor approximation to the true posterior, and therefore will not be as influenced by the choice of prior as SG-MCMC. However, we leave a full investigation of these effects to future work.
+
+# B EVALUATION METRICS
+
+When using BNNs, practitioners might care about different outcomes. In some applications, the predictive accuracy might be the only metric of interest, while in other applications calibrated uncertainty estimates could be crucial. We therefore use a range of different metrics in our experiments in order to highlight the respective strengths and weaknesses of different priors. Moreover, we compare the priors to the empirical weight distributions of conventionally trained networks.
+
+# B.1 EMPIRICAL TEST PERFORMANCE
+
+Test error The test error is probably the most widely used metric in supervised learning. It intuitively measures the performance of the model on a held-out test set and is often seen as an empirical approximation to the true generalization error. While it is often used for model selection, it comes with the risk of overfitting to the used test set (Bishop, 2006) and in the case of BNNs also fails to account for the predictive variance of the posterior.
+
+Test log-likelihood The predictive log-likelihood also requires a test set for its evaluation, but it takes the predictive posterior variance into account. It can thus offer a built-in tradeoff between the mean fit and the quality of the uncertainty estimates. Moreover, it is a proper scoring rule (Gneiting & Raftery, 2007).
+
+# B.2 UNCERTAINTY ESTIMATES
+
+Uncertainty calibration Bayesian methods are often chosen for their superior uncertainty estimates, so many users of BNNs will not be satisfied with only fitting the posterior mean well. The calibration measures how well the uncertainty estimates of the model correlate with predictive performance. Intuitively, when the model is for instance $70 \%$ certain about a prediction, this prediction should be correct with $70 \%$ probability. Many deep learning models are not well calibrated, because they are often overconfident and assign too low uncertainties to their predictions (Ovadia et al., 2019; Wenzel et al., 2020b). When the models are supposed to be used in safety-critical scenarios, it is often crucial to be able to tell when they encounter an input that they are not certain about (Kendall & Gal, 2017). For these applications, metrics such as the expected calibration error (Naeini et al., 2015) might be the most important criteria.
+
+Out-of-distribution detection The out-of-distribution (OOD) detection measures how well one can tell in-distribution and out-of-distribution examples apart based on the uncertainties. This is important when we believe that the model might be deployed under some degree of dataset shift. In this case, the model should be able to detect these OOD examples and be able to reject them, that is, refuse to make a prediction on them.
+
+# C DETAILS ABOUT THE CONSIDERED PRIORS
+
+We contrast the widely used isotropic Gaussian priors with heavy-tailed distributions, including the Laplace and Student-t distributions, and with correlated Gaussian priors. We chose these distributions based on our observations of the empirical weight distributions of SGD-trained networks (see Sec. 3) and for their ease of implementation and optimization. We now give a quick overview over these different distributions and their most salient properties.
+
+Gaussian. The isotropic Gaussian distribution (Gauss, 1809) is the de-facto standard for BNN priors in recent work (e.g., Hernández-Lobato & Adams, 2015; Louizos & Welling, 2017; Dusenberry et al., 2020; Wenzel et al., 2020a; Neal, 1992; Zhang et al., 2019; Osawa et al., 2019; Immer et al., 2021b; Lee et al., 2017; Garriga-Alonso et al., 2019). Its probability density function (PDF) is
+
+$$
+p ( x ; \mu , \sigma ^ { 2 } ) = { \frac { 1 } { \sqrt { 2 \pi \sigma ^ { 2 } } } } \exp \left( - { \frac { ( x - \mu ) ^ { 2 } } { 2 \sigma ^ { 2 } } } \right)
+$$
+
+with mean $\mu$ and standard deviation $\sigma$ . It is attractive, because it is the central limit of all finitevariance distributions (Billingsley, 1961) and the maximum entropy distribution for a given mean and scale (Bishop, 2006). However, its tails are relatively light compared to some of the other distributions that we will consider.
+
+Laplace. The Laplace distribution (Laplace, 1774) has heavier tails than the Gaussian and is discontinuous at $x = \mu$ . Its PDF is
+
+$$
+p ( x ; \mu , b ) = { \frac { 1 } { 2 b } } \exp \left( - { \frac { | x - \mu | } { b } } \right)
+$$
+
+with mean $\mu$ and scale $b$ . It is often used in the context of (frequentist) lasso regression (Tibshirani, 1996).
+
+Student-t. The Student-t distribution characterizes the mean of a finite number of samples from a Gaussian distribution (Student, 1908). Its PDF is
+
+$$
+p ( x ; \mu , \nu ) = \frac { \Gamma ( \frac { \nu + 1 } { 2 } ) } { \Gamma ( \frac { \nu } { 2 } ) \sqrt { \nu \pi } } \left( 1 + \frac { ( x - \mu ) ^ { 2 } } { \nu } \right) ^ { - \frac { \nu + 1 } { 2 } } ,
+$$
+
+where $\mu$ is the mean, $\Gamma$ is the gamma function, and $\nu$ are the degrees of freedom. The Student-t also arises as the marginal distribution over Gaussians with an inverse-Gamma prior over the variances (Helmert, 1875; Lüroth, 1876). For $\nu \to \infty$ , the Student-t distribution approaches the Gaussian. For any finite $\nu$ it has heavier tails than the Gaussian. Its $k$ -th moment is only finite for $\nu > k$ . The $\nu$ parameter thus offers a convenient way to adjust the heaviness of the tails. Note that it also controls the variance of the distribution, which is $\nu / ( \bar { \nu } - 2 )$ (or else undefined). Unless otherwise stated, we set $\nu = 3$ in our experiments, such that the distribution has rather heavy tails, while still having a finite mean and variance.
+
+Multivariate Gaussian with Matérn covariance. For our correlated Bayesian CNN priors, we use multivariate Gaussian priors
+
+$$
+\begin{array} { l } { \displaystyle { p ( \pmb { x } ; \pmb { \mu } , \pmb { \Sigma } ) = \frac { 1 } { \sqrt { ( 2 \pi ) ^ { d } \operatorname* { d e t } \pmb { \Sigma } } } \exp \left( - \frac { 1 } { 2 } \| \pmb { x } - \pmb { \mu } \| _ { \pmb { \Sigma } ^ { - 1 } } ^ { 2 } \right) } } \\ { \mathrm { ~ w i t h ~ } \quad \| \pmb { x } - \pmb { \mu } \| _ { \pmb { \Sigma } ^ { - 1 } } ^ { 2 } = ( \pmb { x } - \pmb { \mu } ) ^ { \top } \pmb { \Sigma } ^ { - 1 } ( \pmb { x } - \pmb { \mu } ) , } \end{array}
+$$
+
+where $d$ is the dimensionality.
+
+In our experiments, we set ${ \pmb \mu } = { \bf 0 }$ and define the covariance $\pmb { \Sigma }$ to be block-diagonal, such that the covariance between weights in different filters is 0 and between weights in the same filter is given by a Matérn kernel $( \nu = 1 / 2$ ) on the pixel distances, as applied by Garriga-Alonso $\&$ van der Wilk (2021) in the infinite-width case. Formally, for the weights $w _ { i , j }$ and $w _ { i ^ { \prime } , j ^ { \prime } }$ in filters $i$ and $i ^ { \prime }$ and for pixels $j$ and $j ^ { \prime }$ , the covariance is
+
+$$
+\begin{array} { r } { \mathrm { c o v } ( w _ { i , j } , w _ { i ^ { \prime } , j ^ { \prime } } ) = \left\{ \begin{array} { l l } { \sigma ^ { 2 } \exp \left( \frac { - d ( j , j ^ { \prime } ) } { \lambda } \right) } & { \mathrm { i f ~ } i = i ^ { \prime } } \\ { 0 } & { \mathrm { e l s e } } \end{array} \right. , } \end{array}
+$$
+
+where $d ( \cdot , \cdot )$ is the Euclidean distance in pixel space and we set $\sigma = \lambda = 1$ .
+
+# D IMPLEMENTATION DETAILS
+
+Training setup. For all the MNIST BNN experiments, we perform 60 cycles of SG-MCMC (Zhang et al., 2019) with 45 epochs each. We draw one sample each at the end of the respective last five epochs of each cycle. From these 300 samples, we discard the first 50 as a burn-in of the chain. Moreover, in each cycle, we only add Langevin noise in the last 15 epochs (similar to Zhang et al. (2019)). We start each cycle with a learning rate of 0.01 and decay to 0 using a cosine schedule. We use a mini-batch size of 128.
+
+For the SGD experiments yielding the empirical weight distributions, we use the same settings, but do not add any Langevin noise. We also do not use any cycles and just train the networks once to convergence, which in our case took 600 epochs.
+
+We ran the experiments on GPUs of the type NVIDIA GeForce GTX 1080 Ti and NVIDIA GeForce RTX 2080 Ti on our local cluster. The main experiments (see Fig. 4 and Fig. 5) took around 10,000 GPU hours to run.
+
+FCNN architecture. For the FCNN experiments, we used a feedforward neural network with three layers, a hidden layer width of 100, and ReLU activations.
+
+CNN architecture. For the CNN experiments, we use a convolutional network with two convolutional layers and one fully connected layer. The hidden convolutional layers have 64 channels each and use $3 \times 3$ convolutions and ReLU activations. Each convolutional layer is followed by a $2 \times 2$ max-pooling layer.
+
+ResNet architecture and data augmentation. For the ResNet experiments on CIFAR-10, we use a ResNet20 architecture (He et al., 2016), equal to the one used in Wenzel et al. (2020a). For data augmentation, we pad all the images with 4 pixels on each border and then randomly crop out a $3 2 \mathrm { x } 3 2 $ image out of that padded one and then randomly flip half of the images horizontally
+
+Software packages. We implemented the inference and models with the PyTorch library (Paszke et al., 2019). To manage our experiments and schedule runs with several settings, we used Sacred (Greff et al., 2017) and Jug (Coelho, 2017) respectively. For the diagnostics, we also use Arviz (Kumar et al., 2019).
+
+
+Figure A.10: Distributions of off-diagonal elements in the empirical covariances of the weights and singular values of the CNN in the other layer. The empirical distributions are plotted as histograms, while the idealized random Gaussian weights are overlaid as an orange line. We see that the covariances of the empirical weights are more heavy-tailed than for the Gaussian weights and that the singular value spectrum for the empirical weights decays faster than the Gaussian ones.
+
+
+Figure A.11: Performances of Bayesian ResNets with different priors on CIFAR-10 with and without data augmentation in terms of different metrics. Data augmentation seems to increase the cold posterior effect.
+
+
+Figure A.12: Performances of fully connected BNNs with different priors on MNIST and FashionMNIST in terms of different metrics, compared to SGD solutions. The heavy-tailed priors perform better for Fashion MNIST, and perform better for MNIST at least for Laplace for error and NLL. heavy-tailed priors also eliminate the cold posterior effect (they get worse as temperature falls).
+
+
+Figure A.13: Performances of convolutional BNNs with different priors on MNIST and FashionMNIST in terms of different metrics, compared to SGD solutions. The correlated prior generally performs better than the isotropic ones, but still exhibits a cold posterior effect, while the heavy-tailed priors reduce the cold posterior effect, but yield a worse performance.
+
+
+Figure A.14: Performances of Bayesian ResNets with different priors on CIFAR-10 with and without data augmentation in terms of different metrics, compared to SGD solutions. The correlated prior generally outperforms the other ones. Moreover, data augmentation seems to increase the cold posterior effect.
+
+
+Figure A.15: Performances of fully connected and convolutional BNNs with sigmoid activation functions on MNIST. The observed effects are qualitatively similar to the ones with ReLU activations in the main body of the paper.
+
+
+Figure A.16: Performances of fully connected and convolutional BNNs with tanh activation functions on MNIST. The observed effects are qualitatively similar to the ones with ReLU activations in the main body of the paper.
+
+
+Figure A.17: Performances of Bayesian FCNNs with different priors on (Fashion-)MNIST, including temperatures $T > 1$ . The performances generally do not improve for warm posteriors, such that $T \approx 1$ is indeed optimal for some priors.
+
+
+Figure A.18: Performances of Bayesian CNNs and Resnets with different priors on (Fashion-)MNIST and CIFAR, including temperatures $T > 1$ . The performances generally do not improve for warm posteriors, such that $T \approx 1$ is indeed optimal for some priors. Note that here, we do not use data augmentation for CIFAR.
+
+
+Figure A.19: Performances of Bayesian FCNNs with different priors and different prior variances on MNIST. The qualitative behavior is similar to the one for the He variance in the main text.
+
+
+Figure A.20: Performances of Bayesian CNNs with different priors and different prior variances on MNIST. The qualitative behavior is similar to the one for the He variance in the main text.
+
+
+Figure A.21: Performances of Bayesian FCNNs with different priors and different prior variances on Fashion-MNIST. The qualitative behavior is similar to the one for the He variance in the main text.
+
+
+Figure A.22: Performances of Bayesian CNNs with different priors and different prior variances on Fashion-MNIST. The qualitative behavior is similar to the one for the He variance in the main text.
+
+
+Figure A.23: Performances of Bayesian Resnets with different priors and different prior variances on CIFAR-10. The qualitative behavior is similar to the one for the He variance in the main text. Note that here, we do not use data augmentation.
+
+
+Figure A.24: Performances of Bayesian FCNNs with different priors and different depths on MNIST. The qualitative behavior for the different numbers of layers is similar to the one for three layers in the main text.
+
+
+Figure A.25: Box plots of the mean-squared error of Bayesian FCNNs doing regression on UCI datasets. For each temperature, and prior, each box displays the median $\pm 1 . 5$ times the inter-quartile range. Outliers are plotted as $\times$ . We exclude runs where the potential diverges. Temperature 1 is clearly best for all datasets, but otherwise there is no clear trend.
+
+
+Figure A.26: Kinetic temperature diagnostics of the ResNet CIFAR-10 experiments with data augmentation. We see that the kinetic temperatures agree almost perfectly with the target temperature of the sampler.
+
+Table A.2: Worst (highest) $\widehat { R }$ values for different models and neuron-permutation-invariant functions.
+
+
Loss
Potential
Log-prior
FCNN MNIST
1.006
1.023
1.101
FCNN Fashion
1.007
1.013
1.104
CNNMNIST
1.002
1.001
1.013
CNNFashion
1.009
1.007
1.013
ResNet CIFAR-10
1.125
1.171
1.404
ResNet C.-10 (aug)
1.066
1.090
1.346
+
+
+Figure A.27: Temperature diagnostics of the MNIST experiment with FCNNs.
+
+
+Figure A.28: Temperature diagnostics of the MNIST experiment with CNNs.
+
+
+Figure A.29: Temperature diagnostics of the FashionMNIST experiment with FCNNs.
+
+
+Figure A.30: Temperature diagnostics of the FashionMNIST experiment with CNNs.
+
+
+Figure A.31: Temperature diagnostics of the CIFAR-10 experiment with ResNets without data augmentation.
+
+
+Figure A.32: Temperature diagnostics of the CIFAR-10 experiment with ResNets with data augmentation.
+
+
+Figure A.33: Performances of mean-field variational inference ResNets with different priors on CIFAR-10. Note the reversed y-axis for OOD detection on the right to ensure that lower values are better in all plots. Shaded regions represent one standard error.
\ No newline at end of file
diff --git a/md/dev/xm6YD62D1Ub/xm6YD62D1Ub.md b/md/dev/xm6YD62D1Ub/xm6YD62D1Ub.md
new file mode 100644
index 0000000000000000000000000000000000000000..8f6e056cc25be23c8ba8fe17e677095835926433
--- /dev/null
+++ b/md/dev/xm6YD62D1Ub/xm6YD62D1Ub.md
@@ -0,0 +1,464 @@
+# VICREG: VARIANCE-INVARIANCE-COVARIANCE REGULARIZATION FOR SELF-SUPERVISED LEARNING
+
+# Adrien Bardes1,2
+
+Jean Ponce2,4
+
+Yann LeCun $^ { 1 , 3 , 4 }$
+
+1Facebook AI Research
+2Inria, École normale supérieure, CNRS, PSL Research University
+3Courant Institute, New York University
+4Center for Data Science, New York University
+
+# ABSTRACT
+
+Recent self-supervised methods for image representation learning maximize the agreement between embedding vectors produced by encoders fed with different views of the same image. The main challenge is to prevent a collapse in which the encoders produce constant or non-informative vectors. We introduce VICReg (Variance-Invariance-Covariance Regularization), a method that explicitly avoids the collapse problem with two regularizations terms applied to both embeddings separately: (1) a term that maintains the variance of each embedding dimension above a threshold, (2) a term that decorrelates each pair of variables. Unlike most other approaches to the same problem, VICReg does not require techniques such as: weight sharing between the branches, batch normalization, feature-wise normalization, output quantization, stop gradient, memory banks, etc., and achieves results on par with the state of the art on several downstream tasks. In addition, we show that our variance regularization term stabilizes the training of other methods and leads to performance improvements.
+
+# 1 INTRODUCTION
+
+Self-supervised representation learning has made significant progress over the last years, almost reaching the performance of supervised baselines on many downstream tasks Bachman et al. (2019); Misra & Maaten (2020); He et al. (2020); Tian et al. (2020); Caron et al. (2020); Grill et al. (2020); Chen & He (2020); Gidaris et al. (2021); Zbontar et al. (2021). Several recent approaches rely on a joint embedding architecture in which two networks are trained to produce similar embeddings for different views of the same image. A popular instance is the Siamese network architecture Bromley et al. (1994), where the two networks share the same weights. The main challenge with joint embedding architectures is to prevent a collapse in which the two branches ignore the inputs and produce identical and constant output vectors. There are two main approaches to preventing collapse: contrastive methods and information maximization methods. Contrastive Bromley et al. (1994); Chopra et al. (2005); He et al. (2020); Hjelm et al. (2019); Chen et al. (2020a) methods tend to be costly, require large batch sizes or memory banks, and use a loss that explicitly pushes the embeddings of dissimilar images away from each other. They often require a mining procedure to search for offending dissimilar samples from a memory bank He et al. (2020) or from the current batch Chen et al. (2020a). Quantization-based approaches Caron et al. (2020; 2018) force the embeddings of different samples to belong to different clusters on the unit sphere. Collapse is prevented by ensuring that the assignment of samples to clusters is as uniform as possible. A similarity term encourages the cluster assignment score vectors from the two branches to be similar. More recently, a few methods have appeared that do not rely on contrastive samples or vector quantization, yet produce high-quality representations, for example BYOL Grill et al. (2020) and SimSiam Chen & He (2020). They exploit several tricks: batch-wise or feature-wise normalization, a "momentum encoder" in which the parameter vector of one branch is a low-pass-filtered version of the parameter vector of the other branch Grill et al. (2020); Richemond et al. (2020), or a stop-gradient operation in one of the branches Chen & He (2020). The dynamics of learning in these methods, and how they avoid collapse, is not fully understood, although theoretical and empirical studies point to the crucial importance of batch-wise or feature-wise normalization Richemond et al. (2020); Tian et al. (2021). Finally, an alternative class of collapse prevention methods relies on maximizing the information content of the embedding Zbontar et al. (2021); Ermolov et al. (2021). These methods prevent informational collapse by decorrelating every pair of variables of the embedding vectors. This indirectly maximizes the information content of the embedding vectors. The Barlow Twins method drives the normalized cross-correlation matrix of the two embeddings towards the identity Zbontar et al. (2021), while the Whitening-MSE method whitens and spreads out the embedding vectors on the unit sphere Ermolov et al. (2021).
+
+
+Figure 1: VICReg: joint embedding architecture with variance, invariance and covariance regularization. Given a batch of images $I$ , two batches of different views $X$ and $X ^ { \prime }$ are produced and are then encoded into representations $Y$ and $Y ^ { \prime }$ . The representations are fed to an expander producing the embeddings $Z$ and $Z ^ { \prime }$ . The distance between two embeddings from the same image is minimized, the variance of each embedding variable over a batch is maintained above a threshold, and the covariance between pairs of embedding variables over a batch are attracted to zero, decorrelating the variables from each other. Although the two branches do not require identical architectures nor share weights, in most of our experiments, they are Siamese with shared weights: the encoders are ResNet-50 backbones with output dimension 2048. The expanders have 3 fully-connected layers of size 8192.
+
+# 2 VICREG: INTUITION
+
+We introduce VICReg (Variance-Invariance-Covariance Regularization), a self-supervised method for training joint embedding architectures based on the principle of preserving the information content of the embeddings. The basic idea is to use a loss function with three terms:
+
+• Invariance: the mean square distance between the embedding vectors.
+• Variance: a hinge loss to maintain the standard deviation (over a batch) of each variable of the embedding above a given threshold. This term forces the embedding vectors of samples within a batch to be different.
+• Covariance: a term that attracts the covariances (over a batch) between every pair of (centered) embedding variables towards zero. This term decorrelates the variables of each embedding and prevents an informational collapse in which the variables would vary together or be highly correlated.
+
+Variance and Covariance terms are applied to both branches of the architecture separately, thereby preserving the information content of each embedding at a certain level and preventing informational collapse independently for the two branches. The main contribution of this paper is the Variance preservation term, which explicitly prevents a collapse due to a shrinkage of the embedding vectors towards zero. The Covariance criterion is borrowed from the Barlow Twins method and prevents informational collapse due to redundancy between the embedding variables Zbontar et al. (2021). VICReg is more generally applicable than most of the aforementioned methods because of fewer constraints on the architecture. In particular, VICReg:
+
+• does not require that the weights of the two branches be shared, not that the architectures be identical, nor that the inputs be of the same nature;
+
+• does not require a memory bank, nor contrastive samples, nor a large batch size; • does not require batch-wise nor feature-wise normalization; and • does not require vector quantization nor a predictor module.
+
+Other methods require asymmetric stop gradient operations, as in SimSiam Chen & He (2020), weight sharing between the two branches as in classical Siamese nets, or weight sharing through exponential moving average dampening with stop gradient in one branch, as in BYOL and MoCo He et al. (2020); Grill et al. (2020); Chen et al. (2020c), large batches of contrastive samples, as in SimCLR Chen et al. (2020a), or batch-wise and/or feature-wise normalization Caron et al. (2020); Grill et al. (2020); Chen & He (2020); Zbontar et al. (2021); Ermolov et al. (2021). One of the most interesting feature of VICReg is the fact that the two branches are not required to share the same parameters, architecture, or input modality. This opens the door to the use of non-contrastive self-supervised joint-embedding for multi-modal signals, such as video and audio. We demonstrate the effectiveness of the proposed approach by evaluating the representations learned with VICReg on several downstream image recognition tasks including linear head and semi-supervised evaluation protocols for image classification on ImageNet Deng et al. (2009), and other classification, detection, instance segmentation, and retrieval tasks. Furthermore, we show that incorporating variance preservation into other self-supervised joint-embedding methods yields better training stability and performance improvement on downstream tasks. More generally, we show that VICReg is an explicit and effective, yet simple method for preventing collapse in self-supervised joint-embedding learning.
+
+# 3 RELATED WORK
+
+Contrastive learning. In contrastive SSL methods applied to joint embedding architectures, the output embeddings for a sample and its distorted version are brought close to each other, while other samples and their distortions are pushed away. The method is most often applied to Siamese architectures in which the two branches have identical architectures and share weights Misra & Maaten (2020); He et al. (2020); Bromley et al. (1994); Hjelm et al. (2019); Chen et al. (2020a;c); Hadsell et al. (2006); Ye et al. (2019); Wu et al. (2018); van den Oord et al. (2018); Chen et al. (2020b). Many authors use the InfoNCE loss van den Oord et al. (2018) in which the repulsive force is larger for contrastive samples that are closer to the reference. While these methods yield good performance, they require large amounts of contrastive pairs in order to work well. These contrastive pairs can be sampled from a memory bank as in MoCo He et al. (2020), or given by the current batch of data as in SimCLR Chen et al. (2020a), with a significant memory footprint. This downside of contrastive methods motivates a search for alternatives.
+
+Clustering methods. Instead of viewing each sample as its own class, clustering-based methods group them into clusters based on some similarity measure Caron et al. (2020; 2018); Bautista et al. (2016); Yang et al. (2016); Xie et al. (2016); Huang et al. (2019); Zhuang et al. (2019); Caron et al. (2019); Asano et al. (2020); Yan et al. (2020). DeepCluster Caron et al. (2018) uses $k$ -means assignments of representations from previous iterations as pseudo-labels for the new representations, which requires an expensive clustering phase done asynchronously, and makes the method hard to scale up. SwAV Caron et al. (2020) mitigates this issue by learning the clusters online while maintaining a balanced partition of the assignments through the Sinkhorn-Knopp transform Cuturi (2013). These clustering approaches can be viewed as contrastive learning at the level of clusters which still requires a lot of negative comparisons to work well.
+
+Distillation methods. Recent proposals such as BYOL, SimSiam, OBoW and variants Grill et al. (2020); Chen & He (2020); Gidaris et al. (2021); Richemond et al. (2020); Gidaris et al. (2020) have shown that collapse can be avoided by using architectural tricks inspired by knowledge distillation Hinton et al. (2015). These methods train a student network to predict the representations of a teacher network, for which the weights are a running average of the student network’s weights Grill et al. (2020), or are shared with the student network, but no gradient is back-propagated through the teacher Chen & He (2020). These methods are effective, but there is no clear understanding of why and how they avoid collapse. Alternatively, the images can be represented as bags of word over a dictionary of visual features, which effectively prevents collapse. In OBoW Gidaris et al. (2020) and Gidaris et al. (2021) the dictionary is obtained by off-line or on-line clustering. By contrast, our method explicitly prevents collapse in the two branches independently, which removes the requirement for shared weights and identical architecture, opening the door to the application of joint-embedding SSL to multi-modal signals.
+
+Information maximization methods. A principle to prevent collapse is to maximize the information content of the embeddings. Two such methods were recently proposed: W-MSE Ermolov et al. (2021) and Barlow Twins Zbontar et al. (2021). In W-MSE, an extra module transforms the embeddings into the eigenspace of their covariance matrix (whitening or Karhunen-Loève transform), and forces the vectors thereby obtained to be uniformly distributed on the unit sphere. In Barlow Twins, a loss term attempts to make the normalized cross-correlation matrix of the embedding vectors from the two branches to be close to the identity. Both methods attempt to produce embedding variables that are decorrelated from each other, thus preventing an informational collapse in which the variables carry redundant information. Because all variables are normalized over a batch, there is no incentive for them to shrink nor expand. This seems to sufficient to prevent collapse. Our method borrows the decorrelation mechanism of Barlow Twins. But it includes an explicit variance-preservation term for each variable of the two embeddings and thus does not require any normalization.
+
+# 4 VICREG: DETAILED DESCRIPTION
+
+VICReg follows recent trends in self-supervised learning Caron et al. (2020); Grill et al. (2020); Chen & He (2020); Zbontar et al. (2021); Chen et al. (2020a) and is based on a joint embedding architecture. Contrary to many previous approaches, our architecture may be completely symmetric or completely asymmetric with no shared structure or parameters between the two branches. In most of our experiments, we use a Siamese net architecture in which the two branches are identical and share weights. Each branch consists of an encoder $f _ { \theta }$ that outputs the representations (used for downstream tasks), followed by an expander $h _ { \phi }$ that maps the representations into an embedding space where the loss function will be computed. The role of the expander is twofold: (1) eliminate the information by which the two representations differ, (2) expand the dimension in a non-linear fashion so that decorrelating the embedding variables will reduce the dependencies (not just the correlations) between the variables of the representation vector. The loss function uses a term $s$ that learns invariance to data transformations and is regularized with a variance term $v$ that prevents norm collapse and a covariance term $c$ that prevents informational collapse by decorrelating the different dimensions of the vectors. After pretraining, the expander is discarded and the representations of the encoder are used for downstream tasks.
+
+# 4.1 METHOD
+
+Given an image $i$ sampled from a dataset $\mathcal { D }$ , two transformations $t$ and $t ^ { \prime }$ are sampled from a distribution $\tau$ to produce two different views $x = t ( i )$ and $x ^ { \prime } = t ^ { \prime } ( i )$ of $i$ . These transformations are random crops of the image, followed by color distortions. The distribution $\tau$ is described in Appendix C. The views $x$ and $x ^ { \prime }$ are first encoded by $f _ { \theta }$ into their representations $y = f _ { \boldsymbol { \theta } } ( \boldsymbol { x } )$ and $\bar { y ^ { \prime } } \overset { - } { = } f _ { \theta } ( x ^ { \prime } )$ , which are then mapped by the expander $h _ { \phi }$ onto the embeddings $z = h _ { \phi } ( y )$ and $z ^ { \prime } = h _ { \phi } ( y ^ { \prime } )$ . The loss is computed at the embedding level on $z$ and $z ^ { \prime }$ .
+
+We describe here the variance, invariance and covariance terms that compose our loss function. The images are processed in batches, and we denote $Z = [ z _ { 1 } , \dots , z _ { n } ]$ and $Z ^ { \prime } = [ z _ { 1 } ^ { \prime } , \dots , z _ { n } ^ { \prime } ]$ the two batches composed of $n$ vectors of dimension $d$ , of embeddings coming out of the two branches of the siamese architecture. We denote by $z ^ { j }$ the vector composed of each value at dimension $j$ in all vectors in $Z$ . We define the variance regularization term $v$ as a hinge function on the standard deviation of the embeddings along the batch dimension:
+
+$$
+v ( Z ) = \frac { 1 } { d } \sum _ { j = 1 } ^ { d } \operatorname* { m a x } ( 0 , \gamma - S ( z ^ { j } , \epsilon ) ) ,
+$$
+
+where $S$ is the regularized standard deviation defined by:
+
+$$
+S ( x , \epsilon ) = \sqrt { \mathrm { V a r } ( x ) + \epsilon } ,
+$$
+
+$\gamma$ is a constant target value for the standard deviation, fixed to 1 in our experiments, $\epsilon$ is a small scalar preventing numerical instabilities. This criterion encourages the variance inside the current batch to be equal to $\gamma$ along each dimension, preventing collapse with all the inputs mapped on the same vector. Using the standard deviation and not directly the variance is crucial. Indeed, if we take $S ( x ) = \mathrm { V a r } ( x )$ in the hinge function, the gradient of $S$ with respect to $x$ becomes close to 0 when $x$ is close to $\bar { x }$ . In this case, the gradient of $v$ also becomes close to 0 and the embeddings collapse. We define the covariance matrix of $Z$ as:
+
+$$
+C ( Z ) = \frac { 1 } { n - 1 } \sum _ { i = 1 } ^ { n } ( z _ { i } - \bar { z } ) ( z _ { i } - \bar { z } ) ^ { T } , \mathrm { w h e r e } \bar { z } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } z _ { i } .
+$$
+
+Inspired by Barlow Twins Zbontar et al. (2021), we can then define the covariance regularization term $c$ as the sum of the squared off-diagonal coefficients of $C ( Z )$ , with a factor $1 / d$ that scales the criterion as a function of the dimension:
+
+$$
+c ( Z ) = \frac { 1 } { d } \sum _ { i \neq j } [ C ( Z ) ] _ { i , j } ^ { 2 } .
+$$
+
+This term encourages the off-diagonal coefficients of $C ( Z )$ to be close to 0, decorrelating the different dimensions of the embeddings and preventing them from encoding similar information. Decorrelation at the embedding level ultimately has a decorrelation effect at the representation level, which is a non trivial phenomenon that we study in Appendix D. We finally define the invariance criterion $s$ between $Z$ and $Z ^ { \prime }$ as the mean-squared euclidean distance between each pair of vectors, without any normalization:
+
+$$
+s ( Z , Z ^ { \prime } ) = \frac { 1 } { n } \sum _ { i } \| z _ { i } - z _ { i } ^ { \prime } \| _ { 2 } ^ { 2 } .
+$$
+
+The overall loss function is a weighted average of the invariance, variance and covariance terms:
+
+$$
+\ell ( Z , Z ^ { \prime } ) = \lambda s ( Z , Z ^ { \prime } ) + \mu [ v ( Z ) + v ( Z ^ { \prime } ) ] + \nu [ c ( Z ) + c ( Z ^ { \prime } ) ] ,
+$$
+
+where $\lambda , \mu$ and $\nu$ are hyper-parameters controlling the importance of each term in the loss. In our experiments, we set $\nu = 1$ and perform a grid search on the values of $\lambda$ and $\mu$ with the base condition $\lambda = \mu > 1$ . The overall objective function taken on all images over an unlabelled dataset $\mathcal { D }$ is given by:
+
+$$
+\mathcal { L } = \sum _ { I \in \mathcal { D } } \sum _ { t , t ^ { \prime } \sim \mathcal { T } } \ell ( Z ^ { I } , Z ^ { \prime I } ) ,
+$$
+
+where $Z ^ { I }$ and $Z ^ { \prime I }$ are the batches of embeddings corresponding to the batch of images $I$ transformed by $t$ and $t ^ { \prime }$ . The objective is minimized for several epochs, over the encoder parameters $\theta$ and expander parameters $\phi$ . We illustrate the architecture and loss function of VICReg in Figure 1.
+
+# 4.2 IMPLEMENTATION DETAILS
+
+Implementation details for pretraining with VICReg on the 1000-classes ImagetNet dataset without labels are as follows. Coefficients $\lambda$ and $\mu$ are 25 and $\nu$ is 1 in Eq. (6), and $\epsilon$ is 0.0001 in Eq. (1). We give more details on how we choose the coefficients of the loss function in Appendix D.4. The encoder network $f _ { \theta }$ is a standard ResNet-50 backbone He et al. (2016) with 2048 output units. The expander $h _ { \phi }$ is composed of two fully-connected layers with batch normalization (BN) Ioffe & Szegedy (2015) and ReLU, and a third linear layer. The sizes of all 3 layers were set to 8192. As with Barlow Twins, performance improves when the size of the expander layers is larger than the dimension of the representation. The impact of the expander dimension on performance is studied in Appendix D. The training protocol follows those of BYOL and Barlow Twins: LARS optimizer You et al. (2017); Goyal et al. (2017) run for 1000 epochs with a weight decay of $1 0 ^ { - 6 }$ and a learning rate $l r = b a t c h \_ s i z e / 2 5 6 \times b a s e \_ l r$ , where batch_size is set to 2048 by default and base_ $_ { . } l r$ is a base learning rate set to 0.2. The learning rate follows a cosine decay schedule Loshchilov & Hutter (2017), starting from 0 with 10 warmup epochs and with final value of 0.002.
+
+# 5 RESULTS
+
+In this section, we evaluate the representations obtained after self-supervised pretraining of a ResNet$5 0 \mathrm { H e }$ et al. (2016) backbone with VICReg during 1000 epochs, on the training set of ImageNet, using the training protocol described in section 4. We also pretrain on pairs of image and text data and evaluate on retrieval tasks on the MS-COCO dataset.
+
+Table 1: Evaluation on ImageNet. Evaluation of the representations obtained with a ResNet-50 backbone pretrained with VICReg on: (1) linear classification on top of the frozen representations from ImageNet; (2) semi-supervised classification on top of the fine-tuned representations from $1 \%$ and $10 \%$ of ImageNet samples. We report Top-1 and Top-5 accuracies (in $\%$ ). Top-3 best self-supervised methods are underlined.
+
+
Method
Linear
Semi-supervised
Top-1
Top-5
Top-1
Top-5
1%
10%
1%
10%
Supervised
76.5
25.4
56.4
48.4
80.4
MoCo He et al. (2020)
60.6
=
1
1
-
PIRL Misra & Maaten (2020)
63.6
=
1
57.2
83.8
CPC v2 Hénaff et al. (2019)
63.8
=
=
-
1
CMC Tian et al. (2019)
66.2
=
=
=
=
=
SimCLR Chen et al. (2020a)
69.3
89.0
48.3
65.6
75.5
87.8
MoCo v2 Chen et al. (2020c)
71.1
1
-
1
1
SimSiam Chen&He (2020)
71.3
1
=
=
=
SwAV Caron et al. (2020)
71.8
-
InfoMin Aug Tian et al. (2020)
73.0
91.1
=
OBoW Gidaris et al. (2021)
73.8
1
=
82.9
90.7
BYOL Grill et al. (2020)
74.3
91.6
53.2
68.8
78.4
89.0
SwAV (w/ multi-crop) Caron et al. (2020)
75.3
=
53.9
70.2
78.5
89.9
Barlow Twins Zbontar et al. (2021)
73.2
91.0
55.0
69.7
79.2
89.3
VICReg (ours)
73.2
91.1
54.8
69.5
79.4
89.5
+
+# 5.1 EVALUATION ON IMAGENET
+
+Following the ImageNet Deng et al. (2009) linear evaluation protocol, we train a linear classifier on top of the frozen representations of the ResNet-50 backbone pretrained with VICReg. We also evaluate the performance of the backbone when fine-tuned with a linear classifier on a subset of ImageNet’s training set using $1 \%$ or $10 \%$ of the labels, using the split of Chen et al. (2020a). We give implementation details about the optimization procedure for these tasks in Appendix C. We have applied the training procedure described in section 4 with three different random initialization. The numbers reported in Table 1 for VICReg are the mean scores, and we have observed that the difference between worse and best run is lower than $0 . 1 \%$ accuracy for linear classification, which shows that VICReg is a very stable algorithm. Lack of time has prevented us from doing the same for the semi-supervised classification experiments, and the experiments of section 5.2 and 6, but we expect similar conclusion to hold. We compare in Table 1 our results on both tasks against other methods on the validation set of ImageNet. The performance of VICReg is on par with the state of the art without using the negative pairs of SimCLR, the clusters of SwAV, the bag-of-words representations of OBoW, or any asymmetric networks architectural tricks such as the momentum encoder of BYOL and the stop-gradient operation of SimSiam. The performance is comparable to that of Barlow Twins, which shows that VICReg’s more explicit way of constraining the variance and comparing views has the same power than maximizing cross-correlations between pairs of twin dimensions. The main advantage of VICReg is the modularity of its objective function and the applicability to multi-modal setups.
+
+# 5.2 TRANSFER TO OTHER DOWNSTREAM TASKS
+
+Following the setup from Misra & Maaten (2020), we train a linear classifier on top of the frozen representations learnt by our pretrained ResNet-50 backbone on a variety of different datasets: the Places205 Zhou et al. (2014) scene classification dataset, the VOC07 Everingham et al. (2010) multi-label image classification dataset and the iNaturalist2018 Horn et al. (2018) fine-grained image classification dataset. We then evaluate the quality of the representations by transferring to other vision tasks including $\mathrm { \ V O C { 0 7 + 1 2 } }$ Everingham et al. (2010) object detection using Faster R-CNN Ren et al. (2015) with a R50-C4 backbone, and COCO Lin et al. (2014) instance segmentation using Mask-R-CNN He et al. (2017) with a R50-FPN backbone. We report the performance in Table 2,
+
+Table 2: Transfer learning on downstream tasks. Evaluation of the representations from a ResNet50 backbone pretrained with VICReg on: (1) linear classification tasks on top of frozen representations, we report Top-1 accuracy (in $\%$ ) for Places205 Zhou et al. (2014) and iNat18 Horn et al. (2018), and mAP for VOC07 Everingham et al. (2010); (2) object detection with fine-tunning, we report $\mathrm { { A P } _ { 5 0 } }$ for $\mathrm { \ V O C { 0 7 + 1 2 } }$ using Faster R-CNN with C4 backbone Ren et al. (2015); (3) object detection and instance segmentation, we report AP for COCO Lin et al. (2014) using Mask R-CNN with FPN backbone He et al. (2017). We use $\dagger$ to denote the experiments run by us. Top-3 best self-supervised methods are underlined.
+
+
Linear Classification
Object Detection
Method
Places205
VOC07 iNat18
VOC07+12(
COCO det COCO seg
Supervised
53.2
87.5
46.7
81.3
39.0
35.4
MoCo He et al. (2020)
46.9
79.8
31.5
=
PIRL Misra & Maaten (2020)
49.8
81.1
34.1
=
1
=
SimCLR Chen et al. (2020a)
52.5
85.5
37.2
1
-
1
MoCo v2 Chen et al. (2020c)
51.8
86.4
38.6
82.5
39.8
36.1
SimSiam Chen & He (2020)
1
1
1
82.4
-
-
BYOL Grill et al. (2020)
54.0
86.6
47.6
=
40.4†
37.0t
SwAV (m-c) Caron et al. (2020)
56.7
88.9
48.6
82.6
41.6
37.8
OBoW Gidaris et al. (2021)
56.8
89.3
1
82.9
1
=
Barlow Twins Grill et al. (2020)
54.1
86.2
46.5
82.6
40.0t
36.7†
VICReg (ours)
54.3
86.6
47.0
82.4
39.4
36.4
+
+Table 3: Evaluation on MS-COCO 5K retrieval tasks. Comparison of VICReg with the contrastive loss of ${ \mathrm { V S E } } { + } { + }$ Faghri et al. (2018), and with Barlow Twins, pretrain on the training set of MS-COCO. In all settings, the encoder for text is a word embedding followed by a GRU layer, the encoder for images is a ResNet-152.
+
+
Method
Image-to-text
Text-to-Image
R@1
R@5
R@10
R@1
R@5
R@10
Contrastive (VSE++)
30.3
59.4
72.4
41.3
71.1
81.2
Barlow Twins
31.4
60,4
75.1
42.9
74.0
83.5
VICReg
33.6
62.7
77.9
45.2
76.1
84.2
+
+VICReg performs on par with most concurrent methods, and better than Barlow Twins, across all classification tasks, but is slightly behind the top-3 on detection tasks.
+
+# 5.3 MULTI-MODAL PRETRAINING ON MS-COCO
+
+One fundamental difference of VICReg compared to Barlow Twins is the way the branches are regularized. In VICReg, both branches are regularized independently, as the covariance term is applied on each branch separately, which works better in the scenarios where the branches are completely different, have different types of architecture and process different types of data. Indeed, the statistics of the output of the two branches can be very different, and the amount of regularization required for each may vary a lot. In Barlow Twins, the regularization is applied on the cross-correlation matrix, which favors the scenarios where the branches produce outputs with similar statistics. We demonstrate the capabilities of VICReg in a multi-modal experiment where we pretrain on pairs of images and corresponding captions on the MS-COCO dataset. We regularize each branch with a different coefficient, which is not possible with Barlow Twins, and we show that VICReg outperforms Barlow Twins on image and text retrieval downstream tasks. Table 3 reports the performance of VICReg against the contrastive loss proposed by ${ \mathrm { V S E } } { + } { + }$ Faghri et al. (2018), and against Barlow Twins, in the identical setting proposed in Faghri et al. (2018). VICReg outperforms the two by a significant margin.
+
+Table 4: Effect of incorporating variance and covariance regularization in different methods. Top-1 ImageNet accuracy with the linear evaluation protocol after 100 pretraining epochs. For all methods, pretraining follows the architecture, the optimization and the data augmentation protocol of the original method using our reimplementation. ME: Momentum Encoder. SG: stop-gradient. PR: predictor. BN: Batch normalization layers after input and inner linear layers in the expander. No Reg: No additional regularization. Var Reg: Variance regularization. Var/Cov Reg: Variance and Covariance regularization. Unmodified original setups are marked by a $\dagger$ .
+
+
Method
ME
SG
PR
BN
No Reg
Var Reg
Var/Cov Reg
BYOL
√
√
√
√
69.3†
70.2
69.5
SimSiam
√
67.9†
68.1
67.6
SimSiam
1
35.1
67.3
67.1
SimSiam
<<>
collapse
56.8
66.1
VICReg
collapse
56.2
67.3
VICReg
?
collapse
57.1
68.7
VICReg
V
collapse
57.5
68.6†
VICReg
collapse
56.5
67.4
+
+# 6 ANALYSIS
+
+In this section we study how the different components of our method contribute to its performance, as well as how they interact with components from other self-supervised methods. We also evaluate different scenarios where the branches have different weights and architecture. All reported results are obtained on the linear evaluation protocol, using a ResNet-50 backbone if not mentioned otherwise, and 100 epochs of pretraining, which gives results consistent with those obtained with 1000 epochs of pretraining. The optimization setting used for each experiment is described in Appendix C.
+
+Asymmetric networks. We study the impact of different components used in asymmetric architectures and the effects of adding variance and covariance regularization, in terms of performance and training stability. Starting from a simple symmetric architecture with an encoder and an expander without batch normalization, which correspond to VICReg without batch normalization in the expander, we progressively add batch normalization in the inner layers of the expander, a predictor, a stop-gradient operation and a momentum encoder. We use the training protocol and architecture of SimSiam Chen & He (2020) when a stop-gradient is used and the training protocol and architecture of BYOL Grill et al. (2020) when a momentum encoder is used. The predictor as used in SimSiam and BYOL is a learnable module $g _ { \psi }$ that predicts the embedding of a view given the embedding of the other view of the same image. If $z$ and $z ^ { \prime }$ are the embeddings of two views of an image, then $p = g _ { \psi } ( z )$ and $p ^ { \prime } = g _ { \psi } ( z ^ { \prime } )$ are the predictions of each view. The invariance loss function of Eq. (5) is now computed between a batch of embeddings $Z = [ z _ { 1 } , \ldots , z _ { n } ]$ and the corresponding batch of predictions $P = [ p _ { 1 } ^ { \prime } , \ldots , p _ { n } ^ { \prime } ]$ , then symmetrized:
+
+$$
+s ( Z , Z ^ { \prime } , P , P ^ { \prime } ) = \frac { 1 } { 2 n } \sum _ { i } D ( z _ { i } - p _ { i } ^ { \prime } ) + \frac { 1 } { 2 n } \sum _ { i } D ( z _ { i } ^ { \prime } - p _ { i } ) ,
+$$
+
+where $D$ is a distance function that depends on the method used. BYOL uses the mean square error between $l _ { 2 }$ -normalized vectors, SimSiam uses the negative cosine similarity loss and VICReg uses the mean square error without $l _ { 2 }$ -normalization. The variance and covariance terms are regularizing the output $Z$ and $Z ^ { \prime }$ of the expander, which we empirically found to work better than regularizing the output of the predictor. We compare different settings in Table 4, based on the default data augmentation, optimization and architecture settings of the original BYOL, SimSiam and VICReg methods. In all settings, the absence of BN indicates that BN is also removed in the predictor when one is used.
+
+We analyse first the impact of variance regularization (VR) in the different settings. When using VR, adding a predictor (PR) to VICReg does not lead to a significant change of the performance, which indicates that PR is redundant with VR. In comparison, without VR, the representations collapse, and both stop-gradient (SG) and PR are necessary. Batch normalization in the inner layers of the expander (BN) in VICReg leads to a $1 . 0 \%$ increase in the performance, which is not a big improvement considering that SG and PR without BN is performing very poorly at $3 5 . 1 \%$ .
+
+Table 5: Impact of sharing weights or not between branches. Top-1 accuracy on linear classification with 100 pretraining epochs. The encoder and expander of both branches can share the same architecture and share their weights (SW), share the same architecture with different weights (DW), or have different architectures (DA). The encoders can be ResNet-50, ResNet-101 or ViT-S.
+
+
SW R50
DW R50
DA R50/R101
DA R50/ViT-S
BYOL
69.3
X
X
X
SimCLR
64.4
63.1
63.9
63.5
Barlow Twins
68.7
64.2
65.3
63.9
VICReg
68.6
66.5
68.1
66.2
+
+Finally, incorporating VR with SG or ME further improves the performance by small margins of respectively $0 . 2 \%$ and $0 . 9 \%$ , which might be explained by the fact that these architectural tricks that prevent collapse are not perfectly maintaining the variance of the representations, i.e. very slow collapse is happening with these methods. We explain this intuition by studying the evolution of the standard deviation of the representations during pretraining for BYOL and SimSiam in Appendix D. We then analyse the impact of adding additional covariance regularization (CR) in the different settings, along with variance regularization. We found that optimization with SG and CR is hard, even if our analysis of the average correlation coefficient of the representations during pretraining in Appendix D shows that both fulfill the same objective.
+
+The performance of BYOL and SimSiam slightly drops compared to VR only, except when PR is removed, where SG becomes useless. BN is still useful and improves the performance by $1 . 3 \%$ . Finally with CR, PR does not harm the performance and even improves it by a very small margin. VICReg+PR with 1000 epochs of pretraining exactly matches the score of VICReg $7 3 . 2 \%$ on linear classification).
+
+Weight sharing. Contrary to most self-supervised learning approaches based on Siamese architectures, VICReg has several unique properties: (1) weights do not need to be shared between the branches, each branch’s weights are updated independently of the other branch’s weights; (2) the branches are regularized independently, the variance and covariance terms are computed on each branch individually; (3) no predictor is necessary unlike with methods where one branch predicts outputs of the other branch. We compare the robustness of VICReg against other methods in different scenarios where the weights of the branches can be shared (SW), not shared (DW), and where the encoders can have different architectures (DA). Among other self-supervised methods, SimCLR and Barlow Twins are the only ones that can handle these scenarios. The asymmetric methods that are based on a discrepancy between the branches requires either the architecture or the weights to be shared between the branches. The performance drops by $2 . 1 \%$ with VICReg and $4 . 5 \%$ with Barlow Twins, between the shared weights scenario (SW) and the different weight scenario (DW). The difference between VICReg and Barlow Twins is also significant in scenarios with different architectures, in particular VICReg performs better than Barlow Twins by $2 . 8 \%$ with ResNet-50/ResNet-101 and better by $2 . 3 \%$ with ResNet-50/ViT-S Dosovitskiy et al. (2021). This shows that VICReg is more robust than Barlow Twins in these kind of scenarios. The performance of SimCLR remains stable across scenarios, but is significantly worse than the performance of VICReg. Importantly, the ability of VICReg to function with different parameters, architectures, and input modalities for the branches widens the applicability to joint-embedding SSL to many applications, including multi-modal signals.
+
+# 7 CONCLUSION
+
+We introduced VICReg, a simple approach to self-supervised learning based on a triple objective: learning invariance to different views with a invariance term, avoiding collapse of the representations with a variance preservation term, and maximizing the information content of the representation with a covariance regularization term. VICReg achieves results on par with the state of the art on many downstream tasks, but is not subject to the same limitations as most other methods, particularly because it does not require the embedding branches to be identical or even similar.
+
+Acknowledgement. Jean Ponce was supported in part by the French government under management of Agence Nationale de la Recherche as part of the ”Investissements d’avenir” program, reference ANR-19-P3IA-0001 (PRAIRIE 3IA Institute), the Louis Vuitton/ENS Chair in Artificial Intelligence and the Inria/NYU collaboration. Adrien Bardes was supported in part by a FAIR/Prairie CIFRE PhD Fellowship. The authors wish to thank Jure Zbontar for the BYOL implementation, Stéphane Deny for useful comments on the paper, and Li Jing, Yubei Chen, Mikael Henaff, Pascal Vincent and Geoffrey Zweig for useful discussions. We thank Quentin Duval and the VISSL team for help obtaining the results of table 2.
+
+# REFERENCES
+
+Yuki Markus Asano, Christian Rupprecht, and Andrea Vedaldi. Self-labelling via simultaneous clustering and representation learning. In ICLR, 2020. 3
+
+Philip Bachman, R Devon Hjelm, and William Buchwalter. Learning representations by maximizing mutual information across views. In NeurIPS, 2019. 1
+
+Miguel A. Bautista, Artsiom Sanakoyeu, Ekaterina Sutter, and Björn Ommer. Cliquecnn: Deep unsupervised exemplar learning. In NeurIPS, 2016. 3
+
+Jane Bromley, Isabelle Guyon, Yann LeCun, Eduard Sackinger, and Roopak Shah. Signature verification using a “siamese” time delay neural network. In NeurIPS, 1994. 1, 3
+
+Mathilde Caron, Piotr Bojanowski, Armand Joulin, and Matthijs Douze. Deep clustering for unsupervised learning. In ECCV, 2018. 1, 3
+
+Mathilde Caron, Piotr Bojanowski, Julien Mairal, and Armand Joulin. Unsupervised pre-training of image features on non-curated data. In ICCV, 2019. 3
+
+Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. In NeurIPS, 2020. 1, 3, 4, 6, 7, 14, 16, 17, 18, 20
+
+Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey E. Hinton. A simple framework for contrastive learning of visual representations. In ICML, 2020a. 1, 3, 4, 6, 7, 14, 16, 17, 20, 21
+
+Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey Hinton. Big self-supervised models are strong semi-supervised learners. In NeurIPS, 2020b. 3
+
+Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. In CVPR, 2020. 1, 3, 4, 6, 7, 8, 14, 16, 17, 21
+
+Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020c. 3, 6, 7
+
+Sumit Chopra, Raia Hadsell, and Yann LeCun. Learning a similarity metric discriminatively, with application to face verification. In CVPR, 2005. 1
+
+Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In NeurIPS, 2013. 3
+
+Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009. 3, 6
+
+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. 9
+
+Aleksandr Ermolov, Aliaksandr Siarohin, Enver Sangineto, and Nicu Sebe. Whitening for selfsupervised representation learning, 2021. 2, 3, 4, 14
+
+Mark Everingham, Luc Van Gool, John Winn Christopher K. I. Williams, and Andrew Zisserman. The pascal visual object classes (voc) challenge. IJCV, 2010. 6, 7, 16
+
+Fartash Faghri, David J. Fleet, Jamie Ryan Kiros, and Sanja Fidler. ${ \mathrm { V s e } } + +$ : Improving visual-semantic embeddings with hard negatives. In BMVC, 2018. 7
+
+Rong-En Fan, Kai-Wei Chang, Cho-Jui Hsieh, Xiang-Rui Wang, and Chih-Jen Lin. Liblinear: A library for large linear classification. JMLR, 2008. 16
+
+Spyros Gidaris, Andrei Bursuc, Nikos Komodakis, Patrick Pérez, and Matthieu Cord. Learning representations by predicting bags of visual words. In CVPR, 2020. 3
+
+Spyros Gidaris, Andrei Bursuc, Gilles Puy, Nikos Komodakis, Matthieu Cord, and Patrick Pérez. Online bag-of-visual-words generation for unsupervised representation learning. In CVPR, 2021. 1, 3, 6, 7, 14
+
+Priya Goyal, Piotr Dollá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. 5
+
+Priya Goyal, Quentin Duval, Jeremy Reizenstein, Matthew Leavitt, Min Xu, Benjamin Lefaudeux, Mannat Singh, Vinicius Reis, Mathilde Caron, Piotr Bojanowski, Armand Joulin, and Ishan Misra. Vissl. https://github.com/facebookresearch/vissl, 2021. 16
+
+Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre H. Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, Bilal Piot, Koray Kavukcuoglu, Rémi Munos, and Michal Valko. Bootstrap your own latent: A new approach to self-supervised learning. In NeurIPS, 2020. 1, 3, 4, 6, 7, 8, 14, 16, 17, 20, 21
+
+Raia Hadsell, Sumit Chopra, and Yann LeCun. Dimensionality reduction by learning an invariant mapping. In CVPR, 2006. 3
+
+Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. 5
+
+Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In ICCV, 2017. 6, 7
+
+Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In CVPR, 2020. 1, 3, 6, 7, 16
+
+Geoffrey Hinton, Oriol Vinyals, and Jeffrey Dean. Distilling the knowledge in a neural network. In NIPS Deep Learning and Representation Learning Workshop, 2015. 3
+
+R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. In ICLR, 2019. 1, 3
+
+Grant Van Horn, Oisin Mac Aodha, Yang Song, Yin Cui, Chen Sun, Alex Shepard, Hartwig Adam, Pietro Perona, and Serge Belongie. The inaturalist species classification and detection dataset. In CVPR, 2018. 6, 7, 16
+
+Jiabo Huang, Qi Dong andShaogang Gong, and Xiatian Zhu. Unsupervised deep learning by neighbourhood discovery. In ICML, 2019. 3
+
+Olivier J. Hénaff, Aravind Srinivas, Jeffrey De Fauw, Ali Razavi, Carl Doersch, S. M. Ali Eslami, and Aäron van den Oord. Data-efficient image recognition with contrastive predictive coding. In ICML, 2019. 6
+
+Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015. 5
+
+Junnan Li, Pan Zhou, Caiming Xiong, and Steven C.H. Hoi. Prototypical contrastive learning of unsupervised representations. In ICLR, 2021. 20
+
+Tsung-Yi Lin, Michael Maire, Serge Belongie, Lubomir Bourdev, Ross Girshick, James Hays, Pietro Perona, Deva Ramanan, C. Lawrence Zitnick, and Piotr Dollár. Microsoft coco: Common objects in context. In ECCV, 2014. 6, 7
+
+Ilya Loshchilov and Frank Hutter. Sgdr: stochastic gradient descent with warm restarts. In ICLR, 2017. 5
+
+Ishan Misra and Laurens van der Maaten. Self-supervised learning of pretext-invariant representations. In CVPR, 2020. 1, 3, 6, 7, 16
+
+Karol J. Piczak. ESC: Dataset for Environmental Sound Classification. In Proceedings of the 23rd Annual ACM Conference on Multimedia, 2015. 18
+
+Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In NeurIPS, 2015. 6, 7
+
+Pierre H. Richemond, Jean-Bastien Grill, Florent Altché, Corentin Tallec, Florian Strub, Andrew Brock, Samuel Smith, Soham De, Razvan Pascanu, Bilal Piot, and Michal Valko. Byol works even without batch statistics. arXiv preprint arXiv:2010.10241, 2020. 1, 3
+
+Yonglong Tian, Dilip Krishnan, , and Phillip Isola. Contrastive multiview coding. arXiv preprint arXiv:1906.05849v4, 2019. 6
+
+Yonglong Tian, Chen Sun, Ben Poole, Dilip Krishnan, Cordelia Schmid, and Phillip Isola. What makes for good views for contrastive learning. In NeurIPS, 2020. 1, 6
+
+Yuandong Tian, Xinlei Chen, and Surya Ganguli. Understanding self-supervised learning dynamics without contrastive pairs. arXiv preprint arXiv:2102.06810, 2021. 1
+
+Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. 3
+
+Yuxin Wu, Alexander Kirillov, Francisco Massa, Wan-Yen Lo, and Ross Girshick. Detectron2. https://github.com/facebookresearch/detectron2, 2019. 16
+
+Zhirong Wu, Yuanjun Xiong, Stella Yu, , and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In CVPR, 2018. 3, 18, 20
+
+Junyuan Xie, Ross Girshick, and Ali Farhadi. Unsupervised deep embedding for clustering analysis. In ICML, 2016. 3
+
+Saining Xie, Ross Girshick, Piotr Dollár, Zhuowen Tu, and Kaiming He. Aggregated residual transformations for deep neural networks. In CVPR, 2017. 17
+
+Xueting Yan, Ishan Misra, Abhinav Gupta, Deepti Ghadiyaram, and Dhruv Mahajan. Clusterfit: Improving generalization of visual representations. In CVPR, 2020. 3
+
+Jianwei Yang, Devi Parikh, and Dhruv Batra. Joint unsupervised learning of deep representations and image clusters. In CVPR, 2016. 3
+
+Mang Ye, Xu Zhang, Pong C Yuen, and Shih-Fu Chang. Unsupervised embedding learning via invariant and spreading instance feature. In CVPR, 2019. 3
+
+Yang You, Igor Gitman, and Boris Ginsburg. Large batch training of convolutional networks. arXiv preprint arXiv:1708.03888, 2017. 5, 17
+
+Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016. 17
+
+Jure Zbontar, Li Jing, Ishan Misra, Yann LeCun, and Stéphane Deny. Barlow twins: Self-supervised learning via redundancy reduction. arXiv preprint arxiv:2103.03230, 2021. 1, 2, 3, 4, 5, 6, 14, 16, 20, 21
+
+Bolei Zhou, Agata Lapedriza, Jianxiong Xiao, Antonio Torralba, and Aude Oliva. Learning deep features for scene recognition using places database. In NeurIPS, 2014. 6, 7, 16
+
+Chengxu Zhuang, Alex Lin Zhai, and Daniel Yamins. Local aggregation for unsupervised learning of visual embeddings. In ICCV, 2019. 3, 18, 20
+
+Algorithm 1: VICReg pytorch pseudocode.
+
+# f: encoder network, lambda, mu, nu: coefficients of the invariance, variance and covariance losses, N: batch size , D: dimension of the representations
+# mse_loss: Mean square error loss function, off_diagonal: off-diagonal elements of a matrix, relu: ReLU activation function
+
+for x in loader: # load a batch with N samples # two randomly augmented versions of x x_a, x_b $=$ augment(x)
+
+# compute representations z_a = f(x_a) # N x D $\mathrm { ~ z ~ } \mathrm { ~ b ~ } = \mathrm { ~ f ~ } ( \mathrm { ~ x ~ } \mathrm { ~ b ~ } )$ # N x D
+
+# invariance loss sim_loss $=$ mse_loss(z_a, z_b)
+
+# # variance loss
+
+std_z_a $=$ torch.sqrt(z_a.var(dim ${ \left. \sum \right. }$ ) $^ +$ 1e-04) std_z_b $=$ torch.sqrt(z_b.var(dim ${ \left. \sum \right. }$ ) $^ +$ 1e-04) std_loss $=$ torch.mean(relu(1 - std_z_a)) $^ +$ torch.mean( relu(1 - std_z_b))
+
+# # covariance loss
+
+z_a = z_a - z_a.mean(dim ${ } = 0$ )
+$z \_ { \mathrm { ~ b ~ } } = \ \mathrm { ~ z \_ ~ } \mathrm { ~ k ~ }$ b - z_b.mean(dim ${ } = 0$ )
+cov_z_a $=$ (z_a.T @ z_a) / (N - 1)
+cov_z_b $=$ (z_b.T @ z_b) / (N - 1)
+cov_loss $=$ off_diagonal(cov_z_a).pow_(2).sum() / D $^ +$ off_diagonal(cov_z_b).pow_(2).sum() / D
+
+# # loss
+
+loss $=$ lambda $\star$ sim_loss $^ +$ mu $\star$ std_loss $^ +$ nu $\star$ cov_loss
+
+# optimization step loss.backward() optimizer.step()
+
+# B RELATION TO OTHER SELF-SUPERVISED METHODS
+
+We compare here VICReg with other methods in terms of methodology, and we discuss the mechanisms used by these methods to avoid collapse and to learn representations, and how they relate to VICReg. We synthesize and illustrate the differences between these methods in Figure 2.
+
+Relation to Barlow Twins Zbontar et al. (2021). VICReg uses the same decorrelation mechanism as Barlow Twins, which consists in penalizing the off-diagonal terms of a covariance matrix computed on the embeddings. However, Barlow Twins uses the cross-correlation matrix where each entry in the matrix is a cross-correlation between two vectors $z ^ { i }$ and $z ^ { \prime } { \mathcal { I } }$ , from the two branches of the siamese architecture. Instead of using cross-correlations, we simply use the covariance matrix of each branch individually, and the variance term of VICReg allows us to get rid of standardization. Indeed, Barlow Twins forces the correlations between pairs of vectors $z ^ { i }$ and $z ^ { \prime i }$ from the same dimension $i$ to be 1. Without normalization, this target value of 1 becomes arbitrary and the vectors take values in a wider range. Moreover, there is an undesirable phenomenon happening in Barlow Twins, the embeddings before standardization can shrink and become constant to numerical precision, which could cause numerical instabilities. In practice, this is solved by adding a constant scalar in the denominator of standardization of the embeddings. Without normalization, VICReg naturally avoids this edge case.
+
+Relation to W-MSE Ermolov et al. (2021). The whitening operation of W-MSE consists in computing the inverse covariance matrix of the embeddings and use its square root as a whitening operator on the embeddings. Using this operator has two downsides. First, matrix inversion is a very costly and potentially unstable operation. VICReg does not need to inverse the covariance matrix. Second, as mentioned in Ermolov et al. (2021) the whitening operator is constructed over several consecutive iteration batches and therefore might have a high variance, which biases the estimation of the meansquared error. This issue is overcome in practice by a batch slicing strategy, where the whitening operator is computed over randomly constructed sub-batches. VICReg does not apply any operator on the embeddings, but instead regularizes the variance and covariance of the embeddings using an additional constraint.
+
+Relation to BYOL and SimSiam Grill et al. (2020); Chen & He (2020). The core components that avoid collapse in BYOL and SimSiam are the average moving weights and the stop-gradient operation on one side of their asymmetric architecture, which play the role of the repulsive term used in other methods. Our experiments in Appendix D.8 show that in addition to preventing collapse, these components also have a decorrelation effect. In addition, we have conducted the following experiment: We compute the correlation matrix of the final representations obtained with SimSiam, BYOL, VICReg and VICReg without covariance regularization. We measure the average correlation coefficient and observe that this coefficient is much smaller for SimSiam, BYOL and VICReg, compared to VICReg without covariance regularization. We observe in Figure 5 that even without covariance regularization, SimSiam and BYOL naturally minimize the average correlation coefficient of the representations. VICReg replaces the moving average weights and the stop-gradient operation, which are architectural trick that require some dependency between the branches, by an explicit constraint on the variance and the covariance of both embeddings separately, which achieves the same goal of decorrelating the representations and avoiding collapse, while being clearer, more interpretable, and working with independent branches.
+
+Relation to SimCLR, SwAV and OBoW Caron et al. (2020); Chen et al. (2020a); Gidaris et al. (2021). Contrastive and clustering based self-supervised algorithms rely on direct comparisons between elements of negative pairs. In the case of SimCLR, the negative pairs involve embeddings mined from the current batch, and large batch sizes are required. Despite the fact that SwAV computes clusters using elements in the current batch, it does not seem to have the same dependency on batch size. However, it still requires a lot of prototype vectors for negative comparisons between embeddings and codes. VICReg eliminates the negative comparisons and replace them by an explicit constraint on the variance of the embeddings, which efficiently plays the role of a negative term between the vectors. SwAV can also be interpreted as a distillation method, where a teacher network produces quantized vectors, used as target for a student network. Ensuring an equal partition of the quantized vectors in different bins or clusters effectively prevents collapse. OBOW can also be interpreted under the same framework. The embeddings are bag-of-words over a vocabulary of visual features, and collapse is avoided by the underlying quantization operation.
+
+
+Figure 2: Conceptual comparison between different self-supervised methods. The inputs $X$ and $X ^ { \prime }$ are fed to an encoder $f$ with weights $\theta$ . The representations $Y$ and $Y ^ { \prime }$ are further processed by a network $h$ with weights $\psi$ . $h$ can be a projector (narrowing trapeze) that reduces the dimensionality of the representations, or an expander (widening trapeze) that increases their dimensionality. A criterion is finally applied on the embeddings $Z$ and $Z ^ { \prime }$ . VICReg (a) works when both branches have encoders $f$ and $f ^ { \prime }$ with different architectures and sets of weights $\theta$ and $\theta ^ { \prime }$ . Each branch’s variance and covariance are regularized by regularizers $v$ and $c$ , and the distance between both branches is minimized with a mean-squared error loss $s$ . Barlow Twins (b) uses a loss $c$ to decorrelate pairs of different dimensions in the batch-wise normalized (B-Norm) embeddings, and learns invariance with a loss $i$ that makes similar dimensions highly correlated. W-MSE (c) uses a batch slicing operation that shuffles batches into small sub-batches, and apply PCA as a whitening operation on the featurewise normalized (F-Norm) embeddings of each sub-batch. BYOL (d) has an asymmetric architecture where the weights $\theta _ { m }$ of one encoder are an exponential moving average (ema) of the other encoder’s weights $\theta$ . A predictor $g$ with weights $\psi$ is used in the branch with learnable weights. SimSiam (e) uses a predictor on one branch and a stop-gradient operation (sg) on the other one. SimCLR (f) uses the InfoNCE contrastive loss where all the feature-wise normalized embeddings are compared between them inside a batch. Samples from distorted versions of the same input are brought close to each other, while other samples are pushed away. SwAV (g) quantizes the feature-wise normalized embeddings of a branch and use it as target for the other one. OBoW (h) uses bag-of-words (BoW) representations and a cross-entropy loss to compare the BoW generated by a teacher network from the feature maps $Y ^ { F }$ of the encoder, to the BoW predicted by a student network. Green blocks: parametric functions; yellow boxes: non-parametric functions; blue boxes: objective functions.
+
+# C ADDITIONAL IMPLEMENTATION DETAILS
+
+# C.1 DATA AUGMENTATION
+
+We follow the image augmentation protocol first introduced in SimCLR Chen et al. (2020a) and now commonly used by similar approaches based on siamese networks Caron et al. (2020); Grill et al. (2020); Chen & He (2020); Zbontar et al. (2021). Two random crops from the input image are sampled and resized to $2 2 4 \times 2 2 4$ , followed by random horizontal flip, color jittering of brightness, contrast, saturation and hue, Gaussian blur and random grayscale. Each crop is normalized in each color channel using the ImageNet mean and standard deviation pixel values. In more details, the exact set of augmentations is based on BYOL Grill et al. (2020) data augmentation pipeline but is symmetrised. The following operations are performed sequentially to produce each view:
+
+• Random cropping with an area uniformly sampled with size ratio between 0.08 to 1.0, followed by resizing to size $2 2 4 \times 2 2 4$ . RandomResizedCrop(224, $\mathsf { i c a l e } \mathsf { = } ( 0 . 0 8 $ , 0.1)) in PyTorch.
+• Random horizontal flip with probability 0.5.
+• Color jittering of brightness, contrast, saturation and hue, with probability 0.8. ColorJitter(0.4, 0.4, 0.2, 0.1) in PyTorch.
+• Grayscale with probability 0.2.
+• Gaussian blur with probability 0.5 and kernel size 23.
+• Solarization with probability 0.1.
+• color normalization with mean (0.485, 0.456, 0.406) and standard deviation (0.229, 0.224, 0.225).
+
+# C.2 IMAGENET EVALUATION
+
+Linear evaluation. We follow standard procedure and train a linear classifier on top of the frozen representations of a ResNet-50 pretrained with VICReg. We use the SGD optimizer with a learning rate of 0.02, a weight decay of $\bar { 1 0 } ^ { - 6 }$ , a batch size of 256, and train for 100 epochs. The learning rate follows a cosine decay. The training data augmentation pipeline is composed of random cropping and resize of ratio 0.2 to 1.0 with size $2 2 4 \times 2 2 4$ , and random horizontal flips. During evaluation the validation images are simply center cropped and resized to $2 2 4 \times 2 2 4$ .
+
+Semi-supervised evaluation. We train a linear classifier and fine-tune the representations using 1 and $10 \%$ of the labels. We use the SGD optimizer with no weight decay and a batch size of 256, and train for 20 epochs. We perform a grid search on the values of the encoder and linear head learning rates. In the $10 \%$ of labels case, we use a learning rate of 0.01 for the encoder and 0.1 for the linear head. In the $1 \%$ of labels case we use 0.03 for the encoder and 0.08 for the linear head. The two learning rates follow a cosine decay schedule. The training data and validation augmentation pipelines are identical to the linear evaluation data augmentation pipelines.
+
+# C.3 TRANSFER LEARNING
+
+We use the VISSL library Goyal et al. (2021) for linear classification tasks and the detectron2 library Wu et al. (2019) for object detection and segmentation tasks.
+
+Linear classification. We follow standard protocols Misra & Maaten (2020); Caron et al. (2020); Zbontar et al. (2021) and train linear models on top of the frozen representations. For VOC07 Everingham et al. (2010), we train a linear SVM with LIBLINEAR Fan et al. (2008). The images are center cropped and resized to $2 2 4 \times 2 2 4$ , and the C values are computed with cross-validation. For Places205 Zhou et al. (2014) we use SGD with a learning rate of 0.003, a weight decay of 0.0001, a momentum of 0.9 and a batch size of 256, for 28 epochs. The learning rate is divided by 10 at epochs 4, 8 and 12. For Inaturalist2018 Horn et al. (2018), we use SGD with a learning rate of 0.005, a weight decay of 0.0001, a momentum of 0.9 and a batch size of 256, for 84 epochs. The learning rate is divided by 10 at epochs 24, 48 and 72.
+
+Object detection and instance segmentation. Following the setup of He et al. (2020); Zbontar et al. (2021), we use the trainval split of $\mathrm { v o c } 0 7 { + } 1 2$ with 16K images for training and a Faster
+
+R-CNN C-4 backbone for 24K iterations with a batch size of 16. The backbone is initialized with our pretrained ResNet-50 backbone. We use a learning rate of 0.1, divided by 10 at iteration 18K and 22K, a linear warmup with slope of 0.333 for 1000 iterations, and a region proposal network loss weight of 0.2. For COCO we use Mask R-CNN FPN backbone for 90K iterations with a batch size of 16, a learning rate of 0.04, divided by 10 at iteration 60K and 80K and with 50 warmup iterations.
+
+# C.4 ANALYSIS
+
+We give here implementation details on the results of Table 4 with BYOL and SimSiam, as well as the default setup for VICReg with 100 epochs of pretraining, used in all our ablations included in Appendix D. For both BYOL and SimSiam experiments, the variance criterion has coefficient $\mu = 1$ and the covariance criterion has coefficient $\nu = 0 . 0 1$ , the data augmentation pipeline and the architectures of the expander and predictor exactly follow the pipeline and architectures described in their paper. The linear evaluation setup of each methods follows closely the setup described in the original papers.
+
+BYOL setup. We use our own BYOL implementation in PyTorch, which outperforms the original implementation for 100 epochs of pretraining $( 6 9 . 3 \%$ accuracy on the linear evaluation protocol against $6 6 . 5 \%$ for the original implementation) and matches its performance for 1000 epochs of pretraining. We use the LARS optimizer You et al. (2017), with a learning rate of $b a s e \_ l r *$ batch_size/256 where base_ $l r = 0 . 4 5$ , and batch $\_ s i z e = 4 0 9 6$ , a weight decay of $1 0 ^ { - 6 }$ , an eta value of 0.001 and a momentum of 0.9, for 100 epoch of pretraining with 10 epochs of warmup. The learning rate follows a cosine decay schedule. The initial value of the exponential moving average factor is 0.99 and follows a cosine decay schedule.
+
+SimSiam setup. We use our own implementation of SimSiam, which reproduces exactly the performance reported in the paper Chen & He (2020). We use SGD with a learning rate of base_lr batch_size/256 where base_ $l r = 0 . 0 5$ , batch_size = 2048, with a weight decay of 0.0001 and a momentum of 0.9 for 100 epochs of pretraining and 10 epochs of warmup. The learning rate of the encoder and the expander follow a cosine decay schedule while the learning rate of the predictor is kept fixed.
+
+VICReg setup. The setting of VICReg’s experiments is identical to the setting described in section 4.2, except that the number of pretraining epochs is 100 and the base learning rate is 0.3. The base learning rates used for the batch size study are 0.8, 0.5 and 0.4 for batch size 128, 256 and 512 respectively, and 0.3 for all other batch sizes. When a predictor is used, it has a similar architecture as the expander described in section 4.2, but with 2 layers instead of 3, which gives better results in practice.
+
+# D ADDITIONAL RESULTS
+
+# D.1 OTHER RESNET ARCHITECTURES
+
+Table 9 reports the performance of VICReg on linear classification with large ResNet architectures. We focus on the wider family of ResNet Zagoruyko & Komodakis (2016) and aggregated ResNet Xie et al. (2017), and we consider two ways of widening a standard ResNet. First, we follow standard practice in recent self-supervised learning work Caron et al. (2020); Grill et al. (2020); Chen et al. (2020a) and multiple by 2 or 4 the number of filters in every convolutional layer, which also has the effect of multiplying the dimensionality of the representations. Second, as originally proposed in Zagoruyko & Komodakis (2016), we only multiply the number of filters in the bottleneck layers, which does not increases the dimensionality of the representations. We call this architecture Narrow ResNet (with prefix N- in Table 9). The main observation we make is the dependency of VICReg on the dimensionality of the representation. Using the narrow architecture, the performance of VICReg, jumps from $7 3 . 2 \%$ top-1 accuracy on linear classification with a ResNet-50, to $7 4 . 7 \%$ with Narrow ResNet-50 $( \mathbf { x } 2 )$ , which is a $1 . 5 \%$ improvement and $7 6 . 0 \%$ with Narrow ResNet-50 (x4), which is a $2 . 8 \%$ improvement. We observe a similar trend going from ResNet-50 to ResNet-50 $( \mathbf { x } 2 )$ , which is a $2 . 3 \%$ improvement but the performance completely saturates with ResNet-50 (x4), which is a $0 . 1 \%$ improvement over ResNet-50 (x2). Table 10 reports the performance of VICReg on semi-supervised classification with large ResNet architectures. VICReg combined with a ResNet-50 (x2) outperforms the current state-of-the-art methods BYOL and SimCLR, using this encoder architecture. Our largest model ResNet-200 $( \mathbf { x } 2 )$ performs lower than BYOL when $1 \%$ of the labels are used but is on par with $10 \%$ of the labels. These results demonstrate the capabilities of VICReg to scale up when large architectures are used.
+
+Table 6: Evaluation on ESC-50. Evaluation of the representations obtained with a ResNet-18 backbone pretrained with VICReg on ESC-50 Piczak (2015) by processing jointly a raw audio time-series and its corresponding time-frequency representation. The supervised baseline corresponds to a ResNet-18 trained on the time-frequency representation in a supervised way. We report Top-1 accuracy on the validation set (in $\%$ ).
+
+
Method
Top-1
Supervised baseline
72.7
Barlow Twins
75.4
VICReg
78.4
+
+# D.2 PRETRAINING AND EVALUATION ON ESC-50 AUDIO CLASSIFICATION
+
+We demonstrate the ability of VICReg to function in a setting where the branches have different architectures by pretraining on the ESC-50 audio dataset Piczak (2015), which is an environmental sound classification dataset with 50 classes. We jointly embedded a raw audio time-series representation on one branch, with its corresponding time-frequency representation on the other branch. We use the standard split of ESC-50 Piczak (2015), composed of 1600 training audio samples and 400 validation sample. The raw audio encoder is a 1-dimensional ResNet-18 with output dimension 384. The time-frequency image representation is the mel spectrogram with 1 channel of the raw audio, that we normalize between 0 and 1, and that is processed be a ResNet-18 with output dimension of 512. We use the AdamW optimizer with learning rate 0.0005 for 100 epochs of pretraining.
+
+Table 6 reports the performance of a linear classifier trained one the frozen representations obtained with VICReg and Barlow Twins to a simple supervised baseline where we train a ResNet-18 on the time-frequency representation in a supervised way. VICReg performs better by $5 . 7 \%$ than our supervised baseline, and better by $3 . 0 \%$ than Barlow Twins. We give more details in Appendix ??. Current best approaches that report around $9 5 \%$ accuracy on this task uses tricks such as heavy data augmentation or pretraining on larger audio and video datasets. With this experiment, our purpose is not to push the state of the art on ESC-50, but merely to demonstrate the applicability of VICReg to settings with multiple architectures and input modalities.
+
+# D.3 K-NEAREST-NEIGHBORS
+
+Following recent protocols Caron et al. (2020); Wu et al. (2018); Zhuang et al. (2019), we evaluate the learnt representations using K-nearest-neighbors classifiers built on the training set of ImageNet and evaluated on the validation set of ImageNet. We report the results with $\mathrm { K } { = } 2 0$ and ${ \mathrm { K } } { = } 2 0 0$ in Table 11. VICReg performs slightly lower than other methods in the 20-NN case but remains competitive in the 200-NN case. These results with K-NN classifiers demonstrate the potential applicability of VICReg to downstream tasks based on nearest neighbors search, such as content retrieval in images or videos.
+
+# D.4 LOSS FUNCTION COEFFICIENTS.
+
+Table 7 reports the performance for various values of the loss term coefficients in Eq. (6). Without variance regularization the representations immediately collapse to a single vector and the covariance term, which has no repulsive effect preventing collapse, has no impact. The invariance term is absolutely necessary and without it the network can not learn any good representations. By simply using the invariance term and variance regularization, which is a very simple baseline, VICReg still reaches an accuracy of $5 7 . 5 \%$ . These results show that variance and covariance regularizations have complementary effects, and that both are required.
+
+On ImageNet, we choose the final coefficients the following way. First, we have empirically found that using very different values for $\lambda$ and $\mu$ , or taking $\lambda = \mu$ with $\nu > \mu$ leads to unstable training. On the other hand taking $\lambda = \mu$ and picking $\nu < \mu$ leads to stable convergence, with the exact value picked for $m u$ having very limited influence on the final linear classification accuracy. We have found that setting $l a m b d a = m u = 2 5$ and $n u = 1$ works best (by a small margin) for Imagenet but we have also obtained excellent results on MNIST and Cifar-10 and 100 using these exact same values. We could easily have tuned these parameters by cross-validation on the validation sets of these two smaller datasets.
+
+Table 7: Impact of variance-covariance regularization. Inv: a invariance loss is used, $\lambda > 0$ , Var: variance regularization, $\mu > 0$ , Cov: covariance regularization, $\nu > 0$ , in Eq. (6).
+
+
Method
入
μ
V
Top-1
Inv
1
0
0
collapse
Inv + Cov
25
0
1
collapse
Inv + Cov
0
25
1
collapse
Inv + Var
1
1
0
57.5
Inv + Var + Cov (VICReg)
1
1
1
collapse
1
10
1
collapse
10
1
1
collapse
5
5
1
68.1
10
10
1
68.2
25
25
1
68.6
50
50
1
68.3
+
+Table 8: Impact of normalization. Std: variables are centered and divided by their standard deviation over the batch. This is applied or not to the embedding and the expander hidden layers. $l _ { 2 }$ : the embedding vectors are $l _ { 2 }$ -normalized.
+
+
Representation
Embedding
Top-1
Std
None
68.6
Std
Std
68.4
None
Std
67.4
Std
None
67.2
None
l2
65.1
+
+# D.5 NORMALIZATIONS
+
+VICReg is the first self-supervised method for joint-embedding architectures we are aware of that does not require normalization. Contrary to SimSiam, W-MSE, SwAV and BYOL, and others, the embedding vectors are not projected on the unit sphere. Contrary to Barlow Twins, they are not standardized (equivalent to batch normalization without the adaptive parameters). Table 8 shows that the best settings do not involve any normalization of the embeddings, whether it is batch-wise or feature-wise (as in $l _ { 2 }$ normalization). Whenever the embeddings are standardized (lines 3 and 5 in the table) the covariance matrix of Eq. (3) becomes the normalized auto-correlation matrix with coefficients between -1 and 1. This hurts the accuracy by $0 . 2 \%$ . We observe that when unconstrained, the coefficients in the covariance matrix take values in a wider range, which seems to facilitate the training process. Standardization is still an important component that helps stabilize the training when used in the hidden layers of the expander, and the performance drops by $1 . 2 \%$ when it is removed. Projecting the embeddings on the unit sphere implicitly constrains their standard deviation along the batch dimension to be $1 / { \sqrt { d } }$ , where $d$ is the dimension of the vectors. We change the invariance term of Eq. (5) to be the mean square error between $l _ { 2 }$ -normalized vectors, and the target $\gamma$ in the variance term of Eq. (1) is set to $1 / \sqrt { d }$ instead of 1, forcing the standard deviation to get closer to $1 / \sqrt { d }$ , and the vectors to be spread out on the unit sphere. This puts a lot more constraints on the network and the performance drops by $3 . 5 \%$ .
+
+Table 9: Linear classification with large architectures. Top-1 accuracy comparison between different methods using various encoder architectures. For all VICReg results, the output dimensionality of the expander is 8192. N-R stands for Narrow ResNet, where only the bottleneck convolutional layers are widen.
+
+
Method
Arch.
Param.
Repr.
Top-1
Top-5
SimCLR Chen et al. (2020a)
R50 (x2) R50 (x4)
93M 375M
4096 8192
74.2 76.5
92.0 93.2
SwAV Caron et al. (2020)
R50 (x2) R50 (x4)
93M 375M
4096 8192
77.3 77.9
- =
BYOL Grill et al. (2020)
R50 (x5) R50 (x2) R50 (x4)
586M 93M 375M
10240 4096 8192
78.5 77.4 78.6
- 93.6 94.2
VICReg (ours)
R200 (x2) N-R50 (x2)
250M 66M
4096 2048
79.6 74.7
94.8 91.9
N-R50 (x4)
221M
2048
76.0
92.4
R50 (x2)
93M
4096
75.5
92.1
R50 (x4)
375M
8192
75.6
92.2
RNXT101-32-16
191M
2048
76.1
92.3
R200 (x2)
250M
4096
77.3
93.3
+
+Table 10: Semi-supervised classification with large architectures. Top-1 accuracy comparison between different methods using various encoder architectures. For all VICReg results, the output dimensionality of the expander is 8192.
+
+
Method
Arch.
Param.
Repr.
Top-1
Top-5
1%
10%
1%
10%
SimCLR Chen et al. (2020a)
R50 (x2)
93M
4096
58.5
71.7
83.0
91.2
R50 (x4)
375M
8192
63.0
74.4
85.8
92.6
BYOL Grill et al. (2020)
R50 (x2)
93M
4096
62.2
73.5
84.1
91.7
R50 (x4)
375M
8192
69.1
75.7
87.9
92.5
R200 (x2)
250M
4096
71.2
77.7
89.5
93.7
VICReg (ours)
R50 (x2)
93M
4096
62.6
73.9
84.5
91.8
R200 (x2)
250M
4096
68.8
77.3
88.2
93.6
+
+Table 11: K-NN classifiers on ImageNet. Top-1 accuracy with 20 and 200 nearest neighbors.
+
+
Method
20-NN
200-NN
NPID Wu et al. (2018)
46.5
LA Zhuang et al. (2019)
49.4
PCL Li et al. (2021)
54.5
1
BYOL Grill et al. (2020)
66.7
64.9
SwAV Caron et al. (2020)
65.7
62.7
Barlow Twins Zbontar et al. (2021)
64.8
62.9
VICReg
64.5
62.8
+
+Table 12: Impact of expander dimensionality. Top-1 accuracy on the linear evaluation protocol with 100 pretraining epochs.
+
+
Dimensionality
256
512
1024
2048
4096
8192
16834
Top-1
55.9
59.2
62.4
65.1
67.3
68.6
68.8
+
+Table 13: Impact of batch size. Top-1 accuracy on the linear evaluation protocol with 100 pretraining epochs.
+
+
Batch size
128
256
512
1024
2048
4096
Top-1
67.3
67.9
68.2
68.3
68.6
67.8
+
+# D.6 EXPANDER NETWORK ARCHITECTURE
+
+VICReg borrows the decorrelation mechanism of Barlow Twins Zbontar et al. (2021) and we observe that it therefore has the same dependency on the dimensionality of the expander network. Table 12 reports the impact of the width and depth of the expander network. The dimensionality corresponds the number of hidden and output units in the expander network during pretraining. As the dimensionality increases, the performance dramatically increases from $5 5 . 9 \%$ top-1 accuracy on linear evaluation with a dimensionality of 256, to $6 8 . 8 \%$ with dimensionality 16384. The performance tends to saturate as the difference between dimensionality 8192 and 16384 is only of $0 . 2 \%$ .
+
+# D.7 BATCH SIZE
+
+Contrastive methods suffer from the need of a lot of negative examples which can translate into the need for very large batch sizes Chen et al. (2020a). Table 13 reports the performance on linear classification when the size of the batch varies between 128 and 4096. For each value of batch size, we perform a grid search on the base learning rate described in Appendix C.4. We observe a $0 . 7 \%$ and $1 . 2 \%$ drop in accuracy with small batch size of 256 and 128 which is comparable with the robustness to batch size of Barlow Twins Zbontar et al. (2021) and SimSiam Chen & He (2020), and a $0 . 8 \%$ drop with a batch size of 4096, which is reasonable and allows our method to be very easily parallelized on multiple GPUs.
+
+# D.8 COMBINATION WITH BYOL AND SIMSIAM
+
+BYOL Grill et al. (2020) and SimSiam Chen & He (2020) rely on a effective but difficult to interpret mechanism for preventing collapse, which may lead to instabilities during the training. We incorporate our variance regularization loss into BYOL and SimSiam and show that it helps stabilize the training and offers a small performance improvement. For both methods, the results are obtained using our own implementation and the exact same data augmentation and optimization settings as in their original paper. The variance and covariance regularization losses are incorporated with a factor of $\mu = 1$ for variance and $\nu = 0 . 0 1$ for covariance. We report in Figure 3 the improvement obtained over these methods on the linear evaluation protocol for different number of pre-training epochs. For BYOL the improvement is of $0 . 9 \%$ with 100 epochs and becomes less significant as the number of pre-training epochs increases with a $0 . 2 \%$ improvement with 1000 epochs. This indicates that variance regularization makes BYOL converge faster. In SimSiam the improvement is not as significant. We plot in Figure 4 the evolution of the standard deviation computed along each dimension and averaged across the dimensions of the representation and the embeddings, during BYOL and SimSiam pretraining. For both methods, the standard deviation computed on the embeddings perfectly matches $1 / \sqrt { d }$ where $d$ is the dimension of the embeddings, which indicates that the embeddings are perfectly spread-out across the unit sphere. This translates in an increased standard deviation at the representation level, which seems to be correlated to the performance improvement. We finally study in Figure 5 the evolution of the average correlation coefficient, during pretraining of BYOL and SimSiam, with and without variance and covariance regularization. The average correlation coefficient is computed by averaging the off-diagonal coefficients of the
+
+
+Figure 3: Incorporating variance regularization in BYOL and SimSiam. Top-1 accuracy on the linear evaluation protocol for different number of pretraining epochs. For both methods pre-training follows the optimization and data augmentation protocol of their original paper but is based on our implementation. Var indicates variance regularization
+
+correlation matrix of the representations:
+
+$$
+\frac { 1 } { 2 d ( d - 1 ) } \sum _ { i \neq j } C ( \boldsymbol { Y } ) _ { i , j } ^ { 2 } + C ( \boldsymbol { Y } ^ { \prime } ) _ { i , j } ^ { 2 } ,
+$$
+
+where $Y$ and $Y ^ { \prime }$ are the standardized representations and $C$ is defined in Eq. (3). In BYOL this coefficient is much lower using covariance regularization, which translate in a small improvement of the performance, according to Table 4. We do not observe the same improvement in SimSiam, both in terms of correlation coefficient, and in terms of performance on linear classification. The average correlation coefficient is correlated with the performance, which motivates the fact that decorrelation and redundancy reduction are core mechanisms for learning self-supervised representations.
+
+# E RUNNING TIME
+
+We report in Table 14, the running time of VICReg in comparison with other methods. All methods are run by us on 32 Tesla V100 GPUs. Each method offers a different trade-off between running time, memory and performance. SwAV is a very fast algorithm which use less memory and run faster than the other methods but with a lower performance, multi-crop helps the performance at the cost of additional compute and memory usage. BYOL has the highest memory requirement, which is due to the need of storing the target network weights. Finally, Barlow Twins and VICReg offer an interesting trade-off, consuming less memory than BYOL and SwAV with multi-crop, and running faster than SwAV with multi-crop, but with a slightly worse performance. The difference of 1h running time between Barlow Twins and VICReg is probably due to implementation details not related to the method.
+
+Table 14: Running time and peak memory. Comparison between different methods, the training is distributed on 32 Tesla V100 GPUs, the running time is measured over 100 epochs and the peak memory is measured on a single GPU. We report top-1 accuracy $( \% )$ on linear classification on top of the frozen representations.
+
+
Method
time /100 epochs
peak memory /GPU
Top-1 accuracy (%)
SwAV
9h
9.5G
71.8
SwAV (w/ multi-crop)
13h
12.9G
75.3
BYOL
10h
14.6G
74.3
Barlow Twins
12h
11.3G
73.2
VICReg
11h
11.3G
73.2
+
+
+Figure 4: Standard deviation of the features during BYOL and SimSiam pretraining. Evolution of the average standard deviation of each dimension of the features with and without variance regularization (Var). left: the standard deviation is measured on the representations, right: the standard deviation is measured on the embeddings.
+
+
+Figure 5: Average correlation coefficient of the features during BYOL and SimSiam pretraining. Evolution of the average correlation coefficient measured by averaging the off-diagonal terms of the correlation matrix of the representations with BYOL, BYOL with variance-covariance regularization (BYOL VarCov), SimSiam, and SimSiam with variance-covariance regularization (SimSiam VarCov).
\ No newline at end of file
diff --git a/md/dev/xnuN2vGmZA0/xnuN2vGmZA0.md b/md/dev/xnuN2vGmZA0/xnuN2vGmZA0.md
new file mode 100644
index 0000000000000000000000000000000000000000..3cf45271bd3de5f8ad18c01cda83690a1c19ac79
--- /dev/null
+++ b/md/dev/xnuN2vGmZA0/xnuN2vGmZA0.md
@@ -0,0 +1,228 @@
+# VITA: Video Instance Segmentation via Object Token Association
+
+Miran Heo⇤ Yonsei University
+
+Sukjun Hwang⇤ Yonsei University
+
+Seoung Wug Oh Adobe Research
+
+Joon-Young Lee Adobe Research
+
+Seon Joo Kim Yonsei University
+
+{miran, sj.hwang, seonjookim}@yonsei.ac.kr
+
+{seoh, jolee}@adobe.com
+
+# Abstract
+
+We introduce a novel paradigm for offline Video Instance Segmentation (VIS), based on the hypothesis that explicit object-oriented information can be a strong clue for understanding the context of the entire sequence. To this end, we propose VITA, a simple structure built on top of an off-the-shelf Transformer-based image instance segmentation model. Specifically, we use an image object detector as a means of distilling object-specific contexts into object tokens. VITA accomplishes video-level understanding by associating frame-level object tokens without using spatio-temporal backbone features. By effectively building relationships between objects using the condensed information, VITA achieves the state-of-the-art on VIS benchmarks with a ResNet-50 backbone: 49.8 AP, 45.7 AP on YouTube-VIS 2019 & 2021, and 19.6 AP on OVIS. Moreover, thanks to its object token-based structure that is disjoint from the backbone features, VITA shows several practical advantages that previous offline VIS methods have not explored - handling long and highresolution videos with a common GPU, and freezing a frame-level detector trained on image domain. Code is available at https://github.com/sukjunhwang/ VITA.
+
+# 1 Introduction
+
+The goal of Video Instance Segmentation (VIS) is to predict both mask trajectories and categories of each object belonging to a set of predefined categories. Numerous studies have attained the goal in a variety of ways, but a notable innovation in terms of accuracy has been achieved by Transformer-based $\mathbb { \left| \left[ 2 \right] \right| }$ architectures. Extending DETR [5] to the video domain, VisTR $\left. \boldsymbol { \widetilde { 2 8 } } \right.$ made the first attempt to design an end-to-end model that jointly predicts object trajectories with their corresponding segmentation masks. By adopting this paradigm, subsequent studies [15, 30, 6, 34] also tackle the problem in a complete-offline manner: video-in and video-out.
+
+The key message from the follow-up approaches [15, 30, 6, 34] is to effectively design core interactions between frames. In parallel with recent studies [11, 25, 37, 7, 22] that improve the accuracy in various tasks by localizing the attention scope of Transformer layers, the subsequent VIS methods suggest bounding the attention scope in the encoder [15, 34] or the decoder $\lVert \rVert ^ { 3 0 \mathrm { j } }$ . Specifically, they decompose the global attention by iteratively mixing two phases: intra-frame attention and inter-frame communication. Interestingly, the temporal interactions between frames are commonly achieved with only a small number of tokens, e.g., memory tokens [15, 34], messenger tokens $\dot { \mathbb { B } } \dot { \mathcal { 4 } } \mathbb { I }$ , and instance queries $\textcircled { \lvert 3 0 \rvert }$ . As a result, the question arises: “what information is important to understand a video?”
+
+
+Figure 1: (a) Early-stage VIS methods divide the problem into two components, detection and association. (b) To alleviate the context-limited structure, complete-offline methods jointly track and segment instances in an end-to-end manner by employing dense spatio-temporal features. (c) On the other hand, our VITA is a new paradigm that directly leverages object queries for offline VIS.
+
+In this paper, we introduce Video Instance Segmentation via Object Token Association (VITA), a new offline VIS paradigm which suggests that a video can be effectively understood from a collection of object-centric tokens. Existing offline methods [28, 15, 30, 6, 34] (Fig. 1 (b)) localize objects in multiple frames by iteratively referring to dense spatio-temporal backbone features. However, such methods show difficulties in handling long sequences as the myriad of dense reference features hinders the Transformer layers from retrieving relevant information. With the motivation to devise an effective method for the long-range understanding, we obtain clues from the traditional trackingby-detection paradigm (Fig. 1 (a)) and make two hypotheses: 1) an image object detector can fully embody the context of an object into a feature vector (or a token); and 2) a video can be represented by the relationship between the objects.
+
+In this regard, VITA aims to parse an input video from the collection of object tokens without the necessity of referencing dense spatio-temporal backbone (Fig. 1 (c)). Given the compactness of the token representation, VITA can collect the object tokens over the whole video and directly analyzes the collection using Transformer layers. This unique design enables the complete-offline inference (i.e., video-in and video-out) even for extremely long videos. This also facilitates building relationships between every detected object and successfully achieves global video understanding. As a result, VITA achieves state-of-the-art performance on various VIS benchmarks.
+
+We evaluate VITA on three popular VIS benchmarks, YouTube-VIS 2019 & 2021 $\lVert \overline { { 3 2 } } \rVert$ and OVIS $\mathbb { [ 2 4 ] }$ . With ResNet-50 [14] backbone, VITA achieves the new state-of-the-arts of 49.8 AP & 45.7 AP on YouTube-VIS 2019 & 2021, and 19.6 AP on OVIS. Above all, VITA outperforms the previous best approaches by 5.1 AP for YouTube-VIS 2021, which contains more complicated and long sequences than YouTube-VIS 2019. VITA is the first offline method that presents the results on OVIS benchmark that consists of long videos (the longest video has 292 frames) using a single 12GB GPU.
+
+In addition to the performance, the design of VITA have several practical advantages over the previous offline VIS methods. It can handle long and high-resolution videos so it does not require heuristics for associating clip-level results. VITA can process 1392 frames at once regardless of video resolution using a single 12GB GPU which is 11 times longer than IFC $\mathbb { \lVert \rVert \cdot \rVert }$ . Moreover, VITA can be trained on top of a parameter-frozen image object detector without sacrificing the performance much. This property is especially useful for the applications that cannot afford to store separated image and video instance segmentation models. VITA takes only $6 \%$ additional parameters to extend the Swin-L detector.
+
+# 2 Related Works
+
+Online VIS approaches first predict individual tracklets within a local range window consisting of a single or a few frames. After obtaining results from adjacent windows, they associate individual tracklets of same identities by a hand-crafted or a learnable matching algorithm. MaskTrack RCNN $\mathbb { \lVert 3 2 \rVert }$ sets the groundwork for VIS research by proposing a simple tracking branch added on a two-stage image instance segmentation model $[ \overbrace { 1 . 3 } ]$ . The methods [4, 33, 21] that follow the tracking-by-detection paradigm (Fig. 1 (a)) measure the similarities between per-frame predictions, then employ an association algorithm.
+
+To deploy temporal context from multiple frames, per-clip methods [1, 2] design an architecture of predicting tracklets within a local window and stitching the tracklets sequentially in a nearonline manner. Propagation-based methods [10, 17, 12] devise a paradigm that conjugates rich previous information stored in memories to facilitate online applications. EfficientVIS $\mathbb { \left[ \left[ 2 9 \right] \right. }$ introduces correspondence learning between adjacent tracklet features and successfully runs in a cascaded manner which eliminates the hand-crafted tracklet association.
+
+
+Figure 2: VITA takes only mask features and frame queries that are independently decoded by the frame-level detector for entire video sequence. By directly constructing temporal interactions between frame queries that encapsulate rich object-aware knowledge in spatial scenes, VITA yields mask trajectories with corresponding categories in an end-to-end manner.
+
+Offline VIS architectures are proposed with the motivation of predicting mask trajectories through a whole video sequence at once. VisTR $\pmb { \left. 2 8 \right. }$ successfully extends DETR $\pmb { \Vert 5 \Vert }$ to the VIS domain, introducing a new paradigm of jointly tracking and segmenting instances. However, its dense selfattention over the spatio-temporal inputs leads to explosive computations and memories. With the motivation of relaxing the heavy computation of VisTR, IFC $[ \bar { 1 } 5 ]$ adopts memory tokens to the Transformer encoder and decodes clip-level object queries. By setting the frame-level encoder to be independent and adopting the decoder of IFC, Mask2Former-VIS $\pmb { \mathbb { H } }$ records considerable performance on benchmarks by taking the advantage of its mask-oriented representation [7]. TeViT [34] proposes a new backbone that efficiently exchanges temporal information internally based on Vision Transformers $\pmb { \mathbb { Q } } \Vert$ instead of the frame-wise CNN backbone. SeqFormer $\textcircled { \vert 3 0 \vert }$ decomposes the decoder to be frame-independent, while building communication between different frames using instance queries that are used for frame-wise detection. All these studies achieve promising performance by referring to dense backbone features (Fig. 1 (b)). On the other hand, our VITA suggests a new offline VIS paradigm that directly interprets a video from the collection of object tokens (Fig. 1 (c)).
+
+Global trackers that aim to associate frame-level predictions across an entire sequence as a whole are studied in the Multiple Object Tracking (MOT) community. Conventional approaches formulate the problem as a graph optimization – interpreting each detection as a node and considering the edges as possible connections between the nodes [35, 26, 3, 8]. Different from existing methods, GTR $[ \breve { \left| 3 6 \right| }$ introduces a Transformer-based architecture that receives queries, then explicitly searches for the predictions with the same identities. Similarly, a recent method [16] proposes a set classifier that classifies the category of each tracklet by globally aggregating information from multiple frames.
+
+# 3 Method
+
+In this section, we first give a brief overview of Mask2Former $ { \mathbb { I } } ^ { \| \ b { 7 } \| }$ , a frame-level detector for VITA.
+Then, we introduce the architecture of our proposed VITA, which is built on top of Mask2Former.
+Finally, we describe how VITA handles extremely long videos in a complete-offline manner.
+
+# 3.1 Frame-level Detector
+
+In this paper, we adopt Mask2Former $\mathbb { H }$ for the frame-level detector which directly localizes instances using masks without the necessity of bounding boxes. Following the set prediction mechanism of DETR $\mathbb { \left[ 5 \right] }$ , the frame-level detector parse an input image $H \times W$ using $N _ { f }$ object queries, which we call frame queries $( f \in \mathbb { R } ^ { C \times N _ { f } } )$ throughout this paper. Having the spatially encoded features to be decoded by the frame queries through a Transformer decoder, each object in the image gets represented as a $C$ -dimensional vector. Then, the frame queries are used for both classifying and segmenting their matched objects where the predictions are also used for auxiliary supervision for VITA. Specifically, the frame-level detector generates two features for the frame-level predictions: 1) dynamic $1 \times 1$ convolutional weight from the frame queries; 2) per-pixel embeddings $\begin{array} { r } { \dot { \mathcal { M } } \in \mathbb { R } ^ { C \times \frac { H } { S } \times \frac { W } { S } } } \end{array}$ from the pixel decoder, where $S$ is the stride of the feature map. Finally, the detector segments objects by applying a simple dot product between the two embeddings.
+
+# 3.2 VITA
+
+We now propose the novel end-to-end video instance segmentation method VITA, which can be largely divided into three phases (Fig. 2). First, VITA operates on top of the frame-level detector [7] in a complete frame-independent manner; no inter-computation between frames is involved. Then, the frame queries that hold object-centric information are collected throughout the whole video and they embed video-level information by building communications between different frames using Object Encoder. Finally, Object Decoder aggregates information from the frame queries to video queries, which are eventually used for predicting categories and masks of objects in videos at once.
+
+Input of VITA. Given an input video of $T$ frames, the frame-level detector executes frame-by-frame as previously explained. Among a number of intermediate embeddings that are generated by the detector, the only features that are used by VITA are 1) frame queries $\bar { \{ f ^ { t } \} } _ { t = 1 } ^ { T } \in \bar { \mathbb { R } } ^ { C \times T \times N _ { f } }$ which hold object-centric information; and 2) per-pixel embeddings $\{ \mathcal { M } ^ { t } \} _ { t = 1 } ^ { T } \in \mathbb { R } ^ { C \times T \times \frac { H } { S } \times \frac { W } { S } }$ from the pixel decoder.
+
+Object Encoder. After the frame-wise detector distills the object-wise context into the frame queries, Object Encoder aims to build temporal communication by employing self-attention along the temporal axis. First, Object Encoder gathers frame queries from all frames and converts them to object tokens through a linear layer. However, a naive self-attention over the whole $T N _ { f }$ object tokens is not applicable when processing long videos due to the quadratic computational overhead of Transformers. Inspired by Swin Transformer $[ [ 2 2 ] ]$ , we adopt window-based self-attention layers that shift along the temporal dimension. As illustrated in Fig. $\begin{array} { r } { \bigtriangledown , } \end{array}$ Object Encoder initially partitions object tokens $\{ \overline { { f } } ^ { t } \} _ { t = 1 } ^ { T }$ to the temporal axis with local windows of size $W$ without an overlap. By alternatively shifting the windows, object tokens from different frames can exchange object-wise information which allows VITA to both effectively and efficiently handle long sequences.
+
+
+Figure 3: Illustration of an Object Encoder layer. Blocks with dashed line are local windows, and indicates an object token.
+
+Object Decoder and Output heads. Two limitations of previous offline VIS methods [28, 15, 6] are the ineffectiveness in handling dynamic scenes and the inability of processing long videos. For example, such methods obtain high accuracy when dealing with static and short videos (YouTubeVIS 2019 $\mathbb { [ 3 2 ] } )$ , but struggle to track objects or executes end-to-end on benchmarks with dynamic and long videos (YouTube-VIS 2021 $\lVert \dot { 3 } 2 \rVert$ and OVIS $\pm \mathbb { Z } 4 \mathbb { I } )$ . Both limitations are mainly caused by the decoder, which parses object contexts directly from dense spatio-temporal features. As recent studies [11, 25, 37] suggest, typical Transformer decoders show difficulties in retrieving relevant information from global context. In the video domain, the number of backbone features being referred to proportionally increases with the number of frames. Therefore, when handling extremely long videos, the countless reference tokens result in both imprecise information retrieval and intractable peak memories.
+
+For the solution to the problem, we suggest Object Decoder which extracts information from the object tokens, not the spatio-temporal backbone features. Implicitly embedding the context of objects, object tokens can provide sufficient instance-specific information without the interference of dense backbone features. Specifically, we employ $N _ { v }$ trainable video queries $\boldsymbol { v } \in \mathbb { R } ^ { C \times N _ { v } }$ to decode objectwise information from all object tokens $\{ f ^ { t } \} _ { t = 1 } ^ { T }$ that are collected from all $T$ frames. Receiving much condensed input over naively taking dense spatio-temporal features, Object Decoder effectively captures video contexts and aggregates relevant information into the video queries. As a result, Object
+
+Decoder shows fast convergence speed while achieving high accuracy. Furthermore, the compact input greatly saves memories, thus facilitates processing long and high-resolution videos.
+
+From the decoded video queries $v$ , VITA returns final predictions $z = \{ ( p _ { i } , m _ { i } ) \} _ { i = 1 } ^ { N _ { v } }$ using two output heads similar to IFC ; the class head and the mask head. The class head is a single linear classifier, which directly predicts class probabilities $p \in \mathbb R ^ { N _ { v } \times ( K + 1 ) }$ of each video query, where $K + 1$ is the number of categories including an auxiliary label “no object” $( \emptyset )$ . The mask head dynamically generates mask embeddings $\boldsymbol { w _ { v } } ^ { \prime } \in \mathbb { R } ^ { C \times N _ { v } }$ per a video query, which corresponds to the tracklet of an instance over all frames. Finally, the predicted mask logits $m \in \mathbb { R } ^ { N _ { v } \times T \times \dot { H } \times W }$ can be obtained from a matrix multiplication between $w _ { v }$ and $\{ \mathcal { M } ^ { t } \} _ { t = 1 } ^ { T }$ .
+
+# 3.3 Clip-wise losses
+
+Instance matching. We search for optimal pair indices between the predictions from VITA and $G _ { v }$ ground-truth to remove postprocessing heuristics such as NMS. First, we calculate costs from all possible pairs using the cost function of Mask2Former $\mathbb { H }$ with a simple extension of mask-related costs to the temporal axis $\mathbb { \left[ 1 5 \right] }$ . Then, from $N _ { v } { \times } G _ { v }$ costs of pairs, we follow DETR $\pmb { \Vert 5 \Vert }$ and use Hungarian algorithm $\pm \textcircled { 1 1 8 } \textcircled { 1 }$ for the optimal matching as shown in Fig. 4 (b).
+
+Similarity loss. Inspired by the initial VIS approach (MaskTrack R-CNN $[ \left| 3 2 \right| ]$ where the similarity loss is adopted to track instances at different frames, we train video queries and frame queries to be clustered in the latent space by their identities. As shown in Fig. $\textcircled { 4 }$ (a), our adopted frame-level detector $\mathbb { [ [ \big ] ] }$ also searches for paired indices be
+
+
+Figure 4: Similarity loss. $\bigcirc$ and $\sqcap$ indicate video query and frame query, respectively. Same color represents same GT instance ID.
+
+tween $N _ { f }$ frame-wise predictions and $G _ { f } ^ { t }$ ground-truth objects at each $t ^ { \mathrm { { t h } } }$ frame. The frame queries and the video queries that are matched to ground-truths get collected and we embed the collection through a linear layer. Then, we measure the similarity of all possible pairs using a simple matrix multiplication. Finally, as shown in Fig. $\boxed { 4 }$ (c), binary cross entropy is used to compute $\mathcal { L } _ { s i m }$ between the predicted similarities and the ground-truth where annotated to 1 for pairs of equal identities and 0 for vice-versa.
+
+Total loss. We attach the proposed module VITA on top of the frame-level detector, and all components of the model get trained end-to-end. Note that not only video-level outputs from VITA are used for the loss computation, but also per-frame outputs from the frame-level detector get involved. Specifically, we use $\mathcal { L } _ { f }$ from $\mathbb { I } \mathbb { I }$ to calculate loss from the per-frame outputs to frame-wise ground-truth. Extending the loss function of $\mathbb { [ [ \big ] ] }$ to the temporal axis as similar to $\bar { \mathbb { E } } \bar { \ b { 5 } } \|$ , we use outputs from VITA $z$ to calculate the video-level loss $\mathcal { L } _ { v }$ . Finally, we integrate all losses together as follows: $\mathcal { L } _ { t o t a l } = \lambda _ { v } \mathcal { L } _ { v } + \lambda _ { f } \mathcal { L } _ { f } + \lambda _ { s i m } \mathcal { L } _ { s i m }$ .
+
+# 4 Experiments
+
+# 4.1 Datasets
+
+YouTube-VIS 2019. YouTube-VIS 2019 $\pmb { \mathbb { B 2 } }$ is the first dataset proposed for VIS and contains 40 semantic categories. Mostly originated from Video Object Segmentation (VOS) datasets, the VIS benchmark has a small number of unique instances (average 1.7 per video for the train set) and the categories of instances appearing in the same video are different in general. Also, the average length of videos in the valid set is short (27.4 frames), which enables existing complete-offline approaches to load a whole video and infer the benchmark at once.
+
+Table 1: Comparisons on YouTube-VIS 2019.
+
+
Method Backbone
AP AP50 AP75 AR1 AR10
NNTai (rer)
MaskTrackR-CNNB2MaskTrackR-CNN32Cross VIS [33]Cross VIS [33]PCAN日PCAN日EfficientVIS四EfficientVIS29VISOLO四
+
+YouTube-VIS 2021. In order to address more difficult scenarios, additional videos are included in YouTube-VIS2021 (794 videos for training and 129 videos for validation). In particular, a greater number of objects with confusing trajectories has been added (average 3.4 per video for the additional videos in the train set). However, the average length of the additional validation videos is still 39.7 frames, which is not significantly increased compared to YouTube-VIS 2019.
+
+OVIS. Under the same definition as YouTube-VIS, OVIS $\pmb { \Vert 2 4 \Vert }$ specifically aims to tackle objects with heavy occlusions that are belonging to 25 semantic categories. In addition to the heavily occluded situation, OVIS has three challenging characteristics that are distinct from the YouTube-VIS datasets. First, although it has fewer categories than YouTube-VIS, much more instances appear in a single video (average 5.9 per video for the train set). Second, the instances with the same categories in the same video have almost similar appearances, thus approaches that rely heavily on visual cues often struggle to predict accurate trajectories. Finally, the average length of videos for the valid set is 62.7 frames (the longest video has 292 frames) which is much longer than that of YouTube-VIS. Therefore, not only do previous approaches show relatively low accuracy, but all existing complete-offline VIS methods are not feasible to infer OVIS without hand-crafted association algorithms.
+
+# 4.2 Implementation Details
+
+Our method is implemented on top of detectron2 $\textcircled { \scriptsize { 1 3 1 } }$ . All hyper-parameters regarding the framelevel detector are equal to the defaults of Mask2Former [7]. The total loss $\mathcal { L } _ { t o t a l }$ is balanced with $\lambda _ { v }$ $\lambda _ { f }$ , and $\lambda _ { s i m }$ where 1.0, 1.0, and 0.5, respectively. By default, Object Encoder is composed of three layers with the window size $W = 6$ , and Object Decoder employs six layers with $N _ { v } = 1 0 0$ video queries. Having VITA built on top of Mask2Former, we first train our model on the COCO $\left[ \left[ 2 0 \right] \right]$ dataset following Mask2Former. Then, we train our method on the VIS datasets $\pm \pm \pm \pm \pm \pm$ simultaneously with pseudo videos generated from images $\left[ \left[ 2 0 \right] \right]$ following the details of SeqFormer $\textcircled { \lvert 3 0 \rvert }$ . During inference, each frame is resized to a shorter edge size of 360 and 448 pixels when using ResNet [14] and Swin $[ [ 2 2 ] ]$ backbones, respectively. Note that all reported scores in main results and ablation studies are the mean of five runs, and we use the standard ResNet-50 [14] for the backbone unless specified.
+
+Table 2: Comparisons with ResNet-50 backbone on YouTube-VIS 2021 and OVIS. $\dagger$ indicates using MsgShifT backbone. $\ddagger$ indicates using Swin-L $[ [ 2 2 ] ]$ backbone.
+
+
Method
YouTube-VIS 2021
OVIS
AP
AP50
AP75
AR1
AR10
AP
AP50
AP75
AR1
AR10
MaskTrack R-CNN 32]
28.6
48.9
29.6
26.5
33.8
10.8
25.3
8.5
7.9
14.9
CMaskTrack R-CNN [23]
-
=
=
=
-
15.4
33.9
13.1
9.3
20.0
STMask [19]
31.1
50.4
33.5
26.9
35.6
15.4
33.8
12.5
8.9
21.3
Cross VIS [33]
34.2
54.4
37.9
30.4
38.2
14.9
32.7
12.1
10.3
19.8
IFC [5]
35.2
55.9
37.7
32.6
42.9
1
1
1
1
1
VISOLO [12]
36.9
54.7
40.2
30.6
40.9
15.3
31.0
13.8
11.1
21.7
TeViTt B4]
37.9
61.2
42.1
35.1
44.6
17.4
34.9
15.0
11.2
21.8
SeqFormer[ 眉
40.5
62.4
43.7
36.1
48.1
-
1
1
-
1
Mask2Former-VIS 回
40.6
60.9
41.8
-
1
1
-
1
1
1
VITA (Ours)
45.7
67.4
49.5
40.9
53.6
19.6
41.2
17.4
11.7
26.0
SeqFormert [30]
51.8
74.6
58.2
42.8
58.1
-
1
1
1
-
Mask2Former-VIS‡ 回
52.6
76.4
57.2
-
-
1
1
1
1
1
VITA (Ours)‡
57.5
80.6
61.0
47.7
62.6
27.7
51.9
24.9
14.9
33.0
+
+# 4.3 Main Results
+
+Using the popular VIS benchmarks – YouTube-VIS 2019 & 2021 $\pmb { \Vert 3 2 } \Vert$ and OVIS [24] – we compare VITA with state-of-the-art approaches following the standard evaluation metric [32].
+
+YouTube-VIS 2019. Tab. 1 shows the comparison on YouTube-VIS 2019 dataset with backbones of both CNN-based (ResNet-50 and 101 [14]) and Transformer-based (Swin-L $\pmb { \mathbb { L 2 } } \mathbf { \mathbb { I } }$ ). Offline methods can take two advantages over (near) online approaches: 1) they have a greater receptive field to the temporal axis, and 2) they can avoid error propagation derived from hand-crafted association algorithms. As a result, the tendency of offline methods with higher accuracy is clearly shown in the table. Among the competitive offline models, our VITA sets a new state-of-the-art of 49.8 AP and 51.7 AP using CNN backbones, ResNet-50 and ResNet-101 respectively. In addition, with Swin-L backbone, VITA achieves 63.0 AP outperforming all existing VIS methods.
+
+YouTube-VIS 2021. We compare VITA with state-of-the-art methods on YouTube-VIS 2021 benchmark in Tab. 2. Note that the longest video in the valid set has 84 frames, thus previous offline methods [15, 30, 6] can infer videos at once with GPUs with large memories. Above all, VITA achieves the highest accuracy, 45.7 AP, which outperforms the previous state-of-the-art approach [6] with a huge margin of 5.1 AP. Considering the accuracy gap on YouTube-VIS 2019, the results demonstrate that VITA can effectively handle tricky scenarios, e.g., numerous unique instances with confusing trajectories. We hypothesize that the object-oriented design of VITA is more effective than typical dense Transformer decoders in addressing such challenging scenes.
+
+OVIS. In Tab. 2, we demonstrate the competitiveness of VITA on the challenging OVIS benchmark. Due to the considerable lengths of videos – the longest video has 292 frames – existing offline approaches [28, 15, 34, 30, 6] cannot process OVIS benchmark in their original design: video-in and video-out. To the best of our knowledge, VITA is the first complete-offline approach to evaluate on OVIS valid set. Thanks to its object token-based structure which is disjoint from backbone features, VITA can process the benchmark without any hand-crafted association algorithm. Moreover, VITA sets a new state-of-the-art performance of 19.6 AP, demonstrating the potential of the complete-offline pipeline in long and complicated scenes.
+
+Table 3: Impact of local windows of varying sizes in Object Encoder.
+
+
W
AP
AP50
AP75
AR1
AR10
3
49.4
72.2
54.4
48.6
60.9
6
49.8
72.6
54.5
49.4
61.0
12
50.0
73.0
54.7
49.0
60.8
All
50.1
72.4
54.7
49.0
60.6
+
+Table 5: Use of different heuristic association algorithms on OVIS valid set.
+
+
Length
Algorithm
AP
AP50
AP75
36
Greedy Hungarian
18.8 18.4
39.4 38.9
17.1 16.3
48
Greedy Hungarian
18.8 19.1
39.0 39.1
17.1 17.4
All
None
19.6
41.2
17.4
+
+Table 4: Maximum number of frames that can be processed at once using a single Titan XP.
+
+
Method
Max Frames360 × 640 720×1280
VisTR [28]IFC园Mask2Former-VIS回
46 12123 3881 20
W=3VITA(Ours) W=6W = 12
26771392741
+
+Table 6: Pruning tokens by different ratios $r$
+
+
r
一 AP
AP50
AP75
AR1
AR10
1.0
49.8
72.6
54.5
49.4
61.0
0.75
49.7
72.5
54.4
48.7
61.0
0.5
48.9
72.1
52.0
48.3
60.9
0.25
48.1
71.6
51.6
47.4
59.8
+
+# 4.4 Ablation Studies
+
+We provide a series of ablation studies using a ResNet-50 [14] backbone. All experiments are conducted on YouTube-VIS 2019 $\pmb { \mathbb { \left[ \left| 3 2 \right| \right] } }$ valid set except for Tab. 5 with OVIS [24] valid set.
+
+Attention window size. Tab. $\bigstar$ shows the performance of VITA with varying sizes of shifted attention window $W$ in Object Encoder during inference. The larger the window, the greater the receptive field for the temporal axis in Object Encoder. The results suggest that larger window sizes utilize information from multiple frames, which helps Object Encoder understand the context of objects in videos. We set $W = 6$ considering a trade-off between performance and inference scalability.
+
+Maximum number of frames. In Tab. $\boxed { 4 }$ we calculate the maximum number of frames that VITA can handle with respect to the various window sizes $W$ , and compare it with existing complete-offline VIS methods. To take into account the general environment, all results are computed using a single 12GB Titan XP GPU. As shown in results, existing methods have limitations in processing long videos in a video-in and video-out manner. Clearly, the bottleneck of VisTR $\pmb { \left. 2 8 \right. }$ is the encoder, where the full spatio-temporal self-attention leads to a tremendous memory usage. IFC $\mathbb { \left. \overline { { \Omega } } \right. }$ alleviates the computation of VisTR $\pmb { \left. 2 8 \right. }$ , achieving a higher number of input frames. However, IFC makes use of a typical Transformer decoder that visits all dense spatio-temporal features. Therefore, IFC cannot infer the OVIS $ { \mathbb { 1 2 4 } }$ benchmark at once which contains a video of 292 frames. The problem gets aggravated in Mask2Former-VIS $\pmb { \mathbb { H } }$ as the scope of the decoder is extended to multiple feature levels $\textcircled { 7 }$ . On the other hand, VITA presents considerable frame numbers that can be inferred completely offline. Furthermore, VITA is independent from input frame resolutions as each frame gets summarized into compact object tokens. With input resolution of $3 6 0 \times 6 4 0$ and $W = 6$ , the maximum length of sequence that VITA is able to process in complete-offline is about $I I \times$ longer than IFC [15].
+
+Heuristic clip association. Tab. $\boxed { 5 }$ shows the results on OVIS valid set of splitting a video into shorter clips and associating clip-wise predictions through heuristic matching. The length of the clip is set to be less than the average length of videos of OVIS valid set (62.7). Then, we associate outputs from different clips using mask IoU score as the matching cost. We test with two matching algorithms: Greedy and Hungarian. As shown in Tab. $\boxed { 5 }$ VITA demonstrates the best performance on the complete-offline inference that use all the video frames at once.
+
+Pruning Tokens. In Tab. $^ { 6 , }$ we investigate the effects of removing redundant frame queries. From a collection of frame queries, VITA understands the overall context of the given clip. As only a small portion of the collection is matched to foreground objects, the number of total input frame queries can be reduced. First, for each frame, we sort frame queries in ascending order by the “no object” $( \emptyset )$ probability. Then, we keep only top $r N _ { f }$ queries from the sorted list where $r$ is the ratio, and discard the rest. The accuracy with respect to the ratio $r$ is as shown in Tab. 6.
+
+
+Figure 5: Train speed comparison with Mask2Former-VIS $\textcircled { 6 }$ . $\dagger$ indicates the same training setup with VITA.
+
+Table 7: Results on YouTube-VIS 2019 with freezing detector pretrained on COCO.
+
+
Backbone
Freeze
AP
AP50
AP75
AR1
AR10
ResNet-50
厂
49.8 40.9
72.6 61.9
54.5 44.6
49.4 43.1
61.0 53.1
ResNet-101
51.9
75.4
57.0
49.6
59.1
1
43.2
64.4
48.7
46.1
55.9
Swin-L
63.0
86.9
67.9
56.3
68.1
1
53.4
75.9
58.7
51.9
64.3
+
+By setting the ratio $r = 0 . 7 5$ , the accuracy of VITA shows only a marginal degradation in the accuracy $( - 0 . 1$ AP). This signifies that VITA focuses more on the foreground contexts that are embedded in the frame queries. Meanwhile, as the quadratic computation in Clip Encoder can be alleviated, VITA can process a much greater number of frames; using the ratio $r = 0 . 7 5$ , the maximum frame number increases from 1392 (Tab. 4) to 2635.
+
+Convergence speed and Similarity loss. Fig. $5$ validates our claim of the faster convergence speed and the effectiveness of the proposed Similarity loss. For a fair comparison, we report average scores and standard deviations of five runs, each trained without pseudo videos, same as Mask2FormerVIS [6]. Thanks to its object-centric design, VITA shows faster convergence than Mask2Former-VIS. Furthermore, the use of Similarity loss leads to an additional accuracy gain of 1.8 AP. The results demonstrate that the loss mitigates the discrepancies between the embeddings of equal identities, leading to better performance.
+
+Frozen frame-level detector. In Tab. $\bigstar$ we demonstrate the performance of VITA where the frame-level detector is completely frozen. Specifically, while VITA gets trained on YouTube-VIS 2019, the frame-level detector $\dot { \bigtriangledown } \mathbb { I }$ does not get updated from pretrained weights on COCO $\left[ \left[ 2 0 \right] \right]$ . Note that among 40 categories in YouTube-VIS 2019 dataset, only 20 categories overlap with the categories of COCO. Interestingly, though the frame-level detector remains completely frozen, VITA achieves compelling results with various backbones. As shown in Tab. 1 and Tab. $\textcircled { 7 }$ VITA presents a huge practicality as it surpasses all online approaches on top of the ResNet-50 backbone. This strategy can be beneficial in various scenarios: 1) when the accuracy of image instance segmentation should be kept while extending the network to the video domain, and 2) when having limited time and GPUs to train models. The strategy can be especially useful in mobile applications that have scarce storage for keeping two separate network parameters for image instance segmentation and video instance segmentation. With additional $6 \%$ parameters, VITA successfully extends the frozen Swin-L based frame-level detector to the video domain and it achieves great accuracy.
+
+We also provide a brief discussion of our understanding for the large gap in AP. Compared to COCO, we observe that YouTube-VIS dataset is annotated with only a few salient objects as foregrounds. Having weights of the frame-level detector frozen to COCO, the detector cannot adapt to the YouTubeVIS domain and it embeds and interprets more objects in scenes as foregrounds. Therefore, VITA outputs more predictions as a foreground category even if such predictions are not labeled as groundtruths in YouTube-VIS. As a result, it leads to a lower average precision as it comes out with more false positive predictions. On the contrary, the more false positive predictions only slightly affect AR.
+
+Qualitative Results. We provide some visualizations of the predictions from VITA and frame-level detector in Fig. $6 .$ The qualitative results show that VITA leads to better video instance segmentation qualities compared to the frame-level detector. Specifically, the frame-level detector mistakenly interprets in to recognize either category or mask of instances that have been largely occluded, while our method successfully recovers it by leveraging the temporal information.
+
+
+Figure 6: Visualization of predictions from the frame-level detector and VITA. Instances with the same identity are displayed in the same color.
+
+# 5 Limitations
+
+VITA has achieved high performance in the complete-offline paradigm while dramatically improving the number of input frames that can be processed at once. However, there are two major limitations for the ultimate long video understanding. First, the current architecture still has limitations in processing an infinite number of frames. In addition, since object tokens do not explicitly utilize temporal information, they may have difficulties in identifying complex behaviors that span over very long sequences. We believe that devising explicit designs to address these issues will be a promising future direction.
+
+# 6 Conclusion
+
+In this paper, we proposed VITA for offline Video Instance Segmentation. VITA is a simple model built on top of the off-the-shelf image instance segmentation model [7]. Unlike existing offline methods, VITA directly leverages object queries decoded by independent frame-level detectors. We demonstrated that deploying object-oriented information is not only effective in improving performance, but also has robust practicality for processing long and high-resolution videos - setting state-of-the-art on popular VIS benchmarks, e.g., YouTubeVIS-2019 & 2021 and OVIS. Moreover, since VITA is designed to absorb spatial knowledge purely from image object detector, it shows fast convergence and demonstrates competitive performance even if trained on frozen detectors. We hope that our method extends the scope of offline VIS research beyond benchmarks to real-world applications.
+
+# Acknowledgements
+
+This work has partly supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (NRF2022R1A2C2004509) and by Institute of Information communications Technology Planning Evaluation (IITP) grant funded by the Korea government (MSIT) (No. 2022-0-00113, Developing a Sustainable Collaborative Multi-modal Lifelong Learning Framework), and Artificial Intelligence Graduate School Program under Grant 2020-0-01361.
+
+# Broader Impact
+
+VITA is designed for the VIS task and focuses on processing long and high-resolution videos in an end-to-end manner while achieving the state-of-the-art performance. We hope that VITA can have a positive impact on many industrial areas such as video editing applications. We would like to note that research on VIS must be aware of potential misuse that violates personal privacy.
+
+Licenses of COCO $[ \pmb { \big | 2 0 } ]$ , YouTube-VIS [32], OVIS [24], and detectron2 [31]: Attribution 4.0 International, CC BY 4.0, CC BY-NC-SA 4.0, and Apache-2.0, respectively.
+
+References
+[1] Ali Athar, Sabarinath Mahadevan, Aljoša Ošep, Laura Leal-Taixé, and Bastianan Leibe. Stemseg: Spatio-temporal embeddings for instance segmentation in videos. In ECCV, 2020.
+[2] Gedas Bertasius and Lorenzo Torresani. Classifying, segmenting, and tracking object instances in video with mask propagation. In CVPR, 2020.
+[3] Guillem Brasó and Laura Leal-Taixé. Learning a neural solver for multiple object tracking. In CVPR, 2020.
+[4] Jiale Cao, Rao Muhammad Anwer, Hisham Cholakkal, Fahad Shahbaz Khan, Yanwei Pang, and Ling Shao. Sipmask: Spatial information preservation for fast image and video instance segmentation. In ECCV, 2020.
+[5] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, 2020.
+[6] Bowen Cheng, Anwesa Choudhuri, Ishan Misra, Alexander Kirillov, Rohit Girdhar, and Alexander G Schwing. Mask2former for video instance segmentation. arXiv preprint arXiv:2112.10764, 2021.
+[7] Bowen Cheng, Ishan Misra, Alexander G Schwing, Alexander Kirillov, and Rohit Girdhar. Masked-attention mask transformer for universal image segmentation. In CVPR, 2022.
+[8] Peng Dai, Renliang Weng, Wongun Choi, Changshui Zhang, Zhangping He, and Wei Ding. Learning a proposal classifier for multiple object tracking. In CVPR, 2021.
+[9] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
+[10] Yang Fu, Linjie Yang, Ding Liu, Thomas S Huang, and Humphrey Shi. Compfeat: Comprehensive feature aggregation for video instance segmentation. In AAAI, 2021.
+[11] Peng Gao, Minghang Zheng, Xiaogang Wang, Jifeng Dai, and Hongsheng Li. Fast convergence of detr with spatially modulated co-attention. In ICCV, 2021.
+[12] Su Ho Han, Sukjun Hwang, Seoung Wug Oh, Yeonchool Park, Hyunwoo Kim, Min-Jung Kim, and Seon Joo Kim. Visolo: Grid-based space-time aggregation for efficient online video instance segmentation. In CVPR, 2022.
+[13] Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross Girshick. Mask r-cnn. In ICCV, 2017.
+[14] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
+[15] Sukjun Hwang, Miran Heo, Seoung Wug Oh, and Seon Joo Kim. Video instance segmentation using inter-frame communication transformers. In NeurIPS, 2021.
+[16] Sukjun Hwang, Miran Heo, Seoung Wug Oh, and Seon Joo Kim. Cannot see the forest for the trees: Aggregating multiple viewpoints to better classify objects in videos. In CVPR, 2022.
+[17] Lei Ke, Xia Li, Martin Danelljan, Yu-Wing Tai, Chi-Keung Tang, and Fisher Yu. Prototypical cross-attention networks for multiple object tracking and segmentation. In NeurIPS, 2021.
+[18] Harold W Kuhn. The hungarian method for the assignment problem. In Naval research logistics quarterly, 1955.
+[19] Minghan Li, Shuai Li, Lida Li, and Lei Zhang. Spatial feature calibration and temporal fusion for effective one-stage video instance segmentation. In CVPR, 2021.
+[20] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C. Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, 2014.
+[21] Dongfang Liu, Yiming Cui, Wenbo Tan, and Yingjie Chen. Sg-net: Spatial granularity network for one-stage video instance segmentation. In CVPR, 2021.
+[22] 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, 2021.
+[23] Jiyang Qi, Yan Gao, Yao Hu, Xinggang Wang, Xiaoyu Liu, Xiang Bai, Serge Belongie, Alan Yuille, Philip HS Torr, and Song Bai. Occluded video instance segmentation. arXiv preprint arXiv:2102.01558, 2021.
+[24] Jiyang Qi, Yan Gao, Yao Hu, Xinggang Wang, Xiaoyu Liu, Xiang Bai, Serge Belongie, Alan Yuille, Philip HS Torr, and Song Bai. Occluded video instance segmentation: Dataset and iccv 2021 challenge. In NeurIPS Track on Datasets and Benchmarks, 2021.
+[25] Zhiqing Sun, Shengcao Cao, Yiming Yang, and Kris M Kitani. Rethinking transformer-based set prediction for object detection. In ICCV, 2021.
+[26] Siyu Tang, Mykhaylo Andriluka, Bjoern Andres, and Bernt Schiele. Multiple people tracking by lifted multicut and person re-identification. In CVPR, 2017.
+[27] 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.
+[28] Yuqing Wang, Zhaoliang Xu, Xinlong Wang, Chunhua Shen, Baoshan Cheng, Hao Shen, and Huaxia Xia. End-to-end video instance segmentation with transformers. In CVPR, 2020.
+[29] Jialian Wu, Sudhir Yarram, Hui Liang, Tian Lan, Junsong Yuan, Jayan Eledath, and Gerard Medioni. Efficient video instance segmentation via tracklet query and proposal. In CVPR, 2022.
+[30] Junfeng Wu, Yi Jiang, Wenqing Zhang, Xiang Bai, and Song Bai. Seqformer: a frustratingly simple model for video instance segmentation. In ECCV, 2022.
+[31] Yuxin Wu, Alexander Kirillov, Francisco Massa, Wan-Yen Lo, and Ross Girshick. Detectron2. https://github.com/facebookresearch/detectron2, 2019.
+[32] Linjie Yang, Yuchen Fan, and Ning Xu. Video instance segmentation. In ICCV, 2019.
+[33] Shusheng Yang, Yuxin Fang, Xinggang Wang, Yu Li, Chen Fang, Ying Shan, Bin Feng, and Wenyu Liu. Crossover learning for fast online video instance segmentation. In ICCV, 2021.
+[34] Shusheng Yang, Xinggang Wang, Yu Li, Yuxin Fang, Jiemin Fang, Wenyu Liu, Xun Zhao, and Ying Shan. Temporally efficient vision transformer for video instance segmentation. In CVPR, 2022.
+[35] Li Zhang, Yuan Li, and Ramakant Nevatia. Global data association for multi-object tracking using network flows. In CVPR, 2008.
+[36] Xingyi Zhou, Tianwei Yin, Vladlen Koltun, and Phillip Krähenbühl. Global tracking transformers. In CVPR, 2022.
+[37] Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. In ICLR, 2021.
\ No newline at end of file
diff --git a/md/dev/xozJw0kZXF/xozJw0kZXF.md b/md/dev/xozJw0kZXF/xozJw0kZXF.md
new file mode 100644
index 0000000000000000000000000000000000000000..d6c4af618f1e368926f05d115008e73798eda82c
--- /dev/null
+++ b/md/dev/xozJw0kZXF/xozJw0kZXF.md
@@ -0,0 +1,340 @@
+# Evaluating Object Hallucination in Large Vision-Language Models
+
+Yifan Li1,3∗, Yifan $\mathbf { D } \mathbf { u } ^ { 1 , 3 }$ ∗, Kun Zhou2∗, Jinpeng Wang 4, Wayne Xin Zhao2,3† and Ji-Rong Wen1, 2,3 1Gaoling School of Artificial Intelligence, Renmin University of China 2School of Information, Renmin University of China. 3Beijing Key Laboratory of Big Data Management and Analysis Methods 4Meituan Group {liyifan0925, yifandu1999, batmanfly}@gmail.com, francis_kun_zhou@163.com, wangjinpeng04@meituan.com, jrwen@ruc.edu.cn
+
+# Abstract
+
+Inspired by the superior language abilities of large language models (LLM), large visionlanguage models (LVLM) have been recently proposed by integrating powerful LLMs for improving the performance on complex multimodal tasks. Despite the promising progress on LVLMs, we find that they suffer from object hallucinations, i.e., they tend to generate objects inconsistent with the target images in the descriptions. To investigate it, this work presents the first systematic study on object hallucination of LVLMs. We conduct the evaluation experiments on several representative LVLMs, and show that they mostly suffer from severe object hallucination issues. We further discuss that the visual instructions may influence the hallucination, and find that: objects that frequently appear in the visual instructions or co-occur with the image objects are obviously prone to be hallucinated by LVLMs. Besides, we further design a polling-based query method called $P O P E$ for better evaluation of object hallucination. Experiment results show that our POPE can evaluate object hallucination in a more stable and flexible way.
+
+# 1 Introduction
+
+Large language models (LLMs) (Zhao et al., 2023) have shown remarkable abilities to solve various complex tasks by following human instructions in a zero-shot manner. The success of LLMs drives the researchers to devise more powerful multimodal models based on the superior capacity of LLMs, to enhance the understanding of visual semantics (Alayrac et al., 2022; Li et al., 2023b). As an exemplified work, GPT-4 (OpenAI, 2023) has exhibited the exciting performance of LLMs on multimodal tasks and scenarios.
+
+Following this line of research, a surge of studies (Zhu et al., 2023; Gao et al., 2023; Li et al.,
+
+2023a) have been proposed to enhance the visionlanguage pre-trained model (VLPM) (Gan et al., 2022) by incorporating powerful LLMs (Touvron et al., 2023; Chiang et al., 2023), which are called large vision-language model (LVLM). Typically, existing work reuses the visual encoder in VLPMs to handle image data, while replacing the original language encoder with LLMs. After vision-language pre-training (Alayrac et al., 2022; Li et al., 2022b) and visual instruction tuning (Liu et al., 2023), LVLMs can fulfill complex tasks according to human instructions, demonstrating strong capacities in solving various vision-language tasks, e.g., image captioning (Ordonez et al., 2011; Hodosh et al., 2015; Sharma et al., 2018; Agrawal et al., 2019) and visual question answering (Antol et al., 2015a; Zhang et al., 2016; Goyal et al., 2017).
+
+Despite the success of LVLMs, previous work has revealed that their main components, i.e., LLMs and VLPMs, both suffer from hallucination. Especially, LLMs tend to hallucinate unintended text (Huang et al., 2021; Bang et al., 2023), and VLPMs might generate nonexistent objects in the image (Biten et al., 2022) (termed as object hallucination). It is generally believed that the hallucination would degrade the model performance and greatly harm the user experiences in real-world applications (MacLeod et al., 2017; Ji et al., 2022). Therefore, it is natural to ask the question: does hallucination still exist in LVLMs? In this paper, we systematically evaluate the issue of object hallucination in existing LVLMs, which refers to generating contents that are inconsistent with ground-truth objects in the given image.
+
+To conduct our study, we first use the CHAIR (Caption Hallucination Assessment with Image Relevance) metric (Rohrbach et al., 2018), and examine the hallucination degree of several representative LVLMs on the MSCOCO dataset. Our preliminary experiments (Table 1) show that most of LVLMs severely suffer from object hallucination, and are even more prone to hallucinate than small vision-language models. Besides, we find that the existing object hallucination evaluation method may not be best suited for LVLMs and further propose a Polling-based Object Probing Evaluation (POPE) method. The basic idea is to convert the evaluation of hallucination into a binary classification task by prompting LVLMs with simple Yes-or-No short questions about the probing objects (e.g., Is there a car in the image?). We show that such a method is more stable and flexible. Besides, by using different object sampling strategies, we validate that existing LVLMs are prone to hallucinate objects which frequently appear or co-occur in the visual instruction dataset.
+
+
+Figure 1: Cases of object hallucination in LVLMs. Bold objects are ground-truth objects in the annotations and red objects are hallucinated objects by LVLMs. The left case is from the traditional instruction-based evaluation method, and the right cases are from three variants of POPE.
+
+Our main contributions are as follows: (1) We conduct an empirical study on object hallucination for several representative LVLMs and find that they are highly affected by object hallucination. (2) We discuss the potential reasons behind this promblem, e.g., LVLMs tend to generate frequently appearing or co-occurring objects in the instruction corpora. (3) We propose an object hallucination evaluation approach called POPE, which is more stable and can be easily extended to unannotated datasets.
+
+# 2 Background
+
+# 2.1 Large Vision-Language Model
+
+Since LLMs have been shown to be general task solvers in a zero-shot/few-shot manner, a number of studies are devoted to improving VLPM by integrating powerful LLMs for more accurate language understanding and generation (Zhu et al., 2023; Liu et al., 2023; Dai et al., 2023a). In this paper, we refer to the enhanced VLPMs with the integration of LLMs as Large Vision-Language Models (LVLM).
+
+Generally speaking, an LVLM consists of a vision encoder, a language encoder (i.e., an LLM), and a cross-modal alignment network. The training of LVLMs is generally composed of three major steps. First, a vision encoder and a language encoder are pre-trained on large-scale unimodal data (i.e., image and text data, respectively). Second, these two encoders are aligned through image-text alignment pre-training, which enables the LLM to generate a meaningful caption for a given image. Third, the aligned model is further fine-tuned on image-text instructions, so that it can generate satisfactory answers $w . r . t .$ . to a natural language question regarding a specific image. Note that in the second and third steps, we can optionally finetune different components instead of performing full-parameter fine-tuning.
+
+Once the visual encoder and the LLM are well aligned, the derived LVLM can demonstrate a superior visual understanding ability. It can not only grasp the visual semantics of objects in the image, but also deeply understand the linguistic semantics for these objects by leveraging the parametric knowledge in the LLM. Further, the LVLM can perform complex reasoning over the related concepts about these objects, thus achieving an improved performance on a variety of multimodal tasks, e.g., visual question answering (VQA).
+
+# 2.2 Object Hallucination
+
+Although LVLMs are powerful in solving visionlanguage tasks, they also suffer from the issue of object hallucination as VLPMs. In the literature of computer vision field (Rohrbach et al., 2018; Biten et al., 2022), object hallucination refers that the model generating descriptions or captions that contain objects which are inconsistent with or even absent from the target image. In general, object hallucination can be defined at different semantic levels. The most straightforward way is to define it over the object level, while more finegrained definitions might be concerned with the attributes or characteristics of objects. In this work, we focus on coarse-grained object hallucinations in the model-generated captions and leave finegrained object hallucinations such as the number, attributes, and positions of the object for future work. We present an example of object hallucination in Figure 1, where the hallucinated object “meat bowl”,“bottle”, “beverage”, “condiment” are generated by the underlying LVLMs.
+
+The hallucination phenomenon hinders the safe use of LVLMs in real-world deployment, as it may result in unexpected consequences caused by these hallucinated objects (MacLeod et al., 2017). For example, due to an incorrect understanding of the external environment, an autonomous driving system would make wrong decisions when encountering unexpected events, which might lead to serious safety issues. In order to mitigate these issues, this work aims to study how object hallucination exists in LVLMs from an evaluation perspective.
+
+# 3 Object Hallucination in LVLMs
+
+In this section, we evaluate the object hallucination problem in popular LVLMs using an existing method. We first introduce the evaluation settings and then analyze the experimental results.
+
+# 3.1 Evaluation Settings
+
+Caption Hallucination Assessment with Image Relevance (CHAIR) (Rohrbach et al., 2018) is a popular metric for evaluating object hallucination in image captioning tasks. Given the ground truth objects in the image, CHAIR calculates the proportion of objects that appear in the caption but not the image. Existing work commonly adopts its two variants, i.e., $\mathrm { C H A I R } _ { I }$ and $\mathrm { C H A I R } _ { S }$ , which evaluate the hallucination degree at the object instance level and sentence level respectively. They can be formulated as:
+
+$$
+\mathrm { C H A I R } _ { I } = \frac { \left| \left\{ \mathrm { h a l l u c i n a t e d o b j e c t s } \right\} \right| } { \left| \left\{ \mathrm { a l l m e n t i o n e d o b j e c t s } \right\} \right| } ,
+$$
+
+$$
+\mathrm { C H A I R } _ { S } = \frac { \left| \left\{ \mathrm { c a p t i o n s ~ w i t h ~ h a l l u c i n a t e d ~ o b j e c t s } \right\} \right| } { \left| \left\{ \mathrm { a l l ~ c a p t i o n s } \right\} \right| } .
+$$
+
+Table 1: Results of CHAIR on VLPMs and LVLMs. $I _ { 1 }$ denotes “Generate a short caption of the image” and $I _ { 2 }$ denotes “Provide a brief description of the given image”. Len refers to the average length of generated captions. The results of VLPMs (OSCAR, VinVL, BLIP, and OFA) are collected from Dai et al. (2023b). The best results in each block are denoted in bold.
+
+
I
Model
CHAIR1
CHAIRs
Len
OSCARBase
7.1
13.0
=
VinVLLarge
5.5
10.5
OFALarge
4.7
8.9
BLIP Large
4.7
8.8
=
I1
mPLUG-Owl
14.8
25.4
35.8
LLaVA
10.5
32.7
64.3
MultiModal-GPT
11.1
15.0
11.6
MiniGPT-4
6.7
9.5
24.7
InstructBLIP
2.6
3.7
8.5
I2
mPLUG-Owl
30.2
76.8
98.5
LLaVA
18.8
62.7
90.7
MultiModal-GPT
18.2
36.2
45.7
MiniGPT-4
9.2
31.5
116.2
InstructBLIP
2.5
3.4
7.5
+
+We select five recently released LVLMs, i.e., mPLUG-Owl (Ye et al., 2023), LLaVA (Liu et al., 2023), Multimodal-GPT (Gong et al., 2023), MiniGPT-4 (Zhu et al., 2023) and InstructBLIP (Dai et al., 2023a) and prompt them with following instructions to generate captions about images in MSCOCO (Lin et al., 2014):
+
+• $I _ { 1 }$ : Generate a short caption of the image. • $I _ { 2 }$ : Provide a brief description of the given image.
+
+Then, we calculate CHAIR on these captions. We leave more details about the introduction to the dataset and evaluated models in Appendix A.
+
+# 3.2 Evaluation Results
+
+Severity of Hallucinations. As the evaluation results illustrated in Table 1, most instruction-tuned LVLMs suffer from the object hallucination problem, even more serious than small models, e.g., LLaVA (32.7) v.s. $0 \mathrm { S C A R } _ { b a s e }$ (13.0) on $\mathrm { C H A I R } _ { S }$ using Instruction 1. It indicates that object hallucination is an important problem for LVLMs and deserves to be concerned about. As a comparison, InstructBLIP hallucinates less than other LVLMs. A possible reason is that its visual instructions are collected from a wide variety of publicly available datasets, which are relatively short. In contrast, other LVLMs mostly employ the visual instructions generated by unimodal LLMs (Liu et al., 2023). Such synthetic visual instructions are generally longer and more informative, but may involve unexpected descriptive information (hallucination inherent from LLMs) that is inconsistent with the image, which could mislead LVLMs.
+
+
+Figure 2: Hallucination times of frequently appearing/co-occurring objects in MSCOCO.
+
+Disadvantages of CHAIR. As Table 1 shows, the evaluation results can be affected by other factors, e.g., instruction designs and the length of captions. Specifically, although the adopted two instructions have similar semantic meanings, LVLMs prompted by Instruction 2 can even result in doubled values of CHAIR metrics compared with those prompted by Instruction 1, and the performance order of some LVLMs also changes (e.g., CHAIRI values of LLaVA and MultiModal-GPT). It indicates the instability of the CHAIR metric when different instructions are employed. Besides, as CHAIR requires to examine whether the mentioned objects are hallucinated in the generated caption, it needs complex human-crafted parsing rules to perform exact matching, which has not been adapted to the special generation styles of LVLMs and may lead to misclassification errors.
+
+Thus, it is necessary to consider a more suitable method that can stably and conveniently evaluate the object hallucination problem in LVLMs.
+
+# 4 Influence of Instruction Data on Object Hallucination
+
+Considering their impressive performance on complex vision-language tasks (Chen et al., 2023; Bai et al., 2023; Li et al., 2023a), it is counter-intuitive that the hallucination problem of LVLMs is so severe. Since smaller VLPMs suffer less from object hallucination, it is possible that the visual instruction-tuning process of LVLMs exacerbates object hallucination. In this section, we investigate the influence of the visual instruction data. We first make two basic hypotheses in Section 4.1 and then conduct qualitative and quantitative analysis to verify them in Section 4.2 and Section 4.3.
+
+# 4.1 Hypotheses
+
+As the visual instruction datasets of these LVLMs are mostly constructed based on MSCOCO (Lin et al., 2014), they generally share a similar unbalanced object distribution where top frequent objects occupy a major part of the dataset. After being fine-tuned on them, LVLMs may also be prone to generate (or hallucinate) frequently appearing objects in MSCOCO. Additionally, the presence of frequently co-occurring object groups (e.g., laptop, mouse and keyboard) may also contribute to object hallucination. LVLMs can be elicited by the existing objects in the image to hallucinate other objects that frequently co-occur with them. Therefore, we hypothesize that (1) LVLMs are prone to hallucinate frequently appearing objects in the visual instruction datasets; (2) LVLMs are prone to hallucinate objects that frequently co-occur with ground-truth objects in the image. We conduct qualitative and quantitative analyses in the following parts to verify them.
+
+
Model
HRA
HRc(dining table)
@10
@20
@30
@10
@20
@30
mPLUG-Owl
0.5455
0.6591
0.7533
0.6608
0.7926
0.8253
LLaVA
0.4620
0.5911
0.6796
0.5628
0.7329
0.8595
MultiModal-GPT
0.4152
0.5399
0.6743
0.5742
0.7849
0.8961
MiniGPT-4
0.4610
0.5758
0.7207
0.5600
0.6980
0.9145
+
+Table 2: Results on MSCOCO that quantify the correlations between the appearing/co-occurring frequency of objects and the hallucination times of LVLMs.
+
+# 4.2 Qualitative Analysis
+
+We first qualitatively analyze the correlation between the appearance frequency and hallucination. For the first hypothesis, we plot a bar chart between the top ten frequently appearing objects in MSCOCO and their hallucination times in the validation set of MSCOCO; for the second hypothesis, we select the top ten frequently co-occurring objects with “dining table” and also plot a bar chart to show their hallucination times across images that really contain “dining table”. We show the results of MiniGPT-4, LLaVA, MultiModal-GPT and mPLUG-Owl in Figure 2. Obviously, with the decreasing of the occurrence frequency of objects (from right to left), there is a notable decrease in the hallucination times for all four LVLMs. It reveals that the frequently appearing and co-occurring objects in the visual instruction dataset are indeed more likely to be hallucinated by LVLMs. To better support our results, we also list the full statistics of all 80 COCO objects in Appendix B.
+
+# 4.3 Quantitative Analysis
+
+To further consolidate the above findings, we employ the top- $k$ hit ratio $( \mathrm { H R } @ k )$ to measure the consistency between the appearance frequency and hallucination times of objects, which is defined as:
+
+$$
+\mathrm { H R } _ { A } @ k = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { \mathrm { H i t } @ k ( i ) } { \mathrm { H a l l u c i n a t e d } ( i ) } ,
+$$
+
+$$
+\mathrm { H R } _ { C } @ k ( o ) = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \frac { \mathrm { H i t } @ k ( i , o ) } { \mathrm { H a l l u c i n a t e d } ( i ) } ,
+$$
+
+where $\mathrm { H R } _ { A }$ and $\mathrm { H R } _ { C }$ quantify the correlations between hallucination times and appearing and co-occurring frequency respectively. $n$ is the total number of images, Hallucinated $( i )$ denotes the number of hallucinated objects in the $i$ -th example, $\mathrm { H i t } @ k ( i )$ denotes the number of top- $k$ frequently appearing MSCOCO objects in Hallucinated $( i )$ and $\mathrm { H i t } @ k ( i , o )$ denotes the number of top- $k$ frequently co-occurring objects with the probing object $o$ in Hallucinated $( i )$ . Therefore, $\mathrm { H R } @ k$ can reflect the proportion of top- $k$ frequently appearing or co-occurring objects in all hallucinated objects.
+
+We present the $\mathrm { H R } _ { A }$ and $\mathrm { H R } _ { C }$ (dining table) of top 30 objects in Table 2 and leave ${ \mathrm { H R } } _ { C } @$ (chair) and $\mathrm { H R } _ { C } @ ( \mathsf { c a r } )$ in Appendix C. The $\mathrm { H R } _ { A } @ 1 0$ and $\mathrm { H R } _ { C } @ 1 0$ (dining table) of all LVLMs are near 0.5 and 0.6, respectively. It indicates that, on average, approximately half of the hallucinated objects in each image belong to the top 10 frequently appearing COCO objects, while more than half are among the top 10 frequently cooccurring objects with the objects already present in the image. When we broaden our observation to the top 30 objects, this proportion continues to increase. These findings further verify that LVLMs mostly hallucinate common objects in the visual instruction data and inspire us to design three sampling strategies in our evaluation pipeline.
+
+# 5 POPE
+
+In this section, we devise Polling-based Object Probing Evaluation (POPE), a simple yet effective approach for evaluating hallucination in LVLMs. We first provide an overview of POPE, and then evaluate the representative LVLMs with POPE. Finally, we discuss the stability and scalability of our method, and also analyze the impact of hallucina
+
+
+Figure 3: Overview of the POPE pipeline. Given an input image, POPE first extracts ground-truth objects in the image either from human annotations or with the help of automatic segmentation tools like SEEM. Then, POPE conducts negative sampling for nonexistent objects in the image under Random/Popular/Adversarial settings. Finally, the ground-truth objects and nonexistent objects are formulated into question templates to poll LVLMs.
+
+tion on VQA task.
+
+# 5.1 Overview of POPE
+
+In the empirical results of Section 3, we have revealed the severity of the object hallucination problem in LVLMs and highlighted the limitations of the existing evaluation method, e.g., sensitive to instructions and biased to short captions. Besides, existing methods mostly rely on parsing the generated captions to extract the predicted objects, which usually require human-crafted complex rules and are still inevitable to omit or misclassify objects.
+
+Therefore, we consider devising a more suitable method for the stable, fair and flexible object hallucination evaluation of LVLMs, namely pollingbased object probing evaluation (POPE). Specifically, POPE formulates the evaluation of object hallucination as a binary classification task that prompts LVLMs to output “Yes” or “No”, e.g., “Is there a chair in the image?”. In this way, by sampling objects that LVLMs are prone to hallucinate, we can construct a set of hard questions to poll LVLMs. As standard answers to these questions are just “Yes” or “No”, we can easily identify them without complex parsing rules, and avoid the influence of instruction designs and caption length, thus guaranteeing stability, fairness and flexibility.
+
+Definition. Given an image caption dataset, POPE focuses on constructing a set of triples, each of which consists of an image, multiple questions and their answers (“Yes” or “No”). The formulated definition of a triple can be described as:
+
+$$
+\langle x , \{ q ( o _ { i } ) , a _ { i } \} _ { i = 1 } ^ { l } \rangle ,
+$$
+
+where $x$ denotes the image, $q ( o _ { i } )$ is the question probing $o _ { i }$ based on a template “Is there a/an