Datasets:
Add files using upload-large-folder tool
Browse files- md/dev/0I3su3mkuL/0I3su3mkuL.md +370 -0
- md/dev/10uNUgI5Kl/10uNUgI5Kl.md +386 -0
- md/dev/1KaSx3GrBBm/1KaSx3GrBBm.md +341 -0
- md/dev/3lge0p5o-M-/3lge0p5o-M-.md +456 -0
- md/dev/67o9UQgTD0/67o9UQgTD0.md +474 -0
- md/dev/7gE9V9GBZaI/7gE9V9GBZaI.md +560 -0
- md/dev/8H5bpVwvt5/8H5bpVwvt5.md +0 -0
- md/dev/99RpBVpLiX/99RpBVpLiX.md +0 -0
- md/dev/9EAQVEINuum/9EAQVEINuum.md +414 -0
- md/dev/AhccnBXSne/AhccnBXSne.md +307 -0
- md/dev/EXnIyMVTL8s/EXnIyMVTL8s.md +719 -0
- md/dev/G2Q2Mh3avow/G2Q2Mh3avow.md +0 -0
- md/dev/I-6yh2-dkyD/I-6yh2-dkyD.md +345 -0
- md/dev/ITw9edRDlD/ITw9edRDlD.md +338 -0
- md/dev/JCCi58IUsh/JCCi58IUsh.md +491 -0
- md/dev/KwmPfARgOTD/KwmPfARgOTD.md +0 -0
- md/dev/LV8OmADmoOe/LV8OmADmoOe.md +223 -0
- md/dev/NiEtU7blzN/NiEtU7blzN.md +453 -0
- md/dev/OgCcfc1m0TO/OgCcfc1m0TO.md +267 -0
- md/dev/RA7ND878XP/RA7ND878XP.md +310 -0
- md/dev/SlxSY2UZQT/SlxSY2UZQT.md +336 -0
- md/dev/Sxk8Bse3RKO/Sxk8Bse3RKO.md +297 -0
- md/dev/TIdIXIpzhoI/TIdIXIpzhoI.md +465 -0
- md/dev/TatRHT_1cK/TatRHT_1cK.md +314 -0
- md/dev/TntbHxxGd6j/TntbHxxGd6j.md +347 -0
- md/dev/VgOw1pUPh97/VgOw1pUPh97.md +294 -0
- md/dev/WVX0NNVBBkV/WVX0NNVBBkV.md +0 -0
- md/dev/_1bgdFHhA70/_1bgdFHhA70.md +435 -0
- md/dev/a8qX5RG36jd/a8qX5RG36jd.md +328 -0
- md/dev/biaOpY5gAo/biaOpY5gAo.md +501 -0
- md/dev/dUSI4vFyMK/dUSI4vFyMK.md +372 -0
- md/dev/dz79MhQXWvg/dz79MhQXWvg.md +294 -0
- md/dev/f-fVCElZ-G1/f-fVCElZ-G1.md +330 -0
- md/dev/f3zNgKga_ep/f3zNgKga_ep.md +291 -0
- md/dev/fARM4P0gAJV/fARM4P0gAJV.md +441 -0
- md/dev/fcO9Cgn-X-R/fcO9Cgn-X-R.md +344 -0
- md/dev/h4r00NGkjR/h4r00NGkjR.md +293 -0
- md/dev/hX5Ia-ION8Y/hX5Ia-ION8Y.md +379 -0
- md/dev/luEG3j9LW5-/luEG3j9LW5-.md +432 -0
- md/dev/n0OeTdNRG0Q/n0OeTdNRG0Q.md +418 -0
- md/dev/n7XbkHOwKn6/n7XbkHOwKn6.md +395 -0
- md/dev/r9hNv76KoT3/r9hNv76KoT3.md +0 -0
- md/dev/ucASPPD9GKN/ucASPPD9GKN.md +0 -0
- md/dev/v54eUIayFh/v54eUIayFh.md +520 -0
- md/dev/w6fj2r62r_H/w6fj2r62r_H.md +377 -0
- md/dev/xnuN2vGmZA0/xnuN2vGmZA0.md +228 -0
- md/dev/yb3HOXO3lX2/yb3HOXO3lX2.md +259 -0
- md/dev/z9NLqoFvZ0/z9NLqoFvZ0.md +481 -0
- md/dev/zGvRdBW06F5/zGvRdBW06F5.md +248 -0
- md/train/S1WRibb0Z/S1WRibb0Z.md +448 -0
md/dev/0I3su3mkuL/0I3su3mkuL.md
ADDED
|
@@ -0,0 +1,370 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Q-Transformer: Scalable Offline Reinforcement Learning via Autoregressive Q-Functions
|
| 2 |
+
|
| 3 |
+
Yevgen Chebotar∗, Quan Vuong∗, Alex Irpan, Karol Hausman, Fei Xia, Yao Lu, Aviral Kumar, Tianhe Yu, Alexander Herzog, Karl Pertsch, Keerthana Gopalakrishnan, Julian Ibarz, Ofir Nachum, Sumedh Sontakke, Grecia Salazar, Huong T Tran, Jodilyn Peralta, Clayton Tan, Deeksha Manjunath, Jaspiar Singht, Brianna Zitkovich, Tomas Jackson, Kanishka Rao, Chelsea Finn, Sergey Levine
|
| 4 |
+
|
| 5 |
+
Google DeepMind
|
| 6 |
+
|
| 7 |
+
Abstract: In this work, we present a scalable reinforcement learning method for training multi-task policies from large offline datasets that can leverage both human demonstrations and autonomously collected data. Our method uses a Transformer to provide a scalable representation for Q-functions trained via offline temporal difference backups. We therefore refer to the method as Q-Transformer. By discretizing each action dimension and representing the Q-value of each action dimension as separate tokens, we can apply effective high-capacity sequence modeling techniques for Q-learning. We present several design decisions that enable good performance with offline RL training, and show that Q-Transformer outperforms prior offline RL algorithms and imitation learning techniques on a large diverse real-world robotic manipulation task suite. The project’s website and videos can be found at qtransformer.github.io
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Robotic learning methods that incorporate large and diverse datasets in combination with highcapacity expressive models, such as Transformers [1, 2, 3, 4, 5, 6], have the potential to acquire generalizable and broadly applicable policies that perform well on a wide variety of tasks [1, 2]. For example, these policies can follow natural language instructions [4, 7], perform multi-stage behaviors [8, 9], and generalize broadly across environments, objects, and even robot morphologies [10, 3]. However, many of the recently proposed high-capacity models in the robotic learning literature are trained with supervised learning methods. As such, the performance of the resulting policy is limited by the degree to which human demonstrators can provide high-quality demonstration data. This is limiting for two reasons. First, we would like robotic systems that are more proficient than human teleoperators, exploiting the full potential of the hardware to perform tasks quickly, fluently, and reliably. Second, we would like robotic systems that get better with autonomously gathered experience, rather than relying entirely on high-quality demonstrations.
|
| 12 |
+
|
| 13 |
+

|
| 14 |
+
Figure 1: Q-Transformer enables training highcapacity sequential architectures on mixed quality data. Our policies are able to improve upon human demonstrations and execute a variety of manipulation tasks in the real world.
|
| 15 |
+
|
| 16 |
+
Reinforcement learning in principle provides both of these capabilities. A number of promising recent advances demonstrate the successes of large-scale robotic RL in varied settings, such as robotic grasping and stacking [11, 12], learning heterogeneous tasks with human-specified rewards [13], learning multi-task policies [14, 15], learning goal-conditioned policies [16, 17, 18, 19], and robotic navigation [20, 21, 22, 23, 24]. However, training high-capacity models such as Transformers using RL algorithms has proven more difficult to instantiate effectively at large scale. In this paper, we aim to combine large-scale robotic learning from diverse real-world datasets with modern high-capacity Transformer-based policy architectures.
|
| 17 |
+
|
| 18 |
+
While in principle simply replacing existing architectures (e.g., ResNets [15] or smaller convolutional neural networks [11, 14]) with a Transformer is conceptually straightforward, devising a methodology that effectively makes use of such architectures is considerably more challenging. High-capacity models only make sense when we train on large and diverse datasets – small, narrow datasets simply do not require this much capacity and do not benefit from it. While prior works used simulation to create such datasets [2, 25, 26], the most representative data comes from the real world [12, 11, 14]. Therefore, we focus on reinforcement learning methods that can use Transformers and incorporate large, previously collected datasets via offline RL. Offline RL methods train on prior data, aiming to derive the most effective possible policy from a given dataset. Of course, this dataset can be augmented with additionally autonomously gathered data, but the training is separated from data collection, providing an appealing workflow for large-scale robotics applications [27].
|
| 19 |
+
|
| 20 |
+
Another issue in applying Transformer models to RL is to design RL systems that can effectively train such models. Effective offline RL methods generally employ Q-function estimation via temporal difference updates [28]. Since Transformers model discrete token sequences, we convert the Q-function estimation problem into a discrete token sequence modeling problem, and devise a suitable loss function for each token in the sequence. Na¨ıvely discretizing the action space leads to exponential blowup in action cardinality, so we employ a per-dimension discretization scheme, where each dimension of the action space is treated as a separate time step for RL. Different bins in the discretization corresponds to distinct actions. The per-dimension discretization scheme allows us to use simple discrete-action Q-learning methods with a conservative regularizer to handle distributional shift [29, 30]. We propose a specific regularizer that minimizes values of every action that was not taken in the dataset and show that our method can learn from both narrow demonstration-like data and broader data with exploration noise. Finally, we utilize a hybrid update that combines Monte Carlo and $n$ -step returns with temporal difference backups [31], and show that doing so improves the performance of our Transformer-based offline RL method on large-scale robotic learning problems.
|
| 21 |
+
|
| 22 |
+
In summary, our main contribution is the Q-Transformer, a Transformer-based architecture for robotic offline reinforcement learning that makes use of per-dimension tokenization of Q-values and can readily be applied to large and diverse robotic datasets, including real-world data. We summarize the components of Q-Transformer in Figure 1. Our experimental evaluation validates the Q-Transformer by learning large-scale text-conditioned multi-task policies, both in simulation for rigorous comparisons and in large-scale real-world experiments for realistic validation. Our real-world experiments utilize a dataset with 38,000 successful demonstrations and 20,000 failed autonomously collected episodes on more than 700 tasks, gathered with a fleet of 13 robots. QTransformer outperforms previously proposed architectures for large-scale robotic RL [15, 14], as well as previously proposed Transformer-based models such as the Decision Transformer [32, 33].
|
| 23 |
+
|
| 24 |
+
# 2 Related Work
|
| 25 |
+
|
| 26 |
+
Offline RL has been extensively studied in recent works [34, 35, 36, 37, 35, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 39]. Conservative Q-learning (CQL) [29] learns policies constrained to a conservative lower bound of the value function. Our goal is not to develop a new algorithmic principle for offline RL, but to devise an offline RL system that can integrate with high-capacity Transformers, and scale to real-world multi-task robotic learning. We thus develop a version of CQL particularly effective for training large Transformer-based Q-functions on mixed quality data. While some works have noted that imitation learning outperforms offline RL on demonstration data [49], other works showed offline RL techniques to be effective with demonstrations both in theory and in practice [50, 15]. Nonetheless, a setting that combines “narrow” demonstration data with “broad” sub-optimal (e.g., autonomously collected) data is known to be particularly difficult [51, 52, 53], though it is quite natural in many robotic learning settings where we might want to augment a core set of demonstrations with relatively inexpensive low-quality autonomously collected data. We believe that the effectiveness of our method in this setting is of particular interest to practitioners.
|
| 27 |
+
|
| 28 |
+
Transformer-based architectures [54] have been explored in recent robotics research, both to learn generalizable task spaces [55, 56, 57, 58, 8, 59] and to learn multi-task or even multi-domain sequential policies directly [2, 1, 6, 3]. Although most of these works considered Transformers in a supervised learning setting, e.g., learning from demonstrations [4, 5], there are works on employing Transformers for RL and conditional imitation learning [32, 20, 60, 33]. In our experiments, we compare to Decision Transformer (DT) in particular [32], which extends conditional imitation learning with reward conditioning [61, 62] to use sequence models, and structurally resembles imitation learning methods that have been used successfully for robotic control. Although DT incorporates elements of RL (namely, reward functions), it does not provide a mechanism to improve over the demonstrated behavior or recombine parts of the dataset to synthesize more optimal behaviors, and indeed is known to have theoretical limitations [63]. On the other hand, such imitation-based recipes are popular perhaps due to the difficulty of integrating Transformer architectures with more powerful temporal difference methods (e.g., Q-learning). We show that several simple but important design decisions are needed to make this work, and our method significantly outperforms non-TD methods such as DT, as well as imitation learning, on our large-scale multi-task robotic control evaluation. Extending Decision Transformer, Yamagata et al. [64] proposed to use a Q-function in combination with a Transformer-based policy, but the Q-function itself did not use a Transformer-based architecture. Our Q-function could in principle be combined with this method, but our focus is specifically on directly training Transformers to represent Q-values.
|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
Figure 2: Q-values update for each action dimension at timestep t. Given a history of states, we update the Q-values of all bins in all action dimensions. The Q-values of the discrete action bins of the dataset actions are trained via the Bellman update (green boxes). The values of action bins not observed in the dataset are minimized towards zero (red boxes). The Q-targets of all action dimensions except the last one are computed using maximization over the next action dimension within the same time step. The Q-target of the last action dimension is computed using the discounted maximization of the first dimension of the next time step plus the reward. We also incorporate Monte Carlo returns by taking the maximum of the computed Q-targets and the return-to-go.
|
| 32 |
+
|
| 33 |
+
To develop a Transformer-based Q-learning method, we discretize each action space dimension, with each dimension acting as a distinct time step. Autoregressive generation of discrete actions has been explored by Metz et al. [65], who propose a hierarchical decomposition of an MDP and then utilize LSTM [66] for autoregressive discretization. Our discretization scheme is similar but simpler, in that we do not use any hierarchical decomposition but simply treat each dimension as a time step. However, since our goal is to perform offline RL at scale with real-world image based tasks (vs. the smaller state-space tasks learned via online RL by Metz et al. [65]), we present a number of additional design decisions to impose a conservative regularizer, enabling training our Transformerbased offline Q-learning method at scale, providing a complete robotic learning system.
|
| 34 |
+
|
| 35 |
+
# 3 Background
|
| 36 |
+
|
| 37 |
+
In RL, we learn policies $\pi$ that maximizes the expected total reward in a Markov decision process (MDP) with states $s$ , actions $a$ , discount factor $\gamma \in \mathsf { \Gamma } ( 0 , 1 ]$ , transition function $T ( s ^ { \prime } | s , { \bar { a } } )$ and a reward function $R ( s , a )$ . Actions $a$ have dimensionality $d _ { \mathcal { A } }$ . Value-based RL approaches learn a Q-function $Q ( s , a )$ representing the total discounted return $\begin{array} { r } { \sum _ { t } \gamma ^ { t } R ( s _ { t } , a _ { t } ) } \end{array}$ , with policy $\pi ( a | s ) =$ arg maxa $Q ( s , a )$ . The Q-function can be learned by iteratively applying the Bellman operator [67]:
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\mathcal { B } ^ { * } Q ( s _ { t } , a _ { t } ) = R ( s _ { t } , a _ { t } ) + \gamma \operatorname* { m a x } _ { a _ { t + 1 } } Q ( s _ { t + 1 } , a _ { t + 1 } ) ,
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
approximated via function approximation and sampling. The offline RL setting assumes access to an offline dataset of transitions or episodes, produced by some unknown behavior policy $\pi _ { \beta } ( a | s )$ , but does not assume the ability to perform additional online interaction during training. This is appealing for real-world robotic learning, where on-policy data collection is time-consuming. Learning from offline datasets requires addressing distributional shift, since in general the action that maximizes $Q ( s _ { t + 1 } , a _ { t + 1 } )$ might lie outside of the data distribution. One approach to mitigate this is to add a conservative penalty [29, 52] that pushes down the Q-values $Q ( s , a )$ for any action $a$ outside of the dataset, thus ensuring that the maximum value action is in-distribution.
|
| 44 |
+
|
| 45 |
+

|
| 46 |
+
Figure 3: Q-Transformer network architecture, as applied to our multi-task language-conditioned robotic control setting. The encoding of the observations is concatenated with embeddings of the previous predicted action dimensions and processed by Transformer layers. We apply a sigmoid to the Transformer output to produce Q-values (normalized to lie in the range $[ 0 , 1 ] )$ for each of the action value bins. Finally, one-hot action vectors are constructed by taking the arg max over all bins and are fed back to the network to predict the Q-values of the next action dimensions. The language instruction is encoded with Universal Sentence Encoder [68] and then fed to FiLM EfficientNet [69, 70] network together with the robot camera images.
|
| 47 |
+
|
| 48 |
+
In this work, we consider tasks with sparse rewards, where a binary reward $R \in \{ 0 , 1 \}$ (indicating success or failure) is assigned at the last time step of episodes. Although our method is not specific to this setting, such reward structure is common in robotic manipulation tasks that either succeed or fail on each episode, and can be particularly challenging for RL due to the lack of reward shaping.
|
| 49 |
+
|
| 50 |
+
# 4 Q-Transformer
|
| 51 |
+
|
| 52 |
+
In this section, we introduce Q-Transformer, an architecture for offline Q-learning with Transformer models, which is based on three main ingredients. First, we describe how we apply discretization and autoregression to enable TD-learning with Transformer architectures. Next, we introduce a particular conservative Q-function regularizer that enables learning from offline datasets. Lastly, we show how Monte Carlo and $n$ -step returns can be used to improve learning efficiency.
|
| 53 |
+
|
| 54 |
+
# 4.1 Autoregressive Discrete Q-Learning
|
| 55 |
+
|
| 56 |
+
Using Transformers with Q-learning presents two challenges: (1) we must tokenize the inputs to effectively apply attention mechanisms, which requires discretizing the action space; (2) we must perform maximization of Q-values over discretized actions while avoiding the curse of dimensionality. Addressing these issues within the standard Q-learning framework requires new modeling decisions. The intuition behind our autoregressive Q-learning update is to treat each action dimension as essentially a separate time step. That way, we can discretize individual dimensions (1D quantities), rather than the entire action space, avoiding the curse of dimensionality. This can be viewed as a simplified version of the scheme proposed in [65], though we apply this to high-capacity Transformer models, extend it to the offline RL setting, and scale it up to real-world robotic learning.
|
| 57 |
+
|
| 58 |
+
Let $\tau = ( s _ { 1 } , a _ { 1 } , \dots , s _ { T } , a _ { T } )$ be a trajectory of robotic experience of length $T$ from an offline dataset $\mathcal { D }$ . For a given time-step $t$ , and the corresponding action $a _ { t }$ in the trajectory, we define a per-dimension view of the action $a _ { t }$ . Let $a _ { t } ^ { 1 : i }$ denote the vector of action dimensions from the first dimension $a _ { t } ^ { 1 }$ until the $i$ -th dimension $a _ { t } ^ { i }$ , where $i$ can range from 1 to the total number of action dimensions, that we denote as $d _ { \mathcal { A } }$ . Then, for a time window $w$ of state history, we define the Q-value of the action $a _ { t } ^ { i }$ in the $_ { i - t h }$ dimension using an autoregressive Q-function conditioned on states from this time window $s _ { t - w : t }$ and previous action dimensions for the current time step $a _ { t } ^ { 1 : i - 1 }$ . To train the Q-function, we define a per-dimension Bellman update. For all dimensions $i \in \{ \bar { 1 } , \ldots , d _ { A } \}$ :
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
Q ( s _ { t - w : t } , a _ { t } ^ { 1 : i - 1 } , a _ { t } ^ { i } ) \gets \left\{ \begin{array} { l l } { \operatorname* { m a x } _ { a _ { t } ^ { i + 1 } } Q ( s _ { t - w : t } , a _ { t } ^ { 1 : i } , a _ { t } ^ { i + 1 } ) } & { \mathrm { i f ~ } i \in \{ 1 , \dots , d _ { A } - 1 \} } \\ { a _ { t } ^ { i + 1 } } & { \mathrm { ~ i f ~ } i \in \{ 1 , \dots , d _ { A } \} } \end{array} \right.
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
The reward is only applied on the last dimension (second line in the equation), as we do not receive any reward before executing the whole action. In addition, we only discount Q-values between the time steps and keep discounting at 1.0 for all but the last dimension within each time step, to ensure the same discounting as in the original MDP. Figure 2 illustrates this process, where each yellow box represents the Q-target computation with additional conservatism and Monte Carlo returns described in the next subsections. It should be noted that by treating each action dimension as a time step for the Bellman update, we do not change the general optimization properties of Q-learning algorithms and the principle of the Bellman optimality still holds for a given MDP as we maximize over an action dimension given the optimality of all action dimensions in the future. We show that this approach provides a theoretically consistent way to optimize the original MDP in Appendix A, with a proof of convergence in the tabular setting in Appendix B.
|
| 65 |
+
|
| 66 |
+
# 4.2 Conservative Q-Learning with Transformers
|
| 67 |
+
|
| 68 |
+
Having defined a Bellman backup for running Q-learning with Transformers, we now develop a technique that enables learning from offline data, including human demonstrations and autonomously collected data. This typically requires addressing over-estimation due to the distributional shift, when the Q-function for the target value is queried at an action that differs from the one on which it was trained. Conservative Q-learning (CQL) [29] minimizes the Q-function on out-of-distribution actions, which can result in Q-values that are significantly smaller than the minimal possible cumulative reward that can be attained in any trajectory. When dealing with sparse rewards $R \in \{ 0 , 1 \}$ , results in [27] show that the Q-function regularized with a standard conservative objective can take on negative values, even though instantaneous rewards are all non-negative. This section presents a modified version of conservative Q-learning that addresses this issue in our problem setting.
|
| 69 |
+
|
| 70 |
+
The key insight behind our design is that, rather than minimizing the Q-values on actions not in the data, we can instead regularize these $\mathrm { Q }$ -values to be close to the minimal attainable possible cumulative reward. Concretely, denoting the minimal possible reward on the task as $R _ { \mathrm { m i n } }$ , and the time horizon of the task as $T$ , our approach regularizes the Q-values on actions not covered by the dataset towards $R _ { \operatorname* { m i n } } \cdot T$ , which in our problem setting is equal to 0 (i.e., $R _ { \mathrm { m i n } } = 0 .$ ). For simplicity of notation, we omit the action dimension indices in presenting the resulting objective, but remark that the training objective below is applied to Bellman backups on all action dimensions as described in the previous section. Let $\pi _ { \beta }$ be the behavioral policy that induced a given dataset $\mathcal { D }$ , and let $\begin{array} { r } { \tilde { \pi } _ { \beta } ( a | s ) = \frac { 1 } { Z ( s ) } \cdot ( 1 . 0 - \pi _ { \beta } ( a | \dot { s } ) ) } \end{array}$ be the distribution over all actions which have a very low density under $\pi _ { \beta } ( a | s )$ . Our objective to train the Q-function is:
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
J = \ \frac { 1 } { 2 } \underbrace { \mathbb { E } _ { s \sim \mathcal { D } , a \sim \pi _ { \beta } ( a | s ) } \left[ \left( Q ( s , a ) - B ^ { * } Q ^ { k } ( s , a ) \right) ^ { 2 } \right] } _ { ( i ) , \mathrm { ~ I D ~ e r r o r } } + \alpha \cdot \frac { 1 } { 2 } \underbrace { \mathbb { E } _ { s \sim \mathcal { D } , a \sim \pi _ { \beta } ( a | s ) } \left[ \left( Q ( s , a ) - 0 \right) ^ { 2 } \right] } _ { ( i i ) , \mathrm { ~ c o n s e r v a t i v e ~ r e g u l a r i z a t i o n ~ } \mathcal { L } _ { C } } ,
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
where the first term $( i )$ trains the Q-function by minimizing the temporal difference error objective as defined in Eq. 1, and the second term $( i i )$ regularizes the $\mathbf { Q }$ -values to the minimal possible $\mathrm { Q }$ - value of 0 in expectation under the distribution of actions induced by $\tilde { \pi } _ { \beta }$ , which we denote as a conservative regularization term $\mathcal { L } _ { C }$ . Term $( i i )$ is also weighted by a multiplier $\alpha$ , which modulates the strength of this conservative regularization. We discuss the choice of $\alpha$ in our implementation in Appendix D.2 and analyze the behavior of the conservatism term in Appendix C, providing a simple characterization of how this regularizer modifies the learned Q-function in tabular settings.
|
| 77 |
+
|
| 78 |
+
# 4.3 Improving Learning Efficiency with Monte Carlo and $n$ -step Returns
|
| 79 |
+
|
| 80 |
+
When the dataset contains some good trajectories (e.g., demonstrations) and some suboptimal trajectories (e.g., autonomously collected trials), utilizing Monte Carlo return-to-go estimates to accelerate Q-learning can lead to significant performance improvements, as the Monte Carlo estimates along the better trajectories lead to much faster value propagation. This has also been observed in prior work [31]. Based on this observation, we propose a simple improvement to Q-Transformer that we found to be quite effective in practice. The Monte Carlo return is defined by the cumulative reward within the offline trajectory $\begin{array} { r } { \tau \colon \mathbf { M } \mathbf { C } _ { t : T } = \sum _ { j = t } ^ { T } \gamma ^ { j - t } R ( s _ { j } , a _ { j } ) } \end{array}$ . This matches the Q-value of the behavior policy $\pi _ { \beta }$ , and since the optimal $Q ^ { * } ( s , a )$ is larger than the Q-value for any other policy, we have $Q ^ { * } ( s _ { t } , a _ { t } ) \geq \mathbf { M } \mathbf { C } _ { t : T }$ . Since the Monte Carlo return is a lower bound of the optimal Q-function, we can augment the Bellman update to take the maximum between the MC-return and the current Q-value: max $( \mathbf { M } \mathbf { C } _ { t : T } , Q ( s _ { t } , a _ { t } \mathbf { \bar { ) } } )$ , without changing what the Bellman update will converge to.
|
| 81 |
+
|
| 82 |
+

|
| 83 |
+
Figure 4: Left: Real world manipulation tasks. Right: Real world performance comparison. RT-1 [1] is imitation learning on demonstrations. Q-Transformer (Q-T), Decision Transformer (DT) [32], Implicit Q-learning (IQL) [40] learn from both demonstrations and autonomous data.
|
| 84 |
+
|
| 85 |
+
Although this does not change convergence, including this maximization speeds up learning (see Section 5.3). We present a hypothesis why this occurs. In practice, $\mathrm { Q }$ -values for final timesteps $( s _ { T } , a _ { T } )$ are learned first and then propagated backwards in future gradient steps. It can take multiple gradients for the Q-value to propagate all the way to $( s _ { 1 } , a _ { 1 } )$ . The $\operatorname* { m a x } ( \mathbf { M C } , Q )$ allows us to apply useful gradients to $Q ( s _ { 1 } , a _ { 1 } )$ at the start of training before the $\mathbf { Q }$ -values have propagated.
|
| 86 |
+
|
| 87 |
+
In our experiments, we also notice that additionally employing $n$ -step returns [71, 72] over action dimensions can significantly help with the learning speed. We pick $n$ such that the final Q-value of the last dimension of the next time step is used as the Q-target. This is because we get a new state and reward only after inferring and executing the whole action as opposed to parts of it, meaning that intermediate rewards remain 0 all the way until the last action dimension. While this introduces bias to the Bellman backups, as is always the case with off-policy learning with $n$ -step returns, we find in our ablation study in Section 5.3 that the detrimental effects of this bias are small, while the speedup in training is significant. This is consistent with previously reported results [72]. More details about our Transformer sequence model architecture (depicted in Figure 3) conservative Qlearning implementation, and the robot system can be found in Appendix D.
|
| 88 |
+
|
| 89 |
+
# 5 Experiments
|
| 90 |
+
|
| 91 |
+
In our experiments, we aim to answer the following questions: (1) Can Q-Transformer learn from a combination of demonstrations and sub-optimal data? (2) How does Q-Transformer compare to other methods? (3) How important are the specific design choices in Q-Transformer? (4) Can QTransformer be applied to large-scale real world robotic manipulation problems?
|
| 92 |
+
|
| 93 |
+
# 5.1 Real-world language-conditioned manipulation evaluation
|
| 94 |
+
|
| 95 |
+
Training dataset. The offline data used in our experiments was collected with a fleet of 13 robots, and consists of a subset of the demonstration data described by Brohan et al. [1], combined with lower quality autonomously collected data. The demonstrations were collected via human teleoperation for over 700 distinct tasks, each with a separate language description. We use a maximum of 100 demonstrations per task, for a total of about 38,000 demonstrations. All of these demonstrations succeed on their respective tasks and receive a reward of 1.0. The rest of the dataset was collected by running the robots autonomously, executing policies learned via behavioral cloning.
|
| 96 |
+
|
| 97 |
+
To ensure a fair comparison between Q-Transformer and imitation learning methods, we discard all successful episodes in the autonomously collected data when we train our method, to ensure that by including the autonomous data the Q-Transformer does not get to observe more successful trials than the imitation learning baselines. This leaves us with about 20,000 additional autonomously collected failed episodes, each with a reward of 0.0, for a dataset size of about 58,000 episodes. The episodes are on average 35 time steps in length. Examples of the tasks are shown in Figure 4.
|
| 98 |
+
|
| 99 |
+
Performance evaluation. To evaluate how well Q-Transformer can perform when learning from real-world offline datasets while effectively incorporating autonomously collected failed episodes, we evaluate Q-Transformer on 72 unique manipulation tasks, and a variety of different skills, such as “drawer pick and place”, “open and close drawer”, “move object near target”, each consisting of 18, 7 and 48 unique tasks instructions respectively to specify different object combinations and drawers. As such, the average success rate in Table 4 is the average over 72 tasks.
|
| 100 |
+
|
| 101 |
+
Since each task in the training set only has a maximum of 100 demonstrations, we observe from Figure 4 that an imitation learning algorithm like RT-1 [1], which also uses a similar Transformer architecture, struggles to obtain a good performance when learning from only the limited pool of successful robot demonstrations. Existing offline RL methods, such as IQL [40] and a Transformerbased method such as Decision Transformer [32], can learn from both successful demonstrations and failed episodes, and show better performance compared to RT-1, though by a relatively small margin. Q-Transformer has the highest success rate and outperforms both the behavior cloning baseline (RT-1) and offline RL baselines (Decision Transformer, IQL), exceeding the average performance of the best-performing prior method by about $70 \%$ . This demonstrates that Q-Transformer can effectively improve upon human demonstrations using autonomously collected sub-optimal data.
|
| 102 |
+
|
| 103 |
+
Appendix G also shows that Q-Transformer can be successfully applied in combination with a recently proposed language task planner [8] to perform both affordance estimation and robot action execution. Q-Transformer outperforms prior methods for planning and executing long-horizon tasks.
|
| 104 |
+
|
| 105 |
+
# 5.2 Benchmarking in simulation
|
| 106 |
+
|
| 107 |
+
In this section, we evaluate Q-Transformer on a challenging simulated offline RL task that require incorporating sub-optimal data to solve the task. In particular, we use a visual simulated picking task depicted in Figure 5, where we have a small amount of position controlled human demonstrations ${ \sim } 8 \%$ of the data). The demonstrations are replayed with noise to generate more trajectories ( ${ \sim } 9 2 \%$ of the data). Figure 5 shows a comparison to several offline algorithms, such as QT-Opt with CQL [11, 29], IQL [40], AW-Opt [73], and Decision Transformer [32], along with RT-1 using Behavioral Cloning [1] on demonstrations only. As we see, algorithms that can effectively perform TDlearning to combine optimal and sub-optimal data (such as Q-Transformer and QT-Opt) perform better than others. BC with RT-1 is not
|
| 108 |
+
|
| 109 |
+

|
| 110 |
+
Figure 5: Performance comparison on a simulated picking task.
|
| 111 |
+
|
| 112 |
+
able to take advantage of sub-optimal data. Decision Transformer is trained on both demonstrations and sub-optimal data, but is not able to leverage the noisy data for policy improvement and does not end up performing as well as our method. Although IQL and AW-Opt perform TD-learning, the actor remains too close to the data and can not fully leverage the sub-optimal data. Q-Transformer is able to both bootstrap the policy from demonstrations and also quickly improve through propagating information with TD-learning. We also analyze the statistical significance of the results by training with multiple random seeds in Appendix F.
|
| 113 |
+
|
| 114 |
+
# 5.3 Ablations
|
| 115 |
+
|
| 116 |
+
We perform a series of ablations of our method design choices in simulation, with results presented in Figure 6 (left). First, we demonstrate that our choice of conservatism for Q-Transformer performs better than the standard CQL regularizer, which corresponds to a softmax layer on top of the Q-function outputs with a cross-entropy loss between the dataset action and the output of this softmax [29]. This regularizer plays a similar role to the one we propose, decreasing the Q-values for out-of-distribution actions and staying closer to the behavior policy.
|
| 117 |
+
|
| 118 |
+
As we see in Figure 6 (left), performance with softmax conservatism drops to around the fraction of demonstration episodes $( \sim 8 \% )$ . This suggests a collapse to the behavior policy as the conservatism penalty becomes too good at constraining to the behavior policy distribution. Due to the nature of the softmax, pushing Q-values down for unobserved actions also pushes Q-values up for the observed actions, and we theorize this makes it difficult to keep Q-values low for sub-optimal in-distribution actions that fail to achieve high reward. Next, we show that using conservatism is important. When removing conservatism entirely, we observe that performance collapses. Actions that are rare in the dataset will have overestimated Q-values, since they are not trained by the offline Q-learning procedure. The resulting overestimated values will propagate and collapse the entire Q-function, as described in prior work [38]. Finally, we ablate the Monte-Carlo returns and again observe performance collapse. This demonstrates that adding information about the sampled future returns significantly helps in bootstrapping the training of large architectures such as Transformers.
|
| 119 |
+
|
| 120 |
+

|
| 121 |
+
Figure 6: Left: Ablations: changing to softmax conservatism decreases performance. Removing MC returns or conservatism completely collapse performance. Top Right: The $n$ -step return version of our method reaches similar performance to the standard version with 4 times fewer steps, indicating that the added bias from $n$ -step returns is small compared to the gain in training speed. Using $n$ -step return also leads to better performance on tasks that have longer horizon, e.g. move object near target. Bottom Right: Success rates on real world task categories with a larger dataset.
|
| 122 |
+
|
| 123 |
+
<table><tr><td>n-step ablation</td><td>n-step 1-step</td><td>1-step</td></tr><tr><td># of gradient steps Training duration (hours)</td><td>137480 582960 32 163</td><td>136920 40</td></tr><tr><td>pick object move object near target</td><td>94% 88%</td><td>97% 92% 80% 67%</td></tr><tr><td>Large offline dataset</td><td>Q-T DT</td><td>RT-1</td></tr><tr><td>Average success rate</td><td>88% 78%</td><td>82%</td></tr></table>
|
| 124 |
+
|
| 125 |
+
We also ablate the choice of $n$ -step returns from the Section 4.3 on real robots and observe that using $n$ -step returns leads to a significantly faster training speed as measured by the number of gradient steps and wall clock time compared to using 1-step returns, with a minimal loss in performance, as shown in Figure 6 (top right).
|
| 126 |
+
|
| 127 |
+
# 5.4 Massively scaling up Q-Transformer
|
| 128 |
+
|
| 129 |
+
The experiments in the previous section used a large dataset that included successful demonstrations and failed autonomous trials, comparable in size to some of the largest prior experiments that utilized demonstration data [74, 15, 58]. We also carry out a preliminary experiment with a much larger dataset to investigate the performance of Q-Transformer as we scale up the dataset size.
|
| 130 |
+
|
| 131 |
+
This experiment includes all of the data collected with 13 robots and comprises of the demonstrations used by RT-1 [1] and successful autonomous episodes, corresponding to about 115,000 successful trials, and an additional 185,000 failed autonomous episodes, for a total dataset size of about 300,000 trials. Model architecture and hyperparameters were kept exactly the same, as the computational cost of the experiment made further hyperparameter tuning prohibitive (in fact, we only train the models once). Note that with this number of successful demonstrations, even standard imitation learning with the RT-1 architecture already performs very well, attaining $82 \%$ success rate. However, as shown in Figure 6 (bottom right), Q-Transformer was able to improve even on this very high number. This experiment demonstrates that Q-Transformer can continue to scale to extremely large dataset sizes, and continues to outperform both imitation learning with RT-1 and Decision Transformer.
|
| 132 |
+
|
| 133 |
+
# 6 Limitations and Discussion
|
| 134 |
+
|
| 135 |
+
In this paper, we introduced the Q-Transformer, an architecture for offline reinforcement learning with high-capacity Transformer models that is suitable for large-scale multi-task robotic RL. Our framework does have several limitations. First, we focus on sparse binary reward tasks corresponding to success or failure for each trial. While this setup is reasonable for a broad range of episodic robotic manipulation problems, it is not universal, and we expect that Q-Transformer could be extended to more general settings as well in the future.
|
| 136 |
+
|
| 137 |
+
Second, the per-dimension action discretization scheme that we employ may become more cumbersome in higher dimensions (e.g., controlling a humanoid robot), as the sequence length and inference time for our model increases with action dimensionality. Although $n$ -step returns mitigate this to a degree, the length of the sequences still increases with action dimensionality. For such higherdimensional action space, adaptive discretization methods might also be employed, for example by training a discrete autoencoder model and reducing representation dimensionality. Uniform action discretization can also pose problems for manipulation tasks that require a large range of motion granularities, e.g. both coarse and fine movements. In this case, adaptive discretization based on the distribution of actions could be used for representing both types of motions.
|
| 138 |
+
|
| 139 |
+
Finally, in this work we concentrated on the offline RL setting. However, extending Q-Transformer to online finetuning is an exciting direction for future work that would enable even more effective autonomous improvement of complex robotic policies.
|
| 140 |
+
|
| 141 |
+
References
|
| 142 |
+
[1] A. Brohan, N. Brown, J. Carbajal, Y. Chebotar, J. Dabis, C. Finn, K. Gopalakrishnan, K. Hausman, A. Herzog, J. Hsu, et al. Rt-1: Robotics transformer for real-world control at scale. arXiv preprint arXiv:2212.06817, 2022.
|
| 143 |
+
[2] Y. Jiang, A. Gupta, Z. Zhang, G. Wang, Y. Dou, Y. Chen, L. Fei-Fei, A. Anandkumar, Y. Zhu, and L. Fan. Vima: General robot manipulation with multimodal prompts. arXiv preprint arXiv:2210.03094, 2022.
|
| 144 |
+
[3] A. Gupta, L. Fan, S. Ganguli, and L. Fei-Fei. Metamorph: Learning universal controllers with transformers. arXiv preprint arXiv:2203.11931, 2022.
|
| 145 |
+
[4] M. Shridhar, L. Manuelli, and D. Fox. Perceiver-actor: A multi-task transformer for robotic manipulation. arXiv preprint arXiv:2209.05451, 2022.
|
| 146 |
+
[5] N. M. M. Shafiullah, Z. J. Cui, A. Altanzaya, and L. Pinto. Behavior transformers: Cloning $k$ modes with one stone. arXiv preprint arXiv:2206.11251, 2022.
|
| 147 |
+
[6] S. Reed, K. Zolna, E. Parisotto, S. G. Colmenarejo, A. Novikov, G. Barth-Maron, M. Gimenez, Y. Sulsky, J. Kay, J. T. Springenberg, et al. A generalist agent. arXiv preprint arXiv:2205.06175, 2022.
|
| 148 |
+
[7] M. Shridhar, L. Manuelli, and D. Fox. Cliport: What and where pathways for robotic manipulation. In Proceedings of the 5th Conference on Robot Learning (CoRL), 2021.
|
| 149 |
+
[8] M. Ahn, A. Brohan, N. Brown, Y. Chebotar, O. Cortes, B. David, C. Finn, K. Gopalakrishnan, K. Hausman, A. Herzog, et al. Do as I can, not as I say: Grounding language in robotic affordances. arXiv preprint arXiv:2204.01691, 2022.
|
| 150 |
+
[9] D.-A. Huang, Y.-W. Chao, C. Paxton, X. Deng, L. Fei-Fei, J. C. Niebles, A. Garg, and D. Fox. Motion reasoning for goal-based imitation learning. In 2020 IEEE International Conference on Robotics and Automation (ICRA), pages 4878–4884. IEEE, 2020.
|
| 151 |
+
[10] D. Shah, A. Sridhar, A. Bhorkar, N. Hirose, and S. Levine. Gnm: A general navigation model to drive any robot. arXiv preprint arXiv:2210.03370, 2022.
|
| 152 |
+
[11] D. Kalashnikov, A. Irpan, P. Pastor, J. Ibarz, A. Herzog, E. Jang, D. Quillen, E. Holly, M. Kalakrishnan, V. Vanhoucke, et al. Scalable deep reinforcement learning for vision-based robotic manipulation. In Conference on Robot Learning, pages 651–673. PMLR, 2018.
|
| 153 |
+
[12] A. X. Lee, C. M. Devin, Y. Zhou, T. Lampe, K. Bousmalis, J. T. Springenberg, A. Byravan, A. Abdolmaleki, N. Gileadi, D. Khosid, et al. Beyond pick-and-place: Tackling robotic stacking of diverse shapes. In 5th Annual Conference on Robot Learning, 2021.
|
| 154 |
+
[13] S. Cabi, S. G. Colmenarejo, A. Novikov, K. Konyushkova, S. Reed, R. Jeong, K. Zolna, Y. Aytar, D. Budden, M. Vecerik, et al. Scaling data-driven robotics with reward sketching and batch reinforcement learning. arXiv preprint arXiv:1909.12200, 2019.
|
| 155 |
+
[14] 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. arXiv, 2021.
|
| 156 |
+
[15] A. Kumar, A. Singh, F. Ebert, Y. Yang, C. Finn, and S. Levine. Pre-training for robots: Offline rl enables learning new tasks from a handful of trials. arXiv preprint arXiv:2210.05178, 2022.
|
| 157 |
+
[16] L. P. Kaelbling. Learning to achieve goals. In R. Bajcsy, editor, IJCAI, pages 1094–1099. Morgan Kaufmann, 1993. ISBN 1-55860-300-X.
|
| 158 |
+
[17] Y. Chebotar, K. Hausman, Y. Lu, T. Xiao, D. Kalashnikov, J. Varley, A. Irpan, B. Eysenbach, R. Julian, C. Finn, et al. Actionable models: Unsupervised offline reinforcement learning of robotic skills. arXiv preprint arXiv:2104.07749, 2021.
|
| 159 |
+
[18] T. Schaul, D. Horgan, K. Gregor, and D. Silver. Universal value function approximators. In F. Bach and D. Blei, editors, Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pages 1312–1320, Lille, France, 07–09 Jul 2015. PMLR.
|
| 160 |
+
[19] M. Andrychowicz, D. Crow, A. Ray, J. Schneider, R. Fong, P. Welinder, B. McGrew, J. Tobin, P. Abbeel, and W. Zaremba. Hindsight experience replay. In Advances in Neural Information Processing Systems, pages 5048–5058, 2017.
|
| 161 |
+
[20] K. Fang, A. Toshev, L. Fei-Fei, and S. Savarese. Scene memory transformer for embodied agents in long-horizon tasks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 538–547, 2019.
|
| 162 |
+
[21] P. Anderson, A. X. Chang, D. S. Chaplot, A. Dosovitskiy, S. Gupta, V. Koltun, J. Kosecka, J. Malik, R. Mottaghi, M. Savva, and A. R. Zamir. On evaluation of embodied navigation agents. CoRR, abs/1807.06757, 2018. URL http://dblp.uni-trier.de/db/ journals/corr/corr1807.html#abs-1807-06757.
|
| 163 |
+
[22] P. Anderson, Q. Wu, D. Teney, J. Bruce, M. Johnson, N. Sunderhauf, I. D. Reid, S. Gould, ¨ and A. van den Hengel. Vision-and-language navigation: Interpreting visually-grounded navigation instructions in real environments. CoRR, abs/1711.07280, 2017. URL http: //arxiv.org/abs/1711.07280.
|
| 164 |
+
[23] P. Mirowski, R. Pascanu, F. Viola, H. Soyer, A. J. Ballard, A. Banino, M. Denil, R. Goroshin, L. Sifre, K. Kavukcuoglu, D. Kumaran, and R. Hadsell. Learning to navigate in complex environments. CoRR, abs/1611.03673, 2016. URL http://dblp.uni-trier.de/db/ journals/corr/corr1611.html#MirowskiPVSBBDG16.
|
| 165 |
+
[24] Y. Zhu, R. Mottaghi, E. Kolve, J. J. Lim, A. Gupta, L. Fei-Fei, and A. Farhadi. Target-driven visual navigation in indoor scenes using deep reinforcement learning. In ICRA, pages 3357– 3364. IEEE, 2017. ISBN 978-1-5090-4633-1. URL http://dblp.uni-trier.de/db/ conf/icra/icra2017.html#ZhuMKLGFF17.
|
| 166 |
+
[25] 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, pages 1094–1100. PMLR, 2020.
|
| 167 |
+
[26] J. Fu, A. Kumar, O. Nachum, G. Tucker, and S. Levine. D4rl: Datasets for deep data-driven reinforcement learning. arXiv preprint arXiv:2004.07219, 2020.
|
| 168 |
+
[27] A. Kumar, A. Singh, S. Tian, C. Finn, and S. Levine. A workflow for offline model-free robotic reinforcement learning. arXiv preprint arXiv:2109.10813, 2021.
|
| 169 |
+
[28] R. S. Sutton and A. G. Barto. Introduction to Reinforcement Learning. MIT Press, Cambridge, MA, USA, 1st edition, 1998. ISBN 0262193981.
|
| 170 |
+
[29] A. Kumar, A. Zhou, G. Tucker, and S. Levine. Conservative q-learning for offline reinforcement learning. Advances in Neural Information Processing Systems, 33:1179–1191, 2020.
|
| 171 |
+
[30] V. Mnih, K. Kavukcuoglu, D. Silver, A. Graves, I. Antonoglou, D. Wierstra, and M. Riedmiller. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013.
|
| 172 |
+
[31] A. Wilcox, A. Balakrishna, J. Dedieu, W. Benslimane, D. S. Brown, and K. Goldberg. Monte carlo augmented actor-critic for sparse reward deep reinforcement learning from suboptimal demonstrations. In A. H. Oh, A. Agarwal, D. Belgrave, and K. Cho, editors, Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum? id=FLzTj4ia8BN.
|
| 173 |
+
[32] 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. Advances in neural information processing systems, 34:15084–15097, 2021.
|
| 174 |
+
[33] K.-H. Lee, O. Nachum, M. Yang, L. Lee, D. Freeman, W. Xu, S. Guadarrama, I. Fischer, E. Jang, H. Michalewski, et al. Multi-game decision transformers. arXiv preprint arXiv:2205.15241, 2022.
|
| 175 |
+
[34] N. Jaques, A. Ghandeharioun, J. H. Shen, C. Ferguson, A. Lapedriza, N. Jones, S. Gu, and R. Picard. Way off-policy batch deep reinforcement learning of implicit human preferences in dialog. arXiv preprint arXiv:1907.00456, 2019.
|
| 176 |
+
[35] Y. Wu, G. Tucker, and O. Nachum. Behavior regularized offline reinforcement learning. arXiv preprint arXiv:1911.11361, 2019.
|
| 177 |
+
[36] X. B. Peng, A. Kumar, G. Zhang, and S. Levine. Advantage-weighted regression: Simple and scalable off-policy reinforcement learning. arXiv preprint arXiv:1910.00177, 2019.
|
| 178 |
+
[37] N. Y. Siegel, J. T. Springenberg, F. Berkenkamp, A. Abdolmaleki, M. Neunert, T. Lampe, R. Hafner, and M. Riedmiller. Keep doing what worked: Behavioral modelling priors for offline reinforcement learning. arXiv preprint arXiv:2002.08396, 2020.
|
| 179 |
+
[38] A. Kumar, J. Fu, M. Soh, G. Tucker, and S. Levine. Stabilizing off-policy q-learning via bootstrapping error reduction. In Advances in Neural Information Processing Systems, pages 11761–11771, 2019.
|
| 180 |
+
[39] I. Kostrikov, J. Tompson, R. Fergus, and O. Nachum. Offline reinforcement learning with fisher divergence critic regularization. arXiv preprint arXiv:2103.08050, 2021.
|
| 181 |
+
[40] I. Kostrikov, A. Nair, and S. Levine. Offline reinforcement learning with implicit q-learning. arXiv preprint arXiv:2110.06169, 2021.
|
| 182 |
+
[41] Z. Wang, A. Novikov, K. Zołna, J. T. Springenberg, S. Reed, B. Shahriari, N. Siegel, J. Merel, ˙ C. Gulcehre, N. Heess, et al. Critic regularized regression. arXiv preprint arXiv:2006.15134, 2020.
|
| 183 |
+
[42] S. Fujimoto and S. S. Gu. A minimalist approach to offline reinforcement learning. arXiv preprint arXiv:2106.06860, 2021.
|
| 184 |
+
[43] X. Chen, Z. Zhou, Z. Wang, C. Wang, Y. Wu, and K. Ross. Bail: Best-action imitation learning for batch deep reinforcement learning, 2019. URL https://arxiv.org/abs/1910. 12179.
|
| 185 |
+
[44] H. Furuta, Y. Matsuo, and S. S. Gu. Generalized decision transformer for offline hindsight information matching. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $=$ CAjxVodl_v.
|
| 186 |
+
[45] Y. Jang, J. Lee, and K.-E. Kim. GPT-critic: Offline reinforcement learning for end-to-end taskoriented dialogue systems. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ qaxhBG1UUaS.
|
| 187 |
+
[46] L. Meng, M. Wen, Y. Yang, chenyang le, X. yun Li, H. Zhang, Y. Wen, W. Zhang, J. Wang, and B. XU. Offline pre-trained multi-agent decision transformer, 2022. URL https:// openreview.net/forum?id=W08IqLMlMer.
|
| 188 |
+
[47] P. Daoudi, M. Barlier, L. D. Santos, and A. Virmaux. Density estimation for conservative q-learning, 2022. URL https://openreview.net/forum?id $=$ liV-Re74fK.
|
| 189 |
+
[48] L. Liu, Z. Tang, L. Li, and D. Luo. Robust imitation learning from corrupted demonstrations, 2022. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ UECzHrGio7i.
|
| 190 |
+
[49] A. Mandlekar, D. Xu, J. Wong, S. Nasiriany, C. Wang, R. Kulkarni, F.-F. Li, S. Savarese, Y. Zhu, and R. Mart´ın-Mart´ın. What matters in learning from offline human demonstrations for robot manipulation. In 5th Annual Conference on Robot Learning, 2021. URL https: //openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ JrsfBJtDFdI.
|
| 191 |
+
[50] A. Kumar, J. Hong, A. Singh, and S. Levine. When should we prefer offline reinforcement learning over behavioral cloning? arXiv preprint arXiv:2204.05618, 2022.
|
| 192 |
+
[51] A. Singh, A. Kumar, Q. Vuong, Y. Chebotar, and S. Levine. Offline rl with realistic datasets: Heteroskedasticity and support constraints. arXiv preprint arXiv:2211.01052, 2022.
|
| 193 |
+
[52] Q. Vuong, A. Kumar, S. Levine, and Y. Chebotar. DASCO: Dual-generator adversarial support constrained offline reinforcement learning. In A. H. Oh, A. Agarwal, D. Belgrave, and K. Cho, editors, Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id ${ . } = { }$ jBTQGGy9qA-.
|
| 194 |
+
[53] J. Li, X. Zhan, H. Xu, X. Zhu, J. Liu, and Y.-Q. Zhang. Distance-sensitive offline reinforcement learning. arXiv preprint arXiv:2205.11027, 2022.
|
| 195 |
+
[54] 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.
|
| 196 |
+
[55] Y. Zhang and J. Chai. Hierarchical task learning from language instructions with unified transformers and self-monitoring. arXiv preprint arXiv:2106.03427, 2021.
|
| 197 |
+
[56] A. Pashevich, C. Schmid, and C. Sun. Episodic transformer for vision-and-language navigation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 15942–15952, 2021.
|
| 198 |
+
[57] A. Silva, N. Moorman, W. Silva, Z. Zaidi, N. Gopalan, and M. Gombolay. Lancon-learn: Learning with language to enable generalization in multi-task manipulation. IEEE Robotics and Automation Letters, 7(2):1635–1642, 2021.
|
| 199 |
+
[58] E. Jang, A. Irpan, M. Khansari, D. Kappler, F. Ebert, C. Lynch, S. Levine, and C. Finn. Bc-z: Zero-shot task generalization with robotic imitation learning. In Conference on Robot Learning, pages 991–1002. PMLR, 2021.
|
| 200 |
+
[59] S. Nair, E. Mitchell, K. Chen, S. Savarese, C. Finn, et al. Learning language-conditioned robot behavior from offline data and crowd-sourced annotation. In Conference on Robot Learning, pages 1303–1315. PMLR, 2022.
|
| 201 |
+
[60] M. Janner, Q. Li, and S. Levine. Reinforcement learning as one big sequence modeling problem. In ICML 2021 Workshop on Unsupervised Reinforcement Learning, 2021.
|
| 202 |
+
[61] A. Kumar, X. B. Peng, and S. Levine. Reward-conditioned policies. arXiv preprint arXiv:1912.13465, 2019.
|
| 203 |
+
[62] R. K. Srivastava, P. Shyam, F. Mutz, W. Jaskowski, and J. Schmidhuber. Training agents using ´ upside-down reinforcement learning. arXiv preprint arXiv:1912.02877, 2019.
|
| 204 |
+
[63] D. Brandfonbrener, A. Bietti, J. Buckman, R. Laroche, and J. Bruna. When does returnconditioned supervised learning work for offline reinforcement learning? arXiv preprint arXiv:2206.01079, 2022.
|
| 205 |
+
[64] T. Yamagata, A. Khalil, and R. Santos-Rodriguez. Q-learning decision transformer: Leveraging dynamic programming for conditional sequence modelling in offline rl, 2023.
|
| 206 |
+
[65] L. Metz, J. Ibarz, N. Jaitly, and J. Davidson. Discrete sequential prediction of continuous actions for deep rl. CoRR, abs/1705.05035, 2017. URL http://dblp.uni-trier.de/ db/journals/corr/corr1705.html#MetzIJD17.
|
| 207 |
+
[66] S. Hochreiter and J. Schmidhuber. Long Short-Term Memory. 9(8):1735–1780, 1997.
|
| 208 |
+
[67] R. S. Sutton and A. G. Barto. Reinforcement learning: An introduction. Second edition, 2018.
|
| 209 |
+
[68] D. Cer, Y. Yang, S.-y. Kong, N. Hua, N. Limtiaco, R. S. John, N. Constant, M. GuajardoCespedes, S. Yuan, C. Tar, et al. Universal sentence encoder. arXiv preprint arXiv:1803.11175, 2018.
|
| 210 |
+
[69] E. Perez, F. Strub, H. De Vries, V. Dumoulin, and A. Courville. Film: Visual reasoning with a general conditioning layer. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
|
| 211 |
+
[70] M. Tan and Q. Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International conference on machine learning, pages 6105–6114. PMLR, 2019.
|
| 212 |
+
[71] R. S. Sutton. Learning to predict by the methods of temporal differences. Machine learning, 3 (1):9–44, 1988.
|
| 213 |
+
[72] M. Hessel, J. Modayil, H. Van Hasselt, T. Schaul, G. Ostrovski, W. Dabney, D. Horgan, B. Piot, M. Azar, and D. Silver. Rainbow: Combining improvements in deep reinforcement learning. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
|
| 214 |
+
[73] Y. Lu, K. Hausman, Y. Chebotar, M. Yan, E. Jang, A. Herzog, T. Xiao, A. Irpan, M. Khansari, D. Kalashnikov, and S. Levine. Aw-opt: Learning robotic skills with imitation andreinforcement at scale. In 5th Annual Conference on Robot Learning, 2021.
|
| 215 |
+
[74] S. Dasari and A. Gupta. Transformers for one-shot visual imitation. In Conference on Robot Learning, pages 2071–2084. PMLR, 2021.
|
| 216 |
+
[75] C. J. Watkins and P. Dayan. Q-learning. Machine Learning, 8:279–292, 1992.
|
| 217 |
+
[76] T. Xiao, E. Jang, D. Kalashnikov, S. Levine, J. Ibarz, K. Hausman, and A. Herzog. Thinking while moving: Deep reinforcement learning with concurrent control. arXiv preprint arXiv:2004.06089, 2020.
|
| 218 |
+
[77] A. Chowdhery, S. Narang, J. Devlin, M. Bosma, G. Mishra, A. Roberts, P. Barham, H. W. Chung, C. Sutton, S. Gehrmann, P. Schuh, K. Shi, S. Tsvyashchenko, J. Maynez, A. Rao, P. Barnes, Y. Tay, N. Shazeer, V. Prabhakaran, E. Reif, N. Du, B. Hutchinson, R. Pope, J. Bradbury, J. Austin, M. Isard, G. Gur-Ari, P. Yin, T. Duke, A. Levskaya, S. Ghemawat, S. Dev, H. Michalewski, X. Garcia, V. Misra, K. Robinson, L. Fedus, D. Zhou, D. Ippolito, D. Luan, H. Lim, B. Zoph, A. Spiridonov, R. Sepassi, D. Dohan, S. Agrawal, M. Omernick, A. M. Dai, T. S. Pillai, M. Pellat, A. Lewkowycz, E. Moreira, R. Child, O. Polozov, K. Lee, Z. Zhou, X. Wang, B. Saeta, M. Diaz, O. Firat, M. Catasta, J. Wei, K. Meier-Hellstern, D. Eck, J. Dean, S. Petrov, and N. Fiedel. Palm: Scaling language modeling with pathways, 2022. URL https://arxiv.org/abs/2204.02311.
|
| 219 |
+
|
| 220 |
+
# A Proof of MDP optimization consistency
|
| 221 |
+
|
| 222 |
+
To show that transforming MDP into a per-action-dimension form still ensures optimization of the original MDP, we show that optimizing the Q-function for each action dimension is equivalent to optimizing the Q-function for the full action.
|
| 223 |
+
|
| 224 |
+
If we consider the full action $a _ { 1 : d _ { \mathcal { A } } }$ and that we switch to the state $s ^ { \prime }$ at the next timestep, the Qfunction for optimizing over the full action MDP would be:
|
| 225 |
+
|
| 226 |
+
$$
|
| 227 |
+
\begin{array} { r l } & { \underset { a _ { 1 : d _ { \cal A } } } { \operatorname* { m a x } } Q ( s , a _ { 1 : d _ { \cal A } } ) = \underset { a _ { 1 : d _ { \cal A } } } { \operatorname* { m a x } } \left[ R ( s , a _ { 1 : d _ { \cal A } } ) + \gamma \underset { a _ { 1 : d _ { \cal A } } } { \operatorname* { m a x } } Q ( s ^ { \prime } , a _ { 1 : d _ { \cal A } } ) \right] } \\ & { \quad \quad \quad \quad = R ( s , a _ { 1 : d _ { \cal A } } ^ { * } ) + \gamma \underset { a _ { 1 : d _ { \cal A } } } { \operatorname* { m a x } } Q ( s ^ { \prime } , a _ { 1 : d _ { \cal A } } ) , } \end{array}
|
| 228 |
+
$$
|
| 229 |
+
|
| 230 |
+
where $R ( s , a _ { 1 : d _ { A } } ^ { * } )$ is the reward we get after executing the full action.
|
| 231 |
+
|
| 232 |
+
The optimization over each action dimension using our Bellman update is:
|
| 233 |
+
|
| 234 |
+
$$
|
| 235 |
+
\begin{array} { r l } { \operatorname* { m a x } _ { \mathbf { x } \in \mathcal { G } _ { \delta , \epsilon } ^ { \star } , \eta _ { \epsilon } \in \mathcal { G } _ { \epsilon - 1 } \sim \mathcal { G } _ { \epsilon } ^ { \star } } } & { = - \operatorname* { m a x } _ { \mathbf { x } \in \mathcal { G } _ { \epsilon } ^ { \star } \cup \mathcal { G } _ { \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon } ^ { \star } } } \\ & { = \operatorname* { m a x } _ { \mathbf { x } \in \mathcal { G } _ { \epsilon } ^ { \star } \cup \mathcal { G } _ { \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon + 1 , \epsilon - 1 } } } \\ & { = \operatorname* { m a x } _ { \mathbf { x } \in \mathcal { G } _ { \epsilon } ^ { \star } \cup \mathcal { G } _ { \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 } } } \\ & { - \operatorname* { m a x } _ { \mathbf { x } \in \mathcal { F } _ { \epsilon } \cup \mathcal { G } _ { \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 } } } \\ & { - \operatorname* { m a x } _ { \mathbf { x } \in \mathcal { F } _ { \epsilon } \cap \mathcal { G } _ { \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 } } } \\ & { - \operatorname* { m a x } _ { \mathbf { x } \in \mathcal { G } _ { \epsilon + 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 } } } \\ & { - \operatorname* { m a x } _ { \mathbf { x } \in \mathcal { G } _ { \epsilon + 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 } } } \\ & { = \operatorname* { m a x } _ { \mathbf { x } \in \mathcal { G } _ { \epsilon + 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 } } + \operatorname* { m a x } _ { \mathbf { x } \in \mathcal { G } _ { \epsilon + 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 , \epsilon - 1 } } } \\ & - \operatorname* { m a x } _ \ \end{array}
|
| 236 |
+
$$
|
| 237 |
+
|
| 238 |
+
which optimizes the original full action MDP as in Eq. 3.
|
| 239 |
+
|
| 240 |
+
# B Proof of convergence
|
| 241 |
+
|
| 242 |
+
Convergence of Q-learning has been shown in the past [67, 75]. Below we demonstrate that per-action dimension Q-function converges as well, by providing a proof almost identical to the standard $\mathrm { Q }$ -learning convergence proof, but extended to account for the per-action dimension maximization.
|
| 243 |
+
|
| 244 |
+
Let $d _ { \mathcal { A } }$ be the dimensionality of the action space, $a$ indicates a possible sequence of actions, whose dimension is not necessarily equal to the dimension of the action space. That is:
|
| 245 |
+
|
| 246 |
+
$$
|
| 247 |
+
a \in \{ a _ { 1 : i } , \forall i \leq d _ { A } \}
|
| 248 |
+
$$
|
| 249 |
+
|
| 250 |
+
To proof convergence, we can demonstrate that the Bellman operator applied to the per-action dimension Q-function is a contraction, i.e.:
|
| 251 |
+
|
| 252 |
+
$$
|
| 253 |
+
| | \mathcal { B } ^ { * } Q _ { 1 } ( s , a ) - \mathcal { B } ^ { * } Q _ { 2 } ( s , a ) | | _ { \infty } \leq c | | Q _ { 1 } ( s , a ) - Q _ { 2 } ( s , a ) | | _ { \infty } ,
|
| 254 |
+
$$
|
| 255 |
+
|
| 256 |
+
where
|
| 257 |
+
|
| 258 |
+
$$
|
| 259 |
+
B ^ { \ast } Q ( s , a ) = \left\{ \begin{array} { l l } { R ( s , a ) + \gamma \displaystyle \operatorname* { m a x } _ { a ^ { \prime } } Q ( s , a , a ^ { \prime } ) } & { \mathrm { i f ~ t h e ~ d i m e n s i o n ~ o f ~ } a \mathrm { ~ i s ~ l e s s ~ t h a n ~ } d \mathcal { A } } \\ { R ( s , a ) + \gamma \displaystyle \operatorname* { m a x } _ { a ^ { \prime } } \frac { E } { s ^ { \prime } } [ Q ( s ^ { \prime } , a ^ { \prime } ) ] } & { \mathrm { i f ~ t h e ~ d i m e n s i o n ~ o f ~ } a \mathrm { ~ i s ~ e q u a l ~ t o ~ } d \mathcal { A } } \end{array} \right.
|
| 260 |
+
$$
|
| 261 |
+
|
| 262 |
+
$a ^ { \prime }$ is the next action dimension following the sequence $a , s ^ { \prime }$ is the next state of the MDP, $\gamma$ is the discounting factor, and $0 \leq c \leq 1$ .
|
| 263 |
+
|
| 264 |
+
Proof: We can show that this is the case as follows:
|
| 265 |
+
|
| 266 |
+
Case 1: For action sequence whose dimension is less than the dimension of the action space.
|
| 267 |
+
|
| 268 |
+
$$
|
| 269 |
+
\begin{array} { r l } & { \mathcal { B } ^ { * } Q _ { 1 } ( s , a ) - \mathcal { B } ^ { * } Q _ { 2 } ( s , a ) } \\ & { \quad = R ( s , a ) + \gamma \underset { a ^ { \prime } } { \operatorname* { m a x } } Q _ { 1 } ( s , a , a ^ { \prime } ) - R ( s , a ) - \gamma \underset { a ^ { \prime } } { \operatorname* { m a x } } Q _ { 2 } ( s , a , a ^ { \prime } ) } \\ & { \quad = \gamma \underset { a ^ { \prime } } { \operatorname* { m a x } } [ Q _ { 1 } ( s , a , a ^ { \prime } ) - Q _ { 2 } ( s , a , a ^ { \prime } ) ] } \\ & { \quad \le \gamma \underset { s , a } { \operatorname* { s u p } } [ Q _ { 1 } ( s , a ) - Q _ { 2 } ( s , a ) ] } \\ & { \quad \Longrightarrow | | \mathcal { B } ^ { * } Q _ { 1 } ( s , a ) - \mathcal { B } ^ { * } Q _ { 2 } ( s , a ) | | _ { \infty } \le \gamma | | Q _ { 1 } ( s , a ) - Q _ { 2 } ( s , a ) | | _ { \infty } } \end{array}
|
| 270 |
+
$$
|
| 271 |
+
|
| 272 |
+
where $\operatorname { s u p } _ { s , a }$ is the supremum over all action sequences, with $0 \leq \gamma \leq 1$ and $\| f \| _ { \infty } = \operatorname* { s u p } _ { x } [ f ( x ) ]$ .
|
| 273 |
+
|
| 274 |
+
Case 2: For action sequence whose dimension is equal to the dimension of the action space
|
| 275 |
+
|
| 276 |
+
$$
|
| 277 |
+
\begin{array} { r l } & { \mathcal { B } ^ { * } Q _ { 1 } ( s , a ) - \mathcal { B } ^ { * } Q _ { 2 } ( s , a ) } \\ & { \ = R ( s , a ) + \gamma \underset { a ^ { \prime } } { \operatorname* { m a x } } E [ Q _ { 1 } ( s ^ { \prime } , a ^ { \prime } ) ] - R ( s , a ) - \gamma \underset { a ^ { \prime } } { \operatorname* { m a x } } E [ Q _ { 2 } ( s ^ { \prime } , a ^ { \prime } ) ] } \\ & { \ = \gamma \underset { a ^ { \prime } } { \operatorname* { m a x } } E [ Q _ { 1 } ( s ^ { \prime } , a ^ { \prime } ) - Q _ { 2 } ( s ^ { \prime } , a ^ { \prime } ) ] } \\ & { \ \leq \gamma \underset { s , a } { \operatorname* { s u p } } [ Q _ { 1 } ( s , a ) - Q _ { 2 } ( s , a ) ] } \\ & { \ \Longrightarrow \ | | \mathcal { B } ^ { * } Q _ { 1 } ( s , a ) - \mathcal { B } ^ { * } Q _ { 2 } ( s , a ) | | _ { \infty } \leq \gamma | | Q _ { 1 } ( s , a ) - Q _ { 2 } ( s , a ) | | _ { \infty } } \end{array}
|
| 278 |
+
$$
|
| 279 |
+
|
| 280 |
+
# C Analysis of the conservatism term
|
| 281 |
+
|
| 282 |
+
With the goal of understanding the behavior of our training procedure, we theoretically analyze the solution obtained by Eq. 2 for the simpler cases when $Q$ is represented as a table, and when the objective in Eq. 2 can be minimized exactly. We derive the minimizer of the objective in Eq. 2 by differentiating $J$ with respect to $Q$ :
|
| 283 |
+
|
| 284 |
+
$$
|
| 285 |
+
\begin{array} { r l } & { \forall s , a , k , \frac { d J } { d Q ( s , a ) } = 0 } \\ & { \pi _ { \beta } ( a | s ) \left( Q ( s , a ) - B ^ { * } Q ^ { k } ( s , a ) \right) + \alpha \tilde { \pi } _ { \beta } ( a | s ) Q ( s , a ) = 0 } \\ & { Q ( s , a ) \left( \pi _ { \beta } ( a | s ) + \alpha \tilde { \pi } _ { \beta } ( a | s ) \right) = \pi _ { \beta } ( a | s ) B ^ { * } Q ^ { k } ( s , a ) } \\ & { Q ^ { k + 1 } ( s , a ) = \underbrace { \pi _ { \beta } ( a | s ) } _ { : = m ( s , a ) } . } \end{array}
|
| 286 |
+
$$
|
| 287 |
+
|
| 288 |
+
Eq. 4 implies that training with the objective in Eq. 2 performs a weighted Bellman backup: unlike the standard Bellman backup, training with Eq. 2 multiplies large Q-value targets by a weight $m ( s , a )$ . This weight $m ( s , a )$ takes values between 0 and 1, with larger values close to 1 for indistribution actions where $( s , a ) \in \mathcal { D }$ , and very small values close to 0 for out-of-distribution actions $a$ at any state $s$ (i.e., actions where $\pi _ { \beta } ( a | s )$ is small). Thus, the Bellman backup induced via Eq. 4 should effectively prevent over-estimation of Q-values for unseen actions.
|
| 289 |
+
|
| 290 |
+
# D Q-Transformer Architecture & System
|
| 291 |
+
|
| 292 |
+
In this section, we describe the architecture of Q-Transformer as well as the important implementation and system details that make it an effective Q-learning algorithm for real robots.
|
| 293 |
+
|
| 294 |
+
# D.1 Transformer sequence model architecture
|
| 295 |
+
|
| 296 |
+
Our neural network architecture is shown in Figure 3. The architecture is derived from the RT-1 design [1], adapted to accommodate the Q-Transformer framework, and consists of a Transformer backbone that reads in images via a convolutional encoder followed by tokenization. Since we apply Q-Transformer to a multi-task robotic manipulation problem where each task is specified by a natural language instruction, we first embed the natural language instruction into an embedding vector via the Universal Sentence Encoder [68]. The embedding vector and images from the robot camera are then converted into a sequence of input tokens via a FiLM EfficientNet [69, 70]. In the standard RT-1 architecture [1], the robot action space is discretized and the Transformer sequence model outputs the logits for the discrete action bins per dimension and per time step. In this work, we extend the network architecture to use Q-learning by applying a sigmoid activation to the output values for each action, and interpreting the resulting output after the sigmoid as Q-values. This representation is particularly suitable for tasks with sparse per-episode rewards $R \in [ 0 , 1 ]$ , since the Q-values may be interpreted as probabilities of task success and should always lie in the range $[ 0 , 1 ]$ . Note that unlike the standard softmax, this interpretation of Q-values does not prescribe normalizing across actions (i.e., each action output can take on any value in $[ 0 , 1 ] )$ ).
|
| 297 |
+
|
| 298 |
+
Since our robotic system, described in Section D.3, has 8-dimensional actions, we end up with 8 dimensions per time step and discretize each one into $N = 2 5 6$ value bins. Our reward function is a sparse reward that assigns value 1.0 at the last step of an episode if the episode is successful and 0.0 otherwise. We use a discount rate $\gamma = 0 . 9 8$ . As is common in deep RL, we use a target network to estimate target Q-values $Q ^ { k }$ , using an exponential moving average of $Q$ -network weights to update the target network. The averaging constant is set to 0.01.
|
| 299 |
+
|
| 300 |
+
# D.2 Conservative Q-learning implementation
|
| 301 |
+
|
| 302 |
+
The conservatism penalty in Section 4.2 requires estimating expectations under $\pi _ { \beta } ( a | s )$ and $\tilde { \pi } _ { \beta } ( a | s ) \propto ( 1 - \pi _ { \beta } ( \bar { a } | s ) )$ , with the latter being especially non-trivial to estimate. We employ a simple and crude approximation that we found to work well in practice, replacing $\pi _ { \beta } ( a | s )$ with the empirical distribution corresponding, for each sampled state-action tuple $( s _ { j } , a _ { j } ) \in \mathcal { D }$ , to a Dirac delta centered on $a _ { j }$ , such that $\pi _ { \beta } ( { \bar { a } } | s _ { j } ) = \delta ( a = { \bar { a } } _ { j } )$ . This results in a simple expression for $\tilde { \pi } _ { \beta } ( a | s _ { j } )$ corresponding to the uniform distribution over all other actions, such that ${ \tilde { \pi } } _ { \beta } ( a | s _ { j } ) \propto \delta ( a \stackrel { . } { \neq } a _ { j } )$ . After discretizing the actions, there are $N - 1$ bins per dimension to exhaustively iterate over when computing the conservatism term in Eq. 2, which is the same as taking the average over targets for all unseen action values. In our experiments, we find that simply setting the conservatism weight to $\alpha = 1 . 0$ worked best, without additional tuning.
|
| 303 |
+
|
| 304 |
+
# D.3 Robot system overview
|
| 305 |
+
|
| 306 |
+
The robot that we use in this work is a mobile manipulator with a 7-DOF arm with a 2 jaw parallel gripper, attached to a mobile base with a head-mounted RGB camera, illustrated in Figure 1. The RGB camera provides a $6 4 0 \times 5 1 2$ RGB image, which is downsampled to $3 2 0 \times 2 5 6$ before being consumed by the Q-Transformer. See Figure 4 for images from the robot camera view. The learned policy is set up to control the arm and the gripper of the robot. Our action space consists of 8 dimensions: 3D position, 3D orientation, gripper closure command, and an additional dimension indicating whether the episode should terminate, which the policy must trigger to receive a positive reward upon successful task completion. Position and orientation are relative to the current pose, while the gripper command is the absolute closedness fraction, ranging from fully open to fully closed. Orientation is represented via axis-angles, and all actions except whether to terminate are continuous actions discretized over their full action range in 256 bins. The termination action is binary, but we pad it to be the same size as the other action dimensions to avoid any issues with unequal weights. The policy operates at $3 \ : \mathrm { H z }$ , with actions executed asynchronously [76].
|
| 307 |
+
|
| 308 |
+
Algorithm 1 Temporal difference error and loss computation for one action dimension i at timestep $t$ , $\hat { a } _ { t } ^ { i }$ .
|
| 309 |
+
|
| 310 |
+
Input Sequence of state in time window of size $w$ , $s _ { t - w : t }$ Input Language embedding of task instruction $l$ .
|
| 311 |
+
Input The state at timestep $t + 1$ , $s _ { t + 1 }$ .
|
| 312 |
+
Input Dataset action up to dimension $i$ , $\{ \boldsymbol { \mathcal { D } } \boldsymbol { a } _ { t } ^ { j } \} _ { j = 0 } ^ { i }$ .
|
| 313 |
+
Output The loss to optimize Q-Transformer.
|
| 314 |
+
|
| 315 |
+
${ Q } ^ { t a r g } \gets$ Compute maximum Q-values of the next action dimension using Eq. 1 // Compute the maximum between $\mathsf { Q }$ -target and Monte Carlo return. $Q ^ { t a r g } \gets \mathrm { m a x } ( \mathbf { M } \mathbf { C } , Q ^ { t a r g } )$
|
| 316 |
+
|
| 317 |
+
// Compute the temporal difference error. $\mathrm { T D E r r o r } = \frac { 1 } { 2 } ( \mathrm { Q } \mathrm { - } \mathrm { T r a n s f o r m e r } ( l , s _ { t - w : t } , \{ a ^ { j } \} _ { j = 1 } ^ { i } ) - Q ^ { t a r g } ) ^ { 2 }$
|
| 318 |
+
|
| 319 |
+
// Compute the conservative regularizer.
|
| 320 |
+
// The sum is over all action bins not equal to the tokenized dataset action.
|
| 321 |
+
// $N$ is the number of discretization bin.
|
| 322 |
+
$\mathrm { R e g } = \frac { 1 } { 2 ( N - 1 ) } \sum _ { a \neq _ { \mathscr D } a _ { t } ^ { i } } \left( \mathrm { Q } \mathrm { - T r a n s f o r m e r } ( l , s _ { t - w : t } , \{ a ^ { j } \} _ { j = 1 } ^ { i - 1 } \cup \{ a \} ) \right) ^ { 2 }$
|
| 323 |
+
// Compute the loss function
|
| 324 |
+
$\mathcal { L } = \mathrm { T D E r r o r } + \mathrm { R e g }$
|
| 325 |
+
|
| 326 |
+
Return $\mathcal { L }$ as the loss function to optimize Q-Transformer with.
|
| 327 |
+
|
| 328 |
+
# E Pseudo-code
|
| 329 |
+
|
| 330 |
+
Algorithm 1 shows the loss computation for training each action dimension of the Q-Transformer. We first use Eq. 1 to compute the maximum Q-values over the next action dimensions. Then we compute the Q-target for the given dataset action by using the Bellman update with an additional maximization over the Monte-Carlo return and predicted maximum Q-value at the next time step. The TD-error is then computed using the Mean-Squared Error. Finally, we set a target of 0 for all discretized action bins except the dataset action and add the averaged Mean-Squared Error over these dimensions to the TD-Error, which results in the total loss $\mathcal { L }$ .
|
| 331 |
+
|
| 332 |
+
# F Running training for multiple random seeds
|
| 333 |
+
|
| 334 |
+

|
| 335 |
+
Figure 7: Mean and variance of Q-Transformer and RT-1 performance in simulation when running the training for 5 different random seeds.
|
| 336 |
+
|
| 337 |
+
In addition to performing a large amount of evaluations, we also analyze the statistical significance of our learning results by running our training of Q-Transformer and RT-1 on multiple seeds in simulation. In particular, we run the training for 5 random seeds in Figure 7. As we can see, QTransformer retains its improved performance across the distribution of the random seeds.
|
| 338 |
+
|
| 339 |
+
# G Q-Transformer value function with a language planner experiments
|
| 340 |
+
|
| 341 |
+

|
| 342 |
+
Figure 8: Qualitative comparisons of Q-values from QT-Opt (sim-to-real) and Q-Transformer. QTransformer outputs sharper Q-values for objects close to the robot, which can be grasped faster and more easily than the objects farther away.
|
| 343 |
+
|
| 344 |
+
Recently, the SayCan algorithm [8] was proposed as a way to combine large language models (LLMs) with learned policies and value functions to solve long-horizon tasks. In this framework, the value function for each available skill is used to determine the “affordance” of the current state for that skill, and a large language model then selects from among the available affordances to take a step towards performing some temporally extended task. For example, if the robot is commanded to bring all the items on a table, the LLM might propose a variety of semantically meaningful items, and select from among them based on the item grasping skill that currently has a high value (corresponding to items that the robot thinks it can grasp). SayCan uses QT-Opt in combination with sim-to-real transfer to train Q-functions for these affordances. In the following set of experiments, we demonstrate that the Q-Transformer outperforms QT-Opt for affordance estimation without using any sim-to-real transfer, entirely using the real world dataset that we employ in the preceding experiments.
|
| 345 |
+
|
| 346 |
+
We first benchmark Q-Transformer on the problem of correctly estimating task affordances from the RT-1 dataset [1]. In addition to the standard training on demonstrations and autonomous data, we introduce a training with relabeling, which we found particularly useful for affordance estimation. During relabeling, we sample a random alternate task for a given episode. We relabel the task name of the episode to the newly sampled task, and set reward to 0.0. This ensures that the boundaries between tasks are more clearly learned during train
|
| 347 |
+
|
| 348 |
+
<table><tr><td>Model</td><td>Precision</td><td>Recall</td><td>F1</td></tr><tr><td>QT-Opt (sim-to-real)</td><td>0.61</td><td>0.68</td><td>0.64</td></tr><tr><td>Q-T w/ relabel</td><td>0.76</td><td>0.89</td><td>0.82</td></tr><tr><td>Q-T w/o relabel</td><td>0.58</td><td>0.93</td><td>0.71</td></tr></table>
|
| 349 |
+
|
| 350 |
+
Table 1: Affordance estimation comparison: precision, recall and F1 score when using Q-values to determine if a task is feasible. Q-Transformer (Q-T) with multitask relabeling consistently produces better affordance estimates.
|
| 351 |
+
|
| 352 |
+
ing. Table 1 shows comparison of performance of our model with and without relabeling as well as the sim-to-real QT-Opt model used in SayCan [8]. Both of our models outperform the QT-Opt model on F1 score, with the relabeled model outperforming it by a large margin. This demonstrates that our Q-function can be effectively used for affordance estimation, even without training with sim-to-real transfer. Visualization of the Q-values produced by our Q-function can be found in Figure 8.
|
| 353 |
+
|
| 354 |
+
We then use Q-Transformer in a long horizon SayCan style evaluation, replacing both the sim-to-real QT-Opt model for affordance estimation, and the RT-1 policy for low-level robotic control. During this evaluation, a PaLM language model [77] is used to propose task candidates given a user query. Q-values are then used to pick the task candidate with the highest affordance score, which is then executed on the robot using the execution policy. The $\mathrm { Q } \mathrm { - }$ Transformer used for affordance estimation is trained with relabeling. The QTransformer used for low-level control is
|
| 355 |
+
|
| 356 |
+
Table 2: Performance on SayCan style long-horizon tasks: SayCan queries $Q ( s , \bar { a } )$ in planning to pick a language instruction, then runs a policy to execute the plan. Q-Transformer outperforms RT-1 with QT-Opt in both planning and execution.
|
| 357 |
+
|
| 358 |
+
<table><tr><td colspan="2">Method</td><td colspan="2">Success Rate</td></tr><tr><td>Affordance</td><td>Execution Planning</td><td></td><td>Execution</td></tr><tr><td>Q-T w/ relabel QT-Opt (sim-to-real)</td><td>Q-T RT-1</td><td>93 87</td><td>93 67</td></tr></table>
|
| 359 |
+
|
| 360 |
+
trained without relabeling, since we found relabeling episodes at the task level did not improve execution performance. SayCan with Q-Transformer is better at both planning the sequence of tasks and executing those plans, as illustrated in Table 2.
|
| 361 |
+
|
| 362 |
+
# H Real robotic manipulation tasks used in our evaluation
|
| 363 |
+
|
| 364 |
+
We include the complete list of evaluation tasks in our real robot experiments below.
|
| 365 |
+
|
| 366 |
+
Drawer pick and place: pick 7up can from top drawer and place on counter, place 7up can into top drawer, pick brown chip bag from top drawer and place on counter, place brown chip bag into top drawer, pick orange can from top drawer and place on counter, place orange can into top drawer, pick coke can from middle drawer and place on counter, place coke can into middle drawer, pick orange from middle drawer and place on counter, place orange into middle drawer, pick green rice chip bag from middle drawer and place on counter, place green rice chip bag into middle drawer, pick blue plastic bottle from bottom drawer and place on counter, place blue plastic bottle into bottom drawer, pick water bottle from bottom drawer and place on counter, place water bottle into bottom drawer, pick rxbar blueberry from bottom drawer and place on counter, place rxbar blueberry into bottom drawer.
|
| 367 |
+
|
| 368 |
+
Open and close drawer: open top drawer, close top drawer, open middle drawer, close middle drawer, open bottom drawer, close bottom drawer.
|
| 369 |
+
|
| 370 |
+
Move object near target: move 7up can near apple, move 7up can near blue chip bag, move apple near blue chip bag, move apple near 7up can, move blue chip bag near 7up can, move blue chip bag near apple, move blue plastic bottle near pepsi can, move blue plastic bottle near orange, move pepsi can near orange, move pepsi can near blue plastic bottle, move orange near blue plastic bottle, move orange near pepsi can, move redbull can near rxbar blueberry, move redbull can near water bottle, move rxbar blueberry near water bottle, move rxbar blueberry near redbull can, move water bottle near redbull can, move water bottle near rxbar blueberry, move brown chip bag near coke can, move brown chip bag near green can, move coke can near green can, move coke can near brown chip bag, move green can near brown chip bag, move green can near coke can, move green jalapeno chip bag near green rice chip bag, move green jalapeno chip bag near orange can, move green rice chip bag near orange can, move green rice chip bag near green jalapeno chip bag, move orange can near green jalapeno chip bag, move orange can near green rice chip bag, move redbull can near sponge, move sponge near water bottle, move sponge near redbull can, move water bottle near sponge, move 7up can near blue blastic bottle, move 7up can near green can, move blue plastic bottle near green can, move blue plastic bottle near 7up can, move green can near 7up can, move green can near blue plastic bottle, move apple near brown chip bag, move apple near green jalapeno chip bag, move brown chip bag near green jalapeno chip bag, move brown chip bag near apple, move green jalapeno chip bag near apple, move green jalapeno chip bag near brown chip bag.
|
md/dev/10uNUgI5Kl/10uNUgI5Kl.md
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# REWARD DESIGN WITH LANGUAGE MODELS
|
| 2 |
+
|
| 3 |
+
Minae Kwon, Sang Michael Xie, Kalesha Bullard†, Dorsa Sadigh Stanford University, DeepMind† {minae, xie, dorsa}@cs.stanford.edu, ksbullard@deepmind.com†
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Reward design in reinforcement learning (RL) is challenging since specifying human notions of desired behavior may be difficult via reward functions or require many expert demonstrations. Can we instead cheaply design rewards using a natural language interface? This paper explores how to simplify reward design by prompting a large language model (LLM) such as GPT-3 as a proxy reward function, where the user provides a textual prompt containing a few examples (few-shot) or a description (zero-shot) of the desired behavior. Our approach leverages this proxy reward function in an RL framework. Specifically, users specify a prompt once at the beginning of training. During training, the LLM evaluates an RL agent’s behavior against the desired behavior described by the prompt and outputs a corresponding reward signal. The RL agent then uses this reward to update its behavior. We evaluate whether our approach can train agents aligned with user objectives in the Ultimatum Game, matrix games, and the DEALORNODEAL negotiation task. In all three tasks, we show that RL agents trained with our framework are well-aligned with the user’s objectives and outperform RL agents trained with reward functions learned via supervised learning. Code and prompts can be found here.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Autonomous agents are becoming increasingly capable with the rise of compute and data. This underscores the importance for human users to be able to control what policies the agents learn and ensure the policies are aligned with their objectives. For instance, imagine training an agent to represent users in a salary negotiation. A working mother fighting for a livable wage may want their agent to be stubborn whereas a new hire looking to develop a good relationship with the company may want their agent to be more versatile.
|
| 12 |
+
|
| 13 |
+
Currently, users specify desired behaviors by 1) designing reward functions or 2) providing large amounts of labeled data. Both approaches are challenging and impractical for different reasons. Designing reward functions is not an intuitive way to specify preferences. For instance, it isn’t straightforward how to write a reward function for a “versatile” negotiator. Furthermore, designing reward functions that balance between different objectives — also known as the “reward design problem” — is notoriously difficult because agents are susceptible to reward hacking (Amodei et al., 2016; Hadfield-Menell et al., 2017). On the other hand, one can learn a reward function from labeled examples. However, that is not possible with a single example; we need large amounts of labeled data to capture the nuances of different users’ preferences and objectives, which has shown to be costly (Zhang et al., 2016). Additionally, both approaches do not generalize well to new users who have different objectives — we would have to re-design our reward functions or re-collect data.
|
| 14 |
+
|
| 15 |
+
Our aim is to create an easier way for users to communicate their preferences, where the interface is more intuitive than crafting a reward function and where they can cheaply specify their preferences with no more than a few examples. To do this, we leverage large language models (LLMs) that are trained on internet-scale text data and have shown an impressive ability to learn in-context from few or zero examples (Brown et al., 2020). Our key insight is that
|
| 16 |
+
|
| 17 |
+
The scale of data that LLMs have been trained on make them great in-context learners and also allows them to capture meaningful commonsense priors about human behavior. Given a few examples or a description demonstrating the user’s objective, an LLM should be able to provide an accurate instantiation of reward values on a new test example, allowing for easier generalization to new objectives.
|
| 18 |
+
|
| 19 |
+
To this end, we explore how to prompt an LLM as a proxy reward function to train RL agents from user inputs. In our approach, the user specifies an objective with a natural language prompt. Objectives can be specified with a few examples when they are difficult to define (such as “versatility”) or as a single phrase when they are well-known concepts (such as “Pareto-optimality”). We use the prompt and the LLM to define a reward function for training an RL agent. The LLM takes the user prompt and a trajectory from an RL episode as input and outputs a score (e.g., “No” or $\ " { } 0 \ " { }$ ) for whether the trajectory satisfies the user’s objective, which we parse as an integer reward for the RL agent (Figure 1).
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Depiction of our framework on the DEALORNODEAL negotiation task. A user provides an example and explanation of desired negotiating behavior (e.g., versatility) before training. During training, (1) we provide the LLM with a task description, a user��s description of their objective, an outcome of an episode that is converted to a string, and a question asking if the outcome episode satisfies the user objective. (2-3) We then parse the LLM’s response back into a string and use that as the reward signal for the Alice the RL agent. (4) Alice updates their weights and rolls out a new episode. (5) We parse the episode outcome int a string and continue training. During evaluation, we sample a trajectory from Alice and evaluate whether it is aligned with the user’s objective.
|
| 23 |
+
|
| 24 |
+
There are two advantages to prompting LLMs as a proxy reward function: (1) we can leverage LLM’s in-context learning abilities and prior knowledge on human behavior so that users only need to provide a handful of example desirable behaviors and (2) users can specify their preferences intuitively using language. On the other hand, a potential disadvantage is that it is unclear how much prompt design will be required for the LLM to reliably infer user intent (see Sec. 5 for a discussion). The goal of this paper is to explore how well LLMs can train objective-aligned agents by providing reward signals, and empirically examine whether we can do so with no more than a few examples. Our contributions are as follows:
|
| 25 |
+
|
| 26 |
+
• We introduce the idea of using LLMs as a proxy reward function.
|
| 27 |
+
• We propose a general RL training framework that leverages this proxy reward and is agnostic to the RL algorithm used.
|
| 28 |
+
• We show that an LLM can more accurately train objective-aligned RL agents by an average of $3 5 \%$ compared the baseline. We use few-shot prompting for the Ultimatum Game and DEALORNODEAL negotiation task as well as zero-shot prompting in Matrix Games.
|
| 29 |
+
• We conduct a pilot study with 10 human users. Users rate our agent to be significantly more aligned with their objective than an agent trained with a different one, $p { < } 0 . 0 0 1$ .
|
| 30 |
+
• We provide further analysis quantifying the amount of user data required for our approach as well as the effect varying prompts has on the LLM’s reward signal accuracy.
|
| 31 |
+
|
| 32 |
+
# 2 RELATED WORK
|
| 33 |
+
|
| 34 |
+
Using Language for Reward Shaping. Recent Reinforcement Learning from Human Feedback (RLHF) works Ouyang et al. (2022); Bai et al. (2022) use LLMs as rewards by fine-tuning them on large amounts of user data. Our work does not fine-tune LLMs but uses in-context learning from only a handful of user data.
|
| 35 |
+
|
| 36 |
+
Several works Goyal et al. (2019); Carta et al. (2022); Mirchandani et al. (2021) shape rewards by training an RL agent to learn and complete intermediate tasks guided by language. In contrast, our framework does not focus on generating subtasks but leverages the in-context learning abilities of an LLM to determine whether an agent’s policy satisfies the higher-level task.
|
| 37 |
+
|
| 38 |
+
RL and Foundation Models. We leverage large language models such as GPT-3 (Brown et al., 2020) to learn a proxy reward function while avoiding the need for many expert demonstrations. Ahn et al. (2022); Huang et al. (2022) use an LLM to provide a plan which guides a robot with reasonable/feasible actions towards a human goal (e.g., with enumerating subtasks). In contrast, our work is different in that we are using an LLM to identify if a behavior satisfies “hard-to-specify” properties of a human’s objective and also offers users more control over how they want their policy to be executed. In the vision domain, Parisi et al. (2022) used pre-trained vision models as a feature extractor for the learned policy, but not to design a reward signal. In a similar spirit of leveraging self-supervised pre-training to design a flexible reward function, Chen et al. (2021) use a broad dataset of human videos and a small dataset of robot videos to train a reward function, which improves generalization to new environments and tasks. The interface for the desired task is a video of the task to be completed, instead of text in our framework, and the domain is restricted to robot tasks. More related works can be found in Sec. A.2.
|
| 39 |
+
|
| 40 |
+
# 3 USING LLMS AS A REWARD SIGNAL
|
| 41 |
+
|
| 42 |
+
Our goal is to use an LLM as a proxy reward function to train objective-aligned RL agents from user inputs. We formalize the task using a Markov Decision Process $\mathcal { M } { = } \langle S , \mathcal { A } , p , \mathcal { R } , \gamma \rangle$ , where $s$ is the state space (e.g., in DEALORNODEAL, the space of representations of utterances in the negotiation so far), $\mathcal { A }$ is the action space (e.g., set of all possible utterances), $p { : } S \times \mathcal { A } \times \mathcal { S } [ 0 , 1 ]$ is the transition probability, and $\gamma$ is the discount factor. Traditionally the reward function maps states and actions to a real number $\mathcal { R } : \mathcal { S } \times \mathcal { A } \mathbb { R }$ In our work, we use an LLM as a proxy reward function that takes in a text prompt and outputs a string. We define $A ^ { * }$ to be the set of all strings, $\rho \in A ^ { * }$ as our text prompt (input to the LLM) and the LLM as a function $L L M { \mathrel { : } } A ^ { * } { \mathrel { \to } } A ^ { * }$ . As illustrated in Fig. 1, the prompt $\rho$ is a concatenation of four components including a string to describe the task $\rho _ { 1 } \in A ^ { * }$ and a user-specified string that describes their objectives using examples or a description, $\rho _ { 2 } \in A ^ { * }$ . Additionally, we include a textual description of states and actions from an RL episode, $\rho _ { 3 }$ , using a parser $f : { \cal S } \times { \cal A } { \cal A } ^ { * }$ . $\rho _ { 3 }$ can describe the final state, final action, a trajectory, or any other representation of the episode. Finally, we include a question $\rho _ { 4 } \in A ^ { * }$ that asks whether the RL agent’s behavior, $\rho _ { 3 }$ , satisfies the user’s objective, $\rho _ { 2 }$ . We define an additional parser $g \colon A ^ { * } \to \{ 0 , 1 \}$ that maps the textual output of $L L M$ to a binary value. We use this as the reward signal. Our framework replaces the traditional reward function with a proxy reward, $L L M$ , and can be used with any RL training algorithm.
|
| 43 |
+
|
| 44 |
+
Our framework is depicted in Fig. 1. Before training, a user specifies $\rho _ { 2 }$ which can be $N$ examples describing their objective or a description of their objective using natural language. In Fig. 1 a user provides an example of their objective: versatile negotiating behavior. During training, we construct a prompt $\rho$ by concatenating a description of the task, the user-specified examples/description, an episode’s outcome, and a question asking if the outcome satisfies the objective. We (1) feed the prompt to the LLM, (2) take its output, and (3) parse it into an integer using function $g$ ; we use a handcrafted, task-specific parser. We use the integer as the reward signal. (4) The RL agent then updates its weights and rolls out an episode. (5) We parse the episode outcome into a string using $f$ and continue training; we also instantiate $f$ as handcrafted, task-specific parser. To evaluate our framework, we sample a trajectory (e.g., a negotiation) from the agent and evaluate whether the trajectory is aligned with the user’s objective (e.g., whether Alice demonstrated versatile negotiating behavior).
|
| 45 |
+
|
| 46 |
+
# 4 EXPERIMENTS
|
| 47 |
+
|
| 48 |
+
In this section we investigate three questions to determine the feasibility and efficacy of our approach: (Q1) Can LLMs produce reward signals that are consistent with user objectives from a few examples (few-shot prompting)? (Q2) When objectives are well-known, can LLMs produce objective-consistent reward signals without any examples (zero-shot prompting)? (Q3) Can LLMs provide objective-aligned reward signals from examples (few-shot prompting) in more complex, longer-horizon domains? We evaluate our approach on three tasks: the Ultimatum Game, 2-player Matrix Games, and the DEALORNODEAL negotiation task (Lewis et al., 2017). We address (Q1) using the Ultimatum Game. We use Matrix Games to address (Q2) because it has well-known solution concepts such as Pareto-optimality. The
|
| 49 |
+
|
| 50 |
+
DEALORNODEAL negotiation task is a longer-horizon domain where the LLM rewards agents for negotiating in a user-specified style; we address (Q3) in this task.
|
| 51 |
+
|
| 52 |
+
In practice, we do not have access to ground truth user reward functions — this is the function that we are trying to approximate. However, for most of our experiments, we assume access to the true reward by constructing user reward functions that humans have been shown to have inspired by prior work. We use the true rewards only to evaluate our framework’s performance. Finally, we include a pilot user study where we evaluate agent performance when we do not have access to the ground truth reward. We use the ‘text-davinci-002’ GPT-3 model with temperature 0 as our LLM and our results are reported across 3 random seeds. Details on how we trained RL agents for each task are in A.4. s
|
| 53 |
+
|
| 54 |
+
Evaluation Metrics. We evaluate our approach using the following metrics across our tasks (task-specific metrics are described within each subsection):
|
| 55 |
+
|
| 56 |
+
Labeling Accuracy. We construct ground-truth reward functions for each domain. We report the mean accuracy of predictions of the reward value during RL training with respect to the ground-truth reward functions. This assesses how effectively the LLM can produce reward signals that are consistent with the user’s objective.
|
| 57 |
+
|
| 58 |
+
RL Agent Accuracy. After RL training, we evaluate the learned policy with respect to the ground truth reward functions. We report the mean accuracy of RL agents.
|
| 59 |
+
|
| 60 |
+
# Baselines.
|
| 61 |
+
|
| 62 |
+
SL (Few-shot baseline). A supervised learning (SL) model trained to predict reward signals using the same examples given to the LLM in our framework. Examples are represented using structured non-text inputs, making it an easier problem for the SL model. This baseline only applies to tasks where we use few-shot prompting (Ultimatum Game, DEALORNODEAL). See A.5 for details on training and model architecture for each task.
|
| 63 |
+
|
| 64 |
+
No Objective (Zero-shot baseline). In our zero-shot task, Matrix Games, we do not use any examples so we do not use SL as a baseline. Instead, we use a No Objective baseline where we prompt the LLM without using the user’s description of their objective to isolate the effect the description has on the LLM’s response.
|
| 65 |
+
|
| 66 |
+
RL trained with Ground Truth Reward Functions. RL agents trained with ground truth reward functions.
|
| 67 |
+
We use this as an oracle.
|
| 68 |
+
|
| 69 |
+
4.1 ULTIMATUM GAME: TRAINING OBJECTIVE-ALIGNED AGENTS WITH FEW-SHOT PROMPTING
|
| 70 |
+
|
| 71 |
+
When defining a precise objective is difficult, we can instead give a few examples of desired behavior. For instance, in a resource division game like the Ultimatum Game, it may be difficult for a user to specify the exact percentage (such as $3 2 . 4 \%$ ) of resources they would be happy with receiving. Instead it could be easier for a user to give examples of splits that they would be happy with. We explore whether LLMs can produce reward signals that are consistent with user objectives from a few examples in the Ultimatum Game.
|
| 72 |
+
|
| 73 |
+
Task Description. The Ultimatum Game consists of two players, a Proposer and a Responder. A sum of money is endowed to the Proposer and they must propose a way to split the endowment with the Responder. The Responder can accept or reject the proposed split. If the Responder accepts, players receive money as per the split; if the Responder rejects, then both players get nothing. We train an RL agent to play the Responder. The agent learns to reject proposals according to a user’s preferences. The game consists of a single timestep and our RL agents are trained using DQN for 1e4 steps.
|
| 74 |
+
|
| 75 |
+
Ground Truth User Objectives. A rational Responder would accept any proposal, even if it is unfair because getting something is better than getting nothing (in fact, this is a Nash Equilibrium of the game). However, prior work in behavioral economics shows that humans are willing to “punish” the Proposer by rejecting unfair proposals (Vavra et al., 2018). For instance, a student may reject an unfair proposal only if she receives less than $30 \%$ of the endowment whereas a wealthier person may reject if they receive less than $60 \%$ . We experiment with the following preferences:
|
| 76 |
+
|
| 77 |
+
• Low vs High Percentages. Users will reject proposals if they receive less than $( 3 0 \%$ , $6 0 \% \}$ of the endowment.
|
| 78 |
+
• Low vs High Payoffs. Users will reject unfair proposals if they receive less than $\{ \$ 10,4100 \}$ . They accept unfair proposals otherwise.
|
| 79 |
+
|
| 80 |
+

|
| 81 |
+
Figure 2: Ultimatum Game, Few-shot. (Top) Accuracy of reward signals provided by LLM and SL during RL training when prompted with/trained on 10 vs 1 example. (Bottom) Corresponding accuracy of RL agents after training. LLM is able to maintain a high accuracy when prompted with a single example followed by an explanation. We do not provide figures of Inequity Aversion because both LLM and SL trivially achieve perfect labeling and RL agent accuracy.
|
| 82 |
+
|
| 83 |
+
• Inequity Aversion (Fehr & Schmidt (2010)). Users will reject proposals if they do not receive exactly $5 0 \%$ of the endowment.
|
| 84 |
+
|
| 85 |
+
Prompt Design. We describe a user’s objective using 10 examples of the Ultimatum Game. An example consists of the proposed split, the Responder’s action, and a “yes/no” label of whether the Responder’s action was desirable or undesirable. These examples do not have explanations and resemble a traditional dataset used for supervised learning. We also experiment with using a single example followed by a short explanation. Importantly, we do not explicitly mention the user’s ground truth objective in the prompt. See Fig. 10 in the Appendix for an example of both types of prompts.
|
| 86 |
+
|
| 87 |
+
Design Procedure. We randomly generated 10 proposed splits used for our prompt and sampled one proposal from the set for our single-example case. For Low vs High Percentages and Low vs High Payoffs, we used the same set of proposals across variants (i.e., same proposals for $30 \%$ and $60 \%$ ) and $( \$ 10$ , $\$ 100)$ ). We also randomly generated 50 proposals used to evaluate the LLM. Due to limited resources when querying GPT-3, we query the model’s responses to the 50 evaluation splits in a batched manner and save them. We then use those responses as the reward signal.
|
| 88 |
+
|
| 89 |
+
# 4.1.1 RESULTS
|
| 90 |
+
|
| 91 |
+
Labeling Accuracy. We evaluated our approach on our test set of 50 proposals over 3 seeds; results are shown in Fig. $\cdot$ . When prompted with 10 examples without explanations, the LLM and SL perform similarly well (see Fig. 2, top row). This result is not surprising, given that the decision boundary for the binary decision tasks is relatively simple to learn with 10 training examples.
|
| 92 |
+
|
| 93 |
+
Instead, if we prompt the LLM with a single example followed by an explanation, it maintains a high accuracy whereas SL trained on the same, single example drops in accuracy. We did not use the explanation as part of input when training SL because it only takes non-textual inputs. This result highlights the advantage of using an LLM over a supervised learning model: they require far fewer examples because they can learn from explanations (Lampinen et al., 2022). We find that explanations are critical, as removing explanations when prompting the LLM with a single example results in a drop in LLM labeling accuracy (avg. drop of $3 1 . 6 7 \%$ ) and a drop in RL agent accuracy (avg. drop of $2 8 . 8 \%$ ).
|
| 94 |
+
|
| 95 |
+
RL Agent Accuracy. The accuracy of the trained RL agents mirror the labeling accuracy.
|
| 96 |
+
|
| 97 |
+
Summary. LLMs are efficient in-context learners. They are able to provide reward signals that are consistent with a user’s objectives from examples — even a single example with an explanation will suffice.
|
| 98 |
+
|
| 99 |
+
4.2 MATRIX GAMES: TRAINING OBJECTIVE-ALIGNED AGENTS WITH ZERO-SHOT PROMPTING
|
| 100 |
+
|
| 101 |
+
When objectives are well-known concepts such as Pareto-optimality, can we prompt the LLM without giving any examples? We hypothesize that well-known objectives are likely to be in-distribution for LLMs, and thus LLMs may be able to produce objective-aligned reward signals from zero-shot prompting. Since we do not use examples, we do not use a SL baseline. Instead we use a baseline No Objective where we do not mention any objectives and ask the LLM for a reward signal (see example in Fig. 11 in the Appendix). This baseline evaluates whether the LLM can successfully apply its knowledge of each objective.
|
| 102 |
+
|
| 103 |
+

|
| 104 |
+
Figure 3: Matrix Games, Zero-shot. (Top) Accuracy of reward signals provided by LLM and a No Objective baseline during RL training. We report results for both regular and scrambled versions of matrix games. (Bottom) Accuracy of RL agents after training.
|
| 105 |
+
|
| 106 |
+
Task Description. We consider two-player normal-form matrix games: Battle of the Sexes, Stag Hunt, Chicken, and Prisoner’s Dilemma. Each matrix game has four joint outcomes (i.e., a tuple of joint actions and rewards) and we address pure strategies in this task. The game consists of a single timestep and our RL agents are trained using DQN for 500 steps.
|
| 107 |
+
|
| 108 |
+
Ground Truth User Objectives. Although (mixed) Nash Equilibria are traditional solution concepts for normal form matrix games, users may prefer a solution for other properties. For instance, in Prisoner’s Dilemma, users may prefer both agents to cooperate because they will maximize total welfare even though it is not a Pure Nash Equilibrium. We experiment with four well-known solution concepts (or objectives):
|
| 109 |
+
|
| 110 |
+
• Total Welfare. Outcomes that achieve the greatest sum of player rewards.
|
| 111 |
+
• Equality. Outcomes that result in equal rewards between players.
|
| 112 |
+
• Rawlsian Fairness. Outcomes that maximize the minimum reward any player receives.
|
| 113 |
+
• Pareto-optimality. Outcomes where the one of the corresponding rewards cannot be improved without lowering the other.
|
| 114 |
+
|
| 115 |
+
Prompt Design. Prompts for each solution concept are shown in Fig. 11 in the Appendix. Due to limited resources with querying GPT-3, we queried GPT-3 in a batched manner and saved the corresponding labels to train our RL agents. Our prompt enumerates the outcomes of a matrix game and then asks the LLM for the outcome(s) that satisfy a solution concept. We do not mention the name of the matrix game in the prompt. As in Kojima et al. (2022), we elicit intermediate reasoning steps by asking the LLM to “think step-by-step” and provide a definition of the solution concept. To prevent any bias the LLM may have towards the order in which the outcomes of a matrix game are presented, we also randomly scramble associations between joint actions and rewards (example shown in Fig. 12 in the Appendix).
|
| 116 |
+
|
| 117 |
+
Design Procedure. We tuned the wording of our prompt (e.g., how to describe the matrix game, whether or not to use chain-of-thought prompting) on the Battle of the Sexes matrix game to find a prompt that gave us accurate results. During evaluation, we kept the structure of our prompt the same for all of the matrix games.
|
| 118 |
+
|
| 119 |
+
# 4.2.1 RESULTS
|
| 120 |
+
|
| 121 |
+
Labeling Accuracy. Given that each game can have many outcomes that satisfy a solution concept, we report the LLM’s accuracy if its response does not include any incorrect outcomes. If the LLM identifies any incorrect outcome, we report a score of 0. The LLM produces more objective-aligned reward signals with zero-shot prompting by applying its knowledge of well-known objectives, improving the labeling accuracy over having no objective by $48 \%$ on average with a regular ordering of matrix game outcomes and $36 \%$ with a scrambled order. Scrambling the order of matrix game outcomes in the prompt lowers accuracy for most solution concepts. We suspect that this is because the matrix games are well-known and likely to have been in the LLM’s training set, where each joint action is usually associated with particular payoffs. Scrambling the associations between joint actions and payoffs could make the matrix game more out-of-distribution for the LLM, and thus lower accuracy.
|
| 122 |
+
|
| 123 |
+
RL Agent Accuracy. Compared to labeling accuracy, it is easier for the resulting RL agents to be accurate because they only need to learn one correct outcome, not all of them. Thus, LLMs that only identify one out of two correct outcomes can still train objective-aligned RL agents. Results are shown on the bottom row of Fig. 3. RL agents trained using rewards from the LLM receive perfect accuracy for Total Welfare and Equality and $7 5 \%$ accuracy for the other two objectives. The baseline receives lower accuracy for all objectives.
|
| 124 |
+
|
| 125 |
+
Does the LLM Correctly Identify Each Objective? As part of our prompt, we ask the LLM to provide a definition of the objective before reasoning about whether an outcome satisfies the objective (see Fig. 11 in the Appendix). Table 2 in the Appendix shows how the LLM defines each objective zero-shot. The LLM is able to successfully recall the definitions for each objective except for Rawlsian Fairness – it gets it partially correct. However, the LLM varies in its ability to reason whether an outcome of a game satisfies the objective, which explains why the LLM does not receive perfect labeling accuracy for all objectives.
|
| 126 |
+
|
| 127 |
+
Summary. An LLM is able to identify well-known objectives and provide objective-aligned reward signals in a zero-shot setting.
|
| 128 |
+
|
| 129 |
+
# 4.3 DEALORNODEAL: TRAINING OBJECTIVE-ALIGNED AGENTS IN MULTI-TIMESTEP TASKS
|
| 130 |
+
|
| 131 |
+
We have shown that an LLM can provide objective-aligned reward signals in single-timestep tasks. In longer horizon tasks we must give trajectories instead of states as examples in our prompts. Longer prompts can be challenging because it is less likely for an LLM to have seen them during training. LLMs also have a recency bias which makes it harder for them to remember context introduced earlier on (Zhao et al., 2021). Can an LLM provide objective-aligned signals in longer horizon tasks? We investigate this question in the DEALORNODEAL negotiation task (Lewis et al., 2017).
|
| 132 |
+
|
| 133 |
+
Task Description. DEALORNODEAL is a long-horizon task with a maximum length of 100 timesteps. An agent Alice must come to an agreement with her partner Bob on the allocation of a set of objects (books, hats, and balls). Agents are shown a context, which includes the counts of each item and their private utilities for each item. In the original task, agents get rewarded based on the agreed upon split and their utilities. If Alice and Bob reach a disagreement, both agents get nothing. We train Alice using on-policy RL by negotiating against a fixed partner model, which we refer to as Bob. See Sec. A.4 for more details on the domain and training.
|
| 134 |
+
|
| 135 |
+
Ground Truth User Objectives. We train Alice to negotiate in different styles. For this experiment, we assume we have access to precise definitions in order to evaluate our models. Importantly, we do not give definitions of each style to the LLM, only examples. We experiment with the following negotiation styles inspired by previous literature Sycara et al. (1997); Caputo et al. (2019):
|
| 136 |
+
|
| 137 |
+
• Versatile. Alice does not suggest the same proposal more than once.
|
| 138 |
+
• Push-Over. Alice gets less points than Bob.
|
| 139 |
+
• Competitive. Alice gets more points than Bob.
|
| 140 |
+
• Stubborn. Alice repeatedly suggests the same proposal.
|
| 141 |
+
|
| 142 |
+
Prompt Design. We describe user objectives using three examples. Each example contains a negotiation between Alice and Bob, a question asking whether Alice negotiated in a particular style, and a yes or no answer followed by a short explanation. For an example, see Fig. 13 in the Appendix.
|
| 143 |
+
|
| 144 |
+
Design Procedure. To create example negotiations, we randomly sampled three negotiation contexts for each objective and trained an RL agent (using the original task reward, without the LLM) to negotiate against $B o b$ in these contexts. We then sampled negotiations from the trained model. We also made sure all three sampled negotiations did not have the same ground truth label. We use a separate set of contexts when training RL agents with an LLM in the loop.
|
| 145 |
+
|
| 146 |
+
# 4.3.1 RESULTS
|
| 147 |
+
|
| 148 |
+
Labeling Accuracy. The top row of Fig. 4 shows that the LLM labels more accurately than SL except for Versatile. For Versatile, both models perform similarly because SL learns to overwhelmingly predict a negative label (avg of $9 6 \%$ negative predictions) and the RL agent showed more negative examples of Versatile behavior (avg. of $7 0 \%$ ground truth negative labels). However, the large portion of negative examples prevents the agent from learning correct behavior as shown in the Versatile plot on the bottom of Fig. 4); here, we get a larger performance gap between the LLM and SL.
|
| 149 |
+
|
| 150 |
+

|
| 151 |
+
Figure 4: DEALORNODEAL, Few-shot. (Top) Accuracy of reward signals provided by LLM and SL during RL training. (Bottom) Accuracy of RL agents after training. (Right) Pilot study results. Agents trained with the user’s preferred style were rated as significantly more aligned than an agent trained with the opposite style $p { < } 0 . 0 0 1$ .
|
| 152 |
+
|
| 153 |
+
Table 1: Qualitative results describing negotiations produced by agents trained with LLM.
|
| 154 |
+
|
| 155 |
+
<table><tr><td></td><td>Advantage</td><td>Diversity</td><td>Agreement Rate</td></tr><tr><td>Versatile</td><td>0.17±0.91</td><td>0.99±0.01</td><td>0.98±1.89</td></tr><tr><td>Push-Over</td><td>-2.95±0.64</td><td>0.82±0.26</td><td>1.0±0.0</td></tr><tr><td>Competitive</td><td>2.92±0.64</td><td>0.74±0.25</td><td>0.88±6.5</td></tr><tr><td>Stubborn</td><td>1.36±2.24</td><td>0.52±0.1</td><td>0.82±12.35</td></tr></table>
|
| 156 |
+
|
| 157 |
+
RL Agent Accuracy. Results are shown on bottom row of of Fig. 4. LLM improves RL agent accuracy over SL by $4 6 \%$ on average. Our method approaches the performance of using the true reward; we under perform by an average of $4 \%$ . We remind readers that it is possible to outperform an agent trained with the true reward — especially when the LLM’s labeling accuracy is near-perfect as is the case for Competitive and Stubborn — due to reward hacking or stochasticity during training. For instance, agents trained with the true reward for Competitive end in more disagreements, leading to 0 reward for both agents and a lower accuracy.
|
| 158 |
+
|
| 159 |
+
Is There a Qualitative Difference in Styles? Example negotiations of agents trained with the LLM for each style are shown in Fig. 9 in the Appendix. To measure qualitative differences among styles, we looked at average advantage (Alice’s original task reward - Bob’s original task reward), diversity (percentage of Alice’s utterances that are unique in a negotiation), and agreement rate (percentage of negotiations that end in agreement). The results in Table 1 demonstrate qualitative differences in styles.
|
| 160 |
+
|
| 161 |
+
# 4.3.2 PILOT USER STUDY
|
| 162 |
+
|
| 163 |
+
We conduct a within-subjects pilot user study to determine whether our trained agents can meaningfully align themselves with different user objectives when we do not have access to ground truth objectives and users evaluate agent performance.
|
| 164 |
+
|
| 165 |
+
Method We asked $N { = } 1 0$ users to select a style in which they wanted their agent to negotiate in. We gave them an option to choose from our existing styles (Versatile, Push-Over, Competitive, Stubborn), or come up with their own. Importantly, users did not know how we defined these styles. We then showed users a list of 10 example negotiations generated via selfplay using an RL agent trained with a greedy objective (no particular style). We asked users to select 3 examples (1 positive, 1 negative, and 1 positive or negative) where Alice displayed positive or negative behavior of the user’s chosen style. For each chosen example, we asked users whether Alice demonstrated their chosen style and asked them to provide a ”Yes/No” answer as well as a short explanation. These examples corresponded to unknown, user-specific ground truth reward functions that we did not have access to. We then trained a negotiation agent by incorporating the user-provided examples in the prompt as described in Sec. 3. We also trained an agent to negotiate in the opposite style by flipping the ”Yes/No” labels in the user-provided explanations. We hypothesize that users should perceive a significant difference between these two agents. To evaluate our trained agents, we had both agents negotiate on a set of 10 test negotiations. For each test negotiation, we asked users to rate how well each agent aligned with their chosen style on a scale from 1 (least aligned) to 5 (most aligned).
|
| 166 |
+
|
| 167 |
+
Results Agents trained with the correct style were significantly more aligned (avg. $3 . 7 2 { \pm } 1 . 2 )$ than agents trained with the opposite style (avg. $1 . 5 6 \pm 1 . 0 5 )$ , $p < 0 . 0 0 1$ , see Fig. 4 (right). Users varied in which styles they preferred: 4 users chose styles such as Polite, Push-Over, Considerate and Compromising, 2 users chose Versatile, and 4 users chose styles such as Stubborn, Competitive and Ambitious. These results demonstrate that our framework can produce agents aligned with differently specified objectives by changing the examples in the prompt. Furthermore, these results suggest that our framework can be used when rewards are difficult to define and results are agents with humans.
|
| 168 |
+
|
| 169 |
+
Summary. Our framework can train objective-aligned agents when ground truth rewards are not present in complex, longer-horizon tasks. Agents are able to align the style in which they complete a task as evaluated by automated metrics as well as human users.
|
| 170 |
+
|
| 171 |
+
# 5 ANALYSIS OF DATA EFFICIENCY & PROMPT DESIGN
|
| 172 |
+
|
| 173 |
+
We have shown that we can use an LLM as a proxy reward function to successfully train objective-aligned agents across different tasks. This is a promising result because it represents an important step in enabling human-compatible and value-aligned AI systems. In this section, 1) we further quantify how data efficient our method is and 2) also analyze how robust LLM is to variations of prompt design.
|
| 174 |
+
|
| 175 |
+
1) How Data-efficient is Our Method? We quantify how much more user data a supervised learning baseline would need in order to achieve the same labeling accuracy as the LLM. Results in the Ultimatum Game demonstrate that 10 labeled examples is enough for an SL model to reach comparable performance, whereas a a single labeled example is not sufficient. In this section, we quantify the amount of data needed for DEALORNODEAL because it is an example of a task where the decision boundary is not as easy to learn as the Ultimatum Game. We train SL by adding additional class-balanced, labeled examples to the original three examples it was trained on. We plot the average labeling accuracy SL achieves when trained on increasingly larger amounts of examples as well as the accuracy LLM achieves with three examples, shown in Fig. 6 in the Appendix. Results show that SL requires on the order of hundreds of more labeled examples in order to be comparably accurate as LLM.
|
| 176 |
+
|
| 177 |
+
2) How Much Does LLM’s Labeling Accuracy Change When We Vary the Prompt? As with many approaches that use LLMs, a limitation of our approach is that it requires prompt design. We attempt to quantify the effort required for designing prompts as well as determine the feasibility of using nonengineered prompts from humans. We analyze the effect of prompt variation on labeling accuracy in DEALORNODEAL for the Stubborn objective. We vary different parts of the user-specified prompt at a time: the keyword (i.e., replacing “Stubborn” with its synonyms), the example negotiations, and the explanations associated with each example. Fig. 7 provides a summary of our results. See Sec. A.7 for the full results. Results illustrate that an LLM can be quite robust to different prompts — they all outperform SL. Furthermore, the quality of the explanation seems to be the most important in determining LLM accuracy.
|
| 178 |
+
|
| 179 |
+
# 6 LIMITATIONS & FUTURE WORK
|
| 180 |
+
|
| 181 |
+
User Studies. This work takes a first step in determining whether we can use LLMs as proxy rewards.
|
| 182 |
+
Given promising results, we plan on evaluating our approach with a larger user study.
|
| 183 |
+
|
| 184 |
+
Multimodal Foundation Models. Beyond language models, multimodal foundation models such as Flamingo (Alayrac et al., 2022) can enable us to provide more complex environment states to the foundation model through images or other modalities while preserving an intuitive language interface for specifying the user objective.
|
| 185 |
+
|
| 186 |
+
Non-Binary Rewards. Another limitation of our framework is that the LLM only specifies binary rewards. We plan on exploring how we can incorporate the likelihoods that LLMs produce for each word as a non-binary reward signal.
|
| 187 |
+
|
| 188 |
+
# ACKNOWLEDGMENTS
|
| 189 |
+
|
| 190 |
+
This work was supported by NSF Award 1941722, 2125511, 2006388, AFOSR, DARPA YFA Award, ONR, and JP Morgan Faculty Award. We would also like to thank Karl Tuyls, Ian Gemp, Albert Gu, Siddharth Karamcheti, Kanishk Gandhi, and other reviewers for this paper.
|
| 191 |
+
|
| 192 |
+
# REFERENCES
|
| 193 |
+
|
| 194 |
+
Michael Ahn, Anthony Brohan, Noah Brown, Yevgen Chebotar, Omar Cortes, Byron David, Chelsea Finn, Chuyuan Fu, Keerthana Gopalakrishnan, Karol Hausman, Alex Herzog, Daniel Ho, Jasmine Hsu, Julian Ibarz, Brian Ichter, Alex Irpan, Eric Jang, Rosario Jauregui Ruano, Kyle Jeffrey, Sally Jesmonth, Nikhil J Joshi, Ryan Julian, Dmitry Kalashnikov, Yuheng Kuang, Kuang-Huei Lee, Sergey Levine, Yao Lu, Linda Luu, Carolina Parada, Peter Pastor, Jornell Quiambao, Kanishka Rao, Jarek Rettinghouse, Diego Reyes, Pierre Sermanet, Nicolas Sievers, Clayton Tan, Alexander Toshev, Vincent Vanhoucke, Fei Xia, Ted Xiao, Peng Xu, Sichun Xu, Mengyuan Yan, and Andy Zeng. Do as i can, not as i say: Grounding language in robotic affordances. arXiv, 2022.
|
| 195 |
+
|
| 196 |
+
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, 2022.
|
| 197 |
+
|
| 198 |
+
Dario Amodei, Chris Olah, Jacob Steinhardt, Paul Christiano, John Schulman, and Dan Mane. Concrete ´ problems in ai safety. arXiv preprint arXiv:1606.06565, 2016.
|
| 199 |
+
|
| 200 |
+
Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, et al. Training a helpful and harmless assistant with reinforcement learning from human feedback. arXiv preprint arXiv:2204.05862, 2022.
|
| 201 |
+
|
| 202 |
+
Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
|
| 203 |
+
|
| 204 |
+
Andrea Caputo, Oluremi B Ayoko, Nii Amoo, and Charlott Menke. The relationship between cultural values, cultural intelligence and negotiation styles. Journal of Business Research, 99:23–36, 2019.
|
| 205 |
+
|
| 206 |
+
Thomas Carta, Sylvain Lamprier, Pierre-Yves Oudeyer, and Olivier Sigaud. Eager: Asking and answering questions for automatic reward shaping in language-guided rl. arXiv preprint arXiv:2206.09674, 2022.
|
| 207 |
+
|
| 208 |
+
Annie S. Chen, Suraj Nair, and Chelsea Finn. Learning generalizable robotic reward functions from ”in-the-wild” human videos. ArXiv, abs/2103.16817, 2021.
|
| 209 |
+
|
| 210 |
+
Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. Advances in neural information processing systems, 30, 2017.
|
| 211 |
+
|
| 212 |
+
Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014.
|
| 213 |
+
|
| 214 |
+
Ernst Fehr and Klaus M Schmidt. On inequity aversion: A reply to binmore and shaked. Journal of economic behavior & organization, 73(1):101–108, 2010.
|
| 215 |
+
|
| 216 |
+
Prasoon Goyal, Scott Niekum, and Raymond J Mooney. Using natural language for reward shaping in reinforcement learning. arXiv preprint arXiv:1903.02020, 2019.
|
| 217 |
+
|
| 218 |
+
Dylan Hadfield-Menell, Smitha Milli, Pieter Abbeel, Stuart J Russell, and Anca Dragan. Inverse reward design. Advances in neural information processing systems, 30, 2017.
|
| 219 |
+
|
| 220 |
+
He He, Derek Chen, Anusha Balakrishnan, and Percy Liang. Decoupling strategy and generation in negotiation dialogues. In Empirical Methods in Natural Language Processing (EMNLP), 2018.
|
| 221 |
+
|
| 222 |
+
Wenlong Huang, P. Abbeel, Deepak Pathak, and Igor Mordatch. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. In ICML, 2022.
|
| 223 |
+
|
| 224 |
+
Borja Ibarz, Jan Leike, Tobias Pohlen, Geoffrey Irving, Shane Legg, and Dario Amodei. Reward learning from human preferences and demonstrations in atari. Advances in neural information processing systems, 31, 2018.
|
| 225 |
+
|
| 226 |
+
W Bradley Knox, Alessandro Allievi, Holger Banzhaf, Felix Schmitt, and Peter Stone. Reward (mis) design for autonomous driving. arXiv preprint arXiv:2104.13906, 2021.
|
| 227 |
+
|
| 228 |
+
Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. arXiv, 2022.
|
| 229 |
+
|
| 230 |
+
Minae Kwon, Siddharth Karamcheti, Mariano-Florentino Cuellar, and Dorsa Sadigh. Targeted data acquisition for evolving negotiation agents. In International Conference on Machine Learning, pp. 5894–5904. PMLR, 2021.
|
| 231 |
+
|
| 232 |
+
Andrew K Lampinen, Ishita Dasgupta, Stephanie CY Chan, Kory Matthewson, Michael Henry Tessler, Antonia Creswell, James L McClelland, Jane X Wang, and Felix Hill. Can language models learn from explanations in context? arXiv preprint arXiv:2204.02329, 2022.
|
| 233 |
+
|
| 234 |
+
Mike Lewis, Denis Yarats, Yann N. Dauphin, Devi Parikh, and Dhruv Batra. Deal or no deal? end-to-end learning for negotiation dialogues. In Empirical Methods in Natural Language Processing (EMNLP), 2017.
|
| 235 |
+
|
| 236 |
+
Jessy Lin, Daniel Fried, Dan Klein, and Anca Dragan. Inferring rewards from language in context. arXiv preprint arXiv:2204.02515, 2022.
|
| 237 |
+
|
| 238 |
+
Suvir Mirchandani, Siddharth Karamcheti, and Dorsa Sadigh. Ella: Exploration through learned language abstraction. Advances in Neural Information Processing Systems, 34:29529–29540, 2021.
|
| 239 |
+
|
| 240 |
+
Long Ouyang, Jeff Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, John Schulman, Jacob Hilton, Fraser Kelton, Luke E. Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Francis Christiano, Jan Leike, and Ryan J. Lowe. Training language models to follow instructions with human feedback. ArXiv, abs/2203.02155, 2022.
|
| 241 |
+
|
| 242 |
+
Alexander Pan, Kush Bhatia, and Jacob Steinhardt. The effects of reward misspecification: Mapping and mitigating misaligned models. arXiv preprint arXiv:2201.03544, 2022.
|
| 243 |
+
|
| 244 |
+
Simone Parisi, Aravind Rajeswaran, Senthil Purushwalkam, and Abhinav Kumar Gupta. The unsurprising effectiveness of pre-trained vision models for control. In ICML, 2022.
|
| 245 |
+
|
| 246 |
+
Antonin Raffin, Ashley Hill, Adam Gleave, Anssi Kanervisto, Maximilian Ernestus, and Noah Dormann. Stable-baselines3: Reliable reinforcement learning implementations. Journal of Machine Learning Research, 22(268):1–8, 2021. URL http://jmlr.org/papers/v22/20-1364.html.
|
| 247 |
+
|
| 248 |
+
Stephane Ross, Geoffrey Gordon, and Drew 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, pp. 627–635. JMLR Workshop and Conference Proceedings, 2011.
|
| 249 |
+
|
| 250 |
+
Dorsa Sadigh, Anca D. Dragan, S. Shankar Sastry, and Sanjit A. Seshia. Active preference-based learning of reward functions. In Proceedings of Robotics: Science and Systems (RSS), July 2017. doi: 10.15607/RSS.2017.XIII.053.
|
| 251 |
+
|
| 252 |
+
Katia Sycara, Daniel Zeng, et al. Benefits of learning in negotiation. In Proceedings of the AAAI National Conference on Artificial Intelligence. Menlo Park, California, pp. 36–41, 1997.
|
| 253 |
+
|
| 254 |
+
Peter Vavra, Luke J Chang, and Alan G Sanfey. Expectations in the ultimatum game: distinct effects of mean and variance of expected offers. Frontiers in psychology, 9:992, 2018.
|
| 255 |
+
|
| 256 |
+
Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3):229–256, 1992.
|
| 257 |
+
|
| 258 |
+
Jing Zhang, Xindong Wu, and Victor S Sheng. Learning from crowdsourced labeled data: a survey. Artificial Intelligence Review, 46(4):543–576, 2016.
|
| 259 |
+
|
| 260 |
+
Tony Z. Zhao, Eric Wallace, Shi Feng, Dan Klein, and Sameer Singh. Calibrate before use: Improving fewshot performance of language models. In International Conference on Machine Learning (ICML), 2021.
|
| 261 |
+
|
| 262 |
+
# A APPENDIX0 Tabl
|
| 263 |
+
|
| 264 |
+
# A.1 SUMMARY
|
| 265 |
+
|
| 266 |
+
OF RESULTS: IS IT IS POSSIBLE TO USE LLM AS A PROXY REWARD IN RL TRAINING?
|
| 267 |
+
Figure 5: Average Labeling and RL Agent Accuracy across the different objectives for each task across 3 seeds.
|
| 268 |
+
|
| 269 |
+
<table><tr><td colspan="5">Avg.Labeling Accuracy</td><td colspan="3">Avg.RL Agent Accuracy</td></tr><tr><td></td><td>Zero-shot Baseline (No Obj.)</td><td>Few-shot Baseline (SL)</td><td>Ours</td><td>Zero-shot Baseline (No Obj.)</td><td>Few-shot Baseline (SL)</td><td>Ours</td><td>True Reward</td></tr><tr><td>Ultimatum Game</td><td>-</td><td>0.67 ±0.34</td><td>0.91±0.27</td><td>-</td><td>0.67 ±0.34</td><td>0.9±0.26</td><td>1.0±0.02</td></tr><tr><td>Matrix Games</td><td>0.19 ±0.29</td><td>-</td><td>0.61±0.41</td><td>0.54±0.29</td><td>-</td><td>0.88±0.</td><td>1.0±0.</td></tr><tr><td>DEALORNODEAL</td><td></td><td>0.5± 0.47</td><td>0.9±0.22</td><td></td><td>0.33± 0.42</td><td>0.8±0.33</td><td>0.84 ±0.27</td></tr></table>
|
| 270 |
+
|
| 271 |
+
We provide a summary of results in Fig. 5. The figure depicts the average Labeling and RL Agent Accuracy computed across the different user objectives for each task, across 3 seeds. Overall, our approach is able to produce more objective-aligned reward signals than our baselines. Our approach is also able to produce objective-aligned policies that are close in accuracy to policies trained with the true reward.
|
| 272 |
+
|
| 273 |
+
# A.2 MORE RELATED WORKS
|
| 274 |
+
|
| 275 |
+
Reward Design. Our framework addresses reward design—how to engineer rewards so that they align with our objectives (Amodei et al., 2016). This is challenging because tasks often have conflicting objectives that a human must trade off (Pan et al., 2022). Misspecifying reward functions can lead to reward hacking, or the gaming of specified rewards. Reward hacking has appeared in various domains such as autonomous driving (Knox et al., 2021) and game-playing (Ibarz et al., 2018). We hope to address these challenges by leveraging LLMs and making it easier for humans to specify their objectives.
|
| 276 |
+
|
| 277 |
+
Imitation Learning & Preference-based Learning. Another method of specifying user objectives is to learn them from expert demonstrations (Ross et al., 2011) or preferences Sadigh et al. (2017). These techniques either assume access to large datasets (Christiano et al., 2017) or place restrictive assumptions (such as linearity) about the reward function (Sadigh et al., 2017). Recent work attempts to learn reward functions from language instructions using pragmatic reasoning (Lin et al., 2022). In contrast, our work relies on an LLM’s in-context learning abilities to provide a reward.
|
| 278 |
+
|
| 279 |
+
# A.3 LLM DEFINITION OF OBJECTIVES IN THE MATRIX GAME
|
| 280 |
+
|
| 281 |
+
<table><tr><td rowspan=1 colspan=1>LLMDefns.of ObjectivesTotal welfare is the sum of the rewards of both players.(√)</td></tr><tr><td rowspan=1 colspan=1>Equality of rewards is only possible if both players receive the same reward. (√)</td></tr><tr><td rowspan=1 colspan=1>Rawlsian fairness is defined as the maxmin value of the game, which is theminimum reward that the player could get assuming that the other player ismaximizing their reward. (X)</td></tr><tr><td rowspan=1 colspan=1>An outcome is Pareto-optimal if there is no other outcome that would make one player beter off without making the other player worse off.(√)</td></tr></table>
|
| 282 |
+
|
| 283 |
+
Table 2: Completion of each sentence given by LLM in pink. LLM provides correct definitions for objectives except for Rawlsian Fairness, which is partially correct.
|
| 284 |
+
|
| 285 |
+
# A.4 DETAILS ON RL ENVIRONMENTS AND TRAINING
|
| 286 |
+
|
| 287 |
+
Ultimatum Game. The environment is a single horizon with discrete actions (i.e., accept or reject) and continuous observations (i.e., a proposed split). We train DQN agents using the Stable Baselines3 implementation for 1e4 timesteps with a learning rate of 1e-4 across 3 seeds (Raffin et al., 2021). We instantiate our policy as a MLP with the default parameters used in Stable Baselines3.
|
| 288 |
+
|
| 289 |
+
Parser $g$ . The parser $g$ that transforms the LLM’s output into an integer reward signal is defined using a handcrafted parser. When prompting the LLM, we structure the labels for each example to be in “Yes/No” form which enables the LLM to also reply using the same format. We are then able search for the “Yes” or “No” strings and parse them into a 1 or 0 respectively. In the rare occasion that the LLM does not respond in this form, we skip the episode during RL training and omit the example from our evaluation.
|
| 290 |
+
|
| 291 |
+
Further Analysis on Performance of No Objective Baseline. The average LLM accuracy of a random baseline across the four matrix games are Welfare: 0.125, Equality: 0.125, Rawlsian Fairness: 0.078, Pareto-optimality: 0.172. The No Objective baseline’s performance is close to random as can be verified by comparing the random baseline results with Figure 3 (top row).\* Behaviorally, we observe that No Objective acts like a random baseline: the LLM often hallucinates matrix game rewards and also displays incoherent reasoning when selecting answers.
|
| 292 |
+
|
| 293 |
+
Matrix Game.. The environment is a single horizon with discrete actions (i.e., one of the four joint actions) and no observations. We train DQN agents using the Stable Baselines3 implementation for 500 timesteps with a learning rate of 1e-4 across 3 seeds (Raffin et al., 2021). We instantiate our policy as a MLP with the default parameters used in Stable Baselines3.
|
| 294 |
+
|
| 295 |
+
Parser $g$ . We parse the LLM’s response by hand, since LLM output can be variable in zero-shot settings.
|
| 296 |
+
|
| 297 |
+
DEALORNODEAL. We use a version of the DEALORNODEAL environment used in Kwon et al. (2021). In the environment, the goal is for an agent $A$ to come to an agreement with a partner $B$ on the allocation of a set of objects (books, hats, and balls). During each negotiation, agents receive a context, $c _ { A } = [ i ; u _ { A } ] , c _ { B } =$ $[ i ; u _ { B } ]$ , detailing the count of each item $i$ as well as their private utilities, $u _ { A } , u _ { B }$ . Item counts and utilities are represented as vectors $i \in \{ 1 , . . . , 4 \} ^ { 3 }$ and $u _ { A } , u _ { B } \in \{ 0 , \bar { . . . } , 1 0 \} ^ { 3 }$ and are sampled uniformly.
|
| 298 |
+
|
| 299 |
+
After receiving contexts $c _ { A } , c _ { B }$ , an agent is randomly selected to begin the negotiation. Agents negotiate for $T$ time steps by exchanging coarse dialogue acts $x _ { t }$ at each time step $1 \leq t \leq T$ (He et al., 2018). Rather than negotiate directly in natural language, where the generation problem is hard and can result in degenerate dialogues (He et al., 2018), we use these dialogue acts instead to focus on learning diverse and interpretable strategies.
|
| 300 |
+
|
| 301 |
+
A dialogue act $x _ { t }$ is one of five actions: propose, insist, agree, disagree, or end. The propose and insist acts take allocations of items as arguments $o \ = \ [ o _ { A } ; o _ { B } ]$ where $o _ { A } , o _ { B } \in \{ 1 , . . . , 4 \} ^ { 3 }$ (e.g., propose: books $^ { = 1 }$ , hat $S { = } 2$ , $\mathtt { b a l l s } = 1$ ). When an agent selects end, the conversation terminates and each agent is asked to make their final selection.
|
| 302 |
+
|
| 303 |
+
If agents agree on the final allocation of items, i.e., $o _ { A } + o _ { B } = i$ , agents are awarded points based on their private utilities, $r _ { A } = u _ { A } \cdot o _ { A } , r _ { B } = u _ { B } \cdot o _ { B }$ . If agents do not agree, they receive 0 points. Each agent’s context is constrained so that the agent can receive a maximum of 10 points.
|
| 304 |
+
|
| 305 |
+
Agents are first trained using supervised learning on a dataset of human-human negotiations provided by (Lewis et al., 2017) to predict the next token. We use a learning rate of 1.0 and batch size of 16. We then fine-tune these agents using RL where they optimize the expected reward of each dialogue act using REINFORCE (Williams, 1992). Agents are trained on 250 contexts for 1 epoch with a learning rate of 0.1. We instantiate our policy with four GRUs (Chung et al., 2014). We closely follow the implementation outlined in (Kwon et al., 2021; Lewis et al., 2017), please refer to those papers for more training details.
|
| 306 |
+
|
| 307 |
+
Parser $g$ . The parser $g$ that transforms the LLM’s output into an integer reward signal is defined using a handcrafted parser. When prompting the LLM, we structure the labels for each example to be in “Yes/No” form which enables the LLM to also reply using the same format. We are then able search for the “Yes” or “No” strings and parse them into a 1 or 0 respectively. In the rare occasion that the LLM does not respond in this form, we skip the episode during RL training and omit the example from our evaluation.
|
| 308 |
+
|
| 309 |
+
# A.5 SL MODEL ARCHITECTURE AND TRAINING
|
| 310 |
+
|
| 311 |
+
Ultimatum Game. SL is trained to predict binary labels for a batch of proposed splits. We implemented SL as a multi-layer perceptron (MLP) network that consists of a single hidden layer with depth 32. We also use ReLU activations after our input and hidden layers. We trained the model on the same 10 examples we gave to LLM for 5 epochs with the Adam optimizer. We evaluate the model on the 50 heldout test examples and save the model with the best test accuracy. We show the training and test accuracy for each user objective below:
|
| 312 |
+
|
| 313 |
+
Table 3: Training accuracy for SL on the Ultimatum Game.
|
| 314 |
+
|
| 315 |
+
<table><tr><td></td><td>30%</td><td>60%</td><td>$10</td><td>$100</td><td>Ineq. Aversion</td></tr><tr><td>Train Acc. (10 examples)</td><td>1.0</td><td>1.0</td><td>0.9</td><td>1.0</td><td>1.0</td></tr><tr><td>Train Acc. (1 example)</td><td>1.0</td><td>1.0</td><td>1.0</td><td>1.0</td><td>1.0</td></tr></table>
|
| 316 |
+
|
| 317 |
+
DEALORNODEAL. SL is trained to predict binary labels given a negotiation as input. We closely follow the implementation of a SL model found in (Kwon et al., 2021; Lewis et al., 2017). A negotiation consists of a context, coarse dialogue acts exchanged between Alice and Bob, and the outcome of the negotiation (the final split of items and whether agents agreed or disagreed). Please refer to Sec. A.4 for more details on the environment. We implement SL using a MLP context encoder, MLP outcome encoder, and a GRU ((Chung et al., 2014)) to process the coarse dialogue acts. The MLP encoders consist of an embedding layer followed by a linear layer with a Tanh activation function; we use a hidden size of 64 for the context encoder’s linear layer. We similarly embed each coarse dialogue act before feeding it into the GRU. We use a hidden size of 128 for the GRU. We train SL on the same 3 examples we use in our prompt for LLM. We train for a maximum of 50 epochs using the Adam optimizer. SL received a training accuracy of $1 0 0 \%$ for all of our objectives.
|
| 318 |
+
|
| 319 |
+
# A.6 HOW DATA-EFFICIENT IS OUR METHOD?
|
| 320 |
+
|
| 321 |
+

|
| 322 |
+
SL Labeling Accuracy When Trained with # Additional Labeled Examples
|
| 323 |
+
Figure 6: SL requires on the order of hundreds of more labeled examples in order to be comparably accurate to the LLM.
|
| 324 |
+
|
| 325 |
+
A.7 HOW MUCH DOES LLM’S LABELING ACCURACY CHANGE WHEN WE VARY THE PROMPT?
|
| 326 |
+
Effect of Prompt Variation on Labeling Accuracy for Stubborn (N=3, 3 seeds)
|
| 327 |
+
Figure 7: On average, varying the prompt does not have a large impact on the accuracy of the LLM.
|
| 328 |
+
|
| 329 |
+
<table><tr><td>SL</td><td>Ours</td><td>Vary Keyword</td><td>Vary Example Negotiations</td><td>Vary Explanations</td></tr><tr><td>0.58 ± 0.48</td><td>0.97 ± 0.16</td><td>0.91±0.28</td><td>0.93 ±0.28</td><td>0.79 ±0.33</td></tr></table>
|
| 330 |
+
|
| 331 |
+
We analyze the effect of varying prompts on the LLM’s labeling accuracy for the Stubborn negotiating style in DEALORNODEAL. We vary prompts in three ways: we vary the keyword (i.e., replacing “Stubborn” with its synonyms), the example negotiations, and the explanations associated with each example.
|
| 332 |
+
|
| 333 |
+
When varying the keyword, we use the synonyms: “Headstrong”, “Obstinate”, and a less commonly used word, “Froward”. To vary example negotiations, we randomly sample three new negotiations to have counterbalanced labels, all positive labels, or all negative labels. We vary the explanations by coming up with two plausible sets of explanations a user might have given for each example. We also experiment with the scenario where we give no explanations. Results are shown in Fig. 8. Overall, varying prompts do not have a large impact on labeling accuracy — they all outperform the baseline. However, the quality of explanation seems to have the largest impact on labeling accuracy.
|
| 334 |
+
|
| 335 |
+
# A.8 WHAT IS THE IMPORTANCE OF INCLUDING THE TASK DESCRIPTION, $\rho _ { 1 }$ IN THE PROMPT?
|
| 336 |
+
|
| 337 |
+
We experiment with removing $\rho _ { 1 }$ , the task description in the Ultimatum Game with a single example followed by an explanation. Performance increases slightly in LLM labeling accuracy (avg. of $8 \%$ ) and RL agent accuracy (avg. of $9 \%$ ). We run the same experiment in the Ultimatum game in the case of 10 examples with no explanation. Performance drops slightly in LLM labeling accuracy (avg. $4 . 4 \%$ ) and RL agent accuracy (avg. $5 . 3 \%$ ). We conclude that $\rho _ { 1 }$ is not conclusively influential in improving performance in few-shot settings.
|
| 338 |
+
|
| 339 |
+

|
| 340 |
+
Figure 8: Varying prompts do not have a large impact on labeling accuracy.
|
| 341 |
+
Figure 9: Example negotiations after Alice is trained with reward signals from LLM in DEALORNODEAL. We illustrate qualitative differences in how Alice negotiates for the same context. $B o b$ is an agent that is trained with supervised learning.
|
| 342 |
+
|
| 343 |
+
# A.9 EXPERIMENTING WITH SMALLER LLM SIZES
|
| 344 |
+
|
| 345 |
+
We experiment with GPT-2, a 1.5B parameter model. We We find that GPT-2 underperforms GPT-3 in both labeling (avg. $1 5 \%$ ) and RL agent accuracy (avg. $4 9 \%$ ). GPT-2 outperforms the SL baseline in labeling accuracy (avg. $2 4 \%$ ), and slightly underperforms the SL baseline for RL agent accuracy (avg. $2 . 7 \%$ ). Results are averaged across styles and seeds. GPT-2 (1.5B) is several orders smaller than GPT-3 (175B), and we expect models larger than GPT-2 to close the gap with GPT-3’s performance.
|
| 346 |
+
|
| 347 |
+
A.10 EXAMPLE NEGOTIATIONS
|
| 348 |
+
|
| 349 |
+
# Context
|
| 350 |
+
|
| 351 |
+
Alice : book=(count:1 value:0) hat=(count:1 value:7) ball=(count:3 value:1) Bob : book=(count:1 value:3) hat=(count:1 value:7) ball=(count:3 value:0)
|
| 352 |
+
|
| 353 |
+
<table><tr><td rowspan=1 colspan=1>Versatile</td></tr><tr><td rowspan=1 colspan=1>Alice : propose: item0=1 item1=1 item2=0Bob :propose: item0=0 item1=1 item2=0Alice : propose: item0=1 item1=0 item2=2Bob :agree</td></tr><tr><td rowspan=1 colspan=1>Agreement!Alice : 2 pointsBob :7 pointsCompetitive</td></tr><tr><td rowspan=1 colspan=1>Alice : propose: item0=1 item1=0 item2=3Bob : propose: item0=1 item1=1 item2=0Alice : insist: item0=0 item1=1 item2=3Bob :agree</td></tr><tr><td rowspan=1 colspan=1>Agreement!Alice : 10 pointsBob :3 points</td></tr></table>
|
| 354 |
+
|
| 355 |
+
<table><tr><td>Push-over</td></tr><tr><td>Alice : propose: item0=1 item1=0 item2=3 Bob :propose: itemO=1 item1=1 item2=0 Alice :agree Agreement! Alice : 3 points</td></tr><tr><td>Bob :10 points Stubborn Alice : propose: item0=0 item1=1 item2=1</td></tr><tr><td>Bob :propose: item0=0 item1=1 item2=0 Alice : propose: item0=0 item1=1 item2=1 Bob : propose: item0=0 item1=1 item2=0 Alice : propose: item0=0 item1=1 item2=1 Bob :propose: item0=0 item1=1 item2=0 Alice : propose: item0=0 item1=1 item2=1 Bob:propose: item0=0 item1=1 item2=0 Alice : propose: item0=0 item1=1 item2=1</td></tr></table>
|
| 356 |
+
|
| 357 |
+
Disagreement?! Alice : 0 (potential 0) Bob : 0 (potential 0)
|
| 358 |
+
|
| 359 |
+
# A.11 EXAMPLE OF PROMPTS USED IN OUR EXPERIMENTS
|
| 360 |
+
|
| 361 |
+
# A.11.1 ULTIMATUM GAME
|
| 362 |
+
|
| 363 |
+
Further Explanation of Our Prompt Selection Process. When constructing our explanations, we encourage the LLM to produce intermediate reasoning steps by using the “Let’s think step by step” template usedUltimatum prompt in Kojima et al. (2022) which has been shown to improve performance.
|
| 364 |
+
|
| 365 |
+

|
| 366 |
+
Figure 10: An example of few-shot prompts used for the Ultimatum Game. We highlight the four parts of each pro
|
| 367 |
+
|
| 368 |
+
# A.11.2 MATRIX GAMES
|
| 369 |
+
|
| 370 |
+
Further Explanation of Our Prompt Selection Process. We found that structuring the outcomes of the game as a multiple choice question improved performance. We also encouraged the LLM to produce intermediate reasoning steps by using the “Let’s think step by step” template used in Kojima et al. (2022) which has been shown to improve performance.Matrix prompt
|
| 371 |
+
|
| 372 |
+

|
| 373 |
+
Figure 11: Examples of a zero-shot prompts used for each objective, including the no-objective baseline, in the Matrix Games. Due to limited resources when querying GPT-3, we queried GPT-3 in a batched manner and saved the corresponding labels to train our RL agents. Consequently, we do not have an Episode outcome in our prompts.
|
| 374 |
+
|
| 375 |
+
# A.11.3 DEALORNODEAL
|
| 376 |
+
|
| 377 |
+
Further Explanation of Our Prompt Selection Process. We chose 3 counterbalanced examples from a training set of sample negotiations. This training set was generated via selfplay using an RL agent trained
|
| 378 |
+
|
| 379 |
+
Figure 12: Examples of regular and scrambled outcomes for the Chicken Game (Matrix Game experiments). Scrambling creates new associations between joint actions and joint rewards. We scramble the outcomes in order to remove any bias LLM may have towards the order in which outcomes are normally presented.
|
| 380 |
+
|
| 381 |
+
<table><tr><td>Chicken Game (Regular Order)</td><td>Chicken Game (Scrambled Order)</td></tr><tr><td>We have a two-player game where P1 and P2 can choose one of these options.</td><td>We have a two-player game where P1 and P2 can choose one of these options.</td></tr><tr><td>Options: A.if action1(P1) and action1(P2)=>P1 gets reward of 2, P2 gets reward of 2.</td><td>Options: A. if actionl(P1) and actionl(P2) =>P1 gets reward of 3,P2 gets reward of 1.</td></tr><tr><td>B. if action1(P1) and action2(P2)=>P1 gets reward of 1,P2 gets reward of 3.</td><td>B.if action1(P1) and action2(P2)=>P1 gets reward of 2,P2 gets reward of 2.</td></tr><tr><td>C.if action2(P1) and action1(P2)=>P1 gets reward of 3,P2 gets reward of 1.</td><td>C.if action2(P1) and action1(P2)=>P1 gets reward of 1, P2 gets reward of 3.</td></tr><tr><td>D.if action2(P1) and action2(P2)=>P1 gets reward of 0,P2 gets reward of 0.</td><td>D.if action2(P1)and action2(P2)=>P1 gets reward of 0,P2 gets reward of 0.</td></tr><tr><td></td><td></td></tr><tr><td>Which option(s) are Pareto-optimal? Let's think step by step:</td><td>Which option(s) are Pareto-optimal? Let's think step by step:</td></tr><tr><td>An outcome is Pareto-optimal if</td><td>An outcome is Pareto-optimal if</td></tr></table>
|
| 382 |
+
|
| 383 |
+
with a greedy reward (no particular style). We chose to complement our examples with simple and succinct explanations.
|
| 384 |
+
|
| 385 |
+

|
| 386 |
+
Figure 13: Example of a prompt used for DEALORNODEAL.
|
md/dev/1KaSx3GrBBm/1KaSx3GrBBm.md
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MOVING BEYOND HANDCRAFTED ARCHITECTURES IN SELF-SUPERVISED LEARNING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
The current literature on self-supervised learning (SSL) focuses on developing learning objectives to train neural networks more effectively on unlabeled data. The typical development process involves taking well-established architectures, e.g., ResNet or ViT demonstrated on ImageNet, and using them to evaluate newly developed objectives on downstream scenarios. While convenient, this neglects the role of architectures which has been shown to be crucial in the supervised learning literature. In this work, we establish extensive empirical evidence showing that a network architecture plays a significant role in contrastive SSL. We conduct a large-scale study with over 100 variants of ResNet and MobileNet architectures and evaluate them across 11 downstream scenarios in the contrastive SSL setting. We show that there is no one network that performs consistently well across the scenarios. Based on this, we propose to learn not only network weights but also architecture topologies in the SSL regime. We show that “self-supervised architectures” outperform popular handcrafted architectures (ResNet18 and MobileNetV2) while performing competitively with the larger and computationally heavy ResNet50 on major image classification benchmarks (ImageNet-1K, iNat2021, and more). Our results suggest that it is time to consider moving beyond handcrafted architectures in contrastive SSL and start thinking about incorporating architecture search into self-supervised learning objectives.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Self-supervised learning (SSL) achieves impressive results on challenging tasks involving image, video, audio, and text. Models pretrained on large unlabeled data perform nearly as good and sometimes even better than their supervised counterparts (Caron et al., 2020; Chen & He, 2021). So far, the focus has been on designing effective learning objectives – e.g., pretext tasks (Gidaris et al., 2018; Caron et al., 2018), contrastive (Oord et al., 2018; Chen et al., 2020a) and noncontrastive (Grill et al., 2020) tasks – together with empirical (Cole et al., 2021; Feichtenhofer et al., 2021) and theoretical (Arora et al., 2019; Poole et al., 2019) studies providing key insights and underpinnings. Recent works propose new objectives with a different class of network architectures such as vision transformers (ViT) (Bao et al., 2021) and masked autoencoders (He et al., 2022).
|
| 12 |
+
|
| 13 |
+
However, there has been little focus on the role of architectures in SSL. Currently, the de facto protocol in SSL is to take architectures that perform well on established benchmarks in the supervised setting and to adapt them to the self-supervised setting by plugging in different learning objectives. For example, several existing work on contrastive learning use ResNet (He et al., 2016) as the backbone (Chen et al., 2020a; He et al., 2020). This is partly for convenience. Evaluating different architectures in SSL is computationally expensive; selecting an architecture in advance and fixing it throughout makes it easy to evaluate different learning objectives. This also stems from strong empirical success of those architectures in transfer learning, e.g., CNNs trained on large labeled data provide “unreasonable effectiveness” (Sun et al., 2017; Zhang et al., 2018; Sejnowski, 2020) in a variety of downstream cases. Nonetheless, one implicit assumption is that an architecture that works well in the supervised learning scenario will continue to be effective in the SSL regime.
|
| 14 |
+
|
| 15 |
+
We argue that this assumption is incorrect and dangerous. It is valid only to a limited extent and the performance starts deteriorating significantly when SSL is conducted on data whose distribution deviates much from the original distribution the architecture was trained on. This is counter to the promise of SSL, where one can learn optimal representation for a wide range of tasks. One main reason for performance degradation is that different data distributions benefit from different inductive biases: An architecture with specific layer types and the wiring between them naturally encodes inductive biases, which may be optimal only for a certain data distribution (e.g., objectcentric imagery such as ImageNet) and not for others (e.g., medical and satellite imagery). In fact, numerous studies have shown that standard “recipes” for architecture design do not translate well across different data distributions (Tuggener et al., 2021; Dey et al., 2021; Kolesnikov et al., 2019).
|
| 16 |
+
|
| 17 |
+
The main objective of this work is to show that the choice of network architecture crucially matters in SSL, and that it is not easy to handcraft architectures that are effective across different SSL scenarios. To see this, recall that the goal of SSL is to learn data representations capturing important features and attributes that generalize well across various downstream tasks. There has been extensive literature on the expressivity of neural networks (Raghu et al. (2017); Zhang et al. (2021a) and references therein); one of the important conclusions is that the network topology plays a significant role in determining the expressivity, i.e., the kinds of functions a network can approximate is bounded by the network capacity and available sample size in the finite sample regime. This implies that, in practice, SSL with a fixed architecture learns representations only within the scope of function space induced by the pre-selected architecture topology, and therefore, the ultimate success of SSL can be achieved when it finds optimal architecture from certain search space in conjunction with its weights for specific data distributions.
|
| 18 |
+
|
| 19 |
+
In this paper, we establish extensive empirical evidence showing that architecture matters in selfsupervised learning. We do this in two sets of large-scale studies. First, we sample 116 variants of ResNet (He et al., 2016) and MobileNet (Sandler et al., 2018) architectures with different topologies and evaluate them on 11 downstream tasks in the SSL setting. We pretrain all models under the same setting, optimizing the SimCLR objective (Chen et al., 2020a) on ImageNet (Deng et al., 2009), and investigate if there exist any correlation between these models in downstream performance on different datasets. We observe no strong correlation, except for tasks highly similar to ImageNet. We further show that ImageNet downstream performance, the gold standard benchmark in the SSL literature, is not indicative of performance on other downstream tasks. This implies that we need to be careful in choosing an architecture for evaluating any newly developed SSL objectives, as one might get different conclusions based on different network architectures.
|
| 20 |
+
|
| 21 |
+
This subsequently raises the question: Can we improve SSL by learning not only network weights but also architectures directly optimized for the given dataset? It removes the burden of manually searching for effective architectures in SSL, and if we succeed, it can substantially improve performance of SSL. To test this hypothesis, as the second set of our study, we apply a well-established NAS algorithm (Cai et al., 2018) to the SSL setting. Unlike the typical NAS setting that optimize on a labeled target dataset, we search for optimal architectures directly on an unlabeled pretraining dataset via contrastive learning (Chen et al., 2020a). We evaluate our $\mathrm { ^ { 6 6 } N A S } + \mathrm { S S L } ^ { \mathrm { 3 } }$ framework on datasets with different distributions, ImageNet-1K and iNat 2021 (Van Horn et al., 2021), and show that self-supervised architectures consistently outperform handcrafted ones in the same parameter range (MobileNetV2 and ResNet18) across 11 downstream tasks. This provides strong evidence suggesting the importance of learning architecture topologies in addition to their weights in SSL.
|
| 22 |
+
|
| 23 |
+
Our work focuses on studying the role of architectures in contrastive SSL with the SimCLR framework for CNN-based architectures such as ResNets and MobileNets. As a first step in this direction, we provide an in-depth analysis through large-scale experiments in this specific (yet limited) setting. Extending our study to different SSL approaches (He et al., 2020; Grill et al., 2020; He et al., 2022) and architectures such as ViTs would be an interesting direction but beyond the scope of this paper.
|
| 24 |
+
|
| 25 |
+
In summary, our main contributions are: 1) We establish extensive evidence showing that there isn’t one network architecture performing consistently well across different downstream scenarios in the SimCLR setting. We show this using 116 variants of ResNet and MobileNet architectures pretrained on ImageNet and evaluated on 11 downstream datasets. 2) We show that ImageNet performance (the gold standard in SSL benchmark) is not always indicative of downstream performance. This means that findings about SSL objectives shown only on ImageNet do not generalize across other data distributions. 3) We propose to self-supervise a CNN architecture topology and its network weights on unlabeled data. We show that self-supervised architectures outperform handcrafted ones in a similar parameter range for the SimCLR setting across different downstream datasets.
|
| 26 |
+
|
| 27 |
+
# 2 RELATED WORK
|
| 28 |
+
|
| 29 |
+
Role of architectures in SSL. There has been significant progress in learning representations via SSL (Gidaris et al., 2018; Chen et al., 2020a;c; Caron et al., 2020). Ericsson et al. (2021) provide an overview of different SSL setups and their performance on downstream tasks. Most works focus on improving self-supervised objectives to develop better representations while keeping architectures fixed. Our focus is orthogonal to this line of work. We study the role of architectures in SSL and investigate the benefits of self-supervising architecture topologies along with network weights.
|
| 30 |
+
|
| 31 |
+
Similar to ours, Kornblith et al. (2019) analyze transfer performance of different architectures pretrained on ImageNet across several downstream datasets. However, they focused on supervised learning, which need not translate to self-supervised setups (Kolesnikov et al., 2019). Caron et al. (2021) propose a self-distillation based SSL objective and compare the performance of ResNets with ViTs. In contrast, we focuse on contrastive SSL and the importance of architecture topologies for the class of CNNs. Kolesnikov et al. (2019) is the most related to ours but are limited to pretext-task based SSL and show results only for a few variants of VGG and ResNet. In comparison, we conduct a study on a much larger scale in a contrastive learning setup. Also, we provide insights into generalization performance of the networks across different datasets. Crucially, unlike all previous work in SSL, we propose to learn both architecture topologies and their network weights.
|
| 32 |
+
|
| 33 |
+
NAS and SSL. The literature on NAS has rapidly progressed in the past years; we refer the reader to the NAS survey by Elsken et al. (2019). Here we focus on the most directly relevant work to SSL. Mellor et al. (2021) search for networks without any training and verify their effectiveness of supervised benchmarks. Liu et al. (2020) show that highly performant architectures can be found without using any supervised labels during the search itself, and propose using DARTS (Liu et al., 2019) with self-supervised proxy tasks to search for architectures which will perform well on supervised datasets. In a similar vein, Zhang et al. (2021b) use random labels during the search phase of NAS, and Yan et al. (2020) learn representations of architectures via SSL and use them to improve NAS. Li et al. (2021) introduce a new self-supervised training scheme to search for architectures in a new hybrid search space. One common theme in this line of work is that they aim to harness SSL in aid of NAS. In contrast, we aim to utilize NAS to hunt for architectures which will perform well for self-supervised learning, thereby harnessing NAS in aid of SSL.
|
| 34 |
+
|
| 35 |
+
# 3 DOES ONE NETWORK RULE THEM ALL IN SSL?
|
| 36 |
+
|
| 37 |
+
We conduct a large scale study to investigate whether a particular architecture topology can be consistently effective across a wide range of SSL scenarios. To this end, we sample 116 models with different architecture topologies and analyze their performance on 11 downstream tasks.
|
| 38 |
+
|
| 39 |
+
To maximize generality while taming complexity of our study, we choose two most representative CNN architectures: ResNets and MobileNets. The former is the de facto backbone for numerous modern visual models (Kirillov et al., 2019; Wu et al., 2019) and SSL approaches (Caron et al., 2020; Chen & He, 2021), while the latter is used in low-resource setups (Cheng et al., 2017). We create 69 ResNet-like and 47 MobileNet-like architectures for our evaluation, varying the number of blocks at each of the 4 stages of a ResNet, the block structure (BasicBlock and Bottleneck), width, and number of groups. For MobileNet, we vary the width multiplier parameter and the number of blocks in each of the 6 stages. We choose the SimCLR objective (Chen et al., 2020a) for our experiments and pretrain each of the 116 architectures on ImageNet-1K. Owing to the large scale nature of the experiments and computational constraints, we limit the pretraining to 100 epochs and a batch size of 512. Each of these jobs takes roughly 1 day to finish on a system with $8 \times \mathrm { ~ V 1 0 0 ~ }$ (32GB) GPUs. We report linear evaluation results in all cases.
|
| 40 |
+
|
| 41 |
+
ImageNet performance is not indicative of downstream performance for SSL. To examine the correlation between ImageNet vs. downstream performance, we compute the Spearman’s rank correlation coefficient $\rho$ on top-1 validation accuracy between every dataset pair, shown in Fig. 1. We also show scatter plots in Fig. 2 revealing the relationship between ImageNet vs. downstream performance on the most representative cases; the complete set of scatter plots are in the appendix.
|
| 42 |
+
|
| 43 |
+
For ResNet-like architectures (Fig. 2 top row), we see strong correlation between ImageNet and CIFAR-100 ( $\rho = . 8 )$ ) as these datasets contain similar categories; about 90 classes in CIFAR-100 are the same class or a superclass in ImageNet. A similar observation is made (in Fig. 1) for Stanford Dogs $( \rho = . 7 7 )$ due to the 120 dog categories in ImageNet. However, we observe high variance in transfer performance for out-of-domain datasets, e.g., Flowers $( \rho = . 3 5 )$ , represented by only two ImageNet categories (daisy and yellow lady slipper). Correlation becomes negative on Stanford Cars $( \rho = - . 2 9 )$ and FGVC Aircraft $( \rho = - . 2 4 )$ , likely because ImageNet contains only a few categories of cars (10 classes) and aircraft (4 classes). Low correlation means network ranks are inconsistent and models performing well on ImageNet do not keep their precedence in other tasks.
|
| 44 |
+
|
| 45 |
+

|
| 46 |
+
Figure 2: ImageNet performance is not indicative of downstream performance in SSL. We show linear evaluation top-1 accuracy of ImageNet (x-axis) vs. downstream datasets (y-axis) obtained from variations of ResNet (top) and MobileNet (bottom); all models are pretrained on ImageNet-1K using SimCLR under the same protocol. The solid lines and shaded areas indicate fitted regression models and their confidence intervals.
|
| 47 |
+
|
| 48 |
+
For MobileNet-like architectures (Fig. 2 bottom row), we see overall much lower correlation with ImageNet performance; the ResNet space showed correlation at least for in-distribution datasets. For e.g., we see correlation between ImageNet and CIFAR-100 drops from $\rho = . 8$ (ResNet) to $\rho \ = \ . 2 3$ (MobileNet). For other datasets like MIT67, correlation is higher $( \rho ~ = ~ . 5 2 )$ but still less meaningful due to high variability in performance (notice the cluster around $42 \%$ accuracy). These results indicate that MobileNets are even less tuned towards ImageNet than ResNets and any handcrafted architectures in this space is likely to be suboptimal on ImageNet and other downstream datasets.
|
| 49 |
+
|
| 50 |
+

|
| 51 |
+
Figure 1: ImageNet performance isn’t indicative of downstream performance in SSL. We show rank correlation between each pair of top-1 accuracy on 11 downstream tasks obtained from ImageNet-pretrained ResNets. We see no strong correlation except for ones similar to ImageNet, e.g., CIFAR-10/100 and Dogs120.
|
| 52 |
+
|
| 53 |
+
Our results highlight that the same architecture recipes in terms of ImageNet accuracy, which is frequently used as a predictor for various selfsupervised tasks, do not work well for different datasets in the SimCLR setting.
|
| 54 |
+
|
| 55 |
+
Larger networks do not always perform better in contrastive SSL. In general, large-parameter models yield better performance on ImageNet, both in supervised (Kornblith et al., 2019) and SSL setups (Chen et al., 2020a). We examine whether this trend holds for downstream datasets some of which are widely different from ImageNet. We follow the same setup as above and compute the
|
| 56 |
+
|
| 57 |
+

|
| 58 |
+
Figure 3: Larger models do not always perform better in SSL. We show the model size in terms of parameter counts ( $\mathbf { \widetilde { x } }$ -axis) vs. top-1 accuracy on different datasets obtained from variations of ResNet (top) and MobileNet (bottom) architectures; all models are pretrained on ImageNet-1K using SimCLR under the same protocol.
|
| 59 |
+
|
| 60 |
+
correlation between number of model parameters and top-1 validation accuracy on different datasets.
|
| 61 |
+
Fig. 3 shows scatter plots of the most representative results; full results are in the appendix.
|
| 62 |
+
|
| 63 |
+
For ResNet-like architectures (Fig. 3 top row), we do not see strong trends indicating larger models always perform better. In fact, on some downstream tasks we see negative correlation (Aircraft, $\rho =$ $- . 3 7 )$ with lighter networks being favored for better performance, or even non-linear relationship, e.g., notice the slight “U” pattern on Stanford Cars $\zeta = - . 1 4 )$ , indicating the behavior of ResNets on these datasets are wildly unexpected. Unsurprisingly, there is strong correlation with ImageNet $( \rho = . 8 5 )$ and CIFAR-100 $\langle \rho = . 8 7 \rangle$ , likely because ResNets are heavily hand-tuned on the kinds of images observed in these datasets. These results clearly suggest that the same architecture recipes which work well for ImageNet (increasing parameters through depth and width) do not hold for other downstream scenarios.
|
| 64 |
+
|
| 65 |
+
For MobileNet-like architectures (Fig. 3 bottom row), we see that there exists almost no interpretable trend. The fitted regression models (solid lines) and their confidence intervals (shaded area) show that the relationships are highly non-linear and non-monotonic; we shouldn’t read too much into the correlation coefficients (reported for completeness). These results indicate that MobileNets do not favor any one architecture and it is heavily reliant on the dataset it is trained on.
|
| 66 |
+
|
| 67 |
+
Our results suggest that larger models are not always better in SSL; lighter models can outperform heavier models on tasks like FGVC Aircraft. Previous work (Chen et al., 2020b) showed that increasing network depth/width improves downstream performance. However, they vary depth at a coarser level with 50/100/150 layers and width with $1 \times / 2 \times$ , leading to a large swing in network parameters (24-795M); here we show the same is not true at a finer level. Our results provide evidence that ResNet architectures are tuned to scale well on ImageNet but not the others; the trend is even weaker for MobileNet-like architectures, suggesting they are optimized for computational efficiency and not for achieving high accuracy on any particular dataset.
|
| 68 |
+
|
| 69 |
+
There is no winner in the battle of top vs. bottom heavy networks in SSL. Raghu et al. (2017) showed that CNNs are more sensitive to lower (initial) layer weights, suggesting that “not all weights are created equal” across layers. This raises the question: If CNNs are more sensitive to lower layers, will increasing the parameter count for lower layers yield better performance in SSL? To get insights into this, we split a network into two halves: “top” (layers closer to output) and “bottom” (closer to input). We use the ratio of top to bottom parameters as a measure of networks being “top-heavy” (high ratio) or “bottom-heavy” (low ratio).
|
| 70 |
+
|
| 71 |
+
Fig. 4 shows the downstream accuracy for ImageNet, Stanford Cars and Sports against this ratio. From the top-left subplot, we see that ResNet-ImageNet accuracy tend to increase with high top:bottom ratio, showing top-heavy networks generally perform better than the bottom-heavy counterparts. However, we no longer observe such trend in other datasets, and with MobileNets (Fig. 4 bottom row) we do not see such trend even for ImageNet.
|
| 72 |
+
|
| 73 |
+
An important point to realize: It is necessary to allocate the right portion of parameters to different layers of a given network topology, instead of allocating parameters in the top-heavy or bottom-heavy fashion assuming one will generally lead to better performance. ResNets and many other handcrafted CNNs (Simonyan & Zisserman, 2014; Szegedy et al., 2016; Huang et al., 2017) are usually top-heavy because of GPU memory limits; bottom-heavy networks occupy more memory in terms of activation maps. MobileNets alleviate this to some extent with lighter convolutions, allowing it to have more parameters in early layers. In object detection, Liang et al. (2019) also show that allocation of computational resources in the backbone is important for improved performance. While this architectural difference provides explanations about the wildly different trends we observe above, the key message here is that one recipe (top vs. bottom heavy) does not apply equally to different architectures, bolstering our claim that one network doesn’t rule them all in SSL.
|
| 74 |
+
|
| 75 |
+
Key takeaway: We need to move beyond handcrafted architectures in SSL. The three main observations above imply that finding an optimal architecture could be an important missing piece for selfsupervised learning. Our results show that the current practice in designing SSL objectives – i.e., optimizing for ImageNet performance based on ResNet backbones – could lead to misleading conclusions which do not generalize to other downstream scenarios. Also, the general belief that “the larger the better” in model size do not really hold in SSL, e.g., smaller
|
| 76 |
+
|
| 77 |
+

|
| 78 |
+
Figure 4: There is no winner in the top vs. bottom battle in SSL. Except for ResNet-ImageNet (top-left), we see no strong trend that suggests either top-heavy or bottom-heavy networks perform better.
|
| 79 |
+
|
| 80 |
+
ResNets can outperform larger ones even if they are pretrained following the same protocol. Let’s say, based on these observations, one is compelled to hunt for a new architecture geared specifically towards SSL. Our top vs. bottom analysis suggests that it can be extremely tricky to find the right architecture topology with optimal parameter allocation across different layers. All this suggests that it is time to consider moving beyond handcrafted architectures in SSL and start thinking about searching for optimal architectures as part of self-supervised learning objectives.
|
| 81 |
+
|
| 82 |
+
# 4 NEURAL ARCHITECTURE SEARCH FOR SSL
|
| 83 |
+
|
| 84 |
+
We turn to the idea of learning both the architecture topology and its network weights in an SSL framework, using NAS to improve SSL (rather than using SSL to improve NAS). It is important to draw a clear distinction between our idea and prior work that used SSL to improve NAS (Li et al., 2021; Liu et al., 2020; 2019; Yan et al., 2020; Zhang et al., 2021b) as well as work that used NAS to improve supervised learning (Elsken et al., 2019); our goal here is to show the benefit of harnessing NAS in aid of SSL and not for comparison with more recent SOTA NAS approaches.
|
| 85 |
+
|
| 86 |
+
While examining this idea appears to be straightforward, it requires careful design of experiments. The biggest hurdle is that both NAS and SSL require heavy compute resources; the former needs a search space large enough to cover a comprehensive range of architecture topologies, while the latter requires large datasets and batch sizes to be effective. This calls for an efficient framework to conduct our study. Furthermore, we need datasets large enough to pretrain the models on, and different enough to investigate the importance of data-dependent architectures in SSL. To meet our desiderata, we choose ProxylessNAS (Cai et al., 2018) as our NAS algorithm, MobileNet as our search space, and ImageNet-1K and iNat2021 (Van Horn et al., 2021) as our pretraining datasets.
|
| 87 |
+
|
| 88 |
+

|
| 89 |
+
Figure 5: Samples from datasets used in our study. We choose these datasets because of the apparent domain shift across them. ImageNet contains general yet coarsely categorized images compared to iNat2021, which contains an order of magnitude higher number of fine-grained categories; although some images look similar to each other, every image shown belongs to a different category highlighting the fine-grained nature of this dataset. The downstream datasets, except for CIFAR, are similarly fine-grained but on different domains.
|
| 90 |
+
|
| 91 |
+
# 4.1 EXPERIMENTAL SETUP
|
| 92 |
+
|
| 93 |
+
SSL objective. We use SimCLR (Chen et al., 2020a), one of the most well-established contrastive SSL framework. We follow the same augmentation methods and hyperparameter settings as in Chen et al. (2020a). While more recent SSL works exist (Caron et al., 2020; Chen & He, 2021), they are similar to SimCLR by utilizing a contrastive learning based objective. We adopt SimCLR for its simplicity and leave analysis of other SSL approaches for future work.
|
| 94 |
+
|
| 95 |
+
NAS algorithm. We choose ProxylessNAS for two reasons: efficiency and flexibility. One-shot NAS algorithms produce an architecture topology in a two-step process. They first find an optimal cell structure by solving a proxy task over a small dataset (e.g., CIFAR-10) and a smaller architecture (e.g., 8 cells), and then stack/repeat the best found cell topology for the target task (e.g., ImageNet with 20 cells). This reduces complexity at the cost of flexibility and introduces an optimization gap (Chen et al., 2021), requiring strong correlation between proxy and the actual target datasets. In contrast, ProxylessNAS produces an architecture by directly optimizing on a target task, as it can significantly ameliorate memory requirements of one-shot NAS methods. To ensure flexibility, it uses a “supernet” with a broad range of candidate operations orchestrating depth (via zero operations), width (via wider convolutions), and block structure (by allowing for operations to differ by level). At each training step, it optimizes one “subnet” on the target task as a surrogate, which greatly reduces compute and memory requirements.
|
| 96 |
+
|
| 97 |
+
Datasets. We use ImageNet-1K and iNat2021 to pretrain our models and evaluate them on their validation sets as well as on 10 downstream datasets used in Section 3. We deliberately choose the two pretraining datasets as they exhibit widely different characteristics, i.e., ImageNet-1K contains a variety of objects and scenes, while iNat2021 contains fine-grained species covering the tree of life. The former contains many inorganic object categories not present in the latter. This creates a domain gap, which allows us to investigate the importance of data-dependent architectures in SSL.
|
| 98 |
+
|
| 99 |
+
iNat2021 contains 2.7 million images (twice the size of ImageNet) representing 10K species (ten times more than ImageNet). To investigate the effect of dataset size during architecture search and pretraining, we use both the full and the mini versions of iNat2021 – the latter contains 500K images representing the same 10K classes. This gives us pretraining datasets at three different scales: 500K (iNat2021-mini), 1.2M (ImageNet), 2.7M (iNat2021).
|
| 100 |
+
|
| 101 |
+
Implementation details. For ProxylessNAS, we replace the original supervised classification loss with the contrastive loss of SimCLR and remove the latency loss as we currently do not consider hardware-constrained scenarios. We follow the original training schedule, i.e., a warmup phase for 40 epochs, which optimizes only the network weights and not the NAS parameters, followed by a search phase for 120 epochs. We use the SGD optimizer for network weights and the ADAM optimizer for NAS parameters, using initial learning rates of 0.25 and 0.1, respectively, and use the cosine decay schedule for both.
|
| 102 |
+
|
| 103 |
+
To make our experiments tractable, we use the MobileNetV2 search space which typically yields 3 to 18 million parameters; the ResNet search space is larger, yielding 20 to 60 million parameters. Working with smaller models means we can use large batch sizes, which is important for contrastive learning to work effectively; we use the batch size 640 given our computational budget. The candidate set of NAS operations consists of mobile inverted bottleneck convolution (MBConv) with kernel sizes $\{ 3 , 5 , 7 \}$ , expansion ratios $\{ 3 , 6 \}$ and zero operations. A higher expansion ratio enables a wider network with more channels for convolutions, while zero operations allow for choosing to remove operations, thereby learning the optimal depth. Once the search is done, we take the architecture and discard the learned weights; we train it again from scratch using the SimCLR objective on different datasets. This allows us to compare different architectures on fair ground. After pretraining, we conduct linear evaluation on all downstream datasets.
|
| 104 |
+
|
| 105 |
+
# 4.2 RESULTS AND DISCUSSION
|
| 106 |
+
|
| 107 |
+
Self-supervised architectures outperform handcrafted architectures in SSL. Table 1 compares our self-supervised architectures to MobileNetV2 and ResNet18/50, by searching, pretraining, and evaluating on ImageNet-1K, iNat2021 and iNat2021-mini. We report linear evaluation results on validation splits. The results show that our selfsupervised architectures outperform MobileNetV2 by a large margin, even with similar parameters (about 3M).
|
| 108 |
+
|
| 109 |
+
Table 1: Searched architectures vs. handcrafted architecture results. We search, pretrain, and evaluate ours on each of the three datasets in the last three columns. †SOTA results (in gray) from Chen et al. (2020a) for ImageNet and Cole et al. (2021) for iNat21 require larger batch sizes and longer training.
|
| 110 |
+
|
| 111 |
+
<table><tr><td>Model</td><td>Params</td><td>Batch</td><td>Epochs</td><td>ImageNet</td><td>iNat21</td><td>iNat21-mini</td></tr><tr><td>MobileV2</td><td>3.5M</td><td>640</td><td>100</td><td>41.9</td><td>30.2</td><td>13.6</td></tr><tr><td>Ours</td><td>3.3M</td><td>640</td><td>100</td><td>55.3</td><td>40.3</td><td>14.7</td></tr><tr><td>ResNet18</td><td>11M</td><td>640</td><td>100</td><td>49.8</td><td>30.3</td><td>20.1</td></tr><tr><td>ResNet50</td><td>23.5M</td><td>640</td><td>100</td><td>58.9</td><td>41.3</td><td>23.4</td></tr><tr><td>Ours</td><td>12-18M</td><td>640</td><td>100</td><td>59.1</td><td>43.8</td><td>25.1</td></tr><tr><td>ResNet50</td><td>23.5M</td><td>4096</td><td>1000</td><td>69.3t</td><td>50.6t</td><td>-</td></tr></table>
|
| 112 |
+
|
| 113 |
+
The self-supervised architectures also beat ResNet18 and ResNet50, with even smaller model size than ResNet50. The superior downstream performance of our approach should not be attributed solely to NAS, as the architecture search was performed without ever solving the downstream tasks. It is rather the incorporation of NAS into SSL that improved the quality of representations, leading to downstream performance boost. This shows the effectiveness of learning both the architecture topology and its weights in SSL.
|
| 114 |
+
|
| 115 |
+
Do self-supervised architectures generalize well to different data distributions? We take the three architectures searched on each dataset, discard their learned weights, and pretrain them on each dataset, yielding 9 pretrained models. We then evaluate the performance directly on validation splits of the respective datasets. Table 2 shows that transferring an architecture from $\mathrm { i N a t } 2 0 2 1$ to ImageNet leads to a marginal
|
| 116 |
+
|
| 117 |
+
Table 2: Self-supervised architecture transfer results. We evaluate architectures in the cross-dataset setting, pretraining and evaluating the searched architectures across three datasets (last three columns).
|
| 118 |
+
|
| 119 |
+
<table><tr><td>Searched on</td><td>Params</td><td>ImageNet</td><td>iNat21</td><td>iNat21-mini</td></tr><tr><td>ImageNet</td><td>12-18M</td><td>59.1</td><td>21.5</td><td>23.9</td></tr><tr><td>iNat21</td><td>12-18M</td><td>58.3</td><td>43.8</td><td>27.9</td></tr><tr><td>iNat21-mini</td><td>12-18M</td><td>58.0</td><td>22.4</td><td>25.1</td></tr></table>
|
| 120 |
+
|
| 121 |
+
performance drop compared to an architecture optimized directly on ImageNet $( 5 9 . 1 \%$ to $5 8 . 3 \%$ ); both these architectures still outperform handcrafted ResNet18 $( 4 9 . 8 \% )$ with a comparable model size. However, transferring an architecture from ImageNet to iNat2021 deteriorates performance significantly $( 4 3 . 8 \%$ to $2 1 . { \bar { 5 } } \%$ ). This implies an interesting finding, i.e., iNat21-searched architectures seem to be more resilient to domain shift than ImageNet-searched architectures. This could be due to the difference in dataset size (iNat21 has twice as many images as ImageNet), or due to the fine-grained nature of iNat21 resulting in an overall more difficult instance discrimination task (Chen et al., 2020a) that leads to more discriminative representations. The effect of dataset size on architecture search is also shown on iNat21-mini results. While transferring an architecture from ImageNet to iNat21-mini shows an expected drop in accuracy $( 2 5 . 1 \%$ to $2 3 . 9 \%$ ), transferring from the larger iNat21 improves performance $2 5 . 1 \%$ to $2 7 . 9 \%$ ). As both datasets are in the same domain and only differ in number of samples per class, higher search dataset size is the driving factor behind the gains in accuracy while pretraining on a smaller version of the dataset.
|
| 122 |
+
|
| 123 |
+
Downstream transfer experiments. The results above show that self-supervised architectures are superior to handcrafted architectures when tested in in-distribution settings, which might reflect a practical use case of self-supervised pretraining in the real-world setting (e.g., one has access to only small labeled but large unlabeled data from the same distribution). We now evaluate our approach on a downstream transfer scenario with possible domain shift and with much smaller datasets. To this end, we again use the 10 downstream tasks used in Section 3, which contain datasets coming from both in-distributions and out-of-distributions relative to the pretraining datasets.
|
| 124 |
+
|
| 125 |
+
Table 3: Downstream transfer results. We categorize downstream datasets as in-distribution (green) and outof-distribution (red) relative to the pretraining dataset based on class overlap; best viewed in color. We see that self-supervised architectures generally perform better on in-distribution downstream scenarios.
|
| 126 |
+
|
| 127 |
+
<table><tr><td>Pretrain Dataset</td><td>Arch.</td><td>Params</td><td>Pretrain Val. Set</td><td>CUB</td><td>NABirds</td><td>CIFAR10</td><td>Oxford Flowers</td><td>Stanford Dogs</td><td>Food101</td><td>Sport</td><td>Stanford Cars</td><td>MIT67</td><td>FGVC Aircraft</td></tr><tr><td rowspan="4">ImNet</td><td>MobileV2</td><td>3.5M</td><td>41.9</td><td>20.1</td><td>14.2</td><td>75.8</td><td>85.4</td><td>35.7</td><td>51.6</td><td>94.0</td><td>26.4</td><td>57.5</td><td>35.8</td></tr><tr><td>Ours</td><td>3.3M</td><td>55.3</td><td>31.8</td><td>24.4</td><td>78.8</td><td>91.7</td><td>49.2</td><td>61.7</td><td>94.3</td><td>30.4</td><td>62.5</td><td>38.1</td></tr><tr><td>ResNet18</td><td>11M</td><td>49.8</td><td>27.0</td><td>19.0</td><td>79.9</td><td>89.9</td><td>44.1</td><td>55.8</td><td>94.6</td><td>27.8</td><td>62.1</td><td>36.7</td></tr><tr><td>ResNet50</td><td>23.5M</td><td>58.9</td><td>31.4</td><td>24.6</td><td>85.9</td><td>92.8</td><td>52.3</td><td>65.7</td><td>94.3</td><td>35.1</td><td>69.6</td><td>42.0</td></tr><tr><td rowspan="3">iNat21</td><td>Ours</td><td>3-18M</td><td>59.1</td><td>34.3</td><td>26.1</td><td>81.8</td><td>92.2</td><td>51.0</td><td>64.7</td><td>94.7</td><td>33.2</td><td>66.1</td><td>39.4</td></tr><tr><td>ResNet18</td><td>11M</td><td>30.3</td><td>26.1</td><td>19.0</td><td>73.2</td><td>92.8</td><td>31.3</td><td>55.3</td><td>92.1</td><td>18.9</td><td>49.9</td><td>32.7</td></tr><tr><td>ResNet50</td><td>23.5M</td><td>41.3</td><td>31.2</td><td>23.2</td><td>75.1</td><td>95.1</td><td>39.7</td><td>65.1</td><td>94.3</td><td>22.3</td><td>55.0</td><td>37.6</td></tr><tr><td></td><td>Ours</td><td>3-18M</td><td>43.8</td><td>32.7</td><td>24.1</td><td>76.1</td><td>94.7</td><td>39.0</td><td>63.1</td><td>93.1</td><td>20.1</td><td>49.0</td><td>34.9</td></tr></table>
|
| 128 |
+
|
| 129 |
+
Table 3 summarizes the results (we color code in/out-of-distribution datasets based on our crude categorization; see appendix for our justification). We first compare our self-supervised architectures to MobileNetV2 in the same parameter range (3.5M vs $3 . 3 \mathbf { M }$ ; top two rows). We notice that self-supervised architectures significantly outperform MobileNetV2 in all datasets regardless of distributional shift. This is encouraging (i.e., self-supervised architectures can learn generalizable representations) but at the same time not totally surprising (i.e., MobileNet is optimized for efficiency and not for accuracy). Next, we compare ours to ResNet18 that has a similar parameter range although belonging to a class of architectures much different from our search space. Ours outperforms ResNet18 on all pretraining and evaluation datasets by a considerable margin. This shows that our approach is generalizable and can outperform architectures in the ResNet18 search space even though they are generally more computationally expensive than the MobileNet search space.
|
| 130 |
+
|
| 131 |
+
Finally, we compare ours to ResNet50 which is computationally heavier compared to ResNet18. We preface our analysis with a caveat that our self-supervised architectures are almost half the capacity of ResNet50, limiting their representational power. Keeping this in mind, we see that our approach starts to fail in some of the in-distribution and all of the out-of-distribution scenarios (red shaded cells). This is somewhat disappointing but perhaps expected: self-supervised architectures naturally encode inductive biases specific to the dataset they were optimized on. When a distributional shift happens, their performance can start deteriorating because out-of-domain data might require a different set of inductive biases. The strong performance by ResNet50 imply that the model might be striking the right balance across those datasets in terms of inductive biases, but our results in Table 1 and 2 show that ResNet50 can be less effective on newly developed datasets such as iNat2021.
|
| 132 |
+
|
| 133 |
+
# 5 CONCLUSION
|
| 134 |
+
|
| 135 |
+
This work lays the ground for moving beyond handcrafted architectures in SSL. By conducting large-scale experiments with 116 architectures and 11 downstream tasks, we established extensive empirical evidence showing that there isn’t one architecture that performs consistently well across different downstream scenarios in SSL. Motivated by this, we proposed to move beyond handcrafted architectures and learn both an architecture topology and its network weights in SSL. We provided convincing results demonstrating that the self-supervised architectures significantly outperform handcrafted MobileNetV2 and ResNet18 architectures on 11 downstream tasks, and competitively with ResNet50 even with almost half the model size. We re-emphasize that improvements are not solely due to NAS, as the architecture search was performed by solving SSL and not by optimizing directly on downstream tasks as in the typical NAS setting.
|
| 136 |
+
|
| 137 |
+
Our work barely scratches the surface and opens up many doors for future directions. Will our findings hold for different architectures such as Transformers and different modalities such as video and text? How can we make architecture search more effective for SSL? Can ideas from domain generalization improve the transferability of self-supervised architectures in the out-of-distribution setting? Or is it even the right idea to expect learned architectures to generalize to widely different domains? We hope the readers are as excited as us to investigate these challenging questions.
|
| 138 |
+
|
| 139 |
+
# REFERENCES
|
| 140 |
+
|
| 141 |
+
Sanjeev Arora, Hrishikesh Khandeparkar, Mikhail Khodak, Orestis Plevrakis, and Nikunj Saunshi. A theoretical analysis of contrastive unsupervised representation learning. arXiv preprint arXiv:1902.09229, 2019. 1
|
| 142 |
+
|
| 143 |
+
Hangbo Bao, Li Dong, and Furu Wei. Beit: Bert pre-training of image transformers. arXiv preprint arXiv:2106.08254, 2021. 1
|
| 144 |
+
|
| 145 |
+
Han Cai, Ligeng Zhu, and Song Han. Proxylessnas: Direct neural architecture search on target task and hardware. arXiv preprint arXiv:1812.00332, 2018. 2, 6, 15
|
| 146 |
+
|
| 147 |
+
Mathilde Caron, Piotr Bojanowski, Armand Joulin, and Matthijs Douze. Deep clustering for unsupervised learning of visual features. In Proceedings of the European Conference on Computer Vision, pp. 132–149, 2018. 1
|
| 148 |
+
|
| 149 |
+
Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. arXiv preprint arXiv:2006.09882, 2020. 1, 3, 7
|
| 150 |
+
|
| 151 |
+
Mathilde Caron, Hugo Touvron, Ishan Misra, Herve J ´ egou, Julien Mairal, Piotr Bojanowski, and ´ Armand Joulin. Emerging properties in self-supervised vision transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9650–9660, 2021. 3
|
| 152 |
+
|
| 153 |
+
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, 2020a. 1, 2, 3, 4, 7, 8, 15, 17, 18
|
| 154 |
+
|
| 155 |
+
Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey E Hinton. Big self-supervised models are strong semi-supervised learners. Advances in neural information processing systems, 33:22243–22255, 2020b. 5
|
| 156 |
+
|
| 157 |
+
Xin Chen, Lingxi Xie, Jun Wu, and Qi Tian. Progressive darts: Bridging the optimization gap for nas in the wild. International Journal of Computer Vision, 129(3):638–655, 2021. 7
|
| 158 |
+
|
| 159 |
+
Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15750–15758, 2021. 1, 3, 7
|
| 160 |
+
|
| 161 |
+
Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020c. 3
|
| 162 |
+
|
| 163 |
+
Yu Cheng, Duo Wang, Pan Zhou, and Tao Zhang. A survey of model compression and acceleration for deep neural networks. arXiv preprint arXiv:1710.09282, 2017. 3
|
| 164 |
+
|
| 165 |
+
Elijah Cole, Xuan Yang, Kimberly Wilber, Oisin Mac Aodha, and Serge Belongie. When does contrastive visual representation learning work? arXiv preprint arXiv:2105.05837, 2021. 1, 8
|
| 166 |
+
|
| 167 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009. 2, 16, 17, 18, 20
|
| 168 |
+
|
| 169 |
+
Debadeepta Dey, Shital Shah, and Sebastien Bubeck. Fear: A simple lightweight method to rank architectures. arXiv preprint arXiv:2106.04010, 2021. 2
|
| 170 |
+
|
| 171 |
+
Thomas Elsken, Jan Hendrik Metzen, Frank Hutter, et al. Neural architecture search: A survey. J. Mach. Learn. Res., 20(55):1–21, 2019. 3, 6
|
| 172 |
+
|
| 173 |
+
Linus Ericsson, Henry Gouk, and Timothy M Hospedales. How well do self-supervised models transfer? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5414–5423, 2021. 3
|
| 174 |
+
|
| 175 |
+
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, pp. 3299–3309, 2021. 1
|
| 176 |
+
|
| 177 |
+
Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. arXiv preprint arXiv:1803.07728, 2018. 1, 3
|
| 178 |
+
|
| 179 |
+
Jean-Bastien Grill, Florian Strub, Florent Altche, Corentin Tallec, Pierre H Richemond, Elena ´ Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv preprint arXiv:2006.07733, 2020. 1, 2
|
| 180 |
+
|
| 181 |
+
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. 1, 2
|
| 182 |
+
|
| 183 |
+
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. 1, 2
|
| 184 |
+
|
| 185 |
+
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, 2022. 1, 2
|
| 186 |
+
|
| 187 |
+
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. 6
|
| 188 |
+
|
| 189 |
+
Aditya Khosla, Nityananda Jayadevaprakash, Bangpeng Yao, and Fei-Fei Li. Novel dataset for finegrained image categorization: Stanford dogs. In Proc. CVPR Workshop on Fine-Grained Visual Categorization (FGVC), volume 2. Citeseer, 2011. 16, 20
|
| 190 |
+
|
| 191 |
+
Alexander Kirillov, Kaiming He, Ross Girshick, Carsten Rother, and Piotr Dollar. Panoptic segmen- ´ tation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9404–9413, 2019. 3
|
| 192 |
+
|
| 193 |
+
Alexander Kolesnikov, Xiaohua Zhai, and Lucas Beyer. Revisiting self-supervised visual representation learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 1920–1929, 2019. 2, 3
|
| 194 |
+
|
| 195 |
+
Simon Kornblith, Jonathon Shlens, and Quoc V Le. Do better imagenet models transfer better? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2661–2671, 2019. 3, 4
|
| 196 |
+
|
| 197 |
+
Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained categorization. In Proceedings of the IEEE international conference on computer vision workshops, pp. 554–561, 2013. 16, 20
|
| 198 |
+
|
| 199 |
+
Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. 16, 20
|
| 200 |
+
|
| 201 |
+
Changlin Li, Tao Tang, Guangrun Wang, Jiefeng Peng, Bing Wang, Xiaodan Liang, and Xiaojun Chang. Bossnas: Exploring hybrid cnn-transformers with block-wisely self-supervised neural architecture search. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 12281–12291, 2021. 3, 6
|
| 202 |
+
|
| 203 |
+
Li-Jia Li and Li Fei-Fei. What, where and who? classifying events by scene and object recognition. In 2007 IEEE 11th international conference on computer vision, pp. 1–8. IEEE, 2007. 16, 20
|
| 204 |
+
|
| 205 |
+
Feng Liang, Chen Lin, Ronghao Guo, Ming Sun, Wei Wu, Junjie Yan, and Wanli Ouyang. Computation reallocation for object detection. arXiv preprint arXiv:1912.11234, 2019. 6
|
| 206 |
+
|
| 207 |
+
Chenxi Liu, Piotr Dollar, Kaiming He, Ross Girshick, Alan Yuille, and Saining Xie. Are labels ´ necessary for neural architecture search? In European Conference on Computer Vision, pp. 798– 813. Springer, 2020. 3, 6
|
| 208 |
+
|
| 209 |
+
Hanxiao Liu, Karen Simonyan, and Yiming Yang. DARTS: Differentiable architecture search. In International Conference on Learning Representations, 2019. URL https://openreview. net/forum?id=S1eYHoC5FX. 3, 6
|
| 210 |
+
|
| 211 |
+
Subhransu Maji, Esa Rahtu, Juho Kannala, Matthew Blaschko, and Andrea Vedaldi. Fine-grained visual classification of aircraft. arXiv preprint arXiv:1306.5151, 2013. 16
|
| 212 |
+
|
| 213 |
+
Joseph Mellor, Jack Turner, Amos Storkey, and Elliot J. Crowley. Neural architecture search without training, 2021. 3
|
| 214 |
+
|
| 215 |
+
Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. 2011. 16, 20
|
| 216 |
+
|
| 217 |
+
Maria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In 2008 Sixth Indian Conference on Computer Vision, Graphics & Image Processing, pp. 722–729. IEEE, 2008. 16, 20
|
| 218 |
+
|
| 219 |
+
Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. 1
|
| 220 |
+
|
| 221 |
+
Ben Poole, Sherjil Ozair, Aaron Van Den Oord, Alex Alemi, and George Tucker. On variational bounds of mutual information. In International Conference on Machine Learning, pp. 5171– 5180. PMLR, 2019. 1
|
| 222 |
+
|
| 223 |
+
Ariadna Quattoni and Antonio Torralba. Recognizing indoor scenes. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, pp. 413–420. IEEE, 2009. 16, 20
|
| 224 |
+
|
| 225 |
+
Maithra Raghu, Ben Poole, Jon Kleinberg, Surya Ganguli, and Jascha Sohl-Dickstein. On the expressive power of deep neural networks. In international conference on machine learning, pp. 2847–2854. PMLR, 2017. 2, 5
|
| 226 |
+
|
| 227 |
+
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, pp. 4510–4520, 2018. 2
|
| 228 |
+
|
| 229 |
+
Terrence J Sejnowski. The unreasonable effectiveness of deep learning in artificial intelligence. Proceedings of the National Academy of Sciences, 117(48):30033–30038, 2020. 1
|
| 230 |
+
|
| 231 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. 6
|
| 232 |
+
|
| 233 |
+
Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In Proceedings of the IEEE international conference on computer vision, pp. 843–852, 2017. 1
|
| 234 |
+
|
| 235 |
+
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2818–2826, 2016. 6
|
| 236 |
+
|
| 237 |
+
Lukas Tuggener, Jurgen Schmidhuber, and Thilo Stadelmann. Is it enough to optimize cnn architec-¨ tures on imagenet? arXiv preprint arXiv:2103.09108, 2021. 2
|
| 238 |
+
|
| 239 |
+
Grant Van Horn, Elijah Cole, Sara Beery, Kimberly Wilber, Serge Belongie, and Oisin Mac Aodha. Benchmarking representation learning for natural world image collections. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12884–12893, 2021. 2, 6
|
| 240 |
+
|
| 241 |
+
P. Welinder, S. Branson, T. Mita, C. Wah, F. Schroff, S. Belongie, and P. Perona. Caltech-UCSD Birds 200. Technical Report CNS-TR-2010-001, California Institute of Technology, 2010. 16, 20
|
| 242 |
+
|
| 243 |
+
Yuxin Wu, Alexander Kirillov, Francisco Massa, Wan-Yen Lo, and Ross Girshick. Detectron2. 2019. URL https://github. com/facebookresearch/detectron2, 2(3), 2019. 3
|
| 244 |
+
|
| 245 |
+
Shen Yan, Yu Zheng, Wei Ao, Xiao Zeng, and Mi Zhang. Does unsupervised architecture representation learning help neural architecture search? Advances in Neural Information Processing Systems, 33, 2020. 3, 6
|
| 246 |
+
|
| 247 |
+
Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning (still) requires rethinking generalization. Communications of the ACM, 64(3):107– 115, 2021a. 2
|
| 248 |
+
|
| 249 |
+
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, pp. 586–595, 2018. 1
|
| 250 |
+
|
| 251 |
+
Xuanyang Zhang, Pengfei Hou, Xiangyu Zhang, and Jian Sun. Neural architecture search with random labels. arXiv preprint arXiv:2101.11834, 2021b. 3, 6
|
| 252 |
+
|
| 253 |
+
# APPENDIX
|
| 254 |
+
|
| 255 |
+
Fig. 6 provides an overview of our work. We show that no single handcrafted architecture performs consistently well across different tasks. It is therefore imperative to optimize for architecture topologies along with network weights for a specific task. Through extensive empirical results we show that such self-supervised architectures outperform their handcrafted counterparts in the same search space on the respective tasks.
|
| 256 |
+
|
| 257 |
+

|
| 258 |
+
Figure 6: Conventional SSL frameworks learn network weights for a fixed handcrafted architecture (left). We show that learning architecture topologies along with their weights can improve performance in SSL (right).
|
| 259 |
+
|
| 260 |
+
# A SUPERVISED TRAINING PERFORMANCE OF SELF-SUPERVISED ARCHITECTURES
|
| 261 |
+
|
| 262 |
+
In addition to evaluating the performance of the searched architectures for SSL, we analyze their supervised training performance. We use the searched architectures and directly train them, from scratch without any pretraining, on downstream datasets using the supervised labels. Results are summarized in Table 4. We include architectures searched on ImageNet and iNat21, and MobileNetV2 for reference. It shows the searched architectures perform well even in the supervised setting, outperforming the handcrafted MobileNetV2 on most of the downstream datasets. However, a performance degradation is observed in out-of-distribution datasets like Stanford Cars and FGVC Aircraft. This is in line with the discussion in Section 4.2 of the main paper where the searched architecture performances deteriorate with distributional shift. Nevertheless, for the more in-distribution datasets, we obtain higher accuracies showing that the searched architectures are suitable for supervised training as well.
|
| 263 |
+
|
| 264 |
+
Table 4: Supervised performance of searched architectures.
|
| 265 |
+
|
| 266 |
+
<table><tr><td></td><td>CUB</td><td>CIFAR10</td><td>CIFAR100</td><td>Food</td><td>Flowers</td><td>Sport</td><td>Cars</td><td>Aircraft</td></tr><tr><td>MobileNetV2</td><td>58.2</td><td>93.7</td><td>71.9</td><td>80.8</td><td>90.0</td><td>94.2</td><td>88.6</td><td>81.4</td></tr><tr><td>Ours (ImNet)</td><td>57.9</td><td>93.1</td><td>74.7</td><td>78.1</td><td>96.7</td><td>95.0</td><td>71.0</td><td>75.5</td></tr><tr><td>Ours (iNat21)</td><td>64.5</td><td>93.9</td><td>75.8</td><td>81.6</td><td>98.1</td><td>96.3</td><td>72.3</td><td>72.9</td></tr></table>
|
| 267 |
+
|
| 268 |
+
# B CLASS MAPPING FROM IMAGENET TO DOWNSTREAM DATASETS
|
| 269 |
+
|
| 270 |
+
We provide a justification for characterizing downstream datasets as in-distribution/out-ofdistribution with respect to ImageNet as shown in Table 3 of the main paper. We provide a rough class mapping between ImageNet and the 10 downstream datasets. Note that obtaining an exact class mapping is difficult due to only an approximate mapping existing between any 2 datasets. In addition, there can be classes which contribute to improved features for another class while still being semantically different. For example, zebra (n02391049) can contribute to improved features for horses (sorrel-n02389026) due to similar shapes. We now list datasets with corresponding ImageNet classes/superclasses. While some superclasses can contain additional subclasses in the WordNet hierarchy, we restrict to only those classes in the ImageNet-1k dataset. Numbers in bracket denote the total number of classes roughly overlapping.
|
| 271 |
+
|
| 272 |
+
• CIFAR-10 (270): vehicle (n4524313), bird (n1503061), feline (n2120997), frog (n1639765), dog (n2084071), sorrel (n2389026)
|
| 273 |
+
• Stanford Dogs (120): dog (n2084071)
|
| 274 |
+
• CUB (60): bird (n1503061)
|
| 275 |
+
• NABirds (60): bird (n1503061)
|
| 276 |
+
• Food101 (20): nutriment (n7570720), beverage (n7881800), foodstuff (n7566340), sandwich (n7695965), bagel (n7693725), guacamole (n7583066), chocolate sauce (n7836838), carbonara (n7831146), french loaf (n7684084), pretzel (n7695742)
|
| 277 |
+
• Stanford Cars (10): car (n2958343)
|
| 278 |
+
• FGVC Aircraft (3): airliner (n2690373), warplane (n4552348), airship (n2692877)
|
| 279 |
+
• Oxford Flowers (2): yellow lady’s slipper (n12057211), daisy (n11939491)
|
| 280 |
+
• MIT67 (0): -
|
| 281 |
+
• Sports(0): -
|
| 282 |
+
|
| 283 |
+
Due to the inductive biases encoded during the search process specific to the dataset it is searched on, the self-supervised architecture performs well on more in-distribution datasets like CUB or NABirds. However, we see that for datasets like Stanford Cars and subsequent ones, there is little direct class overlap with ImageNet classes. This leads to lesser images being available for self-supervised pretraining which are in-distribution for these datasets. Consequently, due to the relatively out-of-distribution nature of these datasets we see in Table 3 of the main paper, our selfsupervised architectures are outperformed by the ResNet-50 baseline.
|
| 284 |
+
|
| 285 |
+
# C ADDITIONAL IMPLEMENTATION DETAILS
|
| 286 |
+
|
| 287 |
+
We sample ResNet architectures by varying the number of blocks at each of the 4 stages choosing from the set of $2 , 3 , 4$ blocks and choose the ones in the parameter range shown in Fig. 3 while also fitting in GPU memory. For MobileNets, we have 7 sequences (stages) and a higher variation of the number of blocks from [2-6] while also choosing the width parameter from the set $1 . 0 , 1 . 2 , 1 . 4 , 1 . 6 , 1 . 8 , 2 . 0$ and choose the ones in the 2M-7M parameter range and fitting in GPU memory. Note that a high number of blocks in the earlier stages take significantly more GPU memory due to larger feature map sizes.
|
| 288 |
+
|
| 289 |
+
For the architecture search phase, we use the optimizer hyperparameters as explained in Sec. 4.1 of the main paper. We use a weight decay of $4 e ^ { - 5 }$ for the weight parameters excluding batch normalization parameters. The initial convolution is a $3 { \tt X } 3$ convolution with stride 2. The network consists of 6 stages with 4 cells in the first 5 stages and 1 cell in the last stage. By default, the number of channels at each stage is 24, 40, 80, 96, 192, 320, which is multiplied by a constant width multiplier. We downsample it by a factor of 2 at the beginning of the first, second, third and fifth stage. Other architecture details are the default ones used in Cai et al. (2018). We use the same projection head as used normally for SimCLR Chen et al. (2020a) on top of the backbone network, which is a 2048 dimensional hidden layer and 128 dimensional output layer. For evaluation, we remove the projection head and use the output of the network backbone as the feature extractor. Augmentations are the same as in SimCLR with random resize scaling and cropping, flipping and color jitter. A temperature value of $\tau = 0 . 1$ is set for the contrastive loss.
|
| 290 |
+
|
| 291 |
+

|
| 292 |
+
Figure 7: Self-supervised architectures for different pretraining datasets. MB3 and MB6 are the mobile inverted convolutions with expansion ratio of 3 and 6 respectively. We see that the majority of the preferred convolutions is MB6 $7 \times 7$ suggesting that the network prefers convolutions with more parameters for the self-supervised regime due to lots of data. For smaller datasets like iNat21Mini, MB6 convolutions are not as strongly preferred.
|
| 293 |
+
|
| 294 |
+
# D VISUALIZING SELF-SUPERVISED ARCHITECTURES FOR DIFFERENT PRETRAINING DATASETS
|
| 295 |
+
|
| 296 |
+
We visualize the types of convolutions searched at a $1 . 7 5 \mathrm { x }$ width multiplier for the 3 different pretraining datasets: ImageNet, iNat21 and iNat21Mini. Results are shown in Fig. 7. MB3 and MB6 are the mobile inverted convolutions with expansion ratio of 3 and 6 respectively. The grey lines denote the downsampling of image due to strided convolutions. All architectures are followed by a pooling layer to reduce the image size to $1 \times 1$ . In contrast to standard handcrafted architectures, larger $7 \times 7$ convolutions are preferred even in the later stages of the network. We also see that the majority of the preferred convolutions is MB6 $7 \times 7$ suggesting that the network prefers convolutions with more parameters for the self-supervised regime due to lots of data. This is less preferred in smaller datasets like iNat21Mini where MB3 convolutions are common especially in earlier stages of the network. It is difficult to draw conclusions on the type of network preferred between ImageNet and iNat21 showing that it is imperative to search for an optimal architecture rather than handcraft them.
|
| 297 |
+
|
| 298 |
+
# E DOWNSTREAM DATASET PERFORMANCE CORRELATION WITH IMAGENET
|
| 299 |
+
|
| 300 |
+
We show the downstream dataset correlation for all 10 downstream datasets in addition to ImageNet1K Deng et al. (2009): CIFAR10/100 Krizhevsky et al. (2009), Stanford Cars Krause et al. (2013) and Dogs Khosla et al. (2011), CUB-200 Welinder et al. (2010), MIT-67 Quattoni & Torralba (2009), SVHN Netzer et al. (2011), Flowers-102 Nilsback & Zisserman (2008), FGVC-Aircraft Maji et al. (2013), Sports8 Li & Fei-Fei (2007). These are shown for both ResNets (Fig. 8) and MobileNets (Fig. 9). We see similar results for the 5 datasets in addition to those shown in Fig. 3 of main paper. High correlation exists for datasets which are visually similar to ImageNet while it is less correlated for datasets which are out of domain. For MobileNets this correlation is even less pronounced with high variance in performance at higher ImageNet accuracies.
|
| 301 |
+
|
| 302 |
+

|
| 303 |
+
Figure 8: ImageNet performance correlation with 10 different downstream datasets for various ResNets. We show linear evaluation top-1 accuracy of ImageNet $\mathbf { \dot { x } }$ -axis) vs. different downstream datasets (y-axis) obtained from variations of ResNet; all models are pretrained on ImageNet-1K Deng et al. (2009) using SimCLR Chen et al. (2020a) under the same protocol. The solid lines and shaded areas indicate fitted regression models and their confidence intervals.
|
| 304 |
+
|
| 305 |
+

|
| 306 |
+
Figure 9: ImageNet performance correlation with 10 different downstream datasets for various MobileNets. We show linear evaluation top-1 accuracy of ImageNet $\mathbf { \widetilde { x } }$ -axis) vs. different downstream datasets (y-axis) obtained from variations of MobileNet; all models are pretrained on ImageNet-1K Deng et al. (2009) using SimCLR Chen et al. (2020a) under the same protocol. The solid lines and shaded areas indicate fitted regression models and their confidence intervals.
|
| 307 |
+
|
| 308 |
+

|
| 309 |
+
Figure 10: Dataset performance correlation with 10 different datasets for various ResNets. We show the model size in terms of parameter counts $\mathbf { \widetilde { x } }$ -axis) vs. top-1 accuracy on different datasets obtained from variations of ResNet-like architectures; all models are pretrained on ImageNet-1K Deng et al. (2009) using SimCLR Chen et al. (2020a) under the same protocol. The solid lines and shaded areas indicate fitted regression models and their confidence intervals.
|
| 310 |
+
|
| 311 |
+

|
| 312 |
+
Figure 11: Dataset performance correlation with 10 different datasets for various MobileNets. We show the model size in terms of parameter counts $\mathbf { \widetilde { x } }$ -axis) vs. top-1 accuracy on different datasets obtained from variations of MobileNet-like architectures; all models are pretrained on ImageNet-1K Deng et al. (2009) using SimCLR Chen et al. (2020a) under the same protocol. The solid lines and shaded areas indicate fitted regression models and their confidence intervals.
|
| 313 |
+
|
| 314 |
+

|
| 315 |
+
Figure 12: Linear and rank correlation of ResNets between different pairs of 11 datasets We show correlation between every pair of top-1 accuracy on 11 downstream tasks obtained from ImageNet-pretrained ResNets. We see no strong correlation except for ones highly similar to the data the models were originally pretrained on, e.g., CIFAR-10/100 and Dogs120.
|
| 316 |
+
|
| 317 |
+

|
| 318 |
+
|
| 319 |
+

|
| 320 |
+
Figure 13: Linear and rank correlation of MobileNets between different pairs of 11 datasets We show correlation between every pair of top-1 accuracy on 11 downstream tasks obtained from ImageNet-pretrained MobileNets. The correlation
|
| 321 |
+
|
| 322 |
+

|
| 323 |
+
|
| 324 |
+
# F DATASET PERFORMANCE AS A FUNCTION OF NUMBER OF PARAMETERS
|
| 325 |
+
|
| 326 |
+
We show the dataset correlation with respect to number of parameters for 5 more datasets in addition to that shown in Fig. 4 of main paper. Fig. 10 summarizes the results for ResNets while Fig. 11 shows results for MobileNets. We see that similar results hold for the additional 5 datasets where more parameters, and consequently larger networks, does not always lead to better downstream performance.
|
| 327 |
+
|
| 328 |
+
# G LINEAR AND RANK CORRELATION FOR RESNETS/MOBILENETS
|
| 329 |
+
|
| 330 |
+
We show the summary of the correlation across different datasets for both ResNets (Fig. 12) and MobileNets (Fig. 13). In addition to Spearman’s rank correlation coefficient, we also show Pearson’s linear correlation coefficient. While Pearson’s linear coefficient is higher in the case of MobileNets, the linear fit still exhibits high variance for higher ImageNet accuracies, as seen in Fig. 9.
|
| 331 |
+
|
| 332 |
+

|
| 333 |
+
Figure 14: ImageNet performance correlation with 10 different downstream datasets for various ResNets, MobileNets and searched architectures. The searched architectures outperform MobileNets while being comparable with ResNets at fewer parameters.
|
| 334 |
+
|
| 335 |
+
# H DATASET LICENSES
|
| 336 |
+
|
| 337 |
+
Table 5 lists some datasets we used and their licenses.
|
| 338 |
+
|
| 339 |
+
Table 5: Licenses of datasets.
|
| 340 |
+
|
| 341 |
+
<table><tr><td>Dataset</td><td>License</td></tr><tr><td>CIFAR-10 Krizhevsky et al. (2009)</td><td>MIT</td></tr><tr><td>CIFAR-100 Krizhevsky et al. (2009)</td><td>MIT</td></tr><tr><td>ImageNet Deng et al. (2009)</td><td>BSD 3-Clause</td></tr><tr><td>Sport8 Li & Fei-Fei (2007)</td><td>CCO:Public Domain</td></tr><tr><td>Stanford Dogs Khosla et al. (2011)</td><td>BSD3-Clause</td></tr><tr><td>Stanford Cars Krause et al. (2013)</td><td>BSD 3-Clause</td></tr><tr><td>CUB-200 Welinder et al. (2010)</td><td>Data files @ Original Authors</td></tr><tr><td>MIT-67 Quattoni & Torralba a (2009)</td><td>MIT</td></tr><tr><td>SVHN Netzer et al. (2011)</td><td>CCO:Public Domain</td></tr><tr><td>Flowers-102 Nilsback & Zisserman (2008)</td><td>GNU General Public License,version 2</td></tr></table>
|
md/dev/3lge0p5o-M-/3lge0p5o-M-.md
ADDED
|
@@ -0,0 +1,456 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DIFFEDIT: DIFFUSION-BASED SEMANTIC IMAGE EDITING WITH MASK GUIDANCE
|
| 2 |
+
|
| 3 |
+
Guillaume Couairon, Jakob Verbeek, Holger Schwenk Meta AI {gcouairon,jjverbeek, schwenk}@meta.com
|
| 4 |
+
|
| 5 |
+
Matthieu Cord Sorbonne Universite, Valeo.ai´ matthieu.cord@ sorbonne-universite.fr
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Image generation has recently seen tremendous advances, with diffusion models allowing to synthesize convincing images for a large variety of text prompts. In this article, we propose DIFFEDIT, a method to take advantage of text-conditioned diffusion models for the task of semantic image editing, where the goal is to edit an image based on a text query. Semantic image editing is an extension of image generation, with the additional constraint that the generated image should be as similar as possible to a given input image. Current editing methods based on diffusion models usually require to provide a mask, making the task much easier by treating it as a conditional inpainting task. In contrast, our main contribution is able to automatically generate a mask highlighting regions of the input image that need to be edited, by contrasting predictions of a diffusion model conditioned on different text prompts. Moreover, we rely on latent inference to preserve content in those regions of interest and show excellent synergies with mask-based diffusion. DIFFEDIT achieves state-of-the-art editing performance on ImageNet. In addition, we evaluate semantic image editing in more challenging settings, using imagesdit from the COCO dataset as well as text-based generated images.
|
| 10 |
+
|
| 11 |
+

|
| 12 |
+
Figure 1: In semantic image editing the goal is to modify an input image based on a textual query, while otherwise leaving the image as close as possible to the original. In our DIFFEDIT approach, a mask generation module determines which part of the image should be edited, and an encoder infers the latents, to provide inputs to a text-conditional diffusion model which produces the image edit.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
Mask The task of semantic image editing consists in modifying an input image in accordance with a Generation Masked textual transformation query. For instance, given an image of a bowl of fruits and the query “fruits” $ ~ \mathrm { ^ { * } } p e a r s ^ { \prime \prime }$ Module Diffusion , the aim is to produce a novel image where the fruits have been changed into pears, while keeping the bowl and the background as similar as possible to the input image. The text query Encode can also be a more elaborate description like “A basket of fruits”. See the example edits obtained with DIFFEDIT in Figure 1. Semantic image editing bears strong similarities with image generation Text Query A basket of fruits and can be viewed as extending text-conditional image generation with an additional constraint: the Mask generated image should be as close as possible to a given input image.
|
| 17 |
+
|
| 18 |
+
Input Image Module Masked Text-conditional image generation is currently undergoing a revolution, with DALL-E (Ramesh et al., 2021), Cogview (Ding et al., 2021), Make-a-scene (Gafni et al., 2022), Latent Diffusion Models (Rombach et al., 2022), DALL-E 2 (Ramesh et al., 2022) and Imagen (Saharia et al., 2022b), vastly improving state of the art in modelling wide distributions of images and allowing for unprecedented compositionality of concepts in image generation. Scaling these models is a key to their success. State-of-the art models are now trained on vast amounts of data, which requires large computational resources. Similarly to language models pretrained on web-scale data and adapted in downstreams tasks with prompt engineering, the generative power of these big generative models can be harnessed to solve semantic image editing, avoiding to train specialized architectures (Li et al., 2020a; Wang et al., 2022a), or to use costly instance-based optimization (Crowson et al., 2022; Couairon et al., 2022; Patashnik et al., 2021).
|
| 19 |
+
|
| 20 |
+
Diffusion models are an especially interesting class of model for image editing because of their iterative denoising process starting from random Gaussian noise. This process can be guided through a variety of techniques, like CLIP guidance (Nichol et al., 2021; Avrahami et al., 2022; Crowson, 2021), and inpainting by copy-pasting pixel values outside a user-given mask (Lugmayr et al., 2022). These previous works, however, lack two crucial properties for semantic image editing: (i) inpainting discards information about the input image that should be used in image editing (e.g. changing a dog into a cat should not modify the animal’s color and pose); (ii) a mask must be provided as input to tell the diffusion model what parts of the image should be edited. We believe that while drawing masks is common on image editing tools like Photoshop, language-guided editing offers a more intuitive interface to modify images that requires less effort from users.
|
| 21 |
+
|
| 22 |
+
Conditioning a diffusion model on an input image can also be done without a mask, e.g. by considering the distance to input image as a loss function (Crowson, 2021; Choi et al., 2021), or by using a noised version of the input image as a starting point for the denoising process as in SDEdit (Meng et al., 2021). However, these editing methods tend to modify the entire image, whereas we aim for localized edits. Furthermore, adding noise to the input image discards important information, both inside the region that should be edited and outside.
|
| 23 |
+
|
| 24 |
+
To leverage the best of both worlds, we propose DIFFEDIT, an algorithm that leverages a pretrained text-conditional diffusion model for zero-shot semantic image editing, without expensive editingspecific training. DIFFEDIT makes it possible by automatically finding what regions of an input image should be edited given a text query, by contrasting the predictions of a conditional and unconditional diffusion model. We also show how using a reference text describing the input image and similar to the query, can help obtain better masks. Moreover, we demonstrate that using a reverse denoising model, to encode the input image in latent space, rather than simply adding noise to it, allows to better integrate the edited region into the background and produces more subtle and natural edits. See Figure 1 for illustrations. We quantitatively evaluate our approach and compare to prior work using images of the ImageNet and COCO dataset, as well as a set of generated images.
|
| 25 |
+
|
| 26 |
+
# 2 RELATED WORK
|
| 27 |
+
|
| 28 |
+
Semantic image editing. The field of image editing encompasses many different tasks, from photo colorization and retouching (Shi et al., 2020), to style transfer (Jing et al., 2019), inserting objects in images (Gafni & Wolf, 2020; Brown et al., 2022), image-to-image translation (Zhu et al., 2017; Saharia et al., 2022a), inpainting (Yu et al., 2018), scene graph manipulation (Dhamo et al., 2020), and placing subjects in novel contexts (Ruiz et al., 2022). We focus on semantic image editing, where the instruction to modify an image is given in natural language. Some approaches involve training an end-to-end architecture with a proxy objective before being adapted to editing at inference time, based on GANs (Li et al., 2020b;a; Ma et al., 2018; Alami Mejjati et al., 2018; Mo et al., 2018) or transformers (Wang et al., 2022a; Brown et al., 2022; Issenhuth et al., 2021). Others (Crowson et al., 2022; Couairon et al., 2022; Patashnik et al., 2021; Bar-Tal et al., 2022) rely on optimization of the image itself, or a latent representation of it, to modify an image based on a high-level multimodal objective in an embedding space, typically using CLIP (Radford et al., 2021). These approaches are quite computationnaly intensive, and work best when the optimization is coupled with a powerful generative network. Given a pre-trained generative model such as a GAN, it has also been explored to find directions in the latent space that corresponds to specific semantic edits (Hark ¨ onen ¨ et al., 2020; Collins et al., 2020; Shen et al., 2020; Shoshan et al., 2021), which then requires GAN inversion to edit real images (Wang et al., 2022c; Zhu et al., 2020; Grechka et al., 2021).
|
| 29 |
+
|
| 30 |
+
Image editing with diffusion models. Because diffusion models iteratively refine an image starting from random noise, they are easily adapted for inpainting when a mask is given as input. Song et al.
|
| 31 |
+
|
| 32 |
+
(2021) proposed to condition the generation process by copy-pasting pixel values from the reference image at each denoising step. Nichol et al. (2021) use a similar technique by copy-pasting pixels in the estimated final version of the image. Wang et al. (2022b) use DDIM encoding of the input image, and then decode on edited sketches or semantic segmentation maps. The gradient of a CLIP score can also be used to match a given text query inside a mask, as in Paint by Word (Bau et al., 2021), local CLIP-guided diffusion (Crowson, 2021), or blended diffusion (Avrahami et al., 2022). Lugmayr et al. (2022) apply a sequence of noise-denoise operations to better inpaint a specific region. There are also a number of methods that do not require an editing mask. In DiffusionCLIP (Kim & Ye, 2021), the weights of the diffusion model themselves are updated via gradient descent from a CLIP loss with a target text. The high computational cost of fine-tuning a diffusion model for each input image, however, makes it impractical as an interactive image editing tool. In SDEdit (Meng et al., 2021) the image is corrupted with Gaussian noise, and then the diffusion network is used to denoise it. While this method is originally designed to transform sketches to real images and to make pixel-based collages more realistic, we adapt it by denoising the image conditionally to the text query. In ILVR (Choi et al., 2021), the decoding process of diffusion model is guided with the constraint that downsampled versions of the input image and decoded image should stay close. Finally, in recent work concurrent to ours, Hertz et al. (2022) propose to edit images by modifying attention maps during the diffusion process.
|
| 33 |
+
|
| 34 |
+
# 3 DIFFEDIT FRAMEWORK
|
| 35 |
+
|
| 36 |
+
In this section, we first give an overview of diffusion models. We then describe our DIFFEDIT approach in detail, and provide a theoretical analysis comparing DIFFEDIT with SDEdit.
|
| 37 |
+
|
| 38 |
+
# 3.1 BACKGROUND: DIFFUSION MODELS, DDIM AND ENCODING
|
| 39 |
+
|
| 40 |
+
Denoising diffusion probabilistic models (Ho et al., 2020) is a class of generative models that are trained to invert a diffusion process. For a number of timesteps $T$ , the diffusion process gradually adds noise to the input data, until the resulting distribution is (almost) Gaussian. A neural network is then trained to reverse that process, by minimizing the denoising objective
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
\begin{array} { r } { \mathcal { L } = \mathbb { E } _ { \mathbf { x } _ { 0 } , t , \epsilon } \Vert \epsilon - \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) \Vert _ { 2 } ^ { 2 } , } \end{array}
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
where $\epsilon _ { \theta }$ is the noise estimator which aims to find the noise $\mathbf { \epsilon } \gets \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ that is mixed with an input image $\mathbf { x } _ { \mathrm { 0 } }$ to yield $\mathbf { x } _ { t } = \sqrt { \alpha _ { t } } \mathbf { x } _ { 0 } + \sqrt { 1 - \alpha _ { t } } \epsilon$ . The coefficient $\alpha _ { t }$ defines the level of noise and is a decreasing function of the timestep $t$ , with $\alpha _ { 0 } = 1$ (no noise) and $\alpha _ { T } \approx 0$ (almost pure noise).
|
| 47 |
+
|
| 48 |
+
Song et al. (2021) propose to use $\epsilon _ { \theta }$ to generate new images with the $D D I M$ algorithm: starting from $\mathbf { x } _ { T } \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ , the following update rule is applied iteratively until step 0:
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
\mathbf { x } _ { t - 1 } = \sqrt { \alpha _ { t - 1 } } \Bigg ( \frac { \mathbf { x } _ { t } - \sqrt { 1 - \alpha _ { t } } \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) } { \sqrt { \alpha _ { t } } } \Bigg ) + \sqrt { 1 - \alpha _ { t - 1 } } \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) .
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
The variable $\mathbf { x }$ is updated by taking small steps in the direction of $\epsilon _ { \theta }$ . Equation 2 can be written as the neural ODE , taking $\mathbf { u } = \mathbf { x } / \sqrt { \alpha }$ and $\tau = \sqrt { 1 / \alpha - 1 }$ :
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
d \mathbf { u } = \epsilon _ { \theta } ( \frac { \mathbf { u } } { \sqrt { 1 + \tau ^ { 2 } } } , t ) d \tau .
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
This allows to view DDIM sampling as an Euler scheme for solving Equation 3 with initial condition $\mathbf u ( t = T ) \sim \mathcal { N } ( \mathbf 0 , \alpha _ { T } \mathbf I )$ . This illustrates that we can use fewer sampling steps during inference than the value of $T$ chosen during training, by using a coarser discretization of the ODE. In the remainder of the paper, we parameterize the timestep $t$ to be between 0 and 1, so that $t = 1$ corresponds to $T$ steps of diffusion in the original formulation. As proposed by Song et al. (2021), we can also use this ODE to encode an image $\mathbf { x } _ { \mathrm { 0 } }$ onto a latent variable ${ \bf x } _ { r }$ for a timestep $r \leq 1$ , by using the boundary condition $\mathbf { u } ( t = 0 ) = \mathbf { x } _ { 0 }$ instead of $\mathbf { u } ( t = 1 )$ , and applying an Euler scheme until timestep $r$ . In the remainder of the paper, we refer to this encoding process as DDIM encoding, we denote the corresponding function that maps $\mathbf { x } _ { \mathrm { 0 } }$ to ${ \bf x } _ { r }$ as $E _ { r }$ , and refer to the variable $r$ as the encoding ratio. Similarly, we note $D _ { r }$ the inverse function that maps ${ \bf x } _ { r }$ to $\mathbf { x } _ { \mathrm { 0 } }$ , which corresponds to regular DDIM decoding. With sufficiently small steps in the Euler scheme, decoding ${ \bf x } _ { r }$ approximately recovers the original image $\mathbf { x } _ { \mathrm { 0 } }$ . This property is particularly interesting in the context of image editing: all the information of the input image $\mathbf { x } _ { \mathrm { 0 } }$ is encoded in ${ \bf x } _ { r }$ , and can be accessed via DDIM sampling.
|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
Step 1: Compute Mask
|
| 64 |
+
Figure 2: The three steps of DIFFEDIT. Step 1: we add noise to the input image, and denoise it: once conditioned on the query text, and once conditioned on a reference text (or unconditionally). We derive a mask based on the difference in the denoising results. Step 2: we encode the input image with DDIM, to estimate the latents corresponding to the input image. Step 3: we perform DDIM decoding conditioned on the text query, using the inferred mask to replace the background with pixel values coming from the encoding process at the corresponding timestep.
|
| 65 |
+
|
| 66 |
+
# 3.2 SEMANTIC IMAGE EDITING WITH DIFFEDIT
|
| 67 |
+
|
| 68 |
+
In many cases, semantic image edits can be restricted to only a part of the image, leaving other parts unchanged. However, the input text query does not explicitly identify this region, and a naive method could allow for edits all over the image, risking to modify the input in areas where it is not needed. To circumvent this, we propose DIFFEDIT, a method to leverage a text-conditioned diffusion model to infer a mask of the region that needs to be edited. Starting from a DDIM encoding of the input image, DIFFEDIT uses the inferred mask to guide the denoising process, minimizing edits outside the region of interest. Figure 2 illustrates the three steps of our approach, which we detail below.
|
| 69 |
+
|
| 70 |
+
Step 1: Computing editing mask. When the denoising an image, a text-conditioned diffusion model will yield different noise estimates given different text conditionings. We can consider where the estimates are different, which gives information about what image regions are concerned by the change in conditioning text. For instance, in Figure 2, the noise estimates conditioned to the query zebra and reference text horse1 are different on the body of the animal, where they will tend to decode different colors and textures depending on the conditioning. For the background, on the other hand, there is little change in the noise estimates. The difference between the noise estimates can thus be used to infer a mask that identifies what parts on the image need to be changed to match the query. In our algorithm, we use a Gaussian noise with strength $50 \%$ (see analysis in Appendix A.1), remove extreme values in noise predictions and stabilize the effect by averaging spatial differences over a set of $n$ input noises, with $n { = } 1 0$ in our default configuration. The result is then rescaled to the range $[ 0 , 1 ]$ , and binarized with a threshold, which we set to 0.5 by default. The masks generally somewhat overshoot the region that requires editing, this is beneficial as it allows it to be smoothly embedded in it’s context, see examples in Section 4 and Section A.5.
|
| 71 |
+
|
| 72 |
+
Step 2: Encoding. We encode the input image $\mathbf { x } _ { \mathrm { 0 } }$ in the implicit latent space at timestep $r$ with the DDIM encoding function $E _ { r }$ . This is done with the unconditional model, i.e. using conditioning text $\varnothing$ , so no text input is used for this step.
|
| 73 |
+
|
| 74 |
+
Step 3: Decoding with mask guidance. After obtaining the latent ${ \bf x } _ { r }$ , we decode it with our diffusion model conditioned on the editing text query $Q$ , e.g. zebra in the example of Figure 2. We use our mask $M$ to guide this diffusion process. Outside the mask $M$ , the edited image should in principle be the same as the input image. We guide the diffusion model by replacing pixel values outside the mask with the latents $\mathbf { x } _ { t }$ inferred with DDIM encoding, which will naturally map back to the original pixels through decoding, unlike when using a noised version of $\mathbf { x } _ { \mathrm { 0 } }$ as typically done (Meng et al., 2021; Song et al., 2021). The mask-guided DDIM update can be written as $\tilde { \mathbf { y } } _ { t } = M \mathbf { y } _ { t } + ( 1 - M ) \mathbf { x } _ { t }$ , where $\mathbf { y } _ { t }$ is computed from $\mathbf { y } _ { t - d t }$ with Eq. 2, and $\mathbf { x } _ { t }$ is the corresponding DDIM encoded latent.
|
| 75 |
+
|
| 76 |
+
The encoding ratio $r$ determines the strength of the edit: larger values of $r$ allow for stronger edits that allow to better match the text query, at the cost of more deviation from the input image which might not be needed. We evaluate the impact of this parameter in our experiments. We illustrate the effect of the encoding ratio in Appendix A.5.
|
| 77 |
+
|
| 78 |
+
# 3.3 THEORETICAL ANALYSIS
|
| 79 |
+
|
| 80 |
+
In DIFFEDIT, we use DDIM encoding to encode images before doing the actual editing step. In this section, we give theoretical insight on why this component yields better editing results than adding random noise as in SDEdit (Meng et al., 2021). With ${ \bf x } _ { r }$ being the encoded version of $\mathbf { x } _ { \mathrm { 0 } }$ , using DDIM decoding on ${ \bf x } _ { r }$ unconditionally would give back the original image $\mathbf { x } _ { \mathrm { 0 } }$ . In DIFFEDIT, we use DDIM decoding conditioned on the text query $Q$ , but there is still a strong bias to stay close to the original image. This is because the unconditional and conditional noise estimator networks $\epsilon _ { \theta }$ and $\epsilon _ { \theta } ( \cdot , Q )$ often produce similar estimates, yielding similar decoding behavior when initialized with the same starting point ${ \bf x } _ { r }$ . This means that the edited image will have a small distance w.r.t. the input image, a property critical in the context of image editing. We capture this phenomenon with the proposition below, where we compare the DDIM encoder √ $E _ { r } ( \mathbf { x } _ { 0 } )$ to the SDEdit encoder $G _ { r } ( \mathbf { x } _ { 0 } , \epsilon \bar { ) : = } \sqrt { \alpha _ { r } } \mathbf { x } _ { 0 } + \sqrt { 1 - \alpha _ { r } } \epsilon$ , which simply adds noise to the image $\mathbf { x } _ { \mathrm { 0 } }$ .
|
| 81 |
+
|
| 82 |
+
Proposition 1. Let $\boldsymbol { \mathcal { X } } ~ = ~ \mathbb { R } ^ { d }$ be the space of input images, $p _ { D }$ be the data distribution of couples $( \mathbf { x } _ { 0 } , Q )$ where $\mathbf { x } _ { 0 } \in \mathcal { X }$ and $Q$ a textual query to edit that image. Suppose that $\| \epsilon _ { \theta } ( \mathbf { x } _ { t } , Q , t ) \| _ { 2 } \leq C$ for all $x \in \mathcal { X }$ , $t \in [ 0 , 1 ]$ , that $\epsilon _ { \theta } ( \cdot , \varnothing , t )$ is $K _ { 1 }$ -Lipschitz for all $t _ { : }$ , and let $\begin{array} { r } { K _ { 2 } = \mathbb { E } _ { ( \mathbf { x } _ { 0 } , Q ) \in p _ { D } } \operatorname* { m a x } _ { t \in [ 0 , 1 ] } | | \epsilon _ { \theta } ( \mathbf { x } , Q , t ) - \epsilon _ { \theta } ( \mathbf { x } , \theta , t ) | | } \end{array}$ . Then, for all encoding ratios $0 \leq r \leq 1$ , we have the two following bounds:
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\begin{array} { r l } & { \underset { ( \mathbf { x } _ { 0 } , Q ) \sim p _ { D } } { \mathbb { E } } \| \mathbf { x } _ { 0 } - D _ { r } ( G _ { r } ( \mathbf { x } _ { 0 } , \epsilon ) , Q ) \| _ { 2 } \leq ( C + 1 ) \tau , } \\ & { \underset { ( \mathbf { x } _ { 0 } , Q ) \sim p _ { D } } { \mathbb { E } } } \\ & { } \\ & { \underset { ( \mathbf { x } _ { 0 } , Q ) \sim p _ { D } } { \mathbb { E } } \| \mathbf { x } _ { 0 } - D _ { r } ( E _ { r } ( \mathbf { x } _ { 0 } ) , Q ) \| _ { 2 } \leq \frac { K _ { 2 } \tau } { \sqrt { \tau ^ { 2 } + 1 } } \Big ( \tau + \sqrt { \tau ^ { 2 } + 1 } \Big ) ^ { K _ { 1 } } , } \end{array}
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
where $\tau = \sqrt { 1 / \alpha _ { r } - 1 }$ increases with the encoding ratio $r$ : $\tau ( r = 0 ) = 0$ and $\operatorname* { l i m } _ { r \to 1 } \tau = + \infty$ .
|
| 89 |
+
|
| 90 |
+
We provide the proof in Appendix B. The first bound is associated with SDEdit, and is an extension of a bound proven in the original paper. The second bound we contribute is associated with DIFFEDIT. It is tighter than the first bound below a certain encoding ratio, see Figure 3. We empirically estimated the parameters $K _ { 1 } , K _ { 2 }$ and $C$ with the diffusion models that we are using. While the asymptotic behavior of the second bound is worse than the first with $K _ { 1 } > 1$ , it is the very small value of $K _ { 2 }$ that gives a tighter bound.
|
| 91 |
+
|
| 92 |
+
This supports our argument from above: because the unconditional and text-conditional noise estimates generally give close results — $K _ { 2 }$ being a measure of the average difference— the Euler scheme with $\epsilon _ { \theta } ( \cdot , Q , \cdot )$ gives a sequence of intermediate latents $\mathbf { y } _ { r } , . . . , \mathbf { y } _ { 0 }$ that stays close to the trajectory $x _ { r } , \ldots , D _ { r } ( x _ { r } ) \approx \mathbf { x } _ { 0 }$ mapping back $\mathbf { x } _ { r }$ to $\mathbf { x } _ { \mathrm { 0 } }$ . While these upper bounds do not guarantee that DDIM encoding yields smaller edits than SDEdit, experimentally we find that it is indeed the case.
|
| 93 |
+
|
| 94 |
+

|
| 95 |
+
Figure 3: Illustration of the bounds from Proposition 1, with estimated parameters $C = 1 , K _ { 2 } = 0 . 0 2$ , and $K _ { 1 } = 3$ .
|
| 96 |
+
|
| 97 |
+
# 4 EXPERIMENTS
|
| 98 |
+
|
| 99 |
+
In this section, we describe our experimental setup, followed by qualitative and quantitative results.
|
| 100 |
+
|
| 101 |
+
# 4.1 EXPERIMENTAL SETUP
|
| 102 |
+
|
| 103 |
+
Datasets. We perform experiments on three datasets. First, on ImageNet (Deng et al., 2009) we follow the evaluation protocol of FlexIT (Couairon et al., 2022). Given an image belonging to one class, the goal is to edit it so that it will depict an object of another class as indicated by the query. Given the nature of the ImageNet dataset, edits often concern the main object in the scene. Second, we consider editing images generated by Imagen (Saharia et al., 2022b) based on structured text prompts, in order to evaluate edits that involve changing the background, replacing secondary objects, or changing object properties. Third, we consider edits based on images and queries from the $C O C O$ (Lin et al., 2014) dataset to evaluate edits based on more complex text prompts.
|
| 104 |
+
|
| 105 |
+
Diffusion models. In our experiments we use latent diffusion models (Rombach et al., 2022). We use the class-conditional model trained on ImageNet at resolution $2 5 6 \times 2 5 6$ , as well as the 890M parameter text-conditional model trained on LAION-5B (Schuhmann et al., 2021), known as Stable Diffusion, at $5 1 2 \times 5 1 2$ resolution.2 Since these models operate in a VQGAN latent spaces (Esser et al., 2021), the resolution of our masks is $3 2 \times 3 2$ (ImageNet) or $6 4 \times 6 4$ (Imagen and COCO). We use 50 steps in DDIM sampling with a fixed schedule, and the encoding ratio parameter further decreases the number of updates used for our edits. This allows to edit images in ${ \sim } 1 0$ seconds on a single Quadro GP100 GPU. We also use classifier-free guidance (Ho & Salimans, 2022) with the recommended values: 5 on ImageNet, 7.5 for Stable Diffusion. For more details see Section A.2.
|
| 106 |
+
|
| 107 |
+
Comparison to other methods. We use SDEdit (Meng et al., 2021) as our main point of comparison, since we can use the same diffusion model as for DIFFEDIT. We also compare to FlexIT (Couairon et al., 2022), a mask-free, optimization-based editing method based on VQGAN and CLIP. On ImageNet, we evaluate ILVR (Choi et al., 2021) which uses another diffusion model trained on ImageNet (Dhariwal & Nichol, 2021). Finally, on COCO and Imagen images, we compare to the concurrent work of Hertz et al. (2022). 3
|
| 108 |
+
|
| 109 |
+
Evaluation. In semantic image editing, we have to satisfy the two contradictory objectives of (i) matching the text query and (ii) staying close to the input image. For a given editing method, better matching the text query comes at the cost of increased distance to the input image. Different editing methods often have a parameter that allows to control the editing strength: varying its value allows to get different operating points, forming a trade-off curve between the two objectives aforementioned. Therefore, we evaluate editing methods by comparing their trade-off curves. For diffusion-based methods, we use the encoding ratio to control the trade-off.
|
| 110 |
+
|
| 111 |
+
# 4.2 EXPERIMENTS ON IMAGENET
|
| 112 |
+
|
| 113 |
+
On ImageNet, we follow the evaluation protocol of Couairon et al. (2022), with the associated metrics: the LPIPS perceptual distance (Zhang et al., 2018) measures the distance with the input image, and the CSFID, which is a class-conditional FID metric (Heusel et al., 2017) measuring both image realism and consistency w.r.t. the transformation prompt. For both metrics, lower values indicate better edits. For more details see Couairon et al. (2022).
|
| 114 |
+
|
| 115 |
+
We compare DIFFEDIT to other semantic editing methods from the literature in terms of CSFID-LPIPS tradeoff. Stronger edits improve (lower) the CSFID score as the edited images better adhere to the text query, but the resulting images tend to deviate more from the input image, leading to worse (increased) LPIPS distances.
|
| 116 |
+
|
| 117 |
+

|
| 118 |
+
Figure 4: Comparison on ImageNet data of DIFFEDIT with other Image Editing methods. For DIFFEDIT we annotate the different operating points with the corresponding encoding ratios.
|
| 119 |
+
|
| 120 |
+

|
| 121 |
+
Figure 5: Edits obtained on ImageNet with DIFFEDIT and ablated models. Encode-Decode is DIFFEDIT without masking, and SDEdit is obtained when not using masking nor encoding. When not using masking (SDEdit and Encode-Decode) we observe undesired edits to the background, see e.g. the sky in the second column. When not using DDIM encoding (SDEdit and DiffEdit w/o Encode), appearance information from the input —such as pose— is lost, see last two columns.
|
| 122 |
+
|
| 123 |
+
The results in Figure 4 indicate that DIFFEDIT obtains the best trade-offs among the different methods. For fair comparison with previous methods, here we do not leverage the label of the input image and use the empty text as reference when inferring the editing mask. The Copy and Retrieve baselines are two opposite cases where we have best possible LPIPS distance —zero, by copying the input image— and best possible transformation score by discarding the input image and replacing it with a real image from the target class from the ImageNet dataset. DIFFEDIT, as well as the diffusion-based SDEdit and ILVR, are able to obtain CSFID values comparable to that of the retrieval baseline. Among the diffusion-based methods, our DIFFEDIT obtains comparable CSFID values at significantly better LPIPS scores. For FlexIT, the CSFID best value is significantly worse, indicating it is not able to produce both strong and realistic edits. Using more optimization steps does not solve this issue, as the distance to the input image is part of the loss it minimizes.
|
| 124 |
+
|
| 125 |
+
Ablation experiments. We ablate the two core components of DIFFEDIT, mask inference and DDIM encoding, to measure their relative contributions in terms of CSFID-LPIPS trade-off. If we do not use either of these components our method reverts to SDEdit (Meng et al., 2021). The results in Figure 6, left panel, show that adding DDIM encoding (Encode-Decode) and the masking (DiffEdit w/o Encode) separately both improve the trade-off and reduce the average editing distance w.r.t. the input image compared to SDEdit. Moreover, combining these two elements into DIFFEDIT gives an even better trade-off, showing their complementarity: masking better preserves the background, while DDIM encoding retains visual appearance of the input inside the mask. See Figure 5 for qualitative examples of these ablations, along with the inferred masks.
|
| 126 |
+
|
| 127 |
+
The right panel of Figure 6 shows DIFFEDIT with different mask binarization thresholds. Compared to our default value of 0.5, a lower threshold of 0.25 results in larger masks (more image modifications) and worse CSFID-LPIPS tradeoff. A higher threshold of 0.75 results in masks that are too restrictive: the CSFID score stagnates around 40, even at large encoding ratios.
|
| 128 |
+
|
| 129 |
+

|
| 130 |
+
Figure 6: Ablations on ImageNet. Left: effect of masking and encoding component. Right: DIFFEDIT with different mask thresholds; with 0.5 our default setting.
|
| 131 |
+
|
| 132 |
+
Finally, our mask guidance operator $\tilde { \mathbf { y } } _ { t } = M \mathbf { y } _ { t } + ( 1 - M ) \mathbf { x } _ { t }$ provides a better trade-off than the reference text operator used in GLIDE (Nichol et al., 2021), which interpolates $\mathbf { y } _ { t }$ with a mask-corrected version of the predicted denoised image $\hat { \mathbf { y } } _ { 0 }$ . With encoding ratio $80 \%$ , both operators produce edits with a LPIPS score of 30.5, but the GLIDE version yields a CSFID of 26.4 compared to 23.6 for ours.w/o reference text
|
| 133 |
+
|
| 134 |
+
# 4.3 EXPERIMENTS ON IMAGES GENERATED BY IMAGEN
|
| 135 |
+
|
| 136 |
+
In our second set of experiments we evaluate edits that involve changes in background, replacingw/ reference text “A bowl of fruits” secondary objects, and editing object properties. We find that images generated by Imagen (Saharia et al., 2022b) offer a well suited testbed for this purpose. Indeed, the authors tested the compositional abilities of Imagen with templated prompts of the form: “{A photo of a | An oil painting ofw/o reference text $^ a \}$ {fuzzy panda | British shorthair cat | Persian cat | Shiba Inu dog | raccoon} {wearing a cowboy hat and | wearing sunglasses and} {red shirt | black jacket} {playing a guitar | riding a bike | skateboarding} {in a garden | on a beach | on top of a mountain}”, resulting in 300 prompts.
|
| 137 |
+
|
| 138 |
+
We use the generated images as input and ask to change the prompt to another prompt for which one of these elements is changed. Since we cannot use the CSFID metric as for ImageNet, as images do not carry a single class label, we use FID to measure image realism, and CLIPScore (Hessel et al., 2021) to measure the alignment of the query and A cup of output image. These two scores have become the standard in evaluating text-conditional image generation (Saharia et al., 2022b).
|
| 139 |
+
|
| 140 |
+
Figure 7 displays the CLIP-LPIPS and FID-CLIP trade-offs. DIFFEDIT provides more accurate edits than SDEdit, FlexIT, and Cross Attention Control, by combining inferred masks with DDIM encoding. Two versions of DiffEdit are shown, which differ by how the mask is computed: they correspond to (i) using the original caption as reference text (labelled w/ ref. text) or (ii) using the empty text $\varnothing$ (labelled w/o ref. text).
|
| 141 |
+
|
| 142 |
+
Computing the mask with the original caption as reference text yields the best overall trade-off. Leveraging the original caption yields better CLIP and FID scores. Figure 8 illustrates the difference in the masks obtained with and without reference text for two examples. The reference text allows to ignore parts of the image that are described both by the query and reference text (e.g. the fruits), because in both cases the network uses the common text on the corresponding image region to estimate the noise. On the contrary, parts where the query and reference text disagree, e.g. “bowl” vs. “basket”, will have different noise estimates.
|
| 143 |
+
|
| 144 |
+

|
| 145 |
+
Figure 7: Editing trade-offs on Imagen images.
|
| 146 |
+
|
| 147 |
+

|
| 148 |
+
Figure 8: Masks and edits obtained with and without reference text in the mask computation algorithm.
|
| 149 |
+
|
| 150 |
+

|
| 151 |
+
Figure 9: Edits on Imagen dataset. We use encoding ratio of $90 \%$ for DiffEdit and $70 \%$ for SDEdit for fair comparison: both methods have similar CLIPScore, for larger encoding ratios SDEdit drastically change the input.
|
| 152 |
+
|
| 153 |
+
Qualitative transformation examples are shown in Figure 9, where the masks are inferred by contrasting the caption and query texts.
|
| 154 |
+
|
| 155 |
+
# 4.4 EXPERIMENTS ON COCO
|
| 156 |
+
|
| 157 |
+
To evaluate semantic image editing with more complex prompts, we use images and captions from the COCO dataset Lin et al. (2014). To this end, we leverage the annotations provided by Hu et al. (2019), which associate images from the COCO validation set with other COCO captions that are similar to the original ones, but in contradiction with the given image. This makes these annotations particularly interesting as queries for semantic image editing, as they can often be satisfied by editing only a part of the input image, see Figure 15 in the supplementary material for examples. Similar to our evaluation for Imagen images, here we evaluate edits in terms of CLIPScore, FID and LPIPS.
|
| 158 |
+
|
| 159 |
+
The results in Figure 10 show that the CLIP-LPIPS trade-off of DIFFEDIT is the best, but that it reaches lower maximum CLIP score than SDEdit. The FID scores are similar to SDEdit, but significantly improves upon the Encode-Decode ablation, which does not use a mask.
|
| 160 |
+
|
| 161 |
+
Moreover, in contrast to results on the Imagen data, leveraging the original image caption does not change the CLIP-LPIPS and FID-CLIP tradeoffs. We find that the caption often describes the input image differently compared to the query text, making it more difficult to identify which part of the image needs to be edited. We verify this hypothesis in Section A.3 by filtering the dataset according to the edit distance between the caption and edit query. When the caption and edit query are similar, leveraging the image caption boosts CLIP scores by 0.25 points, a similar improvement as seen on the Imagen data.
|
| 162 |
+
|
| 163 |
+
Qualitative examples are shown in Figure 11. The first column illustrates the benefit of DDIM encoding: we are able to correctly maintain properties of the object inside the mask, such as clothes’ color. The three last columns illustrate how contrasting different pairs of reference and query text allows to select different objects in the input image to perform different edits. See Section A.5 for more examples.
|
| 164 |
+
|
| 165 |
+

|
| 166 |
+
Figure 10: Quantitative evaluation on COCO.
|
| 167 |
+
|
| 168 |
+

|
| 169 |
+
Figure 11: Examples edits on COCO images.
|
| 170 |
+
|
| 171 |
+
# 5 CONCLUSION
|
| 172 |
+
|
| 173 |
+
We introduced DIFFEDIT, a novel algorithm for semantic image editing based on diffusion models. Given a textual query, using the diffusion model, DIFFEDIT infers the relevant regions to be edited rather than requiring a user generated mask. Furthermore, in contrast to other diffusion-based methods, we initialize the generation process with a DDIM encoding of the input.We provide theoretical analysis that motivates this choice, and show experimentally that this approach conserves more appearance information from the input image, leading to lighter edits. Quantitative and qualitative evaluations on ImageNet, COCO, and images generated by Imagen, show that our approach leads excellent edits, improving over previous approaches. Although DIFFEDIT works better with a reference text describing the input image, we believe this additional information can be inferred from input image and target caption, which we leave for future work.
|
| 174 |
+
|
| 175 |
+
# 6 ETHICS STATEMENT
|
| 176 |
+
|
| 177 |
+
Image editing raises several ethical challenges that we wish to discuss here. First, as image editing is closely related to image generation, it inherits known concerns. Open-source diffusion models are trained on large amounts of web-scraped data like LAION, and inherit their biases. In particular, it was shown that LAION contains inappropriate content (violence, hate, pornography), along with racist and sexist stereotypes. Furthermore it was found that diffusion models trained on LAION, such as Imagen, can exhibit social and cultural bias. Therefore, the use of such models can raise ethical issues, whether the text prompt is intentionnally harmful or not. Because image editing is usually performed on real images, there are additionnal ethical challenges, such as potential skin tone change when editing a person or re-inforcing harmful social stereotypes. We believe that open-sourcing editing algorithms in a research context contributes to a better understanding of such problems, and can aid the community in efforts to mitigate them in the future. Furthermore, image editing tools could be used with harmful intent such as harrassement or propagating fake news. This use, known as deep fakes, has been largely discussed in previous work, e.g. in Etienne (2021). To mitigate potential misuse, the Stable Diffusion model is released under a license focused on ethical and legal use, stating explicitly that users “must not distribute harmful, offensive, dehumanizing content or otherwise harmful representations of people or their environments, cultures, religions, etc. produced with the model weights”.
|
| 178 |
+
|
| 179 |
+
Our editing benchmark based on the COCO dataset also has some limitations. COCO has a predominant western cultural bias, and we are therefore evaluating transformations on a small subset of images mostly associated with western culture. Finding relevant transformation prompts for an image is challenging: while we found it relevant to leverage existing annotations based on COCO, we believe that evaluating image editing models on a less culturally biased dataset is needed.
|
| 180 |
+
|
| 181 |
+
# REFERENCES
|
| 182 |
+
|
| 183 |
+
Youssef Alami Mejjati, Christian Richardt, James Tompkin, Darren Cosker, and Kwang In Kim. Unsupervised attention-guided image-to-image translation. Advances in neural information processing systems, 31, 2018.
|
| 184 |
+
|
| 185 |
+
Omri Avrahami, Dani Lischinski, and Ohad Fried. Blended diffusion for text-driven editing of natural images. In CVPR, 2022.
|
| 186 |
+
|
| 187 |
+
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.
|
| 188 |
+
|
| 189 |
+
David Bau, Alex Andonian, Audrey Cui, YeonHwan Park, Ali Jahanian, Aude Oliva, and Antonio Torralba. Paint by word. arXiv preprint, arXiv:2103.10951, 2021.
|
| 190 |
+
|
| 191 |
+
Andrew Brown, Cheng-Yang Fu, Omkar Parkhi, Tamara L Berg, and Andrea Vedaldi. End-to-end visual editing with a generatively pre-trained artist. arXiv preprint, arXiv:2205.01668, 2022.
|
| 192 |
+
|
| 193 |
+
Jooyoung Choi, Sungwon Kim, Yonghyun Jeong, Youngjune Gwon, and Sungroh Yoon. ILVR: Conditioning method for denoising diffusion probabilistic models. In ICCV, 2021.
|
| 194 |
+
|
| 195 |
+
Edo Collins, Raja Bala, Bob Price, and Sabine Susstrunk. Editing in style: Uncovering the local semantics of GANs. In CVPR, 2020.
|
| 196 |
+
|
| 197 |
+
Guillaume Couairon, Asya Grechka, Jakob Verbeek, Holger Schwenk, and Matthieu Cord. FlexIT: Towards flexible semantic image translation. In CVPR, 2022.
|
| 198 |
+
|
| 199 |
+
Katherine Crowson. CLIP Guided Diffusion HQ 512x512. 2021. URL https://colab. research.google.com/drive/1V66mUeJbXrTuQITvJunvnWVn96FEbSI3.
|
| 200 |
+
|
| 201 |
+
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. In ECCV, 2022.
|
| 202 |
+
|
| 203 |
+
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.
|
| 204 |
+
|
| 205 |
+
Helisa Dhamo, Azade Farshad, Iro Laina, Nassir Navab, Gregory D Hager, Federico Tombari, and Christian Rupprecht. Semantic image manipulation using scene graphs. In CVPR, 2020.
|
| 206 |
+
|
| 207 |
+
Prafulla Dhariwal and Alexander Nichol. Diffusion models beat GANs on image synthesis. In NeurIPS, 2021.
|
| 208 |
+
|
| 209 |
+
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. In NeurIPS, 2021.
|
| 210 |
+
|
| 211 |
+
Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In CVPR, 2021.
|
| 212 |
+
|
| 213 |
+
Hubert Etienne. The future of online trust (and why deepfake is advancing it). AI and Ethics, 1, 11 2021. doi: 10.1007/s43681-021-00072-1.
|
| 214 |
+
|
| 215 |
+
Oran Gafni and Lior Wolf. Wish you were here: Context-aware human generation. In CVPR, 2020.
|
| 216 |
+
|
| 217 |
+
Oran Gafni, Adam Polyak, Oron Ashual, Shelly Sheynin, Devi Parikh, and Yaniv Taigman. Makea-scene: Scene-based text-to-image generation with human priors. In ECCV, 2022.
|
| 218 |
+
|
| 219 |
+
Asya Grechka, Jean-Franc¸ois Goudou, and Matthieu Cord. MAGECally invert images for realistic editing. In BMVC, 2021.
|
| 220 |
+
|
| 221 |
+
Erik Hark ¨ onen, Aaron Hertzmann, Jaakko Lehtinen, and Sylvain Paris. GANSpace: Discovering ¨ interpretable GAN controls. In NeurIPS, 2020.
|
| 222 |
+
|
| 223 |
+
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.
|
| 224 |
+
|
| 225 |
+
Jack Hessel, Ari Holtzman, Maxwell Forbes, Ronan Le Bras, and Yejin Choi. CLIPScore: A reference-free evaluation metric for image captioning. arXiv preprint, arXiv:2104.08718, 2021.
|
| 226 |
+
|
| 227 |
+
Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. GANs trained by a two time-scale update rule converge to a local Nash equilibrium. In NeurIPS, 2017.
|
| 228 |
+
|
| 229 |
+
Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598, 2022.
|
| 230 |
+
|
| 231 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In NeurIPS, 2020.
|
| 232 |
+
|
| 233 |
+
Hexiang Hu, Ishan Misra, and Laurens van der Maaten. Evaluating text-to-image matching using binary image selection (BISON). In ICCV Workshop on closing the loop between vision and language, 2019.
|
| 234 |
+
|
| 235 |
+
Thibaut Issenhuth, Ugo Tanielian, Jer´ emie Mary, and David Picard. EdiBERT, a generative model ´ for image editing. arXiv preprint, arXiv:2111.15264, 2021.
|
| 236 |
+
|
| 237 |
+
Yongcheng Jing, Yezhou Yang, Zunlei Feng, Jingwen Ye, Yizhou Yu, and Mingli Song. Neural style transfer: A review. Transactions on visualization and computer graphics, 26(11):3365– 3385, 2019.
|
| 238 |
+
|
| 239 |
+
Valentin Khrulkov and Ivan Oseledets. Understanding DDPM latent codes through optimal transport. Applied Mathematics Letters, 2022.
|
| 240 |
+
|
| 241 |
+
Gwanghyun Kim and Jong Chul Ye. DiffusionCLIP: Text-guided image manipulation using diffusion models. In CVPR, 2021.
|
| 242 |
+
|
| 243 |
+
Hugo Lavenant and Filippo Santambrogio. The flow map of the Fokker-Planck equation does not provide optimal transport. Applied Mathematics Letters, 2022.
|
| 244 |
+
|
| 245 |
+
Bowen Li, Xiaojuan Qi, Thomas Lukasiewicz, and Philip H. S. Torr. ManiGAN: Text-guided image manipulation. In CVPR, 2020a.
|
| 246 |
+
|
| 247 |
+
Bowen Li, Xiaojuan Qi, Philip HS Torr, and Thomas Lukasiewicz. Image-to-image translation with text guidance. arXiv preprint, arXiv:2002.05235, 2020b.
|
| 248 |
+
|
| 249 |
+
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, 2014.
|
| 250 |
+
|
| 251 |
+
Andreas Lugmayr, Martin Danelljan, Andres Romero, Fisher Yu, Radu Timofte, and Luc Van Gool. RePaint: Inpainting using denoising diffusion probabilistic models. In CVPR, 2022.
|
| 252 |
+
|
| 253 |
+
Shuang Ma, Jianlong Fu, Chang Wen Chen, and Tao Mei. Da-gan: Instance-level image translation by deep attention generative adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5657–5666, 2018.
|
| 254 |
+
|
| 255 |
+
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 ICLR, 2021.
|
| 256 |
+
|
| 257 |
+
Sangwoo Mo, Minsu Cho, and Jinwoo Shin. Instagan: Instance-aware image-to-image translation. arXiv preprint arXiv:1812.10889, 2018.
|
| 258 |
+
|
| 259 |
+
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.
|
| 260 |
+
|
| 261 |
+
Or Patashnik, Zongze Wu, Eli Shechtman, Daniel Cohen-Or, and Dani Lischinski. StyleCLIP: Textdriven manipulation of StyleGAN imagery. In ICCV, 2021.
|
| 262 |
+
|
| 263 |
+
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.
|
| 264 |
+
|
| 265 |
+
Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In ICML, 2021.
|
| 266 |
+
|
| 267 |
+
Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with CLIP latents. arXiv preprint, arXiv:2204.06125, 2022.
|
| 268 |
+
|
| 269 |
+
Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High- ¨ resolution image synthesis with latent diffusion models. In CVPR, 2022.
|
| 270 |
+
|
| 271 |
+
Nataniel Ruiz, Yuanzhen Li, Varun Jampani, Yael Pritch, Michael Rubinstein, and Kfir Aberman. DreamBooth: Fine tuning text-to-image diffusion models for subject-driven generation. arXiv preprint, arXiv:2208.12242, 2022.
|
| 272 |
+
|
| 273 |
+
Chitwan Saharia, William Chan, Huiwen Chang, Chris Lee, Jonathan Ho, Tim Salimans, David Fleet, and Mohammad Norouzi. Palette: Image-to-image diffusion models. In SIGGRAPH, 2022a.
|
| 274 |
+
|
| 275 |
+
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, 2022b.
|
| 276 |
+
|
| 277 |
+
Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. LAION-400M: Open dataset of CLIP-filtered 400 million image-text pairs. arXiv preprint, arXiv:2111.02114, 2021.
|
| 278 |
+
|
| 279 |
+
Yujun Shen, Jinjin Gu, Xiaoou Tang, and Bolei Zhou. Interpreting the latent space of GANs for semantic face editing. In CVPR, 2020.
|
| 280 |
+
|
| 281 |
+
Jing Shi, Ning Xu, Trung Bui, Franck Dernoncourt, Zheng Wen, and Chenliang Xu. A benchmark and baseline for language-driven image editing. In ACCV, 2020.
|
| 282 |
+
|
| 283 |
+
Alon Shoshan, Nadav Bhonker, Igor Kviatkovsky, and Gerard Medioni. GAN-control: Explicitly controllable GANs. In ICCV, 2021.
|
| 284 |
+
|
| 285 |
+
Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In ICLR, 2021.
|
| 286 |
+
|
| 287 |
+
Jianan Wang, Guansong Lu, Hang Xu, Zhenguo Li, Chunjing Xu, and Yanwei Fu. ManiTrans: Entity-level text-guided image manipulation via token-wise semantic alignment and generation. In CVPR, 2022a.
|
| 288 |
+
|
| 289 |
+
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, 2022b.
|
| 290 |
+
|
| 291 |
+
Tengfei Wang, Yong Zhang, Yanbo Fan, Jue Wang, and Qifeng Chen. High-fidelity GAN inversion for image attribute editing. In CVPR, 2022c.
|
| 292 |
+
|
| 293 |
+
Jiahui Yu, Zhe Lin, Jimei Yang, Xiaohui Shen, Xin Lu, and Thomas S Huang. Generative image inpainting with contextual attention. In CVPR, 2018.
|
| 294 |
+
|
| 295 |
+
R. Zhang, P. Isola, A. Efros, E. Shechtman, and O. Wang. The unreasonable effectiveness of deep features as a perceptual metric. In CVPR, 2018.
|
| 296 |
+
|
| 297 |
+
Jiapeng Zhu, Yujun Shen, Deli Zhao, and Bolei Zhou. In-domain GAN inversion for real image editing. In ECCV, 2020.
|
| 298 |
+
|
| 299 |
+
Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In CVPR, 2017.
|
| 300 |
+
|
| 301 |
+
# DIFFEDIT: Diffusion-based semantic image editing with mask generation Supplementary Material
|
| 302 |
+
|
| 303 |
+
In this supplementary material we provide more details on the experiments and methods presented in the main paper. In Section A we provide additional experimental results, including assessment of the impact of the strength of classifier-free guidance, the impact of using reference texts describing the input image, an illustration of the effect of the encoding ratio, more qualitative editing examples, as well as a number of example images and associated reference and query texts on COCO. In Section B we provide proofs that support Proposition 1 in the main paper.
|
| 304 |
+
|
| 305 |
+
# A ADDITIONAL EXPERIMENTAL RESULTS
|
| 306 |
+
|
| 307 |
+
# A.1 ANALYSIS OF NOISE USED TO COMPUTE THE MASK
|
| 308 |
+
|
| 309 |
+
In step one our method an editing mask is inferred by contrasting noise estimations on a noised version of the input image, see Section 3.2. In this section, we study the impact of the level of noise added to the input image, by varying its value between 0.1 and 0.8, where 0 corresponds to using the initial image as input, and 1 to replacing the input image with random Gaussian noise. We evaluate the obtained operating points on ImageNet with the CSFID and LPIPS metrics when using a encoding ratios of 0.7 and 0.8 for DDIM encoding and masked-guided denoising in steps two and three of DIFFEDIT. From the results in Figure 12, we find that best results are obtained for moderate values of noise addition of 0.6 and below. Indeed, with too much noise added to the
|
| 310 |
+
|
| 311 |
+

|
| 312 |
+
Figure 12: Impact of the noise added to input image when computing the mask, for a encoding ratios of 0.7 or 0.8 on ImageNet.
|
| 313 |
+
|
| 314 |
+
input image, it is difficult to correctly identify visual elements in the input image. We use a value of 0.5 in all our experiments.
|
| 315 |
+
|
| 316 |
+
# A.2 CLASSIFIER-FREE GUIDANCE
|
| 317 |
+
|
| 318 |
+
In diffusion models, the noise estimator $\epsilon _ { \theta }$ can be conditioned on text describing the image, which provides a signal to guide the noise estimation process (Nichol et al., 2021; Saharia et al., 2022b). Ho & Salimans (2022) introduced classifier-free guidance, a technique to greatly improve generation quality and imagetext alignment in text-conditional diffusion models. It consists in training both a conditional and unconditional model by dropping the conditioning text at train time with fixed probability, e.g. $10 \%$ . Then, after training, at each step $t$ during decoding, the noise estimation $\epsilon _ { \theta } ( \mathbf { x } _ { t } , Q , t )$ is extrapolated by using the unconditional noise estimation $\epsilon _ { \theta } ( \mathbf { x } _ { t } , \emptyset , \bar { t } )$ as origin. Formally, the noise that is used is
|
| 319 |
+
|
| 320 |
+
$$
|
| 321 |
+
\begin{array} { r } { \epsilon = \epsilon _ { \theta } ( \mathbf { x } _ { t } , \theta , t ) + \lambda ( \epsilon _ { \theta } ( \mathbf { x } _ { t } , Q , t ) - \epsilon _ { \theta } ( \mathbf { x } _ { t } , \theta , t ) ) , } \end{array}
|
| 322 |
+
$$
|
| 323 |
+
|
| 324 |
+
where $\lambda$ is the classifier-free guidance parame
|
| 325 |
+
|
| 326 |
+

|
| 327 |
+
Figure 13: Ablation on the value of the classifierfree guidance parameter. On ImageNet, we find that a value of at least 3 must be used to get good results. We chose to use 5, which is the default value recommended for generation.
|
| 328 |
+
|
| 329 |
+
ter. We study the influence of this parameter on DIFFEDIT in Figure 13, finding that similarly to generation, a value above 3 yields the best results. Without classifier-free guidance, the obtained trade-off is not competitive. For our experiments we use a default guidance value of $\lambda = 5$ .
|
| 330 |
+
|
| 331 |
+
Here, we investigate why there is little difference between using or not the reference text to compute the mask on our COCO queries. In Figure 15 we show several editing queries on the COCO dataset taken from the BISON dataset (Hu et al., 2019). Generally, the text query describes a scene similar to the one in the input image, and it is possible to match the text query by editing only a fraction of the input image.
|
| 332 |
+
|
| 333 |
+

|
| 334 |
+
Figure 14: Results on COCO: unfiltered (left) and filtered (right). While having a small impact overall, for the filtered set using the reference text is beneficial, especially at high encoding ratios, e.g. $90 \%$ .
|
| 335 |
+
|
| 336 |
+
However, we find that while queries have been built to be close to a caption of the input image, most of the time the query is not well aligned with the caption. We create a filtered version of this dataset, for which queries are structurally similar to the caption, i.e. where only a few words are changed, but the grammatical structure stays the same. We use the filtering criterion that the total number of words inserted/deleted/replaced must not exceed $2 5 \%$ of the total number of words in the original caption, resulting in a total of 272 queries out of $5 0 \mathrm { k }$ original queries. In Figure 14 we compare results with and without filtering, and observe that for the images with small caption edits the gain of DIFFEDIT (w/ ref. text) compared to Encode-Decode is somewhat larger than on the unfiltered dataset. Moreover, using the original caption as reference text to compute the mask gives higher CLIPScore, especially at high encoding ratio. This illustrates that a well chosen reference text helps to generate better editing masks.
|
| 337 |
+
|
| 338 |
+

|
| 339 |
+
Figure 15: Editing queries on the COCO dataset.
|
| 340 |
+
|
| 341 |
+
# A.4 VISUALISATION OF THE IMPACT OF ENCODING RATIO
|
| 342 |
+
|
| 343 |
+
We show visual results for ablations of our two main components, mask inference and DDIM encoding, in Figure 16. The resulting methods are SDEdit, Encode-Decode, DIFFEDIT w/o Encoding, and DIFFEDIT. We demonstrate the qualitative behavior of these different methods, at varying encoding ratios between $3 0 \%$ and $8 0 \%$ . Compared to SDEdit, Encode-Decode allows to better match the query with less modifications of the main object and the background, especially at $6 0 \% - 7 0 \%$ .
|
| 344 |
+
|
| 345 |
+
Mask inference allows to maintain exactly the background. Using DDIM inference on top of maskbased decoding allows to better retain of the content inside the mask, especially at $70 \%$ and $80 \%$ , c.f. row 3 vs. 4.
|
| 346 |
+
|
| 347 |
+

|
| 348 |
+
Figure 16: Qualitative ablations of the mask and encoding components, using different encoding ratios from $30 \%$ to $80 \%$ .
|
| 349 |
+
|
| 350 |
+
A.5 ADDITIONAL VISUALIZATIONS AND QUALITATIVE RESULTS
|
| 351 |
+
|
| 352 |
+
Figure 17 illustrates editing examples on Imagen, in comparison with other mask-free editing methods. DIFFEDIT generally performs more targeted and accurate edits, leaving more of the original image in tact where possible. Consider for example the first column of Figure 17, where DIFFEDIT leaves the guitar as it, while other methods make unnecessary and unrealistic changes to the guitar.
|
| 353 |
+
|
| 354 |
+
Additional qualitative examples on COCO images are shown in Figure 19.
|
| 355 |
+
|
| 356 |
+
Figure 20 shows several failure cases of semantic image editing with DIFFEDIT. Some failure modes are inherited from the generative model itself: models trained on web-scrapped image-text data are known to struggle with understanding spatial positions in images, spatial reasoning, and counting (Ramesh et al., 2021). Others are specific to our mask-based method, like the difficulty to insert objects, because the mask often seeks an “anchor” visual element to insert an object, see first column.
|
| 357 |
+
|
| 358 |
+
# A.6 DETAILS ON COMPARISONS WITH OTHER METHODS
|
| 359 |
+
|
| 360 |
+
On the COCO and Imagen datasets, we do not compare with ILVR, since it cannot be used within the latent diffusion framework: the method needs image downsampling and upsampling, which does not work well with the latent spaces used in latent diffusion. Even adapted with a diffusion model without latent spaces like Imagen, we do not expect the CLIP-LPIPS trade-off to be favorable for this method, given the high editing distance obtained on ImageNet. Instead, we compare against CrossAttention Control Hertz et al. (2022), a recent method for text-driven image editing based on the unreleased Imagen diffusion model. The method is very recent and has been adapted to use with Stable Diffusion at https://github.com/bloc97/CrossAttentionControl/. We have performed lightweight hyperparameter search to optimize the CLIP-LPIPS trade-off on a subset of Imagen images. We generally find that this re-implementation, while producing edited images structurally similar to the input, changes local features more than SDEdit, leading to generally high LPIPS distances, resulting in a CLIP-LPIPS trade-off not competitive with other methods on our COCO and Imagen benchmark. In particular, LPIPS distance are high on the COCO dataset where text query and reference text have a high edit distance on average, whereas Cross-Attention Control was designed to perform well for prompt-to-prompt editing, i.e. the input and target text should almost exactly match. Given that our results are based on the unofficial re-implementation, we caution that they are temporary and we will update them when the official code (or official adaptation for Stable Diffusion) is released.
|
| 361 |
+
|
| 362 |
+

|
| 363 |
+
Figure 17: Example edits from Imagen, in comparison with other mask-free editing methods.
|
| 364 |
+
|
| 365 |
+

|
| 366 |
+
Figure 18: More qualitative examples on COCO. Baseline methods are shown for comparison. The mask is sometimes bigger or smaller that one could expect: In column 3, it is larger, but there are few edits outside the requested bread burger transformation (except for the wine bottle label), which is not the case without DDIM encoding. In column 4, the mask does not cover the interior of the truck, but this does not affect the edit quality.
|
| 367 |
+
|
| 368 |
+

|
| 369 |
+
Figure 19: More qualitative examples on COCO. In the first column, the color of the objects to be edited is maintained, which would not be the case with regular inpainting methods. Contrasting similar text query and reference text allows to select the object to be edited.
|
| 370 |
+
|
| 371 |
+

|
| 372 |
+
Figure 20: Illustration of failure modes. In the first two columns show difficulty to insert an object in a smooth region of the image. In column three the mask fails to identify a region where to add the zebra. Columns 4 and 5 show mask identification errors, where multiple similar objects are included in the mask, whereas matching the text query only requires to edit a single object. In both cases this results in over-editing. Col. 6 shows the failure to change a spatial relation in the image.
|
| 373 |
+
|
| 374 |
+
# B THEORETICAL RESULTS
|
| 375 |
+
|
| 376 |
+
Here, we prove the bounds given in the main paper. We reused notations from Proposition 1 in the main paper. We also discuss links to optimal transport.
|
| 377 |
+
|
| 378 |
+
# B.1 PROOF OF SDEDIT BOUND
|
| 379 |
+
|
| 380 |
+
Proposition 2. Suppose that $\| \epsilon _ { \theta } ( \mathbf { x } , Q , t ) \| _ { 2 } \leq C$ for all $x \in \mathcal { X }$ , $t \in [ 0 , 1 ]$ . Then
|
| 381 |
+
|
| 382 |
+
$$
|
| 383 |
+
\begin{array} { r l } & { \quad \underset { ( \mathbf { x } _ { 0 } , Q ) \sim p _ { D } } { \mathbb { E } } \| \mathbf { x } _ { 0 } - D _ { r } ( G _ { r } ( \mathbf { x } _ { 0 } , \epsilon ) , Q ) \| _ { 2 } \leq ( C + 1 ) \tau } \\ & { \quad \epsilon \sim { \cal N } ( 0 , 1 ) } \end{array}
|
| 384 |
+
$$
|
| 385 |
+
|
| 386 |
+
Proof. Let $T$ $\mathbf { \xi } , \mathbf { x } _ { r } = G _ { r } ( \mathbf { x } _ { 0 } , \epsilon ) , \mathbf { y } _ { r } = \mathbf { x } _ { r }$ and ${ \bf y } _ { 0 } = D _ { r } ( { \bf y } _ { r } , Q )$ . Then
|
| 387 |
+
|
| 388 |
+
$$
|
| 389 |
+
\| \frac { { \bf x } _ { r } } { \sqrt { \alpha _ { r } } } - { \bf y } _ { 0 } \| = \| \frac { { \bf y } _ { r } } { \sqrt { \alpha _ { r } } } - \frac { { \bf y } _ { 0 } } { \sqrt { \alpha _ { 0 } } } \| = \| \int _ { \tau } ^ { 0 } \epsilon _ { \theta } ( x _ { t } , Q , t ) d \tau \| \le C \tau .
|
| 390 |
+
$$
|
| 391 |
+
|
| 392 |
+
Since the pr $\begin{array} { r } { \frac { \mathbf { x } _ { r } } { \sqrt { \alpha _ { r } } } = \mathbf { x } _ { 0 } + \boldsymbol { \tau } \boldsymbol { \epsilon } } \end{array}$ , we have $\begin{array} { r } { \| \mathbf { x } _ { 0 } - \mathbf { y } _ { 0 } \| \leq \| \mathbf { x } _ { 0 } + \tau \epsilon - \mathbf { y } _ { 0 } \| + \| \tau \epsilon \| \leq C \tau + \tau } \end{array}$ which concludes
|
| 393 |
+
|
| 394 |
+
In the SDEdit paper (Meng et al., 2021), a proof similar to what we state is given, with three main differences: (i) the proof is given in the case of variance-exploding Stochastic Differential Equation (VE-SDE), which needs adaption for our setting which uses variance-preserving SDE; (ii) the bound is derived in the case of a stochastic differential equation, whereas we use a deterministic DDIM process; (iii) the bound is given by controlling the probability tail, whereas we only consider the expectancy of edit distance. However, despite these differences, the spirit of the proof is the same as here.
|
| 395 |
+
|
| 396 |
+
# B.2 PROOF OF PROPOSITION 2
|
| 397 |
+
|
| 398 |
+
Proposition 3. Suppose that $\epsilon _ { \theta } ( \cdot , Q , t )$ is $K _ { 1 }$ -lipschitz and $\kappa _ { 2 }$ defined as
|
| 399 |
+
|
| 400 |
+
$$
|
| 401 |
+
\kappa _ { 2 } ( \mathbf { x } _ { 0 } ) = \operatorname* { m a x } _ { t \in [ 0 , 1 ] } \| \epsilon _ { \theta } ( E _ { t } ( \mathbf { x } _ { 0 } ) , Q , t ) - \epsilon _ { \theta } ( E _ { t } ( \mathbf { x } _ { 0 } ) , \emptyset , t ) \|
|
| 402 |
+
$$
|
| 403 |
+
|
| 404 |
+
Let $K _ { 2 } = \mathbb { E } _ { \mathbf { x } _ { 0 } } \kappa _ { 2 } ( \mathbf { x } _ { 0 } )$ . Then for all encoding ratio $r$ , with $\tau = \sqrt { \alpha _ { r } ^ { - 1 } - 1 }$ ,
|
| 405 |
+
|
| 406 |
+
$$
|
| 407 |
+
\mathbb { E } _ { \mathbf { x } _ { 0 } } \| \mathbf { x } _ { 0 } - D _ { r } ( E _ { r } ( \mathbf { x } _ { 0 } ) , Q ) \| \leq \frac { K _ { 2 } \tau } { \sqrt { \tau ^ { 2 } + 1 } } \Big ( \tau + \sqrt { \tau ^ { 2 } + 1 } \Big ) ^ { K _ { 1 } }
|
| 408 |
+
$$
|
| 409 |
+
|
| 410 |
+
Proof. Let $\sigma$ be a time-dependent variable defined as $\sigma ( t ) ~ = ~ \sqrt { \alpha _ { t } ^ { - 1 } - 1 }$ . Let $\textbf { u } = \textbf { x } / \sqrt { \alpha } =$ $\mathbf { x } \sqrt { 1 + \sigma ^ { 2 } }$ and $\mathbf { v } = \mathbf { y } { \sqrt { 1 + \sigma ^ { 2 } } }$ . u and $\mathbf { v }$ are solutions of the following differential system:
|
| 411 |
+
|
| 412 |
+
$$
|
| 413 |
+
\begin{array} { r l } & { { d { \mathbf { u } } } | _ { t } = \epsilon _ { \theta } ( { \mathbf { u } } / \sqrt { 1 + \sigma ^ { 2 } } , \varnothing , t ) { d \sigma } , } \\ & { { d { \mathbf { v } } } | _ { t } = \epsilon _ { \theta } ( { \mathbf { v } } / \sqrt { 1 + \sigma ^ { 2 } } , Q , t ) { d \sigma } , } \\ & { { \mathbf { u } } ( r ) = { \mathbf { v } } ( r ) = E _ { r } ( \mathbf { x } _ { 0 } ) \sqrt { 1 + \sigma ^ { 2 } } . } \end{array}
|
| 414 |
+
$$
|
| 415 |
+
|
| 416 |
+
Let $\mathbf { w } = \| \mathbf { u } - \mathbf { v } \|$ , then $\mathbf { w } | _ { t = r } = 0$ and
|
| 417 |
+
|
| 418 |
+
$$
|
| 419 |
+
\begin{array} { r l } & { \| \mathbf { w } | _ { t } \leq \| d \mathbf { u } | _ { t } - d \mathbf { v } | _ { t } \| = \| ( { \epsilon } _ { \theta } ( \mathbf { x } , { \theta } , t ) - { \epsilon } _ { \theta } ( \mathbf { y } , Q , t ) ) d \sigma \| } \\ & { \qquad \leq \| ( { \epsilon } _ { \theta } ( \mathbf { x } , { \theta } , t ) - { \epsilon } _ { \theta } ( \mathbf { x } , Q , t ) \| d \sigma + \| ( { \epsilon } _ { \theta } ( \mathbf { x } , Q , t ) - { \epsilon } _ { \theta } ( \mathbf { y } , Q , t ) \| d \sigma } \\ & { \qquad \leq { \kappa } _ { 2 } ( \mathbf { x } _ { 0 } ) d \sigma + K _ { 1 } \| \mathbf { x } - \mathbf { y } \| d \sigma } \\ & { \qquad \leq \Big ( { \kappa } _ { 2 } ( \mathbf { x } _ { 0 } ) + \frac { K _ { 1 } } { \sqrt { 1 + { \sigma } ^ { 2 } } } w \Big ) d \sigma . } \end{array}
|
| 420 |
+
$$
|
| 421 |
+
|
| 422 |
+
By integration we get
|
| 423 |
+
|
| 424 |
+
$$
|
| 425 |
+
{ \pmb w } ( t ) \le \kappa _ { 2 } ( { \bf x } _ { 0 } ) * ( \tau - t ) + \int _ { t } ^ { \tau } \frac { K _ { 1 } } { \sqrt { 1 + \sigma ^ { 2 } } } { \pmb w } ( \sigma ) d \sigma .
|
| 426 |
+
$$
|
| 427 |
+
|
| 428 |
+
From here we can apply Gronwall’s inequality: ¨
|
| 429 |
+
|
| 430 |
+
$$
|
| 431 |
+
\begin{array} { l } { w ( 0 ) \leq \kappa _ { 2 } ( \mathbf { x } _ { 0 } ) \tau \exp \Big ( \displaystyle \int _ { 0 } ^ { \tau } \frac { K _ { 1 } } { \sqrt { 1 + s ^ { 2 } } } d s \Big ) } \\ { \leq \kappa _ { 2 } ( \mathbf { x } _ { 0 } ) \tau \exp \Big ( K _ { 1 } \log ( \tau + \sqrt { \tau ^ { 2 } + 1 } ) \Big ) } \\ { \leq \kappa _ { 2 } ( \mathbf { x } _ { 0 } ) \tau \Big ( \tau + \sqrt { \tau ^ { 2 } + 1 } \Big ) ^ { K _ { 1 } } . } \end{array}
|
| 432 |
+
$$
|
| 433 |
+
|
| 434 |
+
Which finally gives
|
| 435 |
+
|
| 436 |
+
$$
|
| 437 |
+
\| \mathbf { x } _ { 0 } - \mathbf { y } _ { 0 } \| \leq \frac { \kappa _ { 2 } ( \mathbf { x } _ { 0 } ) \tau } { \sqrt { \tau ^ { 2 } + 1 } } \Big ( \tau + \sqrt { \tau ^ { 2 } + 1 } \Big ) ^ { K _ { 1 } } .
|
| 438 |
+
$$
|
| 439 |
+
|
| 440 |
+
Taking the expectation w.r.t. the input image $\mathbf { x } _ { \mathrm { 0 } }$ gives the final result:
|
| 441 |
+
|
| 442 |
+
$$
|
| 443 |
+
\mathbb { E } _ { \mathbf { x } _ { 0 } } \left\| \mathbf { x } _ { 0 } - D _ { T } ( E _ { T } ( \mathbf { x } _ { 0 } ) , Q ) \right\| \leq \frac { K _ { 2 } \tau } { \sqrt { \tau ^ { 2 } + 1 } } \Big ( \tau + \sqrt { \tau ^ { 2 } + 1 } \Big ) ^ { K _ { 1 } }
|
| 444 |
+
$$
|
| 445 |
+
|
| 446 |
+
which concludes the proof.
|
| 447 |
+
|
| 448 |
+
# B.3 LINKS TO OPTIMAL TRANSPORT THEORY
|
| 449 |
+
|
| 450 |
+
The reverse DDIM encoder $E _ { r }$ maps the distribution of images $p _ { 0 } = p _ { D }$ to the distribution $p _ { r }$ of images noised at timestep $r$ . Khrulkov & Oseledets (2022) suggested that $E _ { r }$ could be an optimal transport map between $p _ { 0 }$ and $p _ { r }$ , minimizing the transport cost $\mathbb { E } _ { \mathbf { x } _ { 0 } } \| \mathbf { x } _ { 0 } - E _ { r } ( \mathbf { x } _ { 0 } ) \| _ { 2 } ^ { 2 }$ . This means that the encoded images are, on average, as close as possible to the input images, while following the correct distribution $p _ { r }$ . It would entail that the unconditional decoder $\bar { D _ { r } } = E _ { r } ^ { - 1 }$ would be an optimal transport map between $p _ { r }$ and $p _ { 0 }$ , and moreover that the conditional decoder $D _ { r } ( \cdot , Q )$ would be an optimal transport map between the distributions $p _ { r } ( \cdot | Q )$ and $p _ { 0 } ( \cdot | Q )$ conditioned by text description $Q$ . Under the hypothesis that $p _ { r }$ is very close to $p _ { r } ( \cdot | Q )$ , then the Encode-Decode algorithm would be the combination of two optimal transport maps $E _ { r }$ and $D _ { r } ( \cdot , Q )$ , mapping $p _ { 0 }$ to $p _ { r }$ and then $p _ { r } \simeq p _ { r } ( \cdot | Q )$ to $p _ { 0 } ( \cdot | Q )$ . This is a very interesting property and we make the connection with the desired properties of semantic image editing, which can be expressed as an optimal transport problem. Given two distribution of images $p _ { 1 } , p _ { 2 }$ (lets say cats and dogs), the aim is to find the function $f$ that performs the expected edit (changing images of cats into images of dogs) while minimally editing the image, which can be expressed mathematically as:
|
| 451 |
+
|
| 452 |
+
$$
|
| 453 |
+
f = \underset { f } { \arg \operatorname* { m i n } } \mathbb { E } _ { \mathbf { x } } \| \mathbf { x } - f ( \mathbf { x } ) \| \quad \mathrm { s . t . } \quad p _ { 2 } = f _ { \# } p _ { 1 } ,
|
| 454 |
+
$$
|
| 455 |
+
|
| 456 |
+
where $f _ { \# }$ is the push-forward measure. The function $D _ { r } ( \cdot , Q ) \circ E _ { r }$ is not a solution of this optimal transport problem, because (i) it was proven that the reverse DDIM encoder is not the optimal transport map for some distributions (Lavenant & Santambrogio, 2022), and (ii) the composition of two optimal transport maps is not necessarily an optimal transport map. However, experiments and numerical simulations suggest that $E _ { r }$ is very close from an optimal transport map. It would be interesting to study the “optimality defect” of $E _ { r }$ and of the editing function $D _ { r } ( \cdot , Q ) \circ E _ { r }$ . We leave this for future work.
|
md/dev/67o9UQgTD0/67o9UQgTD0.md
ADDED
|
@@ -0,0 +1,474 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Counterfactual Memorization in Neural Language Models
|
| 2 |
+
|
| 3 |
+
Chiyuan Zhang Google Research chiyuan@google.com
|
| 4 |
+
|
| 5 |
+
Daphne Ippolito Carnegie Mellon University daphnei@cmu.edu
|
| 6 |
+
|
| 7 |
+
Katherine Lee Google DeepMind katherinelee@google.com
|
| 8 |
+
|
| 9 |
+
Matthew Jagielski Google DeepMind jagielski@google.com
|
| 10 |
+
|
| 11 |
+
Florian Tramèr ETH Zürich florian.tramer@inf.ethz.ch
|
| 12 |
+
|
| 13 |
+
Nicholas Carlini Google DeepMind ncarlini@google.com
|
| 14 |
+
|
| 15 |
+
# Abstract
|
| 16 |
+
|
| 17 |
+
Modern neural language models that are widely used in various NLP tasks risk memorizing sensitive information from their training data. Understanding this memorization is important in real world applications and also from a learningtheoretical perspective. An open question in previous studies of language model memorization is how to filter out “common” memorization. In fact, most memorization criteria strongly correlate with the number of occurrences in the training set, capturing memorized familiar phrases, public knowledge, templated texts, or other repeated data. We formulate a notion of counterfactual memorization which characterizes how a model’s predictions change if a particular document is omitted during training. We identify and study counterfactually-memorized training examples in standard text datasets. We estimate the influence of each memorized training example on the validation set and on generated texts, showing how this can provide direct evidence of the source of memorization at test time.
|
| 18 |
+
|
| 19 |
+
# 1 Introduction
|
| 20 |
+
|
| 21 |
+
Modern neural language models (LMs) have achieved impressive results in generating high quality text [e.g. Brown et al., 2020, Zhang et al., 2022, Chowdhery et al., 2022, OpenAI, 2023] and have led to breakthroughs in many downstream natural language processing tasks [Devlin et al., 2019, Raffel et al., 2020b, Bommasani et al., 2021]. The paradigm of taking a single large-scale pre-trained model and fine-tuning it for many tasks motivates the study of these models’ ability to generalize by avoiding memorizing their training data. Moreover, memorization of sensitive user information or copyrighted materials in the training data [Carlini et al., 2020, Vyas et al., 2023, Lee et al., 2023] leads to practical concerns in real world applications.
|
| 22 |
+
|
| 23 |
+
Previous work on memorization in neural language models demonstrated the ability to extract memorized training data, including sensitive data such as phone numbers and usernames [Carlini et al., 2020, Ziegler, 2021, Carlini et al., 2019, Henderson et al., 2017, Thakkar et al., 2020, Thomas et al., 2020]. One issue with these extraction attacks is that they primarily identify “common” and frequently occurring strings in the training set. For example, as shown in the analysis of Lee et al. [2021], near-duplicate training examples, which are very common in standard text corpora, account for a large majority of the memorized content. To filter out such commonly occurring strings from all memorized texts, previous work applied various heuristic rules to distinguish frequently-occurring sequences from memorization of isolated pieces of information.
|
| 24 |
+
|
| 25 |
+
In this paper, we propose a principled causal perspective to disentangle memorization of common vs rare data, by directly tying a model’s predictions to the presence or absence of individual training examples. We define counterfactual memorization as a measure of the change in a model’s prediction when a particular example is excluded from the training set. Counterfactual memorization accounts for the commonality of an example as removing one instance of a text that is common across multiple documents will have a minor effect on the model’s prediction on that text. The mathematical formulation of counterfactual memorization extends a prior definition of label memorization in classification models [Feldman, 2020] to the context of neural language modeling.
|
| 26 |
+
|
| 27 |
+
Formally, a training document $x$ is considerded counterfactually memorized, when the language model predicts $x$ accurately if and only $i f$ the model was trained on $x$ . This allows us to construct a procedure to quantitatively measure the memorization of isolated pieces of text, whose sole presence in the training dataset have a large effect on the model’s predictions.
|
| 28 |
+
|
| 29 |
+
Following Feldman and Zhang [2020], we further extend this definition to counterfactual influence, which measures the influence of a memorized training text sample on another text example. Counterfactual influence allows us to trace the source of information for a model’s predictions, by locating the training example(s) which significantly contributed to it. With these tools, we study memorization across several standard text datasets. Our main contributions are as follows:
|
| 30 |
+
|
| 31 |
+
1. We define counterfactual memorization in neural LMs which gives us a principled perspective to distinguish memorization of “rare” and “common” information in neural LMs (Section 3). 2. We estimate counterfactual memorization on several standard text datasets, and confirm that rare memorized examples exist in all of them. We study common patterns across memorized text and the memorization profiles of individual internet domains. (Section 4). 3. We identify an inverse correlation between number of duplicates and counterfactual memorization as compared with previous definitions of memorization (Section 5). 4. We extend the definition of counterfactual memorization to counterfactual influence, and study the impact of memorized examples on the test-time prediction of the validation set examples and generated examples (Section 6).
|
| 32 |
+
|
| 33 |
+
# 2 Related Work
|
| 34 |
+
|
| 35 |
+
Previous work analyzed the memorization of large language models on sensitive information (e.g. phone numbers) in the training data [Carlini et al., 2020, Ziegler, 2021] or synthetically injected “canaries” [Carlini et al., 2019, Henderson et al., 2017, Thakkar et al., 2020, Thomas et al., 2020]. However, not all the memorized texts are equally interesting — as confirmed in a later study [Lee et al., 2021], near-duplicated training examples are very common in standard text corpus, and those commonly occurring phrases contribute significantly to memorized texts. In order to distinguish “common” memorization of common phrases or public knowledge from “rare” memorization of private, rare information, various heuristics were adopted in previous investigations. Our paper proposed a principled perspective towards this problem. Our intuition comes from psychologies studies that categorize human (declarative) memory into episodic memory [Tulving, 1983] of specific contents of individual events, and semantic memory [Squire, 1992] about general knowledge like grammars and factual information. We would like the models to obtain semantic memory but avoid episodic memory. The capture the latter, we proposed a notion of counterfactual memorization. The mathematical formulation of counterfactual memorization is borrowed from a notion of label memorization in Feldman [2020] and adapted to the context of neural LMs in this paper. This formulation has been studied empirically in the context of computer vision in Feldman and Zhang [2020]. In a follow up work, Ilyas et al. [2022] showed that it is possible to fit a datamodel to predict the outcome of training a model on a specific training subset and evaluating on a specific input. However, this procedure requires training a massive number of models (e.g. 300,000 for CIFAR-10) on random subsets of the training data, thus is computationally infeasible for the scale of language models considered here.
|
| 36 |
+
|
| 37 |
+
The general idea of measuring model behavior on held-out training data is common in machine learning. In cross validation, held-out data is used to estimate the test performance for model selection; in learning theory, leave-one-out stability was shown to be deeply connected to generalization [e.g. Mukherjee et al., 2006]; in differential privacy, the worst case performance difference of models trained on two “neighboring” datasets (identical except a single example being held-out or replaced)
|
| 38 |
+
|
| 39 |
+
quantifies the privacy guarantee of a learning algorithm [Dwork et al., 2014, Nasr et al., 2021, Jagielski et al., 2020]. Most previous work aimed for an overall measurement, while our paper focused on characterizing the behaviors of individual examples.
|
| 40 |
+
|
| 41 |
+
We estimated a counterfactual influence to study how a memorized training example impact the model prediction at test time. Influence functions have been used in statistics to assess robust estimators since Hampel [1974]. Previous papers adopted it to analyze neural network predictions [Koh and Liang, 2017, Koh et al., 2019]. However, the estimation was found to be computational expensive and fragile [Basu et al., 2021]. Pruthi et al. [2020] tracks the gradient updates during training to estimate the influence from a training example; Feldman [2020], Feldman and Zhang [2020] use aggregated statistics from multiple models independently trained on heldout data subsets to estimate the influence. Further extensions were shown to work well on detecting mislabeled data in classification problems [Wang and Jia, 2022] and characterizing hallucinations in Neural Machine Translation [Raunak et al., 2021]. Alternative methods also looked at simple data statistics (e.g. co-occurrence counts) without model re-training to infer the causal effects on language models’ predictions [Elazar et al., 2022]. In this paper, we adapt the approach from Feldman [2020], and formulate counterfactual influence directly with subset sampling, as oppose to leave-one-out influence. We also extend the estimation to assess the influence on generated examples.
|
| 42 |
+
|
| 43 |
+
Counterfactual is an important notion in statistical causality [Pearl et al., 2000, Rubin, 2005, Pearl, 2009, Imbens and Rubin, 2015] useful for studying causal probabilistic inference under alternative conditions. Such counterfactuals may or may not be directly testable (e.g. a counterfactual treatment in medical studies). In this paper, we directly measure the counterfactual influence of a training example by comparing the behavior of the model trained with and without that example.
|
| 44 |
+
|
| 45 |
+
# 3 Counterfactual Memorization
|
| 46 |
+
|
| 47 |
+
To quantify memorization of rare details of a specific training document, we define the following notion of counterfactual memorization. The mathematical formulation is borrowed from Feldman [2020], where it was originally proposed to quantify label memorization in multi-class classification problems. We extend it to the context of unsupervised neural language modeling.
|
| 48 |
+
|
| 49 |
+
Definition 3.1 (Counterfactual Memorization). Given a training algorithm $A$ that maps a training dataset $D$ to a trained model $f$ , and a measure $M ( f , x )$ of the performance of $f$ on a specific example $x$ , the counterfactual memorization of a training example $x$ in $D$ is given by
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
\mathsf { m e m } ( x ) \triangleq \mathbb { E } _ { S \subset D , x \in S } [ M ( A ( S ) , x ) ] - \mathbb { E } _ { S \subset D , x \notin S } [ M ( A ( S ) , x ) ] \quad ,
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+
where $S$ and $S ^ { \prime }$ are subsets of training examples sampled from $D$ . The expectation is taken with respect to the random sampling of $S$ and $S ^ { \prime }$ , as well as the randomness in the training algorithm $A$ .
|
| 56 |
+
|
| 57 |
+
That is, our memorization definition compares the difference between two expected performance measures on a given example $x$ . On one side, we compute the expected performance of a model when trained on datasets that contain the example $x$ , and, on the other side, we compute the expected performance of a model when trained on datasets that do not contain the example $x$ . Throughout this paper we use per-token accuracy as the measure $M$ . In other words, we ask the model to predict the next token based on the groundtruth context (preceding tokens), measure the 0-1 loss of the argmax token prediction, and then average it across all predicted tokens.
|
| 58 |
+
|
| 59 |
+
The expectations in Equation (1) can be empirically estimated via sampling. Specifically, we train $m$ different models on independently sampled subsets $S _ { 1 } , \ldots , S _ { m }$ of equal size $| S _ { i } | = r | D |$ for a fixed $r \in ( 0 , 1 )$ . We then divide these models into two groups: the first group contains all models trained on subsets $S$ where $x \in S$ ; and the second group are all models trained on subsets $S$ where $x \not \in S$ . We take the average performance on $x$ in the two groups separately and compute the difference between the two:
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
\widehat { \mathsf { m e m } } ( x ) \triangleq \operatorname* { m e a n } _ { i : x \in S _ { i } } [ M ( A ( S _ { i } ) , x ) ] - \operatorname* { m e a n } _ { i : x \notin S _ { i } } [ M ( A ( S _ { i } ) , x ) ] .
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
This difference quantifies how the presence or absence of the example $x$ in a model’s training set affect the model’s performance on $x$ . If there is a large difference between including an example in the training set versus not including it, then we consider this example counterfactually memorized.
|
| 66 |
+
|
| 67 |
+
For each $x$ , we refer to models trained with $x$ in the training set ( $\{ A ( S _ { i } ) : x \in S _ { i } \} )$ as IN models and the models $x$ was not trained on $\{ A ( S _ { i } ) : x \notin S _ { i } \} )$ as OUT models. Note we do not need to retrain a model for each example $x$ . Instead, we train $m$ models once on random subsets of $D$ , and compute the estimation (Equation 2) for all examples using the same set of $m$ models. Ilyas et al. [2022] recently showed that it may also be possible to directly predict these scores using a regression model, yet this approach is computationally prohibitive for large language models.
|
| 68 |
+
|
| 69 |
+
# 4 Analyzing Counterfactual Memorization
|
| 70 |
+
|
| 71 |
+
We estimate and analyze counterfactual memorization of training examples in three standard text datasets: RealNews [Zellers et al., 2019], C4 [Raffel et al., 2020a] and Wiki40B:en [Guo et al., 2020]. Unless otherwise specified, we use Transformer-based language models [Vaswani et al., 2017] equivalent to (decoder only) T5-base [Raffel et al., 2020b] with ${ \sim } 1 1 2 \mathbf { M }$ parameters. To save computation and enable more direct comparisons across datasets, we truncate the training set for each datasets by taking the first $2 ^ { 2 1 }$ documents. To estimate counterfactual memorization, we train 400 models for each dataset, each on a random $2 5 \%$ subset of the training examples. In practice, we use a hash-based filtering mechanism to efficiently approximate random subset sampling (details in Appendix G), as the data loading APIs for large text corpora generally support only sequential visits to examples with limited shuffling and subsampling capability within a window.
|
| 72 |
+
|
| 73 |
+
We train each model for 60 epochs1 using the Adam optimizer [Kingma and Ba, 2015] with learning rate 0.1 and weight decay $1 0 ^ { - 5 }$ . For C4/RealNews/Wiki40B:en, respectively, our models converge to an average per-token accuracy of $4 4 . 2 1 \% / 4 7 . 5 9 \% / 6 6 . 3 5 \%$ on the subsampled training set, and $2 7 . 9 0 \% / 3 1 . { \bar { 0 } } 9 \% / 4 9 . 5 5 \%$ on the validation set. On average, the models start to overfit at around epoch 5, as indicated by the signal that the validation accuracy starting to decrease.
|
| 74 |
+
|
| 75 |
+
# 4.1 Distribution of Memorization
|
| 76 |
+
|
| 77 |
+
Table 1 shows examples from the RealNews training set sampled at various memorization levels. Examples with the highest memorization are generally unconventional text such as all-capital letters, structured formats (i.e., tables or bullet list), and multilingual texts. After those artificial examples, examples with intermediate-to-high memorization are most often news reports of specific events. One of our main goals is to be able to separate memorization of such examples containing details of specific events from memorization of common facts or highly duplicated template texts. Indeed, templated documents with many near-duplicate copies in the training data generally have low counterfactual memorization. C4 and Wiki40B:en have similar trends. Interestingly, though Wikipedia articles are less likely to be auto-generated from templates than the web in general, we do observe repetitive patterns in low-scoring documents, such as “_START_ARTICLE_ <place name>, Virginia _START_PARAGRAPH_ <place name> is an unincorporated community in <county name>, in the U.S. state of Virginia.”
|
| 78 |
+
|
| 79 |
+
To visualize the distribution of memorization, we plot 2D histograms in Figure 1, where the $\mathbf { X }$ -axis shows the difference of IN-accuracy and OUT-accuracy (i.e. the counterfactual memorization), and the y-axis shows the sum of the two, which we term “simplicity”. A simple example is one that is scored highly regardless of whether a model saw it during training. The histograms are plotted in log scale to better visualize the exponential decay in the tail for high memorization and simplicity levels.
|
| 80 |
+
|
| 81 |
+
From the 2D density plots, we find that easy examples tend to have low memorization. However, there is no simple linear correlation. Peak memorization occurs for examples of intermediate simplicity. For the hardest examples, the memorization scores are low, because even the IN-models could not learn them well. Many hard examples consist of ill formatted text or contained foreign languages. As a result, in Wiki40B:en, which contains higher quality texts, the lower bound of the histogram is higher than the other two datasets (Figure 1). Interestingly, the choice of data has a relatively minor effect on memorization: the shape of the memorization histogram is generally consistent across the three datasets; the range of memorization values is only slightly compressed for Wiki40B:en.
|
| 82 |
+
|
| 83 |
+
Table 1: Examples of RealNews training set sampled at high, intermediate and low memorization. The URL of each document is included at the beginning of each example. [...] indicate omitted text for brevity. In the last block, two near-duplicate examples are shown; the yellow highlights in the last block indicate differences.
|
| 84 |
+
|
| 85 |
+
<table><tr><td>Index</td><td>mem</td><td>Text</td></tr><tr><td>2090855</td><td>0.6546</td><td>link → THE AMERICAN JEWISH CONGRESS ANNOUNCED TODAY THE PUBLICATION OF A REPORT ON JEWISH NON- EMPLOYMENT AS A RESULT OF ECONOMIC DISCRIMINATION,[J THEREAFTER ONE OF THE DEPARTMENTS OF A.T.& T.”ALMOSTUNPRECEDENTEDLY "ENGAGED A JEWISH APPLICANT.</td></tr><tr><td>2085736</td><td>0.5755</td><td>linkxRECIPE:ChinesePork&VegetableSoupwith WontonNodles ChinesePork&Vegetable SoupwithWontonNoodeslpork enderloin (about1-1/4poudsize)oeddutitinchcubupswerodickenrothuwate*/4cpakes (about11/2cups each)RecipebyPorkBeInspired.com withadaptations byculinarydietian &nutritionistKim Galeaz,RDNCD</td></tr><tr><td>1680600</td><td>0.5807</td><td>linkLangaggs.ab.edgmtofout.cwoldiktogatsi being heldonthe traditionallandsofthe (appropriate group)people,nd paymyrespectoelders both past and present"[]</td></tr><tr><td>2074805</td><td>0.2835</td><td>linkATexasoorsstudentpunishdforsinghatomosealitysongshadhisuspesosnded.WesteHilhde thecorrectdecisioninreversingtheircoursefctio."Thedecisiontoescid thesuspensionis thecorrecto.Thesuspensonaswrong andimproper"saidStaver."Iaplaudthestudentforstandingup.Westoodwithhimtoresistanunjustsuspensionandweaepleasedthat suspensionhasevesed"Libetyounselillotiuetteisefrdfosiedeliosdae instancesareincreasingandwillcontinue toincreaseunlessChristiansandpeoplewholovelibertystandupandesistisitolerance."</td></tr><tr><td>449808</td><td>0.0361</td><td>link >Investors in Digital Realty Trust, Inc.(DLR) sawnew optionsbegin trading thisweek. for theFebruary2014 expiration.At Stock Options Channel, our YieldBoost formula has looked up and down theI eDLRoptions chain for the new February2014 contracts and identified one put and one callcontract of particular interest.The put contract at the $45.OO strike price has a current bid of $1.00. [...]</td></tr><tr><td>1157311</td><td>0.0356</td><td>link > Investors in Abercrombie & Fitch Co. (ANF): sawnew optionsbecome available today, for theApril 4th expiration. At Stock Options Channel,our YieldBoost formula has looked up and down the ANF optionschain for the new April4th contracts and identified one put and one call contract of particular interest.The put contract at the $34.OO strike price has a current bid of $1.97. [...]</td></tr></table>
|
| 86 |
+
|
| 87 |
+

|
| 88 |
+
Figure 1: The joint distribution of counterfactual memorization (X axis) and simplicity (Y axis), where simplicity is measured as the overall accuracy for an example across all models. (Histograms are in log-scale).
|
| 89 |
+
|
| 90 |
+
Figure 1 shows the overall distribution of memorization for each training datasets. To obtain a more granular view, we can also analyze the distributions for texts sourced from individual web domains in RealNews and C4, to see whether different data sources display different memorization profiles. Web domains such as news portals, blogs, and forums differ both stylistically and in how much they reference or even copy from other websites. Additionally, some domains are represented much more frequently than others in the datasets we studied. This could lead to considerably different memorization profiles for examples from different domains.
|
| 91 |
+
|
| 92 |
+
To investigate these effects, we visualize the 95th percentile memorization score in each web domain against the number of examples in that domain for RealNews (Figure 2a) and C4 (Figure 2b). C4 contains many more domain names than RealNews since the latter is collected only from news websites. For both datasets, the domains with a large number of crawled documents show a smaller variance in the 95-percentile values, while “smaller” domains depict a wide range of variety in memorization profiles. The memorization profiles of a few representative domains are visualized in Figures 2c and 2d. The domains we selected for visualization are: the largest domain (blue), the domain with highest 95 percentile memorization (orange), and two domains that have more than 1000 and 50 articles in RealNews and C4 respectively (green and red).
|
| 93 |
+
|
| 94 |
+
In RealNews (Figure 2c), reuters.com contains the largest number of documents but low memorization scores on average. The domain digitallibrary.un.org, the United Nations Digital Library, has high memorization scores potentially because it contains many multilingual documents. We have observed that less frequently occurring tokens, like those in foreign languages or ALL-CAPITAL words tend to cause high memorization. Similarly, flattened structured data (e.g. tabular texts) also deviates significantly from normal English texts and potentially leads to high memorization, as demonstrated by zap2it.com, a website for TV program listings. On the other hand, hotair.com is a news commentary website that frequently quotes other major news articles. This may lead to duplicate text in the dataset which we suspect contributes to its overall lower memorization distribution.
|
| 95 |
+
|
| 96 |
+

|
| 97 |
+
Figure 2: For each web domain, we plot the 95-percentile of memorization against the number of examples from that domain in (a) RealNews and (b) C4. The red dotted line indicates a threshold of a minimum of 1000 articles for RealNews and 50 articles for C4. The memorization distributions of a few representative domains are shown for (c) RealNews and (d) C4.
|
| 98 |
+
|
| 99 |
+
The observations are similar on C4: blogspot.com contains a large number of documents in the training set with only moderate amounts of memorization; zh.wikipedia.org and buckinghamautos.com.au have high memorization due to foreign (Chinese) or structured (car sales listings) text; and www.unitedstateszipcodes.org has very low memorization scores because common templates are re-used to generate similar pages for individual zip codes.
|
| 100 |
+
|
| 101 |
+
# 4.2 Number of Models Needed
|
| 102 |
+
|
| 103 |
+
To evaluate the impact of a single training example, one may wish to train two models that differ only in that single example. In practice, the stochasticity in a single run of common training algorithms (e.g. SGD) produces too low signal-to-noise ratios to be useful for such estimation. Moreover, leave-one-out estimation means a separate pair of models needs to be trained for each training example, which is computationally costly. Therefore, we formulated our estimation in Section 3 by accumulating statistics from $m$ models independently trained on random training subsets. In our experiments, we set $m = 4 0 0$ . To understand how sensitive our results are to $m$ , we analyze the rankings produced by distinct sets of models of size $m$ . We vary $m$ from 6 to 192, and partition our set of 400 models into up to 10 sets of $m$ models (e.g. for $m = 1 9 2$ , we construct 2 partitions, and for $m = 6$ , we construct 10). We then compute the Spearman’s R between these partitions to measure the agreement between the rankings produced by each partition. If the rankings are very similar (have Spearman’s R close to 1), then this number of models is reliably estimating the true ranking of memorization scores. We plot these Spearman’s R values in Figure 3a. Even at 96 models, this correlation begins to plateau near 1, lending confidence that 400 models is sufficient for reliable estimation of memorization scores. See Appendix D for more analysis on the sensitivity to $m$ .
|
| 104 |
+
|
| 105 |
+
# 4.3 Impact of Number of Training Epochs
|
| 106 |
+
|
| 107 |
+
As expected, the overall amount of memorization grows consistently with the number of epochs of training (Figure 3b). This makes sense since training for more epochs increases overfitting. As training progresses, we also see an increasingly long tail of examples with high memorization scores. On RealNews, about $59 \%$ of examples had consistently increasing memorization scores across all epochs considered. There were no examples whose memorization decreased in a significant way over training (all observed decreases can be attributed either to noise or to instability early in training). Only $0 . 5 \%$ of examples stayed completely un-memorized with scores which never rose above 0.1, while $85 \%$ of examples had memorization scores which never rose above 0.2. Figure 3c shows the fraction of memorized examples as training progresses, at several thresholds of memorization. We can see that more training epochs significantly increases memorization.
|
| 108 |
+
|
| 109 |
+

|
| 110 |
+
Figure 3: (a) Spearman’s R between memorization rankings from two disjoint sets of $m$ models. The rankings are variable at low numbers of models, but starts to converge at 192 models. All of our other experiments use 400 models. Reported values are averages over up to 10 partitions, with error bars of 10 standard deviations. (b) The distribution in memorization of RealNews examples as training progresses. (c) The fraction of RealNews examples with memorization consistently above the specified threshold as training progresses. (d) For RealNews, we plot memorization scores against the number of near-duplicates an example had in the dataset.
|
| 111 |
+
|
| 112 |
+
# 5 Duplicate Text and Memorization
|
| 113 |
+
|
| 114 |
+
One of the goals of evaluating counterfactual memorization is to identify examples that have a low number of duplicates yet whose presence versus absence in the training data has a large effect on the model. Here, we perform a quantitative study of the (anti-)correlation between duplication and counterfactual memorization compared with the positive correlation between duplication and the “generation-time memorization” definitions of memorization used by Lee et al. [2021], Carlini et al. [2022], Kandpal et al. [2022].
|
| 115 |
+
|
| 116 |
+
Following the method from [Lee et al., 2021], we first use MinHash [Broder, 1997] to identify near-duplicate examples in RealNews train set. We consider a example a duplicate if it has an normalized edit similarity of greater than 0.7 (definition included in Appendix I). Out of 2.01 million examples, ${ \sim } 3 8 { , } 0 0 0$ were identified as being a near-duplicate with at least one other example. Among these frequently-occurring examples, the Pearson correlation between an example’s counterfactual memorization score and the number of near-duplicates for that example is $- 0 . 3 9$ ; in other words, memorization does quantitatively decrease when data is repeated more often.
|
| 117 |
+
|
| 118 |
+
In Figure 3d we can see that examples with a large number of near-duplicates have smaller memorization scores. Counterfactual memorization primarily differentiates amongst examples with a few number of duplicates. This makes sense given that examples with lots of near duplicates would likely have their near duplicates in OUT-models. This is to be contrasted with “generation-time memorization” (discussed in Section A) that measures the textual overlap between model generated texts and the training documents. There, the number of occurrences strongly correlate with the measured memorization [Carlini et al., 2020, Lee et al., 2021, Kandpal et al., 2022]. Counterfactual memorization measures a fundamentally different type of memorization from simple textual matching considered in prior work, providing information about how easy or hard a training example is in the context of the rest of the training set. In Table 1 we can see this effect qualitatively: sequences with near-duplicates in the training set tend to have low counterfactual memorization (as expected) .
|
| 119 |
+
|
| 120 |
+
# 6 From Memorization to Influence
|
| 121 |
+
|
| 122 |
+
Counterfactual memorization identifies training examples that contain rare information not conveyed by other examples. A natural question to ask is whether a model would leak the information in a memorized example during inference. Previous paper studies membership inference attack [Shokri et al., 2017, Sablayrolles et al., 2019, Long et al., 2020] where an attacker tries to figure out if a particular example exists in the training set. In this paper, we consider standard model evaluation without adversarial attackers, and quantify “does seeing a particular training example strongly influence the prediction on a validation example?” Another way of asking this is if a single example in the training set has an large and over-representative impact on the prediction of a validation example. We answer these questions by measuring counterfactual influence with a formulation adapted from Feldman and Zhang [2020]:
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 4: (a) Histogram of the influence of all the training examples on a specific test example for three different test examples on RealNews. The blue and orange examples have high and intermediate influence from some training examples, as indicated by the outlier values to the right of the each histogram plot. The green one is a random example, where the influence from all individual training examples are close to zero. (b) The joint distribution of the memorization score of each training example and its maximum influence on any validation set example. The histograms are in log scale to better visualize the tail of the distributions. C4 shown in Figure 6.
|
| 126 |
+
|
| 127 |
+
Definition 6.1 (Counterfactual Influence). Given a training algorithm $A$ that maps a training set $D$ to a trained model, and a performance measure $M$ , the counterfactual influence of a training example $x \in D$ on another example $x ^ { \prime }$ is
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
\mathsf { i n f l } ( x \Rightarrow x ^ { \prime } ) \triangleq \mathbb { E } _ { S \subset D , x \in S } [ M ( A ( S ) , x ^ { \prime } ) ] - \mathbb { E } _ { S \subset D , x \notin S } [ M ( A ( S ) , x ^ { \prime } ) ] ,
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
where $S$ is a subset of training examples sampled from $D$ . The expectation is taken with respect to the random sampling of $S$ , as well as the randomness in the training algorithm $A$ . Here $x ^ { \prime }$ can be an example from the validation set or test set, a generated example or a training example.
|
| 134 |
+
|
| 135 |
+
An empirical estimation of the influence can be computed similarly to counterfactual memorization by uniformly sampling $m$ subsets $S _ { 1 } , \ldots , S _ { m }$ from $D$ , where $| S _ { i } | = r | D |$ , and calculating
|
| 136 |
+
|
| 137 |
+
$$
|
| 138 |
+
\begin{array} { r } { \widehat { \mathfrak { i n f } } | ( x \Rightarrow x ^ { \prime } ) \triangleq \underset { i : x \in S _ { i } } { \mathrm { m e a n } } [ M ( A ( S _ { i } ) , x ^ { \prime } ) ] - \underset { i : x \notin S _ { i } } { \mathrm { m e a n } } [ M ( A ( S _ { i } ) , x ^ { \prime } ) ] . } \end{array}
|
| 139 |
+
$$
|
| 140 |
+
|
| 141 |
+
This measures how much a training sample $x$ ’s presence influences the prediction of a different example $x ^ { \prime }$ . Note, ${ \mathsf { m e m } } ( x ) = { \mathsf { i n f l } } ( x \Rightarrow x )$ , i.e., counterfactual memorization is self influence.
|
| 142 |
+
|
| 143 |
+
Influence on Examples of the Validation Set. With the same models trained for estimating memorization, we can estimate the counterfactual influence on the validation set according to Equation (4). For each example in the validation set, we can estimate the influence on it from each training example. Figure 4a shows the distribution of influence from all training example on three different examples from the validation set. The green example was randomly chosen and represents the behavior for most validation examples: it receive close-to-zero influence from all the (individual) training examples. The blue and orange examples were sampled to have high and intermediate maximum influence. Each of them has one (or a few) strong influencer from the training set, as indicated by the bars to the right of the histogram. They also only receive tiny influence from all the rest of the training examples, though the variance of influence is larger than for the green example.
|
| 144 |
+
|
| 145 |
+
Intuitively, most training examples will have small influence on validation set examples because the models learn distributional patterns shared across many training examples, and individual training examples tend to have insignificant influence here. However, a training example $x$ with high counterfactual memorization contains rare information that are not shared with other examples. Therefore, if a validation set example $x ^ { \prime }$ contains similar information, $\mathsf { i n f l } ( x \Rightarrow x ^ { \prime } )$ could be large. Figure $^ { 4 \mathrm { b } }$ shows the relationship between memorization and influence by plotting $\mathsf { m e m } ( x )$ of each training example $x$ against its maximum influence $\mathrm { m a x } _ { x ^ { \prime } } \mathsf { i n f l } ( x \Rightarrow x ^ { \prime } )$ on $x ^ { \prime }$ across the validation set.
|
| 146 |
+
|
| 147 |
+
Consistent with our intuition, examples with small memorization scores have small max-influence scores. Larger influence scores on the validation set generally requires larger memorization scores of the training example itself. However, not all training examples with large memorization scores lead to large influence scores. In particular, the max-influences drop significantly for examples with memorization larger than 0.4. One potential reason is that many examples with very high memorization are simply low quality text, so memorization is required in order to learn them, but they do not encode anything interesting that could influence a validation example. On the other hand, even if a memorized example encodes some rare and useful information, the max-influence could still be low because the validation set does not contain a relevant document. This is especially true given that all datasets have considerably smaller validation sets than training sets.
|
| 148 |
+
|
| 149 |
+
Table 2: Train-validation example pairs of RealNews sampled at a variety of influence levels. [...] indicate text omitted for brevity. Differences in each document pair are highlighted yellow.
|
| 150 |
+
|
| 151 |
+
<table><tr><td>Index</td><td>Estim.</td><td>Text</td><td></td></tr><tr><td>Validation 1334662</td><td>infl 0.3780</td><td>link ></td><td>Identical URL except with the htp://protocol instead of https://.The text is identical to the training example.</td></tr><tr><td>Train 2077314</td><td>mem 0.3780</td><td>Jeffrey Heller/Jeremy Gaunt)</td><td>linkByAriRabinoichZEELLLEYIsrael(Reuters)edisposablepaperfcemasksoferitteproteionfromteodf dustthatfleelosteaphtoleari</td></tr><tr><td>Validation 838341</td><td>infl 0.1209</td><td>link VATICAN CITY(AP)</td><td>Emeritus Pope Benedict XVI is offering a first-ever papal assessment of his own pontificate in a book that recountshissooipseathscodisptsttleathallVtiasgalb"dic XVI:TheFinalConversatios,"isdueoutinSeptemberthelatestVaticancarerbysimplyspreadinggossipthathewas gay Different</td></tr><tr><td>Train</td><td>mem 0.1650</td><td>link >VATICAN CITY</td><td>websites,but (almost) identical report. Emeritus Pope Benedict XVIisofferingafirst-everpapal assessmentof hisown pontificate inabook thatrecounts hisdecisiontosipiseatscodiseptstosmatleatallVatian’s"globy"ec Final Conversations,"isdueoutineptember,thelatest[.Vaticancarerbysimplyspreadinggossipthathewasgay. Follow Nicole Winfield</td></tr><tr><td>614881</td><td></td><td></td><td>at www.twitter.com/nwinfield linkANAH-OnanighthenFancoiseaucheminhadtwoistsinrontandChrisProngebockedsixsotsinetroi69</td></tr><tr><td>Validation 682107</td><td>infl</td><td>0.0673</td><td>DucksfansmighthavebeelostwitoutheirprogramsonWednesayightItsonlytefrstgameoftepreseasonutaeeraearly begun.AgroupofmostlyewcomersinDucksuniforsbeatPhoenix3-2inashootoutonWednesdayatHondaCenter.Afamilarfacemade ct,however,asobbyRyansoredtwogoalsRyaalsoscoredtwgoalsintheDucks’preseasonopenerastyariernt</td></tr><tr><td></td><td></td><td></td><td>the biggest impact,</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>websites on the same event with slightly diferent wordings.</td></tr><tr><td>Train</td><td></td><td>mem</td><td>linkANAHE-OnanightwhenFrancoisBeaucheminhadtwoasstsinorontoandChrisProngerblockedsixsots inDetroit,the</td></tr><tr><td>494435</td><td></td><td>0.1439</td><td>13,869 Ducks' fans who showed at at Honda Center Wednesday needed programs to identify the players on their favorite team.</td></tr><tr><td></td><td></td><td></td><td>frstgameoftepresasoutraasal.Agroupofostlwcoesiucksosatoix-inot</td></tr><tr><td></td><td></td><td></td><td>althoughafamiliarfacemade thebiggest impactasBobbyRyanscoredtwo goalsinregulationandanother intheshootout. two goals in the Ducks’ preseason opener last year[...]</td></tr><tr><td></td><td></td><td></td><td>Ryan also scored</td></tr><tr><td>Validation</td><td></td><td>infl</td><td>linkxMoretan7oo poundsofButerballtrkeyrecalledbecauseofpotentialsalmonella WASHINGON—The U.S.Departentof</td></tr><tr><td>1165799</td><td></td><td>0.0360</td><td>Agriculture's Food Safety and Inspections services announced on Wednesday[ [.] They were shipped to nationwide retail and institutional</td></tr><tr><td></td><td></td><td></td><td>locations.RELATED: View the fullrecall FSIS,the Centers for Disease Control and Prevention and[..] Different websitesreportingthe same</td></tr><tr><td></td><td></td><td></td><td>event, one embeded a lot more information than the other.</td></tr><tr><td>Train</td><td></td><td></td><td>link > x Butterball recalls nearly 8o.oo0 pounds of turkey a after salmonella cases WASHINGTON- The U.S. Department of Agriculture's</td></tr><tr><td>1571976</td><td></td><td>mem</td><td>Food Safetyand Inspection service announced Wednesday [..] The raw ground turkey was produced on July 7, 2018. The following products</td></tr><tr><td></td><td></td><td>0.2094</td><td></td></tr><tr><td></td><td></td><td></td><td>under recall were shippedtonationwide retailand institutionallocations: 48-oz.plastic wrappedtraycontaining"BUTTERBALLeveryday</td></tr><tr><td></td><td></td><td></td><td>Fresh GroundTurkeyWITHNAURALFLAVORING(85%LEAN/15%FAT)withsellorfreeze bydateof726/18,lotcode 818andUP</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>codes22655-7155or2655-71557representedonthelabel.48-oz.plasticwrappedtraycontaining"BUERBALLeverdayFreshGoud</td></tr><tr><td></td><td></td><td></td><td>Turkey WITH NATURAL FLAVORING (93% LEAN/7% FAT)" with sellor freeze by date of 7/26/18, lot[.] labelshere. FSIS,the Centers for</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>Disease Control and Prevention and</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr></table>
|
| 152 |
+
|
| 153 |
+
Table 2 shows train-validation example pairs from RealNews sampled at different influence value ranges. We found that the train-validation pairs with the highest influence are almost identical, except some superficial differences, such as different handling of quotation / em dash marks. As we move to intermediate influence ranges, we commonly found reports on the same events. Large paragraphs of identical text indicate that one document might be citing the other or both citing from a third party. At low influence, two types of correlations are commonly observed: 1) templated texts with high similarity—the reason for a low influence is that there are many similar training examples that split the influence; 2) superficially related documents due to a shared prefix such as ST. CLOUD – This week in our “Behind the Scenes” series on WJON or a shared substring of some common knowledge like FSIS, the Centers for Disease Control and Prevention. Due to high signal-to-noise ratio, here were no noticeable relationships in the document pairs with influence scores below 0.02.
|
| 154 |
+
|
| 155 |
+
Influence turns out to be an effective tool for analyzing and attributing the model predictions at test time: for predictions that rely on information obtained by (counterfactual) memorization, we can identify exactly which training example provided such information. Our observation of nearduplicated training-validation document pairs is consistent with recent studies that identifies data contamination in large Internet crawled text corpus [Lee et al., 2021, Dodge et al., 2021].
|
| 156 |
+
|
| 157 |
+
Influence on Generated Texts. The influence estimation is not restricted to the validation set. We can also estimate influence on generated examples. In this section, we evaluate on the publicly released generations from the Grover models [Zellers et al., 2019] trained on RealNews. Specifically, we take the generations from Grover-Mega $\scriptstyle ( \mathtt { p } = 0 . 9 6 )$ ), a 1.5-billion-parameter model trained on the RealNews dataset. Comparing with the train-validation influence in Figure 4b, the histogram (c.f. Figure 10 in Appendix.) decays faster as max-influence grows. Moreover, the value range of max-influence is also twice smaller. The reason that we did not find a lot of highly influenced generated examples are two fold: 1) there are only 24,576 generation in the public release, which is much fewer than the validation examples. As a result, the corresponding example of many memorized training examples do not get sampled in the generations. For comparison, previous work [Carlini et al., 2020, Lee et al., 2021] generated $1 0 0 { , } 0 0 0 { + }$ examples to identify memorization in generation. These approaches also count duplicates in the training set, which counterfactual memorization filters out. 2) The Grover model was trained on the full RealNews training set, while we have restricted our analysis to the first 2M training examples. There could be potentially more high influence training examples that are missed in our calculation.
|
| 158 |
+
|
| 159 |
+
# 7 Summary and Discussion
|
| 160 |
+
|
| 161 |
+
We studied memorization in neural language models. We formulated a notion of counterfactual memorization as a tool that can systematically ignore “common” memorization such as general knowledge (e.g. “Paris is a city in France”) and captures memorization of rare, specific information (e.g. description of a specific episode of event) present in the training examples. We conducted experiments on three commonly used text corpus in language modeling and found memorization in all of them. We further analyze the per-domain memorization profiles for Internet-crawled data, and found that different sources could have substantially different memorization profiles.
|
| 162 |
+
|
| 163 |
+
Furthermore, we analyzed how memorized training examples could impact the model predictions at test time via counterfactual influence. We found that for examples from both the validation set and the model generated texts, the model predictions could be drastically different depending on the presence or absence of a particular training example with high memorization.
|
| 164 |
+
|
| 165 |
+
Limitations. This study mainly focus on English datasets. While we expect the characterization of memorization would be similar when evaluated on corpus of other (natural) languages, new patterns might be observed on multilingual data or more structured domains such as programming languages.
|
| 166 |
+
|
| 167 |
+
Both the neural language models and training sets used in this work are orders of magnitude smaller than modern standards such as GPT-3 [Brown et al., 2020], GPT-4 [OpenAI, 2023] and PaLM2 [Google, 2023]. Moreover, we only conducted preliminary investigation of the dynamics of counterfactual memorization during training. Although our experiments effectively estimated and detected memorization, we suspect more interesting examples might emerge if larger, more capable models are analyzed. For example, currently when the information from a memorized training example is leaked in the prediction of a strongly influenced test example, it can usually be explained by a high text overlap between the training and test examples. For models with deeper understanding of languages, we suspect that strong influence could be observed even between documents that have no direct text overlap but that encode similar semantic information.
|
| 168 |
+
|
| 169 |
+
In order to test this, it will be necessary to scale our framework to larger models and datasets. Moreover, it will be necessary to construct datasets where semantically similar but textually different document pairs exist. One potential source to construct such datasets would be versioned Wikipedia articles–two versions of the same article with large time span or edit distance may contain semantically similar (but paraphrased) information. Such a dataset of paraphrased text pairs would be more broadly useful to understand the ability of different models to disentangle text content and form—by measuring the influence of one piece of text on a paraphrased piece of text.
|
| 170 |
+
|
| 171 |
+
Counterfactual memorization enables us to identify examples that whose presence or absence has a large impact on the model and the model’s ability to score and generate other text. The privacy risk for this is low since in order to perform this analysis, one would need to already have access to the dataset and the ability to train models.
|
| 172 |
+
|
| 173 |
+
Acknowledgments. The authors would like to thank Samy Bengio, Christopher A. ChoquetteChoo, Ethan Dyer, Michael C. Mozer, Behnam Neyshabur, Andrew Nystrom, and Hanie Sedghi for constructive discussions and feedback. The authors would like to thank Andrew Nystrom for assistance with MinHash-based near-duplicate detection.
|
| 174 |
+
|
| 175 |
+
# References
|
| 176 |
+
|
| 177 |
+
Samyadeep Basu, Philip Pope, and Soheil Feizi. Influence functions in deep learning are fragile. ArXiv, abs/2006.14651, 2021.
|
| 178 |
+
|
| 179 |
+
Rishi Bommasani, Drew A Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, Erik Brynjolfsson, Shyamal Buch, Dallas Card, Rodrigo Castellon, Niladri Chatterji, Annie Chen, Kathleen Creel, Jared Quincy Davis, Dora Demszky, Chris Donahue, Moussa Doumbouya, Esin Durmus, Stefano Ermon, John Etchemendy, Kawin Ethayarajh, Li Fei-Fei, Chelsea Finn, Trevor Gale, Lauren Gillespie, Karan Goel, Noah Goodman, Shelby Grossman, Neel Guha, Tatsunori Hashimoto, Peter Henderson, John Hewitt, Daniel E Ho, Jenny Hong, Kyle Hsu, Jing Huang, Thomas Icard, Saahil Jain, Dan Jurafsky, Pratyusha Kalluri, Siddharth Karamcheti, Geoff Keeling, Fereshte Khani, Omar Khattab, Pang Wei Kohd, Mark Krass, Ranjay Krishna, Rohith Kuditipudi, Ananya Kumar, Faisal Ladhak, Mina Lee, Tony Lee, Jure Leskovec, Isabelle Levent, Xiang Lisa Li, Xuechen Li, Tengyu Ma, Ali Malik, Christopher D Manning, Suvir Mirchandani, Eric Mitchell, Zanele Munyikwa, Suraj Nair, Avanika Narayan, Deepak Narayanan, Ben Newman, Allen Nie, Juan Carlos Niebles, Hamed Nilforoshan, Julian Nyarko, Giray Ogut, Laurel Orr, Isabel Papadimitriou, Joon Sung Park, Chris Piech, Eva Portelance, Christopher Potts, Aditi Raghunathan, Rob Reich, Hongyu Ren, Frieda Rong, Yusuf Roohani, Camilo Ruiz, Jack Ryan, Christopher Ré, Dorsa Sadigh, Shiori Sagawa, Keshav Santhanam, Andy Shih, Krishnan Srinivasan, Alex Tamkin, Rohan Taori, Armin W Thomas, Florian Tramèr, Rose E Wang, William Wang, Bohan Wu, Jiajun Wu, Yuhuai Wu, Sang Michael Xie, Michihiro Yasunaga, Jiaxuan You, Matei Zaharia, Michael Zhang, Tianyi Zhang, Xikun Zhang, Yuhui Zhang, Lucia Zheng, Kaitlyn Zhou, and Percy Liang. On the opportunities and risks of foundation models. August 2021.
|
| 180 |
+
|
| 181 |
+
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.
|
| 182 |
+
|
| 183 |
+
Andrei Z Broder. On the resemblance and containment of documents. In Proceedings. Compression and Complexity of SEQUENCES 1997 (Cat. No. 97TB100171), pages 21–29. IEEE, 1997.
|
| 184 |
+
|
| 185 |
+
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.
|
| 186 |
+
|
| 187 |
+
Nicholas Carlini, Chang Liu, Úlfar Erlingsson, Jernej Kos, and Dawn Song. The secret sharer: Evaluating and testing unintended memorization in neural networks. In USENIX Security Symposium, 2019.
|
| 188 |
+
|
| 189 |
+
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 arXiv:2012.07805, 2020.
|
| 190 |
+
|
| 191 |
+
Nicholas Carlini, Steve Chien, Milad Nasr, Shuang Song, Andreas Terzis, and Florian Tramer. Membership inference attacks from first principles, 2021.
|
| 192 |
+
|
| 193 |
+
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.
|
| 194 |
+
|
| 195 |
+
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.
|
| 196 |
+
|
| 197 |
+
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.
|
| 198 |
+
|
| 199 |
+
Jesse Dodge, Maarten Sap, Ana Marasovic, William Agnew, Gabriel Ilharco, Dirk Groeneveld, and Matt Gardner. Documenting the english colossal clean crawled corpus. arXiv preprint arXiv:2104.08758, 2021.
|
| 200 |
+
|
| 201 |
+
Cynthia Dwork, Aaron Roth, et al. The algorithmic foundations of differential privacy. Found. Trends Theor. Comput. Sci., 9(3-4):211–407, 2014.
|
| 202 |
+
|
| 203 |
+
Yanai Elazar, Nora Kassner, Shauli Ravfogel, Amir Feder, Abhilasha Ravichander, Marius Mosbach, Yonatan Belinkov, Hinrich Schütze, and Yoav Goldberg. Measuring causal effects of data statistics on language model’s factual predictions. arXiv preprint arXiv:2207.14251, 2022.
|
| 204 |
+
|
| 205 |
+
Vitaly Feldman. Does learning require memorization? A short tale about a long tail. In STOC, 2020.
|
| 206 |
+
|
| 207 |
+
Vitaly Feldman and Chiyuan Zhang. What neural networks memorize and why: Discovering the long tail via influence estimation. In Advances in Neural Information Processing Systems, 2020.
|
| 208 |
+
|
| 209 |
+
Google. Palm 2 technical report. Technical report, Google, 2023.
|
| 210 |
+
|
| 211 |
+
Mandy Guo, Zihang Dai, Denny Vrandecic, and Rami Al-Rfou. Wiki-40b: Multilingual language model dataset. In LREC 2020, 2020.
|
| 212 |
+
|
| 213 |
+
Frank R Hampel. The influence curve and its role in robust estimation. Journal of the american statistical association, 69(346):383–393, 1974.
|
| 214 |
+
|
| 215 |
+
Jonathan Heek, Anselm Levskaya, Avital Oliver, Marvin Ritter, Bertrand Rondepierre, Andreas Steiner, and Marc van Zee. Flax: A neural network library and ecosystem for JAX, 2020. URL http://github.com/google/flax.
|
| 216 |
+
|
| 217 |
+
Peter Henderson, Koustuv Sinha, Nicolas Angelard-Gontier, Nan Rosemary Ke, Genevieve Fried, Ryan Lowe, and Joelle Pineau. Ethical challenges in data-driven dialogue systems, 2017.
|
| 218 |
+
|
| 219 |
+
Andrew Ilyas, Sung Min Park, Logan Engstrom, Guillaume Leclerc, and Aleksander Madry. Datamodels: Predicting predictions from training data. arXiv preprint arXiv:2202.00622, 2022.
|
| 220 |
+
|
| 221 |
+
Guido W Imbens and Donald B Rubin. Causal inference in statistics, social, and biomedical sciences. Cambridge University Press, 2015.
|
| 222 |
+
|
| 223 |
+
Matthew Jagielski, Jonathan Ullman, and Alina Oprea. Auditing differentially private machine learning: How private is private sgd?, 2020.
|
| 224 |
+
|
| 225 |
+
Nikhil Kandpal, Eric Wallace, and Colin Raffel. Deduplicating training data mitigates privacy risks in language models. arXiv preprint arXiv:2202.06539, 2022.
|
| 226 |
+
|
| 227 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In The International Conference for Learning Representations, 2015.
|
| 228 |
+
|
| 229 |
+
Pang Wei Koh and Percy Liang. Understanding black-box predictions via influence functions. ArXiv, abs/1703.04730, 2017.
|
| 230 |
+
|
| 231 |
+
Pang Wei Koh, Kai-Siang Ang, Hubert Hua Kian Teo, and Percy Liang. On the accuracy of influence functions for measuring group effects. In NeurIPS, 2019.
|
| 232 |
+
|
| 233 |
+
Jooyoung Lee, Thai Le, Jinghui Chen, and Dongwon Lee. Do language models plagiarize? In Proceedings of the ACM Web Conference 2023, pages 3637–3647, 2023.
|
| 234 |
+
|
| 235 |
+
Katherine Lee, Daphne Ippolito, Andrew Nystrom, Chiyuan Zhang, Douglas Eck, Chris CallisonBurch, and Nicholas Carlini. Deduplicating training data makes language models better. CoRR, abs/2107.06499, 2021. URL https://arxiv.org/abs/2107.06499.
|
| 236 |
+
|
| 237 |
+
Yunhui Long, Lei Wang, Diyue Bu, Vincent Bindschaedler, Xiaofeng Wang, Haixu Tang, Carl A Gunter, and Kai Chen. A pragmatic approach to membership inferences on machine learning models. In 2020 IEEE European Symposium on Security and Privacy (EuroS&P), pages 521–534. IEEE, 2020.
|
| 238 |
+
|
| 239 |
+
Sayan Mukherjee, Partha Niyogi, Tomaso Poggio, and Ryan Rifkin. Learning theory: stability is sufficient for generalization and necessary and sufficient for consistency of empirical risk minimization. Advances in Computational Mathematics, 25(1):161–193, 2006.
|
| 240 |
+
|
| 241 |
+
Milad Nasr, Shuang Song, Abhradeep Thakurta, Nicolas Papernot, and Nicholas Carlini. Adversary instantiation: Lower bounds for differentially private machine learning, 2021.
|
| 242 |
+
|
| 243 |
+
OpenAI. Gpt-4 technical report. arXiv, 2023.
|
| 244 |
+
|
| 245 |
+
Judea Pearl. Causal inference in statistics: An overview. 2009.
|
| 246 |
+
|
| 247 |
+
Judea Pearl et al. Causality: Models, reasoning and inference. Cambridge, UK: CambridgeUniversityPress, 19(2):3, 2000.
|
| 248 |
+
|
| 249 |
+
Garima Pruthi, Frederick Liu, Mukund Sundararajan, and Satyen Kale. Estimating training data influence by tracking gradient descent. ArXiv, abs/2002.08484, 2020.
|
| 250 |
+
|
| 251 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1–67, 2020a. URL http://jmlr.org/papers/v21/20-074.html.
|
| 252 |
+
|
| 253 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1–67, 2020b. URL http://jmlr.org/papers/v21/20-074.html.
|
| 254 |
+
|
| 255 |
+
Vikas Raunak, Arul Menezes, and Marcin Junczys-Dowmunt. The curious case of hallucinations in neural machine translation. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1172–1183, Online, June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021. naacl-main.92. URL https://aclanthology.org/2021.naacl-main.92.
|
| 256 |
+
|
| 257 |
+
Donald B Rubin. Causal inference using potential outcomes: Design, modeling, decisions. Journal of the American Statistical Association, 100(469):322–331, 2005.
|
| 258 |
+
|
| 259 |
+
Alexandre Sablayrolles, Matthijs Douze, Yann Ollivier, Cordelia Schmid, and Hervé Jégou. Whitebox vs black-box: Bayes optimal strategies for membership inference, 2019.
|
| 260 |
+
|
| 261 |
+
Reza Shokri, Marco Stronati, Congzheng Song, and Vitaly Shmatikov. Membership inference attacks against machine learning models. In 2017 IEEE Symposium on Security and Privacy (SP), pages 3–18. IEEE, 2017.
|
| 262 |
+
|
| 263 |
+
Larry R Squire. Memory and the hippocampus: a synthesis from findings with rats, monkeys, and humans. Psychological review, 99(2):195, 1992.
|
| 264 |
+
|
| 265 |
+
Om Thakkar, Swaroop Ramaswamy, Rajiv Mathews, and Françoise Beaufays. Understanding unintended memorization in federated learning, 2020.
|
| 266 |
+
|
| 267 |
+
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.
|
| 268 |
+
|
| 269 |
+
Endel Tulving. Elements of episodic memory. Oxford University Press, 1983. ISBN 9780198521259.
|
| 270 |
+
|
| 271 |
+
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.
|
| 272 |
+
|
| 273 |
+
Nikhil Vyas, Sham Kakade, and Boaz Barak. Provable copyright protection for generative models. arXiv preprint arXiv:2302.10870, 2023.
|
| 274 |
+
|
| 275 |
+
Tianhao Wang and Ruoxi Jia. Data banzhaf: A data valuation framework with maximal robustness to learning stochasticity. arXiv preprint arXiv:2205.15466, 2022.
|
| 276 |
+
|
| 277 |
+
Santiago Zanella-Béguelin, Lukas Wutschitz, Shruti Tople, Victor Rühle, Andrew Paverd, Olga Ohrimenko, Boris Köpf, and Marc Brockschmidt. Analyzing information leakage of updates to natural language models. Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications Security, Oct 2020. doi: 10.1145/3372297.3417880. URL http://dx.doi.org/ 10.1145/3372297.3417880.
|
| 278 |
+
|
| 279 |
+
Rowan Zellers, Ari Holtzman, Hannah Rashkin, Yonatan Bisk, Ali Farhadi, Franziska Roesner, and Yejin Choi. Defending against neural fake news. In Advances in Neural Information Processing Systems, 2019.
|
| 280 |
+
|
| 281 |
+
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.
|
| 282 |
+
|
| 283 |
+
Albert Ziegler. GitHub Copilot: Parrot or crow? https://docs.github.com/en/github/copilot/researchrecitation, 2021.
|
| 284 |
+
|
| 285 |
+

|
| 286 |
+
Figure 5: Per-token accuracy of training examples evaluated on IN models vs OUT models.
|
| 287 |
+
|
| 288 |
+
# A Difference Between Counterfactual and Generation-Time Memorization
|
| 289 |
+
|
| 290 |
+
Many definitions of memorization operate at generation-time: a sequence of generated text is marked as memorized if a sufficient amount of overlap is found in the training dataset [Carlini et al., 2020]. When the training data is not available, heuristic-based methods comparing language model perplexities are used to predict whether a generation contains memorized content [Carlini et al., 2019, Thakkar et al., 2020, Thomas et al., 2020, Carlini et al., 2020, Zanella-Béguelin et al., 2020]. One difficulty with these approaches is that generation-time instances of memorization are strongly correlated with the number of similar or near-duplicate examples in the training set. As observed in Lee et al. [2021], large clusters of near-duplicated examples do exist in common language datasets, dominating memorization detected in generated text. Generation-time methods for measuring memorization are forced to design heuristics to avoid simply identifying these uninteresting instances of memorization.
|
| 291 |
+
|
| 292 |
+
In contrast, the counterfactual memorization we study in this paper handles the issue of near-duplicates automatically without the need for heuristics. For a training example, $x$ , with many near-duplicate copies in the training set, $\mathsf { m e m } ( x )$ will be small (because other samples $x ^ { \prime } \approx x$ will be present in the training dataset whether or not $x$ is). This does not mean that counterfactual memorization is the opposite of generation-time memorization. An example, $x$ , with high $\mathsf { m e m } ( x )$ may have a high chance of being generated if a model is appropriately prompted, despite and possibly because it is rare, and thus the example is considered memorized by both definitions. In summary, generationtime memorization measures the chance a model will directly copy from training examples, while counterfactual memorization aims to discover rare information that is memorized.
|
| 293 |
+
|
| 294 |
+
# B Average Accuracy of IN models vs OUT models
|
| 295 |
+
|
| 296 |
+
Figure 5 compares the per-token accuracy between the IN models and OUT models for the training examples from three different datasets. Counterfactual memorization is estimated by taking the difference between the average IN-accuracy and the average OUT-accuracy. Thus, the examples closer to the upper left corner are more counterfactually memorized, while the examples near the diagonal are not.
|
| 297 |
+
|
| 298 |
+
# C The Impact of Data Deduplication on Memorization
|
| 299 |
+
|
| 300 |
+
To investigate the impact of data deduplication on counterfactual memorization, we compared C4 with C4-NEARDUP [Lee et al., 2021], which is derived from C4 with deduplication using approximate document matching. Figure 7 compares the distribution of memorization between the original C4 and the deuplicated dataset. We did not find significant difference between the two datasets. One potential reason is that the deduplication criterion was relatively conservative, which removed only $\sim 3 \%$ of the training examples. In fact, we can still easily see near duplicate examples in C4-NEARDUP among examples with low memorization, as shown below:
|
| 301 |
+
|
| 302 |
+
Example 1380925 $\mathtt { ( m e m = 0 . 0 3 7 4 }$ ) link $\vartriangleright$ This is a placeholder page for Joshua Baldridge, which means this person is not currently on this site. We do suggest using the tools below to find Joshua Baldridge. You are visiting the placeholder page for Joshua Baldridge. This page is here because someone used our placeholder utility to look for Joshua Baldridge. We created this page automatically in hopes Joshua Baldridge would find it. If you are not Joshua Baldridge, but are an alumni of Brecksville Broadview Heights High School, register on this site for free now.
|
| 303 |
+
|
| 304 |
+

|
| 305 |
+
Figure 6: Full version of Figure 4b: The joint distribution of the memorization score of each training example and its maximum influence on any validation set example. The histograms are in log scale to better visualize the tail of the distributions.
|
| 306 |
+
|
| 307 |
+
Example 2048352 $\mathrm { { ( m e m = 0 . 0 3 2 0 ) } }$ ) link $\vartriangleright$ This is a placeholder page for Laytoya Brannon, which means this person is not currently on this site. We do suggest using the tools below to find Laytoya Brannon. You are visiting the placeholder page for Laytoya Brannon. This page is here because someone used our placeholder utility to look for Laytoya Brannon. We created this page automatically in hopes Laytoya Brannon would find it. If you are not Laytoya Brannon, but are an alumni of Mainland High School, register on this site for free now.
|
| 308 |
+
|
| 309 |
+
Example 1314053 $\mathtt { ( m e m = 0 . 0 2 7 8 ) }$ ) link $\vartriangleright$ This is a placeholder page for Devin Mcguire, which means this person is not currently on this site. We do suggest using the tools below to find Devin Mcguire. You are visiting the placeholder page for Devin Mcguire. This page is here because someone used our placeholder utility to look for Devin Mcguire. We created this page automatically in hopes Devin Mcguire would find it. If you are not Devin Mcguire, but are an alumni of Kankakee Valley High School, register on this site for free now.
|
| 310 |
+
|
| 311 |
+
Example 1085524 $\mathrm { { ( m e m = 0 . 0 2 0 9 } }$ ) link $\vartriangleright$ This is a placeholder page for Anthony Christie, which means this person is not currently on this site. We do suggest using the tools below to find Anthony Christie. You are visiting the placeholder page for Anthony Christie. This page is here because someone used our placeholder utility to look for Anthony Christie. We created this page automatically in hopes Anthony Christie would find it. If you are not Anthony Christie, but are an alumni of Old Bridge High School, register on this site for free now.
|
| 312 |
+
|
| 313 |
+

|
| 314 |
+
Figure 7: The joint distribution of memorization and simplicity. The histograms are plotted in log scale to better visualize the tail of the distributions.
|
| 315 |
+
|
| 316 |
+

|
| 317 |
+
|
| 318 |
+

|
| 319 |
+
Figure 8: Spearman’s R between memorization rankings from a set of $m$ models and our full set of 400 models. As more models are trained, the ranking changes very little, with the ranking at 192 models having a Spearman’s R of at least 0.992 on all datasets.
|
| 320 |
+
Figure 9: The variance in memorization scores decreases significantly as the number of models increases for all 3 datasets.
|
| 321 |
+
|
| 322 |
+
Measurements of the edit distances show that they are near the boundary of the deduplication threshold chosen in Lee et al. [2021]. On the other hand, the tail of the distribution — examples with high counterfactual memorization are mostly unaffected by text deduplication.
|
| 323 |
+
|
| 324 |
+
# D Variance of Memorization Scores
|
| 325 |
+
|
| 326 |
+
In Figure 8, we measure the Spearman’s R between our total set of 400 models and an $m$ model subset. As expected, as $m$ increases, so does Spearman’s R—in particular, at 192 models, the Spearman’s R is at least $9 9 . 2 \%$ for all datasets, and increasing $m$ already appears to have diminishing returns.
|
| 327 |
+
|
| 328 |
+
Using the same partitioning into size $m$ sets of models, we analyze the variance of memorization scores assigned to each sample. To do this, within each partition, we compute the memorization score assigned to each sample. We then compute the standard deviation of all partitions’ memorization scores for each sample. In Figure 9, we plot each sample’s standard deviation — in all, this demonstrates the distribution of the variance of memorization scores. We find that the variance decreases substantially as $m$ grows, and concentrates near 0 already with $m = 1 9 2$ , for all datasets.
|
| 329 |
+
|
| 330 |
+
# E Histogram of Max-Influence on Generated Texts
|
| 331 |
+
|
| 332 |
+
Figure 10 shows the histogram of max-influence on each generated example by Grover-Mega $\scriptstyle \left( \mathrm { p } = 0 . 9 6 \right)$ [Zellers et al., 2019], from the RealNews training examples. Those generated examples are publicly released at https://github.com/rowanz/grover/tree/master/generation_examples.
|
| 333 |
+
|
| 334 |
+
# F Miscellaneous Experiment Details
|
| 335 |
+
|
| 336 |
+
Our experiments are implemented using JAX [Bradbury et al., 2018] and Flax [Heek et al., 2020], both open sourced library under the Apache-2.0 license. In the study of influence on generated texts, we use the publicly released generations from the Grover models [Zellers et al., 2019], available at their open source code repository, under the Apache-2.0 license.
|
| 337 |
+
|
| 338 |
+
We run the experiments using our internal cluster. The majority of the compute is consumed by model training. In this paper, we use standard training setup for transformer based neural language models, which could run on single node machines with one or multiple GPUs. However, to carry out the full analysis, we need to train 400 different models for each of the three datasets analyzed in this paper.
|
| 339 |
+
|
| 340 |
+

|
| 341 |
+
Figure 10: Histogram of max-influence on each generated example by Grover-Mega $\scriptstyle ( \mathtt { p } = 0 . 9 6$ ), from the RealNews training examples.
|
| 342 |
+
|
| 343 |
+

|
| 344 |
+
Figure 11: Comparison of hash based subset sampling with numpy.random.choice.
|
| 345 |
+
|
| 346 |
+
# G Subsampling Procedure
|
| 347 |
+
|
| 348 |
+
In the estimation of memorization and influence, we trained 400 models each on an independent random subset of training examples. We use Tensorflow Datasets (TFDS) 2 to load our training data. TFDS supports loading a continuous range of examples, but does not support subset loading from a list of indices of individual examples. The API has a filter function which allows us to provide a Tensorflow predicate to precisely control the subset loading. However, a naive implementation of checking whether the index of the current example is in a given list of subset indices is very slow and scales poorly with the subset size.
|
| 349 |
+
|
| 350 |
+
To mitigate the issue, we implemented a hash based subset sampling predicate that can be evaluated efficiently for each example, and (approximately) select a random subset of a specified size. Let $N$ be the total number of training examples, $n < N$ be the expected subset size. The idea is to map the index $i$ of each example to $N / n$ hash buckets, and select all the examples that fall into one particular bucket. To make sure each model gets an independent subset sampling, we need to use different hash functions for different models. In our implementation, we compose a known hash function for uint64 types with a simple pseudo number based on the index of the current model to achieve this. Note the subset size sampled is close to $n$ but is not guaranteed to be exactly $n$ . But this is not a problem in our settings. The specific implementation is shown below:
|
| 351 |
+
|
| 352 |
+
def hash_sampler(mod, seed, system): """Get hash based subset sampler.
|
| 353 |
+
|
| 354 |
+
Args: mod: total_n_egs // subset_size seed: different seed leads to different subset sample
|
| 355 |
+
|
| 356 |
+
system: 'np' or 'tf'.
|
| 357 |
+
|
| 358 |
+
Returns:
|
| 359 |
+
|
| 360 |
+
A Tensorflow or Numpy subset sampler. np_hash $=$ hash_uint64_builder('np') mul, offset, remainder $=$ np_hash(seed $^ +$ 1234 + np.arange(3)) remainder $=$ remainder % mod
|
| 361 |
+
|
| 362 |
+
if system $\ d = \ d \cdot \mathsf { n p } ^ { \prime }$ : def np_sampler(n_total): $\mathrm { ~ \bf ~ { ~ x ~ } ~ } =$ np.arange(n_total, dtype=np.uint64) return np_hash(x\*mul $^ +$ offset) $\%$ mod $= =$ remainder return np_sampler
|
| 363 |
+
elif system $= =$ 'tf': tf_hash $=$ hash_uint64_builder('tf') def tf_filter(idx, _): return tf.equal(tf_hash(idx\*mul $^ +$ offset) % mod, remainder) return tf_filter
|
| 364 |
+
raise KeyError(f'Unknown system: {system}')
|
| 365 |
+
|
| 366 |
+
def hash_uint64_builder(system): """Build a hash function in tf/np for uint64.""" if system $\ d = \ d \cdot \mathsf { n p } ^ { \prime }$ : uint64_cast $=$ functools.partial(np.array, dtype=np.uint64) op_xor $=$ operator.xor op_rshift $=$ operator.rshift elif system $= =$ 'tf': uint64_cast $=$ functools.partial(tf.cast, dtype=tf.uint64) op_xor $=$ tf.bitwise.bitwise_xor op_rshift $=$ tf.bitwise.right_shift else: raise KeyError(f'Unknown system: {system}')
|
| 367 |
+
|
| 368 |
+
# https://stackoverflow.com/questions/664014/
|
| 369 |
+
# what-integer-hash-function-are-good-that-accepts-an-integer-hash-key
|
| 370 |
+
def hash_uint64(x): $\times \ =$ uint64_cast(x) $\times \ =$ op_xor(x, op_rshift(x, 30)) $\star$ uint64_cast(0xbf58476d1ce4e5b9) $\times \ =$ op_xor(x, op_rshift(x, 27)) $\star$ uint64_cast(0x94d049bb133111eb) x = op_xor(x, op_rshift(x, 31)) return x
|
| 371 |
+
|
| 372 |
+
return hash_uint64
|
| 373 |
+
|
| 374 |
+
In Figure 11, we compare our hash-based subset sampler with numpy.random.choice(N, size=n, replace $=$ False). The leftmost section of the figure shows that the sampling procedure always samples close to $n$ points, with a small variance. The middle section plots a histogram of the empirical fraction of total models that each point appears in. Note that, because we use $r = 0 . 2 5$ , this fraction should be 0.25 on average, although, because we only use 400 models, each value will not be identically 0.25. We find that our hash-based sampler produces probabilities which are highly consistent with those produced by numpy.random.choice. We also measure the pairwise independence of the hash-based sampler, measuring the probability that two different training points $x _ { 1 } , x _ { 2 }$ appear both IN or OUT of a model’s training set. We expect this value to be 0.625 $( = r ^ { 2 } + ( 1 - r ) ^ { 2 } )$ . We plot this in the right portion of the figure, demonstrating that the independence of our hash-based sampler is very similar to numpy.random.choice.
|
| 375 |
+
|
| 376 |
+

|
| 377 |
+
Figure 12: Comparison of directly using the per-token-accuracy vs. taking the logit of the per-tokenaccuracy. Top row: logit(per-token-accuracy). Bottom row: per-token-accuracy. Figures exactly the same as Figure 5.
|
| 378 |
+
|
| 379 |
+
# H Alternative Memorization Metrics with Logit Scaling
|
| 380 |
+
|
| 381 |
+
We defined the counterfactual memorization in (1) with a generic performance measure $M$ . Throughout the paper, we define $M$ as per-token accuracy–the fraction of the times the model assigns the highest score to the true next token in the sequence. The finite value range could cause unnecessary compression for values near the interval boundary. As a result, the resolution of memorization estimation is lower for models with very high or very low performance. To mitigate this issue, we explore an alternative measure by taking the logit on the per-token accuracy [Carlini et al., 2021]. The logit function maps to $( - \infty , \infty )$ before aggregating across independently trained models. Figure 12 compares the scatter plots of average performance on IN / OUT models measured by the logit scaled per-token accuracy and the raw per-token accuracy. Comparing to the raw per-token accuracy, the scatter plots generated with the logit scaled measure are no longer artificially constrained to be a triangular shape. As a result, the memorization estimation, which is proportional to the distance to the diagonal line, has a higher resolution on the two ends (lower left and upper right) than the unscaled version.
|
| 382 |
+
|
| 383 |
+
Note there is no absolutely right or wrong measure. While the scaled version has better resolution on the two ends, the advantage of the unscaled version is that the value range [0, 1] makes it straightforward to interpret the numerical values of counterfactual memorization. Since the consistency between the two versions are high (Spearman’s $\rho$ correlation between the two versions are $0 . 9 4 7 \mathrm { ~ / ~ } 0 . 9 0 3 \mathrm { ~ / ~ }$ 0.944 on RealNews/ C4/ Wiki40B:en), we use the unscaled version throughout the paper for easier interpretation.
|
| 384 |
+
|
| 385 |
+
# I Definition of Edit Similarity
|
| 386 |
+
|
| 387 |
+
We define the edit similarity between two sequences $x _ { i }$ and $x _ { j }$ as. In our case, we use token-level similarity.
|
| 388 |
+
|
| 389 |
+
$$
|
| 390 |
+
\mathrm { E d i t S i m } ( x _ { i } , x _ { j } ) = 1 - { \frac { \mathrm { E d i t D i s t a n c e } ( x _ { i } , x _ { j } ) } { \operatorname* { m a x } ( | x _ { i } | , | x _ { j } | ) } }
|
| 391 |
+
$$
|
| 392 |
+
|
| 393 |
+
Table 3: Pairs of RealNews training examples and Grover generations sampled at several influence levels. “link” contains the document URL. [...] indicate text omitted for brevity. Differences in each pair are highlighted.
|
| 394 |
+
|
| 395 |
+
<table><tr><td></td><td rowspan=1 colspan=15>Index Estim. Text</td></tr><tr><td></td><td rowspan=5 colspan=15>Generation infl linkBakubaAridlateofUdostbaatsa91361 0.1805 manats,espeielyrileloeatesofbjatstodrsccdgtoatafrCtalBankof AzerbaijanforAprilI5.0OJapaneseyen10JPY1.51871NewZealanddollar1NZD1.1513FollowTrendonTelegram.Onlymost interesting and important newsTrain mem linkBakbacdgateofUdgtAbjmawasseatd2072973 0.3534 manats,respeelyfarch5.loeatesofbjagstordecodgtoatafroCalBank of AzerbaijanforMarch15.[Japaneseyen1JY5221NewZealanddolla1NZD11636FollowTendonTelegram.Onlymost interesting and important news</td></tr><tr><td></td><td rowspan=1 colspan=2>1361</td></tr><tr><td></td><td rowspan=1 colspan=1></td></tr><tr><td></td><td rowspan=1 colspan=5>manats,respec</td><td rowspan=1 colspan=2>bectively</td></tr><tr><td></td><td rowspan=1 colspan=2>nkofA</td><td rowspan=1 colspan=4>Azerbaijanfor</td></tr><tr><td></td><td rowspan=3 colspan=15>Generation infl link > NEW DELHI: India is likely to see average monsoon rains this year.thestate-runvweather office said on Monday, which should support21998 0.0218 agriculturalpodctiodoocothisia’sdigooealffadcstioslis</td></tr><tr><td></td></tr><tr><td></td><td rowspan=1 colspan=1></td></tr><tr><td></td><td rowspan=6 colspan=14>expectedtob96petofteogteaverage,M.jeeanetaryatteistryofarthiencstoldcofereeIndiaMeterolicaepnt(sagalifallte96ped4tf89 centimeters for the entire four-month season beginning June. [..]However,onaveraeteIasforeastaccratelyolyoeeveriveyearsovertepasttdeades,venaftertingcctanerror band of plus or minus 5 percentage points.</td><td rowspan=1 colspan=1>retaryat theMinistry of E</td></tr><tr><td></td><td rowspan=2 colspan=1>allasbety</td></tr><tr><td></td><td rowspan=1 colspan=1>he Ministry of Earth Sci</td></tr><tr><td></td><td rowspan=1 colspan=1>ndia's</td></tr><tr><td></td><td rowspan=2 colspan=8>error band of plus or minus 5 percentage points.</td><td rowspan=1 colspan=2>Dhas</td><td rowspan=2 colspan=2>as forecast</td><td rowspan=2 colspan=1>east accurately only once every five y</td></tr><tr><td></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=5 colspan=3>Train326212</td><td rowspan=1 colspan=2>Train326212</td><td rowspan=1 colspan=3>mem0.1555</td><td rowspan=1 colspan=7>higherfarmand</td><td rowspan=1 colspan=1>rs)-In</td></tr><tr><td rowspan=4 colspan=2></td><td rowspan=1 colspan=3>thecountry</td><td rowspan=1 colspan=8>ry's$2trillioneconomy.areexpected</td><td rowspan=1 colspan=1>be97p</td></tr><tr><td rowspan=1 colspan=11>Meteorological Department (IMD), told a newsconference.“We see very less probability of a deficit monsoon," Ramesh said on Monday.Otherthanliftingfarmandiderconomicgrowth,aspellofgoodrainswillkeepalidonifation,potentillytmptingPrieisterNarendraoditiadgeeaetisueiy9.a’sathofsageoalfalle96</td><td rowspan=1 colspan=1>“We see very less probability of a deficit monsoon," Ramesh said on Monday.Otherthanliftingfarmandiderconomicgrowth,aspellofgoodrainswillkeepalidonifation,potentillytmptingPrieister</td></tr><tr><td rowspan=1 colspan=11>percentand104percentofyearaverageof89forthentiefour-mothseasonbegiingJne.saidaumbabaseddealerwit</td></tr><tr><td rowspan=1 colspan=11>a global trading firm. Average monsoon rainfallwill help India retain its position as the world's top rice exporter</td></tr></table>
|
| 396 |
+
|
| 397 |
+
# J Examples of Train-Generation Pairs at Different Influence Ranges
|
| 398 |
+
|
| 399 |
+
In table 3, we show examples of train-generation pairs sampled from different influence ranges. The patterns generally follow the train-validation pairs shown in table 2, although many of the relations are due to some form of templating.
|
| 400 |
+
|
| 401 |
+
# K Examples Sampled at Different Level of Memorization
|
| 402 |
+
|
| 403 |
+
Figure 13, Figure 14, and Figure 15 show full examples from RealNews sampled at high, middle and low memorization value ranges, respectively. Similarly, Figure 16, Figure 17, and Figure 18 show examples from C4 sampled at high, middle and low memorization value ranges, respectively. Figure 19, Figure 20, and Figure 21 show examples from Wiki40B:en sampled at high, middle and low memorization value ranges, respectively.
|
| 404 |
+
|
| 405 |
+
# L Example Pairs Sampled at Different Level of Influence
|
| 406 |
+
|
| 407 |
+
Figure 22, Figure 23, Figure 24, Figure 25, and Figure 26 show train-validation example pairs from RealNews sampled from high to low influence ranges. For each pair, we show the validation set example first, and then show the corresponding training example with a difflib generated visualization of textual difference with the training example.
|
| 408 |
+
|
| 409 |
+
Similarly, Figure 27 and Figure 28 show train-validation example pairs from C4, and Figure 29 and Figure 30 from Wiki40B:en.
|
| 410 |
+
|
| 411 |
+
We also show train-generation influence pairs between RealNews training set and Grover [Zellers et al., 2019] model generation in Figure 31, Figure 32, and Figure 33.
|
| 412 |
+
|
| 413 |
+

|
| 414 |
+
Figure 13: Text examples from RealNews with high memorization.
|
| 415 |
+
|
| 416 |
+

|
| 417 |
+
Figure 14: Text examples from RealNews with intermediate memorization.
|
| 418 |
+
|
| 419 |
+

|
| 420 |
+
Figure 15: Text examples from RealNews with low memorization.
|
| 421 |
+
|
| 422 |
+

|
| 423 |
+
Figure 16: Text examples from C4 with high memorization.
|
| 424 |
+
|
| 425 |
+

|
| 426 |
+
Figure 17: Text examples from C4 with intermediate memorization.
|
| 427 |
+
|
| 428 |
+

|
| 429 |
+
Figure 18: Text examples from C4 with low memorization.
|
| 430 |
+
|
| 431 |
+

|
| 432 |
+
Figure 19: Text examples from Wiki40B:en with high memorization.
|
| 433 |
+
|
| 434 |
+

|
| 435 |
+
Figure 20: Text examples from Wiki40B:en with intermediate memorization.
|
| 436 |
+
|
| 437 |
+

|
| 438 |
+
Figure 21: Text examples from Wiki40B:en with low memorization.
|
| 439 |
+
|
| 440 |
+

|
| 441 |
+
Figure 22: Validation / training example pair from RealNews with high influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
|
| 442 |
+
|
| 443 |
+

|
| 444 |
+
Figure 23: Validation / training example pair from RealNews with relatively high influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
|
| 445 |
+
|
| 446 |
+

|
| 447 |
+
Figure 24: Validation / training example pair from RealNews with intermediate influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
|
| 448 |
+
|
| 449 |
+

|
| 450 |
+
Figure 25: Validation / training example pair from RealNews with relatively low influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
|
| 451 |
+
|
| 452 |
+

|
| 453 |
+
Figure 26: Validation / training example pair from RealNews with low influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
|
| 454 |
+
|
| 455 |
+

|
| 456 |
+
Figure 27: Validation / training example pair from C4 with high to intermediate influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
|
| 457 |
+
|
| 458 |
+

|
| 459 |
+
Figure 28: Validation / training example pair from C4 with intermediate to low influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
|
| 460 |
+
|
| 461 |
+

|
| 462 |
+
Figure 29: Validation / training example pair from Wiki40B:en with high to intermediate influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
|
| 463 |
+
|
| 464 |
+

|
| 465 |
+
Figure 30: Validation / training example pair from Wiki40B:en with intermediate to low influence. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
|
| 466 |
+
|
| 467 |
+

|
| 468 |
+
Figure 31: Generated / training example pair from RealNews with high to intermediate influence. The generated examples are directly taken from publicly released generations of the Grover-Mega $\scriptstyle \left( \mathrm { p } = 0 . 9 6 \right)$ model [Zellers et al., 2019]. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
|
| 469 |
+
|
| 470 |
+

|
| 471 |
+
Figure 32: Generated / training example pair from RealNews with intermediate to low influence. The generated examples are directly taken from publicly released generations of the Grover-Mega $\scriptstyle \left( \mathrm { p } = 0 . 9 6 \right)$ model [Zellers et al., 2019]. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
|
| 472 |
+
|
| 473 |
+

|
| 474 |
+
Figure 33: Generated / training example pair from RealNews with low influence. The generated examples are directly taken from publicly released generations of the Grover-Mega $\scriptstyle ( \mathtt { p } = 0 . 9 6 )$ ) model [Zellers et al., 2019]. Red / green highlighted text indicate deleted / added text in the training example comparing to the corresponding validation example, generated using Python difflib.
|
md/dev/7gE9V9GBZaI/7gE9V9GBZaI.md
ADDED
|
@@ -0,0 +1,560 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EXPLORING MEMORIZATION IN ADVERSARIAL TRAINING
|
| 2 |
+
|
| 3 |
+
Yinpeng $\mathbf { D o n g ^ { 1 , 2 } }$ , Ke $\mathbf { X } \mathbf { u } ^ { 4 }$ , Xiao Yang1, Tianyu Pang1, Zhijie Deng1, Hang $\mathbf { S u } ^ { 1 , 3 }$ , J $\mathbf { u n } \mathbf { Z } \mathbf { h } \mathbf { u } ^ { 1 , 2 , 3 * }$ 1 Dept. of Comp. Sci. and Tech., Institute for AI, Tsinghua-Bosch Joint ML Center, THBI Lab 1 BNRist Center, Tsinghua University, Beijing, China; 2 RealAI; 3 Peng Cheng Laboratory; 4 CMU {dongyinpeng, suhangss, dcszj}@mail.tsinghua.edu.cn, kx1@andrew.cmu.edu
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Deep learning models have a propensity for fitting the entire training set even with random labels, which requires memorization of every training sample. In this paper, we explore the memorization effect in adversarial training (AT) for promoting a deeper understanding of model capacity, convergence, generalization, and especially robust overfitting of the adversarially trained models. We first demonstrate that deep networks have sufficient capacity to memorize adversarial examples of training data with completely random labels, but not all AT algorithms can converge under the extreme circumstance. Our study of AT with random labels motivates further analyses on the convergence and generalization of AT. We find that some AT approaches suffer from a gradient instability issue and most recently suggested complexity measures cannot explain robust generalization by considering models trained on random labels. Furthermore, we identify a significant drawback of memorization in AT that it could result in robust overfitting. We then propose a new mitigation algorithm motivated by detailed memorization analyses. Extensive experiments on various datasets validate the effectiveness of the proposed method.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Deep neural networks (DNNs) usually exhibit excellent generalization ability in pattern recognition tasks, despite their sufficient capacity to overfit or memorize the entire training set with completely random labels (Zhang et al., 2017). The memorization behavior in deep learning has aroused tremendous attention to identifying the differences between learning on true and random labels (Arpit et al., 2017; Neyshabur et al., 2017), and examining what and why DNNs memorize (Feldman, 2020; Feldman & Zhang, 2020; Maennel et al., 2020). This phenomenon has also motivated a growing body of works on model capacity (Arpit et al., 2017; Belkin et al., 2019), convergence (Allen-Zhu et al., 2019; Du et al., 2019; Zou et al., 2020), and generalization (Neyshabur et al., 2017; Bartlett et al., 2017), which consequently provide a better understanding of the DNN working mechanism.
|
| 12 |
+
|
| 13 |
+
In this paper, we explore the memorization behavior for a different learning algorithm—adversarial training (AT). Owing to the security threat of adversarial examples, i.e., maliciously generated inputs by adding imperceptible perturbations to cause misclassification (Szegedy et al., 2014; Goodfellow et al., 2015), various defense methods have been proposed to improve the adversarial robustness of DNNs (Kurakin et al., 2017; Madry et al., 2018; Liao et al., 2018; Wong & Kolter, 2018; Cohen et al., 2019; Zhang et al., 2019b; Pang et al., 2019; 2020; Dong et al., 2020a). AT is arguably the most effective defense technique (Athalye et al., 2018; Dong et al., 2020b), in which the network is trained on the adversarially augmented samples instead of the natural ones (Madry et al., 2018).
|
| 14 |
+
|
| 15 |
+
Despite the popularity, the memorization behavior in AT is less explored. Schmidt et al. (2018) show that a model is able to fully (over)fit the training set against an adversary, i.e., reaching almost $1 0 0 \%$ robust training accuracy, while the performance on test data is much inferior, witnessing a significant generalization gap. The overfitting phenomenon in AT is further investigated in Rice et al. (2020). However, it is not clear whether DNNs could memorize adversarial examples of training data with completely random labels. Answering this question could help to examine the effects of memorization in AT under the “extreme” circumstance and facilitate a deeper understanding of capacity, convergence, generalization, and robust overfitting of the adversarially trained models. In general, it is difficult for a classifier to memorize adversarial examples with random labels since the model entails a much more complicated decision boundary, as illustrated in Fig. 1. Even though the networks have sufficient capacity, AT may not necessarily converge. Therefore, we aim to comprehensively study this problem and explore how the analysis can motivate better algorithms.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: A conceptual illustration of decision boundaries learned via standard training and adversarial training with true and random labels, respectively. The model needs a significantly more complicated decision boundary to memorize adversarial examples of training data with random labels.
|
| 19 |
+
|
| 20 |
+
Our contributions. We first empirically investigate the memorization behavior in AT by performing PGD-AT (Madry et al., 2018) and TRADES (Zhang et al., 2019b) with random labels sampled uniformly over all classes. Different from standard training (ST) that can easily memorize random labels (Zhang et al., 2017), AT may fail to converge, with PGD-AT being a typical example. Nevertheless, TRADES can converge under this circumstance. It demonstrates that DNNs have sufficient capacity to memorize adversarial examples of training data with completely random labels. This phenomenon is commonly observed on multiple datasets, network architectures, and threat models.
|
| 21 |
+
|
| 22 |
+
The memorization analysis has further implications for understanding the convergence and generalization of AT. We conduct a convergence analysis on gradient magnitude and stability to explain the counter-intuitive different convergence properties of PGD-AT and TRADES with random labels since they behave similarly when trained on true labels (Rice et al., 2020). We corroborate that PGD-AT suffers from a gradient instability issue while the gradients of TRADES are relatively stable thanks to its adversarial loss. Moreover, by considering models trained on random labels, our generalization analysis indicates that several recently suggested complexity measures are inadequate to explain robust generalization, which is complementary to the findings in ST (Neyshabur et al., 2017). Accordingly, an appropriate explanation of robust generalization remains largely under-addressed.
|
| 23 |
+
|
| 24 |
+
Lastly, but most importantly, we identify a significant drawback of memorization in AT that it could result in robust overfitting (Rice et al., 2020). We argue that the cause of robust overfitting lies in the memorization of one-hot labels in the typical AT methods. The one-hot labels can be inappropriate or even noisy for some adversarial examples because some data naturally lies close to the decision boundary, and the corresponding adversarial examples should be assigned low predictive confidence (Stutz et al., 2020; Cheng et al., 2020). To solve this problem, we propose a new mitigation algorithm that impedes over-confident predictions by regularization for avoiding the excessive memorization of adversarial examples with possibly noisy labels. Experiments validate that our method can eliminate robust overfitting to a large extent across multiple datasets, network architectures, threat models, and AT methods, achieving better robustness under a variety of adversarial attacks than the baselines.
|
| 25 |
+
|
| 26 |
+
# 2 BACKGROUND
|
| 27 |
+
|
| 28 |
+
# 2.1 ADVERSARIAL TRAINING
|
| 29 |
+
|
| 30 |
+
Let $\mathbf { \mathcal { D } } = \{ ( \mathbf { x } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n }$ denote a training dataset with $n$ samples, where $\mathbf { x } _ { i } \in \mathbb { R } ^ { d }$ is a natural example and $y _ { i } \in \{ 1 , . . . , C \}$ is its true label often encoded as an one-hot vector ${ \mathbf { 1 } } _ { y _ { i } }$ with totally $C$ classes. Adversarial training (AT) can be formulated as a robust optimization problem (Madry et al., 2018):
|
| 31 |
+
|
| 32 |
+
$$
|
| 33 |
+
\operatorname* { m i n } _ { \pmb { \theta } } \sum _ { i = 1 } ^ { n } \operatorname* { m a x } _ { \mathbf { x } _ { i } ^ { \prime } \in S ( \mathbf { x } _ { i } ) } \mathcal { L } ( f _ { \pmb { \theta } } ( \mathbf { x } _ { i } ^ { \prime } ) , y _ { i } ) ,
|
| 34 |
+
$$
|
| 35 |
+
|
| 36 |
+
where $f _ { \theta }$ is a DNN classifier with parameters $\pmb \theta$ that predicts probabilities over all classes, $\mathcal { L }$ is the classification loss (i.e., the cross-entropy loss as $\mathcal { L } ( f _ { \theta } ^ { \mathsf { ^ { * } } } ( \mathbf { x } ) , y ) \overset { \bullet } { = } - \mathbf { 1 } _ { y } ^ { \top } \log f _ { \theta } ( \mathbf { x } ) )$ , and $\begin{array} { r } S ( \mathbf { x } ) = \{ \mathbf { x } ^ { \prime } : \ \end{array}$ $\| \mathbf { x } ^ { \prime } - \mathbf { x } \| _ { p } \leq \epsilon \}$ is an adversarial region centered at $\mathbf { x }$ with radius $\epsilon > 0$ under the $\ell _ { p }$ -norm threat models (e.g., $\ell _ { 2 }$ and $\ell _ { \infty }$ norms that we consider). The robust optimization problem (1) is solved by using adversarial attacks to approximate the inner maximization and updating the model parameters $\pmb \theta$ via gradient descent. A typical method uses projected gradient descent (PGD) (Madry et al., 2018) for the inner problem, which starts at a randomly initialized point in $S ( \mathbf { x } _ { i } )$ and iteratively updates the adversarial example under the $\ell _ { \infty }$ -norm threat model by
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\mathbf { x } _ { i } ^ { \prime } = \Pi _ { S ( \mathbf { x } _ { i } ) } \big ( \mathbf { x } _ { i } ^ { \prime } + \alpha \cdot \mathrm { s i g n } \big ( \nabla _ { \mathbf { x } } \mathcal { L } \big ( f _ { \theta } ( \mathbf { x } _ { i } ^ { \prime } ) , y _ { i } \big ) \big ) \big ) ,
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
where $\Pi ( \cdot )$ is the projection operator and $\alpha$ is the step size.
|
| 43 |
+
|
| 44 |
+
Besides PGD-AT, another typical AT method is TRADES (Zhang et al., 2019b), which balances the trade-off between robustness and natural accuracy by minimizing a different adversarial loss
|
| 45 |
+
|
| 46 |
+
$$
|
| 47 |
+
\operatorname* { m i n } _ { \pmb { \theta } } \sum _ { i = 1 } ^ { n } \left\{ \mathcal { L } ( f _ { \pmb { \theta } } ( \mathbf { x } _ { i } ) , y _ { i } ) + \beta \cdot \operatorname* { m a x } _ { \mathbf { x } _ { i } ^ { \prime } \in S ( \mathbf { x } _ { i } ) } \mathcal { D } ( f _ { \pmb { \theta } } ( \mathbf { x } _ { i } ) | | f _ { \pmb { \theta } } ( \mathbf { x } _ { i } ^ { \prime } ) ) \right\} ,
|
| 48 |
+
$$
|
| 49 |
+
|
| 50 |
+
where $\mathcal { L }$ is the clean cross-entropy loss on the natural example, $\mathcal { D }$ is the Kullback–Leibler divergence, and $\beta$ is a balancing parameter. The inner maximization of TRADES is also solved by PGD.
|
| 51 |
+
|
| 52 |
+
Recent progress of AT includes designing new adversarial losses (Mao et al., 2019; Qin et al., 2019; Pang et al., 2020; Wang et al., 2020; Dong et al., 2020a) and network architecture (Xie et al., 2019), training acceleration (Shafahi et al., 2019; Zhang et al., $2 0 1 9 \mathrm { a }$ ; Wong et al., 2020), and exploiting more training data (Hendrycks et al., 2019; Alayrac et al., 2019; Carmon et al., 2019; Zhai et al., 2019). Recent works highlight the training tricks in AT (Gowal et al., 2020; Pang et al., 2021).
|
| 53 |
+
|
| 54 |
+
# 2.2 RELATED WORK ON DNN MEMORIZATION
|
| 55 |
+
|
| 56 |
+
It has been observed that DNNs can easily memorize training data with random labels (Zhang et al., 2017), which requires “rethinking” of conventional techniques (e.g., VC dimension) to explain generalization. Arpit et al. (2017) identify qualitative differences between learning on true and random labels. Further works attempt to examine what and why DNNs memorize (Feldman, 2020; Feldman & Zhang, 2020; Maennel et al., 2020). Motivated by the memorization phenomenon in deep learning, convergence of training has been analyzed in the over-parameterized setting (Allen-Zhu et al., 2019; Du et al., 2019; Zou et al., 2020), while generalization has been studied with numerous theoretical and empirical complexity measures (Neyshabur et al., 2015; 2017; Bartlett et al., 2017; Novak et al., 2018; Arora et al., 2018; Cao & Gu, 2019; Jiang et al., 2020; Chen et al., 2020).
|
| 57 |
+
|
| 58 |
+
In contrast, the memorization behavior in AT has been less explored. The previous works demonstrate that DNNs can fit training data against an adversary (Madry et al., 2018; Schmidt et al., 2018; Rice et al., 2020), e.g., achieving nearly $1 0 0 \%$ robust training accuracy against a PGD adversary, but this behavior is not explored when trained on random labels. This paper is dedicated to investigating the memorization in AT under the extreme condition with random labels, while drawing connections to capacity, convergence, generalization, and robust overfitting, with the overarching goal of better understanding the AT working mechanism.
|
| 59 |
+
|
| 60 |
+
# 3 MEMORIZATION IN AT AND IMPLICATIONS
|
| 61 |
+
|
| 62 |
+
In this section, we first explore the memorization behavior in AT through an empirical study. Our analysis raises new questions about the convergence and generalization of AT, many of which cannot be answered by existing works. Thereafter, we provide further analytical studies on the convergence and generalization of AT by considering models trained on random labels particularly.
|
| 63 |
+
|
| 64 |
+
# 3.1 AT WITH RANDOM LABELS
|
| 65 |
+
|
| 66 |
+
We explore the memorization behavior of PGD-AT (Madry et al., 2018) and TRADES (Zhang et al., 2019b) as two studying cases. The experiments are conducted on CIFAR-10 (Krizhevsky & Hinton, 2009) with a Wide ResNet model (Zagoruyko & Komodakis, 2016) of depth 28 and widen factor 10 (WRN-28-10). Similar to Zhang et al. (2017), we train a network on the original dataset with true labels and on a copy of the dataset in which the true labels are corrupted by random ones. For training and robustness evaluation, a 10-step $\ell _ { \infty }$ PGD adversary with $\epsilon = 8 / 2 5 5$ and $\alpha = 2 / 2 5 5$ is adopted. For TRADES, the PGD adversary maximizes the KL divergence during training, while maximizes the cross-entropy loss for robustness evaluation, as common practice (Zhang et al., 2019b). We set $\beta = 6 . 0$ . In the sequel, we denote accuracy of a classifier against the 10-step PGD adversary as “robust accuracy”, and accuracy on natural examples as “natural accuracy”.
|
| 67 |
+
|
| 68 |
+

|
| 69 |
+
Figure 2: (a) and (b) show the natural and robust training accuracies of PGD-AT and TRADES, respectively, when trained on true or random labels. (c) shows the generalization gap under varying levels of label noise.
|
| 70 |
+
|
| 71 |
+
Fig. 2(a) and Fig. 2(b) show the learning curves of PGD-AT and TRADES without explicit regularizations. Both methods achieve almost $\bar { 1 } 0 0 \%$ natural and robust training accuracies when trained on true labels. When the labels are random, we observe the totally different behaviors between PGDAT and TRADES—PGD-AT fails to converge while TRADES still reaches nearly $1 0 0 \%$ training accuracies. This phenomenon is somewhat striking because PGD-AT and TRADES perform similarly on true labels (Rice et al., 2020). We find that the different memorization behaviors between PGD-AT and TRADES when trained on random labels can commonly be observed across a variety of datasets, model architectures, and threat models (shown in Appendix A.1), indicating that it is a general phenomenon of memorization in the two AT methods. Therefore, our finding is:
|
| 72 |
+
|
| 73 |
+
DNNs have sufficient capacity to memorize adversarial examples of training data with completely random labels, but the convergence depends on the AT algorithms.
|
| 74 |
+
|
| 75 |
+
Partially corrupted labels. We then inspect the behavior of AT under varying levels of label noise from $0 \%$ (true labels) to $1 0 0 \%$ (completely random labels). The generalization gap (i.e., difference between training and test accuracies) presented in Fig. 2(c) grows steadily as we increase the noise rate before the network fails to converge. The learning curves are provided in Appendix A.1.
|
| 76 |
+
|
| 77 |
+
Explicit regularizations. We study the role of common regularizers in AT memorization, including data augmentation, weight decay, and dropout (Srivastava et al., 2014). We train TRADES on true and random labels with several combinations of regularizers. We observe the explicit regularizers do not significantly affect the model’s ability to memorize adversarial examples, similar to the finding in ST (Zhang et al., 2017; Arpit et al., 2017). The detailed results are provided in Appendix A.1.
|
| 78 |
+
|
| 79 |
+
# 3.2 CONVERGENCE ANALYSIS OF AT WITH RANDOM LABELS
|
| 80 |
+
|
| 81 |
+
Since we have observed a counter-intuitive fact that PGD-AT and TRADES exhibit different convergence properties with random labels, it is necessary to perform a convergence analysis to understand this phenomenon. Note that our finding can hardly be explained by previous works (Gao et al., 2019; Wang et al., 2019; Zhang et al., 2020).
|
| 82 |
+
|
| 83 |
+
We first study the effects of different training settings on PGD-AT with random labels. We conduct experiments to analyze each training factor individually, including network architecture, attack steps, optimizer, and perturbation budget. We find that tuning the training settings cannot make PGD-AT converge with random labels (Appendix A.2 details the results). Based on the analysis, we think that the convergence issue of PGD-AT could be a result of the adversarial loss function in Eq. (1) rather than other training configurations. Specifically, TRADES in Eq. (3) minimizes a clean cross-entropy (CE) loss on natural examples, making DNNs memorize natural examples with random labels before fitting adversarial examples. As seen in Fig. 2(b), at the very early stage of TRADES training (the first 25 epochs), the natural accuracy starts to increase while the robust accuracy does not. However, PGD-AT in Eq. (1) directly minimizes the CE loss on adversarial samples with random labels, which can introduce unstable gradients with large variance, making it fail to converge. To corroborate the above argument, we analyze the gradient magnitude and stability below.
|
| 84 |
+
|
| 85 |
+
Gradient magnitude. First, we calculate the average gradient norm of the adversarial loss in Eq. (1) w.r.t. model parameters over each training sample for PGD-AT, and similarly calculate the average gradient norm of the clean CE loss (the first term) and the KL loss (the second term) in Eq. (3) w.r.t. parameters for TRADES to analyze their effects, respectively. We present the gradient norm along with training in Fig. 3(a). We can see that at the initial training epochs, the gradient norm of the KL loss in TRADES is much smaller than that of the CE loss, which indicates that the CE loss dominates TRADES training initially. With the training progressing, the KL loss has a larger gradient norm, making the network memorize adversarial examples. However, it is still unclear why PGD-AT does not rely on a similar learning tactic for convergence. To make a direct comparison with TRADES, we rewrite the adversarial loss of PGD-AT in Eq. (1) as
|
| 86 |
+
|
| 87 |
+

|
| 88 |
+
Figure 3: (a): Gradient norm of PGD-AT and TRADES Figure 4: (a): The $\ell _ { 2 }$ distance between the gradients along the training process. (b): The ratio of the gra- at $\pmb { \theta }$ and $\pmb \theta + \lambda \mathbf d$ of different losses, where $\pmb { \theta }$ are inidient norm of PGD-AT and TRADES during the first tialized, $\lambda \in [ - 0 . 0 5 , 0 . 0 5 ]$ . (b): The cosine similarity 1000 training iterations. between the gradients in each two successive epochs.
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
\operatorname* { m a x } _ { \mathbf { x } _ { i } ^ { \prime } \in S ( \mathbf { x } _ { i } ) } \mathcal { L } ( f _ { \theta } ( \mathbf { x } _ { i } ^ { \prime } ) , y _ { i } ) = \mathcal { L } ( f _ { \theta } ( \mathbf { x } _ { i } ) , y _ { i } ) + \mathcal { R } ( \mathbf { x } _ { i } , y _ { i } , \pmb { \theta } ) ,
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
where $\mathcal { R } ( \mathbf { x } _ { i } , y _ { i } , \pmb \theta )$ denotes the difference between the CE loss on adversarial example $\mathbf { x } _ { i } ^ { \prime }$ and that on natural example $\mathbf { x } _ { i }$ . Hence we can separately calculate the gradient norm of $\mathcal { L } ( f _ { \pmb { \theta } } ( \mathbf { x } _ { i } ) , y _ { i } )$ and $\mathcal { R } ( \mathbf { x } _ { i } , y _ { i } , \pmb \theta )$ w.r.t. parameters $\pmb \theta$ to find out the effect of $\mathcal { R } ( \mathbf { x } _ { i } , y _ { i } , \pmb \theta )$ on training. Specifically, we measure the relative gradient magnitude, i.e., in PGD-AT we calculate the ratio of the gradient norm $\begin{array} { r l } { { \frac { \| \nabla _ { \pmb { \theta } } \mathcal { R } ( \mathbf { x } _ { i } , y _ { i } , \pmb { \theta } ) \| _ { 2 } } { \| \nabla _ { \pmb { \theta } } \mathcal { L } ( f _ { \pmb { \theta } } ( \mathbf { x } _ { i } ) , y _ { i } ) \| _ { 2 } } } \quad } & { } \end{array}$ ; while in TRADES, we similarly calculate the ratio of the gradient norm of the KL loss to that of the CE loss. Fig. 3(b) illustrates the ratio of PGD-AT and TRADES during the first 1000 training iterations. The ratio of PGD-AT is consistently higher than that of TRADES, meaning that $\mathcal { R } ( \mathbf { x } _ { i } , y _ { i } , \pmb \theta )$ has a non-negligible impact on training.
|
| 95 |
+
|
| 96 |
+
Gradient stability. Then, we analyze the gradient stability to explain why PGD-AT cannot converge. We denote the adversarial loss of PGD-AT as $\begin{array} { r } { \mathcal { I } ( \mathbf { x } , y , \theta ) \stackrel { - } { = } \operatorname* { m a x } _ { \mathbf { x } ^ { \prime } \in S ( \mathbf { x } ) } \mathcal { L } ( f _ { \theta } ( \mathbf { x } ^ { \prime } ) , y ) } \end{array}$ with the subscript $i$ omitted for notation simplicity. We have a theorem on gradient stability.
|
| 97 |
+
|
| 98 |
+
Theorem 1. Suppose the gradient of the clean cross-entropy loss is locally Lipschitz continuous as
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\begin{array} { r } { \| \nabla _ { \theta } \mathcal { L } \big ( f _ { \theta } ( \mathbf { x } ^ { \prime } ) , y \big ) - \nabla _ { \theta } \mathcal { L } \big ( f _ { \theta } ( \mathbf { x } ) , y \big ) \| _ { 2 } \leq K \| \mathbf { x } ^ { \prime } - \mathbf { x } \| _ { p } , } \end{array}
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
any $\mathbf { x } \in \mathbb { R } ^ { d }$ , $\mathbf { x } ^ { \prime } \in S ( \mathbf { x } )$ , and any $\pmb \theta$ , where $K$ is the Lipschitz constant. Then we ha
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
\begin{array} { r } { \| \nabla _ { \theta } \mathcal { I } ( \mathbf { x } , y , \theta _ { 1 } ) - \nabla _ { \theta } \mathcal { I } ( \mathbf { x } , y , \theta _ { 2 } ) \| _ { 2 } \leq \| \nabla _ { \theta } \mathcal { L } ( f _ { \theta _ { 1 } } ( \mathbf { x } ) , y ) - \nabla _ { \theta } \mathcal { L } ( f _ { \theta _ { 2 } } ( \mathbf { x } ) , y ) \| _ { 2 } + 2 \epsilon K . } \end{array}
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
We provide the proof in Appendix B, where we show the upper bound in Eq. (5) is tight. Theorem 1 indicates that the gradient of the adversarial loss $\mathcal { I } ( \mathbf { x } , y , \pmb { \theta } )$ of PGD-AT will change more dramatically than that of the clean CE loss $\mathcal { L } ( f _ { \theta } ( \mathbf { x } ) , y )$ . When $\pmb { \theta } _ { 1 }$ and $\pmb { \theta } _ { 2 }$ are close, the difference between the gradients of $\mathcal { L }$ at $\pmb { \theta } _ { 1 }$ and $\pmb { \theta } _ { 2 }$ is close to 0 due to the semi-smoothness of over-parameterized DNNs (Allen-Zhu et al., 2019), but that of $\mathcal { I }$ is relatively large due to $2 \epsilon K$ in Eq. (5). To validate this, we visualize the change of gradient when moving the parameters $\pmb { \theta }$ along a random direction $\mathbf { d }$ with magnitude $\lambda$ . In particular, we set $\pmb \theta$ as initialization, $\mathbf { d }$ is sampled from a Gaussian distribution and normalized filter-wise (Li et al., 2018). For PGD-AT and TRADES, we craft adversarial examples on-the-fly for the model with $\pm \lambda \mathbf { d }$ and measure the change of gradient by the $\ell _ { 2 }$ distance to gradient at $\pmb { \theta }$ averaged over all data samples. The curves on gradient change of PGD-AT, TRADES, and the clean CE loss are shown in Fig. 4(a). In a small neighborhood of $\pmb { \theta }$ (i.e., small $\lambda$ ), the gradient of PGD-AT changes abruptly while the gradients of TRADES and the clean CE loss are more continuous. The gradient instability leads to a lower cosine similarity between the gradient directions w.r.t. the same data in each two successive training epochs of PGD-AT, as illustrated in Fig. 4(b). Therefore, the training of PGD-AT would be rather unstable that the gradient exhibits large variance, making it fail to converge.
|
| 111 |
+
|
| 112 |
+
Clean CE loss helps PGD-AT converge. To further verify our argument, we add the clean CE loss into the PGD-AT objective to resemble the learning of TRADES with random labels, as
|
| 113 |
+
|
| 114 |
+

|
| 115 |
+
Figure 5: AT by Eq. (6)
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
\operatorname* { m i n } _ { \pmb { \theta } } \sum _ { i = 1 } ^ { n } \left\{ ( 1 - \gamma ) \cdot \mathcal { L } ( f _ { \pmb { \theta } } ( \mathbf { x } _ { i } ) , y _ { i } ) + \gamma \cdot \operatorname* { m a x } _ { \mathbf { x } _ { i } ^ { \prime } \in S ( \mathbf { x } _ { i } ) } \mathcal { L } ( f _ { \pmb { \theta } } ( \mathbf { x } _ { i } ^ { \prime } ) , y _ { i } ) \right\} ,
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+

|
| 122 |
+
Figure 6: The results on four complexity measures of the adversarially trained models w.r.t. robust generaliza tion gap. The training settings of these models are provided in Appendix A.3.
|
| 123 |
+
|
| 124 |
+
where $\gamma$ is gradually increased from 0 to 1. By using Eq. (6), the gradient would be stabler at the initial stage and training on random labels can successfully converge, as shown Fig. 5.
|
| 125 |
+
|
| 126 |
+
In summary, our convergence analysis identifies the gradient instability issue of PGD-AT, provides new insights on the differences between PGD-AT and TRADES, and partially explain the failures of AT under other realistic settings beyond the scope of this section as detailed in Appendix A.2.
|
| 127 |
+
|
| 128 |
+
# 3.3 GENERALIZATION ANALYSIS OF AT WITH RANDOM LABELS
|
| 129 |
+
|
| 130 |
+
As our study demonstrates DNNs’ ability to memorize adversarial examples with random labels, we raise the question of whether DNNs rely on a similar memorization tactic on true labels and how to explain/ensure robust generalization. Although many efforts have been devoted to studying robust generalization of AT theoretically or empirically (Yin et al., 2018; Schmidt et al., 2018; Bubeck et al., 2019; Tu et al., 2019; Wu et al., 2020), they do not take the models trained on random labels into consideration. As it is easy to show that the explicit regularizations are not the adequate explanation of generalization in ST (Zhang et al., 2017; Arpit et al., 2017) and AT (see Appendix A.3), people resort to complexity measures of a model to explain generalization (i.e., a lower complexity should imply a smaller generalization gap). Here we show how the recently proposed complexity measures fail to explain robust generalization when comparing models trained on true and random labels.
|
| 131 |
+
|
| 132 |
+
We consider several norm-based and sharpness/flatness-based measures. We denote the parameters of a network by $\pmb \theta : = \{ W _ { i } \} _ { i = 1 } ^ { m }$ . The norm-based measures include spectral norm $\begin{array} { r } { \frac { 1 } { \gamma _ { \mathrm { m a r g i n } } } \prod _ { i = 1 } ^ { m } \| W _ { i } \| _ { 2 } } \end{array}$ and $\ell _ { 1 }$ norm $\begin{array} { r } { \frac { 1 } { \gamma _ { \mathrm { m a r g i n } } } \sum _ { i = 1 } ^ { m } \| W _ { i } \| _ { 1 } } \end{array}$ of model parameters, where $\gamma _ { \mathrm { m a r g i n } }$ is a margin on model output to make them scale-insensitive (Neyshabur et al., 2017). The spectral norm appears in the theoretical robust generalization bounds (Yin et al., 2018; Tu et al., 2019) and is related to the Lipschitz constant of neural networks (Cisse et al., 2017). The $\ell _ { 1 }$ norm is adopted to reduce the robust generalization gap (Yin et al., 2018). The sharpness/flatness-based measures include the curvature of input loss landscape (Moosavi-Dezfooli et al., 2019) as the dominant eigenvalue of the Hessian matrix, as well as the flatness of weight loss landscape (Wu et al., 2020) related to the change of adversarial loss when moving the weights along a random direction. Fig. 6 plots the four complexity measures w.r.t. robust generalization gap of several models trained with various combinations of regularizations on true or random labels. The results show that the first three measures can hardly ensure robust generalization, that lower complexity does not necessarily imply smaller robust generalization gap, e.g., the models trained on random labels can even lead to lower complexity than those trained on true labels. Among them, the flatness of weight loss landscape (Wu et al., 2020) is more reliable.
|
| 133 |
+
|
| 134 |
+
In summary, the generalization analysis indicates that the previous approaches, especially various complexity measures, cannot adequately explain and ensure the robust generalization performance in AT. Our finding of robust generalization in AT is complementary to that of standard generalization in ST (Zhang et al., 2017; Neyshabur et al., 2017; Jiang et al., 2020). Accordingly, robust generalization of adversarially trained models remains an open problem for future research.
|
| 135 |
+
|
| 136 |
+
# 4 ROBUST OVERFITTING ANALYSIS
|
| 137 |
+
|
| 138 |
+
Rice et al. (2020) have identified robust overfitting as a dominant phenomenon in AT, i.e., shortly after the first learning rate decay, further training will continue to decrease the robust test accuracy. They further show that several remedies for overfitting, including explicit $\ell _ { 1 }$ and $\ell _ { 2 }$ regularizations, data augmentation, etc., cannot gain improvements upon early stopping. Although robust overfitting has been thoroughly investigated, there still lacks an explanation of why it occurs. In this section, we draw a connection between memorization and robust overfitting in AT by showing that robust overfitting is caused by excessive memorization of one-hot labels in the typical AT methods. Motivated by the analysis, we then propose an effective strategy to eliminate robust overfitting.
|
| 139 |
+
|
| 140 |
+

|
| 141 |
+
Figure 7: (a): The accuracy curves of PGD-AT with true labels to reproduce robust overfitting. (b): The robust test accuracy of PGD-AT under various perturbation budgets . (c): The adversarial loss of two independently trained networks by PGD-AT on 500 samples sorted by the loss of the first model.
|
| 142 |
+
|
| 143 |
+
# 4.1 EXPLAINING ROBUST OVERFITTING
|
| 144 |
+
|
| 145 |
+
The typical AT approaches (e.g., PGD-AT, TRADES) commonly adopt one-hot labels as the targets for training, as introduced in Sec. 2.1. The one-hot labels could be inappropriate for some adversarial examples because it is difficult for a network to assign high-confident one-hot labels for all perturbed samples within the perturbation budget $\epsilon$ (Stutz et al., 2020; Cheng et al., 2020). Intuitively, some examples may naturally lie close to the decision boundary and should be assigned lower predictive confidence for the worst-case adversarial examples. It indicates that one-hot labels of some training data may be noisy in $\mathsf { A T } ^ { 1 }$ . After a certain training epoch, the model memorizes these “hard” training examples with possibly noisy labels, leading to the reduction of test robustness, as shown in Fig. 7(a). Thus, we hypothesize the cause of robust overfitting lies in the memorization of one-hot labels.
|
| 146 |
+
|
| 147 |
+
Our hypothesis is well supported by two pieces of evidence. First, we find that when the perturbation budget $\epsilon$ is small, robust overfitting does not occur, as shown in Fig. 7(b). This observation implies that the one-hot labels are more appropriate as the targets for adversarial examples within a smaller neighborhood while become noisier under a larger perturbation budget and lead to overfitting. Second, we validate that the “hard” training examples with higher adversarial loss values are consistent across different models. We first train two independent networks (using the same architecture and different random seeds) by PGD-AT and calculate the adversarial loss for each training sample. We show the adversarial losses on 500 samples sorted by the loss of the first model in Fig. 7(c). It can be seen that the samples with lower adversarial losses of the first model also have relatively lower losses of the second one and vice versa. We further quantitatively measure the consistency of the adversarial losses of all training samples between the two models using the Kendall’s rank coefficient (Kendall, 1938), which is 0.85 in this case. A similar result can be observed for two different model architectures (see Appendix C.1). The results verify that the “hard” training examples with possibly noisy labels are intrinsic of a dataset, supporting our hypothesis on why robust overfitting occurs.
|
| 148 |
+
|
| 149 |
+
# 4.2 MITIGATING ROBUST OVERFITTING
|
| 150 |
+
|
| 151 |
+
Based on the above analysis, we resort to the methods that are less prone to overfit noisy labels for mitigating robust overfitting in AT. Although learning with noisy labels has been broadly studied in ST (Natarajan et al., 2013; Patrini et al., 2017; Jiang et al., 2018; Han et al., 2018; Zhang & Sabuncu, 2018), we find that most of these approaches are not suitable for AT. For example, a typical line of methods filter out noisy samples and train the models on the identified clean samples (Jiang et al., 2018; Han et al., 2018; Ren et al., 2018). However, they will neglect a portion of training data with noisy labels, which can lead to inferior results for AT due to the reduction of training data (Schmidt et al., 2018). Table 2 shows the results to validate this.
|
| 152 |
+
|
| 153 |
+
To address this problem, we propose to regularize the predictions of adversarial examples from being over-confident by integrating the temporal ensembling (TE) approach (Laine & Aila, 2017) into the AT frameworks. TE maintains an ensemble prediction of each data and penalizes the difference between the current prediction and the ensemble prediction, which is effective for semi-supervised learning and learning with noisy labels (Laine & Aila, 2017). We think that TE is suitable for AT since it enables to leverage all training samples and hinders the network from excessive memorization of one-hot labels with a regularization term. Specifically, we denote the ensemble prediction of a training sample $\mathbf { x } _ { i }$ as $\mathbf { p } _ { i }$ , which is updated in each training epoch as $\mathbf { p } _ { i } \eta \cdot \mathbf { p } _ { i } + ( 1 - \eta ) \cdot f _ { \pmb { \theta } } ( \mathbf { x } _ { i } )$ , where $\eta$ is the momentum term. The training objective of PGD-AT with TE can be expressed as
|
| 154 |
+
|
| 155 |
+
Table 1: Test accuracy $( \% )$ of several methods on CIFAR-10, CIFAR-100, and SVHN under the $\ell _ { \infty }$ norm with $\epsilon = 8 / 2 5 5$ based on the ResNet-18 architecture. We choose the best checkpoint according to the highest robust accuracy on the test set under PGD-10.
|
| 156 |
+
|
| 157 |
+
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Natural AccuracyBest Final Diff</td><td rowspan=1 colspan=1>PGD-10Best Final Diff</td><td rowspan=1 colspan=1>PGD-1000Best Final Diff</td><td rowspan=1 colspan=1>C&W-1000Best Final Diff</td><td rowspan=1 colspan=1>AutoAttackBest Final Diff</td></tr><tr><td rowspan=1 colspan=1>PGD-ATPGD-AT+TE</td><td rowspan=1 colspan=1>83.75 84.82 -1.0782.35 82.79 -0.44</td><td rowspan=1 colspan=1>[52.64 44.92 7.7255.79 54.83 0.96</td><td rowspan=1 colspan=1>[51.22 42.74 8.4854.65 53.30 1.35</td><td rowspan=1 colspan=1>|50.11 43.63 7.4852.30 51.73 0.57</td><td rowspan=1 colspan=1>|47.74 41.84 5.9050.59 49.62 0.97</td></tr><tr><td rowspan=1 colspan=1>TRADESTRADES+TE</td><td rowspan=1 colspan=1>[81.19 82.48 -1.29|83.86 83.97 -0.11</td><td rowspan=1 colspan=1>[53.32 50.25 3.0755.15 54.42 0.73</td><td rowspan=1 colspan=1>[52.44 48.67 3.7753.74 53.03 0.71</td><td rowspan=1 colspan=1>|49.88 48.14 1.74|50.77 50.63 0.14</td><td rowspan=1 colspan=1>49.03 46.80 2.2349.77 49.20 0.57</td></tr><tr><td rowspan=1 colspan=6>(a) The evaluation results on CIFAR-10.</td></tr><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Natural AccuracyBest FinalDiff</td><td rowspan=1 colspan=1>PGD-10Best Final Diff</td><td rowspan=1 colspan=1>PGD-1000Best Final Diff</td><td rowspan=1 colspan=1>C&W-1000Best Final Diff</td><td rowspan=1 colspan=1>AutoAttackBest Final Diff</td></tr><tr><td rowspan=1 colspan=1>PGD-ATPGD-AT+TE</td><td rowspan=1 colspan=1>57.54 57.510.0356.45 57.12 -0.67</td><td rowspan=1 colspan=1>29.40 21.75 7.6531.74 30.24 1.50</td><td rowspan=1 colspan=1>28.54 20.63 7.9131.27 29.80 1.47</td><td rowspan=1 colspan=1>27.06 21.17 5.8928.27 27.36 0.91</td><td rowspan=1 colspan=1>24.72 19.34 5.3826.30 25.34 0.96</td></tr><tr><td rowspan=1 colspan=1>TRADESTRADES+TE</td><td rowspan=1 colspan=1>57.98 56.321.6659.35 58.72 0.63</td><td rowspan=1 colspan=1>|29.93 27.70 2.23|31.09 30.12 0.97</td><td rowspan=1 colspan=1>29.51 26.93 2.58|230.54 29.45 1.09</td><td rowspan=1 colspan=1>[25.46 24.42 1.04|26.61 25.94 0.67</td><td rowspan=1 colspan=1>24.6123.40 1.2125.27 24.55 0.72</td></tr><tr><td rowspan=1 colspan=6>(b) The evaluation results on CIFAR-100.</td></tr><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Natural AccuracyBest Final Diff</td><td rowspan=1 colspan=1>PGD-10Best Final Diff</td><td rowspan=1 colspan=1>PGD-1000Best Final Diff</td><td rowspan=1 colspan=1>C&W-1000Best Final Diff</td><td rowspan=1 colspan=1>AutoAttackBest Final Diff</td></tr><tr><td rowspan=1 colspan=1>PGD-ATPGD-AT+TE</td><td rowspan=1 colspan=1>89.00 90.55 -1.5590.09 90.91 -0.82</td><td rowspan=1 colspan=1>[54.51 46.97 7.5459.74 59.05 0.69</td><td rowspan=1 colspan=1>[52.22 42.85 9.3757.7156.46 1.25</td><td rowspan=1 colspan=1>48.66 44.13 4.5354.5553.94 0.61</td><td rowspan=1 colspan=1>46.61 38.24 8.3751.44 50.61 0.83</td></tr><tr><td rowspan=1 colspan=1>TRADESTRADES+TE</td><td rowspan=1 colspan=1>90.88 91.30 -0.4289.01 88.52 0.49</td><td rowspan=1 colspan=1>[59.50 57.04 2.4659.81 58.49 1.32</td><td rowspan=1 colspan=1>[52.78 50.17 2.6158.24 56.66 1.58</td><td rowspan=1 colspan=1>[52.76 50.53 2.2354.00 53.24 0.76</td><td rowspan=1 colspan=1>40.36 38.88 1.4851.45 50.16 1.29</td></tr></table>
|
| 158 |
+
|
| 159 |
+
(c) The evaluation results on SVHN.
|
| 160 |
+
|
| 161 |
+
$$
|
| 162 |
+
\operatorname* { m i n } _ { \pmb { \theta } } \sum _ { i = 1 } ^ { n } \operatorname* { m a x } _ { \mathbf { x } _ { i } ^ { \prime } \in S ( \mathbf { x } _ { i } ) } \left\{ \mathcal { L } ( f _ { \pmb { \theta } } ( \mathbf { x } _ { i } ^ { \prime } ) , y _ { i } ) + w \cdot | | f _ { \pmb { \theta } } ( \mathbf { x } _ { i } ^ { \prime } ) - \hat { \mathbf { p } } _ { i } | | _ { 2 } ^ { 2 } \right\} ,
|
| 163 |
+
$$
|
| 164 |
+
|
| 165 |
+
where $\hat { { \bf p } } _ { i }$ is the normalization of $\mathbf { p } _ { i }$ as a probability vector and $w$ is a balancing weight. TE can be similarly integrated with TRADES with the same regularization term. The network would learn to fit relatively easy samples with one-hot labels in the initial training stage, as shown in Fig. 7(a). After the learning rate decays, the network can keep assigning low confidence for hard samples with the regularization term in Eq. (7) and avoid fitting one-hot labels. Therefore, the proposed algorithm enables to learn under label noise in AT and alleviates the robust overfitting problem.
|
| 166 |
+
|
| 167 |
+
# 5 EMPIRICAL EVALUATION ON MITIGATING ROBUST OVERFITTING
|
| 168 |
+
|
| 169 |
+
In this section, we provide the experimental results on CIFAR-10, CIFAR-100 (Krizhevsky & Hinton, 2009), and SVHN (Netzer et al., 2011) datasets to validate the effectiveness of our proposed method. Code is available at https://github.com/dongyp13/memorization-AT.
|
| 170 |
+
|
| 171 |
+
Training details. We adopt the common setting that the perturbation budget is $\epsilon = 8 / 2 5 5$ under the $\ell _ { \infty }$ norm in most experiments. We consider PGD-AT and TRADES as two typical AT baselines and integrate the proposed TE approach into them, respectively. We use the ResNet-18 (He et al., 2016) model as the classifier in most experiments. In training, we use the 10-step PGD adversary with $\alpha = 2 / 2 5 5$ . The models are trained via the SGD optimizer with momentum 0.9, weight decay 0.0005, and batch size 128. For CIFAR-10/100, we set the learning rate as 0.1 initially which is decayed by 0.1 at 100 and 150 epochs with totally 200 training epochs. For SVHN, the learning rate starts from 0.01 with a cosine annealing schedule for a total number of 80 training epochs. In our method, We set $\eta = 0 . 9$ and $w = 3 0$ along a Gaussian ramp-up curve (Laine & Aila, 2017).
|
| 172 |
+
|
| 173 |
+
Evaluation results. We adopt PGD-10, PGD-1000, C&W-1000 (Carlini & Wagner, 2017), and AutoAttack (Croce & Hein, 2020b) for evaluating adversarial robustness rigorously. AutoAttack is a strong attack to evaluate model robustness, which is composed of an ensemble of diverse attacks, including APGD-CE (Croce & Hein, 2020b), APGD-DLR (Croce & Hein, 2020b), FAB (Croce & Hein, 2020a), and Square attack (Andriushchenko et al., 2020). To show the performance of robust overfitting, we report the test accuracy on the best checkpoint that achieves the highest robust test accuracy under PGD-10 and the final checkpoint, as well as the difference between these two checkpoints. The results of PGD-AT, TRADES, and the combinations of them with our proposed approach (denoted as PGD- $\mathbf { A T + T E }$ and TRADES ${ \bf \nabla } + { \bf T } { \bf E }$ ) on the CIFAR-10, CIFAR-100, and SVHN datasets are shown in Table 1.
|
| 174 |
+
|
| 175 |
+
We can observe that the differences between best and final test accuracies of our method are reduced to around $1 \%$ , while the accuracy gaps of PGDAT and TRADES are much larger. It indicates that our method largely eliminates robust overfitting. Due to being less affected by robust overfitting, our method achieves higher robust accuracies than the baselines. We also show the learning curves of these methods in Fig. 8. We consistently demonstrate the effectiveness of our method on different network architectures (including WRN-34-10
|
| 176 |
+
|
| 177 |
+

|
| 178 |
+
Figure 8: The natural and robust test accuracy curves (under PGD10) of PGD-AT, TRADES, and their extensions by integrating the proposed TE approach. The models are trained on CIFAR-10 under the $\ell _ { \infty }$ norm with $\epsilon = 8 / 2 5 5$ based on the ResNet-18 architecture.
|
| 179 |
+
|
| 180 |
+
and VGG-16) and threat models (including $\ell _ { 2 }$ norm), which will be shown in Appendix C.2.
|
| 181 |
+
|
| 182 |
+
Discussion and comparison with related works. Our method is kind of similar to the label smoothing (LS) technique, which is studied in AT (Pang et al., 2021). Recent works have also introduced the smoothness in training labels and model weights (Chen et al., 2021; Huang et al., 2020), which can alleviate robust overfitting to some extent. The significant difference between our work and them is that we provide a reasonable explanation for robust overfitting—one-hot labels are noisy for AT, while previous methods did not give such an explanation and could be viewed as solutions to our identified problem. To empirically compare with these methods, we conduct experiments on CIFAR-10 with the ResNet-18 network. Under the PGD-AT framework, we compare with the baseline PGD-AT, PGD-AT+LS, self-adaptive training (SAT) (Huang et al., 2020), and knowledge distillation with stochastic weight averaging (KD-SWA) (Chen et al., 2021). We also adopt the $C o$ - teaching approach (Han et al., 2018) adapted to PGD-AT, which jointly trains two models using the filtered samples given by each other. The results under the adopted attacks are presented in Table 2. Although various techniques can alleviate robust overfitting, our method achieves better robustness than the others, validating its effectiveness. For Co-teaching, though robust overfitting is alleviated, the performance is worse than our proposed method due to the reduction of training data.
|
| 183 |
+
|
| 184 |
+
Table 2: Test accuracy $( \% )$ of the proposed method and other methods on CIFAR-10 under the $\ell _ { \infty }$ norm with $\epsilon = 8 / 2 5 5$ based on the ResNet-18 architecture.
|
| 185 |
+
|
| 186 |
+
<table><tr><td>Method</td><td>Natural Accuracy Best Final 1Diff</td><td>PGD-10 Best</td><td>Final Diff</td><td>PGD-1000 Best Final Diff</td><td></td><td>C&W-1000 Best</td><td>Final Diff</td><td>AutoAttack Best Final Diff</td></tr><tr><td>PGD-AT</td><td>83.75 84.82 -1.07</td><td>52.64 44.92</td><td>7.72</td><td>51.22</td><td>42.74 8.48</td><td></td><td>[50.11 43.63 7.48</td><td>47.74 41.84 5.90</td></tr><tr><td>PGD-AT+LS</td><td>82.68 85.16 -2.48</td><td>53.70 48.90 4.80</td><td></td><td>52.564 46.31</td><td>6.25</td><td></td><td>50.41 46.06 4.35</td><td>49.02 44.39 4.63</td></tr><tr><td>SAT</td><td>82.81 81.86 0.95</td><td>53.81 53.31</td><td>0.50</td><td>52.41 52.00</td><td>0.41</td><td>51.99 51.71</td><td></td><td>50.214</td></tr><tr><td>KD-SWA</td><td>84.84 85.26 -0.42</td><td>54.89</td><td></td><td></td><td></td><td></td><td>0.28</td><td>49.73 0.48</td></tr><tr><td>Co-teaching</td><td></td><td>53.80</td><td>1.09</td><td>53.31 52.45</td><td>0.86</td><td>51.48 50.91</td><td>0.57</td><td>50.42 49.83 0.59</td></tr><tr><td></td><td>81.94 82.22 -0.28</td><td>51.27 50.52</td><td>0.75</td><td>50.15 49.12</td><td>1.03</td><td></td><td>50.85 49.86 0.99</td><td>49.60 48.49 1.11</td></tr><tr><td>PGD-AT+TE</td><td>82.35 82.79 -0.44</td><td>55.79</td><td>54.83 0.96</td><td>54.65 53.30 1.35</td><td></td><td></td><td>52.30 51.73 0.57</td><td>50.59 49.62 0.97</td></tr></table>
|
| 187 |
+
|
| 188 |
+
# 6 CONCLUSION
|
| 189 |
+
|
| 190 |
+
In this paper, we demonstrate the capacity of DNNs to fit adversarial examples with random labels by exploring memorization in adversarial training, which also poses open questions on the convergence and generalization of adversarially trained models. We validate that some AT methods suffer from a gradient instability issue and robust generalization can hardly be explained by complexity measures. We further identify a significant drawback of memorization in AT related to the robust overfitting phenomenon—robust overfitting is caused by memorizing one-hot labels in adversarial training. We propose a new mitigation algorithm to address this issue, with the effectiveness validated extensively.
|
| 191 |
+
|
| 192 |
+
# ACKNOWLEDGEMENTS
|
| 193 |
+
|
| 194 |
+
This work was supported by the National Key Research and Development Program of China (2020AAA0106000, 2020AAA0104304, 2020AAA0106302), NSFC Projects (Nos. 61620106010, 62061136001, 61621136008, 62076147, U19B2034, U1811461, U19A2081), Beijing NSF Project (No. JQ19016), Beijing Academy of Artificial Intelligence (BAAI), Tsinghua-Alibaba Joint Research Program, Tsinghua Institute for Guo Qiang, Tsinghua-OPPO Joint Research Center for Future Terminal Technology.
|
| 195 |
+
|
| 196 |
+
# ETHICS STATEMENT
|
| 197 |
+
|
| 198 |
+
The existence of adversarial examples can pose severe security threats to machine learning and deep learning models when they are deployed to real-world applications. The vulnerability to adversarial examples could also lower the confidence of the public on machine learning techniques. Therefore, it is important to develop more robust models. As the most effective method for promoting model robustness, adversarial training (AT) has not been fully investigated. This paper aims to investigate the memorization effect of AT to facilitate a better understanding of its working mechanism. Some findings in this paper can be analyzed more deeply, including theoretical analysis of AT convergence, generalization, etc., which we leave to future work.
|
| 199 |
+
|
| 200 |
+
# REPRODUCIBILITY STATEMENT
|
| 201 |
+
|
| 202 |
+
Most of the experiments are easily reproducible. We provide the code for reproducing the results at https://github.com/dongyp13/memorization-AT.
|
| 203 |
+
|
| 204 |
+
# REFERENCES
|
| 205 |
+
|
| 206 |
+
Jean-Baptiste Alayrac, Jonathan Uesato, Po-Sen Huang, Alhussein Fawzi, Robert Stanforth, and Pushmeet Kohli. Are labels required for improving adversarial robustness? In Advances in Neural Information Processing Systems (NeurIPS), pp. 12214–12223, 2019.
|
| 207 |
+
|
| 208 |
+
Zeyuan Allen-Zhu, Yuanzhi Li, and Zhao Song. A convergence theory for deep learning via overparameterization. In International Conference on Machine Learning (ICML), pp. 242–252, 2019.
|
| 209 |
+
|
| 210 |
+
Maksym Andriushchenko, Francesco Croce, Nicolas Flammarion, and Matthias Hein. Square attack: a query-efficient black-box adversarial attack via random search. In European Conference on Computer Vision (ECCV), pp. 484–501, 2020.
|
| 211 |
+
|
| 212 |
+
Sanjeev Arora, Rong Ge, Behnam Neyshabur, and Yi Zhang. Stronger generalization bounds for deep nets via a compression approach. In International Conference on Machine Learning (ICML), pp. 254–263, 2018.
|
| 213 |
+
|
| 214 |
+
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 International Conference on Machine Learning (ICML), pp. 233–242, 2017.
|
| 215 |
+
|
| 216 |
+
Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. In International Conference on Machine Learning (ICML), pp. 274–283, 2018.
|
| 217 |
+
|
| 218 |
+
Peter L Bartlett, Dylan J Foster, and Matus J Telgarsky. Spectrally-normalized margin bounds for neural networks. In Advances in Neural Information Processing Systems (NIPS), pp. 6240–6249, 2017.
|
| 219 |
+
|
| 220 |
+
Mikhail Belkin, Daniel Hsu, Siyuan Ma, and Soumik Mandal. Reconciling modern machinelearning practice and the classical bias–variance trade-off. Proceedings of the National Academy of Sciences, 116(32):15849–15854, 2019.
|
| 221 |
+
|
| 222 |
+
Sébastien Bubeck, Yin Tat Lee, Eric Price, and Ilya Razenshteyn. Adversarial examples from computational constraints. In International Conference on Machine Learning (ICML), pp. 831–840, 2019.
|
| 223 |
+
|
| 224 |
+
Yuan Cao and Quanquan Gu. Generalization bounds of stochastic gradient descent for wide and deep neural networks. In Advances in Neural Information Processing Systems (NeurIPS), 2019.
|
| 225 |
+
|
| 226 |
+
Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In IEEE Symposium on Security and Privacy $( S P )$ , pp. 39–57, 2017.
|
| 227 |
+
|
| 228 |
+
Yair Carmon, Aditi Raghunathan, Ludwig Schmidt, Percy Liang, and John C Duchi. Unlabeled data improves adversarial robustness. In Advances in Neural Information Processing Systems (NeurIPS), pp. 11192–11203, 2019.
|
| 229 |
+
|
| 230 |
+
Tianlong Chen, Zhenyu Zhang, Sijia Liu, Shiyu Chang, and Zhangyang Wang. Robust overfitting may be mitigated by properly learned smoothening. In International Conference on Learning Representations (ICLR), 2021.
|
| 231 |
+
|
| 232 |
+
Zixiang Chen, Yuan Cao, Difan Zou, and Quanquan Gu. How much over-parameterization is sufficient to learn deep relu networks? In International Conference on Learning Representations (ICLR), 2020.
|
| 233 |
+
|
| 234 |
+
Minhao Cheng, Qi Lei, Pin-Yu Chen, Inderjit Dhillon, and Cho-Jui Hsieh. Cat: Customized adversarial training for improved robustness. arXiv preprint arXiv:2002.06789, 2020.
|
| 235 |
+
|
| 236 |
+
Moustapha Cisse, Piotr Bojanowski, Edouard Grave, Yann Dauphin, and Nicolas Usunier. Parseval networks: Improving robustness to adversarial examples. In International Conference on Machine Learning (ICML), pp. 854–863, 2017.
|
| 237 |
+
|
| 238 |
+
Jeremy M Cohen, Elan Rosenfeld, and J Zico Kolter. Certified adversarial robustness via randomized smoothing. In International Conference on Machine Learning (ICML), pp. 1310–1320, 2019.
|
| 239 |
+
|
| 240 |
+
Francesco Croce and Matthias Hein. Minimally distorted adversarial examples with a fast adaptive boundary attack. In International Conference on Machine Learning (ICML), pp. 2196–2205, 2020a.
|
| 241 |
+
|
| 242 |
+
Francesco Croce and Matthias Hein. Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks. In International Conference on Machine Learning (ICML), pp. 2206–2216, 2020b.
|
| 243 |
+
|
| 244 |
+
Yinpeng Dong, Zhijie Deng, Tianyu Pang, Jun Zhu, and Hang Su. Adversarial distributional training for robust deep learning. In Advances in Neural Information Processing Systems (NeurIPS), pp. 8270–8283, 2020a.
|
| 245 |
+
|
| 246 |
+
Yinpeng Dong, Qi-An Fu, Xiao Yang, Tianyu Pang, Hang Su, Zihao Xiao, and Jun Zhu. Benchmarking adversarial robustness on image classification. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 321–331, 2020b.
|
| 247 |
+
|
| 248 |
+
Simon Du, Jason Lee, Haochuan Li, Liwei Wang, and Xiyu Zhai. Gradient descent finds global minima of deep neural networks. In International Conference on Machine Learning (ICML), pp. 1675–1685, 2019.
|
| 249 |
+
|
| 250 |
+
Vitaly Feldman. Does learning require memorization? a short tale about a long tail. In Proceedings of the 52nd Annual ACM SIGACT Symposium on Theory of Computing, pp. 954–959, 2020.
|
| 251 |
+
|
| 252 |
+
Vitaly Feldman and Chiyuan Zhang. What neural networks memorize and why: Discovering the long tail via influence estimation. In Advances in Neural Information Processing Systems (NeurIPS), pp. 2881–2891, 2020.
|
| 253 |
+
|
| 254 |
+
Ruiqi Gao, Tianle Cai, Haochuan Li, Cho-Jui Hsieh, Liwei Wang, and Jason D Lee. Convergence of adversarial training in overparametrized neural networks. In Advances in Neural Information Processing Systems (NeurIPS), pp. 13029–13040, 2019.
|
| 255 |
+
|
| 256 |
+
Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations (ICLR), 2015.
|
| 257 |
+
|
| 258 |
+
Sven Gowal, Chongli Qin, Jonathan Uesato, Timothy Mann, and Pushmeet Kohli. Uncovering the limits of adversarial training against norm-bounded adversarial examples. arXiv preprint arXiv:2010.03593, 2020.
|
| 259 |
+
|
| 260 |
+
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 Advances in Neural Information Processing Systems (NeurIPS), pp. 8527–8537, 2018.
|
| 261 |
+
|
| 262 |
+
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 (CVPR), pp. 770–778, 2016.
|
| 263 |
+
|
| 264 |
+
Dan Hendrycks, Kimin Lee, and Mantas Mazeika. Using pre-training can improve model robustness and uncertainty. In International Conference on Machine Learning (ICML), pp. 2712–2721, 2019.
|
| 265 |
+
|
| 266 |
+
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 (CVPR), pp. 4700–4708, 2017.
|
| 267 |
+
|
| 268 |
+
Lang Huang, Chao Zhang, and Hongyang Zhang. Self-adaptive training: beyond empirical risk minimization. In Advances in Neural Information Processing Systems (NeurIPS), pp. 19365– 19376, 2020.
|
| 269 |
+
|
| 270 |
+
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 International Conference on Machine Learning (ICML), pp. 2304–2313, 2018.
|
| 271 |
+
|
| 272 |
+
Yiding Jiang, Behnam Neyshabur, Hossein Mobahi, Dilip Krishnan, and Samy Bengio. Fantastic generalization measures and where to find them. In International Conference on Learning Representations (ICLR), 2020.
|
| 273 |
+
|
| 274 |
+
Maurice G Kendall. A new measure of rank correlation. Biometrika, 30(1/2):81–93, 1938.
|
| 275 |
+
|
| 276 |
+
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015.
|
| 277 |
+
|
| 278 |
+
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
|
| 279 |
+
|
| 280 |
+
Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. In International Conference on Learning Representations (ICLR), 2017.
|
| 281 |
+
|
| 282 |
+
Samuli Laine and Timo Aila. Temporal ensembling for semi-supervised learning. In International Conference on Learning Representations (ICLR), 2017.
|
| 283 |
+
|
| 284 |
+
Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer, and Tom Goldstein. Visualizing the loss landscape of neural nets. In Advances in Neural Information Processing Systems (NeurIPS), pp. 6389–6399, 2018.
|
| 285 |
+
|
| 286 |
+
Fangzhou Liao, Ming Liang, Yinpeng Dong, Tianyu Pang, Xiaolin Hu, and Jun Zhu. Defense against adversarial attacks using high-level representation guided denoiser. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1778–1787, 2018.
|
| 287 |
+
|
| 288 |
+
Chen Liu, Mathieu Salzmann, Tao Lin, Ryota Tomioka, and Sabine Süsstrunk. On the loss landscape of adversarial training: Identifying challenges and how to overcome them. In Advances in Neural Information Processing Systems (NeurIPS), 2020a.
|
| 289 |
+
|
| 290 |
+
Shengchao Liu, Dimitris Papailiopoulos, and Dimitris Achlioptas. Bad global minima exist and sgd can reach them. In Advances in Neural Information Processing Systems (NeurIPS), 2020b.
|
| 291 |
+
|
| 292 |
+
Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations (ICLR), 2018.
|
| 293 |
+
|
| 294 |
+
Hartmut Maennel, Ibrahim Alabdulmohsin, Ilya Tolstikhin, Robert JN Baldock, Olivier Bousquet, Sylvain Gelly, and Daniel Keysers. What do neural networks learn when trained with random labels? In Advances in Neural Information Processing Systems (NeurIPS), pp. 19693–19704, 2020.
|
| 295 |
+
|
| 296 |
+
Chengzhi Mao, Ziyuan Zhong, Junfeng Yang, Carl Vondrick, and Baishakhi Ray. Metric learning for adversarial robustness. In Advances in Neural Information Processing Systems (NeurIPS), pp. 480–491, 2019.
|
| 297 |
+
|
| 298 |
+
Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Jonathan Uesato, and Pascal Frossard. Robustness via curvature regularization, and vice versa. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 9078–9086, 2019.
|
| 299 |
+
|
| 300 |
+
Nagarajan Natarajan, Inderjit S Dhillon, Pradeep K Ravikumar, and Ambuj Tewari. Learning with noisy labels. In Advances in Neural Information Processing Systems (NIPS), pp. 1196–1204, 2013.
|
| 301 |
+
|
| 302 |
+
Yurii E Nesterov. A method for solving the convex programming problem with convergence rate o $( 1 / \mathrm { k } ^ { \cdot } 2 )$ . In Dokl. akad. nauk Sssr, volume 269, pp. 543–547, 1983.
|
| 303 |
+
|
| 304 |
+
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.
|
| 305 |
+
|
| 306 |
+
Behnam Neyshabur, Ryota Tomioka, and Nathan Srebro. Norm-based capacity control in neural networks. In Conference on Learning Theory (COLT), pp. 1376–1401, 2015.
|
| 307 |
+
|
| 308 |
+
Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nati Srebro. Exploring generalization in deep learning. In Advances in Neural Information Processing Systems (NIPS), pp. 5947–5956, 2017.
|
| 309 |
+
|
| 310 |
+
Roman Novak, Yasaman Bahri, Daniel A. Abolafia, Jeffrey Pennington, and Jascha Sohl-Dickstein. Sensitivity and generalization in neural networks: an empirical study. In International Conference on Learning Representations (ICLR), 2018.
|
| 311 |
+
|
| 312 |
+
Tianyu Pang, Kun Xu, Chao Du, Ning Chen, and Jun Zhu. Improving adversarial robustness via promoting ensemble diversity. In International Conference on Machine Learning (ICML), pp. 4970–4979, 2019.
|
| 313 |
+
|
| 314 |
+
Tianyu Pang, Kun Xu, Yinpeng Dong, Chao Du, Ning Chen, and Jun Zhu. Rethinking softmax crossentropy loss for adversarial robustness. In International Conference on Learning Representations (ICLR), 2020.
|
| 315 |
+
|
| 316 |
+
Tianyu Pang, Xiao Yang, Yinpeng Dong, Hang Su, and Jun Zhu. Bag of tricks for adversarial training. In International Conference on Learning Representations (ICLR), 2021.
|
| 317 |
+
|
| 318 |
+
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 Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1944–1952, 2017.
|
| 319 |
+
|
| 320 |
+
Chongli Qin, James Martens, Sven Gowal, Dilip Krishnan, Krishnamurthy Dvijotham, Alhussein Fawzi, Soham De, Robert Stanforth, and Pushmeet Kohli. Adversarial robustness through local linearization. In Advances in Neural Information Processing Systems (NeurIPS), pp. 13847– 13856, 2019.
|
| 321 |
+
|
| 322 |
+
Mengye Ren, Wenyuan Zeng, Bin Yang, and Raquel Urtasun. Learning to reweight examples for robust deep learning. In International Conference on Machine Learning (ICML), pp. 4334–4343, 2018.
|
| 323 |
+
|
| 324 |
+
Leslie Rice, Eric Wong, and Zico Kolter. Overfitting in adversarially robust deep learning. In International Conference on Machine Learning (ICML), pp. 8093–8104, 2020.
|
| 325 |
+
|
| 326 |
+
Amartya Sanyal, Puneet K. Dokania, Varun Kanade, and Philip Torr. How benign is benign overfitting ? In International Conference on Learning Representations (ICLR), 2021.
|
| 327 |
+
|
| 328 |
+
Ludwig Schmidt, Shibani Santurkar, Dimitris Tsipras, Kunal Talwar, and Aleksander Madry. Adversarially robust generalization requires more data. In Advances in Neural Information Processing Systems (NeurIPS), pp. 5014–5026, 2018.
|
| 329 |
+
|
| 330 |
+
Ali Shafahi, Mahyar Najibi, Amin Ghiasi, Zheng Xu, John Dickerson, Christoph Studer, Larry S Davis, Gavin Taylor, and Tom Goldstein. Adversarial training for free! In Advances in Neural Information Processing Systems (NeurIPS), pp. 3358–3369, 2019.
|
| 331 |
+
|
| 332 |
+
Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The Journal of Machine Learning Research, 15(1):1929–1958, 2014.
|
| 333 |
+
|
| 334 |
+
David Stutz, Matthias Hein, and Bernt Schiele. Confidence-calibrated adversarial training: Generalizing to unseen attacks. In International Conference on Machine Learning (ICML), pp. 9155– 9166, 2020.
|
| 335 |
+
|
| 336 |
+
Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In International Conference on Learning Representations (ICLR), 2014.
|
| 337 |
+
|
| 338 |
+
Zhuozhuo Tu, Jingwei Zhang, and Dacheng Tao. Theoretical analysis of adversarial learning: A minimax approach. In Advances in Neural Information Processing Systems (NeurIPS), pp. 12280–12290, 2019.
|
| 339 |
+
|
| 340 |
+
Yisen Wang, Xingjun Ma, James Bailey, Jinfeng Yi, Bowen Zhou, and Quanquan Gu. On the convergence and robustness of adversarial training. In International Conference on Machine Learning (ICML), pp. 6586–6595, 2019.
|
| 341 |
+
|
| 342 |
+
Yisen Wang, Difan Zou, Jinfeng Yi, James Bailey, Xingjun Ma, and Quanquan Gu. Improving adversarial robustness requires revisiting misclassified examples. In International Conference on Learning Representations (ICLR), 2020.
|
| 343 |
+
|
| 344 |
+
Eric Wong and Zico Kolter. Provable defenses against adversarial examples via the convex outer adversarial polytope. In International Conference on Machine Learning (ICML), pp. 5286–5295, 2018.
|
| 345 |
+
|
| 346 |
+
Eric Wong, Leslie Rice, and J. Zico Kolter. Fast is better than free: Revisiting adversarial training. In International Conference on Learning Representations (ICLR), 2020.
|
| 347 |
+
|
| 348 |
+
Dongxian Wu, Shu-Tao Xia, and Yisen Wang. Adversarial weight perturbation helps robust generalization. In Advances in Neural Information Processing Systems (NeurIPS), pp. 2958–2969, 2020.
|
| 349 |
+
|
| 350 |
+
Cihang Xie and Alan Yuille. Intriguing properties of adversarial training. In International Conference on Learning Representations (ICLR), 2020.
|
| 351 |
+
|
| 352 |
+
Cihang Xie, Yuxin Wu, Laurens van der Maaten, Alan L Yuille, and Kaiming He. Feature denoising for improving adversarial robustness. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 501–509, 2019.
|
| 353 |
+
|
| 354 |
+
Dong Yin, Kannan Ramchandran, and Peter Bartlett. Rademacher complexity for adversarially robust generalization. In International Conference on Machine Learning (ICML), pp. 7085–7094, 2018.
|
| 355 |
+
|
| 356 |
+
Fisher Yu, Dequan Wang, Evan Shelhamer, and Trevor Darrell. Deep layer aggregation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2403– 2412, 2018.
|
| 357 |
+
|
| 358 |
+
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In Proceedings of the British Machine Vision Conference (BMVC), 2016.
|
| 359 |
+
|
| 360 |
+
Runtian Zhai, Tianle Cai, Di He, Chen Dan, Kun He, John Hopcroft, and Liwei Wang. Adversarially robust generalization just requires more unlabeled data. arXiv preprint arXiv:1906.00555, 2019.
|
| 361 |
+
|
| 362 |
+
Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In International Conference on Learning Representations (ICLR), 2017.
|
| 363 |
+
|
| 364 |
+
Dinghuai Zhang, Tianyuan Zhang, Yiping Lu, Zhanxing Zhu, and Bin Dong. You only propagate once: Painless adversarial training using maximal principle. In Advances in Neural Information Processing Systems (NeurIPS), pp. 227–238, 2019a.
|
| 365 |
+
|
| 366 |
+
Hongyang Zhang, Yaodong Yu, Jiantao Jiao, Eric P Xing, Laurent El Ghaoui, and Michael I Jordan. Theoretically principled trade-off between robustness and accuracy. In International Conference on Machine Learning (ICML), pp. 7472–7482, 2019b.
|
| 367 |
+
|
| 368 |
+
Yi Zhang, Orestis Plevrakis, Simon S Du, Xingguo Li, Zhao Song, and Sanjeev Arora. Overparameterized adversarial training: An analysis overcoming the curse of dimensionality. In Advances in Neural Information Processing Systems (NeurIPS), pp. 679–688, 2020.
|
| 369 |
+
|
| 370 |
+
Zhilu Zhang and Mert Sabuncu. Generalized cross entropy loss for training deep neural networks with noisy labels. In Advances in Neural Information Processing Systems (NeurIPS), pp. 8778– 8788, 2018.
|
| 371 |
+
|
| 372 |
+
Difan Zou, Yuan Cao, Dongruo Zhou, and Quanquan Gu. Gradient descent optimizes overparameterized deep relu networks. Machine Learning, 109(3):467–492, 2020.
|
| 373 |
+
|
| 374 |
+
# A ADDITIONAL EXPERIMENTS ON MEMORIZATION IN AT
|
| 375 |
+
|
| 376 |
+
In this section, we provide additional experiments on the memorization behavior in AT. All of the experiments are conducted on NVIDIA 2080 Ti GPUs. The source code of this paper is submitted as the supplementary material, and will be released after the review process.
|
| 377 |
+
|
| 378 |
+
# A.1 MEMORIZATION OF PGD-AT AND TRADES
|
| 379 |
+
|
| 380 |
+
# A.1.1 DIFFERENT TRAINING SETTINGS
|
| 381 |
+
|
| 382 |
+
We first demonstrate that the different memorization behaviors between PGD-AT and TRADES can be generally observed under various settings.
|
| 383 |
+
|
| 384 |
+

|
| 385 |
+
Figure A.1: The natural and robust training accuracies of PGD-AT and TRADES on CIFAR-100 when trained on true or random labels.
|
| 386 |
+
|
| 387 |
+

|
| 388 |
+
Figure A.2: The natural and robust training accuracies of PGD-AT and TRADES on SVHN when trained on true or random labels.
|
| 389 |
+
|
| 390 |
+
Datasets. Similar to Fig. 2, we show the accuracy curves of PGD-AT and TRADES when trained on true or random labels on CIFAR-100 (Krizhevsky & Hinton, 2009) in Fig. A.1 and on SVHN (Netzer et al., 2011) in Fig. A.2. We consistently observe that PGD-AT fails to converge with random labels, while TRADES can successfully converge, although it does not reach $1 0 0 \%$ accuracy on SVHN.
|
| 391 |
+
|
| 392 |
+
Model architectures. We then consider other network architectures, including the DenseNet-121 model (Huang et al., 2017) and the deep layer aggregation (DLA) model (Yu et al., 2018). The corresponding results are shown in Fig. A.3. The similar results can be observed, although it may take more training epochs to make TRADES converge with the smaller DenseNet-121 network.
|
| 393 |
+
|
| 394 |
+

|
| 395 |
+
Figure A.3: The natural and robust training accuracies of PGD-AT and TRADES on CIFAR-10 with different architectures when trained on random labels.
|
| 396 |
+
|
| 397 |
+

|
| 398 |
+
Figure A.4: The natural and robust training accuracies of PGD-AT and TRADES on CIFAR-10 under the $\ell _ { 2 }$ -norm threat model when trained on random labels.
|
| 399 |
+
|
| 400 |
+
Threat models. We further consider the $\ell _ { 2 }$ -norm threat model, in which we set $\epsilon = 1 . 0$ and $\alpha =$ 0.25 in the 10-step PGD adversary. The learning curves of PGD-AT and TRADES are shown in Fig. A.4, which also exhibit similar results.
|
| 401 |
+
|
| 402 |
+
Perturbation budget. We study the memorization behavior in AT with different perturbation budgets $\epsilon$ . In Fig. A.5, we show that when the perturbation budget is $\epsilon = 1 6 / 2 5 5$ $\ell _ { \infty }$ norm), TRADES trained on random labels can still converge. But when we set a larger budget (e.g., $\epsilon = 3 2 / 2 5 5 )$ , both PGD-AT and TRADES cannot obtain near $100 \%$ robust training accuracy. We also find under this condition, even AT trained on true labels cannot get $100 \%$ robust training accuracy, indicating that the gradient instability issue discussed in Sec. 3.2 results in the convergence problem.
|
| 403 |
+
|
| 404 |
+
In summary, our empirical observation that PGD-AT and TRADES perform differently when trained on random labels is general across multiple datasets, network architectures, and threat models.
|
| 405 |
+
|
| 406 |
+
# A.1.2 LEARNING CURVES UNDER DIFFERENT NOISE RATES
|
| 407 |
+
|
| 408 |
+
We show the learning curves of PGD-AT and TRADES under varying levels of label noise in Fig. A.6 and Fig. A.7, respectively. In this experiment, we adopt the weight decay and data augmentation for regularizations. We can see that the network achieves maximum accuracy on the test set before fitting the noisy training set. Thus the model learns easy and simple patterns first before fitting the noise, similar to the finding in ST (Arpit et al., 2017). It can also be observed that under $8 0 \%$ noise rate, PGD-AT fails to converge. Note that when the noise rate is $0 \%$ , the network is trained on true labels, but the robust test accuracy also decreases after a certain epoch. This phenomenon is called robust overfitting (Rice et al., 2020), which is studied in Sec. 4.
|
| 409 |
+
|
| 410 |
+

|
| 411 |
+
Figure A.5: The natural and robust training accuracies of PGD-AT and TRADES on CIFAR-10 with $\epsilon =$ 16/255 when trained on true or random labels.
|
| 412 |
+
|
| 413 |
+

|
| 414 |
+
Figure A.6: Accuracy curves of PGD-AT under different noise rates on CIFAR-10.
|
| 415 |
+
|
| 416 |
+

|
| 417 |
+
Figure A.7: Accuracy curves of TRADES under different noise rates on CIFAR-10.
|
| 418 |
+
|
| 419 |
+
# A.1.3 EXPLICIT REGULARIZATIONS
|
| 420 |
+
|
| 421 |
+
We consider three common regularizers, including data augmentation, weight decay, and dropout (Srivastava et al., 2014). We train the models based on TRADES on true and random labels with several combinations of explicit regularizers. As shown in Table A.1, the explicit regularizations do not significantly affect the model’s ability to memorize adversarial examples with random labels.
|
| 422 |
+
|
| 423 |
+
# A.2 MORE RESULTS ON THE CONVERGENCE OF AT
|
| 424 |
+
|
| 425 |
+
# A.2.1 TRAINING CONFIGURATIONS
|
| 426 |
+
|
| 427 |
+
We study different training configurations on PGD-AT with random labels. We consider various factors as follows. These experiments are conducted on CIFAR-10.
|
| 428 |
+
|
| 429 |
+
• Model capacity. Recent work suggests that model size is a critical factor to obtain better robustness (Madry et al., 2018; Xie & Yuille, 2020). A possible reason why PGD-AT fails to converge with random labels may also be the insufficient model capacity. Therefore, we try to use larger models, including WRN-34-20 (which is used in Rice et al. (2020)) and WRN-70-16 (which is used in Gowal et al. (2020)). However, using larger models under this setting cannot solve the convergence problem.
|
| 430 |
+
|
| 431 |
+
Table A.1: The training accuracy, test accuracy, and generalization gap $( \% )$ of TRADES when trained on true or random labels, with and without explicit regularizations, including data augmentation (random crop and flip), weight decay (0.0002), and dropout (0.2).
|
| 432 |
+
|
| 433 |
+
<table><tr><td>Labels</td><td>Data Augmentation</td><td>Weight Decay</td><td>Dropout</td><td>Training Accuracy Natural</td><td>Robust</td><td>Test Accuracy Natural I</td><td>Robust</td><td>Generalization Gap Natural</td><td>Robust</td></tr><tr><td>true</td><td></td><td>X</td><td>X</td><td>99.73</td><td>99.65</td><td>77.53</td><td>37.47</td><td>22.20</td><td>62.18</td></tr><tr><td>true</td><td>X</td><td></td><td>×</td><td>99.57</td><td>97.03</td><td>82.91</td><td>45.37</td><td>16.93</td><td>51.66</td></tr><tr><td>true</td><td>×</td><td>X</td><td>×</td><td>99.59</td><td>99.53</td><td>77.31</td><td>38.94</td><td>22.28</td><td>60.59</td></tr><tr><td>true</td><td>X</td><td>X</td><td>√</td><td>99.65</td><td>99.40</td><td>79.96</td><td>39.86</td><td>19.69</td><td>59.54</td></tr><tr><td>true</td><td>√</td><td>√</td><td>X</td><td>99.50</td><td>97.28</td><td>84.26</td><td>49.16</td><td>15.24</td><td>48.12</td></tr><tr><td>true</td><td>X</td><td>√</td><td>√</td><td>99.41</td><td>99.20</td><td>80.28</td><td>41.64</td><td>19.13</td><td>57.56</td></tr><tr><td>random</td><td></td><td>X</td><td>×</td><td>99.80</td><td>99.55</td><td>9.79</td><td>0.15</td><td>90.01</td><td>99.40</td></tr><tr><td>random</td><td>X</td><td>X</td><td>X</td><td>99.36</td><td>86.10</td><td>9.71</td><td>0.24</td><td>89.65</td><td>85.86</td></tr><tr><td>random</td><td>X</td><td>√</td><td>X</td><td>99.84</td><td>99.53</td><td>10.13</td><td>0.23</td><td>89.71</td><td>99.30</td></tr><tr><td>random</td><td>X</td><td>X</td><td>√</td><td>99.15</td><td>92.23</td><td>9.04</td><td>0.17</td><td>90.11</td><td>92.06</td></tr><tr><td>random</td><td>√</td><td></td><td>X</td><td>99.25</td><td>69.62</td><td>9.67</td><td>0.24</td><td>89.58</td><td>69.38</td></tr><tr><td>random</td><td>×</td><td>【</td><td>√</td><td>99.38</td><td>81.57</td><td>9.54</td><td>0.19</td><td>89.84</td><td>81.38</td></tr></table>
|
| 434 |
+
|
| 435 |
+
• Attack steps. We adopt the weaker FGSM adversary (Goodfellow et al., 2015) for training. We also adopt the random initialization trick as argued in Wong et al. (2020) and adjust the step size as $\alpha = 1 0 / 2 5 5$ , yielding the fast adversarial training method (Wong et al., 2020). However, fast AT still cannot converge.
|
| 436 |
+
|
| 437 |
+
• Optimizer. We try to use various optimizers, including the SGD momentum optimizer, the Adam optimizer (Kingma & Ba, 2015), and the nesterov optimizer (Nesterov, 1983); different learning rate schedules, including the piecewise decay and cosine schedules, and different learning rates (0.1 and 0.01), but none of these attempts make PGD-AT converge.
|
| 438 |
+
|
| 439 |
+
• Perturbation budget. The perturbation budget $\epsilon$ is an important factor to affect the convergence of PGD-AT. When $\epsilon$ approaches 0, PGD-AT would degenerate into standard training, which can easily converge (Zhang et al., 2017). Hence we try different values of $\epsilon$ , and find that PGD-AT can converge with a smaller $\epsilon$ (e.g., $\epsilon = 1 / 2 5 5 )$ but cannot converge when $\epsilon \geq 2 / 2 5 5$ .
|
| 440 |
+
|
| 441 |
+
# A.2.2 GRADIENT STABILITY UNDER COSINE SIMILARITY
|
| 442 |
+
|
| 443 |
+
In Fig. 4(a), we show the gradient change of PGD-AT, TRADES, and the clean CE loss under the $\ell _ { 2 }$ distance. We further show the cosine similarity between the gradients at $\pmb { \theta }$ and $\pm \lambda \mathbf { d }$ in Fig. A.8. The cosine similarity is also averaged over all data samples. The results based on cosine similarity are consistent with the results based on the $\ell _ { 2 }$ distance, showing that the gradient of PGD-AT changes more abruptly.
|
| 444 |
+
|
| 445 |
+
# A.2.3 THE FAILURES OF AT UNDER REALISTIC SETTINGS
|
| 446 |
+
|
| 447 |
+
We find that some AT methods (e.g., PGD-AT) suffer from a gradient instability issue, which results in the convergence problem when trained on random labels. Under other realistic setting, our analysis may also be valuable.
|
| 448 |
+
|
| 449 |
+
First, PGD-AT fails to converge under $80 \%$ noise rate. We think that the unstable gradients can overwhelm the useful gradients given by clean examples. To prove it, we train the models under $80 \%$ uniform label noise, by either PGD-AT or standard training (ST) on natural examples. We then select 100 training images with wrong labels and another 100 training images with true labels for evaluation. Similarly, we calculate the gradient norm of the cross-entropy loss w.r.t. model parameters of each method. We show the results in Fig. A.9. For AT, the gradient norm of clean examples is larger than that of noisy examples at beginning, which makes the model learn to classify. However, for PGD-AT, the gradient norm of clean examples is almost the same as that of noisy examples (the two curves overlap together). And the unstable gradients provided by noisy examples would overwhelm the useful gradients given by clean examples, making the network fail to converge.
|
| 450 |
+
|
| 451 |
+

|
| 452 |
+
Figure A.8: The cosine similarity between the gradients at $\pmb \theta$ and $\pmb \theta + \lambda \mathbf d$ of different losses, where $\pmb { \theta }$ are initialized, $\lambda \in [ - 0 . 0 5 , 0 . 0 5 ]$ .
|
| 453 |
+
|
| 454 |
+

|
| 455 |
+
Figure A.9: The gradient norm of PGD-AT and ST given clean examples or noisy examples, when trained on $80 \%$ uniform label noise.
|
| 456 |
+
|
| 457 |
+
Second, when the perturbation budget is large (e.g., $\epsilon = 6 4 / 2 5 5 )$ , PGD-AT cannot converge with true labels, while TRADES can achieve about $5 0 \%$ training accuracies. This can also be explained by our convergence analysis that the gradient is very unstable in PGD-AT with a larger perturbation budget, making it fail to converge.
|
| 458 |
+
|
| 459 |
+
# A.3 MORE DISCUSSIONS ON THE GENERALIZATION OF AT
|
| 460 |
+
|
| 461 |
+
As shown in Table A.1, when trained on true labels, although the regularizers can help to reduce the generalization gap, the model without any regularization can still generalize non-trivially. The three explicit regularizations do not significantly affect the model’s ability to memorize adversarial examples with random labels. In consequence, the explicit regularizers are not the adequate explanation of generalization. By inspecting the learning dynamics of AT under different noise rates in Fig. A.6 and Fig. A.7, the network achieves maximum accuracy on the test set before fitting the noisy training set, meaning that the model learns simple patterns (i.e., clean data) before memorizing the hard examples with wrong labels, similar to the observation in standard training (Arpit et al., 2017). The results suggest that optimization by itself serves as an implicit regularizer to find a model with good generalization performance.
|
| 462 |
+
|
| 463 |
+

|
| 464 |
+
Figure A.10: The natural and robust testing accuracies of TRADES on CIFAR-10 with different initialization strategies and training methods.
|
| 465 |
+
|
| 466 |
+
A recent work (Liu et al., 2020b) points out that in standard training, pre-training on random labels can lead to substantial performance degeneration of subsequent SGD training on true labels, while adding regularizations can overcome the bad initialization caused by pre-training with random labels. In this paper, we further investigate whether this finding can generalize to adversarial training.
|
| 467 |
+
|
| 468 |
+
As PGD-AT cannot converge with random labels, we adopt TRADES to conduct experiments. Following Liu et al. (2020b), we consider two initialization strategies — random initialization and adversarial initialization generated by training on random labeling of the training data. We also consider two training methods — vanilla SGD training and SOTA SGD training with data augmentation (random crops and flips), weight decay, and momentum. The results are shown in Fig. A.10. It can be seen that with vanilla SGD, the adversarial initialization can lead to worse performance than the random initialization. But with the regularization techniques, the models with different initializations converge to nearly the same test accuracy. The results are consistent with the findings in Liu et al. (2020b).
|
| 469 |
+
|
| 470 |
+
# B PROOF OF THEOREM 1
|
| 471 |
+
|
| 472 |
+
Proof. Recall that $\begin{array} { r } { \mathcal { I } ( \mathbf { x } , y , \pmb { \theta } ) = \operatorname* { m a x } _ { \mathbf { x } ^ { \prime } \in S ( \mathbf { x } ) } \mathcal { L } ( f _ { \pmb { \theta } } ( \mathbf { x } ^ { \prime } ) , y ) } \end{array}$ is the adversarial loss of PGD-AT. First, we have
|
| 473 |
+
|
| 474 |
+
$$
|
| 475 |
+
\begin{array} { r l } & { \quad \| \nabla _ { \theta } \mathcal { I } ( { \bf x } , y , \theta _ { 1 } ) - \nabla _ { \theta } \mathcal { I } ( { \bf x } , y , \theta _ { 2 } ) \| _ { 2 } } \\ & { = \| \nabla _ { \theta } \mathcal { I } ( { \bf x } , y , \theta _ { 1 } ) - \nabla _ { \theta } \mathcal { L } ( f _ { \theta _ { 1 } } ( { \bf x } ) , y ) - } \\ & { \quad \nabla _ { \theta } \mathcal { I } ( { \bf x } , y , \theta _ { 2 } ) + \nabla _ { \theta } \mathcal { L } ( f _ { \theta _ { 2 } } ( { \bf x } ) , y ) + } \\ & { \quad \nabla _ { \theta } \mathcal { L } ( f _ { \theta _ { 1 } } ( { \bf x } ) , y ) - \nabla _ { \theta } \mathcal { L } ( f _ { \theta _ { 2 } } ( { \bf x } ) , y ) \| _ { 2 } } \\ & { \le \| \nabla _ { \theta } \mathcal { I } ( { \bf x } , y , \theta _ { 1 } ) - \nabla _ { \theta } \mathcal { L } ( f _ { \theta _ { 1 } } ( { \bf x } ) , y ) \| _ { 2 } + } \\ & { \quad \| \nabla _ { \theta } \mathcal { I } ( { \bf x } , y , \theta _ { 2 } ) - \nabla _ { \theta } \mathcal { L } ( f _ { \theta _ { 2 } } ( { \bf x } ) , y ) \| _ { 2 } + } \\ & { \quad \| \nabla _ { \theta } \mathcal { L } ( f _ { \theta _ { 1 } } ( { \bf x } ) , y ) - \nabla _ { \theta } \mathcal { L } ( f _ { \theta _ { 2 } } ( { \bf x } ) , y ) \| _ { 2 } . } \end{array}
|
| 476 |
+
$$
|
| 477 |
+
|
| 478 |
+
From the assumption, for any $\mathbf { x } \in \mathbb { R } ^ { d }$ and $\mathbf { x } ^ { \prime } \in { \mathcal { S } } ( \mathbf { x } )$ , we have
|
| 479 |
+
|
| 480 |
+
$$
|
| 481 |
+
\| \nabla _ { \pmb { \theta } } \mathcal { L } \big ( f _ { \pmb { \theta } } ( \mathbf { x } ^ { \prime } ) , y \big ) - \nabla _ { \pmb { \theta } } \mathcal { L } \big ( f _ { \pmb { \theta } } ( \mathbf { x } ) , y \big ) \| _ { 2 } \leq K \| \mathbf { x } ^ { \prime } - \mathbf { x } \| _ { p } \leq \epsilon K ,
|
| 482 |
+
$$
|
| 483 |
+
|
| 484 |
+
due to the definition of $\boldsymbol { S } ( \mathbf { x } )$ . We also note that $\mathcal { I } ( \mathbf { x } , y , \pmb { \theta } )$ is the maximal cross-entropy loss $\mathcal { L }$ within $\boldsymbol { S } ( \mathbf { x } )$ , such that we have
|
| 485 |
+
|
| 486 |
+
$$
|
| 487 |
+
\begin{array} { r } { \| \nabla _ { \theta } \mathcal { I } ( \mathbf { x } , y , \pmb { \theta } ) - \nabla _ { \theta } \mathcal { L } ( f _ { \pmb { \theta } } ( \mathbf { x } ) , y ) \| _ { 2 } \le \epsilon K . } \end{array}
|
| 488 |
+
$$
|
| 489 |
+
|
| 490 |
+
Combining Eq. (B.1) and Eq. (B.2), we can obtain Eq. (5).
|
| 491 |
+
|
| 492 |
+
Note that the bound is tight since the all the equalities can be reached.
|
| 493 |
+
|
| 494 |
+
Remark 1. We note that a recent work (Liu et al., 2020a) gives a similar result on gradient stability. The difference is that they assume the loss function satisfies an additional Lipschitzian smoothness condition as
|
| 495 |
+
|
| 496 |
+
$$
|
| 497 |
+
\begin{array} { r } { \| \nabla _ { \pmb \theta } \mathcal { L } \big ( f _ { \pmb \theta _ { 1 } } ( \mathbf { x } ) , y \big ) - \nabla _ { \pmb \theta } \mathcal { L } \big ( f _ { \pmb \theta _ { 2 } } ( \mathbf { x } ) , y \big ) \| _ { 2 } \leq K _ { \pmb \theta } \| \pmb \theta _ { 1 } - \pmb \theta _ { 2 } \| _ { 2 } , } \end{array}
|
| 498 |
+
$$
|
| 499 |
+
|
| 500 |
+
where $K _ { \theta }$ is another constant. Then they prove that
|
| 501 |
+
|
| 502 |
+
$$
|
| 503 |
+
\begin{array} { r } { \| \nabla _ { \pmb { \theta } } \mathcal { I } ( \mathbf { x } , y , \pmb { \theta } _ { 1 } ) - \nabla _ { \pmb { \theta } } \mathcal { I } ( \mathbf { x } , y , \pmb { \theta } _ { 2 } ) \| _ { 2 } \leq K _ { \pmb { \theta } } \| \pmb { \theta } _ { 1 } - \pmb { \theta } _ { 2 } \| _ { 2 } + 2 \epsilon K . } \end{array}
|
| 504 |
+
$$
|
| 505 |
+
|
| 506 |
+
It can be noted that with this new assumption, we can simply obtain this result by Theorem 1.
|
| 507 |
+
Therefore, Theorem 1 is a more general result of the previous one.
|
| 508 |
+
|
| 509 |
+
# B.1 THEORETICAL ANALYSIS FOR TRADES
|
| 510 |
+
|
| 511 |
+
Note that TRADES adopts the $\mathrm { K L }$ divergence in its adversarial loss. The KL divergence is defined on two predicted probability distributions over all classes, as
|
| 512 |
+
|
| 513 |
+
$$
|
| 514 |
+
\mathcal { D } ( f _ { \pmb { \theta } } ( \mathbf { x } ) \| f _ { \pmb { \theta } } ( \mathbf { x } ^ { \prime } ) ) = \sum _ { y \in \{ 1 , \dots , C \} } f _ { \pmb { \theta } } ( \mathbf { x } ) _ { y } \cdot \log \frac { f _ { \pmb { \theta } } ( \mathbf { x } ) _ { y } } { f _ { \pmb { \theta } } ( \mathbf { x } ^ { \prime } ) _ { y } } .
|
| 515 |
+
$$
|
| 516 |
+
|
| 517 |
+
However, based on the local Lipschitz continuity assumption of the clean cross-entropy loss (which is only concerned with the predicted probability of the true class) in Eq. (4), we cannot derive a similar theoretical bound on the gradient stability of TRADES as in Eq. (5). Therefore, we need to make a different assumption on the KL divergence. For example, suppose the gradient of the KL divergence satisfies
|
| 518 |
+
|
| 519 |
+
$$
|
| 520 |
+
\begin{array} { r } { \| \nabla _ { \theta } \mathcal { D } \big ( f _ { \pmb { \theta } } ( \mathbf { x } ) \| f _ { \pmb { \theta } } ( \mathbf { x } ^ { \prime } ) \big ) \| _ { 2 } \leq K ^ { \prime } \| \mathbf { x } ^ { \prime } - \mathbf { x } \| _ { p } , } \end{array}
|
| 521 |
+
$$
|
| 522 |
+
|
| 523 |
+
for any $\mathbf { x } \in \mathbb { R } ^ { d }$ , $\mathbf { x } ^ { \prime } \in S ( \mathbf { x } )$ , and any $\pmb \theta$ , where $K ^ { \prime }$ is another constant. We denote the adversarial loss of TRADES as $\mathcal { I } ^ { \prime } ( \mathbf { x } , y , \pmb { \theta } )$ , then we have
|
| 524 |
+
|
| 525 |
+
$$
|
| 526 |
+
\begin{array} { r l } & { \quad \| \nabla _ { \theta } \mathcal { I } ^ { \prime } ( \mathbf { x } , y , \theta _ { 1 } ) - \nabla _ { \theta } \mathcal { I } ^ { \prime } ( \mathbf { x } , y , \theta _ { 1 } ) \| _ { 2 } } \\ & { { \le } \| \nabla _ { \theta } \mathcal { L } ( f _ { \theta _ { 1 } } ( \mathbf { x } ) , y ) - \nabla _ { \theta } \mathcal { L } ( f _ { \theta _ { 2 } } ( \mathbf { x } ) , y ) \| _ { 2 } + } \\ & { \quad \beta \| \nabla _ { \theta } \underset { \mathbf { x } ^ { \prime } \in S ( \mathbf { x } ) } { \operatorname* { m a x } } \mathcal { D } ( f _ { \theta _ { 1 } } ( \mathbf { x } ) \| f _ { \theta _ { 1 } } ( \mathbf { x } ^ { \prime } ) ) \| _ { 2 } + } \\ & { \quad \beta \| \nabla _ { \theta } \underset { \mathbf { x } ^ { \prime } \in S ( \mathbf { x } ) } { \operatorname* { m a x } } \mathcal { D } ( f _ { \theta _ { 2 } } ( \mathbf { x } ) \| f _ { \theta _ { 2 } } ( \mathbf { x } ^ { \prime } ) ) \| _ { 2 } } \\ & { { \le } \| \nabla _ { \theta } \mathcal { L } ( f _ { \theta _ { 1 } } ( \mathbf { x } ) , y ) - \nabla _ { \theta } \mathcal { L } ( f _ { \theta _ { 2 } } ( \mathbf { x } ) , y ) \| _ { 2 } + 2 \beta \epsilon K ^ { \prime } . } \end{array}
|
| 527 |
+
$$
|
| 528 |
+
|
| 529 |
+
Although we can derive a similar bound on gradient stability of TRADES, this bound is not directly comparable to Eq. (5) since we cannot find the relationship between $K$ and $K ^ { \prime }$ . However, our empirical analysis on gradient magnitude in Sec. 3.2 has shown that TRADES is dominated by the clean cross-entropy loss at the initial training epochs, thus the gradient stability of the TRADES loss will be similar to that of the clean cross-entropy loss, as also revealed in Fig. 4(a). Therefore, the gradient of TRADES would be relatively stable.
|
| 530 |
+
|
| 531 |
+
# C FULL EXPERIMENTS ON ROBUST OVERFITTING
|
| 532 |
+
|
| 533 |
+

|
| 534 |
+
|
| 535 |
+

|
| 536 |
+
Figure C.1: The robust test accuracy of TRADES under various perturbation budgets $\epsilon$ .
|
| 537 |
+
Figure C.2: The adversarial loss of WRN-28-10 and ResNet-18 trained by PGD-AT on 500 samples sorted by the loss of the first model (i.e., WRN-28-10).
|
| 538 |
+
|
| 539 |
+
First, we show the robust test accuracy curves of TRADES under various perturbation budgets in Fig. C.1. It can also be observed that when the perturbation budget is small, robust overfitting does not occur.
|
| 540 |
+
|
| 541 |
+
Second, we show that the “hard” training examples with higher adversarial loss values are consistent across different model architectures. We train one WRN-28-10 model and one ResNet-18 model based on PGD-AT. We then calculate the adversarial loss for each training sample for these two models. We show the adversarial loss on 500 samples sorted by the loss of the first model (i.e., WRN28-10) in Fig. C.2. It can be seen that the samples with lower adversarial losses of the first model also have relatively lower losses of the second one and vice versa. The Kendall’s rank coefficient of the adversarial loss between the two models is 0.78 in this case.
|
| 542 |
+
|
| 543 |
+
Third, we visualize the hard training examples with high adversarial loss values in Fig. C.3. It can be seen that these examples are difficult to recognize and their labels may be wrong. Therefore, the one-hot labels for these hard training examples can be noisy for AT, leading to the robust overfitting problem.
|
| 544 |
+
|
| 545 |
+

|
| 546 |
+
Figure C.3: The hard training examples with high adversarial loss values.
|
| 547 |
+
|
| 548 |
+
Table C.1: Test accuracy $( \% )$ of several methods using different model architectures and threat models. We choose the best checkpoint according to the highest robust accuracy on the test set under PGD-10.
|
| 549 |
+
|
| 550 |
+
<table><tr><td rowspan="2">Methods</td><td rowspan="2">Networks</td><td rowspan="2">Norms</td><td colspan="3">Natural Accuracy</td><td colspan="3">PGD-10</td></tr><tr><td>Best</td><td>Final</td><td>Diff</td><td>Best</td><td>Final</td><td>Diff</td></tr><tr><td>PGD-AT PGD-AT+TE PGD-AT</td><td>WRN-34-10 WRN-34-10 VGG-16</td><td>lo (∈=8/255)</td><td>86.58 85.43 79.60</td><td>86.83 85.10</td><td>-0.25 0.33</td><td>55.83 59.30</td><td>49.52 56.63</td><td>6.31 2.67</td></tr><tr><td>PGD-AT+TE PGD-AT</td><td>VGG-16</td><td></td><td>78.19 88.82</td><td>81.26 79.13</td><td>-1.66 -0.94</td><td>48.52 52.06</td><td>43.02 51.29</td><td>5.50 0.77</td></tr><tr><td></td><td></td><td></td><td></td><td>88.96</td><td>-0.14</td><td>69.05</td><td>65.96</td><td>3.09</td></tr><tr><td>PGD-AT+TE</td><td></td><td></td><td>87.95</td><td>88.20</td><td></td><td></td><td></td><td>0.65</td></tr><tr><td></td><td>ResNet-18</td><td>l2 (∈ =128/255)</td><td></td><td></td><td>-0.25</td><td>72.58</td><td>71.93</td><td></td></tr><tr><td>TRADES</td><td></td><td></td><td>86.50</td><td>86.57</td><td>-0.07</td><td>70.22</td><td>66.07</td><td>4.15</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>TRADES+TE</td><td></td><td></td><td>88.42</td><td>88.60</td><td>-0.18</td><td>72.72</td><td>72.43</td><td>0.29</td></tr></table>
|
| 551 |
+
|
| 552 |
+
# C.2 ADDITIONAL EXPERIMENTS ON MITIGATING ROBUST OVERFITTING
|
| 553 |
+
|
| 554 |
+
We show the results of our proposed methods on other network architectures (including WRN34-10 and VGG-16) and threat models (including $\ell _ { 2 }$ norm) in Table C.1. The results consistently demonstrate the effectiveness of the proposed method.
|
| 555 |
+
|
| 556 |
+
We further show the results of PGD-AT, PGD- $\mathbf { A T + T E }$ , TRADES, and TRADES ${ \bf \nabla } + { \bf T } { \bf E }$ on CIFAR-10 over 3 runs in Table C.2.
|
| 557 |
+
|
| 558 |
+
Table C.2: Test accuracy $( \% )$ of several methods on CIFAR-10 under the $\ell _ { \infty }$ norm with $\epsilon = 8 / 2 5 5$ based on the ResNet-18 architecture. We show the mean/std of the results over 3 runs.
|
| 559 |
+
|
| 560 |
+
<table><tr><td rowspan="2">Method</td><td colspan="3">Natural Accuracy</td></tr><tr><td>Best</td><td>Final</td><td>Diff</td></tr><tr><td>PGD-AT</td><td>83.76 ± 0.02</td><td>84.93 ± 0.26</td><td>-1.17 ± 0.29</td></tr><tr><td>PGD-AT+TE</td><td>82.36 ± 0.18</td><td>82.69 ± 0.14</td><td>-0.33 ± 0.31</td></tr><tr><td>TRADES</td><td>81.34 ± 0.15</td><td>82.70 ± 0.21</td><td>-1.36 ± 0.36</td></tr><tr><td>TRADES+TE</td><td>83.66 ± 0.19</td><td>83.89 ± 0.09</td><td>-0.23 ± 0.21</td></tr><tr><td rowspan="2">Method</td><td></td><td>PGD-10</td><td></td></tr><tr><td>Best</td><td>Final</td><td>Diff</td></tr><tr><td>PGD-AT</td><td>52.62 ± 0.10</td><td>44.91 ± 0.01</td><td>7.71 ± 0.11</td></tr><tr><td>PGD-AT+TE</td><td>55.74 ± 0.17</td><td>54.82 ± 0.23</td><td>0.92 ± 0.07</td></tr><tr><td>TRADES</td><td>53.25 ± 0.07</td><td>50.48 ± 0.23</td><td>2.77 ± 0.16</td></tr><tr><td>TRADES+TE</td><td>54.93 ± 0.16</td><td>54.04 ± 0.19</td><td>0.89 ± 0.13</td></tr><tr><td rowspan="2">Method</td><td></td><td>PGD-1000</td><td></td></tr><tr><td>Best</td><td>Final</td><td>Diff</td></tr><tr><td>PGD-AT</td><td>51.26 ± 0.03</td><td>42.72 ± 0.06</td><td>8.54 ± 0.06</td></tr><tr><td>PGD-AT+TE</td><td>54.54 ± 0.27</td><td>53.01 ± 0.34</td><td>1.53 ± 0.24</td></tr><tr><td>TRADES</td><td>52.24 ± 0.20</td><td>48.74 ± 0.17</td><td>3.50 ± 0.13</td></tr><tr><td>TRADES+TE</td><td>53.55 ± 0.16</td><td>52.93 ± 0.07</td><td>0.62 ± 0.11</td></tr><tr><td rowspan="2">Method</td><td></td><td>C&W-1000</td><td></td></tr><tr><td>Best</td><td>Final</td><td>Diff</td></tr><tr><td>PGD-AT PGD-AT+TE</td><td>50.24 ± 0.12</td><td>43.59 ± 0.07</td><td>6.65 ± 0.19</td></tr><tr><td></td><td>52.31 ± 0.01</td><td>51.67 ± 0.12</td><td>0.64 ± 0.11</td></tr><tr><td>TRADES</td><td>49.83 ± 0.05</td><td>48.11 ± 0.04</td><td>1.72 ± 0.02</td></tr><tr><td>TRADES+TE</td><td>50.80 ± 0.02</td><td>50.61 ± 0.07</td><td>0.19 ± 0.08</td></tr><tr><td rowspan="2">Method</td><td>Best</td><td>AutoAttack Final</td><td>Diff</td></tr><tr><td></td><td></td><td></td></tr><tr><td>PGD-AT PGD-AT+TE</td><td>47.85 ± 0.17 50.37 ± 0.22</td><td>41.62 ± 0.16 49.36 ± 0.24</td><td>6.23 ± 0.26 1.01 ± 0.03</td></tr><tr><td>TRADES</td><td>48.86 ± 0.18</td><td>46.73 ± 0.07</td><td>2.13 ± 0.11</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>TRADES+TE</td><td>49.40 ± 0.27</td><td>48.77 ± 0.21</td><td>0.63 ± 0.05</td></tr></table>
|
md/dev/8H5bpVwvt5/8H5bpVwvt5.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/99RpBVpLiX/99RpBVpLiX.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/9EAQVEINuum/9EAQVEINuum.md
ADDED
|
@@ -0,0 +1,414 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OPTIMIZING BI-ENCODER FOR NAMED ENTITY RECOGNITION VIA CONTRASTIVE LEARNING
|
| 2 |
+
|
| 3 |
+
Sheng Zhang, Hao Cheng, Jianfeng Gao, and Hoifung Poon Microsoft Research
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We present a bi-encoder framework for named entity recognition (NER), which applies contrastive learning to map candidate text spans and entity types into the same vector representation space. Prior work predominantly approaches NER as sequence labeling or span classification. We instead frame NER as a representation learning problem that maximizes the similarity between the vector representations of an entity mention and its type. This makes it easy to handle nested and flat NER alike, and can better leverage noisy self-supervision signals. A major challenge to this bi-encoder formulation for NER lies in separating non-entity spans from entity mentions. Instead of explicitly labeling all non-entity spans as the same class Outside (O) as in most prior methods, we introduce a novel dynamic thresholding loss, learned in conjunction with the standard contrastive loss. Experiments show that our method performs well in both supervised and distantly supervised settings, for nested and flat NER alike, establishing new state of the art across standard datasets in the general domain (e.g., ACE2004, ACE2005, CoNLL2003) and high-value verticals such as biomedicine (e.g., GENIA, NCBI, BC5CDR, JNLPBA). We release the code at github.com/microsoft/binder.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Named entity recognition (NER) is the task of identifying text spans associated with named entities and classifying them into a predefined set of entity types such as person, location, etc. As a fundamental component in information extraction systems (Nadeau & Sekine, 2007), NER has been shown to be of benefit to various downstream tasks such as relation extraction (Mintz et al., 2009), coreference resolution (Chang et al., 2013), and fine-grained opinion mining (Choi et al., 2006).
|
| 12 |
+
|
| 13 |
+
Inspired by recent success in open-domain question answering (Karpukhin et al., 2020) and entity linking (Wu et al., 2020; Zhang et al., 2021a), we propose an efficient BI-encoder for NameD Entity Recognition (BINDER). Our model employs two encoders to separately map text and entity types into the same vector space, and it is able to reuse the vector representations of text for different entity types (or vice versa), resulting in a faster training and inference speed. Based on the bi-encoder representations, we propose a unified contrastive learning framework for NER, which enables us to overcome the limitations of popular NER formulations (shown in Figure 1), such as difficulty in handling nested NER with sequence labeling (Chiu & Nichols, 2016; Ma & Hovy, 2016), complex learning and inference for span-based classification (Yu et al., 2020; Fu et al., 2021), and challenges in learning with noisy supervision (Strakova et al., 2019; Yan et al., 2021). ´ 1 Through contrastive learning, we encourage the representation of entity types to be similar with the corresponding entity spans, and to be dissimilar with that of other text spans. Additionally, existing work labels all nonentity tokens or spans as the same class Outside (O), which can introduce false negatives when the training data is partially annotated (Das et al., 2022; Aly et al., 2021). We instead introduce a novel dynamic thresholding loss in contrastive learning, which learns candidate-specific dynamic thresholds to distinguish entity spans from non-entity ones.
|
| 14 |
+
|
| 15 |
+
To the best of our knowledge, we are the first to optimize bi-encoder for NER via contrastive learning. We conduct extensive experiments to evaluate our method in both supervised and distantly supervised settings. Experiments demonstrate that our method achieves the state of the art on a wide range of NER datasets, covering both general and biomedical domains. In supervised NER, compared to the previous best results, our method obtains a $2 . 4 \% - 2 . 9 \%$ absolute improvement in F1 on standard nested NER datasets such as ACE2004 and ACE2005, and a $1 . 2 \% - 1 . 9 \%$ absolute improvement on standard flat NER datasets such as BC5-chem, BC5-disease, and NCBI. In distantly supervised NER, our method obtains a $1 . 5 \%$ absolute improvement in F1 on the BC5CDR dataset. We further study the impact of various choices of components in our method, and conduct breakdown analysis at entity type level and token level, which reveals potential growth opportunities.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Left: The architecture of BINDER. The entity type and text encoder are isomorphic and fully decoupled Transformer models. In the vector space, the anchor point $( \bigcirc )$ represents the special token [CLS] from the entity type encoder. Through contrastive learning, we maximize the similarity between the anchor and the positive token ( Jim), and minimize the similarity between the anchor and negative tokens. The dotted gray circle (delimited by the similarity between the anchor and $\operatorname { O } [ \operatorname { C L S } ]$ from the text encoder) represents a threshold that separates entity tokens from non-entity tokens. To reduce clutter, data points that represent possible spans from the input text are not shown. Right: We compare BINDER with existing solutions for NER on three dimensions: 1) whether it can be applied to nested NER without special handling; 2) whether it can be trained using noisy supervision without special handling; 3) whether it has a fast training and inference speed.
|
| 19 |
+
|
| 20 |
+

|
| 21 |
+
|
| 22 |
+
# 2 METHOD
|
| 23 |
+
|
| 24 |
+
In this section, we present the design of BINDER, a novel architecture for NER tasks. As our model is built upon a bi-encoder framework, we first provide the necessary background for encoding both entity types and text using the Transformer-based (Vaswani et al., 2017) bi-encoder. Then, we discuss our ways of deriving entity type and individual mention span representations using the embedding output from the bi-encoder. Based on that, we introduce two types of contrastive learning objectives for NER using the token and span-level similarity respectively.
|
| 25 |
+
|
| 26 |
+
# 2.1 BI-ENCODER FOR NER
|
| 27 |
+
|
| 28 |
+
The overall architecture of BINDER is shown in Figure 1. Our model is built upon a bi-encoder architecture which has been mostly explored for dense retrieval (Karpukhin et al., 2020). Following the recent work, our bi-encoder also consists of two isomorphic and fully decoupled Transformer models (Vaswani et al., 2017), i.e. an entity type encoder and a text encoder. For NER tasks, we consider two types of inputs, entity type descriptions and text to detect named entities. At the high level, the entity type encoder produces type representations for each entity of interests (e.g. person in Figure 1) and the text encoder outputs representations for each input token in the given text where named entities are potentially mentioned (e.g. Jim in Figure 1). Then, we enumerate all span candidates based on corresponding token representations and match them with each entity type in the vector space. As shown in Figure 1, we maximize the similarity between the entity type and the positive spans, and minimize the similarity of negative spans.
|
| 29 |
+
|
| 30 |
+
We first formally discuss encoding both inputs using a pretrained Transformer model, BERT (Devlin et al., 2019).2 Specifically, we use $x _ { 1 } , \ldots , x _ { N }$ to denote an input sequence of length $N$ . When using BERT, there is a prepended token [CLS] and an appended token [SEP]for all input sequences, i.e. [CLS], $x _ { 1 } , \ldots , x _ { N }$ [SEP]. Then the output is a sequence of hidden states $\mathbf { h } _ { [ \mathbb { C L S } ] } , \mathbf { h } _ { 1 } , \dots , \mathbf { h } _ { N } , \mathbf { h } _ { [ \mathbb { S E P } ] } \in \mathbb { R } ^ { d }$ from the last BERT layer for each input token, where $d$ is the hidden dimension. Note that as [CLS]is always in the beginning, $\mathbf { h } _ { 0 }$ and $\mathbf { h } _ { \left[ \mathrm { C L S } \right] }$ are interchangeable here. Based on this, we then discuss the way of computing entity type and text token embeddings, which are the basic building blocks for deriving our NER constrative learning objectives later.
|
| 31 |
+
|
| 32 |
+
Entity Type Embeddings The goal of entity type encoder is to produce entity type embeddings that serve as anchors in the vector space for contrastive learning. In this work, we focus on a predefined set of entity types $\mathcal { E } = \{ E _ { 1 } , \ldots , E _ { K } \}$ , where each entity type has one or multiple natural language descriptions. The natural language description can be formal textual definitions based on the dataset annotation guideline or Wikipedia, and prototypical instances where a target type of named entities are mentioned. For simplicity, the discussion proceeds with one description per type and we use $E _ { k }$ to denote a sequence of tokens for the $k$ -th entity type description. For a given entity type $E _ { k }$ , we use BERT as the entity type encoder $( \mathrm { B E R T } ^ { E \setminus } ,$ ) and add an additional linear projection to compute corresponding entity type embeddings in the following way:
|
| 33 |
+
|
| 34 |
+
$$
|
| 35 |
+
\begin{array} { r l } & { { \bf { h } } _ { [ \mathbb { C } \mathrm { L S } ] } ^ { E _ { k } } = { \tt B E R T } ^ { E } ( E _ { k } ) , } \\ & { { \bf { e } } _ { k } = { \tt L i n e a r } ^ { E } ( { \bf { h } } _ { [ \mathbb { C } \mathrm { L S } ] } ^ { E _ { k } } ) , } \end{array}
|
| 36 |
+
$$
|
| 37 |
+
|
| 38 |
+
where Linear is a learnable linear layer and $\mathbf { e } _ { k } \in \mathbb { R } ^ { d }$ is the vector representation for $E _ { k }$
|
| 39 |
+
|
| 40 |
+
Text Token Embeddings Instead of using [CLS]embeddings as done in the recent bi-encoder work for entity retrieval (Wu et al., 2020), we consider using text token embeddings as the basic unit for computing similarity with entity span embeddings. As there are multiple potential named entities not known as a prior in the input, naively using special markers (Wu et al., 2020) incurs huge computation overhead for NER. Similar to the entity type embeddings, we again use BERT as the text encoder (BERTT ) and simply use the final hidden states as the basic text token representations3,
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
\mathbf { h } _ { 1 } ^ { T } , \ldots , \mathbf { h } _ { N } ^ { T } = \mathtt { B E R T } ^ { T } \big ( x _ { 1 } , \ldots , x _ { N } \big ) .
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
# 2.2 CONTRASTIVE LEARNING FOR NER
|
| 47 |
+
|
| 48 |
+
Based on the entity type embeddings and text token embeddings discussed above, we then introduce two different contrastive learning objectives for NER in this part. Here, we assume a span $( i , j )$ is a contiguous sequence of tokens in the input text with a start token in position $i$ and an end token in position $j$ . Throughout this work, we use the similarity function, $\begin{array} { r } { s \mathrm { i m } ( \cdot , \cdot ) = \frac { \cos ( \cdot , \cdot ) } { \tau } } \end{array}$ cos(·,·) , where τ is a scalar parameter.
|
| 49 |
+
|
| 50 |
+
As shown in Figure 1, the overall goal of NER constrastive learning is to push the entity mention span representations close to their corresponding entity type embeddings (positive) and far away from irrelevant types (negative) in vector space, e.g. Person closer to $\ J \ i \mathrm { m }$ but away from Acme. To achieve that, we propose a multi-objective formulation consisting of two objectives based on span and token embedding spaces respectively.
|
| 51 |
+
|
| 52 |
+
Span-based Objective We derive the vector representation for span $( i , j )$ as below:
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\mathsf { \mathbf { s } } _ { i , j } = \mathtt { L i n e a r } ^ { S } ( \mathbf { h } _ { i } ^ { T } \oplus \mathbf { h } _ { j } ^ { T } \oplus D ( j - i ) ) ,
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
where $\mathbf { h } _ { i } ^ { T } , \mathbf { h } _ { j } ^ { T }$ are text token embeddings (Equation 3), $\mathbf { s } _ { i , j } \in \mathbb { R } ^ { d }$ , LinearS is a learnable linear layer, $\oplus$ indicates the vector concatenation, $D ( j - i ) \in \mathbb { R } ^ { m }$ is the $( j - i )$ -th row of a learnable span width embedding matrix $D \in \mathbb { R } ^ { N \times m }$ . Based on this, the span-based infoNCE (Oord et al., 2018) can be defined as
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\ell _ { \mathrm { s p a n } } = - \log \frac { \exp ( \sin ( \mathbf { s } _ { i , j } , \mathbf { e } _ { k } ) ) } { \sum _ { \mathbf { s } ^ { \prime } \in \mathcal { S } _ { k } ^ { - } \cup \mathbf { s } _ { i , j } } \exp ( \sin ( \mathbf { s } ^ { \prime } , \mathbf { e } _ { k } ) ) } ,
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
where the span $( i , j )$ belongs to entity type $E _ { k }$ , $S _ { k } ^ { - }$ is the set of negative spans that are all possible spans from the input text, excluding entity spans from $E _ { k }$ , and $\mathbf { e } _ { k }$ is the entity type embedding.
|
| 65 |
+
|
| 66 |
+
Position-based Objective One limitation of the span-based objective is that it penalizes all negative spans in the same way, even if they are partially correct spans, e.g., spans that have the same start or end token with the gold entity span. Intuitively, it is more desirable to predict partially correct spans than completely wrong spans. Therefore, we propose additional position-based contrastive learning objectives. Specby using additional linear layers, ddings , where $E _ { k }$ $e _ { k } ^ { \mathrm { B } } = \mathtt { L i n e a r } _ { B } ^ { E } ( \mathbf { h } _ { \scriptscriptstyle { [ \mathrm { C L S } ] } } ^ { E _ { k } } ) , e _ { k } ^ { \mathrm { Q } } = \mathtt { L i n e a r } _ { Q } ^ { E } ( \mathbf { h } _ { \scriptscriptstyle { [ \mathrm { C L S } ] } } ^ { E _ { k } } )$ $e _ { k } ^ { \tt B } , e _ { k } ^ { \tt Q }$ are the type embeddings for the start and end positions respectively, $\mathbf { h } _ { [ \mathbb { C } \mathrm { L } S ] } ^ { E _ { k } }$ is from the entity type encoder (Equation 1). Accordingly, we can use two addtional linear layers to compute the corresponding token embeddings for the start and end tokens respectively, $\mathbf u _ { n } = \mathtt { L i n e a r } _ { B } ^ { \mathrm { - } } ( \mathbf h _ { n } ^ { T } ) , \mathbf v _ { n } =$ Linea $\underline { { \boldsymbol { r } } } _ { Q } ^ { T } ( \mathbf { h } _ { n } ^ { T } )$ , where $\mathbf { h } _ { n } ^ { T }$ is the text token embeddings (Equation 3). Using $e _ { \mathbf { B } } ^ { k } , e _ { \mathbf { Q } } ^ { k }$ as anchors, we then define two position-based objectives via contrastive learning:
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
\begin{array} { r l } & { \ell _ { \mathrm { s t a r t } } = - \log \frac { \exp ( \sin ( \mathbf { u } _ { i } , \mathbf { e } _ { k } ^ { \mathrm { B } } ) ) } { \sum _ { \mathbf { u } ^ { \prime } \in \mathcal { U } _ { k } ^ { - } \cup \mathbf { u } _ { i } } \exp ( \sin ( \mathbf { u } ^ { \prime } , \mathbf { e } _ { k } ^ { \mathrm { B } } ) ) } } \\ & { \ell _ { \mathrm { e n d } } = - \log \frac { \exp ( \sin ( \mathbf { v } _ { j } , \mathbf { e } _ { k } ^ { \mathrm { Q } } ) ) } { \sum _ { \mathbf { v } ^ { \prime } \in \mathcal { V } _ { k } ^ { - } \cup \mathbf { v } _ { j } } \exp ( \sin ( \mathbf { v } ^ { \prime } , \mathbf { e } _ { k } ^ { \mathrm { Q } } ) ) } , } \end{array}
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
where $\mathcal { U } _ { k } ^ { - } , \mathcal { V } _ { k } ^ { - }$ are two sets of positions in the input text that do not belong to the start/end of any span of entity type $k$ . Compared with Equation 5, the main difference of position-based objectives comes from the corresponding negative sets where start and end positions are independent of each other. In other words, the position-based objectives can potentially help the model to make better start and end position predictions.
|
| 73 |
+
|
| 74 |
+
Thresholding for Non-Entity Cases Although the contrastive learning objectives defined above can effectively push the positive spans close to their corresponding entity type in vector space, it might be problematic for our model at test time to decide how close a span should be before it can be predicted as positive. In other words, the model is not able to separate entity spans from nonentity spans properly. To address this issue, we use the similarity between the special token [CLS] and the entity type as a dynamic threshold (as shown in Figure 1). Intuitively, the representation of [CLS] reads the entire input text and summarizes the contextual information, which could make it a good choice to estimate the threshold to separate entity spans from non-entity spans. We compare it with several other thresholding choices in $\ S 4$ .
|
| 75 |
+
|
| 76 |
+
To learn thresholding, we extend the original contrastive learning objectives with extra adaptive learning objectives for non-entity cases. Specifically, for the start loss (Equation 6), the augmented start loss $\ell _ { \mathrm { s t a r t } } ^ { + }$ is defined as
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\ell _ { \mathrm { s t a r t } } ^ { + } = \beta \ell _ { \mathrm { s t a r t } } - ( 1 - \beta ) \log \frac { \exp ( \sin ( \mathbf { u } _ { \scriptscriptstyle { \left[ \mathrm { C L S } \right] } } , \mathbf { e } _ { k } ^ { \mathrm { B } } ) ) } { \sum _ { \mathbf { u } ^ { \prime } \in \mathcal { U } _ { k } ^ { - } \exp ( \sin ( \mathbf { u } ^ { \prime } , \mathbf { e } _ { k } ^ { \mathrm { B } } ) ) } } .
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
An augmented end loss use the span embedding $\ell _ { \mathrm { e n d } } ^ { + }$ can be defined in a similar fashion. Ffor deriving the augmented span loss span loss (Equation 5), we $\mathbf { s } _ { 0 , 0 }$ $\ell _ { \tt s p a n } ^ { + }$
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\ell _ { \mathrm { s p a n } } ^ { + } = \beta \ell _ { \mathrm { s p a n } } - ( 1 - \beta ) \log \frac { \exp ( \sin ( \mathbf { s } _ { 0 , 0 } , \mathbf { e } _ { k } ) ) } { \sum _ { \mathbf { s } ^ { \prime } \in S _ { k } ^ { - } } \exp ( \sin ( \mathbf { s } ^ { \prime } , \mathbf { e } _ { k } ) ) } .
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
Note that we use a single scalar hyperparameter $\beta$ for balancing the adaptive thresholding learning and original contrastive learning for all three cases.
|
| 89 |
+
|
| 90 |
+
Training Finally, we consider a multi-task contrastive formulation by combing three augmented contrastive learning discussed above, leading to our overall training objective
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\mathcal { L } = \alpha \ell _ { \mathrm { s t a r t } } ^ { + } + \gamma \ell _ { \mathrm { e n d } } ^ { + } + \lambda \ell _ { \mathrm { s p a n } } ^ { + } ,
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
where $\alpha , \gamma , \lambda$ are all scalar hyperparameters.
|
| 97 |
+
|
| 98 |
+
Inference Strategy During inference, we enumerate all possible spans that are less than the length of $L$ and compute three similarity scores based on the start/end/span cases for each entity type. We consider two prediction strategies, joint position-span and span-only predictions. In the joint position-span case, for entity type $E _ { k }$ , we prune out spans $( i , j )$ that have either start or end similar scores lower than the learned threshold, i.e. $\mathrm { s i m } ( \mathbf { u } _ { i } , \mathbf { e } _ { k } ^ { \mathrm { B } } ) \ < \ \mathrm { s i m } ( \mathbf { u } _ { \mathrm { [ C L S ] } } , \mathbf { e } _ { k } ^ { \mathrm { B } } )$ or $\sin ( \mathbf { v } _ { j } , \mathbf { e } _ { k } ^ { \mathrm { Q } } ) < \sin ( \mathbf { v } _ { [ \mathtt { C L S } ] } , \mathbf { e } _ { k } ^ { \mathrm { Q } } )$ . Then, only those spans with span similarity scores higher than the span threshold are predicted as positive ones i.e. $\sin ( \mathbf { s } _ { i , j } , \mathbf { e } _ { k } ) > \sin ( \mathbf { s } _ { 0 , 0 } , \mathbf { e } _ { k } )$ . For the span-only strategy, we just rely on the span similarity score and keep all qualified spans as final predictions. As shown later in our experiments $( \ S 4 )$ , we find the span-only inference is more effective, because the joint inference is more likely to be affected by annotation artifacts. The full inference algorithm is summarized in Appendix A.5.
|
| 99 |
+
|
| 100 |
+
# 3 EXPERIMENTS
|
| 101 |
+
|
| 102 |
+
We evaluate our method in both supervised and distantly supervised settings. The implementation details of our method are described in Appendix A.4
|
| 103 |
+
|
| 104 |
+
Evaluation Metrics We follow the standard evaluation protocol and use micro F1: a predicted entity span is considered correct if its span boundaries and the predicted entity type are both correct.
|
| 105 |
+
|
| 106 |
+
Datasets In the supervised setting, we evaluate our method on both nested and flat NER. For nested NER, we consider ACE2004, ACE2005, and GENIA (Kim et al., 2003). ACE2004 and ACE2005 are collected from general domains (e.g., news and web). We follow Luan et al. (2018) to split ACE2004 into 5 folds, and ACE2005 into train, development and test sets. GENIA is from the biomedical domain. We use its v3.0.2 corpus and follow Finkel & Manning (2009) and Lu & Roth (2015) to split it into $8 0 \% / 1 0 \% / 1 0 \%$ train/dev/test splits. For flat NER, we consider CoNLL2003 (Tjong Kim Sang & De Meulder, 2003) as well as five biomedical NER datasets from the BLURB benchmark (Gu et al., 2021): BC5-chem/disease (Li et al., 2016), NCBI (Dogan et al., ˘ 2014), BC2GM (Smith et al., 2008), and JNLPBA (Collier & Kim, 2004). Preprocessing and splits follow Gu et al. (2021). Appendix A.6 reports the dataset statistics.
|
| 107 |
+
|
| 108 |
+
In the distantly supervised setting, we consider BC5CDR (Li et al., 2016). It consists of 1,500 articles annotated with 15,935 chemical and 12,852 disease mentions. We use the standard train, development, and test splits. In the train and development sets, we discard all human annotations and only keep the unlabeled articles. Their distant labels are generated using exact string matching against a dictionary released by Shang et al. (2018).4 On the training set, the distant labels have high precision $( 9 7 . 9 9 \%$ for chemicals, and $9 8 . 3 4 \%$ for diseases), but low recall $6 3 . 1 4 \%$ for chemicals, and $4 6 . 7 3 \%$ for diseases).
|
| 109 |
+
|
| 110 |
+
Supervised NER Results Table 1 presents the comparison of our method with all previous methods evaluated on three nested NER datasets, ACE2004, ACE2005, and GENIA. We report precision, recall, and F1. As is shown, our method achieves the state of the art performance on all three datasets. On ACE2004 and ACE2005, it outperforms all previous methods with $8 9 . 7 \%$ and $9 0 . 0 \%$ F1. Particularly, in comparison with the previous best method (Tan et al., 2021), our method significantly improves F1 by the absolute points of $+ 2 . 4 \%$ and $+ 2 . 9 \%$ respectively. On GENIA, our method advances the previous state of the art (Yu et al., 2020) by $+ 0 . 3 \%$ F1. Note that the previous methods are built on top of different encoders, e.g., LSTM, BERT-large, BART-large, and T5-base. We also report our method using a BERT-base encoder, which even outperforms the previous methods that use a larger encoder of BERT-large (Tan et al., 2021) or BART-large (Yan et al., 2021). Overall, our method has substantial gains over the previous methods. Due to the space limit, we report the result on CoNLL03 and compare with prompt-based NER and span-based NER in Appendix A.1 and A.2.
|
| 111 |
+
|
| 112 |
+
Table 2 compares our method with all previous submissions on the BLURB benchmark. We only report F1 due to unavailability of precision and recall of these submissions. The major difference among these submissions are encoders. A direct comparison can be made between our method and Gu et al. (2021) which formulates NER as a sequential labeling task and fine-tunes a standard $\mathrm { L S T M + C R F }$ classifier on top of the pretrained transformer encoder. While both using PubMedBERT as the encoder, our method significantly outperforms Gu et al. (2021) across the board. Compared to the previous best submissions (Kanakarajan et al., 2021; Yasunaga et al., 2022), our method also show substantial gains on BC5-chem $( + 1 . 2 \% )$ , BC5-disease $( + 1 . 9 \% )$ , and NCBI $( 1 . 5 \% )$ .
|
| 113 |
+
|
| 114 |
+
Table 1: Test scores on three nested NER datasets. Bold-and-underline, bold-only and underline-only indicate the best, the second best, and the third best respectively. The different encoders are used: $\mathrm { L } = \mathrm { L S T M }$ , $\mathbf { B l } =$ BERT-large, BioB $=$ BioBERT, BioBl $=$ BioBERT-large, $\mathbf { B A l = }$ BART-large, $\mathrm { T } 5 \mathrm { b } = \mathrm { T } 5$ -base, $\mathbf { B } \mathbf { b } =$ BERT-base. $\dagger$ Original scores of Li et al. (2020) are not reproducible. Like Yan et al. (2021), we report the rerun of their released code.
|
| 115 |
+
|
| 116 |
+
<table><tr><td rowspan="2"></td><td rowspan="2">Encoder</td><td colspan="3">ACE2004</td><td colspan="3">ACE2005</td><td colspan="3">GENIA</td></tr><tr><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td></tr><tr><td>Lu & Roth (2015)</td><td>-</td><td>70.0</td><td>56.9</td><td>62.8</td><td>66.3</td><td>59.2</td><td>62.5</td><td>74.2</td><td>66.7</td><td>70.3</td></tr><tr><td>Katiyar & Cardie (2018)</td><td>L</td><td>73.6</td><td>71.8</td><td>72.7</td><td>70.6</td><td>70.4</td><td>70.5</td><td>77.7</td><td>71.8</td><td>74.6</td></tr><tr><td>Shibuya & Hovy (2020)</td><td>B1</td><td>83.7</td><td>81.9</td><td>82.8</td><td>83.0</td><td>82.4</td><td>82.7</td><td>78.1</td><td>76.5</td><td>77.3</td></tr><tr><td>Wang et al. (2020)</td><td>Bl/BioB</td><td>86.1</td><td>86.5</td><td>86.3</td><td>84.0</td><td>85.4</td><td>84.7</td><td>79.5</td><td>78.9</td><td>79.2</td></tr><tr><td>Li et al. (2020)t</td><td>Bl/BioB</td><td>85.8</td><td>85.8</td><td>85.8</td><td>85.0</td><td>84.1</td><td>84.6</td><td>81.2</td><td>76.4</td><td>78.7</td></tr><tr><td>Yu et al. (2020)</td><td>Bl/BioB</td><td>87.3</td><td>86.0</td><td>86.7</td><td>85.2</td><td>85.6</td><td>85.4</td><td>81.8</td><td>79.3</td><td>80.5</td></tr><tr><td>Tan et al. (2021)</td><td>Bl/BioB</td><td>88.5</td><td>86.1</td><td>87.3</td><td>87.5</td><td>86.6</td><td>87.1</td><td>82.3</td><td>78.7</td><td>80.4</td></tr><tr><td>Yan et al. (2021)</td><td>BAl</td><td>87.3</td><td>86.4</td><td>86.8</td><td>83.2</td><td>86.4</td><td>84.7</td><td>78.6</td><td>79.3</td><td>78.9</td></tr><tr><td>Zhang et al. (2022)</td><td>T5b</td><td>86.5</td><td>84.5</td><td>85.4</td><td>83.3</td><td>86.6</td><td>84.9</td><td>81.0</td><td>77.2</td><td>79.1</td></tr><tr><td>Wan et al. (2022)</td><td>Bb</td><td>86.7</td><td>85.9</td><td>86.3</td><td>84.4</td><td>85.9</td><td>85.1</td><td>77.9</td><td>80.7</td><td>79.3</td></tr><tr><td rowspan="2">BINDER (Ours)</td><td>Bb/BioB</td><td>88.3</td><td>89.1</td><td>88.7</td><td>89.1</td><td>89.8</td><td>89.5</td><td>81.5</td><td>79.6</td><td>80.5</td></tr><tr><td>Bl/BioBl</td><td>89.7</td><td>89.7</td><td>89.7</td><td>89.6</td><td>90.5</td><td>90.0</td><td>83.4</td><td>78.3</td><td>80.8</td></tr></table>
|
| 117 |
+
|
| 118 |
+
Table 2: Test F1 scores on five flat NER datasets from the BLURB benchmark (aka.ms/blurb). Bold and underline indicate the best and the second best respectively. All encoders use their base version.
|
| 119 |
+
|
| 120 |
+
<table><tr><td></td><td>Encoder</td><td>BC5-chem</td><td>BC5-disease</td><td>NCBI</td><td>BC2GM</td><td> JNLPBA</td></tr><tr><td>Lee et al. (2019)</td><td>BioBERT</td><td>92.9</td><td>84.7</td><td>89.1</td><td>83.8</td><td>78.6</td></tr><tr><td>Gu et al. (2021)</td><td>PubMedBERT</td><td>93.3</td><td>85.6</td><td>87.8</td><td>84.5</td><td>79.1</td></tr><tr><td>Kanakarajan et al. (2021)</td><td>BioELECTRA</td><td>93.6</td><td>85.8</td><td>89.4</td><td>84.7</td><td>80.2</td></tr><tr><td>Yasunaga et al. (2022)</td><td>LinkBERT</td><td>93.8</td><td>86.1</td><td>88.2</td><td>84.9</td><td>79.0</td></tr><tr><td>BINDER (Ours)</td><td>PubMedBERT</td><td>95.0</td><td>88.0</td><td>90.9</td><td>84.6</td><td>80.3</td></tr></table>
|
| 121 |
+
|
| 122 |
+
Distantly Supervised NER Results Table 3 compares test scores of our method and previous methods on BC5CDR. It presents a clear advantage of our method over all previous methods in the distantly supervised setting. The F1 score is advanced by $+ 1 . 5 \%$ over the previous best method (Zhou et al., 2022), which adapts positive and unlabeled (PU) learning to obtain a high recall yet at the loss of precision. In contrast, our method maintains a reasonable recall (comparable to Shang et al., 2018; Peng et al., 2019) and substantially improves the precision. Note that besides the dictionary used to generate distant supervisions, Zhou et al. (2022); Shang et al. (2018) require an additional high-quality dictionary to estimate the noisiness of non-entity spans. Our method does not have such a requirement. For reference, Table 2 also includes the supervised state of the art. Our method in the supervised setting achieves $9 1 . 9 \%$ F1, outperforming the previous SOTA Wang et al. (2021) by $1 . 0 \%$ . Comparing both settings, we observe that the distantly supervised result still has an over-10-point gap with the supervised one, indicating a potential to further reduce the false negative noise.
|
| 123 |
+
|
| 124 |
+
Table 3: Test scores on BC5CDR. All baselines scores in the distantly supervised setting are quoted from Zhou et al. (2022).
|
| 125 |
+
|
| 126 |
+
<table><tr><td rowspan="2"></td><td colspan="3">BC5CDR</td></tr><tr><td>P</td><td>R</td><td>F1</td></tr><tr><td colspan="4">Distantly Supervised</td></tr><tr><td>Dict/KB Matching AutoNER (Shang et al., 2018)</td><td>86.4 82.6</td><td>51.2 77.5</td><td>64.3 80.0</td></tr><tr><td>BNPU (Peng et al.,2019)</td><td>48.1</td><td>77.1</td><td>59.2</td></tr><tr><td>BERT-ES (Liang et al.,2020)</td><td>80.4</td><td>67.9</td><td>73.7</td></tr><tr><td>Conf-MPU (Zhou et al., 2022)</td><td>76.6</td><td>83.8</td><td>80.1</td></tr><tr><td>BINDER (Ours)</td><td>87.6</td><td>76.3</td><td>81.6</td></tr><tr><td colspan="4">Fully Supervised</td></tr><tr><td>Nooralahzadeh et al. (2019)</td><td>92.1</td><td>87.9</td><td>89.9</td></tr><tr><td>Wang et al. (2021)</td><td>-</td><td>-</td><td>90.9</td></tr><tr><td>BINDER (Ours)</td><td>92.6</td><td>91.2</td><td>91.9</td></tr></table>
|
| 127 |
+
|
| 128 |
+
# 4 ANALYSIS
|
| 129 |
+
|
| 130 |
+
Here we conduct extensive analyses of our method. For efficiency, all analysis in this section is done based on the uncased BERT-base encoder.
|
| 131 |
+
|
| 132 |
+
Ablation Study We compare several variants of our method and report their test scores on ACE2005 in Table 4. We observe performance degradation in all these variants. Shared linear layers uses the same linear layer for span and token embeddings, and the same linear layer for entity type embeddings, in the hope of projecting them into the same vector space and sharing their semantics. It leads to a slightly better precision but a drop of recall. Similar changes are observed in Joint position-span inference, which adopts a more stringent strategy to prune out spans – only keep spans whose start, end, and span scores are all above the thresholds. No position-based objectives only optimizes the span-based objective, which penalizes partially corrected spans in the same way as other spans, resulting in a marginal improvement of recall but a significant loss of precision.
|
| 133 |
+
|
| 134 |
+
Choices of Entity Type Descriptions Table 5 compares different choices of entity type descriptions. Our final model uses annotation guidelines, which outperforms other choices: (1) Atomic labels considers each entity type as an atomic label. Instead of learning an entity type encoder, we directly learn an embedding vector for each entity type. (2) Keywords uses a keyword for each entity type as the input to the entity type encoder, e.g., “person” for PER. (3) Prototypical instances for each minibatch during training dynamically samples from the training data a prototypical instance for each entity type and uses it as input to the entity type encoder. Unlike annotation guidelines, we add special markers to indicate the start and end of an entity span and use the hidden states of the start marker as entity type embeddings. At test time, we increase the number of prototypical instances to three for each entity type. Larger number of prototypical instances may improve the performance. Prototypical instances may also lead to a better performance in few-shot or zero-shot settings. We leave them to future exploration.
|
| 135 |
+
|
| 136 |
+
Table 4: Test scores of our method and its variants on ACE2005.
|
| 137 |
+
|
| 138 |
+
<table><tr><td rowspan="2"></td><td colspan="3">ACE2005</td></tr><tr><td>P</td><td>R</td><td>F1</td></tr><tr><td>Our full model</td><td>89.1</td><td>89.8</td><td>89.5</td></tr><tr><td>Shared linear layers</td><td>89.3</td><td>89.3</td><td>89.3</td></tr><tr><td>Joint position-span inference</td><td>89.4</td><td>89.2</td><td>89.3</td></tr><tr><td>No position-based objectives</td><td>88.7</td><td>89.9</td><td>89.3</td></tr></table>
|
| 139 |
+
|
| 140 |
+
Table 5: Test scores on ACE2005 with different entity type descriptions.
|
| 141 |
+
|
| 142 |
+
<table><tr><td rowspan="2"></td><td colspan="3">ACE2005</td></tr><tr><td>P</td><td>R</td><td>F1</td></tr><tr><td>Atomic labels</td><td>88.9</td><td>89.6</td><td>89.2</td></tr><tr><td>Keywords</td><td>88.7</td><td>89.8</td><td>89.2</td></tr><tr><td>Prototypical instances</td><td>88.7</td><td>90.1</td><td>89.4</td></tr><tr><td>Annotation guidelines</td><td>89.1</td><td>89.8</td><td>89.5</td></tr></table>
|
| 143 |
+
|
| 144 |
+
Thresholding Strategies Our method uses dynamic similarity thresholds to distinguish entity spans from non-entity spans. We compare the impact of dynamic thresholds in our method with two straightforward variants: (1) Learned global thresholds replaces dynamic thresholds with global thresholds, one for each entity type. Specifically, we consider the global similarity thresholds as scalar parameters (initialized as 0). During training, we replace the similarity function outputs $\mathrm { s i m } \big ( \mathbf { u } _ { \mathrm { [ C L S ] } } , \mathbf { e } _ { k } ^ { \mathrm { B } } \big )$ in Equation 8 and $\sin ( \mathbf { s } _ { 0 , 0 } , \mathbf { e } _ { k } )$ in Equation 9 with the corresponding global thresholds. At test times, the global thresholds are used to separate entity spans from non-entity spans. (2) Global thresholds tuned on dev introduces global thresholds after the training is done and tune them on the development set. During training, instead of Equation 10, we optimize a simplified loss without thresholding, $\alpha \ell _ { \mathrm { s t a r t } } + \gamma \ell _ { \mathrm { e n d } } + \lambda \ell _ { \mathrm { j o i n t } }$ . Table 6 compares their test scores on the ACE2005 dataset. Dynamic thresholds have the best scores overall. Learned global thresholds performs better than global thresholds tuned on the development set, indicating the necessity of learning thresholds during training. Note that the global thresholds tuned on dev still outperforms all the previous methods in Table 1, showing a clear advantage of our bi-encoder framework. In Appendix A.7, We further visualize and discuss the distribution of similarity scores between text spans and entity types based on different thresholding strategies.
|
| 145 |
+
|
| 146 |
+
Time Efficiency Table 7 compares the training and inference speed of our method against several prominent methods. To ensure fair comparisons, all speed numbers are recorded based on the same machine using their released code with the same batch size and the same maximum sequence length.
|
| 147 |
+
|
| 148 |
+
MRC-NER (Li et al., 2020) formulates NER as a machine reading comprehension problem and employs a cross-attention encoder. Comparing with it, our bi-encoder framework has $1 7 \mathrm { x }$ and $8 \mathbf { { X } }$ speed on training and inference respectively. Biaffine-NER (Yu et al., 2020) formulates NER as a dependency parsing problem and applies a biaffine classifier to classify the typed arc between an entity span start and end. Comparing with it, our framework does not need a biaffine layer and is $1 . 7 \mathrm { x }$ and 2.4x faster at training and inference. Without the need of conditional random fields (CRFs), our framework is even faster than the widely used BERT-CRF framework. A drawback of BERT-CRF is that it cannot be applied to nested NER. Here we test it on a flat NER dataset CoNLL2003 (Tjong Kim Sang & De Meulder, 2003). All other frameworks are tested on ACE2005.
|
| 149 |
+
|
| 150 |
+
<table><tr><td></td><td colspan="3">ACE2005</td></tr><tr><td></td><td>P</td><td>R</td><td>F1</td></tr><tr><td>Dynamic thresholds</td><td>89.1</td><td>89.8</td><td>89.5</td></tr><tr><td>Learned global thresholds</td><td>88.2</td><td>89.0</td><td>88.6</td></tr><tr><td>Global thresholds tuned on dev</td><td>86.3</td><td>88.7</td><td>87.5</td></tr></table>
|
| 151 |
+
|
| 152 |
+
Table 6: Test scores of our method using different thresholding strategies on ACE2005.
|
| 153 |
+
Table 7: Training and inference speed.
|
| 154 |
+
|
| 155 |
+
<table><tr><td></td><td colspan="2">Speed (w/s)</td></tr><tr><td></td><td>Training</td><td>Inference</td></tr><tr><td>MRC-NER (Li et al., 2020)</td><td>147</td><td>1,110</td></tr><tr><td>Biaffine-NER(Yu et al.,2020)</td><td>1,548</td><td>3,634</td></tr><tr><td>BERT-CRF (pytorch_neural_crf)</td><td>2,273</td><td>8,596</td></tr><tr><td>BINDER (Ours)</td><td>2,571</td><td>8,886</td></tr></table>
|
| 156 |
+
|
| 157 |
+
Table 8: Test F1 score breakdowns on ACE2005 and GENIA. Columns compare F1 scores on different entity types. Rows compare F1 scores based on the entire entity span, or only the start or end of entity span. S-F1 denotes the strict F1 requiring the exact boundary match. L-F1 denotes the loose F1 allowing partial overlaps. The color signifies substantially better F1 scores than the corresponding entity span strict F1 scores.
|
| 158 |
+
|
| 159 |
+
<table><tr><td rowspan="2"></td><td colspan="8">ACE2005</td><td colspan="6">GENIA</td></tr><tr><td>PER</td><td>GPE</td><td>ORG</td><td>FAC</td><td>LOC</td><td>VEH</td><td>WEA</td><td>ALL</td><td>Prot.</td><td>DNA</td><td>CellT.</td><td>CelIL.</td><td>RNA</td><td>ALL</td></tr><tr><td>S-F1span</td><td>93.4</td><td>91.2</td><td>79.7</td><td>81.0</td><td>78.7</td><td>84.8</td><td>82.1</td><td>89.5</td><td>82.9</td><td>77.6</td><td>74.5</td><td>76.3</td><td>87.9</td><td>80.5</td></tr><tr><td>S-F1start</td><td>93.9</td><td>91.2</td><td>80.7</td><td>81.0</td><td>79.0</td><td>84.8</td><td>82.1</td><td>89.9</td><td>86.1</td><td>80.9</td><td>74.5</td><td>80.2</td><td>88.7</td><td>83.2</td></tr><tr><td>S-F1end</td><td>93.9</td><td>91.2</td><td>81.9</td><td>83.1</td><td>79.0</td><td>86.8</td><td>82.1</td><td>90.3</td><td>87.6</td><td>82.6</td><td>83.7</td><td>82.8</td><td>91.0</td><td>85.8</td></tr><tr><td>L-F1span</td><td>94.4</td><td>91.4</td><td>83.0</td><td>83.1</td><td>79.4</td><td>87.2</td><td>82.1</td><td>90.8</td><td>91.6</td><td>87.4</td><td>84.8</td><td>87.2</td><td>91.7</td><td>89.9</td></tr></table>
|
| 160 |
+
|
| 161 |
+
Performance Breakdown Table 8 shows the test F1 scores on each entity type of ACE2005 and GENIA. We report four types of F1 scores: $\mathrm { S - F 1 _ { \mathrm { s p a n } } }$ is the strict F1 based on the exact match of entity spans; $\mathrm { S } { \mathrm { - F } } 1 _ { \mathrm { s t a r t } }$ is the strict F1 based on the exact match of entity start words; $\mathrm { S - F 1 _ { e n d } }$ is the strict F1 based on the exact match of entity end words; $\mathrm { L } { \mathrm { - F } } 1 _ { \mathrm { s p a n } }$ is the loose F1 allowing the partial match of entity spans. We notice that $\mathrm { S - F 1 _ { e n d } }$ is often substantially better than $\mathrm { S - F 1 _ { \mathrm { s p a n } } }$ and $\mathrm { \bf S } { - } \mathrm { \bf F } 1 _ { \mathrm { s t a r t } }$ To explain this difference, we go through these partially corrected predictions and summarize the common errors in Table 9. The most common one is the inclusion or exclusion of modifiers. This could be due to annotation disagreement: in ACE2005, sometimes generic spans are preferred (e.g., “tomcats” vs. “f-14 tomcats”), while in some cases specific spans are preferred (e.g., “cruise ship” vs. “ship”). This issue is more common in the biomedical dataset GENIA, e.g., “human GR” is considered
|
| 162 |
+
|
| 163 |
+
Table 9: Examples of common errors among the partially corrected predictions. Red indicates error spans. Blue indicates missing spans. The number after each span mean the span frequency in the training data.
|
| 164 |
+
|
| 165 |
+
<table><tr><td>Error Type</td><td>Ent. Type</td><td>Predicted ←Gold</td></tr><tr><td rowspan="2">Modifier Error</td><td>VEH FAC VEH CellL. Prot.</td><td>f-14 tomcats (O) ←→ tomcats (0) federal court (O) ←→court (0) ship (29) ←→cruise ship (1) unstimulated Tcells (O) ←→Tcells (553)</td></tr><tr><td>CellT.</td><td>human GR(O)←GR(88) lymphocytes(117) ←→ human lympho- cytes (18)</td></tr><tr><td>Missing Genitive</td><td>PER</td><td>E6 motif (O) ←→ synthetic E6 motif (0) attendant (3) ←→attendant's (0)</td></tr><tr><td rowspan="5">Annotation Error</td><td>PER</td><td>Dr.Germ (O) ←→Dr(1)/Germ (0)</td></tr><tr><td>Prot.</td><td>Ag amino acid sequence (O) ←→Ag (1)/ amino acid sequence (6)</td></tr><tr><td>CellL.</td><td>EBV-transformed human B cell line SKW6.4(O) ←→EBV-transformed hu-</td></tr><tr><td>DNA</td><td>man B cell line (O)/SKW6.4 (1) second-site LTR revertants (0) ↑ second-site LTR (O)</td></tr></table>
|
| 166 |
+
|
| 167 |
+
as wrong while “human lymphocytes” are correct, which explains the higher scores of $\mathrm { S - F 1 _ { e n d } }$ than $\mathrm { S } { \mathrm { - F } } 1 _ { \mathrm { s t a r t } }$ . Missing genitives for person names are another common errors in ACE2005. We also discover some annotation errors, where names of a single person, protein, or cell line are sometimes broken into two less meaningful spans, e.g., “Dr. Germ” is annotated as two person mentions “Dr”
|
| 168 |
+
|
| 169 |
+
and “Germ”, and “EBV-transformed human B cell line SKW6.4” is annotated as two separate cell lines “EBV-transformed human B cell line” and “SKW6.4”.
|
| 170 |
+
|
| 171 |
+
# 5 RELATED WORK
|
| 172 |
+
|
| 173 |
+
Supervised NER Early techniques for NER are based on hidden markov models (e.g., Zhou & Su, 2002) and conditional random fields (CRFs) (e.g., McDonald & Pereira 2005). However, due to the inability to handle nested named entities, techniques such as cascaded CRFs (Alex et al., 2007), adpated constituency parsing (Finkel & Manning, 2009), and hypergraphs (Lu & Roth, 2015) are developed for nested NER. More recently, with the advance in deep learning, a myriad of new techniques have been used in supervised NER. Depending on the way they formulate the task, these techniques can be categorized as NER as sequence labeling (Chiu & Nichols, 2016; Ma & Hovy, 2016; Katiyar & Cardie, 2018); NER as parsing (Lample et al., 2016; Yu et al., 2020); NER as span classification (Sohrab & Miwa, 2018; Xia et al., 2019; Ouchi et al., 2020; Fu et al., 2021); NER as a sequence-to-sequence problem (Strakova et al., 2019; Yan et al., 2021); and NER as machine ´ reading comprehension (Li et al., 2020; Mengge et al., 2020). Unlike previous work, we formulate NER as a contrastive learning problem. The span-based design of our bi-encoder and contrastive loss provides us with the flexibility to handle both nested and flat NER.
|
| 174 |
+
|
| 175 |
+
Distantly Supervised NER Distant supervision from external knowledge bases in conjunction with unlabeled text is generated by string matching (Giannakopoulos et al., 2017) or heuristic rules (Ren et al., 2015; Fries et al., 2017). Due to the limited coverage of external knowledge bases, distant supervision often has a high false negative rate. To alleviate this issue, Shang et al. (2018) design a new tagging scheme with an unknown tag specifically for false negatives; Mayhew et al. (2019) iteratively detect false negatives and downweigh them in training; Peng et al. (2019); Zhou et al. (2022) address overfitting to false negatives using Positive and Unlabeled (PU) learning; Zhang et al. (2021b) identify dictionary biases via a structural causal model, and de-bias them using causal interventions. Liu et al. (2021) introduce a calibrated confidence estimation method and integrate it into a self-training framework. Without replying on sophisticated de-noising designs, our bi-encoder framework can be directly used in distant supervision. Experiments in $\ S 3$ show the robustness of our contrastive learning algorithm to the noise in distantly supervised NER.
|
| 176 |
+
|
| 177 |
+
Bi-Encoder The use of bi-encoder dates back to Bromley et al. (1993) for signature verification and Chopra et al. (2005) for face verification. These works and their descendants (e.g., Yih et al., 2011; Hu et al., 2014) refer to the architecture as siamese networks since two similar inputs are encoded separately by two copies of the same network (all parameters are shared). Wsabie (Weston et al., 2010) and StarSpace (Wu et al., 2018) subsequently employ bi-encoder to learn embeddings for different data types. Using deep pretrained transformers as encoders, Humeau et al. (2019) compare three different architectures, bi-encoder, poly-encoder, and cross-encoder. The bi-encoder architecture afterwards has been use in various tasks, e.g., information retrieval (Huang et al., 2013; Gillick et al., 2018), open-domain question answering (Karpukhin et al., 2020), and entity linking (Gillick et al., 2019; Wu et al., 2020; Zhang et al., 2021a). To our best knowledge, there is no previous work learning bi-encoder for NER.
|
| 178 |
+
|
| 179 |
+
# 6 CONCLUSIONS
|
| 180 |
+
|
| 181 |
+
We present a bi-encoder framework for NER using contrastive learning, which separately maps text and entity types into the same vector space. To separate entity spans from non-entity ones, we introduce a novel contrastive loss to jointly learn span identification and entity classification. Experiments in both supervised and distantly supervised settings show the effectiveness and robustness of our method. We conduct extensive analysis to explain the success of our method and reveal growth opportunities. Future directions include further improving low-performing types and applications in self-supervised zero-shot settings.
|
| 182 |
+
|
| 183 |
+
# REFERENCES
|
| 184 |
+
|
| 185 |
+
Beatrice Alex, Barry Haddow, and Claire Grover. Recognising nested named entities in biomedical text. In Biological, translational, and clinical language processing, pp. 65–72, Prague, Czech Republic, June 2007. Association for Computational Linguistics. URL https:// aclanthology.org/W07-1009.
|
| 186 |
+
|
| 187 |
+
Rami Aly, Andreas Vlachos, and Ryan McDonald. Leveraging type descriptions for zero-shot named entity recognition and classification. 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. 1516–1528, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.120. URL https: //aclanthology.org/2021.acl-long.120.
|
| 188 |
+
|
| 189 |
+
Jane Bromley, Isabelle Guyon, Yann LeCun, Eduard Sackinger, and Roopak Shah. Signature verifi- ¨ cation using a” siamese” time delay neural network. Advances in neural information processing systems, 6, 1993.
|
| 190 |
+
|
| 191 |
+
Kai-Wei Chang, Rajhans Samdani, and Dan Roth. A constrained latent variable model for coreference resolution. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pp. 601–612, Seattle, Washington, USA, October 2013. Association for Computational Linguistics. URL https://aclanthology.org/D13-1057.
|
| 192 |
+
|
| 193 |
+
Jason P.C. Chiu and Eric Nichols. Named entity recognition with bidirectional LSTM-CNNs. Transactions of the Association for Computational Linguistics, 4:357–370, 2016. doi: 10.1162/ tacl a 00104. URL https://aclanthology.org/Q16-1026.
|
| 194 |
+
|
| 195 |
+
Yejin Choi, Eric Breck, and Claire Cardie. Joint extraction of entities and relations for opinion recognition. In Proceedings of the 2006 Conference on Empirical Methods in Natural Language Processing, pp. 431–439, Sydney, Australia, July 2006. Association for Computational Linguistics. URL https://aclanthology.org/W06-1651.
|
| 196 |
+
|
| 197 |
+
Sumit Chopra, Raia Hadsell, and Yann LeCun. Learning a similarity metric discriminatively, with application to face verification. In 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’05), volume 1, pp. 539–546. IEEE, 2005.
|
| 198 |
+
|
| 199 |
+
Nigel Collier and Jin-Dong Kim. Introduction to the bio-entity recognition task at JNLPBA. In Proceedings of the International Joint Workshop on Natural Language Processing in Biomedicine and its Applications (NLPBA/BioNLP), pp. 73–78, Geneva, Switzerland, August 28th and 29th 2004. COLING. URL https://aclanthology.org/W04-1213.
|
| 200 |
+
|
| 201 |
+
Leyang Cui, Yu Wu, Jian Liu, Sen Yang, and Yue Zhang. Template-based named entity recognition using BART. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pp. 1835–1845, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/ v1/2021.findings-acl.161. URL https://aclanthology.org/2021.findings-acl. 161.
|
| 202 |
+
|
| 203 |
+
Sarkar Snigdha Sarathi Das, Arzoo Katiyar, Rebecca Passonneau, and Rui Zhang. CONTaiNER: Few-shot named entity recognition via contrastive learning. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 6338– 6353, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/ 2022.acl-long.439. URL https://aclanthology.org/2022.acl-long.439.
|
| 204 |
+
|
| 205 |
+
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), pp. 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423. URL https: //aclanthology.org/N19-1423.
|
| 206 |
+
|
| 207 |
+
Ning Ding, Yulin Chen, Xu Han, Guangwei Xu, Pengjun Xie, Hai-Tao Zheng, Zhiyuan Liu, Juanzi Li, and Hong-Gee Kim. Prompt-learning for fine-grained entity typing. arXiv preprint arXiv:2108.10604, 2021.
|
| 208 |
+
|
| 209 |
+
Rezarta Islamaj Dogan, Robert Leaman, and Zhiyong Lu. Special report: Ncbi disease corpus: A ˘ resource for disease name recognition and concept normalization. J. of Biomedical Informatics, 47:1–10, feb 2014. ISSN 1532-0464.
|
| 210 |
+
|
| 211 |
+
Gamaleldin Elsayed, Dilip Krishnan, Hossein Mobahi, Kevin Regan, and Samy Bengio. Large margin deep networks for classification. Advances in neural information processing systems, 31, 2018.
|
| 212 |
+
|
| 213 |
+
Jenny Rose Finkel and Christopher D. Manning. Nested named entity recognition. In Proceedings of the 2009 Conference on Empirical Methods in Natural Language Processing, pp. 141–150, Singapore, August 2009. Association for Computational Linguistics. URL https: //aclanthology.org/D09-1015.
|
| 214 |
+
|
| 215 |
+
Jason Fries, Sen Wu, Alex Ratner, and Christopher Re. Swellshark: A generative model for biomed-´ ical named entity recognition without labeled data. arXiv preprint arXiv:1704.06360, 2017.
|
| 216 |
+
|
| 217 |
+
Jinlan Fu, Xuanjing Huang, and Pengfei Liu. SpanNER: Named entity re-/recognition as span prediction. 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. 7183–7195, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.558. URL https://aclanthology.org/2021. acl-long.558.
|
| 218 |
+
|
| 219 |
+
Athanasios Giannakopoulos, Claudiu Musat, Andreea Hossmann, and Michael Baeriswyl. Unsupervised aspect term extraction with B-LSTM & CRF using automatically labelled datasets. In Proceedings of the 8th Workshop on Computational Approaches to Subjectivity, Sentiment and Social Media Analysis, pp. 180–188, Copenhagen, Denmark, September 2017. Association for Computational Linguistics. doi: 10.18653/v1/W17-5224. URL https://aclanthology. org/W17-5224.
|
| 220 |
+
|
| 221 |
+
Daniel Gillick, Alessandro Presta, and Gaurav Singh Tomar. End-to-end retrieval in continuous space. arXiv preprint arXiv:1811.08008, 2018.
|
| 222 |
+
|
| 223 |
+
Daniel Gillick, Sayali Kulkarni, Larry Lansing, Alessandro Presta, Jason Baldridge, Eugene Ie, and Diego Garcia-Olano. Learning dense representations for entity retrieval. In Proceedings of the 23rd Conference on Computational Natural Language Learning (CoNLL), pp. 528–537, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/ K19-1049. URL https://aclanthology.org/K19-1049.
|
| 224 |
+
|
| 225 |
+
Yu Gu, Robert Tinn, Hao Cheng, Michael Lucas, Naoto Usuyama, Xiaodong Liu, Tristan Naumann, Jianfeng Gao, and Hoifung Poon. Domain-specific language model pretraining for biomedical natural language processing. ACM Transactions on Computing for Healthcare (HEALTH), 3(1): 1–23, 2021.
|
| 226 |
+
|
| 227 |
+
Tao Gui, Jiacheng Ye, Qi Zhang, Zhengyan Li, Zichu Fei, Yeyun Gong, and Xuanjing Huang. Uncertainty-aware label refinement for sequence labeling. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 2316–2326, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main. 181. URL https://aclanthology.org/2020.emnlp-main.181.
|
| 228 |
+
|
| 229 |
+
Baotian Hu, Zhengdong Lu, Hang Li, and Qingcai Chen. Convolutional neural network architectures for matching natural language sentences. Advances in neural information processing systems, 27, 2014.
|
| 230 |
+
|
| 231 |
+
Po-Sen Huang, Xiaodong He, Jianfeng Gao, Li Deng, Alex Acero, and Larry Heck. Learning deep structured semantic models for web search using clickthrough data. In Proceedings of the 22nd ACM International Conference on Information & Knowledge Management, CIKM ’13, pp. 2333–2338, New York, NY, USA, 2013. Association for Computing Machinery. ISBN 9781450322638. doi: 10.1145/2505515.2505665. URL https://doi.org/10.1145/ 2505515.2505665.
|
| 232 |
+
|
| 233 |
+
Samuel Humeau, Kurt Shuster, Marie-Anne Lachaux, and Jason Weston. Poly-encoders: Architectures and pre-training strategies for fast and accurate multi-sentence scoring. In International Conference on Learning Representations, 2019.
|
| 234 |
+
|
| 235 |
+
Kamal raj Kanakarajan, Bhuvana Kundumani, and Malaikannan Sankarasubbu. BioELECTRA:pretrained biomedical text encoder using discriminators. In Proceedings of the 20th Workshop on Biomedical Language Processing, pp. 143–154, Online, June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.bionlp-1.16. URL https://aclanthology. org/2021.bionlp-1.16.
|
| 236 |
+
|
| 237 |
+
Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. Dense passage retrieval for open-domain question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 6769–6781, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.550. URL https://aclanthology.org/2020. emnlp-main.550.
|
| 238 |
+
|
| 239 |
+
Arzoo Katiyar and Claire Cardie. Nested named entity recognition revisited. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 861–871, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-1079. URL https://aclanthology.org/N18-1079.
|
| 240 |
+
|
| 241 |
+
Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. Supervised contrastive learning. Advances in Neural Information Processing Systems, 33:18661–18673, 2020.
|
| 242 |
+
|
| 243 |
+
J-D Kim, Tomoko Ohta, Yuka Tateisi, and Jun’ichi Tsujii. Genia corpus—a semantically annotated corpus for bio-textmining. Bioinformatics, 19(suppl 1):i180–i182, 2003.
|
| 244 |
+
|
| 245 |
+
Guillaume Lample, Miguel Ballesteros, Sandeep Subramanian, Kazuya Kawakami, and Chris Dyer. Neural architectures for named entity recognition. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 260–270, San Diego, California, June 2016. Association for Computational Linguistics. doi: 10.18653/v1/N16-1030. URL https://aclanthology.org/N16-1030.
|
| 246 |
+
|
| 247 |
+
Jinhyuk Lee, Wonjin Yoon, Sungdong Kim, Donghyeon Kim, Sunkyu Kim, Chan Ho So, and Jaewoo Kang. BioBERT: a pre-trained biomedical language representation model for biomedical text mining. Bioinformatics, 36(4):1234–1240, 09 2019. ISSN 1367-4803. doi: 10.1093/bioinformatics/btz682. URL https://doi.org/10.1093/bioinformatics/ btz682.
|
| 248 |
+
|
| 249 |
+
Jiao Li, Yueping Sun, Robin J Johnson, Daniela Sciaky, Chih-Hsuan Wei, Robert Leaman, Allan Peter Davis, Carolyn J Mattingly, Thomas C Wiegers, and Zhiyong Lu. Biocreative v cdr task corpus: a resource for chemical disease relation extraction. Database, 2016, 2016.
|
| 250 |
+
|
| 251 |
+
Xiaoya Li, Jingrong Feng, Yuxian Meng, Qinghong Han, Fei Wu, and Jiwei Li. A unified MRC framework for named entity recognition. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 5849–5859, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.519. URL https: //aclanthology.org/2020.acl-main.519.
|
| 252 |
+
|
| 253 |
+
Chen Liang, Yue Yu, Haoming Jiang, Siawpeng Er, Ruijia Wang, Tuo Zhao, and Chao Zhang. Bond: Bert-assisted open-domain named entity recognition with distant supervision. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, KDD ’20, pp. 1054–1064, New York, NY, USA, 2020. Association for Computing Machinery. ISBN 9781450379984. doi: 10.1145/3394486.3403149. URL https: //doi.org/10.1145/3394486.3403149.
|
| 254 |
+
|
| 255 |
+
Kun Liu, Yao Fu, Chuanqi Tan, Mosha Chen, Ningyu Zhang, Songfang Huang, and Sheng Gao. Noisy-labeled NER with confidence estimation. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 3437–3445, Online, June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.naacl-main.269. URL https://aclanthology.org/2021. naacl-main.269.
|
| 256 |
+
|
| 257 |
+
Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
|
| 258 |
+
|
| 259 |
+
Wei Lu and Dan Roth. Joint mention extraction and classification with mention hypergraphs. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 857–867, Lisbon, Portugal, September 2015. Association for Computational Linguistics. doi: 10.18653/v1/D15-1102. URL https://aclanthology.org/D15-1102.
|
| 260 |
+
|
| 261 |
+
Yi Luan, Luheng He, Mari Ostendorf, and Hannaneh Hajishirzi. Multi-task identification of entities, relations, and coreference for scientific knowledge graph construction. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 3219–3232, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/ v1/D18-1360. URL https://aclanthology.org/D18-1360.
|
| 262 |
+
|
| 263 |
+
Ruotian Ma, Xin Zhou, Tao Gui, Yiding Tan, Linyang Li, Qi Zhang, and Xuanjing Huang. Templatefree prompt tuning for few-shot NER. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 5721–5732, Seattle, United States, July 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.naacl-main.420. URL https://aclanthology.org/2022. naacl-main.420.
|
| 264 |
+
|
| 265 |
+
Xuezhe Ma and Eduard Hovy. End-to-end sequence labeling via bi-directional LSTM-CNNs-CRF. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1064–1074, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1101. URL https://aclanthology.org/ P16-1101.
|
| 266 |
+
|
| 267 |
+
Stephen Mayhew, Snigdha Chaturvedi, Chen-Tse Tsai, and Dan Roth. Named entity recognition with partially annotated training data. In Proceedings of the 23rd Conference on Computational Natural Language Learning (CoNLL), pp. 645–655, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/K19-1060. URL https://aclanthology.org/K19-1060.
|
| 268 |
+
|
| 269 |
+
Ryan McDonald and Fernando Pereira. Identifying gene and protein mentions in text using conditional random fields. BMC bioinformatics, 6(1):1–7, 2005.
|
| 270 |
+
|
| 271 |
+
Xue Mengge, Bowen Yu, Zhenyu Zhang, Tingwen Liu, Yue Zhang, and Bin Wang. Coarse-toFine Pre-training for Named Entity Recognition. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 6345–6354, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.514. URL https://aclanthology.org/2020.emnlp-main.514.
|
| 272 |
+
|
| 273 |
+
Mike Mintz, Steven Bills, Rion Snow, and Daniel Jurafsky. Distant supervision for relation extraction without labeled data. In Proceedings of the Joint Conference of the 47th Annual Meeting of the ACL and the 4th International Joint Conference on Natural Language Processing of the AFNLP, pp. 1003–1011, Suntec, Singapore, August 2009. Association for Computational Linguistics. URL https://aclanthology.org/P09-1113.
|
| 274 |
+
|
| 275 |
+
David Nadeau and Satoshi Sekine. A survey of named entity recognition and classification. Lingvisticae Investigationes, 30(1):3–26, 2007.
|
| 276 |
+
|
| 277 |
+
Farhad Nooralahzadeh, Jan Tore Lønning, and Lilja Øvrelid. Reinforcement-based denoising of distantly supervised NER with partial annotation. In Proceedings of the 2nd Workshop on Deep Learning Approaches for Low-Resource NLP (DeepLo 2019), pp. 225–233, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-6125. URL https://aclanthology.org/D19-6125.
|
| 278 |
+
|
| 279 |
+
Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
|
| 280 |
+
|
| 281 |
+
Hiroki Ouchi, Jun Suzuki, Sosuke Kobayashi, Sho Yokoi, Tatsuki Kuribayashi, Ryuto Konno, and Kentaro Inui. Instance-based learning of span representations: A case study through named entity recognition. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 6452–6459, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.575. URL https://aclanthology.org/2020. acl-main.575.
|
| 282 |
+
|
| 283 |
+
Minlong Peng, Xiaoyu Xing, Qi Zhang, Jinlan Fu, and Xuanjing Huang. Distantly supervised named entity recognition using positive-unlabeled learning. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2409–2419, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1231. URL https: //aclanthology.org/P19-1231.
|
| 284 |
+
|
| 285 |
+
Xiang Ren, Ahmed El-Kishky, Chi Wang, Fangbo Tao, Clare R Voss, and Jiawei Han. Clustype: Effective entity recognition and typing by relation phrase-based clustering. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 995–1004. ACM, 2015.
|
| 286 |
+
|
| 287 |
+
Jingbo Shang, Liyuan Liu, Xiaotao Gu, Xiang Ren, Teng Ren, and Jiawei Han. Learning named entity tagger using domain-specific dictionary. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 2054–2064, Brussels, Belgium, OctoberNovember 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1230. URL https://aclanthology.org/D18-1230.
|
| 288 |
+
|
| 289 |
+
Takashi Shibuya and Eduard Hovy. Nested Named Entity Recognition via Second-best Sequence Learning and Decoding. Transactions of the Association for Computational Linguistics, 8:605– 620, 09 2020. ISSN 2307-387X. doi: 10.1162/tacl a 00334. URL https://doi.org/10. 1162/tacl_a_00334.
|
| 290 |
+
|
| 291 |
+
Larry Smith, Lorraine K Tanabe, Cheng-Ju Kuo, I Chung, Chun-Nan Hsu, Yu-Shi Lin, Roman Klinger, Christoph M Friedrich, Kuzman Ganchev, Manabu Torii, et al. Overview of biocreative ii gene mention recognition. Genome biology, 9(2):1–19, 2008.
|
| 292 |
+
|
| 293 |
+
Mohammad Golam Sohrab and Makoto Miwa. Deep exhaustive model for nested named entity recognition. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 2843–2849, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1309. URL https://aclanthology.org/ D18-1309.
|
| 294 |
+
|
| 295 |
+
Jana Strakova, Milan Straka, and Jan Hajic. Neural architectures for nested NER through lineariza- ´ tion. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 5326–5331, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1527. URL https://aclanthology.org/P19-1527.
|
| 296 |
+
|
| 297 |
+
Sainbayar Sukhbaatar, Joan Bruna, Manohar Paluri, Lubomir Bourdev, and Rob Fergus. Training convolutional networks with noisy labels. arXiv preprint arXiv:1406.2080, 2014.
|
| 298 |
+
|
| 299 |
+
Zeqi Tan, Yongliang Shen, Shuai Zhang, Weiming Lu, and Yueting Zhuang. A sequence-to-set network for nested named entity recognition. In Proceedings of the 30th International Joint Conference on Artificial Intelligence, IJCAI-21, 2021. URL https://arxiv.org/abs/ 2105.08901.
|
| 300 |
+
|
| 301 |
+
Erik F. Tjong Kim Sang and Fien De Meulder. Introduction to the CoNLL-2003 shared task: Language-independent named entity recognition. In Proceedings of the Seventh Conference on Natural Language Learning at HLT-NAACL 2003, pp. 142–147, 2003. URL https: //aclanthology.org/W03-0419.
|
| 302 |
+
|
| 303 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In
|
| 304 |
+
|
| 305 |
+
Proc. Advances in Neural Information Processing Systems (NeurIPS), volume 30, 2017. URL https://proceedings.neurips.cc/paper/2017/file/ 3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf.
|
| 306 |
+
|
| 307 |
+
Juncheng Wan, Dongyu Ru, Weinan Zhang, and Yong Yu. Nested named entity recognition with span-level graphs. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 892–903, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.63. URL https: //aclanthology.org/2022.acl-long.63.
|
| 308 |
+
|
| 309 |
+
Jue Wang, Lidan Shou, Ke Chen, and Gang Chen. Pyramid: A layered model for nested named entity recognition. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 5918–5928, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.525. URL https://aclanthology.org/2020. acl-main.525.
|
| 310 |
+
|
| 311 |
+
Xinyu Wang, Yong Jiang, Nguyen Bach, Tao Wang, Zhongqiang Huang, Fei Huang, and Kewei Tu. Improving named entity recognition by external context retrieving and cooperative learning. 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. 1800–1812, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/ v1/2021.acl-long.142. URL https://aclanthology.org/2021.acl-long.142.
|
| 312 |
+
|
| 313 |
+
Jason Weston, Samy Bengio, and Nicolas Usunier. Large scale image annotation: learning to rank with joint word-image embeddings. Machine learning, 81(1):21–35, 2010.
|
| 314 |
+
|
| 315 |
+
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 Rush. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 38–45, Online, October 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-demos.6. URL https: //aclanthology.org/2020.emnlp-demos.6.
|
| 316 |
+
|
| 317 |
+
Ledell Wu, Adam Fisch, Sumit Chopra, Keith Adams, Antoine Bordes, and Jason Weston. Starspace: Embed all the things! In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
|
| 318 |
+
|
| 319 |
+
Ledell Wu, Fabio Petroni, Martin Josifoski, Sebastian Riedel, and Luke Zettlemoyer. Scalable zero-shot entity linking with dense entity retrieval. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 6397–6407, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.519. URL https://aclanthology.org/2020.emnlp-main.519.
|
| 320 |
+
|
| 321 |
+
Congying Xia, Chenwei Zhang, Tao Yang, Yaliang Li, Nan Du, Xian Wu, Wei Fan, Fenglong Ma, and Philip Yu. Multi-grained named entity recognition. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 1430–1440, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1138. URL https://aclanthology.org/P19-1138.
|
| 322 |
+
|
| 323 |
+
Hang Yan, Tao Gui, Junqi Dai, Qipeng Guo, Zheng Zhang, and Xipeng Qiu. A unified generative framework for various NER subtasks. 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. 5808–5822, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.451. URL https://aclanthology.org/2021.acl-long.451.
|
| 324 |
+
|
| 325 |
+
Jie Yang, Shuailong Liang, and Yue Zhang. Design challenges and misconceptions in neural sequence labeling. In Proceedings of the 27th International Conference on Computational Linguistics, pp. 3879–3889, Santa Fe, New Mexico, USA, August 2018. Association for Computational Linguistics. URL https://aclanthology.org/C18-1327.
|
| 326 |
+
|
| 327 |
+
Michihiro Yasunaga, Jure Leskovec, and Percy Liang. LinkBERT: Pretraining language models with document links. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 8003–8016, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.551. URL https://aclanthology.org/2022.acl-long.551.
|
| 328 |
+
|
| 329 |
+
Wen-tau Yih, Kristina Toutanova, John C. Platt, and Christopher Meek. Learning discriminative projections for text similarity measures. In Proceedings of the Fifteenth Conference on Computational Natural Language Learning, pp. 247–256, Portland, Oregon, USA, June 2011. Association for Computational Linguistics. URL https://aclanthology.org/W11-0329.
|
| 330 |
+
|
| 331 |
+
Juntao Yu, Bernd Bohnet, and Massimo Poesio. Named entity recognition as dependency parsing. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 6470–6476, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/ 2020.acl-main.577. URL https://aclanthology.org/2020.acl-main.577.
|
| 332 |
+
|
| 333 |
+
Sheng Zhang, Hao Cheng, Shikhar Vashishth, Cliff Wong, Jinfeng Xiao, Xiaodong Liu, Tristan Naumann, Jianfeng Gao, and Hoifung Poon. Knowledge-rich self-supervised entity linking. arXiv preprint arXiv:2112.07887, 2021a.
|
| 334 |
+
|
| 335 |
+
Shuai Zhang, Yongliang Shen, Zeqi Tan, Yiquan Wu, and Weiming Lu. De-bias for generative extraction in unified NER task. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 808–818, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.59. URL https: //aclanthology.org/2022.acl-long.59.
|
| 336 |
+
|
| 337 |
+
Wenkai Zhang, Hongyu Lin, Xianpei Han, and Le Sun. De-biasing distantly supervised named entity recognition via causal intervention. 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. 4803–4813, Online, August 2021b. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.371. URL https: //aclanthology.org/2021.acl-long.371.
|
| 338 |
+
|
| 339 |
+
Zhilu Zhang and Mert Sabuncu. Generalized cross entropy loss for training deep neural networks with noisy labels. Advances in neural information processing systems, 31, 2018.
|
| 340 |
+
|
| 341 |
+
GuoDong Zhou and Jian Su. Named entity recognition using an HMM-based chunk tagger. In Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics, pp. 473–480, Philadelphia, Pennsylvania, USA, July 2002. Association for Computational Linguistics. doi: 10.3115/1073083.1073163. URL https://aclanthology.org/P02-1060.
|
| 342 |
+
|
| 343 |
+
Kang Zhou, Yuepei Li, and Qi Li. Distantly supervised named entity recognition via confidencebased multi-class positive and unlabeled learning. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 7198–7211, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long. 498. URL https://aclanthology.org/2022.acl-long.498.
|
| 344 |
+
|
| 345 |
+
# A APPENDIX
|
| 346 |
+
|
| 347 |
+
# A.1 COMPARISON WITH PROMPT-BASED LEARNING
|
| 348 |
+
|
| 349 |
+
Prompt-based learning emerges as a powerful method in few-shot NER (Cui et al., 2021; Ma et al., 2022; Ding et al., 2021). Below, we compare BINDER with Tempalte BART (Cui et al., 2021), a representative prompt-based learning method:
|
| 350 |
+
|
| 351 |
+
Method Difference Cui et al. (2021) follows an encoder-decoder framework. Given a text span, it decodes and selects among all possible templates including none-entity templates. Their candidates are templates based on a static set of entity types. In contrast, BINDER is to given an entity type select among all possible text spans. The candidates are a dynamic set of text spans, which are different for different input documents. The size of candidates is much larger – $\mathcal { O } ( L ^ { 2 } )$ , where $L$ is the max seq length, set to 256 in our experiments.
|
| 352 |
+
|
| 353 |
+
Loss Difference Cui et al. (2021) uses cross-entropy to maximize the likelihood of gold entity type template against templates of other entity types. In comparison, BINDER uses contrastive learning, given an entity type, to maximize the similarity of gold text spans against other text spans. Instead of comparing entity types, BINDER compares all possible text spans from an input document. It captures subtleties of each text span via contrastive learning. As shown in previous work, instancebased contrastive learning has better generalization performance than cross-entropy loss (Khosla et al., 2020), due to its robustness to noisy labels (Zhang & Sabuncu, 2018; Sukhbaatar et al., 2014) and the possibility of better margins (Elsayed et al., 2018). To our best knowledge, we are the first to demonstrate BINDER with contrastive loss (among text spans) significantly cross-entropy loss (among entity types/templates), in both supervised settings (see Table 1 and Table 2) and distantly supervised settings (see Table 3).
|
| 354 |
+
|
| 355 |
+
Non-entity Handling Difference Cui et al. (2021) labels all non-entity spans with non-entity templates. This can introduce false negatives when the training data is partially annotated (Das et al., 2022; Aly et al., 2021). Our formulation allows us to avoid using an explicit non-entity class, and instead to introduce a dynamic threshold based on the input document and the entity type, to distinguish entity spans from non-entity spans. Our experiments show a clear advantage of dynamic thresholding over explicit non-entity labeling scheme.
|
| 356 |
+
|
| 357 |
+
Computational Efficiency The encoder-decoder framework used by Cui et al. (2021) has much lower computational efficiency. First, it has double parameter size compared to BINDER (which is encoder-only). Second, both its training and inference time are significantly slower than BINDER. Because the decoding process relies on cross-attention from decoder to encoder, their method has to decode all possible templates for each input document. The number of templates $N _ { \mathrm { t e m p l a t e s } } =$ $N _ { \mathrm { t e x t s p a n s } } \times N _ { \mathrm { e n t i t y t y p e s } }$ . And the overall the decoding operations are $\mathcal { O } ( N _ { \mathrm { d o c u m e n t s } } \times N _ { \mathrm { t e x t s p a n s } } \times$ $N _ { \mathrm { e n t i t y } \mathrm { t y p e s } } )$ . Furthermore, the decoding process has to be done in an autoregressive manner, which even reduces the time efficiency. In comparison, BINDER employs a bi-encoder framework. It separately encodes entity types and input documents. Encoding entity types does not rely on input documents. At test time, it only needs to encode entity types once, and then re-use them to for NER of different input documents. Encoding entity types is only $\mathcal { O } ( N _ { \mathrm { e n t i t y } \mathrm { t y p e s } } )$ , and can be done very efficiently in parallel on GPU.
|
| 358 |
+
|
| 359 |
+
Performance on CoNLL03 To make a direct comparison with Cui et al. (2021), we train and evaluate BINDER on CoNLL03 (Tjong Kim Sang & De Meulder, 2003). Table 10 reports the test results. BINDER outperforms Template BART as well as other strong baselines.
|
| 360 |
+
|
| 361 |
+
Table 10: Test scores on CoNLL03.
|
| 362 |
+
|
| 363 |
+
<table><tr><td></td><td colspan="3">CoNLL03</td></tr><tr><td></td><td>P</td><td>R</td><td>F1</td></tr><tr><td>Yang et al. (2018)</td><td></td><td>-</td><td>90.77</td></tr><tr><td>Ma & Hovy (2016)</td><td></td><td></td><td>91.21</td></tr><tr><td>Gui et al. (2020)</td><td></td><td>=</td><td>92.02</td></tr><tr><td>Template BART (Cui et al., 2021)</td><td>91.72</td><td>93.40</td><td>92.55</td></tr><tr><td>BINDER</td><td>93.08</td><td>93.57</td><td>93.33</td></tr></table>
|
| 364 |
+
|
| 365 |
+
# A.2 COMPARISON WITH SPAN-BASED NER
|
| 366 |
+
|
| 367 |
+
We highlight the difference between our method (BINDER) and span-based NER below:
|
| 368 |
+
|
| 369 |
+
Formulation Difference In span-based NER, it is to given a text span select among all entity types. The candidates are a static set of entity types, the size of which is usually small (e.g., PER, ORG, LOC, MISC). In contrast, BINDER formulates NER as given an entity type to select among all possible text spans of an input document. The candidates are a dynamic set of text spans, which are different for different input documents. The size of candidates is much larger – $\mathcal { O } ( \dot { L } ^ { 2 } )$ , where $L$ is the max seq length, set to 256 in our experiments.
|
| 370 |
+
|
| 371 |
+
Loss Difference Span-based NER uses cross-entropy to maximize the likelihood of gold entity type template against templates of other entity types. In comparison, BINDER uses contrastive learning, given an entity type, to maximize the similarity of gold text spans against other text spans. Instead of comparing entity types, BINDER compares all possible text spans from an input document. It captures subtleties of each text span via contrastive learning. As shown in previous work, instancebased contrastive learning has better generalization performance than cross-entropy loss (Khosla et al., 2020), due to its robustness to noisy labels (Zhang & Sabuncu, 2018; Sukhbaatar et al., 2014) and the possibility of better margins (Elsayed et al., 2018). To our best knowledge, we are the first to demonstrate BINDER with contrastive loss (among text spans) significantly cross-entropy loss (among entity types), in both supervised settings (see Table 1 and Table 2) and distantly supervised settings (see Table 3).
|
| 372 |
+
|
| 373 |
+
Non-entity Handling Difference Span-based NER labels all non-entity tokens or spans with the same class Outside (O). This can introduce false negatives when the training data is partially annotated (Das et al., 2022; Aly et al., 2021). Our formulation allows us to avoid using an explicit non-entity class, and instead to introduce a dynamic threshold based on the input document and the entity type, to distinguish entity spans from non-entity spans. Our experiments show a clear advantage of dynamic thresholding over traditional explicit O labeling scheme.
|
| 374 |
+
|
| 375 |
+
# A.3 IMPACT OF MAXIMUM SEQUENCE LENGTH
|
| 376 |
+
|
| 377 |
+
In our experiments, we set the maximum sequence length $L$ to 256, meaning that the number of candidate spans is $\mathcal { O } ( L ^ { 2 } )$ . Speed comparison in Table 7 is made based on $L = 2 5 6$ . We also experimented with smaller numbers of $L$ (e.g., 64, 128), which resulted in better speed but a slight performance degradation. Increasing $L$ did not bring significant gain but increased memory consumption. Therefore, in the experiments, we set $L$ to 256.
|
| 378 |
+
|
| 379 |
+
# A.4 IMPLEMENTATION DETAILS
|
| 380 |
+
|
| 381 |
+
We implement our models based on the HuggingFace Transformers library (Wolf et al., 2020). The base encoders are initialized using PubMedBERT-base-uncased (Gu et al., 2021) or BioBERT (Lee et al., 2019) for biomedical NER datasets, and BERT-base-uncased or BERT-large-uncased (Devlin et al., 2019) for NER datasets in the general domains. The linear layer output size is 128; the width embedding size is 128; the initial temperatures are 0.07. We train our models with the AdamW optimizer (Loshchilov & Hutter, 2017) of a linear scheduler and dropout of 0.1. The entity start/end/span contrastive loss weights are set to $\alpha = 0 . 2 , \gamma = 0 . 2 , \lambda = 0 . 6$ , and the same loss weights are chosen for thresholding contrastive learning. The contrastive losses for thresholding and entity are weighted equally in the final loss. For all experiments, we ignore sentence boundaries, and tokenize and split text into sequences with a stride of 16. For base encoders, we train our models for 20 epochs with a learning rate of 3e-5 and a batch size of 8 sequences with the maximum token length of $N = 1 2 8$ . For large encoders, we train our models for 40 epochs with a learning rate of 3e-5 and a batch size of 16 sequences with the maximum token length of $N = 2 5 6$ . The maximum token length for entity spans is set to 30. We use early stop with a patience of 10 in the distantly supervised setting. Validation is done at every 50 steps of training, and we adopt the models that have the best performance on the development set. We report the median score of multiple runs.
|
| 382 |
+
|
| 383 |
+
# A.5 INFERENCE FOR BINDER
|
| 384 |
+
|
| 385 |
+
As we can see in Algorithm 1, the difference between joint position-span and span-only strategies is whether line 9 is used. Also, for flat NER datasets, we further carry out a post-processing step to remove overlapping predictions (line 19 in Algorithm 1). Here, the post-processing (removeOverlap) is carried out in a greedy fashion where higher scored span predictions with earlier start and end positions are preferred.
|
| 386 |
+
|
| 387 |
+
# Algorithm 1: Inference for BINDER.
|
| 388 |
+
|
| 389 |
+
Input: $\begin{array} { r } { S = \{ ( i , j ) | i , j = 1 , \dots , N , 0 \leq j - i \leq L \} } \end{array}$ the set of spans , $\mathcal { E } = \{ E _ { 1 } , \ldots , E _ { K } \}$ the set of entity types, joint for whether using joint position-span inference, and flat for whether the inference is for flat NER. $M = \{ \}$ ; for $E _ { k } \in \mathcal { E }$ do
|
| 390 |
+
4 compute start/end/span threshold scores $b _ { n u l l } , e _ { n u l l } , s _ { n u l l }$ .
|
| 391 |
+
6 for $( i , j ) \in S$ do compute start/end/span similarity scores $b , e , s$ .
|
| 392 |
+
9 if joint is true and $b < b _ { n u l l }$ or $e < e _ { n u l l }$ then Continue; end
|
| 393 |
+
13 if $s > s _ { n u l l }$ then $M = M \cup \{ ( i , j , E _ { k } ) \}$ ; end end end
|
| 394 |
+
19 if flat is true then return removeOverlap $( M )$ ); end return $M$ ; Function removeOverlap $( \hat { D } )$ : $\hat { M } = \{ \}$ ; sort $\hat { D }$ by the similarity score in descending order and break the tie by ascending in start and end positions; for $( i , j , E _ { k } )$ in $\hat { D }$ do if span $( i , j )$ has no overlap in $\hat { M }$ then $\hat { M } = \hat { M } \cup \{ ( i , j , E _ { k } ) \}$ ; end end return $\hat { M }$ ;
|
| 395 |
+
|
| 396 |
+
# A.6 STATISTICS OF DATASETS
|
| 397 |
+
|
| 398 |
+
Table 11 reports the statistics of supervised NER datasets.
|
| 399 |
+
|
| 400 |
+
Table 11: The statistics of supervised NER datasets.
|
| 401 |
+
|
| 402 |
+
<table><tr><td rowspan="2">Dataset</td><td rowspan="2">|</td><td colspan="3"># Annotations</td></tr><tr><td>Train</td><td>Dev</td><td>Test</td></tr><tr><td>ACE2004</td><td>7</td><td>22,735 (5-fold)</td><td></td><td></td></tr><tr><td>ACE2005</td><td>7</td><td>26,473</td><td>6.338</td><td>5,476</td></tr><tr><td>GENIA</td><td>5</td><td>46,142</td><td>4,367</td><td>5,506</td></tr><tr><td>BC5-chem</td><td>1</td><td>5,203</td><td>5,347</td><td>5,385</td></tr><tr><td>BC5-disease</td><td>1</td><td>4,182</td><td>4,244</td><td>4,424</td></tr><tr><td>NCBI</td><td>1</td><td>5,134</td><td>787</td><td>960</td></tr><tr><td>BC2GM</td><td>1</td><td>15,197</td><td>3,061</td><td>6,325</td></tr><tr><td>JNLPBA</td><td>1</td><td>46,750</td><td>4,551</td><td>8,662</td></tr></table>
|
| 403 |
+
|
| 404 |
+
# A.7 DISTRIBUTIONS OF SIMILARITY SCORES
|
| 405 |
+
|
| 406 |
+
Figure 2 visualizes the distributions of similarity scores between different text spans and entity types based on different thresholding strategies. Consistent with the scores in Table 6, the majority of entity spans and non-entity spans are separable regardless of the thresholding strategy. This is true even when no thresholds are used during training and instead we tune global thresholds on dev.
|
| 407 |
+
|
| 408 |
+

|
| 409 |
+
Figure 2: The kernel density estimation of similarity scores between different text spans (entity, non-entity, and threshold spans) and entity types (PER, ORG, GPE) on ACE2005 based on different thresholding strategies.
|
| 410 |
+
|
| 411 |
+
We zoom in the distributions in Figure 3 and observe that the learned global thresholds tend to make the similarities less separable between entity spans and non-entity spans.
|
| 412 |
+
|
| 413 |
+

|
| 414 |
+
Figure 3: Zoom-in of the kernel density estimation of similarity scores in Figure 2, with the $y$ -axis density limited to (0, 0.1).
|
md/dev/AhccnBXSne/AhccnBXSne.md
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# VideoMAE: Masked Autoencoders are Data-Efficient Learners for Self-Supervised Video Pre-Training
|
| 2 |
+
|
| 3 |
+
Zhan Tong 1,2∗ Yibing Song 2 Jue Wang 2 Limin Wang 1,3† 1State Key Laboratory for Novel Software Technology, Nanjing University 2Tencent AI Lab 3Shanghai AI Lab tongzhan@smail.nju.edu.cn {yibingsong.cv, arphid}@gmail.com lmwang@nju.edu.cn
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Pre-training video transformers on extra large-scale datasets is generally required to achieve premier performance on relatively small datasets. In this paper, we show that video masked autoencoders (VideoMAE) are data-efficient learners for self-supervised video pre-training (SSVP). We are inspired by the recent ImageMAE [30] and propose customized video tube masking with an extremely high ratio. This simple design makes video reconstruction a more challenging and meaningful self-supervision task, thus encouraging extracting more effective video representations during the pre-training process. We obtain three important findings with VideoMAE: (1) An extremely high proportion of masking ratio (i.e., $9 0 \%$ to $9 5 \%$ ) still yields favorable performance for VideoMAE. The temporally redundant video content enables higher masking ratio than that of images. (2) VideoMAE achieves impressive results on very small datasets (i.e., around $3 \mathrm { k } { - } 4 \mathrm { k }$ videos) without using any extra data. This is partially ascribed to the challenging task of video reconstruction to enforce high-level structure learning. (3) VideoMAE shows that data quality is more important than data quantity for SSVP. Domain shift between pre-training and target datasets is an important factor. Notably, our VideoMAE with the vanilla ViT backbone can achieve $8 7 . 4 \%$ on Kinects-400, $7 5 . 4 \%$ on SomethingSomething V2, $9 1 . 3 \%$ on UCF101, and $6 2 . 6 \%$ on HMDB51, without using any extra data. Code is available at https://github.com/MCG-NJU/VideoMAE.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Transformer [70] has brought significant progress in natural language processing [17, 7, 54]. The vision transformer [20] also improves a series of computer vision tasks including image classification [66, 88], object detection [8, 37], semantic segmentation [80], object tracking [13, 16], and video recognition [6, 3]. The multi-head self-attention upon linearly projected image/video tokens is capable of modeling global dependency among visual content either spatially or temporally. The inductive bias is effectively reduced via this flexible attention mechanism.
|
| 12 |
+
|
| 13 |
+
Training effective vision transformers (ViTs) typically necessitates large-scale supervised datasets. Initially, the pre-trained ViTs achieve favorable performance by using hundreds of millions of labeled images [20]. For video transformers [3, 6], they are usually derived from image-based transformers and heavily depend on the pre-trained models from large-scale image data (e.g., ImageNet [57]). Previous trials [3, 6] on training video transformers from scratch yield unsatisfied results (except for MViT [21] with a strong inductive bias). Therefore, the learned video transformers are naturally biased by image-based models, and it still remains a challenge that how to effectively and efficiently train a vanilla vision transformer on the video dataset itself without using any pre-trained model or extra image data. Moreover, the existing video datasets are relatively small compared with image datasets, which further increases the difficulty of training video transformers from scratch. Meanwhile, self-supervised learning has shown remarkable performance by using large-scale image datasets [14, 9]. The learned representations have outperformed the ones via supervised learning when being transferred to downstream tasks. It is expected that this self-supervised learning paradigm can provide a promising solution to address the challenge of training video transformers.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: VideoMAE performs the task of masking random cubes and reconstructing the missing ones with an asymmetric encoder-decoder architecture. Due to high redundancy and temporal correlation in videos, we present the customized design of tube masking with an extremely high ratio $90 \%$ to $9 5 \%$ ). This simple design enables us to create a more challenging and meaningful self-supervised task to make the learned representations capture more useful spatiotemporal structures.
|
| 17 |
+
|
| 18 |
+
Following the success of masked autoencoding in NLP [17] and images [30, 4], we present a new selfsupervised video pre-training (SSVP) method, termed as Video Masked Autoencoder (VideoMAE). Our VideoMAE inherits the simple pipeline of masking random cubes and reconstructing the missing ones. However, the extra time dimension of videos makes them different from images in this masked modeling. First, video frames are often densely captured, and their semantics varies slowly in time [87]. This temporal redundancy would increase the risk of recovering missing pixels from the spatiotemporal neighborhood with little high-level understanding. Furthermore, video could be viewed as the temporal evolution of static appearance, and there exists a correspondence between frames. This temporal correlation could lead to information leakage (i.e., masked spatiotemporal content re-occurrence) during reconstruction unless a specific masking strategy is considered. In this sense, for each masked cube, it is easy to find a corresponding and unmasked copy in adjacent frames. This property would make the learned models identify some “shortcut” features that are hard to generalize to new scenarios.
|
| 19 |
+
|
| 20 |
+
To make video masked modeling more effective, in this paper, we present a customized design of tube masking with an extremely high ratio in our VideoMAE. First, due to temporal redundancy, we use an extremely high masking ratio to drop the cubes from the downsampled clips. This simple strategy not only effectively increases the pre-training performance but also greatly reduces the computational cost due to the asymmetric encoder-decoder architecture. Second, to consider temporal correlation, we devise a simple yet effective tube masking strategy, which turns out to be helpful in relieving the risk of information leakage for cubes with no or negligible motion during reconstruction. With this simple yet effective design in our VideoMAE, we are able to successfully train vanilla ViT backbones on the relatively small-scale video datasets such as Something-Something [25], UCF101 [60], and HMDB51 [34], which significantly outperform the previous state of the art under the setting without extra data. In summary, the main contribution of this paper is threefold:
|
| 21 |
+
|
| 22 |
+
• We present a simple but effective video masked autoencoder that unleashes the potential of vanilla vision transformer for video recognition. To the best of our knowledge, this is the first masked video pre-training framework of simply using plain ViT backbones. To relieve the information leakage issue in masked video modeling, we present the tube masking with an extremely high ratio, which brings the performance improvement to the VideoMAE. • Aligned with the results in NLP and Images on masked modeling, our VideoMAE demonstrates that this simple masking and reconstruction strategy provides a good solution to self-supervised video pre-training. The models pre-trained with our VideoMAE significantly outperform those trained from scratch or pre-trained with contrastive learning methods. • We obtain extra important findings on masked modeling that might be ignored in previous research in NLP and Images. (1) We demonstrate that VideoMAE is a data-efficient learner that could be successfully trained with only $3 . 5 \mathrm { k }$ videos. (2) Data quality is more important than quantity for SSVP when a domain shift exists between the source and target dataset.
|
| 23 |
+
|
| 24 |
+
# 2 Related Work
|
| 25 |
+
|
| 26 |
+
Video representation learning. Learning good video representations has been heavily investigated in the literature. The supervised learning methods [58, 75, 69, 10, 6] usually depend on the image backbones. The video encoder backbones are first pre-trained with image data in a supervised form. Then, these backbones are fine-tuned on the video dataset for classifying human actions. Meanwhile, some methods [67, 22, 21] directly train video backbones from videos in a supervised manner. Besides supervised learning, semi-supervised video representation learning has also been studied [59]. The representations of labeled training samples are utilized to generate supervision signals for unlabeled ones. Supervised or semi-supervised representation learning mainly uses a top-down training paradigm, which is not effective in exploring the inherent video data structure itself. Meanwhile, some multimodal contrastive learning methods [36, 42, 62] have been developed to learn video representation from noisy text supervision.
|
| 27 |
+
|
| 28 |
+
For self-supervised learning, the prior knowledge of temporal information has been widely exploited to design pretext tasks [78, 44, 82, 5] for SSVP. Recently, contrastive learning [28, 45, 29, 52, 24, 27] is popular to learn better visual representation. However these methods heavily rely on strong data augmentation and large batch size [23]. Predicting the video clip with autoencoders in pixel space has been explored for representation learning by using CNN or LSTM backbones [48, 61], or conducting video generation with autoregressive GPT [83]. Instead, our VideoMAE aims to use the simple masked autoencoder with recent ViT backbones to perform data-efficient SSVP.
|
| 29 |
+
|
| 30 |
+
Masked visual modeling. Masked visual modeling has been proposed to learn effective visual representations based on the simple pipeline of masking and reconstruction. These works mainly focus on the image domain. The early work [72] treated the masking as a noise type in denoised autoencoders [71] or inpainted missing regions with context [47] by using convolutions. iGPT [11] followed the success of GPT [7, 55] in NLP and operated a sequence of pixels for prediction. The original ViT [20] investigated the masked token prediction for self-supervised pre-training. More recently, the success of vision transformer has led to investigation of Transformer-based architectures for masked visual modeling [4, 19, 30, 79, 81, 89]. BEiT [4], BEVT [76] and VIMPAC [64] followed BERT [17] and proposed to learn visual representations from images and videos by predicting the discrete tokens [56]. MAE [30] introduced an asymmetric encoder-decoder architecture for masked image modeling. MaskFeat [79] proposed to reconstruct the HOG features of masked tokens to perform self-supervised pre-training in videos. VideoMAE is inspired by the ImageMAE and introduces specific design in implementation for SSVP. In particular, compared with previous masked video modeling [30, 76, 64], we present a simpler yet more effective video masked autoencoder by directly reconstructing the pixels. Our VideoMAE is the first masked video pre-training framework of simply using plain ViT backbones.
|
| 31 |
+
|
| 32 |
+
# 3 Proposed Method
|
| 33 |
+
|
| 34 |
+
In this section, we first revisit ImageMAE [30]. Then we analyze the characteristics of video data.
|
| 35 |
+
Finally, we show how we explore MAE in the video data by presenting our VideoMAE.
|
| 36 |
+
|
| 37 |
+
# 3.1 Revisiting Image Masked Autoencoders
|
| 38 |
+
|
| 39 |
+
ImageMAE [30] performs the masking and reconstruction task with an asymmetric encoder-decoder architecture. The input image $I \in \mathcal { R } ^ { \mathbf { \breve { 3 } } \times H \times W }$ is first divided into regular non-overlapping patches of size $1 6 \times 1 6$ , and each patch is represented with token embedding. Then a subset of tokens are randomly masked with a high masking ratio $( 7 5 \% )$ , and only the remaining ones are fed into the transformer encoder $\Phi _ { \mathrm { e n c } }$ . Finally, a shallow decoder $\Phi _ { \mathrm { d e c } }$ is placed on top of the visible tokens from the encoder and learnable mask tokens to reconstruct the image. The loss function is mean squared error (MSE) loss between the normalized masked tokens and reconstructed ones in the pixel space:
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
\mathcal { L } = \frac { 1 } { \Omega } \sum _ { p \in \Omega } | I ( p ) - \hat { I } ( p ) | ^ { 2 } ,
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
where $p$ is the token index, $\Omega$ is the set of masked tokens, $I$ is the input image, and $\hat { I }$ is the reconstructed one.
|
| 46 |
+
|
| 47 |
+

|
| 48 |
+
Figure 2: Slowness is a general prior in (a) video data [87]. This leads to two important characteristics in time: temporal redundancy and temporal correlation. Temporal redundancy makes it possible to recover pixels under an extremely high masking ratio. Temporal correlation leads to easily reconstruct the missing pixels by finding those corresponding patches in adjacent frames under plain (b) frame masking or (c) random masking. To avoid this simple task and encourage learning representative representation, we propose a (d) tube masking, where the masking map is the same for all frames.
|
| 49 |
+
|
| 50 |
+
# 3.2 Characteristics of Video Data
|
| 51 |
+
|
| 52 |
+
Compared with static images, video data contain temporal relations. We show the motivation of our VideoMAE by analyzing video characteristics.
|
| 53 |
+
|
| 54 |
+
Temporal redundancy. There are frequently captured frames in a video. The semantics vary slowly in the temporal dimension [87]. We observe that consecutive frames are highly redundant, as shown in Figure 2. This property leads to two critical issues in masked video autoencoding. First, it would be less efficient to keep the original temporal frame rate for pre-training. This would draw us to focus more on static or slow motions in our masked modeling. Second, temporal redundancy greatly dilutes motion representations. This would make the task of reconstructing missing pixels not difficult under the normal masking ratio (e.g., $50 \%$ to $7 5 \%$ ). The encoder backbone is not effective in capturing motion representations.
|
| 55 |
+
|
| 56 |
+
Temporal correlation. Videos could be viewed as the temporal extension of static appearance, and therefore there exists an inherent correspondence between adjacent frames. This temporal correlation could increase the risk of information leakage in the masking and reconstruction pipeline. In this sense, as shown in Figure 2, we can reconstruct the masked patches by finding the spatiotemporal corresponding unmasked patches in the adjacent frames under plain random masking or frame masking. In this case, it might guide the VideoMAE to learn low-level temporal correspondence rather than high-level information such as spatiotemporal reasoning over the content. To alleviate this behavior, we need to propose a new masking strategy to make the reconstruction more challenging and encourage effective learning of spatiotemporal structure representations.
|
| 57 |
+
|
| 58 |
+
# 3.3 VideoMAE
|
| 59 |
+
|
| 60 |
+
To relieve the above issues in video masked modeling, we make the customized design in our VideoMAE, and the overall pipeline is shown in Figure 1. Our VideoMAE takes the downsampled frames as inputs and uses the cube embedding to obtain video tokens. Then, we propose a simple design of tube masking with high ratio to perform MAE pre-training with an asymmetric encoderdecoder architecture. Our backbone uses the vanilla ViT with joint space-time attention.
|
| 61 |
+
|
| 62 |
+
Temporal downsampling. According to the above analysis on temporal redundancy over consecutive frames, we propose to use the strided temporal sampling strategy to perform more efficient video pre-training. Formally, one video clip consisting of $t$ consecutive frames is first randomly sampled from the original video $V$ . We then use temporal sampling to compress the clip to $T$ frames, each of which contains $H \times W \times 3$ pixels. In experiments, the stride $\tau$ is set to 4 and 2 on Kinetics and Something-Something, respectively.
|
| 63 |
+
|
| 64 |
+
Cube embedding. We adopt the joint space-time cube embedding [3, 21, 38] in our VideoMAE, where we treat each cube of size $2 \times 1 6 \times 1 6$ as one token embedding. Thus, the cube embedding layer obtains T2 × H16 $\begin{array} { r } { \frac { T } { 2 } \times \frac { H } { 1 6 } \times \frac { W } { 1 6 } \ 3 } \end{array}$ D tokens and maps each token to the channel dimension $D$ . This design can decrease the spatial and temporal dimension of input, which helps to alleviate the spatiotemporal redundancy in videos.
|
| 65 |
+
|
| 66 |
+
Tube masking with extremely high ratios. First, temporal redundancy is a factor affecting VideoMAE design. We find that VideoMAE is in favor of extremely high masking ratios (e.g. $90 \%$ to $9 5 \%$ ) compared with the ImageMAE. Video information density is much lower than images, and we expect a high ratio to increase the reconstruction difficulty. This high masking ratio is helpful to mitigate the information leakage during masked modeling and make masked video reconstruction a meaningful self-supervised pre-training task.
|
| 67 |
+
|
| 68 |
+
Second, temporal correlation is another factor in our VideoMAE design. We find even under the extremely high masking ratio, we can still improve the masking efficiency by proposing the temporal tube masking mechanism. Temporal tube masking enforces a mask to expand over the whole temporal axis, namely, different frames sharing the same masking map. Mathematically, the tube mask mechanism can be expressed as $\mathbb { I } [ p _ { x , y , \cdot } \in \Omega ] \sim \mathrm { B e r n o u l l i } ( \bar { \rho _ { \mathrm { m a s k } } } )$ and different time $t$ shares the same value. With this mechanism, temporal neighbors of masked cubes are always masked. So for some cubes with no or small motion (e.g., finger cube in 4th row of Figure 2 (d)), we can not find the spatiotemporal corresponding content in all frames. In this way, it would encourage our VideoMAE to reason over high-level semantics to recover these totally missing cubes. This simple strategy can alleviate the information leakage for cubes with no or negligible motion, and turns out to be effective in practice for masked video pre-training.
|
| 69 |
+
|
| 70 |
+
Backbone: joint space-time attention. Due to the high proportion of masking ratio mentioned above, only a few tokens are left as the input for the encoder. To better capture high-level spatio-temporal information in the remaining tokens, we use the vanilla ViT backbone [20] and adopt the joint space-time attention [3, 38]. Thus, all pair tokens could interact with each other in the multi-head self-attention layer [70]. The specific architecture design for the encoder and decoder is shown in supplementary materials. The quadratic complexity of the joint space-time attention mechanism is a computational bottleneck, while our design of an extremely high masking ratio alleviates this issue by only putting the unmasked tokens (e.g., $10 \%$ ) into the encoder during the pre-training phase.
|
| 71 |
+
|
| 72 |
+
# 4 Experiments
|
| 73 |
+
|
| 74 |
+
# 4.1 Datasets
|
| 75 |
+
|
| 76 |
+
We evaluate our VideoMAE on five common video datasets: Kinetics-400 [33], Something-Something V2 [25], UCF101 [60], HMDB51 [34], and AVA [26]. The Kinetics-400 contains around 240k training videos and 20k validation videos of 10s from 400 classes. The Something-Something V2 is another large-scale video dataset, having around 169k videos for training and 20k videos for validation. In contrast to Kinetics-400, this dataset contains 174 motion-centric action classes. These two large-scale video datasets focus on different visual cues for action recognition. UCF101 and HMDB51 are two relatively small video datasets, which contain around $9 . 5 \mathrm { k } / 3 . 5 \mathrm { k }$ train/val videos and $3 . 5 \mathrm { k } / 1 . 5 \mathrm { k }$ train/val videos, respectively. Compared with those large-scale video datasets, these two small datasets are more suitable for verifying the effectiveness of VideoMAE, as training large ViT models is more challenging on small datasets. Moreover, we also transfer the learned ViT models by VideoMAE to downstream action detection task. We work on AVA, a dataset for spatiotemporal localization of human actions with 211k training and $5 7 \mathrm { k }$ validation video segments. In experiments of downstream tasks, we fine-tune the pre-trained VideoMAE models on the training set and report the results on the validation set. The implementation details are described in Appendix $\ S \mathrm { ~ B ~ }$ .
|
| 77 |
+
|
| 78 |
+
# 4.2 Ablation Studies
|
| 79 |
+
|
| 80 |
+
In this subsection, we perform in-depth ablation studies on VideoMAE design with the default backbone of 16-frame ViT-B on Something-Something V2 (SSV2) and Kinetics-400 (K400). The specific architectures for the encoder and decoder are shown in Appendix $\ S \mathrm { ~ A ~ }$ . For fine-tuning, we perform TSN [75] uniform sampling on SSV2 and dense sampling [77, 22] on K400. All models share the same inference protocol, i.e., $2 \mathrm { c l i p s } \times 3$ crops on SSV2 and 5 clips $\times 3$ crops on K400.
|
| 81 |
+
|
| 82 |
+
Decoder design. The lightweight decoder is one key component of our VideoMAE. We conduct experiments with the different depths in Table 1a. Unlike in ImageMAE, a deep decoder here is important for better performance, while a shallow decoder could reduce the GPU memory consumption. We take 4 blocks for the decoder by default. The decoder width is set to half channel of the encoder (e.g., 384-d for ViT-B), following the design in the image domain.
|
| 83 |
+
|
| 84 |
+
<table><tr><td rowspan=1 colspan=3>blocks SSV2K400 GPU mem.</td></tr><tr><td rowspan=1 colspan=3>1 68.579.0 7.9G</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>69.279.2</td><td rowspan=1 colspan=1>10.2G</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>69.680.0</td><td rowspan=1 colspan=1>14.7G</td></tr><tr><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>69.379.7</td><td rowspan=1 colspan=1>23.7G</td></tr></table>
|
| 85 |
+
|
| 86 |
+
(a) Decoder depth. 4 blocks of decoder achieve the best tradeoff. “GPU mem.” is GPU memory during pre-training, benchmarked in one GPU with a batch size of 16.
|
| 87 |
+
|
| 88 |
+
<table><tr><td>case</td><td>ratio</td><td>SSV2</td><td>K400</td></tr><tr><td>tube</td><td>75</td><td>68.0</td><td>79.8</td></tr><tr><td>tube</td><td>90</td><td>69.6</td><td>80.0</td></tr><tr><td>random</td><td>90</td><td>68.3</td><td>79.5</td></tr><tr><td>frame</td><td>87.5*</td><td>61.5</td><td>76.5</td></tr></table>
|
| 89 |
+
|
| 90 |
+
(b) Mask sampling. We compare different masking strategies. Our proposed tube masking with an extremely high ratio works the best. $* ^ { * } 8 7 . 5 ^ { * }$ means masking 14/16 frames.
|
| 91 |
+
|
| 92 |
+
<table><tr><td>input</td><td>target</td><td>SSV2</td><td>K400</td></tr><tr><td>T×T</td><td>center</td><td>63.0</td><td>79.3</td></tr><tr><td>TX</td><td>Tx</td><td>68.9</td><td>79.8</td></tr><tr><td>T×T</td><td>T×T</td><td>69.6</td><td>80.0</td></tr><tr><td>T×T</td><td>2T×</td><td>69.2</td><td>80.1</td></tr></table>
|
| 93 |
+
|
| 94 |
+
(c) Reconstruction target. $T \times$ $\tau$ denotes “frames $\times$ stride”. center denotes the center frame of the input clip. $T$ is set to 16 as default. $\tau$ is set to 2 and 4 on SSV2 and K400, respectively.
|
| 95 |
+
|
| 96 |
+
<table><tr><td rowspan=1 colspan=2>case SSV2K400fromscratch 32.668.8</td></tr><tr><td rowspan=1 colspan=2>fromscratch 32.668.8</td></tr><tr><td rowspan=1 colspan=2>ImageNet-21k sup.61.8 78.9</td></tr><tr><td></td><td rowspan=2 colspan=1>65.2 -</td></tr><tr><td rowspan=1 colspan=1>IN-21k+K400 sup.</td></tr><tr><td rowspan=1 colspan=1>VideoMAE</td><td rowspan=1 colspan=1>69.680.0</td></tr></table>
|
| 97 |
+
|
| 98 |
+
(d) Pre-training strategy. Our VideoMAE works the best without using any extra data. “sup.” is supervised training.
|
| 99 |
+
|
| 100 |
+
<table><tr><td>dataset</td><td>method SSV2</td><td>K400</td></tr><tr><td>IN-1K</td><td>ImageMAE 64.8</td><td>78.7</td></tr><tr><td>K400</td><td>VideoMAE 68.5</td><td>80.0</td></tr><tr><td>SSV2</td><td>VideoMAE 69.6</td><td>79.6</td></tr></table>
|
| 101 |
+
|
| 102 |
+
(e) Pre-training dataset. Our VideoMAE works the best when directly pre-training the models on the source datasets.
|
| 103 |
+
|
| 104 |
+
<table><tr><td>case</td><td>SSV2</td><td>K400</td></tr><tr><td>L1 loss</td><td>69.1</td><td>79.7</td></tr><tr><td>MSE loss</td><td>69.6</td><td>80.0</td></tr><tr><td>Smooth L1 loss</td><td>68.9</td><td>79.6</td></tr></table>
|
| 105 |
+
|
| 106 |
+
(f) Loss function. MSE loss works the best for the masking and reconstruction task in VideoMAE.
|
| 107 |
+
|
| 108 |
+
Table 1: Ablation experiments on Something-Something V2 and Kinetics-400. Our backbone is 16-frame vanilla ViT-B and all models are pre-trained with mask ratio $\rho { = } 9 0 \%$ for 800 epochs, and finetuned for evaluation. We perform TSN [75] uniform sampling on SSV2 and dense sampling [77, 22] on K400. All models share the same inference protocol, i.e., 2 clips $\times 3$ crops on SSV2 and 5 clips $\times 3$ crops on K400. The default choice for our model is colored in gray .
|
| 109 |
+
|
| 110 |
+
Masking strategy. We compare different masking strategies in Table 1b. When increasing the masking ratio from $7 5 \%$ to $90 \%$ for tube masking, the performance on SSV2 boosts from $6 8 . 0 \%$ to $6 9 . 6 \%$ . Then, with an extremely high ratio, we find tube masking also achieves better performance than plain random masking and frame masking. We attribute these interesting observations to the redundancy and temporal correlation in videos. The conclusion on K400 is in accord with one on SSV2. One may note that the performance gap on K400 is lower than one on SSV2. We argue that the Kinetics videos are mostly stationary and scene-related. The effect of temporal modeling is not obvious. Overall, we argue that our default designs enforce the networks to capture more useful spatiotemporal structures and therefore make VideoMAE a more challenging task, which a good self-supervised learner hunger for.
|
| 111 |
+
|
| 112 |
+
Reconstruction target. First, if we only employ the center frame as the target, the results would decrease greatly as shown in Table 1c. The sampling stride is also sensitive. The result of small sampling strid $\begin{array} { c } { { \vdots \frac { \tau } { 2 } } } \\ { { 2 T } } \end{array}$ is lower than default sampling stride $\tau$ $6 8 . 9 \%$ vs. $6 9 . 6 \%$ on SSV2). We also try to reconstruct frames from the downsampled $T$ frames, but it obtains slightly worse results on SSV2. For simplicity, we use the input downsampled clip as our default reconstruction target.
|
| 113 |
+
|
| 114 |
+
Pre-training strategy. We compare different pre-training strategies in Table 1d. Similar to previous trials [3, 6], training video transformers from scratch yields unsatisfied results on video datasets. When pre-trained on the large-scale ImageNet-21K dataset, the video transformer obtains better accuracy from $3 2 . 6 \%$ to $6 1 . 8 \%$ on SSV2 and $6 8 . 8 \%$ to $78 . 9 \%$ on K400. Using the models pre-trained on both ImageNet-21K and Kinetics further increases accuracy to $6 5 . 2 \%$ on SSV2. Our VideoMAE can effectively train a video transformer on the video dataset itself without using any extra data and achieve the best performance $6 9 . 6 \%$ on SSV2 and $8 0 . 0 \%$ on K400).
|
| 115 |
+
|
| 116 |
+
Pre-training dataset. First, we pre-train the ViT-B on ImageNet-1K for 1600 epochs, following the recipes in [30]. Then we inflate the 2D patch embedding layer to our cube embedding layer following [10] and fine-tune the model on the target video datasets. The results surpass the model trained from scratch as shown in Table 1e. We also compare the ImageMAE pre-trained model with VideoMAE models pre-trained on video datasets. We see that our VideoMAE models can achieve better performance than ImageMAE. However, when we try to transfer the pre-trained VideoMAE models to the other video datasets (e.g. from Kinetics to Something-Something), the results are slightly worse than their counterpart, which is directly pre-trained on its own target video datasets. We argue that domain shift between pre-training and target datasets could be an important issue.
|
| 117 |
+
|
| 118 |
+
dataset training data from scratch MoCo v3 VideoMAE
|
| 119 |
+
Table 2: Comparisons with the results of previous self-supvised pre-training methods on different datasets. We take 16-frame ViT-B as the default backbone. Notably, here MoCo v3 and VideoMAE all only use the unlabelled data in the training set of each dataset for pre-training and are all fine-tuned for evaluation.
|
| 120 |
+
|
| 121 |
+
<table><tr><td>K400</td><td>240k</td><td>68.8</td><td>74.2</td><td>80.0</td></tr><tr><td>Sth-Sth V2</td><td>169k</td><td>32.6</td><td>54.2</td><td>69.6</td></tr><tr><td>UCF101</td><td>9.5k</td><td>51.4</td><td>81.7</td><td>91.3</td></tr><tr><td>HMDB51</td><td>3.5k</td><td>18.0</td><td>39.2</td><td>62.6</td></tr></table>
|
| 122 |
+
|
| 123 |
+
Table 3: Comparisons with the efficiency and effectiveness on Something-Something V2. We report the fine-tuning (ft) and linear probing (lin) accuracy $( \% )$ . The wall-clock time of pre-training is benchmarked in 64 Tesla V100 GPUs with PyTorch.
|
| 124 |
+
|
| 125 |
+
<table><tr><td>method</td><td>epoch</td><td>ft. acc.</td><td>lin. acc.</td><td>hours</td><td>speedup</td></tr><tr><td>MoCov3</td><td>300</td><td>54.2</td><td>33.7</td><td>61.7</td><td>-</td></tr><tr><td>VideoMAE</td><td>800</td><td>69.6</td><td>38.9</td><td>19.5</td><td>3.2×</td></tr></table>
|
| 126 |
+
|
| 127 |
+
Table 4: Comparisons with the feature transferability on smaller datasets. We take 16-frame ViT-B as the default backbone. Notably, here MoCo v3 and VideoMAE are all pre-trained on Kinetics-400 with unlabelled data in the training set. Then the pre-trained model is fine-tuned on target datasets for evaluation.
|
| 128 |
+
|
| 129 |
+
<table><tr><td>method</td><td>K400 → SSV2 K400 →UCF K400 →HMDB</td><td></td><td></td></tr><tr><td>MoCo v3</td><td>62.4</td><td>93.2</td><td>67.9</td></tr><tr><td>VideoMAE</td><td>68.5</td><td>96.1</td><td>73.3</td></tr></table>
|
| 130 |
+
|
| 131 |
+
Loss function. Table 1f contains an ablation study of loss function. We find that the MSE loss could achieve a higher result compared with the L1 loss and smooth L1 loss. Therefore, we employ the MSE loss by default.
|
| 132 |
+
|
| 133 |
+
# 4.3 Main Results and Analysis
|
| 134 |
+
|
| 135 |
+
VideoMAE: data-efficient learner. The self-supervised video pre-training (SSVP) has been extensively studied in previous works, but they mainly use the CNN-based backbones. Few works have investigated transformer-based backbone in SSVP. Therefore, to demonstrate the effectiveness of VideoMAE for transformer-based SSVP, we compare two methods implemented by ourselves: (1) training from scratch and (2) pre-training with contrastive learning (MoCo v3 [14]). For training from scratch, we carefully tune these hyper-parameters to successfully pre-train ViT-Base from the training set of the dataset. For pre-training with MoCo v3, we strictly follow the training practice in its image counterpart and carefully avoid the collapse issue.
|
| 136 |
+
|
| 137 |
+
The recognition accuracy is reported in Table 2. We see that our VideoMAE significantly outperforms other two training settings. For instance, on the largest dataset of Kinetics-400, our VideoMAE outperforms training from scratch by around $10 \%$ and MoCo v3 pre-training by around $5 \%$ . This superior performance demonstrates that masked autoencoder provides an effective pre-training mechanism for video transformers. We also see that the performance gap between our VideoMAE and the other two methods becomes larger as the training set becomes smaller. Notably, even with only $3 . 5 \mathrm { k }$ training clips on HMDB51, our VideoMAE pre-training can still obtain a satisfying accuracy (around $6 1 \%$ ). This new result demonstrates that VideoMAE is a more data-efficient learner for SSVP. This property is particularly important for scenarios with limited data available and different with contrastive learning methods.
|
| 138 |
+
|
| 139 |
+
We compare the efficiency of VideoMAE pre-training and MoCo v3 pre-training in Table 3. The task of masked autoencoding with a high ratio is more challenging and thereby requires more training epochs (800 vs. 300). Thanks to the asymmetric encoder-decoder in our VideoMAE and extremely high masking ratio, our pre-training time is much shorter than MoCo v3 (19.5 vs. 61.7 hours).
|
| 140 |
+
|
| 141 |
+
High masking ratio. In VideoMAE, one core design is the extremely high masking ratio. We perform an investigation of this design on the Kinetics-400 and Something-Something V2 datasets. The results are shown in Figure 3. We see that the best masking ratio is extremely high, and even $9 5 \%$ can achieve good performance for both datasets. This result is difference from BERT [17] in NLP and MAE [30] in images. We analyze the temporal redundancy and correlation in videos makes it possible for our VideoMAE to learn plausible outputs with such a high masking ratio.
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
|
| 145 |
+

|
| 146 |
+
Figure 3: The effect of masking ratio Figure 4: Data efficiency of VideoMAE representations. on (a) Something-Something V2 and (b) Our default backbone is 16-frame vanilla ViT-B. • denotes Kinetics-400. We take 16-frame vanilla that all models are trained for the same 132k iterations, ViT-B as default. The results show that and $0$ denotes that all models are trained for the same 800 an extremely high masking ratio $( 9 0 \% )$ epochs. Note that it takes 132k iterations to pre-train the achieves the best efficiency and effective- model for 800 epochs on the full training set of Somethingness trade-off on both video datasets. Something V2.
|
| 147 |
+
|
| 148 |
+
We also visualize the reconstructed examples in Appendix $\ S { s e }$ . We see that even under an extremely high masking ratio, VideoMAE can produce satisfying reconstructed results. This implies VideoMAE is able to learn useful representations that capture the holistic spatiotemporal structure in videos.
|
| 149 |
+
|
| 150 |
+
Transfer learning: quality vs. quantity. To further investigate the generalization ability of VideoMAE in representation learning, we transfer the learned VideoMAE from Kinetics-400 to Something-Something V2, UCF101, and HMDB51. The results are shown in Table 4, and we compare them with MoCo v3 pre-training. The models pre-trained by VideoMAE are better than those pre-trained by MoCo v3, demonstrating that our VideoMAE learns more transferable representations.
|
| 151 |
+
|
| 152 |
+
Comparing Table 2 and Table 4, the transferred representation outperforms the original VideoMAE models trained from its own dataset on UCF101 and HMDB51. In contrast, the transferred representation is worse on Something-Something V2. To figure out whether this inconsistent result is caused by the large scale of Something-Something V2, we further perform a detailed investigation by decreasing the pre-training video numbers. In this study, we run two experiments: (1) pre-training with the same epochs and (2) pre-training with the same time budget. The result is shown in Figure 4. We see that more training iterations could contribute to better performance when we decrease the size of the pre-training set. Surprisingly, even with only $4 2 \mathrm { k }$ pre-training videos, we can still obtain better accuracy than the Kinetics pre-trained models with 240k videos $6 8 . 7 \%$ vs. $6 8 . 5 \%$ ). This result implies that domain shift is another important factor, and data quality is more important than data quantity in SSVP when there exists a difference between pre-training and target datasets. It also demonstrates that VideoMAE is a data-efficient learner for SSVP.
|
| 153 |
+
|
| 154 |
+
Transfer learning: downstream action detection. We also transfer the learned VideoMAE on Kinetics-400 to downstream action detection dataset AVA. Following the standard setting [26], we evaluate on top 60 common classes with mean Average Precision (mAP) as the metric under IoU threshold of 0.5. The results are shown in the Table 5. After self-supervised pre-training on Kinetics400, our VideoMAE with the vanilla ViT-B can achieve $2 6 . 7 \mathrm { m A P }$ on AVA, which demonstrates the strong transferability of our VideoMAE. If the pre-trained ViT-B is additionally fine-tuned on Kinetics-400 with labels, the transfer learning performance can further increase about $5 \mathrm { m A P }$ (from 26.7 to 31.8). More remarkably, when we scale up the pre-training configurations with larger video datasets (e.g. Kinetics-700) or more powerful backbones (e.g. ViT-Large and ViT-Huge), VideoMAE can finally obtain better performance. For example, our ViT-L VideoMAE pre-trained on Kinetics-700 achieves $3 9 . 3 \mathrm { m A P }$ and ViT-H VideoMAE pre-trained on Kinetics-400 has $3 9 . 5 \mathrm { m A P } . $ . These results demonstrate that the self-supervised pre-trained models transfer well not only on action classification task but on more complex action detection task.
|
| 155 |
+
|
| 156 |
+
Table 5: Comparison with the state-of-the-art methods on AVA v2.2. All models are pre-trained and fine-tuned at image size $2 2 4 ^ { 2 }$ . We report the mean Average Precision (mAP) on validation set. “Ex. labels $\pmb { \chi } ^ { , }$ means only unlabelled data is used during the pre-training phase and the pre-trained models are directly transferred to AVA. “Ex. labels $\curvearrowleft$ means pre-trained models are additionally fine-tuned on the pre-training dataset with labels before transferred to AVA. $T \times \tau$ refers to frame number and corresponding sample rate.
|
| 157 |
+
|
| 158 |
+
<table><tr><td>Method</td><td>Backbone</td><td>Pre-train Dataset Extra Labels|T×7</td><td></td><td></td><td>GFLOPs</td><td>Param</td><td>mAP</td></tr><tr><td>supervised [22]</td><td>SlowFast-R101</td><td>Kinetics-400</td><td>√</td><td>8×8</td><td>138</td><td>53</td><td>23.8</td></tr><tr><td>CVRL [53]</td><td>SlowOnly-R50</td><td>Kinetics-400</td><td>X</td><td>32×2</td><td>42</td><td>32</td><td>16.3</td></tr><tr><td>pBYOLp=3 [23]</td><td>SlowOnly-R50 SlowOnly-R50</td><td>Kinetics-400</td><td>X</td><td>8×8</td><td>42</td><td>32</td><td>23.4</td></tr><tr><td>pMoCop=3 [23]</td><td>MViT-L</td><td>Kinetics-400 Kinetics-400</td><td>X</td><td>8×8 40×3</td><td>42</td><td>32</td><td>20.3</td></tr><tr><td>MaskFeat↑312 [79] MaskFeat↑312 [79]</td><td>MViT-L</td><td>Kinetics-600</td><td>√ √</td><td>40×3</td><td>2828 2828</td><td>218 218</td><td>37.5</td></tr><tr><td>VideoMAE</td><td>ViT-S</td><td>Kinetics-400</td><td>X</td><td>16×4</td><td>57</td><td>22</td><td>38.8 22.5</td></tr><tr><td>VideoMAE</td><td>ViT-S</td><td>Kinetics-400</td><td>√</td><td>16×4</td><td>57</td><td>22</td><td>28.4</td></tr><tr><td>VideoMAE</td><td>ViT-B</td><td>Kinetics-400</td><td>X</td><td>16×4</td><td>180</td><td>87</td><td>26.7</td></tr><tr><td>VideoMAE</td><td>ViT-B</td><td>Kinetics-400</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>ViT-L</td><td>Kinetics-400</td><td>√</td><td>16×4</td><td>180</td><td>87</td><td>31.8</td></tr><tr><td>VideoMAE</td><td>ViT-L</td><td>Kinetics-400</td><td>X</td><td>16×4 16×4</td><td>597</td><td>305</td><td>34.3</td></tr><tr><td>VideoMAE VideoMAE</td><td>ViT-H</td><td>Kinetics-400</td><td>√</td><td>16×4</td><td>597</td><td>305</td><td>37.0</td></tr><tr><td>VideoMAE</td><td>ViT-H</td><td>Kinetics-400</td><td>X √</td><td>16×4</td><td>1192 1192</td><td>633 633</td><td>36.5</td></tr><tr><td>VideoMAE</td><td>ViT-L</td><td>Kinetics-700</td><td>X</td><td>16×4</td><td>597</td><td>305</td><td>39.5 36.1</td></tr><tr><td>VideoMAE</td><td>ViT-L</td><td>Kinetics-700</td><td>√</td><td>16×4</td><td>597</td><td>305</td><td>39.3</td></tr></table>
|
| 159 |
+
|
| 160 |
+
<table><tr><td>Method</td><td>Backbone</td><td>Extra data</td><td>Ex. labels</td><td>Frames</td><td>GFLOPs</td><td>Param</td><td>Top-1</td><td>Top-5</td></tr><tr><td>TEINetEn [39]</td><td>ResNet50x2</td><td rowspan="3">ImageNet-1K</td><td>√</td><td>8+16</td><td>99×10x3</td><td>50</td><td>66.5</td><td>N/A</td></tr><tr><td>TANetEn [40]</td><td>ResNet50×2</td><td>√</td><td>8+16</td><td>99×2×3</td><td>51</td><td>66.0</td><td>90.1</td></tr><tr><td>TDNEn [74]</td><td>ResNet101×2</td><td>√</td><td>8+16</td><td>198×1×3</td><td>88</td><td>69.6</td><td>92.2</td></tr><tr><td>SlowFast [22] MViTv1[21]</td><td>ResNet101 MViTv1-B</td><td rowspan="2">Kinetics-400</td><td>√ √</td><td>8+32 64</td><td>106×1×3 455×1×3</td><td>53 37</td><td>63.1 67.7</td><td>87.6</td></tr><tr><td>TimeSformer [6]</td><td>ViT-B</td><td></td><td>8</td><td>196×1×3</td><td>121</td><td>59.5</td><td>90.9 N/A</td></tr><tr><td>TimeSformer [6]</td><td>ViT-L</td><td rowspan="2">ImageNet-21K</td><td>V</td><td>64</td><td>5549×1×3</td><td>430</td><td>62.4</td><td>N/A</td></tr><tr><td>ViViT FE [3]</td><td>ViT-L</td><td>√</td><td>32</td><td>995×4×3</td><td>N/A</td><td>65.9</td><td>89.9</td></tr><tr><td>Motionformer [50]</td><td>ViT-B</td><td rowspan="4">IN-21K+K400</td><td>√</td><td>16</td><td>370×1×3</td><td>109</td><td>66.5</td><td>90.1</td></tr><tr><td>Motionformer [50]</td><td>ViT-L</td><td>√</td><td>32</td><td>1185×1×3</td><td>382</td><td>68.1</td><td>91.2</td></tr><tr><td>Video Swin [38]</td><td>Swin-B</td><td>√</td><td>32</td><td>321×1×3</td><td>88</td><td>69.6</td><td>92.7</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>VIMPAC [64]</td><td>ViT-L</td><td>HowTo100M+DALLE IN-1K+K400+DALLE</td><td>X</td><td>10</td><td>N/A×10×3</td><td>307</td><td>68.1</td><td>N/A</td></tr><tr><td>BEVT[76]</td><td>Swin-B</td><td rowspan="2">Kinetics-600</td><td>×</td><td>32</td><td>321×1×3</td><td>88</td><td>70.6</td><td>N/A</td></tr><tr><td>MaskFeat↑312 [79]</td><td>MViT-L</td><td>√</td><td>40</td><td>2828×1×3</td><td>218</td><td>75.0</td><td>95.0</td></tr><tr><td>VideoMAE</td><td>ViT-B</td><td>Kinetics-400 Kinetics-400</td><td>X ×</td><td>16</td><td>180×2×3</td><td>87</td><td>69.7</td><td>92.3</td></tr><tr><td>VideoMAE</td><td>ViT-L</td><td rowspan="4"> no external data</td><td>X</td><td>16</td><td>597×2×3</td><td>305</td><td>74.0</td><td>94.6</td></tr><tr><td>VideoMAE</td><td>ViT-S</td><td>X</td><td>16</td><td>57×2×3</td><td>22</td><td>66.8</td><td>90.3</td></tr><tr><td>VideoMAE</td><td>ViT-B</td><td></td><td>16</td><td>180×2×3</td><td>87</td><td>70.8</td><td>92.4</td></tr><tr><td>VideoMAE VideoMAE</td><td>ViT-L ViT-L</td><td>X X</td><td>16 32</td><td>597×2×3 1436×1×3</td><td>305 305</td><td>74.3 75.4</td><td>94.6 95.2</td></tr></table>
|
| 161 |
+
|
| 162 |
+
Table 6: Comparison with the state-of-the-art methods on Something-Something V2. Our VideoMAE reconstructs normalized cube pixels and is pre-trained with a masking ratio of $90 \%$ for 2400 epochs. “Ex. labels $\pmb { \chi } ^ { , }$ means only unlabelled data is used during the pre-training phase. “N/A” indicates the numbers are not available for us.
|
| 163 |
+
|
| 164 |
+
# 4.4 Comparison with the state of the art
|
| 165 |
+
|
| 166 |
+
We compare with the previous state-of-the-art performance on the Kinetics-400 and SomethingSomething V2 datasets. The results are reported in Table 6 and Table 7. Our VideoMAE can easily scale up with more powerful backbones (e.g. ViT-Large and ViT-Huge) and more frames (e.g. 32). Our VideoMAE achieves the top-1 accuracy of $7 5 . 4 \%$ on Something-Something V2 and $8 7 . 4 \%$ on Kinetics-400 without using any extra data. We see that the existing state-of-the-art methods all depend on the external data for pre-training on the Something-Something V2 dataset. On the contrary, our VideoMAE without any external data significantly outperforms previous methods with the same input resolution by around $5 \%$ . Our ViT-H VideoMAE also achieves very competitive performance on the Kinetics-400 dataset without using any extra data, which is even better than ViViT-H with on
|
| 167 |
+
|
| 168 |
+
Table 7: Comparison with the state-of-the-art methods on Kinetics-400. Our VideoMAE reconstructs normalized cube pixels. Here models are self-supervised pre-trained with a masking ratio of $90 \%$ for 1600 epochs on Kinetics-400. VideoMAE↑320 is initialized from its $2 2 4 ^ { 2 }$ resolution counterpart and then fine-tuned for evaluation. “Ex. labels $\pmb { \chi } ^ { , }$ means only unlabelled data is used during the pre-training phase. “N/A” indicates the numbers are not available for us.
|
| 169 |
+
|
| 170 |
+
<table><tr><td>Method</td><td>Backbone</td><td>Extra data</td><td>Ex.labels|1</td><td>Frames</td><td>GFLOPs</td><td>Param</td><td>Top-1</td><td>Top-5</td></tr><tr><td>NL I3D [77]</td><td>ResNet101</td><td rowspan="3">ImageNet-1K</td><td>√</td><td>128</td><td>359×10×3</td><td>62</td><td>77.3</td><td>93.3</td></tr><tr><td>TANet [40]</td><td>ResNet152</td><td></td><td>16</td><td>242×4×3</td><td>59</td><td>79.3</td><td>94.1</td></tr><tr><td>TDNEn [74]</td><td>ResNet101</td><td></td><td>8+16</td><td>198×10×3</td><td>88</td><td>79.4</td><td>94.4</td></tr><tr><td>TimeSformer [6]</td><td>ViT-L</td><td rowspan="4">ImageNet-21K</td><td></td><td>96</td><td>8353×1×3</td><td>430</td><td>80.7</td><td>94.7</td></tr><tr><td>ViViT FE [3]</td><td>ViT-L</td><td></td><td>128</td><td>3980×1×3</td><td>N/A</td><td>81.7</td><td>93.8</td></tr><tr><td>Motionformer [50]</td><td>ViT-L</td><td></td><td>32</td><td>1185×10×3</td><td>382</td><td>80.2</td><td>94.8</td></tr><tr><td>Video Swin [38]</td><td>Swin-L</td><td></td><td>32</td><td>604×4×3</td><td>197</td><td>83.1</td><td>95.9</td></tr><tr><td>ViViT FE [3]</td><td>ViT-L</td><td>JFT-300M</td><td>√</td><td>128</td><td>3980×1×3</td><td>N/A</td><td>83.5</td><td>94.3</td></tr><tr><td>ViViT[3]</td><td>ViT-H</td><td>JFT-300M</td><td></td><td>32</td><td>3981×4×3</td><td>N/A</td><td>84.9</td><td>95.8</td></tr><tr><td>VIMPAC [64]</td><td>ViT-L</td><td>HowTo100M+DALLE</td><td>X</td><td>10</td><td>N/A×10×3</td><td>307</td><td>77.4</td><td>N/A</td></tr><tr><td>BEVT[76]</td><td>Swin-B</td><td>IN-1K+DALLE</td><td>X</td><td>32</td><td>282×4×3</td><td>88</td><td>80.6</td><td>N/A</td></tr><tr><td>MaskFeat↑352 [79]</td><td>MViT-L</td><td>Kinetics-600</td><td>X</td><td>40</td><td>3790×4×3</td><td>218</td><td>87.0</td><td>97.4</td></tr><tr><td>ip-CSN [68]</td><td>ResNet152</td><td rowspan="4"> no external data</td><td>X</td><td>32</td><td>109×10×3</td><td>33</td><td>77.8</td><td>92.8</td></tr><tr><td>SlowFast [22]</td><td>R101+NL</td><td>X</td><td>16+64</td><td>234×10×3</td><td>60</td><td>79.8</td><td>93.9</td></tr><tr><td>MViTv1[21]</td><td>MViTv1-B</td><td>X</td><td>32</td><td>170×5×1</td><td>37</td><td>80.2</td><td>94.4</td></tr><tr><td>MaskFeat [79]</td><td>MViT-L</td><td>×</td><td>16</td><td>377×10×1</td><td>218</td><td>84.3</td><td>96.3</td></tr><tr><td>VideoMAE</td><td>ViT-S</td><td rowspan="4">no external data</td><td>X</td><td>16</td><td>57×5×3</td><td>22</td><td>79.0</td><td>93.8</td></tr><tr><td>VideoMAE</td><td>ViT-B</td><td>X</td><td>16</td><td>180×5×3</td><td>87</td><td>81.5</td><td>95.1</td></tr><tr><td>VideoMAE</td><td>ViT-L</td><td>×</td><td>16</td><td>597×5×3</td><td>305</td><td>85.2</td><td>96.8</td></tr><tr><td>VideoMAE</td><td>ViT-H</td><td>×</td><td>16</td><td>1192×5×3</td><td>633</td><td>86.6</td><td>97.1</td></tr><tr><td>VideoMAE↑320</td><td>ViT-L</td><td rowspan="2">no external data</td><td>X</td><td>32</td><td>3958×4×3</td><td>305</td><td>86.1</td><td></td></tr><tr><td>VideoMAE↑320</td><td>ViT-H</td><td>×</td><td>32</td><td>7397×4×3</td><td>633</td><td>87.4</td><td>97.3 97.6</td></tr></table>
|
| 171 |
+
|
| 172 |
+
JFT-300M pre-training $8 6 . 6 \%$ v.s. $8 4 . 9 \%$ ). When fine-tuned with larger spatial resolutions and input video frames, the performance of our ViT-H VideoMAE can further boost from $8 6 . 6 \%$ to $8 7 . 4 \%$ .
|
| 173 |
+
|
| 174 |
+
# 5 Conclusion
|
| 175 |
+
|
| 176 |
+
In this paper, we have presented a simple and data-efficient self-supervised learning method (VideoMAE) for video transformer pre-training. Our VideoMAE introduces two critical designs of extremely high masking ratio and tube masking strategy to make the video reconstruction task more challenging. This harder task would encourage VideoMAE to learn more representative features and relieve the information leakage issue. Empirical results demonstrate this simple algorithm works well for video datasets of different scales. In particular, we are able to learn effective VideoMAE only with thousands of video clips, which has significant practical value for scenarios with limited data available.
|
| 177 |
+
|
| 178 |
+
Future work VideoMAE could be further improved by using larger webly datasets, larger models (e.g., ViT-G) and larger spatial resolutions of input video (e.g., $3 8 \hat { 4 ^ { 2 } }$ ). VideoMAE only leverages the RGB video stream without using additional audio or text stream. We expect that audio and text from the video data can provide more information for self-supervised pre-training.
|
| 179 |
+
|
| 180 |
+
Broader impact Potential negative societal impacts of VideoMAE are mainly concerned with energy consumption. The pre-training phase may lead to a large amount of carbon emission. Though the pre-training is energy-consuming, we only need to pre-train the model once. Different downstream tasks can then share the same pre-trained model via additional fine-tuning. Our VideoMAE unleashes the great potential of vanilla vision transformer for video analysis, which could increase the risk of video understanding model or its outputs being used incorrectly, such as for unauthorized surveillance.
|
| 181 |
+
|
| 182 |
+
Acknowledgements and disclosure of funding Thanks to Ziteng Gao, Lei Chen and Chongjian Ge for their help. This work is supported by National Natural Science Foundation of China (No. 62076119, No. 61921006), the Fundamental Research Funds for the Central Universities (No. 020214380091), Tencent AI Lab Rhino-Bird Focused Research Program (No. JR202125), and Collaborative Innovation Center of Novel Software Technology and Industrialization.
|
| 183 |
+
|
| 184 |
+
References
|
| 185 |
+
[1] Jean-Baptiste Alayrac, Adria Recasens, Rosalia Schneider, Relja Arandjelovic, Jason Ramapuram, Jeffrey De Fauw, Lucas Smaira, Sander Dieleman, and Andrew Zisserman. Self-supervised multimodal versatile networks. In Advances in Neural Information Processing Systems, 2020.
|
| 186 |
+
[2] Humam Alwassel, Dhruv Mahajan, Bruno Korbar, Lorenzo Torresani, Bernard Ghanem, and Du Tran. Self-supervised learning by cross-modal audio-video clustering. In Advances in Neural Information Processing Systems, 2020.
|
| 187 |
+
[3] Anurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun, Mario Luciˇ c, and Cordelia Schmid. Vivit: A ´ video vision transformer. In IEEE/CVF International Conference on Computer Vision, 2021.
|
| 188 |
+
[4] Hangbo Bao, Li Dong, Songhao Piao, and Furu Wei. BEit: BERT pre-training of image transformers. In International Conference on Learning Representations, 2022.
|
| 189 |
+
[5] Sagie Benaim, Ariel Ephrat, Oran Lang, Inbar Mosseri, William T. Freeman, Michael Rubinstein, Michal Irani, and Tali Dekel. Speednet: Learning the speediness in videos. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020.
|
| 190 |
+
[6] Gedas Bertasius, Heng Wang, and Lorenzo Torresani. Is space-time attention all you need for video understanding? In International Conference on Machine Learning, 2021.
|
| 191 |
+
[7] 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 Advances in Neural Information Processing Systems, 2020.
|
| 192 |
+
[8] 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, 2020.
|
| 193 |
+
[9] Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, Julien Mairal, Piotr Bojanowski, and Armand Joulin. Emerging properties in self-supervised vision transformers. In IEEE/CVF International Conference on Computer Vision, 2021.
|
| 194 |
+
[10] João Carreira and Andrew Zisserman. Quo vadis, action recognition? A new model and the kinetics dataset. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2017.
|
| 195 |
+
[11] Mark Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, and Ilya Sutskever. Generative pretraining from pixels. In International Conference on Machine Learning, 2020.
|
| 196 |
+
[12] Peihao Chen, Deng Huang, Dongliang He, Xiang Long, Runhao Zeng, Shilei Wen, Mingkui Tan, and Chuang Gan. Rspnet: Relative speed perception for unsupervised video representation learning. In Proceedings of the AAAI Conference on Artificial Intelligence, 2021.
|
| 197 |
+
[13] Xin Chen, Bin Yan, Jiawen Zhu, Dong Wang, Xiaoyun Yang, and Huchuan Lu. Transformer tracking. In CVPR, 2021.
|
| 198 |
+
[14] Xinlei Chen, Saining Xie, and Kaiming He. An empirical study of training self-supervised vision transformers. In IEEE/CVF International Conference on Computer Vision, 2021.
|
| 199 |
+
[15] Ekin D Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V Le. Randaugment: Practical automated data augmentation with a reduced search space. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, 2020.
|
| 200 |
+
[16] Yutao Cui, Cheng Jiang, Limin Wang, and Gangshan Wu. Mixformer: End-to-end tracking with iterative mixed attention. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022.
|
| 201 |
+
[17] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In North American Chapter of the Association for Computational Linguistics, 2019.
|
| 202 |
+
[18] Ali Diba, Vivek Sharma, Reza Safdari, Dariush Lotfi, Saquib Sarfraz, Rainer Stiefelhagen, and Luc Van Gool. Vi2clr: Video and image for visual contrastive learning of representation. In IEEE/CVF International Conference on Computer Vision, 2021.
|
| 203 |
+
[19] Xiaoyi Dong, Jianmin Bao, Ting Zhang, Dongdong Chen, Weiming Zhang, Lu Yuan, Dong Chen, Fang Wen, and Nenghai Yu. Peco: Perceptual codebook for bert pre-training of vision transformers. arXiv preprint arXiv:2111.12710, 2021.
|
| 204 |
+
[20] 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.
|
| 205 |
+
[21] Haoqi Fan, Bo Xiong, Karttikeya Mangalam, Yanghao Li, Zhicheng Yan, Jitendra Malik, and Christoph Feichtenhofer. Multiscale vision transformers. In IEEE/CVF International Conference on Computer Vision, 2021.
|
| 206 |
+
[22] Christoph Feichtenhofer, Haoqi Fan, Jitendra Malik, and Kaiming He. Slowfast networks for video recognition. In IEEE/CVF International Conference on Computer Vision, 2019.
|
| 207 |
+
[23] Christoph Feichtenhofer, Haoqi Fan, Bo Xiong, Ross Girshick, and Kaiming He. A large-scale study on unsupervised spatiotemporal representation learning. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021.
|
| 208 |
+
[24] Chongjian Ge, Youwei Liang, Yibing Song, Jianbo Jiao, Jue Wang, and Ping Luo. Revitalizing cnn attentions via transformers in self-supervised visual representation learning. In Advances in Neural Information Processing Systems, 2021.
|
| 209 |
+
[25] Raghav Goyal, Samira Ebrahimi Kahou, Vincent Michalski, Joanna Materzynska, Susanne Westphal, Heuna Kim, Valentin Haenel, Ingo Fründ, Peter Yianilos, Moritz Mueller-Freitag, Florian Hoppe, Christian Thurau, Ingo Bax, and Roland Memisevic. The "something something" video database for learning and evaluating visual common sense. In IEEE/CVF International Conference on Computer Vision, 2017.
|
| 210 |
+
[26] Chunhui Gu, Chen Sun, David A Ross, Carl Vondrick, Caroline Pantofaru, Yeqing Li, Sudheendra Vijayanarasimhan, George Toderici, Susanna Ricco, Rahul Sukthankar, et al. Ava: A video dataset of spatio-temporally localized atomic visual actions. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2018.
|
| 211 |
+
[27] Sheng Guo, Zihua Xiong, Yujie Zhong, Limin Wang, Xiaobo Guo, Bing Han, and Weilin Huang. Crossarchitecture self-supervised video representation learning. In CVPR, 2022.
|
| 212 |
+
[28] Tengda Han, Weidi Xie, and Andrew Zisserman. Memory-augmented dense predictive coding for video representation learning. In European Conference on Computer Vision, 2020.
|
| 213 |
+
[29] Tengda Han, Weidi Xie, and Andrew Zisserman. Self-supervised co-training for video representation learning. In Advances in Neural Information Processing Systems, 2020.
|
| 214 |
+
[30] Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked autoencoders are scalable vision learners. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022.
|
| 215 |
+
[31] Elad Hoffer, Tal Ben-Nun, Itay Hubara, Niv Giladi, Torsten Hoefler, and Daniel Soudry. Augment your batch: Improving generalization through instance repetition. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020.
|
| 216 |
+
[32] Kai Hu, Jie Shao, Yuan Liu, Bhiksha Raj, Marios Savvides, and Zhiqiang Shen. Contrast and order representations for video self-supervised learning. In IEEE/CVF International Conference on Computer Vision, 2021.
|
| 217 |
+
[33] Will Kay, Joao Carreira, Karen Simonyan, Brian Zhang, Chloe Hillier, Sudheendra Vijayanarasimhan, Fabio Viola, Tim Green, Trevor Back, Paul Natsev, Mustafa Suleyman, and Andrew Zisserman. The kinetics human action video dataset. arXiv preprint arXiv:1705.06950, 2017.
|
| 218 |
+
[34] Hildegard Kuehne, Hueihan Jhuang, Estíbaliz Garrote, Tomaso Poggio, and Thomas Serre. Hmdb: a large video database for human motion recognition. In IEEE/CVF International Conference on Computer Vision, 2011.
|
| 219 |
+
[35] Hsin-Ying Lee, Jia-Bin Huang, Maneesh Singh, and Ming-Hsuan Yang. Unsupervised representation learning by sorting sequence. In IEEE/CVF International Conference on Computer Vision, 2017.
|
| 220 |
+
[36] Tianhao Li and Limin Wang. Learning spatiotemporal features via video and text pair discrimination. CoRR, abs/2001.05691, 2020.
|
| 221 |
+
[37] 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, 2021.
|
| 222 |
+
[38] Ze Liu, Jia Ning, Yue Cao, Yixuan Wei, Zheng Zhang, Stephen Lin, and Han Hu. Video swin transformer. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022.
|
| 223 |
+
[39] Zhaoyang Liu, Donghao Luo, Yabiao Wang, Limin Wang, Ying Tai, Chengjie Wang, Jilin Li, Feiyue Huang, and Tong Lu. TEINet: Towards an efficient architecture for video recognition. In Proceedings of the AAAI Conference on Artificial Intelligence, 2020.
|
| 224 |
+
[40] Zhaoyang Liu, Limin Wang, Wayne Wu, Chen Qian, and Tong Lu. Tam: Temporal adaptive module for video recognition. In IEEE/CVF International Conference on Computer Vision, 2021.
|
| 225 |
+
[41] Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. arXiv preprint arXiv:1608.03983, 2016.
|
| 226 |
+
[42] Antoine Miech, Jean-Baptiste Alayrac, Lucas Smaira, Ivan Laptev, Josef Sivic, and Andrew Zisserman. End-to-end learning of visual representations from uncurated instructional videos. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020.
|
| 227 |
+
[43] Antoine Miech, Jean-Baptiste Alayrac, Lucas Smaira, Ivan Laptev, Josef Sivic, and Andrew Zisserman. End-to-End Learning of Visual Representations from Uncurated Instructional Videos. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020.
|
| 228 |
+
[44] Ishan Misra, C Lawrence Zitnick, and Martial Hebert. Shuffle and learn: unsupervised learning using temporal order verification. In European Conference on Computer Vision, 2016.
|
| 229 |
+
[45] Tian Pan, Yibing Song, Tianyu Yang, Wenhao Jiang, and Wei Liu. Videomoco: Contrastive video representation learning with temporally adversarial examples. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021.
|
| 230 |
+
[46] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, 2019.
|
| 231 |
+
[47] Deepak Pathak, Philipp Krähenbühl, Jeff Donahue, Trevor Darrell, and Alexei A. Efros. Context encoders: Feature learning by inpainting. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2016.
|
| 232 |
+
[48] Viorica Patraucean, Ankur Handa, and Roberto Cipolla. Spatio-temporal video autoencoder with differentiable memory. arXiv preprint arXiv:1511.06309, 2015.
|
| 233 |
+
[49] Mandela Patrick, Yuki M. Asano, Polina Kuznetsova, Ruth Fong, João F. Henriques, Geoffrey Zweig, and Andrea Vedaldi. Multi-modal self-supervision from generalized data transformations. In IEEE/CVF International Conference on Computer Vision, 2021.
|
| 234 |
+
[50] Mandela Patrick, Dylan Campbell, Yuki M. Asano, Ishan Misra Florian Metze, Christoph Feichtenhofer, Andrea Vedaldi, and Joo F. Henriques. Keeping your eye on the ball: Trajectory attention in video transformers. In Advances in Neural Information Processing Systems, 2021.
|
| 235 |
+
[51] AJ Piergiovanni, Anelia Angelova, and Michael S Ryoo. Evolving losses for unsupervised video representation learning. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020.
|
| 236 |
+
[52] Rui Qian, Tianjian Meng, Boqing Gong, Ming-Hsuan Yang, Huisheng Wang, Serge Belongie, and Yin Cui. Spatiotemporal contrastive video representation learning. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021.
|
| 237 |
+
[53] Rui Qian, Tianjian Meng, Boqing Gong, Ming-Hsuan Yang, Huisheng Wang, Serge J. Belongie, and Yin Cui. Spatiotemporal contrastive video representation learning. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021.
|
| 238 |
+
[54] Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. OpenAI blog, 2018.
|
| 239 |
+
[55] Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI blog, 2019.
|
| 240 |
+
[56] Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In International Conference on Machine Learning, 2021.
|
| 241 |
+
[57] 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, 2015.
|
| 242 |
+
[58] Karen Simonyan and Andrew Zisserman. Two-stream convolutional networks for action recognition in videos. Advances in Neural Information Processing Systems, 2014.
|
| 243 |
+
[59] Ankit Singh, Omprakash Chakraborty, Ashutosh Varshney, Rameswar Panda, Rogerio Feris, Kate Saenko, and Abir Das. Semi-supervised action recognition with temporal contrastive learning. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021.
|
| 244 |
+
[60] Khurram Soomro, Amir Roshan Zamir, and Mubarak Shah. Ucf101: A dataset of 101 human actions classes from videos in the wild. arXiv preprint arXiv:1212.0402, 2012.
|
| 245 |
+
[61] Nitish Srivastava, Elman Mansimov, and Ruslan Salakhutdinov. Unsupervised learning of video representations using lstms. International Conference on Machine Learning, 2015.
|
| 246 |
+
[62] Jonathan C. Stroud, David A. Ross, Chen Sun, Jia Deng, Rahul Sukthankar, and Cordelia Schmid. Learning video representations from textual web supervision. CoRR, abs/2007.14937, 2020.
|
| 247 |
+
[63] Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2016.
|
| 248 |
+
[64] Hao Tan, Jie Lei, Thomas Wolf, and Mohit Bansal. Vimpac: Video pre-training via masked token prediction and contrastive learning. arXiv preprint arXiv:2106.11250, 2021.
|
| 249 |
+
[65] Jiajun Tang, Jin Xia, Xinzhi Mu, Bo Pang, and Cewu Lu. Asynchronous interaction aggregation for action detection. In European Conference on Computer Vision, 2020.
|
| 250 |
+
[66] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. In International Conference on Machine Learning, 2021.
|
| 251 |
+
[67] Du Tran, Lubomir Bourdev, Rob Fergus, Lorenzo Torresani, and Manohar Paluri. Learning spatiotemporal features with 3d convolutional networks. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2015.
|
| 252 |
+
[68] Du Tran, Heng Wang, Matt Feiszli, and Lorenzo Torresani. Video classification with channel-separated convolutional networks. In IEEE/CVF International Conference on Computer Vision, 2019.
|
| 253 |
+
[69] Du Tran, Heng Wang, Lorenzo Torresani, Jamie Ray, Yann LeCun, and Manohar Paluri. A closer look at spatiotemporal convolutions for action recognition. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2018.
|
| 254 |
+
[70] 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, 2017.
|
| 255 |
+
[71] Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoine Manzagol. Extracting and composing robust features with denoising autoencoders. In International Conference on Machine Learning, 2008.
|
| 256 |
+
[72] Pascal Vincent, Hugo Larochelle, Isabelle Lajoie, Yoshua Bengio, and Pierre-Antoine Manzagol. Stacked denoising autoencoders: Learning useful representations in a deep network with a local denoising criterion. Journal of Machine Learning Research, 2010.
|
| 257 |
+
[73] Jiangliu Wang, Jianbo Jiao, and Yun-Hui Liu. Self-supervised video representation learning by pace prediction. In European Conference on Computer Vision, 2020.
|
| 258 |
+
[74] Limin Wang, Zhan Tong, Bin Ji, and Gangshan Wu. TDN: Temporal difference networks for efficient action recognition. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021.
|
| 259 |
+
[75] 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, 2019.
|
| 260 |
+
[76] Rui Wang, Dongdong Chen, Zuxuan Wu, Yinpeng Chen, Xiyang Dai, Mengchen Liu, Yu-Gang Jiang, Luowei Zhou, and Lu Yuan. Bevt: Bert pretraining of video transformers. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022.
|
| 261 |
+
[77] Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2018.
|
| 262 |
+
[78] Xiaolong Wang and Abhinav Gupta. Unsupervised learning of visual representations using videos. In IEEE/CVF International Conference on Computer Vision, 2015.
|
| 263 |
+
[79] Chen Wei, Haoqi Fan, Saining Xie, Chao-Yuan Wu, Alan Yuille, and Christoph Feichtenhofer. Masked feature prediction for self-supervised visual pre-training. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022.
|
| 264 |
+
[80] Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M Alvarez, and Ping Luo. Segformer: Simple and efficient design for semantic segmentation with transformers. In Advances in Neural Information Processing Systems, 2021.
|
| 265 |
+
[81] Zhenda Xie, Zheng Zhang, Yue Cao, Yutong Lin, Jianmin Bao, Zhuliang Yao, Qi Dai, and Han Hu. Simmim: A simple framework for masked image modeling. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022.
|
| 266 |
+
[82] Dejing Xu, Jun Xiao, Zhou Zhao, Jian Shao, Di Xie, and Yueting Zhuang. Self-supervised spatiotemporal learning via video clip order prediction. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2019.
|
| 267 |
+
[83] Wilson Yan, Yunzhi Zhang, Pieter Abbeel, and Aravind Srinivas. Videogpt: Video generation using VQ-VAE and transformers. arXiv preprint arXiv:2104.10157, 2021.
|
| 268 |
+
[84] Ceyuan Yang, Yinghao Xu, Bo Dai, and Bolei Zhou. Video representation learning with visual tempo consistency. arXiv preprint arXiv:2006.15489, 2020.
|
| 269 |
+
[85] Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. In IEEE/CVF International Conference on Computer Vision, 2019.
|
| 270 |
+
[86] Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017.
|
| 271 |
+
[87] Zhang Zhang and Dacheng Tao. Slow feature analysis for human action recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2012.
|
| 272 |
+
[88] Daquan Zhou, Bingyi Kang, Xiaojie Jin, Linjie Yang, Xiaochen Lian, Qibin Hou, and Jiashi Feng. Deepvit: Towards deeper vision transformer. arXiv preprint arXiv:2103.11886, 2021.
|
| 273 |
+
[89] Jinghao Zhou, Chen Wei, Huiyu Wang, Wei Shen, Cihang Xie, Alan Yuille, and Tao Kong. iBOT: Image bert pre-training with online tokenizer. International Conference on Learning Representations, 2022.
|
| 274 |
+
|
| 275 |
+
# Checklist
|
| 276 |
+
|
| 277 |
+
1. For all authors...
|
| 278 |
+
|
| 279 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 280 |
+
(b) Did you describe the limitations of your work? [Yes] Shown in Section 5.
|
| 281 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] Shown in Section 5.
|
| 282 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 283 |
+
|
| 284 |
+
2. If you are including theoretical results...
|
| 285 |
+
|
| 286 |
+
(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]
|
| 287 |
+
|
| 288 |
+
3. If you ran experiments...
|
| 289 |
+
|
| 290 |
+
(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] Shown in Section 4.1 and Appendix $\ S \ B$ .
|
| 291 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Shown in Appendix $\ S \ O $ .
|
| 292 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Because of the computation costs, we did not run the experiments multiple times.
|
| 293 |
+
(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 Table 3 and Appendix $\ S \mathrm { ~ B ~ }$ .
|
| 294 |
+
|
| 295 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 296 |
+
|
| 297 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 298 |
+
(b) Did you mention the license of the assets? [Yes] Shown in Appendix $\ S ~ ^ { \intercal }$ .
|
| 299 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 300 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] We used publicly available datasets whose licenses allow research usage.
|
| 301 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] To the best of our knowledge, the data we used contains no personally identifiable information or offensive content.
|
| 302 |
+
|
| 303 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 304 |
+
|
| 305 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 306 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 307 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/EXnIyMVTL8s/EXnIyMVTL8s.md
ADDED
|
@@ -0,0 +1,719 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TOWARDS UNDERSTANDING AND MITIGATING DIMENSIONAL COLLAPSE IN HETEROGENEOUS FEDERATED LEARNING
|
| 2 |
+
|
| 3 |
+
Yujun $\mathbf { S h i } ^ { 1 \mathrm { ~ * ~ } }$ Jian Liang3 Wenqing Zhang2 Vincent Y. F. Tan1 Song Bai2 1National University of Singapore 2ByteDance Inc. 3Institute of Automation, CAS shi.yujun@u.nus.edu vtan@nus.edu.sg songbai.site@gmail.com
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Federated learning aims to train models collaboratively across different clients without sharing data for privacy considerations. However, one major challenge for this learning paradigm is the data heterogeneity problem, which refers to the discrepancies between the local data distributions among various clients. To tackle this problem, we first study how data heterogeneity affects the representations of the globally aggregated models. Interestingly, we find that heterogeneous data results in the global model suffering from severe dimensional collapse, in which representations tend to reside in a lower-dimensional space instead of the ambient space. Moreover, we observe a similar phenomenon on models locally trained on each client and deduce that the dimensional collapse on the global model is inherited from local models. In addition, we theoretically analyze the gradient flow dynamics to shed light on how data heterogeneity result in dimensional collapse for local models. To remedy this problem caused by the data heterogeneity, we propose FEDDECORR, a novel method that can effectively mitigate dimensional collapse in federated learning. Specifically, FEDDECORR applies a regularization term during local training that encourages different dimensions of representations to be uncorrelated. FEDDECORR, which is implementation-friendly and computationally-efficient, yields consistent improvements over baselines on standard benchmark datasets. Code: https://github.com/bytedance/FedDecorr.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
With the rapid development deep learning and the availability of large amounts of data, concerns regarding data privacy have been attracting increasingly more attention from industry and academia. To address this concern, McMahan et al. (2017) propose Federated Learning—a decentralized training paradigm enabling collaborative training across different clients without sharing data.
|
| 12 |
+
|
| 13 |
+
One major challenge in federated learning is the potential discrepancies in the distributions of local training data among clients, which is known as the data heterogeneity problem. In particular, this paper focuses on the heterogeneity of label distributions (see Fig. 1(a) for an example). Such discrepancies can result in drastic disagreements between the local optima of the clients and the desired global optimum, which may lead to severe performance degradation of the global model. Previous works attempting to tackle this challenge mainly focus on the model parameters, either during local training (Li et al., 2020; Karimireddy et al., 2020) or global aggregation (Wang et al., 2020b). However, these methods usually result in an excessive computation burden or high communication costs (Li et al., 2021a) because deep neural networks are typically heavily over-parameterized. In contrast, in this work, we focus on the representation space of the model and study the impact of data heterogeneity.
|
| 14 |
+
|
| 15 |
+
To commence, we study how heterogeneous data affects the global model in federated learning in Sec. 3.1. Specifically, we compare representations produced by global models trained under different degrees of data heterogeneity. Since the singular values of the covariance matrix provide a comprehensive characterization of the distribution of high-dimensional embeddings, we use it to study the representations output by each global model. Interestingly, we find that as the degree of data heterogeneity increases, more singular values tend to evolve towards zero. This observation suggests that stronger data heterogeneity causes the trained global model to suffer from more severe dimensional collapse, whereby representations are biased towards residing in a lower-dimensional space (or manifold). A graphical illustration of how heterogeneous training data affect output representations is shown in Fig. 1(b-c). Our observations suggest that dimensional collapse might be one of the key reasons why federated learning methods struggle under data heterogeneity. Essentially, dimensional collapse is a form of oversimplification in terms of the model, where the representation space is not being fully utilized to discriminate diverse data of different classes.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: (a) illustrates data heterogeneity in terms of number of samples per class. (b), (c), (d) show representations (normalized to the unit sphere) of global models trained under homogeneous data, heterogeneous data, and heterogeneous data with FEDDECORR, respectively. Only (c) suffers dimensional collapse. (b), (c), (d) are produced with ResNet20 on CIFAR10. Best viewed in color.
|
| 19 |
+
|
| 20 |
+
Given the observations made on the global model, we conjecture that the dimensional collapse of the global model is inherited from models locally trained on various clients. This is because the global model is a result of the aggregation of local models. To validate our conjecture, we further visualize the local models in terms of the singular values of representation covariance matrices in Sec. 3.2. Similar to the visualization on the global model, we observe dimensional collapse on representations produced by local models. With this observation, we establish the connection between dimensional collapse of the global model and local models. To further understand the dimensional collapse on local models, we analyze the gradient flow dynamics of local training in Sec. 3.3. Interestingly, we show theoretically that heterogeneous data drive the weight matrices of the local models to be biased to being low-rank, which further results in representation dimensional collapse.
|
| 21 |
+
|
| 22 |
+
Inspired by the observations that dimensional collapse of the global model stems from local models, we consider mitigating dimensional collapse during local training in Sec. 4. In particular, we propose a novel federated learning method termed FEDDECORR. FEDDECORR adds a regularization term during local training to encourage the Frobenius norm of the correlation matrix of representations to be small. We show theoretically and empirically that this proposed regularization term can effectively mitigate dimensional collapse (see Fig. 1(d) for example). Next, in Sec. 5, through extensive experiments on standard benchmark datasets including CIFAR10, CIFAR100, and TinyImageNet, we show that FEDDECORR consistently improves over baseline federated learning methods. In addition, we find that FEDDECORR yields more dramatic improvements in more challenging federated learning setups such as stronger heterogeneity or more number of clients. Lastly, FEDDECORR has extremely low computation overhead and can be built on top of any existing federated learning baseline methods, which makes it widely applicable.
|
| 23 |
+
|
| 24 |
+
Our contributions are summarized as follows. First, we discover through experiments that stronger data heterogeneity in federated learning leads to greater dimensional collapse for global and local models. Second, we develop a theoretical understanding of the dynamics behind our empirical discovery that connects data heterogeneity and dimensional collapse. Third, based on the motivation of mitigating dimensional collapse, we propose a novel method called FEDDECORR, which yields consistent improvements while being implementation-friendly and computationally-efficient.
|
| 25 |
+
|
| 26 |
+
# 2 RELATED WORKS
|
| 27 |
+
|
| 28 |
+
Federated Learning. McMahan et al. (2017) proposed FedAvg, which adopts a simple averaging scheme to aggregate local models into the global model. However, under data heterogeneity, FedAvg suffers from unstable and slow convergence, resulting in performance degradation. To tackle this challenge, previous works either improve local training (Li et al., 2021b; 2020; Karimireddy et al., 2020; Acar et al., 2021; Al-Shedivat et al., 2020; Wang et al., 2021) or global aggregation (Wang et al., 2020b; Hsu et al., 2019; Luo et al., 2021; Wang et al., 2020a; Lin et al., 2020; Reddi et al., 2020; Wang et al., 2020a). Most of these methods focus on the model parameter space, which may result in high computation or communication cost due to deep neural networks being overparameterized. Li et al. (2021b) focuses on model representations and uses a contrastive loss to maximize agreements between representations of local models and the global model. However, one drawback of Li et al. (2021b) is that it requires additional forward passes during training, which almost doubles the training cost. In this work, based on our study of how data heterogeneity affects model representations, we propose an effective yet highly efficient method to handle heterogeneous data. Another research trend is in personalized federated learning (Arivazhagan et al., 2019; Li et al., 2021c; Fallah et al., 2020; T Dinh et al., 2020; Hanzely et al., 2020; Huang et al., 2021; Zhang et al., 2020), which aims to train personalized local models for each client. In this work, however, we focus on the typical setting that aims to train one global model for all clients.
|
| 29 |
+
|
| 30 |
+
Dimensional Collapse. Dimensional collapse of representations has been studied in metric learning (Roth et al., 2020), self-supervised learning (Jing et al., 2021), and class incremental learning (Shi et al., 2022). In this work, we focus on federated learning and discover that stronger data heterogeneity causes a higher degree of dimensional collapse for locally trained models. To the best of our knowledge, this work is the first to discover and analyze dimensional collapse of representations in federated learning.
|
| 31 |
+
|
| 32 |
+
Gradient Flow Dynamics. Arora et al. (2018; 2019) introduce the gradient flow dynamics framework to analyze the dynamics of multi-layer linear neural networks under the $\ell _ { 2 }$ -loss and find deeper neural networks biasing towards low-rank solution during optimization. Following their works, Jing et al. (2021) finds two factors that cause dimensional collapse in self-supervised learning, namely strong data augmentation and implicit regularization from depth. Differently, we focus on federated learning with the cross-entropy loss. More importantly, our analysis focuses on dimensional collapse caused by data heterogeneity in federated learning instead of depth of neural networks.
|
| 33 |
+
|
| 34 |
+
Feature Decorrelation. Feature decorrelation had been used for different purposes, such as preventing mode collapse in self-supervised learning (Bardes et al., 2021; Zbontar et al., 2021; Hua et al., 2021), boosting generalization (Cogswell et al., 2015; Huang et al., 2018; Xiong et al., 2016), and improving class incremental learning (Shi et al., 2022). We instead apply feature decorrelation to counter the undesired dimensional collapse caused by data heterogeneity in federated learning.
|
| 35 |
+
|
| 36 |
+
# 3 DIMENSIONAL COLLAPSE CAUSED BY DATA HETEROGENEITY
|
| 37 |
+
|
| 38 |
+
In this section, we first empirically visualize and compare representations of global models trained under different degrees of data heterogeneity in Sec. 3.1. Next, to better understand the observations on global models, we analyze representations of local models in Sec. 3.2. Finally, to theoretically understand our observations, we analyze the gradient flow dynamics of local training in Sec. 3.3.
|
| 39 |
+
|
| 40 |
+
# 3.1 EMPIRICAL OBSERVATIONS ON THE GLOBAL MODEL
|
| 41 |
+
|
| 42 |
+
We first empirically demonstrate that stronger data heterogeneity causes more severe dimensional collapse on the global model. Specifically, we first separate the training samples of CIFAR100 into 10 splits, each corresponding to the local data of one client. To simulate data heterogeneity among clients as in previous works (Yurochkin et al., 2019; Wang et al., 2020a; Li et al., 2021b), we sample a probability vector $\mathbf { p } _ { c } = ( p _ { c , 1 } , p _ { c , 2 } , \hdots , p _ { c , K } ) \sim { \mathrm { D i r } } _ { K } ( \alpha )$ and allocate a $p _ { c , k }$ proportion of instances of class $c \in [ C ] = \{ 1 , 2 , \ldots , C \}$ to client $k \in [ K ]$ , where $\operatorname { D i r } _ { K } ( \alpha )$ is the Dirichlet distribution with $K$ categories and $\alpha$ is the concentration parameter. A smaller $\alpha$ implies stronger data heterogeneity $\alpha = \infty$ corresponds to the homogeneous setting). We let $\alpha \in \{ 0 . 0 1 , 0 . 0 5 , 0 . 2 5 , \infty \}$ .
|
| 43 |
+
|
| 44 |
+
For each of the settings generated by different $\alpha$ ’s, we apply FedAvg (McMahan et al., 2017) to train a MobileNetV2 (Sandler et al., 2018) with CIFAR100 (observations on other federated learning methods, model architectures, or datasets are similar and are provided in Appendix D). Next, for each of the four trained global models, we compute the covariance matrix $\begin{array} { r } { \mathbf { \tilde { \Sigma } } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } ( \mathbf { z } _ { i } - } \end{array}$ $\bar { \mathbf { z } } ) ( \mathbf { z } _ { i } - \bar { \mathbf { z } } ) ^ { \top }$ of the representations over the $N$ test data points in CIFAR100. Here $\mathbf { z } _ { i }$ is the $i$ -th test data point and $\begin{array} { r } { \bar { \bf z } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } { \bf z } _ { i } } \end{array}$ is their average.
|
| 45 |
+
|
| 46 |
+

|
| 47 |
+
Figure 2: Data heterogeneity causes dimensional collapse on (a) global models and (b) local models. We plot the singular values of the covariance matrix of representations in descending order. The $x$ -axis $( k )$ is the index of singular values and the $y$ -axis is the logarithm of the singular values.
|
| 48 |
+
|
| 49 |
+
Finally, we apply the singular value decomposition (SVD) on each of the covariance matrices and visualize the top 100 singular values in Fig. 2(a). If we define a small value $\tau$ as the threshold for a singular value to be significant (e.g., $\log \tau = - 2$ ), we observe that for the homogeneous setting, almost all the singular values are significant, i.e., they surpass $\tau$ . However, as $\alpha$ decreases, the number of singular values exceeding $\tau$ monotonically decreases. This implies that with stronger heterogeneity among local training data, the representation vectors produced by the trained global model tend to reside in a lower-dimensional space, corresponding to more severe dimensional collapse.
|
| 50 |
+
|
| 51 |
+
# 3.2 EMPIRICAL OBSERVATIONS ON LOCAL MODELS
|
| 52 |
+
|
| 53 |
+
Since the global model is obtained by aggregating locally trained models on each client, we conjecture that the dimensional collapse observed on the global model stems from the dimensional collapse of local models. To further validate our conjecture, we continue to study whether increasing data heterogeneity will also lead to more severe dimensional collapse on locally trained models.
|
| 54 |
+
|
| 55 |
+
Specifically, for different $\alpha$ ’s, we visualize the locally trained model of one client (visualizations on local models of other clients are similar and are provided in Appendix E). Following the same procedure as in Sec. 3.1, we plot the singular values of covariance matrices of representations produced by the local models. We observe from Fig. 2(b) that locally trained models demonstrate the same trend as the global models—namely, that the presence of stronger data heterogeneity causes more severe dimensional collapse. These experiments corroborate that the global model inherit the adverse dimensional collapse phenomenon from the local models.
|
| 56 |
+
|
| 57 |
+
# 3.3 A THEORETICAL EXPLANATION FOR DIMENSIONAL COLLAPSE
|
| 58 |
+
|
| 59 |
+
Based on the empirical observations in Sec. 3.1 and Sec. 3.2, we now develop a theoretical understanding to explain why heterogeneous training data causes dimensional collapse for the learned representations.
|
| 60 |
+
|
| 61 |
+
Since we have established that the dimensional collapse of global model stems from local models, we focus on studying local models in this section. Without loss of generality, we study local training of one arbitrary client. Specifically, we first analyze the gradient flow dynamics of the model weights during the local training. This analysis shows how heterogeneous local training data drives the model weights towards being low-rank, which leads to dimensional collapse for the representations.
|
| 62 |
+
|
| 63 |
+
# 3.3.1 SETUPS AND NOTATIONS
|
| 64 |
+
|
| 65 |
+
We denote the number of training samples as $N$ , the dimension of input data as $d _ { \mathrm { i n } }$ , and total number of classes as $C$ . The $i$ -th sample is denoted as $X _ { i } \in \mathbb { R } ^ { d _ { \mathrm { i n } } }$ , and its corresponding one-hot encoded label is $\mathbf { y } _ { i } \in \mathbb { R } ^ { C }$ . The collection of all $N$ training samples is denoted as $\bar { X } = [ \bar { X } _ { 1 } , X _ { 2 } \ldots , X _ { N } ] \in$ $\mathbb { R } ^ { d _ { \mathrm { i n } } \times N }$ , and the $N$ one-hot encoded training labels are denoted as $\mathbf { y } = [ \mathbf { y } _ { 1 } , \mathbf { y } _ { 2 } , \ldots , \mathbf { y } _ { N } ] \in \mathbb { R } ^ { C \times N }$ .
|
| 66 |
+
|
| 67 |
+
For simplicity in exposition, we follow Arora et al. (2018; 2019) and Jing et al. (2021) and analyze linear neural networks (without nonlinear activation layers). We consider an $( L + 1 )$ -layer (where $L \geq 1 \AA$ ) linear neural network trained using the cross entropy loss under gradient flow (i.e., gradient descent with an infinitesimally small learning rate). The weight matrix of the $i$ -th layer $( i \in [ L + 1 ] )$ ) at the optimization time step $t$ is denoted as $W _ { i } ( t )$ . The dynamics can be expressed as
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\dot { W } _ { i } ( t ) = - \frac { \partial } { \partial W _ { i } } \ell ( W _ { 1 } ( t ) , \ldots , W _ { L + 1 } ( t ) ) ,
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
where $\ell$ denotes the cross-entropy loss.
|
| 74 |
+
|
| 75 |
+
In addition, at the optimization time step $t$ and given the input data $X _ { i }$ , we denote $\mathbf { z } _ { i } ( t ) \in \mathbb { R } ^ { d }$ as the output representation vector $d$ being the dimension of the representations) and $\gamma _ { i } ( t ) \in \mathbb { R } ^ { C }$ as the output softmax probability vector. We have
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
\gamma _ { i } ( t ) = \mathrm { s o f t m a x } ( W _ { L + 1 } ( t ) { \mathbf z } _ { i } ( t ) ) = \mathrm { s o f t m a x } ( W _ { L + 1 } ( t ) W _ { L } ( t ) \ldots W _ { 1 } ( t ) X _ { i } ) .
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
e define -dimens $\begin{array} { r } { \mu _ { c } = \frac { N _ { c } } { N } } \end{array}$ , where -hot vec $N _ { c }$ is number of d where only the a samples belonging to class -th entry is 1 (and the others $c$ . We denote re 0). In ad $\mathbf { e } _ { c }$ as theon, let $C$ $c$
|
| 82 |
+
$\begin{array} { r } { \bar { \gamma } _ { c } ( t ) = \frac { 1 } { N _ { c } } \sum _ { i = 1 } ^ { N } \gamma _ { i } ( t ) \mathbb { 1 } \{ \mathbf { y } _ { i } = \mathbf { e } _ { c } \} } \end{array}$ and $\begin{array} { r } { \bar { X } _ { c } = \frac { 1 } { N _ { c } } \sum _ { i = 1 } ^ { N } X _ { i } \mathbb { { l } } \{ \mathbf { y } _ { i } = \mathbf { e } _ { c } \} } \end{array}$ .
|
| 83 |
+
|
| 84 |
+
# 3.3.2 ANALYSIS ON GRADIENT FLOW DYNAMICS
|
| 85 |
+
|
| 86 |
+
Since our goal is to analyze model representations ${ \bf z } _ { i } ( t )$ , we focus on weight matrices that directly produce representations (i.e., the first $L$ layers). We denote the product of the weight matrices of the first $L$ layers as $\Pi ( t ) = W _ { L } ( t ) W _ { L - 1 } ( \dot { t } ) \dots W _ { 1 } ( t )$ and analyze the behavior of $\Pi ( t )$ under the gradient flow dynamics. In particular, we derive the following result for the singular values of $\Pi ( t )$ .
|
| 87 |
+
|
| 88 |
+
Theorem 1 (Informal). Assuming that the mild conditions as stated in Appendix $A . 3$ hold. Let $\sigma _ { k } ( t )$ for $k \in [ d ]$ be the $k$ -th largest singular value of $\Pi ( t )$ . Then,
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
\begin{array} { r } { \dot { \sigma } _ { k } ( t ) = N L \left( \sigma _ { k } ( t ) \right) ^ { 2 - \frac { 2 } { L } } \sqrt { ( \sigma _ { k } ( t ) ) ^ { \frac { 2 } { L } } + M } \left( \mathbf { u } _ { L + 1 , k } ( t ) \right) ^ { \top } G ( t ) \mathbf { v } _ { k } ( t ) , } \end{array}
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
where ${ \mathbf { u } } _ { L + 1 , k } ( t )$ is the $k$ -th left singular vector of $W _ { L + 1 } ( t )$ , $\mathbf { v } _ { k } ( t )$ is the $k$ -th right singular vector of $\Pi ( t )$ , $M$ is a constant, and $G ( t )$ is defined as
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
G ( t ) = \sum _ { c = 1 } ^ { C } \mu _ { c } ( \mathbf { e } _ { c } - \bar { \gamma } _ { c } ( t ) ) \bar { X } _ { c } ^ { \top } ,
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
where $\mu _ { c }$ $\iota _ { c } , \mathbf { e } _ { c } , \bar { \gamma } _ { c } ( t )$ , $\bar { X } _ { c }$ are defined after Eqn. (2).
|
| 101 |
+
|
| 102 |
+
The proof of the precise version of Theorem 1 is provided in Appendix A.
|
| 103 |
+
|
| 104 |
+
Based on Theorem 1, we are able to explain why greater data heterogeneity causes $\Pi ( t )$ to be biased to become lower-rank. Note that strong data heterogeneity causes local training data of one client being highly imbalanced in terms of the number of data samples per class (recall Fig. 1(a)). This implies that $\mu _ { c }$ , which is the proportion of the class $c$ data, will be close to 0 for some classes.
|
| 105 |
+
|
| 106 |
+
Next, based on the definition of $G ( t )$ in Eqn. (4), more $\mu _ { c }$ ’s being close to 0 leads to $G ( t )$ being biased towards a low-rank matrix. If this is so, the term $( \mathbf { \bar { u } } _ { L + 1 , k } ( \mathbf { \bar { \Psi } } _ { k } ( t ) ) ^ { \top } G ( t ) \mathbf { v } _ { k } ( t )$ in Eqn. (3) will only be significant (large in magnitude) for fewer values of $k$ . This is because ${ \bf u } _ { L + 1 , k } ( t )$ and $\mathbf { v } _ { k } ( t )$ are both singular vectors, which are orthogonal among different $k$ ’s. This further leads to $\dot { \sigma } _ { k } ( t )$ on the left-hand side of Eqn. (3), which is the evolving rate of $\sigma _ { k }$ , being small for most of the $k$ ’s throughout training. These observations imply that only relatively few singular values of $\Pi ( t )$ will increase significantly after training.
|
| 107 |
+
|
| 108 |
+
Furthermore, $\Pi ( t )$ being biased towards being low-rank will directly lead to dimensional collapse for the representations. To see this, we simply write the covariance matrix of the representations in terms of ${ \bar { \Pi } } ( t )$ as
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
\Sigma ( t ) = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } ( { \bf z } _ { i } ( t ) - \bar { \bf z } ( t ) ) ( { \bf z } _ { i } ( t ) - \bar { \bf z } ( t ) ) ^ { \top } = \Pi ( t ) \biggl ( \frac { 1 } { N } \sum _ { i = 1 } ^ { N } ( X _ { i } - \bar { X } ) ( X _ { i } - \bar { X } ) ^ { \top } \biggr ) \Pi ( t ) ^ { \top } .
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
From Eqn. (5), we observe that if $\Pi ( t )$ evolves to being a lower-rank matrix, $\Sigma ( t )$ will also tend to be lower-rank, which corresponds to the stronger dimensional collapse observed in Fig. 2(b).
|
| 115 |
+
|
| 116 |
+

|
| 117 |
+
Figure 3: FEDDECORR effectively mitigates dimensional collapse for (a-b) local models and (c-d) global models. For each heterogeneity parameter $\alpha \in \{ 0 . 0 1 , 0 . { \overset { \cdot } { 0 } } 5 \}$ , we apply FEDDECORR and plot the singular values of the representation covariance matrix. The $x$ -axis $( k )$ is the index of singular values. With FEDDECORR, the tail singular values are prevented from dropping to 0 too rapidly.
|
| 118 |
+
|
| 119 |
+
# 4 MITIGATING DIMENSIONAL COLLAPSE WITH FEDDECORR
|
| 120 |
+
|
| 121 |
+
Motivated by the above observations and analyses on dimensional collapse caused by data heterogeneity in federated learning, we explore how to mitigate excessive dimensional collapse.
|
| 122 |
+
|
| 123 |
+
Since dimensional collapse on the global model is inherited from local models, we propose to alleviate the problem during local training. One natural way to achieve this is to add the following regularization term on the representations during training
|
| 124 |
+
|
| 125 |
+
$$
|
| 126 |
+
L _ { \mathrm { s i n g u l a r } } ( w , X ) = { \frac { 1 } { d } } \sum _ { i = 1 } ^ { d } { \bigg ( } \lambda _ { i } - { \frac { 1 } { d } } \sum _ { j = 1 } ^ { d } \lambda _ { j } { \bigg ) } ^ { 2 } ,
|
| 127 |
+
$$
|
| 128 |
+
|
| 129 |
+
where $\lambda _ { i }$ is the $i$ -th singular value of the covariance matrix of the representations. Essentially, $L _ { \mathrm { s i n g u l a r } }$ penalizes the variance among the singular values, thus discouraging the tail singular values from collapsing to 0, mitigating dimensional collapse. However, this regularization term is not practical as it requires calculating all the singular values, which is computationally expensive.
|
| 130 |
+
|
| 131 |
+
Therefore, to derive a computationally-cheap training objective, we first apply the $\mathbf { Z }$ -score normalization on all the representation vectors $\mathbf { z } _ { i }$ as follows: $\hat { \mathbf { z } } _ { i } = ( \mathbf { z } _ { i } - \bar { \mathbf { z } } ) / \sqrt { \mathrm { V a r } ( \mathbf { z } ) }$ . This results in the covariance matrix of $\hat { \mathbf { z } } _ { i }$ being equal to its correlation matrix (i.e., the matrix of correlation coefficients). The following proposition suggests a more convenient cost function to regularize.
|
| 132 |
+
|
| 133 |
+
Proposition 1. For a $d$ -by- $d$ correlation matrix $K$ with singular values $( \lambda _ { 1 } , \ldots , \lambda _ { d } )$ , we have:
|
| 134 |
+
|
| 135 |
+
$$
|
| 136 |
+
\sum _ { i = 1 } ^ { d } \left( \lambda _ { i } - \frac { 1 } { d } \sum _ { j = 1 } ^ { d } \lambda _ { j } \right) ^ { 2 } = \| K \| _ { \mathrm { F } } ^ { 2 } - d .
|
| 137 |
+
$$
|
| 138 |
+
|
| 139 |
+
The proof of Proposition 1 can be found in Appendix B. This proposition suggests that regularizing the Frobenius norm of the correlation matrix $\| K \| _ { \mathrm { F } }$ achieves the same effect as minimizing $L _ { \mathrm { s i n g u l a r } }$ . In contrast to the singular values, $\| K \| _ { \mathrm { F } }$ can be computed efficiently.
|
| 140 |
+
|
| 141 |
+
To leverage this proposition, we propose a novel method, FEDDECORR, which regularizes the Frobenius norm of the correlation matrix of the representation vectors during local training on each client. Formally, the proposed regularization term is defined as:
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
L _ { \mathrm { F e d D e c o r r } } ( w , X ) = \frac { 1 } { d ^ { 2 } } \| K \| _ { \mathrm { F } } ^ { 2 } ,
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
where $w$ is the model parameters, $K$ is the correlation matrix of the representations. The overall objective of each local client is
|
| 148 |
+
|
| 149 |
+
$$
|
| 150 |
+
\operatorname* { m i n } _ { w } \ell ( w , X , \mathbf { y } ) + \beta L _ { \mathrm { F e d D e c o r r } } ( w , X ) ,
|
| 151 |
+
$$
|
| 152 |
+
|
| 153 |
+
where $\ell$ is the cross entropy loss, and $\beta$ is the regularization coefficient of FEDDECORR. The pseudocode of our method is provided in Appendix $\mathbf { G }$ .
|
| 154 |
+
|
| 155 |
+
To visualize the effectiveness of $L _ { \mathrm { F e d D e c o r r } }$ in mitigating dimensional collapse, we now revisit the experiments of Fig. 2 and apply $L _ { \mathrm { F e d D e c o r r } }$ under the heterogeneous setting where $\alpha \in \{ 0 . 0 1 , 0 . 0 5 \}$ . We plot our results in Fig. 3 for both local and global models. Figs. 3(a-b) show that for local models, FEDDECORR encourages the tail singular values to not collapse to 0, thus effectively mitigating dimensional collapse. Moreover, as illustrated in Figs. 3(c-d), this desirable effect introduced by FEDDECORR on local models can also be inherited by the global models.
|
| 156 |
+
|
| 157 |
+
<table><tr><td rowspan="2">Method</td><td colspan="4">CIFAR10</td><td colspan="4">CIFAR100</td></tr><tr><td>α= 0.05</td><td>0.1</td><td>0.5</td><td>8</td><td>0.05</td><td>0.1</td><td>0.5</td><td>8</td></tr><tr><td>FedAvg</td><td>64.85±2.01 76.28±1.22 89.84±0.13 92.39±0.26 59.87±0.25 66.46±0.16 71.69±0.15 74.54±0.15</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>FedProx</td><td>+ FEDDEC0RR 73.06±0.81 80.60±0.91 89.84±0.05 92.19±0.10 61.53±0.11 67.12±0.09 71.91±0.04 73.87±0.18</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>+ FEDDEC0RR 71.38±0.81 81.74±0.34 89.96±0.26 92.14±0.20 61.33±0.19 67.00±0.46 71.64±0.10 74.15±0.06</td><td></td><td></td><td></td><td></td><td></td><td></td><td>64.11±0.84 76.10±0.40 89.57±0.04 92.38±0.09 60.02±0.46 66.41±0.27 71.78±0.19 74.34±0.03</td><td></td></tr><tr><td>FedAvgM</td><td></td><td></td><td></td><td></td><td>71.34±0.71 77.51±0.58 88.39±0.17 91.35±0.15 59.64±0.20 66.36±0.14 71.17±0.22 74.20±0.16</td><td></td><td></td><td></td></tr><tr><td>MOON</td><td>+ FEDDEC0RR 73.60±0.82 79.21±0.15 88.70±0.26 91.33±0.13 61.48±0.27 66.60±0.1171.26±0.21 73.86±0.25</td><td></td><td></td><td></td><td>68.79±0.69 78.70±0.66 90.08±0.10 92.62±0.17 56.79±0.17 65.48±0.29 71.81±0.14 74.30±0.12</td><td></td><td></td><td></td></tr><tr><td></td><td>+ FEDDEC0RR 73.46±0.84 81.63±0.5590.61±0.05 92.63±0.19 59.43±0.34 66.12±0.20 71.68±0.05 73.70±0.25</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 158 |
+
|
| 159 |
+
Table 1: CIFAR10/100 Experiments. We run experiments under various degrees of heterogeneity $( \alpha \in \{ 0 . 0 5 , 0 . 1 , 0 . 5 , \infty \} )$ and report the test accuracy $( \% )$ . All results are (re)produced by us and are averaged over 3 runs (mean $\pm$ std). Bold font highlights the highest accuracy in each column.
|
| 160 |
+
|
| 161 |
+
# 5 EXPERIMENTS
|
| 162 |
+
|
| 163 |
+
# 5.1 EXPERIMENTAL SETUPS
|
| 164 |
+
|
| 165 |
+
Datasets: We adopt three popular benchmark datasets, namely CIFAR10, CIFAR100, and TinyImageNet. CIFAR10 and CIFAR100 both have 50, 000 training samples and 10, 000 test samples, and the size of each image is $3 2 \times 3 2$ . TinyImageNet contains 200 classes, with 100, 000 training samples and 10, 000 testing samples, and each image is $6 4 \times 6 4$ . The method generating local data for each client was introduced in Sec. 3.1.
|
| 166 |
+
|
| 167 |
+
Implementation Details: Our code is based on the code of Li et al. (2021b). For all experiments, we use MobileNetV2 (Sandler et al., 2018). We run 100 communication rounds for all experiments on the CIFAR10/100
|
| 168 |
+
|
| 169 |
+
<table><tr><td rowspan="2">Method</td><td colspan="3">TinyImageNet</td></tr><tr><td>α = 0.050.1</td><td>0.5</td><td>8</td></tr><tr><td>FedAvg</td><td colspan="3">35.02±0.46 39.30±0.23 46.92±0.25 49.33±0.19</td></tr><tr><td></td><td colspan="3">+ FEDDEC0RR 40.29±0.18 43.86±0.50 50.01±0.27 52.63±0.26</td></tr><tr><td>FedProx</td><td colspan="3">35.20±0.30 39.66±0.43 47.16±0.0749.76±0.36 + FEDDEC0RR 40.63±0.05 44.19±0.14 50.26±0.27 52.37±0.36</td></tr><tr><td>FedAvgM</td><td colspan="3">34.81±0.09 39.72±0.11 47.11±0.04 49.67±0.25</td></tr><tr><td></td><td colspan="3">+ FEDDEC0RR 39.97±0.23 43.95±0.26 50.14±0.11 52.05±0.37</td></tr><tr><td>MOON</td><td colspan="3">35.23±0.26 40.53±0.28 47.25±0.6650.48±0.57 + FEDDEC0RR 40.40±0.24 44.20±0.22 50.81±0.51 53.01±0.45</td></tr></table>
|
| 170 |
+
|
| 171 |
+
Table 2: TinyImageNet Experiments. We run with $\alpha \in$ $\{ 0 . 0 5 , 0 . 1 , 0 . 5 , \infty \} )$ and report the test accuracy $( \% )$ . All results are (re)produced by us and are averaged over 3 runs (mean $\pm$ std is reported). Bold font highlights the highest accuracy in each column.
|
| 172 |
+
|
| 173 |
+
datasets and 50 communication rounds on the TinyImageNet dataset. We conduct local training for 10 epochs in each communication round using SGD optimizer with a learning rate of 0.01, a SGD momentum of 0.9, and a batch size of 64. The weight decay is set to $1 0 ^ { - 5 }$ for CIFAR10 and $1 0 ^ { - 4 }$ for CIFAR100 and TinyImageNet. We apply the data augmentation of Cubuk et al. (2018) in all CIFAR100 and TinyImageNet experiments. The $\beta$ of FEDDECORR (i.e., $\beta$ in Eqn. (9)) is tuned to be 0.1. The details of tuning hyper-parameters for other federated learning methods are described in Appendix F.
|
| 174 |
+
|
| 175 |
+
# 5.2 FEDDECORR SIGNIFICANTLY IMPROVES BASELINE METHODS
|
| 176 |
+
|
| 177 |
+
To validate the effectiveness of our method, we apply FEDDECORR to four baselines, namely FedAvg (McMahan et al., 2017), FedAvgM (Hsu et al., 2019), FedProx (Li et al., 2020), and MOON (Li et al., 2021b). We partition the three benchmark datasets (CIFAR10, CIFAR100, and TinyImageNet) into 10 clients with $\alpha \in \{ 0 . 0 5 , 0 . 1 , 0 . 5 , \infty \}$ . Since $\alpha = \infty$ is the homogeneous setting where local models should be free from the pitfall of excessive dimensional collapse, we only expect FEDDECORR to perform on par with the baselines in this setting.
|
| 178 |
+
|
| 179 |
+
We display the CIFAR10/100 results in Tab. 1 and the TinyImageNet results in Tab. 2. We observe that for all of the heterogeneous settings on all datasets, the highest accuracies are achieved by adding FEDDECORR on top of a certain baseline method. In particular, in the strongly heterogeneous settings where $\alpha \in \{ 0 . 0 5 , 0 . 1 \}$ , adding FEDDECORR yields significant improvements of around $2 \% \sim \mathbf { \bar { g } } \%$ over baseline methods on all datasets. On the other hand, for the less heterogeneous setting of $\alpha = 0 . 5$ , the problem of dimensional collapse is less pronounced as discussed in Sec 3, leading to smaller improvements from FEDDECORR. Such decrease in improvements is a general trend and is also observed on FedProx, FedAvgM, and MOON. In addition, surprisingly, in the homogeneous setting of $\alpha = \infty$ , FEDDECORR still produces around $2 \%$ of improvements on the TinyImageNet dataset. We conjecture that this is because TinyImageNet is much more complicated than the CIFAR datasets, and some other factors besides heterogeneity of label may cause undesirable dimensional collapse in the federated learning setup. Therefore, federated learning on TinyImageNet can benefit from FEDDECORR even in the homogeneous setting.
|
| 180 |
+
|
| 181 |
+

|
| 182 |
+
Figure 4: Test accuracy $( \% )$ at each communication round. Results are averaged over 3 runs. Shaded areas denote one standard deviation above and below the mean.
|
| 183 |
+
|
| 184 |
+
To further demonstrate the advantages of FEDDECORR, we apply it on FedAvg and plot how the test accuracy of the global model evolves throughout the federated learning in Fig. 4. In this figure, if we set a certain value of the testing accuracy as a threshold, we see that adding FEDDECORR significantly reduces the number of communication rounds needed to achieve the given threshold. This further shows that FEDDECORR not only improves the final performance, but also greatly boosts the communication efficiency in federated learning.
|
| 185 |
+
|
| 186 |
+
# 5.3 ABLATION STUDY ON THE NUMBER OF CLIENTS
|
| 187 |
+
|
| 188 |
+
Table 3: Ablation study on the number of clients. Based on TinyImageNet, we run experiments with different number of clients and different amounts of data heterogeneity.
|
| 189 |
+
|
| 190 |
+
<table><tr><td># clients</td><td>Method</td><td>α = 0.05 0.1</td><td>0.5</td></tr><tr><td rowspan="2">10</td><td>FedAvg</td><td>35.02 39.30</td><td>46.92</td></tr><tr><td>+ FEDDECORR</td><td>40.29 43.86</td><td>50.01</td></tr><tr><td rowspan="2">20</td><td>FedAvg</td><td>31.21 35.30</td><td>43.64</td></tr><tr><td>+ FEDDECORR</td><td>39.41 41.27</td><td>46.17</td></tr><tr><td rowspan="2">30</td><td>FedAvg</td><td>26.20 30.88</td><td>37.22</td></tr><tr><td>+ FEDDECORR</td><td>36.50 39.02</td><td>44.38</td></tr><tr><td rowspan="2">50</td><td>FedAvg</td><td>25.70 28.88</td><td>34.89</td></tr><tr><td>+ FEDDECORR</td><td>34.50 36.674</td><td>42.34</td></tr><tr><td rowspan="2">100</td><td>FedAvg</td><td>21.53 </td><td>24.693 30.21</td></tr><tr><td> + FEDDECORR</td><td>30.55</td><td>33.85 38.65</td></tr></table>
|
| 191 |
+
|
| 192 |
+
Next, we study whether the improvements brought by FEDDECORR are preserved as number of clients increases. We partition the TinyImageNet dataset into 10, 20, 30, 50, and 100 clients according to different $\alpha$ ’s, and then run FedAvg with and without FEDDECORR. For
|
| 193 |
+
|
| 194 |
+
the experiments with 10, 20 and 30 clients, we run 50 communication rounds. For the experiments with 50 and 100 clients, we randomly select $2 0 \%$ of the total clients to participate the federated learning in each round and run 100 communication rounds. Results are shown in Tab. 3. From this table, we see that the performance improvements resulting from FEDDECORR increase from around ${ \mathbf 3 \% } \sim { \mathbf 5 \% }$ to around $\mathbf { 7 \% } \sim \mathbf { 1 0 \% }$ with the growth in the number of clients. Therefore, interestingly, we show through experiments that the improvements brought by FEDDECORR can be even more pronounced under the more challenging settings with more clients. Moreover, our experimental results under random client participation show that the improvements from FEDDECORR are robust to such uncertainties. These experiments demonstrate the potential of FEDDECORR to be applied to real world federated learning settings with massive numbers of clients and random client participation.
|
| 195 |
+
|
| 196 |
+

|
| 197 |
+
Figure 5: Ablation study on $\beta$ . We apply FEDDECORR with different choices of $\beta$ on FedAvg.
|
| 198 |
+
|
| 199 |
+
5.4 ABLATION STUDY ON THE REGULARIZATION COEFFICIENT $\beta$
|
| 200 |
+
|
| 201 |
+
Next, we study FEDDECORR’s robustness to the $\beta$ in Eqn. (9) by varying it in the set $\{ 0 . 0 1 , 0 . 0 5 , 0 . 1 , 0 . 2 , 0 . 3 \}$ . We partition the CIFAR10 and TinyImageNet datasets into 10 clients with $\alpha$ equals to 0.05 and 0.1 to simulate the heterogeneous setting. Results are shown in Fig. 5. We observe that, in general, when $\beta$ increases, the performance of FEDDECORR first increases, then plateaus, and finally decreases slightly. These results show that FEDDECORR is relatively insensitive to the choice of $\beta$ , which implies FEDDECORR is an easy-to-tune federated learning method. In addition, among all experimental setups, setting $\beta$ to be 0.1 consistently produces (almost) the best results. Therefore, we recommend $\beta = 0 . 1$ when having no prior information about the dataset.
|
| 202 |
+
|
| 203 |
+
# 5.5 ABLATION STUDY ON THE NUMBER OF LOCAL EPOCHS
|
| 204 |
+
|
| 205 |
+
Lastly, we ablate on the number of local epochs per communication round. We set the number of local epochs $E$ to be in the set $\{ 1 , 5 , 1 0 , 2 0 \}$ . We run experiments with and without FEDDECORR, and we use the CIFAR100 and TinyImageNet datasets with $\alpha$ being 0.05 and 0.1 for this ablation study. Results are shown in Tab. 4, in which one observes that with increasing $E$ , FEDAVG performance first increases and then decreases. This is because when $E$ is too small, the local training cannot converge properly in each communication round. On the other hand, when $E$ is too large, the model parameters of local clients might be driven to be too far from the global optimum. Nevertheless,
|
| 206 |
+
|
| 207 |
+
Table 4: Ablation study on local epochs. Experiments with different number of local epochs $E$ .
|
| 208 |
+
|
| 209 |
+
<table><tr><td rowspan="2">E</td><td rowspan="2">Method</td><td>CIFAR100</td><td>TinyImageNet</td></tr><tr><td>α = 0.05 0.1</td><td>0.05 0.1</td></tr><tr><td rowspan="2">1</td><td>FedAvg</td><td>50.67 55.98</td><td>32.31 34.88</td></tr><tr><td>+ FEDDECORR</td><td>53.18 57.02</td><td>36.49 38.99</td></tr><tr><td rowspan="2">5</td><td>FedAvg</td><td>59.57</td><td>65.0236.02 40.75</td></tr><tr><td> + FEDDECORR</td><td>61.42 65.98</td><td>41.68 44.77</td></tr><tr><td rowspan="2">10</td><td>FedAvg</td><td>59.87 66.46</td><td>535.02 39.30</td></tr><tr><td> + FEDDECORR</td><td>61.53</td><td>67.12 40.29 43.86</td></tr><tr><td rowspan="2">20</td><td>FedAvg</td><td>58.50 </td><td>66.3731.23 37.23</td></tr><tr><td>+ FEDDECORR</td><td>60.65</td><td>66.86 35.44 42.04</td></tr></table>
|
| 210 |
+
|
| 211 |
+
FEDDECORR consistently improves over the baselines across different choices of local epochs $E$ .
|
| 212 |
+
|
| 213 |
+
# 5.6 ADDITIONAL EMPIRICAL ANALYSES
|
| 214 |
+
|
| 215 |
+
We present more empirical analyses in Appendix C. These include comparing FEDDECORR with other baselines (Appendix C.4) and other decorrelation methods (Appendix C.2), experiments on other model architectures (Appendix C.3) and another type of data heterogeneity (Appendix C.5), and discussing the computational advantage of FEDDECORR (Appendix C.1).
|
| 216 |
+
|
| 217 |
+
# 6 CONCLUSION
|
| 218 |
+
|
| 219 |
+
In this work, we study representations of trained models under federated learning in which the data held by clients are heterogeneous. Through extensive empirical observations and theoretical analyses, we show that stronger data heterogeneity results in more severe dimensional collapse for both global and local representations. Motivated by this, we propose FEDDECORR, a novel method to mitigate dimensional collapse during local training, thus improving federated learning under the heterogeneous data setting. Extensive experiments on benchmark datasets show that FEDDECORR yields consistent improvements over existing baseline methods.
|
| 220 |
+
|
| 221 |
+
# ACKNOWLEDGEMENTS
|
| 222 |
+
|
| 223 |
+
The authors would like to thank anonymous reviewers for the constructive feedback. Yujun Shi and Vincent Tan are supported by Singapore Ministry of Education Tier 1 grants (Grant Number: A-0009042-01-00, A-8000189-01-00, A-8000980-00-00) and a Singapore National Research Foundation (NRF) Fellowship (Grant Number: A-0005077-01-00). Jian Liang is supported by National Natural Science Foundation of China (Grant No. 62276256) and Beijing Nova Program under Grant Z211100002121108.
|
| 224 |
+
|
| 225 |
+
# REPRODUCIBILITY STATEMENT
|
| 226 |
+
|
| 227 |
+
All source code has been released at https://github.com/bytedance/FedDecorr. Pseudo-code of FEDDECORR is provided in Appendix G. We introduced all the implementation details of baselines and our method in Sec. 5.1. In addition, the proofs of Theorem 1 and Proposition 1 are provided in Appendix A and Appendix B, respectively. All assumptions are stated and discussed in the proof.
|
| 228 |
+
|
| 229 |
+
# REFERENCES
|
| 230 |
+
|
| 231 |
+
Durmus Alp Emre Acar, Yue Zhao, Ramon Matas Navarro, Matthew Mattina, Paul N Whatmough, and Venkatesh Saligrama. Federated learning based on dynamic regularization. arXiv preprint arXiv:2111.04263, 2021.
|
| 232 |
+
|
| 233 |
+
Maruan Al-Shedivat, Jennifer Gillenwater, Eric Xing, and Afshin Rostamizadeh. Federated learning via posterior averaging: A new perspective and practical algorithms. arXiv preprint arXiv:2010.05273, 2020.
|
| 234 |
+
|
| 235 |
+
Manoj Ghuhan Arivazhagan, Vinay Aggarwal, Aaditya Kumar Singh, and Sunav Choudhary. Federated learning with personalization layers. arXiv preprint arXiv:1912.00818, 2019.
|
| 236 |
+
|
| 237 |
+
Sanjeev Arora, Nadav Cohen, and Elad Hazan. On the optimization of deep networks: Implicit acceleration by overparameterization. In International Conference on Machine Learning, pp. 244–253. PMLR, 2018.
|
| 238 |
+
|
| 239 |
+
Sanjeev Arora, Nadav Cohen, Wei Hu, and Yuping Luo. Implicit regularization in deep matrix factorization. Advances in Neural Information Processing Systems, 32, 2019.
|
| 240 |
+
|
| 241 |
+
Adrien Bardes, Jean Ponce, and Yann LeCun. Vicreg: Variance-invariance-covariance regularization for self-supervised learning. arXiv preprint arXiv:2105.04906, 2021.
|
| 242 |
+
|
| 243 |
+
Michael Cogswell, Faruk Ahmed, Ross Girshick, Larry Zitnick, and Dhruv Batra. Reducing overfitting in deep networks by decorrelating representations. arXiv preprint arXiv:1511.06068, 2015.
|
| 244 |
+
|
| 245 |
+
Ekin D Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V Le. Autoaugment: Learning augmentation policies from data. arXiv preprint arXiv:1805.09501, 2018.
|
| 246 |
+
|
| 247 |
+
Alireza Fallah, Aryan Mokhtari, and Asuman Ozdaglar. Personalized federated learning with theoretical guarantees: A model-agnostic meta-learning approach. Advances in Neural Information Processing Systems, 33:3557–3568, 2020.
|
| 248 |
+
|
| 249 |
+
Filip Hanzely, Slavom´ır Hanzely, Samuel Horvath, and Peter Richt ´ arik. Lower bounds and opti- ´ mal algorithms for personalized federated learning. Advances in Neural Information Processing Systems, 33:2304–2315, 2020.
|
| 250 |
+
|
| 251 |
+
Tzu-Ming Harry Hsu, Hang Qi, and Matthew Brown. Measuring the effects of non-identical data distribution for federated visual classification. arXiv preprint arXiv:1909.06335, 2019.
|
| 252 |
+
|
| 253 |
+
Tianyu Hua, Wenxiao Wang, Zihui Xue, Sucheng Ren, Yue Wang, and Hang Zhao. On feature decorrelation in self-supervised learning. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9598–9608, 2021.
|
| 254 |
+
|
| 255 |
+
Lei Huang, Dawei Yang, Bo Lang, and Jia Deng. Decorrelated batch normalization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 791–800, 2018.
|
| 256 |
+
|
| 257 |
+
Yutao Huang, Lingyang Chu, Zirui Zhou, Lanjun Wang, Jiangchuan Liu, Jian Pei, and Yong Zhang. Personalized cross-silo federated learning on non-iid data. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pp. 7865–7873, 2021.
|
| 258 |
+
|
| 259 |
+
Ziwei Ji and Matus Telgarsky. Gradient descent aligns the layers of deep linear networks. arXiv preprint arXiv:1810.02032, 2018.
|
| 260 |
+
|
| 261 |
+
Li Jing, Pascal Vincent, Yann LeCun, and Yuandong Tian. Understanding dimensional collapse in contrastive self-supervised learning. arXiv preprint arXiv:2110.09348, 2021.
|
| 262 |
+
|
| 263 |
+
Sai Praneeth Karimireddy, Satyen Kale, Mehryar Mohri, Sashank Reddi, Sebastian Stich, and Ananda Theertha Suresh. Scaffold: Stochastic controlled averaging for federated learning. In International Conference on Machine Learning, pp. 5132–5143. PMLR, 2020.
|
| 264 |
+
|
| 265 |
+
Qinbin Li, Yiqun Diao, Quan Chen, and Bingsheng He. Federated learning on non-iid data silos: An experimental study. arXiv preprint arXiv:2102.02079, 2021a.
|
| 266 |
+
|
| 267 |
+
Qinbin Li, Bingsheng He, and Dawn Song. Model-contrastive federated learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10713–10722, 2021b.
|
| 268 |
+
|
| 269 |
+
Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smith. Federated optimization in heterogeneous networks. Proceedings of Machine Learning and Systems, 2:429–450, 2020.
|
| 270 |
+
|
| 271 |
+
Tian Li, Shengyuan Hu, Ahmad Beirami, and Virginia Smith. Ditto: Fair and robust federated learning through personalization. In International Conference on Machine Learning, pp. 6357– 6368. PMLR, 2021c.
|
| 272 |
+
|
| 273 |
+
Tao Lin, Lingjing Kong, Sebastian U Stich, and Martin Jaggi. Ensemble distillation for robust model fusion in federated learning. Advances in Neural Information Processing Systems, 33:2351–2363, 2020.
|
| 274 |
+
|
| 275 |
+
Mi Luo, Fei Chen, Dapeng Hu, Yifan Zhang, Jian Liang, and Jiashi Feng. No fear of heterogeneity: Classifier calibration for federated learning with non-iid data. Advances in Neural Information Processing Systems, 34, 2021.
|
| 276 |
+
|
| 277 |
+
Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-efficient learning of deep networks from decentralized data. In Artificial intelligence and statistics, pp. 1273–1282. PMLR, 2017.
|
| 278 |
+
|
| 279 |
+
Sashank Reddi, Zachary Charles, Manzil Zaheer, Zachary Garrett, Keith Rush, Jakub Konecnˇ y,\` Sanjiv Kumar, and H Brendan McMahan. Adaptive federated optimization. arXiv preprint arXiv:2003.00295, 2020.
|
| 280 |
+
|
| 281 |
+
Karsten Roth, Timo Milbich, Samarth Sinha, Prateek Gupta, Bjorn Ommer, and Joseph Paul Cohen. Revisiting training strategies and generalization performance in deep metric learning. In International Conference on Machine Learning, pp. 8242–8252. PMLR, 2020.
|
| 282 |
+
|
| 283 |
+
Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4510–4520, 2018.
|
| 284 |
+
|
| 285 |
+
Yujun Shi, Kuangqi Zhou, Jian Liang, Zihang Jiang, Jiashi Feng, Philip HS Torr, Song Bai, and Vincent YF Tan. Mimicking the oracle: an initial phase decorrelation approach for class incremental learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16722–16731, 2022.
|
| 286 |
+
|
| 287 |
+
Canh T Dinh, Nguyen Tran, and Josh Nguyen. Personalized federated learning with moreau envelopes. Advances in Neural Information Processing Systems, 33:21394–21405, 2020.
|
| 288 |
+
|
| 289 |
+
Hongyi Wang, Mikhail Yurochkin, Yuekai Sun, Dimitris Papailiopoulos, and Yasaman Khazaeni. Federated learning with matched averaging. arXiv preprint arXiv:2002.06440, 2020a.
|
| 290 |
+
|
| 291 |
+
Jianyu Wang, Qinghua Liu, Hao Liang, Gauri Joshi, and H Vincent Poor. Tackling the objective inconsistency problem in heterogeneous federated optimization. Advances in neural information processing systems, 33:7611–7623, 2020b.
|
| 292 |
+
|
| 293 |
+
Lixu Wang, Shichao Xu, Xiao Wang, and Qi Zhu. Addressing class imbalance in federated learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pp. 10165–10173, 2021.
|
| 294 |
+
|
| 295 |
+
Wei Xiong, Bo Du, Lefei Zhang, Ruimin Hu, and Dacheng Tao. Regularizing deep convolutional neural networks with a structured decorrelation constraint. In 2016 IEEE 16th International Conference on Data Mining (ICDM), pp. 519–528. IEEE, 2016.
|
| 296 |
+
|
| 297 |
+
Mikhail Yurochkin, Mayank Agarwal, Soumya Ghosh, Kristjan Greenewald, Nghia Hoang, and Yasaman Khazaeni. Bayesian nonparametric federated learning of neural networks. In International Conference on Machine Learning, pp. 7252–7261. PMLR, 2019.
|
| 298 |
+
|
| 299 |
+
Jure Zbontar, Li Jing, Ishan Misra, Yann LeCun, and Stephane Deny. Barlow twins: Self-supervised ´ learning via redundancy reduction. In International Conference on Machine Learning, pp. 12310– 12320. PMLR, 2021.
|
| 300 |
+
|
| 301 |
+
Michael Zhang, Karan Sapra, Sanja Fidler, Serena Yeung, and Jose M Alvarez. Personalized federated learning with first order model optimization. arXiv preprint arXiv:2012.08565, 2020.
|
| 302 |
+
|
| 303 |
+
# A PROOF OF THEOREM 1 IN MAIN PAPER
|
| 304 |
+
|
| 305 |
+
# A.1 NOTATIONS REVISITED
|
| 306 |
+
|
| 307 |
+
Here, for the reader’s convenience, we summarize the notations used in both the main text and this appendix.
|
| 308 |
+
|
| 309 |
+
<table><tr><td>Notation N</td><td>Explanation Number of training data points.</td></tr><tr><td>C X y Y Wi(t) I(t) 01,k ul,k Vl,k 0k Uk Vk Nc μc ec</td><td>Total number of classes. The collection of the N training samples, X ∈ Rdin × N. The collection of one hot labels of the N training samples,y ∈ RC×N. The collection of model output softmax vectors givenall N input data,y ∈ RCN The i-th layer weight matrix at the t-th optimization step. The product of the weight matrices of the first L layers: II(t) = WL(t) ...Wi(t). The k-th singular value of Wt . The k-th left singular vector of Wt. The k-th right singular vector of Wt.</td></tr></table>
|
| 310 |
+
|
| 311 |
+
# A.2 TWO LEMMAS
|
| 312 |
+
|
| 313 |
+
Here, we elaborate two useful lemmas from Arora et al. (2019; 2018).
|
| 314 |
+
|
| 315 |
+
The first lemma is adopted from Arora et al. (2019):
|
| 316 |
+
|
| 317 |
+
Lemma 1. Assuming the weight matrix $W$ evolves under gradient descent dynamics with infinitesimally small learning rate, the $k$ -th singular value of this matrix (denoted as $\sigma _ { k }$ ) evolves as
|
| 318 |
+
|
| 319 |
+
$$
|
| 320 |
+
\begin{array} { r } { \dot { { \boldsymbol \sigma } } _ { k } ( t ) = ( { \mathbf u } _ { k } ( t ) ) ^ { \top } \dot { W } ( t ) { \mathbf v } _ { k } ( t ) , } \end{array}
|
| 321 |
+
$$
|
| 322 |
+
|
| 323 |
+
where ${ \bf u } _ { k } ( t )$ and $\mathbf { v } _ { k } ( t )$ are the $k$ -th left and right singular vectors of $W ( t )$ , respectively.
|
| 324 |
+
|
| 325 |
+
Proof. By performing an SVD on $W ( t )$ , we have $W ( t ) = U ( t ) S ( t ) V ( t ) ^ { \top }$ . Therefore, by the chain rule in differention, we have:
|
| 326 |
+
|
| 327 |
+
$$
|
| 328 |
+
\dot { W } ( t ) = \dot { U } ( t ) S ( t ) V ( t ) ^ { \top } + U ( t ) \dot { S } ( t ) V ( t ) ^ { \top } + U ( t ) S ( t ) \dot { V } ( t ) ^ { \top } .
|
| 329 |
+
$$
|
| 330 |
+
|
| 331 |
+
Next, for both sides of the above equation, we left multiply $U ( t ) ^ { \top }$ and right multiply $V ( t )$
|
| 332 |
+
|
| 333 |
+
$$
|
| 334 |
+
U ( t ) ^ { \top } \dot { W } ( t ) V ( t ) = U ( t ) ^ { \top } \dot { U } ( t ) S ( t ) + \dot { S } ( t ) + S ( t ) ( \dot { V } ( t ) ) ^ { \top } V ( t ) .
|
| 335 |
+
$$
|
| 336 |
+
|
| 337 |
+
ince $S ( t )$ is a diagonal matrix, we consider the $k$ -th diagonal entry of $S ( t )$ , namely $\sigma _ { k } ( t )$
|
| 338 |
+
|
| 339 |
+
$$
|
| 340 |
+
\begin{array} { r } { ( \mathbf { u } _ { k } ( t ) ) ^ { \top } \dot { W } ( t ) \mathbf { v } _ { k } ( t ) = ( \mathbf { u } _ { k } ( t ) ) ^ { \top } \dot { \mathbf { u } } _ { k } ( t ) \sigma _ { k } ( t ) + \dot { \sigma } _ { k } ( t ) + \sigma _ { k } ( t ) ( \mathbf { v } _ { k } ( t ) ) ^ { \top } \dot { \mathbf { v } } _ { k } ( t ) . } \end{array}
|
| 341 |
+
$$
|
| 342 |
+
|
| 343 |
+
Since ${ \bf u } _ { k } ( t )$ and $\mathbf { v } _ { k } ( t )$ are unit vectors and are evolving in time with infinitesimal rate, we have $( { \mathbf { u } } _ { k } ( t ) ) ^ { \top } \dot { { \mathbf { u } } } _ { k } ( t ) = 0$ and $( { \bf v } _ { k } ( t ) ) ^ { \top } \dot { \bf v } _ { k } ( t ) = 0$ . Next, Eqn. (13) can be simplified as
|
| 344 |
+
|
| 345 |
+
$$
|
| 346 |
+
\begin{array} { r } { \dot { { \boldsymbol \sigma } } _ { k } ( t ) = ( { \mathbf u } _ { k } ( t ) ) ^ { \top } \dot { W } ( t ) { \mathbf v } _ { k } ( t ) . } \end{array}
|
| 347 |
+
$$
|
| 348 |
+
|
| 349 |
+
The proof is thus complete.
|
| 350 |
+
|
| 351 |
+
The second lemma is adopted from Arora et al. (2018).
|
| 352 |
+
|
| 353 |
+
Lemma 2. Given $L$ consecutive linear layers in a neural network characterized by weight matrices $W _ { 1 } , W _ { 2 } , \ldots , W _ { L }$ . We denote $\Pi = W _ { L } W _ { L - 1 } \ldots W _ { 1 }$ . We further denote $W _ { j } ( t )$ as weight matrix $W _ { j }$ after the $t$ -th gradient descent optimization step. Correspondingly, the initialization of $W _ { j }$ is $W _ { j } ( 0 )$ . Assuming we have $W _ { j } ( 0 ) ( W _ { j } ( 0 ) ) ^ { \top } = ( W _ { j + 1 } ( 0 ) ) ^ { \top } W _ { j + 1 } ( 0 )$ for any $j \in [ L - 1 ]$ at initialization. Then, under the gradient descent dynamics, $\Pi ( t )$ satisfies
|
| 354 |
+
|
| 355 |
+
$$
|
| 356 |
+
\dot { \Pi } ( t ) = - \sum _ { j = 1 } ^ { L } \left[ \Pi ( t ) \Pi ( t ) ^ { \top } \right] ^ { \frac { L - j } { L } } \frac { \partial \ell ( \Pi ( t ) ) } { \partial \Pi } \left[ \Pi ( t ) ^ { \top } \Pi ( t ) \right] ^ { \frac { j - 1 } { L } } ,
|
| 357 |
+
$$
|
| 358 |
+
|
| 359 |
+
where $[ \cdot ] ^ { \frac { L - j } { L } }$ and $[ \cdot ] ^ { \frac { j - 1 } { L } }$ are fractional power operators defined over positive semi-definite matrices.
|
| 360 |
+
|
| 361 |
+
Proof. Here, we first define some additional notation. Given any square matrices (or possibly scalar) $A _ { 1 } , A _ { 2 } , \ldots , A _ { m }$ , we denote $\mathrm { d i a g } ( A _ { 1 } , A _ { 2 } , \ldots , A _ { m } )$ to be the block diagonal matrix
|
| 362 |
+
|
| 363 |
+
$$
|
| 364 |
+
\mathrm { d i a g } ( A _ { 1 } , A _ { 2 } , \ldots , A _ { m } ) = \left[ \begin{array} { c c c c } { { A _ { 1 } } } & { { 0 } } & { { 0 } } & { { 0 } } \\ { { 0 } } & { { A _ { 2 } } } & { { 0 } } & { { 0 } } \\ { { 0 } } & { { 0 } } & { { \ddots } } & { { 0 } } \\ { { 0 } } & { { 0 } } & { { 0 } } & { { A _ { m } } } \end{array} \right] .
|
| 365 |
+
$$
|
| 366 |
+
|
| 367 |
+
Here, we first consider dynamics of an arbitrary $W _ { j }$ where $j \in [ L - 1 ]$ . By the chain rule, we have
|
| 368 |
+
|
| 369 |
+
$$
|
| 370 |
+
\begin{array} { l } { \dot { W } _ { j } ( t ) = - \frac { \partial \ell ( W _ { 1 } ( t ) , \dots , W _ { L + 1 } ( t ) ) } { \partial W _ { j } ( t ) } } \\ { \quad \qquad = - ( W _ { j + 1 } ( t ) ^ { \top } \dots W _ { L } ( t ) ^ { \top } ) \frac { \partial \ell ( \Pi ( t ) ) } { \partial \Pi } ( W _ { 1 } ( t ) ^ { \top } \dots W _ { j - 1 } ( t ) ^ { \top } ) . } \end{array}
|
| 371 |
+
$$
|
| 372 |
+
|
| 373 |
+
Given Eqn. (16), we right multiply $\dot { W } _ { j } ( t )$ by $( W _ { j } ( t ) ) ^ { \top }$ and we left multiply $\dot { W } _ { j + 1 } ( t )$ by $( W _ { j + 1 } ( t ) ) ^ { \top }$ , which yields
|
| 374 |
+
|
| 375 |
+
$$
|
| 376 |
+
\dot { W } _ { j } ( t ) ( W _ { j } ( t ) ) ^ { \top } = ( W _ { j + 1 } ( t ) ) ^ { \top } \dot { W } _ { j + 1 } ( t ) .
|
| 377 |
+
$$
|
| 378 |
+
|
| 379 |
+
Applying the same trick on $W _ { j } ( t ) ^ { \top }$ and $W _ { j + 1 } ( t ) ^ { \top }$ yields
|
| 380 |
+
|
| 381 |
+
$$
|
| 382 |
+
W _ { j } ( t ) ( \dot { W } _ { j } ( t ) ) ^ { \top } = ( \dot { W } _ { j + 1 } ( t ) ) ^ { \top } W _ { j + 1 } ( t ) .
|
| 383 |
+
$$
|
| 384 |
+
|
| 385 |
+
Adding Eqns. (17) and (18) on both sides yields
|
| 386 |
+
|
| 387 |
+
$$
|
| 388 |
+
\dot { W } _ { j } ( t ) ( W _ { j } ( t ) ) ^ { \top } + W _ { j } ( t ) ( \dot { W } _ { j } ( t ) ) ^ { \top } = W _ { j + 1 } ( t ) ^ { \top } \dot { W } _ { j + 1 } ( t ) + ( \dot { W } _ { j + 1 } ( t ) ) ^ { \top } W _ { j + 1 } ( t ) .
|
| 389 |
+
$$
|
| 390 |
+
|
| 391 |
+
Next, by the chain rule for differentiation, Eqn. (19) directly implies that
|
| 392 |
+
|
| 393 |
+
$$
|
| 394 |
+
\frac { \mathrm { d } ( W _ { j } ( t ) W _ { j } ( t ) ^ { \top } ) } { \mathrm { d } t } = \frac { \mathrm { d } ( W _ { j + 1 } ( t ) ^ { \top } W _ { j + 1 } ( t ) ) } { \mathrm { d } t } .
|
| 395 |
+
$$
|
| 396 |
+
|
| 397 |
+
Since we have assumed that $W _ { j } ( 0 ) W _ { j } ( 0 ) ^ { \top } = W _ { j + 1 } ( 0 ) ^ { \top } W _ { j + 1 } ( 0 )$ , we can conclude that
|
| 398 |
+
|
| 399 |
+
$$
|
| 400 |
+
W _ { j } ( t ) W _ { j } ( t ) ^ { \top } = W _ { j + 1 } ( t ) ^ { \top } W _ { j + 1 } ( t ) .
|
| 401 |
+
$$
|
| 402 |
+
|
| 403 |
+
Next, we apply an SVD on $W _ { j } ( t )$ and $W _ { j + 1 } ( t )$ in Eqn. (21). This yields
|
| 404 |
+
|
| 405 |
+
$$
|
| 406 |
+
U _ { j } ( t ) S _ { j } ( t ) S _ { j } ^ { \top } ( t ) U _ { j } ^ { \top } ( t ) = V _ { j + 1 } ( t ) S _ { j + 1 } ^ { \top } ( t ) S _ { j + 1 } ( t ) V _ { j + 1 } ^ { \top } ( t ) .
|
| 407 |
+
$$
|
| 408 |
+
|
| 409 |
+
Based on Eqn. (22) and given the uniqueness property of SVD, we know:
|
| 410 |
+
|
| 411 |
+
$$
|
| 412 |
+
S _ { j } ( t ) S _ { j } ( t ) ^ { \top } = S _ { j + 1 } ^ { \top } ( t ) S _ { j + 1 } ( t ) = \mathrm { d i a g } ( \rho _ { 1 } I _ { d _ { 1 } } , \rho _ { 2 } I _ { d _ { 2 } } , \dots , \rho _ { m } I _ { d _ { m } } ) ,
|
| 413 |
+
$$
|
| 414 |
+
|
| 415 |
+
where ${ \sqrt { \rho _ { 1 } } } , \ldots , { \sqrt { \rho _ { m } } }$ represent the $m$ distinct singular values satisfying $\rho _ { 1 } > \rho _ { 2 } > . . . > \rho _ { m } \geq 0$ , and $I _ { d _ { r } }$ for any $r \in [ m ]$ are identity matrix of size $d _ { r } \times d _ { r }$ . Since Eqn. (23) holds for any $j$ , we know by induction that the set of values of $\rho$ ’s is the same across all layers $j \in [ L ]$ . In addition, there exist orthogonal matrices $O _ { j , r } \in \mathbb { R } ^ { d _ { r } \times \dot { d } _ { r } }$ for any $r \in [ m ]$ such that
|
| 416 |
+
|
| 417 |
+
$$
|
| 418 |
+
U _ { j } ( t ) = V _ { j + 1 } ( t ) \mathrm { d i a g } ( O _ { j , 1 } , O _ { j , 2 } , \dots , O _ { j , m } ) .
|
| 419 |
+
$$
|
| 420 |
+
|
| 421 |
+
Given Eqns. (24), next, we study $W _ { j + 1 } ( t ) W _ { j } ( t ) W _ { j } ^ { \top } ( t ) W _ { j + 1 } ^ { \top } ( t )$ for any $j \in [ N - 1 ]$ :
|
| 422 |
+
|
| 423 |
+
$$
|
| 424 |
+
\begin{array} { r l } & { W _ { j + 1 } ( t ) W _ { j } ( t ) W _ { j } ^ { \top } ( t ) W _ { j + 1 } ^ { \top } ( t ) } \\ & { = U _ { j + 1 } S _ { j + 1 } V _ { j + 1 } ^ { \top } U _ { j } S _ { j } S _ { j } ^ { \top } U _ { j } ^ { \top } V _ { j + 1 } S _ { j + 1 } ^ { \top } U _ { j + 1 } ^ { \top } } \\ & { = U _ { j + 1 } S _ { j + 1 } \mathrm { d i a g } ( O _ { j , 1 } , O _ { j , 2 } , \ldots , O _ { j , m } ) S _ { j } S _ { j } ^ { \top } \mathrm { d i a g } ( O _ { j , 1 } ^ { \top } , O _ { j , 2 } ^ { \top } , \ldots , O _ { j , m } ^ { \top } ) S _ { j + 1 } ^ { \top } U _ { j + 1 } ^ { \top } } \\ & { \qquad \quad \mathrm { ( p l u g g i n g } } \\ & { = U _ { j + 1 } S _ { j + 1 } S _ { j } S _ { j } ^ { \top } S _ { j + 1 } ^ { \top } U _ { j + 1 } ^ { \top } \qquad ( S _ { j } \mathrm { c o m m u t e s ~ w i t h ~ d i a g } ( O _ { j , 1 } , O _ { j , 2 } , \ldots , O _ { j , m } ) ) } \\ & { = U _ { j + 1 } \mathrm { d i a g } ( \rho _ { 1 } ^ { 2 } I _ { d _ { 1 } } , \rho _ { 2 } ^ { 2 } I _ { d _ { 2 } } , \ldots , \rho _ { m } ^ { 2 } I _ { d _ { m } } ) U _ { j + 1 } ^ { \top } . } \end{array}
|
| 425 |
+
$$
|
| 426 |
+
|
| 427 |
+
Similarly, it holds that
|
| 428 |
+
|
| 429 |
+
$$
|
| 430 |
+
\begin{array} { r } { W _ { j } ^ { \top } ( t ) W _ { j + 1 } ^ { \top } ( t ) W _ { j + 1 } ( t ) W _ { j } ( t ) = V _ { j } \mathrm { d i a g } ( \rho _ { 1 } ^ { 2 } I _ { d _ { 1 } } , \rho _ { 2 } ^ { 2 } I _ { d _ { 2 } } , \dots , \rho _ { m } ^ { 2 } I _ { d _ { m } } ) V _ { j } ^ { \top } . } \end{array}
|
| 431 |
+
$$
|
| 432 |
+
|
| 433 |
+
Next, by induction and Eqns. (25),
|
| 434 |
+
|
| 435 |
+
$$
|
| 436 |
+
\begin{array} { r l } & { W _ { L } ( t ) \ldots W _ { j } ( t ) W _ { j } ( t ) ^ { \top } \ldots W _ { L } ( t ) ^ { \top } } \\ & { \qquad = U _ { L } \mathrm { d i a g } ( \rho _ { 1 } ^ { L - j + 1 } I _ { d _ { 1 } } , \rho _ { 2 } ^ { L - j + 1 } I _ { d _ { 2 } } , \ldots , \rho _ { m } ^ { L - j + 1 } I _ { d _ { m } } ) U _ { L } ^ { \top } , } \end{array}
|
| 437 |
+
$$
|
| 438 |
+
|
| 439 |
+
by induction and Eqns. (26), it holds that
|
| 440 |
+
|
| 441 |
+
$$
|
| 442 |
+
\begin{array} { r } { W _ { 1 } ^ { \top } ( t ) \ldots W _ { j } ^ { \top } ( t ) W _ { j } ( t ) \ldots W _ { 1 } ( t ) = V _ { 1 } \mathrm { d i a g } ( \rho _ { 1 } ^ { j } I _ { d _ { 1 } } , \rho _ { 2 } ^ { j } I _ { d _ { 2 } } , \ldots , \rho _ { m } ^ { j } I _ { d _ { m } } ) V _ { 1 } ^ { \top } . } \end{array}
|
| 443 |
+
$$
|
| 444 |
+
|
| 445 |
+
From Eqns. (27), we know that for any $j \in [ L - 1 ]$ ,
|
| 446 |
+
|
| 447 |
+
$$
|
| 448 |
+
\begin{array} { r l } & { \Pi ( t ) \Pi ( t ) ^ { \top } = W _ { L } ( t ) \ldots W _ { 1 } ( t ) W _ { 1 } ( t ) ^ { \top } \ldots W _ { L } ( t ) ^ { \top } } \\ & { \qquad = U _ { L } \mathrm { d i a g } ( \rho _ { 1 } ^ { L } I _ { d _ { 1 } } , \rho _ { 2 } ^ { L } I _ { d _ { 2 } } , \ldots , \rho _ { m } ^ { L } I _ { d _ { m } } ) U _ { L } ^ { \top } } \\ & { \qquad = \left[ U _ { L } \mathrm { d i a g } ( \rho _ { 1 } ^ { L - j } I _ { d _ { 1 } } , \rho _ { 2 } ^ { L - j } I _ { d _ { 2 } } , \ldots , \rho _ { m } ^ { L - j } I _ { d _ { m } } ) U _ { L } ^ { \top } \right] ^ { \frac { L } { L - j } } } \\ & { \qquad = \left[ W _ { L } ( t ) \ldots W _ { j + 1 } ( t ) W _ { j + 1 } ( t ) ^ { \top } \ldots W _ { L } ( t ) ^ { \top } \right] ^ { \frac { L } { L - j } } . } \end{array}
|
| 449 |
+
$$
|
| 450 |
+
|
| 451 |
+
Similarly, from Eqn. (28), we know that for any $2 \leq j \leq L - 1$ ,
|
| 452 |
+
|
| 453 |
+
$$
|
| 454 |
+
\begin{array} { r l } & { \Pi ( t ) ^ { \top } \Pi ( t ) = W _ { 1 } ( t ) ^ { \top } \cdot \cdot \cdot W _ { L } ( t ) ^ { \top } W _ { L } ( t ) \cdot \cdot \cdot W _ { 1 } ( t ) } \\ & { \qquad = V _ { 1 } \mathrm { d i a g } ( \rho _ { 1 } ^ { L } I _ { d _ { 1 } } , \rho _ { 2 } ^ { L } I _ { d _ { 2 } } , \cdot \cdot \cdot , \rho _ { m } ^ { L } I _ { d _ { m } } ) V _ { 1 } ^ { \top } } \\ & { \qquad = \Big [ V _ { 1 } \mathrm { d i a g } ( \rho _ { 1 } ^ { j - 1 } I _ { d _ { 1 } } , \rho _ { 2 } ^ { j - 1 } I _ { d _ { 2 } } , \dots , \rho _ { m } ^ { j - 1 } I _ { d _ { m } } ) V _ { 1 } ^ { \top } \Big ] ^ { \frac { L } { j - 1 } } } \\ & { \qquad = \big [ W _ { 1 } ^ { \top } \cdot \dots W _ { j - 1 } ^ { \top } W _ { j - 1 } ( t ) \cdot \dots W _ { 1 } ( t ) \big ] ^ { \frac { L } { j - 1 } } . } \end{array}
|
| 455 |
+
$$
|
| 456 |
+
|
| 457 |
+
With everything derived above, we now study the dynamics of $\Pi ( t )$ as follows
|
| 458 |
+
|
| 459 |
+
$$
|
| 460 |
+
\begin{array} { l } { { \displaystyle \dot { \mathrm { I I } } ( t ) = \sum _ { j = 1 } ^ { L } \left[ W _ { L } ( t ) \dots W _ { j + 1 } ( t ) \right] ( \dot { W } _ { j } ( t ) ) \left[ W _ { j - 1 } ( t ) \dots W _ { 1 } ( t ) \right] \quad \mathrm { ( d i f f e r e n t i a l ~ c h a i n ~ r u l e ) } } } \\ { { \displaystyle = - \sum _ { j = 1 } ^ { L } \left[ W _ { L } ( t ) \dots W _ { j + 1 } ( t ) W _ { j + 1 } ( t ) ^ { \top } \dots W _ { L } ( t ) ^ { \top } \right] } } \\ { { \displaystyle \qquad \times \frac { \partial \ell ( [ \mathbf { I I } ( t ) ) } { \partial \Pi } \left[ W _ { 1 } ^ { \top } ( t ) \dots W _ { j - 1 } ^ { \top } ( t ) W _ { j - 1 } ( t ) \dots W _ { 1 } ( t ) \right] \quad \mathrm { ( p l u g g i n g - i n ~ ( 1 6 ) ) } } } \\ { { \displaystyle = - \sum _ { j = 1 } ^ { L } \left[ \Pi ( t ) \Pi ( t ) ^ { \top } \right] ^ { \frac { L - j } { \mathrm { x } _ { \mathrm { x } } } } \frac { \partial \ell ( [ \mathbf { I } ( t ) ) } { \partial \Pi } \left[ \Pi ( t ) ^ { \top } \Pi ( t ) \right] ^ { \frac { j - 1 } { \mathrm { x } _ { \mathrm { x } } } } \qquad \mathrm { ( p l u g g g i n g - i n ~ ( 2 9 ) ~ a n d ~ ( 2 6 ) ~ } } } \end{array}
|
| 461 |
+
$$
|
| 462 |
+
|
| 463 |
+
This completes the proof.
|
| 464 |
+
|
| 465 |
+

|
| 466 |
+
Figure 6: Alignment effects between the singular spaces of $W _ { L + 1 } ( t )$ and $\Pi ( t )$ . We train a 3-layer linear neural network on the MNIST dataset and visualize the models at 3, 5, 7, 9 training epochs, respectively. In each figure, the $k ^ { \prime }$ -th row and $k$ -th column pixel is the value of $\vert { \mathbf u } _ { k } ( t ) ^ { \top } { \mathbf v } _ { L + 1 , k ^ { \prime } } ( t ) \vert$ . Darker colors denote values close to 1 while lighter colors denote values close to 0. From the figures, we empirically observe that $| \mathbf { u } _ { k } ( t ) ^ { \top } \mathbf { v } _ { L + 1 , k ^ { \prime } } ( \bar { t } ) | = \mathbb { 1 } \{ k = k ^ { \prime } \}$ approximately holds.
|
| 467 |
+
|
| 468 |
+
# A.3 ASSUMPTIONS
|
| 469 |
+
|
| 470 |
+
Assumption 1. We assume that the initial values of the weight matrices satisfy $W _ { i + 1 } ^ { \top } ( 0 ) W _ { i + 1 } ( 0 ) =$ $W _ { i } ( 0 ) W _ { i } ^ { \top } ( 0 )$ for any $i \in [ L - 1 ]$ .
|
| 471 |
+
|
| 472 |
+
Assumption 2. We assume $| \mathbf { u } _ { k } ( t ) ^ { \top } \mathbf { v } _ { L + 1 , k ^ { \prime } } ( t ) | = \mathbb { 1 } \{ k = k ^ { \prime } \}$ holds for all $t ,$ , where ${ \bf u } _ { k } ( t )$ is the $k$ -th left singular vector of $\Pi ( t )$ and $\mathbf { v } _ { L + 1 , k ^ { \prime } } ( t )$ is the $k ^ { \prime }$ -th right singular vector of $W _ { L + 1 } ( t )$ .
|
| 473 |
+
|
| 474 |
+
Remark: For Assumption 1, it can be achieved in practice by proper random initialization. For Assumption 2, Ji & Telgarsky (2018) proved that under some assumptions, gradient descent optimization will drive consecutive layers of linear networks to satisfy it. We also provide empirical evidence in Fig. 6 to corroborate that this assumption approximately holds.
|
| 475 |
+
|
| 476 |
+
# A.4 PROOF OF THEOREM 1 IN THE MAIN TEXT
|
| 477 |
+
|
| 478 |
+
Theorem 1 (formally stated). Let $\sigma _ { k } ( t )$ for $k \in [ d ]$ be the $k$ -th largest singular value of $\Pi ( t )$ . Then, under Assumptions $^ { l }$ and 2, we have
|
| 479 |
+
|
| 480 |
+
$$
|
| 481 |
+
\begin{array} { r } { \dot { \sigma } _ { k } ( t ) = N L \left( \sigma _ { k } ( t ) \right) ^ { 2 - \frac { 2 } { L } } \sqrt { \left( \sigma _ { k } ( t ) \right) ^ { \frac { 2 } { L } } + M } \left( \mathbf { u } _ { L + 1 , k } ( t ) \right) ^ { \top } G ( t ) \mathbf { v } _ { k } ( t ) , } \end{array}
|
| 482 |
+
$$
|
| 483 |
+
|
| 484 |
+
where ${ \mathbf { u } } _ { L + 1 , k } ( t )$ is the $k$ -th left singular vector of $W _ { L + 1 } ( t )$ , $\mathbf { v } _ { k } ( t )$ is the $k$ -th right singular vector of $\Pi ( t )$ , $M$ is a constant, and $G ( t )$ is defined as
|
| 485 |
+
|
| 486 |
+
$$
|
| 487 |
+
G ( t ) = \sum _ { c = 1 } ^ { C } \mu _ { c } ( \mathbf { e } _ { c } - \bar { \gamma } _ { c } ( t ) ) \bar { X } _ { c } ^ { \top } .
|
| 488 |
+
$$
|
| 489 |
+
|
| 490 |
+
Proof. Recall that for $( L + 1 )$ -layer linear neural networks, given the $i$ -th training sample $X _ { i } \in \mathbb { R } ^ { d }$ , we have
|
| 491 |
+
|
| 492 |
+
$$
|
| 493 |
+
\gamma _ { i } ( t ) = \mathrm { s o f t m a x } ( W _ { L + 1 } ( t ) { \mathbf z } _ { i } ( t ) ) = \mathrm { s o f t m a x } ( W _ { L + 1 } ( t ) \Pi ( t ) X _ { i } ) ,
|
| 494 |
+
$$
|
| 495 |
+
|
| 496 |
+
and the loss is the standard cross-entropy loss defined as follows
|
| 497 |
+
|
| 498 |
+
$$
|
| 499 |
+
\ell ( \Pi ( t ) , W _ { L + 1 } ( t ) ) = \sum _ { i = 1 } ^ { N } - \mathbf { y } _ { i } ^ { \top } \log \gamma _ { i } ( t ) .
|
| 500 |
+
$$
|
| 501 |
+
|
| 502 |
+
By the chain rule, we can derive gradient of $\ell$ with respect to $W _ { L + 1 }$ and $\Pi$ , which are respectively,
|
| 503 |
+
|
| 504 |
+
$$
|
| 505 |
+
\frac { \partial \ell ( \Pi ( t ) , W _ { L + 1 } ( t ) ) } { \partial W _ { L + 1 } } = - ( \mathbf { y } - \boldsymbol { \gamma } ( t ) ) \boldsymbol { X } ^ { \top } \Pi ( t ) ^ { \top } ,
|
| 506 |
+
$$
|
| 507 |
+
|
| 508 |
+
and
|
| 509 |
+
|
| 510 |
+
$$
|
| 511 |
+
\frac { \partial \ell ( \Pi ( t ) , W _ { L + 1 } ( t ) ) } { \partial \Pi } = - W _ { L + 1 } ( t ) ^ { \top } ( \mathbf { y } - \boldsymbol { \gamma } ( t ) ) \boldsymbol { X } ^ { \top } .
|
| 512 |
+
$$
|
| 513 |
+
|
| 514 |
+
Next, under the gradient descent dynamics, the dynamics on $W _ { L + 1 }$ satisfies
|
| 515 |
+
|
| 516 |
+
$$
|
| 517 |
+
\dot { W } _ { L + 1 } ( t ) = - \frac { \partial \ell ( \Pi ( t ) , W _ { L + 1 } ( t ) ) } { \partial W _ { L + 1 } } = ( \mathbf { y } - \boldsymbol { \gamma } ( t ) ) \boldsymbol { X } ^ { \top } \Pi ( t ) ^ { \top } ,
|
| 518 |
+
$$
|
| 519 |
+
|
| 520 |
+
while the dynamics on $\Pi$ requires invoking Lemma 2, which allows us to write
|
| 521 |
+
|
| 522 |
+
$$
|
| 523 |
+
\begin{array} { r l } & { \dot { \Pi } ( t ) = - \displaystyle \sum _ { j = 1 } ^ { L } [ \Pi ( t ) \Pi ( t ) ^ { \top } ] ^ { \frac { L - j } { L } } \frac { \partial \ell ( \Pi ( t ) ) } { \partial \Pi } [ \Pi ( t ) ^ { \top } \Pi ( t ) ] ^ { \frac { j - 1 } { L } } } \\ & { \quad \quad = \displaystyle \sum _ { j = 1 } ^ { L } [ \Pi ( t ) \Pi ( t ) ^ { \top } ] ^ { \frac { L - j } { L } } W _ { L + 1 } ( t ) ^ { \top } ( \mathbf { y } - \boldsymbol { \gamma } ( t ) ) \boldsymbol { X } ^ { \top } [ \Pi ( t ) ^ { \top } \Pi ( t ) ] ^ { \frac { j - 1 } { L } } . } \end{array}
|
| 524 |
+
$$
|
| 525 |
+
|
| 526 |
+
Next, we invoke Lemma 1 on Eqn. (39) and Eqn. (38), respectively, yielding:
|
| 527 |
+
|
| 528 |
+
$$
|
| 529 |
+
\begin{array} { r l } { \dot { \sigma } _ { k } ( t ) = } & { ( \mathbf { u } _ { k } ( t ) ) ^ { \top } \dot { \Pi } ( t ) ( \mathbf { v } _ { k } ( t ) ) } \\ & { = \displaystyle \sum _ { j = 1 } ^ { L } \mathbf { u } _ { k } ( t ) ^ { \top } [ \Pi ( t ) \Pi ( t ) ^ { \top } ] ^ { \frac { L - i } { L } } W _ { L + 1 } ( t ) ^ { \top } ( \mathbf { y } - \gamma ( t ) ) X ^ { \top } [ \Pi ( t ) ^ { \top } \Pi ( t ) ] ^ { \frac { i - 1 } { L } } \mathbf { v } _ { k } ( t ) } \\ & { = L ( \sigma _ { k } ( t ) ) ^ { 2 - \frac { 2 } { L } } \mathbf { u } _ { k } ( t ) ^ { \top } W _ { L + 1 } ( t ) ^ { \top } ( \mathbf { y } - \gamma ( t ) ) X ^ { \top } \mathbf { v } _ { k } ( t ) } \\ & { \qquad \mathrm { ( S V D ~ o n ~ I ~ } ] } \\ & { = L ( \sigma _ { k } ( t ) ) ^ { 2 - \frac { 2 } { L } } \displaystyle \sum _ { k ^ { \prime } } \sigma _ { L + 1 , k ^ { \prime } } \mathbf { u } _ { k } ( t ) ^ { \top } \mathbf { v } _ { L + 1 , k ^ { \prime } } ( t ) ( \mathbf { u } _ { L + 1 , k ^ { \prime } } ( t ) ) ^ { \top } ( \mathbf { y } - \gamma ( t ) ) X ^ { \top } \mathbf { v } _ { k } ( t ) } \\ & { \qquad \mathrm { ( S V D ~ o n ~ } b } \\ & { = L ( \sigma _ { k } ( t ) ) ^ { 2 - \frac { 2 } { L } } \sigma _ { L + 1 , k } ( \mathbf { u } _ { L + 1 , k } ( t ) ) ^ { \top } ( \mathbf { y } - \gamma ( t ) ) X ^ { \top } \mathbf { v } _ { k } ( t ) \qquad \mathrm { ( A s s u m p i o n 2 ) } . } \end{array}
|
| 530 |
+
$$
|
| 531 |
+
|
| 532 |
+
and
|
| 533 |
+
|
| 534 |
+
$$
|
| 535 |
+
\begin{array} { r l } & { \dot { \boldsymbol \sigma } _ { L + 1 , k } ( t ) = \mathbf { u } _ { L + 1 , k } ( t ) ^ { \top } ( \mathbf { y } - \boldsymbol \gamma ( t ) ) \boldsymbol X ^ { \top } \boldsymbol \Pi ( t ) ^ { \top } { \mathbf { v } } _ { L + 1 , k } ( t ) } \\ & { \qquad = \displaystyle \sum _ { k ^ { \prime } } \sigma _ { k ^ { \prime } } \mathbf { u } _ { L + 1 , k } ( t ) ^ { \top } ( \mathbf { y } - \boldsymbol \gamma ( t ) ) \boldsymbol X ^ { \top } { \mathbf { v } } _ { k ^ { \prime } } ( t ) \mathbf { u } _ { k ^ { \prime } } ^ { \top } { \mathbf { v } } _ { L + 1 , k } ( t ) } \\ & { \qquad = \sigma _ { k } \mathbf { u } _ { L + 1 , k } ( t ) ^ { \top } ( \mathbf { y } - \boldsymbol \gamma ( t ) ) \boldsymbol X ^ { \top } { \mathbf { v } } _ { k } ( t ) \qquad \mathrm { ( A s s u m p t i o n ~ 2 ) } . } \end{array}
|
| 536 |
+
$$
|
| 537 |
+
|
| 538 |
+
Combining Eqns. (40) and (41), we have:
|
| 539 |
+
|
| 540 |
+
$$
|
| 541 |
+
\frac { 1 } { L } ( \dot { \sigma } _ { k } ( t ) ) ( \sigma _ { k } ( t ) ) ^ { \frac { 2 } { L } - 1 } = \sigma _ { L + 1 , k } ( t ) ( \dot { \sigma } _ { L + 1 , k } ( t ) ) .
|
| 542 |
+
$$
|
| 543 |
+
|
| 544 |
+
Next, apply integration on both sides, which yields
|
| 545 |
+
|
| 546 |
+
$$
|
| 547 |
+
( \sigma _ { L + 1 , k } ( t ) ) ^ { 2 } = ( \sigma _ { k } ( t ) ) ^ { \frac { 2 } { L } } + M ,
|
| 548 |
+
$$
|
| 549 |
+
|
| 550 |
+
where $M$ a constant.
|
| 551 |
+
|
| 552 |
+
By Eqn. (43), Eqn. (40) can be rewritten as
|
| 553 |
+
|
| 554 |
+
$$
|
| 555 |
+
\begin{array} { r } { \dot { \sigma } _ { k } ( t ) = L ( \sigma _ { k } ( t ) ) ^ { 2 - \frac { 2 } { L } } \sqrt { ( \sigma _ { k } ( t ) ) ^ { \frac { 2 } { L } } + M } \left( \mathbf { u } _ { L + 1 , k } ( t ) \right) ^ { \top } ( \mathbf { y } - \boldsymbol { \gamma } ( t ) ) { X } ^ { \top } \mathbf { v } _ { k } ( t ) . } \end{array}
|
| 556 |
+
$$
|
| 557 |
+
|
| 558 |
+
Finally, notice that $( \mathbf y - \gamma ( t ) ) X ^ { \top }$ can be rewritten as
|
| 559 |
+
|
| 560 |
+
$$
|
| 561 |
+
( \mathbf { y } - \boldsymbol { \gamma } ( t ) ) \boldsymbol { X } ^ { \top } = \sum _ { i = 1 } ^ { N } ( \mathbf { y } - \boldsymbol { \gamma } _ { i } ( t ) ) \boldsymbol { X } _ { i } ^ { \top } = N \sum _ { c = 1 } ^ { C } \mu _ { c } ( \mathbf { e } _ { c } - \bar { \boldsymbol { \gamma } } _ { c } ( t ) ) \bar { X } _ { c } ^ { \top } .
|
| 562 |
+
$$
|
| 563 |
+
|
| 564 |
+
We further substitute Eqn. (45) into Eqn. (44) and obtain
|
| 565 |
+
|
| 566 |
+
$$
|
| 567 |
+
\begin{array} { r } { \dot { \sigma } _ { k } ( t ) = N L ( \sigma _ { k } ( t ) ) ^ { 2 - \frac { 2 } { L } } \sqrt { ( \sigma _ { k } ( t ) ) ^ { \frac { 2 } { L } } + M } \left( \mathbf { u } _ { L + 1 , k } ( t ) \right) ^ { \top } G ( t ) \mathbf { v } _ { k } ( t ) , } \end{array}
|
| 568 |
+
$$
|
| 569 |
+
|
| 570 |
+
where $G ( t )$ is defined as
|
| 571 |
+
|
| 572 |
+
$$
|
| 573 |
+
G ( t ) = \sum _ { c = 1 } ^ { C } \mu _ { c } ( \mathbf { e } _ { c } - \bar { \gamma } _ { c } ( t ) ) \bar { X } _ { c } ^ { \top } .
|
| 574 |
+
$$
|
| 575 |
+
|
| 576 |
+
This completes the proof.
|
| 577 |
+
|
| 578 |
+
# B PROOF OF PROPOSITION 1 IN THE MAIN PAPER
|
| 579 |
+
|
| 580 |
+
Proposition 1 (restated). For a $d$ -by- $d$ correlation matrix $K$ with singular values $( \lambda _ { 1 } , \ldots , \lambda _ { d } )$ , we have:
|
| 581 |
+
|
| 582 |
+
$$
|
| 583 |
+
\sum _ { i = 1 } ^ { d } \left( \lambda _ { i } - \frac { 1 } { d } \sum _ { j = 1 } ^ { d } \lambda _ { j } \right) ^ { 2 } = \| K \| _ { \mathrm { F } } ^ { 2 } - d .
|
| 584 |
+
$$
|
| 585 |
+
|
| 586 |
+
Proof. Given a $d$ -by- $d$ correlation matrix $K$ , since the diagonal entries of $K$ are all 1, we have
|
| 587 |
+
|
| 588 |
+
$$
|
| 589 |
+
\sum _ { i = 1 } ^ { d } \lambda _ { i } = \operatorname { t r } ( K ) = d .
|
| 590 |
+
$$
|
| 591 |
+
|
| 592 |
+
This is because for any symmetric positive definite matrix, the sum of all singular values equals the trace of the matrix.
|
| 593 |
+
|
| 594 |
+
Next, for the left-hand side of Eqn. (7), we have:
|
| 595 |
+
|
| 596 |
+
$$
|
| 597 |
+
\begin{array} { l l } { \displaystyle \sum _ { i = 1 } ^ { d } \left( \lambda _ { i } - \frac { 1 } { d } \sum _ { j = 1 } ^ { d } \lambda _ { j } \right) ^ { 2 } = \sum _ { i = 1 } ^ { d } ( \lambda _ { i } - 1 ) ^ { 2 } } & { ( \mathrm { P l u g - i n ~ E q n . ~ } ( 4 9 ) ) } \\ { \displaystyle } & { = \sum _ { i = 1 } ^ { d } \lambda _ { i } ^ { 2 } - 2 \sum _ { i = 1 } ^ { d } \lambda _ { i } + d } \\ { \displaystyle } & { = \sum _ { i = 1 } ^ { d } \lambda _ { i } ^ { 2 } - d } & { ( \mathrm { P l u g - i n ~ E q n . ~ } ( 4 9 ) ) . } \end{array}
|
| 598 |
+
$$
|
| 599 |
+
|
| 600 |
+
Next, for the right-hand side of Eqn. (7), we have:
|
| 601 |
+
|
| 602 |
+
$$
|
| 603 |
+
\begin{array} { r l } & { \| K \| _ { \mathrm { F } } ^ { 2 } - d = \mathrm { t r } ( K ^ { \top } K ) - d } \\ & { \qquad = \mathrm { t r } ( U S V ^ { \top } V S ^ { \top } U ^ { \top } ) - d } \\ & { \qquad = \mathrm { t r } ( U S S ^ { \top } U ^ { \top } ) - d } \\ & { \qquad = \displaystyle \sum _ { i = 1 } ^ { n } \lambda _ { i } ^ { 2 } - d . } \end{array}
|
| 604 |
+
$$
|
| 605 |
+
|
| 606 |
+
Therefore, we have shown that the left-hand side of Eqn. (7) equals its right-hand side.
|
| 607 |
+
|
| 608 |
+
# C ADDITIONAL EMPIRICAL ANALYSES
|
| 609 |
+
|
| 610 |
+
# C.1 COMPUTATIONAL EFFICIENCY
|
| 611 |
+
|
| 612 |
+
We demonstrate FEDDECORR’s advantage vis- $\grave { \mathbf { a } }$ -vis some of its competitors in terms of its computational efficiency. We compare FEDDECORR with some other methods that also apply additional regularization terms during local training such as FedProx and MOON. We partition CIFAR10, CIFAR100 and TinyImageNet into 10 clients with $\alpha = 0 . 5$ and report the total computation times required for one round of training for FedAvg, FedProx, MOON, and FEDDECORR . Results are shown in Tab. 5. All results are produced with a NVIDIA Tesla V100 GPU. We see that FEDDECORR incurs a negligible computation overhead on top of the na¨ıve FedAvg, while FedProx and MOON introduce about $0 . 5 \sim 1 \times$ additional computation cost. The advantage of FEDDECORR in terms of efficiency is mainly because it only involves calculating the Frobenius norm of a matrix which is extremely cheap. Indeed this regularization operates on the output representation vectors of the model, without requiring computing parameter-wise regularization like FedProx nor extra forward passes like MOON.
|
| 613 |
+
|
| 614 |
+
<table><tr><td></td><td>CIFAR10</td><td>CIFAR100</td><td>TinyImageNet</td></tr><tr><td>FedAvg</td><td>6.7</td><td>6.9</td><td>25.4</td></tr><tr><td>FedProx</td><td>12.1</td><td>12.3</td><td>33.2</td></tr><tr><td>MOON</td><td>12.2</td><td>12.7</td><td>38.1</td></tr><tr><td>FEDDECORR</td><td>6.9</td><td>7.1</td><td>25.7</td></tr></table>
|
| 615 |
+
|
| 616 |
+
Table 5: Comparison of computation times. We report the total computation times (in minutes) for one round of training on the three datasets for FedAvg, FedProx, MOON, and FEDDECORR. Here, FEDDECORR stands for applying FEDDECORR to FedAvg.
|
| 617 |
+
|
| 618 |
+
# C.2 COMPARISON WITH OTHER DECORRELATION METHODS
|
| 619 |
+
|
| 620 |
+
Some decorrelation regularizations such as DeCov (Cogswell et al., 2015) and StructuredDeCov (Xiong et al., 2016) were proposed to improve the generalization capabilities in standard classification tasks. Both these methods operate directly on the covariance matrix of the representations instead of the correlation matrix like our proposed method—FEDDECORR. To compare our FEDDECORR with the existing decorrelation methods, we follow the same procedure as in FEDDECORR and apply DeCov and Structured-DeCov during local training. Our experiments are based on TinyImageNet and FedAvg. TinyImageNet is partitioned into 10 clients according to various $\alpha$ ’s. Results are shown in Tab. 6. Surprisingly, we see that unlike our FEDDECORR which steadily improves the baseline, adding DeCov or Structured-DeCov both degrade the performance in federated learning. We conjecture that this is because directly regularizing the covariance matrix is highly unstable, leading to undesired modification on the representations. This experiment shows that our design of regularization of the correlation matrix instead of the covariance matrix is of paramount importance.
|
| 621 |
+
|
| 622 |
+
Table 6: Comparison with other decorrelation methods. Based on FedAvg and the TinyImageNet dataset, we use different decorrelation regularizers in local training.
|
| 623 |
+
|
| 624 |
+
<table><tr><td></td><td>|FedAvg</td><td>DeCov</td><td>St.-Decov</td><td>FEDDECORR</td></tr><tr><td>a= 0.05</td><td>35.02</td><td>32.88</td><td>32.04</td><td>40.29</td></tr><tr><td>α = 0.1</td><td>39.30</td><td>37.29</td><td>37.74</td><td>43.86</td></tr><tr><td>α = 0.5</td><td>46.92</td><td>46.29</td><td>45.85</td><td>50.01</td></tr></table>
|
| 625 |
+
|
| 626 |
+
# C.3 EXPERIMENTS ON OTHER MODEL ARCHITECTURES
|
| 627 |
+
|
| 628 |
+
In this section, we demonstrate the effectiveness of our method across different model architectures. Here, besides the MobileNetV2 used in the main paper, we also experiment on ResNet18 and ResNet32. Note that ResNet18 is the wider ResNet whose representation dimension is 512 and ResNet32 is the narrower ResNet whose representation dimension is 64. The coefficient of the FedDecorr objective is set to be 0.1 as suggested to be a good universal value of $\beta$ in the paper. The heterogeneity parameter $\alpha$ is set to be 0.05 and we use the CIFAR10 dataset. Our results are shown in Tab. 7. As can be seen, FedDecorr yields consistent improvements across different neural network architectures. One interesting phenomenon is that the improvements brought about by FedDecorr are much larger on wider networks (e.g., MobileNetV2, ResNet18) than on narrower ones (e.g. ResNet32). We conjecture this is because the dimension of the ambient space of wider networks are clearly higher than that of shallower networks. Therefore, relatively speaking, the dimensional collapse caused by data heterogeneity will be more severe for wider networks.
|
| 629 |
+
|
| 630 |
+
Table 7: Effectiveness of FEDDECORR on other model architectures.
|
| 631 |
+
|
| 632 |
+
<table><tr><td></td><td colspan="3">|MobileNetV2 ResNet18 ResNet32</td></tr><tr><td>FedAvg</td><td>64.85</td><td>71.51</td><td>65.76</td></tr><tr><td>+ FEDDECORR</td><td>73.06</td><td>76.54</td><td>67.21</td></tr></table>
|
| 633 |
+
|
| 634 |
+
Table 8: CIFAR10/100 Experiments. We run experiments under various degrees of heterogeneity $( \alpha \in \{ 0 . 0 5 , 0 . 1 , 0 . 5 , \infty \} )$ and report the test accuracy $( \% )$ . All results are (re)produced by us and are averaged over 3 runs (mean $\pm$ std). Bold font highlights the highest accuracy in each column. We add results of Scaffold and FedNova comparing to Tab. 1 in the main paper.
|
| 635 |
+
|
| 636 |
+
<table><tr><td rowspan="2">Method</td><td colspan="4">CIFAR10</td><td colspan="4">CIFAR100</td></tr><tr><td></td><td>α=0.050.1</td><td>0.5</td><td>8</td><td>0.05</td><td>0.1</td><td>0.5</td><td>8</td></tr><tr><td>Scaffold</td><td></td><td></td><td></td><td></td><td>51.99±2.54 74.36±3.10 87.05±0.3989.77±0.24 54.51±0.26 61.42±0.54 68.37±0.44 70.97±0.04</td><td></td><td></td><td></td></tr><tr><td>FedNova</td><td></td><td></td><td></td><td></td><td>63.07±1.59 79.98±1.56 90.23±0.41 92.39±0.18 60.22±0.33 66.43±0.26 71.79±0.17 74.47±0.13</td><td></td><td></td><td></td></tr><tr><td>FedAvg</td><td></td><td></td><td></td><td></td><td>64.85±2.01 76.28±1.22 89.84±0.13 92.39±0.26 59.87±0.25 66.46±0.16 71.69±0.15 74.54±0.15</td><td></td><td></td><td></td></tr><tr><td>FedProx</td><td></td><td></td><td></td><td></td><td>+ FEDDEC0RR 73.06±0.81 80.60±0.91 89.84±0.05 92.19±0.10 61.53±0.11 67.12±0.09 71.91±0.04 73.87±0.18</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>64.11±0.84 76.10±0.40 89.57±0.04 92.38±0.09 60.02±0.46 66.41±0.27 71.78±0.19 74.34±0.03</td><td>+ FEDDEC0RR 71.38±0.81 81.74±0.34 89.96±0.26 92.14±0.20 61.33±0.19 67.00±0.46 71.64±0.10 74.15±0.06</td><td></td><td></td></tr><tr><td>FedAvgM</td><td></td><td></td><td></td><td></td><td>71.34±0.71 77.51±0.58 88.39±0.1791.35±0.15 59.64±0.20 66.36±0.1471.17±0.2 74.20±0.16</td><td></td><td></td><td></td></tr><tr><td>MOON</td><td>+ FEDDEC0RR 73.60±0.82 79.21±0.15 88.70±0.26 91.33±0.13 61.48±0.27 66.60±0.11 71.26±0.21 73.86±0.25</td><td></td><td></td><td></td><td></td><td>68.79±0.69 78.70±0.6690.08±0.10 92.62±0.17 56.79±0.17 65.48±0.29 71.81±0.14 74.30±0.12</td><td></td><td></td></tr></table>
|
| 637 |
+
|
| 638 |
+
<table><tr><td rowspan="2">Method</td><td>TinyImageNet</td></tr><tr><td>α =0.050.1 0.5</td></tr><tr><td>Scaffold FedNova</td><td>8 35.16±0.77 37.87±0.78 44.24±0.14 44.88±0.29 35.28±0.04 39.73±0.07 47.05±0.42 49.57±0.09</td></tr><tr><td>FedAvg</td><td>35.02±0.46 39.30±0.23 46.92±0.25 49.33±0.19</td></tr><tr><td></td><td>+ FEDDEC0RR 40.29±0.18 43.86±0.50 50.01±0.27 52.63±0.26</td></tr><tr><td>FedProx</td><td>35.20±0.30 39.66±0.4347.16±0.07 49.76±0.36</td></tr><tr><td></td><td>+ FEDDEC0RR 40.63±0.05 44.19±0.14 50.26±0.27 52.37±0.36</td></tr><tr><td>FedAvgM</td><td>34.81±0.09 39.72±0.1147.11±0.04 49.67±0.25</td></tr><tr><td></td><td>+ FEDDEC0RR 39.97±0.23 43.95±0.26 50.14±0.11 52.05 ±0.37</td></tr><tr><td>MOON</td><td></td></tr><tr><td></td><td>35.23±0.26 40.53±0.28 47.25±0.66 50.48±0.57</td></tr><tr><td></td><td>+ FEDDEC0RR 40.40±0.24 44.20±0.22 50.81±0.51 53.01±0.45</td></tr></table>
|
| 639 |
+
|
| 640 |
+
Table 9: TinyImageNet Experiments. We run with $\alpha \in \{ 0 . 0 5 , 0 . 1 , 0 . 5 , \infty \}$ and report the test accuracies $( \% )$ . All results are (re)produced by us and are averaged over 3 runs (mean $\pm$ std is reported). Bold font highlights the highest accuracy in each column. We add results of Scaffold and FedNova comparing to Tab. 2 in the main paper.
|
| 641 |
+
|
| 642 |
+
# C.4 COMPARISON WITH OTHER FEDERATED LEARNING BASELINES
|
| 643 |
+
|
| 644 |
+
In this section, we compare FEDDECORR with two other baselines, namely Scaffold (Karimireddy et al., 2020) and FedNova (Wang et al., 2020b). We use the same experimental setups as in the main paper to implement these two baselines. Results on CIFAR10/100 and TinyImageNet are shown in Tab. 8 and Tab. 9, respectively. As shown in the tables, across various datasets and degrees of heterogeneity, adding FEDDECORR on top of a baseline method can outperform the baselines when there is some heterogeneity across the agents, i.e., $\alpha < \infty$ .
|
| 645 |
+
|
| 646 |
+
# C.5 EXPERIMENTS ON ANOTHER TYPE OF HETEROGENEITY
|
| 647 |
+
|
| 648 |
+
In this section, we run experiments under another type of data heterogeneity. Specifically, we follow McMahan et al. (2017) and split the CIFAR10 dataset across different clients such that each client only has a fixed number of classes $C$ (e.g., $C = 2$ indicates each client only has data of two classes). We split the data across 10 clients and choose $C$ to be 2 and 3. Results are shown in Tab. 10. As can
|
| 649 |
+
|
| 650 |
+

|
| 651 |
+
Figure 7: Data heterogeneity causes similar dimensional collapse on other federated learning methods such as FedAvgM (Hsu et al., 2019), FedProx (Li et al., 2020), and MOON (Li et al., 2021b). The $\mathbf { X }$ -axis $( k )$ is the index of singular values.
|
| 652 |
+
|
| 653 |
+

|
| 654 |
+
Figure 8: Data heterogeneity causes similar dimensional collapse on other model architectures during federated learning. The $\mathbf { X }$ -axis $( k )$ is the index of singular values.
|
| 655 |
+
|
| 656 |
+
be observed, under this different heterogeneity scenario, FEDDECORR also yields noticeable and consistent improvements.
|
| 657 |
+
|
| 658 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>|C=2 C=3</td></tr><tr><td rowspan=1 colspan=1>FedAvg</td><td rowspan=1 colspan=1>45.61 67.53</td></tr><tr><td rowspan=1 colspan=1>+ FEDDECORR</td><td rowspan=1 colspan=1>47.6374.51</td></tr></table>
|
| 659 |
+
|
| 660 |
+
Table 10: FEDDECORR yields noticeable and consistent improvements under another type of data heterogeneity.
|
| 661 |
+
|
| 662 |
+
# D ADDITIONAL VISUALIZATIONS ON GLOBAL MODELS
|
| 663 |
+
|
| 664 |
+
In this section, we provide additional visualizations on global models with different federated learning methods, model architectures, and datasets. Through our extensive experimental results, we demonstrate that dimensional collapse is a general problem under heterogeneous data in federated learning.
|
| 665 |
+
|
| 666 |
+
# D.1 VISUALIZATION ON GLOBAL MODELS OF OTHER FEDERATED LEARNING METHODS
|
| 667 |
+
|
| 668 |
+
In the main text, we have shown that global models produced by FedAvg (McMahan et al., 2017) suffer stronger dimensional collapse with increasing data heterogeneity. To further show such dimensional collapse phenomenon is a general problem in federated learning, we visualized global models produced by other federated learning methods such as FedAvg with server momentum (Hsu et al., 2019), FedProx (Li et al., 2020), and MOON (Li et al., 2021b). Specifically, we follow the same procedure as in the main text and plot the singular values of covariance matrices of representations. Results are shown in Fig. 7. From the figure, one can see that all these three other methods also demonstrated the similar hazard of dimensional collapse as in FedAvg.
|
| 669 |
+
|
| 670 |
+
# D.2 VISUALIZATION ON GLOBAL MODELS OF OTHER MODEL ARCHITECTURES
|
| 671 |
+
|
| 672 |
+
In the main text, we have shown the dimensional collapse on global models caused by data heterogeneity with MobileNetV2. In this section, we perform the similar visualization based on other model architectures such as ResNet32 and ResNet18. Note that ResNet32 is a narrower ResNet whose representation dimension is 64 and ResNet18 is a wider ResNet whose representation dimension is 64. We visualize the top 50 singular values for ResNet32 and the top 100 singular values for ResNet18. Results are shown in Fig. 8. From the figure, one can observe that heterogeneous data also lead to dimensional collapse on ResNet32 and ResNet18.
|
| 673 |
+
|
| 674 |
+

|
| 675 |
+
Figure 9: Data heterogeneity causes similar dimensional collapse on other datasets during federated learning. The $\mathbf { X }$ -axis $( k )$ is the index of singular values.
|
| 676 |
+
|
| 677 |
+
# D.3 VISUALIZATION ON GLOBAL MODELS OF OTHER DATASETS
|
| 678 |
+
|
| 679 |
+
In the main text, we use the CIFAR100 dataset for our visualizations. In this section, we perform similar visualizations with other datasets such as CIFAR10 and TinyImageNet. Results are shown in Fig. 9. From the figure, one can also observe that dimensional collapse results from data heterogeneity.
|
| 680 |
+
|
| 681 |
+
# E VISUALIZATION ON OTHER LOCAL CLIENTS
|
| 682 |
+
|
| 683 |
+
In the main text Fig. 2(b), under the four different degrees of data heterogeneity (i.e., $\alpha \in$ $\{ 0 . 0 1 , 0 . 0 5 , 0 . 2 5 , \infty \} )$ ), we compare representations of local models of client 1 and empirically show how data heterogeneity affects representations produced by the local models. In this section, to further corroborate our conclusion, we follow the same procedure and visualize singular values of the covariance matrix of representations produced by local models trained on the rest of the 9 clients under the same $\alpha$ ’s. Results are shown in Fig. 10. From the results, we can obtain the similar observations as in Fig. 2(b) of the main text, namely that stronger data heterogeneity causes more severe dimensional collapse for local models.
|
| 684 |
+
|
| 685 |
+
# F HYPERPARAMETERS OF OTHER FEDERATED LEARNING METHODS
|
| 686 |
+
|
| 687 |
+
The regularization coefficient of FedProx (Li et al., 2020) $\mu$ is tuned across $\{ 1 0 ^ { - 4 } , 1 \overset { \smile } { 0 } ^ { - 3 } , 1 0 ^ { - 2 } , 1 0 ^ { - 1 } \}$ and is selected to be $\begin{array} { r } { \dot { \mu } { } ~ = ~ 1 0 ^ { - 3 } } \end{array}$ ; the regularization coefficient of MOON (Li et al., 2021b) $\mu$ is tuned across $\{ 0 . 1 , 1 . 0 , 5 . 0 , 1 0 . 0 \}$ and is selected to be $\mu = 1 . 0$ ; the server momentum of FedAvgM (Hsu et al., 2019) $\rho$ is tuned across $\{ 0 . 1 , 0 . 5 , 0 . 9 \}$ and is selected to be $\rho = 0 . 5$ .
|
| 688 |
+
|
| 689 |
+
# G PSEUDO-CODE OF FEDDECORR
|
| 690 |
+
|
| 691 |
+
Here, we provide a pytorch-style pseudo-code for FEDDECORR in Alg. 1. All FEDDECORR-specific components are highlight in blue. As indicated in the pseudocode, the only additional operation of FEDDECORR is in adding a regularization term $L _ { \mathrm { F e d D e c o r r } } ( w , X )$ defined in Eqn. (8). This shows that FEDDECORR is an extremely convenient plug-and-play federated learning method.
|
| 692 |
+
|
| 693 |
+
# H STABILITY OF FEDDECORR REGULARIZATION LOSS
|
| 694 |
+
|
| 695 |
+
In this section, we first split CIFAR10 into 10 clients with $\alpha = 0 . 5$ . Then, we plot how FedDecorr loss evolve within 10 local epochs for all the 10 clients in Fig. 11. All training configurations are the same as in the main paper. From the results, one can observe that the optimization process of FedDecorr loss is stable.
|
| 696 |
+
|
| 697 |
+

|
| 698 |
+
Figure 10: Heterogeneous local training data cause dimensional collapse. For each of the clients, given the four models trained under different degrees of heterogeneity, we plot the singular values of covariance matrix of representations in descending orders (the results of client 1 are shown in main text Fig. 2(b)). Representations are computed over the CIFAR100 test set. The $x$ -axis $( k )$ is the index of singular values and the $y$ -axis is the logarithm of the singular values.
|
| 699 |
+
|
| 700 |
+

|
| 701 |
+
Figure 11: How FedDecorr loss evolve within 10 local epochs.
|
| 702 |
+
|
| 703 |
+
# Algorithm 1 PyTorch-style Pseudocode for FEDDECORR. (Blue highlights FEDDECORR-specific code)
|
| 704 |
+
|
| 705 |
+
def FedDecorrLoss(z): # N: batch size # d: representation dimension # z: a batch of representation, with shape (N, d) N,d = z.shape # z-score normalization z = (z - z.mean(0)) / z.std(0) # estimate correlation matrix corr mat $\equiv$ 1/N\*torch.matmul(z.t(), z) # calculate FedDecorr loss loss fed decorr $=$ (corr mat.pow(2)).mean() return loss fed decorr
|
| 706 |
+
|
| 707 |
+
def LocalTraining(train_loader, local_epochs, beta): for e in range(local_epochs): for data, targets in train_loader: # forward propagation. # given the batch of data, compute batch representations z and loss loss, z = . loss $+ =$ beta\*FedDecorr(z) # back propagation and update local model parameters ...
|
| 708 |
+
|
| 709 |
+
# def GlobalAggregation():
|
| 710 |
+
|
| 711 |
+
# receiving models from each clients # aggregating local models with certain schemes # sending aggregated models back to clients
|
| 712 |
+
|
| 713 |
+
# def main():
|
| 714 |
+
|
| 715 |
+
# n_comm_round: number of communication rounds.
|
| 716 |
+
# train_loader: data loader of training data.
|
| 717 |
+
# n_local_epochs: number of local trainig epochs on each client.
|
| 718 |
+
# beta: coefficient of the FedDecorr regularization.
|
| 719 |
+
for comm in range(n_comm_round): LocalTraining(train_loader, n_local_epochs, beta) GlobalAggregation()
|
md/dev/G2Q2Mh3avow/G2Q2Mh3avow.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/I-6yh2-dkyD/I-6yh2-dkyD.md
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CYCLIP: Cyclic Contrastive Language-Image Pretraining
|
| 2 |
+
|
| 3 |
+
Shashank Goel∗ UCLA shashankgoel@ucla.edu
|
| 4 |
+
|
| 5 |
+
Hritik Bansal∗ UCLA hbansal@ucla.edu
|
| 6 |
+
|
| 7 |
+
Sumit Bhatia MDSR Lab, Adobe Systems sumit.bhatia@adobe.com
|
| 8 |
+
|
| 9 |
+
Ryan A. Rossi Adobe Research ryrossi@adobe.com
|
| 10 |
+
|
| 11 |
+
Vishwa Vinay Adobe Research vinay@adobe.com
|
| 12 |
+
|
| 13 |
+
Aditya Grover UCLA adityag@cs.ucla.edu
|
| 14 |
+
|
| 15 |
+
# Abstract
|
| 16 |
+
|
| 17 |
+
Recent advances in contrastive representation learning over paired image-text data have led to models such as CLIP [44] that achieve state-of-the-art performance for zero-shot classification and distributional robustness. Such models typically require joint reasoning in the image and text representation spaces for downstream inference tasks. Contrary to prior beliefs, we demonstrate that the image and text representations learned via a standard contrastive objective are not interchangeable and can lead to inconsistent downstream predictions. To mitigate this issue, we formalize consistency and propose CYCLIP, a framework for contrastive representation learning that explicitly optimizes for the learned representations to be geometrically consistent in the image and text space. In particular, we show that consistent representations can be learned by explicitly symmetrizing (a) the similarity between the two mismatched image-text pairs (cross-modal consistency); and (b) the similarity between the image-image pair and the text-text pair (in-modal consistency). Empirically, we show that the improved consistency in CYCLIP translates to significant gains over CLIP, with gains ranging from $1 \dot { 0 } \% - 2 4 \%$ for zero-shot classification accuracy on standard benchmarks (CIFAR-10, CIFAR-100, ImageNet1K) and $1 0 \% - 2 7 \%$ for robustness to various natural distribution shifts. The code is available at https://github.com/goel-shashank/CyCLIP.
|
| 18 |
+
|
| 19 |
+
# 1 Introduction
|
| 20 |
+
|
| 21 |
+
The ability to learn general-purpose representations from diverse data modalities is a long-standing goal of artificial intelligence (AI) [4, 32]. In this regard, recent instantiations such as CLIP [44], ALIGN [29], and BASIC [41] have scaled up vision-language contrastive pretraining to jointly learn image and text embeddings, by exploiting an enormous amount of paired image-text data on the web. Post pretraining, these embeddings exhibit impressive zero-shot classification performance [13] and robustness to natural distribution shifts [48, 57, 24, 26]. Recently, these embeddings have been extended to text-guided generation of natural images [47, 12, 38, 46] and transferred to modalities such as 3-D shapes [50] by emphasizing the interchangeability of the image and text embeddings.
|
| 22 |
+
|
| 23 |
+
In the context of vision-language pretraining, the standard contrastive learning objective aims to maximize the similarity between matched image-text pairs (“positives") against all the mismatched image-text pairs (“negatives") [45, 7, 40, 22]. While such an objective aligns the true image-text pairs, it poses no constraints on the overall geometry of all data pairs, including the mismatched pairs and pairs within the same modality. In Figure 1 (a), we illustrate this effect where matched image-text pairs, $( I _ { \mathrm { d o g } } , T _ { \mathrm { d o g } } )$ and $( I _ { \mathrm { c a t } } , T _ { \mathrm { c a t } } )$ , get close to each other but the overall geometry of pairwise distances can be highly irregular (see e.g., $( I _ { \mathrm { d o g } } , T _ { \mathrm { c a t } } )$ and $( I _ { \mathrm { c a t } } , T _ { \mathrm { d o g } } ) )$ . If we use such representations for downstream inference, such irregularities can translate into inconsistent reasoning in the image and text spaces. For example, CLIP designs proxy captions for class labels and uses the most similar class caption to perform zero-shot classification for images; using the default captions in Figure 1 (a), this would imply that a test image $I _ { \mathrm { t e s t } }$ gets classified as a dog in the image space even when a simple nearest neighbor classifier in the text space would correctly infer the label to be a cat.
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
Figure 1: An illustration of the planar geometry of the learned representations of image-text pairs by (a) CLIP and (b) CYCLIP. The edges indicate the distance between the representations i.e., $\dot { d ( e _ { 1 } , e _ { 2 } ) } = 1 - \langle e _ { 1 } , e _ { 2 } \rangle$ , where $\langle \cdot , \cdot \rangle$ is the inner product. CYCLIP is cyclic consistent between image-text pairs as the in-modal distances, $d ( T _ { \mathrm { c a t } } , T _ { \mathrm { d o g } } ) \sim d ( I _ { \mathrm { c a t } } , I _ { \mathrm { d o g } } )$ , and the cross-modal distances, $d ( \bar { T _ { \mathrm { c a t } } } , \bar { I _ { \mathrm { d o g } } } ) ~ \sim ~ d ( \bar { I _ { \mathrm { c a t } } } , \bar { T _ { \mathrm { d o g } } } )$ , are similar to each other unlike CLIP. Due to explicit consistency constraints, the test image of a cat is classified as a cat in the image as well as the text space.
|
| 27 |
+
|
| 28 |
+
To mitigate these challenges, we propose Cyclic Contrastive Language-Image Pretraining (CYCLIP), a framework that imposes additional geometric structure on the learned representations. Specifically, given two image-text pairs, we augment the contrastive learning objective with two symmetrization terms. The first term provides for in-modal consistency by encouraging the distance between the two image embeddings to be close to the distance between the corresponding text embeddings. The second term for the cross-modal consistency that encourages the distance between the image and text embedding from the first and second pairs respectively to be close to the distance between the text and image embeddings from the first and second pairs respectively. As shown in Figure 1 (b), if representations of any two image-text pairs, $( I _ { \mathrm { d o g } } , T _ { \mathrm { d o g } } )$ and $( \dot { I } _ { \mathrm { c a t } } , T _ { \mathrm { c a t } } )$ exactly satisfy both forms of cyclic consistency, then we can guarantee that any test image $I _ { \mathrm { t e s t } }$ respects the ordering of distances in both image and text spaces (i.e., if $d ( I _ { \mathrm { t e s t } } , I _ { \mathrm { d o g } } ) > d ( I _ { \mathrm { t e s t } } , I _ { \mathrm { c a t } } )$ , then $d ( I _ { \mathrm { t e s t } } , T _ { \mathrm { d o g } } ) > d ( I _ { t e s t } , T _ { \mathrm { c a t } } ) )$ .
|
| 29 |
+
|
| 30 |
+
Empirically, we demonstrate that the improved consistency in CYCLIP translates to improvements over CLIP. In all cases, we pre-train our models on the Conceptual Captions 3M dataset[52]. On zero-shot classification, we observe that CYCLIP improves over CLIP by $1 0 . 2 \%$ on ImageNet1K, $1 0 . 6 \%$ on CIFAR-10 and $2 3 . 9 \%$ on CIFAR-100 respectively. Further, CYCLIP outperforms CLIP with an average relative gain of $+ 1 7 \%$ on ImageNet natural distribution shift benchmarks. We further analyze the improved performance of CYCLIP and find that the additional geometric structure in the representation space better captures the coarse and fine-grained concept hierarchies of datasets.
|
| 31 |
+
|
| 32 |
+
Our contributions are as follows:
|
| 33 |
+
|
| 34 |
+
1. We analyze contrastive learning for representation learning jointly over image and text modalities. We identify a critical shortcoming in the geometry of the learned representation space that can lead to inconsistent predictions in image and text domains.
|
| 35 |
+
|
| 36 |
+
2. We propose CYCLIP, a simple and effective framework for contrastive representation learning with two additional cycle consistency constraints for mitigating the above issue. 3. We demonstrate that CYCLIP achieves significant empirical improvements over CLIP on zero-shot classification and robustness benchmarks. We further explain these improvements by analyzing the impact of consistency on the hierarchical structure of datasets.
|
| 37 |
+
|
| 38 |
+
# 2 Cycle Consistent Representation Learning
|
| 39 |
+
|
| 40 |
+
# 2.1 Preliminaries
|
| 41 |
+
|
| 42 |
+
We are interested in using text supervision to learn general-purpose visual representations that can be generalized to downstream predictive tasks. To this end, there have been several recent advances in language-image pretraining concerning model architectures, training objectives, and sources of supervision. Our work is most closely related to Contrastive Language-Image Pretraining (CLIP) [44] which combines many such advances in a highly scalable and generalizable learning framework.
|
| 43 |
+
|
| 44 |
+
CLIP is trained on millions of images with their captions scraped from the web. Formally, we consider a dataset $S \subset \mathcal { T } \times \mathcal { T }$ consisting of pairs $( I _ { j } , T _ { j } )$ where $I _ { j }$ is a raw image and $T _ { j }$ is a text caption. We use $\mathcal { T }$ and $\tau$ to denote the domain of images and text, respectively. The CLIP architecture consists of 3 components: (i) an image encoder network, $f _ { I } : \mathcal { T } \mapsto \mathbb { R } ^ { d }$ , to encode the raw image into an embedding vector of dimension $d$ , (ii) a text encoder network, $f _ { T } : T \mapsto \mathbb { R } ^ { d }$ , to encode the raw text into an embedding vector of dimension $d$ , (iii) a contrastive objective that pulls the embeddings of paired image-caption pairs together while pushing apart embeddings of unmatched pairs.
|
| 45 |
+
|
| 46 |
+
Formally, during training, consider a batch of $N$ image-captions pairs, $\{ I _ { j } , T _ { j } \} _ { j = 1 } ^ { N }$ , where $I _ { j }$ and $T _ { j }$ represent the raw image and text pair, respectively. The image embedding $\bar { I } _ { j } ^ { e } \in \mathbb { R } ^ { d }$ and text embedding $T _ { j } ^ { e } \in \mathbb { R } ^ { d }$ are obtained by passing $I _ { j }$ and $T _ { j }$ through the image encoder $f _ { I }$ and text encoder $f _ { T }$ , respectively; i.e. $I _ { j } ^ { e } = f _ { I } ( I _ { j } )$ and $T _ { j } ^ { e } = f _ { T } ( T _ { j } )$ . Further, we assume they are normalized to have unit $\ell _ { 2 }$ -norm. The contrastive objective in CLIP aims to align the image and text representations by minimizing the loss function ${ \mathcal { L } } _ { \mathrm { C L I P } }$ shown below:
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
\mathcal { L } _ { \mathrm { C L I P } } = - \frac { 1 } { 2 N } \sum _ { j = 1 } ^ { N } \log \left[ \frac { \exp \left( \langle I _ { j } ^ { e } , T _ { j } ^ { e } \rangle / \tau \right) } { \displaystyle \sum _ { k = 1 } ^ { N } \exp \left( \langle I _ { j } ^ { e } , T _ { k } ^ { e } \rangle / \tau \right) } \right] - \frac { 1 } { 2 N } \sum _ { k = 1 } ^ { N } \log \left[ \frac { \exp \left( \langle I _ { k } ^ { e } , T _ { k } ^ { e } \rangle / \tau \right) } { \displaystyle \sum _ { j = 1 } ^ { N } \exp \left( \langle I _ { j } ^ { e } , T _ { k } ^ { e } \rangle / \tau \right) } \right]
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
where $\langle \cdot , \cdot \rangle$ represents the inner product, and $\tau$ is a trainable temperature parameter. CLIP and its variants can be used to perform zero-shot image classification, i.e., classifying test images into categories not seen at training time. We first transform each category into a suitable caption (e.g., the airplane category in CIFAR-10 can be expressed as ‘a photo of an airplane’). Then, the similarity of the test image to each caption is computed (e.g., cosine distance), and the model predicts the category for which the image-caption similarity is the highest.
|
| 53 |
+
|
| 54 |
+
# 2.2 Inconsistent Representation Learning in CLIP
|
| 55 |
+
|
| 56 |
+
As illustrated in Figure 1 (a), the standard contrastive objective in CLIP can learn image-text representations such that the predicted labels for the test image are different in the image and text spaces. Here, we reason about such inconsistencies more formally in the context of downstream classification. As discussed above, we can predict a label in the text embedding space (zero-shot setting) by selecting the label that is closest to the test image $( P _ { T } )$ . Additionally, for classification in the image embedding space, if we had access to a labeled training set, then one natural way to infer the predicted label $( { \dot { P } } _ { I } ^ { k } )$ of a test image $I _ { t e s t }$ is by taking a majority vote from the true labels associated with the $\mathbf { k }$ -nearest training images. Formally, we define a consistency score that measures the synchrony between the predicted labels in the image and text spaces as:
|
| 57 |
+
|
| 58 |
+

|
| 59 |
+
Figure 2: Illustrative overview for CYCLIP $N = 2 \AA$ ). It consists of 3 major components: (a) cross-modal contrastive alignment, (b) cross-modal consistency, and (c) in-modal consistency. Only (a) is present in CLIP, whereas our proposed regularizers in (b) and (c) mitigate inconsistency.
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
{ \mathrm { C o n s i s t e n c y ~ S c o r e } } _ { k } = { \frac { 1 } { N } } \sum _ { j = 1 } ^ { N } \mathbb { 1 } \left[ P _ { I } ^ { k } ( I _ { j } ) = P _ { T } ( I _ { j } ) \right]
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
where $_ \mathrm { N }$ is the number of test images. In our experiments (discussed in detail in $\ S 3$ ), we found the CLIP’s consistency score $k = 1$ ) to be $44 \%$ , $16 \%$ , and $16 \%$ on the standard benchmarks CIFAR-10, CIFAR-100, and ImageNet1K, respectively, showing a very high degree of disagreement in the image and text spaces. In the following section, we describe our approach to alleviate the inconsistent inference problem and quantitatively show that our solution improves the consistency score in $\ S 4 . 1$ .
|
| 66 |
+
|
| 67 |
+
# 2.3 Cycle Consistent Representation Learning via CYCLIP
|
| 68 |
+
|
| 69 |
+
We showed that the visual representations learned by CLIP could be inconsistent when used for inference in the image and text spaces. To mitigate this problem, we propose CYCLIP, a learning framework that builds upon CLIP by augmenting the contrastive loss in Eq. 1 with additional geometric consistency regularizers. The intuition follows directly from Figure 1 (b), where we showed that inconsistency in the image and text spaces could be eliminated if we symmetrize the similarity between the two mismatched image-text pairs and the similarity between the image-image pair and the text-text pair. We formalize this intuition with two consistency regularizers.
|
| 70 |
+
|
| 71 |
+
(1) The cross-modal consistency regularizer reduces the gap in the similarity scores between the embeddings of all the mismatched image-text pairs in a batch, two at a time:
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
\mathcal { L } _ { \mathrm { C - C y c l i c } } = \frac { 1 } { N } \sum _ { j = 1 } ^ { N } \sum _ { k = 1 } ^ { N } \left( \langle I _ { j } ^ { e } , T _ { k } ^ { e } \rangle - \langle I _ { k } ^ { e } , T _ { j } ^ { e } \rangle \right) ^ { 2 } .
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
(2) The in-modal consistency regularizer reduces the gap in the similarity scores between the embeddings of all combinations of image pairs and their corresponding text pairs in a batch:
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
\mathcal { L } _ { \mathrm { I - C y c l i c } } = \frac { 1 } { N } \mathrm {sum _ { \substack { j = 1 } } ^ { N } } \mathrm { \sum _ { \substack { k = 1 } } ^ { N } } \left( \langle I _ { j } ^ { e } , I _ { k } ^ { e } \rangle - \langle T _ { k } ^ { e } , T _ { j } ^ { e } \rangle \right) ^ { 2 } .
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
Hence, our overall loss for CYCLIP is given as:
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
{ \mathcal { L } } _ { \mathrm { C Y C L I P } } = { \mathcal { L } } _ { \mathrm { C L I P } } + \lambda _ { 1 } { \mathcal { L } } _ { \mathrm { I - C y c l i c } } + \lambda _ { 2 } { \mathcal { L } } _ { \mathrm { C - C y c l i c } }
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
where $\lambda _ { 1 } > 0$ and $\lambda _ { 2 } > 0$ are hyperparameters controlling the importance of the in-modal and cross-modal cyclic consistency regularizers relative to the contrastive loss in CLIP. We can also characterize the effect of the regularizers in terms of symmetrizing the in-modal and cross-modal similarity matrices, as illustrated in Figure 2. Note that the optimal solution to the contrastive loss formulation would push the similarity between the normalized embeddings of the matched pairs towards 1 while forcing all other pairs of similarities to 0, thereby also symmetrizing the cross-modal similarity matrix and minimizing the cross-modal consistency loss. However, this idealized scenario does not occur in practice, and we find that explicit regularization via cycle-consistency in CYCLIP facilitates improved learning, as we show in our experiments.
|
| 90 |
+
|
| 91 |
+
# 3 Experiments
|
| 92 |
+
|
| 93 |
+
Setup: We use Conceptual Captions 3M [52] (CC3M) image-caption pairs as the source of multimodal pretraining data for all our models. Note while this dataset is smaller than the custom dataset (400 million pairs) used in the original work on CLIP [44], it is suitable for our available data and compute and has been used for benchmark evaluations in many subsequent works on language-image pretraining [5, 33, 37, 56]. Following prior work [44], our CLIP models use ResNet-50 as the image encoder and a transformer architecture as the text encoder. Further, we train our models from scratch for 64 epochs on 4 V100 GPUs with a batch size of 128 and an initial learning rate of 0.0005 with cosine scheduling and 10000 warmup steps. The dimension of the image and text embeddings is 1024. For CYCLIP, we use $\lambda _ { 1 } = 0 . 2 5$ and $\lambda _ { 2 } = 0 . 2 5$ across all our experiments.
|
| 94 |
+
|
| 95 |
+
# 3.1 Zero-Shot Transfer
|
| 96 |
+
|
| 97 |
+
We compare the zero-shot performance of CLIP and CYCLIP on standard image classification datasets: CIFAR-10, CIFAR-100 [31], and ImageNet1K [49]. We follow the evaluation strategy suggested by [44] for zero-shot classification using prompt engineering. For each dataset, we use the names of the classes to form a set of natural sentences such as ‘a photo of the $\{ \mathrm { c l a s s ~ n a m e } \} ^ { \mathrm { , } }$ , ‘a sketch of the {class name}’ and more. These are passed through the text encoder to get a set of text embeddings for that class. This set of text embeddings are $\ell _ { 2 }$ -normalized, averaged, and further $\ell _ { 2 }$ -normalized to obtain a single text embedding for that class. For a given image, the image embedding is obtained as described in $\ S 2$ . The class whose text embedding (as described above) is closest to the test image is taken to be the predicted label. The zero-shot performance of the models is presented in Table 1.
|
| 98 |
+
|
| 99 |
+
Table 1: Zero-shot TopK classification accuracy $( \% )$ where $\mathsf { K } \in \{ 1 , 3 , 5 \}$
|
| 100 |
+
|
| 101 |
+
<table><tr><td rowspan="2"></td><td colspan="3">CIFAR-10</td><td colspan="3">CIFAR-100</td><td colspan="3">ImageNet1K</td></tr><tr><td>Top1</td><td>Top3</td><td>Top5</td><td>Top1</td><td>Top3</td><td>Top5</td><td>Top1</td><td>Top3</td><td>Top5</td></tr><tr><td>CLIP</td><td>46.54</td><td>78.22</td><td>91.16</td><td>18.69</td><td>34.72</td><td>43.97</td><td>20.03</td><td>33.04</td><td>39.35</td></tr><tr><td>CYCLIP</td><td>51.45</td><td>79.57</td><td>91.80</td><td>23.15</td><td>41.46</td><td>50.66</td><td>22.08</td><td>35.98</td><td>42.30</td></tr><tr><td>%GAIN</td><td>+10.6</td><td>+1.7</td><td>+0.7</td><td>+23.9</td><td>+19.4</td><td>+15.2</td><td>+10.2</td><td>+8.9</td><td>+7.5</td></tr></table>
|
| 102 |
+
|
| 103 |
+
We observe that the CYCLIP outperforms CLIP across all the datasets and on all TopK metrics, with gains in the range of $1 0 \% - 2 4 \%$ for $\mathrm { K } = 1$ . Our results on zero-shot transfer indicate the usefulness of having geometrical consistency for improved downstream performance of CLIP.
|
| 104 |
+
|
| 105 |
+
# 3.2 Robustness to Natural Distribution Shifts
|
| 106 |
+
|
| 107 |
+
One of the major successes of CLIP was its state-of-the-art performance on the natural distribution shift benchmarks. These benchmarks include images depicting sketches, cartoons, adversaries generated using attacks on trained ImageNet models. In Table 2, we evaluate the zero-shot classification accuracy of CYCLIP on four natural distribution shift benchmarks for the ImageNet dataset: ImageNetV2 [48], ImageNetSketch [57], ImageNet-A [27], and ImageNet-R [25].
|
| 108 |
+
|
| 109 |
+
For most of the distribution shift benchmarks, both CLIP and CYCLIP undergo a significant reduction in their zero-shot performance compared to the original ImageNet1K dataset (last three columns in Table 1). However, we observe that CYCLIP outperforms CLIP on all of the datasets considered in this experiment by a significant margin of improvement $( 1 0 - 2 7 \% )$ ). This result indicates that having cyclic consistency in the learned representations preserves the robustness on the traditional datasets.
|
| 110 |
+
|
| 111 |
+
Table 2: Zeroshot Classification on Natural Distribution Shifts $( \% )$
|
| 112 |
+
|
| 113 |
+
<table><tr><td></td><td colspan="3">ImageNetV2</td><td colspan="3">ImageNetSketch</td><td colspan="3">ImageNet-A</td><td colspan="3">ImageNet-R</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>Top1 Top3 Top5 Top1 Top3 Top5 Top1 Top3 Top5 Top1 Top3 Top5</td><td></td><td></td><td></td><td></td></tr><tr><td>CLIP</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>16.91 29.28 34.99 10.37 19.15 24.20 4.2311.3516.88 24.32 39.69 47.20</td><td></td><td></td><td></td><td></td></tr><tr><td>CYCLIP 19.22 32.29 38.41 12.26 22.56 28.17 5.3513.53 19.51 26.79 42.31 50.03</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>%GAIN +13.7 +10.3 +9.8 +18.2 +17.8 +16.4 +26.5 +19.2 +15.6 +10.2 +6.6 +6.0</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 114 |
+
|
| 115 |
+
# 3.3 Linear Probing
|
| 116 |
+
|
| 117 |
+
While the primary focus of CLIP and CYCLIP is zero-shot generalization, we can also assess if the benefits of our cyclic consistency constraints in mitigating inconsistency can be recovered with extra in-domain and in-modality supervision i.e., in the presence of in-distribution training samples from in-domain visual datasets. To this end, we conduct an additional experiments on linear probing where we fit a linear classifier on the representations learned by the visual encoder (ResNet-50) of CLIP and CYCLIP on a range of image classification datasets.
|
| 118 |
+
|
| 119 |
+
Table 3: Transfer CLIP and CYCLIP to 14 downstream visual datasets using linear probing. Our CYCLIP performs marginally better on 9 out of 14 datasets. For training ImageNet1K, we use a random subset of 50K images from its original training dataset.
|
| 120 |
+
|
| 121 |
+
<table><tr><td>iroiiir0 eeeee srtprtiois Crreaer CIPAAII1 CEIPRIPI0 DPodppttrt Arrit IorPoon TTSSP OITLS NH∧S 0 CLIP 79.80 78.26 54.85 59.02 28.00 83.50 54.44 69.72 35.93 57.66 53.82 20.00 89.23 47.28|</td></tr></table>
|
| 122 |
+
|
| 123 |
+
We present our results in Table 3. We find that both CLIP and CYCLIP can recover most of the performance lost due to inconsistency when provided extra in-domain and in-modality supervision, with CYCLIP marginally outperforming the CLIP on 9 out of 14 visual datasets.
|
| 124 |
+
|
| 125 |
+
# 4 Analysis
|
| 126 |
+
|
| 127 |
+
Previously, we demonstrated the gains of CYCLIP over CLIP on downstream tasks that involve joint reasoning over the image and text spaces. In the current section, we wish to better understand the relative behavior of the two models on a set of challenging tasks.
|
| 128 |
+
|
| 129 |
+
# 4.1 Consistency in Image and Text Spaces
|
| 130 |
+
|
| 131 |
+
We begin by quantitatively measuring the inconsistency problem illustrated in Figure 1. That is, we wish to evaluate to what extent are the predictions in the image-text space (zero-shot) consistent with the ones made purely within the image space, as measured by our consistency metric in Eq. 2.
|
| 132 |
+
|
| 133 |
+
Table 4 presents our results over standard benchmarks (CIFAR-10, CIFAR-100, ImageNet1K). The consistency score is calculated over 10K, 10K, and 50K testing images of the CIFAR-10, CIFAR-100 and ImageNet dataset respectively. We use 50K samples from the training set of each dataset for $\mathbf { k }$ -Nearest Neighbor prediction. CYCLIP is more consistent than CLIP across all the datasets as we explicitly symmetrize the cross-modal and in-modal distances. Hence, the representations learned by CYCLIP can be better used interchangeably than CLIP.
|
| 134 |
+
|
| 135 |
+
Table 4: Consistency score $( \% )$ trend for CLIP and CYCLIP across standard benchmarks . Top- $\mathbf { \nabla } \cdot \mathbf { k }$ consistency score implies the fraction of times, the zero-shot predicted label in the text space is identical to the k-Nearest Neighbor predicted label in the image space (using the training dataset).
|
| 136 |
+
|
| 137 |
+
<table><tr><td></td><td colspan="4">CIFAR-10</td><td colspan="4">CIFAR-100</td><td colspan="4">ImageNet1K</td></tr><tr><td></td><td></td><td>Top1 Top3Top5Top10 Top1</td><td></td><td></td><td></td><td></td><td></td><td>Top3Top5Top10 Top1 T</td><td></td><td></td><td></td><td>Top3Top5Top10</td></tr><tr><td>CLIP</td><td>44.60</td><td>46.04</td><td>47.06</td><td>48.45</td><td>16.21</td><td>17.28</td><td>18.42</td><td>19.36</td><td>16.34</td><td>17.42</td><td>18.58</td><td>19.78</td></tr><tr><td>CYCLIP</td><td>48.81</td><td>50.89</td><td>52.30</td><td>53.71</td><td>20.43</td><td>21.96</td><td>23.18</td><td>24.31</td><td>19.20</td><td>20.31</td><td></td><td>21.9523.94</td></tr><tr><td>%GAIN</td><td>+8.6</td><td>+9.5</td><td>+10.0</td><td>)+9.8</td><td>+20.7</td><td></td><td></td><td>+21.3 +20.5 +20.4</td><td>+14.9 +14.2 +15.4 +17.4</td><td></td><td></td><td></td></tr></table>
|
| 138 |
+
|
| 139 |
+
# 4.2 Fine-grained and Coarse-grained Performance
|
| 140 |
+
|
| 141 |
+
In $\ S 3 . 1$ , we observed that CYCLIP outperforms CLIP on zero-shot transfer across various datasets. We perform an error analysis investigating both models’ coarse and fine-grained classification performance to understand the transfer phenomena better. Given a hierarchical class structure dataset, coarse-grained classification differentiates between high-level (parent) classes, i.e., zeroshot classification into aquatic mammals and fish. The fine-grained classification task focuses on differentiating low-level (child) classes, i.e., zero-shot classification into a dolphin, otter, and seal (subclasses of aquatic mammals). We perform this analysis on the CIFAR-100, ImageNet1K, ImageNetV2, ImageNetSketch, ImageNet-A, and ImageNet-R datasets.
|
| 142 |
+
|
| 143 |
+
Formally, we consider a test set of $N$ image-subclass-superclass triplets, $\{ I _ { j } , C _ { j } , P _ { j } \} _ { j = 1 } ^ { N }$ , where $I _ { j }$ , $C _ { j }$ , $P _ { j }$ represent the image, the subclass (child) and superclass (parent) respectively. The image embedding $I _ { j } ^ { e } \in \mathbb { R } ^ { d }$ is obtained as described in $\ S 2$ , and the subclass embedding $C _ { j } ^ { e } \in \mathbb { R } ^ { d }$ and superclass embedding ${ P } _ { j } ^ { e } \in \mathbb { R } ^ { d }$ are obtained as described in $\ S 3 . 1$ . Let the total number of superclasses and subclasses in the dataset be $n _ { \mathrm { p } }$ and $n _ { \mathrm { c } }$ , respectively. Further, let $F$ be a unique mapping from a subclass to the superclass, and $\mho$ denote the inverse mapping from a superclass to the set of subclasses i.e. $\forall P \in \{ 1 , \cdot \cdot \cdot , n _ { \mathrm { p } } \}$ , $G ( P ) = \{ C : F ( C ) = P$ and $\mathbf { \bar { \it C } } \in \{ 1 , \dots , n _ { \mathrm { c } } \} \}$ . Under this setup, the fine-grained and coarse-grained accuracies are defined as:
|
| 144 |
+
|
| 145 |
+
$$
|
| 146 |
+
\begin{array} { r l } & { \mathrm { F i n e - g r a i n e d ~ A c c u r a c y } = \displaystyle \frac { 1 } { N } \sum _ { j = 1 } ^ { N } 1 \left[ \mathrm { a r g m a x } \ \langle I _ { j } ^ { e } , C \rangle = C _ { j } \right] } \\ & { \mathrm { C o a r s e - g r a i n e d ~ A c c u r a c y } = \displaystyle \frac { 1 } { N } \sum _ { j = 1 } ^ { N } 1 \left[ \mathrm { a r g m a x } \ \langle I _ { j } ^ { e } , C \rangle \in G \left( P _ { j } \right) \right] } \end{array}
|
| 147 |
+
$$
|
| 148 |
+
|
| 149 |
+
In Figure 3 we visualize how CLIP and CYCLIP compare with each other on the above metrics. The difference between the zero-shot performance of CYCLIP and CLIP is much more significant for coarse-grained classification than fine-grained classification across all the datasets. This observation indicates that concept-level knowledge is better captured in CYCLIP compared to CLIP. The drastic difference in the coarse-grained performance of CYCLIP and CLIP may be attributed to the rigid separation that the default cross-entropy loss in CLIP enforces between the positive pairs and negative pairs, which might degrade performance when some pairs in the negative batch belong to a similar entity. However, CYCLIP does not suffer from this problem as much because it poses cycle constraints on the overall geometry of all the data pairs rather than forcing a rigid separation.
|
| 150 |
+
|
| 151 |
+
# 4.3 Alignment and Uniformity on the Unit Hypersphere
|
| 152 |
+
|
| 153 |
+
[58] argues that contrastive learning directly optimizes for (a) alignment (closeness) of the representations of the positive pairs and (b) uniformity (coverage) of the representation space on the unit hypersphere. We extend these properties for multimodal contrastive representation learning as:
|
| 154 |
+
|
| 155 |
+
$$
|
| 156 |
+
\mathrm { A l i g n m e n t } = \frac { 1 } { N } \sum _ { j = 1 } ^ { N } \langle I _ { j } ^ { e } , T _ { j } ^ { e } \rangle \qquad \mathrm { U n i f o r m i t y } = \log \left( \frac { 1 } { N ( N - 1 ) } \sum _ { j = 1 } ^ { N } \sum _ { k = 1 , j \neq k } ^ { N } e ^ { - \langle I _ { j } ^ { e } , T _ { k } ^ { e } \rangle } \right)
|
| 157 |
+
$$
|
| 158 |
+
|
| 159 |
+

|
| 160 |
+
Figure 3: The gap between the performances of CLIP and CYCLIP is much larger in coarse-grained scenario highlighting better entity-level knowledge representation in CYCLIP.
|
| 161 |
+
|
| 162 |
+
We desire our models to achieve high alignment and uniformity scores so that the image-text representations are close for the matched pairs and better spread over the unit hypersphere for different categories. We analyze the effect of cross-modal and in-modal consistency on the alignment and uniformity of the shared representations. For this, we train two ablated versions of CYCLIP, 1) C-CYCLIP with only cross-modal consistency component i.e. $\lambda _ { 1 } = 0 , \lambda _ { 2 } = 0 . 5$ , and 2) I-CYCLIP with only in-modal consistency component i.e. $\lambda _ { 1 } = 0 . 5 , \lambda _ { 2 } = 0$ (in Eq. 5). We design proxy captions for classes as discussed in $\ S 3 . 1$ to act as text embeddings. We present the results in Table 5.
|
| 163 |
+
|
| 164 |
+
Table 5: Alignment and Uniformity values for CLIP and Cyclic CLIP models. We abbreviate Alignment by A, Uniformity by U, and Zero-shot Top1 classification accuracy $( \% )$ by ZS-Top1.
|
| 165 |
+
|
| 166 |
+
<table><tr><td rowspan="2">Model</td><td colspan="3">CIFAR-10</td><td colspan="3">CIFAR-100</td><td colspan="3">ImageNet1K</td></tr><tr><td>A</td><td>U</td><td>ZS-Top1</td><td>A</td><td>U</td><td>ZS-Top1</td><td>A</td><td>U</td><td>ZS-Top1</td></tr><tr><td>CLIP</td><td>0.36</td><td>-0.27</td><td>46.54</td><td>0.36</td><td>-0.25</td><td>18.69</td><td>0.39</td><td>-0.18</td><td>20.03</td></tr><tr><td>CYCLIP</td><td>0.36</td><td>-0.34</td><td>51.45</td><td>0.37</td><td>-0.33</td><td>23.15</td><td>0.38</td><td>-0.32</td><td>22.08</td></tr><tr><td>I-CYCLIP</td><td>0.60</td><td>-0.57</td><td>50.97</td><td>0.60</td><td>-0.57</td><td>22.35</td><td>0.61</td><td>-0.55</td><td>21.21</td></tr><tr><td>C-CYCLIP</td><td>0.05</td><td>-0.02</td><td>55.52</td><td>0.06</td><td>-0.02</td><td>25.49</td><td>0.07</td><td>-0.02</td><td>21.73</td></tr></table>
|
| 167 |
+
|
| 168 |
+
We observe that I-CYCLIP learns representations that are better aligned in the representation space; however, they do not cover the hypersphere uniformly. The representations learned by C-CYCLIP are more uniformly spread but poorly aligned compared to I-CYCLIP. In this light, the components of CYCLIP can be seen to encourage a balance of good alignment and uniformity. Further, we find that CLIP is more uniform than CYCLIP in all datasets, but contrary to prior beliefs, this does not translate to improved downstream performance. C-CYCLIP has the best downstream zero-shot performance for CIFAR-10 and CIFAR-100 despite its poor alignment score. Further, all 3 variants of CYCLIP outperform CLIP on all 3 datasets, with CYCLIP performing the best on ImageNet1K.
|
| 169 |
+
|
| 170 |
+
# 4.4 Image-Text Retrieval
|
| 171 |
+
|
| 172 |
+
We evaluate the effectiveness of the proposed method on the cross-modal (image to text and text to image) retrieval downstream task in the zero-shot as well as fine-tuned settings. We consider the standard benchmark datasets: Flickr30K [42] and MSCOCO [8]. We assess our models on the test set of Flickr30K (1K) and MSCOCO (5K) obtained from the well-known Karpathy [30] split. Both the datasets contains 5 paired captions per image that makes text retrieval per image more easier than image retrieval per caption. We confirm the same in our results below. We perform fine-tuning on the Karpathy’s training split with the batch size of 48. We fine-tune on Flick30K for 10 epochs and MSCOCO for 5 epochs. All the other hyperparameters are identical to that of pre-training.
|
| 173 |
+
|
| 174 |
+
Table 6: Zero-shot and fine-tuned cross-modal image-text retrieval (text-to-image and image-to-text) results of CLIP and CYCLIP on Flick30K and MSCOCO datasets.
|
| 175 |
+
|
| 176 |
+
<table><tr><td rowspan="3"></td><td rowspan="3"></td><td colspan="4">Flickr30K (1K)</td><td colspan="4">MSCOCO (5K)</td></tr><tr><td colspan="2">Text Retrieval</td><td colspan="2">Image Retrieval</td><td colspan="2">Text Retrieval</td><td colspan="2">Image I Retrieval</td></tr><tr><td> R@1 R@5 R@10 R@1 R@5 R@10 R@1 R@5 R@10 R@1 R@5 R@10</td><td></td><td colspan="2"></td><td></td><td></td><td></td><td></td></tr><tr><td>Zero-shot</td><td>CLIP CyCLIP</td><td>88.2 93.9 88.1 93.7</td><td>95.8</td><td>29.9 57.2</td><td>68.0</td><td>82.1 85.6</td><td>87.8</td><td>8.4 19.5</td><td>26.6</td></tr><tr><td></td><td></td><td></td><td></td><td>95.9 30.9</td><td>57.8</td><td>69.1 82.1</td><td>85.6</td><td>87.7</td><td>8.6 20.0</td><td>27.0</td></tr><tr><td>Fine-tuned</td><td>CLIP</td><td>91.9</td><td>97.0</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>98.0 46.3</td><td>74.7</td><td>83.6 83.2</td><td>87.6</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>90.0</td><td>10.6 23.9</td><td>31.3</td></tr><tr><td></td><td>CYCLIP</td><td>92.3</td><td>97.0</td><td>98.4</td><td>47.3</td><td>83.2</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>76.6</td><td>85.4</td><td>87.8</td><td>90.3</td><td>11.4 25.8</td><td>33.4</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 177 |
+
|
| 178 |
+
Table 6 presents our cross-modal image-text retrieval results for CLIP and CYCLIP. In the zero-shot setting, we find that CYCLIP marginally outperforms CLIP on the image retrieval task on both the datasets. The relatively lower performance of both CLIP and CYCLIP in the zero-shot setting may be attributed to the more complicated nature of the two datasets where the models are expected to find similarities between the image and text at multiple resolutions as opposed to image classification where there is mostly single object to be matched with a simpler caption. It is not clear as to what distinctions in the raw input and text space are reflected in the embedding space too. Hence, we perform fine-tuning on both the datasets to better inform our models of the downstream datasets. In the fine-tuning setting, we find that the performance of both the models increases across both the datasets. However, we observe clear benefits of the soft consistent regularization on the image retrieval results for both the datasets.
|
| 179 |
+
|
| 180 |
+
# 4.5 CYCLIP preserves the Effective Robustness of CLIP
|
| 181 |
+
|
| 182 |
+
[36] shows that there is a strong correlation between the in-distribution and out-of-distribution generalization of the models trained on ImageNet1K, as illustrated by the linear fit (red) in Figure 4. Ideally, any model that does not undergo distribution shift would fall on the $y = x$ trendline (black). For other models, the deviations of the models from this ideal fit indicate their effective robustness. Previously, [45] showed that the zero-shot CLIP classifier trained on 400M image-text pairs improves effective robustness significantly compared to prior approaches to robustness. Subsequently, [28] demonstrated that CLIP models trained at small scales also exhibit high effective robustness that allows them to be used as a proxy to study the robustness properties of CLIP.
|
| 183 |
+
|
| 184 |
+

|
| 185 |
+
Figure 4: Effect of varying the training dataset size on (a) Classification accuracy on ImageNet1K and (b) Effective Robustness on ImageNetV2.
|
| 186 |
+
|
| 187 |
+
We evaluate the effect of cyclic consistency on effective robustness. We trained 4 CLIP and CYCLIP models, varying the training dataset sizes from 500K to 4M image-text pairs from the $\mathrm { C C 3 M + }$ CC12M datasets. In Figure 4, (a) we observe that for all training data sizes, CYCLIP shows a significant improvement over CLIP, showcasing its effectiveness in a diverse set of data regimes. Further, Figure 4 (b) shows that CYCLIP lies way above the baseline trend and preserves the effective robustness of CLIP.
|
| 188 |
+
|
| 189 |
+
# 5 Related Work
|
| 190 |
+
|
| 191 |
+
Our work fits into the broader theme of unsupervised pretraining with multiple modalities and has been successfully applied for learning representations of modalities such as images, text, and speech [2, 15, 1, 59, 43, 34]. Similar to the unimodal setting, two predominant approaches for multimodal pretraining are contrastive and generative, as described below.
|
| 192 |
+
|
| 193 |
+
Contrastive Representation Learning: Contrastive learning was originally proposed for selfsupervised representation learning in the unimodal context where the embeddings of a sample are brought closer to an augmented version of the sample. In contrast, the embeddings are pushed away for other samples, and their augmentation [11, 51, 39, 55, 21, 7, 16, 40, 66, 23, 18]. [63] and [3] impose additional constraints to remove redundancies and prevent dimensional collapse in the visual representations. Recently, contrastive learning has also been used to learn robust representations of the multimodal data [62, 47]. Many works use additional losses to imbibe extra supervisory multimodal knowledge during the training process [54, 65, 64, 14, 35]. In this work, we focus on having cyclic consistency in addition to the contrastive loss to learn more robust image-text representations.
|
| 194 |
+
|
| 195 |
+
Contrastive Language-Image Pretraining: CLIP [44], ALIGN [29] and BASIC [41] have enjoyed great success in extending contrastive learning to paired image-text data, with impressive zero-shot classification and robustness performance. These works have been further extended recently to include visual self-supervision [37], additional nearest neighbor supervision [33], and utilization of unpaired data [56]. Our work complements much of this literature as it identifies consistency regularizers that can be augmented to the learning objective of the above works.
|
| 196 |
+
|
| 197 |
+
Generative Representation Learning: Generative models have been applied for learning representations of multimodal data [60, 53]. In particular, [67, 61, 10] proposed a notion of cyclic consistency for learning from unpaired multimodal data using GANs [17], which was extended later to normalizing flows [20, 19]. While these works focus on regularizing a generative mapping between modalities, our notion of cycle consistency applies to embeddings learned via a contrastive framework.
|
| 198 |
+
|
| 199 |
+
# 6 Conclusion
|
| 200 |
+
|
| 201 |
+
We presented CYCLIP, a framework for cycle consistent multimodal representation learning for image and text modality. The main benefits of CYCLIP stem from including cross-modal consistency and in-modal consistency regularizers to prevent inconsistent inference in the image and text spaces. Empirically, we show that CYCLIP performs much better than CLIP on zero-shot classification and is more robust on benchmarks for distributional robustness. We also showed that the representations learned by CYCLIP are more consistent than CLIP and better capture concept-level knowledge, as evidenced by our analysis of fine-grained and coarse-grained accuracies.
|
| 202 |
+
|
| 203 |
+
We believe this work can motivate further studies on understanding the geometry of the representation spaces learned via the contrastive objective applied to paired multimodal data and, in particular, identify conditions and regularization strategies under which the learned representations are synergistic across the various modalities for downstream applications.
|
| 204 |
+
|
| 205 |
+
One important future direction and a current limitation is scaling CYCLIP to larger datasets. While we do not possess the resources for this study, it is imperative to study the extent to which the benefits of cycle consistency remain at the scale on which the original CLIP was trained (400M image-text pairs). Finally, for real-world deployment of CLIP and their variants, such as CYCLIP, we need to be cautious about amplifying societal biases as these models are trained on large uncurated datasets scraped from the web [9]. Additionally, it is easy to add malicious data to the web, which poses a severe security threat [5]. Alleviating such harms is an important and active area of research.
|
| 206 |
+
|
| 207 |
+
# Acknowledgements
|
| 208 |
+
|
| 209 |
+
This research is supported by an Adobe Data Science Research Award for Aditya Grover. We would like to thank the IDRE’s Research Technology group for the GPU computing resources on the UCLA Hoffman2 Cluster. We also want to thank Tung Duc Nguyen, Satvik Mashkaria, Siddarth Krishnamoorthy, Varuni Sarwal, and Ashima Suvarna for their helpful suggestions.
|
| 210 |
+
|
| 211 |
+
References
|
| 212 |
+
[1] Yusuf Aytar, Carl Vondrick, and Antonio Torralba. See, hear, and read: Deep aligned representations. arXiv preprint arXiv:1706.00932, 2017.
|
| 213 |
+
[2] Tadas Baltrušaitis, Chaitanya Ahuja, and Louis-Philippe Morency. Multimodal machine learning: A survey and taxonomy. IEEE transactions on pattern analysis and machine intelligence, 41(2):423–443, 2018.
|
| 214 |
+
[3] Adrien Bardes, Jean Ponce, and Yann LeCun. Vicreg: Variance-invariance-covariance regularization for self-supervised learning. arXiv preprint arXiv:2105.04906, 2021.
|
| 215 |
+
[4] Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE transactions on pattern analysis and machine intelligence, 35(8):1798– 1828, 2013.
|
| 216 |
+
[5] Nicholas Carlini and Andreas Terzis. Poisoning and backdooring contrastive learning. arXiv preprint arXiv:2106.09667, 2021.
|
| 217 |
+
[6] 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 Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3558–3568, 2021.
|
| 218 |
+
[7] 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.
|
| 219 |
+
[8] 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.
|
| 220 |
+
[9] Jaemin Cho, Abhay Zala, and Mohit Bansal. Dall-eval: Probing the reasoning skills and social biases of text-to-image generative transformers. arXiv preprint arXiv:2202.04053, 2022.
|
| 221 |
+
[10] Yunjey Choi, Minje Choi, Munyoung Kim, Jung-Woo Ha, Sunghun Kim, and Jaegul Choo. Stargan: Unified generative adversarial networks for multi-domain image-to-image translation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 8789–8797, 2018.
|
| 222 |
+
[11] Sumit Chopra, Raia Hadsell, and Yann LeCun. Learning a similarity metric discriminatively, with application to face verification. In 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’05), volume 1, pages 539–546. IEEE, 2005.
|
| 223 |
+
[12] Katherine Crowson, Stella Rose 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, abs/2204.08583, 2022.
|
| 224 |
+
[13] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A largescale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248–255. Ieee, 2009.
|
| 225 |
+
[14] Karan Desai and Justin Johnson. Virtex: Learning visual representations from textual annotations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11162–11173, 2021.
|
| 226 |
+
[15] Jiali Duan, Liqun Chen, Son Tran, Jinyu Yang, Yi Xu, Belinda Zeng, Chenyang Tao, and Trishul Chilimbi. Multi-modal alignment using representation codebook. arXiv:2203.00048, 2022.
|
| 227 |
+
[16] Tianyu Gao, Xingcheng Yao, and Danqi Chen. Simcse: Simple contrastive learning of sentence embeddings. arXiv preprint arXiv:2104.08821, 2021.
|
| 228 |
+
[17] Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. Advances in neural information processing systems, 27, 2014.
|
| 229 |
+
|
| 230 |
+
[18] Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent-a new approach to self-supervised learning. Advances in Neural Information Processing Systems, 33:21271–21284, 2020.
|
| 231 |
+
|
| 232 |
+
[19] Aditya Grover, Christopher Chute, Rui Shu, Zhangjie Cao, and Stefano Ermon. Alignflow: Cycle consistent learning from multiple domains via normalizing flows. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 4028–4035, 2020.
|
| 233 |
+
|
| 234 |
+
[20] Aditya Grover, Manik Dhar, and Stefano Ermon. Flow-gan: Combining maximum likelihood and adversarial learning in generative models. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
|
| 235 |
+
|
| 236 |
+
[21] Michael Gutmann and Aapo Hyvärinen. Noise-contrastive estimation: A new estimation principle for unnormalized statistical models. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pages 297–304. JMLR Workshop and Conference Proceedings, 2010.
|
| 237 |
+
|
| 238 |
+
[22] Raia Hadsell, Sumit Chopra, and Yann LeCun. Dimensionality reduction by learning an invariant mapping. In 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’06), volume 2, pages 1735–1742. IEEE, 2006.
|
| 239 |
+
|
| 240 |
+
[23] 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, pages 9729–9738, 2020.
|
| 241 |
+
|
| 242 |
+
[24] Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, et al. The many faces of robustness: A critical analysis of out-of-distribution generalization. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 8340–8349, 2021.
|
| 243 |
+
|
| 244 |
+
[25] Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Lixuan Zhu, Samyak Parajuli, Mike Guo, Dawn Xiaodong Song, Jacob Steinhardt, and Justin Gilmer. The many faces of robustness: A critical analysis of out-ofdistribution generalization. 2021 IEEE/CVF International Conference on Computer Vision (ICCV), pages 8320–8329, 2021.
|
| 245 |
+
|
| 246 |
+
[26] Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 15262–15271, 2021.
|
| 247 |
+
|
| 248 |
+
[27] Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Xiaodong Song. Natural adversarial examples. 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 15257–15266, 2021.
|
| 249 |
+
|
| 250 |
+
[28] 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. Zenodo, July 2021. If you use this software, please cite it as below.
|
| 251 |
+
|
| 252 |
+
[29] Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc Le, YunHsuan 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.
|
| 253 |
+
|
| 254 |
+
[30] Andrej Karpathy and Li Fei-Fei. Deep visual-semantic alignments for generating image descriptions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3128–3137, 2015.
|
| 255 |
+
|
| 256 |
+
[31] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. Citeseer, 2009.
|
| 257 |
+
|
| 258 |
+
[32] Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. nature, 521(7553):436–444, 2015.
|
| 259 |
+
|
| 260 |
+
[33] Yangguang Li, Feng Liang, Lichen Zhao, Yufeng Cui, Wanli Ouyang, Jing Shao, Fengwei Yu, and Junjie Yan. Supervision exists everywhere: A data efficient contrastive language-image pre-training paradigm. arXiv:2110.05208, 2021.
|
| 261 |
+
[34] Kevin Lu, Aditya Grover, Pieter Abbeel, and Igor Mordatch. Pretrained transformers as universal computation engines. arXiv preprint arXiv:2103.05247, 2021.
|
| 262 |
+
[35] Sijie Mai, Ying Zeng, Shuangjia Zheng, and Haifeng Hu. Hybrid contrastive learning of tri-modal representation for multimodal sentiment analysis. arXiv:2109.01797, 2021.
|
| 263 |
+
[36] John P Miller, Rohan Taori, Aditi Raghunathan, Shiori Sagawa, Pang Wei Koh, Vaishaal Shankar, Percy Liang, Yair Carmon, and Ludwig Schmidt. 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, 2021.
|
| 264 |
+
[37] Norman Mu, Alexander Kirillov, David Wagner, and Saining Xie. Slip: Self-supervision meets language-image pre-training. arXiv:2112.12750, 2021.
|
| 265 |
+
[38] 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:2112.10741, 2021.
|
| 266 |
+
[39] Hyun Oh Song, Yu Xiang, Stefanie Jegelka, and Silvio Savarese. Deep metric learning via lifted structured feature embedding. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4004–4012, 2016.
|
| 267 |
+
[40] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
|
| 268 |
+
[41] Hieu Pham, Zihang Dai, Golnaz Ghiasi, Hanxiao Liu, Adams Wei Yu, Minh-Thang Luong, Mingxing Tan, and Quoc V Le. Combined scaling for zero-shot transfer learning. arXiv preprint arXiv:2111.10050, 2021.
|
| 269 |
+
[42] Bryan A Plummer, Liwei Wang, Chris M Cervantes, Juan C Caicedo, Julia Hockenmaier, and Svetlana Lazebnik. Flickr30k entities: Collecting region-to-phrase correspondences for richer image-to-sentence models. In Proceedings of the IEEE international conference on computer vision, pages 2641–2649, 2015.
|
| 270 |
+
[43] Ariadna Quattoni, Michael Collins, and Trevor Darrell. Learning visual representations using images with captions. In 2007 IEEE Conference on Computer Vision and Pattern Recognition, pages 1–8. IEEE, 2007.
|
| 271 |
+
[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.
|
| 272 |
+
[45] 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.
|
| 273 |
+
[46] 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.
|
| 274 |
+
[47] 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.
|
| 275 |
+
[48] Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? In International Conference on Machine Learning, pages 5389–5400. PMLR, 2019.
|
| 276 |
+
[49] 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.
|
| 277 |
+
|
| 278 |
+
[50] Aditya Sanghi, Hang Chu, Joseph G Lambourne, Ye Wang, Chin-Yi Cheng, and Marco Fumero. Clip-forge: Towards zero-shot text-to-shape generation. arXiv preprint arXiv:2110.02624, 2021.
|
| 279 |
+
|
| 280 |
+
[51] Florian Schroff, Dmitry Kalenichenko, and James Philbin. Facenet: A unified embedding for face recognition and clustering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 815–823, 2015.
|
| 281 |
+
|
| 282 |
+
[52] 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.
|
| 283 |
+
|
| 284 |
+
[53] Yuge Shi, Brooks Paige, Philip Torr, et al. Variational mixture-of-experts autoencoders for multi-modal deep generative models. Advances in Neural Information Processing Systems, 32, 2019.
|
| 285 |
+
|
| 286 |
+
[54] 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.
|
| 287 |
+
|
| 288 |
+
[55] Kihyuk Sohn. Improved deep metric learning with multi-class n-pair loss objective. Advances in neural information processing systems, 29, 2016.
|
| 289 |
+
|
| 290 |
+
[56] Ajinkya Tejankar, Bichen Wu, Saining Xie, Madian Khabsa, Hamed Pirsiavash, and Hamed Firooz. A fistful of words: Learning transferable visual models from bag-of-words supervision. arXiv:2112.13884, 2021.
|
| 291 |
+
|
| 292 |
+
[57] Haohan Wang, Songwei Ge, Zachary Lipton, and Eric P Xing. Learning robust global representations by penalizing local predictive power. Advances in Neural Information Processing Systems, 32, 2019.
|
| 293 |
+
|
| 294 |
+
[58] Tongzhou Wang and Phillip Isola. Understanding contrastive representation learning through alignment and uniformity on the hypersphere. In ICML, 2020.
|
| 295 |
+
|
| 296 |
+
[59] Wenhui Wang, Hangbo Bao, Li Dong, and Furu Wei. Vlmo: Unified vision-language pretraining with mixture-of-modality-experts. arXiv preprint arXiv:2111.02358, 2021.
|
| 297 |
+
|
| 298 |
+
[60] Mike Wu and Noah Goodman. Multimodal generative models for scalable weakly-supervised learning. Advances in Neural Information Processing Systems, 31, 2018.
|
| 299 |
+
|
| 300 |
+
[61] Zili Yi, Hao Zhang, Ping Tan, and Minglun Gong. Dualgan: Unsupervised dual learning for image-to-image translation. In Proceedings of the IEEE international conference on computer vision, pages 2849–2857, 2017.
|
| 301 |
+
|
| 302 |
+
[62] Xin Yuan, Zhe Lin, Jason Kuen, Jianming Zhang, Yilin Wang, Michael Maire, Ajinkya Kale, and Baldo Faieta. Multimodal contrastive training for visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6995–7004, 2021.
|
| 303 |
+
|
| 304 |
+
[63] Jure Zbontar, Li Jing, Ishan Misra, Yann LeCun, and Stéphane Deny. Barlow twins: Selfsupervised learning via redundancy reduction. In International Conference on Machine Learning, pages 12310–12320. PMLR, 2021.
|
| 305 |
+
|
| 306 |
+
[64] Rowan Zellers, Ximing Lu, Jack Hessel, Youngjae Yu, Jae Sung Park, Jize Cao, Ali Farhadi, and Yejin Choi. Merlot: Multimodal neural script knowledge models. Advances in Neural Information Processing Systems, 34, 2021.
|
| 307 |
+
|
| 308 |
+
[65] Pengchuan Zhang, Xiujun Li, Xiaowei Hu, Jianwei Yang, Lei Zhang, Lijuan Wang, Yejin Choi, and Jianfeng Gao. Vinvl: Revisiting visual representations in vision-language models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5579–5588, 2021.
|
| 309 |
+
|
| 310 |
+
[66] Yuhao Zhang, Hang Jiang, Yasuhide Miura, Christopher D Manning, and Curtis P Langlotz. Contrastive learning of medical visual representations from paired images and text. arXiv preprint arXiv:2010.00747, 2020.
|
| 311 |
+
[67] Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Proceedings of the IEEE international conference on computer vision, pages 2223–2232, 2017.
|
| 312 |
+
|
| 313 |
+
# Checklist
|
| 314 |
+
|
| 315 |
+
1. For all authors...
|
| 316 |
+
|
| 317 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 318 |
+
(b) Did you describe the limitations of your work? [Yes] Section 6.
|
| 319 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] Section 6.
|
| 320 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 321 |
+
|
| 322 |
+
2. If you are including theoretical results...
|
| 323 |
+
|
| 324 |
+
(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]
|
| 325 |
+
|
| 326 |
+
3. If you ran experiments...
|
| 327 |
+
|
| 328 |
+
(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]
|
| 329 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 330 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Due to extremely-compute heavy experiments.
|
| 331 |
+
(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]
|
| 332 |
+
|
| 333 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 334 |
+
|
| 335 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 336 |
+
(b) Did you mention the license of the assets? [No] All the non-proprietary datasets and code used are public under MIT, BSD or CC licenses.
|
| 337 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 338 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 339 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 340 |
+
|
| 341 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 342 |
+
|
| 343 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 344 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 345 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/ITw9edRDlD/ITw9edRDlD.md
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Are Emergent Abilities of Large Language Models a Mirage?
|
| 2 |
+
|
| 3 |
+
# Rylan Schaeffer
|
| 4 |
+
|
| 5 |
+
Brando Miranda Computer Science Stanford University brando9@cs.stanford.edu
|
| 6 |
+
|
| 7 |
+
Computer Science Stanford University rschaef@cs.stanford.edu
|
| 8 |
+
|
| 9 |
+
Sanmi Koyejo
|
| 10 |
+
Computer Science
|
| 11 |
+
Stanford University
|
| 12 |
+
sanmi@cs.stanford.edu
|
| 13 |
+
|
| 14 |
+
# Abstract
|
| 15 |
+
|
| 16 |
+
Recent work claims that large language models display emergent abilities: abilities not present in smaller-scale models that are present in larger-scale models. What makes emergent abilities intriguing is two-fold: their sharpness, transitioning seemingly instantaneously from not present to present, and their unpredictability, appearing at seemingly unforeseeable model scales. Here, we present an alternative explanation for emergent abilities: for a particular task and model family, when analyzing fixed model outputs, emergent abilities appear due to the researcher’s choice of metric rather than due to fundamental changes in models with scale. Specifically, nonlinear or discontinuous metrics produce seemingly emergent abilities, whereas linear or continuous metrics produce smooth, continuous, predictable changes in model performance. We present our alternative explanation in a simple mathematical model, then test it in three complementary ways: we (1) make, test and confirm three predictions on the effect of metric choice using the InstructGPT/GPT-3 family on tasks with claimed emergent abilities; (2) make, test and confirm two predictions about metric choices in a meta-analysis of emergent abilities on the Beyond the Imitation Game Benchmark (BIG-Bench); and (3) show how to choose metrics to produce never-before-seen seemingly emergent abilities in multiple vision tasks across diverse deep network architectures. Via all three analyses, we provide evidence that emergent abilities disappear with different metrics or with better statistics, and may not be a fundamental property of scaling AI models.
|
| 17 |
+
|
| 18 |
+
# 1 Introduction
|
| 19 |
+
|
| 20 |
+
Emergent properties of complex systems have long been studied across disciplines, from physics to biology to mathematics. The idea of emergence was popularized by Nobel Prize-winning physicist P.W. Anderson’s “More Is Different" [1], which argues that as the complexity of a system increases, new properties may materialize that cannot be predicted even from a precise quantitative understanding of the system’s microscopic details. Recently, the idea of emergence gained significant attention in machine learning due to observations that large language models (LLMs) such as GPT [4], PaLM [7] and LaMDA [35] exhibit so-called “emergent abilities" [38, 9, 33, 4] (Fig. 1).
|
| 21 |
+
|
| 22 |
+
The term “emergent abilities of LLMs" was recently and crisply defined as “abilities that are not present in smaller-scale models but are present in large-scale models; thus they cannot be predicted by simply extrapolating the performance improvements on smaller-scale models" [38]. Such emergent abilities were first discovered in the GPT-3 family [4]. Subsequent work emphasized the discovery, writing that “[although model] performance is predictable at a general level, performance on a specific task can sometimes emerge quite unpredictably and abruptly at scale" [9]. These quotations collectively identify the two defining properties of emergent abilities in LLMs:
|
| 23 |
+
|
| 24 |
+
1. Sharpness, transitioning seemingly instantaneously from not present to present
|
| 25 |
+
|
| 26 |
+

|
| 27 |
+
Figure 1: Emergent abilities of large language models. Model families display sharp and unpredictable increases in performance at specific tasks as scale increases. Source: Fig. 2 from [38].
|
| 28 |
+
|
| 29 |
+
2. Unpredictability, transitioning at seemingly unforeseeable model scales
|
| 30 |
+
|
| 31 |
+
These emergent abilities have garnered significant interest, raising questions such as: What controls which abilities will emerge? What controls when abilities will emerge? How can we make desirable abilities emerge faster, and ensure undesirable abilities never emerge? These questions are especially pertinent to AI safety and alignment, as emergent abilities forewarn that larger models might one day, without warning, acquire undesired mastery over dangerous capabilities [34, 12, 19, 20].
|
| 32 |
+
|
| 33 |
+
In this paper, we call into question the claim that LLMs possess emergent abilities, by which we specifically mean sharp and unpredictable changes in model outputs as a function of model scale on specific tasks. Our doubt stems from the observation that emergent abilities seem to appear only under metrics that nonlinearly or discontinuously scale any model’s per-token error rate. For instance, as we later show, $> 9 2 \%$ of emergent abilities on BIG-Bench tasks [33] (hand-annotated by [37]) appear under either of these two metrics:
|
| 34 |
+
|
| 35 |
+
$$
|
| 36 |
+
\begin{array} { r l } { \mathrm { M u l t i p l e ~ C h o i c e ~ G r a d e ~ { \stackrel { d e f } { = } } ~ } } & { { } { \left\{ \begin{array} { l l } { 1 } & { { \mathrm { i f ~ h i g h e s t ~ p r o b a b i l i t y ~ m a s s ~ o n ~ c o r r e c t ~ o p t i o n } } } \\ { 0 } & { { \mathrm { o t h e r w i s e } } } \end{array} \right. } } \\ { \mathrm { E x a c t ~ S t r i n g ~ M a t c h ~ { \stackrel { d e f } { = } } ~ } } & { { } { \left\{ \begin{array} { l l } { 1 } & { { \mathrm { i f ~ o u t p u t ~ s t r i n g ~ e x a c t l y ~ m a t c h e s ~ t a r g e t ~ s t r i n g } } } \\ { 0 } & { { \mathrm { o t h e r w i s e } } } \end{array} \right. } } \end{array}
|
| 37 |
+
$$
|
| 38 |
+
|
| 39 |
+
This raises the possibility of an alternative explanation for the origin of LLMs’ emergent abilities: sharp and unpredictable changes might be induced by the researcher’s choice of measurement, even though the model family’s per-token error rate changes smoothly, continuously and predictably with increasing scale. Specifically, our alternative posits that emergent abilities are a mirage caused primarily by the researcher choosing a metric that nonlinearly or discontinuously deforms per-token error rates, and secondarily by possessing too few test data to accurately estimate the performance of smaller models, thereby causing smaller models to appear wholly unable to perform the task.
|
| 40 |
+
|
| 41 |
+
To communicate our alternative explanation, we present it as a simple mathematical model and demonstrate how it quantitatively reproduces the evidence offered in support of emergent abilities of LLMs. We then test our alternative explanation in three complementary ways:
|
| 42 |
+
|
| 43 |
+

|
| 44 |
+
Figure 2: Emergent abilities of large language models are created by the researcher’s chosen metrics, not unpredictable changes in model behavior with scale. (A) Suppose the per-token cross-entropy loss decreases monotonically with model scale, e.g., $\mathcal { L } _ { C E }$ scales as a power law. (B) The per-token probability of selecting the correct token asymptotes towards 1. (C) If the researcher scores models’ outputs using a nonlinear metric such as Accuracy (which requires a sequence of tokens to all be correct), the metric choice nonlinearly scales performance, causing performance to change sharply and unpredictably in a manner that qualitatively matches published emergent abilities (inset). (D) If the researcher instead scores models’ outputs using a discontinuous metric such as Multiple Choice Grade (akin to a step function), the metric choice discontinuously scales performance, again causing performance to change sharply and unpredictably. (E) Changing from a nonlinear metric to a linear metric such as Token Edit Distance, scaling shows smooth, continuous and predictable improvements, ablating the emergent ability. (F) Changing from a discontinuous metric to a continuous metric such as Brier Score again reveals smooth, continuous and predictable improvements in task performance. Consequently, the observation of "emergent abilities" can be explained by the researcher’s choice of metrics, and does not require fundamental changes in model family behavior on specific tasks with scale.
|
| 45 |
+
|
| 46 |
+
1. We make, test and confirm three predictions based on our alternative hypotheses using the InstructGPT [27] / GPT-3 [4] model family.
|
| 47 |
+
2. We meta-analyze published benchmarks [33, 38] to reveal that emergent abilities only appear for specific metrics, not for model families on particular tasks, and that changing the metric causes the emergence phenomenon to disappear.
|
| 48 |
+
3. We induce never-before-seen, seemingly emergent abilities in multiple architectures across various vision tasks by intentionally changing the metrics used for evaluation.
|
| 49 |
+
|
| 50 |
+
# 2 Alternative Explanation for Emergent Abilities
|
| 51 |
+
|
| 52 |
+
How might smooth, continuous, predictable changes in model family performance appear sharp and unpredictable? The answer is that the researcher’s choice of a nonlinear or discontinuous metric can distort the model family’s performance to appear sharp and unpredictable.
|
| 53 |
+
|
| 54 |
+
To expound, suppose that within a model family, the test loss falls smoothly, continuously, and predictably with the number of model parameters. One reason to believe this is the phenomenon known as neural scaling laws: empirical observations that deep networks exhibit power law scaling in the test loss as a function of training dataset size, number of parameters or compute [15, 32, 13, 18,
|
| 55 |
+
|
| 56 |
+
10, 14, 17, 39, 16, 8, 29]. For concreteness, suppose we have a model family of different numbers of parameters $N > 0$ and assume that each model’s per-token cross entropy falls as a power law with the number of parameters $N$ for constants $c > 0 , \alpha < 0$ (Fig. 2A):
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
\mathcal { L } _ { C E } ( N ) = \left( \frac { N } { c } \right) ^ { \alpha }
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
To be clear, we do not require this particular functional form to hold; rather, we use it for illustrative purposes. Let $V$ denote the set of possible tokens, $p$ denote the true but unknown probability distribution, and $\hat { p } _ { N }$ denote the $N$ -parameter model’s predicted probability distribution. The pertoken cross entropy as a function of number of parameters $N$ is:
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\mathcal { L } _ { C E } ( N ) \ \stackrel { \mathrm { d e f } } { = } \ - \sum _ { v \in V } p ( v ) \log \hat { p } _ { N } ( v )
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
In practice, $p$ is unknown, so we substitute a one-hot distribution of the observed token $v ^ { * }$
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
\mathcal { L } _ { C E } ( N ) = - \log \hat { p } _ { N } ( v ^ { * } )
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
A model with $N$ parameters then has a per-token probability of selecting the correct token (Fig. 2B):
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
p ( \mathrm { s i n g l e ~ t o k e n ~ c o r r e c t } ) = \exp \Big ( - \mathcal { L } _ { C E } ( N ) \Big ) = \exp \Big ( - \big ( N / c \big ) ^ { \alpha } \Big )
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
Suppose the researcher then chooses a metric that requires selecting $L$ tokens correctly. For example, our task might be $L$ -digit integer addition, and a model’s output is scored 1 if all $L$ output digits exactly match all target digits with no additions, deletions or substitutions, 0 otherwise. If the probability each token is correct is independent1, the probability of scoring 1 is:
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
\operatorname { A c c u r a c y } ( N ) \approx p _ { N } ( { \mathrm { s i n g l e ~ t o k e n ~ c o r r e c t } } ) ^ { \mathrm { n u m . ~ o f ~ t o k e n s } } = \exp { \Big ( } - ( N / c ) ^ { \alpha } { \Big ) } ^ { L }
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
This choice of metric nonlinearly scales performance with increasing token sequence length. When plotting performance on a linear-log plot, one sees a sharp, unpredictable emergent ability on longer sequences (Fig. 2C) that closely matches claimed emergent abilities (inset). What happens if the researcher switches from a nonlinear metric like Accuracy, under which the per-token error rate scales geometrically in target length (App. A.3), to an approximately linear metric like Token Edit Distance, under which the per-token error rate scales quasi-linearly in target length (App. A.2)?
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
{ \mathrm { T o k e n ~ E d i t ~ D i s t a n c e } } ( N ) \approx L \left( 1 - p _ { N } ( { \mathrm { s i n g l e ~ t o k e n ~ c o r r e c t } } ) \right) = L \left( 1 - \exp { \big ( } - ( N / c ) ^ { \alpha } { \big ) } \right)
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
The linear metric reveals smooth, continuous, predictable changes in model performance (Fig. 2E). Similarly, if the researcher uses a discontinuous metric like Multiple Choice Grade, the researcher can find emergent abilities (Fig. 2D), but switching to a continuous metric like Brier Score removes such abilities (Fig. 2F). In summary, sharp and unpredictable changes with increasing scale can be fully explained by three interpretable factors: (1) the researcher choosing a metric that nonlinearly or discontinuously scales the per-token error rate, (2) having insufficient resolution to estimate model performance in the smaller parameter regime, with resolution2 set by 1/test dataset size, and (3) insufficiently sampling the larger parameter regime.
|
| 93 |
+
|
| 94 |
+
# 3 Analyzing InstructGPT/GPT-3’s Emergent Arithmetic Abilities
|
| 95 |
+
|
| 96 |
+
Previous papers prominently claimed the GPT [4, 27] family3 displays emergent abilities at integer arithmetic tasks [9, 33, 38] (Fig. 1A). We chose these tasks as they were prominently presented [4, 9, 33, 38], and we focused on the GPT family due to it being publicly queryable. As explained mathematically and visually in Sec. 2, our alternative explanation makes three predictions:
|
| 97 |
+
|
| 98 |
+

|
| 99 |
+
Figure 3: Claimed emergent abilities evaporate upon changing the metric. Top: When performance is measured by a nonlinear metric (e.g., Accuracy), the InstructGPT/GPT-3 [4, 27] family’s performance appears sharp and unpredictable on longer target lengths. Bottom: When performance is instead measured by a linear metric (e.g., Token Edit Distance), the family exhibits smooth, predictable performance improvements.
|
| 100 |
+
|
| 101 |
+

|
| 102 |
+
Figure 4: Claimed emergent abilities evaporate upon using better statistics. Based on the predictable effect Accuracy has on performance, measuring performance requires high resolution. Generating additional test data increases the resolution and reveals that even on Accuracy, the InstructGPT/GPT-3 family’s [4, 27] performance is above chance and improves in a smooth, continuous, predictable manner that qualitatively matches the mathematical model.
|
| 103 |
+
|
| 104 |
+
1. Changing the metric from a nonlinear or discontinuous metric (Fig. 2CD) to a linear or continuous metric (Fig. 2 EF) should reveal smooth, continuous, predictable performance improvement with model scale.
|
| 105 |
+
2. For nonlinear metrics, increasing the resolution of measured model performance by increasing the test dataset size should reveal smooth, continuous, predictable model improvements commensurate with the predictable nonlinear effect of the chosen metric.
|
| 106 |
+
3. Regardless of metric, increasing the target string length should predictably affect the model’s performance as a function of the length-1 target performance: approximately geometrically for accuracy and approximately quasilinearly for token edit distance.
|
| 107 |
+
|
| 108 |
+
To test these predictions, we collected outputs from the InstructGPT/GPT-3 family on two tasks: 2-shot multiplication between two 2-digit integers and 2-shot addition between two 4-digit integers.
|
| 109 |
+
|
| 110 |
+
Prediction: Emergent Abilities Disappear With Different Metrics On both arithmetic tasks, the GPT family displays emergent abilities if the target has 4 or 5 digits and if the metric is Accuracy (Fig. 3, top) [4, 9, 38]. However, if one changes from nonlinear Accuracy to linear Token Edit Distance while keeping the models’ outputs fixed, the family’s performance smoothly, continuously and predictably improves with increasing scale (Fig. 3, bottom). This confirms our first prediction and supports our alternative explanation that the observation of emergent abilities can be explained by the researcher’s choice of metric, not changes in the model family’s outputs. We also observe that under Token Edit Distance, increasing the length of the target string from 1 to 5 predictably decreases the family’s performance in an approximately quasilinear manner, confirming the first half of our third prediction.
|
| 111 |
+
|
| 112 |
+
Prediction: Emergent Abilities Disappear With Better Statistics We next tested our second prediction: that even on nonlinear metrics such as accuracy, smaller models do not have zero accuracy, but rather have non-zero above-chance accuracy commensurate with choosing to use accuracy as the metric. In order to accurately measure models’ accuracy, we increased the resolution by generating additional test data, and found that on both arithmetic tasks, all models in the InstructGPT/GPT-3 family achieve above-chance accuracy (Fig. 4). This confirms our second prediction. We also observe that as the target string length increases, the accuracy falls approximately geometrically with the length of the target string, confirming the second half of our third prediction. These results additionally demonstrate that the researcher’s choice of metric has the effect that one should predict accuracy to have, i.e., geometric decay with the target length.
|
| 113 |
+
|
| 114 |
+
# 4 Meta-Analysis of Claimed Emergent Abilities
|
| 115 |
+
|
| 116 |
+
Analyzing the GPT family is possible because the models are publicly queryable. However, at the time of this analysis, other model families claimed to exhibit emergent abilities are not publicly queryable, nor are their generated outputs publicly available, meaning we are limited to analyzing the published results themselves [9, 38, 37]. Our alternative explanation makes two predictions.
|
| 117 |
+
|
| 118 |
+
1. At the “population level" of Task-Metric-Model Family triplets, emergent abilities should appear predominantly on specific metrics, not task-model family pairs, and specifically with nonlinear and/or discontinuous metrics. 2. On individual Task-Metric-Model Family triplets that display an emergent ability, changing the metric to a linear and/or continuous metric should remove the emergent ability.
|
| 119 |
+
|
| 120 |
+
To test these predictions, we used claimed emergent abilities on BIG-Bench [33, 38] due to the benchmark being pertinent and publicly available.
|
| 121 |
+
|
| 122 |
+
Prediction: Emergent Abilities Should Appear with Metrics, not Task-Model Families If emergent abilities are real, one should expect task-model family pairs to show emergence for all reasonable metrics. However, if our alternative explanation is correct, we should expect emergent abilities to appear only under certain metrics. To test this, we analyzed on which metrics emergent abilities appear. To determine whether a task-metric-model family triplet exhibits a possible emergent ability, we used a metric from previous work [33]. Letting $y _ { i } \in \mathbb { R }$ denote model performance at model scales $x _ { i } \in \mathbb { R }$ , sorted such that $x _ { i } < x _ { i + 1 }$ , the emergence score is:
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
{ \begin{array} { r l r l } { \cdot { \operatorname { S c o r e } } { \Big ( } { \Big \{ } ( x _ { n } , y _ { n } ) { \Big \} } _ { n = 1 } ^ { N } { \Big ) } } & { } & { { \stackrel { \mathrm { d e f } } { = } } } & { { \frac { \operatorname { s i g n } ( \operatorname { a r g m a x } _ { i } y _ { i } - \operatorname { a r g m i n } _ { i } y _ { i } ) ( \operatorname* { m a x } _ { i } y _ { i } - \operatorname* { m i n } _ { i } y _ { i } ) } { \sqrt { { \mathsf { M e d i a n } } ( \{ ( y _ { i } - y _ { i - 1 } ) ^ { 2 } \} _ { i } ) } } } } \end{array} }
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
We found that most metrics used in BIG-Bench have zero task-model family pairs that exhibit emergent abilities: of the 39 preferred metrics in BIG-Bench, at most 5 display emergence (Fig. 5A). Many of the 5 are nonlinear and/or discontinuous, e.g., Exact String Match, Multiple Choice Grade, ROUGE-L-Sum (App. A.4). Notably, because BIG-Bench often scores models on tasks using multiple metrics, the lack of emergent abilities under other metrics suggests that emergent abilities do not appear when model outputs are scored using other metrics.
|
| 129 |
+
|
| 130 |
+

|
| 131 |
+
Figure 5: Emergent abilities appear only for specific metrics, not task-model families. (A) Possible emergent abilities appear with at most 5 out of 39 BIG-Bench metrics. (B) Hand-annotated data by [37] reveal emergent abilities appear only under 4 preferred metrics. $\mathrm { ( C ) > 9 2 \% }$ of emergent abilities appear under one of two metrics: Multiple Choice Grade and Exact String Match.
|
| 132 |
+
|
| 133 |
+
Because emergence score only suggests emergence, we also analyzed hand-annotated task-metricmodel family triplets [37], which revealed emergent abilities appear with $4 / 3 9$ metrics (Fig. 5B), and 2 metrics account for $> 9 2 \%$ of claimed emergent abilities (Fig. 5C): Multiple Choice Grade and Exact String Match. Multiple Choice Grade is discontinuous, and Exact String Match is nonlinear.
|
| 134 |
+
|
| 135 |
+
Prediction: Changing Metric Removes Emergent Abilities To test our second prediction, we focused on the LaMDA family [35] because its outputs are available through BIG-Bench. We identified tasks on which LaMDA displays emergent abilities with Multiple Choice Grade, then asked whether LaMDA still displays emergent abilities on the same tasks with a different BIG-Bench metric: Brier Score [3]. Brier Score is a strictly proper scoring rule for predictions of mutually exclusive outcomes; for a binary outcome, the Brier Score simplifies to the squared error between 1 and the model’s probability mass on the outcome. LaMDA’s emergent abilities on the discontinuous Multiple Choice Grade disappeared when we changed the metric to the continuous Brier Score (Fig. 6). These results support our alternative explanation that emergent abilities are induced by the chosen metric.
|
| 136 |
+
|
| 137 |
+

|
| 138 |
+
Figure 6: Changing the metric when evaluating task-model family pairs causes emergent abilities to disappear. Top: The LaMDA model family displays emergent abilities when measured under the discontinuous Multiple Choice Grade. Bottom: The LaMDA model family’s emergent abilities disappear when measured under a continuous BIG-Bench metric: Brier Score.
|
| 139 |
+
|
| 140 |
+
# 5 Inducing Emergent Abilities in Networks on Vision Tasks
|
| 141 |
+
|
| 142 |
+
To demonstrate how emergent abilities can be induced by the researcher’s choice of metric, we show how to produce emergent abilities in deep networks of various architectures: fully connected, convolutional, self-attentional. We focus on vision tasks because abrupt transitions in vision models’ capabilities have not been observed to the best of our knowledge; this is one reason why emergence in large language models is considered so interesting. For the convolutional example, see App. B.
|
| 143 |
+
|
| 144 |
+
Emergent Reconstruction of CIFAR100 Natural Images by Nonlinear Autoencoders We first induce an emergent ability to reconstruct images in shallow (i.e., single hidden layer) nonlinear autoencoders trained on CIFAR100 natural images [21]. To emphasize that the sharpness of the metric is responsible for emergent abilities, and to show that sharpness extends to metrics beyond Accuracy, we intentionally define a discontinuous metric that measures a network’s ability to reconstruct a dataset as the average number of test data with squared reconstruction error below cutoff $c$ :
|
| 145 |
+
|
| 146 |
+
$$
|
| 147 |
+
\mathrm { R e c o n s t r u c t i o n } _ { c } \Big ( \{ x _ { n } \} _ { n = 1 } ^ { N } \Big ) \stackrel { \mathrm { \scriptsize ~ d e f } } { = } \frac { 1 } { N } \sum _ { n } \mathbb { I } \Big [ | | x _ { n } - \hat { x } _ { n } | | ^ { 2 } < c \Big ] ,
|
| 148 |
+
$$
|
| 149 |
+
|
| 150 |
+
where $\mathbb { I } ( \cdot )$ denotes an indicator variable and ${ \hat { x } } _ { n }$ is the autoencoder’s reconstruction of $x _ { n }$ . The autoencoder family displays smoothly decreasing squared reconstruction error as the number of bottleneck units increases (Fig. 7B). Under our newly defined Reconstructionc metric and for particular choices of $c$ , the autoencoder family exhibits a sharp and seemingly unpredictable image reconstruction ability (Fig. 7C) that qualitatively matches published emergent abilities (Fig. 7A).
|
| 151 |
+
|
| 152 |
+
Emergent Classification of Omniglot Characters by Autoregressive Transformers We next induce emergent abilities in Transformers [36] trained to autoregressively classify Omniglot handwritten characters [22], in a setup inspired by recent work [6]: Omniglot images are embedded by convolutional layers, then sequences of embedded image-image class label pairs are fed into decoder-only transformers. We measure image classification performance on sequences of length $L \in [ 1 , 5 ]$ , again via subset accuracy: 1 if all $L$ images are classified correctly (Fig. 8B), 0 otherwise. Causal transformers display a seemingly emergent ability to correctly classify Omniglot handwritten characters (Fig. 8C) that qualitatively matches published emergent abilities (Fig. 8A).
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
Figure 7: Induced emergent reconstruction ability in shallow nonlinear autoencoders. (A) A published emergent ability at the BIG-Bench Periodic Elements task [33]. (B) Shallow nonlinear autoencoders trained on CIFAR100 [21] display smoothly decreasing mean squared reconstruction error. (C) Using a newly defined Reconstructionc metric (Eqn. 1) induces an unpredictable change.
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
Figure 8: Induced emergent classification ability in autoregressive Transformers. (A) A published emergent ability on the MMLU benchmark [9]. (B) Autoregressive transformers trained to classify Omniglot images display increasing accuracy with increasing scale. (C) When accuracy is redefined as classifying all images correctly, a seemingly emergent ability appears.
|
| 159 |
+
|
| 160 |
+
# 6 Limitations
|
| 161 |
+
|
| 162 |
+
This paper has several limitations. First, nothing in this paper should be interpreted as claiming that large language models cannot display emergent abilities; rather, our message is that some previously claimed emergent abilities appear to be mirages induced by researcher analyses. Second, our experiments and analyses are limited because some LLMs with claimed emergent abilities (e.g., PaLM 1, Gopher, Chinchilla) are private and not queryable at the time of our analysis. Lastly, the best metric(s) arguably depends on human preferences, which may exhibit qualitatively different behavior; we are unaware of studies quantifying whether human judgment is thresholded in an “emergent" way.
|
| 163 |
+
|
| 164 |
+
# 7 Related Work
|
| 165 |
+
|
| 166 |
+
Srivastava et al. [33] observed that while accuracy at a particular task can empirically appear sharp and unpredictable, cross-entropy does not appear so; the authors then discussed whether emergent abilities may be partially attributed to the metric. Our paper converts their discussion into precise predictions, then quantitatively tests the predictions to reveal metric choice is possibly responsible for some claimed emergent abilities; well-known and widely-used metrics (including metrics used by [33]) capture graded improvements; emergent abilities do not appear only on tasks involving multiple steps, such as the discontinuous Multiple Choice Grade; metric choice can be used to induce emergent abilities in a novel domain (vision) in diverse architectures and tasks.
|
| 167 |
+
|
| 168 |
+
Alternative explanations exist for the origin of emergent abilities. Caballero et al. [5] explain emergence by assuming a piece-wise power law functional form; under this view, emergent abilities are real, caused by a “break" (or possibly multiple breaks) in the governing power law. In contrast, our work suggests that emergent abilities can be induced by the researcher under a single power law. Both explanations could be true: some emergent abilities might genuinely be abruptly appearing, whereas some emergent abilities might be attributable to the metric. Michaud et al. [28] posits that language modeling data might be comprised of discrete subtasks (“quanta”) that networks learn; if larger networks have greater capacity, and are thus more capable of learning more of these quanta, then if some downstream task requires a network to learn some combination of quanta, larger networks are more likely to have all the requisite capabilities and thus are capable of performing this downstream task. We think that this is a very interesting hypothesis. Whether language modeling data can or should be understood from this quantization perspective, and whether these quanta indeed are the origin of emergent abilities, are really exciting questions that we think merit more study.
|
| 169 |
+
|
| 170 |
+
# 8 Discussion
|
| 171 |
+
|
| 172 |
+
Our paper presents an alternative explanation for the claimed emergent abilities of large language models. For a fixed task and a fixed model family, the researcher can choose a metric to create an emergent ability or choose a metric to ablate an emergent ability. Ergo, emergent abilities may be creations of the researcher’s choices, not a fundamental property of the model family on the specific task.
|
| 173 |
+
|
| 174 |
+
Our work has several implications. Firstly, a task and a metric are distinct and meaningful choices when constructing a benchmark. Secondly, when choosing metric(s), if the goal is to accurately predict scaling behavior, then one should consider the interplay between cross-entropy, transformations, and resolution-limited evaluations so that one isn’t surprised. As a corollary, continuous/linear metrics are probably better for accurate scaling forecasts, but if discontinuous/nonlinear metrics are preferred, then one may need a lot of data for sufficient resolution to accurately measure performance. The key is thinking through the consequences of one’s choices! Thirdly, when making claims about capabilities of large models, including proper controls is critical. In this particular setting, emergent abilities claims are possibly infected by a failure to control for multiple comparisons. In BIG-Bench alone, there are $\geq 2 2 0$ tasks, $\sim 4 0$ metrics per task, $\sim 1 0$ model families, for a total of $\sim 1 0 ^ { 6 }$ taskmetric-model family triplets, meaning the probability that no task-metric-model family triplet exhibits an emergent ability by random chance might be small. Fourthly, scientific progress can be hampered when models and their outputs are not made available for independent scientific investigation.
|
| 175 |
+
|
| 176 |
+
# 9 Contributions
|
| 177 |
+
|
| 178 |
+
RS conceived of the research direction collected data, ran experiments, and analyzed results. SK supervised and guided the project. BM also provided guidance. All authors helped write the manuscript.
|
| 179 |
+
|
| 180 |
+
# 10 Acknowledgements
|
| 181 |
+
|
| 182 |
+
This work is partially supported by the National Science Foundation under grants No. 2046795, 1934986, 2205329, NIH 1R01MH116226-01A, NIFA award 2020-67021-32799, the Alfred P. Sloan Foundation, and Google Inc. RS is partially supported by a Stanford Data Science Scholarship and BM is partially supported by a Stanford School of Engineering Fellowship and a Stanford EDGE Scholar Fellowship. We thank our colleagues Professor Tatsunori Hashimoto, Eric Han, Max Lamparth, Mikail Khona, Kateryna Pistunova, Victor Lecomte, and Zane Durante for discussing our findings with us and providing much-appreciated feedback.
|
| 183 |
+
|
| 184 |
+
References
|
| 185 |
+
[1] Philip W Anderson. More is different: broken symmetry and the nature of the hierarchical structure of science. Science, 177(4047):393–396, 1972.
|
| 186 |
+
[2] Boaz Barak, Benjamin Edelman, Surbhi Goel, Sham Kakade, Eran Malach, and Cyril Zhang. Hidden progress in deep learning: Sgd learns parities near the computational limit. Advances in Neural Information Processing Systems, 35:21750–21764, 2022.
|
| 187 |
+
[3] Glenn W Brier et al. Verification of forecasts expressed in terms of probability. Monthly weather review, 78(1):1–3, 1950.
|
| 188 |
+
[4] 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.
|
| 189 |
+
[5] Ethan Caballero, Kshitij Gupta, Irina Rish, and David Krueger. Broken neural scaling laws. arXiv preprint arXiv:2210.14891, 2022.
|
| 190 |
+
[6] Stephanie CY Chan, Adam Santoro, Andrew Kyle Lampinen, Jane X Wang, Aaditya K Singh, Pierre Harvey Richemond, James McClelland, and Felix Hill. Data distributional properties drive emergent in-context learning in transformers. In Advances in Neural Information Processing Systems, 2022.
|
| 191 |
+
[7] 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.
|
| 192 |
+
[8] 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. In International Conference on Machine Learning, pages 4057–4086. PMLR, 2022.
|
| 193 |
+
[9] Deep Ganguli, Danny Hernandez, Liane Lovitt, Amanda Askell, Yuntao Bai, Anna Chen, Tom Conerly, Nova Dassarma, Dawn Drain, Nelson Elhage, et al. Predictability and surprise in large generative models. In 2022 ACM Conference on Fairness, Accountability, and Transparency, pages 1747–1764, 2022.
|
| 194 |
+
[10] Mitchell A Gordon, Kevin Duh, and Jared Kaplan. Data and parameter scaling laws for neural machine translation. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 5915–5922, 2021.
|
| 195 |
+
[11] Andrey Gromov. Grokking modular arithmetic. arXiv preprint arXiv:2301.02679, 2023.
|
| 196 |
+
[12] Dan Hendrycks. Detecting emergent behavior. 2022.
|
| 197 |
+
[13] 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.
|
| 198 |
+
[14] Danny Hernandez, Jared Kaplan, Tom Henighan, and Sam McCandlish. Scaling laws for transfer. arXiv preprint arXiv:2102.01293, 2021.
|
| 199 |
+
[15] Joel Hestness, Sharan Narang, Newsha Ardalani, Gregory Diamos, Heewoo Jun, Hassan Kianinejad, Md Patwary, Mostofa Ali, Yang Yang, and Yanqi Zhou. Deep learning scaling is predictable, empirically. arXiv preprint arXiv:1712.00409, 2017.
|
| 200 |
+
[16] 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 compute-optimal large language models. arXiv preprint arXiv:2203.15556, 2022.
|
| 201 |
+
[17] Andy L Jones. Scaling scaling laws with board games. arXiv preprint arXiv:2104.03113, 2021.
|
| 202 |
+
|
| 203 |
+
[18] 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.
|
| 204 |
+
|
| 205 |
+
[19] Victoria Krakovna, Vikrant Varma, Ramana Kumar, and Mary Phuong. Refining the sharp left turn threat model, part 1: claims and mechanisms. 2022.
|
| 206 |
+
|
| 207 |
+
[20] Victoria Krakovna, Vikrant Varma, Ramana Kumar, and Mary Phuong. Refining the sharp left turn threat model, part 2: applying alignment techniques. 2022.
|
| 208 |
+
|
| 209 |
+
[21] Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
|
| 210 |
+
|
| 211 |
+
[22] Brenden M Lake, Ruslan Salakhutdinov, and Joshua B Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015.
|
| 212 |
+
|
| 213 |
+
[23] Yann LeCun. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/, 1998.
|
| 214 |
+
|
| 215 |
+
[24] 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.
|
| 216 |
+
|
| 217 |
+
[25] Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. In Text summarization branches out, pages 74–81, 2004.
|
| 218 |
+
|
| 219 |
+
[26] Ziming Liu, Eric J Michaud, and Max Tegmark. Omnigrok: Grokking beyond algorithmic data. arXiv preprint arXiv:2210.01117, 2022.
|
| 220 |
+
|
| 221 |
+
[27] Ryan Lowe and Jan Leike. Aligning language models to follow instructions. 2022.
|
| 222 |
+
|
| 223 |
+
[28] Eric J. Michaud, Ziming Liu, Uzay Girit, and Max Tegmark. The quantization model of neural scaling, 2023.
|
| 224 |
+
|
| 225 |
+
[29] Oren Neumann and Claudius Gros. Scaling laws for a multi-agent reinforcement learning model. arXiv preprint arXiv:2210.00849, 2022.
|
| 226 |
+
|
| 227 |
+
[30] 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.
|
| 228 |
+
|
| 229 |
+
[31] Alethea Power, Yuri Burda, Harri Edwards, Igor Babuschkin, and Vedant Misra. Grokking: Generalization beyond overfitting on small algorithmic datasets. arXiv preprint arXiv:2201.02177, 2022.
|
| 230 |
+
|
| 231 |
+
[32] Jonathan S Rosenfeld, Amir Rosenfeld, Yonatan Belinkov, and Nir Shavit. A constructive prediction of the generalization error across scales. In International Conference on Learning Representations, 2019.
|
| 232 |
+
|
| 233 |
+
[33] 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.
|
| 234 |
+
|
| 235 |
+
[34] Jacob Steinhardt. Future ml systems will be qualitatively different. 2022.
|
| 236 |
+
|
| 237 |
+
[35] Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, HengTze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, et al. Lamda: Language models for dialog applications. arXiv preprint arXiv:2201.08239, 2022.
|
| 238 |
+
|
| 239 |
+
[36] 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.
|
| 240 |
+
|
| 241 |
+
[37] Jason Wei. 137 emergent abilities of large language models. 2022.
|
| 242 |
+
|
| 243 |
+
[38] 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. arXiv preprint arXiv:2206.07682, 2022.
|
| 244 |
+
[39] 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, pages 12104–12113, 2022.
|
| 245 |
+
|
| 246 |
+
# A Approximate Behavior of Metrics on Sequential Data
|
| 247 |
+
|
| 248 |
+
How do different metrics behave when used to measure autoregressive model outputs? Precisely answering this question is tricky and possibly analytically unsolvable, so we provide an approximate answer here.
|
| 249 |
+
|
| 250 |
+
Notationally, we consider $N$ test data of length $L$ (here, length is measured in tokens) with targets denoted $t _ { n } \ { \stackrel { \mathrm { d e f } } { = } } \ ( t _ { n 1 } , t _ { n 2 } , . . . t _ { n L } )$ , the autoregressive model has a true-but-unknown per-token error probability of $\epsilon \in [ 0 , 1 ]$ and the model outputs prediction $\boldsymbol { \hat { t } _ { n } } \ { \stackrel { \mathrm { d e f } } { = } } \ ( { \hat { t } _ { n 1 } } , { \hat { t } _ { n 2 } } , . . . { \hat { t } _ { n L } } )$ . This assumes that the model’s per-token error probability is constant, which is empirically false, but modeling the complex dependencies of errors is beyond our scope.
|
| 251 |
+
|
| 252 |
+
# A.1 Per-Token Error Probability is Resolution-Limited
|
| 253 |
+
|
| 254 |
+
Note that because we have $N$ test data, each of length $L$ , our resolution for viewing the per-token error probability $\epsilon$ is limited by $1 / N L$ . Here, resolution refers to “the smallest interval measurable by a scientific instrument; the resolving power." To explain what resolution means via an example, suppose one wants to measure a coin’s probability of yielding heads. After a single coin flip, only two outcomes are possible (H, T), so the resolution-limited probability of heads is either 0 or 1. After two coin flips, four outcomes are possible (HH, HT, TH, TT), so the resolution-limited probability of heads is now one of $0 , 0 . 5 , 1$ . After $F$ coin flips, we can only resolve the coin’s probability of yielding heads up to $1 / F$ . Consequently, we introduce a resolution-limited notation:
|
| 255 |
+
|
| 256 |
+
$a _ { b } \ { \stackrel { \mathrm { d e f } } { = } } \ a$ rounded to the nearest integer multiple of $1 / b$
|
| 257 |
+
|
| 258 |
+
# A.2 Token Edit Distance
|
| 259 |
+
|
| 260 |
+
We first consider an adaptation of the Levenshtein (string edit) distance for models that function on tokens rather than characters, an adaptation we term the token edit distance. The token edit distance between two token sequences $t _ { n } , \hat { t _ { n } }$ is defined as the integer number of additions, deletions or substitutions necessary to transform $t _ { n }$ into $\hat { t } _ { n }$ (or vice versa).
|
| 261 |
+
|
| 262 |
+
$$
|
| 263 |
+
\begin{array} { l } { \mathrm { T o k e n ~ E d i t ~ D i s t a n c e } ( t _ { n } , \hat { t } _ { n } ) \overset { \mathrm { d e f } } { = } \mathrm { N u m ~ S u b s t i u t i o n s } + \mathrm { N u m . ~ A d d i t i o n s } + \mathrm { N u m . ~ D e l e t i o n s } } \\ { \displaystyle = \sum _ { \ell = 1 } ^ { L } \mathbb { I } [ t _ { n \ell } \neq \hat { t } _ { n \ell } ] + \mathrm { N u m . ~ A d d i t i o n s } + \mathrm { N u m . ~ D e l e t i o n s } } \\ { \displaystyle \quad \geq \sum _ { \ell = 1 } ^ { L } \mathbb { I } [ t _ { n \ell } \neq \hat { t } _ { n \ell } ] } \end{array}
|
| 264 |
+
$$
|
| 265 |
+
|
| 266 |
+
The expected token edit distance is therefore:
|
| 267 |
+
|
| 268 |
+
$$
|
| 269 |
+
\begin{array} { l } { \displaystyle \mathbb { E } [ \mathrm { T o k e n ~ E d i t ~ D i s t a n c e } ( t _ { n } , \hat { t } _ { n } ) ] \geq \mathbb { E } [ \sum _ { \ell = 1 } ^ { L } \mathbb { I } [ t _ { n \ell } \neq \hat { t } _ { n \ell } ] ] } \\ { \displaystyle = \sum _ { \ell = 1 } ^ { L } p ( t _ { n \ell } \neq \hat { t } _ { n \ell } ) } \\ { \approx L ( 1 - \epsilon ) } \end{array}
|
| 270 |
+
$$
|
| 271 |
+
|
| 272 |
+
The resolution-limited expected token edit distance is therefore:
|
| 273 |
+
|
| 274 |
+
$$
|
| 275 |
+
\mathbb { E } [ \mathrm { T o k e n ~ E d i t ~ D i s t a n c e } ( t _ { n } , \hat { t } _ { n } ) ] _ { N L } \ge L \Big ( 1 - \epsilon _ { N L } \Big )
|
| 276 |
+
$$
|
| 277 |
+
|
| 278 |
+
From this, we see that the expected token edit distance scales approximately linearly with the resolution-limited per-token probability. The real rate is slightly higher than linear because additions
|
| 279 |
+
|
| 280 |
+
and deletions contribute an additional non-negative cost, but modeling this requires a model of how likely the model is to overproduce or underproduce tokens, which is something we do not currently possess.
|
| 281 |
+
|
| 282 |
+
# A.3 Accuracy
|
| 283 |
+
|
| 284 |
+
$$
|
| 285 |
+
\begin{array} { l } { \displaystyle \mathrm { A c c u r a c y } ( t _ { n } , \hat { t } _ { n } ) \stackrel { \mathrm { d e f } } { = } \mathbb { I } [ \mathrm { N o \ a d d i t i o n s } ] \mathbb { I } [ \mathrm { N o \ d e l e t i o n s } ] \prod _ { l = 1 } ^ { L } \mathbb { I } [ t _ { n l } = \hat { t } _ { n l } ] } \\ { \displaystyle \approx \prod _ { l = 1 } ^ { L } \mathbb { I } [ t _ { n l } = \hat { t } _ { n l } ] } \end{array}
|
| 286 |
+
$$
|
| 287 |
+
|
| 288 |
+
As with the Token Edit Distance (App. A.2), we ignore how likely the language model is to overproduce or underproduce tokens because we do not have a good model of this process. Continuing along,
|
| 289 |
+
|
| 290 |
+
$$
|
| 291 |
+
\begin{array} { l } { \displaystyle \mathbb { E } [ \log \mathrm { A c c u r a c y } ] = \sum _ { l } \mathbb { E } [ \log \mathbb { I } [ t _ { n l } = \hat { t } _ { n l } ] ] } \\ { \displaystyle \qquad \leq \sum _ { l } \log \mathbb { E } [ \mathbb { I } [ t _ { n l } = \hat { t } _ { n l } ] ] } \\ { \displaystyle \qquad \approx L \log ( 1 - \epsilon ) } \end{array}
|
| 292 |
+
$$
|
| 293 |
+
|
| 294 |
+
Taking an approximation that would make most mathematicians cry:
|
| 295 |
+
|
| 296 |
+
$$
|
| 297 |
+
\begin{array} { r } { \mathbb { E } [ \mathrm { A c c u r a c y } ] \approx \exp ( \mathbb { E } [ \mathrm { l o g } \mathrm { A c c u r a c y } ] ) } \\ { = ( 1 - \epsilon ) ^ { L } } \end{array}
|
| 298 |
+
$$
|
| 299 |
+
|
| 300 |
+
This reveals that accuracy approximately falls geometrically with target token length. The resolutionlimited expected accuracy is therefore:
|
| 301 |
+
|
| 302 |
+
$$
|
| 303 |
+
\mathbb { E } [ \mathrm { A c c u r a c y } ] _ { N L } = ( 1 - \epsilon ) ^ { L } { } _ { N L }
|
| 304 |
+
$$
|
| 305 |
+
|
| 306 |
+
From this we can see that choosing a nonlinear metric like Accuracy is affected significantly more than a linear metric by limited resolution because Accuracy forces one to distinguish quantities that decay rapidly.
|
| 307 |
+
|
| 308 |
+
# A.4 ROUGE-L-Sum
|
| 309 |
+
|
| 310 |
+
Another BIG-Bench metric [33] is ROUGE-L-Sum [25], a metric based on the longest common subsequence (LCS) between two sequences. Section 3.2 of [25] gives the exact definition, but the key property is that ROUGE-L-Sum measures the “union" LCS, which means “stitching" together LCSs across the candidate and multiple references. As explained in the original paper [25]: if the candidate sequence is $c = w _ { 1 } w _ { 2 } w _ { 3 } w _ { 4 } w _ { 5 }$ , and if there are two reference sequences $r _ { 1 } = w _ { 1 } w _ { 2 } w _ { 6 } w _ { 7 } w _ { 8 }$ and $r _ { 2 } = w _ { 1 } w _ { 3 } w _ { 8 } w _ { 9 } w _ { 5 }$ , then $L C S ( r _ { 1 } , c ) = w _ { 1 } w _ { 2 }$ and $L C S ( r _ { 2 } , c ) = \overline { { w _ { 1 } w _ { 3 } w _ { 5 } } }$ , then the union LCS of $c , r _ { 1 } , r _ { 2 }$ is $w _ { 1 } w _ { 2 } w _ { 3 } w _ { 5 }$ , with length 4. Intuitively, this disproportionately benefits models with smaller error rates because their mistakes can be “stitched" across multiple references; this is confirmed in Monte Carlo simulation (Fig. 9).
|
| 311 |
+
|
| 312 |
+
# A.5 BLEU
|
| 313 |
+
|
| 314 |
+
Yet another BIG-Bench metric [33] is BLEU [30], a metric based on shared $\mathbf { n }$ -grams between the generated string and reference strings. BLEU is also a discontinuous and nonlinear metric for several reasons. For an explanation of its discontinuity, consider bleu.compute(predictions $=$ ["hello there general"], references=[["hello there general"]]). At first glance, this might seem like it should also result in a BLEU score of 1.0 since the prediction matches the reference. However, the issue here is the absence of longer n-grams. For the unigrams, bigrams, and trigrams, the precision is 1.0 since they match perfectly. However, for the 4-grams, there are none in both the candidate and the reference. This results in a precision of 0 for the 4-grams because the BLEU score takes the geometric mean of the n-gram precisions, meaning any 0 in the set will make the entire product 0. Hence, despite the match in unigrams, bigrams, and trigrams, the absence of 4-grams results in a BLEU score of 0.0. This behavior of BLEU has been a point of criticism, as short sentences or those with fewer n-grams than the maximum considered (often 4) can yield scores that are counter-intuitive. This is confirmed in Monte Carlo simulations (Fig. 10)
|
| 315 |
+
|
| 316 |
+

|
| 317 |
+
Figure 9: ROUGE-L-Sum is a sharp metric. Simulations show that as the per-token error probability slightly increases (e.g. from 0.05 to 0.1), the ROUGE-L-Sum metric falls sharply.
|
| 318 |
+
|
| 319 |
+

|
| 320 |
+
Figure 10: BLEU is a sharp metric. Simulations show that as the per-token error probability slightly increases (e.g. from 0.05 to 0.1), the ROUGE-L-Sum metric falls sharply.
|
| 321 |
+
|
| 322 |
+
# B Inducing Emergent Abilities in Networks on Vision Tasks
|
| 323 |
+
|
| 324 |
+
# B.1 Emergent Classification of MNIST Handwritten Digits by Convolutional Networks
|
| 325 |
+
|
| 326 |
+
We begin by inducing an emergent classification ability in a LeNet convolutional neural network family [24], trained on the MNIST handwritten digits dataset [23]. This family displays smoothly increasing test accuracy as the number of parameters increases (Fig. 11B). To emulate the accuracy metric used by emergence papers [9, 38, 33], we use subset accuracy: 1 if the network classifies $K$ out of $K$ (independent) test data correctly, 0 otherwise. Under this definition of accuracy, the model family displays an “emergent" ability to correctly classify sets of MNIST digits as $K$ increases from 1 to 5, especially when combined with sparse sampling of model sizes (Fig. 11C). This convolutional family’s emergent classification ability qualitatively matches published emergent abilities, e.g., at the BIG-Bench Grounded Mappings task [38] (Fig. 11A).
|
| 327 |
+
|
| 328 |
+

|
| 329 |
+
Figure 11: Induced emergent MNIST classification ability in convolutional networks. (A) A published emergent ability from the BIG-Bench Grounded Mappings task [38]. (B) LeNet trained on MNIST [23] displays a predictable, commonplace sigmoidal increase in test accuracy as model parameters increase. (C) When accuracy is redefined as correctly classifying $K$ out of $K$ independent test data, this newly defined metric induces a seemingly unpredictable change.
|
| 330 |
+
|
| 331 |
+
# C Relationship Between Emergent Abilities and Grokking
|
| 332 |
+
|
| 333 |
+
Emergent abilities [4, 9, 33, 38] are sometimes compared with grokking [31, 26, 2, 11], a phenomenon whereby a single model will, over the course of learning, achieve high training accuracy and only much later achieve high test accuracy. There are several differences between grokking and emergent abilities:
|
| 334 |
+
|
| 335 |
+
1. Grokking is primarily studied within a single model, whereas emergent abilities are studied within a model family (i.e., multiple models).
|
| 336 |
+
2. Grokking occurs with increasing gradient steps, whereas emergent abilities occur with increasing model scale, typically measured in parameters or effective parameters (although more recently compute).
|
| 337 |
+
3. Grokking explicitly studies a discrepancy between the model’s train and test behavior, whereas emergent abilities (to the best of our knowledge) do not present separate train & test curves.
|
| 338 |
+
4. Grokking is primarily studied on toy “algorithmic" tasks in small networks, whereas emergent abilities are often studied on benchmark NLP tasks in large language models.
|
md/dev/JCCi58IUsh/JCCi58IUsh.md
ADDED
|
@@ -0,0 +1,491 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Grounded Decoding: Guiding Text Generation with Grounded Models for Embodied Agents
|
| 2 |
+
|
| 3 |
+
Wenlong Huang1∗, Fei $\mathbf { X i a } ^ { 2 }$ , Dhruv Shah3, Danny Driess2, Andy Zeng2, Yao $\mathbf { L } \mathbf { u } ^ { 2 }$ , Pete Florence2, Igor Mordatch2, Sergey Levine2,3, Karol Hausman2, Brian Ichter2 1Stanford University, 2Google Deepmind, 3UC Berkeley grounded-decoding.github.io
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Recent progress in large language models (LLMs) has demonstrated the ability to learn and leverage Internet-scale knowledge through pre-training with autoregressive models. Unfortunately, applying such models to settings with embodied agents, such as robots, is challenging due to their lack of experience with the physical world, inability to parse non-language observations, and ignorance of rewards or safety constraints that robots may require. On the other hand, languageconditioned robotic policies that learn from interaction data can provide the necessary grounding that allows the agent to be correctly situated in the real world, but such policies are limited by the lack of high-level semantic understanding due to the limited breadth of the interaction data available for training them. Thus, if we want to make use of the semantic knowledge in a language model while still situating it in an embodied setting, we must construct an action sequence that is both likely according to the language model and also realizable according to grounded models of the environment. We frame this as a problem similar to probabilistic filtering: decode a sequence that both has high probability under the language model and high probability under a set of grounded model objectives. We demonstrate how such grounded models can be obtained across three simulation and real-world domains, and that the proposed decoding strategy is able to solve complex, long-horizon embodiment tasks in a robotic setting by leveraging the knowledge of both models.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Recent works have demonstrated robots that are increasingly proficient at understanding and acting upon natural language, whether through planning or conditioned policies. Complementing such progress, the field of natural language processing has recently seen large language models (LLMs) become ubiquitously used as pre-trained or few-shot prompted models, due to their impressive fewshot performance and vast knowledge-base. These LLMs have efficiently learned from web-scale data through autoregressively modeling the probability distribution over text tokens and thus generate text. However, the nature of this process is such that applying such models to embodied settings remains a challenge. They have not interacted with their environment, lack observability of nonlanguage observation modalities (e.g., images), and may not know what is safe or possible for a particular embodiment.
|
| 12 |
+
|
| 13 |
+
Determining how to execute long-horizon behaviors based on high-level verbal commands is one particular area of robotics where the rich semantic knowledge in large language models can be especially useful. This problem combines elements of semantic reasoning and planning: the robot must understand the instruction, determine the steps needed to fulfill it, and also determine how to sequence those steps appropriately given its capabilities and the current state of the environment. However, this is not a problem that can be solved purely with semantics, as it requires sufficient grounding to understand how the task should be performed in context – for example, in the example in Figure 1, the language model alone has no way of knowing which block to pick up because this requires knowledge of which blocks are present, and also what manipulations the robot is capable of performing on them. Thus, although a language model can assign probabilities for how likely various steps are to correspond to the desired task semantically, the constraints of the planning problem must also enter into the process. These constraints could themselves be represented as probabilities that mirror the token probabilities generated by a language model, reflecting their applicability to the current environment rather than their semantic likelihood. We can frame this as a problem similar to probabilistic filtering: decode a sequence (i.e., a task description) that both has a high probability under the language model and a high probability under a grounded model that predicts how applicable this sequence is to the current scene.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Grounded Decoding solves robotic tasks by taking an instruction as input and selecting tokens that have high probability under a Large Language Model (LLM) and a set of Grounded Models (GM). Thus, it leverages the open-vocabulary and semantic knowledge of LLMs while being grounded in the environment and in the robot’s capabilities. Furthermore, the whole process does not require expensive fine-tuning of the LLM.
|
| 17 |
+
|
| 18 |
+
Herein, we present Grounded Decoding (GD), a scalable, general approach to planning with LLMs embodied domains. Grounded Decoding jointly decodes the token probability of an LLM and token probabilities from token-conditioned, robotic functions, such as affordance functions capturing the abilities of a robot given its embodiment, safety functions, or more. By guiding the LLM directly at its output, Grounded Decoding enables a general and flexible family of planning algorithms that combines LLM’s strength of long-horizon and semantic reasoning and grounded models’ strength of local and embodiment grounding.
|
| 19 |
+
|
| 20 |
+
Our contributions are as followed: 1) we present a robot-centric formulation for decoding language models to perform long-horizon robotic tasks with token-conditioned grounded models, 2) we demonstrate techniques for learning such grounded models, serving different purposes such as affordances and safety requirements, and 3) we show empirical evidence, across three simulation and real-world domains, that the proposed method performs strongly on a wide range of tasks while also significantly outperforming prior methods in efficiency.
|
| 21 |
+
|
| 22 |
+
# 2 Related Work
|
| 23 |
+
|
| 24 |
+
Guided Decoding for Language Models. Decoding strategies for large language models is an active area of research within natural language processing [77, 87, 25, 85, 38]. A number of recent works have focused on developing decoding heuristics for natural text generation [49, 35, 48, 18, 25, 6, 36, 63]. Another line of works use external classifiers for maximizing certain language-space utilities when decoding language models [71, 92, 26, 39, 37, 21, 38, 4, 12, 23]. Most closely related to our work are classifier-guided decoding methods developed for offline domains, such as image captioning [78, 74] and task-oriented dialog [72, 83]. However, extensions to embodied domains, which we investigate exclusively in this work, remain non-trivial because grounding in embodied domains is bounded by the abilities of the agent and by environment state transition as the agent actively interacts with the environment.
|
| 25 |
+
|
| 26 |
+

|
| 27 |
+
Figure 2: Overview of Grounded Decoding. Given a free-form language instruction, a language model and grounded models jointly decide the next candidate token to be decoded by combining their respective likelihood. Language model proposes likely tokens that produce goal-directed and coherent long-horizon behaviors, while grounded models connect them to the physical scene, through a flexible composition of multiple objective functions from multiple modalities, such as affordance, preferences, and safety.
|
| 28 |
+
|
| 29 |
+
Embodied and Multimodal Language Models. Training language models to understand embodiment is an active area of research. Training multimodal models can enable some degree of embodied reasoning, such as understanding images and videos [9, 40, 76, 3]. Directly finetuning language models to output actions has also been investigated [75, 55, 66]. Lastly, training downstream models on language model embeddings shows promise [46, 52, 24, 94, 60, 41]. In this work, we investigate leveraging large frozen language models for embodied applications [29, 2, 96, 8, 64, 30, 42, 70, 47, 27, 58, 73, 44, 43, 14, 16, 82, 93, 89, 45, 56], with grounded models to provide domain-specific grounding during decoding process.
|
| 30 |
+
|
| 31 |
+
Comparison to SayCan. The most closely related work to our work is SayCan [2]. SayCan uses a large language model and a value function to select robotic skills among a constrained set of primitives. This constrained set of primitives enables SayCan to use the so-called “scoring-mode” of the LLM to get the probability of a skill being useful to a high-level instruction. This requirement to consider only a fixed and enumerated set of primitives limits the applicability of SayCan in scenarios with many possible skills, such as open vocabulary or combinatorial tasks. Grounded Decoding on the other hand jointly decodes the LLM and the grounded model at the token level, allowing for expressive decoding with an open vocabulary. Furthermore, SayCan considers only grounding functions derived from RL-trained value functions for affordance grounding functions, while Grounded Decoding explores many types of grounding functions to propose a broad family of algorithms.
|
| 32 |
+
|
| 33 |
+
Task and Motion Planning. Task and motion planning [33] seeks to solve high-level instructions via sequencing tasks in dynamically feasible manner. Research within this area generally focuses on symbolic planning [19] or optimization-based [79] approaches. Machine learning has increasingly been used to accelerate planning and enable new domains [91, 61, 69, 20, 17, 28, 90, 31, 1, 65, 51, 86, 88, 15]. However, planning constraints are often explicitly specified for TAMP methods. In contrast, we specify constraints as (learned) probabilities, which are baked into the decoding process and provided by domain-specific grounded models.
|
| 34 |
+
|
| 35 |
+
# 3 Grounded Decoding
|
| 36 |
+
|
| 37 |
+
# 3.1 LLMs and Grounding Models
|
| 38 |
+
|
| 39 |
+
Large Language Models. LLMs are trained to predict the probability $p ( W )$ of a text sequence $W$ , represented as a sequence of tokens $W = w _ { 1 : N } = ( w _ { 1 } , \dotsc , w _ { N } )$ . The tokens are elements of a fixed vocabulary $\mathcal { W }$ . Typical neural architectures factorize the joint probability into $p ( W ) =$ $\begin{array} { r } { \prod _ { n = 1 } ^ { N } p _ { \mathrm { L L M } } ( w _ { n } | w _ { 1 : n - 1 } ) } \end{array}$ , where $p _ { \mathrm { L L M } }$ is predicted by a transformer network [81]. Given $p _ { \mathrm { L L M } }$ , generating a text consisting of $N$ -many tokens, the so-called decoding process, can be seen as the optimization problem arg $\begin{array} { r } { \operatorname* { m a x } _ { w _ { 1 : N } \in \mathcal { W } } \prod _ { n = 1 } ^ { N } p _ { \mathrm { L L M } } ( w _ { n } | w _ { 1 : n - 1 } ) } \end{array}$ , which in practice is solved, e.g., using greedy search , beam search, or sampling strategies. To further ensure the LLM is solving a desired task, one typically starts with a given text, the so-called prefix or prompt, that describes the task, and then the LLM completes this task in its decoding process.
|
| 40 |
+
|
| 41 |
+
Grounding Functions. We use the concept of grounding functions, $p _ { \mathrm { G } } ( w _ { 1 : n } | s )$ , which seek to model a probability of tokens $w _ { 1 : n }$ given (potentially non-textual) state $s \in S$ . This state is intended to capture the embodiment of the robot and the environment, which may be an image, proprioception of the robot, or the environment state. Thus the grounding function models probabilities relevant to the robot embodiment and environment, such as whether the tokens are possible for the robot to execute given the state (affordances), or other values like safety, cost, or user preferences.
|
| 42 |
+
|
| 43 |
+
# 3.2 Problem formulation.
|
| 44 |
+
|
| 45 |
+
Given an instruction in language $\ell$ , we look at the problem of using an LLM to decode a language plan $w _ { 1 : N }$ , which is typically done by finding the most likely tokens under the probability distribution predicted by the LLM, $p _ { \mathrm { L L M } } ( w _ { 1 : N } | \ell )$ , with $\ell$ being the prefix. However, based on the instruction $\ell$ as the prefix alone, the LLM can easily generate text that is not grounded in the physical state of the environment, rendering such plans useless in the real world. In order to ground the language model in an actual physical embodiment, we propose Grounded Decoding (GD): The main idea of GD is to guide the generation of token sequences with grounding function $( s )$ that are conditioned on the embodiment of the system.
|
| 46 |
+
|
| 47 |
+
Formally, let $s \in S$ denote a representation of the state of the world. Then, GD attempts to generate text that is consistent with both the instruction $\ell$ and the physical state $s$ :
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
w _ { 1 : N } ^ { * } = \arg \operatorname* { m a x } _ { w _ { 1 : N } , w _ { n } \in \mathcal { W } } p _ { \mathrm { G D } } ( w _ { 1 : N } | s , \ell )
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
To leverage the Internet-scale knowledge of LLMs, we factorize $p _ { \mathrm { G D } } ( w _ { 1 : N } | s , \ell )$ as follows 2:
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
\begin{array} { r l } { p _ { \mathrm { G i D } } ( w _ { 1 : N } | s , \ell ) = \frac { p ( s , \ell | w _ { 1 : N } ) p ( w _ { 1 : N } ) } { p ( s , \ell ) } } & { } \\ { = \frac { p ( s | w _ { 1 : N } ) p ( \ell | w _ { 1 : N } ) p ( w _ { 1 : N } ) } { p ( s , \ell ) } } & { } \\ { = \frac { p ( w _ { 1 : N } | \ell ) p ( \ell ) p ( w _ { 1 : N } | s ) p ( s ) p ( w _ { 1 : N } ) } { p ( s , \ell ) p ( w _ { 1 : N } ) p ( w _ { 1 : N } ) } } & { } \\ { \propto \frac { p ( w _ { 1 : N } | \ell ) } { p ( w _ { 1 : N } ) } p ( w _ { 1 : N } ) } & { } \\ { \propto \frac { p ( w _ { 1 : N } | \ell ) } { p ( w _ { 1 : N } ) } p ( w _ { 1 : N } | s ) } & { } \\ { \propto p ( w _ { 1 : N } | \ell ) p ( w _ { 1 : N } | s ) . } & { } \end{array}
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
To decode autoregressively with the formulation, we factorize above into token decoding:
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
\begin{array} { r } { p _ { \mathrm { G D } } ( w _ { 1 : N } | s , \ell ) \propto \displaystyle \prod _ { n = 1 } ^ { N } p _ { \mathrm { L L M } } ( w _ { n } | w _ { 1 : n - 1 } , \ell ) p _ { \mathrm { G } } ( w _ { 1 : n } | s ) . } \end{array}
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
The first term, $p _ { \mathrm { L L M } } ( w _ { n } | w _ { 1 : n - 1 } , \ell )$ , can be modeled as the probability of the LLM predicting the token for the given instruction $\ell$ appended previously decoded tokens $w _ { 1 : n - 1 }$ without the state $s$ as input. The second term, $p _ { \mathrm { G } } ( w _ { 1 : n } | s )$ , is the grounding function that is only conditioned on the state $s$ and judges whether the generated text $w _ { 1 : n }$ is consistent with the physical state. The core idea behind this factorization is that LLMs exhibit long-term planning capabilities, while the grounding function guides the planning of the LLM to be possible in the concrete embodied physical world without needing to be informed or capable of reasoning over the long-horizon instruction.
|
| 66 |
+
|
| 67 |
+
# 3.3 Grounded Decoding
|
| 68 |
+
|
| 69 |
+
This work investigates grounded decoding exclusively in the context of task planning for embodied agents. Figure 2 visualizes a single step of the simplest greedy search form of GD, and accompanying pseudo-code can be found in Algorithm 1. Given a high-level language instruction and history of executed actions, GD proceeds through a process similar to probabilistic filtering by selecting tokens iteratively that have high probability under the language model and the grounded model. After each token is selected, it is appended to the prefix. The process continues until a token in the terminal set ${ \mathcal { W } } _ { \mathrm { t e r m } }$ is selected, which could be a period sign “.” indicating the end of a single-step skill (e.g., pick-and-place). Then the command $w _ { 1 : i }$ is sent to a language-conditioned policy $\pi ( \boldsymbol { a } | \boldsymbol { s } , \boldsymbol { w } _ { 1 : i } )$ that executes the action $a$ conditioned on the environment state $s$ . Crucially, this grounding function must accept partial commands to enable grounding during decoding.3 Additionally, we note that GD, in its essence, provides a grounded scoring function; thus, it can be easily extended to any search methods such as beam search, top- $\mathbf { \nabla } \cdot \mathbf { k }$ sampling, etc.
|
| 70 |
+
|
| 71 |
+
# Algorithm 1 Grounded Decoding (GD) w/ Greedy Search
|
| 72 |
+
|
| 73 |
+
1: Given: state $s$ , instruction $\ell$ , terminal set ${ \mathcal { W } } _ { \mathrm { t e r m } }$
|
| 74 |
+
2: Initialize: $w = \{ \}$ , $n = 0$
|
| 75 |
+
3: while $w _ { n } \notin \mathcal { W } _ { \mathrm { t e r m } } \mathbf { d o }$
|
| 76 |
+
4: $n = n + 1$
|
| 77 |
+
5: $\begin{array} { r } { \left. w _ { n } = \arg \operatorname* { m a x } _ { w _ { n } \in \mathcal { W } } p _ { \mathrm { L L M } } ( w _ { n } | w _ { 1 : n - 1 } , \ell ) p _ { \mathrm { G } } ( w _ { 1 : n } | s ) \right. } \end{array}$
|
| 78 |
+
6: end while
|
| 79 |
+
7: Return: $w$
|
| 80 |
+
|
| 81 |
+
# 3.4 Techniques for Obtaining Grounded Models
|
| 82 |
+
|
| 83 |
+
Unlike language tasks, where a single model is capable of performing general semantic reasoning, a singular grounded model remains an open problem. Indeed, each domain may impose varied environmental and embodiment constraints. Despite these challenges, we present several techniques for obtaining grounded models that can be leveraged in GD’s formulation, and validate them in three domains in Section 4.
|
| 84 |
+
|
| 85 |
+
Token-Conditioned Value Functions. Assuming a robot acts with action $a$ according to policy $\pi ( \boldsymbol { a } | \boldsymbol { s } , \boldsymbol { w } _ { 1 : n } )$ , that aims to maximize certain a utility and that the utility captures a task objective, a natural choice that can provide “grounding score” is the action-value function $Q ( s , a | w _ { 1 : n } )$ as it necessarily captures the embodiment of the robot. Additional objectives, such as task constraints, can also be encapsulated in $Q ( s , a | w _ { 1 : n } )$ to ensure grounding. Note that unlike the formulation proposed in [2], $w _ { 1 : n }$ cannot be restricted to a fixed repertoire of token sequences. In practice, to obtain a $Q ( s , a | w _ { 1 : n } )$ that satisfies the requirements, one can train multi-task language-conditioned agents, either through reinforcement learning (Section 4.2) or supervised learning (Section 4.1).
|
| 86 |
+
|
| 87 |
+
Multimodal Foundation Models. A general choice to ground LLMs is through using multimodal foundation models, such as CLIP [57] or open-vocabulary object detectors [22, 34, 50]. Although these models can connect language to other grounded modalities (e.g., vision), they often lack the capability for complex or long-horizon reasoning, and they do not consider embodiment constraints. As a result, to leverage them in the decoding process, they need to constrained to where they are the most applicable rather than always decoding jointly. To this end, we use a prompt-based technique that allows LLMs to choose when to jointly decode (Section 4.3), which we find to be effective in most cases.4.
|
| 88 |
+
|
| 89 |
+
Rule-based Methods. Another source of grounding may come from features $x = \phi ( w _ { 1 : n } )$ designed with expert domain knowledge, which can then be used to map $w _ { 1 : n }$ to a “grounding score” using pamametric or non-parametric functions $f ( x )$ . Such techniques may be most applicable when interpretability and enforcing hard constraints are required, such as safety-critical settings, or when data are scarce, such as cases involving preferences of individual users (as shown in Section 4.1).
|
| 90 |
+
|
| 91 |
+
# 3.5 Comparisons to Prompt-based Methods
|
| 92 |
+
|
| 93 |
+
One alternative approach for grounding is including scene information as part of the prompt (e.g., object detection results [96]), which complements the grounding method proposed in this work.
|
| 94 |
+
|
| 95 |
+

|
| 96 |
+
Figure 3: Example rollouts and likelihood of representative tokens under Grounded Decoding objective in three distinct domains: simulated tabletop rearrangement (top), Minigrid 2D Maze (middle), and real-world Language score, grounding score, tokenskitchen mobile manipulation (bottom). Each domain uses different prompts, grounded models, and low-level [(-2.2144471089350395, 13.634880781173706, 'pepsi'), primitives. The GD formulation is shared across the domains, decoding a pre-trained langauge model with (-0.1931666703881, 0.0, 'grapefruit soda'), respect to domain-specific grounded models to decompose a open-ended instruction into actionable steps.
|
| 97 |
+
|
| 98 |
+
However, we note that prompting is often insufficent for grounding, as information about the scene and about the capabilities of the robot may not always be succinctly described in the prompt. Such examples include 1) in a block stacking task, a block that has been stacked on cannot be picked, 2) in a navigation task, to open a door, one must have a key and that door must be reachable, and 3) in a mobile manipulation domain, an object may be visible but is out of reach of the manipulator. Therefore, Grounded Decoding is a more general and flexible grounding method that injects continuous probabilities during decoding, which may even come from grounding functions from other modalities (e.g., vision).
|
| 99 |
+
|
| 100 |
+
# 4 Experiments
|
| 101 |
+
|
| 102 |
+
# 4.1 Long-Horizon Tabletop Manipulation
|
| 103 |
+
|
| 104 |
+
Herein we experiment with a simulated tabletop manipulation environment based on RAVENS [95]. We create a custom set of 20 tasks, with 10 seen tasks and 10 unseen tasks. Seen tasks are used for training (for supervised baseline) or for few-shot prompting. They are grouped by following categories. Detailed breakdown can be found in Appendix A.2.
|
| 105 |
+
|
| 106 |
+
i. Letters: Rearranging alphabetical letters (“sort the letters in alphabetical order”).
|
| 107 |
+
|
| 108 |
+
ii. Blocks & Bowls: Rearranging or combining blocks and bowls (“put blocks in matching bowls”).
|
| 109 |
+
|
| 110 |
+
iii. Box Packing: Sorting food items and utensils into boxes in accordance with safety constraints and user preferences (“Can you pack the picnic box for me?”).
|
| 111 |
+
|
| 112 |
+
Given only high-level language instructions and top-down visual observation of the environment, Grounded Decoding decodes a sequence of text tokens representing the step command to be executed. Note that because GD generated grounded free-form actions, it does not require each step to strictly map to a repertoire of skill as in [29, 2]. After a complete command is generated, it is executed via a pre-trained multi-task language-conditioned CLIPort [67]. An example rollout is shown in Figure 4.To demonstrate the techniques proposed in Section 3.4 to obtain grounding functions, we study the composition of following grounding functions (overall grounding score is calculated as $\textstyle p _ { \mathbf { G } } = \mathbf { \dot { I } } \prod _ { i = 1 } ^ { n } p _ { i } )$ depending on the task categories. Refer to the Appendix A.2 for details.
|
| 113 |
+
|
| 114 |
+
Table 1: Tabletop domain success rates.
|
| 115 |
+
|
| 116 |
+
<table><tr><td></td><td colspan="2">CLIPort</td><td>+LLM</td><td colspan="2">+GD (Ours)</td></tr><tr><td></td><td>Short Long</td><td></td><td>Ungrounded</td><td>Greedy Beam</td><td></td></tr><tr><td>Seen Tasks</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Letters</td><td>7%</td><td>40%</td><td>20%</td><td>43%</td><td>57%</td></tr><tr><td>Blocks&Bowls</td><td>2%</td><td>62%</td><td>35%</td><td>60%</td><td>77%</td></tr><tr><td>Box Packing*</td><td>15%</td><td>28%</td><td>11%</td><td>79%</td><td>78%</td></tr><tr><td>Unseen Tasks</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Letters</td><td>6%</td><td>10%</td><td>19%</td><td>37%</td><td>41%</td></tr><tr><td>Blocks&Bowls</td><td>6%</td><td>10%</td><td>28%</td><td>44%</td><td>50%</td></tr></table>
|
| 117 |
+
|
| 118 |
+
Table 2: 2D Maze success rates.
|
| 119 |
+
|
| 120 |
+
<table><tr><td></td><td></td><td>+Skills</td><td>+LLM</td><td colspan="2">+GD (Ours)</td></tr><tr><td></td><td>PPO</td><td>HRL</td><td>Ungrounded</td><td>Greedy</td><td>Beam</td></tr><tr><td>Easy</td><td>28%</td><td>68%</td><td>96%</td><td>100%</td><td>100%</td></tr><tr><td>Medium</td><td>13%</td><td>48%</td><td>87%</td><td>93%</td><td>97%</td></tr><tr><td>Hard</td><td>6%</td><td>31%</td><td>54%</td><td>78%</td><td>88%</td></tr></table>
|
| 121 |
+
|
| 122 |
+
Affordance Grounding Function (AF). As the primitive policy CLIPort [67] already acts as an action-value function over the pixel space, we directly leverage its predictions for affordance grounding. In particular, given scene image $s$ and partially-decoded instruction $w _ { 1 : n }$ , CLIPort predicts unnormalized logits over the pixel space $\mathbf { u } _ { \mathrm { p i c k } } , \mathbf { u } _ { \mathrm { p l a c e } } \mathbf { \dot { \in } } \mathbb { R } ^ { 4 8 0 \times 6 4 0 }$ , respectively for the pick location and the place location. Therefore, for any given $s$ and $w _ { 1 : n }$ , we can calculate the affordance as $p _ { \mathrm { A F } } ( w _ { 1 : n } | s ) = \operatorname* { m a x } _ { ( x , y ) \in 4 8 0 \times 6 4 0 }$ $( \mathbf { u } _ { \mathrm { p i c k } } ( x , y ) + \mathbf { u } _ { \mathrm { p l a c e } } ( x , y ) )$ .
|
| 123 |
+
|
| 124 |
+
Safety Grounding Function (S). To strictly enforce hard constraints such as safety requirements, we adopt the rule-based method proposed in Section 3.4. In particular, the features $x$ are indicator functions denoting whether knives and red boxes which we use as hazardous objects are involved in an action, i.e., $x = \mathbb { I } [$ [“red” or “knife” in $w _ { 1 : n } ]$ . We then use constant mappings to convert the features $\begin{array} { r } { p _ { \mathrm { S } } ( w _ { 1 : n } | s ) = \underline { { \epsilon } } ( x + \frac { 1 } { Z } ( 1 - x ) } \end{array}$ to scores of 0 or 1, where $Z$ is the normalizing term and $\epsilon \approx 0$ is a small value for ensuring the joint probability does not collapse to 0.
|
| 125 |
+
|
| 126 |
+
Preference Grounding Function $\mathbf { \Pi } ^ { ( \mathbf { P } ) }$ . We similarly use rule-based methods for preference grounding, as data of individual users may be scarce to learn a separate model. In particular, we choose two random objects $\left( o _ { 1 } , o _ { 2 } \right)$ as the preferred objects, i.e., $x = \mathbb { I } [ o _ { 1 } \quad$ or $O _ { 2 }$ in $w _ { 1 : n } ]$ . Note that unlike safety functions, preferences often come in the form of “soft requirement”. Therefore, the preference grounding function is implemented as $\begin{array} { r } { p _ { \mathrm { P } } ( w _ { 1 : n } | s ) = \frac { \alpha } { Z } x + \frac { \bar { \beta ^ { } } } { Z } ( 1 - x ) } \end{array}$ , where we choose $\alpha = 0 . 5$ and $\beta = 0 . 1$ for our experiments.
|
| 127 |
+
|
| 128 |
+
Baselines. We study two variants of GD using beam search and greedy search. We also compare to ”No Grounding” baseline that decodes only according to language model likelihood. Furthermore, we compare to solitary method CLIPort [67] that directly take in the high-level language instructions without a planner. We consider two variants of CLIPort: 1) ”Short” that is trained with only singlestep pick-and-place commands, and 2) ”Long” that is trained on high-level instructions from the 10 training tasks. For more details, please refer to Appendix A.2.
|
| 129 |
+
|
| 130 |
+
Analysis. Results grouped by each task category are shown in Table $\cdot$ . Please refer to the Appendix for detailed breakdown. Each method is evaluated on 20 episodes for each task within each task category. Supervised methods, such as CLIPort, are found to perform poorly on unseen tasks. Methods that leverage language model planner show better generalization to unseen tasks but fall short due to lack of grounding. Grounded Decoding achieves the best results by enabling the LLM to plan actions using grounded information and is further improved with beam search.
|
| 131 |
+
|
| 132 |
+
# 4.2 2D Maze
|
| 133 |
+
|
| 134 |
+
We further evaluate the long-horizon reasoning of Grounded Decoding for 2D maze-solving on Minigrid [10]. The agent receives a top-down view of the environment along with a natural language instruction. More details can be found in Appendix A.3. The tasks are grouped in three categories:
|
| 135 |
+
|
| 136 |
+
i. Easy: Simple tasks where the horizon is short (10-30 steps) and fully described by the textual instruction, e.g. OpenDoors and PutNext.
|
| 137 |
+
|
| 138 |
+
ii. Medium: Short and long-horizon tasks (up to 80 steps) with step-by-step textual instructions, e.g. LockedRoom.
|
| 139 |
+
|
| 140 |
+
iii. Hard: Complex, long-horizon instructions (over 100 steps) with ambiguous instructions that necessitate multi-step reasoning and efficient exploration, e.g. MultiRoom and BlockedUnlock.
|
| 141 |
+
|
| 142 |
+

|
| 143 |
+
Figure 4: Greedy decoding rollout with GD, where key decoded tokens are shown (yellow, purple, red, yellow). Combined scores are normalized to the maximum for visual clarity; others are normalized to their sum.
|
| 144 |
+
|
| 145 |
+
Affordance Grounding Function. Following the recipe from Section 3.3, we train tokenconditioned affordance function to be used in GD. The difference is that the grounding function here is the value function from the goal-conditioned policy that is trained with PPO [62] instead of from demonstrations as in CLIPort [67]. The policy performs short-horizon skills such as “Go to red key” or “Open the door” and are conditioned on CLIP embeddings of the skill and an image of the scene. Accordingly, the goal-conditioned value function evaluates the feasibility given the current observation and the (partially) decoded skill.
|
| 146 |
+
|
| 147 |
+
Baselines. We compare the two variants of GD – with greedy and beam search – with 1) a solitary PPO policy [62], 2) a hierarchical RL algorithm which plans over the low-level skills, and 3) a hierarchical method that uses an ungrounded language model for planning [29].
|
| 148 |
+
|
| 149 |
+
Analysis. Table 2 reports the success rate, averaged across 100 episodes of randomly initialized environments. The “flat” RL agent performs poorly in all but the simplest environments, owing to difficulties with understanding the high-level instruction and reasoning over long horizons (often over 100 steps). Planning over low-level skills using hierarchical RL [5] improves this performance, since the high-level decision-making problem is greatly simplified. However, the high-level RL agent still needs to reason over low-level (textual) skills by understanding their underlying capabilities and stitching them together. Using the planning capabilities of large language models to reason over textual skills significantly boosts this performance [29], since the language model can inherit the strong reasoning capabilities from its training data. This tends to be insufficient in challenging environments, however, since the number of potentially viable skills may be very large and the LLM has no information about the robot’s observations. GD can leverage the learned affordance function (in this case, the goal-conditioned value function) to inform the language model’s plans, enabling successful long-horizon reasoning. We further find that beam search improves performance modestly, particularly in long-horizon tasks.
|
| 150 |
+
|
| 151 |
+
# 4.3 Mobile Manipulation in a Physical Kitchen
|
| 152 |
+
|
| 153 |
+
Our last environment is a kitchen robot in the real world, and we follow the same implementations of the mobile manipulation platform and skills in SayCan [2]. We perform instruction following tasks, as in [2]. An example task is “Bring an apple”, for which the robot needs to plan and execute a sequence of “1. Find an apple, 2. Pick up the apple, 3. Bring it to you. 4. Put it down, 5. Done”. We split the tasks into two categories. Unambiguous means the instruction explicitly contains the object of interest, and Ambiguous means the instruction does not contain the object name. For example, when human asks “bring me the fruit”, the robot needs to first determine available fruits. We assume all necessary objects are in the field of view. More details can be found in Appendix A.4.
|
| 154 |
+
|
| 155 |
+
Grounded Decoding with Chain-of-thought. We demonstrate using multimodal foundation models for Grounded Decoding, as proposed in Section 3.4. In particular, we use open-vocabulary object detector owl-vit [50]. Note that because these off-the-shelf models are not trained on robot domain data, we find that it works best by constraining their influence on decoding. We achieve this by making a slight modification to the SayCan algorithm [2]: before generating action plans, we prompt the LLM to generate visually-grounded chain-of-thought [84] by giving LLM the option of when to enable grounded decoding and disable grounded decoding, as visualized in Fig. 5. Specifically,
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
Figure 5: Example prompt and rollout in realworld kitchen environment.
|
| 159 |
+
|
| 160 |
+
Table 3: Success rates in kitchen environment.
|
| 161 |
+
|
| 162 |
+
<table><tr><td></td><td colspan="2">GD</td><td colspan="2">SayCan</td></tr><tr><td>Tasks</td><td>Planning</td><td>gExecution Planning</td><td></td><td>:Execution</td></tr><tr><td>Unambiguous</td><td>85%</td><td>57%</td><td>85%</td><td>57%</td></tr><tr><td>Ambiguous</td><td>58%</td><td>44%</td><td>33%</td><td>25%</td></tr></table>
|
| 163 |
+
|
| 164 |
+
Table 4: By avoiding full enumeration of skills, GD is more efficient than SayCan while staying performant.
|
| 165 |
+
|
| 166 |
+
<table><tr><td colspan="4">GD (Greedy) ( GD(Beam) SayCan</td></tr><tr><td>Success Rate</td><td>50%</td><td>60%</td><td>64%</td></tr><tr><td>Token Count</td><td>1x</td><td>4.3x</td><td>113.7x</td></tr></table>
|
| 167 |
+
|
| 168 |
+
LLMs can be prompted to generate a left bracket to start decoding jointly with grounded models and a right bracket to revert to ungrounded decoding. After chain-of-thought, we use SayCan scoring mode for decoding the action plans.
|
| 169 |
+
|
| 170 |
+
Analysis. Table 3 shows that GD recovers similar performance on Unambiguous tasks, and gain $2 5 \%$ in planning performance on Ambiguous tasks. This shows that GD with multimodal foundation models can effectively use visually-grounded chain-of-thought to disambiguate abstract tasks.
|
| 171 |
+
|
| 172 |
+
# 5 Analysis
|
| 173 |
+
|
| 174 |
+
# 5.1 Comparison to SayCan
|
| 175 |
+
|
| 176 |
+
In this section, we directly compare GD to SayCan [2], which is related to our method in that both combine language model knowledge and grounded model knowledge (discussed in more detail in Section 2). However, SayCan uses the language model to score all pre-specified options, rendering it inefficient at dealing with large or combinatorial action spaces. In contrast, GD computation considers all possible language token in the autoregressive decoding process, which is independent of the size of the action space. Results shown in Table 4 demonstrate that GD is two orders of magnitude more efficient on our tasks, with comparable performance. Furthermore, by decoding at the most basic functioning unit of language, GD’s formulation allows open-vocabulary grounding beyond just affordances, e.g. safety, preferences, and multimodal embeddings such as CLIP.
|
| 177 |
+
|
| 178 |
+
# 5.2 Breakdown of Failure Reasons
|
| 179 |
+
|
| 180 |
+
Because all hierarchical approaches share an imperfect low-level policy for step execution, the results reported in Table 1 are compounded with both planning failures and low-level policy failure. In Figure 6, we provide failure breakdown analysis for Grounded Decoding and associated baselines. Note that the CLIPort baselines are solitary methods that do not use a planner, so the failures are solely composed of policy failures. As shown in Figure 6, while all planning-based methods use the same underlying low-level policy, Grounded Decoding significantly reduces planning failure by being able to incorporate grounded scene information into the decoding process. Moreover, we observe that despite the shared affordance function across beam and greedy search, the beam search variant performs stronger by being aware of the full-length single-step instructions during decoding.
|
| 181 |
+
|
| 182 |
+
# 5.3 Grounded Action Manifold
|
| 183 |
+
|
| 184 |
+
A central goal of this work is to investigate the integration of grounded information into language model decoding to output instructions actionable by a policy. To investigate this, we use a t-SNE [80] plot to illustrate the extent to which grounded models help narrow down the search space for language models. Specifically, we first enumerate all meaningful instructions in the tabletop domain, such as “pick x and place it on y,” which are represented as dots in the figure. We then compute the affordance values with respect to four different scenes, where each color represents one scene. Finally, we group the dots using t-SNE and BERT embeddings [13]. Figure 7 shows that grounded models can effectively identify achievable skills to produce an actionable manifold within the language space and that this grounding is required, as language alone does not perfectly group actionable skills. It is worth noting that while we provide manual enumeration of all possible skills for practical analysis, the full language space is much larger. This highlights the even more pronounced narrowing of the search in the language space.
|
| 185 |
+
|
| 186 |
+

|
| 187 |
+
Figure 6: Failure breakdown on tabletop domain. GD achieves lowest planning failure among planning-based methods, among which beam search variant performs the best.
|
| 188 |
+
|
| 189 |
+

|
| 190 |
+
Figure 7: Visualization of actions colored by affordance values in different scenes. Every dot represents a possible action in the tabletop domain, where the majority of the actions are infeasible. We show how grounded models can identify the feasible actions for specific scenes. Notably, these actions are not always clustered in language space, requiring the grounding function to determine what action to perform.
|
| 191 |
+
|
| 192 |
+
# 6 Conclusions, Limitations, & Future Works
|
| 193 |
+
|
| 194 |
+
We presented Grounded Decoding (GD), an approach for leveraging the knowledge and capabilities of large language models in embodied settings through grounding functions, which model the probabilities of tokens given an embodiment. GD resembles probabilistic filtering, by decoding tokens that have high probabilities under the language model and under grounded model(s). By guiding the LLM’s decoding directly at its output, GD is a general, flexible, and expressive approach to embodied tasks. This is demonstrated on three embodied domains, showing GD is capable of solving complex, long-horizon tasks.
|
| 195 |
+
|
| 196 |
+
Though quite general and flexible, GD has a few limitations. First, although we present several techniques for obtaining grounding functions in different domains, it remains a question whether a capable and general grounding function can be obtained. We hope that recent progress in largescale robotics models (e.g. [7] and [59]) can remove this bottleneck, and note that the flexibility of GD allows such progress to be straightforwardly leveraged. Second, prompt engineering is often required to steer LLMs to the desired action space (e.g., likely action verbs, likely present objects). Finally, while not requiring additional training, the joint decoding may be limiting compared to a single model capable of both grounding and language reasoning [3, 9, 16].
|
| 197 |
+
|
| 198 |
+
This work presented a family of algorithms for grounding LLMs in embodiment, for which there are many avenues for future work. The flexibility of the approach enables many other grounding functions and ways to integrate grounding. Furthermore, the development and integration of a foundation model for grounding would improve performance significantly. Finally, though GD’s probabilistic filtering-based approach is quite general, fusing grounding information to the language model after each token decoding may be limiting and future works can investigate how such grounding can be elegantly integrated during decoding.
|
| 199 |
+
|
| 200 |
+
# Acknowledgments
|
| 201 |
+
|
| 202 |
+
The authors would like to acknowledge Pierre Sermanet, Carolina Parada, Jie Tan, Yevgen Chebotar, Vincent Vanhoucke, and Dorsa Sadigh for their feedback and contributions. This work is supported in part by OpenAI academic access program, granted to Wenlong Huang.
|
| 203 |
+
|
| 204 |
+
References [1] Christopher Agia, Toki Migimatsu, Jiajun Wu, and Jeannette Bohg. Stap: Sequencing taskagnostic policies. arXiv preprint arXiv:2210.12250, 2022.
|
| 205 |
+
[2] Michael Ahn, Anthony Brohan, Noah Brown, Yevgen Chebotar, Omar Cortes, Byron David, Chelsea Finn, Keerthana Gopalakrishnan, Karol Hausman, Alex Herzog, Daniel Ho, Jasmine Hsu, Julian Ibarz, Brian Ichter, Alex Irpan, Eric Jang, Rosario Jauregui Ruano, Kyle Jeffrey, Sally Jesmonth, Nikhil Joshi, Ryan Julian, Dmitry Kalashnikov, Yuheng Kuang, Kuang-Huei Lee, Sergey Levine, Yao Lu, Linda Luu, Carolina Parada, Peter Pastor, Jornell Quiambao, Kanishka Rao, Jarek Rettinghouse, Diego Reyes, Pierre Sermanet, Nicolas Sievers, Clayton Tan, Alexander Toshev, Vincent Vanhoucke, Fei Xia, Ted Xiao, Peng Xu, Sichun Xu, and Mengyuan Yan. Do as i can and not as i say: Grounding language in robotic affordances. In arXiv preprint arXiv:2204.01691, 2022.
|
| 206 |
+
[3] 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.
|
| 207 |
+
[4] Ashutosh Baheti, Alan Ritter, Jiwei Li, and Bill Dolan. Generating more interesting responses in neural conversation models with distributional constraints. arXiv preprint arXiv:1809.01215, 2018.
|
| 208 |
+
[5] Andrew G. Barto and Sridhar Mahadevan. Recent advances in hierarchical reinforcement learning. Discrete Event Dynamic Systems, 13(1–2):41–77, jan 2003. [6] Sourya Basu, Govardana Sachitanandam Ramachandran, Nitish Shirish Keskar, and Lav R Varshney. Mirostat: A neural text decoding algorithm that directly controls perplexity. arXiv preprint arXiv:2007.14966, 2020.
|
| 209 |
+
[7] Anthony Brohan, Noah Brown, Justice Carbajal, Yevgen Chebotar, Joseph Dabis, Chelsea Finn, Keerthana Gopalakrishnan, Karol Hausman, Alex Herzog, Jasmine Hsu, et al. Rt-1: Robotics transformer for real-world control at scale. arXiv preprint arXiv:2212.06817, 2022.
|
| 210 |
+
[8] Boyuan Chen, Fei Xia, Brian Ichter, Kanishka Rao, Keerthana Gopalakrishnan, Michael S Ryoo, Austin Stone, and Daniel Kappler. Open-vocabulary queryable scene representations for real world planning. arXiv preprint arXiv:2209.09874, 2022.
|
| 211 |
+
[9] Xi Chen, Xiao Wang, Soravit Changpinyo, AJ Piergiovanni, Piotr Padlewski, Daniel Salz, Sebastian Goodman, Adam Grycner, Basil Mustafa, Lucas Beyer, et al. Pali: A jointly-scaled multilingual language-image model. arXiv preprint arXiv:2209.06794, 2022.
|
| 212 |
+
[10] Maxime Chevalier-Boisvert, Lucas Willems, and Suman Pal. Minimalistic gridworld environment for gymnasium, 2018.
|
| 213 |
+
[11] 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.
|
| 214 |
+
[12] Sumanth Dathathri, Andrea Madotto, Janice Lan, Jane Hung, Eric Frank, Piero Molino, Jason Yosinski, and Rosanne Liu. Plug and play language models: A simple approach to controlled text generation. arXiv preprint arXiv:1912.02164, 2019.
|
| 215 |
+
[13] 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.
|
| 216 |
+
[14] Yan Ding, Xiaohan Zhang, Chris Paxton, and Shiqi Zhang. Task and motion planning with large language models for object rearrangement. arXiv preprint arXiv:2303.06247, 2023.
|
| 217 |
+
[15] Danny Driess, Ozgur Oguz, Jung-Su Ha, and Marc Toussaint. Deep visual heuristics: Learning feasibility of mixed-integer programs for manipulation planning. In 2020 IEEE International Conference on Robotics and Automation (ICRA), pages 9563–9569. IEEE, 2020.
|
| 218 |
+
[16] 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.
|
| 219 |
+
[17] Ben Eysenbach, Russ R Salakhutdinov, and Sergey Levine. Search on the replay buffer: Bridging planning and reinforcement learning. Advances in Neural Information Processing Systems, 2019.
|
| 220 |
+
[18] Angela Fan, Mike Lewis, and Yann Dauphin. Hierarchical neural story generation. arXiv preprint arXiv:1805.04833, 2018.
|
| 221 |
+
[19] Richard E Fikes and Nils J Nilsson. Strips: A new approach to the application of theorem proving to problem solving. Artificial intelligence, 1971.
|
| 222 |
+
[20] Caelan Reed Garrett, Chris Paxton, Tomas Lozano-P ´ erez, Leslie Pack Kaelbling, and Dieter ´ Fox. Online replanning in belief space for partially observable task and motion problems. In 2020 IEEE International Conference on Robotics and Automation (ICRA), 2020.
|
| 223 |
+
[21] Marjan Ghazvininejad, Xing Shi, Jay Priyadarshi, and Kevin Knight. Hafez: an interactive poetry generation system. In Proceedings of ACL 2017, System Demonstrations, pages 43–48, 2017.
|
| 224 |
+
[22] Xiuye Gu, Tsung-Yi Lin, Weicheng Kuo, and Yin Cui. Open-vocabulary object detection via vision and language knowledge distillation. arXiv preprint arXiv:2104.13921, 2021.
|
| 225 |
+
[23] Thomas Hartvigsen, Saadia Gabriel, Hamid Palangi, Maarten Sap, Dipankar Ray, and Ece Kamar. Toxigen: A large-scale machine-generated dataset for adversarial and implicit hate speech detection. arXiv preprint arXiv:2203.09509, 2022.
|
| 226 |
+
[24] Felix Hill, Sona Mokra, Nathaniel Wong, and Tim Harley. Human instruction-following with deep reinforcement learning via transfer-learning from text. arXiv preprint arXiv:2005.09382, 2020.
|
| 227 |
+
[25] Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. arXiv preprint arXiv:1904.09751, 2019.
|
| 228 |
+
[26] Ari Holtzman, Jan Buys, Maxwell Forbes, Antoine Bosselut, David Golub, and Yejin Choi. Learning to write with cooperative discriminators. arXiv preprint arXiv:1805.06087, 2018.
|
| 229 |
+
[27] Chenguang Huang, Oier Mees, Andy Zeng, and Wolfram Burgard. Visual language maps for robot navigation. arXiv preprint arXiv:2210.05714, 2022.
|
| 230 |
+
[28] De-An Huang, Suraj Nair, Danfei Xu, Yuke Zhu, Animesh Garg, Li Fei-Fei, Silvio Savarese, and Juan Carlos Niebles. Neural task graphs: Generalizing to unseen tasks from a single video demonstration. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2019.
|
| 231 |
+
[29] Wenlong Huang, Pieter Abbeel, Deepak Pathak, and Igor Mordatch. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. In International Conference on Machine Learning. PMLR, 2022.
|
| 232 |
+
[30] Wenlong Huang, Fei Xia, Ted Xiao, Harris Chan, Jacky Liang, Pete Florence, Andy Zeng, Jonathan Tompson, Igor Mordatch, Yevgen Chebotar, Pierre Sermanet, Noah Brown, Tomas Jackson, Linda Luu, Sergey Levine, Karol Hausman, and Brian Ichter. Inner monologue: Embodied reasoning through planning with language models. In arXiv preprint arXiv:2207.05608, 2022.
|
| 233 |
+
[31] Brian Ichter, Pierre Sermanet, and Corey Lynch. Broadly-exploring, local-policy trees for long-horizon task planning. Conference on Robot Learning (CoRL), 2021.
|
| 234 |
+
[32] Eric Jang, Alex Irpan, Mohi Khansari, Daniel Kappler, Frederik Ebert, Corey Lynch, Sergey Levine, and Chelsea Finn. Bc-z: Zero-shot task generalization with robotic imitation learning. In Conference on Robot Learning, pages 991–1002. PMLR, 2021.
|
| 235 |
+
[33] Leslie Pack Kaelbling and Tomas Lozano-P ´ erez. Hierarchical planning in the now. In ´ Workshops at the Twenty-Fourth AAAI Conference on Artificial Intelligence, 2010.
|
| 236 |
+
[34] Aishwarya Kamath, Mannat Singh, Yann LeCun, Gabriel Synnaeve, Ishan Misra, and Nicolas Carion. Mdetr-modulated detection for end-to-end multi-modal understanding. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1780–1790, 2021.
|
| 237 |
+
[35] Jungo Kasai, Keisuke Sakaguchi, Ronan Le Bras, Dragomir Radev, Yejin Choi, and Noah A Smith. Beam decoding with controlled patience. arXiv preprint arXiv:2204.05424, 2022.
|
| 238 |
+
[36] Nitish Shirish Keskar, Bryan McCann, Lav R Varshney, Caiming Xiong, and Richard Socher. Ctrl: A conditional transformer language model for controllable generation. arXiv preprint arXiv:1909.05858, 2019.
|
| 239 |
+
[37] Ben Krause, Akhilesh Deepak Gotmare, Bryan McCann, Nitish Shirish Keskar, Shafiq Joty, Richard Socher, and Nazneen Fatema Rajani. Gedi: Generative discriminator guided sequence generation. arXiv preprint arXiv:2009.06367, 2020.
|
| 240 |
+
[38] Remi Leblond, Jean-Baptiste Alayrac, Laurent Sifre, Miruna Pislar, Jean-Baptiste Lespiau, ´ Ioannis Antonoglou, Karen Simonyan, and Oriol Vinyals. Machine translation decoding beyond beam search. arXiv preprint arXiv:2104.05336, 2021.
|
| 241 |
+
[39] Jiwei Li, Will Monroe, and Dan Jurafsky. Learning to decode for future success. arXiv preprint arXiv:1701.06549, 2017.
|
| 242 |
+
[40] Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. Visualbert: A simple and performant baseline for vision and language. arXiv preprint arXiv:1908.03557, 2019.
|
| 243 |
+
[41] Shuang Li, Xavier Puig, Yilun Du, Clinton Wang, Ekin Akyurek, Antonio Torralba, Jacob Andreas, and Igor Mordatch. Pre-trained language models for interactive decision-making. arXiv preprint arXiv:2202.01771, 2022.
|
| 244 |
+
[42] Jacky Liang, Wenlong Huang, Fei Xia, Peng Xu, Karol Hausman, Brian Ichter, Pete Florence, and Andy Zeng. Code as policies: Language model programs for embodied control. arXiv preprint arXiv:2209.07753, 2022.
|
| 245 |
+
[43] Kevin Lin, Christopher Agia, Toki Migimatsu, Marco Pavone, and Jeannette Bohg. Text2motion: From natural language instructions to feasible plans. arXiv preprint arXiv:2303.12153, 2023.
|
| 246 |
+
[44] Bo Liu, Yuqian Jiang, Xiaohan Zhang, Qiang Liu, Shiqi Zhang, Joydeep Biswas, and Peter Stone. Llm+ p: Empowering large language models with optimal planning proficiency. arXiv preprint arXiv:2304.11477, 2023.
|
| 247 |
+
[45] Yujie Lu, Pan Lu, Zhiyu Chen, Wanrong Zhu, Xin Eric Wang, and William Yang Wang. Multimodal procedural planning via dual text-image prompting. arXiv preprint arXiv:2305.01795, 2023.
|
| 248 |
+
[46] Corey Lynch and Pierre Sermanet. Grounding language in play. 2020.
|
| 249 |
+
[47] Oier Mees, Jessica Borja-Diaz, and Wolfram Burgard. Grounding language with visual affordances over unstructured data. arXiv preprint arXiv:2210.01911, 2022.
|
| 250 |
+
[48] Clara Meister, Tiago Pimentel, Gian Wiher, and Ryan Cotterell. Typical decoding for natural language generation. arXiv preprint arXiv:2202.00666, 2022.
|
| 251 |
+
[49] Clara Meister, Tim Vieira, and Ryan Cotterell. If beam search is the answer, what was the question? arXiv preprint arXiv:2010.02650, 2020.
|
| 252 |
+
[50] Matthias Minderer, Alexey Gritsenko, Austin Stone, Maxim Neumann, Dirk Weissenborn, Alexey Dosovitskiy, Aravindh Mahendran, Anurag Arnab, Mostafa Dehghani, Zhuoran Shen, et al. Simple open-vocabulary object detection with vision transformers. arXiv preprint arXiv:2205.06230, 2022.
|
| 253 |
+
|
| 254 |
+
[51] Ashvin V Nair, Vitchyr Pong, Murtaza Dalal, Shikhar Bahl, Steven Lin, and Sergey Levine. Visual reinforcement learning with imagined goals. In Advances in Neural Information Processing Systems, 2018.
|
| 255 |
+
|
| 256 |
+
[52] Suraj Nair, Eric Mitchell, Kevin Chen, Brian Ichter, Silvio Savarese, and Chelsea Finn. Learning language-conditioned robot behavior from offline data and crowd-sourced annotation. In Conference on Robot Learning, pages 1303–1315. PMLR, 2021.
|
| 257 |
+
|
| 258 |
+
[53] OpenAI. Gpt-4 technical report. arXiv, 2023.
|
| 259 |
+
|
| 260 |
+
[54] 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.
|
| 261 |
+
|
| 262 |
+
[55] Alexander Pashevich, Cordelia Schmid, and Chen Sun. Episodic transformer for vision-andlanguage navigation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, 2021.
|
| 263 |
+
|
| 264 |
+
[56] Dhruvesh Patel, Hamid Eghbalzadeh, Nitin Kamra, Michael Louis Iuzzolino, Unnat Jain, and Ruta Desai. Pretrained language models as visual planners for human assistance. arXiv preprint arXiv:2304.09179, 2023.
|
| 265 |
+
|
| 266 |
+
[57] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. In Marina Meila and Tong Zhang, editors, Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pages 8748–8763. PMLR, 18–24 Jul 2021.
|
| 267 |
+
|
| 268 |
+
[58] Shreyas Sundara Raman, Vanya Cohen, Eric Rosen, Ifrah Idrees, David Paulius, and Stefanie Tellex. Planning with large language models via corrective re-prompting. arXiv preprint arXiv:2211.09935, 2022.
|
| 269 |
+
|
| 270 |
+
[59] Scott Reed, Konrad Zolna, Emilio Parisotto, Sergio Gomez Colmenarejo, Alexander Novikov, Gabriel Barth-Maron, Mai Gimenez, Yury Sulsky, Jackie Kay, Jost Tobias Springenberg, et al. A generalist agent. arXiv preprint arXiv:2205.06175, 2022.
|
| 271 |
+
|
| 272 |
+
[60] Machel Reid, Yutaro Yamada, and Shixiang Shane Gu. Can wikipedia help offline reinforcement learning. arXiv preprint arXiv:2201.12122, 2022.
|
| 273 |
+
|
| 274 |
+
[61] Nikolay Savinov, Alexey Dosovitskiy, and Vladlen Koltun. Semi-parametric topological memory for navigation. arXiv preprint arXiv:1803.00653, 2018.
|
| 275 |
+
|
| 276 |
+
[62] John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
|
| 277 |
+
|
| 278 |
+
[63] Thomas Scialom, Paul-Alexis Dray, Sylvain Lamprier, Benjamin Piwowarski, and Jacopo Staiano. Discriminative adversarial search for abstractive summarization. In International Conference on Machine Learning, pages 8555–8564. PMLR, 2020.
|
| 279 |
+
|
| 280 |
+
[64] Dhruv Shah, Blazej Osinski, Brian Ichter, and Sergey Levine. Lm-nav: Robotic navigation with large pre-trained models of language, vision, and action. arXiv preprint arXiv:2207.04429, 2022.
|
| 281 |
+
|
| 282 |
+
[65] Dhruv Shah, Peng Xu, Yao Lu, Ted Xiao, Alexander Toshev, Sergey Levine, and Brian Ichter. Value function spaces: Skill-centric state abstractions for long-horizon reasoning. ICLR, 2022.
|
| 283 |
+
|
| 284 |
+
[66] Pratyusha Sharma, Antonio Torralba, and Jacob Andreas. Skill induction and planning with latent language. arXiv preprint arXiv:2110.01517, 2021.
|
| 285 |
+
|
| 286 |
+
[67] Mohit Shridhar, Lucas Manuelli, and Dieter Fox. Cliport: What and where pathways for robotic manipulation. In Conference on Robot Learning, pages 894–906. PMLR, 2022.
|
| 287 |
+
|
| 288 |
+
[68] Mohit Shridhar, Lucas Manuelli, and Dieter Fox. Perceiver-actor: A multi-task transformer for robotic manipulation. In Proceedings of the 6th Conference on Robot Learning (CoRL), 2022.
|
| 289 |
+
|
| 290 |
+
[69] Tom Silver, Rohan Chitnis, Nishanth Kumar, Willie McClinton, Tomas Lozano-Perez, Leslie Pack Kaelbling, and Joshua Tenenbaum. Inventing relational state and action abstractions for effective and efficient bilevel planning. arXiv preprint arXiv:2203.09634, 2022.
|
| 291 |
+
[70] Ishika Singh, Valts Blukis, Arsalan Mousavian, Ankit Goyal, Danfei Xu, Jonathan Tremblay, Dieter Fox, Jesse Thomason, and Animesh Garg. Progprompt: Generating situated robot task plans using large language models. arXiv preprint arXiv:2209.11302, 2022.
|
| 292 |
+
[71] Charlie Snell, Ilya Kostrikov, Yi Su, Mengjiao Yang, and Sergey Levine. Offline rl for natural language generation with implicit language q learning. arXiv preprint arXiv:2206.11871, 2022.
|
| 293 |
+
[72] Charlie Snell, Sherry Yang, Justin Fu, Yi Su, and Sergey Levine. Context-aware language modeling for goal-oriented dialogue systems. arXiv preprint arXiv:2204.10198, 2022.
|
| 294 |
+
[73] Chan Hee Song, Jiaman Wu, Clayton Washington, Brian M Sadler, Wei-Lun Chao, and Yu Su. Llm-planner: Few-shot grounded planning for embodied agents with large language models. arXiv preprint arXiv:2212.04088, 2022.
|
| 295 |
+
[74] Yixuan Su, Tian Lan, Yahui Liu, Fangyu Liu, Dani Yogatama, Yan Wang, Lingpeng Kong, and Nigel Collier. Language models can see: plugging visual controls in text generation. arXiv preprint arXiv:2205.02655, 2022.
|
| 296 |
+
[75] Alessandro Suglia, Qiaozi Gao, Jesse Thomason, Govind Thattai, and Gaurav Sukhatme. Embodied bert: A transformer model for embodied, language-guided visual task completion. arXiv preprint arXiv:2108.04927, 2021.
|
| 297 |
+
[76] 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, 2019.
|
| 298 |
+
[77] Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. Advances in neural information processing systems, 27, 2014.
|
| 299 |
+
[78] Yoad Tewel, Yoav Shalev, Idan Schwartz, and Lior Wolf. Zero-shot image-to-text generation for visual-semantic arithmetic. arXiv preprint arXiv:2111.14447, 2021.
|
| 300 |
+
[79] Marc Toussaint. Logic-geometric programming: An optimization-based approach to combined task and motion planning. In Twenty-Fourth International Joint Conference on Artificial Intelligence, 2015.
|
| 301 |
+
[80] Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(11), 2008.
|
| 302 |
+
[81] 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.
|
| 303 |
+
[82] Sai Vemprala, Rogerio Bonatti, Arthur Bucker, and Ashish Kapoor. Chatgpt for robotics: Design principles and model abilities. 2023, 2023.
|
| 304 |
+
[83] Siddharth Verma, Justin Fu, Mengjiao Yang, and Sergey Levine. Chai: A chatbot ai for taskoriented dialogue with offline reinforcement learning. arXiv preprint arXiv:2204.08426, 2022.
|
| 305 |
+
[84] 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.
|
| 306 |
+
[85] Sean Welleck, Ilia Kulikov, Jaedeok Kim, Richard Yuanzhe Pang, and Kyunghyun Cho. Consistency of a recurrent language model with respect to incomplete decoding. arXiv preprint arXiv:2002.02492, 2020.
|
| 307 |
+
[86] Bohan Wu, Suraj Nair, Li Fei-Fei, and Chelsea Finn. Example-driven model-based reinforcement learning for solving long-horizon visuomotor tasks. arXiv preprint arXiv:2109.10312, 2021.
|
| 308 |
+
[87] Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016.
|
| 309 |
+
[88] Fei Xia, Chengshu Li, Roberto Mart´ın-Mart´ın, Or Litany, Alexander Toshev, and Silvio Savarese. Relmogen: Integrating motion generation in reinforcement learning for mobile manipulation. In 2021 IEEE International Conference on Robotics and Automation (ICRA), 2021.
|
| 310 |
+
[89] Yaqi Xie, Chen Yu, Tongyao Zhu, Jinbin Bai, Ze Gong, and Harold Soh. Translating natural language to planning goals with large-language models. arXiv preprint arXiv:2302.05128, 2023.
|
| 311 |
+
[90] Danfei Xu, Ajay Mandlekar, Roberto Mart´ın-Mart´ın, Yuke Zhu, Silvio Savarese, and Li FeiFei. Deep affordance foresight: Planning through what can be done in the future. In 2021 IEEE International Conference on Robotics and Automation (ICRA), pages 6206–6213. IEEE, 2021.
|
| 312 |
+
[91] Danfei Xu, Suraj Nair, Yuke Zhu, Julian Gao, Animesh Garg, Li Fei-Fei, and Silvio Savarese. Neural task programming: Learning to generalize across hierarchical tasks. In 2018 IEEE International Conference on Robotics and Automation (ICRA), 2018.
|
| 313 |
+
[92] Kevin Yang and Dan Klein. Fudge: Controlled text generation with future discriminators. arXiv preprint arXiv:2104.05218, 2021.
|
| 314 |
+
[93] Haoqi Yuan, Chi Zhang, Hongcheng Wang, Feiyang Xie, Penglin Cai, Hao Dong, and Zongqing Lu. Plan4mc: Skill reinforcement learning and planning for open-world minecraft tasks. arXiv preprint arXiv:2303.16563, 2023.
|
| 315 |
+
[94] Rowan Zellers, Ximing Lu, Jack Hessel, Youngjae Yu, Jae Sung Park, Jize Cao, Ali Farhadi, and Yejin Choi. Merlot: Multimodal neural script knowledge models. Advances in Neural Information Processing Systems, 2021.
|
| 316 |
+
[95] Andy Zeng, Pete Florence, Jonathan Tompson, Stefan Welker, Jonathan Chien, Maria Attarian, Travis Armstrong, Ivan Krasin, Dan Duong, Vikas Sindhwani, and Johnny Lee. Transporter networks: Rearranging the visual world for robotic manipulation. Conference on Robot Learning (CoRL), 2020.
|
| 317 |
+
[96] Andy Zeng, Adrian Wong, Stefan Welker, Krzysztof Choromanski, Federico Tombari, Aveek Purohit, Michael Ryoo, Vikas Sindhwani, Johnny Lee, Vincent Vanhoucke, et al. Socratic models: Composing zero-shot multimodal reasoning with language. arXiv preprint arXiv:2204.00598, 2022.
|
| 318 |
+
|
| 319 |
+
# A Appendix
|
| 320 |
+
|
| 321 |
+
# A.1 Grounded Decoding Implementation Details
|
| 322 |
+
|
| 323 |
+
We study three different implementations of Grounded Decoding for each of the experimental domains. While each instantiation applied Grounded Decoding to long-horizon planning and behavior synthesis, different components including language models and grounded models are used in each domain, as seen in Table 5. Grounded models used in these domains include Affordance Functions (AF), Safety Functions (S), Preference Functions (P), and Open-Vocabulary Object Detectors (D).
|
| 324 |
+
|
| 325 |
+
<table><tr><td></td><td>Tabletop Rearrangement (Sim)</td><td>MiniGrid 2D Maze (Sim)</td><td>Kitchen Mobile Manipulation (Real)</td></tr><tr><td>LLM</td><td>InstructGPT [54]</td><td>InstructGPT</td><td>InstructGPT + PaLM[11]</td></tr><tr><td>Primitives</td><td>CLIPort [67]</td><td>PPO [62]</td><td>RT-1 [7]</td></tr><tr><td>Grounded Models</td><td>AF+S + P</td><td>AF</td><td>D</td></tr></table>
|
| 326 |
+
|
| 327 |
+
Table 5: Comparison between different versions of GD implemented in three different environments.
|
| 328 |
+
|
| 329 |
+
# A.2 Implementation Details of Simulated Tabletop Rearrangement
|
| 330 |
+
|
| 331 |
+
# A.2.1 Tasks
|
| 332 |
+
|
| 333 |
+
There are a total of 20 tasks (templates of language instructions), listed in Table 6, grouped into three task category: Letters, Blocks&Bowls, and Box Packing. Three categories share a total of 57 objects. For Letters category, the goals are to rearrange the alphabetical letter objects such that they satisfy certain orders specified by the language instructions. At the beginning of each episode, task-relevant objects and a set of 1 to 3 randomly-sampled distractor objects (except for the Letters category) are initialized at random positions on the tabletop with fixed orientations. A minimum $1 5 \mathrm { c m }$ distance is enforced between any two objects to avoid collision and penetration at initialization. To allow for automatic evaluations, a binary reward function is defined for each task using ground-truth state of the objects. Furthermore, we implement scripted policies for each task to collect demonstrations for training the CLIPort baseline. For certain tasks, we also randomize the attributes mentioned in the given instructions, which can be found below:
|
| 334 |
+
|
| 335 |
+
i. hwordi: hi, world, left, right, top, down, love, you ii. hcorner/sidei: left side, top left corner, top side, top right corner, bottom right corner, bottom side, bottom left corner
|
| 336 |
+
|
| 337 |
+
# A.2.2 Low-level Primitives
|
| 338 |
+
|
| 339 |
+
We use CLIPort [67] as the low-level primitive that can be invoked by the LLM planner, as it shows promising results of generalization across free-form language instructions. Additionally, since the policy predicts per-pixel affordance, it can be repurposed to serve as grounded models for planning for long-horizon tasks, which we leverage in this work. The single primitive policy is trained on 50,000 pre-collected demonstrations, across 10 training tasks, where each demonstration contains 1) language instruction of the format “pick up [x] and place it on [y]”, 2) top-down RGB-D observation of the current scene, 3) expert pick location expressed as pixel coordinates, and 4) expert place location expressed as pixel coordinates. The expert actions are obtained by accessing ground-truth object pose in the simulator. We further apply substring augmentation during training as we find it helps with performance on partial commands (see Section
|
| 340 |
+
|
| 341 |
+
# A.2.3 Language Model
|
| 342 |
+
|
| 343 |
+
We use InstructGPT [54] (text-davinci-002), accessed through OpenAI API.
|
| 344 |
+
|
| 345 |
+
# A.2.4 CLIPort Baseline
|
| 346 |
+
|
| 347 |
+
As CLIPort [67] already takes as input a natural language instruction and is capable of directly outputting robot actions, it bears the question whether we need a high-level planner for completing long-horizon tasks. To this end, we additionally train two variants of multi-task CLIPort policy on 10 of the total 20 tasks as baselines (see Table 6 for the train/test split). One variant, which we referred as “CLIPort (Short)”, is trained only on single-step pick-and-place instructions of the format “pick up [x] and place it on [y]” on the 10 training tasks. The decomposed pick-and-place instructions are obtained from scripted planners. At evaluation time, the policy is fed in only the high-level instructions without any planners. The other variant, which we referred as “CLIPort (Long)”, is trained on the high-level instructions from the 10 training tasks (without decomposition from scripted planners). Similarly, at evaluation time, it is fed in only the high-level instructions and evaluated on both seen and unseen instructions. Both variants are trained on 50,000 demonstrations, similar to the Grounded Decoding primitive. The goal of these baselines is to evaluate whether solitary language-conditioned policies can perform well on long-horizon tasks and generalize to new task instructions. Note that the CLIPort baselines are different from the primitive used in Grounded Decoding, although they share the same architecture.
|
| 348 |
+
|
| 349 |
+
# A.2.5 Full Experimental Results in Simulated Tabletop Domain
|
| 350 |
+
|
| 351 |
+
Below we show the full list of tasks and the full experimental results in the simulated tabletop domain. Each entry is the average success rate across 20 rollouts. The tasks with blue-colored background are seen tasks and the tasks with orange-colored background are the unseen tasks. Seen tasks may be used for training for supervised baselines (CLIPort) or may be used in the prompt for methods using language model planner. Note that for the “Box Packing” task category, although all tasks were seen in training or the prompts, we enforce additional safety and preference constraints for evaluation only at test time.
|
| 352 |
+
|
| 353 |
+
Table 6: Full Experimental Results in Simulated Tabletop Rearrangement Tasks. The tasks with blue-colored background are seen tasks and the tasks with orange-colored background are the unseen tasks. $\ast _ { \mathrm { B o X } }$ Packing tasks are all seen during training, but safety and preference requirements are only enforced during evaluation.
|
| 354 |
+
|
| 355 |
+
<table><tr><td rowspan="2"></td><td rowspan="2"></td><td colspan="2">CLIPort</td><td rowspan="2">+LLM</td><td colspan="2">+Grounded Decoding</td></tr><tr><td></td><td>Short Long</td><td>:Ungrounded Greedy</td><td>Beam</td></tr><tr><td>Letters</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Put the letters in alphabetical order from left to right</td><td>AF</td><td>5%</td><td>20%</td><td>10%</td><td>20%</td><td>40%</td></tr><tr><td>Spell as much of word as you can</td><td>AF</td><td>10%</td><td>60%</td><td>30%</td><td>60%</td><td>65%</td></tr><tr><td>Separate the vowels from the remaining letters to the bottom side</td><td>AF</td><td>5%</td><td>40%</td><td>20%</td><td>50%</td><td>65%</td></tr><tr><td>Put the leters in reverse alphabetical order from left to right</td><td>AF</td><td>15%</td><td>10%</td><td>15%</td><td>25%</td><td>25%</td></tr><tr><td>Correctly spell out a sport using the present letters</td><td>AF</td><td>10%</td><td>10%</td><td>5%</td><td>30%</td><td>30%</td></tr><tr><td>Sort the geometrically symmetrical leters to the bottom side</td><td>AF</td><td>5%</td><td>10%</td><td>15%</td><td>35%</td><td>50%</td></tr><tr><td>Separate the consonants from the remaining letters to the bottom side</td><td>AF</td><td>0%</td><td>0%</td><td>25%</td><td>25%</td><td>25%</td></tr><tr><td>Sortthe letters less than "D"according to ASCII to the bottom side</td><td>AF</td><td>0%</td><td>20%</td><td>35%</td><td>70%</td><td>75%</td></tr><tr><td>Blocks & Bowls</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td> Stack all the blocks</td><td>AF</td><td>5%</td><td>90%</td><td>30%</td><td>75%</td><td>90%</td></tr><tr><td>Put all the blocks on the corner/side</td><td>AF</td><td>0%</td><td>65%</td><td>50%</td><td>45%</td><td>70%</td></tr><tr><td>Put all the blocks in the bowls with matching colors</td><td>AF</td><td>0%</td><td>30%</td><td>25%</td><td>60%</td><td>70%</td></tr><tr><td>Put the blocks in the bowls with mismatched colors</td><td>AF</td><td>25%</td><td>30%</td><td>45%</td><td>30%</td><td> 55%</td></tr><tr><td>Put all the blocks in different corners</td><td>AF</td><td>0%</td><td>5%</td><td>40%</td><td>50%</td><td>60%</td></tr><tr><td>Stack only the blocks of cool colors</td><td>AF</td><td>5%</td><td>5%</td><td>20%</td><td>70%</td><td>70%</td></tr><tr><td>Stack only the blocks of warm colors</td><td>AF</td><td>0%</td><td>10%</td><td>15%</td><td>45%</td><td>35%</td></tr><tr><td>Sort the primary color blocks to the left side</td><td>AF</td><td>0%</td><td>0%</td><td>20%</td><td>25%</td><td>30%</td></tr><tr><td> Box Packing*</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Pack the objects into the brown box</td><td>AF + S</td><td></td><td>20%40%</td><td>5%</td><td>100%</td><td>90%</td></tr><tr><td>Pack the objects into the boxes</td><td>AF + S</td><td></td><td>10%20%</td><td>5%</td><td>75%</td><td>70%</td></tr><tr><td>I'd like some snacks on the right side</td><td>AF + P</td><td></td><td>15%20%</td><td>15%</td><td>40%</td><td>55%</td></tr><tr><td>Pack me a picnic box</td><td>AF + S +P</td><td></td><td>15%30%</td><td>20%</td><td>100%</td><td>95%</td></tr></table>
|
| 356 |
+
|
| 357 |
+
# A.3 Implementation Details of Minigrid 2D Maze
|
| 358 |
+
|
| 359 |
+
# A.3.1 Environment Setup
|
| 360 |
+
|
| 361 |
+
We use the open-source gym-minigrid suite of environments to evaluate our method with one simple change — instead of the default observation space which is a $7 \times 7$ egocentric window, our agent has access to entire grid — that allows us to simplify the tasks by removing partial observability [65].
|
| 362 |
+
|
| 363 |
+
# A.3.2 Tasks
|
| 364 |
+
|
| 365 |
+
The tasks are grouped in three categories (please see Table 7 for example instructions):
|
| 366 |
+
|
| 367 |
+
1. Easy: Simple tasks where the horizon is short (10-30 steps) and fully described by the textual instruction, e.g. OpenDoors and PutNext. The short horizon makes them relatively easy for a wide range of HRL algorithms. The instructions for these tasks generally spell out each individual skill, making them particularly easy for high-level planners based on language modeling.
|
| 368 |
+
2. Medium: Combination of short and long horizon tasks (up to 80 steps) with step-by-step textual instructions, e.g. LockedRoom. While being significantly longer, these tasks also tend to have instructions that spell out the low-level tasks (see Table 7).
|
| 369 |
+
3. Hard: Complex, long horizon instructions (over 100 steps) with short, ambiguous instructions that necessitate multi-step reasoning and efficient exploration, e.g. MultiRoom and BlockedUnlock. In addition to being long-horizon, the instructions in this case tend to be ambiguous and under-specified, e.g. ”traverse through the rooms to get to the goal”, which does not provide enough context for any blind planning agent.
|
| 370 |
+
|
| 371 |
+
Table 7: Example Instructions in Minigrid
|
| 372 |
+
|
| 373 |
+
<table><tr><td>Difficulty</td><td>Task Name</td><td>Example Instruction</td></tr><tr><td>Easy</td><td>OpenDoors PutNext</td><td>open door blue, then open door red move the red ball next to the green box</td></tr><tr><td>Medium</td><td>LockedRoom</td><td> get the red key from the purple room, open the red door and go to the goal</td></tr><tr><td>Hard</td><td>MultiRoom BlockedUnlock</td><td>traverse the rooms to get to the goal pick up the blue box</td></tr></table>
|
| 374 |
+
|
| 375 |
+
# A.3.3 Language Model
|
| 376 |
+
|
| 377 |
+
We use InstructGPT [54] (text-davinci-002), accessed through OpenAI API. The prompts used can be found in Section A.5.
|
| 378 |
+
|
| 379 |
+
We found the prompts to be generally sufficient for solving the “seen” tasks, as well as “unseen” tasks, i.e. tasks that do not have an example in the context. Empirically, we did not find any improvements by including more then 3 example tasks in the prompt — we hypothesize that this is likely due to the shared low-level primitives across tasks. For all Minigrid experiments presented in this paper, we used the prompt shown in Section A.5.
|
| 380 |
+
|
| 381 |
+
# A.3.4 Low-level Primitives
|
| 382 |
+
|
| 383 |
+
To train low-level primitives, we train an RL agent to solve a wide range of short-horizon subtasks (under 10 steps) that are shared across the various Minigrid tasks — go to $< \circ { \mathrm { b j } } >$ , pick up <obj>, drop <obj>, open <obj>. Rather than training individual skills for each of them [65], we train a single multi-task policy that is conditioned on the CLIP embeddings [57] of the task strings. This scheme allows some robustness to synonyms and ambiguous task specifications, and has been widely used in learning language-grounded policies [32, 68].
|
| 384 |
+
|
| 385 |
+
We train these primitives using PPO [62], as recommended by the environment developers [10]. Each of these skills are trained with a sparse outcome reward $^ { + 1 }$ if a trajectory is successful, 0 otherwise). In addition to these low-level skills, we perform a form of hindsight relabeling where “substrings“ of the task strings are masked to allow generalization to partial strings, e.g. “go to red” may be interpreted as “go to red key” or “go to red door”, and our masking strategy allows the multi-task policy to execute tasks specified by partially complete strings, if necessary.
|
| 386 |
+
|
| 387 |
+

|
| 388 |
+
A.3.5 Additional Qualitative Results
|
| 389 |
+
Figure 8: Minigrid Domain
|
| 390 |
+
|
| 391 |
+
# A.4 Implementation Details of Real-World Mobile Manipulation
|
| 392 |
+
|
| 393 |
+
A.4.1 Tasks
|
| 394 |
+
Table 8: List of unambiguous SayCan instructions
|
| 395 |
+
|
| 396 |
+
<table><tr><td>Instruction</td></tr><tr><td>put an energy bar and water bottle on the table bring me a lime soda and a bag of chips Can you throw away the apple and bring me a coke bring me a 7up can and a tea move an multigrain chips to the table and an apple to the far counter move the lime soda, the sponge,and the water bottle to the table</td></tr></table>
|
| 397 |
+
|
| 398 |
+
Table 9: List of ambiguous SayCan instructions
|
| 399 |
+
|
| 400 |
+
<table><tr><td>Instruction</td></tr><tr><td>I want to wipe some spill.</td></tr><tr><td>Bring me a fruit</td></tr><tr><td>Bring me a snack</td></tr><tr><td>Bring me a bag of chips</td></tr><tr><td>Bring me a bag of snack</td></tr><tr><td>Bring me a bag of chips and something to wipe a spill Bring me a bag of chips and something to drink</td></tr><tr><td>Bring me a bag of chips and a soda</td></tr><tr><td>Human: I want a soda that is not coke,and a fruit.</td></tr><tr><td>I want a fruit and a soda</td></tr></table>
|
| 401 |
+
|
| 402 |
+
# A.4.2 Language Model
|
| 403 |
+
|
| 404 |
+
For planning, we use PaLM [11], a 540B parameter language model trained on a large datasets that include high-quality web documents, books, Wikipedia, conversations, and GitHub code. Before planning, we use InstructGPT [54] (text-davinci-002), accessed through OpenAI API. to generate the (grounded) chain of thought.
|
| 405 |
+
|
| 406 |
+
We used square bracket to indicate grounded decoding, as illustrated in Fig. 5. The prompts are shown in Listing 3.
|
| 407 |
+
|
| 408 |
+
# A.4.3 Low-level Primitives
|
| 409 |
+
|
| 410 |
+
We use a combination of learned and scripted control policies for navigation and manipulation, following the implementation described in SayCan [2] and RT-1 [7]. The manipulation policies for the picking action are learned using Behavior Cloning (BC) on 68000 demonstrations and 12000 autonomous successes that were collected over the course of 11 months using a fleet of 10 robots. The demonstrations are collected by teleoperators using VR headset controllers to track the motion of their hand, which is then mapped onto the robot’s end-effector pose. The navigation policies are scripted, based on a ground-truth map as well as a learned perception module for collision avoidance and planning. The placing actions follow pre-computed motions only when preceded by a navigation policy. The Value Functions used by SayCan for affordance grounding are provided by the $Q$ -networks of trained RL agents; we follow the RL training setup described in [2].
|
| 411 |
+
|
| 412 |
+
# A.4.4 Open-Vocabulary Detector Grounding Function
|
| 413 |
+
|
| 414 |
+
We use owl-vit [50] as our grounding model. It takes in an image and a natural language query, and returns a list of bounding boxes with scores. We take the maximum score a the grounding function.
|
| 415 |
+
|
| 416 |
+
More examples of object detection as a grounding function can be found in Fig. 9.
|
| 417 |
+
|
| 418 |
+

|
| 419 |
+
Figure 9: Additional examples of using open-vocabulary object detection as a grounding function in Real-World Kitchen Mobile Manipulation Domain.
|
| 420 |
+
|
| 421 |
+
# A.5 Prompts
|
| 422 |
+
|
| 423 |
+
# Listing 1: Grounded Decoding Prompt in Simulated Tabletop Rearrangement Domain
|
| 424 |
+
|
| 425 |
+
Task: Pack all letter objects on the brown box Step 1: pick up the e and place it on the brown box Step 2: pick up the g and place it on the brown box Step 3: done
|
| 426 |
+
|
| 427 |
+
Task: Put the letters on the tables in alphabetical order Step 1: pick up the c and place it on the bottom left side Step 2: pick up the d and place it on the right of c Step 3: pick up the i and place it on the right of d Step 4: pick up the l and place it on the right of i Step 5: pick up the w and place it on the right of l Step 6: done
|
| 428 |
+
|
| 429 |
+
Task: Spell as much of "blue" as you can Step 1: pick up the l and place it on the bottom left side Step 2: pick up the the u and place it on the right of l Step 3: pick up the the e and place it on the right of u Step 4: done
|
| 430 |
+
|
| 431 |
+
Task: Separate the vowels from the remaining letters Step 1: pick up the i and place it on the bottom side Step 2: pick up the o and place it on the bottom side Step 3: done
|
| 432 |
+
|
| 433 |
+
Task: Stack all the blocks
|
| 434 |
+
|
| 435 |
+
Step 1: pick up the brown block and place it on the pink block Step 2: pick up the cyan block and place it on the brown block Step 3: pick up the orange block and place it on the cyan block Step 4: pick up the gray block and place it on the orange block Step 5: done
|
| 436 |
+
|
| 437 |
+
Task: Put all the blocks on the bottom left corner Step 1: pick up the white block and place it on the bottom left corner Step 2: pick up the yellow block and place it on the bottom left corner Step 3: pick up the green block and place it on the bottom left corner Step 4: pick up the blue block and place it on the bottom left corner Step 5: pick up the purple block and place it on the bottom left corner Step 6: done
|
| 438 |
+
|
| 439 |
+
Task: Put all the blocks in the bowls with matching colors Step 1: pick up the cyan block and place it on the cyan bowl Step 2: pick up the purple block and place it on the purple bowl Step 3: pick up the brown block and place it on the brown bowl Step 4: pick up the pink block and place it on the pink bowl Step 5: done
|
| 440 |
+
|
| 441 |
+
Task: Pack the items into any box
|
| 442 |
+
Step 1: pick up the donut stick and place it on the red box
|
| 443 |
+
Step 2: pick up the pepsi and place it on the brown box
|
| 444 |
+
Step 3: pick up the peach and place it on the brown box
|
| 445 |
+
Step 4: pick up the strawberry and place it on the red box
|
| 446 |
+
Step 5: done
|
| 447 |
+
|
| 448 |
+
Task: Pack the items on the table into the brown box Step 1: pick up the knife and place it on the brown box Step 2: pick up the plum and place it on the brown box Step 3: pick up the pepsi and place it on the brown box Step 4: pick up the cupcake and place it on the brown box Step 5: done
|
| 449 |
+
|
| 450 |
+
Task: Pack the items on the table into the brown box Step 1: pick up the i and place it on the brown box Step 2: pick up the green block and place it on the brown box Step 3: pick up the l and place it on the brown box Step 4: done
|
| 451 |
+
|
| 452 |
+
Task: Can you put some snacks on the right side for me? Step 1: pick up the plum and place it on the right side Step 2: done
|
| 453 |
+
|
| 454 |
+
Task: Can you pack my picnic box for me?
|
| 455 |
+
|
| 456 |
+
Step 1: pick up the orange and place it on the picnic box Step 2: pick up the diet pepsi and place it on the picnic box Step 3: pick up the knife and place it on the picnic box Step 4: done
|
| 457 |
+
|
| 458 |
+
# Listing 2: Grounded Decoding Prompt in MiniGrid 2D Maze Domain
|
| 459 |
+
|
| 460 |
+
You are a 2D maze-solving agent with access to a variety of low-level skills such as picking up or dropping objects, navigating to doors/keys/boxes, and opening/closing doors. Here are some example tasks:
|
| 461 |
+
|
| 462 |
+
Task: get the green key from the purple room, unlock the green door and go to the goal Step 1: go to the purple door and open it
|
| 463 |
+
Step 2: go to the green key
|
| 464 |
+
Step 3: pick up the key
|
| 465 |
+
Step 4: go to the green door and open it
|
| 466 |
+
Step 5: go to the goal.
|
| 467 |
+
|
| 468 |
+
Task: pick up the purple box Step 1: go to the green obstacle Step 2: pick up the obstacle Step 3: place the obstacle Step 4: go to the blue key Step 5: pick up the blue key Step 6: go to the blue door and open it Step 8: drop the blue key Step 7: go to the purple box Step 8: pick up the purple box.
|
| 469 |
+
|
| 470 |
+
Task: traverse the rooms to get to the goal Step 1: go to the purple door and open it Step 2: go to the green door and open it Step 3: go to the purple door and open it Step 4: go to the green door and open it Step 5: go to the green door and open it Step 6: go to the goal.
|
| 471 |
+
|
| 472 |
+
Now your turn.
|
| 473 |
+
|
| 474 |
+
# Listing 3: Grounded Decoding Prompt in Real-World Kitchen Mobile Manipulation Domain
|
| 475 |
+
|
| 476 |
+
The following objects are in the scene: 7up, apple, banana, mango, tea, multigrain chips, kettle chips, jalapeno chips, rice chips, coke, grapefruit soda, pepsi, redbull, energy bar, lime soda, sponge, paper towel, and water bottle.
|
| 477 |
+
|
| 478 |
+
The following locations are in the scene: close counter, far counter, table, trash, bowl.
|
| 479 |
+
The robot will always put object name in brackets []. Robot: I am a robot that can bring objects to you. Human: I am hungry.
|
| 480 |
+
Robot thought: I will find the [multigrain chips]. Robot plan: 1. Find the multigrain chips
|
| 481 |
+
2. Pick up the multigrain chips
|
| 482 |
+
3. Bring it to you
|
| 483 |
+
4. Put it down
|
| 484 |
+
5. Done Robot: I am a robot that can bring objects to you.
|
| 485 |
+
Human: Throw away the fruit.
|
| 486 |
+
Robot thought: I will find the [mango] and move it to the trash. Robot plan: 1. Find the mango
|
| 487 |
+
2. Pick up the mango
|
| 488 |
+
3. Go to the trash
|
| 489 |
+
4. Put it down
|
| 490 |
+
5. Done Robot: I am a robot that can bring objects to you. Human: (inject instruction).
|
| 491 |
+
Robot thought:
|
md/dev/KwmPfARgOTD/KwmPfARgOTD.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/LV8OmADmoOe/LV8OmADmoOe.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# IMPROVING THE TRANSFERABILITY OF ADVERSARIAL ATTACKS THROUGH EXPERIENCED PRECISE NESTEROV MOMENTUM
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Deep Neural Networks are vulnerable to adversarial attacks, which makes adversarial attacks serve as a method to evaluate the robustness of DNNs. However, adversarial attacks have high white-box attack success rates but poor transferability, making black-box attacks impracticable in the real world. Momentumbased attacks were proposed to accelerate optimization to improve transferability. Nevertheless, conventional momentum-based attacks accelerate optimization inefficiently during early iterations since the initial value of momentum is zero, which leads to unsatisfactory transferability. Therefore, we propose Experienced Momentum (EM), which is the pre-trained momentum. Initializing the momentum to EM can help accelerate optimization during the early iterations. Moreover, the pre-update of conventional Nesterov momentum based attacks is rough, prompting us to propose Precise Nesterov momentum (PN). PN refines the preupdate by considering the gradient of the current data point. Finally, we integrate EM with PN as Experienced Precise Nesterov momentum (EPN) to further improve transferability. Extensive experiments against normally trained and defense models demonstrate that our EPN is more effective than conventional momentum in the improvement of transferability. Specifically, the attack success rates of our EPN-based attacks are ${ \sim } 1 1 . 9 \%$ and ${ \sim } 1 3 . 1 \%$ higher than conventional momentum-based attacks on average against normally trained and defense models, respectively.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Deep neural networks (DNNs) (Krizhevsky et al., 2012; Szegedy et al., 2015; He et al., 2016; Ioffe & Szegedy, 2015) have been widely applied in computer vision, e.g., autonomous driving (Franchi et al., 2022; Hao et al., 2019; Cococcioni et al., 2018), facial recognition (Chrysos et al., 2020; Ghenescu et al., 2018), and medical image analysis (Akselrod-Ballin et al., 2016; Ding et al., 2017; Liu et al., 2019). However, Szegedy et al. (2013) found that applying certain imperceptible perturbations to images can make DNNs misclassify, and they refer to such perturbed images as adversarial examples $( A E s )$ . Adversarial examples pose a huge threat to the security of DNNs, which attaches extensive attention from researchers.
|
| 12 |
+
|
| 13 |
+
Adversarial attacks can be categorized into white-box attacks and black-box attacks. Typically, iterative gradient-based (Kurakin et al., 2016; Madry et al., 2017) and optimization-based attacks (Carlini & Wagner, 2017) have high white-box but low black-box attack success rates, which means that such two attacks are impracticable in the real world. Transferability, which means adversarial examples crafted on the source model remain effective on other models, makes black-box attacks feasible. Furthermore, iterative gradient-based attacks have the advantages of low computational cost and fast generation speed, thus improving the transferability of iterative gradient-based attacks has become a hotspot in the field of adversarial attacks.
|
| 14 |
+
|
| 15 |
+
Many methods have been proposed to improve the transferability of iterative gradient-based attacks. These methods can be classified into three branches: improving optimization algorithms, input transformations, and disrupting feature space. For example, MI-FGSM (Dong et al., 2018), NI-FGSM (Lin et al., 2019), and VM(N)I-FGSM (Wang & He, 2021) improve gradient ascent (or descent) algorithm to escape from saddle points and poor local extrema to improve transferability; DIM (Xie et al., 2019), TIM (Dong et al., 2019), and SIM (Lin et al., 2019) craft adversarial examples on a set of models derived by input transformations to prevent overfitting and improve transferability; NRDM (Naseer et al., 2018), FDA (Ganeshan et al., 2019), and FIA (Wang et al., 2021) disrupt deep features of DNNs to craft highly transferable adversarial examples.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Comparison of conventional Polyak momentum and experienced Polyak momentum. Adversarial examples are crafted on the source model (Inception-v3) and used to attack the target model (VGG16). Our Experienced MI-FGSM (EMI-FGSM), which integrates EM into MI-FGSM, causes misclassification with higher loss and confidence than MI-FGSM, thus EMI-FGSM can mislead the attention of the target model better than MI-FGSM.
|
| 19 |
+
|
| 20 |
+
Those mentioned above adversarial attacks mostly adopt the momentum (Polyak, 1964; Nesterov, 1983) to accelerate optimization. However, such momentum-based adversarial attacks (e.g., M(N)IFGSM, VM(N)I-FGSM, and FIA) have the problem of initializing the momentum to zero, resulting in inefficient acceleration due to momentum accumulating few gradients during the first few iterations. Therefore, we propose Experienced Momentum (EM), which is the pre-trained momentum. Before the iterations, the momentum is initialized to EM instead of zero, leading to better acceleration in the first few iterations. The comparison of conventional Polyak momentum (Polyak, 1964) and experienced Polyak momentum is shown in Fig. 1. To prevent overfitting on the source model, we train EM on a set of models derived by Random Channels Swapping (RCS). EM and RCS are detailed in Sec. 3.1.
|
| 21 |
+
|
| 22 |
+
Furthermore, adversarial attacks (e.g., NI-FGSM and VNI-FGSM) based on Nesterov momentum (i.e., Nesterov Accelerated Gradient, NAG (Nesterov, 1983)) have the disadvantage that the preupdate is rough. Specifically, during each iteration, the parameters are first pre-updated along the momentum to obtain the pre-update point, which is an estimation of the next position. Then the preupdate is modified by the gradient of the pre-update point. Such looking-ahead property of Nesterov momentum makes parameters escape from saddle points and poor local extrema easier and faster, resulting in improving transferability. However, pre-updating only along the momentum is rough, and the estimation of the next position of the parameters is imprecise. Therefore, we propose Precise Nesterov momentum (PN), which not only retains the looking-ahead property but also refines the pre-update by adopting the gradient of the current data point. To improve transferability further, we integrate EM with PN as Experienced Precise Nesterov momentum (EPN). PN and EPN are detailed in Sec. 3.2.
|
| 23 |
+
|
| 24 |
+
Overall, we make the following contributions:
|
| 25 |
+
|
| 26 |
+
• We propose Experienced Momentum (EM), which is trained on a set of models derived by Random Channels Swapping (RCS). Initializing the momentum to EM can accelerate optimization effectively during the early iterations to improve transferability.
|
| 27 |
+
|
| 28 |
+
• We propose Precise Nesterov momentum (PN), which adopts the gradient of the current data point to refine the pre-update to escape from saddle points and poor local extrema easier and faster. We also integrate EM with PN as Experienced Precise Nesterov momentum (EPN) to improve transferability further. • Extensive experiments on normally trained and defense models demonstrate that our EPN is more effective than conventional momentum for improving transferability.
|
| 29 |
+
|
| 30 |
+
# 2 RELATED WORK
|
| 31 |
+
|
| 32 |
+
# 2.1 TRANSFERABLE ADVERSARIAL ATTACKS
|
| 33 |
+
|
| 34 |
+
Since adversarial examples were discovered by Szegedy et al. (2013), many methods (Goodfellow et al., 2014; Kurakin et al., 2016; Carlini & Wagner, 2017) have been proposed to craft adversarial examples to demonstrate the vulnerability of DNNs. We focus on the transferability of iterative gradient-based attacks and review related works from three branches: improving optimization algorithms, input transformations, and disrupting feature space.
|
| 35 |
+
|
| 36 |
+
Improving optimization algorithms. Dong et al. (2018) integrated Polyak momentum (Polyak, 1964) into I-FGSM (Kurakin et al., 2016) to accelerate gradient ascent (or descent) to improve transferability. Inspired by the fact that Nesterov momentum (Nesterov, 1983) is superior to Polyak momentum, Lin et al. (2019) integrated Nesterov momentum into I-FGSM to improve transferability further. Wang & He (2021) used the gradient variance of the previous iteration to tune the current gradient to stabilize the update direction and escape from saddle points and poor local extrema.
|
| 37 |
+
|
| 38 |
+
Input transformations. The nature of input transformations is crafting adversarial examples on a set of derived models to prevent overfitting. Xie et al. (2019) performed random resizing and padding with probability $p$ to derive models. Dong et al. (2019) convolved the gradient to approximate translating input. Lin et al. (2019) scaled the input with the scale factor $1 / 2 ^ { i }$ to derive a set of models.
|
| 39 |
+
|
| 40 |
+
Disrupting feature space. Naseer et al. (2018) created maximum distortions in the feature space to craft adversarial examples, based on the intuition that features of DNNs are highly generalizable. Ganeshan et al. (2019) highly corrupted deep features by disrupting features at each layer of DNNs to improve transferability. Wang et al. (2021) described feature importance with the aggregate gradient and disrupted important object-aware features to achieve stronger transferability.
|
| 41 |
+
|
| 42 |
+
# 2.2 ADVERSARIAL TRAINING
|
| 43 |
+
|
| 44 |
+
Adversarial training as a common defense measure can validate transferability further. Adversarial training increases robustness by adding adversarial examples to the training data. Goodfellow et al. (2014) showed that adversarially trained models are more robust. However, Kurakin et al. (2016) pointed out that adversarial training is not robust to iterative attacks. Moreover, Tramer et al. (2017) \` showed that adversarially trained models are still vulnerable to simple white-box and black-box attacks. Therefore, they proposed ensemble adversarial training adding adversarial examples crafted from other models to the training data.
|
| 45 |
+
|
| 46 |
+
# 3 METHODOLOGY
|
| 47 |
+
|
| 48 |
+
Given a target model $f ^ { \prime } ( x ; { \pmb \theta } ^ { \prime } )$ , where $_ { \textbf { \em x } }$ is an input, and $\pmb { \theta } ^ { \prime }$ is the parameters of $f ^ { \prime }$ . Let $J ( \cdot , y )$ be a loss function, where $y$ is the ground-truth label of the input $_ { \textbf { \em x } }$ . A non-targeted adversarial example $\pmb { x } ^ { a d v }$ satisfies $f ^ { \prime } ( { \pmb x } ; { \hat { \pmb \theta } } ^ { \prime } ) \neq { \bar { f ^ { \prime } } } ( { \pmb x } ^ { a d v } ; { \pmb \theta } ^ { \prime } )$ under the constraint of $| | { \pmb x } ^ { a d v } \bar { - } { \pmb x } | | _ { p } \le \epsilon .$ , where $| | \cdot | | _ { p }$ denotes the $L ^ { p }$ norm, and $p$ is generally $0 , 1 , 2 , \infty$ . In this paper, we focus on $p = \infty$ . Note that our methods can be generalized to $p = 0 , 1 , 2$ easily. Crafting non-targeted adversarial examples can be described as solving the following optimization problem:
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
\underset { \pmb { x } ^ { a d v } } { \arg \operatorname* { m a x } } J ( f ^ { \prime } ( \pmb { x } ^ { a d v } ; \pmb { \theta } ^ { \prime } ) , y ) , \quad \mathrm { s . t . } | | \pmb { x } ^ { a d v } - \pmb { x } | | _ { p } \leq \epsilon .
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
In this paper, we focus on non-targeted attacks. Our proposed methods can be easily transformed into targeted attacks by replacing the above objective function with $- J ( f ^ { \prime } ( x ^ { a d v } ; \pmb { \theta } ^ { \prime } ) , \mathbf { \bar { \psi } } ^ { * } )$ , where $y ^ { * }$ denotes the target label.
|
| 55 |
+
|
| 56 |
+

|
| 57 |
+
Figure 2: Illustration of training EM during each iteration.
|
| 58 |
+
|
| 59 |
+
Many gradient-based methods have been proposed to solve Eq. 1, e.g., FGSM (Goodfellow et al., 2014), I-FGSM (Kurakin et al., 2016), and PGD (Madry et al., 2017). However, the parameters $\pmb { \theta } ^ { \prime }$ of the target model $f ^ { \prime }$ is inaccessible for black-box attacks, resulting in the inability to solve Eq. 1 directly. Therefore, the target model $f ^ { \prime }$ is usually replaced with a model $f$ (i.e., the source model) with accessible parameters $\pmb \theta$ , and then adversarial examples are crafted on the source model $f$ to attack the target model $f ^ { \prime }$ . To achieve effective black-box attacks, adversarial examples crafted on the source model $f$ are required to have high transferability. Therefore, we propose Experienced Momentum (EM, detailed in Sec. 3.1) and Precise Nesterov momentum (PN, detailed in Sec. 3.2) to improve transferability. EM and PN can be naturally combined as Experienced Precise Nesterov momentum (EPN, detailed in Sec. 3.2) to further improve transferability.
|
| 60 |
+
|
| 61 |
+
# 3.1 EXPERIENCED MOMENTUM
|
| 62 |
+
|
| 63 |
+
Momentum-based attacks initialize momentum to zero, resulting in inefficient acceleration during the first few iterations. Therefore, we propose Experienced Momentum (EM), which is the pretrained momentum. Setting the initial momentum to EM can accelerate the optimization during the early iterations. To prevent overfitting of EM and improve transferability further, we train EM on a set of models derived by Random Channels Swapping (RCS). RCS derives models by randomly swapping the channels of the input image, which is equivalent to randomly swapping the “block” dimensions of the original model, leading to various decision boundaries of derived models. Therefore, training EM on derived models can prevent overfitting. The specific procedure for training EM is as follows.
|
| 64 |
+
|
| 65 |
+
First of all, we perform RCS on the input image $_ { \textbf { \em x } }$ . Specifically, we denote the input image $_ { \textbf { \em x } }$ as an RGB triplet $( R , G , B )$ , and then the input image $_ { \textbf { \em x } }$ through RCS can be denoted as $\bar { S } ( { \pmb x } )$ , where $S ( { \pmb x } ) \in \{ ( R , G , B ) , ( R , B , G ) , ( G , R , B ) , ( G , B , R ) , ( B , R , G ) , ( B , G , R ) \} .$ , $S ( \cdot )$ denotes RCS. Secondly, $S ( { \pmb x } )$ is fed into the source model $f$ to derive $f ( S ( \cdot ) , y )$ . Thirdly, we pre-perturb the input image $_ { \textbf { \em x } }$ on the derived model $f ( S ( \cdot ) , y )$ by iterative gradient-based attacks to prevent overfitting. As shown in Fig. 2, we accumulate gradients to training EM during each iteration. Finally, we follow the above procedure repeatedly to make the EM more generalizable. After training EM, we set the initial value of momentum to EM to accelerate the early iterations.
|
| 66 |
+
|
| 67 |
+
# 3.2 PRECISE NESTEROV MOMENTUM
|
| 68 |
+
|
| 69 |
+
Nesterov momentum based Attack (e.g., NI-FGSM (Lin et al., 2019) and VNI-FGSM (Wang & He, 2021)) only pre-update along the momentum roughly, resulting in the imprecision of the pre-update point that is the estimate of the next iterative position. Against this disadvantage, we propose Precise Nesterov momentum (PN), which considers the gradient of the current data point in the pre-update to make the pre-update precise. Specifically, during each iteration, the pre-update is performed along the gradient of the current data point and momentum successively to obtain the pre-update point, and then we use the gradient of the pre-update point to modify the pre-update. We integrate PN into I-FGSM as PNI-FGSM. The $t$ -th iteration of PNI-FGSM can be formalized as follows:
|
| 70 |
+
|
| 71 |
+
$$
|
| 72 |
+
\widetilde { \pmb x } _ { t } ^ { a d v } = \pmb x _ { t } ^ { a d v } + \alpha \cdot \left[ \frac { \nabla _ { \pmb x _ { t } ^ { a d v } } J ( f ( \pmb x _ { t } ^ { a d v } ; \pmb \theta ) , y ) } { | | \nabla _ { \pmb x _ { t } ^ { a d v } } J ( f ( \pmb x _ { t } ^ { a d v } ; \pmb \theta ) , y ) | | _ { 1 } } + \mu \cdot { \pmb g } _ { t - 1 } \right] ,
|
| 73 |
+
$$
|
| 74 |
+
|
| 75 |
+
Input : A source model $f$ with parameters $\pmb \theta$ and a loss function $J$ . An original image $_ { \textbf { \em x } }$ with ground-truth label $y$ . Input : The maximum perturbation $\epsilon$ , the number of iterations $T$ , and the decay factor $\mu$ . Input : The epochs of pretraining epochs. Output: An adversarial example $\bar { \boldsymbol { x } } ^ { a \bar { d } v }$ . 1 $\alpha \epsilon / T$ ; $\pmb { g } ^ { e x p } \mathbf { 0 }$ ; 2 for $n \gets 1$ to epochs do 3 $\hat { \pmb { x } } _ { 1 } ^ { a d v } { \pmb { x } }$ ; 4 for $t \gets 1$ to $T$ do 5 $\begin{array} { r l } & { \widetilde { x } _ { t } ^ { a d v } \gets \hat { x } _ { t } ^ { a d v } + \alpha \cdot \left[ \frac { \nabla _ { \hat { x } _ { t } ^ { a d v } } J ( f ( S ( \hat { x } _ { t } ^ { a d v } ) ; \pmb \theta ) , y ) } { | | \nabla _ { \hat { x } _ { t } ^ { a d v } } J ( f ( S ( \hat { x } _ { t } ^ { a d v } ) ; \pmb \theta ) , y ) | | _ { 1 } } + \mu \cdot g ^ { e x p } \right] ; } \\ & { g ^ { e x p } \gets \frac { \nabla _ { \hat { x } _ { t } ^ { a d v } } J ( f ( S ( \hat { x } _ { t } ^ { a d v } ) ; \pmb \theta ) , y ) } { | | \nabla _ { \hat { x } _ { t } ^ { a d v } } J ( f ( S ( \hat { x } _ { t } ^ { a d v } ) ; \pmb \theta ) , y ) | | _ { 1 } } + \mu \cdot g ^ { e x p } + \frac { \nabla _ { \widetilde { x } _ { t } ^ { a d v } } J ( f ( \widetilde { x } _ { t } ^ { a d v } ; \pmb \theta ) , y ) } { | | \nabla _ { \widetilde { x } _ { t } ^ { a d v } } J ( f ( \widetilde { x } _ { t } ^ { a d v } ; \pmb \theta ) , y ) | | _ { 1 } } ; } \\ & { \hat { x } _ { t + 1 } ^ { a d v } \gets \mathrm { C l i p } _ { ( \pmb { x } , \epsilon ) } \left\{ \hat { x } _ { t } ^ { a d v } + \alpha \cdot \mathrm { s i g n } ( g ^ { e x p } ) \right\} ; } \end{array}$ 6 7 8 end 9 end 10 ${ \pmb x } _ { 1 } ^ { a d v } { \pmb x } ; { \pmb g } _ { 0 } { \pmb g } ^ { e x p }$ ; 11 for $t \gets 1$ to $T$ do 12 Update $\mathbf { \nabla } _ { \mathbf { \boldsymbol { g } } _ { t } }$ and $\pmb { x } _ { t + 1 } ^ { a d v }$ by Eq. 2, 3, 4; 13 end 14 return ${ \pmb x } ^ { a d v } { \pmb x } _ { T + 1 } ^ { a d v }$ .
|
| 76 |
+
|
| 77 |
+
Algorithm 1: Experienced Precise Nesterov momentum I-FGSM (EPNI-FGSM)
|
| 78 |
+
Table 1: The abbreviations used in the paper.
|
| 79 |
+
|
| 80 |
+
<table><tr><td>Abbreviation</td><td>Explanation</td></tr><tr><td></td><td></td></tr><tr><td>D(T)I-MI-FGSM</td><td>the combination of D(T)IM and MI-FGSM</td></tr><tr><td>SI-NI-FGSM</td><td>the combination of SIMand NI-FGSM</td></tr><tr><td>D(T,S)I-EPNI-FGSM</td><td>the combination of D(T,S)IM and EPNI-FGSM</td></tr><tr><td>VT-M(N)I-FGSM</td><td>i.e., VM(N)I-FGSM</td></tr><tr><td>VT-EPNI-FGSM</td><td>the combination of Variance Tuning (VT)(Wang & He,2021) and EPNI-FGSM</td></tr><tr><td>FI-MI-FGSM FI-EPNI-FGSM</td><td>i.e., FIA</td></tr><tr><td></td><td>the combination of Feature Importance-aware (FI) (Wang et al.,2021) and EPNI-FGSM</td></tr></table>
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
g _ { t } = \frac { \nabla _ { x _ { t } ^ { a d v } } J ( f ( x _ { t } ^ { a d v } ; \pmb { \theta } ) , y ) } { | | \nabla _ { x _ { t } ^ { a d v } } J ( f ( x _ { t } ^ { a d v } ; \pmb { \theta } ) , y ) | | _ { 1 } } + \mu \cdot g _ { t - 1 } + \frac { \nabla _ { \widetilde { x } _ { t } ^ { a d v } } J ( f ( \widetilde { x } _ { t } ^ { a d v } ; \pmb { \theta } ) , y ) } { | | \nabla _ { \widetilde { x } _ { t } ^ { a d v } } J ( f ( \widetilde { x } _ { t } ^ { a d v } ; \pmb { \theta } ) , y ) | | _ { 1 } } ,
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
\begin{array} { r } { \pmb { x } _ { t + 1 } ^ { a d v } = \mathrm { C l i p } _ { ( \pmb { x } , \epsilon ) } \left\{ \pmb { x } _ { t } ^ { a d v } + \alpha \cdot \mathrm { s i g n } ( \pmb { g } _ { t } ) \right\} , } \end{array}
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
where $\mathbf { \nabla } _ { \mathbf { \boldsymbol { g } } _ { t } }$ denotes the momentum, ${ \bf { \mathit { g } } } _ { 0 } = { \bf { 0 } }$ , and $\mu$ denotes the decay factor.
|
| 91 |
+
|
| 92 |
+
We combine EM and PN as Experienced Precise Nesterov momentum (EPN) to further improve transferability. The algorithm of EPNI-FGSM, which integrates EPN into I-FGSM, is summarized in Algorithm 1. Particularly, if $\frac { \nabla _ { \widetilde { \pmb { x } } _ { t } ^ { a d v } } J ( f ( \widetilde { \pmb { x } } _ { t } ^ { a d v } ; \pmb { \theta } ) , y ) } { | | \nabla _ { \widetilde { \pmb { x } } _ { t } ^ { a d v } } J ( f ( \widetilde { \pmb { x } } _ { t } ^ { a d v } ; \pmb { \theta } ) , y ) | | _ { 1 } } = \mathbf { 0 }$ , EPNI-FGSM degrades to Experienced MI-FGSM (EMI-FGSM). If $\frac { \nabla _ { \hat { \pmb { x } } _ { t } ^ { a d v } } J ( f ( S ( \hat { \pmb { x } } _ { t } ^ { a d v } ) ; \pmb { \theta } ) , y ) } { | | \nabla _ { \hat { \pmb { x } } _ { t } ^ { a d v } } J ( f ( S ( \hat { \pmb { x } } _ { t } ^ { a d v } ) ; \pmb { \theta } ) , y ) | | _ { 1 } } = \mathbf { 0 }$ , EPNI-FGSM degrades to Experienced NI-FGSM (ENI-FGSM). If $e p o c h s = 0$ , EPNI-FGSM degrades to PNI-FGSM.
|
| 93 |
+
|
| 94 |
+
# 4 EXPERIMENTS
|
| 95 |
+
|
| 96 |
+
We conduct extensive experiments on normally trained and defense models to validate that our EPN is more efficient than conventional momentum. We first present the experimental settings in Sec. 4.1. Then, we report the results for attacking normally trained and defense models in Sec. 4.2 and
|
| 97 |
+
|
| 98 |
+
Table 2: The attack success rates $( \% )$ of adversarial examples crafted on source models against normally trained target models. “\*” indicates the model being white-box attacked. “Avg” means the average attack success rate.
|
| 99 |
+
|
| 100 |
+
<table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="6">Iv3</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>69.2 56.7</td><td>67.9</td><td>68.2</td><td>66.2</td><td>63.0</td><td>61.4</td><td>61.2</td><td></td></tr><tr><td>TI-MI-FGSM SI-NI-FGSM DI-EPNI-FGSM(Ours) TI-EPNI-FGSM(Ours)</td><td>41.8 77.4 88.7 70.6 90.2</td><td>99.7* 100.0* 100.0* 100.0* 100.0*</td><td>37.9 72.7 87.3 68.8 87.1</td><td>31.5 69.8 86.0 59.6</td><td>46.4 67.6 78.5 69.3</td><td>47.6 67.3 81.3 69.8</td><td>44.9 68.0 83.4 68.9</td><td>41.9 61.5 80.2 65.5 76.4</td><td>38.6 62.1 80.5 63.3</td><td>54.9 70.0 80.4 73.5</td><td>72.8 83.8 76.5</td><td>56.2 73.8 83.8 78.5</td><td>58.3 71.9 84.2 77.9</td><td>47.9 70.7 86.1 74.7</td><td>46.5 68.4 84.9 72.9</td><td>43.5 64.8 82.9 70.8</td><td>42.8 65.9 83.4 71.5</td><td>66.0 49.2 70.9 84.4 72.5</td></tr><tr><td>SI-EPNI-FGSM(Ours) VT-MI-FGSM VT-NI-FGSM</td><td>70.5 76.2</td><td>100.0* 100.0*</td><td>69.7 76.2</td><td>85.1 64.9 70.5</td><td>80.1 61.7 65.6</td><td>81.2 63.6 68.4</td><td>81.7 65.7 71.2</td><td>60.0 65.2</td><td>78.2 58.6 64.1</td><td>80.6 65.0 70.5</td><td>83.1 69.2 73.4</td><td>84.4 68.7 73.4</td><td>82.6 66.7 73.2</td><td>86.7 65.8 71.2</td><td>83.8 63.8 71.3</td><td>80.9 65.0 69.2</td><td>81.7 62.6 68.2</td><td>83.8 67.1 72.2</td></tr><tr><td>VT-EPNI-FGSM(Ours) FI-MI-FGSM FI-EPNI-FGSM(Ours)</td><td>84.8 85.8 90.0</td><td>100.0* 97.1* 97.4*</td><td>83.3 85.4 88.0</td><td>78.1 81.8 84.8</td><td>77.0 79.4 81.0</td><td>78.8 80.1 82.4</td><td>79.4 79.5 84.3</td><td>75.8 76.3 79.6</td><td>73.3 74.5 78.5</td><td>80.2 81.0 85.5</td><td>83.3 82.7 87.0</td><td>82.0 82.7 85.9</td><td>81.5 83.2 86.3</td><td>79.7 81.3 84.0</td><td>80.1 78.8 83.5</td><td>78.3 77.2 80.5</td><td>78.5 77.8 81.7</td><td>80.8 81.4</td></tr><tr><td>MI-FGSM NI-FGSM EPNI-FGSM(Ours)</td><td>46.4 49.0 68.1</td><td>44.0 45.6 65.3</td><td>45.4 48.5 68.4</td><td>99.6* 100.0* 100.0*</td><td>40.0 40.6 55.2</td><td>39.2 38.7 53.8</td><td>41.3 42.1 55.5</td><td>33.9 34.9 48.4</td><td>32.7 32.9 47.9</td><td>49.9 53.5 63.8</td><td>53.2 54.3 67.8</td><td>51.4 54.6 66.6</td><td>50.6 54.3 65.3</td><td>38.6 37.5 54.7</td><td>35.3 37.5 50.7</td><td>35.0 33.8 49.0</td><td>32.7 33.2 48.1</td><td>84.7 45.2 46.5 60.5</td></tr><tr><td>DI-MI-FGSM TI-MI-FGSM SI-NI-FGSM DI-EPNI-FGSM(Ours) TI-EPNI-FGSM(Ours) SI-EPNI-FGSM (Ours) VT-MI-FGSM</td><td>63.2 41.5 74.7 82.8 65.1</td><td>62.3 44.5 81.7 83.2 68.2</td><td>65.4 42.0 75.1 84.1 67.6</td><td>98.4* 97.9* 99.3* 100.0* 99.9* 100.0*</td><td>54.2 47.1 65.4 70.7 66.6</td><td>54.2 47.6 65.8 72.3 69.5</td><td>55.7 47.3 69.7 74.4 68.9</td><td>48.6 42.9 65.4 67.5 65.2</td><td>51.0 41.8 64.7 71.1 63.2</td><td>59.3 55.9 68.9 74.6 73.8</td><td>64.4 56.7 71.6 79.5 75.0</td><td>62.8 55.5 71.8 78.2 73.6</td><td>64.7 53.9 73.0 79.6 74.2</td><td>57.0 49.2 72.1 75.0 72.9</td><td>52.8 45.3 68.7 73.0 68.4</td><td>51.8 46.9 67.3 69.6 69.1</td><td>52.6 41.9 68.0 70.9 65.4</td><td>59.9 50.5 72.0 76.9 71.0</td></tr><tr><td></td><td>VT-NI-FGSM VT-EPNI-FGSM(Ours)</td><td>90.9 63.2 66.3 81.0</td><td>93.1 66.6 71.0 82.1</td><td>88.6 68.8 99.6* 73.1 99.8*</td><td>79.1 57.8 59.3</td><td>81.3 57.8 59.3</td><td>85.5 60.7 62.3 75.4</td><td>79.6 53.6 56.9 70.0</td><td>82.9 54.9 56.9 70.6</td><td>83.2 61.7 66.8 77.3</td><td>85.5 63.5 68.2 80.4</td><td>86.0 64.4 68.2 79.9</td><td>86.1 64.0 68.1</td><td>86.3 59.8 60.9</td><td>83.6 56.4 58.0 73.4</td><td>81.5 54.2 57.2</td><td>84.6 56.1 58.5</td><td>85.8 62.5 65.3</td></tr><tr><td></td><td>FI-MI-FGSM FI-EPNI-FGSM (Ours)</td><td>76.3 78.0</td><td>76.0 77.3</td><td>83.1 76.3 89.7* 78.0 91.0*</td><td>100.0* 71.7 67.5 69.8</td><td>72.4 68.0 69.9</td><td>69.7 72.2</td><td>66.8 68.9</td><td>65.5 67.4</td><td>72.5 73.5</td><td>73.7 74.0</td><td>73.4 74.5</td><td>78.7 73.5 73.6</td><td>77.3 70.7 71.7</td><td>68.3 69.0</td><td>72.0 66.8 66.9</td><td>71.9 67.0 67.2</td><td>77.5 71.9 73.1</td></tr><tr><td rowspan="5">R152</td><td>MI-FGSM NI-FGSM EPNI-FGSM(Ours)</td><td>68.9 75.7 91.5</td><td>59.4 64.1 85.8</td><td>53.8 58.0 79.2 74.2</td><td>49.4 81.0 51.7 86.0</td><td>83.3 87.7 94.8 96.2</td><td>92.1 94.7 98.7</td><td>94.5 96.9 99.4</td><td></td><td>100.0* 100.0* 100.0*</td><td>72.7 74.1 76.1 77.4 88.7 89.8</td><td>72.5 77.0 89.5</td><td></td><td>72.5 76.2 89.6</td><td>86.5 87.4 96.5</td><td>83.0 85.1 96.5</td><td>82.5 84.0 85.5 86.7 97.6 96.7</td><td></td><td>77.1 80.4 92.0</td></tr><tr><td>DI-MI-FGSM TI-MI-FGSM SI-NI-FGSM DI-EPNI-FGSM(Ours) TI-EPNI-FGSM(Ours) SI-EPNI-FGSM(Ours)</td><td>85.6 57.1 85.1 97.6 80.3</td><td>82.9 51.3 77.2 96.9 78.2</td><td>75.5 50.1 71.1 94.2 75.7</td><td>72.1 41.4 66.5 92.1</td><td>91.8 70.9 89.6 98.0 89.3</td><td>93.8 75.0 92.0 98.9 91.4</td><td>96.0 80.5 95.3 99.4 94.0</td><td>96.8 84.5 97.8 99.6 95.5</td><td>100.0* 100.0* 100.0* 100.0* 100.0*</td><td>84.0 65.4 82.1 94.3 81.7</td><td>84.4 65.0 83.0 94.6 81.2</td><td>85.5 64.1 81.9 94.7 80.8</td><td>84.6 64.0 81.9 95.2 81.5</td><td>93.7 75.1 93.6 99.4 91.8</td><td>94.0 71.5 91.8 99.3 89.2</td><td>93.7 70.7 92.4 99.6 91.0</td><td>94.4 68.1 91.8 99.1 89.7</td><td>88.8 67.9 86.7 97.2 85.8</td></tr><tr><td>VT-MI-FGSM VT-NI-FGSM VT-EPNI-FGSM(Ours)</td><td>95.3 83.8 87.7 95.4</td><td>91.4 79.6 81.9 92.1</td><td>88.2 74.1 78.9</td><td>66.8 84.8 70.9 74.4</td><td>96.7 92.2 93.5</td><td>97.6 93.7 94.9</td><td>98.6 96.4 98.2</td><td>99.0 97.5 98.7</td><td>100.0* 100.0* 100.0*</td><td>90.3 83.6 85.3</td><td>91.2 82.8 87.2</td><td>92.2 84.4 88.2</td><td>90.5 83.8 86.9</td><td>99.0 94.2 96.1</td><td>98.2 92.4 94.9</td><td>98.1 93.1 95.1</td><td>98.2 93.6 95.7</td><td>94.7 88.0 90.4</td></tr><tr><td>FI-MI-FGSM FI-EPNI-FGSM(Ours) MI-FGSM</td><td>93.3 95.4 78.0</td><td>88.6 93.2</td><td>89.7 88.7 93.1</td><td>86.9 85.1 90.1</td><td>97.9 95.5 96.8</td><td>98.8 96.8 97.9</td><td>99.5 97.5 98.3</td><td>99.8 98.9 98.9</td><td>100.0* 99.9* 100.0*</td><td>93.6 92.5 94.1</td><td>93.5 92.0 94.8</td><td>93.7 93.0 95.0</td><td>94.4 93.8 95.1</td><td>99.4 97.0 97.6</td><td>98.7 95.7 97.4</td><td>99.4 96.6 97.3</td><td>98.8 96.9 97.6</td><td>96.0 94.2 96.0</td></tr><tr><td>NI-FGSM EPNI-FGSM(Ours) DI-MI-FGSM TI-MI-FGSM SI-NI-FGSM V16</td><td>78.8 93.5 88.4 60.6</td><td>59.2 61.6 82.3 75.6 51.1</td><td>63.8 68.8 87.0 77.5</td><td>43.8 47.3 68.1 59.5</td><td>80.0 82.3 91.5 87.8</td><td>73.3 76.1 90.0 83.9</td><td>75.0 78.0 90.0 86.2</td><td>63.7 67.0 82.9 73.8 53.6</td><td>58.7 60.4 77.6 69.7 48.4</td><td>94.7 96.8 99.0 98.3</td><td>98.3 99.2 100.0 98.8</td><td>99.8* 99.9* 100.0* 100.0*</td><td>99.2 99.1 99.9 99.4</td><td>77.0 79.1 91.2 88.0</td><td>69.5 72.1 87.3 81.5</td><td>65.3 66.4 85.8 78.2</td><td>64.9 66.0 87.0 77.5</td><td>74.4 76.4</td><td>89.0 83.8 64.6</td></tr><tr><td>VT-MI-FGSM VT-NI-FGSM</td><td>DI-EPNI-FGSM(Ours) TI-EPNI-FGSM(Ours) SI-EPNI-FGSM(Ours)</td><td>89.8 96.2 82.5 96.1 87.5</td><td>77.5 90.6 74.6 89.1 75.2</td><td>48.5 80.7 62.5 92.6 81.9 77.4 58.1 91.8 80.0 77.9 61.9</td><td>33.4</td><td>71.2 89.1 95.9 88.4 93.6 89.9</td><td>65.4 84.8 94.1 84.2 91.2 86.1</td><td>60.3 85.9 93.5 82.7 92.5 86.8</td><td>77.1 88.6 75.9 86.4 78.3</td><td>73.0 85.5 70.4 84.8 74.1</td><td>88.1 98.5 99.8 96.8 99.4 97.7</td><td>92.9 99.6 99.9 98.2 100.0 98.9</td><td>99.8* 100.0* 100.0* 100.0* 100.0* 99.9*</td><td>94.4 100.0 100.0 98.1 100.0 99.4</td><td>64.9 87.8 95.6 86.4 95.6 87.8</td><td>58.0 81.9 93.1 80.7 92.6 82.2</td><td>54.8 78.9 93.0 78.8 91.0 81.3</td><td>52.4 80.2 91.4 77.4 92.2 80.6</td><td>85.1 93.6 83.0 92.7 85.0</td></tr><tr><td>VT-EPNI-FGSM(Ours) FI-MI-FGSM</td><td></td><td>89.8 95.6 95.9</td><td>76.9 88.4 89.1</td><td>80.7 65.6 92.4 81.1 93.1 79.7</td><td>92.1 96.1 95.6</td><td>87.5 94.4 94.9</td><td>89.3 94.0 93.4</td><td>81.1 90.4 90.4</td><td>76.1 88.8 87.1</td><td></td><td>98.7 99.4 99.6</td><td>99.5 99.9 99.8</td><td>99.9* 99.9* 100.0*</td><td>99.4 99.9 99.8</td><td>88.7 95.6 94.3</td><td>85.4 93.7 91.5</td><td>82.5 93.2 90.2</td><td>82.9 92.2 88.6</td><td>86.8 93.8 93.1</td></tr><tr><td>FI-EPNI-FGSM(Ours)</td><td></td><td>96.7</td><td>90.4</td><td>94.1 84.3</td><td>96.7</td><td>95.9</td><td></td><td>96.0</td><td>92.6</td><td>90.1</td><td>99.8</td><td>99.8</td><td>100.0*</td><td>99.9</td><td>96.4</td><td>94.3</td><td>93.3</td><td>93.0</td><td>94.9</td></tr></table>
|
| 101 |
+
|
| 102 |
+
Sec. 4.3, respectively. Finally, we provide ablation studies in Sec. 4.4. Table 1 introduces the abbreviations used in the paper.
|
| 103 |
+
|
| 104 |
+
# 4.1 EXPERIMENTAL SETTINGS
|
| 105 |
+
|
| 106 |
+
Dataset. We follow the previous works (Dong et al., 2019; Wang et al., 2021) to use the DEV dataset from the NIPS17 Adversarial Attacks and Defenses Competition. This dataset contains 1000 images with size $2 9 9 \times 2 9 9$ .
|
| 107 |
+
|
| 108 |
+
Target Models. Seventeen normally trained models, i.e., GoogLeNet (Iv1) (Szegedy et al., 2015), Inception-v3 (Iv3) (Szegedy et al., 2016), Inception-v4 (Iv4), Inception-ResNet-v2 (IRv2) (Szegedy et al., 2017), ResNet-18 (R18), ResNet-34 (R34), ResNet-50 (R50), ResNet-101 (R101), ResNet152 (R152) (He et al., 2016), VGG11 (V11), VGG13 (V13), VGG16 (V16), VGG19 (V19) (Simonyan & Zisserman, 2014), DenseNet-121 (D121), DenseNet-169 (D169), DenseNet-201 (D201), and DenseNet-161 (D161) (Huang et al., 2017). Ten defense models (i.e., adversarially trained models), i.e., Adv-Inception-v3 $( \mathrm { I v } 3 _ { \mathrm { a d v } } )$ , Ens-Inception-Resnet-v2 $( \mathrm { I R } \mathrm { v } 2 _ { \mathrm { e n s } }$ ) Tramer et al. (2017), \` Adv-EfficientNet-b0 $( \mathrm { E b 0 _ { a d v } ) }$ to Adv-EfficientNet-b7 $( \mathrm { E b } 7 _ { \mathrm { a d v } } ,$ ).
|
| 109 |
+
|
| 110 |
+
Baselines. For fair comparison of our EPN and conventional momentum, we replace conventional momentum with our EPN in momentum-based attacks, i.e., MI-FGSM (Dong et al., 2018), NI
|
| 111 |
+
|
| 112 |
+
Table 3: The attack success rates $( \% )$ of adversarial examples crafted on source models against defense models. “Avg” means the average attack success rate.
|
| 113 |
+
|
| 114 |
+
<table><tr><td>Models</td><td>Attacks</td><td>Iv3adv</td><td>IRv2ens</td><td>Eb0adv</td><td>Ebladv</td><td>Eb2adv</td><td>Eb3adv</td><td>Eb4adv</td><td>Eb5adv</td><td>Eb6adv</td><td>Eb7adv</td><td>Avg</td></tr><tr><td rowspan="9">Iv3</td><td>MI-FGSM NI-FGSM EPNI-FGSM(Ours) DI-MI-FGSM</td><td>25.4 25.4 32.4 33.0</td><td>11.5 11.6 14.3 19.3</td><td>29.7 34.3 49.0 46.6</td><td>26.5 31.0 45.0 42.9</td><td>28.1 31.2 45.4 42.4</td><td>18.8 22.2 31.1 31.3</td><td>16.9 18.6 23.9 27.4</td><td>17.5 18.6 25.7 26.7</td><td>14.8 16.0 22.4</td><td>15.2 16.5 22.3 24.4</td><td>20.4 22.5 31.2 31.7</td></tr><tr><td>TI-MI-FGSM SI-NI-FGSM DI-EPNI-FGSM(Ours) TI-EPNI-FGSM(Ours)</td><td>29.9 37.4 41.5 54.1</td><td>21.5 23.2 25.2 41.2</td><td>35.2 50.2 65.0 60.7</td><td>32.6 46.1 65.5 58.2</td><td>34.9 46.3 64.7 57.0</td><td>27.8 33.3 45.5 46.6</td><td>29.3 30.9 39.1 46.7</td><td>28.2 29.6 41.6 45.3</td><td>22.9 24.5 27.6 36.7 43.4</td><td>26.6 25.8 35.6 44.2</td><td>29.1 35.0 46.0 49.7</td></tr><tr><td>SI-EPNI-FGSM(Ours) VT-MI-FGSM VT-NI-FGSM</td><td>47.4 36.8 39.1</td><td>28.4 25.1 26.4</td><td>66.3 50.5 54.0</td><td>64.7 46.3 50.6</td><td>63.1 44.9 49.5</td><td>46.7 33.5 36.6</td><td>41.8 29.4 31.0</td><td>42.1 29.4 32.7</td><td>37.9 26.8 30.3</td><td>37.3 26.2 28.5</td><td>47.6 34.9 37.9</td></tr><tr><td>VT-EPNI-FGSM(Ours) FI-MI-FGSM FI-EPNI-FGSM(Ours)</td><td>43.1 55.3 58.9</td><td>26.5 38.0 39.9</td><td>63.2 68.2 76.2</td><td>61.8 67.8 73.3</td><td>60.6 64.9 72.7</td><td>46.9 53.6 61.1</td><td>41.1 50.0 56.0</td><td>39.7 49.3 55.6</td><td>38.2 46.6 52.9</td><td>36.8 45.1 50.5</td><td>45.8 53.9 59.7</td></tr><tr><td>MI-FGSM NI-FGSM EPNI-FGSM(Ours) DI-MI-FGSM</td><td>27.3 25.9 33.5 33.1</td><td>15.5 14.9 15.9 24.7</td><td>25.2 24.8 36.3</td><td>22.8 23.1 32.4</td><td>24.3 23.6 34.9</td><td>17.0 17.8 23.9 27.1</td><td>13.8 14.1 20.7 24.6</td><td>14.6 14.9 20.4 23.2</td><td>12.1 12.8 17.6 22.0</td><td>13.2 13.7 17.8 20.8</td><td>18.6 18.6 25.3 28.7</td></tr><tr><td>TI-MI-FGSM SI-NI-FGSM DI-EPNI-FGSM(Ours) TI-EPNI-FGSM(Ours) SI-EPNI-FGSM(Ours)</td><td>38.1 37.0 39.4 58.3 45.6</td><td>32.2 33.0 29.7 52.9 41.5</td><td>38.1 39.0 50.8 57.4 60.5 68.9</td><td>35.8 36.7 48.2 52.4 58.3</td><td>37.9 39.4 46.9 53.4 56.6 66.8</td><td>30.2 35.7 41.0 49.7 50.2</td><td>33.8 32.0 33.6 50.9 42.6</td><td>31.4 28.7 33.3 47.0 43.5</td><td>29.2 26.9 30.2 48.0 39.7</td><td>29.7 27.5 30.6 46.5 40.1</td><td>34.0 36.7 40.1 52.9 50.3</td></tr><tr><td>VT-MI-FGSM VT-NI-FGSM VT-EPNI-FGSM(Ours) FI-MI-FGSM</td><td>38.8 40.5 48.2</td><td>36.4 34.8 36.6</td><td>42.3 44.6 59.5</td><td>64.3 38.9 41.1 55.3</td><td>41.2 43.4 54.1</td><td>31.2 33.1 43.0</td><td>28.4 28.2 38.8</td><td>26.4 26.6 38.0</td><td>25.4 25.8 36.9</td><td>25.4 26.2 35.3</td><td>33.4 34.4 44.6 46.7</td></tr><tr><td>FI-EPNI-FGSM(Ours) MI-FGSM NI-FGSM EPNI-FGSM(Ours)</td><td>54.5 53.3 36.5 40.1</td><td>40.1 47.1 27.8 29.4</td><td>57.4 59.6 46.6 49.8</td><td>56.7 56.8 43.6 47.3</td><td>56.3 57.9 47.3 47.8</td><td>45.7 47.0 30.9 33.2</td><td>40.9 43.3 27.3 29.1</td><td>39.7 42.1 26.5 27.7</td><td>38.2 40.6 22.0 25.2</td><td>37.4 38.6 24.8 25.4</td><td>48.6 33.3 35.5</td></tr><tr><td>DI-MI-FGSM TI-MI-FGSM SI-NI-FGSM R152</td><td>53.1 57.6 46.8 51.7 DI-EPNI-FGSM(Ours) 78.3</td><td>43.1 51.7 41.1 43.4 73.1</td><td>71.9 72.6 50.7 62.8 91.6</td><td>68.1 68.3 46.4 57.3 89.9</td><td>70.5 71.2 50.1 61.2 90.6</td><td>50.2 54.7 41.8 43.4 75.7</td><td>41.0 47.1 43.2 39.3 67.3</td><td></td><td>41.0 37.5 44.7 44.2 41.0 36.2 36.0 35.4 64.9 62.6</td><td>40.2 44.3 38.7 33.8 64.3</td><td>51.7 55.6 43.6 46.4 75.8</td></tr><tr><td>VT-MI-FGSM VT-NI-FGSM FI-MI-FGSM</td><td>TI-EPNI-FGSM(Ours) SI-EPNI-FGSM(Ours) VT-EPNI-FGSM(Ours)</td><td>72.2 67.4 67.5 59.3 59.1 52.6 61.6 55.5 72.6 71.6</td><td>74.7 79.4 69.6 73.6 86.2</td><td>70.1 78.5 64.9 68.2 85.3</td><td></td><td>74.2 81.1 69.3 72.1 88.4</td><td>62.9 61.8 55.1 56.1 74.1</td><td>62.7 53.7 48.8 50.6 66.0</td><td>60.7 51.5 46.1 48.7 64.8</td><td>59.3 58.3 48.8 50.3 43.6 44.6 45.5 47.9 62.2 65.1</td><td></td><td>66.3 63.2 55.4 58.0 73.6</td></tr><tr><td>TI-MI-FGSM V16</td><td>FI-EPNI-FGSM(Ours) MI-FGSM NI-FGSM EPNI-FGSM(Ours) DI-MI-FGSM</td><td>81.0 33.0 33.0 46.7 44.9</td><td>73.3 20.3 22.5 29.0 31.6</td><td>88.5 48.8 49.5 71.2 62.4</td><td>87.0 41.8 43.6 65.7 55.9</td><td>82.6 88.6 41.3 44.3 63.5 56.9</td><td>76.3 25.1 27.7 41.5 37.5</td><td>70.9 21.5 22.2 31.3 32.0</td><td>70.1 21.7 22.7 31.5 30.9</td><td>66.4 19.0 18.9 28.5 27.8</td><td>66.4 21.8 20.1 28.7 28.1</td><td>76.9 29.4 30.5 43.8 40.8</td></tr><tr><td></td><td>SI-NI-FGSM DI-EPNI-FGSM(Ours) TI-EPNI-FGSM(Ours) SI-EPNI-FGSM(Ours) VT-MI-FGSM VT-NI-FGSM</td><td>38.9 50.0 61.2 61.8 62.8 49.4 49.3</td><td>29.4 33.5 44.7 49.9 42.6 35.4 37.5</td><td>44.3 61.4 80.3 68.6 78.6 65.3</td><td>38.0 56.4 77.9 65.2 75.4 58.7</td><td>41.4 54.4 78.2 63.7 74.3 58.6</td><td>31.1 36.5 52.2 49.2 48.1 39.7</td><td>32.0 29.9 43.5 50.3 40.6 34.3</td><td>31.5 30.0 42.6 47.7 41.9 33.6</td><td>28.5 27.2 40.2 47.6 37.9 29.2</td><td>28.2 26.4 38.8 46.1 35.5 32.2</td><td>34.3 40.6 56.0 55.0 53.8</td></tr></table>
|
| 115 |
+
|
| 116 |
+
FGSM (Lin et al., 2019), DI-MI-FGSM (Xie et al., 2019), TI-MI-FGSM (Dong et al., 2019), SI-NIFGSM (Lin et al., 2019), VT-MI-FGSM (Wang & He, 2021), VT-NI-FGSM (Wang & He, 2021) and FI-MI-FGSM (Wang et al., 2021). Then we compare the transferability of conventional momentumbased attacks and our EPN-based attacks.
|
| 117 |
+
|
| 118 |
+
Hyperparameters. In all experiments, we follow the official default settings for hyperparameters. Specifically, the maximum perturbation $\epsilon = 1 6$ , the number of iterations $T = 1 0$ , the step size $\alpha = \epsilon / T = 1 . 6$ , and the decay factor $\mu = 1 . 0$ . For DIM (Xie et al., 2019), the probability $p$ is set to 0.5. For TIM (Dong et al., 2019), the size of the Gaussian kernel is set to $1 5 { \times } 1 5$ . For SIM (Lin et al., 2019), the number of scale copies $m$ is set to 5. For VT-MI-FGSM (Wang & He, 2021) and VT-NIFGSM (Wang & He, 2021), the number of sampled examples $N$ is set to 20, and the parameter $\beta$ for the upper bound of the neighborhood is set to 1.5. For FI-MI-FGSM (Wang et al., 2021), the drop probability $p _ { d }$ is set to 0.3 when attacking normally trained models and 0.1 when attacking defense models, the ensemble number $N$ is set to 30 in aggregate gradient, and the intermediate layer is set to Mixed ${ } _ { 5 b }$ for Iv3, Conv 4a for IRv2, Conv3 3 for V16 as well as the last layer of the second block for R152. For our EM-based attacks, epochs is set to 5.
|
| 119 |
+
|
| 120 |
+

|
| 121 |
+
Figure 3: The average attack success rates $( \% )$ of the adversarial examples crafted on source models against normally trained models (except the source model) and defense models for various $\mu$ .
|
| 122 |
+
|
| 123 |
+

|
| 124 |
+
Figure 4: The average attack success rates $( \% )$ of the adversarial examples crafted on source models against normally trained models (except the source model) and defense models for various epochs.
|
| 125 |
+
|
| 126 |
+
# 4.2 ATTACK NORMALLY TRAINED MODELS
|
| 127 |
+
|
| 128 |
+
To validate that EPN-based attacks have higher transferability than conventional momentum-based attacks, we choose Iv3, IRv2, R152, and V16 as the source model, respectively, and attack normally trained target models via our EPN-based methods and baseline methods. The attack success rates are shown in Table 2. The results show that the attack success rates of our EPN-based methods are ${ \sim } 1 1 . 9 \%$ higher than baseline methods on average, In particular, our EPN-based attacks have the best transferability against normally trained target models when the source model is R152. Specifically, the attack success rates of EPNI-FGSM, DI-EPNI-FGSM, VT-EPNI-FGSM, and FI-EPNI-FGSM are $9 2 . 0 \%$ , $9 7 . 2 \%$ , $9 6 . 0 \%$ , and $9 6 . 0 \%$ , respectively, on average. Therefore, the experiments demonstrate that our EPN improves transferability more effectively than conventional momentum against normally trained models.
|
| 129 |
+
|
| 130 |
+
# 4.3 ATTACK DEFENSE MODELS
|
| 131 |
+
|
| 132 |
+
To further compare the transferability, we also use defense models as the target models, and the source models are still Iv3, IRv2, R152, and V16. We craft adversarial examples on the source model via our EPN-based methods and baseline methods to attack defense models. The attack success rates are shown in Table 3. The results show that the attack success rates of our EPNbased methods are ${ \sim } 1 3 . 1 \%$ higher than baseline methods on average. Adversarial examples crafted on R152 still show the best transferability against defense models. Specifically, the attack success rates of EPNI-FGSM, DI-EPNI-FGSM, VT-EPNI-FGSM, and FI-EPNI-FGSM are $5 1 . 7 \%$ , $7 5 . 8 \%$ , $7 3 . 6 \%$ , and $7 6 . 9 \%$ , respectively, on average. The results of experiments indicate that our EPN is still more effective than conventional momentum against defense models.
|
| 133 |
+
|
| 134 |
+
# 4.4 ABLATION STUDY
|
| 135 |
+
|
| 136 |
+
We conduct ablation studies for EPNI-FGSM. We investigate the impacts of two hyperparameters (i.e., the decay factor $\mu$ and the epochs of pretraining epochs) on the transferability of EPNI-FGSM in Sec. 4.4.1. We further study the impacts of EM and PN on transferability in Sec. 4.4.2.
|
| 137 |
+
|
| 138 |
+
# 4.4.1 IMPACTS OF $\mu$ AND epochs
|
| 139 |
+
|
| 140 |
+
The source models are set to Iv3, IRv2, R152, and V16. We use EPNI-FGSM to craft adversarial examples to attack normally trained models and defense models, respectively. We investigate the impacts of $\mu$ and epochs on the transferability of EPNI-FGSM by counting the average attack success rates against normally trained models (except the source model) and defense models.
|
| 141 |
+
|
| 142 |
+
The decay factor $\mu .$ . The decay factor $\mu$ plays a vital role for momentum. If $\mu = 0$ , the momentumbased attacks degrade to vanilla iterative gradient-based attacks. If $0 < \mu < 1$ , the previous gradients accumulated in the momentum decay exponentially. If $\mu = 1$ , the momentum simply adds up all previous gradients. If $\mu > 1$ , the previous gradients accumulated in the momentum grow exponentially. We pre-set epoch $s = 5$ and set $\mu$ from 0.0 to 2.0 with a step size of 0.1. The average attack success rates are shown in Fig. 3. When $\mu \leq 1 . 0$ , the average attack success rates show an upward trend, and when $\mu \geq 1 . 0$ , the average attack success rates show a downward trend. Therefore, we set $\mu = 1 . 0$ for EPNI-FGSM to achieve the best transferability.
|
| 143 |
+
|
| 144 |
+

|
| 145 |
+
Figure 5: The average attack success rates $( \% )$ of the adversarial examples crafted on source models against normally trained models and defense models via NI-FGSM, ENI-FGSM, PNI-FGSM, and EPNI-FGSM.
|
| 146 |
+
|
| 147 |
+
The epochs of pretraining epochs. epochs affects the amount of gradient accumulated in EM. We pre-set $\mu = 1 . 0$ and set epochs from 0 to 10 with a step size of 1. The average attack success rates are shown in Fig. 4. As epochs increases, the average attack success rates increase and gradually converge. Since the larger epochs, the higher the computational cost, we set epochs $= 5$ for EPNIFGSM to strike a balance between computational cost and transferability.
|
| 148 |
+
|
| 149 |
+
In summary, we set the decay factor $\mu = 1 . 0$ and the epochs of pretraining epochs $= 5$ for EPNIFGSM. Similarly, such two hyperparameters of other EPN-based attacks have the same settings as EPNI-FGSM.
|
| 150 |
+
|
| 151 |
+
# 4.4.2 IMPACTS OF EM AND PN
|
| 152 |
+
|
| 153 |
+
The source models are the same as in Sec 4.4.1. To investigate the impacts of EM and PN, we craft adversarial examples on source models via ENI-FGSM (only with EM), PNI-FGSM (only with PN), and EPNI-FGSM (with EM and PN), respectively. In addition, we also use MI-FGSM and NI-FGSM (without EM and PN) as baselines. For ENI-FGSM, the epochs of pretraining epochs is set to 5. For ENI-FGSM and PNI-FGSM, the decay factor $\mu$ is set to 1.0. The average attack success rates of the adversarial examples against normally trained models and defense models are shown in Fig. 5. The average attack success rates of ENI-FGSM are higher than MI-FGSM and NIFGSM, demonstrating that EM improves transferability more than conventional momentum. The same is true for PN. Besides, the average attack success rates of EPNI-FGSM are higher than that of ENI-FGSM and PNI-FGSM, demonstrating that the combination of EM and PN can further improve transferability.
|
| 154 |
+
|
| 155 |
+
# 5 CONCLUSION
|
| 156 |
+
|
| 157 |
+
In this work, we proposed Experienced Momentum (EM) and Precise Nesterov momentum (PN) to boost transferability. Specifically, EM is trained on a set of derived models by Random Channels Swapping (RCS), and then conventional momentum is initialized to EM, which can accelerate optimization to escape from saddle points and poor local extrema during early iterations to improve transferability. Additionally, we adopted the current gradient to refine the pre-update of conventional Nesterov momentum, called PN. Then, we naturally combined EM and PN as EPN to improve transferability further. Extensive experiments demonstrate that EPN-based attacks have higher transferability than conventional momentum-based attacks. However, our methods still adopt a fixed learning rate or step size that is crucial for the optimizer. Therefore, we will explore the impact of learning rate or step size on transferability in future work.
|
| 158 |
+
|
| 159 |
+
# REFERENCES
|
| 160 |
+
|
| 161 |
+
Ayelet Akselrod-Ballin, Leonid Karlinsky, Sharon Alpert, Sharbell Hasoul, Rami Ben-Ari, and Ella Barkan. A region based convolutional network for tumor detection and classification in breast mammography. In Deep learning and data labeling for medical applications, pp. 197–205. Springer, 2016.
|
| 162 |
+
|
| 163 |
+
Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In 2017 ieee symposium on security and privacy (sp), pp. 39–57. IEEE, 2017.
|
| 164 |
+
|
| 165 |
+
Grigorios G Chrysos, Stylianos Moschoglou, Giorgos Bouritsas, Yannis Panagakis, Jiankang Deng, and Stefanos Zafeiriou. P-nets: Deep polynomial neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7325–7335, 2020.
|
| 166 |
+
|
| 167 |
+
Marco Cococcioni, Emanuele Ruffaldi, and Sergio Saponara. Exploiting posit arithmetic for deep neural networks in autonomous driving applications. In 2018 International Conference of Electrical and Electronic Technologies for Automotive, pp. 1–6. IEEE, 2018.
|
| 168 |
+
|
| 169 |
+
Jia Ding, Aoxue Li, Zhiqiang Hu, and Liwei Wang. Accurate pulmonary nodule detection in computed tomography images using deep convolutional neural networks. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 559–567. Springer, 2017.
|
| 170 |
+
|
| 171 |
+
Yinpeng Dong, Fangzhou Liao, Tianyu Pang, Hang Su, Jun Zhu, Xiaolin Hu, and Jianguo Li. Boosting adversarial attacks with momentum. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 9185–9193, 2018.
|
| 172 |
+
|
| 173 |
+
Yinpeng Dong, Tianyu Pang, Hang Su, and Jun Zhu. Evading defenses to transferable adversarial examples by translation-invariant attacks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4312–4321, 2019.
|
| 174 |
+
|
| 175 |
+
Gianni Franchi, Xuanlong Yu, Andrei Bursuc, Remi Kazmierczak, S ´ everine Dubuisson, Emanuel ´ Aldea, and David Filliat. Muad: Multiple uncertainties for autonomous driving benchmark for multiple uncertainty types and tasks. arXiv preprint arXiv:2203.01437, 2022.
|
| 176 |
+
|
| 177 |
+
Aditya Ganeshan, Vivek BS, and R Venkatesh Babu. Fda: Feature disruptive attack. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 8069–8079, 2019.
|
| 178 |
+
|
| 179 |
+
Veta Ghenescu, Roxana Elena Mihaescu, Serban-Vasile Carata, Marian Traian Ghenescu, Eduard Barnoviciu, and Mihai Chindea. Face detection and recognition based on general purpose dnn object detector. In 2018 International Symposium on Electronics and Telecommunications (ISETC), pp. 1–4. IEEE, 2018.
|
| 180 |
+
|
| 181 |
+
Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
|
| 182 |
+
|
| 183 |
+
Cong Hao, Yao Chen, Xinheng Liu, Atif Sarwari, Daryl Sew, Ashutosh Dhar, Bryan Wu, Dongdong Fu, Jinjun Xiong, Wen-mei Hwu, et al. Nais: Neural architecture and implementation search and its applications in autonomous driving. In 2019 IEEE/ACM International Conference on Computer-Aided Design (ICCAD), pp. 1–8. IEEE, 2019.
|
| 184 |
+
|
| 185 |
+
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.
|
| 186 |
+
|
| 187 |
+
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.
|
| 188 |
+
|
| 189 |
+
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.
|
| 190 |
+
|
| 191 |
+
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25, 2012.
|
| 192 |
+
|
| 193 |
+
Alexey Kurakin, Ian Goodfellow, Samy Bengio, et al. Adversarial examples in the physical world, 2016.
|
| 194 |
+
|
| 195 |
+
Jiadong Lin, Chuanbiao Song, Kun He, Liwei Wang, and John E Hopcroft. Nesterov accelerated gradient and scale invariance for adversarial attacks. arXiv preprint arXiv:1908.06281, 2019.
|
| 196 |
+
|
| 197 |
+
Tianjiao Liu, Qianqian Guo, Chunfeng Lian, Xuhua Ren, Shujun Liang, Jing Yu, Lijuan Niu, Weidong Sun, and Dinggang Shen. Automated detection and classification of thyroid nodules in ultrasound images using clinical-knowledge-guided convolutional neural networks. Medical image analysis, 58:101555, 2019.
|
| 198 |
+
|
| 199 |
+
Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. arXiv preprint arXiv:1706.06083, 2017.
|
| 200 |
+
|
| 201 |
+
Muzammal Naseer, Salman H Khan, Shafin Rahman, and Fatih Porikli. Task-generalizable adversarial attack based on perceptual metric. arXiv preprint arXiv:1811.09020, 2018.
|
| 202 |
+
|
| 203 |
+
Yurii Nesterov. A method for unconstrained convex minimization problem with the rate of convergence $\mathbf { o } ( ^ { 1 } / k ^ { 2 } )$ . 1983.
|
| 204 |
+
|
| 205 |
+
Boris T Polyak. Some methods of speeding up the convergence of iteration methods. Ussr computational mathematics and mathematical physics, 4(5):1–17, 1964.
|
| 206 |
+
|
| 207 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
|
| 208 |
+
|
| 209 |
+
Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
|
| 210 |
+
|
| 211 |
+
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, pp. 1–9, 2015.
|
| 212 |
+
|
| 213 |
+
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2818–2826, 2016.
|
| 214 |
+
|
| 215 |
+
Christian Szegedy, Sergey Ioffe, Vincent Vanhoucke, and Alexander A Alemi. Inception-v4, inception-resnet and the impact of residual connections on learning. In Thirty-first AAAI conference on artificial intelligence, 2017.
|
| 216 |
+
|
| 217 |
+
Florian Tramer, Alexey Kurakin, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick Mc-\` Daniel. Ensemble adversarial training: Attacks and defenses. arXiv preprint arXiv:1705.07204, 2017.
|
| 218 |
+
|
| 219 |
+
Xiaosen Wang and Kun He. Enhancing the transferability of adversarial attacks through variance tuning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1924–1933, 2021.
|
| 220 |
+
|
| 221 |
+
Zhibo Wang, Hengchang Guo, Zhifei Zhang, Wenxin Liu, Zhan Qin, and Kui Ren. Feature importance-aware transferable adversarial attacks. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 7639–7648, 2021.
|
| 222 |
+
|
| 223 |
+
Cihang Xie, Zhishuai Zhang, Yuyin Zhou, Song Bai, Jianyu Wang, Zhou Ren, and Alan L Yuille. Improving transferability of adversarial examples with input diversity. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2730–2739, 2019.
|
md/dev/NiEtU7blzN/NiEtU7blzN.md
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LARGE LANGUAGE MODELS CAN SELF-IMPROVE
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
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 “high-confidence” rationale-augmented answers for unlabeled questions using Chain-of-Thought prompting and self-consistency, and fine-tune the LLM using those self-generated solutions as target outputs. We show that our approach improves the general reasoning ability of a 540B-parameter LLM $7 4 . 4 \% 8 2 . 1 \%$ on GSM8K, $7 8 . 2 \% 8 3 . 0 \%$ on DROP, $9 0 . 0 \% 9 4 . 4 \%$ on OpenBookQA, and $6 3 . 4 \% 6 7 . 9 \%$ on ANLI-A3) and achieves state-of-the-art-level performance, without any ground truth label. We conduct ablation studies and show that finetuning on reasoning is critical for self-improvement.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
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., 2022a): 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., 2022b; Kojima et al., 2022) demonstrates strong reasoning ability of LLMs across diverse tasks with or without few-shot examples; self-consistency (Wang et al., 2022b) further improves the performance via self-evaluating multiple reasoning paths.
|
| 12 |
+
|
| 13 |
+
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. While significant efforts were committed on collecting high-quality supervised datasets, human brain, on the contrary, is capable of the metacognition process (Dunlosky & Metcalfe, 2008), where we can refine our own reasoning ability without external inputs.
|
| 14 |
+
|
| 15 |
+
In this paper, we study how an LLM capable of in-context few-shot learning and chain-of-thought 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-ofThought (CoT) (Wei et al., 2022b) as prompts, filter “high-confidence” predictions using majority voting (Wang et al., 2022b), 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 LLM, where our method not only improves training task performances $( 7 4 . 4 \% 8 2 . 1 \%$ on GSM8K, $7 8 . 2 \% 8 3 . 0 \%$ on DROP, $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) test tasks (AQUA, StrategyQA, MNLI), achieving state-of-the-art performances in many tasks without relying on supervised ground truth answers. Lastly, we conduct preliminary studies on self-generating additional input questions and few-shot CoT prompts, which could further reduce the amount of human effort required for model self-improving, and ablation studies on important hyperparameters of our approach. We hope our simple approach and strong empirical results could encourage more future work by the community to investigate optimal performances of pretrained LLMs without additional human supervision.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Overview of our method. With Chain-of-Thought (CoT) examples as demonstration (Wei et al., 2022b), 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., 2022b). The “high-confidence” CoT reasoning paths that lead to the majority answer are augmented by mixed formats as the final training samples to be fed back to the model for fine-tuning.
|
| 19 |
+
|
| 20 |
+
Our contributions are summarized as follows:
|
| 21 |
+
|
| 22 |
+
• We demonstrate that a large language model can self-improve by taking datasets without ground truth outputs, by leveraging CoT reasoning (Wei et al., 2022b) and selfconsistency (Wang et al., 2022b), achieving competitive in-domain multi-task performances as well as out-of-domain generalization. We achieve state-of-the-art-level results on ARC, OpenBookQA, and ANLI datasets.
|
| 23 |
+
• We provide detailed ablation studies on training sample formatting and sampling temperature after fine-tuning, and identify critical design choices for most successful selfimprovement by LLMs.
|
| 24 |
+
• We study two other approaches for self-improvements, where the model generates additional questions from finite input questions and generates few-shot CoT prompt templates itself. The latter achieves $7 4 . 2 \%$ on GSM8K, which is the state-of-the-art zero-shot performance, against $4 3 . 0 \%$ by Kojima et al. (2022) or $7 0 . 1 \%$ through its naive extension with Wang et al. (2022b).
|
| 25 |
+
|
| 26 |
+
# 2 RELATED WORK
|
| 27 |
+
|
| 28 |
+
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., 2017b; 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). 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.
|
| 29 |
+
|
| 30 |
+
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.
|
| 31 |
+
|
| 32 |
+
(2022b) 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. Wang et al. (2022b) improve Chain-of-Thought prompting by sampling multiple diverse reasoning paths and finding the most consistent answers via majority voting. Kojima 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. (2022a) further decompose the questions into multiple sub-questions, and ask the language model to solve each sub-question sequentially.
|
| 33 |
+
|
| 34 |
+
Refining explanations. More recent work proposes to further refine the generated reasoning paths as some of them could be unreliable. For example, Ye & 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. (2022b) 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. 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 self-improvement, and could readily incorporate these other refinement techniques for generating higher-quality self-training data. Our work is similar 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.
|
| 35 |
+
|
| 36 |
+
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.
|
| 37 |
+
|
| 38 |
+
Distillation and dark knowledge. Our method also tangentially relates to rich literature on distillation (Ba & Caruana, 2014; Hinton et al., 2015). 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., 2022b; Kojima et al., 2022). In our work, we explicitly show that imperfect CoT reasoning (which may lead to incorrect answer) can be used directly for self-improving language models as evidenced in our experiments in Sections 5.2 and 5.3.
|
| 39 |
+
|
| 40 |
+
# 3 METHOD
|
| 41 |
+
|
| 42 |
+
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 training dataset $\mathcal { D } ^ { \mathrm { t r a i n } } = \{ x _ { i } \} _ { i = 1 } ^ { \hat { D } }$ with few-shot Chain-ofThought (CoT) examples (Wei et al., 2022b). 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 $\mathcal { D } ^ { \tt t r a i n }$ , and use majority voting (self-consistency) to select the most consistent, highest confidence answer (Wang et al., 2022b). 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 self-improve without supervised data.
|
| 43 |
+
|
| 44 |
+
# .1 GENERATING AND FILTERING MULTIPLE REASONING PATHS
|
| 45 |
+
|
| 46 |
+
Self-consistency (Wang et al., 2022b) 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.
|
| 47 |
+
|
| 48 |
+
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?
|
| 49 |
+
|
| 50 |
+
# Multiple Path Decoding:
|
| 51 |
+
|
| 52 |
+
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.
|
| 53 |
+
|
| 54 |
+
Output 2: The appetizer costs $\$ 10$ and the entrees are $\$ 20$ each. There are 4 entrees so the sum is $\$ 20 *4=980$ . The waiter gets $20 \%$ of the total. $20 \%$ of $\$ 80$ is $\$ 80 ^ { * }$ . $2 = \$ 16$ . The answer is $\$ 80$ $+ \$ 16= \$ 96$ . (Incorrect reasoning path)
|
| 55 |
+
|
| 56 |
+
Output 3: The appetizer costs $\$ 10$ . The entrees cost $4 * \ S 2 0 = \ S 8 0$ . The tip is $20 \%$ of the total, so it is $20 \%$ of the $\$ 90$ they have spent. The tip is $0 . 2 * 9 0 = \mathbb { S } 1 8$ . The total they spent is $\$ 90+\$ 18$ $= \$ 108$ . The answer is 108.
|
| 57 |
+
|
| 58 |
+
Table 1: Examples of 3 self-generated CoT reasoning paths given a question. Output 1 and 3 are the most consistent reasoning paths based on majority voting and kept as self-training data.
|
| 59 |
+
|
| 60 |
+
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). Since $M$ is prompted with the CoT examples from Wei et al. (2022b), we apply the same output parsing with “The answer is” to generate their predicted answers $\left\{ y _ { i _ { 1 } } , y _ { i _ { 2 } } , \ldots , y _ { i _ { m } } \right\}$ . The most consistent answer, which is not necessarily a correct answer, { 1 2 m }is selected by majority voting, denoted as y˜i = arg maxyij $\begin{array} { r } { \tilde { y } _ { i } = \arg \operatorname* { m a x } _ { y _ { i _ { j } } } \sum _ { k = 1 } ^ { m } \mathbb { I } ( y _ { i _ { j } } = y _ { i _ { k } } ) } \end{array}$ Pmk=1 I(yij = yik ). 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, denoted as $\mathcal { D } ^ { \mathsf { s e l f - c o n s i s t e n t } } = \{ x _ { i } , \tilde { r _ { i } } \}$ , where $\tilde { r _ { i } } = \{ r _ { i _ { j } } | 1 \leq j \leq m , \bar { y } _ { i _ { j } } = \tilde { y } _ { i } \}$ .
|
| 61 |
+
|
| 62 |
+
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 self-generated 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.
|
| 63 |
+
|
| 64 |
+

|
| 65 |
+
Figure 2: The relation of accuracy and confidence of the majorityvoted answer after multiple path decoding on GSM8K training-set questions. Predicted confidence from selfconsistency (Wang et al., 2022b) is well calibrated (Guo et al., 2017).
|
| 66 |
+
|
| 67 |
+
# 3.2 TRAINING WITH MIXED FORMATS
|
| 68 |
+
|
| 69 |
+
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 Table 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$ .
|
| 70 |
+
|
| 71 |
+
<table><tr><td>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.</td></tr><tr><td>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</td></tr><tr><td>is (8 + 10)/2=9 years old. The answer is 9. Format 2: Input: [Standard prompting examples] +‘\n'+ [Question] +‘\n’ +‘A:'</td></tr><tr><td>Output: The answer is 9. Format 3: Input: [Question] +‘\n’ +‘A: Let's think step by step.'</td></tr><tr><td>Output: Amy is 10 years old. Jake is 8 years old. Alex's age is in the middle of Amy and Jake,so Alex</td></tr><tr><td></td></tr><tr><td>is (8 + 10)/2=9 years old. The answer is 9.</td></tr><tr><td>Format 4: Input: [Question] +‘\n’ +‘A:' Output: The answer is 9.</td></tr></table>
|
| 72 |
+
|
| 73 |
+
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.
|
| 74 |
+
|
| 75 |
+
# 3.3 GENERATING QUESTIONS AND PROMPTS
|
| 76 |
+
|
| 77 |
+
Given a set of training questions and a few human-written Chain-of-Thought (CoT) examples as prompts, our proposed approach enables model self-improvement. However, when the amount of training questions or CoT examples is limited, our method may not generate sufficient training samples for language model self-training. Collecting questions from the web requires human engineering. To further reduce human effort, we investigate how to self-generate more training questions as well as example prompts.
|
| 78 |
+
|
| 79 |
+
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 ground truth answers) for in-domain questions. Specifically, we randomly select several existing questions, concatenate them 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 selfconsistency (Wang et al., 2022b) to only keep the questions that have a highly confident answer. Those questions are then used as self-generated training questions.
|
| 80 |
+
|
| 81 |
+
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.
|
| 82 |
+
|
| 83 |
+
# 4 EXPERIMENTAL SETUP
|
| 84 |
+
|
| 85 |
+
Tasks and Datasets. We demonstrate the effectiveness of our method on three types of tasks1:
|
| 86 |
+
|
| 87 |
+
• 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. (2022a) to partition the DROP dataset into football related and non-football related subsets for training.
|
| 88 |
+
|
| 89 |
+
• 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.
|
| 90 |
+
|
| 91 |
+
• 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.
|
| 92 |
+
|
| 93 |
+
Models, Training settings and Hyperparameters We follow previous studies (Wei et al., 2022b; Wang et al., 2022b) and conduct our experiments on an autoregressive Transformer-based language model with 540 billion parameters. 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. Since each reasoning path is augmented into four formats in Sec. 3.2, the final training samples are up to the size of $\bar { 1 } 2 8 \times \lvert \mathscr { D } ^ { \mathrm { t r a i n } } \rvert$ , with $\left| \mathcal { D } ^ { \mathtt { t r a i n } } \right|$ being the size of the corresponding training set. For all datasets except DROP, we use the whole training set; To reduce the training burden, we sample 5k examples from the non-football and football partition of the DROP dataset, and sample $5 \mathrm { k }$ examples from ANLI-A2 and ANLI-A3. For each dataset, we fine-tune the model for 10k steps with a learning rate of 5e−5 and a batch size of 32. For multiple path decoding, we use a sampling temperature of $T = 0 . 7$ with the pre-trained model as suggested by Wang et al. (2022b). 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.
|
| 94 |
+
|
| 95 |
+
# 5 RESULTS
|
| 96 |
+
|
| 97 |
+
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.
|
| 98 |
+
|
| 99 |
+
# 5.1 MAIN RESULTS
|
| 100 |
+
|
| 101 |
+
<table><tr><td></td><td>Prompting Method</td><td>GSM8K</td><td>DROP</td><td>ARC-c</td><td>OpenBookQA</td><td>ANLI-A2</td><td>ANLI-A3</td></tr><tr><td></td><td>Previous SOTA</td><td>82.3a</td><td>84.9b</td><td>88.7c</td><td>91.0d</td><td>64.9d</td><td>66.0d</td></tr><tr><td rowspan="3">w/o LMSI</td><td>Standard-Prompting</td><td>17.9</td><td>60.0</td><td>87.1</td><td>84.4</td><td>55.8</td><td>55.8</td></tr><tr><td>CoT-Prompting</td><td>56.5</td><td>70.6</td><td>85.2</td><td>86.4</td><td>58.9</td><td>60.6</td></tr><tr><td>Self-Consistency</td><td>74.4</td><td>78.2</td><td>88.7</td><td>90.0</td><td>64.5</td><td>63.4</td></tr><tr><td rowspan="3">LMSI</td><td>Standard-Prompting</td><td>32.2</td><td>71.7</td><td>87.2</td><td>92.0</td><td>64.8</td><td>66.9</td></tr><tr><td>CoT-Prompting</td><td>73.5</td><td>76.2</td><td>88.3</td><td>93.0</td><td>65.3</td><td>67.3</td></tr><tr><td>Self-Consistency</td><td>82.1</td><td>83.0</td><td>89.8</td><td>94.4</td><td>66.5</td><td>67.9</td></tr></table>
|
| 102 |
+
|
| 103 |
+
Table 3: Accuracy results on six reasoning benchmarks. The previous SOTA results are from: (a) Li et al. (2022a), (b) Zhou et al. (2022b), (c) Wang et al. (2022b), (d) Wang et al. (2022a).
|
| 104 |
+
|
| 105 |
+
We list the results of using the 540B 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 self-consistency 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 compare our results with previous SOTA, achieved by different methods on different datasets, listed in Table 3. On ARC-c, OpenBookQA, ANLI-A2 and ANLI-A3, LMSI outperforms previous SOTA. On GSM8K dataset, LMSI is close to the DiVeRSe approach (Li et al., 2022a) which uses diverse prompts and a voting verifier to ensemble 100 output paths. On the contrary, we only use 32 output paths for self-generating training samples and for self-consistency with LMSI. On the DROP dataset, LMSI is close to the OPERA approach (Zhou et al., 2022b) which uses ground truth labels for training. On the other hand, our method only leverages the questions in the training set, without using ground truth labels.
|
| 106 |
+
|
| 107 |
+
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.
|
| 108 |
+
|
| 109 |
+
<table><tr><td></td><td>Self-training data</td><td>AQUA</td><td>SVAMP</td><td>StrategyQA</td><td>ANLI-A1</td><td>RTE</td><td>MNLI-M/MM</td></tr><tr><td>w/o LMSI</td><td>-</td><td>35.8</td><td>79.0</td><td>75.3</td><td>68.8</td><td>79.1</td><td>72.0/74.0</td></tr><tr><td>LMSI</td><td>GSM8K + DROP +...</td><td>39.0</td><td>82.8</td><td>77.8</td><td>79.2</td><td>80.1</td><td>81.8/82.2</td></tr></table>
|
| 110 |
+
|
| 111 |
+
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., 2017a) and SVAMP (Patel et al., 2021) are arithmetic reasoning tasks; (2) StrategyQA (Geva et al., 2021) is a commonsense reasoning task; (3) ANLI-A1 (Mihaylov et al., 2018), 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. These three tasks have their own few-shot prompts. From Table 4, we can observe that LMSI achieves higher accuracy results on all OOD tasks, showing that the overall reasoning ability of the language model is improved.
|
| 112 |
+
|
| 113 |
+
Table 5: Ablation study: w/ or w/o CoT reasoning paths as training format on GSM8K dataset.
|
| 114 |
+
|
| 115 |
+
<table><tr><td colspan="2">Results on GSM8K</td></tr><tr><td></td><td>Standard Prompting CoT Prompting</td></tr><tr><td>w/o LMSI</td><td>17.9 56.5</td></tr><tr><td>LMSI w/o CoT formats 23.6</td><td>61.6</td></tr><tr><td>LMSI</td><td>32.2 73.5</td></tr></table>
|
| 116 |
+
|
| 117 |
+
Importance of training with Chain-of-Thought formats We demonstrate the importance of training language models with Chain-of-Thoughts compared to training with only direct answers. In Table 5, we list the results of LMSI with all four formats, and the results of LMSI with only direct answer formats. The results clearly 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.
|
| 118 |
+
|
| 119 |
+
# 5.2 PUSHING THE LIMIT OF SELF-IMPROVEMENTS
|
| 120 |
+
|
| 121 |
+
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.
|
| 122 |
+
|
| 123 |
+
Table 6: Accuracy on GSM8K test set after self-training on self-generated or training set questions.
|
| 124 |
+
|
| 125 |
+
<table><tr><td></td><td>Questions used for Self-Training</td><td colspan="2">Results on GSM8K CoT-Prompting Self-Consistency</td></tr><tr><td>w/o LMSI</td><td>=</td><td>56.5</td><td>74.4</td></tr><tr><td>LMSI</td><td>Generated Questions</td><td>66.2</td><td>78.1</td></tr><tr><td>LMSI</td><td>Training-set Questions</td><td>73.5</td><td>82.1</td></tr></table>
|
| 126 |
+
|
| 127 |
+

|
| 128 |
+
Figure 3: Accuracy results on GSM8K test set using 540B model with multi-path sampling and self-consistency (Wang et al., 2022b). “Step-by-Step” is the baseline performance of Kojima et al. (2022) plus self-consistency (Wang et al., 2022b), while our “Few-Shot w/ Step-by-Step” uses exemplers self-generated from Step-by-Step (greedy decoding) for few-shot prompting the LLM.
|
| 129 |
+
|
| 130 |
+
Self-Generating Few-Shot CoT Prompts We explore the situation where no in-domain CoT examples are provided for a task. We apply the Step-by-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., 2022b)). The strong performance of “Few-Shot w/ Stepby-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., 2022a), where at 40 paths it uses 20 generate prompt-templates, 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. (2022b). Since we did not use training questions or few-shot CoT examples, $7 4 . 2 \%$ also marks the new state-of-the-art zero-shot performance on GSM8K.
|
| 131 |
+
|
| 132 |
+
# 5.3 DISTILLATION TO SMALLER MODELS
|
| 133 |
+
|
| 134 |
+
<table><tr><td></td><td colspan="3">Results on GSM8K</td></tr><tr><td></td><td>8 billion</td><td>62 billion</td><td>540 billion</td></tr><tr><td>w/o LMSI</td><td>5.0</td><td>29.7</td><td>56.5</td></tr><tr><td>Distilled from LMSI 540 billion</td><td>33.4</td><td>57.4</td><td>1</td></tr></table>
|
| 135 |
+
|
| 136 |
+
Table 7: Distillation from 540B model to small models. We see that distilled smaller models outperform models that are one-tier larger.
|
| 137 |
+
|
| 138 |
+
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 model, but fine-tune on models with smaller sizes (8B and 62B respectively), and show the results of CoT-prompting in Table 7. It is interesting to point out that after distillation from LMSI, the 62 billion model can outperform the pre-trained 540 billion model, and the 8 billion model can outperform the pre-trained 62 billion 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.
|
| 139 |
+
|
| 140 |
+
# 5.4 HYPERPARAMETER STUDY
|
| 141 |
+
|
| 142 |
+

|
| 143 |
+
Figure 4: Hyperparameter study results.
|
| 144 |
+
|
| 145 |
+
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(a). 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., 2022b) before self-improvement. We believe the reason is that after training the model, the entropy of the output distribution is reduced.
|
| 146 |
+
|
| 147 |
+
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. 4(b). 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 Self-Improvement, 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.
|
| 148 |
+
|
| 149 |
+
# 6 CONCLUSIONS
|
| 150 |
+
|
| 151 |
+
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 an LLM with 540 billion parameters show that our approach improves the accuracy scores on the six datasets by $1 . 1 \%$ to $7 . 7 \%$ , achieving new state-of-the-art results on ARC, OpenBookQA, and ANLI, 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 Chain-of-Thought prompts. As part of our future work, we plan to combine large-scale generated data from our approach and existing supervised data, to further improve the performance of LLMs.
|
| 152 |
+
|
| 153 |
+
# REFERENCES
|
| 154 |
+
|
| 155 |
+
Massih-Reza Amini, Vasilii Feofanov, Loic Pauletto, Emilie Devijver, and Yury Maximov. Selftraining: A survey, 2022. URL https://arxiv.org/abs/2202.12040.
|
| 156 |
+
|
| 157 |
+
Jimmy Ba and Rich Caruana. Do deep nets really need to be deep? Advances in neural information processing systems, 27, 2014.
|
| 158 |
+
|
| 159 |
+
BIG bench collaboration. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models. ArXiv, abs/2206.04615, 2022.
|
| 160 |
+
|
| 161 |
+
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. In Neurips, 2020.
|
| 162 |
+
|
| 163 |
+
Oana-Maria Camburu, Tim Rocktaschel, Thomas Lukasiewicz, and Phil Blunsom.¨ esnli: Natural language inference with natural language explanations. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 9539–9549. Curran Associates, Inc., 2018. URL http://papers.nips.cc/paper/ 8163-e-snli-natural-language-inference-with-natural-language-explanations. pdf.
|
| 164 |
+
|
| 165 |
+
Xiaokang Chen, Yuhui Yuan, Gang Zeng, and Jingdong Wang. Semi-supervised semantic segmentation with cross pseudo supervision. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 166 |
+
|
| 167 |
+
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. MeierHellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. Palm: Scaling language modeling with pathways. ArXiv, abs/2204.02311, 2022.
|
| 168 |
+
|
| 169 |
+
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. Scaling instruction-finetuned language models. In arxiv, 2022.
|
| 170 |
+
|
| 171 |
+
Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord. Think you have solved question answering? try arc, the ai2 reasoning challenge. ArXiv, abs/1803.05457, 2018.
|
| 172 |
+
|
| 173 |
+
Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems. ArXiv, abs/2110.14168, 2021.
|
| 174 |
+
|
| 175 |
+
Ido Dagan, Oren Glickman, and Bernardo Magnini. The pascal recognising textual entailment challenge. In MLCW, 2005.
|
| 176 |
+
|
| 177 |
+
Dheeru Dua, Yizhong Wang, Pradeep Dasigi, Gabriel Stanovsky, Sameer Singh, and Matt Gardner. Drop: A reading comprehension benchmark requiring discrete reasoning over paragraphs. In NAACL, 2019.
|
| 178 |
+
|
| 179 |
+
John Dunlosky and Janet Metcalfe. Metacognition. Sage Publications, 2008.
|
| 180 |
+
|
| 181 |
+
Jacob Eisenstein, Daniel Andor, Bernd Bohnet, Michael Collins, and David Mimno. Honest students from untrusted teachers: Learning an interpretable question-answering pipeline from a pretrained language model. arXiv preprint arXiv:2210.02498, 2022.
|
| 182 |
+
|
| 183 |
+
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.
|
| 184 |
+
|
| 185 |
+
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.
|
| 186 |
+
|
| 187 |
+
Junxian He, Jiatao Gu, Jiajun Shen, and Marc’Aurelio Ranzato. Revisiting self-training for neural sequence generation. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $_ { \cdot } =$ SJgdnAVKDH.
|
| 188 |
+
|
| 189 |
+
Geoffrey Hinton, Oriol Vinyals, Jeff Dean, et al. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2(7), 2015.
|
| 190 |
+
|
| 191 |
+
Jaehun Jung, Lianhui Qin, Sean Welleck, Faeze Brahman, Chandra Bhagavatula, Ronan Le Bras, and Yejin Choi. Maieutic prompting: Logically consistent reasoning with recursive explanations, 2022. URL https://arxiv.org/abs/2205.11822.
|
| 192 |
+
|
| 193 |
+
Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. Neural Information Processing Systems (NeurIPS), 2022.
|
| 194 |
+
|
| 195 |
+
Anoop Korattikara Balan, Vivek Rathod, Kevin P Murphy, and Max Welling. Bayesian dark knowledge. Advances in neural information processing systems, 28, 2015.
|
| 196 |
+
|
| 197 |
+
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. Can language models learn from explanations in context?, 2022. URL https://arxiv.org/abs/2204. 02329.
|
| 198 |
+
|
| 199 |
+
Yifei Li, Zeqi Lin, Shizhuo Zhang, Qiang Fu, Bei Chen, Jian-Guang Lou, and Weizhu Chen. On the advance of making language models better reasoners. ArXiv, abs/2206.02336, 2022a.
|
| 200 |
+
|
| 201 |
+
Yifei Li, Zeqi Lin, Shizhuo Zhang, Qiang Fu, Bei Chen, Jian-Guang Lou, and Weizhu Chen. On the advance of making language models better reasoners, 2022b. URL https://arxiv.org/ abs/2206.02336.
|
| 202 |
+
|
| 203 |
+
Wang Ling, Dani Yogatama, Chris Dyer, and Phil Blunsom. Program induction by rationale generation: Learning to solve and explain algebraic word problems. In ACL, 2017a.
|
| 204 |
+
|
| 205 |
+
Wang Ling, Dani Yogatama, Chris Dyer, and Phil Blunsom. 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), 2017b. doi: 10.18653/v1/P17-1015. URL https://aclanthology.org/P17-1015.
|
| 206 |
+
|
| 207 |
+
Yu Meng, Jiaxin Huang, Yu Zhang, and Jiawei Han. Generating training data with language models: Towards zero-shot language understanding. ArXiv, abs/2202.04538, 2022.
|
| 208 |
+
|
| 209 |
+
Todor Mihaylov, Peter Clark, Tushar Khot, and Ashish Sabharwal. Can a suit of armor conduct electricity? a new dataset for open book question answering. In EMNLP, 2018.
|
| 210 |
+
|
| 211 |
+
Sharan Narang, Colin Raffel, Katherine Lee, Adam Roberts, Noah Fiedel, and Karishma Malkan. Wt5?! training text-to-text models to explain their predictions, 2020. URL https://arxiv. org/abs/2004.14546.
|
| 212 |
+
|
| 213 |
+
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.
|
| 214 |
+
|
| 215 |
+
Arkil Patel, S. Bhattamishra, and Navin Goyal. Are nlp models really able to solve simple math word problems? In NAACL, 2021.
|
| 216 |
+
|
| 217 |
+
Danish Pruthi, Rachit Bansal, Bhuwan Dhingra, Livio Baldini Soares, Michael Collins, Zachary C. Lipton, Graham Neubig, and William W. Cohen. Evaluating Explanations: How Much Do Explanations from the Teacher Aid Students? Transactions of the Association for Computational Linguistics, 10:359–375, 04 2022. ISSN 2307-387X. doi: 10.1162/tacl a 00465. URL https://doi.org/10.1162/tacl_a_00465.
|
| 218 |
+
|
| 219 |
+
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. In EMNLP, 2016.
|
| 220 |
+
|
| 221 |
+
Aruni RoyChowdhury, Prithvijit Chakrabarty, Ashish Singh, SouYoung Jin, Huaizu Jiang, Liangliang Cao, and Erik G. Learned-Miller. Automatic adaptation of object detectors to new domains using self-training. In CVPR, pp. 780–790, 2019. URL http: //openaccess.thecvf.com/content_CVPR_2019/html/RoyChowdhury_ Automatic_Adaptation_of_Object_Detectors_to_New_Domains_Using_ Self-Training_CVPR_2019_paper.html.
|
| 222 |
+
|
| 223 |
+
Victor Sanh, Albert Webson, Colin Raffel, Stephen H Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Teven Le Scao, Arun Raja, et al. Multitask prompted training enables zero-shot task generalization. In ICLR, 2022.
|
| 224 |
+
|
| 225 |
+
Charlie Snell, Dan Klein, and Ruiqi Zhong. Learning by distilling context. arXiv preprint arXiv:2209.15189, 2022.
|
| 226 |
+
|
| 227 |
+
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. Ul2: Unifying language learning paradigms. 2022.
|
| 228 |
+
|
| 229 |
+
Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. In BlackboxNLP@EMNLP, 2018.
|
| 230 |
+
|
| 231 |
+
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, abs/1905.00537, 2019.
|
| 232 |
+
|
| 233 |
+
Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Rationaleaugmented ensembles in language models. ArXiv, abs/2207.00747, 2022a.
|
| 234 |
+
|
| 235 |
+
Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. ArXiv, abs/2203.11171, 2022b.
|
| 236 |
+
|
| 237 |
+
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.
|
| 238 |
+
|
| 239 |
+
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. arXiv preprint arXiv:2206.07682, 2022a.
|
| 240 |
+
|
| 241 |
+
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Ed Chi, Brian Ichter, Fei Xia, Quoc Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35, 2022b.
|
| 242 |
+
|
| 243 |
+
Adina Williams, Nikita Nangia, and Samuel R. Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In NAACL, 2018.
|
| 244 |
+
|
| 245 |
+
Qizhe Xie, Minh-Thang Luong, Eduard Hovy, and Quoc V. Le. Self-training with noisy student improves imagenet classification. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10684–10695, 2020. doi: 10.1109/CVPR42600.2020.01070.
|
| 246 |
+
|
| 247 |
+
Xi Ye and Greg Durrett. The unreliability of explanations in few-shot in-context learning, 2022.
|
| 248 |
+
|
| 249 |
+
Kang Min Yoo, Dongju Park, Jaewook Kang, Sang-Woo Lee, and Woomyeong Park. Gpt3mix: Leveraging large-scale language models for text augmentation. In EMNLP Findings, 2021.
|
| 250 |
+
|
| 251 |
+
Omar Zaidan, Jason Eisner, and Christine Piatko. Using “annotator rationales” to improve machine learning for text categorization. NAACL, 2007. URL https://aclanthology.org/ N07-1033.
|
| 252 |
+
|
| 253 |
+
Eric Zelikman, Yuhuai Wu, Jesse Mu, and Noah D. Goodman. Star: Bootstrapping reasoning with reasoning, 2022. URL https://arxiv.org/abs/2203.14465.
|
| 254 |
+
|
| 255 |
+
Denny Zhou, Nathanael Scharli, Le Hou, Jason Wei, Nathan Scales, Xuezhi Wang, Dale Schuurmans, Olivier Bousquet, Quoc Le, and Ed Chi. Least-to-most prompting enables complex reasoning in large language models. ArXiv, abs/2205.10625, 2022a.
|
| 256 |
+
|
| 257 |
+
Yongwei Zhou, Junwei Bao, Chaoqun Duan, Haipeng Sun, Jiahui Liang, Yifan Wang, Jing Zhao, Youzheng Wu, Xiaodong He, and Tiejun Zhao. Opera: Operation-pivoted discrete reasoning over text. In NAACL, 2022b.
|
| 258 |
+
|
| 259 |
+
# A APPENDIX
|
| 260 |
+
|
| 261 |
+
# A.1 RESULTS ON UL2 MODEL
|
| 262 |
+
|
| 263 |
+
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 , \dot { 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 5e−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.
|
| 264 |
+
|
| 265 |
+
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.
|
| 266 |
+
|
| 267 |
+
<table><tr><td></td><td>Prompting Method</td><td>GSM8K</td><td>DROP</td><td>ARC-c</td><td>OpenBookQA</td><td>ANLI-A2</td><td>ANLI-A3</td></tr><tr><td> w/o LMSI</td><td>CoT-Prompting Self-Consistency</td><td>5.4/7.1 6.4/9.9</td><td>11.1/16.8 16.8/26.5</td><td>49.9 54.9</td><td>53.6 54.0</td><td>35.9 37.4</td><td>33.8 36.8</td></tr><tr><td>LMSI</td><td>CoT-Prompting Self-Consistency</td><td>6.1/8.6 7.9/10.2</td><td>11.4/17.1 18.1/28.1</td><td>50.9 54.7</td><td>53.8 55.2</td><td>35.4 38.1</td><td>34.4 37.4</td></tr></table>
|
| 268 |
+
|
| 269 |
+
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.
|
| 270 |
+
|
| 271 |
+
# A.2 CHAIN-OF-THOUGHT PROMPTS FOR EACH DATASET
|
| 272 |
+
|
| 273 |
+
We list the Chain-of-Thought Prompts for each dataset for “CoT-Prompting” experiments and selfgenerated training samples.
|
| 274 |
+
|
| 275 |
+
Q: Poison causes harm to which of the following? (a) a Tree (b) a robot (c) a house (d) a car
|
| 276 |
+
A: Poison will harm living things, only a tree is a living thing. The answer is (a).
|
| 277 |
+
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).
|
| 278 |
+
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
|
| 279 |
+
A: The food is being deconstructed in the stomach during digestion. The answer is (c).
|
| 280 |
+
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
|
| 281 |
+
A: The sun can affect the growing of living things, like plants. The answer is (d). Q: There are 15 trees in the grove. Grove workers will plant trees in the grove today. After they are done, there will be 21 trees. How many trees did the grove workers plant today?
|
| 282 |
+
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 $2 1 - 1 5 = 6$ trees. The answer is 6.
|
| 283 |
+
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 3 cars in the parking lot already. 2 more arrive. Now there are $3 + 2 = 5$ cars. 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 $3 2 + 4 2 = 7 4$ chocolates. 35 have been eaten. So in total they still have $7 4 - 3 5 = 3 9$ chocolates. The answer is 39. Q: Jason had 20 lollipops. He gave Denny some lollipops. Now Jason has 12 lollipops. How many lollipops did Jason give to Denny?
|
| 284 |
+
A: Jason had 20 lollipops. 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 $2 0 - 1 2 = 8 $ lollipops. The answer is 8.
|
| 285 |
+
Q: Shawn has five toys. For Christmas, he got two toys each from his mom and dad. How many toys does he have now?
|
| 286 |
+
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.
|
| 287 |
+
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?
|
| 288 |
+
A: There are 4 days from monday to thursday. 5 computers were added each day. That means in total 4 $^ { * } 5 = 2 0$ computers were added. There were 9 computers in the beginning, so now there are $9 + 2 0 = 2 9$ computers. The answer is 29.
|
| 289 |
+
Q: Michael had 58 golf balls. 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?
|
| 290 |
+
A: Michael initially had 58 balls. He lost 23 on Tuesday, so after that he has $5 8 \textrm { - } 2 3 = 3 5$ balls. On Wednesday he lost 2 more so now he has $3 5 - 2 = 3 3$ balls. The answer is 33.
|
| 291 |
+
Q: Olivia has $\$ 23$ . She bought five bagels for $\$ 3$ each. How much money does she have left?
|
| 292 |
+
A: She bought 5 bagels for $\$ 3$ each. This means she spent $5 * \ S 3 = \ S 1 5$ on the bagels. She had $\$ 23$ in beginning, so now she has $\$ 23-\$ 515=58$ . The answer is 8.
|
| 293 |
+
|
| 294 |
+
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?
|
| 295 |
+
|
| 296 |
+
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.
|
| 297 |
+
|
| 298 |
+
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?
|
| 299 |
+
|
| 300 |
+
A: According to the passage, $2 3 . 5 \%$ are under the age of 18, and $8 . 7 \%$ are from ages 18 to 24. $2 3 . 5 \%$ - $8 . 7 \% = 1 4 . 8 \%$ . So the answer is 14.8.
|
| 301 |
+
|
| 302 |
+
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?
|
| 303 |
+
|
| 304 |
+
A: According to the passage, Stafford threw $5 ~ \mathrm { T D }$ passes, 3 of which were to Johnson. $5 \textrm { - } 3 = 2$ . So the answer is 2.
|
| 305 |
+
|
| 306 |
+
Table 11: Few-shot CoT prompts for DROP (nonfootball), from Zhou et al. (2022a).
|
| 307 |
+
|
| 308 |
+
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?
|
| 309 |
+
|
| 310 |
+
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.
|
| 311 |
+
|
| 312 |
+
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?
|
| 313 |
+
|
| 314 |
+
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.
|
| 315 |
+
|
| 316 |
+
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?
|
| 317 |
+
|
| 318 |
+
A: The first and third quarters were the scoreless quarters. So there are 2 scoreless quarters. So the answer is 2.
|
| 319 |
+
|
| 320 |
+
# Premise:
|
| 321 |
+
|
| 322 |
+
”Conceptually cream skimming has two basic dimensions - product and geography.”
|
| 323 |
+
|
| 324 |
+
Based on this premise, can we conclude the hypothesis ”Product and geography are what make cream skimming work.” is true?
|
| 325 |
+
|
| 326 |
+
OPTIONS:
|
| 327 |
+
- yes
|
| 328 |
+
- no
|
| 329 |
+
- it is not possible to tell
|
| 330 |
+
|
| 331 |
+
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.
|
| 332 |
+
|
| 333 |
+
Premise:
|
| 334 |
+
|
| 335 |
+
”One of our member will carry out your instructions minutely.”
|
| 336 |
+
Based on this premise, can we conclude the hypothesis ”A member of my team will execute your orders with
|
| 337 |
+
immense precision.” is true?
|
| 338 |
+
OPTIONS:
|
| 339 |
+
- yes
|
| 340 |
+
- no
|
| 341 |
+
- it is not possible to tell
|
| 342 |
+
|
| 343 |
+
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.
|
| 344 |
+
|
| 345 |
+
Premise:
|
| 346 |
+
”Fun for adults and children.”
|
| 347 |
+
Based on this premise, can we conclude the hypothesis ”Fun for only children.” is true?
|
| 348 |
+
OPTIONS:
|
| 349 |
+
- yes
|
| 350 |
+
- no
|
| 351 |
+
- it is not possible to tell
|
| 352 |
+
|
| 353 |
+
A: ”adults and children” contradicts ”only children”. The answer is no.
|
| 354 |
+
|
| 355 |
+
Premise:
|
| 356 |
+
”He turned and smiled at Vrenna.”
|
| 357 |
+
Based on this premise, can we conclude the hypothesis ”He smiled at Vrenna who was walking slowly behind
|
| 358 |
+
him with her mother.” is true?
|
| 359 |
+
OPTIONS:
|
| 360 |
+
- yes
|
| 361 |
+
- no
|
| 362 |
+
- it is not possible to tell
|
| 363 |
+
|
| 364 |
+
A: the premise does not say anything about ”Vrenna was walking”. The answer is it is not possible to tell.
|
| 365 |
+
|
| 366 |
+
Premise:
|
| 367 |
+
”well you see that on television also”
|
| 368 |
+
Based on this premise, can we conclude the hypothesis ”You can see that on television, as well.” is true?
|
| 369 |
+
OPTIONS:
|
| 370 |
+
- yes
|
| 371 |
+
- no
|
| 372 |
+
- it is not possible to tell
|
| 373 |
+
|
| 374 |
+
A: ”also” and ”as well” mean the same thing. The answer is yes.
|
| 375 |
+
|
| 376 |
+
Premise:
|
| 377 |
+
”Vrenna and I both fought him and he nearly took us.”
|
| 378 |
+
Based on this premise, can we conclude the hypothesis ”Neither Vrenna nor myself have ever fought him.” is true?
|
| 379 |
+
OPTIONS:
|
| 380 |
+
- yes
|
| 381 |
+
- no
|
| 382 |
+
- it is not possible to tell
|
| 383 |
+
A: ”Vrenna and I both” contradicts ”neither Vrenna nor myself”. The answer is no. Table 13: Few-shot CoT prompts for NLI tasks, including ANLI and MNLI, from Wang et al.
|
| 384 |
+
(2022a). Q: George wants to warm his hands quickly by rubbing them. Which skin surface will produce the most heat? (a) dry palms. (b) wet palms. (c) palms covered with oil. (d) palms covered with lotion.
|
| 385 |
+
A: Dry surfaces will more likely cause more friction via rubbing than other smoother surfaces, hence dry palms will produce the most heat. The answer is (a).
|
| 386 |
+
Q: Which factor will most likely cause a person to develop a fever? (a) a leg muscle relaxing after exercise. (b) a bacterial population in the bloodstream. (c) several viral particles on the skin. (d) carbohydrates being digested in the stomach.
|
| 387 |
+
A: Option (b), bacterial population is the most likely cause for a person developing fever. The answer is (b).
|
| 388 |
+
Q: Which change in the state of water particles causes the particles to become arranged in a fixed position? (a) boiling. (b) melting. (c) freezing. (d) evaporating.
|
| 389 |
+
A: When water is freezed, the particles are arranged in a fixed position; the particles are still moving for all other options. The answer is (c).
|
| 390 |
+
Q: When a switch is used in an electrical circuit, the switch can (a) cause the charge to build. (b) increase and decrease the voltage. (c) cause the current to change direction. (d) stop and start the flow of current. A: The function of a switch is to start and stop the flow of a current. The answer is (d). 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
|
| 391 |
+
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).
|
| 392 |
+
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
|
| 393 |
+
A: If a $/ { \mathbf { b } } = 3 / 4$ , then $\mathsf { b } = 4 \mathrm { 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).
|
| 394 |
+
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 }$
|
| 395 |
+
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
|
| 396 |
+
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).
|
| 397 |
+
|
| 398 |
+
Q: Do hamsters provide food for any animals?
|
| 399 |
+
|
| 400 |
+
A: Hamsters are prey animals. Prey are food for predators. Thus, hamsters provide food for some animals.
|
| 401 |
+
The answer is yes.
|
| 402 |
+
|
| 403 |
+
Q: Could Brooke Shields succeed at University of Pennsylvania?
|
| 404 |
+
|
| 405 |
+
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.
|
| 406 |
+
|
| 407 |
+
Q: Yes or no: Hydrogen’s atomic number squared exceeds number of Spice Girls?
|
| 408 |
+
|
| 409 |
+
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.
|
| 410 |
+
|
| 411 |
+
Q: Yes or no: Is it common to see frost during some college commencements?
|
| 412 |
+
|
| 413 |
+
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.
|
| 414 |
+
|
| 415 |
+
Q: Yes or no: Could a llama birth twice during War in Vietnam (1945-46)?
|
| 416 |
+
|
| 417 |
+
A: The War in Vietnam was 6 months. The gestation period for a llama 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.
|
| 418 |
+
|
| 419 |
+
Q: Yes or no: Would a pear sink in water?
|
| 420 |
+
|
| 421 |
+
A: The density of a pear is about $0 . 6 ~ \mathrm { g } / \mathrm { c m } ^ { 3 }$ , which is less than water. Objects less dense than water float.
|
| 422 |
+
Thus, a pear would float. The answer is no.
|
| 423 |
+
|
| 424 |
+
Table 16: Few-shot CoT prompts for StrategyQA, from Wei et al. (2022b).
|
| 425 |
+
|
| 426 |
+
Premise:
|
| 427 |
+
|
| 428 |
+
”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?
|
| 429 |
+
|
| 430 |
+
A: ”No Weapons of Mass Destruction Found” contradicts ”Weapons of Mass Destruction Found”. The answer is no.
|
| 431 |
+
|
| 432 |
+
Premise:
|
| 433 |
+
|
| 434 |
+
”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.”
|
| 435 |
+
|
| 436 |
+
Based on this premise, can we conclude the hypothesis ”Pope Benedict XVI is the new leader of the Roman Catholic Church.” is true?’
|
| 437 |
+
|
| 438 |
+
A: ”installation of new Pope Benedict XVI.” means ”Pope Benedict XVI is the new leader”. The answer is yes.
|
| 439 |
+
|
| 440 |
+
Premise:
|
| 441 |
+
|
| 442 |
+
”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.”
|
| 443 |
+
|
| 444 |
+
Based on this premise, can we conclude the hypothesis ”Paul Stewart Hutchinson is accused of having stabbed a girl.” is true?
|
| 445 |
+
|
| 446 |
+
A: The premise does not say Paul Stewart Hutchinson ”stabbed” this girl. The answer is no.
|
| 447 |
+
|
| 448 |
+
Premise:
|
| 449 |
+
|
| 450 |
+
”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?
|
| 451 |
+
|
| 452 |
+
A: ”Herceptin was approved to treat breast cancer” implies that ”Herceptin can be used to treat breast cancer”.
|
| 453 |
+
The answer is yes.
|
md/dev/OgCcfc1m0TO/OgCcfc1m0TO.md
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LEARNING TO PROMPT FOR VISION-LANGUAGE MODELS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Vision-language pre-training has recently emerged as a promising alternative for representation learning. It shifts from the tradition of using images and discrete labels for learning a fixed set of weights, seen as visual concepts, to aligning images and raw text for two separate encoders. Such a paradigm benefits from a broader source of supervision and allows zero-shot transfer to downstream tasks since visual concepts can be diametrically generated from natural language, known as prompt. In this paper, we identify that a major challenge of deploying such models in practice is prompt engineering. This is because designing a proper prompt, especially for context words surrounding a class name, requires domain expertise and typically takes a significant amount of time for words tuning since a slight change in wording could have a huge impact on performance. Moreover, different downstream tasks require specific designs, further hampering the efficiency of deployment. To overcome this challenge, we propose a simple approach named context optimization $( C o O p )$ . The main idea is to model context in prompts using continuous representations and perform end-to-end learning from data while keeping the pre-trained parameters fixed. In this way, the design of task-relevant prompts can be fully automated. Experiments on 11 datasets show that CoOp effectively turns pre-trained vision-language models into data-efficient visual learners, requiring as few as one or two shots to beat hand-crafted prompts with a decent margin and able to gain significant improvements when using more shots (e.g., at 16 shots the average gain is around $17 \%$ with the highest reaching over $5 0 \%$ ). CoOp also exhibits strong robustness to distribution shift.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
The traditional approach for visual representation learning is to train vision models to predict for a fixed set of object categories using discrete labels (He et al., 2016; Dosovitskiy et al., 2021). However, this approach limits visual recognition systems to closed-set visual concepts defined during training, making them unable to handle new categories once deployed in target environments, since additional data are required for learning a new classifier. Recently, vision-language pre-training such as CLIP (Radford et al., 2021) and ALIGN (Jia et al., 2021) has emerged as a promising alternative. The main idea is to align images and raw text using two separate encoders—one for each modality. Through large-scale pre-training, vision-language models are allowed to learn open-set visual concepts and can readily be transferred to downstream tasks. In particular, for each new classification task, one can synthesize the classification weights by feeding natural language describing classes of interest to the text encoder, and compare them with image features produced by the image encoder.
|
| 12 |
+
|
| 13 |
+
We observe that for pre-trained vision-language models, the text input, known as prompt, plays a key role in downstream datasets. However, identifying the right prompt is a non-trivial task, which often takes a significant amount of time for words tuning—since a slight change in wording could make a huge difference in performance. For instance, for Caltech101 (Figure 1(a), 2nd vs. 3rd prompt), adding “a” before the class token brings more than $5 \%$ increase in accuracy. Moreover, prompt engineering also requires expertise about the task and ideally the language model’s underlying mechanism. This is exemplified in Figure 1(b-d) where adding task-relevant context can lead to significant improvements, i.e., “flower” for Flowers102, “texture” for DTD and “satellite” for EuroSAT. Tuning the sentence structure could bring further improvements, e.g., putting “a type of flower” after the class token for Flowers102, keeping only “texture” in the context for DTD, and adding “centered” before “satellite photo” for EuroSAT. However, even with extensive tuning, the resulting prompts are by no means guaranteed to be optimal for these downstream tasks.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Prompt engineering vs. context optimization $\bf ( C o O p )$ . The latter uses only 16 shots for learning in these examples.
|
| 17 |
+
|
| 18 |
+
Inspired by recent prompt learning research in NLP (Shin et al., 2020; Jiang et al., 2020; Zhong et al., 2021), we propose context optimization $( C o O p ) ^ { 1 }$ to automate prompt engineering to allow more efficient and task-specific transfer for pre-trained vision-language models. Specifically, we model a prompt’s context using continuous representations which are essentially initialized with random vectors with the same dimension as word embeddings (see Figure 2). The context could be shared among all classes or designed to be class-specific. During training, we simply minimize the prediction error using the cross-entropy loss with respect to the learnable context vectors, while keeping the pre-trained parameters fixed. The gradients can be back-propagated all the way through the text encoder, distilling the rich knowledge encoded in the parameters for learning task-relevant context.
|
| 19 |
+
|
| 20 |
+
To demonstrate the effectiveness of $\mathrm { C o O p }$ , we benchmark on 11 datasets, which cover a diverse set of visual recognition tasks including classification on generic objects, scenes, actions and fine-grained categories, as well as specialized tasks like recognizing textures and satellite imagery. The results show that CoOp can effectively turn pre-trained vision-language models into data-efficient visual learners, requiring as few as one or two shots to beat hand-crafted prompts with a decent margin. The performance can also be further boosted by using more shots, e.g., at 16 shots the margin over hand-crafted prompts averages at around $17 \%$ and reaches over $50 \%$ for the highest. CoOp also outperforms the linear probe alternative known as a strong few-shot learning baseline (Tian et al., 2020), and crucially, demonstrates much stronger robustness to distribution shift. Extensive analysis is also conducted to offer a comprehensive picture on how to apply $\mathrm { C o O p }$ in practice. The source code for reproducing the experiments will be released to facilitate future research.
|
| 21 |
+
|
| 22 |
+
# 2 METHODOLOGY
|
| 23 |
+
|
| 24 |
+
# 2.1 VISION-LANGUAGE PRE-TRAINING
|
| 25 |
+
|
| 26 |
+
We briefly introduce vision-language pre-training with a particular focus on CLIP (Radford et al., 2021). Our approach is applicable to broader CLIP-like vision-language models.
|
| 27 |
+
|
| 28 |
+
Models CLIP consists of two encoders, one for images and the other for text. The image encoder aims to map high-dimensional images into a low-dimensional embedding space. The architecture of the image encoder can take the form of a CNN like ResNet-50 (He et al., 2016) or a ViT (Dosovitskiy et al., 2021). On the other hand, the text encoder is built on top of a Transformer (Vaswani et al., 2017) and aims to generate text representations from natural language.
|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
Figure 2: Overview of context optimization $( \mathrm { C o O p } )$ .
|
| 32 |
+
|
| 33 |
+
Specifically, given a sequence of words (tokens), such as “a photo of a dog.”, CLIP first converts each one of the token (including punctuation) into a lower-cased byte pair encoding (BPE) representation (Sennrich et al., 2016), which is essentially a unique numeric ID. The vocabulary size in CLIP is 49,152. To facilitate minibatch processing, each text sequence is encompassed with the [SOS] and [EOS] tokens and capped at a fixed length of 77. After that, the IDs are mapped to 512-D word embedding vectors, which are then passed on to the Transformer. Finally, the features at the [EOS] token position are layer normalized and further processed by a linear projection layer.
|
| 34 |
+
|
| 35 |
+
Training CLIP is trained to align the two embedding spaces learned for images and text respectively. Specifically, the learning objective is formulated as a contrastive loss. Given a batch of image-text pairs, CLIP maximizes the cosine similarity for matched pairs while minimizes the cosine similarity for all other unmatched pairs. To learn diverse visual concepts that are more transferable to downstream tasks, CLIP’s team collects a large training dataset consisting of 400 million image-text pairs.
|
| 36 |
+
|
| 37 |
+
Zero-Shot Inference Since CLIP is pre-trained to predict whether an image matches a textual description, it naturally fits zero-shot recognition. This is achieved by comparing image features with the classification weights synthesized by the text encoder, which takes as input textual descriptions specifying classes of interest. Formally, let $f$ be image features extracted by the image encoder for an image $_ { \textbf { \em x } }$ and $\{ { w } _ { i } \} _ { i = 1 } ^ { K }$ a set of weight vectors generated by the text encoder. $K$ denotes the number of classes and each ${ \pmb w } _ { i }$ is derived from a prompt that could have the form of “a photo of a [CLASS].” where the class token is replaced by the specific class name, such as “cat”, “dog” or “car”. The prediction probability is then computed as
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
p ( y = i | \pmb { x } ) = \frac { \exp ( < \pmb { w } _ { i } , \pmb { f } > / \tau ) } { \sum _ { j = 1 } ^ { K } \exp ( < \pmb { w } _ { j } , \pmb { f } > / \tau ) } ,
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
where $\tau$ is a temperature parameter learned by CLIP and $< \cdot , \cdot >$ denotes cosine similarity.
|
| 44 |
+
|
| 45 |
+
# 2.2 CONTEXT OPTIMIZATION
|
| 46 |
+
|
| 47 |
+
We propose context optimization $\left( \mathbf { C o O p } \right)$ , which avoids manual prompt tuning by modeling context words with continuous vectors that are end-to-end learned from data. An overview is shown in Figure 2. Specifically, the prompt given to the text encoder $g ( \cdot )$ is designed with the following form,
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
{ \pmb t = [ \mathsf { V } ] _ { 1 } [ \mathsf { V } ] _ { 2 } \ldots [ \mathsf { V } ] _ { M } [ \mathsf { C L A S S } ] , }
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
where each $[ \mathsf { V } ] _ { m } \ ( m \in \{ 1 , \dots , M \} )$ is a vector with the same dimension as word embeddings (i.e., 512 for CLIP), and $M$ is a hyperparameter specifying the number of context tokens. Note that the
|
| 54 |
+
|
| 55 |
+
context here is shared among all classes, which is called unified context and different from classspecific context that is introduced later.
|
| 56 |
+
|
| 57 |
+
By forwarding a prompt $\pmb { t }$ to the text encoder $g ( \cdot )$ , we can obtain a classification weight vector representing a visual concept. The prediction probability is computed as
|
| 58 |
+
|
| 59 |
+
$$
|
| 60 |
+
p ( \boldsymbol { y } = i | \boldsymbol { x } ) = \frac { \exp ( < g ( t _ { i } ) , f > / \tau ) } { \sum _ { j = 1 } ^ { K } \exp ( < g ( t _ { j } ) , f > / \tau ) } ,
|
| 61 |
+
$$
|
| 62 |
+
|
| 63 |
+
where the class token within each prompt $\mathbf { \Delta } _ { t _ { i } }$ is replaced by the corresponding word embedding vector(s) of the $i$ -th class name.
|
| 64 |
+
|
| 65 |
+
Training is performed to minimize the standard classification loss based on the cross-entropy, and the gradients can be back-propagated all the way through the text encoder $g ( \cdot )$ , making use of the rich knowledge encoded in the parameters to optimize the context. The design of continuous representations also allows full exploration in the word embedding space, which facilitates the learning of task-relevant context.
|
| 66 |
+
|
| 67 |
+
Other Variants Other than placing the class token at the end of a sequence as in Equation (2), we can also put it in the middle like
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\mathbf { \partial } t = [ \mathbf { V } ] _ { 1 } \ldots [ \mathbf { V } ] _ { \frac { M } { 2 } } [ \mathbf { C L A S S } ] [ \mathbf { V } ] _ { \frac { M } { 2 } + 1 } \ldots [ \mathbf { V } ] _ { M } ,
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
which increases flexibility for learning—theoretically, the prompt is allowed to either fill the latter cells with supplementary descriptions or cut off the sentence earlier by using a termination signal such as full stop.
|
| 74 |
+
|
| 75 |
+
Another option is to design class-specific context (CSC) where context vectors are independent to each class, i.e., $[ \mathbf { V } ] _ { 1 } ^ { i } [ \mathbf { V } ] _ { 2 } ^ { i } \dot { \mathbf { \Omega } } . . . [ \mathbf { V } ] _ { M } ^ { i } \dot { \neq } [ \mathbf { V } ] _ { 1 } ^ { j } [ \mathbf { V } ] _ { 2 } ^ { j } \dot { \mathbf { \Omega } } . . . [ \mathbf { V } ] _ { M } ^ { j }$ for $i \neq j$ and $i , j \in \{ 1 , \dots , K \}$ . As an alternative to unified context, we find that CSC is particularly useful for some fine-grained classification tasks.
|
| 76 |
+
|
| 77 |
+
# 3 EXPERIMENTS
|
| 78 |
+
|
| 79 |
+
# 3.1 FEW-SHOT LEARNING
|
| 80 |
+
|
| 81 |
+
Datasets We select 11 publicly available image classification datasets used in CLIP: ImageNet (Deng et al., 2009), Caltech101 (Fei-Fei et al., 2004), OxfordPets (Parkhi et al., 2012), StanfordCars (Krause et al., 2013), Flowers102 (Nilsback & Zisserman, 2008), Food101 (Bossard et al., 2014), FGVCAircraft (Maji et al., 2013), SUN397 (Xiao et al., 2010), DTD (Cimpoi et al., 2014), EuroSAT (Helber et al., 2019) and UCF101 (Soomro et al., 2012) (see Appendix A for their statistics). These datasets constitute a comprehensive benchmark, which covers a diverse set of vision tasks including classification on generic objects, scenes, actions and fine-grained categories, as well as specialized tasks like recognizing textures and satellite imagery. We follow the few-shot evaluation protocol adopted in CLIP (Radford et al., 2021), using 1, 2, 4, 8 and 16 shots for training respectively and deploying models in the full test sets. The average results over three runs are reported for comparison.
|
| 82 |
+
|
| 83 |
+
Training Details CoOp has four versions: positioning the class token in the end or middle; unified context vs. CSC. Unless otherwise stated, ResNet-50 (He et al., 2016) is used as the image encoder’s backbone and the number of context tokens $M$ is set to 16. Investigations on other design choices are discussed in Section 3.3. All models are built on top of the open-sourced CLIP.2 CoOp’s context vectors are randomly initialized by drawing from a zero-mean Gaussian distribution with standard deviation equal to 0.02. Training is done with SGD and an initial learning rate of 0.002, which is decayed by the cosine annealing rule. The maximum epoch is set to 200 for 16/8 shots, 100 for 4/2 shots, and 50 for 1 shot (except for ImageNet where the maximum epoch is fixed to 50). To mitigate explosive gradients observed in the early training iterations, we use the warmup trick by fixing the learning rate to $1 e - 5$ during the first epoch.
|
| 84 |
+
|
| 85 |
+

|
| 86 |
+
Figure 3: Main results of few-shot learning on the 11 datasets. Overall, $\mathrm { C o O p }$ effectively turns CLIP into a strong few-shot learner (solid lines), achieving significant improvements over zero-shot CLIP (stars) and performing favorably against the linear probe alternative (dashed lines). $M$ denotes the context length. “end” or “mid” means putting the class token in the end or middle. CSC means class-specific context.
|
| 87 |
+
|
| 88 |
+
Baseline Methods We compare CoOp with two baseline methods. The first is zero-shot CLIP, which is based on hand-crafted prompts. We follow the guideline of prompt engineering introduced by Radford et al. (2021). For generic objects and scenes, “a photo of a [CLASS].” is adopted. For fine-grained categories, task-relevant context is added like “a type of pet” for OxfordPets and “a type of food” for Food101. When it comes to specialized tasks such as recognizing textures in DTD, the prompt is customized as “[CLASS] texture.” where the class names are adjectives like “bubbly” and “dotted”. See Appendix A for the details. The second baseline is linear probe CLIP. As suggested by Radford et al. (2021) and a recent study on few-shot learning (Tian et al., 2020), training a linear classifier on top of high-quality pre-trained models’ features (like CLIP) can easily achieve performance that is on a par with that of state-of-the-art few-shot learning methods, which are often much more sophisticated. We follow the same training method used by Radford et al. (2021) to train linear probe CLIP.
|
| 89 |
+
|
| 90 |
+
Comparison with Hand-Crafted Prompts Figure 3 summarizes the results. Our default model is $\mathrm { C L I P { + } C o O p }$ with the class token positioned in the end. The two different ways of positioning the class token achieve similar performance as their curves highly overlap. From the average performance displayed in the top-left corner, we observe that $\mathrm { C L I P { + } C o O p }$ is a strong few-shot learner, requiring only two shots on average to obtain a decent margin over zero-shot CLIP. Given 16 shots for training, the average gap brought by $\mathrm { C o O p }$ can be further increased to around $17 \%$ .
|
| 91 |
+
|
| 92 |
+
Figure 4 ranks the absolute improvements obtained by $\mathrm { C o O p }$ at 16 shots over hand-crafted prompts. Huge improvements are observed on specialized tasks namely EuroSAT and DTD where the increase in performance reaches over $50 \%$ and $20 \%$ respectively. The jumps in performance are also significant (those more than $10 \%$ ) on most fine-grained datasets including Flowers102, StanfordCars and FGVCAircraft, as well as on scene and action recognition datasets (SUN397 & UCF101). Since ImageNet is a challenging dataset that contains 1,000 classes, the $5 . 0 5 \%$ improvement is also noteworthy. In contrast, the increases on the two fine-grained datasets, OxfordPets and Food101, are less appealing. By digging into $\mathrm { C L I P { + } C o O p }$ ’s curves on these two datasets in Figure 3, we find there is a loss of momentum in performance improvements even with more shots used, seemingly an overfitting problem. A potential solution is to impose higher regularizations like increasing the weight decay. Nonetheless, the overall results are strong enough to serve as evidence of CoOp’s capability of learning task-relevant prompts in a data-efficient way.
|
| 93 |
+
|
| 94 |
+
Comparison with Linear Probe CLIP In terms of the overall performance (Figure 3, topleft), $\mathrm { C L I P { + } C o O p }$ demonstrates clear advantages over linear probe CLIP. The latter requires 4 shots on average to match the zero-shot’s performance while $\mathrm { C o O p }$ ’s average gains at 4 shots are already more than $10 \%$ . It is also clear that the gaps in the extreme low-data regime such as one or two shots are much larger, suggesting that $\mathrm { C o O p }$ is much more effective than learning a linear classifier from scratch for fewshot learning. We also observe that linear probe CLIP is comparable to $\mathrm { C L I P { + } C o O p }$ on the two specialized tasks (DTD & EuroSAT) as well as on a couple of fine-grained datasets (Flowers102 & FGVCAircraft)—this is not too surprising as the pre-trained CLIP space has been
|
| 95 |
+
|
| 96 |
+

|
| 97 |
+
Figure 4: Comparison with hand-crafted prompts.
|
| 98 |
+
|
| 99 |
+
proved powerful, making the linear probe model a strong competitor. Nevertheless, CoOp’s CSC version can beat linear probe CLIP on the aforementioned datasets, and moreover, shows much better potential when more shots become available.
|
| 100 |
+
|
| 101 |
+
Unified vs. Class-Specific Context On average, using unified context leads to better performance. In terms of when to apply CSC and when not to, we have the following suggestions. For generic objects (ImageNet & Caltech101), scenes (SUN397) and actions (UCF101), using unified context is clearly better. Unified context also works better on some fine-grained datasets including OxfordPets and Food101, but on others like StanfordCars, Flowers102 and FGVCAircraft the CSC version is preferred. CSC also yields better performance on the two specialized tasks, DTD and EuroSAT, at 16 shots in particular. However, CSC mostly underperforms unified context in challenging low-data scenarios (fewer than 8 shots), which makes sense because CSC has more parameters than unified context and needs more data for training.
|
| 102 |
+
|
| 103 |
+
# 3.2 ROBUSTNESS TO DISTRIBUTION SHIFT
|
| 104 |
+
|
| 105 |
+
Since CoOp requires training on a specific data distribution, it risks learning spurious correlations that are detrimental to generalization in unseen distributions (domains), as suggested in recent studies (Taori et al., 2020; Zhou et al., 2021). On the contrary, zero-shot CLIP is not tied to a specific data distribution and has exhibited strong robustness to distribution shift (Radford et al., 2021). In this section, we aim to unveil how robust CoOp is to distribution shift, in comparison to zero-shot CLIP and the linear probe model.
|
| 106 |
+
|
| 107 |
+
Table 1: Evaluation on robustness to distribution shift. $M$ : $\mathrm { C o O p }$ ’s context length.
|
| 108 |
+
|
| 109 |
+
<table><tr><td rowspan="3"></td><td>Source</td><td colspan="4">Target</td></tr><tr><td>ImageNet</td><td>ImageNetV2</td><td>ImageNet-Sketch</td><td>ImageNet-A</td><td>ImageNet-R</td></tr><tr><td>Zero-Shot CLIP</td><td>55.41</td><td>48.08</td><td>31.67</td><td>18.63</td><td>53.45</td></tr><tr><td>Linear Probe CLIP</td><td>53.44</td><td>43.40</td><td>17.63</td><td>11.66</td><td>32.63</td></tr><tr><td>CLIP + CoOp (M=16)</td><td>60.46</td><td>52.17</td><td>31.14</td><td>19.62</td><td>53.31</td></tr><tr><td>CLIP + CoOp (M=8)</td><td>60.90</td><td>52.53</td><td>31.73</td><td>19.97</td><td>54.34</td></tr><tr><td>CLIP + CoOp (M=4)</td><td>60.85</td><td>53.02</td><td>32.99</td><td>20.69</td><td>55.57</td></tr></table>
|
| 110 |
+
|
| 111 |
+
Table 2: Comparison with prompt ensembling.
|
| 112 |
+
|
| 113 |
+
<table><tr><td></td><td>ImageNet</td></tr><tr><td>Prompt engineering</td><td>55.41</td></tr><tr><td>Prompt ensembling</td><td>57.81</td></tr><tr><td>CoOp</td><td>60.46</td></tr></table>
|
| 114 |
+
|
| 115 |
+
Table 3: Random vs. manual initialization.
|
| 116 |
+
|
| 117 |
+
<table><tr><td></td><td>Avg %</td></tr><tr><td>[V][V]2[V]3[V]4</td><td>71.26</td></tr><tr><td>"a photo of a"</td><td>71.51</td></tr></table>
|
| 118 |
+
|
| 119 |
+
Datasets The source dataset is ImageNet. The target datasets are ImageNetV2 (Recht et al., 2019), ImageNet-Sketch (Wang et al., 2019), ImageNet-A (Hendrycks et al., 2021b) and ImageNetR (Hendrycks et al., 2021a), all of which have compatible class names with ImageNet allowing seamless transfer for the prompts learned by CoOp. ImageNetV2 is a reproduced test set using different sources while following ImageNet’s data collection process. ImageNet-Sketch contains sketch images belonging to the same 1,000 ImageNet classes. Both ImageNet-A and -R contain 200 classes derived from a subset of ImageNet’s 1,000 classes. The former consists of real-world adversarially filtered images that cause current ImageNet classifiers to produce low results, whereas the latter features a rendition of the ImageNet classes in diverse image styles such as paintings, cartoons and sculptures.
|
| 120 |
+
|
| 121 |
+
Results Table 1 summarizes the results. It is surprising that $\mathrm { C L I P { + } C o O p }$ exhibits stronger robustness than zero-shot CLIP to distribution shift, despite exposure to the source dataset. This suggests that the learned prompts are also generalizable. Moreover, it is interesting to see that using fewer context tokens leads to better robustness. More results with different vision backbones are provided in Appendix B.1 where the conclusion remains the same. In contrast, linear probe CLIP obtains much worse results on these target datasets, exposing its weakness in domain generalization.
|
| 122 |
+
|
| 123 |
+
# 3.3 FURTHER ANALYSIS
|
| 124 |
+
|
| 125 |
+
Comparison with Prompt Ensembling Radford et al. (2021) have suggested that additional improvements can be obtained by ensembling over multiple zero-shot classifiers generated using different hand-crafted prompts, such as “a photo of the large [CLASS].”, “a bad photo of the [CLASS].” and “a origami [CLASS].”, which reflect a different scale, view and abstraction respectively for an image. We are interested to know whether the prompts learned by $\mathrm { C o O p }$ can still maintain advantages when compared with prompt ensembling. For fair comparison, we use the select prompts from Radford et al. (2021), which have been extensively tuned on ImageNet, to construct the ensemble classifier. Table 2 presents the results of prompt engineering (i.e., using a single hand-crafted prompt), prompt ensembling and CoOp, confirming that $\mathrm { C o O p }$ is still the best performing method. Additional results are provided in Appendix B.2 to show that $\mathrm { C o O p }$ also beats prompt ensembling when more advanced vision backbones are used. Given the potential of prompt ensembling, future work could investigate how to improve CoOp from the ensembling perspective.
|
| 126 |
+
|
| 127 |
+
Context Length How many context tokens should be used? And is it better to have more context tokens? The results in Section 3.2 suggest having shorter context length benefits domain generalization. Here we study this hyperparameter for source datasets. Specifically, we repeat experiments on the 11 datasets by varying the context length from 4 to 8 to 16. The average results are shown in Figure 5(a), which indicate that having more context tokens leads to better performance and that positioning the class token in the middle gains more momentum with longer context length. To sum up, there is no golden rule for selecting perfect context length since one needs to balance between performance and robustness to distribution shift. See Appendix B.3 for the dataset-specific results.
|
| 128 |
+
|
| 129 |
+

|
| 130 |
+
Figure 5: Investigations on CoOp’s context length and various vision backbones.
|
| 131 |
+
|
| 132 |
+
Vision Backbones Figure 5(b) summarizes the results on the 11 datasets using a variety of vision backbones covering both CNNs and ViTs. The results are expected: the more advanced the backbone, the better the performance. The gap between CoOp and hand-crafted prompts is significant across all architectures. See Appendix B.4 for the dataset-specific results.
|
| 133 |
+
|
| 134 |
+
Initialization We compare random initialization with manual initialization. The latter uses the embeddings of “a photo of a” to initialize the context vectors for the 11 datasets. For fair comparison, we also set the context length to 4 when using random initialization. Table 3 suggests a “good” initialization only brings a small improvement. Though further tuning of the initialization words might help, in practice we suggest using the simple random initialization method.
|
| 135 |
+
|
| 136 |
+
Interpreting the Learned Prompts is difficult because the context vectors are optimized in a continuous space. We resort to an indirect way by searching within the vocabulary for words that are closest to the learned vectors based on the Euclidean distance. Note that CLIP (Radford et al., 2021) uses the BPE representation (Sennrich et al., 2016) for tokenization, so the vocabulary includes subwords that frequently appear in text, such as “hu” (subsumed by many words like “hug” and “human”). Table 4 shows the searched results on some datasets. We observe that a few words are somewhat relevant to the tasks, such as “enjoyed” for Food101, “fluffy” and “paw” for OxfordPets, and “pretty” for DTD. But when connecting all the nearest words together, the prompts do not make much sense. We also observe that when using manual initialization (like “a photo of a”), the nearest words for the converged vectors are mostly the ones used for initialization. We conjecture that the learned vectors might encode meanings that are beyond the existing vocabulary. Overall, we are unable to draw any firm conclusion based on the observations because using nearest words to interpret the learned prompts could be inaccurate—the semantics of the vectors is not necessarily correlated with the nearest words.
|
| 137 |
+
|
| 138 |
+
# 4 RELATED WORK
|
| 139 |
+
|
| 140 |
+
Vision-Language Models have recently demonstrated great potential in learning generic visual representations and allowing zero-shot transfer to a variety of downstream classification tasks (Radford et al., 2021; Jia et al., 2021; Zhang et al., 2020). To our knowledge, the recent developments in vision-language learning, particularly CLIP (Radford et al., 2021) and ALIGN (Jia et al., 2021), are largely driven by advances in the following three areas: i) text representation learning with Transformers (Vaswani et al., 2017), ii) large-minibatch contrastive representation learning (Chen et al., 2020; He et al., 2020; Henaff et al. ´ , 2020), and iii) web-scale training datasets—CLIP benefits from 400 million curated image-text pairs while ALIGN exploits 1.8 billion noisy image-text pairs.
|
| 141 |
+
|
| 142 |
+
The idea of mapping images and text onto a common embedding space has been studied since nearly a decade ago (Socher et al., 2013; Frome et al., 2013; Elhoseiny et al., 2013), but with drastically different technologies. For text features extraction, early work has mainly utilized pre-trained word vectors (Socher et al., 2013; Frome et al., 2013) or the hand-crafted TF-IDF features (Elhoseiny et al., 2013; Lei Ba et al., 2015). Matching images and text features has been formulated as metric learning (Frome et al., 2013), multi-label classification (Joulin et al., 2016; Gomez et al., 2017), n-gram language learning (Li et al., 2017), and the recently proposed captioning (Desai & Johnson, 2021). Our work is orthogonal to recent research in vision-language models, aiming to facilitate the deployment of such models in downstream datasets.
|
| 143 |
+
|
| 144 |
+
Table 4: The nearest words for each of the 16 context vectors learned by $\mathrm { C o O p }$ , with their distances shown in parentheses. N/A means non-Latin characters.
|
| 145 |
+
|
| 146 |
+
<table><tr><td>#</td><td>ImageNet|</td><td>Food101</td><td>OxfordPets|</td><td>DTD|</td><td>UCF101</td></tr><tr><td>1</td><td>potd (1.7136)</td><td>lc (0.6752)</td><td>tosc (2.5952)</td><td>boxed (0.9433)</td><td>|meteorologist (1.5377)</td></tr><tr><td>2</td><td>that (1.4015)</td><td>enjoyed (0.5305)</td><td>judge (1.2635)</td><td>seed (1.0498)</td><td>exe (0.9807)</td></tr><tr><td>3</td><td>filmed (1.2275)</td><td>beh (0.5390)</td><td>fluffy (1.6099)</td><td>anna (0.8127)</td><td>parents (1.0654)</td></tr><tr><td>4</td><td>fruit (1.4864)</td><td>matches (0.5646)</td><td>cart (1.3958)</td><td>mountain (0.9509)</td><td>masterful (0.9528)</td></tr><tr><td></td><td>.,.. (1.5863)</td><td>nytimes (0.6993)</td><td>harlan (2.2948)</td><td>eldest (0.7111)</td><td>fe (1.3574)</td></tr><tr><td></td><td>(1.7502)</td><td>prou (0.5905)</td><td>paw (1.3055)</td><td>pretty (0.8762)</td><td>thof (1.2841)</td></tr><tr><td></td><td>excluded (1.2355)</td><td>lower r(0.5390)</td><td>incase (1.2215)</td><td>faces (0.7872)</td><td>where (0.9705)</td></tr><tr><td></td><td>cold (1.4654)</td><td>N/A</td><td>bie (1.5454)</td><td>honey (1.8414)</td><td>kristen (1.1921)</td></tr><tr><td></td><td>stery (1.6085)</td><td>minute (0.5672)</td><td>snuggle (1.1578)</td><td>series (1.6680)</td><td>imam (1.1297)</td></tr><tr><td></td><td>warri (1.3055)</td><td>~ (0.5529)</td><td>along (1.8298)</td><td>coca (1.5571)</td><td>near (0.8942)</td></tr><tr><td>11</td><td>marvelcomics (1.5638)</td><td>well (0.5659)</td><td>lenjoyment (2.3495)</td><td>moon (1.2775)</td><td>tummy (1.4303)</td></tr><tr><td>12</td><td>.: (1.7387)</td><td>ends (0.6113)</td><td>jt (1.3726)</td><td>1h (1.0382)</td><td>hel (0.7644)</td></tr><tr><td>13</td><td>N/A</td><td>mis (0.5826)</td><td>improving (1.3198)</td><td>won (0.9314)</td><td>boop (1.0491)</td></tr><tr><td>14</td><td>lation (1.5015)</td><td>somethin (0.6041)</td><td>srsly (1.6759)</td><td>replied (1.1429)</td><td>N/A</td></tr><tr><td>15</td><td>muh (1.4985)</td><td>seminar (0.5274)</td><td>asteroid (1.3395)</td><td>sent (1.3173)</td><td>facial (1.4452)</td></tr><tr><td>16</td><td>.# (1.9340)</td><td>N/A</td><td>N/A</td><td>piedmont (1.5198)</td><td>during (1.1755)</td></tr></table>
|
| 147 |
+
|
| 148 |
+
Prompt Learning in NLP Knowledge probing for large pre-trained language models, formally defined by Petroni et al. (2019) as “fill-in-the-blank” cloze tests, has recently sparked interest in prompt learning research in NLP (Shin et al., 2020; Jiang et al., 2020; Li & Liang, 2021; Zhong et al., 2021; Lester et al., 2021; Gao et al., 2020; Liu et al., 2021b). The basic idea of knowledge probing is to induce pre-trained language models to generate answers given cloze-style prompts, which can benefit a number of downstream tasks, such as sentiment analysis. Jiang et al. (2020) propose to generate candidate prompts through text mining and paraphrasing, and identify the optimal ones that give the highest training accuracy. Shin et al. (2020) introduce a gradient-based approach, which searches for tokens with the largest gradient changes in the label likelihood. Most related to our work are continuous prompt learning methods (Zhong et al., 2021; Li & Liang, 2021; Lester et al., 2021) which optimize continuous vectors in the word embedding space. A drawback of such methods compared to searching discrete tokens is the lack of a clear way to visualize what “words” are learned for the vectors. We refer readers to Liu et al. (2021a) for a comprehensive survey in the topic of prompt learning in NLP.
|
| 149 |
+
|
| 150 |
+
# 5 CONCLUSION
|
| 151 |
+
|
| 152 |
+
We present $\mathrm { C o O p }$ , a differentiable approach that focuses on continuous prompt learning to facilitate the deployment of pre-trained vision-language models in downstream datasets. The results on the 11 datasets serve as strong evidence of CoOp’s effectiveness in data-efficient learning. The learned prompts are proved much more task-relevant than hand-crafted prompts reflected by the huge improvements in performance, as well as stronger in robustness to distribution shift. In terms of limitation, CoOp requires explicit access to the pre-trained model parameters, which might be unavailable when only the APIs of pre-trained models are provided. An interesting future direction is thus to investigate “black-box” prompt learning.
|
| 153 |
+
|
| 154 |
+
# REFERENCES
|
| 155 |
+
|
| 156 |
+
Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101–mining discriminative components with random forests. In ECCV, 2014.
|
| 157 |
+
|
| 158 |
+
Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In ICML, 2020.
|
| 159 |
+
|
| 160 |
+
Mircea Cimpoi, Subhransu Maji, Iasonas Kokkinos, Sammy Mohamed, and Andrea Vedaldi. Describing textures in the wild. In CVPR, 2014.
|
| 161 |
+
|
| 162 |
+
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.
|
| 163 |
+
|
| 164 |
+
Karan Desai and Justin Johnson. Virtex: Learning visual representations from textual annotations. In CVPR, 2021.
|
| 165 |
+
|
| 166 |
+
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.
|
| 167 |
+
|
| 168 |
+
Mohamed Elhoseiny, Babak Saleh, and Ahmed Elgammal. Write a classifier: Zero-shot learning using purely textual descriptions. In ICCV, 2013.
|
| 169 |
+
|
| 170 |
+
Li Fei-Fei, Rob Fergus, and Pietro Perona. Learning generative visual models from few training examples: An incremental bayesian approach tested on 101 object categories. In CVPR-W, 2004.
|
| 171 |
+
|
| 172 |
+
Andrea Frome, Greg Corrado, Jonathon Shlens, Samy Bengio, Jeffrey Dean, Marc’Aurelio Ranzato, and Tomas Mikolov. Devise: A deep visual-semantic embedding model. In NeurIPS, 2013.
|
| 173 |
+
|
| 174 |
+
Tianyu Gao, Adam Fisch, and Danqi Chen. Making pre-trained language models better few-shot learners. arXiv preprint arXiv:2012.15723, 2020.
|
| 175 |
+
|
| 176 |
+
Lluis Gomez, Yash Patel, Marc¸al Rusinol, Dimosthenis Karatzas, and CV Jawahar. Self-supervised ˜ learning of visual features through embedding images into text topic spaces. In CVPR, 2017.
|
| 177 |
+
|
| 178 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
|
| 179 |
+
|
| 180 |
+
Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In CVPR, 2020.
|
| 181 |
+
|
| 182 |
+
Patrick Helber, Benjamin Bischke, Andreas Dengel, and Damian Borth. Eurosat: A novel dataset and deep learning benchmark for land use and land cover classification. IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, 2019.
|
| 183 |
+
|
| 184 |
+
Olivier J. Henaff, Aravind Srinivas, Jeffrey De Fauw, Ali Razavi, Carl Doersch, S. M. Ali Eslami,´ and Aaron van den Oord. Data-efficient image recognition with contrastive predictive coding. In ¨ ICML, 2020.
|
| 185 |
+
|
| 186 |
+
Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, Dawn Song, Jacob Steinhardt, and Justin Gilmer. The many faces of robustness: A critical analysis of out-of-distribution generalization. ICCV, 2021a.
|
| 187 |
+
|
| 188 |
+
Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. In CVPR, 2021b.
|
| 189 |
+
|
| 190 |
+
Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V Le, Yunhsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. In ICML, 2021.
|
| 191 |
+
|
| 192 |
+
Zhengbao Jiang, Frank F Xu, Jun Araki, and Graham Neubig. How can we know what language models know? ACL, 2020.
|
| 193 |
+
|
| 194 |
+
Armand Joulin, Laurens Van Der Maaten, Allan Jabri, and Nicolas Vasilache. Learning visual features from large weakly supervised data. In ECCV, 2016.
|
| 195 |
+
Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained categorization. In ICCV-W, 2013.
|
| 196 |
+
Jimmy Lei Ba, Kevin Swersky, Sanja Fidler, et al. Predicting deep zero-shot convolutional neural networks using textual descriptions. In ICCV, 2015.
|
| 197 |
+
Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. arXiv preprint arXiv:2104.08691, 2021.
|
| 198 |
+
Ang Li, Allan Jabri, Armand Joulin, and Laurens van der Maaten. Learning visual n-grams from web data. In ICCV, 2017.
|
| 199 |
+
Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. arXiv preprint arXiv:2101.00190, 2021.
|
| 200 |
+
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, 2021a.
|
| 201 |
+
Xiao Liu, Yanan Zheng, Zhengxiao Du, Ming Ding, Yujie Qian, Zhilin Yang, and Jie Tang. Gpt understands, too. arXiv preprint arXiv:2103.10385, 2021b.
|
| 202 |
+
Subhransu Maji, Esa Rahtu, Juho Kannala, Matthew Blaschko, and Andrea Vedaldi. Fine-grained visual classification of aircraft. arXiv preprint arXiv:1306.5151, 2013.
|
| 203 |
+
Maria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In ICVGIP, 2008.
|
| 204 |
+
Omkar M Parkhi, Andrea Vedaldi, Andrew Zisserman, and CV Jawahar. Cats and dogs. In CVPR, 2012.
|
| 205 |
+
Fabio Petroni, Tim Rocktaschel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H Miller, ¨ and Sebastian Riedel. Language models as knowledge bases? In EMNLP, 2019.
|
| 206 |
+
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.
|
| 207 |
+
Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? In ICML, 2019.
|
| 208 |
+
Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In ACL, 2016.
|
| 209 |
+
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.
|
| 210 |
+
Richard Socher, Milind Ganjoo, Hamsa Sridhar, Osbert Bastani, Christopher D Manning, and Andrew Y Ng. Zero-shot learning through cross-modal transfer. In NeurIPS, 2013.
|
| 211 |
+
Khurram Soomro, Amir Roshan Zamir, and Mubarak Shah. Ucf101: A dataset of 101 human actions classes from videos in the wild. arXiv preprint arXiv:1212.0402, 2012.
|
| 212 |
+
Rohan Taori, Achal Dave, Vaishaal Shankar, Nicholas Carlini, Benjamin Recht, and Ludwig Schmidt. Measuring robustness to natural distribution shifts in image classification. In NeurIPS, 2020.
|
| 213 |
+
Yonglong Tian, Yue Wang, Dilip Krishnan, Joshua B Tenenbaum, and Phillip Isola. Rethinking few-shot image classification: a good embedding is all you need? In ECCV, 2020.
|
| 214 |
+
|
| 215 |
+
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, 2017.
|
| 216 |
+
|
| 217 |
+
Haohan Wang, Songwei Ge, Zachary Lipton, and Eric P Xing. Learning robust global representations by penalizing local predictive power. In NeurIPS, 2019.
|
| 218 |
+
|
| 219 |
+
Jianxiong Xiao, James Hays, Krista A Ehinger, Aude Oliva, and Antonio Torralba. Sun database: Large-scale scene recognition from abbey to zoo. In CVPR, 2010.
|
| 220 |
+
|
| 221 |
+
Yuhao Zhang, Hang Jiang, Yasuhide Miura, Christopher D Manning, and Curtis P Langlotz. Contrastive learning of medical visual representations from paired images and text. arXiv preprint arXiv:2010.00747, 2020.
|
| 222 |
+
|
| 223 |
+
Zexuan Zhong, Dan Friedman, and Danqi Chen. Factual probing is [mask]: Learning vs. learning to recall. In NAACL, 2021.
|
| 224 |
+
|
| 225 |
+
Kaiyang Zhou, Ziwei Liu, Yu Qiao, Tao Xiang, and Chen Change Loy. Domain generalization in vision: A survey. arXiv preprint arXiv:2103.02503, 2021.
|
| 226 |
+
|
| 227 |
+
# APPENDIX
|
| 228 |
+
|
| 229 |
+
# A DATASETS DETAILS
|
| 230 |
+
|
| 231 |
+
The detailed statistics of the 11 datasets, as well as the four variants of ImageNet, are shown in Table 5. The hand-crafted prompts used for zero-shot CLIP are also detailed in the table. For Caltech101, the “BACKGROUND Google” and “Faces easy” classes are discarded. For the video dataset, UCF101, the middle frame of each video is used as input to the image encoder.
|
| 232 |
+
|
| 233 |
+
Table 5: Datasets statistics.
|
| 234 |
+
|
| 235 |
+
<table><tr><td>Dataset</td><td>Classes</td><td>Train</td><td>Val</td><td>Test</td><td>Hand-crafted prompt</td></tr><tr><td>ImageNet</td><td>1,000</td><td>1.28M</td><td>N/A</td><td>50.000</td><td>“a photo of a [CLASS]."</td></tr><tr><td>Caltech101</td><td>100</td><td>4,128</td><td>1,649</td><td>2,465</td><td>“a photo of a [CLASS].”</td></tr><tr><td>OxfordPets</td><td>37</td><td>2.944</td><td>736</td><td>3,669</td><td>“a photo of a[CLASS], a type of pet.”</td></tr><tr><td>StanfordCars</td><td>196</td><td>6,509</td><td>1,635</td><td>8,041</td><td>“a photo of a [CLASS].”</td></tr><tr><td>Flowers102</td><td>102</td><td>4.093</td><td>1,633</td><td>2.463</td><td>“a photo of a [CLASS],a type of flower.”</td></tr><tr><td>Food101</td><td>101</td><td>50,500</td><td>20,200</td><td>30,300</td><td>“a photo of [CLASS], a type of food.”</td></tr><tr><td>FGVCAircraft</td><td>100</td><td>3,334</td><td>3,333</td><td>3,333</td><td>“a photo of a [CLASS],a type of aircraft."”</td></tr><tr><td>SUN397</td><td>397</td><td>15,880</td><td>3,970</td><td>19,850</td><td>“a photo of a [CLASS].”</td></tr><tr><td>DTD</td><td>47</td><td>2,820</td><td>1,128</td><td>1,692</td><td>"[CLASS] texture."</td></tr><tr><td>EuroSAT</td><td>10</td><td>13,500</td><td>5,400</td><td>8,100</td><td>“a centered satelite photo of [CLASS]."</td></tr><tr><td>UCF101</td><td>101</td><td>7,639</td><td>1,898</td><td>3,783</td><td>“a photo of a person doing [CLASS]."</td></tr><tr><td>ImageNetV2</td><td>1,000</td><td>N/A</td><td>N/A</td><td>10.000</td><td>“a photo of a [CLASS].”</td></tr><tr><td>ImageNet-Sketch</td><td>1,000</td><td>N/A</td><td>N/A</td><td>50,889</td><td>“a photo of a [CLASS].”</td></tr><tr><td>ImageNet-A</td><td>200</td><td>N/A</td><td>N/A</td><td>7,500</td><td>“a photo of a [CLASS].”</td></tr><tr><td>ImageNet-R</td><td>200</td><td>N/A</td><td>N/A</td><td>30,000</td><td>“a photo of a [CLASS].”</td></tr></table>
|
| 236 |
+
|
| 237 |
+
# B ADDITIONAL RESULTS
|
| 238 |
+
|
| 239 |
+
# B.1 ROBUSTNESS EXPERIMENTS
|
| 240 |
+
|
| 241 |
+
In addition to ResNet-50, we further experiment with more advanced architectures including ResNet-101, ViT-B/32 and ViT-B/16, all of which have pre-trained weights available from CLIP’s GitHub repository. The results are shown in Table 6 where we can draw the same conclusion as the main paper: CoOp offers stronger robustness than hand-crafted prompts and using fewer context tokens benefits domain generalization.
|
| 242 |
+
|
| 243 |
+
# B.2 PROMPT ENGINEERING, PROMPT ENSEMBLING AND COOP
|
| 244 |
+
|
| 245 |
+
Table 7 provides more comprehensive comparisons covering a variety of vision backbones. The observations are similar to those discussed in the main paper: prompt ensembling is clearly better than prompt engineering; and CoOp demonstrates consistent advantages over prompt ensembling.
|
| 246 |
+
|
| 247 |
+
# B.3 CONTEXT LENGTH
|
| 248 |
+
|
| 249 |
+
Figure 6 shows detailed results of using different context lengths for CoOp on each of the 11 datasets. The average performance, displayed in the top-left corner, suggests that using more context tokens is better. There are three exceptions: on ImageNet, OxfordPets, and Food101, the performance is saturated and the improvements diminish when the context length is increased. As discussed in the main paper, selecting a proper length needs to balance between performance on source datasets and robustness to distribution shift in unseen domains. We suggest practitioners use a validation set to identify the optimal context length for their applications.
|
| 250 |
+
|
| 251 |
+
Table 6: Comparison with zero-shot CLIP on robustness to distribution shift using different vision backbones. $M$ : CoOp’s context length.
|
| 252 |
+
|
| 253 |
+
<table><tr><td rowspan="3">Method</td><td rowspan="2">Source</td><td colspan="4">Target</td></tr><tr><td>ImageNetV2</td><td>ImageNet-Sketch</td><td>ImageNet-A</td><td>ImageNet-R</td></tr><tr><td colspan="7">ResNet-50</td></tr><tr><td>Zero-Shot CLIP</td><td>55.41</td><td>48.08</td><td>31.67</td><td>18.63</td><td>53.45</td></tr><tr><td>CLIP + CoOp (M=16)</td><td>60.46</td><td>52.17</td><td>31.14</td><td>19.62</td><td>53.31</td></tr><tr><td>CLIP + CoOp (M=4)</td><td>60.85</td><td>53.02</td><td>32.99</td><td>20.69</td><td>55.57</td></tr><tr><td colspan="7">ResNet-101</td></tr><tr><td>Zero-Shot CLIP</td><td>58.72</td><td>51.57</td><td>36.73</td><td>25.11</td><td>62.15</td></tr><tr><td>CLIP + CoOp (M=16)</td><td>64.39</td><td>55.00</td><td>37.54</td><td>26.31</td><td>61.73</td></tr><tr><td>CLIP + CoOp (M=4)</td><td>63.99</td><td>55.45</td><td>39.11</td><td>27.25</td><td>63.58</td></tr><tr><td colspan="7">ViT-B/32</td></tr><tr><td>Zero-Shot CLIP</td><td>59.88</td><td>51.98</td><td>39.22</td><td>27.44</td><td>63.79</td></tr><tr><td>CLIP + CoOp (M=16)</td><td>64.92</td><td>55.90</td><td>38.79</td><td>28.77</td><td>63.45</td></tr><tr><td>CLIP + CoOp (M=4)</td><td>64.88</td><td>56.21</td><td>40.17</td><td>29.64</td><td>64.60</td></tr><tr><td colspan="7">ViT-B/16</td></tr><tr><td>Zero-Shot CLIP</td><td>64.71</td><td>58.71</td><td>44.77</td><td>43.37</td><td>72.49</td></tr><tr><td>CLIP + CoOp (M=16)</td><td>70.13</td><td>62.23</td><td>44.82</td><td>44.30</td><td>72.98</td></tr><tr><td>CLIP + CoOp (M=4)</td><td>70.11</td><td>62.66</td><td>46.27</td><td>45.46</td><td>74.33</td></tr></table>
|
| 254 |
+
|
| 255 |
+
Table 7: Comparison with prompt engineering and prompt ensembling on ImageNet using different vision backbones.
|
| 256 |
+
|
| 257 |
+
<table><tr><td>Method</td><td>ResNet-50</td><td>ResNet-101</td><td>ViT-B/32</td><td>ViT-B/16</td></tr><tr><td>Prompt engineering</td><td>55.41</td><td>58.72</td><td>59.88</td><td>64.71</td></tr><tr><td>Prompt ensembling</td><td>57.81</td><td>60.49</td><td>62.01</td><td>67.31</td></tr><tr><td>CoOp</td><td>60.46</td><td>64.39</td><td>64.92</td><td>70.13</td></tr></table>
|
| 258 |
+
|
| 259 |
+
# B.4 VISION BACKBONES
|
| 260 |
+
|
| 261 |
+
Figure 7 provides the detailed per-dataset results for various vision backbones. The more advanced the backbone, the better the performance.
|
| 262 |
+
|
| 263 |
+

|
| 264 |
+
Figure 6: Dataset-specific results of using different context lengths for $\mathrm { C o O p }$
|
| 265 |
+
|
| 266 |
+

|
| 267 |
+
Figure 7: Results on the 11 datasets using a variety of vision backbones.
|
md/dev/RA7ND878XP/RA7ND878XP.md
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Segment Anything in High Quality
|
| 2 |
+
|
| 3 |
+
Lei $\mathbf { K e } ^ { * 1 , 2 }$ Mingqiao Ye∗1 Martin Danelljan1 Yifan Liu1 Yu-Wing Tai3 Chi-Keung Tang2 Fisher Yu1 1ETH Zürich 2HKUST 3Dartmouth College
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
The recent Segment Anything Model (SAM) represents a big leap in scaling up segmentation models, allowing for powerful zero-shot capabilities and flexible prompting. Despite being trained with 1.1 billion masks, SAM’s mask prediction quality falls short in many cases, particularly when dealing with objects that have intricate structures. We propose HQ-SAM, equipping SAM with the ability to accurately segment any object, while maintaining SAM’s original promptable design, efficiency, and zero-shot generalizability. Our careful design reuses and preserves the pre-trained model weights of SAM, while only introducing minimal additional parameters and computation. We design a learnable High-Quality Output Token, which is injected into SAM’s mask decoder and is responsible for predicting the high-quality mask. Instead of only applying it on mask-decoder features, we first fuse them with early and final ViT features for improved mask details. To train our introduced learnable parameters, we compose a dataset of 44K fine-grained masks from several sources. HQ-SAM is only trained on the introduced detaset of 44k masks, which takes only 4 hours on 8 GPUs. We show the efficacy of HQ-SAM in a suite of 10 diverse segmentation datasets across different downstream tasks, where 8 out of them are evaluated in a zero-shot transfer protocol. Our code and pretrained models are at https://github.com/SysCV/SAM-HQ.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Accurate segmentation of diverse objects is fundamental for a wide range of scene understanding applications, including image/video editing, robotic perception, and AR/VR. Trained with billionscale mask labels, the Segment Anything Model (SAM) [21] was recently released as a foundational vision model for general image segmentation. SAM is capable of segmenting a wide range of objects, parts, and visual structures in diverse scenarios, by taking a prompt consisting of points, a bounding box, or a coarse mask as input. Its zero-shot segmentation abilities have led to a rapid paradigm shift, as it can be transferred to numerous applications through simple prompting.
|
| 12 |
+
|
| 13 |
+
While SAM has achieved impressive performance, its segmentation results are still unsatisfactory in many cases. In particular, SAM suffers from two key problems: 1) Coarse mask boundaries, often even neglecting the segmentation of thin object structures, as shown in Figure 1. 2) Incorrect predictions, broken masks, or large errors in challenging cases. This is often related to SAM misinterpreting thin structures, such as the kite lines in the rightmost column of Figure 1. These types of failures severely limit the applicability and effectiveness of foundational segmentation models, such as SAM, in particular for automated annotation and image/video editing tasks, where highly accurate image masks are crucial.
|
| 14 |
+
|
| 15 |
+
We propose HQ-SAM, which can predict highly accurate segmentation masks, even in very challenging cases (see Figure 1), without compromising the strong zero-shot capabilities and flexibility of the original SAM. To preserve the efficiency and zero-shot performance, we propose a minimal adaptation of SAM, adding less than $0 . 5 \%$ parameters, to extend its capability to high-quality segmentation.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: The predicted masks of SAM vs. our HQ-SAM, given the same red box or several points on the object as input prompts. HQ-SAM produces significantly more detailed results with very accurate boundaries. In the rightmost column, SAM misinterprets the thin structure of the kite lines, and produces a large portion of errors with broken holes for the input box prompt.
|
| 19 |
+
|
| 20 |
+
Directly fine-tuning the SAM decoder or introducing a new decoder module severely degrades the general zero-shot segmentation performance. We therefore propose the HQ-SAM architecture, which tightly integrates with and re-uses the existing learned SAM structure, in order to fully preserve the zero-shot performance. First, we design a learnable HQ-Output Token that is input to SAM’s mask decoder, alongside the original prompt and output tokens. Unlike the original output tokens, our HQ-Output Token and its associated MLP layers are trained to predict a high-quality segmentation mask. Second, instead of only re-using the SAM’s mask decoder features, our HQ-Output Token operates on a refined feature set to achieve accurate mask details. In particular, we use both global semantic context and local fine-grained features by fusing SAM’s mask decoder features with early and late feature maps from its ViT encoder. During training, we freeze the entire pre-trained SAM parameters, while only updating our HQ-Output Token, its associated three-layer MLPs, and a small feature fusion block.
|
| 21 |
+
|
| 22 |
+
Learning accurate segmentation requires a dataset with accurate mask annotations of diverse objects with complex and detailed geometries. SAM is trained on the SA-1B dataset, which contains 11M images with 1.1 billion masks automatically generated by a SAM-like model. However, using this extensive dataset presents significant cost implications and falls short of achieving the desired high-quality mask generations pursued in our work, as evident by SAM’s performance in Figure 1. Consequently, we compose a new dataset, called HQSeg-44K, which contains 44K extremely fine-grained image mask annotations. HQSeg44K is constructed by merging six existing image datasets [35, 29, 26, 38, 8, 46] with highly accurate mask labels, covering over 1,000 diverse semantic classes. Thanks to the smaller-scale dataset and our minimal integrated architecture, HQ-SAM can be trained in only 4 hours on 8 RTX 3090 GPUs.
|
| 23 |
+
|
| 24 |
+

|
| 25 |
+
Figure 2: Performance vs. speed vs. model size for an array of SAM variants [21, 52].
|
| 26 |
+
|
| 27 |
+
To validate the effectiveness of HQ-SAM, we perform extensive quantitative and qualitative experimental analysis. We provide a comprehensive performance-speed-model size comparison on SAM variants [21, 52] in Figure 2. We compare HQ-SAM with SAM on a suite of 10 diverse segmentation datasets across different downstream tasks, where 8 out of them are under a zero-shot transfer protocol, including COCO [31], UVO [42], SGinW [58], LVIS [14], HQ-YTVIS [20], BIG [6], COIFT [29] and HR-SOD [51]. This rigorous evaluation demonstrates that the proposed HQ-SAM can produce higher-quality masks while maintaining the zero-shot capability compared with SAM.
|
| 28 |
+
|
| 29 |
+
# 2 Related Work
|
| 30 |
+
|
| 31 |
+
High-quality Segmentation Existing works for high-quality segmentation are mostly trained for a specific segmentation task, like image and video instance segmentation [22, 19, 20, 40, 44], semantic segmentation [30, 54, 39, 50] or panoptic segmentation [9], in a close-world paradigm. Some of them focus on post-segmentation refinement using with graphical models such as CRF [23] or region growing [10]. However, the CRF-based refinement is adhere to low-level color boundaries without fully utilizing high-level semantic context and cannot fix large segmentation errors. While some refinement-based works adopt separate deep networks for cascade iterative refinement [6, 37], they are prone to overfitting as shown by our experiment. Compared to these high-quality segmentation [19, 22, 33] or segmentation refinement methods, we focus on accurately segmenting diverse objects on new data with flexible prompting, and build a high-quality zero-shot segmentation model that generalizes to various segmentation tasks and domains. Unlike the post segmentation refinement works [6, 37], to preserve the zero-shot segmentation capability of SAM, HQ-SAM predicts the new high-quality mask directly by reusing the image encoder and mask decoder of SAM, instead of taking the coarse mask and images as the input and feeding it into a separate refinement network. The model architecture of HQ-SAM builds upon SAM with negligible overhead, where we propose efficient token learning for accurate mask predictions. This is completely different from previous high-quality segmentation works, and we show its effectiveness across a wide range of zero-shot experiments.
|
| 32 |
+
|
| 33 |
+
Fine-tuning and Prompt Tuning for Foundation Models Foundation models [2, 1] first appear in the NLP community, where large language models such as GPT series [2] show strong zero-shot generalization to unseen tasks and data. Then, some prompt-based learning works [16, 27, 17] are proposed to help these pre-trained models generalize to the downstream tasks instead of fine-tuning the internal model parameters [15] for better transfer learning. For vision-based foundation models [21, 43, 59], prompt engineering [56, 45, 49, 57] that freezes the pre-trained model is first explored in vision-language models, such as CLIP [36]. These prompts with learnable parameters are designed to help downstream tasks with better context optimization. Different from the existing prompt-based or finetuning works, we focus on the minimal adaptation of SAM toward high-quality segmentation. We directly use the proposed HQ-Output Token output for accurate mask prediction, instead of only leveraging some learnable parameters [56] to help context learning and better generalization.
|
| 34 |
+
|
| 35 |
+
# 3 Method
|
| 36 |
+
|
| 37 |
+
We propose HQ-SAM to upgrade SAM for high-quality zero-shot segmentation. HQ-SAM is lightweight and only introduces two important adaptations to the SAM model. In Sec 3.1, we first briefly review the architecture of SAM on which HQ-SAM is built. Then, in Sec 3.2, we introduce our HQ-SAM with High-Quality Token (HQ-Output Token) and Global-local Feature Fusion, which are the key components to achieve better segmentation quality for SAM while preserving its zero-shot capability. Finally, in Sec 3.3, we describe the training and inference process of HQ-SAM, which is both data and computationally efficient.
|
| 38 |
+
|
| 39 |
+
# 3.1 Preliminaries: SAM
|
| 40 |
+
|
| 41 |
+
SAM [21] is composed of three modules: (a) Image encoder: a heavy ViT-based backbone for image feature extraction, resulting in image embedding in spatial size $6 4 \times 6 4$ . (b) Prompt encoder: encoding the interactive positional information from the input points/boxes/masks to provide for the mask decoder. (c) Mask decoder: a two-layer transformer-based decoder takes both the extracted image embedding with the concatenated output and prompt tokens for final mask prediction. The released SAM model is trained on the large-scale SA-1B dataset, which contains over 1 billion automatically generated masks $4 0 0 \times$ more masks than any existing segmentation datasets [14, 24]) and 11 million images. Thus, SAM shows valuable strong zero-shot generalization to new data without the necessity for additional training. However, we also note that SAM training is very expensive, where distributively training ViT-H-based SAM for 2 epochs on SA-1B requires 256 GPUs with a large batch size of 256 images. For more SAM method details, we refer readers to [21].
|
| 42 |
+
|
| 43 |
+

|
| 44 |
+
Figure 3: HQ-SAM introduces HQ-Output Token and Global-local Feature Fusion to SAM for high-quality mask prediction. To keep the zero-shot capability of SAM, the lightweight HQ-Output Token reuses SAM’s mask decoder, and generates new MLP layers for performing point-wise product with fused HQ-Features. During training, only a few learnable parameters in HQ-SAM are trainable while we fix the model parameters of the pre-trained SAM. The prompt encoder is omitted here for clarity. Error correction is simply used as a direct element-wise sum between the predicted logits of the SAM’s Output Token and the HQ-Output Token during inference.
|
| 45 |
+
|
| 46 |
+
# 3.2 Ours: HQ-SAM
|
| 47 |
+
|
| 48 |
+
In this section, we describe the architecture of the HQ-SAM network. To preserve the zero-shot transfer capability of SAM, while preventing model overfitting or catastrophic forgetting, instead of directly finetuning SAM or adding a new heavy decoder network, we take a minimal adaptation approach as much as possible. To this end, HQ-SAM reuses the pre-trained model weights of SAM as much as possible with only two new key components, namely, High-Quality Output Token and Global-local Feature Fusion, as illustrated in Figure 3. HQ-SAM can thus be regarded as a highquality zero-shot segmentation model evolved from SAM with negligible extra model parameters and computation cost.
|
| 49 |
+
|
| 50 |
+
# 3.2.1 High-Quality Output Token
|
| 51 |
+
|
| 52 |
+
We propose efficient token learning for improving the mask quality of SAM. As shown in Figure 3, in SAM’s original mask decoder design, the output token (similar to object query in DETR [3]) is adopted for mask prediction, which predicts dynamic MLP weights and then performs point-wise product with the mask features. To promote SAM’s mask quality in HQ-SAM, instead of directly taking SAM’s coarse masks as input, we introduce the HQ-Output token and a new mask prediction layer for high-quality mask prediction.
|
| 53 |
+
|
| 54 |
+
In Figure 3, by reusing and fixing SAM’s mask decoder, a new learnable HQ-Output Token (size of $1 \times 2 5 6 ,$ is concatenated with SAM’s output tokens (size of $4 \times 2 5 6$ and prompt tokens (size of $\mathrm { N _ { p r o m p t } } { \times } 2 5 6 $ ) as the input to the SAM’s mask decoder. Similar to the original output token, in each attention layer, HQ-Output Token first performs self-attention with other tokens and then conducts both token-to-image and the reverse image-to-token attention for its feature updating. Note that HQ-Output Token uses the point-wise MLP shared by the other tokens in each decoder layer. After passing through two decoder layers, the updated HQ-Output Token has access to the global image context, the critical geometric/type information of prompt tokens as well as hidden mask information of the other output tokens. Finally, we add a new three-layer MLP to generate dynamic convolutional kernels from the updated HQ-Output Token, which then performs spatially point-wise product with the fused HQ-feature for high-quality mask generation.
|
| 55 |
+
|
| 56 |
+
Instead of directly finetuning SAM or further adding a heavy post-refinement network, we only allow the HQ-Output Token and its associated three-layer MLPs to be trained for correcting the mask errors of SAM’s output token. This is completely different from existing high-quality segmentation models [19, 6, 20, 22]. We identify two main advantages of our efficient token learning through extensive experiments: 1) This strategy significantly improves SAM’s mask quality while only introducing negligible parameters compared to original SAM, making HQ-SAM training extremely time and data-efficient; 2) The learned token and MLP layers do not overfit to mask the annotation bias of a specific dataset, thus keeping SAM’s strong zero-shot segmentation capability on new images without catastrophic knowledge forgetting.
|
| 57 |
+
|
| 58 |
+
# 3.2.2 Global-local Fusion for High-quality Features
|
| 59 |
+
|
| 60 |
+
Very accurate segmentation also requires input image feature with both rich global semantic context and local boundary details. To further promote mask quality, we enrich both the high-level object context and low-level boundary/edge information in the mask decoder features of SAM. Instead of directly using SAM’s mask decoder feature, we compose the new high-quality features (HQFeatures) by extracting and fusing features from different stages of the SAM model: 1) The early layer local feature of SAM’s ViT encoder with spatial shape $6 4 \times 6 4$ , which captures more general image edge/boundary details [12]. Concretely, we extract the feature after the first global attention block of the ViT encoder, and for ViT-Large based SAM, this is the 6th block output for the 24 blocks in total; 2) The final layer global feature of SAM’s ViT encoder with shape $6 4 \times 6 4$ , which has more global image context information; 3) The mask feature in SAM’s mask decoder with size $2 5 6 \times 2 5 6$ , which is also shared by the output tokens, contains strong mask shape information.
|
| 61 |
+
|
| 62 |
+
As shown in Figure 3, to obtain the input HQ-Features, we first upsample the early-layer and finallayer encoder features to the spatial size $2 5 6 \times 2 5 6$ by transposed convolution. Then, we sum up these three types of features in an element-wise manner after simple convolutional processing. We show that this global-local feature fusion is simple while effective, yielding detail-preserving segmentation results with a small memory footprint and computation burden. We also perform detailed ablation on the effect of each feature source in the experimental section (Table 3).
|
| 63 |
+
|
| 64 |
+
# 3.3 Training and Inference of HQ-SAM
|
| 65 |
+
|
| 66 |
+
Training Data Construction To train HQ-SAM in a data-efficient manner, instead of further training on SA-1B [21], we compose a new training dataset HQSeg-44K which contains 44,320 extremely accurate image mask annotations. We note that the released SA-1B dataset only contains automatically generated mask labels, missing very accurate manual annotation on objects with complex structures. Due to the annotation difficulty, HQSeg-44K leverages a collection of six existing image datasets including DIS [35] (train set), ThinObject-5K [29] (train set), FSS-1000 [26], ECSSD [38], MSRA10K [8], DUT-OMRON [46] with extremely fine-grained mask labeling, where each of them contains 7.4K mask labels on average. To make HQ-SAM robust and generalizable to new data, HQSeg-44K contains diverse semantic classes of more than 1,000. We show the advantage of using HQSeg-44K by comparing HQ-SAM training with 44K randomly sampled images and masks from SA-1B [21] in our supplemental analysis.
|
| 67 |
+
|
| 68 |
+
HQ-SAM Training During training, we fix the model parameters of the pre-trained SAM model while only making the proposed HQ-SAM learnable. The learnable parameters thus only include the HQ-Output Token, its associated three-layer MLP and three simple convolutions for HQ-Features fusion. Since SAM is designed for flexible segmentation prompts, we train HQ-SAM by sampling mixed types of prompts including bounding boxes, randomly sampled points, and coarse masks input. We generate these degraded masks by adding random Gaussian noise in the boundary regions of the GT masks. For generalizability to different object scales, we use large-scale jittering [13]. We use a learning rate of 0.001 and train our HQ-SAM for 12 epochs, with a learning rate drop after 10 epochs. We train on 8 Nvidia GeForce RTX 3090 GPUs with a total batch size of 32, which takes 4 hours to train for 16.6K iterations. Please refer to our supplemental file for more details.
|
| 69 |
+
|
| 70 |
+
HQ-SAM Inference We follow the same inference pipeline of SAM but use the mask prediction from HQ-Output token as high-quality mask prediction. During inference, we sum the predicted logits of the SAM mask (by Output Token) and our predicted mask (by HQ-Output Token) for mask correction on spatial resolution $2 5 6 \times 2 5 6$ . Then we up-sample the corrected mask to the original resolution $1 0 2 4 \times 1 0 2 4$ as our output.
|
| 71 |
+
|
| 72 |
+
SAM vs. HQ-SAM on Training and Inference In Table 1, we report detailed training and inference comparisons between our HQ-SAM and SAM. While HQ-SAM produces substantially better segmentation quality, its training is very quick and affordable, which only takes 4 hours with 8 RTX3090 GPUs. HQ-SAM is also lightweight and efficient, introducing negligible increases in model parameters, GPU memory usage, and inference time per image.
|
| 73 |
+
|
| 74 |
+
Table 1: Training and inference comparison between ViT-L [11] based SAM and HQ-SAM. HQ-SAM brings negligible extra computation burden to SAM, with less than $0 . 5 \%$ increase in model parameters and reaching $96 \%$ of its original speed. SAM-L is trained on 128 A100 GPUs for 180k iterations. Based on SAM-L, we only need to train our HQ-SAM on 8 RTX3090 GPUs for 4 hours.
|
| 75 |
+
|
| 76 |
+
<table><tr><td rowspan="2">Method</td><td colspan="4">Training</td><td colspan="2">Inference</td></tr><tr><td>Learnable Params (M)</td><td># GPU</td><td>Batch Size</td><td>Time (h)</td><td>FPS</td><td>Mem.</td></tr><tr><td>SAM [21]</td><td>1191</td><td>128</td><td>128</td><td>N/A</td><td>5.0</td><td>7.6G</td></tr><tr><td>HQ-SAM</td><td>5.1</td><td>8</td><td>32</td><td>4</td><td>4.8</td><td>7.6G</td></tr></table>
|
| 77 |
+
|
| 78 |
+
# 4 Experiments
|
| 79 |
+
|
| 80 |
+
# 4.1 Experimental Setup
|
| 81 |
+
|
| 82 |
+
Datasets For training we use the compiled HQSeg-44K, described in Section 3.3. For a comprehensive evaluation of the segmentation performance of HQ-SAM, we perform experiments on a wide range of datasets, including four extremely fine-grained segmentation datasets: DIS [35] (validation set), ThinObject-5K [29] (test set), COIFT [29] and HR-SOD [51]. Besides, we experiment on popular and challenging benchmarks across various image/video-based segmentation tasks in zero-shot settings, such as COCO [31], SGinW [58], UVO [42], LVIS [14], HQ-YTVIS [20] and BIG [6].
|
| 83 |
+
|
| 84 |
+
Evaluation Metrics To accurately quantify improvements in mask quality, instead of only employing the standard mask AP or mask mIoU, we also adopt boundary metrics mBIoU and boundary $\mathsf { A P } _ { B }$ [5]. We also evaluate on stricter $\mathsf { A P } _ { B } ^ { \mathrm { s t r i c t } }$ by adjusting the default dilation ratio from 0.02 to 0.01 on UVO [42] and LVIS [14]. For evaluation on the four fine-grained segmentation datasets [35, 29, 51], we also report the averaged boundary and mask IoU among them. For video instance segmentation evaluation on HQ-YTVIS [20], we use both Tube Boundary $\mathsf { A P } ^ { B }$ and Tube Mask $\mathsf { A P } ^ { M }$ .
|
| 85 |
+
|
| 86 |
+
# 4.2 Ablation Experiments
|
| 87 |
+
|
| 88 |
+
We conduct detailed ablation studies on the proposed HQ-SAM using ViT-Large as the backbone, analyzing the impact of the proposed HQ-Output Token and HQ-Features on segmentation quality especially in zero-shot cases. For ablation experiments, we use the four aforementioned extremely accurate segmentation datasets, namely, DIS (val) [35], ThinObject-5K (test) [29], COIFT [29] and HR-SOD [51] as well as the COCO validation set.
|
| 89 |
+
|
| 90 |
+
Effect of the High-Quality Output Token . HQ-SAM employs HQ-Output Token for high-quality mask prediction. Table 2 compares our HQ-Output Token to the baseline SAM and other existing prompt/token learning strategies, such as adding an additional three context tokens [56] as learnable vectors into the SAM’s mask decoder for better context learning. Compared to using context tokens, the HQ-Output token consistently brings larger performance gains on four high-quality datasets, with 13.2 mBIoU on DIS and 2.7 mBIoU on COIFT datasets. We also perform other ablation experiment variants, such as computing the scaled dot product [18] between the original SAM’s output token and our HQ-Output token or restricting the mask loss to only inside the boundary regions, and find they slightly decrease the averaged performance on the four evaluation datasets. Compared to SAM, HQ-SAM significantly improves the mBIoU on DIS benchmark from 52.8 to 70.4 and also promotes the mBIoU on the HRSOD dataset for 3.8 points.
|
| 91 |
+
|
| 92 |
+
Ablation on the Global-local Fusion for HQ-Features Table 3 tabulates the effect of global-local fusion, where the importance of each feature component is analyzed in HQ-Features during the fusion process. Compared to directly using the mask decoder feature of SAM, the entire HQ-Features bring an obvious advantage of $2 . 6 \ \mathrm { m B I o U }$ on four highly accurate segmentation datasets. The final-layer ViT encoder feature with global context increases the mBIoU from 80.1 to 81.3. while the early-layer feature with local details further promotes the mBIoU to 81.8. We also replace the proposed global-local fusion with the conventional FPN to build a feature pyramid for fusion, and found this brought an inferior performance, decreasing from 89.1 to 87.4 mIoU.
|
| 93 |
+
|
| 94 |
+
Comparison to SAM finetuning or post-refinement . In Table 4, we compare our efficient token adaptation strategy to adding an extra post-refinement network [6] and model finetuning, including directly finetuning SAM’s mask decoder or only finetuning its output token for mask prediction. Adding an extra heavy post-refinement network brings limited averaged performance increase on four HQ datasets but leads to very poor performance on COCO, indicating strong overfitting. We also observe a similar phenomenon when directly finetuning SAM’s mask decoder. Only finetuning SAM’s output token can address the catastrophic forgetting problem with improvement on the four HQ datasets and COCO. However, the incremental improvement is still much smaller compared to ours. HQ-SAM improves 1.1 $\mathsf { A P } _ { B }$ on COCO while output token finetuning only gives an increase of $0 . 4 \ : \mathrm { A P } _ { B }$ . This shows the advantage of HQ-SAM in data-efficient learning while preserving the zero-shot capability of SAM.
|
| 95 |
+
|
| 96 |
+
Table 2: Ablation study of the HQ-Output Token on four extremely fine-grained segmentation datasets. We adopt the boxes converted from their GT masks as the box prompt input. By default, we train the predicted mask of HQ Output-Token by computing full GT mask loss.
|
| 97 |
+
|
| 98 |
+
<table><tr><td rowspan="2">Model</td><td colspan="2">DIS [35]</td><td colspan="2">COIFT [29]</td><td colspan="2">HRSOD [51]</td><td colspan="2">ThinObject [29]</td><td colspan="2">Average</td></tr><tr><td>mIoU</td><td>mBIoU</td><td>mIoU</td><td>mBIoU</td><td>mIoU</td><td>mBIoU</td><td>mIoU</td><td>mBIoU</td><td>mIoU</td><td>mBIoU</td></tr><tr><td>SAM (baseline)</td><td>62.0</td><td>52.8</td><td>92.1</td><td>86.5</td><td>90.2</td><td>83.1</td><td>73.6</td><td>61.8</td><td>79.5</td><td>71.1</td></tr><tr><td>Using SAM's mask decoder feature:</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>SAM+Context Token [56]</td><td>71.5</td><td>62.2</td><td>93.0</td><td>87.7</td><td>91.8</td><td>85.0</td><td>84.5</td><td>73.1</td><td>85.2</td><td>77.0</td></tr><tr><td>SAM + HQ-Output Token (× Output Token)</td><td>75.1</td><td>65.8 66.4</td><td>93.9</td><td>88.9</td><td>93.0</td><td>86.1</td><td>86.1</td><td>74.6</td><td>87.0</td><td>78.9</td></tr><tr><td>SAM + HQ-Output Token (Boundary Loss) SAM + HQ-Output Token</td><td>75.2 75.3</td><td>66.0</td><td>94.0 94.2</td><td>88.9 89.2</td><td>92.1 93.0</td><td>85.7 86.1</td><td>87.3 86.8</td><td>76.0 75.4</td><td>87.2 87.3</td><td>79.3</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>79.2</td></tr><tr><td>Using Our HQ-Feature:</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>SAM + HQ-Output Token (+ Context Token)</td><td>78.5</td><td>70.4</td><td>94.6</td><td>89.6</td><td>93.6</td><td>87.0</td><td>88.9 89.5</td><td>79.3</td><td>88.9 89.1</td><td>81.6</td></tr><tr><td>SAM+ HQ-Output Token</td><td>78.6</td><td>70.4</td><td>94.8</td><td>90.1</td><td>93.6</td><td>86.9</td><td></td><td>79.9</td><td></td><td>81.8</td></tr></table>
|
| 99 |
+
|
| 100 |
+
Table 3: Ablation study on the HQ-Features sources. Early-layer denotes the feature after the first global attention block of the ViT encoder, while final-layer denotes the output of the last ViT block. Four HQ datasets denote DIS (val) [35], ThinObject-5K (test) [29], COIFT [29] and HR-SOD [51].
|
| 101 |
+
|
| 102 |
+
<table><tr><td>Model</td><td>Fusion conv</td><td>Decoder Mask feature</td><td>ViT Encoder Final-layer Early-layer</td><td>mIoU</td><td>Four HQ datasets mBIoU</td></tr><tr><td>SAM [21]</td><td></td><td>√</td><td></td><td>79.5</td><td>71.1</td></tr><tr><td rowspan="5">HQ-SAM (Ours)</td><td rowspan="5">广</td><td>√</td><td></td><td></td><td>87.3 79.2</td></tr><tr><td>√</td><td></td><td>87.8</td><td>80.1</td></tr><tr><td></td><td></td><td>15.1</td><td>9.0</td></tr><tr><td>√ √</td><td>广</td><td></td><td>88.6 81.3</td></tr><tr><td>√ √</td><td>√ √ √ 丁</td><td>88.6 89.1</td><td>81.1 81.8</td></tr></table>
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 4: Recall rate comparison between COIFT [29] and HRSOD [51] under the zero-shot protocol, using BIoU thresholds ranging from loose to strict. The performance gap between SAM and our HQ-SAM increases significantly when we vary from a loose BIoU threshold of 0.5 to a very strict threshold of 0.9, showing the advantage of HQ-SAM in predicting very accurate segmentation masks.
|
| 106 |
+
|
| 107 |
+
Accuracy analysis at different BIoU thresholds Figure 4 compares SAM and HQ-SAM from loose to strict BIoU thresholds. We plot the percentage of mask predictions that have a BIoU larger than the threshold indicated on the $\mathbf { X }$ -axis. The large performance gap with strict IoU thresholds on both COIFT [29] and HRSOD [51] clearly validates the advantage of HQ-SAM in predicting very accurate masks. However, even at the loose threshold of 0.5, HQ-SAM reduces the number of incorrect predictions by SAM by $81 \%$ for COIFT and $69 \%$ for HRSOD. This shows that HQ-SAM predictions are not only substantially more accurate but also more robust in challenging cases.
|
| 108 |
+
|
| 109 |
+
Table 4: Comparison with model finetuning or extra post-refinement [6]. For the COCO dataset, we use a SOTA detector FocalNet-DINO [53] trained on the COCO dataset as our box prompt generator.
|
| 110 |
+
|
| 111 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">Four HQ datasets mIoU mBIoU</td><td rowspan="2"></td><td colspan="5">CoCo</td></tr><tr><td>APB</td><td>AP</td><td>APL</td><td>APm</td><td>APs</td></tr><tr><td>SAM (baseline)</td><td>79.5</td><td>71.1</td><td>33.3</td><td>48.5</td><td>63.9</td><td>53.1</td><td>34.1</td></tr><tr><td>Training the whole SAM</td><td>38.0</td><td>12.2</td><td>0.2</td><td>5.5</td><td>1</td><td>-</td><td>1</td></tr><tr><td>Add Context Token [56]</td><td>85.2</td><td>77.0</td><td>31.9</td><td>47.2</td><td>65.1</td><td>51.2</td><td>31.9</td></tr><tr><td>CascadePSP Post-refinement [6]</td><td>80.9</td><td>74.6</td><td>2.8</td><td>13.4</td><td>43.4</td><td>9.4</td><td>0.0</td></tr><tr><td>CRM Post-refinement [37]</td><td>81.4</td><td>75.4</td><td>15.9</td><td>28.7</td><td>=</td><td>-</td><td>-</td></tr><tr><td>Finetune SAM's decoder</td><td>87.6</td><td>79.5</td><td>9.0</td><td>19.5</td><td>45.2</td><td>15.8</td><td>4.7</td></tr><tr><td>Finetune SAM's output token</td><td>87.6</td><td>79.7</td><td>33.7</td><td>48.7</td><td>66.0</td><td>52.3</td><td>33.6</td></tr><tr><td>HQ-SAM (Ours)</td><td>89.1</td><td>81.8</td><td>34.4</td><td>49.5</td><td>66.2</td><td>53.8</td><td>33.9</td></tr></table>
|
| 112 |
+
|
| 113 |
+
Table 5: Zero-shot open-world instance segmentation results comparison on UVO [42]. We use FocalNet-DINO [53] trained on the COCO dataset as our box prompt generator. $* ^ { s t r i c t }$ denotes the boundary region with a tighter threshold.
|
| 114 |
+
|
| 115 |
+
<table><tr><td>Model</td><td>APsict</td><td>AP</td><td>AP6</td><td>APB</td><td>APB75</td><td>APB50</td><td>AP</td></tr><tr><td>SAM</td><td>8.6</td><td>3.7</td><td>25.6</td><td>17.3</td><td>14.4</td><td>37.7</td><td>29.7</td></tr><tr><td>HQ-SAM</td><td>9.9</td><td>5.0</td><td>28.2</td><td>18.5</td><td>16.3</td><td>38.6</td><td>30.1</td></tr></table>
|
| 116 |
+
|
| 117 |
+
Table 6: Zero-shot segmentation result comparison on the test set of high-quality BIG [6] benchmark using various types of input prompts. We employ PSPNet [55] to generate the coarse mask prompt.
|
| 118 |
+
|
| 119 |
+
<table><tr><td>Model</td><td>GT Box Prompt mIoU</td><td>mBIoU</td><td>Mask Prompt mIoU</td><td>mBIoU</td></tr><tr><td>SAM</td><td>81.1</td><td>70.4</td><td>66.6</td><td>41.8</td></tr><tr><td>HQ-SAM</td><td>86.0</td><td>75.3</td><td>86.9</td><td>75.1</td></tr></table>
|
| 120 |
+
|
| 121 |
+
# 4.3 Zero-shot Comparison with SAM
|
| 122 |
+
|
| 123 |
+
We perform extensive zero-shot transfer comparisons between our HQ-SAM and SAM on 7 benchmarks, including SGinW [58], COCO [31], UVO [42], LVIS [14], HQ-YTVIS [20], BIG [6], COIFT [29] and HR-SOD [51], where HQ-SAM outperforms SAM without bells and whistles, demonstrating its efficacy and kept generalization ability even trained with a small-scale dataset.
|
| 124 |
+
|
| 125 |
+
Results on the SGinW Benchmark Equipped with the same Grounding-DINO [32] as box prompts, we also performed experiments by replacing SAM with HQ-SAM in Grounded-SAM, and obtained the first place in the Segmentation in the Wild (SGinW) competition1 on the zero-shot track. Note that SGinW contains 25 zero-shot in-the-wild segmentation datasets for evaluation, and GroundedHQ-SAM with 49.6 mean AP and outperforms Grounded-SAM obviously using the same detector.
|
| 126 |
+
|
| 127 |
+
Zero-Shot Open-world Segmentation To evaluate the zero-shot segmentation results in the openworld environment, in Table 5, we compare SAM and our HQ-SAM on the challenging UVO [42] benchmark with diverse and dense objects mask annotations. By taking the same pre-trained object detector [53] as box prompt input, our HQ-SAM improves for $1 . 3 \mathrm { A P } _ { B } ^ { \mathrm { s t r i c t } }$ t and 2.6 APstrictB50 over SAM.
|
| 128 |
+
|
| 129 |
+
Zero-Shot Segmentation on High-resolution BIG Dataset In Table 6, we compare the zero-shot segmentation quality between SAM and HQ-SAM on the high-resolution BIG benchmark [6] with two types of prompts, including using GT object boxes or the provided coarse masks input. HQ-SAM consistently surpasses SAM, with obvious advantages using different types of prompts, and is much more robust to coarse masks prompts with partial boundary errors (provided by PSPNet [55]).
|
| 130 |
+
|
| 131 |
+
Zero-shot Instance Segmentation on COCO and LVIS In Table 7, we also evaluate HQ-SAM on the popular COCO and LVIS benchmarks respectively by feeding box prompts generated by the trained detectors of these two datasets. HQ-SAM consistently outperforms SAM by $1 . 1 \mathrm { \ A P } _ { B }$ on COCO and $0 . 7 \mathrm { A P } _ { B 7 5 } ^ { \mathrm { s t r i c t } }$ on LVIS, showing the improved mask quality and well-preserved zero-shot segmentation ability during the HQ-SAM training process.
|
| 132 |
+
|
| 133 |
+
Table 7: Zero-shot instance segmentation results comparison on COCO [31] and LVISv1 [14]. For the COCO dataset, we use FocalNet-DINO [53] detector trained on COCO. For LVIS, we adopt ViTDet-H [28] trained on the LVIS dataset as our box prompt generator. For SAM, we use the ViT-L backbone and box prompt. We maintain the zero-shot segmentation capability of the original SAM while improving the mask quality on the boundary region.
|
| 134 |
+
|
| 135 |
+
<table><tr><td rowspan="2">Model</td><td colspan="2">COCO</td><td colspan="5">LVIS</td></tr><tr><td>APB</td><td>AP</td><td>APsiet</td><td>AP</td><td>APB</td><td>APB75</td><td>AP</td></tr><tr><td>SAM</td><td>33.3</td><td>48.5</td><td>32.1</td><td>32.8</td><td>38.5</td><td>40.9</td><td>43.6</td></tr><tr><td>HQ-SAM</td><td>34.4</td><td>49.5</td><td>32.5</td><td>33.5</td><td>38.8</td><td>41.2</td><td>43.9</td></tr></table>
|
| 136 |
+
|
| 137 |
+

|
| 138 |
+
Figure 5: Interactive segmentation results comparison using a varying number of input points on the COIFT [29] (zero-shot) and DIS [35] val set. HQ-SAM consistently outperforms SAM with various point numbers, and the relative improvement is more obvious with less prompt ambiguity.
|
| 139 |
+
|
| 140 |
+
Table 8: Zero-shot Video Instance Segmentation comparison on the test set of the very accurately labeled HQ-YTVIS [20] benchmark. We utilize pre-trained Swin-L-based Mask2Fromer [4] on YTVIS [47] as our box prompt input while reusing its object association prediction.
|
| 141 |
+
|
| 142 |
+
<table><tr><td>Model</td><td>APB</td><td>AP</td><td>AP5</td><td>APM</td><td>AP</td><td>AP</td></tr><tr><td>SAM</td><td>30.2</td><td>19.1</td><td>72.9</td><td>60.7</td><td>68.1</td><td>90.5</td></tr><tr><td>HQ-SAM</td><td>34.0</td><td>24.3</td><td>79.5</td><td>63.6</td><td>70.5</td><td>91.1</td></tr></table>
|
| 143 |
+
|
| 144 |
+
Point-based Interactive Segmentation Comparison To investigate the segmentation performance of HQ-SAM with interactive point prompts, in Figure 5, we compare HQ-SAM to SAM with varying numbers of input points on COIFT [29] (zero-shot) and DIS [35] val set. HQ-SAM consistently outperforms SAM with different point prompts on both two datasets. We note that the relative performance increase is more significant when the prompt contains less object ambiguity with more input points information (increasing from 1 positive point to 10 positive points $+ 5$ negative points).
|
| 145 |
+
|
| 146 |
+
Zero-shot High-quality Video Instance Segmentation Besides conducting image-based segmentation evaluation, we also perform video instance segmentation results comparison on the accurately annotated HQ-YTVIS benchmark [20]. We take the pre-trained Mask2Former [4] as our video box prompts and feed it into SAM and our HQ-SAM for mask prediction. In Table 8, HQ-SAM achieves remarkable gains of 3.8 points in Tube Boundary $\mathsf { A P } ^ { B }$ and 2.9 Tube Mask $\mathsf { A P } ^ { M }$ .
|
| 147 |
+
|
| 148 |
+
Visualization of HQ-Output Token In Figure 6, we provide visual comparison of our HQ-Output Token vs. SAM’s common output token for their cross-attention maps in the last token-to-image layer of the mask decoder. We observe that our HQ-Output Token attends to the boundary and thin structure regions that are missed by the common token.
|
| 149 |
+
|
| 150 |
+
Zero-shot Visual Results Comparison In Figure 7, we compare HQ-SAM to SAM qualitatively in a zero-shot transfer setting, where HQ-SAM significantly promotes the mask details of SAM and also improves the masks of broken holes or large portion errors by the enriched semantic context. Refer to the supplemental file for more visual comparisons.
|
| 151 |
+
|
| 152 |
+
Comparison with Adapter Tuning Strategy In Table 9, we also compare our efficient token adaptation strategy to the recent Adapter Tuning [48] and LoRA [17]. We introduce lightweight adapters to ViT layers of SAM’s encoder for encoder tuning and identify that this strategy leads to overfitting and its zero-shot performance on COCO decreases from 33.3 to 29.6. This validates our design choice to freeze SAM’s encoder, and mainly focus on SAM’s decoder.
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
|
| 156 |
+

|
| 157 |
+
Figure 6: Cross-attention of SAM’s original token vs. HQ-Output Token in the last decoder layer. HQ-Token attends to the boundary and thin structure regions that are missed by the original token.
|
| 158 |
+
Figure 7: Visual results comparison between SAM (top row) vs. HQ-SAM (bottom row) in a zero-shot transfer setting, given the same red box or point prompt. HQ-SAM produces significantly more detailed-preserving results and also addresses the mask errors with broken holes.
|
| 159 |
+
|
| 160 |
+
Table 9: Comparison to Adapter Tuning [48] or using LoRA [17] in SAM’s encoder using ViT-L based SAM and the same HQSeg-44K. For the COCO dataset, we use the SOTA detector FocalNetDINO [53] trained on the COCO dataset as our box prompt generator.
|
| 161 |
+
|
| 162 |
+
<table><tr><td rowspan="2">Model</td><td colspan="5">CoCo</td><td colspan="2">Model Params (MB)</td></tr><tr><td>APB</td><td>AP</td><td>APL</td><td>APM</td><td>APs</td><td>Total</td><td>Trainable</td></tr><tr><td>SAM</td><td>33.3</td><td>48.5</td><td>63.9</td><td>53.1</td><td>34.1</td><td>1191</td><td>1</td></tr><tr><td>SAM+LoRA[17]</td><td>28.6</td><td>43.7</td><td>-</td><td>-</td><td>-</td><td>1192.5</td><td>1.5</td></tr><tr><td>SAM + Encoder Adapter [48]</td><td>29.6</td><td>44.8</td><td>63.9</td><td>47.8</td><td>29.0</td><td>1203</td><td>12.0</td></tr><tr><td>HQ-SAM</td><td>34.4</td><td>49.5</td><td>66.2</td><td>53.8</td><td>33.9</td><td>1196.1</td><td>5.1</td></tr></table>
|
| 163 |
+
|
| 164 |
+
Mobile Efficiency Although HQ-SAM significantly boosts SAM’s mask quality with negligible overhead, it shares the heavy ViT encoder of SAM, and thus cannot achieve a real-time speed in video processing. For efficient mobile deployment, we propose Light HQ-SAM based on the tiny ViT image encoder provided by MobileSAM [52]. In Figure 2, achieving running speed of $4 1 . 2 \ : \mathrm { F P S }$ , Light HQ-SAM improves the zero-shot COCO AP of MobileSAM from 44.3 to 45.0 with negligible additional cost, i.e., 1.7MB increase in model parameters.
|
| 165 |
+
|
| 166 |
+
# 5 Conclusion
|
| 167 |
+
|
| 168 |
+
We propose HQ-SAM, the first high-quality zero-shot segmentation model by introducing negligible overhead to the original SAM. We propose a lightweight High-quality Output Token in HQ-SAM to replace the original SAM’s output token for high-quality mask prediction. After training only on 44K highly-accurate masks, HQ-SAM significantly boosts the mask prediction quality of SAM, which was trained on 1.1 billion masks. The zero-shot transfer evaluation is performed on 8 segmentation benchmarks across both image and video tasks, spanning diverse objects and scenes. Our research offers timely insights into how to leverage and extend SAM-like foundational segmentation models in a data-efficient and computation-affordable manner.
|
| 169 |
+
|
| 170 |
+
# References
|
| 171 |
+
|
| 172 |
+
Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, et al. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258, 2021. [2] 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. In NeurIPS, 2020.
|
| 173 |
+
[3] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, 2020.
|
| 174 |
+
[4] 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.
|
| 175 |
+
[5] Bowen Cheng, Ross Girshick, Piotr Dollár, Alexander C. Berg, and Alexander Kirillov. Boundary IoU: Improving object-centric image segmentation evaluation. In CVPR, 2021.
|
| 176 |
+
[6] Ho Kei Cheng, Jihoon Chung, Yu-Wing Tai, and Chi-Keung Tang. CascadePSP: Toward class-agnostic and very high-resolution segmentation via global and local refinement. In CVPR, 2020.
|
| 177 |
+
[7] Ho Kei Cheng and Alexander G. Schwing. XMem: Long-term video object segmentation with an atkinson-shiffrin memory model. In ECCV, 2022.
|
| 178 |
+
[8] Ming-Ming Cheng, Niloy J Mitra, Xiaolei Huang, Philip HS Torr, and Shi-Min Hu. Global contrast based salient region detection. TPAMI, 37(3):569–582, 2014. [9] Daan de Geus and Gijs Dubbelman. Intra-batch supervision for panoptic segmentation on high-resolution images. In WACV, 2023.
|
| 179 |
+
[10] Philipe Ambrozio Dias and Henry Medeiros. Semantic segmentation refinement by monte carlo region growing of high confidence detections. In ACCV, 2019.
|
| 180 |
+
[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 ICLR, 2021.
|
| 181 |
+
[12] Amin Ghiasi, Hamid Kazemi, Eitan Borgnia, Steven Reich, Manli Shu, Micah Goldblum, Andrew Gordon Wilson, and Tom Goldstein. What do vision transformers learn? a visual exploration. arXiv preprint arXiv:2212.06727, 2022.
|
| 182 |
+
[13] Golnaz Ghiasi, Yin Cui, Aravind Srinivas, Rui Qian, Tsung-Yi Lin, Ekin D Cubuk, Quoc V Le, and Barret Zoph. Simple copy-paste is a strong data augmentation method for instance segmentation. In CVPR, 2021.
|
| 183 |
+
[14] Agrim Gupta, Piotr Dollar, and Ross Girshick. Lvis: A dataset for large vocabulary instance segmentation. In CVPR, 2019.
|
| 184 |
+
[15] Stefan Hinterstoisser, Vincent Lepetit, Paul Wohlhart, and Kurt Konolige. On pre-trained image features and synthetic images for deep learning. In ECCV Workshops, 2018.
|
| 185 |
+
[16] 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.
|
| 186 |
+
[17] 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.
|
| 187 |
+
[18] Menglin Jia, Luming Tang, Bor-Chun Chen, Claire Cardie, Serge Belongie, Bharath Hariharan, and Ser-Nam Lim. Visual prompt tuning. In ECCV, 2022.
|
| 188 |
+
[19] Lei Ke, Martin Danelljan, Xia Li, Yu-Wing Tai, Chi-Keung Tang, and Fisher Yu. Mask transfiner for high-quality instance segmentation. In CVPR, 2022.
|
| 189 |
+
[20] Lei Ke, Henghui Ding, Martin Danelljan, Yu-Wing Tai, Chi-Keung Tang, and Fisher Yu. Video mask transfiner for high-quality video instance segmentation. In ECCV, 2022.
|
| 190 |
+
[21] Alexander Kirillov, Eric Mintun, Nikhila Ravi, Hanzi Mao, Chloe Rolland, Laura Gustafson, Tete Xiao, Spencer Whitehead, Alexander C. Berg, Wan-Yen Lo, Piotr Dollár, and Ross Girshick. Segment anything. In ICCV, 2023.
|
| 191 |
+
[22] Alexander Kirillov, Yuxin Wu, Kaiming He, and Ross Girshick. Pointrend: Image segmentation as rendering. In CVPR, 2020.
|
| 192 |
+
[23] Philipp Krähenbühl and Vladlen Koltun. Efficient inference in fully connected crfs with gaussian edge potentials. In NeurIPS, 2011.
|
| 193 |
+
[24] Alina Kuznetsova, Hassan Rom, Neil Alldrin, Jasper Uijlings, Ivan Krasin, Jordi Pont-Tuset, Shahab Kamali, Stefan Popov, Matteo Malloci, Alexander Kolesnikov, et al. The open images dataset v4: Unified image classification, object detection, and visual relationship detection at scale. IJCV, 128(7):1956–1981, 2020.
|
| 194 |
+
[25] Feng Li, Hao Zhang, Shilong Liu, Jian Guo, Lionel M Ni, and Lei Zhang. Dn-detr: Accelerate detr training by introducing query denoising. In CVPR, 2022.
|
| 195 |
+
[26] Xiang Li, Tianhan Wei, Yau Pun Chen, Yu-Wing Tai, and Chi-Keung Tang. Fss-1000: A 1000-class dataset for few-shot segmentation. In CVPR, 2020. preprint arXiv:2101.00190, 2021.
|
| 196 |
+
[28] Yanghao Li, Hanzi Mao, Ross Girshick, and Kaiming He. Exploring plain vision transformer backbones for object detection. In ECCV, 2022.
|
| 197 |
+
[29] Jun Hao Liew, Scott Cohen, Brian Price, Long Mai, and Jiashi Feng. Deep interactive thin object selection. In WACV, 2021.
|
| 198 |
+
[30] Guosheng Lin, Anton Milan, Chunhua Shen, and Ian Reid. Refinenet: Multi-path refinement networks for high-resolution semantic segmentation. In CVPR, 2017.
|
| 199 |
+
[31] 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.
|
| 200 |
+
[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.
|
| 201 |
+
[33] Qi Lu, Jason Kuen, Guo Weidong, Shen Tiancheng, Gu Jiuxiang, Li Wenbo, Jia Jiaya, Lin Zhe, and Yang Ming-Hsuan. Fine-grained entity segmentation. arXiv preprint arxiv:2211.05776, 2022.
|
| 202 |
+
[34] Jordi Pont-Tuset, Federico Perazzi, Sergi Caelles, Pablo Arbeláez, Alexander Sorkine-Hornung, and Luc Van Gool. The 2017 davis challenge on video object segmentation. arXiv:1704.00675, 2017.
|
| 203 |
+
[35] Xuebin Qin, Hang Dai, Xiaobin Hu, Deng-Ping Fan, Ling Shao, and Luc Van Gool. Highly accurate dichotomous image segmentation. In ECCV, 2022.
|
| 204 |
+
[36] 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.
|
| 205 |
+
[37] Tiancheng Shen, Yuechen Zhang, Lu Qi, Jason Kuen, Xingyu Xie, Jianlong Wu, Zhe Lin, and Jiaya Jia. High quality segmentation for ultra high-resolution images. In CVPR, 2022.
|
| 206 |
+
[38] Jianping Shi, Qiong Yan, Li Xu, and Jiaya Jia. Hierarchical image saliency detection on extended cssd. TPAMI, 38(4):717–729, 2015.
|
| 207 |
+
[39] Towaki Takikawa, David Acuna, Varun Jampani, and Sanja Fidler. Gated-scnn: Gated shape cnns for semantic segmentation. In ICCV, 2019.
|
| 208 |
+
[40] Chufeng Tang, Hang Chen, Xiao Li, Jianmin Li, Zhaoxiang Zhang, and Xiaolin Hu. Look closer to segment better: Boundary patch refinement for instance segmentation. In CVPR, 2021.
|
| 209 |
+
[41] Cameron Trotter, Georgia Atkinson, Matt Sharpe, Kirsten Richardson, A Stephen McGough, Nick Wright, Ben Burville, and Per Berggren. Ndd20: A large-scale few-shot dolphin dataset for coarse and fine-grained categorisation. arXiv preprint arXiv:2005.13359, 2020.
|
| 210 |
+
[42] Weiyao Wang, Matt Feiszli, Heng Wang, and Du Tran. Unidentified video objects: A benchmark for dense, open-world segmentation. In CVPR, 2021.
|
| 211 |
+
[43] Xinlong Wang, Xiaosong Zhang, Yue Cao, Wen Wang, Chunhua Shen, and Tiejun Huang. Seggpt: Segmenting everything in context. arXiv preprint arXiv:2304.03284, 2023.
|
| 212 |
+
[44] Qinrou Wen, Jirui Yang, Xue Yang, and Kewei Liang. Patchdct: Patch refinement for high quality instance segmentation. In ICLR, 2023.
|
| 213 |
+
[45] Yinghui Xing, Qirui Wu, De Cheng, Shizhou Zhang, Guoqiang Liang, and Yanning Zhang. Class-aware visual prompt tuning for vision-language pre-trained model. arXiv preprint arXiv:2208.08340, 2022.
|
| 214 |
+
[46] Chuan Yang, Lihe Zhang, Huchuan Lu, Xiang Ruan, and Ming-Hsuan Yang. Saliency detection via graph-based manifold ranking. In CVPR, 2013.
|
| 215 |
+
[47] Linjie Yang, Yuchen Fan, and Ning Xu. Video instance segmentation. In ICCV, 2019.
|
| 216 |
+
[48] Taojiannan Yang, Yi Zhu, Yusheng Xie, Aston Zhang, Chen Chen, and Mu Li. Aim: Adapting image models for efficient video action recognition. In ICLR, 2023.
|
| 217 |
+
[49] Yuan Yao, Ao Zhang, Zhengyan Zhang, Zhiyuan Liu, Tat-Seng Chua, and Maosong Sun. Cpt: Colorful prompt tuning for pre-trained vision-language models. arXiv preprint arXiv:2109.11797, 2021.
|
| 218 |
+
[50] Yuhui Yuan, Jingyi Xie, Xilin Chen, and Jingdong Wang. Segfix: Model-agnostic boundary refinement for segmentation. In ECCV, 2020.
|
| 219 |
+
[51] Yi Zeng, Pingping Zhang, Jianming Zhang, Zhe Lin, and Huchuan Lu. Towards high-resolution salient object detection. In ICCV, 2019.
|
| 220 |
+
[52] Chaoning Zhang, Dongshen Han, Yu Qiao, Jung Uk Kim, Sung-Ho Bae, Seungkyu Lee, and Choong Seon Hong. Faster segment anything: Towards lightweight sam for mobile applications. arXiv preprint arXiv:2306.14289, 2023.
|
| 221 |
+
[53] 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. In ICLR, 2023.
|
| 222 |
+
[54] Hengshuang Zhao, Xiaojuan Qi, Xiaoyong Shen, Jianping Shi, and Jiaya Jia. Icnet for real-time semantic segmentation on high-resolution images. In ECCV, 2018.
|
| 223 |
+
[55] Hengshuang Zhao, Jianping Shi, Xiaojuan Qi, Xiaogang Wang, and Jiaya Jia. Pyramid scene parsing network. In CVPR, 2017.
|
| 224 |
+
[56] Kaiyang Zhou, Jingkang Yang, Chen Change Loy, and Ziwei Liu. Learning to prompt for vision-language models. International Journal of Computer Vision, 2022.
|
| 225 |
+
[57] Ziqin Zhou, Yinjie Lei, Bowen Zhang, Lingqiao Liu, and Yifan Liu. Zegclip: Towards adapting clip for zero-shot semantic segmentation. In CVPR, 2023.
|
| 226 |
+
[58] 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. In CVPR, 2023.
|
| 227 |
+
[59] Xueyan Zou, Jianwei Yang, Hao Zhang, Feng Li, Linjie Li, Jianfeng Gao, and Yong Jae Lee. Segment everything everywhere all at once. In NeurIPS, 2023.
|
| 228 |
+
|
| 229 |
+
# Supplementary Material: Segment Anything in High Quality
|
| 230 |
+
|
| 231 |
+
In this supplementary material, Section 6 first presents the additional experimental analysis of our HQSAM, including more zero-shot transfer comparisons to SAM on both image and video benchmarks. Then, in Section 7, we describe more details of our method implementation, including the training and inference. In Section 8, we provide further details of our constructed HQSeg-44K dataset for training HQ-SAM. In Section 9, we show extensive visual results comparison between our HQ-SAM and SAM on COCO [31], DIS-test [35], HR-SOD [51], NDD20 [41], DAVIS [34], and YTVIS [47].
|
| 232 |
+
|
| 233 |
+
# 6 Supplementary experiments
|
| 234 |
+
|
| 235 |
+
SAM vs. HQ-SAM on Various Backbones In Table 10, we provide a comprehensive comparison between HQ-SAM and SAM using various backbones, including ViT-B, ViT-L, ViT-H and TinyViT. The comparison not only includes the numerical results on the four HQ datasets and COCO validation set, but also contains the model sizes/speed/memory. HQ-SAM consistently outperforms SAM using three different backbones, with over 10 points increase in mBIoU on the four HQ datasets. Notably, the ViT-B based HQ-SAM significantly improves the $\mathbf { A P } ^ { B }$ on COCO from 28.2 to 31.3 and AP from 44.4 to 46.7, with only a $1 . 1 \%$ increase in model parameters and negligible extra memory consumption.
|
| 236 |
+
|
| 237 |
+
Table 10: SAM vs. HQ-SAM on various ViT backbones. For the COCO dataset, we use a SOTA detector FocalNet-DINO [53] trained on the COCO dataset as our box prompt generator.
|
| 238 |
+
|
| 239 |
+
<table><tr><td rowspan="2">Model</td><td colspan="2">Four HQ datasets</td><td colspan="5">CoCo</td><td colspan="2">Model Params (MB)</td><td rowspan="2">FPS</td><td rowspan="2">Memory</td></tr><tr><td>mIoU</td><td>mBIoU</td><td>APB</td><td>AP</td><td>APL</td><td>APM</td><td>APs</td><td>Total</td><td>Learnable</td></tr><tr><td>SAM-B HQ-SAM-B</td><td>70.6 86.3</td><td>62.3 78.1</td><td>28.2 31.3</td><td>44.4 46.7</td><td>57.7 62.9</td><td>48.7 50.5</td><td>32.1 32.0</td><td>358 362.1</td><td>358 4.1</td><td>10.1 9.8</td><td>5.1G 5.1G</td></tr><tr><td>SAM-L</td><td>79.5</td><td>71.1</td><td>33.3</td><td>48.5</td><td>63.9</td><td>53.1</td><td>34.1</td><td>1191</td><td>1191</td><td>5.0</td><td>7.6G</td></tr><tr><td>HQ-SAM-L SAM-H</td><td>89.1 75.6</td><td>81.8 68.3</td><td>34.4</td><td>49.5</td><td>66.2</td><td>53.8</td><td>33.9</td><td>1196.1</td><td>5.1 2446</td><td>4.8 3.5</td><td>7.6G 10.3G</td></tr><tr><td>HQ-SAM-H</td><td>89.3</td><td>81.5</td><td>34.0 34.9</td><td>48.9 49.9</td><td>64.5</td><td>53.3</td><td>34.4</td><td>2446 2452.1</td><td>6.1</td><td>3.4</td><td>10.3G</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>66.5</td><td>54.0</td><td>34.2</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>MobileSAM</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>69.0</td><td>58.8</td><td>28.6</td><td>44.3</td><td>-</td><td>-</td><td>:</td><td>38.6</td><td>38.6</td><td>44.8</td><td>3.7G</td></tr><tr><td>Light HQ-SAM</td><td>81.4</td><td>71.6</td><td>29.6</td><td>45.0</td><td>-</td><td>-</td><td></td><td>40.3</td><td>1.7</td><td>41.2</td><td>3.7G</td></tr></table>
|
| 240 |
+
|
| 241 |
+
Table 11: Results on YouTubeVIS 2019 validation set and HQ-YTVIS test set using ViT-L based SAM. We adopt the SOTA detector Mask2Former [4] trained on the YouTubeVIS 2019 dataset as our video boxes prompt generator while reusing its object association prediction.
|
| 242 |
+
|
| 243 |
+
<table><tr><td rowspan="2">Model</td><td colspan="6">YTVIS 2019</td><td colspan="2">HQ-YTVIS</td></tr><tr><td>AP</td><td>AP50</td><td>AP75</td><td>APL</td><td>APm</td><td>APs</td><td>APB</td><td>APM</td></tr><tr><td>SAM</td><td>51.8</td><td>82.1</td><td>55.4</td><td>65.5</td><td>52.0</td><td>34.2</td><td>30.2</td><td>60.7</td></tr><tr><td>HQ-SAM</td><td>53.2</td><td>82.9</td><td>58.3</td><td>66.4</td><td>53.3</td><td>33.7</td><td>34.0</td><td>63.6</td></tr></table>
|
| 244 |
+
|
| 245 |
+
Zero-shot Video Instance Segmentation Comparison Extending from Table 8 of the paper (evaluation on the HQ-YTVIS benchmark [20]), we further perform a comparative analysis of zeroshot video instance segmentation results on the popular YTVIS 2019 [47] validation set. We take the pre-trained Mask2Former [4] as our video box prompts and feed them into SAM and our HQ-SAM for mask prediction. In Table 11, HQ-SAM achieves consistent gains of 1.4 points in Tube Mask AP, increasing SAM’s performance from 51.8 to 53.2. Interestingly, we find the $\mathsf { A P } _ { 7 5 }$ improvement with a higher IoU threshold for HQ-SAM is much larger than $\mathrm { { A P } _ { 5 0 } }$ , further validating the advantages of HQ-SAM in high-quality mask prediction.
|
| 246 |
+
|
| 247 |
+
Zero-shot Video Object Segmentation Comparison Besides video instance segmentation, in Table 12, we further report the comparison of video object segmentation results between HQ-SAM and SAM on DAVIS validation set in a zero-shot transfer protocol. We take the pre-trained XMem as our video box prompts and feed the same prompts into SAM and HQ-SAM. HQ-SAM improves SAM the $\mathcal { T } \& \mathcal { F }$ from 82.0 to 83.2 and the $\mathcal { F }$ score from 84.9 to 86.1, where $\mathcal { F }$ is for measuring the contour accuracy of the video objects.
|
| 248 |
+
|
| 249 |
+
Table 12: Results on DAVIS 2017 [34] validation set using ViT-L based SAM. We adopt the SOTA model XMem [7] as our video boxes prompt generator while reusing its object association prediction.
|
| 250 |
+
|
| 251 |
+
<table><tr><td>Model</td><td>J&F</td><td>J</td><td>F</td></tr><tr><td>SAM</td><td>82.0</td><td>79.0</td><td>84.9</td></tr><tr><td>HQ-SAM</td><td>83.2</td><td>80.3</td><td>86.1</td></tr></table>
|
| 252 |
+
|
| 253 |
+
Robustness to Input Box Prompts In Table 13, we compare HQ-SAM to SAM by adding various scales of noises to the input ground truth box prompts. In practice, we cannot expect the input box prompts provided by humans in interactive modes to be identical to the ground truth (GT) boxes or extremely accurate. We follow the data augmentation code in DN-DETR [25] to add different noise scales and identify that our HQ-SAM is much more robust compared to SAM, where the relative mBIoU advantage improves from 10.7 to 20.5 when gradually increasing the noise scales. Note that our method is not trained with noised boxes. We also visualize such noised input case in Figure 11, where SAM is more sensitive to small box location shifts that easily happened during interactive annotation.
|
| 254 |
+
|
| 255 |
+
Table 13: Comparison of segmentation accuracy on the four HQ datasets by adding various noise levels to the GT box prompts input.
|
| 256 |
+
|
| 257 |
+
<table><tr><td>Model</td><td colspan="2">No Noise mIoU mBIoU</td><td colspan="2">Noise scale 0.2 mIoU mBIoU</td><td colspan="2">Noise scale 0.4 mIoU mBIoU</td></tr><tr><td>SAM</td><td>79.5</td><td>71.1</td><td>65.7</td><td>57.1</td><td>46.4</td><td>39.8</td></tr><tr><td>HQ-SAM</td><td>89.1</td><td>81.8个10.7</td><td>82.8</td><td>73.4个16.3</td><td>69.9</td><td>60.3个20.5</td></tr></table>
|
| 258 |
+
|
| 259 |
+
# 7 Additional Implementation details
|
| 260 |
+
|
| 261 |
+
Training Details During training HQ-SAM on the composed HQSeg-44K, we fix the model parameters of the pre-trained SAM model while only making the proposed HQ-SAM learnable, including HQ-Output Token, its associated three-layer MLP and three convolutions for HQ-Features fusion. Two of them are transposed convolutions (size $2 \times 2$ , stride 2) used to upscale encoder embedding size from $6 4 \times 6 4$ to $2 5 6 \times 2 5 6$ . We treat the new HQ-Output Token as the fifth mask token compared to the original four mask tokens in SAM’s mask decoder. During training, this new HQ-Output token of size $1 \times 2 5 6$ is concatenated with SAM’s mask tokens (size of $4 \times 2 5 6$ ), iou token (size of $1 \times 2 5 6 ,$ ) and prompt tokens (size of $\mathrm { N _ { p r o m p t } } { \times 2 5 6 } )$ as the input to the SAM’s mask decoder. For example, if the input image contains $N$ box prompts (size $\Nu { \times } 2 \times 2 5 6 )$ ), the final concatenated input and output shape for the 2-layer mask decoder of SAM is $\Nu \times ( 1 + 4 + 1 + 2 ) \times 2 5 6$ . For experiments using ViT-B, ViT-L, and ViT-H-based models on training, we adopt the same training setting, with a learning rate of 1e-3 and train our HQ-SAM for 12 epochs (learning rate drops to 1e-4 after 10 epochs). We supervise mask prediction of the new HQ-Output token with a combination of both BCE Loss and Dice Loss.
|
| 262 |
+
|
| 263 |
+
Implementation Details We follow the same inference pipeline of SAM but use the mask prediction from HQ-Output token as high-quality mask prediction. Table 10 reports the detailed inference speed comparison using various backbones. For box-prompting-based evaluation, we feed SAM and our HQ-SAM with the same image/video bounding boxes and adopt the single mask output mode of SAM. For interactive segmentation comparison using a single point, we follow SAM and adopt the “center” point of Ground Truth (GT) masks, which is at a maximal value location in a mask’s interior distance transform. For multiple-point evaluation, we randomly sample the points from the GT masks and report the averaged results with three trials.
|
| 264 |
+
|
| 265 |
+
# 8 More Details of HQSeg-44K
|
| 266 |
+
|
| 267 |
+
Data compostion of HQSeg-44K In Table 14, we provide more details of our composed new training dataset HQSeg-44K which contains 44,320 extremely accurate image mask annotations, where we show their annotation quality in Figure 8. HQSeg-44K is a collection of six existing image datasets including DIS [35] (train set), ThinObject-5K [29] (train set), FSS [26], ECSSD [38], MSRA-10K [8], DUT-OMRON [46] with extremely fine-grained mask labeling, where each of them contains 7.4K mask labels on average. This composed training set has no images/annotations overlapping with the zero-shot evaluation datasets adopted in our paper.
|
| 268 |
+
|
| 269 |
+
Effect of HQSeg-44K In Table 15, we show the advantage of using HQSeg-44K by comparing HQ-SAM training with 44K randomly sampled images and masks from SA-1B [21]. Using the same efficient token learning strategy, training with SA-1B (44K) decreases the averaged mBIoU on the four datasets from 71.1 to 70.1, while ours improves it from 71.1 to 81.8. This validates the effectiveness of our constructed HQSeg-44K benchmark in improving mask quality. Note that the ablation experiments in Table 2, Table 3, Table 4, and Table 9 of the paper are all based on the constructed HQSeg-44K.
|
| 270 |
+
|
| 271 |
+
Table 14: Data composition of our constructed HQ-Seg-44K.
|
| 272 |
+
|
| 273 |
+
<table><tr><td>Dataset</td><td>DIS [35]</td><td>Thin-Object 5k [29]</td><td>FSS [26]</td><td>DUTS [46]</td><td>ECSSD [38]</td><td>MSRA-10K [8]</td><td>Total</td></tr><tr><td>Image Num.</td><td>3000</td><td>4748</td><td>10000</td><td>15572</td><td>1000</td><td>10000</td><td>44320</td></tr></table>
|
| 274 |
+
|
| 275 |
+

|
| 276 |
+
Figure 8: Visualization of annotated mask quality for randomly selected cases from the six dataset components of the HQ-Seg-44K. Zoom in for better viewing the fine-grained mask details.
|
| 277 |
+
|
| 278 |
+
Zero-shot results on DIS and ThinObject-5K We also report zero-shot results in Table 16 on DIS and ThinObject-5K by removing the training splits of either or both datasets from the training of
|
| 279 |
+
|
| 280 |
+
Table 15: Comparison of the training dataset. For the COCO dataset using ViT-L-based SAM, we use a SOTA detector FocalNet-DINO [53] trained on the COCO dataset as our box prompt generator.
|
| 281 |
+
|
| 282 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">Dataset</td><td colspan="2">DIS</td><td colspan="2">COIFT</td><td colspan="2">HRSOD</td><td colspan="2">ThinObject mBIoU</td><td rowspan="2">Average</td></tr><tr><td>mIoU</td><td>mBIoU</td><td>mIoU</td><td>mBIoU</td><td>mIoU</td><td>mBIoU</td><td>mIoU</td><td>mIoU</td><td>mBIoU</td></tr><tr><td>SAM</td><td>SA-1B</td><td>62.0</td><td>52.8</td><td>92.1</td><td>86.5</td><td>90.2</td><td>83.1</td><td>73.6</td><td>61.8</td><td>79.5</td><td>71.1</td></tr><tr><td>HQ-SAM</td><td>+ SA-1B-44K</td><td>60.4</td><td>51.7</td><td>91.1</td><td>86.1</td><td>88.4</td><td>80.9</td><td>73.1</td><td>61.8</td><td>78.3</td><td>70.1</td></tr><tr><td>HQ-SAM</td><td>+ HQ-Seg-44K(Ours)</td><td>78.6</td><td>70.4</td><td>94.8</td><td>90.1</td><td>93.6</td><td>86.9</td><td>89.5</td><td>79.9</td><td>89.1</td><td>81.8</td></tr></table>
|
| 283 |
+
|
| 284 |
+

|
| 285 |
+
Figure 9: Visual results comparison between SAM (top row) vs. HQ-SAM (bottom row) on DIS test set, given the same red box prompt. HQ-SAM produces significantly more accurate boundaries.
|
| 286 |
+
|
| 287 |
+
HQ-SAM. The improvement of HQ-SAM over SAM is still substantial on DIS or ThinObject (over 10.0 points on DIS-mIoU and 9.0 points on ThinObject-mIoU), even when the corresponding training splits are removed from training.
|
| 288 |
+
|
| 289 |
+
Table 16: Zero-shot results on DIS and ThinObject-5K by removing the training splits of either or both datasets from the training of HQ-SAM. Results not obtained in a zero-shot manner (i.e. the training split was used), are shown in parenthesis to easily compare zero-shot results.
|
| 290 |
+
|
| 291 |
+
<table><tr><td>Training Setting</td><td>DIS-mIoU</td><td>DIS-mBIoU</td><td>ThinObject-mloU</td><td>ThinObject-mBIoU</td></tr><tr><td>SAM (baseline)</td><td>62.0</td><td>52.8</td><td>73.6</td><td>61.8</td></tr><tr><td>HQ-SAM (remove both DIS and ThinObject)</td><td>72.9</td><td>63.1</td><td>82.7</td><td>70.7</td></tr><tr><td>HQ-SAM (remove DIS)</td><td>74.7</td><td>66.2</td><td>(90.1)</td><td>(80.4)</td></tr><tr><td>HQ-SAM (remove ThinObject)</td><td>(78.4)</td><td>(70.3)</td><td>83.3</td><td>72.1</td></tr><tr><td>HQ-SAM (default HQSeg-44K)</td><td>(78.6)</td><td>(70.4)</td><td>(89.5)</td><td>(79.9)</td></tr></table>
|
| 292 |
+
|
| 293 |
+
# 9 More Visual Results Comparison
|
| 294 |
+
|
| 295 |
+
We provide more extensive visual results comparison in Figure 9 (DIS [35] test set), Figure 10 (zeroshot setting in COCO), Figure 11 (noised box input) and Figure 12 (zero-shot setting in HRSOD [51], NDD20 [41] and web images which cover objects with various structure complexities in diverse environments. In Figure 13 and Figure 14, we provide the zero-shot video segmentation results comparison on DAVIS 2017 and YTVIS 2019 benchmarks respectively. Besides, we include the dark underwater environment in NDD20 [41] and randomly selected web images in Figure 12, showing that the zero-shot segmentation power in SAM is well preserved by HQ-SAM. In Figure 12, we also include two failure cases in the rightmost two columns of the third row and bottom row, where HQ-SAM improves over SAM, but still cannot achieve fully correct mask prediction.
|
| 296 |
+
|
| 297 |
+

|
| 298 |
+
Figure 10: Visual results comparison between SAM (top row) vs. HQ-SAM (bottom row) on COCO val set in zero-shot setting, using a SOTA detector FocalNet-DINO [53] trained on the COCO dataset as our box prompt generator. HQ-SAM predicts masks with higher quality than SAM with less mask artifacts.
|
| 299 |
+
|
| 300 |
+

|
| 301 |
+
Figure 11: Visual results comparison between SAM (top row) vs. HQ-SAM (bottom row) with both the GT and noised green box prompt. HQ-SAM produces much more consistent and robust segmentation results regarding to the noises in the input boxes.
|
| 302 |
+
|
| 303 |
+

|
| 304 |
+
Figure 12: Visual results comparison between SAM (top row and third row) vs. HQ-SAM (second row and bottom row) in zero-shot setting, given the same yellow box or point prompt. HQ-SAM produces significantly more detailed preserving masks while fixing mask errors with broken holes. The rightmost two columns in the third row and bottom row show two failure cases of HQ-SAM in extremely dark environments or very tiny metal rods.
|
| 305 |
+
|
| 306 |
+

|
| 307 |
+
Figure 13: Visual results comparison between SAM vs. HQ-SAM on video object segmentation benchmark DAVIS 2017 in zero-shot setting, given the same video boxes prompts generated by the pre-trained XMem [7].
|
| 308 |
+
|
| 309 |
+

|
| 310 |
+
Figure 14: Visual results comparison between SAM vs. HQ-SAM on video instance segmentation benchmark YTVIS 2019 in zero-shot setting, given the same video boxes prompts generated by the pre-trained Mask2Former [4].
|
md/dev/SlxSY2UZQT/SlxSY2UZQT.md
ADDED
|
@@ -0,0 +1,336 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LABEL-EFFICIENT SEMANTIC SEGMENTATION WITH DIFFUSION MODELS
|
| 2 |
+
|
| 3 |
+
Dmitry Baranchuk, Ivan Rubachev, Andrey Voynov, Valentin Khrulkov, Artem Babenko
|
| 4 |
+
|
| 5 |
+
Yandex Research
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Denoising diffusion probabilistic models have recently received much research attention since they outperform alternative approaches, such as GANs, and currently provide state-of-the-art generative performance. The superior performance of diffusion models has made them an appealing tool in several applications, including inpainting, super-resolution, and semantic editing. In this paper, we demonstrate that diffusion models can also serve as an instrument for semantic segmentation, especially in the setup when labeled data is scarce. In particular, for several pretrained diffusion models, we investigate the intermediate activations from the networks that perform the Markov step of the reverse diffusion process. We show that these activations effectively capture the semantic information from an input image and appear to be excellent pixel-level representations for the segmentation problem. Based on these observations, we describe a simple segmentation method, which can work even if only a few training images are provided. Our approach significantly outperforms the existing alternatives on several datasets for the same amount of human supervision. The source code of the project is publicly available.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Denoising diffusion probabilistic models (DDPM) (Sohl-Dickstein et al., 2015; Ho et al., 2020) have recently outperformed alternative approaches to model the distribution of natural images both in the realism of individual samples and their diversity (Dhariwal & Nichol, 2021). These advantages of DDPM are successfully exploited in applications, such as colorization (Song et al., 2021), inpainting (Song et al., 2021), super-resolution (Saharia et al., 2021; Li et al., 2021b), and semantic editing (Meng et al., 2021), where DDPM often achieve more impressive results compared to GANs.
|
| 14 |
+
|
| 15 |
+
So far, however, DDPM were not exploited as a source of effective image representations for discriminative computer vision problems. While the prior literature has demonstrated that various generative paradigms, such as GANs (Donahue & Simonyan, 2019) or autoregressive models (Chen et al., 2020a), can be used to extract the representations for common vision tasks, it is not clear if DDPM can also serve as representation learners. In this paper, we provide an affirmative answer to this question in the context of semantic segmentation.
|
| 16 |
+
|
| 17 |
+
In particular, we investigate the intermediate activations from the U-Net network that approximates the Markov step of the reverse diffusion process in DDPM. Intuitively, this network learns to denoise its input, and it is not clear why the intermediate activations should capture semantic information needed for high-level vision problems. Nevertheless, we show that on certain diffusion steps, these activations do capture such information, and therefore, can potentially be used as image representations for downstream tasks. Given these observations, we propose a simple semantic segmentation method, which exploits these representations and works successfully even if only a few labeled images are provided. On several datasets, we show that our DDPM-based segmentation method outperforms the existing baselines for the same amount of supervision.
|
| 18 |
+
|
| 19 |
+
To sum up, the contributions of our paper are:
|
| 20 |
+
|
| 21 |
+
1. We investigate the representations learned by the state-of-the-art DDPM and show that they capture high-level semantic information valuable for downstream vision tasks.
|
| 22 |
+
|
| 23 |
+
2. We design a simple semantic segmentation approach that exploits these representations and outperforms the alternatives in the few-shot operating point.
|
| 24 |
+
|
| 25 |
+
3. We compare the DDPM-based representations with their GAN-based counterparts on the same datasets and demonstrate the advantages of the former in the context of semantic segmentation.
|
| 26 |
+
|
| 27 |
+
# 2 RELATED WORK
|
| 28 |
+
|
| 29 |
+
In this section, we briefly describe the existing lines of research relevant to our work.
|
| 30 |
+
|
| 31 |
+
Diffusion models (Sohl-Dickstein et al., 2015; Ho et al., 2020) are a class of generative models that approximate the distribution of real images by the endpoint of the Markov chain which originates from a simple parametric distribution, typically a standard Gaussian. Each Markov step is modeled by a deep neural network that effectively learns to invert the diffusion process with a known Gaussian kernel. Ho et al. highlighted the equivalence of diffusion models and score matching (Song & Ermon, 2019; 2020), showing them to be two different perspectives on the gradual conversion of a simple known distribution into a target distribution via the iterative denoising process. Very recent works (Nichol, 2021; Dhariwal & Nichol, 2021) have developed more powerful model architectures as well as different advanced objectives, which led to the “victory” of DDPM over GANs in terms of generative quality and diversity. DDPM have been widely used in several applications, including image colorization (Song et al., 2021), super-resolution (Saharia et al., 2021; Li et al., 2021b), inpainting (Song et al., 2021), and semantic editing (Meng et al., 2021). In our work, we demonstrate that one can also successfully use them for semantic segmentation.
|
| 32 |
+
|
| 33 |
+
Image segmentation with generative models is an active research direction at the moment, however, existing methods are primarily based on GANs. The first line of works (Voynov & Babenko, 2020; Voynov et al., 2021; Melas-Kyriazi et al., 2021) is based on the evidence that the latent spaces of the state-of-the-art GANs have directions corresponding to effects that influence the foreground/background pixels differently, which allows producing synthetic data to train segmentation models. However, these approaches are currently able to perform binary segmentation only, and it is not clear if they can be used in the general setup of semantic segmentation. The second line of works (Zhang et al., 2021; Tritrong et al., 2021; Xu, 2021; Galeev et al., 2020) is more relevant to our study since they are based on the intermediate representations obtained in GANs. In particular, the method proposed in (Zhang et al., 2021) trains a pixel class prediction model on these representations and confirms their label efficiency. In the experimental section, we compare the method from (Zhang et al., 2021) to our DDPM-based one and demonstrate several distinctive advantages of our solution.
|
| 34 |
+
|
| 35 |
+
Representations from generative models for discriminative tasks. The usage of generative models, as representation learners, has been widely investigated for global prediction (Donahue & Simonyan, 2019; Chen et al., 2020a), and dense prediction problems (Zhang et al., 2021; Tritrong et al., 2021; Xu, 2021; Xu et al., 2021). While previous works highlighted the practical advantages of these representations, such as out-of-distribution robustness (Li et al., 2021a), generative models as representation learners receive less attention compared to alternative unsupervised methods, e.g., based on contrastive learning (Chen et al., 2020b). The main reason is probably the difficulty of training a high-quality generative model on a complex, diverse dataset. However, given the recent success of DDPM on Imagenet (Deng et al., 2009), one can expect that this direction will attract more attention in the future.
|
| 36 |
+
|
| 37 |
+
# 3 REPRESENTATIONS FROM DIFFUSION MODELS
|
| 38 |
+
|
| 39 |
+
In the following section, we investigate the image representations learned by diffusion models. First, we provide a brief overview of the DDPM framework. Then, we describe how to extract features with DDPM and investigate what kind of semantic information these features might capture.
|
| 40 |
+
|
| 41 |
+
Background. Diffusion models transform noise $x _ { T } { \sim } N ( 0 , I )$ to the sample $x _ { 0 }$ by gradually denoising $x _ { T }$ to less noisy samples $x _ { t }$ . Formally, we are given a forward diffusion process:
|
| 42 |
+
|
| 43 |
+
$$
|
| 44 |
+
q ( x _ { t } | x _ { t - 1 } ) : = N ( x _ { t } ; \sqrt { 1 - \beta _ { t } } x _ { t - 1 } , \beta _ { t } I ) ,
|
| 45 |
+
$$
|
| 46 |
+
|
| 47 |
+
for some fixed variance schedule $\beta _ { 1 } , \ldots , \beta _ { t }$ .
|
| 48 |
+
|
| 49 |
+

|
| 50 |
+
Figure 1: Overview of the proposed method. (1) $x _ { 0 } x _ { t }$ by adding noise according to $q ( x _ { t } | x _ { 0 } )$ . (2) Extracting feature maps from a noise predictor $\epsilon _ { \theta } ( x _ { t } , t )$ . (3) Collecting pixel-level representations by upsampling the feature maps to the image resolution and concatenating them. (4) Using the pixel-wise feature vectors to train an ensemble of MLPs to predict a class label for each pixel.
|
| 51 |
+
|
| 52 |
+
Importantly, a noisy sample $x _ { t }$ can be obtained directly from the data $x _ { 0 }$
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\begin{array} { r } { q ( x _ { t } | x _ { 0 } ) : = \mathcal { N } ( x _ { t } ; \sqrt { \bar { \alpha } _ { t } } x _ { 0 } , ( 1 - \bar { \alpha } _ { t } ) I ) , } \\ { x _ { t } = \sqrt { \bar { \alpha } _ { t } } x _ { 0 } + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon , \epsilon \sim \mathcal { N } ( 0 , 1 ) , } \end{array}
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
where $\begin{array} { r } { \alpha _ { t } : = 1 - \beta _ { t } , \bar { \alpha } _ { t } : = \prod _ { s = 1 } ^ { t } \alpha _ { s } , } \end{array}$
|
| 59 |
+
|
| 60 |
+
Pretrained DDPM approximates a reverse process:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
p _ { \theta } ( x _ { t - 1 } | x _ { t } ) : = N ( x _ { t - 1 } ; \mu _ { \theta } ( x _ { t } , t ) , \Sigma _ { \theta } ( x _ { t } , t ) ) .
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
In practice, rather than predicting the mean of the distribution in Equation (3), the noise predictor network $\epsilon _ { \theta } ( x _ { t } , t )$ predicts the noise component at the step $t$ ; the mean is then a linear combination of this noise component and $x _ { t }$ . The covariance predictor $\Sigma _ { \theta } ( x _ { t } , t )$ can be either a fixed set of scalar covariances or learned as well (the latter was shown to improve the model quality (Nichol, 2021)).
|
| 67 |
+
|
| 68 |
+
The denoising model $\epsilon _ { \theta } ( x _ { t } , t )$ is typically parameterized by different variants of the UNet architecture (Ronneberger et al., 2015), and in our experiments we investigate the state-of-the-art one proposed in (Dhariwal & Nichol, 2021).
|
| 69 |
+
|
| 70 |
+
Extracting representations. For a given real image $\boldsymbol { x } _ { 0 } \in \mathbb { R } ^ { H \times W \times 3 }$ , one can compute $T$ sets of activation tensors from the noise predictor network $\epsilon _ { \theta } ( x _ { t } , t )$ . The overall scheme for a timestep $t$ is presented in Figure 1. First, we corrupt $x _ { 0 }$ by adding Gaussian noise according to Equation (2). The noisy $x _ { t }$ is used as an input of $\epsilon _ { \theta } ( x _ { t } , t )$ parameterized by the UNet model. The UNet’s intermediate activations are then upsampled to $H \times W$ with bilinear interpolation. This allows treating them as pixel-level representations of $x _ { 0 }$ .
|
| 71 |
+
|
| 72 |
+
# 3.1 REPRESENTATION ANALYSIS
|
| 73 |
+
|
| 74 |
+
We analyze the representations produced by the noise predictor $\epsilon _ { \theta } ( x _ { t } , t )$ for different $t$ . We consider the state-of-the-art DDPM checkpoints trained on the LSUN-Horse and FFHQ-256 datasets1.
|
| 75 |
+
|
| 76 |
+
The intermediate activations from the noise predictor capture semantic information. For this experiment, we take a few images from the LSUN-Horse and FFHQ datasets and manually assign each pixel to one of the 21 and 34 semantic classes, respectively. Our goal is to understand whether the pixel-level representations produced by DDPM effectively capture the information about semantics. To this end, we train a multi-layer perceptron (MLP) to predict the pixel semantic label from its features produced by one of the 18 UNet decoder blocks on a specific diffusion step $t$ . Note that we consider only the decoder activations because they also aggregate the encoder activations through the skip connections. MLPs are trained on 20 images and evaluated on 20 hold-out ones. The predictive performance is measured in terms of mean IoU.
|
| 77 |
+
|
| 78 |
+

|
| 79 |
+
Figure 2: The evolution of predictive performance of DDPM-based pixel-wise representations for different UNet decoder blocks and diffusion steps. The blocks are numbered from the deep to shallow ones. The most informative features typically correspond to the later steps of the reverse diffusion process and middle layers of the UNet decoder. The earlier steps correspond to uninformative representations. The plots for other datasets are provided in Appendix A
|
| 80 |
+
|
| 81 |
+

|
| 82 |
+
Figure 3: The evolution of predictive performance of DDPM-based pixel-wise representations on the LSUN-Horse dataset for classes with the smallest (Left) and largest (Right) average areas. The predictive performance for small-sized objects starts growing later in the reverse process. The deeper blocks are more informative for larger objects and the shallower blocks are more informative for smaller objects. A similar evaluation for other datasets is provided in Appendix A.
|
| 83 |
+
|
| 84 |
+
The evolution of predictive performance across the different blocks and diffusion steps $t$ is presented in Figure 2. The blocks are numbered from the deep to shallow ones. Figure 2 shows that the discriminability of the features produced by the noise predictor $\epsilon _ { \theta } ( x _ { t } , t )$ varies for different blocks and diffusion steps. In particular, the features corresponding to the later steps of the reverse diffusion process typically capture semantic information more effectively. In contrast, the ones corresponding to the early steps are generally uninformative. Across different blocks, the features produced by the layers in the middle of the UNet decoder appear to be the most informative on all diffusion steps.
|
| 85 |
+
|
| 86 |
+
Also, we separately consider small-sized and large-sized semantic classes based on the average area in the annotated dataset. Then, we evaluate mean IoU for these classes independently across the different UNet blocks and diffusion steps. The results on LSUN-Horse are in Figure 3. As expected, the predictive performance for large-sized objects starts growing earlier in the reverse process. The shallower blocks are more informative for smaller objects, while the deeper blocks are more so for the larger ones. In both cases, the most discriminative features still correspond to the middle blocks.
|
| 87 |
+
|
| 88 |
+
Figure 2 implies that for certain UNet blocks and diffusion steps, similar DDPM-based representations correspond to the pixels of the same semantics. Figure 4 shows the $\mathbf { k }$ -means clusters $\scriptstyle ( k = 5 )$ ) formed by the features extracted by the FFHQ checkpoint from the blocks $\{ 6 , 8 , 1 0 , 1 2 \}$ on the diffusion steps $\{ 5 0 , 2 0 0 , 4 0 0 , 6 0 0 , 8 0 0 \}$ , and confirms that clusters can span coherent semantic objects and object-parts. In the block $B { = } 6$ , the features correspond to coarse semantic masks. At the other extreme, the features from $B { = } 1 2$ can discriminate between fine-grained face parts but exhibit less semantic meaningness for coarse fragmentation. Across different diffusion steps, the most meaningful features correspond to the later ones. We attribute this behavior to the fact that on the earlier steps of the reverse process, the global structure of a DDPM sample has not yet emerged, therefore, it is hardly possible to predict segmentation masks at this stage. This intuition is qualitatively confirmed by the masks in Figure 4. For $t { = } 8 0 0$ , the masks poorly reflect the content of actual images, while for smaller values of $t$ , the masks and images are semantically coherent.
|
| 89 |
+
|
| 90 |
+

|
| 91 |
+
Figure 4: Examples of $\mathbf { k }$ -means clusters $\scriptstyle ( k = 5 )$ ) formed by the features extracted from the UNet decoder blocks $\{ 6 , 8 , 1 0 , 1 2 \}$ on the diffusion steps $\{ 5 0 , 2 0 0 , 4 0 0 , 6 0 0 , 8 0 0 \}$ . The clusters from the middle blocks spatially span coherent semantic objects and parts.
|
| 92 |
+
|
| 93 |
+
# 3.2 DDPM-BASED REPRESENTATIONS FOR FEW-SHOT SEMANTIC SEGMENTATION
|
| 94 |
+
|
| 95 |
+
The potential effectiveness of the intermediate DDPM activations observed above implies their usage as image representations for dense prediction tasks. Figure 1 schematically presents our overall approach for image segmentation, which exploits the discriminability of these representations. In more detail, we consider a few-shot semi-supervised setup, when a large number of unlabeled images $\{ X _ { 1 } , \ldots , X _ { N } \} \subset \mathbb { R } ^ { H \times W \times 3 }$ from the particular domain are available, and only for $n$ training images $\{ X _ { 1 } , \ldots , X _ { n } \} \subset \mathbb { R } ^ { H \times W \times 3 }$ the groundtruth $K$ -class semantic masks $\{ Y _ { 1 } , . . . , Y _ { n } \} \subset \mathbb { R } ^ { H \times W \times \{ 1 , . . . , K \} }$ are provided.
|
| 96 |
+
|
| 97 |
+
As a first step, we train a diffusion model on the whole $\{ X _ { 1 } , \ldots , X _ { N } \}$ in an unsupervised manner. Then, this diffusion model is used to extract the pixel-level representations of the labeled images using the subset of the UNet blocks and diffusion steps $t$ . In this work, we use the representations from the middle blocks $B { = } \{ 5 , 6 , 7 , 8 , 1 2 \}$ of the UNet decoder and later steps $t { = } \{ 5 0 , 1 5 0 , 2 5 0 \}$ of the reverse diffusion process. These blocks and time steps are motivated by the insights from Section 3.1 but intentionally not tuned for each dataset.
|
| 98 |
+
|
| 99 |
+
While the feature extraction at the particular time step is stochastic, we fix the noise for all timesteps $t$ and ablate this in Section 4.1. The extracted representations from all blocks $B$ and steps $t$ are upsampled to the image size and concatenated, forming the feature vectors for all pixels of the training images. The overall dimension of the pixel-level representations is 8448.
|
| 100 |
+
|
| 101 |
+
Then, following (Zhang et al., 2021), we train an ensemble of independent multi-layer perceptrons (MLPs) on these feature vectors, which aim to predict a semantic label of each pixel available for training images. We adopt the ensemble configuration and training settings from (Zhang et al., 2021) and exploit them across all other methods in our experiments, see Appendix C for details.
|
| 102 |
+
|
| 103 |
+
To segment a test image, we extract its DDPM-based pixel-wise representations and use them to predict the pixel labels by the ensemble. The final prediction is obtained by majority voting.
|
| 104 |
+
|
| 105 |
+
# 4 EXPERIMENTS
|
| 106 |
+
|
| 107 |
+
This section experimentally confirms the advantage of the DDPM-based representations for the semantic segmentation problem. We start from a thorough comparison to the existing alternatives and then dissect the reasons for the DDPM success by additional analysis.
|
| 108 |
+
|
| 109 |
+
Datasets. In our evaluation, we mainly work with the “bedroom”, “cat” and “horse” categories from LSUN (Yu et al., 2015) and FFHQ-256 (Karras et al., 2019). As a training set for each dataset, we consider several images for which the fine-grained semantic masks are collected following the protocol from (Zhang et al., 2021). For each dataset, a professional assessor was hired to annotate train and test samples. We denote the collected datasets as Bedroom-28, FFHQ-34, Cat-15, Horse21, where the number corresponds to the number of semantic classes.
|
| 110 |
+
|
| 111 |
+
Table 1: Number of annotated images for each dataset used in our evaluation.
|
| 112 |
+
|
| 113 |
+
<table><tr><td>Dataset</td><td>RealTrain</td><td>RealTest</td><td>GAN</td><td>DDPM</td><td>Total</td></tr><tr><td>Bedroom-28</td><td>40</td><td>20</td><td>40</td><td>40</td><td>140</td></tr><tr><td>FFHQ-34</td><td>20</td><td>20</td><td>20</td><td>20</td><td>80</td></tr><tr><td>Cat-15</td><td>30</td><td>20</td><td>30</td><td>30</td><td>110</td></tr><tr><td>Horse-21</td><td>30</td><td>30</td><td>30</td><td>30</td><td>120</td></tr><tr><td>CelebA-19</td><td>20</td><td>500</td><td>一</td><td>一</td><td>520</td></tr><tr><td>ADE-Bedroom-30</td><td>50</td><td>650</td><td>丨</td><td>丨</td><td>700</td></tr></table>
|
| 114 |
+
|
| 115 |
+
Additionally, we consider two datasets, which, in contrast to others, have publicly available annotations and sizable evaluation sets:
|
| 116 |
+
|
| 117 |
+
• ADE-Bedroom-30 is a subset of the ADE20K dataset (Zhou et al., 2018), where we extract only images of bedroom scenes with 30 most frequent classes. We resize each image to 256 for the smaller side and then crop them to obtain the $2 5 6 \times 2 5 6$ samples. • CelebA-19 is a subset of the CelebAMask-HQ dataset (Lee et al., 2020), which provides the annotation for 19 facial attributes. All images are resized to 256 resolution.
|
| 118 |
+
|
| 119 |
+
The number of annotated images for each dataset are in Table 1. Other details are in Appendix E.
|
| 120 |
+
|
| 121 |
+
Methods. In the evaluation, we compare our method (denoted as DDPM) to several prior approaches which tackle the few-shot semantic segmentation setup. First, we describe the baselines that produce a large set of annotated synthetic images to train a segmentation model:
|
| 122 |
+
|
| 123 |
+
• DatasetGAN (Zhang et al., 2021) — this method exploits the discriminability of pixel-level features produced by GANs. In more detail, assessors annotate a few GAN-produced images. Then, the latent codes of these images are used to obtain the intermediate generator activations, which are considered as pixel-level representations. Given these representations, a classifier is trained to predict a semantic label for each pixel. This classifier is then used to label new synthetic GAN images, which, for their part, serve as a training set for the DeepLabV3 segmentation model (Chen et al., 2017). For each dataset, we increase the number of synthetic images until the performance on the validation set is not saturated. According to (Zhang et al., 2021), we also remove $1 0 \%$ of synthetic samples with the most uncertain predictions. • DatasetDDPM mirrors the DatasetGAN baseline with the only difference being that GANs are replaced with DDPMs. We include this baseline to compare the GAN-based and DDPM-based representations in the same scenario.
|
| 124 |
+
|
| 125 |
+
Note that our segmentation method described in Section 3.2 is more straightforward compared to DatasetGAN and DatasetDDPM since it does not require auxiliary steps of the synthetic dataset generation and training the segmentation model on it.
|
| 126 |
+
|
| 127 |
+
Then, we consider a set of baselines that allow extracting intermediate activations from the real images directly and use them as pixel-level representations similarly to our method. In contrast to DatasetGAN and DatasetDDPM, these methods can potentially be beneficial due to the absence of the domain gap between real and synthetic images.
|
| 128 |
+
|
| 129 |
+
• MAE (He et al., 2021) — one of the state-of-the-art self-supervised methods, which learns a denoising autoencoder to reconstruct missing patches. We use ViT-Large (Dosovitskiy et al., 2021) as a backbone model and reduce the patch size to $8 \times 8$ to increase the spatial dimensions of the feature maps. We pretrain all models on the same datasets as DDPM using the official code2. The feature extraction for this method is described in Appendix F. • SwAV (Caron et al., 2020) — one more recent self-supervised approach. We consider a twice wider ResNet-50 model for evaluation. All models are pretrained on the same datasets as DDPM also using the official source code3. The input image resolution is 256. GAN Inversion employs the state-of-the-art method (Tov et al., 2021) to obtain the latent codes for real images. We map the annotated real images to the GAN latent space, which allows computing the intermediate generator activations and using them as pixel-level representations.
|
| 130 |
+
|
| 131 |
+
Table 2: The comparison of the segmentation methods in terms of mean IoU. $( ^ { * } )$ On CelebA-19 and ADE Bedroom-30, we evaluate models trained on FFHQ-256 and LSUN Bedroom, respectively.
|
| 132 |
+
|
| 133 |
+
<table><tr><td>Method</td><td>Bedroom-28</td><td>FFHQ-34</td><td>Cat-15</td><td>Horse-21</td><td>CelebA-19*</td><td>ADE Bedroom-30*</td></tr><tr><td>ALAE</td><td>20.0 ± 1.0</td><td>48.1 ± 1.3</td><td></td><td></td><td>49.7 ± 0.7</td><td>15.0 ± 0.5</td></tr><tr><td>VDVAE</td><td></td><td>57.3 ± 1.1</td><td></td><td></td><td>54.1 ± 1.0</td><td></td></tr><tr><td>GAN Inversion</td><td>13.9 ± 0.6</td><td>51.7± 0.8</td><td>21.4 ± 1.7</td><td>17.7 ± 0.4</td><td>51.5± 2.3</td><td>11.1 ± 0.2</td></tr><tr><td>GAN Encoder</td><td>22.4 ± 1.6</td><td>53.9 ± 1.3</td><td>32.0± 1.8</td><td>26.7 ± 0.7</td><td>53.9±0.8</td><td>15.7 ± 0.3</td></tr><tr><td>SwAV</td><td>42.4 ± 1.7</td><td>56.9 ± 1.3</td><td>45.1 ± 2.1</td><td>54.0± 0.9</td><td>52.4± 1.3</td><td>30.6 ± 1.6</td></tr><tr><td>MAE</td><td>45.0 ± 2.0</td><td>58.8 ± 1.1</td><td>52.4 ± 2.3</td><td>63.4± 1.4</td><td>57.8±0.4</td><td>31.7 ± 1.8</td></tr><tr><td>DatasetGAN</td><td>31.3 ± 2.3</td><td>57.0 ± 1.1</td><td>36.5± 2.3</td><td>45.4 ± 1.4</td><td></td><td></td></tr><tr><td>DatasetDDPM (Ours)</td><td>47.9 ± 2.9</td><td>56.0± 0.9</td><td>47.6 ± 1.5</td><td>60.8 ± 1.0</td><td></td><td></td></tr><tr><td>DDPM (Ours)</td><td>49.4 ± 1.9</td><td>59.1 ± 1.4</td><td>53.7± 3.3</td><td>65.0 ± 0.8</td><td>59.9 ± 1.0</td><td>34.6 ± 1.7</td></tr></table>
|
| 134 |
+
|
| 135 |
+
• GAN Encoder — while GAN Inversion struggles to reconstruct images from LSUN domains, we also consider the activations of the pretrained GAN encoder used for GAN Inversion.
|
| 136 |
+
|
| 137 |
+
• VDVAE (Child, 2021) — state-of-the-art autoencoder model. The intermediate activations are extracted from both encoder and decoder and concatenated. While there are no pretrained models on the LSUN datasets, we evaluate this model only on the publicly available checkpoint4 on FFHQ-256. Note that VAEs are still significantly inferior to GANs and DDPMs on LSUN.
|
| 138 |
+
|
| 139 |
+
• ALAE (Pidhorskyi et al., 2020) adopts StyleGANv1 generator and adds an encoder network to the adversarial training. We extract features from the encoder model. In our evaluation, we use publicly available models on LSUN-Bedroom and FFHQ- $1 0 2 4 ^ { 5 }$ .
|
| 140 |
+
|
| 141 |
+
Generative pretrained models. In our experiments, we use the state-of-the-art StyleGAN2 (Karras et al., 2020) models for the GAN-based baselines and the state-of-the-art pretrained ADMs (Dhariwal & Nichol, 2021) for our DDPM-based method. Since there is not a pretrained model for FFHQ-256, we train it ourselves using the official implementation6. For evaluation on the ADEBedroom-30 dataset, we use the models (including the baselines) pretrained on LSUN-Bedroom. For Celeba-19, we evaluate the models trained on FFHQ-256.
|
| 142 |
+
|
| 143 |
+
Main results. The comparison of the methods in terms of the mean IoU measure is presented in Table 2. The results are averaged over 5 independent runs for different data splits. We also report per class IoUs in Appendix D. Additionally, we provide several qualitative examples of segmentation with our method in Figure 5. Below we highlight several key observations:
|
| 144 |
+
|
| 145 |
+
• The proposed method based on the DDPM representations significantly outperforms the alternatives on most datasets.
|
| 146 |
+
• The MAE baseline is the strongest competitor to the DDPM-based segmentation and demonstrates comparable results on the FFHQ-34 and Cat-15 datasets.
|
| 147 |
+
• The SwAV baseline underperforms compared to the DDPM-based segmentation. We attribute this behavior to the fact that this baseline is trained in the discriminative fashion and can suppress the details, which are needed for fine-grained semantic segmentation. This result is consistent with the recent findings in (Cole et al., 2021), which shows that the state-of-the-art contrastive methods produce representations, which are suboptimal for fine-grained problems.
|
| 148 |
+
• DatasetDDPM outperforms its counterpart DatasetGAN against most benchmarks. Note that both these methods use the DeepLabV3 network. We attribute this superiority to the higher quality of DDPM synthetics, therefore, a smaller domain gap between synthetic and real data.
|
| 149 |
+
• On most datasets, DDPM outperforms the DatasetDDPM competitor. We provide an additional experiment to investigate this in the discussion section below.
|
| 150 |
+
|
| 151 |
+
Overall, the proposed DDPM-based segmentation outperforms the baselines that exploit alternative generative models and also the baselines trained in the self-supervised fashion. This result highlights the potential of using the state-of-the-art DDPMs as strong unsupervised representation learners.
|
| 152 |
+
|
| 153 |
+

|
| 154 |
+
Figure 5: The examples of segmentation masks predicted by our method on the test images along with the groundtruth annotated masks.
|
| 155 |
+
|
| 156 |
+
Table 3: Performance of DDPM-based segmentation when trained on real and synthetic images. When trained on DDPM-produced data, DDPM demonstrates comparable performance to DatasetDDPM. When trained on GAN-produced data, DDPM still significantly outperforms DatasetGAN, but the gap between them reduces.
|
| 157 |
+
|
| 158 |
+
<table><tr><td></td><td colspan="3">Bedroom-28</td><td colspan="3">Cat-15</td><td colspan="3">Horse-21</td></tr><tr><td>Train data</td><td>Real</td><td>DDPM</td><td>GAN</td><td>Real</td><td>DDPM</td><td>GAN</td><td>Real</td><td>DDPM</td><td>GAN</td></tr><tr><td>DatasetGAN</td><td>丨</td><td>一</td><td>31.3 ± 2.3</td><td>丨</td><td>一</td><td>36.5± 2.3</td><td>1</td><td>一</td><td>45.4 ± 1.4</td></tr><tr><td>DatasetDDPM</td><td>一</td><td>47.9 ± 2.9</td><td>丨</td><td>一</td><td>47.6 ± 1.5</td><td>1</td><td>一</td><td>60.8 ±1.0</td><td>1</td></tr><tr><td>DDPM</td><td>49.4 ± 1.9</td><td>48.7±2.6</td><td>43.3±2.9</td><td>53.7± 3.3</td><td>47.9 ± 2.7</td><td>41.1 ± 2.2</td><td>65.0±0.8</td><td>62.4 ± 1.0</td><td>60.0 ±1.0</td></tr></table>
|
| 159 |
+
|
| 160 |
+
# 4.1 DISCUSSION
|
| 161 |
+
|
| 162 |
+
The effect of training on real data. The proposed DDPM method is trained on annotated real images, while DatasetDDPM and DatasetGAN are trained on synthetic ones, which are typically less natural, diverse, and can lack objects of particular classes. Moreover, synthetic images are harder for human annotation since they might have some distorted objects that are difficult to assign to a particular class. In the following experiment, we quantify the performance drop caused by training on real or synthetic data. Specifically, Table 3 reports the performance of the DDPM approach trained on real, DDPM-produced and GAN-produced annotated images. As can be seen, training on real images is very beneficial on the domains where the fidelity of generative models is still relatively low, e.g., LSUN-Cat, which indicates that annotated real images are a more reliable source of supervision. Moreover, if the DDPM method is trained on synthetic images, its performance becomes on par with DatasetDDPM. On the other hand, when trained on GAN-produced samples, DDPM significantly outperforms DatasetGAN. We attribute this to the fact that DDPMs provide more semantically-valuable pixel-wise representations compared to GANs.
|
| 163 |
+
|
| 164 |
+
Sample-efficiency. In this experiment, we evaluate the performance of our method when it utilizes less annotated data. We provide mIoU for four datasets in Table 4. Importantly, DDPM is still able to outperform most baselines in Table 2, using significantly less supervision.
|
| 165 |
+
|
| 166 |
+
The effect of stochastic feature extraction. Here, we investigate whether our method can benefit from the stochastic feature extraction described in Section 3.2. We consider the deterministic case, when the noise $\epsilon { \sim } N ( 0 , I )$ is sampled once and used in (2) to obtain $x _ { t }$ for all timesteps $t$ during both training and evaluation. Then, we compare it to the following stochastic options:
|
| 167 |
+
|
| 168 |
+
First, different $\epsilon _ { t }$ are sampled for different timesteps $t$ and shared during the training and evaluation. Second, one samples different noise for all timesteps at each training iteration; during the evaluation the method also uses unseen noise samples.
|
| 169 |
+
|
| 170 |
+

|
| 171 |
+
Figure 6: mIoU degradation for different image corruption levels on the Bedroom-28 and Horse-21 datasets. DDPM demonstrates higher robustness and preserves its advantage for all distortion levels.
|
| 172 |
+
|
| 173 |
+
Table 4: Evaluation of the proposed method with a different number of labeled training data. Even using less annotated data, DDPM still outperforms most baselines in Table 2.
|
| 174 |
+
|
| 175 |
+
<table><tr><td></td><td colspan="3">Bedroom-28</td><td colspan="3">Cat-15</td><td colspan="3">Horse-21</td></tr><tr><td>Method</td><td>40</td><td>20</td><td>10</td><td>30</td><td>20</td><td>10</td><td>30</td><td>20</td><td>10</td></tr><tr><td>DDPM</td><td></td><td></td><td></td><td>49.4±1.9 46.2 ±3.6 38.2±2.9 53.7 ±3.3 49.2 ±4.2 42.0±4.8 65.0±0.8</td><td></td><td></td><td></td><td>63.8± 0.7</td><td>56.9± 2.4</td></tr></table>
|
| 176 |
+
|
| 177 |
+
<table><tr><td>ShareTrain/Test</td><td>Share for t</td><td>Bedroom-28</td><td>FFHQ-34</td></tr><tr><td>+</td><td>+</td><td>49.3 ± 1.9</td><td>59.1 ± 1.4</td></tr><tr><td>+</td><td>=</td><td>49.1 ± 2.2</td><td>59.3 ± 1.5</td></tr><tr><td>-</td><td>-</td><td>48.9 ± 1.6</td><td>59.3 ± 1.4</td></tr></table>
|
| 178 |
+
|
| 179 |
+
Table 5: Performance of the DDPM-based method for different feature extraction variations. All considered stochastic options provide a similar mIoU to the determinstic one.
|
| 180 |
+
|
| 181 |
+
The results are provided in Table 5. As one can see, the difference in the performance is marginal. We attribute this behavior to the following reasons:
|
| 182 |
+
|
| 183 |
+
• Our method uses later $t$ of the reverse diffusion process where the noise magnitude is low. • Since we exploit the deep layers of the UNet model, the noise might not affect the activations from these layers significantly.
|
| 184 |
+
|
| 185 |
+
Robustness to input corruptions. In this experiment, we investigate the robustness of DDPMbased representations. First, we learn pixel classifiers on the clean images using the DDPM, SwAV and MAE representations on the Bedroom-28 and Horse-21 datasets. Then, 18 diverse corruption types, adopted from (Hendrycks & Dietterich, 2019), are applied to test images. Each corruption has five levels of severity. In Figure 6, we provide mean IoUs computed over all corruption types for 1, 3, 5 levels of severity, denoted as “weak”, “medium” and “strong”, respectively.
|
| 186 |
+
|
| 187 |
+
One can observe that the proposed DDPM-based method demonstrates higher robustness and preserves its advantage over the SwAV and MAE models even for severe image distortions.
|
| 188 |
+
|
| 189 |
+
# 5 CONCLUSION
|
| 190 |
+
|
| 191 |
+
This paper demonstrates that DDPMs can serve as representation learners for discriminative computer vision problems. Compared to GANs, diffusion models allow for a straightforward computation of these representations for real images, and one does not need to learn an additional encoder, which maps images to the latent space. This DDPM’s advantage and superior generative quality provide state-of-the-art performance in the few-shot semantic segmentation task. The notable restraint of the DDPM-based segmentation is a requirement of high-quality diffusion models trained on the dataset at hand, which can be challenging for complex domains, like ImageNet or MSCOCO. However, given the rapid research progress on DDPM, we expect they will reach these milestones in the nearest future, thereby extending the range of applicability for the corresponding representations.
|
| 192 |
+
|
| 193 |
+
# REFERENCES
|
| 194 |
+
|
| 195 |
+
Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. arXiv preprint arXiv:2006.09882, 2020.
|
| 196 |
+
|
| 197 |
+
Liang-Chieh Chen, George Papandreou, Florian Schroff, and Hartwig Adam. Rethinking atrous convolution for semantic image segmentation. arXiv preprint arXiv:1706.05587, 2017.
|
| 198 |
+
|
| 199 |
+
Mark Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, and Ilya Sutskever. Generative pretraining from pixels. In ICML, 2020a.
|
| 200 |
+
|
| 201 |
+
Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In ICML, 2020b.
|
| 202 |
+
|
| 203 |
+
Rewon Child. Very deep $\{ { \mathrm { v a e } } \} { \mathrm { s } }$ generalize autoregressive models and can outperform them on images. In International Conference on Learning Representations, 2021.
|
| 204 |
+
|
| 205 |
+
Elijah Cole, Xuan Yang, Kimberly Wilber, Oisin Mac Aodha, and Serge Belongie. When does contrastive visual representation learning work? arXiv preprint arXiv:2105.05837, 2021.
|
| 206 |
+
|
| 207 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009.
|
| 208 |
+
|
| 209 |
+
Prafulla Dhariwal and Alex Nichol. Diffusion models beat gans on image synthesis. 2021.
|
| 210 |
+
|
| 211 |
+
Jeff Donahue and Karen Simonyan. Large scale adversarial representation learning. NeurIPS, 2019.
|
| 212 |
+
|
| 213 |
+
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. ICLR, 2021.
|
| 214 |
+
|
| 215 |
+
Danil Galeev, Konstantin Sofiiuk, Danila Rukhovich, Mikhail Romanov, Olga Barinova, and Anton Konushin. Learning high-resolution domain-specific representations with a gan generator. In S+SSPR, 2020.
|
| 216 |
+
|
| 217 |
+
Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollar, and Ross Girshick. Masked ´ autoencoders are scalable vision learners. arXiv:2111.06377, 2021.
|
| 218 |
+
|
| 219 |
+
Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations, 2019.
|
| 220 |
+
|
| 221 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. 2020.
|
| 222 |
+
|
| 223 |
+
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.
|
| 224 |
+
|
| 225 |
+
Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of stylegan. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 8107–8116, 2020.
|
| 226 |
+
|
| 227 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Yoshua Bengio and Yann LeCun (eds.), 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015.
|
| 228 |
+
|
| 229 |
+
Cheng-Han Lee, Ziwei Liu, Lingyun Wu, and Ping Luo. Maskgan: Towards diverse and interactive facial image manipulation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 230 |
+
|
| 231 |
+
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. In CVPR, 2021a.
|
| 232 |
+
|
| 233 |
+
Haoying Li, Yifan Yang, Meng Chang, Huajun Feng, Zhihai Xu, Qi Li, and Yueting Chen. Srdiff: Single image super-resolution with diffusion probabilistic models. 2021b.
|
| 234 |
+
|
| 235 |
+
Luke Melas-Kyriazi, Christian Rupprecht, Iro Laina, and Andrea Vedaldi. Finding an unsupervised image segmenter in each of your deep generative models. arXiv preprint arXiv:2105.08127, 2021.
|
| 236 |
+
|
| 237 |
+
Chenlin Meng, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. Sdedit: Image synthesis and editing with stochastic differential equations. 2021.
|
| 238 |
+
|
| 239 |
+
Prafulla Nichol, Alex & Dhariwal. Improved denoising diffusion probabilistic models. ICML, 2021.
|
| 240 |
+
|
| 241 |
+
Stanislav Pidhorskyi, Donald A Adjeroh, and Gianfranco Doretto. Adversarial latent autoencoders. In Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 242 |
+
|
| 243 |
+
Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computerassisted intervention, pp. 234–241. Springer, 2015.
|
| 244 |
+
|
| 245 |
+
Chitwan Saharia, Jonathan Ho, William Chan, Tim Salimans, David J Fleet, and Mohammad Norouzi. Image super-resolution via iterative refinement. 2021.
|
| 246 |
+
|
| 247 |
+
Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In ICML, 2015.
|
| 248 |
+
|
| 249 |
+
Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. In NeurIPS, 2019.
|
| 250 |
+
|
| 251 |
+
Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. NeurIPS, 2020.
|
| 252 |
+
|
| 253 |
+
Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. 2021.
|
| 254 |
+
|
| 255 |
+
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.
|
| 256 |
+
|
| 257 |
+
Nontawat Tritrong, Pitchaporn Rewatbowornwong, and Supasorn Suwajanakorn. Repurposing gans for one-shot semantic part segmentation. In CVPR, 2021.
|
| 258 |
+
|
| 259 |
+
Andrey Voynov and Artem Babenko. Unsupervised discovery of interpretable directions in the gan latent space. In ICML, 2020.
|
| 260 |
+
|
| 261 |
+
Andrey Voynov, Stanislav Morozov, and Artem Babenko. Object segmentation without labels with large-scale generative models. ICML, 2021.
|
| 262 |
+
|
| 263 |
+
Changxi Xu, Jianjin & Zheng. Linear semantics in generative adversarial networks. In CVPR, 2021.
|
| 264 |
+
|
| 265 |
+
Yinghao Xu, Yujun Shen, Jiapeng Zhu, Ceyuan Yang, and Bolei Zhou. Generative hierarchical features from synthesizing images. In CVPR, 2021.
|
| 266 |
+
|
| 267 |
+
Fisher Yu, Yinda Zhang, Shuran Song, Ari Seff, and Jianxiong Xiao. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
|
| 268 |
+
|
| 269 |
+
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. In CVPR, 2021.
|
| 270 |
+
|
| 271 |
+
Bolei Zhou, Hang Zhao, Xavier Puig, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Semantic understanding of scenes through the ade20k dataset. International Journal of Computer Vision, 127:302–321, 2018.
|
| 272 |
+
|
| 273 |
+
# APPENDIX
|
| 274 |
+
|
| 275 |
+
# A EVOLUTION OF PREDICTIVE PERFORMANCE
|
| 276 |
+
|
| 277 |
+

|
| 278 |
+
Figure 7: The evolution of predictive performance of DDPM-based pixel-wise representations for different UNet blocks and diffusion steps on LSUN-Cat and LSUN-Bedroom. The blocks are numbered from the deep to shallow ones.
|
| 279 |
+
|
| 280 |
+

|
| 281 |
+
Figure 8: The evolution of predictive performance of DDPM-based pixel-wise representations on the FFHQ-256, LSUN-Cat and LSUN-Bedroom datasets for classes with the smallest (Left) and largest (Right) average areas.
|
| 282 |
+
|
| 283 |
+
B DATASETDDPM & DATASETGAN SATURATION
|
| 284 |
+
Table 6: Performance of DatasetDDPM and DatasetGAN for $1 0 K { - } 5 0 K$ synthetic images in the training dataset. Mean IoU of both methods saturates at $3 0 K { - } 5 0 K$ of synthetic data.
|
| 285 |
+
|
| 286 |
+
<table><tr><td colspan="7">DatasetDDPM</td><td colspan="4">DatasetGAN</td></tr><tr><td>Dataset</td><td>10k</td><td>20K</td><td>30K</td><td>40K</td><td>50K</td><td>10K</td><td>20K</td><td>30K</td><td>40K</td><td>50K</td></tr><tr><td>Bedroom-2845.1±2.346.2±2.346.1±2.847.8±2.347.9±2.930.6±2.330.4±3.1 30.9±2.430.9±2.431.3±2.7</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>FFHQ-34</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>55.9±0.8 55.8±0.7 55.9±0.7 56.0±0.8 55.9±0.7 56.4±1.0 56.9±1.0 57.0±1.1 57.0±1.2 57.0±1.2</td></tr><tr><td>Cat-15</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>43.6±3.0 46.4±1.7 46.2±1.9 47.4±1.7 47.6±1.5 34.7±2.8 34.8±2.9 36.3±2.335.8±2.5 36.5 ±2.3</td></tr><tr><td>Horse-21</td><td></td><td></td><td>57.0±1.2 59.5±0.5 59.0±2.0 60.4±1.1 60.8±0.9 41.6±2.0 43.1± 1.8 45.4±1.4 44.5±1.2 44.6 ± 1.4</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 287 |
+
|
| 288 |
+
# C TRAINING SETUP
|
| 289 |
+
|
| 290 |
+
The ensemble of MLPs consists of 10 independent models. Each MLP is trained for ${ \sim } 4$ epochs using the Adam optimizer (Kingma & Ba, 2015) with 0.001 learning rate. The batch size is 64. This setting is used for all methods and datasets.
|
| 291 |
+
|
| 292 |
+
MLP architecture. We adopt the MLP architecture from (Zhang et al., 2021). Specifically, we use MLPs with two hidden layers with ReLU nonlinearity and batch normalization. The sizes of hidden layers are 128 and 32 for datasets with a number of classes less than 30, and 256 and 128 for others.
|
| 293 |
+
|
| 294 |
+
Also, we evaluate the performance of the proposed method for twice wider / deeper MLPs on the Bedroom-28 and FFHQ-34 datasets and do not observe any noticeable difference, see Table 7.
|
| 295 |
+
|
| 296 |
+
<table><tr><td>Method</td><td>Bedroom-28</td><td>FFHQ-34</td></tr><tr><td>Original MLP</td><td>49.4</td><td>59.1</td></tr><tr><td>Wider MLP</td><td>49.5</td><td>59.1</td></tr><tr><td>Deeper MLP</td><td>49.3</td><td>58.9</td></tr></table>
|
| 297 |
+
|
| 298 |
+
Table 7: Performance of the proposed method for twice wider / deeper MLP architecture within the ensemble. More expressive MLPs do not improve the performance.
|
| 299 |
+
|
| 300 |
+
# D PER CLASS IOUS
|
| 301 |
+
|
| 302 |
+

|
| 303 |
+
Figure 9: Per class IoUs for DatasetGAN, DatasetDDPM and DDPM.
|
| 304 |
+
|
| 305 |
+

|
| 306 |
+
Figure 10: Number of instances of each semantic class in the annotated real and synthetic train sets.
|
| 307 |
+
|
| 308 |
+
# E DATASET DETAILS
|
| 309 |
+
|
| 310 |
+
# E.1 CLASS NAMES
|
| 311 |
+
|
| 312 |
+
Bedroom-28: [bed, footboard, headboard, side rail, carpet, ceiling, chandelier, curtain, cushion, floor, table, table top, picture, pillow, lamp column, lamp shade, wall, window, curtain rod, window frame, chair, picture frame, plinth, door, pouf, wardrobe, plant, table staff]
|
| 313 |
+
|
| 314 |
+
FFHQ-34: [background, head, cheek, chin, ear, helix, lobule, bottom lid, eyelashes, iris, pupil, sclera, tear duct, top lid, eyebrow, forehead, frown, hair, sideburns, jaw, moustache, inferior lip, oral commissure, superior lip, teeth, neck, nose, ala of nose, bridge, nose tip, nostril, philtrum, temple, wrinkles]
|
| 315 |
+
|
| 316 |
+
Cat-15: [background, back, belly, chest, leg, paw, head, ear, eye, mouth, tongue, tail, nose, whiskers, neck]
|
| 317 |
+
|
| 318 |
+
Horse-21: [background, person, back, barrel, bridle, chest, ear, eye, forelock, head, hoof, leg, mane, muzzle, neck, nostril, tail, thigh, saddle, shoulder, leg protection]
|
| 319 |
+
|
| 320 |
+
CelebA-19: [background, cloth, ear r, eye g, hair, hat, l brow, l ear, l eye, l lip, mouth, neck, neck l, nose, r brow, r ear, r eye, skin, u lip]
|
| 321 |
+
|
| 322 |
+
ADE-Bedroom-30: [wall, bed, floor, table, lamp, ceiling, painting, windowpane, pillow, curtain, cushion, door, chair, cabinet, chest, mirror, rug, armchair, book, sconce, plant, wardrobe, clock, light, flower, vase, fan, box, shelf, television]
|
| 323 |
+
|
| 324 |
+
# E.2 CLASS STATISTICS
|
| 325 |
+
|
| 326 |
+
In Figure 10, we report the statistics of classes computed over annotated real images as well as annotated synthetic images produced by GAN and DDPM.
|
| 327 |
+
|
| 328 |
+
# F EXTRACTING REPRESENTATIONS FROM MAE
|
| 329 |
+
|
| 330 |
+
To obtain pixelwise representations, we apply the model to a fully observed image (mask ratio $\scriptstyle 1 = 0$ ) of resolution 256 and extract feature maps from the deepest 12 ViT-L blocks . The feature maps from each block have $1 0 2 4 \times 3 2 \times 3 2$ dimensions. Similarly to other methods, we upsample the extracted feature maps to $2 5 6 \times 2 5 6$ and concatenate them. The overall dimension of the pixel representation is 12288.
|
| 331 |
+
|
| 332 |
+
In addition, we investigated other feature extraction strategies and got the following observations:
|
| 333 |
+
|
| 334 |
+
1. Including activations from the decoder did not provide any noticeable gains;
|
| 335 |
+
2. Extracting activations right after self-attention layers caused slightly inferior performance;
|
| 336 |
+
3. Extracting activations from every second encoder block also provided a bit worse results.
|
md/dev/Sxk8Bse3RKO/Sxk8Bse3RKO.md
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Reconstructing Training Data from Trained Neural Networks
|
| 2 |
+
|
| 3 |
+
Niv Haim∗ Weizmann Institute of Science niv.haim@weizmann.ac.il
|
| 4 |
+
|
| 5 |
+
Gal Vardi∗† TTI-Chicago and Hebrew University galvardi@ttic.edu
|
| 6 |
+
|
| 7 |
+
Gilad Yehudai∗ Weizmann Institute of Science gilad.yehudai@weizmann.ac.il
|
| 8 |
+
|
| 9 |
+
Ohad Shamir Weizmann Institute of Science ohad.shamir@weizmann.ac.il
|
| 10 |
+
|
| 11 |
+
Michal Irani Weizmann Institute of Science michal.irani@weizmann.ac.il
|
| 12 |
+
|
| 13 |
+
Project page: https://giladude1.github.io/reconstruction
|
| 14 |
+
|
| 15 |
+
# Abstract
|
| 16 |
+
|
| 17 |
+
Understanding to what extent neural networks memorize training data is an intriguing question with practical and theoretical implications. In this paper we show that in some cases a significant fraction of the training data can in fact be reconstructed from the parameters of a trained neural network classifier. We propose a novel reconstruction scheme that stems from recent theoretical results about the implicit bias in training neural networks with gradient-based methods. To the best of our knowledge, our results are the first to show that reconstructing a large portion of the actual training samples from a trained neural network classifier is generally possible. This has negative implications on privacy, as it can be used as an attack for revealing sensitive training data. We demonstrate our method for binary MLP classifiers on a few standard computer vision datasets.
|
| 18 |
+
|
| 19 |
+
# 1 Introduction
|
| 20 |
+
|
| 21 |
+
It is commonly believed that neural networks memorize the training data, even when they are able to generalize well to unseen test data (e.g., [Zhang et al., 2021, Feldman, 2020]). Exploring this memorization phenomenon is of great importance both practically and theoretically. Indeed, it has implications on our understanding of generalization in deep learning, on the hidden representations learnt by neural networks, and on the extent to which they are vulnerable to privacy attacks.
|
| 22 |
+
|
| 23 |
+
A fundamental question for understanding memorization is:
|
| 24 |
+
|
| 25 |
+
Are the specific training samples encoded in the parameters of a trained classifier? Can they be recovered from the network parameters?
|
| 26 |
+
|
| 27 |
+
In this work, we study this question, and devise a novel scheme which allows us to reconstruct a significant portion of the training data from the parameters of a trained neural network alone, without having any additional information on the data. Thus, we provide a proof-of-concept that the learning (a) Top 24 images reconstructed from a binary classifier trained on 50 CIFAR10 images (b) Their corresponding nearest neighbours from the training-set of the model process can sometimes be reversed: That is, instead of learning a model given a training dataset, it is possible to find the training data given a trained model. In Figure 1 we show how our approach reconstructs images from the CIFAR10 dataset, given a simple trained binary classifier.
|
| 28 |
+
|
| 29 |
+

|
| 30 |
+
|
| 31 |
+

|
| 32 |
+
Figure 1: Reconstruction of training images from a pretrained binary classifier, trained on 50 CIFAR10 images. The two classes are “animals” and “vehicles”. We calculate the nearest neighbor using the SSIM metric.
|
| 33 |
+
|
| 34 |
+
Many works try to “crack” neural networks by analyzing and visualizing either their learnt parameters or representations [Erhan et al., 2009, Mahendran and Vedaldi, 2015, Olah et al., 2017, 2020]. This is usually done by “inverting” the model, namely finding inputs that are strongly correlated with the model’s activations [Mordvintsev et al., 2015, Yin et al., 2020, Fredrikson et al., 2015]. Unsurprisingly, the results are semantically correlated with the training dataset. However, one rarely sees an exact version of a training sample.
|
| 35 |
+
|
| 36 |
+
Our results have potential negative implications on privacy in deep learning. Our scheme can be viewed as a training-data reconstruction attack, since an adversary might recover sensitive training data. For example, if a medical device includes a model trained on sensitive medical records, an adversary might reconstruct this data and thus violate the privacy of the patients. Privacy attacks in deep learning have been widely studied in recent years (cf. Liu et al. [2021]), but as far as we are aware, the known attacks cannot reconstruct portions of the training data from a trained model.
|
| 37 |
+
|
| 38 |
+
Our approach relies on theoretical results about the implicit bias in training neural networks with gradient-based methods. The implicit bias has been studied extensively in recent years with the motivation of explaining generalization in deep learning (see Section 2). We use results by Lyu and Li [2019], Ji and Telgarsky [2020], which establish that, under some technical assumptions, if we train a neural network with the binary cross entropy loss, its parameters will converge to a stationary point of a certain margin-maximization problem. This result implies that the parameters of the trained network satisfy a set of equations w.r.t. the training dataset. In our approach, given a trained network, we find a dataset that solves this set of equations w.r.t. the trained parameters.
|
| 39 |
+
|
| 40 |
+
Our Contributions We show that large portions of the training samples are encoded in the parameters of a trained classifier. We also provide a practical scheme to decode the training samples, without any assumptions on the data. As far as we know, this is the first work that shows that reconstruction of actual training samples from a trained neural network classifier is possible.
|
| 41 |
+
|
| 42 |
+
# 2 Related Work
|
| 43 |
+
|
| 44 |
+
Understanding and Visualizing what is learnt by Neural Networks. The most common approach for analysing what is learnt by a neural network is by searching inputs that maximize the class output or the activations of neurons in intermediate layers [Erhan et al., 2009, Olah et al., 2020]. Oftentimes this is done via optimization with respect to the model input. Optimizing without any prior on the input usually results in noise inputs. Therefore, most approaches incorporate priors such as smoothness regularization or the use of pre-trained image generators [Mahendran and Vedaldi, 2015, Yosinski et al., 2015, Mordvintsev et al., 2015, Nguyen et al., 2016a,b, 2017] (see Olah et al. [2017] for a comprehensive summary). Optimization w.r.t. the input may also result in adversarial examples [Szegedy et al., 2013, Goodfellow et al., 2014]. Recently, [Tsipras et al., 2018, Engstrom et al., 2019] showed that classifiers trained to be robust to adversarial examples tend to learn representations that are more aligned with human vision. This was later utilized by [Santurkar et al., 2019, Mejia et al., 2019] to generate class-conditional images from a trained classifier. While all those approaches indicate that, unsurprisingly, the learnt representations are strongly correlated with the datasets on which the model was trained, none of them demonstrate the reconstruction of exact training samples from the trained models.
|
| 45 |
+
|
| 46 |
+
Privacy Attacks in Deep Learning. Many methods deal with extracting sensitive information from trained models. Perhaps the closest to our approach is model-inversion that aims to reconstruct class representatives from the training data of a trained model [Fredrikson et al., 2015, He et al., 2019, Yang et al., 2019, Yin et al., 2020]. It is important to note that the reconstructed images, albeit semantically similar to some input images, are still not actual samples from the training set. Carlini et al. [2021, 2019] demonstrated reconstruction of training data from generative language models. By completing sentences, they reveal sensitive information from the training data. We note that this approach is specific to generative language models, while our approach considers classifiers and is less data specific. Membership-inference attacks [Shokri et al., 2017] aim to determine whether a given data point was used to train the model or not. For these methods to work, the adversary must be able to guess a specific input, whereas our approach does not assume such ability. Lastly, avoiding leakage of sensitive information on the training dataset is the motivation behind differential privacy in machine learning, which has been extensively studied [Abadi et al., 2016, Dwork et al., 2006, Chaudhuri et al., 2011]. For an elaborated discussion on the relation of these approaches to ours see Appendix A.
|
| 47 |
+
|
| 48 |
+
Implicit Bias. In overparameterized neural networks one might expect overfitting to occur, but it seems that gradient-based methods are biased towards networks that generalize well [Zhang et al., 2021, Neyshabur et al., 2017]. Mathematically characterizing this implicit bias is a major problem in the theory of deep learning. Our approach is based on a characterization of the implicit bias of gradient flow in homogeneous neural networks due to Lyu and Li [2019] and Ji and Telgarsky [2020] (see Section 3 for details). The implicit bias of gradient-based methods in neural networks was extensively studied in recent years both for classification tasks (e.g., Soudry et al. [2018], Gunasekar et al. [2018c], Ji and Telgarsky [2018], Nacson et al. [2019], Vardi et al. [2021], Chizat and Bach [2020], Gunasekar et al. [2018a], Moroshko et al. [2020]) and regression tasks (e.g., Gunasekar et al. [2018b], Arora et al. [2019], Azulay et al. [2021], Yun et al. [2020], Woodworth et al. [2020], Razin and Cohen [2020], Li et al. [2020], Vardi and Shamir [2021], Timor et al. [2022]). See Vardi [2022] for a survey.
|
| 49 |
+
|
| 50 |
+
# 3 Background and Reconstruction Scheme
|
| 51 |
+
|
| 52 |
+
In this section we present our training data reconstruction scheme, as well as provide a brief overview on the theoretical results about implicit bias, which motivate our approach.
|
| 53 |
+
|
| 54 |
+
# 3.1 On the Implicit Bias of Neural Networks
|
| 55 |
+
|
| 56 |
+
Let $S = \{ ( \mathbf { x } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n } \subseteq \mathbb { R } ^ { d } \times \{ - 1 , 1 \}$ be a binary classification training dataset. Let $\Phi ( \pmb \theta ; \cdot ) :$ $\mathbb { R } ^ { d } \to \mathbb { R }$ be a neural network parameterized by $\pmb { \theta } \in \mathbb { R } ^ { p }$ . For a loss function $\ell : \mathbb { R } \to \mathbb { R }$ the empirical loss of $\Phi ( \theta ; \cdot )$ on the dataset $S$ is $\begin{array} { r } { \mathcal { L } ( \pmb { \theta } ) : = \sum _ { i = 1 } ^ { n } \ell \big ( y _ { i } \Phi ( \pmb { \theta } ; \mathbf { x } _ { i } ) \big ) } \end{array}$ . We focus on the logistic loss (a.k.a. binary cross entropy), namely, $\ell ( q ) = \log ( 1 + e ^ { - q } )$ .
|
| 57 |
+
|
| 58 |
+
Our approach is based on Theorem 3.1 below, which holds for gradient flow (i.e., gradient descent with an infinitesimally small step size). Before stating the theorem, we need the following definitions: (1) We say that gradient flow converges in direction to $\tilde { \pmb { \theta } }$ if $\begin{array} { r } { \operatorname* { l i m } _ { t \infty } \frac { \pmb { \theta } ( t ) } { \lVert \pmb { \theta } ( t ) \rVert } = \frac { \tilde { \pmb { \theta } } } { \lVert \tilde { \pmb { \theta } } \rVert } } \end{array}$ , where $\pmb \theta ( t )$ is the parameter vector at time $t$ ; (2) We say that a network $\Phi$ is homogeneous w.r.t. the parameters $\pmb \theta$ if there exists $L > 0$ such that for every $\alpha > 0$ and $\theta , \mathbf { x }$ we have $\bar { \Phi ( \alpha \pmb { \theta } ; \mathbf { x } ) } = \alpha ^ { L } \Phi ( \bar { \pmb { \theta } } ; \mathbf { x } )$ . Thus, scaling the parameters by any factor $\alpha > 0$ scales the outputs by $\alpha ^ { L }$ . We note that essentially any fully-connected or convolutional neural network with ReLU activations is homogeneous w.r.t. the parameters $\pmb \theta$ if it does not have any skip-connections (i.e., residual connections) or bias terms, except possibly for the first layer.
|
| 59 |
+
|
| 60 |
+
Theorem 3.1 (Paraphrased from Lyu and Li [2019], Ji and Telgarsky [2020]) Let $\Phi ( \theta ; \cdot )$ be $a$ homogeneous ReLU neural network. Consider minimizing the logistic loss over a binary classification dataset $\{ ( \mathbf { x } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n }$ using gradient flow. Assume that there exists time $t _ { 0 }$ such that $\mathcal { L } ( \pmb { \theta } ( t _ { 0 } ) ) < 1 ^ { \ddagger }$ Then, gradient flow converges in direction to a first order stationary point (KKT point) of the following maximum-margin problem:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\operatorname* { m i n } _ { \pmb { \theta } ^ { \prime } } \frac { 1 } { 2 } \left\| \pmb { \theta } ^ { \prime } \right\| ^ { 2 } s . t . \forall i \in [ n ] \ y _ { i } \Phi ( \pmb { \theta } ^ { \prime } ; \mathbf { x } _ { i } ) \geq 1 .
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
Moreover, $\mathcal { L } ( \pmb \theta ( t ) ) 0$ as $t \to \infty$ .
|
| 67 |
+
|
| 68 |
+
The above theorem guarantees directional convergence to a first order stationary point (of the optimization problem (1)), which is also called Karush–Kuhn–Tucker point, or KKT point for short. The KKT approach allows inequality constraints, and is a generalization of the method of Lagrange multipliers, which allows only equality constraints.
|
| 69 |
+
|
| 70 |
+
The great virtue of Theorem 3.1 is that it characterizes the implicit bias of gradient flow with the logistic loss for homogeneous networks. Namely, even though there are many possible directions of $\frac { \bar { \pmb { \theta } } } { \| \pmb { \theta } \| }$ that classify the dataset correctly, gradient flow converges only to directions that are KKT points of Problem (1). In particular, if the trajectory $\pmb \theta ( t )$ of gradient flow under the regime of Theorem 3.1 converges in direction to a KKT point $\tilde { \pmb { \theta } }$ , then we have the following: There exist $\lambda _ { 1 } , \ldots , \lambda _ { n } \in \mathbb { R }$ such that
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
\begin{array} { l } { \displaystyle \tilde { \theta } = \sum _ { i = 1 } ^ { n } \lambda _ { i } y _ { i } \nabla _ { \theta } \Phi ( \tilde { \theta } ; { \bf x } _ { i } ) } \\ { \displaystyle \forall i \in [ n ] , ~ y _ { i } \Phi ( \tilde { \theta } ; { \bf x } _ { i } ) \geq 1 } \\ { \displaystyle \lambda _ { 1 } , \ldots , \lambda _ { n } \geq 0 } \\ { \displaystyle \forall i \in [ n ] , ~ \lambda _ { i } = 0 \mathrm { i f } y _ { i } \Phi ( \tilde { \theta } ; { \bf x } _ { i } ) \neq 1 } \end{array}
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
Our main insight is based on Eq. (2), which implies that the parameters $\tilde { \pmb { \theta } }$ are a linear combinations of the derivatives of the network at the training data points. We say that a data point $\mathbf { x } _ { i }$ is on the margin if $y _ { i } \Phi ( \tilde { \pmb { \theta } } ; { \mathbf x } _ { i } ) = 1$ (i.e. $| \Phi ( \tilde { \pmb \theta } ; { \mathbf x } _ { i } ) | = 1 )$ . Note that Eq. (5) implies that only samples which are on the margin affect Eq. (2), since samples not on the margin have a coefficient $\lambda _ { i } = 0$ .
|
| 77 |
+
|
| 78 |
+
# 3.2 Dataset Reconstruction
|
| 79 |
+
|
| 80 |
+
Suppose we are given a trained neural network with parameters $\pmb \theta$ , and our goal is to reconstruct the dataset that the network was trained on. Although Theorem 3.1 holds asymptotically as the time $t$ tends to infinity, it suggests that also after training for a finite number of iterations the parameters of the network might approximately satisfy Eq. (2), and the coefficients $\lambda _ { i }$ satisfy Eq. (4). Since $n$ is unknown (and so is the number of samples on the margin) we set $m \geq 2 n$ which represents the number of samples we want to reconstruct (thus, we only need to upper bound $n$ ), and fix $y _ { i } = 1$ for $i = 1 , \ldots , m / 2$ and $y _ { i } = - 1$ for $i = m / 2 + 1 , \dots , m$ . We define the following losses:
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
\begin{array} { r l } & { L _ { \mathrm { s t a t i o n a r y } } ( \mathbf { x } _ { 1 } , \ldots , \mathbf { x } _ { m } , \boldsymbol { \lambda } _ { 1 } , \ldots , \boldsymbol { \lambda } _ { m } ) = \displaystyle \left\| \pmb { \theta } - \sum _ { i = 1 } ^ { m } \lambda _ { i } y _ { i } \nabla _ { \pmb { \theta } } \Phi ( \pmb { \theta } ; \mathbf { x } _ { i } ) \right\| _ { 2 } ^ { 2 } } \\ & { L _ { \lambda } ( \lambda _ { 1 } , \ldots , \lambda _ { m } ) = \displaystyle \sum _ { i = 1 } ^ { m } \operatorname* { m a x } \{ - \lambda _ { i } , 0 \} } \end{array}
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
Note that the unknown parameters are the $\mathbf { x } _ { i }$ ’s and $\lambda _ { i }$ ’s, and that $\pmb { \theta }$ and the $y _ { i }$ ’s are given. The loss $L _ { \mathrm { s t a t i o n a r y } }$ represents the stationarity condition that the parameters of the network satisfy, and $L _ { \lambda }$ represents the dual feasibility condition. We additionally define $L _ { \mathrm { p r i o r } }$ which represents some prior knowledge we might have about the dataset. For example, if we know that the dataset contains images, prior knowledge would be that each input coordinate (i.e. each pixel) is between 0 and 1. Given no prior knowledge on the data, we can define $L _ { \mathrm { p r i o r } } \equiv 0$ . Finally, we define the reconstruction loss as:
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
L _ { \mathrm { r e c o n s t r u c t } } ( \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { m } , \{ \lambda _ { i } \} _ { i = 1 } ^ { m } ) = \alpha _ { 1 } L _ { \mathrm { s t a t i o n a r y } } + \alpha _ { 2 } L _ { \lambda } + \alpha _ { 3 } L _ { \mathrm { p r i o r } }
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
where $\alpha _ { 1 } , \alpha _ { 2 } , \alpha _ { 3 } \in \mathbb { R }$ are tunable hyperparameters of the different losses. To reconstruct the dataset, we can use any nonconvex optimization method (e.g. SGD) to find the $\mathbf { x } _ { 1 } , \hdots , \mathbf { x } _ { m } , \lambda _ { 1 } , \hdots , \lambda _ { m }$ which minimize Eq. (8). We note that the $\lambda _ { i }$ ’s are not part of the training data, but finding them is necessary in order to solve this optimization problem. Finally, we emphasize that there are many other possible options to formulate the KKT conditions Eq. (2)-(5) as an unconstrained optimization problem. However, this simple choice seemed to work quite well in practice.
|
| 93 |
+
|
| 94 |
+
We note that if there exist $\{ { \bf x } _ { i } \} _ { i = 1 } ^ { n }$ and $\{ \lambda _ { i } \} _ { i = 1 } ^ { n }$ which satisfy the KKT conditions, then there are $\{ { \bf x } _ { i } \} _ { i = 1 } ^ { m }$ and $\{ \lambda _ { i } \} _ { i = 1 } ^ { m }$ which achieve zero loss in Eq. (8). Indeed, such a solution can be obtained by adding to $\{ { \bf x } _ { i } \} _ { i = 1 } ^ { n }$ additional points $\mathbf { x } _ { j }$ with $\lambda _ { j } = 0$ , or by duplicating some points in $\{ { \bf x } _ { i } \} _ { i = 1 } ^ { n }$ and modifying the $\lambda$ ’s accordingly. Also, note that since we choose $m \geq 2 n$ , then we set at least $n$ labels $y _ { i }$ to 1 and at least $n$ labels to $- 1$ . Hence, there is a solution to Eq. (8) even though we do not know the real distribution of labels in the actual training data.
|
| 95 |
+
|
| 96 |
+
We cannot simply use Eq. (3) and (5) in our reconstruction scheme, because they contain the constant "1" which corresponds to the margin (i.e., $\operatorname* { m i n } _ { i } | \Phi ( \tilde { \pmb { \theta } } ; { \mathbf { x } } _ { i } ) | )$ . Namely, we only converge in direction to a point $\tilde { \pmb { \theta } }$ that attains margin 1, but in practice we approach some point $\pmb \theta$ which attains an unknown margin $\gamma$ (i.e., $\mathrm { m i n } _ { i } \left| \Phi ( \pmb { \theta } ; \mathbf { x } _ { i } ) \right| = \gamma )$ , and we do not know in advance how to normalize it to attain a margin of exactly 1. On the other hand, Eq. (2) and (4) hold not only for $\tilde { \pmb { \theta } }$ but also for any $\pmb { \theta }$ that points at the direction of $\tilde { \pmb { \theta } }$ , and therefore in our loss in Eq. (8) we rely only on these conditions.
|
| 97 |
+
|
| 98 |
+
Intuitively, a reason to believe that there is enough information in Eq. (2) to reconstruct the data, is the following observation: Eq. (2) represents a set of $p$ equations with $O ( n d )$ unknown variables, where $p$ is the number of parameters in the network. In practice, neural networks are often highly overparameterized (i.e., $p > n d ,$ , suggesting more equations than variables.
|
| 99 |
+
|
| 100 |
+
Finally, since by Eq. (5) we have $\lambda _ { i } = 0$ for every $\mathbf { x } _ { i }$ that is not on the margin, then Eq. (2) implies that $\tilde { \pmb { \theta } }$ is determined only by the gradients w.r.t. the data points that are on the margin. Hence, we can only expect to reconstruct training samples that are on the margin (see also Subsection 5.3).
|
| 101 |
+
|
| 102 |
+
# 4 A Simple Experiment in Two Dimensions
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 2: Exemplifying our reconstruction scheme on a simple 2D dataset (see text for explanation).
|
| 106 |
+
|
| 107 |
+
In this section we exemplify our dataset reconstruction scheme on a toy example of 2-dimensional data, i.e. we consider $( \dot { \bf x } , y ) \in \mathbb { R } ^ { 2 } \times \{ \pm 1 \}$ . We set $n = 2 0$ training samples on the unit circle, with alternating labels. For a visualization of the dataset see Figure 2a, blue and red " $" \times "$ represent the two classes. We trained a 3-layer model with 1000 neurons in each layer on this dataset. The model learns to correctly classify the training set. In Figure 2b, we visualize the output of the model as a function of its input. Blue and red regions correspond to smaller and larger outputs of the model, respectively.
|
| 108 |
+
|
| 109 |
+
We now demonstrate our reconstruction scheme. We first randomly initialize $m = 1 0 0$ points in $\mathbb { R } ^ { 2 }$ , and assign 50 points to each class. This is depicted in Figure $2 \mathrm { c }$ , where green points correspond to the blue class, and magenta points correspond to the red class. Next, we optimize the loss in Eq. (8), with $L _ { \mathrm { p r i o r } } \equiv 0$ . The results of our reconstruction scheme are in Figure 2d. Note that our approach reconstructed all the input samples, up to some noise.
|
| 110 |
+
|
| 111 |
+
To further improve our reconstruction results, we remove some of the extra points which did not converge to a training sample. In Figure 2e we removed points $\mathbf { x } _ { i }$ with corresponding $\lambda _ { i } ~ < ~ 5$ . According to Eq. (2), points with $\lambda _ { i } = 0$ should not affect the parameters, hence their corresponding $\mathbf { x } _ { i }$ can take any value. In practice, it is sufficient to remove points with a small enough corresponding $\lambda _ { i }$ . Finally, to remove duplicates, we greedily remove points which are very close to other points. That is, we randomly order the points, and iteratively remove points that are at distance $< 0 . 0 3$ from another point. The final reconstruction result is depicted in Figure 2f.
|
| 112 |
+
|
| 113 |
+
# 5 Results
|
| 114 |
+
|
| 115 |
+

|
| 116 |
+
Top 45 images reconstructed from a model trained on CIFAR10 (rows 1, 3, 5), and their corresponding nearest-neighbors from the training-set of the model (rows 2, 4, 6)
|
| 117 |
+
|
| 118 |
+

|
| 119 |
+
Top 45 images reconstructed from a model trained on MNIST (rows 1, 3, 5), and their corresponding nearest-neighbors from the training-set of the model (rows 2, 4, 6)
|
| 120 |
+
Figure 3: Reconstructing training samples from two binary classifiers – one trained on 500 images with labels animals/vehicles (CIFAR), and the other trained on 500 odd/even digit images (MNIST). Train errors are zero, test accuracies are $8 8 . 0 \% / 7 7 . 6 \%$ for MNIST/CIFAR
|
| 121 |
+
|
| 122 |
+
# 5.1 Experimental Setup
|
| 123 |
+
|
| 124 |
+
Datasets. We conduct experiments on binary classification tasks where images are taken from the MNIST [LeCun et al., 2010] and CIFAR10 [Krizhevsky et al., 2009] datasets and the labels are set to odd vs. even digits (MNIST), and vehicles vs. animals§ (CIFAR10). We make sure that the class distribution in the training and test sets is balanced, and normalize the train and test sets by reducing the mean of the training set from both.
|
| 125 |
+
|
| 126 |
+
Training. We consider MLP architectures. Unless stated otherwise, our models comprise of three fully-connected layers with dimensions $d$ -1000-1000-1 (where $d$ is the dimension of the input) with ReLU activations. Biases are set to zero except for the first layer, to line up with the theoretical assumption of homogeneous models in Section 3. The parameters are initialized using standard Kaiming He initialization [He et al., 2015] except for the weights of the first layer that are initialized to a Gaussian distribution with standard deviation $1 0 ^ { - 4 }$ (see discussion in Subsection 5.2). We train our models using full batch gradient descent for $1 0 ^ { 6 }$ epochs with a learning rate of 0.01. All models achieve zero training error (i.e., all the train samples are labeled correctly), and a training loss $< 1 0 ^ { - 6 }$ To compute the test accuracy, we use the original test sets of MNIST/CIFAR10 with 10000/8000 images respectively, and labeled accordingly.
|
| 127 |
+
|
| 128 |
+
# 5.2 Training Set Reconstruction
|
| 129 |
+
|
| 130 |
+
We minimize the loss defined in Eq. (8) with $\alpha _ { 1 } = 1$ , $\alpha _ { 2 } = 5$ , $\alpha _ { 3 } = 1$ . We initialize $\mathbf { x } _ { i } \sim \mathcal { N } ( 0 , \sigma _ { x } I )$ , where $\sigma _ { x }$ is a hyperparameter, and $\lambda _ { i } \sim \mathcal { U } [ 0 , 1 ]$ . We set the number of reconstructed samples to $m =$ $2 n$ (where $n$ is the size of the original training set). Note that our loss contains the derivative of ReLU Eq. (6). This derivative is a step function, containing only flat regions which are hard to optimize. We replace the derivative of the ReLU layer (backward function) with a sigmoid, which is the derivative of softplus (a smooth version of ReLU). We use the fact that our inputs are images to penalize values outside the range $[ - 1 , 1 ]$ . To this end we set $L _ { \mathrm { p r i o r } } ( z ) = \operatorname* { m a x } \{ z - 1 , 0 \} + \operatorname* { m a x } \{ - z - 1 , 0 \}$ for each pixel $z$ , and average over all dimensions (pixels) in $\mathbf { x } _ { i }$ . We optimize our loss for 100, 000 iterations using an SGD optimizer with momentum 0.9. We conduct a total of 100 runs using a random grid search on the hyperparameters (e.g. learning rate, $\sigma _ { x }$ . See Appendix $\mathbf { B }$ for full details). This results in $1 0 0 m$ “reconstructed” inputs.
|
| 131 |
+
|
| 132 |
+
While some $\mathbf { x } _ { i }$ end up converging to a training sample, some end as noise (similar phenomenon can be observed in 2D in Figure 2d). To identify the reconstructions that are most similar to a training image we use the SSIM metric [Wang et al., 2004].
|
| 133 |
+
|
| 134 |
+
In Figure 3 we show the best reconstruction results (in terms of SSIM) for models trained on $n { = } 5 0 0$ samples from MNIST/CIFAR10 datasets (with test accuracy $8 8 . 0 \% / 7 7 . 6 \%$ resp.). Note that the reconstructed images are very similar to the real input data, although a bit noisy. The source of this noise is not entirely clear. Possible reasons may be the complexity of the optimization problem, or the possibility that the trained model has not fully converged to the KKT point of Problem (1).
|
| 135 |
+
|
| 136 |
+
We observed that small initializations significantly improve the quality of the reconstructed samples. We conjecture that small initialization causes faster convergence to the direction of the KKT point. This is also theoretically implied in Moroshko et al. [2020] (for certain linear models). Similarly, training for more epochs also improves the quality of the reconstruction. In Appendix C we show results for reconstructions from networks trained with standard initialization or trained for much fewer epochs. During the training phase, we used full batch gradient descent, to remain as much aligned to the theoretical setting. In Appendix C we show that our approach can reconstruct training data also from models trained with mini-batch SGD.
|
| 137 |
+
|
| 138 |
+
# 5.3 Practice vs. Theory
|
| 139 |
+
|
| 140 |
+
In this section we analyze some relations between our experimental results to the theory laid down in Section 3. Given a trained model and its reconstructed samples, we match each training sample to its best reconstruction (in terms of SSIM score). We then plot this SSIM score against $\bar { \Phi } ( \pmb \theta ; \mathbf x )$ (the value of the model’s output on this training sample) – for all training samples. In Figure 4 each cell shows such plot for a given model. The top row shows models trained on the same architecture with
|
| 141 |
+
|
| 142 |
+
Models with the same architecture (1000-1000) trained on different number of training samples $( n )$
|
| 143 |
+
|
| 144 |
+

|
| 145 |
+
|
| 146 |
+

|
| 147 |
+
Models trained on $n = 5 0 0$ samples with different architectures
|
| 148 |
+
Figure 4: Each point represents a training sample. The y-axis is the highest SSIM score achieved by a reconstruction of this sample, the $\mathbf { X }$ -axis is the output of the model. Top: The effect of training the same model on different number of training samples $( n )$ . Bottom: The effect of training models with different architectures (on $n = 5 0 0$ training samples). The right-most plot shows a 3-layer non-homogeneous MLP (with bias terms in all hidden layers). See discussion in Section 5.3.
|
| 149 |
+
|
| 150 |
+
different number of training samples $( n )$ , where in the bottom row we show the results for models trained on $n = 5 0 0$ training samples, with different architectures (all results are on CIFAR10).
|
| 151 |
+
|
| 152 |
+
Recall that we do not expect to reconstruct samples that are far from the margin (Subsection 3.2). It is evident from Figure 4 that good reconstructions (e.g., $\mathrm { S S I M } > 0 . 4 \AA ,$ ) are obtained for samples that lie on the margin, as expected from theory. The plots indicate that increasing training size makes reconstruction more difficult. Lastly, as seen from the rightmost plot in the bottom row, we manage to get high-quality reconstructions from a non-homogeneous model (trained with biases in all hidden layers). This indicates that our approach may work beyond the theoretical limitations of Theorem 3.1.
|
| 153 |
+
|
| 154 |
+
# 5.4 Comparison to other Reconstruction Schemes
|
| 155 |
+
|
| 156 |
+
Model Inversion. Given a trained model $\Phi ( \theta ; \cdot )$ , we search for $\mathbf { x }$ which maximizes or minimizes $\Phi ( \pmb \theta ; \mathbf x )$ , corresponding to positive or negative labels. We initialize $\mathbf { x } \sim \mathcal { N } ( 0 , \sigma I )$ for several values of $\sigma$ and optimize w.r.t. the model output (see Appendix B for the choice of hyperparameters). In Figure 5a (left) it is apparent that in our two-dimensional experiment, model inversion successfully reconstructed 7 training samples, which indeed lie on a local minimum or maximum. However, note that our scheme reconstructs all 20 samples (Figure 2). In high dimensions, namely, in MNIST and CIFAR, while our scheme can reconstruct a large portion of the training set (Figure 3a), model inversion converges to noisy/blurry class representatives that correspond to high/low output values (Figure 5a, right). Such results are typical with model inversion since not all class members from the training set are visually similar (see discussions in Shokri et al. [2017], Melis et al. [2019]).
|
| 157 |
+
|
| 158 |
+
Weights Visualization. The weights of the first fully-connected layer have the same dimension as that of the input. One may wonder whether training samples are directly encoded there. In Figure 5b we show the weights that are most similar (SSIM) to a training sample, or all of them in the 2D case. As seen in the 2D case, most weights are in the general direction of a training sample, however the scale is unknown without prior knowledge on the data. For images (MNIST/CIFAR10), not more than 3 or 4 of the weights have resemblance to training samples, while our scheme manages to reconstruct dozens of samples. See Appendix B and C for details and all 1000 weights of the models.
|
| 159 |
+
|
| 160 |
+
# 6 Discussion and Conclusion
|
| 161 |
+
|
| 162 |
+
Even though our results are shown for relatively small-scale models, they are the first to show that the parameters of trained networks may contain enough information to fully reconstruct training samples,
|
| 163 |
+
|
| 164 |
+
# (a) Model Inversion
|
| 165 |
+
|
| 166 |
+

|
| 167 |
+
|
| 168 |
+

|
| 169 |
+
(b) Weights of the first Fully-Connected Layer
|
| 170 |
+
Figure 5: Comparison to other reconstruction schemes. Top: Model inversion on the 2D experiment (left), on CIFAR10 (top right) and MNIST (bottom right). The CIFAR and MNIST images are ordered by the value of their output from left (smallest) to right (largest). Bottom: Weights of the first (fully-connected) layer for the 2D experiment (left), CIFAR10 (top right) and MNIST (bottom right). The weights for the 2D experiment are the small purple dots. For the CIFAR and MNIST experiments we show the 10 weights with the highest SSIM score.
|
| 171 |
+
|
| 172 |
+
and the first to reconstruct a substantial amount of training samples. Moreover, the theoretical basis of the implicit bias in neural networks provides an analytic explanation to this phenomenon.
|
| 173 |
+
|
| 174 |
+
Solving our optimization problem for convolutional neural networks turned out to be more challenging and is therefore a subject of future research. We note that the theoretical results that we rely on (i.e., Theorem 3.1) also covers convolutional neural networks. We believe that the homogeneity restriction might be relaxed, and showed reconstructions also from a non-homogeneous model (Figure 4, bottomrightmost). We also believe that our method may be extended to multi-class classifiers using an extension of Theorem 3.1. Finally, showing reconstructions on larger models and datasets, or on tabular or textual data are interesting future directions.
|
| 175 |
+
|
| 176 |
+
On the theoretical side, it is not entirely clear why our optimization problem in Eq. (8) converges to actual training samples, even though there is no guarantee that the solution is unique, especially when using no prior (other than simple bounding to $[ - 1 , 1 ] ,$ . As a final note, our work brings up the question: are samples on margin the only ones that can be recovered from a trained classifier? or there exist better reconstruction schemes to reconstruct even more training samples from a trained neural network.
|
| 177 |
+
|
| 178 |
+
# Acknowledgements
|
| 179 |
+
|
| 180 |
+
This project received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No 788535), and ERC grant 754705, and from the D. Dan and Betty Kahn Foundation, and was supported by the Carolito Stiftung.
|
| 181 |
+
|
| 182 |
+
# References
|
| 183 |
+
|
| 184 |
+
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.
|
| 185 |
+
|
| 186 |
+
S. Arora, N. Cohen, W. Hu, and Y. Luo. Implicit regularization in deep matrix factorization. In Advances in Neural Information Processing Systems, pages 7413–7424, 2019.
|
| 187 |
+
S. Azulay, E. Moroshko, M. S. Nacson, B. Woodworth, N. Srebro, A. Globerson, and D. Soudry. On the implicit bias of initialization shape: Beyond infinitesimal mirror descent. In International Conference on Machine Learning, pages 468–477, 2021.
|
| 188 |
+
B. Balle, G. Cherubin, and J. Hayes. Reconstructing training data with informed adversaries. arXiv preprint arXiv:2201.04845, 2022.
|
| 189 |
+
L. Biewald. Experiment tracking with weights and biases, 2020. URL https://www.wandb.com/. Software available from wandb.com.
|
| 190 |
+
G. Brown, M. Bun, V. Feldman, A. Smith, and K. 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.
|
| 191 |
+
N. Carlini, C. Liu, Ú. Erlingsson, J. Kos, and D. Song. The secret sharer: Evaluating and testing unintended memorization in neural networks. In 28th USENIX Security Symposium (USENIX Security 19), pages 267–284, 2019.
|
| 192 |
+
N. Carlini, S. Deng, S. Garg, S. Jha, S. Mahloujifar, M. Mahmoody, S. Song, A. Thakurta, and F. Tramer. Is private learning possible with instance encoding? arXiv preprint arXiv:2011.05315, 2020a.
|
| 193 |
+
N. Carlini, M. Jagielski, and I. Mironov. Cryptanalytic extraction of neural network models. In Annual International Cryptology Conference, pages 189–218. Springer, 2020b.
|
| 194 |
+
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.
|
| 195 |
+
K. Chaudhuri, C. Monteleoni, and A. D. Sarwate. Differentially private empirical risk minimization. Journal of Machine Learning Research, 12(3), 2011.
|
| 196 |
+
S. Chen, A. Klivans, and R. Meka. Efficiently learning one hidden layer relu networks from queries. Advances in Neural Information Processing Systems, 34, 2021.
|
| 197 |
+
L. Chizat and F. Bach. Implicit bias of gradient descent for wide two-layer neural networks trained with the logistic loss. In Conference on Learning Theory, pages 1305–1338. PMLR, 2020.
|
| 198 |
+
C. Dwork, F. McSherry, K. Nissim, and A. Smith. Calibrating noise to sensitivity in private data analysis. In Theory of cryptography conference, pages 265–284. Springer, 2006.
|
| 199 |
+
L. Engstrom, A. Ilyas, S. Santurkar, D. Tsipras, B. Tran, and A. Madry. Adversarial robustness as a prior for learned representations. arXiv preprint arXiv:1906.00945, 2019.
|
| 200 |
+
D. Erhan, Y. Bengio, A. Courville, and P. Vincent. Visualizing higher-layer features of a deep network. University of Montreal, 1341(3):1, 2009.
|
| 201 |
+
V. Feldman. Does learning require memorization? a short tale about a long tail. In Proceedings of the 52nd Annual ACM SIGACT Symposium on Theory of Computing, pages 954–959, 2020.
|
| 202 |
+
M. Fredrikson, S. Jha, and T. Ristenpart. Model inversion attacks that exploit confidence information and basic countermeasures. In Proceedings of the 22nd ACM SIGSAC conference on computer and communications security, pages 1322–1333, 2015.
|
| 203 |
+
I. J. Goodfellow, J. Shlens, and C. Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
|
| 204 |
+
S. Gunasekar, J. Lee, D. Soudry, and N. Srebro. Characterizing implicit bias in terms of optimization geometry. In International Conference on Machine Learning, pages 1832–1841. PMLR, 2018a.
|
| 205 |
+
S. Gunasekar, J. Lee, D. Soudry, and N. Srebro. Implicit bias of gradient descent on linear convolutional networks. arXiv preprint arXiv:1806.00468, 2018b.
|
| 206 |
+
S. Gunasekar, J. D. Lee, D. Soudry, and N. Srebro. Implicit bias of gradient descent on linear convolutional networks. In Advances in Neural Information Processing Systems, pages 9461–9471, 2018c.
|
| 207 |
+
K. He, X. Zhang, S. Ren, and J. Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pages 1026–1034, 2015.
|
| 208 |
+
Z. He, T. Zhang, and R. B. Lee. Model inversion attacks against collaborative inference. In Proceedings of the 35th Annual Computer Security Applications Conference, pages 148–162, 2019.
|
| 209 |
+
B. Hitaj, G. Ateniese, and F. Perez-Cruz. Deep models under the gan: information leakage from collaborative deep learning. In Proceedings of the 2017 ACM SIGSAC conference on computer and communications security, pages 603–618, 2017.
|
| 210 |
+
Y. Huang, Z. Song, K. Li, and S. Arora. Instahide: Instance-hiding schemes for private distributed learning. In International Conference on Machine Learning, pages 4507–4518. PMLR, 2020.
|
| 211 |
+
Y. Huang, S. Gupta, Z. Song, K. Li, and S. Arora. Evaluating gradient inversion attacks and defenses in federated learning. Advances in Neural Information Processing Systems, 34:7232–7241, 2021.
|
| 212 |
+
M. Jagielski, N. Carlini, D. Berthelot, A. Kurakin, and N. Papernot. High accuracy and high fidelity extraction of neural networks. In 29th USENIX Security Symposium (USENIX Security 20), pages 1345–1362, 2020.
|
| 213 |
+
M. Jegorova, C. Kaul, C. Mayor, A. Q. O’Neil, A. Weir, R. Murray-Smith, and S. A. Tsaftaris. Survey: Leakage and privacy at inference time. arXiv preprint arXiv:2107.01614, 2021.
|
| 214 |
+
Z. Ji and M. Telgarsky. Gradient descent aligns the layers of deep linear networks. In International Conference on Learning Representations, 2018.
|
| 215 |
+
Z. Ji and M. Telgarsky. Directional convergence and alignment in deep learning. Advances in Neural Information Processing Systems, 33:17176–17186, 2020.
|
| 216 |
+
A. Krizhevsky, G. Hinton, et al. Learning multiple layers of features from tiny images. 2009.
|
| 217 |
+
Y. LeCun, C. Cortes, and C. Burges. Mnist handwritten digit database. ATT Labs [Online]. Available: http://yann.lecun.com/exdb/mnist, 2, 2010.
|
| 218 |
+
J. P. Lewis. Fast normalized cross-correlation. 1995. URL http://citeseerx.ist.psu.edu/ viewdoc/summary?doi=10.1.1.21.6062.
|
| 219 |
+
Z. Li, Y. Luo, and K. Lyu. Towards resolving the implicit bias of gradient descent for matrix factorization: Greedy low-rank learning. In International Conference on Learning Representations, 2020.
|
| 220 |
+
B. Liu, M. Ding, S. Shaham, W. Rahayu, F. Farokhi, and Z. Lin. When machine learning meets privacy: A survey and outlook. ACM Computing Surveys (CSUR), 54(2):1–36, 2021.
|
| 221 |
+
Y. Long, V. Bindschaedler, L. Wang, D. Bu, X. Wang, H. Tang, C. A. Gunter, and K. Chen. Understanding membership inferences on well-generalized learning models. arXiv preprint arXiv:1802.04889, 2018.
|
| 222 |
+
K. Lyu and J. Li. Gradient descent maximizes the margin of homogeneous neural networks. arXiv preprint arXiv:1906.05890, 2019.
|
| 223 |
+
A. Mahendran and A. Vedaldi. Understanding deep image representations by inverting them. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 5188–5196, 2015.
|
| 224 |
+
F. A. Mejia, P. Gamble, Z. Hampel-Arias, M. Lomnitz, N. Lopatina, L. Tindall, and M. A. Barrios. Robust or private? adversarial training makes models more vulnerable to privacy attacks. arXiv preprint arXiv:1906.06449, 2019.
|
| 225 |
+
L. Melis, C. Song, E. De Cristofaro, and V. Shmatikov. Exploiting unintended feature leakage in collaborative learning. In 2019 IEEE Symposium on Security and Privacy $( S P )$ , pages 691–706. IEEE, 2019.
|
| 226 |
+
S. Milli, L. Schmidt, A. D. Dragan, and M. Hardt. Model reconstruction from model explanations. In Proceedings of the Conference on Fairness, Accountability, and Transparency, pages 1–9, 2019.
|
| 227 |
+
A. Mordvintsev, C. Olah, and M. Tyka. Inceptionism: Going deeper into neural networks. 2015.
|
| 228 |
+
E. Moroshko, B. E. Woodworth, S. Gunasekar, J. D. Lee, N. Srebro, and D. Soudry. Implicit bias in deep linear classification: Initialization scale vs training accuracy. Advances in neural information processing systems, 33:22182–22193, 2020.
|
| 229 |
+
M. S. Nacson, S. Gunasekar, J. Lee, N. Srebro, and D. Soudry. Lexicographic and depth-sensitive margins in homogeneous and non-homogeneous deep models. In International Conference on Machine Learning, pages 4683–4692. PMLR, 2019.
|
| 230 |
+
B. Neyshabur, S. Bhojanapalli, D. McAllester, and N. Srebro. Exploring generalization in deep learning. In Advances in Neural Information Processing Systems, pages 5947–5956, 2017.
|
| 231 |
+
A. Nguyen, A. Dosovitskiy, J. Yosinski, T. Brox, and J. Clune. Synthesizing the preferred inputs for neurons in neural networks via deep generator networks. Advances in neural information processing systems, 29, 2016a.
|
| 232 |
+
A. Nguyen, J. Yosinski, and J. Clune. Multifaceted feature visualization: Uncovering the different types of features learned by each neuron in deep neural networks. arXiv preprint arXiv:1602.03616, 2016b.
|
| 233 |
+
A. Nguyen, J. Clune, Y. Bengio, A. Dosovitskiy, and J. Yosinski. Plug & play generative networks: Conditional iterative generation of images in latent space. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4467–4477, 2017.
|
| 234 |
+
S. J. Oh, B. Schiele, and M. Fritz. Towards reverse-engineering black-box neural networks. In Explainable AI: Interpreting, Explaining and Visualizing Deep Learning, pages 121–144. Springer, 2019.
|
| 235 |
+
C. Olah, A. Mordvintsev, and L. Schubert. Feature visualization. Distill, 2(11):e7, 2017.
|
| 236 |
+
C. Olah, N. Cammarata, L. Schubert, G. Goh, M. Petrov, and S. Carter. Zoom in: An introduction to circuits. Distill, 2020. doi: 10.23915/distill.00024.001. https://distill.pub/2020/circuits/zoom-in.
|
| 237 |
+
A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32, 2019.
|
| 238 |
+
N. Razin and N. Cohen. Implicit regularization in deep learning may not be explainable by norms. Advances in Neural Information Processing Systems, 2020.
|
| 239 |
+
D. Rolnick and K. Kording. Reverse-engineering deep relu networks. In International Conference on Machine Learning, pages 8178–8187. PMLR, 2020.
|
| 240 |
+
A. Salem, Y. Zhang, M. Humbert, P. Berrang, M. Fritz, and M. Backes. Ml-leaks: Model and data independent membership inference attacks and defenses on machine learning models. arXiv preprint arXiv:1806.01246, 2018.
|
| 241 |
+
S. Santurkar, A. Ilyas, D. Tsipras, L. Engstrom, B. Tran, and A. Madry. Image synthesis with a single (robust) classifier. Advances in Neural Information Processing Systems, 32, 2019.
|
| 242 |
+
R. Shokri, M. Stronati, C. Song, and V. Shmatikov. Membership inference attacks against machine learning models. In 2017 IEEE symposium on security and privacy (SP), pages 3–18. IEEE, 2017.
|
| 243 |
+
L. Song and P. Mittal. Systematic evaluation of privacy risks of machine learning models. In 30th USENIX Security Symposium (USENIX Security 21), pages 2615–2632, 2021.
|
| 244 |
+
D. Soudry, E. Hoffer, M. S. Nacson, S. Gunasekar, and N. Srebro. The implicit bias of gradient descent on separable data. The Journal of Machine Learning Research, 19(1):2822–2878, 2018.
|
| 245 |
+
C. Szegedy, W. Zaremba, I. Sutskever, J. Bruna, D. Erhan, I. Goodfellow, and R. Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
|
| 246 |
+
N. Timor, G. Vardi, and O. Shamir. Implicit regularization towards rank minimization in relu networks. arXiv preprint arXiv:2201.12760, 2022.
|
| 247 |
+
F. Tramèr, F. Zhang, A. Juels, M. K. Reiter, and T. Ristenpart. Stealing machine learning models via prediction {APIs}. In 25th USENIX security symposium (USENIX Security 16), pages 601–618, 2016.
|
| 248 |
+
D. Tsipras, S. Santurkar, L. Engstrom, A. Turner, and A. Madry. Robustness may be at odds with accuracy. arXiv preprint arXiv:1805.12152, 2018.
|
| 249 |
+
G. Vardi. On the implicit bias in deep-learning algorithms. arXiv preprint arXiv:2208.12591, 2022.
|
| 250 |
+
G. Vardi and O. Shamir. Implicit regularization in relu networks with the square loss. In Conference on Learning Theory, pages 4224–4258. PMLR, 2021.
|
| 251 |
+
G. Vardi, O. Shamir, and N. Srebro. On margin maximization in linear and relu networks. arXiv preprint arXiv:2110.02732, 2021.
|
| 252 |
+
B. Wang and N. Z. Gong. Stealing hyperparameters in machine learning. In 2018 IEEE Symposium on Security and Privacy (SP), pages 36–52. IEEE, 2018.
|
| 253 |
+
Z. Wang, A. C. Bovik, H. R. Sheikh, and E. P. Simoncelli. Image quality assessment: from error visibility to structural similarity. IEEE transactions on image processing, 13(4):600–612, 2004.
|
| 254 |
+
B. Woodworth, S. Gunasekar, J. D. Lee, E. Moroshko, P. Savarese, I. Golan, D. Soudry, and N. Srebro. Kernel and rich regimes in overparametrized models. In Conference on Learning Theory, pages 3635–3673. PMLR, 2020.
|
| 255 |
+
Z. Yang, J. Zhang, E.-C. Chang, and Z. Liang. Neural network inversion in adversarial setting via background knowledge alignment. In Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security, pages 225–240, 2019.
|
| 256 |
+
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.
|
| 257 |
+
H. Yin, P. Molchanov, J. M. Alvarez, Z. Li, A. Mallya, D. Hoiem, N. K. Jha, and J. Kautz. Dreaming to distill: Data-free knowledge transfer via deepinversion. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8715–8724, 2020.
|
| 258 |
+
H. Yin, A. Mallya, A. Vahdat, J. M. Alvarez, J. Kautz, and P. Molchanov. See through gradients: Image batch recovery via gradinversion. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 16337–16346, 2021.
|
| 259 |
+
J. Yosinski, J. Clune, A. Nguyen, T. Fuchs, and H. Lipson. Understanding neural networks through deep visualization. arXiv preprint arXiv:1506.06579, 2015.
|
| 260 |
+
C. Yun, S. Krishnan, and H. Mobahi. A unifying view on implicit bias in training linear neural networks. In International Conference on Learning Representations, 2020.
|
| 261 |
+
C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals. Understanding deep learning (still) requires rethinking generalization. Communications of the ACM, 64(3):107–115, 2021.
|
| 262 |
+
Y. Zhang, R. Jia, H. Pei, W. Wang, B. Li, and D. Song. The secret revealer: Generative modelinversion attacks against deep neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 253–261, 2020.
|
| 263 |
+
L. Zhu, Z. Liu, and S. Han. Deep leakage from gradients. Advances in Neural Information Processing Systems, 32, 2019.
|
| 264 |
+
|
| 265 |
+
# Checklist
|
| 266 |
+
|
| 267 |
+
1. For all authors...
|
| 268 |
+
|
| 269 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 270 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 271 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes]
|
| 272 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 273 |
+
|
| 274 |
+
2. If you are including theoretical results...
|
| 275 |
+
|
| 276 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [N/A] We rely on known theoretical results, so proofs are not required.
|
| 277 |
+
|
| 278 |
+
3. If you ran experiments...
|
| 279 |
+
|
| 280 |
+
(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]
|
| 281 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 282 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A]
|
| 283 |
+
(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]
|
| 284 |
+
|
| 285 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 286 |
+
|
| 287 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 288 |
+
(b) Did you mention the license of the assets? [Yes]
|
| 289 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] We do not have new assets.
|
| 290 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] We used only publicly available assets.
|
| 291 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] We used only publicly available data.
|
| 292 |
+
|
| 293 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 294 |
+
|
| 295 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 296 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 297 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/TIdIXIpzhoI/TIdIXIpzhoI.md
ADDED
|
@@ -0,0 +1,465 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PROGRESSIVE DISTILLATION FOR FAST SAMPLING OF DIFFUSION MODELS
|
| 2 |
+
|
| 3 |
+
Tim Salimans & Jonathan Ho Google Research, Brain team {salimans,jonathanho}@google.com
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Diffusion models have recently shown great promise for generative modeling, outperforming GANs on perceptual quality and autoregressive models at density estimation. A remaining downside is their slow sampling time: generating high quality samples takes many hundreds or thousands of model evaluations. Here we make two contributions to help eliminate this downside: First, we present new parameterizations of diffusion models that provide increased stability when using few sampling steps. Second, we present a method to distill a trained deterministic diffusion sampler, using many steps, into a new diffusion model that takes half as many sampling steps. We then keep progressively applying this distillation procedure to our model, halving the number of required sampling steps each time. On standard image generation benchmarks like CIFAR-10, ImageNet, and LSUN, we start out with state-of-the-art samplers taking as many as 8192 steps, and are able to distill down to models taking as few as 4 steps without losing much perceptual quality; achieving, for example, a FID of 3.0 on CIFAR-10 in 4 steps. Finally, we show that the full progressive distillation procedure does not take more time than it takes to train the original model, thus representing an efficient solution for generative modeling using diffusion at both train and test time.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Diffusion models (Sohl-Dickstein et al., 2015; Song & Ermon, 2019; Ho et al., 2020) are an emerging class of generative models that has recently delivered impressive results on many standard generative modeling benchmarks. These models have achieved ImageNet generation results outperforming BigGAN-deep and VQ-VAE-2 in terms of FID score and classification accuracy score (Ho et al., 2021; Dhariwal & Nichol, 2021), and they have achieved likelihoods outperforming autoregressive image models (Kingma et al., 2021; Song et al., 2021b). They have also succeeded in image super-resolution (Saharia et al., 2021; Li et al., 2021) and image inpainting (Song et al., 2021c), and there have been promising results in shape generation (Cai et al., 2020), graph generation (Niu et al., 2020), and text generation (Hoogeboom et al., 2021; Austin et al., 2021).
|
| 12 |
+
|
| 13 |
+
A major barrier remains to practical adoption of diffusion models: sampling speed. While sampling can be accomplished in relatively few steps in strongly conditioned settings, such as text-tospeech (Chen et al., 2021) and image super-resolution (Saharia et al., 2021), or when guiding the sampler using an auxiliary classifier (Dhariwal & Nichol, 2021), the situation is substantially different in settings in which there is less conditioning information available. Examples of such settings are unconditional and standard class-conditional image generation, which currently require hundreds or thousands of steps using network evaluations that are not amenable to the caching optimizations of other types of generative models (Ramachandran et al., 2017).
|
| 14 |
+
|
| 15 |
+
In this paper, we reduce the sampling time of diffusion models by orders of magnitude in unconditional and class-conditional image generation, which represent the setting in which diffusion models have been slowest in previous work. We present a procedure to distill the behavior of a $N$ -step DDIM sampler (Song et al., 2021a) for a pretrained diffusion model into a new model with $N / 2$ steps, with little degradation in sample quality. In what we call progressive distillation, we repeat this distillation procedure to produce models that generate in as few as 4 steps, still maintaining sample quality competitive with state-of-the-art models using thousands of steps.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: A visualization of two iterations of our proposed progressive distillation algorithm. A sampler $f ( \mathbf { z } ; \boldsymbol { \eta } )$ , mapping random noise $\epsilon$ to samples $\mathbf { x }$ in 4 deterministic steps, is distilled into a new sampler $f ( \mathbf { z } ; \theta )$ taking only a single step. The original sampler is derived by approximately integrating the probability flow $O D E$ for a learned diffusion model, and distillation can thus be understood as learning to integrate in fewer steps, or amortizing this integration into the new sampler.
|
| 19 |
+
|
| 20 |
+
# 2 BACKGROUND ON DIFFUSION MODELS
|
| 21 |
+
|
| 22 |
+
We consider diffusion models (Sohl-Dickstein et al., 2015; Song & Ermon, 2019; Ho et al., 2020) specified in continuous time (Tzen & Raginsky, 2019a; Song et al., 2021c; Chen et al., 2021; Kingma et al., 2021). We use $\mathbf { x } \sim p ( \mathbf { x } )$ to denote training data. A diffusion model has latent variables $\mathbf { z } = \{ \mathbf { z } _ { t } | t \in [ 0 , 1 ] \}$ and is specified by a noise schedule comprising differentiable functions $\alpha _ { t } , \sigma _ { t }$ such that $\lambda _ { t } = \log \bar { [ \alpha _ { t } ^ { 2 } / \sigma _ { t } ^ { 2 } ] }$ , the log signal-to-noise-ratio, decreases monotonically with $t$ .
|
| 23 |
+
|
| 24 |
+
These ingredients define the forward process $q ( \mathbf { z } | \mathbf { x } )$ , a Gaussian process satisfying the following Markovian structure:
|
| 25 |
+
|
| 26 |
+
$$
|
| 27 |
+
\begin{array} { r } { q ( \mathbf { z } _ { t } | \mathbf { x } ) = \mathcal { N } ( \mathbf { z } _ { t } ; \alpha _ { t } \mathbf { x } , \sigma _ { t } ^ { 2 } \mathbf { I } ) , \quad q ( \mathbf { z } _ { t } | \mathbf { z } _ { s } ) = \mathcal { N } ( \mathbf { z } _ { t } ; ( \alpha _ { t } / \alpha _ { s } ) \mathbf { z } _ { s } , \sigma _ { t | s } ^ { 2 } \mathbf { I } ) } \end{array}
|
| 28 |
+
$$
|
| 29 |
+
|
| 30 |
+
where $0 \leq s < t \leq 1$ and $\sigma _ { t | s } ^ { 2 } = ( 1 - e ^ { \lambda _ { t } - \lambda _ { s } } ) \sigma _ { t } ^ { 2 }$
|
| 31 |
+
|
| 32 |
+
The role of function approximation in the diffusion model is to denoise ${ \mathbf z } _ { t } \sim q ( { \mathbf z } _ { t } | { \mathbf x } )$ into an estimate $\hat { \mathbf { x } } _ { \theta } ( { \mathbf z } _ { t } ) \approx { \mathbf x }$ (the function approximator also receives $\lambda _ { t }$ as an input, but we omit this to keep our notation clean). We train this denoising model $\hat { \mathbf { x } } _ { \theta }$ using a weighted mean squared error loss
|
| 33 |
+
|
| 34 |
+
$$
|
| 35 |
+
\mathbb { E } _ { \epsilon , t } \big [ w ( \lambda _ { t } ) \| \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) - \mathbf { x } \| _ { 2 } ^ { 2 } \big ]
|
| 36 |
+
$$
|
| 37 |
+
|
| 38 |
+
over uniformly sampled times $t \in [ 0 , 1 ]$ . This loss can be justified as a weighted variational lower bound on the data log likelihood under the diffusion model (Kingma et al., 2021) or as a form of denoising score matching (Vincent, 2011; Song & Ermon, 2019). We will discuss particular choices of weighting function $w ( \lambda _ { t } )$ later on.
|
| 39 |
+
|
| 40 |
+
Sampling from a trained model can be performed in several ways. The most straightforward way is discrete time ancestral sampling (Ho et al., 2020). To define this sampler, first note that the forward process can be described in reverse as $q ( \mathbf { z } _ { s } | \mathbf { z } _ { t } , \mathbf { x } ) = \mathcal { N } ( \mathbf { z } _ { s } ; \tilde { \mu } _ { s | t } ( \mathbf { z } _ { t } , \grave { \mathbf { x } } ) , \tilde { \sigma } _ { s | t } ^ { 2 } \mathbf { I } )$ (noting $s < t$ ), where
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
\tilde { \mu } _ { s | t } ( \mathbf { z } _ { t } , \mathbf { x } ) = e ^ { \lambda _ { t } - \lambda _ { s } } ( \alpha _ { s } / \alpha _ { t } ) \mathbf { z } _ { t } + ( 1 - e ^ { \lambda _ { t } - \lambda _ { s } } ) \alpha _ { s } \mathbf { x } , \quad \tilde { \sigma } _ { s | t } ^ { 2 } = ( 1 - e ^ { \lambda _ { t } - \lambda _ { s } } ) \sigma _ { s } ^ { 2 }
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
We use this reversed description of the forward process to define the ancestral sampler. Starting at $\mathbf { z } _ { 1 } \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ , the ancestral sampler follows the rule
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
\begin{array} { r l } & { \mathbf z _ { s } = \tilde { \mu } _ { s \mid t } ( \mathbf z _ { t } , \hat { \mathbf x } _ { \theta } ( \mathbf z _ { t } ) ) + \sqrt { ( \tilde { \sigma } _ { s \mid t } ^ { 2 } ) ^ { 1 - \gamma } ( \sigma _ { t \mid s } ^ { 2 } ) ^ { \gamma } ) } \epsilon } \\ & { \quad = e ^ { \lambda _ { t } - \lambda _ { s } } ( \alpha _ { s } / \alpha _ { t } ) \mathbf z _ { t } + ( 1 - e ^ { \lambda _ { t } - \lambda _ { s } } ) \alpha _ { s } \hat { \mathbf x } _ { \theta } ( \mathbf z _ { t } ) + \sqrt { ( \tilde { \sigma } _ { s \mid t } ^ { 2 } ) ^ { 1 - \gamma } ( \sigma _ { t \mid s } ^ { 2 } ) ^ { \gamma } ) } \epsilon , } \end{array}
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
where $\epsilon$ is standard Gaussian noise, and $\gamma$ is a hyperparameter that controls how much noise is added during sampling, following Nichol $\&$ Dhariwal (2021).
|
| 53 |
+
|
| 54 |
+
Alternatively, Song et al. (2021c) show that our denoising model $\hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } )$ can be used to deterministically map noise ${ \bf z } _ { 1 } \sim \mathcal { N } ( { \bf 0 } , { \bf I } )$ to samples $\mathbf { x }$ by numerically solving the probability flow $O D E$ :
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
d \mathbf { z } _ { t } = [ f ( \mathbf { z } _ { t } , t ) - \frac { 1 } { 2 } g ^ { 2 } ( t ) \nabla _ { z } \log \hat { p } _ { \boldsymbol { \theta } } ( \mathbf { z } _ { t } ) ] d t ,
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where $\begin{array} { r } { \nabla _ { z } \log \hat { p } _ { \boldsymbol { \theta } } ( \mathbf { z } _ { t } ) = \frac { \alpha _ { t } \hat { \mathbf { x } } _ { \boldsymbol { \theta } } ( \mathbf { z } _ { t } ) - \mathbf { z } _ { t } } { \sigma _ { t } ^ { 2 } } } \end{array}$ . Following Kingma et al. (2021), we have $\begin{array} { r } { f ( \mathbf { z } _ { t } , t ) = \frac { d \log \alpha _ { t } } { d t } \mathbf { z } _ { t } } \end{array}$ and g2(t) = dσ2tdt $\begin{array} { r } { g ^ { 2 } ( t ) = \frac { d \sigma _ { t } ^ { 2 } } { d t } - 2 \frac { d \log { \alpha _ { t } } } { d t } \sigma _ { t } ^ { 2 } } \end{array}$ . Since $\hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } )$ is parameterized by a neural network, this equation is a special case of a neural $O D E$ (Chen et al., 2018), also called a continuous normalizing flow (Grathwohl et al., 2018).
|
| 61 |
+
|
| 62 |
+
Solving the ODE in Equation 6 numerically can be done with standard methods like the Euler rule or the Runge-Kutta method. The DDIM sampler proposed by Song et al. (2021a) can also be understood as an integration rule for this ODE, as we show in Appendix B, even though it was originally proposed with a different motivation. The update rule specified by DDIM is
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\begin{array} { r l r } { { \mathbf { z } _ { s } = \alpha _ { s } \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) + \sigma _ { s } \frac { \mathbf { z } _ { t } - \alpha _ { t } \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) } { \sigma _ { t } } } } \\ & { } & { = e ^ { ( \lambda _ { t } - \lambda _ { s } ) / 2 } ( \alpha _ { s } / \alpha _ { t } ) \mathbf { z } _ { t } + ( 1 - e ^ { ( \lambda _ { t } - \lambda _ { s } ) / 2 } ) \alpha _ { s } \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) , } \end{array}
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
and in practice this rule performs better than the aforementioned standard ODE integration rules in our case, as we show in Appendix C.
|
| 69 |
+
|
| 70 |
+
If $\hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } )$ satisfies mild smoothness conditions, the error introduced by numerical integration of the probability flow ODE is guaranteed to vanish as the number of integration steps grows infinitely large, i.e. $N \infty$ . This leads to a trade-off in practice between the accuracy of the numerical integration, and hence the quality of the produced samples from our model, and the time needed to produce these samples. So far, most models in the literature have needed hundreds or thousands of integration steps to produce their highest quality samples, which is prohibitive for many practical applications of generative modeling. Here, we therefore propose a method to distill these accurate, but slow, ODE integrators into much faster models that are still very accurate. This idea is visualized in Figure 1, and described in detail in the next section.
|
| 71 |
+
|
| 72 |
+
# 3 PROGRESSIVE DISTILLATION
|
| 73 |
+
|
| 74 |
+
To make diffusion models more efficient at sampling time, we propose progressive distillation: an algorithm that iteratively halves the number of required sampling steps by distilling a slow teacher diffusion model into a faster student model. Our implementation of progressive distillation stays very close to the implementation for training the original diffusion model, as described by e.g. Ho et al. (2020). Algorithm 1 and Algorithm 2 present diffusion model training and progressive distillation side-by-side, with the relative changes in progressive distillation highlighted in green.
|
| 75 |
+
|
| 76 |
+
We start the progressive distillation procedure with a teacher diffusion model that is obtained by training in the standard way. At every iteration of progressive distillation, we then initialize the student model with a copy of the teacher, using both the same parameters and same model definition. Like in standard training, we then sample data from the training set and add noise to it, before forming the training loss by applying the student denoising model to this noisy data $\mathbf { z } _ { t }$ . The main difference in progressive distillation is in how we set the target for the denoising model: instead of the original data $\mathbf { x }$ , we have the student model denoise towards a target $\tilde { \mathbf { x } }$ that makes a single student DDIM step match 2 teacher DDIM steps. We calculate this target value by running 2 DDIM sampling steps using the teacher, starting from $\mathbf { z } _ { t }$ and ending at $\mathbf { z } _ { t - 1 / N }$ , with $N$ being the number of student sampling steps. By inverting a single step of DDIM, we then calculate the value the student model would need to predict in order to move from $\mathbf { z } _ { t }$ to $\mathbf { z } _ { t - 1 / N }$ in a single step, as we show in detail in Appendix G. The resulting target value $\tilde { \mathbf { x } } ( \mathbf { z } _ { t } )$ is fully determined given the teacher model and starting point $\mathbf { z } _ { t }$ , which allows the student model to make a sharp prediction when evaluated at $\mathbf { z } _ { t }$ . In contrast, the original data point $\mathbf { x }$ is not fully determined given $\mathbf { z } _ { t }$ , since multiple different data points $\mathbf { x }$ can produce the same noisy data $\mathbf { z } _ { t }$ : this means that the original denoising model is predicting a weighted average of possible x values, which produces a blurry prediction. By making sharper predictions, the student model can make faster progress during sampling.
|
| 77 |
+
|
| 78 |
+
After running distillation to learn a student model taking $N$ sampling steps, we can repeat the procedure with $\bar { N } / 2$ steps: The student model then becomes the new teacher, and a new student model is initialized by making a copy of this model.
|
| 79 |
+
|
| 80 |
+
Unlike our procedure for training the original model, we always run progressive distillation in discrete time: we sample this discrete time such that the highest time index corresponds to a signal-tonoise ratio of zero, i.e. $\alpha _ { 1 } = 0$ , which exactly matches the distribution of input noise $\mathbf { z } _ { 1 } \sim \bar { \mathcal { N } } ( \mathbf { 0 } , \mathbf { I } )$ that is used at test time. We found this to work slightly better than starting from a non-zero signalto-noise ratio as used by e.g. Ho et al. (2020), both for training the original model as well as when performing progressive distillation.
|
| 81 |
+
|
| 82 |
+
# Algorithm 1 Standard diffusion training
|
| 83 |
+
|
| 84 |
+
# Algorithm 2 Progressive distillation
|
| 85 |
+
|
| 86 |
+
Require: Model $\hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } )$ to be trained Require: Data set $\mathcal { D }$ Require: Loss weight function $w ( )$
|
| 87 |
+
|
| 88 |
+
$\mathbf { x } \sim \mathcal { D }$ $\triangleright$ Sample data $t \sim U [ 0 , 1 ]$ $\triangleright$ Sample time $\epsilon \sim \bar { N ( 0 , I ) }$ $\triangleright$ Sample noise ${ \bf z } _ { t } = \alpha _ { t } { \bf x } + \sigma _ { t } \epsilon$ . Add noise to data
|
| 89 |
+
|
| 90 |
+
Require: Trained teacher model $\hat { \mathbf { x } } _ { \eta } ( \mathbf { z } _ { t } )$
|
| 91 |
+
Require: Data set $\mathcal { D }$
|
| 92 |
+
Require: Loss weight function w()
|
| 93 |
+
Require: Student sampling steps $N$ for $K$ iterations do $\theta \eta$ $\triangleright$ Init student from teacher while not converged do $\begin{array} { l } { { \bf { x } } \sim { \mathcal { D } } } \\ { t = i / N , ~ i \sim C a t [ 1 , 2 , \dots , N ] } \\ { \epsilon \sim N ( 0 , I ) } \\ { { \bf { z } } _ { t } = \alpha _ { t } { \bf { x } } + \sigma _ { t } \epsilon } \end{array}$ # 2 steps of DDIM with teacher $\begin{array} { r l } & { t ^ { \prime } = t - 0 . 5 / N , \quad t ^ { \prime \prime } = t - 1 / N } \\ & { \mathbf { \tilde { z } } _ { t ^ { \prime } } = \alpha _ { t ^ { \prime } } \hat { \mathbf { x } } _ { \eta } ( \mathbf { z } _ { t } ) + \frac { \sigma _ { t ^ { \prime } } } { \sigma _ { t } } ( \mathbf { z } _ { t } - \alpha _ { t } \hat { \mathbf { x } } _ { \eta } ( \mathbf { z } _ { t } ) ) } \\ & { \mathbf { \tilde { z } } _ { t ^ { \prime \prime } } = \alpha _ { t ^ { \prime \prime } } \hat { \mathbf { x } } _ { \eta } ( \mathbf { z } _ { t ^ { \prime } } ) + \frac { \sigma _ { t ^ { \prime \prime } } } { \sigma _ { t ^ { \prime \prime } } } ( \mathbf { z } _ { t ^ { \prime } } - \alpha _ { t ^ { \prime } } \hat { \mathbf { x } } _ { \eta } ( \mathbf { z } _ { t ^ { \prime } } ) ) } \\ & { \mathbf { \tilde { x } } = \frac { \mathbf { z } _ { t ^ { \prime \prime } } - ( \sigma _ { t ^ { \prime \prime } } / \sigma _ { t } ) \mathbf { z } _ { t } } { \alpha _ { t ^ { \prime \prime } } - ( \sigma _ { t ^ { \prime \prime } } / \sigma _ { t } ) \alpha _ { t } } \qquad \mathrm { ~ > ~ T e a c h e r ~ } \hat { \mathbf { x } } \mathrm { ~ t a r g e t } } \\ & { \lambda _ { t } = \mathrm { l o g } [ \alpha _ { t } ^ { 2 } / \sigma _ { t } ^ { 2 } ] } \\ & { L _ { \theta } = w ( \lambda _ { t } ) | | \hat { \mathbf { x } } - \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) | | _ { 2 } ^ { 2 } } \\ & { \theta \gets \theta - \gamma \mathrm { v } _ { \theta } L _ { \theta } } \end{array}$ end while $\eta \theta$ . Student becomes next teacher $N \gets N / 2 \mathsf { \Omega } \triangleright \mathrm { H }$ alve number of sampling steps end for
|
| 94 |
+
|
| 95 |
+
$\tilde { \mathbf { x } } = \mathbf { x } \triangleright$ Clean data is target for xˆ $\lambda _ { t } = \log [ \alpha _ { t } ^ { 2 } / \sigma _ { t } ^ { 2 } ]$ $\triangleright$ log-SNR $L _ { \theta } = w ( \lambda _ { t } ) \| \tilde { \mathbf { x } } - \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) \| _ { 2 } ^ { 2 }$ . Loss $\theta \theta - \gamma \nabla _ { \theta } L _ { \theta }$ $\triangleright$ Optimization end while
|
| 96 |
+
|
| 97 |
+
# 4 DIFFUSION MODEL PARAMETERIZATION AND TRAINING LOSS
|
| 98 |
+
|
| 99 |
+
In this section, we discuss how to parameterize the denoising model $\hat { \mathbf { x } } _ { \theta }$ , and how to specify the reconstruction loss weight $w ( \lambda _ { t } )$ . We assume a standard variance-preserving diffusion process for which $\sigma _ { t } ^ { 2 } = 1 - \alpha _ { t } ^ { 2 }$ . This is without loss of generalization, as shown by (Kingma et al., 2021, appendix G): different specifications of the diffusion process, such as the variance-exploding specification, can be considered equivalent to this specification, up to rescaling of the noisy latents $\mathbf { z } _ { t }$ . We use a cosine schedule $\alpha _ { t } = \cos ( 0 . 5 \pi t )$ , similar to that introduced by Nichol $\&$ Dhariwal (2021).
|
| 100 |
+
|
| 101 |
+
Ho et al. (2020) and much of the following work choose to parameterize the denoising model through directly predicting $\epsilon$ with a neural network $\hat { \epsilon } _ { \boldsymbol { \theta } } ( \mathbf { z } _ { t } )$ , which implicitly sets $\begin{array} { r } { \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) = \frac { 1 } { \alpha _ { t } } \bar { ( } \mathbf { z } _ { t } - \sigma _ { t } \hat { \epsilon } _ { \theta } ( \mathbf { z } _ { t } ) \bar { ) } } \end{array}$ . In this case, the training loss is also usually defined as mean squared error in the $\epsilon$ -space:
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
L _ { \theta } = \| \epsilon - \hat { \epsilon } _ { \theta } ( \mathbf { z } _ { t } ) \| _ { 2 } ^ { 2 } = \left\| \frac { 1 } { \sigma _ { t } } ( \mathbf { z } _ { t } - \alpha _ { t } \mathbf { x } ) - \frac { 1 } { \sigma _ { t } } ( \mathbf { z } _ { t } - \alpha _ { t } \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) ) \right\| _ { 2 } ^ { 2 } = \frac { \alpha _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } \| \mathbf { x } - \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) \| _ { 2 } ^ { 2 } ,
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
which can thus equivalently be seen as a weighted reconstruction loss in $\mathbf { x }$ -space, where the weighting function is given by $w ( \lambda _ { t } ) = \exp ( \lambda _ { t } )$ , for log signal-to-noise ratio $\lambda _ { t } = \log [ \alpha _ { t } ^ { 2 } / \sigma _ { t } ^ { 2 } ]$ .
|
| 108 |
+
|
| 109 |
+
Although this standard specification works well for training the original model, it is not well suited for distillation: when training the original diffusion model, and at the start of progressive distillation, the model is evaluated at a wide range of signal-to-noise ratios $\alpha _ { t } ^ { 2 } / \sigma _ { t } ^ { 2 }$ , but as distillation progresses we increasingly evaluate at lower and lower signal-to-noise ratios. As the signal-to-noise ratio goes to zero, the effect of small changes in the neural network output $\hat { \epsilon } _ { \theta } ( { \bf z } _ { t } )$ on the implied prediction in $\mathbf { x }$ -space is increasingly amplified, since $\begin{array} { r } { \hat { \mathbf { x } } _ { \theta } \big ( \mathbf { z } _ { t } \big ) = \frac { 1 } { \alpha _ { t } } \big ( \mathbf { z } _ { t } - \sigma _ { t } \dot { \hat { \epsilon } } _ { \theta } \big ( \mathbf { z } _ { t } \big ) \big ) } \end{array}$ divides by $\alpha _ { t } 0$ . This is not much of a problem when taking many steps, since the effect of early missteps is limited by clipping of the $\mathbf { z } _ { t }$ iterates, and later updates can correct any mistakes, but it becomes increasingly important as we decrease the number of sampling steps. Eventually, if we distill all the way down to a single sampling step, the input to the model is only pure noise $\epsilon$ , which corresponds to a signal-to-noise ratio of zero, i.e. $\alpha _ { t } = 0 , \sigma _ { t } = 1$ . At this extreme, the link between $\epsilon$ -prediction and $\mathbf { x }$ -prediction breaks down completely: observed data $\mathbf { z } _ { t } = \epsilon$ is no longer informative of $\mathbf { x }$ and predictions $\hat { \epsilon } _ { \boldsymbol { \theta } } ( \mathbf { z } _ { t } )$ no longer implicitly predict $\mathbf { x }$ . Examining our reconstruction loss (equation 9), we see that the weighting function $w ( \lambda _ { t } )$ gives zero weight to the reconstruction loss at this signal-to-noise ratio.
|
| 110 |
+
|
| 111 |
+
For distillation to work, we thus need to parameterize the diffusion model in a way for which the implied prediction $\hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } )$ remains stable as $\lambda _ { t } = \log [ \alpha _ { t } ^ { 2 } / \sigma _ { t } ^ { 2 } ]$ varies. We tried the following options, and found all to work well with progressive distillation:
|
| 112 |
+
|
| 113 |
+
• Predicting $\mathbf { x }$ directly. • Predicting both $\mathbf { x }$ and $\epsilon$ , via separate output channels $\{ \tilde { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) , \tilde { \epsilon } _ { \theta } ( \mathbf { z } _ { t } ) \}$ of the neural network, and then merging the predictions via $\hat { \mathbf { x } } = \sigma _ { t } ^ { 2 } \tilde { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) + \alpha _ { t } ( \mathbf { z } _ { t } - \sigma _ { t } \tilde { \epsilon } _ { \theta } ( \mathbf { z } _ { t } ) )$ , thus smoothly interpolating between predicting $\mathbf { x }$ directly and predicting via $\epsilon$ . • Predicting $\mathbf { v } \equiv \alpha _ { t } \epsilon - \sigma _ { t } \mathbf { x }$ , which gives $\hat { \mathbf { x } } = \alpha _ { t } \mathbf { z } _ { t } - \sigma _ { t } \hat { \mathbf { v } } _ { \theta } \big ( \mathbf { z } _ { t } \big )$ , as we show in Appendix D.
|
| 114 |
+
|
| 115 |
+
In Section 5.1 we test all three parameterizations on training an original diffusion model (no distillation), and find them to work well there also.
|
| 116 |
+
|
| 117 |
+
In addition to determining an appropriate parameterization, we also need to decide on a reconstruction loss weighting $w ( \lambda _ { t } )$ . The setup of Ho et al. (2020) weights the reconstruction loss by the signal-to-noise ratio, implicitly gives a weight of zero to data with zero SNR, and is therefore not a suitable choice for distillation. We consider two alternative training loss weightings:
|
| 118 |
+
|
| 119 |
+
$$
|
| 120 |
+
\begin{array} { r l } & { \bullet L _ { \theta } = \operatorname* { m a x } ( \| \mathbf { x } - \hat { \mathbf { x } } _ { t } \| _ { 2 } ^ { 2 } , \| \epsilon - \hat { \epsilon } _ { t } \| _ { 2 } ^ { 2 } ) = \operatorname* { m a x } ( \frac { \alpha _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } , 1 ) \| \mathbf { x } - \hat { \mathbf { x } } _ { t } \| _ { 2 } ^ { 2 } ; \mathfrak { t } } \\ & { \bullet L _ { \theta } = \| \mathbf { v } _ { t } - \hat { \mathbf { v } } _ { t } \| _ { 2 } ^ { 2 } = ( 1 + \frac { \alpha _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } ) \| \mathbf { x } - \hat { \mathbf { x } } _ { t } \| _ { 2 } ^ { 2 } ; \mathbf { \nabla } \mathrm { { S N R } } + 1 ^ { \prime } \mathrm { ~ w e i g h t i n g } } \end{array}
|
| 121 |
+
$$
|
| 122 |
+
|
| 123 |
+
We examine both choices in our ablation study in Section 5.1, and find both to be good choices for training diffusion models. In practice, the choice of loss weighting also has to take into account how $\alpha _ { t } , \sigma _ { t }$ are sampled during training, as this sampling distribution strongly determines the weight the expected loss gives to each signal-to-noise ratio. Our results are for a cosine schedule $\alpha _ { t } =$ $\cos ( 0 . 5 \pi t )$ , where time is sampled uniformly from [0, 1]. In Figure 2 we visualize the resulting loss weightings, both including and excluding the effect of the cosine schedule.
|
| 124 |
+
|
| 125 |
+
# 5 EXPERIMENTS
|
| 126 |
+
|
| 127 |
+
In this section we empirically validate the progressive distillation algorithm proposed in Section 3, as well as the parameterizations and loss weightings considered in Section 4. We consider various image generation benchmarks, with resolution varying from $3 2 \times 3 2$ to $1 2 8 \times 1 2 8$ . All experiments use the cosine schedule $\alpha _ { t } = \cos ( 0 . 5 \pi t )$ , and all models use a U-Net architecture similar to that introduced by Ho et al. (2020), but with BigGAN-style up- and downsampling (Brock et al., 2019), as used in the diffusion modeling setting by Nichol & Dhariwal (2021); Song et al. (2021c). Our training setup closely matches the open source code by Ho et al. (2020). Exact details are given in Appendix E.
|
| 128 |
+
|
| 129 |
+
# 5.1 MODEL PARAMETERIZATION AND TRAINING LOSS
|
| 130 |
+
|
| 131 |
+
As explained in Section 4, the standard method of having our model predict , and minimizing mean squared error in the $\epsilon$ -space (Ho et al., 2020), is not appropriate for use with progressive distillation.
|
| 132 |
+
|
| 133 |
+

|
| 134 |
+
Figure 2: Left: Log weight assigned to reconstruction loss $\| \mathbf { x } - \hat { \mathbf { x } } _ { \lambda } \| _ { 2 } ^ { 2 }$ as a function of the log-SNR $\lambda \stackrel { } { = } \log [ \alpha ^ { 2 } / \sigma ^ { 2 } ]$ , for each of our considered training loss weightings, excluding the influence of the $\alpha _ { t } , \sigma _ { t }$ schedule. Right: Weights assigned to the reconstruction loss including the effect of the cosine schedule $\alpha _ { t } = \cos ( 0 . 5 \pi t )$ , with $t \stackrel { - } { \sim } U [ 0 , 1 ]$ . The weights are only defined up to a constant, and we have adjusted these constants to fit this graph.
|
| 135 |
+
|
| 136 |
+
<table><tr><td>Network Output</td><td>Loss Weighting</td><td>Stochastic sampler</td><td>DDIM sampler</td></tr><tr><td rowspan="3">(x,ε) combined</td><td>SNR</td><td>2.54/9.88</td><td>2.78/9.56</td></tr><tr><td>Truncated SNR</td><td>2.47/9.85</td><td>2.76/9.49</td></tr><tr><td>SNR+1</td><td>2.52/9.79</td><td>2.87/9.45</td></tr><tr><td rowspan="3">X</td><td>SNR</td><td>2.65/9.80</td><td>2.75/9.56</td></tr><tr><td>Truncated SNR</td><td>2.53/9.92</td><td>2.51/9.58</td></tr><tr><td>SNR+1</td><td>2.56/9.84</td><td>2.65/9.52</td></tr><tr><td rowspan="3">E</td><td>SNR</td><td>2.59/9.84</td><td>2.91/9.52</td></tr><tr><td>Truncated SNR</td><td>N/A</td><td>N/A</td></tr><tr><td>SNR+1</td><td>2.56/9.77</td><td>3.27/9.41</td></tr><tr><td rowspan="3">V</td><td>SNR</td><td>2.65/9.86</td><td>3.05/9.56</td></tr><tr><td>Truncated SNR</td><td>2.45/9.80</td><td>2.75/9.52</td></tr><tr><td>SNR+1</td><td>2.49/9.77</td><td>2.87/9.43</td></tr></table>
|
| 137 |
+
|
| 138 |
+
Table 1: Generated sample quality as measured by FID and Inception Score (FID/IS) on unconditional CIFAR-10, training the original model (no distillation), and comparing different parameterizations and loss weightings discussed in Section 4. All reported results are averages over 3 random seeds of the best metrics obtained over 2 million training steps; nevertheless we find results are still $\pm 0 . 1$ due to the noise inherent in training our models. Taking the neural network output to represent a prediction of $\epsilon$ in combination with the Truncated SNR loss weighting leads to divergence.
|
| 139 |
+
|
| 140 |
+
We therefore proposed various alternative parameterizations of the denoising diffusion model that are stable under the progressive distillation procedure, as well as various weighting functions for the reconstruction error in $\mathbf { x }$ -space. Here, we perform a complete ablation experiment of all parameterizations and loss weightings considered in Section 4. For computational efficiency, and for comparisons to established methods in the literature, we use unconditional CIFAR-10 as the benchmark. We measure performance of undistilled models trained from scratch, to avoid introducing too many factors of variation into our analysis.
|
| 141 |
+
|
| 142 |
+
Table 1 lists the results of the ablation study. Overall results are fairly close across different parameterizations and loss weights. All proposed stable model specifications achieve excellent performance, with the exception of the combination of outputting $\epsilon$ with the neural network and weighting the loss with the truncated SNR, which we find to be unstable. Both predicting $\mathbf { x }$ directly, as well as predicting $\mathbf { v }$ , or the combination $( \epsilon , \bf { x } )$ , could thus be recommended for specification of diffusion models. Here, predicting v is the most stable option, as it has the unique property of making DDIM step-sizes independent of the SNR (see Appendix D), but predicting $\mathbf { x }$ gives slightly better empirical results in this ablation study.
|
| 143 |
+
|
| 144 |
+
# 5.2 PROGRESSIVE DISTILLATION
|
| 145 |
+
|
| 146 |
+
We evaluate our proposed progressive distillation algorithm on 4 data sets: CIFAR-10, $6 4 \times 6 4$ downsampled ImageNet, $1 2 8 \times 1 2 8$ LSUN bedrooms, and $1 2 8 \times 1 2 8$ LSUN Church-Outdoor. For each data set we start by training a baseline model, after which we start the progressive distillation procedure. For CIFAR-10 we start progressive distillation from a teacher model taking 8192 steps. For the bigger data sets we start at 1024 steps. At every iteration of distillation we train for 50 thousand parameter updates, except for the distillation to 2 and 1 sampling steps, for which we use 100 thousand updates. We report FID results obtained after each iteration of the algorithm. Using these settings, the computational cost of progressive distillation to 4 sampling steps is comparable or less than for training the original model. In Appendix I we show that this computational cost can be reduce much further still, at a small cost in performance.
|
| 147 |
+
|
| 148 |
+
In Figure 4 we plot the resulting FID scores (Heusel et al., 2017) obtained for each number of sampling steps. We compare against the undistilled DDIM sampler, as well as to a highly optimized stochastic baseline sampler. For all four data sets, progressive distillation produces near optimal results up to 4 or 8 sampling steps. At 2 or 1 sampling steps, the sample quality degrades relatively more quickly. In contrast, the quality of the DDIM and stochastic samplers degrades very sharply after reducing the number of sampling steps below 128. Overall, we conclude that progressive distillation is thus an attractive solution for computational budgets that allow less than or equal to 128 sampling steps. Although our distillation procedure is designed for use with the DDIM sampler, the resulting distilled models can in principle also be used with stochastic sampling: we investigate this in Appendix F, and find that it achieves performance that falls in between the distilled DDIM sampler and the undistilled stochastic sampler.
|
| 149 |
+
|
| 150 |
+
Table 2 shows some of our results on CIFAR-10, and compares against other fast sampling methods in the literature: Our method compares favorably and attains higher sampling quality in fewer steps than most of the alternative methods. Figure 3 shows some random samples from our model obtained at different phases of the distillation process. Additional samples are provided in Appendix H.
|
| 151 |
+
|
| 152 |
+

|
| 153 |
+
Figure 3: Random samples from our distilled $6 4 \times 6 4$ ImageNet models, conditioned on the ‘malamute’ class, for fixed random seed and for varying number of sampling steps. The mapping from input noise to output image is well preserved as the number of sampling steps is reduced.
|
| 154 |
+
|
| 155 |
+
# 6 RELATED WORK ON FAST SAMPLING
|
| 156 |
+
|
| 157 |
+
Our proposed method is closest to the work of Luhman & Luhman (2021), who perform distillation of DDIM teacher models into one-step student models. A possible downside of their method is that it requires constructing a large data set by running the original model at its full number of sampling steps: their cost of distillation thus scales linearly with this number of steps, which can be prohibitive. In contrast, our method never needs to run the original model at the full number of sampling steps: at every iteration of progressive distillation, the number of model evaluations is independent of the number of teacher sampling steps, allowing our method to scale up to large numbers of teacher steps at a logarithmic cost in total distillation time.
|
| 158 |
+
|
| 159 |
+

|
| 160 |
+
Figure 4: Sample quality results as measured by FID for our distilled model on unconditional CIFAR-10, class-conditional $6 4 \mathrm { x } 6 4$ ImageNet, $1 2 8 \mathrm { x } 1 2 8$ LSUN bedrooms, and $1 2 8 \mathrm { x } 1 2 8$ LSUN church-outdoor. We compare against the DDIM sampler and against an optimized stochastic sampler, each evaluated using the same models that were used to initialize the progressive distillation procedure. For CIFAR-10 we report an average over 4 random seeds. For the other data sets we only use a single run because of their computational demand. For the stochastic sampler we set the variance as a log-scale interpolation between an upper and lower bound on the variance, following Nichol & Dhariwal (2021), but we use a single interpolation coefficient rather than a learned coefficient. We then tune this interpolation coefficient separately for each number of sampling steps and report only the best result for that number of steps: this way we obtained better results than with the learned interpolation.
|
| 161 |
+
|
| 162 |
+
DDIM (Song et al., 2021a) was originally shown to be effective for few-step sampling, as was the probability flow sampler (Song et al., 2021c). Jolicoeur-Martineau et al. (2021) study fast SDE integrators for reverse diffusion processes, and Tzen & Raginsky (2019b) study unbiased samplers which may be useful for fast, high quality sampling as well.
|
| 163 |
+
|
| 164 |
+
Other work on fast sampling can be viewed as manual or automated methods to adjust samplers or diffusion processes for fast generation. Nichol & Dhariwal (2021); Kong & Ping (2021) describe methods to adjust a discrete time diffusion model trained on many timesteps into models that can sample in few timesteps. Watson et al. (2021) describe a dynamic programming algorithm to reduce the number of timesteps for a diffusion model in a way that is optimal for log likelihood. Chen et al. (2021); Saharia et al. (2021); Ho et al. (2021) train diffusion models over continuous noise levels and tune samplers post training by adjusting the noise levels of a few-step discrete time reverse diffusion process. Their method is effective in highly conditioned settings such as text-to-speech and image super-resolution. San-Roman et al. (2021) train a new network to estimate the noise level of noisy data and show how to use this estimate to speed up sampling.
|
| 165 |
+
|
| 166 |
+
Alternative specifications of the diffusion model can also lend themselves to fast sampling, such as modified forward and reverse processes (Nachmani et al., 2021; Lam et al., 2021) and training diffusion models in latent space (Vahdat et al., 2021).
|
| 167 |
+
|
| 168 |
+
Table 2: Comparison of fast sampling results on CIFAR-10 for diffusion models in the literature.
|
| 169 |
+
|
| 170 |
+
<table><tr><td>Method</td><td>Model evaluations</td><td>FID</td></tr><tr><td rowspan="3">Progressive Distillation (ours)</td><td>1</td><td>9.12</td></tr><tr><td>2</td><td>4.51</td></tr><tr><td>4</td><td>3.00</td></tr><tr><td>Knowledge distillation (Luhman &Luhman,2021)</td><td>8 1</td><td>2.57 9.36</td></tr><tr><td>DDIM (Song et al.,2021a)</td><td>10</td><td>13.36</td></tr><tr><td rowspan="3"></td><td>20</td><td>6.84</td></tr><tr><td>50</td><td>4.67</td></tr><tr><td>100</td><td>4.16</td></tr><tr><td rowspan="4">Dynamic step-size extrapolation + VP-deep (Jolicoeur-Martineau et al.,2021)</td><td>48</td><td>82.42</td></tr><tr><td>151</td><td>2.73</td></tr><tr><td>180</td><td>2.44</td></tr><tr><td>274 330</td><td>2.60 2.56</td></tr><tr><td rowspan="4">FastDPM(Kong& Ping,2021)</td><td>10</td><td>9.90</td></tr><tr><td>20</td><td>5.05</td></tr><tr><td>50</td><td>3.20</td></tr><tr><td>100</td><td>2.86</td></tr><tr><td>Improved DDPM respacing</td><td>25</td><td>7.53</td></tr><tr><td>(Nichol & Dhariwal, 2021),our reimplementation</td><td>50</td><td>4.99</td></tr><tr><td>LSGM (Vahdat et al., 2021)</td><td>138</td><td>2.10</td></tr></table>
|
| 171 |
+
|
| 172 |
+
# 7 DISCUSSION
|
| 173 |
+
|
| 174 |
+
We have presented progressive distillation, a method to drastically reduce the number of sampling steps required for high quality generation of images, and potentially other data, using diffusion models with deterministic samplers like DDIM (Song et al., 2020). By making these models cheaper to run at test time, we hope to increase their usefulness for practical applications, for which running time and computational requirements often represent important constraints.
|
| 175 |
+
|
| 176 |
+
In the current work we limited ourselves to setups where the student model has the same architecture and number of parameters as the teacher model: in future work we hope to relax this constraint and explore settings where the student model is smaller, potentially enabling further gains in test time computational requirements. In addition, we hope to move past the generation of images and also explore progressive distillation of diffusion models for different data modalities such as e.g. audio (Chen et al., 2021).
|
| 177 |
+
|
| 178 |
+
In addition to the proposed distillation procedure, some of our progress was realized through different parameterizations of the diffusion model and its training loss. We expect to see more progress in this direction as the community further explores this model class.
|
| 179 |
+
|
| 180 |
+
# REPRODUCIBILITY STATEMENT
|
| 181 |
+
|
| 182 |
+
We provide full details on model architectures, training procedures, and hyperparameters in Appendix E, in addition to our discussion in Section 5. In Algorithm 2 we provide fairly detailed pseudocode that closely matches our actual implementation, which is available in open source at https: //github.com/google-research/google-research/tree/master/diffusion_distillation.
|
| 183 |
+
|
| 184 |
+
# ETHICS STATEMENT
|
| 185 |
+
|
| 186 |
+
In general, generative models can have unethical uses, such as fake content generation, and they can suffer from bias if applied to data sets that are not carefully curated. The focus of this paper specifically is on speeding up generative models at test time in order to reduce their computational demands; we do not have specific concerns with regards to this contribution.
|
| 187 |
+
|
| 188 |
+
# REFERENCES
|
| 189 |
+
|
| 190 |
+
Jacob Austin, Daniel D. Johnson, Jonathan Ho, Daniel Tarlow, and Rianne van den Berg. Structured denoising diffusion models in discrete state-spaces. CoRR, abs/2107.03006, 2021.
|
| 191 |
+
|
| 192 |
+
Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale GAN training for high fidelity natural image synthesis. In International Conference on Learning Representations, 2019.
|
| 193 |
+
|
| 194 |
+
Ruojin Cai, Guandao Yang, Hadar Averbuch-Elor, Zekun Hao, Serge Belongie, Noah Snavely, and Bharath Hariharan. Learning gradient fields for shape generation. arXiv preprint arXiv:2008.06520, 2020.
|
| 195 |
+
|
| 196 |
+
Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, and William Chan. WaveGrad: Estimating gradients for waveform generation. International Conference on Learning Representations, 2021.
|
| 197 |
+
|
| 198 |
+
Tian Qi Chen, Yulia Rubanova, Jesse Bettencourt, and David K Duvenaud. Neural ordinary differential equations. In Advances in Neural Information Processing Systems, pp. 6571–6583, 2018.
|
| 199 |
+
|
| 200 |
+
Prafulla Dhariwal and Alex Nichol. Diffusion models beat GANs on image synthesis. arXiv preprint arXiv:2105.05233, 2021.
|
| 201 |
+
|
| 202 |
+
Will Grathwohl, Ricky TQ Chen, Jesse Bettencourt, Ilya Sutskever, and David Duvenaud. Ffjord: Free-form continuous dynamics for scalable reversible generative models. arXiv preprint arXiv:1810.01367, 2018.
|
| 203 |
+
|
| 204 |
+
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, pp. 6626–6637, 2017.
|
| 205 |
+
|
| 206 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In Advances in Neural Information Processing Systems, pp. 6840–6851, 2020.
|
| 207 |
+
|
| 208 |
+
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.
|
| 209 |
+
|
| 210 |
+
Emiel Hoogeboom, Didrik Nielsen, Priyank Jaini, Patrick Forré, and Max Welling. Argmax flows and multinomial diffusion: Towards non-autoregressive language models. arXiv preprint arXiv:2102.05379, 2021.
|
| 211 |
+
|
| 212 |
+
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.
|
| 213 |
+
|
| 214 |
+
Diederik P Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational diffusion models. arXiv preprint arXiv:2107.00630, 2021.
|
| 215 |
+
|
| 216 |
+
Zhifeng Kong and Wei Ping. On fast sampling of diffusion probabilistic models. arXiv preprint arXiv:2106.00132, 2021.
|
| 217 |
+
|
| 218 |
+
Max WY Lam, Jun Wang, Rongjie Huang, Dan Su, and Dong Yu. Bilateral denoising diffusion models. arXiv preprint arXiv:2108.11514, 2021.
|
| 219 |
+
|
| 220 |
+
Haoying Li, Yifan Yang, Meng Chang, Huajun Feng, Zhihai Xu, Qi Li, and Yueting Chen. Srdiff: Single image super-resolution with diffusion probabilistic models. arXiv preprint arXiv:2104.14951, 2021.
|
| 221 |
+
|
| 222 |
+
Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
|
| 223 |
+
|
| 224 |
+
Eric Luhman and Troy Luhman. Knowledge distillation in iterative generative models for improved sampling speed. arXiv preprint arXiv:2101.02388, 2021.
|
| 225 |
+
|
| 226 |
+
Eliya Nachmani, Robin San Roman, and Lior Wolf. Non gaussian denoising diffusion models. arXiv preprint arXiv:2106.07582, 2021.
|
| 227 |
+
|
| 228 |
+
Alexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, ICML, 2021.
|
| 229 |
+
|
| 230 |
+
Chenhao Niu, Yang Song, Jiaming Song, Shengjia Zhao, Aditya Grover, and Stefano Ermon. Permutation invariant graph generation via score-based generative modeling. In International Conference on Artificial Intelligence and Statistics, pp. 4474–4484. PMLR, 2020.
|
| 231 |
+
|
| 232 |
+
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.
|
| 233 |
+
|
| 234 |
+
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.
|
| 235 |
+
|
| 236 |
+
Robin San-Roman, Eliya Nachmani, and Lior Wolf. Noise estimation for generative diffusion models. arXiv preprint arXiv:2104.02600, 2021.
|
| 237 |
+
|
| 238 |
+
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, 2015.
|
| 239 |
+
|
| 240 |
+
Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. International Conference on Learning Representations, 2021a.
|
| 241 |
+
|
| 242 |
+
Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. In Advances in Neural Information Processing Systems, pp. 11895–11907, 2019.
|
| 243 |
+
|
| 244 |
+
Yang Song and Stefano Ermon. Improved techniques for training score-based generative. Advances in Neural Information Processing Systems, 2020.
|
| 245 |
+
|
| 246 |
+
Yang Song, Conor Durkan, Iain Murray, and Stefano Ermon. Maximum likelihood training of scorebased diffusion models. arXiv e-prints, pp. arXiv–2101, 2021b.
|
| 247 |
+
|
| 248 |
+
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, 2021c.
|
| 249 |
+
|
| 250 |
+
Yuxuan Song, Qiwei Ye, Minkai Xu, and Tie-Yan Liu. Discriminator contrastive divergence: Semi-amortized generative modeling by exploring energy of the discriminator. arXiv preprint arXiv:2004.01704, 2020.
|
| 251 |
+
|
| 252 |
+
Belinda Tzen and Maxim Raginsky. Neural stochastic differential equations: Deep latent gaussian models in the diffusion limit. arXiv preprint arXiv:1905.09883, 2019a.
|
| 253 |
+
|
| 254 |
+
Belinda Tzen and Maxim Raginsky. Theoretical guarantees for sampling and inference in generative models with latent diffusions. In Conference on Learning Theory, pp. 3084–3114. PMLR, 2019b.
|
| 255 |
+
|
| 256 |
+
Arash Vahdat, Karsten Kreis, and Jan Kautz. Score-based generative modeling in latent space. arXiv preprint arXiv:2106.05931, 2021.
|
| 257 |
+
|
| 258 |
+
Pascal Vincent. A connection between score matching and denoising autoencoders. Neural Computation, 23(7):1661–1674, 2011.
|
| 259 |
+
|
| 260 |
+
Daniel Watson, Jonathan Ho, Mohammad Norouzi, and William Chan. Learning to efficiently sample from diffusion probabilistic models. arXiv preprint arXiv:2106.03802, 2021.
|
| 261 |
+
|
| 262 |
+
# A PROBABILITY FLOW ODE IN TERMS OF LOG-SNR
|
| 263 |
+
|
| 264 |
+
Song et al. (2021c) formulate the forward diffusion process in terms of an SDE of the form
|
| 265 |
+
|
| 266 |
+
$$
|
| 267 |
+
\begin{array} { r } { d { \mathbf { z } } = f ( { \mathbf { z } } , t ) d t + g ( t ) d W , } \end{array}
|
| 268 |
+
$$
|
| 269 |
+
|
| 270 |
+
and show that samples from this diffusion process can be generated by solving the associated probability flow ODE:
|
| 271 |
+
|
| 272 |
+
$$
|
| 273 |
+
d \mathbf { z } = [ f ( \mathbf { z } , t ) - \frac { 1 } { 2 } g ^ { 2 } ( t ) \nabla _ { z } \log p _ { t } ( \mathbf { z } ) ] d t ,
|
| 274 |
+
$$
|
| 275 |
+
|
| 276 |
+
where in practice $\nabla _ { z } \log { p _ { t } ( \mathbf { z } ) }$ is approximated by a learned denoising model using
|
| 277 |
+
|
| 278 |
+
$$
|
| 279 |
+
\nabla _ { z } \log { p _ { t } ( \mathbf { z } ) } \approx \frac { \alpha _ { t } \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) - \mathbf { z } _ { t } } { \sigma _ { t } ^ { 2 } } .
|
| 280 |
+
$$
|
| 281 |
+
|
| 282 |
+
Following Kingma et al. (2021) we have $\begin{array} { r } { f ( \mathbf { z } , t ) = \frac { d \log \alpha _ { t } } { d t } \mathbf { z } _ { t } } \end{array}$ and $\begin{array} { r } { g ^ { 2 } ( t ) = \frac { d \sigma _ { t } ^ { 2 } } { d t } - 2 \frac { d \log { \alpha _ { t } } } { d t } \sigma _ { t } ^ { 2 } } \end{array}$ . Assuming a variance preserving diffusion process with $\alpha _ { t } ^ { 2 } = 1 - \sigma _ { t } ^ { 2 } = \mathrm { s i g m o i d } ( \bar { \lambda } _ { t } )$ for $\bar { \lambda _ { t } } = \log [ \alpha _ { t } ^ { 2 } / \sigma _ { t } ^ { 2 } ]$ (without loss of generality, see Kingma et al. (2021)), we get
|
| 283 |
+
|
| 284 |
+
$$
|
| 285 |
+
f ( \mathbf { z } , t ) = { \frac { d \log \alpha _ { t } } { d t } } \mathbf { z } _ { t } = { \frac { 1 } { 2 } } { \frac { d \log \alpha _ { \lambda } ^ { 2 } } { d \lambda } } { \frac { d \lambda } { d t } } \mathbf { z } _ { t } = { \frac { 1 } { 2 } } ( 1 - \alpha _ { t } ^ { 2 } ) { \frac { d \lambda } { d t } } \mathbf { z } _ { t } = { \frac { 1 } { 2 } } \sigma _ { t } ^ { 2 } { \frac { d \lambda } { d t } } \mathbf { z } _ { t } .
|
| 286 |
+
$$
|
| 287 |
+
|
| 288 |
+
Similarly, we get
|
| 289 |
+
|
| 290 |
+
$$
|
| 291 |
+
g ^ { 2 } ( t ) = { \frac { d \sigma _ { t } ^ { 2 } } { d t } } - 2 { \frac { d \log \alpha _ { t } } { d t } } \sigma _ { t } ^ { 2 } = { \frac { d \sigma _ { \lambda } ^ { 2 } } { d \lambda } } { \frac { d \lambda } { d t } } - \sigma _ { t } ^ { 4 } { \frac { d \lambda } { d t } } = ( \sigma _ { t } ^ { 4 } - \sigma _ { t } ^ { 2 } ) { \frac { d \lambda } { d t } } - \sigma _ { t } ^ { 4 } { \frac { d \lambda } { d t } } = - \sigma _ { t } ^ { 2 } { \frac { d \lambda } { d t } } .
|
| 292 |
+
$$
|
| 293 |
+
|
| 294 |
+
Plugging these into the probability flow ODE then gives
|
| 295 |
+
|
| 296 |
+
$$
|
| 297 |
+
\begin{array} { l } { d \mathbf { z } = [ f ( \mathbf { z } , t ) - \displaystyle \frac { 1 } { 2 } g ^ { 2 } ( t ) \nabla _ { z } \log p _ { t } ( \mathbf { z } ) ] d t } \\ { \displaystyle = \frac { 1 } { 2 } \sigma _ { \lambda } ^ { 2 } [ \mathbf { z } _ { \lambda } + \nabla _ { z } \log p _ { \lambda } ( \mathbf { z } ) ] d \lambda . } \end{array}
|
| 298 |
+
$$
|
| 299 |
+
|
| 300 |
+
Plugging in our function approximation from Equation 12 gives
|
| 301 |
+
|
| 302 |
+
$$
|
| 303 |
+
\begin{array} { l } { { d { \bf z } = \displaystyle \frac { 1 } { 2 } \sigma _ { \lambda } ^ { 2 } \left[ { \bf z } _ { \lambda } + \left( \frac { \alpha _ { \lambda } \hat { \bf x } _ { \theta } \left( { \bf z } _ { \lambda } \right) - { \bf z } _ { \lambda } } { \sigma _ { \lambda } ^ { 2 } } \right) \right] d \lambda } } \\ { { { \mathrm { } ~ } = \displaystyle \frac { 1 } { 2 } [ \alpha _ { \lambda } \hat { \bf x } _ { \theta } ( { \bf z } _ { \lambda } ) + ( \sigma _ { \lambda } ^ { 2 } - 1 ) { \bf z } _ { \lambda } ] d \lambda } } \\ { { { \mathrm { } ~ } = \displaystyle \frac { 1 } { 2 } [ \alpha _ { \lambda } \hat { \bf x } _ { \theta } ( { \bf z } _ { \lambda } ) - \alpha _ { \lambda } ^ { 2 } { \bf z } _ { \lambda } ] d \lambda . } } \end{array}
|
| 304 |
+
$$
|
| 305 |
+
|
| 306 |
+
# B DDIM IS AN INTEGRATOR OF THE PROBABILITY FLOW ODE
|
| 307 |
+
|
| 308 |
+
The DDIM update rule (Song & Ermon, 2020) is given by
|
| 309 |
+
|
| 310 |
+
$$
|
| 311 |
+
\mathbf { z } _ { s } = \frac { \sigma _ { s } } { \sigma _ { t } } [ \mathbf { z } _ { t } - \alpha _ { t } \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) ] + \alpha _ { s } \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) ,
|
| 312 |
+
$$
|
| 313 |
+
|
| 314 |
+
for $s < t$ . Taking the derivative of this expression with respect to $\lambda _ { s }$ , assuming again a variance preserving diffusion process, and using $\begin{array} { r } { \frac { d \alpha _ { \lambda } } { d \lambda } = \frac { 1 } { 2 } \alpha _ { \lambda } \sigma _ { \lambda } ^ { 2 } } \end{array}$ and $\begin{array} { r } { \frac { d \sigma _ { \lambda } } { d \lambda } = - \frac { 1 } { 2 } \sigma _ { \lambda } \alpha _ { \lambda } ^ { 2 } } \end{array}$ , gives
|
| 315 |
+
|
| 316 |
+
$$
|
| 317 |
+
\begin{array} { r l r } { { \frac { { \bf z } _ { \lambda _ { s } } } { d \lambda _ { s } } = \frac { d \sigma _ { \lambda _ { s } } } { d \lambda _ { s } } \frac { 1 } { \sigma _ { t } } [ { \bf z } _ { t } - \alpha _ { t } \hat { \bf x } _ { \theta } ( { \bf z } _ { t } ) ] + \frac { d \alpha _ { \lambda _ { s } } } { d \lambda _ { s } } \hat { \bf x } _ { \theta } ( { \bf z } _ { t } ) } } \\ & { } & { = - \frac { 1 } { 2 } \alpha _ { s } ^ { 2 } \frac { \sigma _ { s } } { \sigma _ { t } } [ { \bf z } _ { t } - \alpha _ { t } \hat { \bf x } _ { \theta } ( { \bf z } _ { t } ) ] + \frac { 1 } { 2 } \alpha _ { s } \sigma _ { s } ^ { 2 } \hat { \bf x } _ { \theta } ( { \bf z } _ { t } ) . } \end{array}
|
| 318 |
+
$$
|
| 319 |
+
|
| 320 |
+
Evaluating this derivative at $s = t$ then gives
|
| 321 |
+
|
| 322 |
+
$$
|
| 323 |
+
\begin{array} { l } { \displaystyle \frac { { \bf z } _ { \lambda _ { s } } } { d \lambda _ { s } } | _ { s = t } = - \frac { 1 } { 2 } \alpha _ { \lambda } ^ { 2 } [ { \bf z } _ { \lambda } - \alpha _ { \lambda } \hat { \bf x } _ { \theta } ( { \bf z } _ { \lambda } ) ] + \frac { 1 } { 2 } \alpha _ { \lambda } \sigma _ { \lambda } ^ { 2 } \hat { \bf x } _ { \theta } ( { \bf z } _ { \lambda } ) } \\ { \displaystyle = - \frac { 1 } { 2 } \alpha _ { \lambda } ^ { 2 } [ { \bf z } _ { \lambda } - \alpha _ { \lambda } \hat { \bf x } _ { \theta } ( { \bf z } _ { \lambda } ) ] + \frac { 1 } { 2 } \alpha _ { \lambda } ( 1 - \alpha _ { \lambda } ^ { 2 } ) \hat { \bf x } _ { \theta } ( { \bf z } _ { \lambda } ) } \\ { \displaystyle = \frac { 1 } { 2 } [ \alpha _ { \lambda } \hat { \bf x } _ { \theta } ( { \bf z } _ { \lambda } ) - \alpha _ { \lambda } ^ { 2 } { \bf z } _ { \lambda } ] . } \end{array}
|
| 324 |
+
$$
|
| 325 |
+
|
| 326 |
+
Comparison with Equation 19 now shows that DDIM follows the probability flow ODE up to first order, and can thus be considered as an integration rule for this ODE.
|
| 327 |
+
|
| 328 |
+
# C EVALUATION OF INTEGRATORS OF THE PROBABILITY FLOW ODE
|
| 329 |
+
|
| 330 |
+
In a preliminary investigation we tried several numerical integrators for the probability flow ODE. As our model we used a pre-trained class-conditional $1 2 8 \mathrm { x } 1 2 8$ ImageNet model following the description in Ho et al. (2020). We tried a simple Euler integrator, RK4 (the “classic” 4th order Runge–Kutta integrator), and DDIM (Song et al., 2021a). In addition we compared to a Gaussian sampler with variance equal to the lower bound given by Ho et al. (2020). We calculated FID scores on just 5000 samples, hence our results in this experiment are not comparable to results reported in the literature. This preliminary investigation gave the results listed in Table 3 and identified DDIM as the best integrator in terms of resulting sample quality.
|
| 331 |
+
|
| 332 |
+
<table><tr><td>Sampler</td><td>Number of steps</td><td>FID</td></tr><tr><td>Stochastic Euler RK4</td><td>1000 1000 1000 1000</td><td>13.35 16.5 16.33 15.98</td></tr><tr><td>DDIM Stochastic</td><td>100</td><td>18.44</td></tr><tr><td>Euler</td><td>100</td><td>23.67</td></tr><tr><td>RK4</td><td>100</td><td>18.94</td></tr><tr><td>DDIM</td><td>100</td><td>16.35</td></tr></table>
|
| 333 |
+
|
| 334 |
+
Table 3: Preliminary FID scores on $1 2 8 \times 1 2 8$ ImageNet for various integrators of the probability flow ODE, and compared against a stochastic sampler. Model specification and noise schedule follow Ho et al. (2020).
|
| 335 |
+
|
| 336 |
+
# D EXPRESSION OF DDIM IN ANGULAR PARAMETERIZATION
|
| 337 |
+
|
| 338 |
+
We can simplify the DDIM update rule by expressing it in terms of $\phi _ { t } = \arctan ( \sigma _ { t } / \alpha _ { t } )$ , rather than in terms of time $t$ or log-SNR $\lambda _ { t }$ , as we show here.
|
| 339 |
+
|
| 340 |
+
Given our definition of $\phi$ , and assuming a variance preserving diffusion process, we have $\alpha _ { \phi } =$ $\cos ( \phi )$ , $\begin{array} { r } { \sigma _ { \phi } = \sin ( \phi ) } \end{array}$ , and hence ${ \bf z } _ { \phi } = \mathrm { c o s } ( \phi ) { \bf x } + \mathrm { s i n } ( { \bar { \phi } } ) \epsilon$ . We can now define the velocity of $\mathbf { z } _ { \phi }$ as
|
| 341 |
+
|
| 342 |
+
$$
|
| 343 |
+
\mathbf { v } _ { \phi } \equiv \frac { d \mathbf { z } _ { \phi } } { d \phi } = \frac { d \cos ( \phi ) } { d \phi } \mathbf { x } + \frac { d \sin ( \phi ) } { d \phi } \epsilon = \cos ( \phi ) \epsilon - \sin ( \phi ) \mathbf { x } .
|
| 344 |
+
$$
|
| 345 |
+
|
| 346 |
+
Rearranging $\epsilon , \mathbf { x } , \mathbf { v }$ , we then get
|
| 347 |
+
|
| 348 |
+
$$
|
| 349 |
+
\begin{array} { c } { { \sin ( \phi ) { \bf x } = \cos ( \phi ) \epsilon - { \bf v } _ { \phi } } } \\ { { { \displaystyle = \frac { \cos ( \phi ) } { \sin ( \phi ) } ( { \bf z } - \cos ( \phi ) { \bf x } ) - { \bf v } _ { \phi } } } } \\ { { { \displaystyle \sin ^ { 2 } ( \phi ) { \bf x } = \cos ( \phi ) { \bf z } - \cos ^ { 2 } ( \phi ) { \bf x } - \sin ( \phi ) { \bf v } _ { \phi } } } } \\ { { { \displaystyle ( \sin ^ { 2 } ( \phi ) + \cos ^ { 2 } ( \phi ) ) { \bf x } = { \bf x } = \cos ( \phi ) { \bf z } - \sin ( \phi ) { \bf v } _ { \phi } } , } } \end{array}
|
| 350 |
+
$$
|
| 351 |
+
|
| 352 |
+
and similarly we get $\boldsymbol { \epsilon } = \sin ( \phi ) \mathbf { z } _ { \phi } + \cos ( \phi ) \mathbf { v } _ { \phi }$
|
| 353 |
+
|
| 354 |
+
Furthermore, we define the predicted velocity as
|
| 355 |
+
|
| 356 |
+
$$
|
| 357 |
+
\hat { \mathbf { v } } _ { \theta } ( \mathbf { z } _ { \phi } ) \equiv \cos ( \phi ) \hat { \epsilon } _ { \theta } ( \mathbf { z } _ { \phi } ) - \sin ( \phi ) \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { \phi } ) ,
|
| 358 |
+
$$
|
| 359 |
+
|
| 360 |
+
where $\begin{array} { r } { \hat { \epsilon } _ { \theta } ( \mathbf { z } _ { \phi } ) = ( \mathbf { z } _ { \phi } - \cos ( \phi ) \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { \phi } ) ) / \sin ( \phi ) . } \end{array}$
|
| 361 |
+
|
| 362 |
+
Rewriting the DDIM update rule in the introduced terms then gives
|
| 363 |
+
|
| 364 |
+
$$
|
| 365 |
+
\begin{array} { r l r } { { \mathbf { z } _ { \phi _ { s } } = \cos ( \phi _ { s } ) \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { \phi _ { t } } ) + \sin ( \phi _ { s } ) \hat { \boldsymbol { \epsilon } } _ { \theta } ( \mathbf { z } _ { \phi _ { t } } ) } } & { \quad ( \hat { \mathbf { z } } _ { \phi _ { t } } ) } \\ & { } & { = \cos ( \phi _ { s } ) ( \cos ( \phi _ { t } ) \mathbf { z } _ { \phi _ { t } } - \sin ( \phi _ { t } ) \hat { \mathbf { v } } _ { \theta } ( \mathbf { z } _ { \phi _ { t } } ) ) + \sin ( \phi _ { s } ) ( \sin ( \phi _ { t } ) \mathbf { z } _ { \phi _ { t } } + \cos ( \phi _ { t } ) \hat { \mathbf { v } } _ { \theta } ( \mathbf { z } _ { \phi _ { t } } ) ) \quad \mathrm { ~ ( \hat { z } _ \phi \phi _ t ~ ) ~ } } \\ & { } & { = [ \cos ( \phi _ { s } ) \cos ( \phi _ { t } ) - \sin ( \phi _ { s } ) \sin ( \phi _ { t } ) ] \mathbf { z } _ { \phi _ { t } } + [ \sin ( \phi _ { s } ) \cos ( \phi _ { t } ) - \cos ( \phi _ { s } ) \sin ( \phi _ { t } ) ] \hat { \mathbf { v } } _ { \theta } ( \mathbf { z } _ { \phi _ { t } } ) . } \end{array}
|
| 366 |
+
$$
|
| 367 |
+
|
| 368 |
+
Finally, we use the trigonometric identities
|
| 369 |
+
|
| 370 |
+
$$
|
| 371 |
+
\begin{array} { l } { \cos ( \phi _ { s } ) \sin ( \phi _ { t } ) - \sin ( \phi _ { s } ) \cos ( \phi _ { t } ) = \cos ( \phi _ { s } - \phi _ { t } ) } \\ { \sin ( \phi _ { s } ) \cos ( \phi _ { t } ) - \cos ( \phi _ { s } ) \sin ( \phi _ { t } ) = \sin ( \phi _ { s } - \phi _ { t } ) , } \end{array}
|
| 372 |
+
$$
|
| 373 |
+
|
| 374 |
+
to find that
|
| 375 |
+
|
| 376 |
+
$$
|
| 377 |
+
\begin{array} { r } { \mathbf { z } _ { \phi _ { s } } = \cos ( \phi _ { s } - \phi _ { t } ) \mathbf { z } _ { \phi _ { t } } + \sin ( \phi _ { s } - \phi _ { t } ) \hat { \mathbf { v } } _ { \theta } ( \mathbf { z } _ { \phi _ { t } } ) . } \end{array}
|
| 378 |
+
$$
|
| 379 |
+
|
| 380 |
+
or equivalently
|
| 381 |
+
|
| 382 |
+
$$
|
| 383 |
+
\begin{array} { r } { { \bf z } _ { \phi _ { t } - \delta } = \cos ( \delta ) { \bf z } _ { \phi _ { t } } - \sin ( \delta ) \hat { \bf v } _ { \theta } ( { \bf z } _ { \phi _ { t } } ) . } \end{array}
|
| 384 |
+
$$
|
| 385 |
+
|
| 386 |
+
Viewed from this perspective, DDIM thus evolves ${ \bf z } _ { \phi _ { s } }$ by moving it on a circle in the $\left( \mathbf { z } _ { \phi _ { t } } , \hat { \mathbf { v } } _ { \phi _ { t } } \right)$ basis, along the $- \hat { \mathbf { v } } _ { \phi _ { t } }$ direction. The relationship between ${ \bf z } _ { \phi _ { t } } , { \bf v } _ { t } , \alpha _ { t } , \sigma _ { t } , { \bf x } , \epsilon$ is visualized in Figure 5.
|
| 387 |
+
|
| 388 |
+

|
| 389 |
+
Figure 5: Visualization of reparameterizing the diffusion process in terms of $\phi$ and $\mathbf { v } _ { \phi }$
|
| 390 |
+
|
| 391 |
+
# E SETTINGS USED IN EXPERIMENTS
|
| 392 |
+
|
| 393 |
+
Our model architectures closely follow those described by Dhariwal & Nichol (2021). For $6 4 \times 6 4$ ImageNet we use their model exactly, with 192 channels at the highest resolution. All other models are slight variations with different hyperparameters.
|
| 394 |
+
|
| 395 |
+
For CIFAR-10 we use an architecture with a fixed number of channels at all resolutions of 256. The model consists of a UNet that internally downsamples the data twice, to $1 6 \times 1 6$ and to $8 \times 8$ . At each resolution we apply 3 residual blocks, like described by Dhariwal & Nichol (2021). We use single-headed attention, and only apply this at the $1 6 \times 1 6$ and $8 \times 8$ resolutions. We use dropout of 0.2 when training the original model. No dropout is used during distillation.
|
| 396 |
+
|
| 397 |
+
For LSUN we use a model similar to that for ImageNet, but with a reduced number of 128 channels at the $6 4 \times 6 4$ resolution. Compared to ImageNet we have an additional level in the UNet, corresponding to the input resolution of $1 2 8 \times 1 2 8$ , which we process using 3 residual blocks with 64 channels. We only use attention layers for the resolutions of $3 2 \times 3 2$ and lower.
|
| 398 |
+
|
| 399 |
+
For CIFAR-10 we take the output of the model to represent a prediction of $\mathbf { x }$ directly, as discussed in Section 4. For the other data sets we used the combined prediction of $( \mathbf { x } , \epsilon )$ like described in that section also. All original models are trained with Adam with standard settings (learning rate of $3 * 1 0 ^ { - 4 }$ ), using a parameter moving average with constant 0.9999 and very slight decoupled weight decay (Loshchilov & Hutter, 2017) with a constant of 0.001. We clip the norm of gradients to a global norm of 1 before calculating parameter updates. For CIFAR-10 we train for $8 0 0 \mathrm { k }$ parameter updates, for ImageNet we use 550k updates, and for LSUN we use $4 0 0 \mathrm { k }$ updates. During distillation we train for 50k updates per iteration, except for the distillation to 2 and 1 sampling steps, for which we use $1 0 0 \mathrm { k }$ updates. We linearly anneal the learning rate from $1 0 ^ { - 4 }$ to zero during each iteration.
|
| 400 |
+
|
| 401 |
+
We use a batch size of 128 for CIFAR-10 and 2048 for the other data sets. We run our experiments on TPUv4, using 8 TPU chips for CIFAR-10, and 64 chips for the other data sets. The total time required to first train and then distill a model varies from about a day for CIFAR-10, to about 5 days for ImageNet.
|
| 402 |
+
|
| 403 |
+
# F STOCHASTIC SAMPLING WITH DISTILLED MODELS
|
| 404 |
+
|
| 405 |
+
Our progressive distillation procedure was designed to be used with the DDIM sampler, but the resulting distilled model could in principle also be used with a stochastic sampler. Here we evaluate a distilled model for $6 4 \mathrm { x } 6 4$ ImageNet using the optimized stochastic sampler also used in Section 5.2. The results are presented in Figure 6.
|
| 406 |
+
|
| 407 |
+

|
| 408 |
+
Figure 6: FID of generated samples from distilled and undistilled models, using DDIM or stochastic sampling. For the stochastic sampling results we present the best FID obtained by a grid-search over 11 possible noise levels, spaced log-uniformly between the upper and lower bound on the variance as derived by Ho et al. (2020). The performance of the distilled model with stochastic sampling is found to lie in between the undistilled original model with stochastic sampling and the distilled DDIM sampler: For small numbers of sampling steps the DDIM sampler performs better with the distilled model, for large numbers of steps the stochastic sampler performs better.
|
| 409 |
+
|
| 410 |
+
# G DERIVATION OF THE DISTILLATION TARGET
|
| 411 |
+
|
| 412 |
+
The key difference between our progressive distillation algorithm proposed in Section 3 and the standard diffusion training procedure is in how we determine the target value for our denoising model. In standard diffusion training, the target for denoising is the clean data $\mathbf { x }$ . In progressive distillation it is the value $\tilde { \mathbf { x } }$ the student denoising model would need to predict in order to match the teacher model when sampling. Here we derive what this target needs to be.
|
| 413 |
+
|
| 414 |
+
Using notation $t ^ { \prime } = t - 0 . 5 / N$ and $t ^ { \prime \prime } = t - 1 / N$ , when training a student with $N$ sampling steps, we have that the teacher model samples the next set of noisy data $\mathbf { z } _ { t ^ { \prime \prime } }$ given the current noisy data $\mathbf { z } _ { t }$ by taking two steps of DDIM. The student tries to sample the same value in only one step of DDIM. Denoting the student denoising prediction by $\tilde { \mathbf { x } }$ , and its one-step sample by $\tilde { \mathbf { z } } _ { t ^ { \prime \prime } }$ , application of the DDIM sampler (see equation 8), gives:
|
| 415 |
+
|
| 416 |
+
$$
|
| 417 |
+
\tilde { \mathbf { z } } _ { t ^ { \prime \prime } } = \alpha _ { t ^ { \prime \prime } } \tilde { \mathbf { x } } + \frac { \sigma _ { t ^ { \prime \prime } } } { \sigma _ { t } } ( \mathbf { z } _ { t } - \alpha _ { t } \tilde { \mathbf { x } } ) .
|
| 418 |
+
$$
|
| 419 |
+
|
| 420 |
+
In order for the student sampler to match the teacher sampler, we must set $\tilde { \mathbf { z } } _ { t ^ { \prime \prime } }$ equal to $\mathbf { z } _ { t ^ { \prime \prime } }$ . This gives
|
| 421 |
+
|
| 422 |
+
$$
|
| 423 |
+
\begin{array} { c } { { \tilde { \bf z } _ { t ^ { \prime \prime } } = \alpha _ { t ^ { \prime \prime } } \tilde { \bf x } + \frac { \sigma _ { t ^ { \prime \prime } } } { \sigma _ { t } } ( { \bf z } _ { t } - \alpha _ { t } \tilde { \bf x } ) = { \bf z } _ { t ^ { \prime \prime } } } } \\ { { { \mathrm { } } } } \\ { { { \mathrm { } } = \left( \alpha _ { t ^ { \prime \prime } } - \frac { \sigma _ { t ^ { \prime \prime } } } { \sigma _ { t } } \alpha _ { t } \right) \tilde { \bf x } + \frac { \sigma _ { t ^ { \prime \prime } } } { \sigma _ { t } } { \bf z } _ { t } = { \bf z } _ { t ^ { \prime \prime } } } } \\ { { { \mathrm { } } } } \\ { { \left( \alpha _ { t ^ { \prime \prime } } - \frac { \sigma _ { t ^ { \prime \prime } } } { \sigma _ { t } } \alpha _ { t } \right) \tilde { \bf x } = { \bf z } _ { t ^ { \prime \prime } } - \frac { \sigma _ { t ^ { \prime \prime } } } { \sigma _ { t } } { \bf z } _ { t } } } \\ { { { \mathrm { } } } } \\ { { \tilde { \bf x } = \frac { { \bf z } _ { t ^ { \prime \prime } } - \frac { \sigma _ { t ^ { \prime \prime } } } { \sigma _ { t ^ { \prime } } } { \alpha _ { t } } } { \alpha _ { t ^ { \prime \prime } } - \frac { \sigma _ { t ^ { \prime \prime } } } { \sigma _ { t ^ { \prime \prime } } } { \alpha _ { t } } } } } \end{array}
|
| 424 |
+
$$
|
| 425 |
+
|
| 426 |
+
In other words, if our student denoising model exactly predicts $\tilde { \mathbf { x } }$ as defined in equation 43 above, then the one-step student sample $\tilde { \mathbf { z } } _ { t ^ { \prime \prime } }$ is identical to the two-step teacher sample $\mathbf { z } _ { t ^ { \prime \prime } }$ . In order to have our student model approximate this ideal outcome, we thus train it to predict $\tilde { \bf x }$ from $\mathbf { z } _ { t }$ as well as possible, using the standard squared error denoising loss (see Equation 9).
|
| 427 |
+
|
| 428 |
+
Note that this possibility of matching the two-step teacher model with a one-step student model is unique to deterministic samplers like DDIM: the composition of two standard stochastic DDPM sampling steps (Equation 5) forms a non-Gaussian distribution that falls outside the family of Gaussian distributions that can be modelled by a single DDPM student step: A multi-step stochastic DDPM sampler can thus not be distilled into a few-step sampler without some loss in fidelity. This is in contrast with the deterministic DDIM sampler: here both the two-step DDIM teacher update and the one-step DDIM student update represent deterministic mappings implemented by a neural net, which is why the student is able to accurately match the teacher.
|
| 429 |
+
|
| 430 |
+
Finally, note that we do lose something during the progressive distillation process: while the original model was trained to denoise $\mathbf { z } _ { t }$ for any given continuous time $t$ , the distilled student models are only ever evaluated on a small discrete set of times $t$ . The student models thus lose generality as distillation progresses. At the same time, it’s this loss of generality that allows the student models to free up enough modeling capacity to accurately match the teacher model without increasing their model size.
|
| 431 |
+
|
| 432 |
+
# H ADDITIONAL RANDOM SAMPLES
|
| 433 |
+
|
| 434 |
+
In this section we present additional random samples from our diffusion models obtained through progressive distillation. We show samples for distilled models taking 256, 4, and 1 sampling steps. All samples are uncurated.
|
| 435 |
+
|
| 436 |
+
As explained in Section 3, our distilled samplers implement a deterministic mapping from input noise to output samples (also see Appendix G). To facilitate comparison of this mapping for varying numbers of sampling steps, we generate all samples using the same random input noise, and we present the samples side-by-side. As these samples show, the mapping is mostly preserved when moving from many steps to a single step: The same input noise is mapped to the same output image, with a slight loss in image quality, as the number of steps is reduced. Since the mapping is preserved while reducing the number of steps, our distilled models also preserve the excellent sample diversity of diffusion models (see e.g. Kingma et al. (2021)).
|
| 437 |
+
|
| 438 |
+

|
| 439 |
+
Figure 7: Random samples from our distilled CIFAR-10 models, for fixed random seed and for varying number of sampling steps.
|
| 440 |
+
|
| 441 |
+

|
| 442 |
+
Figure 8: Random samples from our distilled $6 4 \times 6 4$ ImageNet models, conditioned on the ‘coral reef’ class, for fixed random seed and for varying number of sampling steps.
|
| 443 |
+
|
| 444 |
+

|
| 445 |
+
Figure 9: Random samples from our distilled $6 4 \times 6 4$ ImageNet models, conditioned on the ‘sports car’ class, for fixed random seed and for varying number of sampling steps.
|
| 446 |
+
|
| 447 |
+

|
| 448 |
+
Figure 10: Random samples from our distilled LSUN bedrooms models, for fixed random seed and for varying number of sampling steps.
|
| 449 |
+
|
| 450 |
+

|
| 451 |
+
Figure 11: Random samples from our distilled LSUN church-outdoor models, for fixed random seed and for varying number of sampling steps.
|
| 452 |
+
|
| 453 |
+
# I ABLATION WITH FASTER DISTILLATION SCHEDULES
|
| 454 |
+
|
| 455 |
+
In order to further reduce the computational requirements for our progressive distillation approach, we perform an ablation study on CIFAR-10, where we decrease the number of parameter updates we use to train each new student model. In Figure 12 we present results for taking 25 thousand, 10 thousand, or 5 thousand optimization steps, instead of the 50 thousand we suggested in Section 3. As the results show, we can drastically decrease the number of optimization steps taken, and still get very good performance when using $\geq 4$ sampling steps. When taking very few sampling steps, the loss in performance becomes more pronounced when training the student for only a short time.
|
| 456 |
+
|
| 457 |
+
In addition to just decreasing the number of parameter updates, we also experiment with a schedule where we train each student on 4 times fewer sampling steps than its teacher, rather than the 2 times we propose in Section 3. Here the denoising target is still derived from taking 2 DDIM steps with the teacher model as usual, since taking 4 teacher steps would negate most of the computational savings. As Figure 12 shows, this does not work as well: if the computational budget is limited, it’s better to take fewer parameter updates per halving of the number of sampling steps then to skip distillation iterations altogether.
|
| 458 |
+
|
| 459 |
+
In Figure 13 we show the results achieved with a faster schedule for the ImageNet and LSUN datasets. Here also, we achieve excellent results with a faster distillation schedule.
|
| 460 |
+
|
| 461 |
+

|
| 462 |
+
Figure 12: Comparing our proposed schedule for progressive distillation taking $5 0 \mathrm { k }$ parameter updates to train a new student every time the number of steps is halved, versus fast sampling schedules taking fewer parameter updates (25k, 10k, 5k), and a fast schedule dividing the number of steps by 4 for every new student instead of by 2. All reported numbers are averages over 4 random seeds. For each schedule we selected the optimal learning rate from $[ 5 e ^ { - 5 } , 1 e ^ { - 4 } , 2 e ^ { - 4 } , 3 e ^ { - 4 } ]$ .
|
| 463 |
+
|
| 464 |
+

|
| 465 |
+
Figure 13: Comparing our proposed schedule for progressive distillation taking $5 0 \mathrm { k }$ parameter updates to train a new student every time the number of steps is halved, versus a fast sampling schedule taking $1 0 \mathrm { k }$ parameter updates. For each reported number of steps we selected the optimal learning rate from $[ \dot { 5 } e ^ { - 5 } , 1 e ^ { - 4 } , \dot { 2 } e ^ { - 4 } , 3 e ^ { - 4 } ]$ . Results are for a single random seed.
|
md/dev/TatRHT_1cK/TatRHT_1cK.md
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# QUANTIFYING MEMORIZATION ACROSS NEURAL LANGUAGE MODELS
|
| 2 |
+
|
| 3 |
+
Nicholas Carlini∗1 Daphne Ippolito1,2 Matthew Jagielski1
|
| 4 |
+
Katherine Lee1,3 Florian Tramèr1 Chiyuan Zhang1
|
| 5 |
+
|
| 6 |
+
1Google Research 2University of Pennsylvania 3Cornell University
|
| 7 |
+
|
| 8 |
+
# ABSTRACT
|
| 9 |
+
|
| 10 |
+
Large language models (LMs) have been shown to memorize parts of their training data, and when prompted appropriately, they will emit the memorized training data verbatim. This is undesirable because memorization violates privacy (exposing user data), degrades utility (repeated easy-to-memorize text is often low quality), and hurts fairness (some texts are memorized over others).
|
| 11 |
+
|
| 12 |
+
We describe three log-linear relationships that quantify the degree to which LMs emit memorized training data. Memorization significantly grows as we increase (1) the capacity of a model, (2) the number of times an example has been duplicated, and (3) the number of tokens of context used to prompt the model. Surprisingly, we find the situation becomes more complicated when generalizing these results across model families. On the whole, we find that memorization in LMs is more prevalent than previously believed and will likely get worse as models continues to scale, at least without active mitigations.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
The performance of neural language models has continuously improved as these models have grown from millions to trillions of parameters (Fedus et al., 2021), with their training sets similarly growing from millions to trillions of tokens. In anticipation of future, even larger models trained on minimally curated datasets, it is important to quantify factors that lead to increased memorization of a model’s training set. Indeed, recent work has shown that training data extraction attacks are a practical threat for current language models (Carlini et al., 2020); an adversary interacting with a pretrained model can extract individual sequences that were used to train the model.
|
| 17 |
+
|
| 18 |
+
While current attacks are effective, they only represent a lower bound on how much memorization occurs in existing models. For example, by querying the GPT-2 language model, Carlini et al. (2020) (manually) identified just 600 memorized training examples out of a 40GB training dataset. This attack establishes a (loose) lower bound that at least $0 . 0 0 0 0 0 0 0 1 5 \%$ of the dataset is memorized. In contrast, we are able to show that the 6 billion parameter GPT-J model (Black et al., 2021; Wang and Komatsuzaki, 2021) memorizes at least $1 \%$ of its training dataset: The Pile (Gao et al., 2020).
|
| 19 |
+
|
| 20 |
+
In addition to prior work’s loose estimates of models’ memorization capabilities, there is a limited understanding of how memorization varies across different neural language models and datasets of different scales. Prior studies of memorization in language models either focus on models or datasets of a fixed size (Carlini et al., 2019; Zhang et al., 2021; Thakkar et al., 2020) or identify a narrow memorization-versus-scale relationship (Carlini et al., 2020; Lee et al., 2021). While McCoy et al. (2021) broadly study the extent to which language models memorize, their focus is on how to avoid the problem and ensure novelty of model outputs, rather than on studying model risk through identifying the maximal amount of data memorization.
|
| 21 |
+
|
| 22 |
+
This paper addresses both of the above open questions by comprehensively quantifying memorization across three families of neural language models and their associated datasets. We leverage access to each model’s original training set to provide order-of-magnitude more precise bounds on the amount of extractable data that an adversary could recover than in prior works.
|
| 23 |
+
|
| 24 |
+
We first construct a set of prompts from the model’s training set. By feeding prefixes of these prompts into the trained model, we check whether the model has the ability to complete the rest of the example verbatim. This allows us to measure memorization across models, datasets, and prompts of varying sizes. We identify three properties that significantly impact memorization:
|
| 25 |
+
|
| 26 |
+
1. Model scale: Within a model family, larger models memorize $2 { - } 5 \times$ more than smaller models.
|
| 27 |
+
2. Data duplication: Examples repeated more often are more likely to be extractable.
|
| 28 |
+
3. Context: It is orders of magnitude easier to extract sequences when given a longer context.
|
| 29 |
+
|
| 30 |
+
Our analysis suggests that future research on neural language modeling will need to take steps to prevent future (larger) models from memorizing their training datasets.
|
| 31 |
+
|
| 32 |
+
# 2 RELATED WORK
|
| 33 |
+
|
| 34 |
+
There is extensive prior work that qualitatively studies memorization in neural language models. Prior work has demonstrated extraction attacks that recover memorized data including URLs, phone numbers, and other personal information (Carlini et al., 2020; Ziegler, 2021)—or synthetically injected “canaries” (Carlini et al., 2019; Henderson et al., 2018; Thakkar et al., 2020; Thomas et al., 2020). However most of these works are qualitative and aim to demonstrate the existence of extractable data, rather than precisely quantifying how much models memorize. For example, the unprompted memorization evaluation of Carlini et al. (2020) found just 600 examples of memorization in GPT-2. Our paper aims to establish tighter bounds on the fraction of a dataset that is memorized.
|
| 35 |
+
|
| 36 |
+
Our analysis is relevant to the broad literature on privacy attacks on machine learning. For example, membership inference attacks (Shokri et al., 2017; Yeom et al., 2018) let an adversary detect the presence of a given example in a model’s training set; other forms of data leakage let an adversary learn dataset properties (Ganju et al., 2018; Fredrikson et al., 2015). We focus on extraction attacks due to their relevance for language modeling—extraction implies significant leakage from a model, and grows with data duplication (Lee et al., 2021), a common feature of large-scale text datasets.
|
| 37 |
+
|
| 38 |
+
Various definitions of memorization in deep neural networks have been studied in prior work (Carlini et al., 2019; 2020; Feldman and Zhang, 2020; Zhang et al., 2021). A detailed comparison with those existing formulations is presented in Section 3.1. One leading general memorization definition is differential privacy (Dwork et al., 2006), which formalizes the idea that removing any one example from the training set should not change the trained model. However, while differential privacy protects a single user’s private information, it is ineffective for preventing memorization of highly duplicated data, and does not capture the complexity of social, linguistic data (Brown et al., 2022). Also, differentially private learning algorithms (Abadi et al., 2016) generally suffer from expensive computation, slow convergence, and poor model utility, despite recent advances (Anil et al., 2021).
|
| 39 |
+
|
| 40 |
+
In concurrent work, Kandpal et al. (2022) study how often models emit memorized data as a function of data duplication. Their analysis focuses on evaluating why training data extraction attacks succeed. In contrast, we explicitly prompt models with training data prefixes in order to measure memorization in the worst case, something that a practical attack cannot necessarily do.
|
| 41 |
+
|
| 42 |
+
Prior scaling hypotheses. Our motivation to study scaling phenomena stems from anecdotal evidence in prior work that memorization ability relates to various aspects of scale. In particular, our analysis on model scale is informed by preliminary experiments in (Zhang et al., 2017; Carlini et al., 2020), our data duplication experiments follow in the line of Lee et al. (2021), and our context length experiments build on hypotheses by Carlini et al. (2020); Ziegler (2021).
|
| 43 |
+
|
| 44 |
+
# 3 METHODOLOGY
|
| 45 |
+
|
| 46 |
+
# 3.1 DEFINITION OF MEMORIZATION
|
| 47 |
+
|
| 48 |
+
To begin, we first select a precise definition for memorization:
|
| 49 |
+
|
| 50 |
+
Definition 3.1. A string $s$ is extractable with $k$ tokens of context from a model $f$ if there exists a (length- $k$ ) string $p$ , such that the concatenation $\left[ p \mid \mid s \right]$ is contained in the training data for $f$ , and $f$ produces $s$ when prompted with $p$ using greedy decoding.
|
| 51 |
+
|
| 52 |
+
For example, if a model’s training dataset contains the sequence “My phone number is 555-6789”, and given the length $k = 4$ prefix “My phone number is”, the most likely output is “555-6789”, then this sequence is extractable (with 4 words of context). We focus on greedy sampling in this paper, and verify in Section 4.1 that our choice of decoding strategy does not significantly impact our results.
|
| 53 |
+
|
| 54 |
+
While prior work proposed other definitions, we prefer ours in this paper as it is more actionable. Some memorization definitions, including lower-bounds on differential privacy (Dwork et al., 2006; Jagielski et al., 2020; Nasr et al., 2021) or counterfactual memorization (Feldman and Zhang, 2020; Zhang et al., 2021), require training hundreds or thousands of models, which is impractical for large language models. Alternatively, computing exposure (Carlini et al., 2019) requires thousands of generations per sequence, and is only designed for carefully crafted training examples.Finally, $k$ -eidetic memorization (Carlini et al., 2020), is a useful definition for unprompted memorization, but less useful for tightly bounding memorization by prompting with training data (as we will do). Future work might explore how our three scaling observations apply to other definitions of memorization.
|
| 55 |
+
|
| 56 |
+
# 3.2 SELECTION OF EVALUATION DATA
|
| 57 |
+
|
| 58 |
+
Having chosen a definition, we next describe our evaluation procedure. Ideally, we would consider every sequence $x = [ p \mid \mid s ]$ in the model’s training dataset (where $x$ has been split into a length- $k$ prefix $p$ and a suffix $s$ ). For each sequence, we would report if the model exactly reproduces $s$ when prompted with $p$ , following Definition 3.1. Unfortunately, performing this test on every sequence in the training data would be prohibitively expensive. For example, the largest 6 billion parameter GPT-Neo model has a throughput of roughly one 100-token generation per second on a V100 GPU. Extrapolating to the 800GB training dataset, this would require over 30 GPU-years of compute.
|
| 59 |
+
|
| 60 |
+
Instead, we query on a smaller subset of the training data, that still produces statistically confident estimates. In this paper we randomly choose subsets of roughly 50,000 sequences, allowing us to efficiently run inference in just a few hours. The primary criteria when choosing a subset of the training data is to obtain a representative sample that allows us to draw meaningful conclusions from the data. We consider two approaches to constructing a subset of the data.
|
| 61 |
+
|
| 62 |
+
Our first subset is a uniformly random sample of 50,000 sequences, drawn from the training dataset without repetition. While a uniform sample is useful to estimate the absolute amount of memorization in a model, it is poorly suited for studying how memorization scales with data properties that are not uniformly represented in the training set. For example, prior work has identified that data duplication (i.e., how often the same sequence is repeated either exactly or approximately) is an important factor for memorization. Yet, because the frequency of training data duplication decays extremely quickly (Lee et al., 2021), a uniformly random sample of 50,000 sequences (accounting for $\leq 0 . 0 \dot { 2 } \%$ of the dataset) is unlikely to contain any signal that would allow us to accurately measure the tail of this repeated data distribution. A similar concern arises for measuring how memorization scales with prompt length, since very long sentences account for only a small fraction of the training set.
|
| 63 |
+
|
| 64 |
+
Therefore, our second subset is a random sample normalized by both sequence lengths and duplication counts, which allows us to accurately measure memorization of large language models in the worst-case, on highly duplicated data with long prompts. For each sequence length $\ell \in \{ 5 0 , 1 0 0 , 1 5 0 , \ldots , 5 0 0 \}$ , and integer $n$ , we select 1,000 sequences of length $\ell$ that are contained in the training dataset between $2 ^ { n / 4 }$ and $2 ^ { ( n + 1 ) / 4 }$ times. We do this until we reach an $n$ for which 1,000 sequences are not available. This gives us 1,000 sequences that repeat between 6 and 8 times $( \approx 2 ^ { 1 1 / 4 }$ and $\approx 2 ^ { 1 2 / 4 }$ ) and also 1,000 sequences that repeat between 724 and 861 times $( \approx 2 ^ { 3 8 / 4 }$ and $\approx 2 ^ { 3 9 / 4 }$ ). This biased sampling allows us to more accurately measure memorization as a function of a sample’s duplication factor and prompt length, without querying the entire dataset. Note that constructing this duplicate-normalized data subset requires some work, as efficiently identifying duplicate substrings in an 800GB training dataset is computationally challenging. We make use of the suffix array construction from Lee et al. (2021) (see Appendix).
|
| 65 |
+
|
| 66 |
+
For each length from 50 to 500 tokens, we collect 50,000 examples duplicated varying numbers of times, totaling roughly 500,000 sequences. For each sequence of length $\ell$ , we prompt the model with the first $\ell - 5 0$ tokens and report the sequence as “extractable” if the model exactly emits the next 50 token suffix of this sequence. Fifty tokens corresponds to an average of 127 characters or 25 wordsin the GPT-Neo training set, well over the length of a typical English sentence. Finally, we compute the average probability that a sequence is extractable by averaging over all lengths $\ell$ .
|
| 67 |
+
|
| 68 |
+

|
| 69 |
+
Figure 1: We prompt various sizes of GPT-Neo models (green) with data sampled from their training set—The Pile, and normalized by sequence lengths and duplication counts. As a baseline (yellow), we also prompt the GPT-2 family of models with the same Pile-derived prompts, even though these models were trained on WebText, a different training dataset. (a) Larger models memorize a larger fraction of their training dataset, following a log-linear relationship. This is not just a result of better generalization, as shown by the lack of growth for the GPT-2 baseline models. (b) Examples that are repeated more often in the training set are more likely to be extractable, again following a log-linear trend (baseline is GPT-2 XL). (c) As the number of tokens of context available increases, so does our ability to extract memorized text (baseine is GPT-2 XL).
|
| 70 |
+
|
| 71 |
+
# 4 EXPERIMENTS
|
| 72 |
+
|
| 73 |
+
We primarily study the GPT-Neo model family (Black et al., 2021; Wang and Komatsuzaki, 2021) trained on the Pile dataset (Gao et al., 2020). The GPT-Neo models are causal language models trained with the objective of predicting the next token in a sequence given the previous ones. They come in four sizes: 125 million, 1.3 billion, 2.7 billion and 6 billion parameters.1 The Pile is a dataset of 825GB of text collected from various sources (e.g., books, Web scrapes, open source code). Prior to the recent release of OPT (Zhang et al., 2022), the GPT-Neo models were the largest language models available for public download, and The Pile is the largest public text dataset available.
|
| 74 |
+
|
| 75 |
+
# 4.1 BIGGER MODELS MEMORIZE MORE
|
| 76 |
+
|
| 77 |
+
We begin by considering the impact of model size on memorization, expanding on prior studies which qualitatively established a relationship between the size of GPT-2 models and their ability to memorize $< 3 0$ URLs (Carlini et al., 2020). In contrast, we study a million model generations in order to describe how model scale relates to memorization.
|
| 78 |
+
|
| 79 |
+
Results. We first study our biased random data sample normalized by duplication count and sequence lengths. The results of this experiment are given in Figure 1a. The y-axis reports the fraction of generations which exactly reproduce the true suffix for their prompt, averaged over all prompt and sequence lengths in our evaluation set. Because our biased sampling over-represents duplicated strings, the absolute degree of memorization in Figure 1a is not particularly important here—rather, we are interested in how memorization varies with scale.2 We find that larger models memorize significantly more than smaller models do, with a near-perfect log-linear fit ( $R ^ { 2 }$ of $9 9 . 8 \%$ ): a ten fold increase in model size corresponds to an increase in memorization of 19 percentage points.
|
| 80 |
+
|
| 81 |
+
To confirm that larger models are indeed memorizing more data, and not simply generalizing better, we repeat the analysis with the GPT-2 model family as a baseline. The GPT-2 models are similarly sized, and also trained on Internet-scraped data. If our “larger models memorize more” result was due to the predictive strength of larger models, and not the memorization of specific training data, we would expect a similar relationship between comparably sized GPT-2 models trained on similar data. Put differently, this baseline allows to establish what fraction of the training data is sufficiently “easy” that any language model can correctly predict the 50-token suffix, even if the example has not been seen during training. For example, a language model trained on multiple examples of number sequences can likely correctly complete some other unseen number sequences. We find that GPT-2 correctly completes approximately $6 \%$ of the examples in our evaluation set, compared to $4 0 \%$ for the similarly sized 1.3B parameter GPT-Neo model. A qualitative analysis (see examples in Appendix Figure 15) suggests that examples “memorized” by GPT-2 are largely uninteresting sequences (e.g., number sequences, repetitions of the same few tokens, or common phrases). Therefore, we conclude that larger models have a higher fraction of extractable training data because they have actually memorized the data; it is not simply that the larger models are more accurate.
|
| 82 |
+
|
| 83 |
+
# 4.2 REPEATED STRINGS ARE MEMORIZED MORE
|
| 84 |
+
|
| 85 |
+
Prior work provides preliminary evidence that memorization in language models increases with the number of times sequences are repeated in the training set (Carlini et al., 2020; Lee et al., 2021). We expand on this observation and quantitatively measure the effect of data duplication on memorization. Using our duplication-normalized data sample, we measure the fraction of sequences which are extractable, for buckets of sequences duplicated between 2 and 900 times. Each bucket consists of 1,000 distinct sentences, and we compute the average amount of memorization for each bucket.
|
| 86 |
+
|
| 87 |
+
Results. Figure 1b shows our results, aggregated over all sequence lengths. We observe a clear log-linear trend in memorization. While models rarely regurgitate strings that are repeated only a few times, this probability increases severely for highly duplicated strings. The small memorization values at low numbers of repetitions corroborates the positive impact of training dataset deduplication on memorization observed by Lee et al. (2021). However, we find that memorization does still happen, even with just a few duplicates—thus, deduplication will not perfectly prevent leakage. While this relationship is perhaps obvious, and has been corroborated for specific training examples in prior work (Carlini et al., 2019; 2020), our results show that it holds across the entire training set.
|
| 88 |
+
|
| 89 |
+
# 4.3 LONGER CONTEXT DISCOVERS MORE MEMORIZATION
|
| 90 |
+
|
| 91 |
+
The previous two questions evaluated how data collection and model training decisions impact the leakage of a model’s training data when it is provided a fixed number of tokens from a sequence as context. As a result, those experiments suggest particular actions that could be taken to mitigate memorization (by reducing model size, or limiting the number of duplicate examples).
|
| 92 |
+
|
| 93 |
+
However, even when the model is fixed, it is possible to vary the amount of extractable training data by controlling the length of the prefix passed to the model. By studying how the number of tokens of context impacts extractability, we demonstrate the difficulty of discovering memorization—language models may only exhibit their memorization under favorable conditions.
|
| 94 |
+
|
| 95 |
+
Results. In Figure 1c, we observe that the fraction of extractable sequences increases log-linearly with the number of tokens of context. For example, $33 \%$ of training sequences in our evaluation set are extractable from the 6B model at 50 tokens of context, compared to $65 \%$ with 450 tokens of context. We call this the discoverability phenomenon: some memorization only becomes apparent under certain conditions, such as when the model is prompted with a sufficiently long context.
|
| 96 |
+
|
| 97 |
+
The discoverability phenomenon may seem natural: conditioning a model on 100 tokens of context is more specific than conditioning the model on 50 tokens of context, and it is natural that the model would estimate the probability of the training data as higher in this situation. However, the result is that some strings are “hidden” in the model and require more knowledge than others to be extractable.
|
| 98 |
+
|
| 99 |
+
From one point of view, it is good that some memorization is difficult to discover. This makes it harder for attackers to perform training data extraction attacks (Carlini et al., 2020), or otherwise exploit memorization. Indeed, if an exact 100 token prompt is required to make the model output a given string, then, in practice, an adversary will likely be unable to perform the attack. The difficulty in discovering memorization also reduces the likelihood of non-adversarial training data regurgitation. For example, the GitHub Copilot model (Chen et al., 2021) reportedly rarely emits memorized code in benign situations, and most memorization occurs only when the model has been prompted with long code excerpts that are very similar to the training data (Ziegler, 2021). Practitioners building language generation APIs could (until stronger attacks are developed) significantly reduce extraction risk by restricting the maximum prompt length available to users.
|
| 100 |
+
|
| 101 |
+

|
| 102 |
+
Figure 2: (a) Fraction of sequences extracted as a function of model scale where we sample uniformly from the training set. (b) Fraction of sequences extracted as we vary the length of the prompt. For each sequence length $n$ , $n { - } 5 0$ tokens are used as the prefix, and we check for extraction of the remaining 50 tokens. (c-left) Using beam search with $\scriptstyle b = 1 0 0$ slightly increases the data extracted. (c-right) We observe considerably more memorization when checking whether the generated sequence occurs anywhere in the entire training set (Section C). However, this approach is very computationally expensive so we do not use it for our other experiments.
|
| 103 |
+
|
| 104 |
+
Viewed differently, however, the difficulty of discovering memorization can also harm our ability to audit privacy in machine learning models. Because provably-correct approaches for privacypreserving training of machine learning models are applied only rarely in practice (Abadi et al., 2016; Thakkar et al., 2020; Ramaswamy et al., 2020), it is common to attempt post-hoc privacy auditing (Jayaraman and Evans, 2019; Jagielski et al., 2020; Nasr et al., 2021). Our results suggest that correctly auditing large language models likely requires prompting the model with training data, as there are no known techniques to identify the tail of memorized data without conditioning the model with a large context. Improving upon this limitation is an interesting problem for future work.
|
| 105 |
+
|
| 106 |
+
# 4.4 ALTERNATE EXPERIMENTAL SETTINGS
|
| 107 |
+
|
| 108 |
+
In this section, we briefly review other strategies that we could have used to quantify memorization.
|
| 109 |
+
|
| 110 |
+
Random dataset sampling. The majority of this paper uses subsets of the training data that were explicitly sampled according to training data duplication frequency. Now, we consider how our results would differ if we chose a truly random subset of the training data, where each sequence is sampled uniformly, instead of sampling a duplicate-normalized dataset. Specifically, we randomly sample 100,000 sequences of varying lengths from The Pile dataset, then prompt the model and test for memorization as before (more details in Appendix C).
|
| 111 |
+
|
| 112 |
+
Figure 2a and Figure 2b present the results. We observe similar qualitative trends with model scale and context length as in Figure 1. Larger models memorize more training examples than smaller models—and much more than the GPT-2 models that were not trained on The Pile. Similarly, providing more context to a model increases the likelihood we discover memorization. We can extract the last 50 tokens of a length-1000 sequence with $7 \%$ probability for the largest GPT-J 6B model, compared to $4 \%$ probability for the smallest 125M GPT-Neo model. (And both of these are much larger than the $2 \%$ probability of extraction for the 1.5B parameter GPT2-XL model.) These results, taken together, allow us to estimate a lower bound that there is at least $1 \%$ of The Pile dataset that is extractable by the 6B GPT-J model, but not by GPT-2 XL.
|
| 113 |
+
|
| 114 |
+
Alternate decoding strategies. We have defined memorization as a model’s ability to generate the true continuation when choosing the most likely token at every step of decoding. Yet, this greedy decoding strategy does not produce the overall most likely sequence. Many language model applications use other decoding strategies, such as beam search to find the generation with highest likelihood. To understand how our choice of decoding strategy affects the amount of memorization we measure, we compare greedy decoding with beam search in Figure 2(c). We find that using beam search with 100 beams results in marginally more extracted memorization. The difference in extractable memorization is just under 2 percentage points on average, with a maximum of $5 . 6 \%$ Interestingly, beam search and greedy decoding generated the same output $45 \%$ of the time.
|
| 115 |
+
|
| 116 |
+
Figure 3: Text examples that are memorized by the 6B model, but not by smaller models. Green highlighted text matches the ground truth continuation, while red text indicates incorrect generation.
|
| 117 |
+
|
| 118 |
+
<table><tr><td rowspan=1 colspan=1>Prompt</td><td rowspan=1 colspan=1>Continuation (== 6B)</td><td rowspan=1 colspan=2>2.7B</td><td rowspan=1 colspan=1>1.3B</td><td rowspan=1 colspan=1>125M</td></tr><tr><td rowspan=1 colspan=1>Gallery "Though defensive violence will</td><td rowspan=1 colspan=1>condemned as ridiculous,and</td><td rowspan=1 colspan=2>condemned as ridiculous,and then</td><td rowspan=1 colspan=1>tried inthe mind of achild</td><td rowspan=1 colspan=1>and foremostaman's dutyto</td></tr><tr><td rowspan=3 colspan=1>always be'a sad necessity'in the eyesof men of principle, it would be stillmore unfortunate if wrongdoers shoulddominate just men."- St.Augustine "Anew idea is first</td><td rowspan=2 colspan=1>thendismissedastrivial,utilfinally it becomes what everybodyknows."-William James "This istherealtaskbefore us:toreassert</td><td rowspan=2 colspan=2>dismissedastivial,bforengacceptedas the mostimportant thingin the world.George Bernard</td><td rowspan=3 colspan=1>and then it is tried in themind of a man."- ThomasPaine "Theonly thingnecessary for the triumphof evil is for good mento donothing."- Edmund Burke"</td><td rowspan=3 colspan=1>his fellow man.It isa duty tobea manof principleandto beaman ofprinciple,andtobeaman ofprinciple,andtobeaman ofprinciple,and tobea</td></tr><tr><td rowspan=1 colspan=1>acceptedas the mostimportant thingin the world.George Bernard</td></tr><tr><td rowspan=1 colspan=1>therealtaskbefore us:toreassertourcommitmentasanation toalaw higher than our own,</td><td rowspan=1 colspan=2>Shaw"The ultimate measure of a manis not where he standsin moments ofcomfort and convenience,but where</td><td rowspan=1 colspan=1>aman</td></tr><tr><td rowspan=2 colspan=1>_GPL(crypto_unregister_alg); intcrypto_register_template(structcrypto_template *tmpl){structcrypto_template *q; interr=-EIS;</td><td rowspan=2 colspan=1>down_write(&crypto_alg_sem);list_for_each_entry(q,&cryptotemplatelist,istif==tmpl)</td><td rowspan=1 colspan=2>list_for_each_entry(q,&cryptoag_list,list){if(tmp-</td><td rowspan=2 colspan=1>q = kzalloc(sizeof(*q),GFP_KERNEL); if(q)goto out; q->alg=tmpl->alg;q->base</td><td rowspan=2 colspan=1>stuctcrypto_template*tmpl=crypto_template_new(tmpl);if (err)returemp->tmpl = q;tmpl->tmpl->tm</td></tr><tr><td rowspan=1 colspan=2>>name&& tmpl->name!= q->alg.cra_name)</td></tr></table>
|
| 119 |
+
|
| 120 |
+
The most common decoding strategy employed by modern LMs is random sampling, where the next token is selected at random according to a probability distribution derived from the model’s predictions. McCoy et al. (2021) found that random sampling resulted in generated text with a greater number of novel $n$ -grams. Since the goal of our study is to maximize discoverability—an antithetical goal to maximizing linguistic novelty—we do not present experiments that use random sampling.
|
| 121 |
+
|
| 122 |
+
Alternate definition of extractability. Our main experiments report a sequence as “extractable” if the model’s generation is identical to the true suffix of the considered training example. However it is possible this suffix is still present (elsewhere) in the dataset. We now consider a loose lower bound on memorization that considers a sequence memorized if the generation $[ p | | f ( p ) ]$ from a prompt $p$ is contained anywhere in the training dataset. Searching within the entire dataset finds more memorized content than comparing with the ground truth (Figure 2c). For examples at 100 repetitions, $3 2 . 6 \%$ of outputs are contained somewhere in the dataset but just $1 5 . 8 \%$ match the ground truth continuation.
|
| 123 |
+
|
| 124 |
+
# 4.5 QUALITATIVE EXAMPLES OF MEMORIZATION
|
| 125 |
+
|
| 126 |
+
In Figure 3, we present qualitative examples that are only memorized by the largest (6B) model, but not the smaller ones. We highlight some interesting patterns in these sequences: while the generations from the smaller models do not match the training data, they are generally thematically-relevant and locally consistent. However, a closer inspection reveals that those generations are only syntactically sound, but semantically incorrect. Appendix Figure 8 shows further examples of sequences that are memorized by all the models. We found most of these universally-memorized sequences to be “unconventional” texts such as code snippets or highly duplicated texts such as open source licenses. Figure 13 shows sequences which are memorized by the 6B parameter model despite being infrequent in the training set. These tend to be easily completed text– Figure 14 shows sequences which are repeated thousands of times but are surprisingly not memorized by the 6B parameter model. Many of these are mostly correctly completed, only differing on semantically unimportant characters.
|
| 127 |
+
|
| 128 |
+
# 5 REPLICATION STUDY
|
| 129 |
+
|
| 130 |
+
The above analysis provides evidence that memorization scales log-linearly with model size, data duplicates, and context length. We now replicate this analysis for other language models trained with different datasets and training objectives, namely: (1) the T5 family of models trained on the C4 dataset (Raffel et al., 2020), (2) models from Lee et al. (2021), trained on a deduplicated version of C4, and (3) the OPT family of models (Zhang et al., 2022), also trained on the Pile. We expected our results to cleanly generalize across settings, and this is indeed true for model scale. Yet, the situation is more complicated when considering data duplication, due to training set idiosyncrasies.
|
| 131 |
+
|
| 132 |
+

|
| 133 |
+
Figure 4: (a) Masked language model objective: Larger models have a higher fraction of sequences extractable on T5. (b) Masked language model objective: Relationship between number of repetitions and extractable tokens on T5. (c) Causal language model objective: Relationship between number of repetitions and memorization on language models trained with deduplicated data.
|
| 134 |
+
|
| 135 |
+
# 5.1 T5 MASKED LANGUAGE MODELING
|
| 136 |
+
|
| 137 |
+
Model and dataset. The T5 v1.1 models are masked encoder-decoder models trained to reproduce randomly deleted spans from an input sequence. The models vary in size from 77M to 11B billion parameters, and are trained on C4—a 806 GB curated version of English web pages from the Common Crawl. The largest T5 model (11B parameters) is the largest publicly available masked language model. T5 models are thus good candidates for studying how memorization scales with model size.
|
| 138 |
+
|
| 139 |
+
We must first define what is meant by “extractable data” for the masked language modeling task. T5 models are trained by removing a random $1 5 \%$ of tokens from each training sequence (i.i.d), and the model must then “fill in the blanks” to restore the tokens that were dropped from the input. As a result of this different training objective, Definition 3.1 is not directly applicable: the model does not operate on a prefix and output a suffix. We instead call a sequence memorized if the model perfectly solves the masked language modeling task on that sequence. For example, we call a 200-token sequence memorized if the model can use the 170 $( = 2 0 0 \cdot 0 . 8 5 )$ ) tokens of context to perfectly predict the remaining 30 tokens $( = 2 0 0 \cdot 0 . 1 5 )$ . Because this token-dropping procedure is stochastic, it is possible that one set of dropped tokens might yield an output of “memorized” and another might not. For simplicity, we inspect only one set of masked tokens per sequence; because we are already averaging over 50,000 sequences this additional randomness does not harm the results of our analysis.
|
| 140 |
+
|
| 141 |
+
Results. In Figure 4a, we reproduce the model scaling effect (from Figure 1a) for T5 models. Larger models similarly have an increased ability to perfectly solve the masked prediction task. Surprisingly, while a scaling trend does hold here as well, the absolute memorization in masked models is an order of magnitude lower than for comparably sized causal language models. For example, the 3B parameter T5-XL model memorizes $3 . { \bar { 5 } } \%$ of sequences repeated 100 times, whereas the GPT-Neo 2.7B model memorizes $5 3 . 6 \%$ of sequences repeated 100 times (with 150 tokens of context).
|
| 142 |
+
|
| 143 |
+
Next, we turn to reproducing the analysis of how memorization scales with data duplication. The situation here becomes significantly less clear. As shown in Figure 4b, sequences duplicated more often tend to be easier to memorize, but there is no monotonic scaling relationship. Compared to the case of the GPT-Neo models trained on The Pile, the relation between data duplication counts and memorization for T5 models trained on C4 exhibits large variance. This variance is statistically significant: sequences repeated 159 to 196 times are memorized with probability less than $5 . 1 \%$ with $9 9 . 7 \%$ confidence (three standard deviations from the mean), however sequences repeated 138 to 158 times (that is, less often) are memorized with probability at least $6 . 2 \%$ (also with $9 9 . 7 \%$ confidence). That is, for some reason, sequences that occur ${ \sim } 1 4 0$ times are more likely to be memorized, despite occurring less often, even if we assume a three-sigma error in both measurements simultaneously.
|
| 144 |
+
|
| 145 |
+
In order to explain this counter-intuitive phenomenon, we qualitatively study each of these two buckets of examples to understand this difference. We find that most of the duplicate examples repeated 138-158 times consist mainly of whitespace tokens. These sequences are thus much easier to predict correctly than other sequences, even if they are repeated more often. This effect, to a lesser extent, can be found in other buckets which contain many approximately near duplicates.
|
| 146 |
+
|
| 147 |
+
# 5.2 LANGUAGE MODELS TRAINED ON DEDUPLICATED DATA
|
| 148 |
+
|
| 149 |
+
Model and dataset. The models used in Lee et al. (2021) are 1.5B parameter causal language models. This model family consists of one model trained on C4 (the same dataset as T5), one model trained on a version of C4 that was deduplicated by removing all documents which were near-duplicates of other documents, and one model trained on a version of C4 that was deduplicated by deleting any string of length-50 tokens that occurred more than once. Lee et al. (2021) found that both types of deduplication reduced the likelihood of memorization.
|
| 150 |
+
|
| 151 |
+
Results. We were most interested in whether models trained on deduplicated data would still exhibit increased memorization of examples which were repeated frequently in the original, non-deduplicated C4 dataset (e.g., because the deduplication missed some near-duplicates). Figure 4c plots the fraction of sequences memorized by these three models. We draw two interesting conclusions from this data.
|
| 152 |
+
|
| 153 |
+
First, we confirm that models trained on deduplicated datasets memorize less data than models trained without deduplication. For example, for sequences repeated below 35 times, the exact deduplicated model memorizes an average of $1 . 2 \%$ of sequences, compared to $3 . 6 \%$ without deduplication, a statistically significant $\left( p < 1 0 ^ { - 1 5 } \right.$ ) decrease by a factor of $3 \times$ . Second, while deduplication does help for sequences repeated up to ${ \sim } 1 0 0$ times, it does not help for sequences repeated more often! The extractability of examples repeated at least 408 times is statistically significantly higher than any other number of repeats before this. We hypothesize that this is due to the fact that any deduplication strategy is necessarily imperfect in order to efficiently scale to hundreds of gigabytes of training data. Thus, while it may be possible to remove most instances of duplicate data, different and valid definitions of duplicates can mean deduplication is not exhaustive.
|
| 154 |
+
|
| 155 |
+
# 5.3 LANGUAGE MODELS TRAINED ON A MODIFIED VERSION OF THE PILE
|
| 156 |
+
|
| 157 |
+
Model and dataset. We finally study the OPT family of models (Zhang et al., 2022), that vary from 125 million to 175 billion parameters.3 These models were trained on a 800GB dataset that overlaps with The Pile but is not identical and contains data from many new sources, while also removing some data from the Pile. This dataset was also deduplicated prior to training, and so we do not expect to see duplicate sequences memorized (much) more than sequences repeated only a few times.
|
| 158 |
+
|
| 159 |
+
Results. Overall, we find that while there are nearly identical scaling trends to those we found for GPT-Neo’s model family, the effect size is orders-of-magnitude smaller (figure 7). Even the 66 billion parameter model memorizes a smaller fraction of The Pile than the smallest 125 million parameter GPT Neo model. This suggests two possible conclusions: (a) careful data curation and training can mitigate memorization, or (b) even slight shifts in data distribution can significantly alter what content gets memorized. Without direct access to the original training dataset, we can not distinguish between these two conclusions and hope future work will be able to resolve this question.
|
| 160 |
+
|
| 161 |
+
# 6 CONCLUSION
|
| 162 |
+
|
| 163 |
+
Our paper presents the first comprehensive quantitative analysis of memorization in large language models, by re-processing the training set to find memorized data. Our work has two broad conclusions.
|
| 164 |
+
|
| 165 |
+
For the study of generalization, we have shown that while current LMs do accurately model the statistics of their training data, this need not imply that they faithfully model the desired underlying data distribution. In particular, when the training data distribution is skewed (e.g., by containing many duplicates of some sequences) larger models are likely to learn these unintended dataset peculiarities. It is therefore important to carefully analyze the datasets used to train ever larger models, as future (larger) models are likely to remember even more training details than current (smaller) models.
|
| 166 |
+
|
| 167 |
+
For the study of privacy, our work indicates that current large language models memorize a significant fraction of their training datasets. Memorization scales log-linear with model size—by doubling the number of parameters in a model we can extract a significantly larger fraction of the dataset. Given that current state-of-the-art models contain more than $2 0 0 \times$ as many parameters as the largest 6B parameter model we analyze, it is likely that these even larger models memorize many sequences that are repeated just a handful of times. At the same time, we have shown that this memorization is often hard to discover, and for an attack to actually extract this data it will be necessary to develop qualitatively new attack strategies. Fortunately, it appears that (for the comparatively small models we study) training data inserted just once is rarely memorized, and so deduplicating training datasets (Lee et al., 2021) is likely a practical technique to mitigate the harms of memorization.
|
| 168 |
+
|
| 169 |
+
# REFERENCES
|
| 170 |
+
|
| 171 |
+
Martin Abadi, Andy Chu, Ian Goodfellow, H Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. Deep learning with differential privacy. In Proceedings of the 2016 ACM SIGSAC conference on computer and communications security, pages 308–318, 2016.
|
| 172 |
+
|
| 173 |
+
Rohan Anil, Badih Ghazi, Vineet Gupta, Ravi Kumar, and Pasin Manurangsi. Large-scale differentially private BERT. arXiv preprint arXiv:2108.01624, 2021.
|
| 174 |
+
|
| 175 |
+
Sid Black, Leo Gao, Phil Wang, Connor Leahy, and Stella Biderman. GPT-Neo: Large Scale Autoregressive Language Modeling with Mesh-Tensorflow, March 2021. URL https://doi.org/ 10.5281/zenodo.5297715. If you use this software, please cite it using these metadata.
|
| 176 |
+
|
| 177 |
+
Hannah Brown, Katherine Lee, Fatemehsadat Mireshghallah, Reza Shokri, and Florian Tramèr. What does it mean for a language model to preserve privacy?, 2022.
|
| 178 |
+
|
| 179 |
+
Nicholas Carlini, Chang Liu, Úlfar Erlingsson, Jernej Kos, and Dawn Song. The secret sharer: Evaluating and testing unintended memorization in neural networks. In USENIX Security Symposium, 2019.
|
| 180 |
+
|
| 181 |
+
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 arXiv:2012.07805, 2020.
|
| 182 |
+
|
| 183 |
+
Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021.
|
| 184 |
+
|
| 185 |
+
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.
|
| 186 |
+
|
| 187 |
+
William Fedus, Barret Zoph, and Noam Shazeer. Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity. arXiv preprint arXiv:2101.03961, 2021.
|
| 188 |
+
|
| 189 |
+
Vitaly Feldman and Chiyuan Zhang. What neural networks memorize and why: Discovering the long tail via influence estimation. In Advances in Neural Information Processing Systems, 2020.
|
| 190 |
+
|
| 191 |
+
Matt Fredrikson, Somesh Jha, and Thomas Ristenpart. Model inversion attacks that exploit confidence information and basic countermeasures. In Proceedings of the 22nd ACM SIGSAC conference on computer and communications security, pages 1322–1333, 2015.
|
| 192 |
+
|
| 193 |
+
Karan Ganju, Qi Wang, Wei Yang, Carl A Gunter, and Nikita Borisov. Property inference attacks on fully connected neural networks using permutation invariant representations. In Proceedings of the 2018 ACM SIGSAC conference on computer and communications security, pages 619–633, 2018.
|
| 194 |
+
|
| 195 |
+
Leo Gao, Stella Biderman, Sid Black, Laurence Golding, Travis Hoppe, Charles Foster, Jason Phang, Horace He, Anish Thite, Noa Nabeshima, et al. The Pile: An 800GB dataset of diverse text for language modeling. arXiv preprint arXiv:2101.00027, 2020.
|
| 196 |
+
|
| 197 |
+
Peter Henderson, Koustuv Sinha, Nicolas Angelard-Gontier, Nan Rosemary Ke, Genevieve Fried, Ryan Lowe, and Joelle Pineau. Ethical challenges in data-driven dialogue systems. In Proceedings of the 2018 AAAI/ACM Conference on AI, Ethics, and Society, pages 123–129, 2018.
|
| 198 |
+
|
| 199 |
+
Matthew Jagielski, Jonathan Ullman, and Alina Oprea. Auditing differentially private machine learning: How private is private SGD? arXiv preprint arXiv:2006.07709, 2020.
|
| 200 |
+
|
| 201 |
+
Bargav Jayaraman and David Evans. Evaluating differentially private machine learning in practice. In 28th {USENIX} Security Symposium ({USENIX} Security 19), pages 1895–1912, 2019.
|
| 202 |
+
|
| 203 |
+
Nikhil Kandpal, Eric Wallace, and Colin Raffel. Deduplicating training data mitigates privacy risks in language models. arXiv preprint arXiv:2202.06539, 2022.
|
| 204 |
+
|
| 205 |
+
Katherine Lee, Daphne Ippolito, Andrew Nystrom, Chiyuan Zhang, Douglas Eck, Chris CallisonBurch, and Nicholas Carlini. Deduplicating training data makes language models better. CoRR, abs/2107.06499, 2021. URL https://arxiv.org/abs/2107.06499.
|
| 206 |
+
|
| 207 |
+
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. CoRR, abs/2111.09509, 2021. URL https://arxiv.org/abs/2111.09509.
|
| 208 |
+
|
| 209 |
+
Milad Nasr, Shuang Song, Abhradeep Thakurta, Nicolas Papernot, and Nicholas Carlini. Adversary instantiation: Lower bounds for differentially private machine learning. arXiv preprint arXiv:2101.04535, 2021.
|
| 210 |
+
|
| 211 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1–67, 2020. URL http://jmlr.org/papers/v21/20-074.html.
|
| 212 |
+
|
| 213 |
+
Swaroop Ramaswamy, Om Thakkar, Rajiv Mathews, Galen Andrew, H Brendan McMahan, and Françoise Beaufays. Training production language models without memorizing user data. arXiv preprint arXiv:2009.10031, 2020.
|
| 214 |
+
|
| 215 |
+
Reza Shokri, Marco Stronati, Congzheng Song, and Vitaly Shmatikov. Membership inference attacks against machine learning models. In 2017 IEEE Symposium on Security and Privacy (SP), pages 3–18. IEEE, 2017.
|
| 216 |
+
|
| 217 |
+
Om Thakkar, Swaroop Ramaswamy, Rajiv Mathews, and Françoise Beaufays. Understanding unintended memorization in federated learning, 2020.
|
| 218 |
+
|
| 219 |
+
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.
|
| 220 |
+
|
| 221 |
+
Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax, May 2021.
|
| 222 |
+
|
| 223 |
+
Samuel Yeom, Irene Giacomelli, Matt Fredrikson, and Somesh 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.
|
| 224 |
+
|
| 225 |
+
Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. ICLR, 2017.
|
| 226 |
+
|
| 227 |
+
Chiyuan Zhang, Daphne Ippolito, Katherine Lee, Matthew Jagielski, Florian Tramèr, and Nicholas Carlini. Counterfactual memorization in neural language models. arXiv preprint arXiv:2112.12938, 2021.
|
| 228 |
+
|
| 229 |
+
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.
|
| 230 |
+
|
| 231 |
+
Albert Ziegler. GitHub Copilot: Parrot or crow? https://docs.github.com/en/github/copilot/researchrecitation, 2021.
|
| 232 |
+
|
| 233 |
+
# A IMPLEMENTATION DETAILS FOR DATASET CREATION
|
| 234 |
+
|
| 235 |
+
Intuitively speaking, it is straightforward to construct a dataset containing specifiable proportions of documents at various frequencies. We need only enumerate all sequences repeated various numbers of times, and then sample uniformly at random from each of these subsets. However in practice this is difficult to do, given the scale of these datasets: even asking the question “how many times is this sequence present in the training dataset” requires linear work for each query, and so repeating this thousands of times for an 800GB dataset would be infeasible.
|
| 236 |
+
|
| 237 |
+
To do this efficiently, we build on the work of Lee et al. (2021) and construct a suffix array over the training dataset. Such a data structure allows efficient queries to enumerate all sequences of length $k$ that are repeated between $N$ and $M$ times for any $N , M$ . This can be accomplished by a linear scan of the suffix array. As notation, write $i$ as the pointer into the dataset at a certain position $j$ of the suffix array (i.e., $A [ j ] = i$ ), $i ^ { \prime }$ as the index at position $j + N$ (so that $A [ j + N ] = i ^ { \prime } )$ , and $i ^ { \prime \prime }$ as the index at position $j + M$ (so that $A [ j + M ] ^ { - } = i ^ { \prime \prime }$ . Then, if $D [ i : i + k ] = D [ i ^ { \prime } : i ^ { \prime } + k ]$ but $D [ i : i + k ] \neq D [ i ^ { \prime \prime } : i ^ { \prime \prime } + k ]$ , the sequence $D [ k : i + k ]$ is guaranteed to appear between $N$ and $M$ times in the dataset. As a result, we can scan linearly through the suffix array and enumerate all values of j $j$ to efficiently find all potential sequences repeated between $\mathbf { N }$ and $\mathbf { M }$ times. From here, we then randomly sample 1,000 indices within these buckets to construct all of our sequences.
|
| 238 |
+
|
| 239 |
+
# B LONGER DOCUMENTS ARE NOT EASIER TO MEMORIZE THAN SHORTER DOCUMENTS
|
| 240 |
+
|
| 241 |
+

|
| 242 |
+
Figure 5: Longer sequences are not easier to extract. We compute the probability that an adversary can extract a sequence as a function of the number of tokens of context available, when varying the length of the sequences. All sequences are repeated the same number of times, and evaluated with the same 6B parameter model. Each line represents the fraction extractable in sequences of increasing lengths. Because all lines nearly perfectly overlap, longer sequences are not fundamentally “easier” to extract than shorter sequences.
|
| 243 |
+
|
| 244 |
+
Intuitively, one might think that longer sequences are more likely in the tail of the distribution, and if the model is trained to a low perplexity, then the tail of the distribution may be more likely to be memorized. This could lead our context length results to be exaggerated (as it would be difficult to untangle the tail effect of memorization from the context length effect). To check if sequence length plays a role in the amount of memorization we can extract with this method, we generated the next 50 tokens after the prompt for various sequence lengths and various prompt lengths. Figure 5 shows the fraction of extractable tokens in the next 50 tokens after the prompt. Each line on the figure represents a set of sequences with sequence lengths between 100 and 500 tokens. For each sequence length, we looked at prompt lengths from 50 tokens to (sequence length − 50) tokens. We do not see significant differences between the fraction of extractable tokens with varying prompt lengths across various sequence lengths.
|
| 245 |
+
|
| 246 |
+
Figure 6: Text examples that are memorized by the 6B model, but not by smaller models. Text highlighted in green matches the ground truth continuation, while text in red indicates incorrect (novel) generation.
|
| 247 |
+
|
| 248 |
+
<table><tr><td rowspan=1 colspan=1>Prompt</td><td rowspan=1 colspan=1>Continuation (= 6B)</td><td rowspan=1 colspan=1>2.7B</td><td rowspan=1 colspan=1>1.3B</td><td rowspan=1 colspan=1>125M</td></tr><tr><td rowspan=3 colspan=1>Gallery "Though defensive violencewill always be'a sad necessity' inthe eyes of men of principle,itwould be still more unfortunate ifwrongdoers should dominate justmen."- St. Augustine "A new idea isfirst</td><td rowspan=1 colspan=1>condemned as ridiculous,and thendismissedastrivial,untilfinallyit</td><td rowspan=3 colspan=1>condemned as ridiculous,and thendismissedasiialoegaccepted asthe most important thingin the world."- George BernardShaw"The ultimate measure of a manis not where he stands in moments ofcomfort and convenience,but where</td><td rowspan=2 colspan=1>tried in the mindof achild,and thenit istried in themind ofaman."- ThomasPaine "The only thingnecessary for the triumphof evil is for goodmen todo</td><td rowspan=3 colspan=1>and foremostaman'sdutytohis fellow man.It isa duty tobe a man of principle,andto bea man ofprincipleand tobeaman ofprinciple,andtobeamanofprinciple,and tobe</td></tr><tr><td rowspan=2 colspan=1>becomeswhat everybody knows."-William James "This is the real taskbeforeus:toreassertourcommitmentasanationtoalawhigherthanourown,</td></tr><tr><td rowspan=1 colspan=1>nothing."- Edmund Burke "</td></tr><tr><td rowspan=1 colspan=1>_GPL(crypto_unregister_alg);intcrypto_register_template(structcrypto_template *tmpl){structcrypto_template *q; int err =-EEXIST;</td><td rowspan=1 colspan=1>down_write(&cryptoalg_sem);list_for_each_entry(q,&cryptotemateistst{tmpl)</td><td rowspan=1 colspan=1>list_for_each_entry(q,&cryptoaglist,ist{i>name &&tmpl->name!= q->alg.cra_name)</td><td rowspan=1 colspan=1>q = kzaloc(sizeof(*q),GFP_KERNEL); if(!q)goto out; q->alg=tmpl->alg; q->base</td><td rowspan=1 colspan=1>structcrypto_template*tmpl=crypto_templatenew(tmpl);if(err)returnerr;tmpl->tmpl = q;tmpl->tmpl->tm</td></tr><tr><td rowspan=1 colspan=1>ions:before {content: "\f5eb";}.fa-discord:before {content:"\f392";}.fa-discourse:before{ content: "\f393</td><td rowspan=1 colspan=1>";}.fa-divide:before{content:"\f529";}.fa-dizzy:before{content:"\f567";}.fa-dna:before</td><td rowspan=1 colspan=1>";}.fa-digg:before{content:"\f391";}.fdochubbeore{ot:"\f394";}.fockeboe</td><td rowspan=1 colspan=1>;}.fa-dggbeore{ot:"\f96c";}.fa-dollar-sign:before{content:"f155";}.fa-digniter</td><td rowspan=1 colspan=1>";}.fa-discus:before{content:"\f394";}.f-drupal:before{content:"\f395";}.f-drupaldiscod</td></tr><tr><td rowspan=1 colspan=1>new users as an exploration tourand getting started guide, withexercises at the end of eachchapter. For more advanced traineesit can be a desktop reference,and acollection of the base knowledgeneeded to proceed with system andnetwork administration. This</td><td rowspan=1 colspan=1>book contains many real life examplesderivedfromtheauthor'sexperienceasa Linux systemand networkadministrator,trainerand consultant.They hope these examples will helpyoutogeta better understanding ofthe Linux systemand that you feelencouraged to tryoutthingson</td><td rowspan=1 colspan=1>bookisdesigned to give thereaderafirm understanding of thetechnologies needed to install andmanage Linux systems, using thevarous available tools and techniquesfor the task.The book begins with arapid-fire introduction to the basic principles of the Linux operating</td><td rowspan=1 colspan=1>is a good place to start foranew user. A: I wouldrecommendthe book&quot;LinuxNetworking" by David S.Itisavery goodbook forbeginners.A: Iwouldrecommend</td><td rowspan=1 colspan=1>isa great way to get startedwitha new project.A:Iwould suggest youto usethefollowing:Createanew project Create a newuser CreateanewuserCreateanew user Create</td></tr></table>
|
| 249 |
+
|
| 250 |
+
# C ALTERNATE EXPERIMENTAL SETTINGS
|
| 251 |
+
|
| 252 |
+
In this section, we study other strategies that we could have used to quantify memorization.
|
| 253 |
+
|
| 254 |
+
Random dataset sampling. In Section 4.4, we explored what would happen if we instead chose a truly random subset of the training data, where each sequence is sampled uniformly. Specifically, we randomly sample 100,000 sequences from The Pile dataset of length 100, 200, 500, and 1,000; prompt the model with the first $N - 5 0$ tokens; and then test for memorization by verifying if the model can emit the remaining 50 tokens perfectly. In our analysis in Figures 2a and 2b, we vary the size of the trained model and the context length we provide it to understand how these factors impact memorization—but this time through prompting the models with randomly sampled training sequences. As expected, the absolute probability of memorization is much lower than in Figure 1 where we prompted models with training data from the sampled duplication-normalized subset.
|
| 255 |
+
|
| 256 |
+
We observe similar trends with model scale and context length as in our other results. Larger models memorize more training examples than smaller models—and much more than the baseline GPT-2 model that was not trained on The Pile. Similarly, providing more context to a model increases the likelihood we can discover memorization. In Figure 2b, we prompt models with: prompt length $=$ sequence length − 50. We see that the longer prompts are easier to predict correctly than shorter prompts. The baseline GPT-2 model is nearly twice as accurate on sequences of length 1,000 (prompt length $= 9 5 0$ ) compared to sequences of length 100 (prompt length $= 5 0$ ).
|
| 257 |
+
|
| 258 |
+
Alternate definition of extractability. Our main experiments report a sequence as “extractable” if the model’s generated continuation is identical to the true suffix within that training example. This method is a loose lower bound on memorization. Consider two sequences $x _ { 1 }$ , $x _ { 2 }$ both contained in the training dataset. Suppose these two sequences share the same prefix, and differ only in the final suffix; that is, $x _ { 1 } = [ p | | s _ { 1 } ]$ and $x _ { 2 } = [ p | | s _ { 2 } ]$ . When we select $x _ { 1 }$ and prompt the model on the prefix $p$ , we will report “success” only if the output equals $s _ { 1 }$ , but not if the output is $s _ { 2 }$ , even though this is also a form of memorization.
|
| 259 |
+
|
| 260 |
+
We now consider how our results would change if we instead checked that the generation $[ p | | f ( p ) ]$ from a prompt $p$ was contained anywhere in the training dataset. This gives a strictly larger measurement of memorization. By comparing these two methods (checking for memorization within the ground truth continuation, and within the entire dataset), we can understand how the choice of measurement affects the results in our experiments.
|
| 261 |
+
|
| 262 |
+
Searching within the entire dataset finds more memorized content than comparing with the ground truth (Figure 2c). For examples at 100 repetitions $3 2 . 6 \%$ of outputs are contained somewhere in the dataset but just $1 5 . 8 \%$ match the ground truth continuation. This difference becomes more pronounced as the number of repetitions increases. The maximum difference between these approaches is $2 8 . 4 \%$ , at 2,200 repetitions.
|
| 263 |
+
|
| 264 |
+
We refrain from using this approach for our main experiments, because this definition requires vastly larger computation resources; it requires querying whether hundreds of thousands of sequences are contained in an 800GB training dataset. Therefore, to promote reproducability, the remainder of this paper continues with testing the generated suffix against the single expected training suffix.
|
| 265 |
+
|
| 266 |
+
# D TEXT MEMORIZED BY ONLY SOME MODELS
|
| 267 |
+
|
| 268 |
+
Table 1: The number of sequences memorized by one model, and not memorized by another.
|
| 269 |
+
|
| 270 |
+
<table><tr><td></td><td></td><td colspan="4">Not Memorized By</td></tr><tr><td>Model</td><td>Memorized</td><td>125M</td><td>1.3B</td><td>2.7B</td><td>6B</td></tr><tr><td>125M</td><td>4,812</td><td>=</td><td>328</td><td>295</td><td>293</td></tr><tr><td>1.3B</td><td>10,391</td><td>5,907</td><td>=</td><td>1,205</td><td>1,001</td></tr><tr><td>2.7B</td><td>12,148</td><td>7,631</td><td>2.962</td><td></td><td>1,426</td></tr><tr><td>6B</td><td>14,792</td><td>10,273</td><td>5,402</td><td>4,070</td><td>-</td></tr></table>
|
| 271 |
+
|
| 272 |
+
Table 1 shows the total number of sequences that are memorized by one model but not another. Larger models have more uniquely memorized sequences, although every model has some memorization not shared by any other model. (Even the 125M model memorizes a few sequences that the 6B model does not.)
|
| 273 |
+
|
| 274 |
+
# E MEMORIZATION IN OPT MODELS
|
| 275 |
+
|
| 276 |
+

|
| 277 |
+
Figure 7: We prompt OPT models with data sampled from their training set. We use a prompt length of 100 here. (a) Fraction of sequences extracted as a function of model scale. (b) Fraction of sequences extracted as the number of repetitions of that sequence in the training set increases.
|
| 278 |
+
|
| 279 |
+
# F EXAMPLES OF MEMORIZED TEXTS
|
| 280 |
+
|
| 281 |
+
We show examples of texts that are memorized by different models. We consider the case of 50-token prompts and 50-token generation. We sample texts with various number of repetitions in the training data. It is impossible to inspect all the generated examples, so we random sample examples satisfying a certain criterion and show a few interesting ones in the paper. Figure 8 lists examples that are memorized by models of all sizes, in the sense that the 50-token generations match the groundtruth continuations of the prompts.
|
| 282 |
+
|
| 283 |
+

|
| 284 |
+
Figure 8: Text examples that are memorized by all the models: given 50-token prompts on the left, the next 50 tokens generated by all the models match the groundtruth continuation.
|
| 285 |
+
|
| 286 |
+
Figure 9 lists examples that are memorized by the 6B model but not by smaller ones. Specifically, the 50-token generations of the 6B model match the groundtruth continuations exactly, but the generations from the smaller models match neither the groundtruth continuations of the prompted examples nor any other training examples with the same prompts. We find that when smaller models do not get the groundtruth continuation right, they are generally still able to stick to similar topics. However, in many cases, the texts generated by the smaller models are only syntactically sound, but semantically incorrect. Figure 10 and Figure 11 show more examples.
|
| 287 |
+
|
| 288 |
+
In Figure 12 we show examples that are only memorized by the smallest model, using similar criterion as when we filter examples that are only memorized by the largest model. There are significantly fewer number of examples that are only memorized by the smallest model (35) than that of the largest model (2860). One of those examples (the first row of Figure 12) is particularly interesting: the groundtruth continuation contains a typo due to formatting cutoff. While the smallest model memorized the typo, larger models try to fix the typo.
|
| 289 |
+
|
| 290 |
+
In Figure 13 and Figure 14 we show examples that are memorized but not heavily duplicated in the training set, and examples that are heavily duplicated but not memorized, respectively. Finally, we show examples that are memorized by GPT2-XL in Figure 15.
|
| 291 |
+
|
| 292 |
+

|
| 293 |
+
Figure 9: Text examples that are memorized by the 6B model (according to true-continuation match), but not memorized by smaller models (the generated texts do not match the true continuation, nor any other training examples). The first column shows the prompt. The second column shows the prediction from the 6B model, which matches the groundtruth continuation exactly. The remaining columns shows predictions from smaller models.
|
| 294 |
+
|
| 295 |
+

|
| 296 |
+
Figure 10: Continuation of Figure 9.
|
| 297 |
+
|
| 298 |
+

|
| 299 |
+
Figure 11: Continuation of Figure 9.
|
| 300 |
+
|
| 301 |
+

|
| 302 |
+
Figure 12: Text examples that are memorized by the $1 2 5 \mathbf { M }$ model (according to true-continuation match), but not memorized by larger models (the generated texts do not match the true continuation, nor any other training examples). The first column shows the prompt. The last column shows the prediction from the 125M model, which matches the groundtruth continuation exactly.
|
| 303 |
+
|
| 304 |
+
Figure 13: Text examples that are memorized but are not heavily duplicated in the training set. Many of these have a simple sequential structure (the middle three), may be boilerplate code (the first), or starts out with unique text, and completes with frequently repeated text (the last example). Overall, these are easily completed sequences.
|
| 305 |
+
|
| 306 |
+
<table><tr><td rowspan=1 colspan=1>Frequency</td><td rowspan=1 colspan=1> Prompt</td><td rowspan=1 colspan=1>Continuation ( == 6B)</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>L_LONG_LONG*/__STL_TEMPLATE_NULL struCt_type_traits<float>{typedef_true_typehas_trivial_default_</td><td rowspan=1 colspan=1>constructor; typedef__true_type has_trivial_copy_constructor;typedef__true_type has_trivial_assignment_operator;</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>"groupby4_map","groupby4_map_skew","groupby4_noskew","groupby5",</td><td rowspan=1 colspan=1>"groupby5_map","groupby5_map_skew","groupby5_noskew","groupby6",</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>pair<K12>(_12),fusion:make_pair<K13>(13),fusion:make_pair<K14>(14),fusion:makepair<K15>(5));</td><td rowspan=1 colspan=1>J namespace result_of{template<typename K0,typename K1,typenameK</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>_GLSL_400))list += QLatin1String("dmat2"); if (variant&(Lexer:Variant_GLSL_40O)) ist+= QLatin</td><td rowspan=1 colspan=1>1String("dmat3"); f (variant & (Lexer:Variant_GLSL_40o))list +=QLatin1String("dmat4"); if (variant&(</td></tr><tr><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>disabled.BCG.com will work better for you if you enableJavaScript or switch to a JavaScript supported browser.Boston Consulting Group is an Equal Opportunity Employer.All qualified applicants will receive consideration foremployment without regard to race,color,</td><td rowspan=1 colspan=1>age,religion,sex,xualentationgederdiy/expressionioalginoectedeatothercharacteristic protected under federal,stateor local law,whereapplicable,and those with criminal histories will beconsidered ina manner consistent with</td></tr></table>
|
| 307 |
+
|
| 308 |
+
Figure 14: Text examples that are heavily replicated in the training set but not memorized. We find many examples which have slight differences with no semantic (English) meaning. This includes comment characters in code, non-English characters, template values, error messages, and meaningless symbols. We also surprisingly find a large number of slightly different but heavily repeated documents about dumpsters.
|
| 309 |
+
|
| 310 |
+
<table><tr><td rowspan=1 colspan=1>Frequency</td><td rowspan=1 colspan=1>Prompt</td><td rowspan=1 colspan=1>Continuation</td><td rowspan=1 colspan=1>6B</td></tr><tr><td rowspan=1 colspan=1>5526</td><td rowspan=1 colspan=1>contributors.All rights reserved./// Licensedunder the Apache License,Version 2.0 (the"License");//you may not usethisfile exceptin compliance with the License.// You mayobtain a copy of the</td><td rowspan=1 colspan=1>License at //http://www.apache.org/licenses/LICENSE-2.0/// Unless requiredby applicable law or agreed to in writing,software // distributed under the License isdistributed on an "AS</td><td rowspan=1 colspan=1>Licenseat////http://www.apache.org/licenses/LICENSE-2.0///Unlessrequiredbyapplicablelaworagreedto inwriting,software//distributedunderthe License</td></tr><tr><td rowspan=1 colspan=1>5652</td><td rowspan=1 colspan=1>ators are Standing By Our Dumpster Specialistsare waiting by the phone to help you getstarted. However, there is some importantinformation we need before we can give you aprice quote and delivery time.Some things weneed to know</td><td rowspan=1 colspan=1>: What size dumpster you will need Whatyou plan on puting in your dumpster Whenyou need us to drop your roll off containeroff How long you plan on keeping your roll-off City &</td><td rowspan=1 colspan=1>include:What size dumpster do you need?What type of waste do you have?How much wastedo you have?What is the delivery time?What isthepickup'time?What</td></tr><tr><td rowspan=1 colspan=1>4323</td><td rowspan=1 colspan=1>a copy ofthe License at ## http:/lwww.apache.org/licenses/LICENSE-2.0 ##Unless required by applicable law</td><td rowspan=1 colspan=1>or agreed to in writing,software #distributed under the License is distributedon an "AS IS" BASIS,WITHOUT #WARRANTIES OR CONDITIONS OF ANYKIND,either express or implied. See</td><td rowspan=1 colspan=1>oragreed to in writing,software #distributed underthe License is distributed onan "AS IS"BASIS,#VWITHOUT WARRANTIES OR CONDITIONS OFANY KIND,either express or implied.</td></tr><tr><td rowspan=1 colspan=1>3556</td><td rowspan=1 colspan=1>date_default_timezone_set() function.In caseyou used any of those methods and you arestill geting this warning,you most likelymisspelled the timezone identifier. We selectedthe timezone 'UTC' for now,but please</td><td rowspan=1 colspan=1>setdate.timezone to select your timezone.in/home/erlypro/public_html/natural/datas/persobanner_center.php on line 17Deprecated: Function eregi_replace</td><td rowspan=1 colspan=1>setdate.timezone toselect your timezone.in/home/notes/public_html/wp-includes/functions.phponline3812Warning:date()[functiondatel:Itisnotsafe to rely</td></tr><tr><td rowspan=2 colspan=1>3920</td><td rowspan=2 colspan=1>|&nbsp;&nbsp;[手把手翻墙教程]https://github.com/gfw-breaker/guides/wiki) &nbsp;&</td><td rowspan=1 colspan=1>nbsp;l&nbsp;&nbsp;[禁闻聚合安卓版](https://github.com/gfw-breaker/bn-android)</td><td rowspan=2 colspan=1>nbsp;[网门安卓版](https://github.com/gfw-breaker/webpack-interpreter)&nbsp;&nbsp;[神州正道</td></tr><tr><td rowspan=1 colspan=1>&nbsp;&n</td></tr><tr><td rowspan=1 colspan=1>3675</td><td rowspan=1 colspan=1>*/_II\\)11*</td><td rowspan=1 colspan=1>=(_-_-_△</td><td rowspan=1 colspan=1>I(_ILI1_11*</td></tr><tr><td rowspan=1 colspan=1>3030</td><td rowspan=1 colspan=1>1775,"date": "1775\u20131851","displayOrder":1,"fc": "Joseph Mallord William</td><td rowspan=1 colspan=1>Turner","gender":"Male","id":558,"mda":"Turner,Joseph Mallord William",</td><td rowspan=1 colspan=1>Turner","gender":"Male","id":604,"mda": "Turner,Joseph MallordWilliam",</td></tr></table>
|
| 311 |
+
|
| 312 |
+
Figure 15: Text examples that are from The Pile and memorized by GPT2-XL. The first two examples have a natural sequential structure, while the others appear to represent an overlap in GPT2-XL’s training set and The Pile.
|
| 313 |
+
|
| 314 |
+
<table><tr><td rowspan=1 colspan=1> Prompt</td><td rowspan=1 colspan=1>Continuation (== GPT2-XL)</td></tr><tr><td rowspan=1 colspan=1>165.00 $175.00 $180.00 $185.00 $190.00 $195.00 $200.00$210.00 $220.00 $230.00 $240.00 $250.00 $260.</td><td rowspan=1 colspan=1>00 $270.00 $280.00 $290.00 $300.00 $310.00 $320.00$330.00 $340.00 $350.00 $360.00 $370.00 $380.00 $</td></tr><tr><td rowspan=1 colspan=1>ISRC3DEC2,ARIZONA_ISRC3DEC2MIX_INPUT_1_SOURCE);ARIZONA_MUX_ENUMS(ISRC3DEC3,ARIZONA_</td><td rowspan=1 colspan=1>ISRC3DEC3MIX_INPUT_1_SOURCE);ARIZONA_MUX_ENUMS(ISRC3DEC4,ARIZONA_ISRC3DEC4MIX_INPUT</td></tr><tr><td rowspan=1 colspan=1>the councils of government,we must guard against theacquisition of unwarranted influence,whether sought orunsought,by the militaryindustrial complex.The potentialfor the disastrous rise of misplaced power exists and willpersist.We must never let the weight</td><td rowspan=1 colspan=1>of this combination endanger our liberties or democraticprocesses.Weshould take nothing forgranted.Onlyanalertand knowledgeable citizenrycan compel the propermeshing of the huge industrial and military machinery ofdefense with our peaceful methods and goals,so thatsecurityand</td></tr><tr><td rowspan=1 colspan=1>full spreadsheet NEW! Buy our book·Facts are Sacred: the power of data (on Kindle) More open data Data journalismand data visualisations from the Guardian World government data ·Search the</td><td rowspan=1 colspan=1>world's government data with our gateway Developmentand aid data·Search the world's global development datawith our gateway Can you do something with this data?·Flickr Please post your visualisations and mash-ups on</td></tr><tr><td rowspan=1 colspan=1>Original press release Get ahead of the crowd by signing upfor 420 Investor,the largest& most comprehensivepremium subscription service for cannabis traders andinvestors since 2013.Published by NCV Newswire The NCVNewswire</td><td rowspan=2 colspan=1>by New Cannabis Venturesaims to curate high qualitycontent and information about leading cannabis companiesto help our readers flterout the noiseand to stay on top ofthe most important cannabis business news.The NCVNewswire is hand-curated byas long the source and copyright are acknowledgedtogetherwithahyperlinktotheoriginalGlobalResearcharticle.For publication of Global Research articles in printor other forms including commercial internet sites,contact:[email protected]www.globalresearch.ca</td></tr><tr><td rowspan=1 colspan=1>of sole responsibility of the author(s).The Centre forResearch on Globalization will not be responsible for any inaccurate or incorrect statement in this article.The Centreof Research on Globalization grants permission to cross- post Global Research articles on community internet sites</td></tr></table>
|
md/dev/TntbHxxGd6j/TntbHxxGd6j.md
ADDED
|
@@ -0,0 +1,347 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OUTPUT DISTRIBUTION OVER THE ENTIRE INPUT SPACE: A NOVEL PERSPECTIVE TO UNDERSTAND NEURAL NETWORKS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Understanding the input-output mapping relationship in the entire input space contributes a novel perspective to a comprehensive understanding of deep neural networks. In this paper, we focus on binary neural classifiers and propose to first uncover the histogram about the number of inputs that are mapped to certain output values and then scrutinize the representative inputs from a certain output range of interest, such as the positive-logit region that corresponds to one of the classes. A straightforward solution is uniform sampling (or exhaustive enumeration) in the entire input space but when the inputs are high dimensional, it can take almost forever to converge. We connect the output histogram to the density of states in physics by making an analogy between the energy of a system and the neural network output. Inspired by the Wang-Landau algorithm designed for sampling the density of states, we propose an efficient sampler that is driven to explore the under-explored output values through a gradient-based proposal. Compared with the random proposal in Wang-Landau algorithm, our gradientbased proposal converges faster as it can propose the inputs corresponding to the under-explored output values. Extensive experiments have verified the accuracy of the histogram generated by our sampler and also demonstrated interesting findings. For example, the models map many human unrecognizable images to very negative logit values. These properties of a neural model are revealed for the first time through our sampled statistics. We believe that our approach opens a new gate for neural model evaluation and shall be further explored in future works.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Understanding the input-output mapping relationship in the entire input space contributes a novel perspective to a comprehensive understanding of deep neural networks. Existing methods approximate such mapping relations through the evaluation on a certain subset of the entire input space, such as measuring the accuracy on in-distribution test sets Dosovitskiy et al. (2021); Tolstikhin et al. (2021); Steiner et al. (2021); Chen et al. (2021); Zhuang et al. (2022); He et al. (2015), out-ofdistribution (OOD) test sets (Liu et al., 2020; Hendrycks & Gimpel, 2016; Hendrycks et al., 2019; Hsu et al., 2020; Lee et al., 2017; 2018), and adversarial test sets Szegedy et al. (2013); Rozsa et al. (2016); Miyato et al. (2018); Kurakin et al. (2016). However, none of the existing evaluations can offer a comprehensive understanding that covers the entire input space, including all kinds of inputs mentioned above and even those human unrecognizable inputs as shown in Fig 1a.
|
| 12 |
+
|
| 13 |
+
As a pilot study, we focus on binary classification — given a trained binary classifier, we aim to uncover a histogram that counts how many samples in the entire input space are mapped to certain logit values, i.e., the distribution of the output values, as shown in Fig 1b. A straightforward solution is uniform sampling (or exhaustive enumeration) in the entire input space but when the inputs are high dimensional, it can take almost forever to converge. Therefore, it calls for a novel efficient sampling method over a neural model’s output space. Note that, as a side product of the sampling procedure, one can expect that this histogram also offers fine-grained information such as some representative input samples corresponding to a certain range of output values.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Input types and the example output histogram when the task is binary classification between digits 0 and 1. The entire input space covers all possible gray-scale images of the same shape. y is the output (logit) of input $\mathbf { X }$ .
|
| 17 |
+
|
| 18 |
+
We connect the output histogram problem to the density of states (DOS) problem in physics by making an analogy between the system energy and neural network output, as shown in the right figure. If one follows the physics language to describe our problem, the input $\mathbf { x }$ to the neural network can be viewed as the configuration $\mathbf { x }$ of the system; the neural network output (e.g., logit values in binary classifier) $y ( \mathbf { x } )$ corresponds to the energy function $E ( \mathbf { x } )$ ; the desired output histogram can be obtained through the DOS (a.k.a., the entropy, $S ( E ( \mathbf { x } ) { \bar { ) } }$ , the log scale of DOS), which is the count of the configurations given the energy value. Note that the density of states by definition is over the entire input space, which aligns perfectly with our objective.
|
| 19 |
+
|
| 20 |
+

|
| 21 |
+
|
| 22 |
+
Inspired by the Wang-Landau algorithm (Wang & Landau, 2001) designed for density of states, we propose an efficient sampler that is driven to explore the under-explored output values through a gradient-based proposal. If the binary classifier is well-trained, it is reasonable to believe that in-distribution inputs (images) which usually have certain semantic structures are concentrated in certain output ranges. If one follows the random proposal in the Wang-Landau algorithm, it is difficult to propose the inputs with meaningful structure (or even in-distribution inputs), thus possibly preventing the sampler from exploring the corresponding output values. Thus, we propose to apply a gradient-based proposal called Gibbs-with-Gradients (GWG) (Grathwohl et al., 2021) which proves to be efficient to propose in-distribution inputs for a trained model.
|
| 23 |
+
|
| 24 |
+
With the help of this new sampler, we can reveal some new understanding of the models for the entire input space. First, in our experiments on a real-world dataset, the dominant output values are very negative and correspond to the human-unrecognizable inputs. This indicates the models may map an overwhelmingly large number of unrecognizable images to the overconfident prediction probabilities. Second, we can derive the relative difference between the dominant peak of output values and the other output values, especially those where the in-distribution inputs correspond to. The output values where the in-distribution inputs correspond to are also dominated by the humanunrecognizable inputs. This result presents significant challenges to the OOD detection problems. Third, we observe a clear trend of the representative samples in a CNN model and speculate it simply utilizes the background to predict the labels of the digits.
|
| 25 |
+
|
| 26 |
+
Our contributions are summarized as follows.
|
| 27 |
+
|
| 28 |
+
• We work on the challenging problem to uncover the output distribution over the entire input space. Such output distributions offer a novel perspective to understand deep neural networks. • We connect this output distribution problem to the density of states problem in physic and successfully tailor Wang-Landau algorithm using a gradient-based proposal, which is a must-have component to sample the entire output space as much as possible, improving the efficiency. • We conduct extensive experiments on toy and real-world datasets based on CNN and ResNet-18 to confirm the correctness of our proposed sampler and discover novel and interesting findings.
|
| 29 |
+
|
| 30 |
+
We believe that our approach opens a new gate for neural model evaluation and shall be further explored in future works. For example, one can can utilize our sampler to estimate the intrinsic ratio of in-distribution samples given a range of interest with human evaluation as shown in Sec. 5.3.
|
| 31 |
+
|
| 32 |
+
# 2 PROBLEM DEFINITION
|
| 33 |
+
|
| 34 |
+
In the traditional setting, binary neural classifiers model the class distribution through logit $z$ . A neural classifier parameterized by $\theta$ learns $p _ { \theta } ( z | \mathbf { x } ) = \delta ( z - y _ { \theta } ( \mathbf { x } ) )$ through a function $y _ { \theta } : \mathbf { x } z \in$ $\mathbb { R }$ , where $\mathbf { x } \in \Omega$ , $\Omega \subseteq \{ 0 , . . . , N \} ^ { D }$ for images, and $\delta$ is the Dirac delta function. $\Omega$ is aligned with Gibbs-With-Gradient’s setting to be discrete.
|
| 35 |
+
|
| 36 |
+
What the above model does not define is the distribution of the data $\mathbf { x }$ . This paper aims to obtain the output value distribution of binary classifiers in the entire input space: $\Omega \doteq \dot { \{ 0 , . . . , N \} } ^ { D }$ . Here we assume that the data distribution $p ( \mathbf { x } )$ follows the uniform distribution over the domain $\Omega$ of $\mathbf { x }$ and denote its measure by $\mu$ . We define the joint distribution
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
p _ { \theta } ( z , \mathbf { x } ) = p _ { \theta } ( z | \mathbf { x } ) \mu ( \mathbf { x } )
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
Our goal is only the logit (output) distribution. We marginalize the above joint distribution to define the density given the logit $z$ :
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
p _ { \theta } ( z ) = \sum _ { \Omega } p _ { \theta } ( z | \mathbf { x } ) \mu ( \mathbf { x } ) = \sum _ { \mathbf { x } \in \Omega } \delta ( z - y _ { \theta } ( \mathbf { x } ) )
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
To sample from the distribution $p _ { \theta } ( z )$ , we can first sample $\mathbf { x } _ { i } \sim \mathrm { U n i f o r m } ( \Omega )$ , then condition on the sampled $\mathbf { x } _ { i }$ , sample $z _ { i } \sim p _ { \theta } ( z | \mathbf { x } _ { i } )$ . While uniform sampler in principle can resolve our problem, it takes almost forever to converge.
|
| 49 |
+
|
| 50 |
+
# 3 METHOD
|
| 51 |
+
|
| 52 |
+
In this section, we first discuss the connection between our problem to density of states (DOS), introduce both Wang-Landau algorithm and Gibbs-with-Gradient as background, and present our new sampler Gradient-Wang-Landau algorithm.
|
| 53 |
+
|
| 54 |
+
# 3.1 CONNECTION TO DENSITY OF STATES (DOS) IN PHYSICS
|
| 55 |
+
|
| 56 |
+
In statistical physics, given the energy function $E : \mathbf { x } \mathcal { E } \in \mathbb { R }$ , the DOS $\rho ( \mathcal { E } )$ is defined as
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
\rho ( \mathcal { E } ) = \sum _ { \mathbf { x } \in \Omega } \delta ( \mathcal { E } - E ( \mathbf { x } ) )
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
where $\delta$ is the Dirac delta function and $\Omega$ is the domain of $\mathbf { x }$ where $\mathbf { x }$ is valid. The DOS is treated as a probability distribution in the energy space, whose log-probability is defined as the entropy $S$ :
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\rho ( \mathcal { E } ) = \exp ( S ( \mathcal { E } ) )
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
Boltzmann constant is assumed to be 1 in our setting. DOS is meaningful because many physical quantities depend on energy or its integration but not the specific input $\mathbf { x }$ .
|
| 69 |
+
|
| 70 |
+
We connect the output histogram to DOS in physics by making an analogy between the system energy $\mathcal { E } = E ( \mathbf { x } )$ and neural network output $z = y ( \mathbf { x } )$ . This connection is based on the observation that the energy function in physics maps an input configuration to a scalar-valued energy; similarly, a binary neural classifier maps an image to a logit. Both the logit and energy are treated as the direct output of the mapping. Other quantities, such as the loss, are derived from the output. The desired output histogram can be obtained similarly through sampling the DOS (a.k.a., the entropy $S ( E ( \mathbf { x } ) )$ or $\bar { S } ( y ( { \bf x } ) )$ in the log scale) which is the count of the configurations given the energy value. The output histogram and DOS are defined in the entire input space.
|
| 71 |
+
|
| 72 |
+
# 3.2 WANG-LANDAU ALGORITHM AND GIBBS-WITH-GRADIENT
|
| 73 |
+
|
| 74 |
+
Wang-Landau algorithm is a Markov chain Monte Carlo sampler that samples DOS. Since the true distribution $\rho ( \mathcal { E } )$ is what we are interested in sampling but its formula/model is unknown, we need to approximate it. The Wang-Landau algorithm uses a histogram to store the current estimation $\tilde { S }$ . It improves the sampling efficiency by sampling the inverted distribution:
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
p ( \mathbf { x } ) \propto \exp ( - \tilde { S } ( E ( \mathbf { x } ) ) )
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
By sampling $p ( \mathbf { x } )$ , we can get an ensemble of $\mathcal { E }$ via $E ( \cdot )$ whose probability distribution is:
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
\pi ( \mathcal { E } ) = \sum _ { \mathbf { x } \sim p ( \mathbf { x } ) } \delta ( \mathcal { E } - E ( \mathbf { x } ) )
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
When $\tilde { S } ( \mathcal { E } )$ approaches $S ( \mathcal { E } )$ , the energy distribution $\pi ( \mathcal { E } )$ approaches to $\mathcal { E }$ -independent constant for all the accessible energy $\mathcal { E }$ .
|
| 87 |
+
|
| 88 |
+
Gibbs-With-Gradient (GWG) is used for energy-based models (EBM) by sampling
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
\log p ( \mathbf { x } ) = f ( \mathbf { x } ) - \log Z ,
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
where $f ( \mathbf { x } )$ is the unnormalized log-probability, $Z$ is the partition function, and $\mathbf { x }$ is discrete. Typical Gibbs sampler iterates every dimension $x _ { i }$ of $\mathbf { x }$ , computes the conditional probability $p ( x _ { i } | x _ { 1 } , . . . x _ { i - 1 } , x _ { i + 1 } , . . . , x _ { D } )$ , and samples according to this conditional probability.
|
| 95 |
+
|
| 96 |
+
When the training data $\mathbf { x }$ are natural images and the EBM learns $\mathbf { x }$ decently well, the traditional Gibbs sampler wastes much of the computation. For example, most pixel-by-pixel iterations over $x _ { i }$ in MNIST dataset will be on the background which should stay black. GWG proposes a smart proposal that picks the pixel $x _ { i }$ that is more likely to change, such as the pixels around the edge between the bright and dark region of the digits.
|
| 97 |
+
|
| 98 |
+
# 3.3 WANG-LANDAU WITH GRADIENT PROPOSAL
|
| 99 |
+
|
| 100 |
+
Directly applying Wang-Landau algorithm is not enough as it uses random proposal, because a trained neural model learns preferred mapping through the loss function. For example, a binary classifier should map the training inputs to either the sufficiently positive or negative logit values which ideally should correspond to the extremely rare but semantically meaningful inputs. After the sampler explores and generates the peak centered at 0 where most random samples correspond to as shown in Fig. 1b, it is almost impossible for the sampler with a random proposal to propose the inputs with meaningful structure (or even in-distribution inputs) so that the other possible output values are explored. Of course, whether those output values correspond to in-distribution inputs is only confirmable after sampling. In summary, it is extremely difficult for the random proposal in Wang-Landau algorithm to explore (almost all) the possible output values.
|
| 101 |
+
|
| 102 |
+
We propose to use the framework of Wang-Landau algorithm but replace the proposal distribution with the Gibbs-With-Gradients (GWG) sampler which has a gradient proposal, since the gradient proposal takes the advantage of model’s learned weights to propose inputs. In order to sample the distribution of the output prediction through GWG, we define log-probability $f ( x )$ as:
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
f ( x ) = S ( y ( \mathbf { x } ) )
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
where $S$ is the count for the bin corresponding to $y ( \mathbf x )$ . The fixed $f ( \cdot )$ in the original GWG is changing in our sampling process given the input $\mathbf { x }$ , since the formula for $S$ is unknown and we can only estimate the output distribution as we did in Wang-Landau algorithm. Moreover, the GWG requires the gradient of $f$ , but the $S$ is not differentiable since it is approximated through discrete bins. We adopt a first-order differentiable interpolation for the discrete histogram of entropy.
|
| 109 |
+
|
| 110 |
+
In summary, similar to the original Wang-Landau algorithm, we first initialize two histograms with all of their bins to 0. One of these histograms is for entropy $S$ , and the other histogram, $H$ , is a counter of how many times the sampler workers visited a specific bin and $H$ is also for the flatness check. We first preset the number of iterations. When $H$ passes the flatness check, it enters the next iteration loop with the step counter reset to 0. Every step in the while loop until the flatness check passes, we interpolate the entropy in the histogram to get a differentiable interpolation and take the derivative of the negation of the entropy with respect to the output $z$ and the inputs $\mathbf { x }$ through the chain rule. GWG uses this gradient to propose the next input that is likely to have lower entropy and be accepted by the sampler. his procedure drives the sampler to visit rare samples whose logit values correspond to the lower entropy until $S$ converges. This proposal also goes through a Monte-Carlo accept-reject procedure in the GWG. Once the flatness is met, the bins of $H$ are reset to 0 and the step size is halved before a new iteration. Our proposed algorithm is in Alg. 1 in Appendix.
|
| 111 |
+
|
| 112 |
+
# 4 RELATED WORKS AND DISCUSSIONS
|
| 113 |
+
|
| 114 |
+
Performance Characterization has long been explored even before the era of deep learning (Haralick, 1992; Klette et al., 2000; Thacker et al., 2008). The input-output relationship has been explored for simple functions (Hammitt & Bartlett, 1995) and mathematical morphological operators (Gao et al., 2002; Kanungo & Haralick, 1990). Compared to existing performance characterization approaches (Ramesh et al., 1997; Bowyer & Phillips, 1998; Aghdasi, 1994; Ramesh & Haralick, 1992; 1994), our work focuses on the output distribution (Greiffenhagen et al., 2001) of a neural network over the entire input space (i.e., not task specific) following the blackbox approach (Courtney et al., 1997; Cho et al., 1997) where the system transfer function from input to output is unknown. Our setting shall be viewed as the most general forward uncertainty quantification case (Lee & Chen, 2009) where the model performance is characterized when the inputs are perturbed (Roberts et al., 2021). To our best knowledge, we demonstrate for the first time that the challenging task of sampling the entire input space for modern neural networks is feasible and efficient by drawing the connection between neural network and physics models. Our proposed method can offer samples to be further integrated with the performance characterization methods mentioned above.
|
| 115 |
+
|
| 116 |
+
Density Estimation and Energy Landscape Mapping Previous works in density estimation focus on data density Tabak & Turner (2013); Liu et al. (2021), where class samples are given and the goal is to estimate the density of samples. Here we are not interested in the density of the given dataset, but the density of all the valid samples in the pixel space for a trained model. Hill et al. (2019); Barbu & Zhu (2020) have done the pioneering work in sampling the energy landscape for energy-based models. Their methods specifically focus on the local minimum and barriers of the energy landscape. We can relax the requirement and generalize the mapping on the “output” space where either sufficiently positive or sufficiently negative output (logit) values are meaningful in binary classifiers and other models.
|
| 117 |
+
|
| 118 |
+
Open-world Model Evaluation Though many neural models have achieved the SOTA performance, most of them are only on in-distribution test sets (Dosovitskiy et al., 2021; Tolstikhin et al., 2021; Steiner et al., 2021; Chen et al., 2021; Zhuang et al., 2022; He et al., 2015; Simonyan & Zisserman, 2014; Szegedy et al., 2015; Huang et al., 2017; Zagoruyko & Komodakis, 2016). Openworld settings where the test set distribution differs from the in-distribution training set create special challenges for the model. While the models have to detect the OOD samples from in-distribution samples (Liu et al., 2020; Hendrycks & Gimpel, 2016; Hendrycks et al., 2019; Hsu et al., 2020; Lee et al., 2017; 2018; Liang et al., 2018; Mohseni et al., 2020; Ren et al., 2019), we also expect sometimes the model could generalize what it learns to OOD datasets (Cao et al., 2022; Sun & Li, 2022). It has been discovered that models have over-confident predictions for some OOD samples that obviously do not align with human judgments (Nguyen et al., 2015). The OOD generalization becomes more challenging because of this discovery, because the models may not be as reliable as we thought they were. Adversarial test sets Szegedy et al. (2013); Rozsa et al. (2016); Miyato et al. (2018); Kurakin et al. (2016); Xie et al. (2019); Madry et al. (2017) also present special challenges as models decisions are different from those of humans. Having a full view of input-output relation with all the above different kinds of test sets under consideration is important.
|
| 119 |
+
|
| 120 |
+
Samplers MCMC samplers (Chen et al., 2014; Welling & Teh, 2011; Li et al., 2016; Xu et al., 2018) are developed to scale to big datasets and sample efficient with gradients. Recently, GibbsWith-Gradients (GWG) (Grathwohl et al., 2021) is proposed to pick the promising pixel(s) as the proposal. To further improve sampling efficiency, CSGLD (Deng et al., 2020) drives the sampler to explore the under-explored energy using similar idea as Wang-Landau algorithm (Wang & Landau, 2001). The important difference between our problem setting and the previous ones solved by other MCMC samplers is the function or model as distribution to be sampled from is unknown. Wang-Landau algorithm utilizes previous approximation of the distribution to drive the sampler to explore the under-explored energy regions. This algorithm can be more efficient through parallelization (Vogel et al., 2013; Cunha-Netto et al., 2008), bin-free (Junghans et al., 2014; Li & Eisenbach, 2017) and extended to multi-dimensional outputs (Zhou et al., 2006). While the previous samplers can be applied to high dimensional inputs, the energy functions written by physicists are relative simple and symmetric. However, modern neural networks are complex and hard to characterize performance (Roberts et al., 2021). We assume agnostic of the output properties of the model and thus apply the Wang-Landau algorithm to sample the entropy as a function of energy but with the gradient proposal in GWG to make the sampler more efficient. Similar to GWG, our sampler can propose the inputs corresponding to the under-explored regions of outputs. Improvements of efficiency can benefit from a patch of pixel changes.
|
| 121 |
+
|
| 122 |
+
# 5 EXPERIMENTS
|
| 123 |
+
|
| 124 |
+
In this section, we apply our proposed Gradient Wang-Landau sampler to inspect a few neural network models and present the discovered output histogram together with representative samples. The dataset and model training details are introduced in Sec. 5.1. We first empirically confirm our sampler performance through a toy example in Sec. 5.2. We then discuss results for modern binary classifiers in Sec. 5.3 and Sec. 5.4. Hyperparameters of the samplers tested in are Appendix C.
|
| 125 |
+
|
| 126 |
+
5.1 DATASETS, MODELS, AND OTHER EXPERIMENT SETTINGS
|
| 127 |
+
|
| 128 |
+
Datasets As aforementioned, we focus on binary classification. Therefore, we derive two datasets from the MNIST datasets by only including samples with labels $\{ 0 , 1 \}$ . The training and test splits are the same as those in the original MNIST dataset.
|
| 129 |
+
|
| 130 |
+
• Toy is a simple dataset with $5 \times 5$ binary input images we construct. It is designed to make feasible the bruteforce enumeration over the entire input space (only $2 ^ { 5 \times 5 }$ different samples). We center crop the MNIST samples from $\{ 0 , 1 \}$ classes and resize them to $5 \times 5$ images. We compute the average of the pixel values and use the average as the threshold to binarize the images — the pixel value lower than this threshold becomes 0; otherwise, it becomes 1. The duplicates are not removed for accuracy after resizing since PyTorch does not find duplicate row indices. • MNIST-0/1 is an MNIST dataset whose samples only have the 0,1 labels. To align with the GWG setting, the inputs are discrete and not $\mathrm { _ { Z } }$ -normalized. Therefore, in this dataset, the input $\mathbf { x }$ is $2 8 \times 2 8$ dimensional with discrete pixel values from $\{ 0 , . . . , 2 5 5 \}$ .
|
| 131 |
+
|
| 132 |
+
Neural Network Models for Evaluation Since the focus of this paper is not to compare different neural architectures, given the relatively small datasets we have, we train two types of models, a simple CNN and ResNet-18 (He et al., 2015). Each pixel of the inputs is first transformed to the one-hot encoding and passed to a 3-by-3 convolution layer with 3 channel output. The CNN model contains 2 convolution layers with 3-by-3 filter size. The output channels are 32 and 128. The final features are average-pooled and passed to a fully-connected layer for the binary classification.
|
| 133 |
+
|
| 134 |
+
Please keep in mind that our goal in this experiment section is to showcase that our proposed sampler can uncover some novel interesting empirical insights for neural network models. Models with different architectures, weights due to different initialization, optimization, and/or datasets will lead to different results. Therefore, our results and discussions are all model-specific. Specifically, we train a simple CNN model to classify the $5 \times 5$ binary images in the Toy dataset (CNN-Toy). The test accuracy of this CNN-Toy model reaches $9 9 . 7 \%$ , which is almost perfect. We train a simple CNN model to classify the $2 8 \times 2 8$ grey-scale images in the MNIST-0/1 dataset (CNN-MNIST-0/1). The test accuracy of CNN-MNIST-0/1 model is $9 7 . 8 \%$ . We train a ResNet-18 model to classify the $2 8 \times 2 8$ grey-scale images in the MNIST-0/1 dataset (ResNet-18-MNIST-0/1). The test accuracy of ResNet-18-MNIST-0/1 model is $1 0 0 \%$ .
|
| 135 |
+
|
| 136 |
+
Sampling Methods for Comparison We compare several different sampling methods (including our proposed method) to obtain the output histogram over the entire input space.
|
| 137 |
+
|
| 138 |
+
• Enumeration generates the histogram by enumerating all the possible pixel values as inputs. This is a rather slow but the most accurate method.
|
| 139 |
+
• In-dist Test Samples generates the histogram of the inputs based on the fixed test set.This is commonly used in machine learning evaluation. It is based on a very small and potentially biased subset of the entire input space.
|
| 140 |
+
• Wang-Landau algorithm (WL) generates the histogram the Wang-Landau algorithm with the random proposal. Specifically, we randomly pick one pixel at a time and change it to any valid (discrete) value as in this implementation 1
|
| 141 |
+
• Gradient Wang-Landau (GWL) generates the histogram by our proposed sampler of WangLandau algorithm with gradient proposal.
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
Figure 2: Output histograms of CNN-Toy obtained by different sampling methods. The indistribution samples are only a very small portion in the output histogram. We also present the representative samples obtained by GWL given different logit values.
|
| 145 |
+
|
| 146 |
+

|
| 147 |
+
Figure 3: Output histograms of CNN-MNIST-0/1 obtained by different sampling methods. The blue scale is for GWL and the red scale is for In-distribution Test Samples. We also present the representative samples obtained by GWL given different logit values (more in Fig. 6 in Appendix)
|
| 148 |
+
|
| 149 |
+
# 5.2 RESULTS OF CNN-TOY
|
| 150 |
+
|
| 151 |
+
Given the CNN-Toy model, we apply Enumeration, GWL, and In-dist Test Samples to obtain the output histograms, as shown in Fig. 2. Note that our GWL method samples the relative entropy of different energy values as duplicate x may be proposed. After normalization with the maximum entropy, the GWL histogram almost exactly matches the Enumeration histogram which is the ground truth histogram. This confirms the accuracy of our GWL sampler and we can apply it further to more complicated models with confidence.
|
| 152 |
+
|
| 153 |
+
Remarkably, this histogram is quite different from the expectation we presented in Fig. 1b — this histogram is even not centered at 0 or has the expected subdominant peaks on both the positive and negative sides. Instead, the dominant peak is so wide that it covers almost the entire spectrum of the possible output values. From a coarse-grained overview, most of the samples are mapped to the center of logit $- 5$ with a decay from $- 5$ to both sides in the CNN-Toy model. This shows the CNN-Toy model is biased to predict more samples to the negative logit values.
|
| 154 |
+
|
| 155 |
+
In Fig. 2, we also present the representative samples obtained by GWL given different logit values in the CNN-Toy model. The visualization results suggest that the CNN-Toy model probably learns the digit “1” for positive logit values as the center pixels of the representative samples are white (see the three representative samples with logit values from 0 to 20) and $\ " 0 \ "$ for the very negative logit values as the center pixels of the representative samples are black (see two representative samples with logit values from -20 to -30). From this example, one can see that the output histogram over the entire input space can offer a comprehensive understanding of the neural network models, helping researchers better understand critical questions such as the distribution of the outputs, where the model maps the samples to, and what the representative samples with high likelihood are.
|
| 156 |
+
|
| 157 |
+
# 5.3 RESULTS OF CNN-MNIST-0/1
|
| 158 |
+
|
| 159 |
+
Histogram Results by GWL The trial of applying GWL on the CNN-Toy model is encouraging and we now apply GWL to the CNN-MNIST-0/1 that is trained on a real-world dataset. The results are shown in Fig. 3. As our GWL reveals, the output histogram of CNN-MNIST-0/1, similar to CNN-Toy’s histogram, does not have the subdominant peaks. It is also different from the presumed case in Fig. 1b. Compared with the output histogram of the CNN-Toy model (i.e., Fig. 2), this time, the peak is on the negative boundary and the histogram is skewed towards the negative logit values. $S$ almost linearly decays to the positive logit values. While the in-distribution samples have logit values between $- 2 0$ and 15 as we expect, these samples are exponentially (i.e., $e ^ { 1 3 0 0 }$ at logit value -20 to $e ^ { 3 1 0 0 }$ at logit value 13, thousands in log scale) less often found than the majority samples whose logit values are around $- 5 5$ . From a fine-grained view, the CNN-MNIST-0/1 model tends to map the human-unrecognizable samples to the very negative logit values. While previous work (Nguyen et al., 2015) showed the existence of the overconfident prediction samples, our result shows a rough but quantitative performance of this CNN which can serve as a baseline for further improvements. One may notice that in Fig. 3, there is still some output values (e.g., the rightmost positive logit region) that are not yet covered by our GWL sampler. We believe that this calls for more future work to follow on more advanced efficient samplers.
|
| 160 |
+
|
| 161 |
+

|
| 162 |
+
Figure 4: Intermediate output histogram $S$ per iteration. (a) GWL gradually explores the logit values in the first iteration. (b) GWL discovers the output histogram well within 2 iterations. (c) The original WL explores the output distribution much slower.
|
| 163 |
+
|
| 164 |
+
GWL is much more efficient than WL Since WL takes a much longer time to converge, we are not able to obtain the converged results from WL. For the comparison purpose, we inspect the intermediate $S$ results of the GWL and WL samplers, as shown in Fig. 4. As one can see from Fig. 4a, in the first iteration, GWL has already been able to gradually explore the logit values efficiently from the most dominant output value around $- 5 5$ to the positive logit values. Within only two iterations, as shown in Fig. 4b, GWL can discover the output histogram covering the value range from $- 5 5$ to 13. On the other hand, as presented in Fig. 4c, in the first two iterations, the original WL can only explore the output ranges from around $- 5 5$ to $- 4 5$ ; in the 3rd iteration, WL converges significantly slower and never ends in a reasonable time. This result indicates that the GWL converges much faster than the original WL and is able to explore a much more diverse range of output values.
|
| 165 |
+
|
| 166 |
+
Manual inspection on more representative samples As show in Fig. 3, for the CNN-MNIST$_ { 0 / 1 }$ model, GWL can effectively sample input images from logit values ranging from -55 to 13. We further group these logit values per 100 bins (100 bins correspond to a difference of 10 in logit value) in $S$ , resulting in about 7 groups. For every group, we sample 200 representative input images. To make sure they are not correlated, we sample every 1000 steps. For demonstration purposes, we randomly pick 10-out-of-200 samples from every group in Fig. 6 in Appendix. We manually inspect the sufficiently positive group (e.g., the last column in Fig. 6) and the sufficiently negative groups (e.g., the first five columns in Fig. 6) , and there are no human recognizable samples of digits. We also observe an interesting pattern that as the logit value increases, more and more representative samples have black background. This result suggests that the CNN-MNIST-0/1 model may heavily rely on the background to classify the images (Xiao et al., 2020). We conjecture that is because the samples in the most dominant peak are closer to class 0 samples than class 1 samples (Appendix. D). In summary, although CNN-MNIST-0/1 holds a very high in-distribution test accuracy, it is far from a robust model because it does not truly understand the semantic structure of the digits.
|
| 167 |
+
|
| 168 |
+
Discussion Fig. 3 presents challenges to the OOD detection methods that may be more modeldependent than we thought before. If the model cannot map most of the human unrecognizable samples with high uncertainty, the likelihood-based OOD detection methods (Liu et al., 2020; Hendrycks & Gimpel, 2016) cannot perform well for samples in the entire input space. Fig. 6 shows the inputs with the in-distribution output values (output logits of the red plot) of the CNN model may not uniquely correspond to in-distribution samples. More rigorous experiments to a definite conclusion are yet required as future work.
|
| 169 |
+
|
| 170 |
+

|
| 171 |
+
(a) Results with random re-initialization.
|
| 172 |
+
|
| 173 |
+

|
| 174 |
+
(b) Results with test set re-initialization.
|
| 175 |
+
Figure 5: Output histograms of ResNet-18-MNIST-0/1 obtained by different sampling methods. There may be a sharp local minima in the output landscape causing a cliff around the logit value of -33 and making GWL “trapped”. We have tried two variants to address the “trapped” issue via (a) random re-initialization and (b) test set re-initialization. The blue scale is for GWL and the red scale is for In-distribution Test Samples. We also present the representative samples obtained by GWL given different logit values.
|
| 176 |
+
|
| 177 |
+
# 5.4 RESULTS OF RESNET-18-MNIST-0/1
|
| 178 |
+
|
| 179 |
+
When applying our GWL samplers to the ResNet-18-MNIST-0/1 model, we observe that the sampler can easily get trapped in some output regions. This is a fairly common phenomenon for WangLandau-based samplers, as reported in (Vogel et al., 2018). We follow the common practice to re-initialize the sampler to the random samples every time it gets trapped. We let those workers run 1000 steps (10,000 pixels selected with replacement) before counting to $S$ again. As shown in Fig. 5a, the smallest logit values in ResNet-18-MNIST-0/1 are around -220, much lower than those of CNN-MNIST-0/1. A wide range of negative logit values corresponds to human unrecognizable inputs and there is no obvious pattern observed in contrast to CNN-MNIST-0/1’s results.
|
| 180 |
+
|
| 181 |
+
Interestingly, we observe a cliff around the logit value of -33. We try another variant for reinitialization: we re-initialize using the test set samples every time it gets trapped in certain output value. This time, as shown in Figure 5b, it can explore the output values larger than -33. We believe there may be a sharp local minima in the output landscape, similar to the case discussed before Vogel et al. (2018).
|
| 182 |
+
|
| 183 |
+
Because of the “trapping” issue and the complexity of ResNet-18 over CNN, we have to relax the flatness check a bit to let GWL converge for the first iteration. Because of the less rigorous flatness check, we do not draw conclusions about ResNet-18-MNIST-0/1 evaluation of the relative entropy differences. Compared with the CNN-MNIST-0/1 model, ResNet-18-MNIST-0/1 has more interesting phenomena and further exploration is needed to understand these phenomena.
|
| 184 |
+
|
| 185 |
+
# 6 CONCLUSION
|
| 186 |
+
|
| 187 |
+
We aim to get a full picture of the input-output relationship of a model through the inputs valid in the pixel space. We propose to use a histogram to better understand the input-output distribution. When the inputs are high-dimensional, enumeration or uniform sampling is either impossible or takes too long to converge. We connect the density of states in physics to this histogram sampling problem. We propose to use an efficient sampler to achieve this goal. We confirm empirically this can be achieved and uncover some new aspects of neural networks.
|
| 188 |
+
|
| 189 |
+
For future work, it is interesting to develop a new and more efficient sampler that has theoretical guarantees to acquire this input-output relationship in order to sample with more pixels, such as the ImageNet (Deng et al., 2009). Most importantly, with this new sampler, we can develop new insights into network architectures developed in the last decade for open-world applications.
|
| 190 |
+
|
| 191 |
+
# 7 REPRODUCIBILITY
|
| 192 |
+
|
| 193 |
+
We provide fairly amount of information to re-implement our sampler. The data processing is in the Sec. 5.1 and algorithm is in Appendix B. The hyperparameters and sampling details are also listed in the Sec. 5. We also provide different time stamp of steps for our samplers to indicate what to expect during the sampling procedure in Fig. 4. Of course, the Wang-Landau algorithm we adopted is the prototypical one and it subjects to some issues reported in its follow-up works, such as the discontinuity of the boundaries between bins and trapping in one of the bins. These problems lead to some issues in our experiments and we discussed them in Sec. 5.4. More advanced algorithms have been developed to resolve these issues.
|
| 194 |
+
|
| 195 |
+
# 8 ETHICS STATEMENT
|
| 196 |
+
|
| 197 |
+
Our method aims to provide a comprehensitve understanding of the neural models. This work will be applicable to many applications, such as those in the safety and trusty-worthy machine learning. As a pilor study, we do not anticipate the negative aspects of our work.
|
| 198 |
+
|
| 199 |
+
# REFERENCES
|
| 200 |
+
|
| 201 |
+
Farzin Aghdasi. Digitization and analysis of mammographic images for early detection of breast cancer. PhD thesis, University of British Columbia, 1994.
|
| 202 |
+
|
| 203 |
+
Adrian Barbu and Song-Chun Zhu. Mapping the energy landscape. In Monte Carlo Methods, pp. 367–420. Springer, 2020.
|
| 204 |
+
|
| 205 |
+
Kevin Bowyer and P Jonathon Phillips. Empirical evaluation techniques in computer vision. IEEE Computer Society Press, 1998.
|
| 206 |
+
|
| 207 |
+
Kaidi Cao, Maria Brbic, and Jure Leskovec. Open-world semi-supervised learning. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum? id=O-r8LOR-CCA.
|
| 208 |
+
|
| 209 |
+
Tianqi Chen, Emily Fox, and Carlos Guestrin. Stochastic gradient hamiltonian monte carlo. In International conference on machine learning, pp. 1683–1691. PMLR, 2014.
|
| 210 |
+
|
| 211 |
+
Xiangning Chen, Cho-Jui Hsieh, and Boqing Gong. When vision transformers outperform resnets without pretraining or strong data augmentations. arXiv preprint arXiv:2106.01548, 2021.
|
| 212 |
+
|
| 213 |
+
Kyujin Cho, Peter Meer, and Javier Cabrera. Performance assessment through bootstrap. IEEE Transactions on Pattern Analysis and Machine Intelligence, 19(11):1185–1198, 1997.
|
| 214 |
+
|
| 215 |
+
Patrick Courtney, Neil Thacker, and Adrian F Clark. Algorithmic modelling for performance evaluation. Machine Vision and Applications, 9(5):219–228, 1997.
|
| 216 |
+
|
| 217 |
+
Antonio Gonc¸alves da Cunha-Netto, AA Caparica, Shan-Ho Tsai, Ronald Dickman, and David Paulˆ Landau. Improving wang-landau sampling with adaptive windows. Physical Review E, 78(5): 055701, 2008.
|
| 218 |
+
|
| 219 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, pp. 248–255, 2009. doi: 10.1109/CVPR.2009.5206848.
|
| 220 |
+
|
| 221 |
+
Wei Deng, Guang Lin, and Faming Liang. A contour stochastic gradient langevin dynamics algorithm for simulations of multi-modal distributions. In Advances in Neural Information Processing Systems, 2020.
|
| 222 |
+
|
| 223 |
+
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. ICLR, 2021.
|
| 224 |
+
|
| 225 |
+
Xiang Gao, Visvanathan Ramesh, and Terry Boult. Statistical characterization of morphological operator sequences. In European Conference on Computer Vision, pp. 590–605. Springer, 2002.
|
| 226 |
+
|
| 227 |
+
Will Grathwohl, Kevin Swersky, Milad Hashemi, David Duvenaud, and Chris Maddison. Oops i took a gradient: Scalable sampling for discrete distributions. In International Conference on Machine Learning, pp. 3831–3841. PMLR, 2021.
|
| 228 |
+
|
| 229 |
+
Michael Greiffenhagen, Dorin Comaniciu, Heinrich Niemann, and Visvanathan Ramesh. Design, analysis, and engineering of video monitoring systems: An approach and a case study. Proceedings of the IEEE, 89(10):1498–1517, 2001.
|
| 230 |
+
|
| 231 |
+
AM Hammitt and EB Bartlett. Determining functional relationships from trained neural networks. Mathematical and computer modelling, 22(3):83–103, 1995.
|
| 232 |
+
|
| 233 |
+
Robert M Haralick. Performance characterization in computer vision. In BMVC92, pp. 1–8. Springer, 1992.
|
| 234 |
+
|
| 235 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015.
|
| 236 |
+
|
| 237 |
+
Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. arXiv preprint arXiv:1610.02136, 2016.
|
| 238 |
+
|
| 239 |
+
Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich. Deep anomaly detection with outlier exposure. In International Conference on Learning Representations, 2019. URL https:// openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HyxCxhRcY7.
|
| 240 |
+
|
| 241 |
+
Mitch Hill, Erik Nijkamp, and Song-Chun Zhu. Building a telescope to look into high-dimensional image spaces. Quarterly of Applied Mathematics, 77(2):269–321, 2019.
|
| 242 |
+
|
| 243 |
+
Yen-Chang Hsu, Yilin Shen, Hongxia Jin, and Zsolt Kira. Generalized ODIN: Detecting outof-distribution image without learning from out-of-distribution data. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10951–10960, 2020.
|
| 244 |
+
|
| 245 |
+
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.
|
| 246 |
+
|
| 247 |
+
Christoph Junghans, Danny Perez, and Thomas Vogel. Molecular dynamics in the multicanonical ensemble: Equivalence of wang–landau sampling, statistical temperature molecular dynamics, and metadynamics. Journal of chemical theory and computation, 10(5):1843–1847, 2014.
|
| 248 |
+
|
| 249 |
+
Tapas Kanungo and Robert M Haralick. Character recognition using mathematical morphology. In Proc. of the Fourth USPS Conference on Advanced Technology, pp. 973–986, 1990.
|
| 250 |
+
|
| 251 |
+
Reinhard Klette, H Siegfried Stiehl, Max A Viergever, and Koen L Vincken. Performance characterization in computer vision. Springer, 2000.
|
| 252 |
+
|
| 253 |
+
Alexey Kurakin, Ian Goodfellow, Samy Bengio, et al. Adversarial examples in the physical world, 2016.
|
| 254 |
+
|
| 255 |
+
Kimin Lee, Honglak Lee, Kibok Lee, and Jinwoo Shin. Training confidence-calibrated classifiers for detecting out-of-distribution samples. arXiv preprint arXiv:1711.09325, 2017.
|
| 256 |
+
|
| 257 |
+
Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. In Advances in Neural Information Processing Systems, pp. 7167–7177, 2018.
|
| 258 |
+
|
| 259 |
+
Sang Hoon Lee and Wei Chen. A comparative study of uncertainty propagation methods for blackbox-type problems. Structural and multidisciplinary optimization, 37(3):239–253, 2009.
|
| 260 |
+
|
| 261 |
+
Chunyuan Li, Changyou Chen, David Carlson, and Lawrence Carin. Preconditioned stochastic gradient langevin dynamics for deep neural networks. In Thirtieth AAAI Conference on Artificial Intelligence, 2016.
|
| 262 |
+
|
| 263 |
+
Ying Wai Li and Markus Eisenbach. A histogram-free multicanonical monte carlo algorithm for the basis expansion of density of states. In Proceedings of the Platform for Advanced Scientific Computing Conference, pp. 1–7, 2017.
|
| 264 |
+
|
| 265 |
+
Shiyu Liang, Yixuan Li, and Rayadurgam Srikant. Enhancing the reliability of out-of-distribution image detection in neural networks. In 6th International Conference on Learning Representations, ICLR 2018, 2018.
|
| 266 |
+
|
| 267 |
+
Qiao Liu, Jiaze Xu, Rui Jiang, and Wing Hung Wong. Density estimation using deep generative neural networks. Proceedings of the National Academy of Sciences, 118(15):e2101344118, 2021.
|
| 268 |
+
|
| 269 |
+
Weitang Liu, Xiaoyun Wang, John Owens, and Yixuan Li. Energy-based out-of-distribution detection. Advances in Neural Information Processing Systems, 2020.
|
| 270 |
+
|
| 271 |
+
Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. arXiv preprint arXiv:1706.06083, 2017.
|
| 272 |
+
|
| 273 |
+
Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, and Shin Ishii. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. IEEE transactions on pattern analysis and machine intelligence, 41(8):1979–1993, 2018.
|
| 274 |
+
|
| 275 |
+
Sina Mohseni, Mandar Pitale, JBS Yadawa, and Zhangyang Wang. Self-supervised learning for generalizable out-of-distribution detection. Proceedings of the AAAI Conference on Artificial Intelligence, 34(04):5216–5223, April 2020. ISSN 2159-5399. doi: 10.1609/aaai.v34i04.5966.
|
| 276 |
+
|
| 277 |
+
Anh Nguyen, Jason Yosinski, and Jeff Clune. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 427–436, 2015.
|
| 278 |
+
|
| 279 |
+
V Ramesh and RM Haralick. A methodology for automatic selection of iu algorithm tuning parameters. In ARPA Image Understanding Workshop, 1994.
|
| 280 |
+
|
| 281 |
+
Visvanathan Ramesh and Robert M Haralick. Random perturbation models and performance characterization in computer vision. In Proceedings 1992 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, pp. 521–522. IEEE Computer Society, 1992.
|
| 282 |
+
|
| 283 |
+
Visvanathan Ramesh, RM Haralick, AS Bedekar, X Liu, DC Nadadur, KB Thornton, and X Zhang. Computer vision performance characterization. RADIUS: Image Understanding for Imagery Intelligence, pp. 241–282, 1997.
|
| 284 |
+
|
| 285 |
+
Jie Ren, Peter J Liu, Emily Fertig, Jasper Snoek, Ryan Poplin, Mark Depristo, Joshua Dillon, and Balaji Lakshminarayanan. Likelihood ratios for out-of-distribution detection. In Advances in Neural Information Processing Systems, pp. 14680–14691, 2019.
|
| 286 |
+
|
| 287 |
+
Daniel A Roberts, Sho Yaida, and Boris Hanin. The principles of deep learning theory. arXiv preprint arXiv:2106.10165, 2021.
|
| 288 |
+
|
| 289 |
+
Andras Rozsa, Ethan M Rudd, and Terrance E Boult. Adversarial diversity and hard positive generation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pp. 25–32, 2016.
|
| 290 |
+
|
| 291 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
|
| 292 |
+
|
| 293 |
+
Andreas Steiner, Alexander Kolesnikov, , Xiaohua Zhai, Ross Wightman, Jakob Uszkoreit, and Lucas Beyer. How to train your vit? data, augmentation, and regularization in vision transformers. arXiv preprint arXiv:2106.10270, 2021.
|
| 294 |
+
|
| 295 |
+
Yiyou Sun and Yixuan Li. Open-world contrastive learning. arXiv preprint arXiv:2208.02764, 2022.
|
| 296 |
+
|
| 297 |
+
Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
|
| 298 |
+
|
| 299 |
+
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, pp. 1–9, 2015.
|
| 300 |
+
|
| 301 |
+
Esteban G Tabak and Cristina V Turner. A family of nonparametric density estimation algorithms. Communications on Pure and Applied Mathematics, 66(2):145–164, 2013.
|
| 302 |
+
|
| 303 |
+
Neil A Thacker, Adrian F Clark, John L Barron, J Ross Beveridge, Patrick Courtney, William R Crum, Visvanathan Ramesh, and Christine Clark. Performance characterization in computer vision: A guide to best practices. Computer vision and image understanding, 109(3):305–334, 2008.
|
| 304 |
+
|
| 305 |
+
Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Andreas Steiner, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, and Alexey Dosovitskiy. Mlp-mixer: An all-mlp architecture for vision. arXiv preprint arXiv:2105.01601, 2021.
|
| 306 |
+
|
| 307 |
+
Thomas Vogel, Ying Wai Li, Thomas Wust, and David P Landau. Generic, hierarchical framework¨ for massively parallel wang-landau sampling. Physical review letters, 110(21):210603, 2013.
|
| 308 |
+
|
| 309 |
+
Thomas Vogel, Ying Wai Li, and David P. Landau. A practical guide to replica-exchange wang—landau simulations. 1012, 4 2018. ISSN 1742-6588. doi: 10.1088/1742-6596/1012/ 1/012003. URL https://www.osti.gov/biblio/1479789.
|
| 310 |
+
|
| 311 |
+
Fugao Wang and David P Landau. Efficient, multiple-range random walk algorithm to calculate the density of states. Physical review letters, 86(10):2050, 2001.
|
| 312 |
+
|
| 313 |
+
Max Welling and Yee W Teh. Bayesian learning via stochastic gradient langevin dynamics. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 681–688, 2011.
|
| 314 |
+
|
| 315 |
+
Kai Xiao, Logan Engstrom, Andrew Ilyas, and Aleksander Madry. Noise or signal: The role of image backgrounds in object recognition. arXiv preprint arXiv:2006.09994, 2020.
|
| 316 |
+
|
| 317 |
+
Cihang Xie, Zhishuai Zhang, Yuyin Zhou, Song Bai, Jianyu Wang, Zhou Ren, and Alan L Yuille. Improving transferability of adversarial examples with input diversity. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2730–2739, 2019.
|
| 318 |
+
|
| 319 |
+
Pan Xu, Jinghui Chen, Difan Zou, and Quanquan Gu. Global convergence of langevin dynamics based algorithms for nonconvex optimization. Advances in Neural Information Processing Systems, 31, 2018.
|
| 320 |
+
|
| 321 |
+
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
|
| 322 |
+
|
| 323 |
+
Chenggang Zhou, T. C. Schulthess, Stefan Torbrugge, and D. P. Landau. Wang-landau algorithm ¨ for continuous models and joint density of states. Phys. Rev. Lett., 96:120201, Mar 2006. doi: 10.1103/PhysRevLett.96.120201. URL https://link.aps.org/doi/10.1103/ PhysRevLett.96.120201.
|
| 324 |
+
|
| 325 |
+
Juntang Zhuang, Boqing Gong, Liangzhe Yuan, Yin Cui, Hartwig Adam, Nicha Dvornek, Sekhar Tatikonda, James Duncan, and Ting Liu. Surrogate gap minimization improves sharpness-aware training. ICLR, 2022.
|
| 326 |
+
|
| 327 |
+
# A APPENDIX A: REPRESENTATIVE INPUTS
|
| 328 |
+
|
| 329 |
+
Here we list more representative samples of the CNN-MNIST-0/1 scenario. The samples are bounded by a black box of boundaries.
|
| 330 |
+
|
| 331 |
+
<table><tr><td>-50.6 国</td><td>-43.2 -43.9</td><td>-31.5 国</td><td>-18.3 国 -18.5</td><td>-13.8 国</td><td>-0.5 □</td><td></td><td>10.3 ■</td></tr><tr><td>-54.2 国</td><td>国</td><td>-28.9 国</td><td></td><td>国</td><td>-13.9 国</td><td>0.6 国</td><td>8.8 □</td></tr><tr><td>-46.7 国</td><td>-44.2 国</td><td>-32.8 √</td><td>-17.4 √</td><td>-13.9 国</td><td></td><td>-3.5 国</td><td>11.2 ■</td></tr><tr><td>-49.3 国</td><td>-39.0 国</td><td>-26.0 国</td><td>-20.2 国</td><td>-9.8 国</td><td></td><td>0.7 国</td><td>7.9 □</td></tr><tr><td>-49.1 图</td><td>-39.6 国</td><td>-33.4 国</td><td>-23.4 国</td><td>-11.0 □</td><td></td><td>0.8 ■</td><td>6.3 1</td></tr><tr><td>-47.9 国</td><td>-35.7 園</td><td>-32.2 国</td><td>-18.6 国</td><td>-7.6 √</td><td></td><td>-0.7</td><td>9.3</td></tr><tr><td>-47.2</td><td>-43.1</td><td>-33.7</td><td>-16.2</td><td>-14.9</td><td></td><td>国 3.4</td><td>□ 10.4</td></tr><tr><td>国</td><td>国 -38.1</td><td>国 -28.8</td><td>□ -23.4</td><td>国</td><td></td><td>□</td><td>□</td></tr><tr><td>-45.1 国</td><td>国</td><td>国</td><td>国</td><td>-12.2 ?</td><td></td><td>3.9 □</td><td>14.8 ■</td></tr><tr><td>-53.1</td><td>-36.7</td><td>-33.5</td><td>-22.5</td><td>-5.7</td><td></td><td>-1.9</td><td>8.8</td></tr><tr><td>国</td><td>国</td><td>国</td><td>国</td><td>国</td><td></td><td>国</td><td>□</td></tr><tr><td>-48.7</td><td>-43.8</td><td>-31.7</td><td>-22.2</td><td>-8.0</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td>0.2</td><td></td></tr><tr><td>国</td><td>国</td><td>国</td><td>国</td><td></td><td>国</td><td>国</td><td>5.8 □</td></tr></table>
|
| 332 |
+
|
| 333 |
+
Figure 6: More representative samples of the CNN-MNIST-0/1 model obtained by GWL at different logit values, grouped by logit values. We further group these logit values per 100 bins (100 bins correspond to a difference of 10 in logit value) in $S$ , resulting in about 10 groups. The output values in the first column are within the range [-55,-45) and the second is from [-45,-35], etc.
|
| 334 |
+
|
| 335 |
+
# B APPENDIX B: GRADIENT WANG-LANDAU ALGORITHM
|
| 336 |
+
|
| 337 |
+
Here we provide the algorithms of the GWL algorithm. The input and output are listed. The hyperparameters are determined mostly by the toy-example.
|
| 338 |
+
|
| 339 |
+
<table><tr><td colspan="2">Algorithm 1 Our proposed Gradient Wang-Landau (GWL)</td></tr><tr><td>lation function g(z, S) for t=1,2,...,Tdo X~Dte while His not flat do</td><td>Require: pretrained model y: X → z, flat histogram H = O,entropy histogram S = 0, increment/step-size lnf, number of iterations T,test set Dte, GWG sampler GWG(z,S), interpo- > Get the continuous interpolation entropy Sin at output z</td></tr><tr><td colspan="2">z =y(x) Sin=g(z,S) X ~ GWG(z,-Sin) = round(z) Round z to the nearest z' that corresponds to one of the bins S[]←S[]+lnf H[]←H[]+1 end while lnf ←lnf/2</td></tr></table>
|
| 340 |
+
|
| 341 |
+
# C HYPER-PARAMETERS AND IMPLEMENTATION DETAILS FOR GWL AND WL
|
| 342 |
+
|
| 343 |
+
The hyper-parameters for GWL and WL are extremely similar, if not identical, as the only major difference between GWL and WL is the gradient proposal versus the random proposal. We first preset a large enough range of output values for the sampler to explore the trained neural network models. In our experiments, we found that the output (logit) values of the binary classifiers typically fall in the range of -300 to 100 (based on ResNet). Therefore, we use this range for all experiments. For flatness histogram $H$ , the bin window size is set to be 1, resulting in 400 bins. The histogram $H$ is considered flat if the difference between maximum bin value and minimum bin value is smaller than the average bin value. For output histogram $S$ , we set the bin window size to be 0.1, resulting in 4000 bins. Instead of updating one bin at a time for $S$ , we update the neighbor bins with exponential decay. We use the linear interpolation to approximate the bins for continuous queries. We iterate 5 times with test set initialization. Every step the GWG tries to at most update 10 pixels.
|
| 344 |
+
|
| 345 |
+
# D SAMPLES SIMILARITY
|
| 346 |
+
|
| 347 |
+
The samples in the most dominant peak may be closer to class 0 than to class 1. We compute the L2 pixel-wise distance from the uniform noise image to the samples of class 1 and 0 respectively. The mean L2 distance from uniform noise to 0 is around 0.3121 and that from uniform noise to 1 is around 0.3236. The distance between 1 and 0 samples is 0.1652. This result shows the samples in the most dominant peak are closer to class 0 samples than class 1 samples. More rigorous experiments to a definite conclusion is yet required as future work.
|
md/dev/VgOw1pUPh97/VgOw1pUPh97.md
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SegNeXt: Rethinking Convolutional Attention Design for Semantic Segmentation
|
| 2 |
+
|
| 3 |
+
Meng-Hao Guo1 Cheng-Ze $\mathbf { L } \mathbf { u } ^ { 2 }$ Qibin Hou2 Zheng-Ning Liu3 Ming-Ming Cheng2 Shi-Min $\mathbf { H } \mathbf { u } ^ { 1 * }$
|
| 4 |
+
|
| 5 |
+
1BNRist, Department of Computer Science and Technology, Tsinghua University 2TMCC, CS, Nankai University 3Fitten Tech, Beijing, China
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
We present SegNeXt, a simple convolutional network architecture for semantic segmentation. Recent transformer-based models have dominated the field of semantic segmentation due to the efficiency of self-attention in encoding spatial information. In this paper, we show that convolutional attention is a more efficient and effective way to encode contextual information than the self-attention mechanism in transformers. By re-examining the characteristics owned by successful segmentation models, we discover several key components leading to the performance improvement of segmentation models. This motivates us to design a novel convolutional attention network that uses cheap convolutional operations. Without bells and whistles, our SegNeXt significantly improves the performance of previous state-of-the-art methods on popular benchmarks, including ADE20K, Cityscapes, COCO-Stuff, Pascal VOC, Pascal Context, and iSAID. Notably, SegNeXt outperforms EfficientNet-L2 w/ NAS-FPN and achieves $9 0 . 6 \%$ mIoU on the Pascal VOC 2012 test leaderboard using only $1 / _ { 1 0 }$ parameters of it. On average, SegNeXt achieves about $2 . 0 \%$ mIoU improvements compared to the state-of-the-art methods on the ADE20K datasets with the same or fewer computations.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
As one of the most fundamental research topics in computer vision, semantic segmentation, which aims at assigning each pixel a semantic category, has attracted great attention over the past decade. From early CNN-based models, typified by FCN [60] and DeepLab series [4, 5, 7], to recent transformer-based methods, represented by SETR [108] and SegFormer [90], semantic segmentation models have experienced significant revolution in terms of network architectures.
|
| 14 |
+
|
| 15 |
+
Table 1: Properties we observe from the successful semantic segmentation methods that are beneficial to the boost of model performance. Here, $n$ refers to the number of pixels or tokens. Strong encoder denotes strong backbones, like ViT [16] and VAN [25].
|
| 16 |
+
|
| 17 |
+
<table><tr><td>Properties</td><td>DeepLabV3+</td><td>HRNet</td><td> SETR</td><td>SegFormer</td><td>SegNeXt</td></tr><tr><td>Strong encoder Multi-scale interaction</td><td>X</td><td>X</td><td>√</td><td>√</td><td>√</td></tr><tr><td>Spatial attention</td><td>X</td><td>√ X</td><td>X</td><td>×</td><td>:</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Computational complexity</td><td>0(n)</td><td>0(n)</td><td>O(n2)</td><td>O(n2)</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>O(n)</td></tr></table>
|
| 18 |
+
|
| 19 |
+
∗S.-M. Hu is the corresponding author. Project page: https://github.com/Jittor/JSeg
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Performance-Computing curves on the Cityscapes (left) and ADE20K (right) validation sets. FLOPs are calculated using an input size of 2, $0 4 8 \times 1$ , 024 for Cityscapes and $5 1 2 \times 5 1 2$ for ADE20K. The size of the circle indicates the number of parameters. Larger circles mean more parameters. We can see that our SegNeXt achieves the best trade-off between segmentation performance and computational complexity.
|
| 23 |
+
|
| 24 |
+
By revisiting previous successful semantic segmentation works, we summarize several key properties different models possess as shown in Tab. 1. Based on the above observation, we argue a successful semantic segmentation model should have the following characteristics: (i) A strong backbone network as encoder. Compared to previous CNN-based models, the performance improvement of transformer-based models is mostly from a stronger backbone network. (ii) Multi-scale information interaction. Different from the image classification task that mostly identifies a single object, semantic segmentation is a dense prediction task and hence needs to process objects of varying sizes in a single image. (iii) Spatial attention. Spatial attention allows models to perform segmentation through prioritization of areas within the semantic regions. (iv) Low computational complexity. This is especially crucial when dealing with high-resolution images from remote sensing and urban scenes.
|
| 25 |
+
|
| 26 |
+
Taking the aforementioned analysis into account, in this paper, we rethink the design of convolutional attention and propose an efficient yet effective architecture for semantic segmentation. Unlike previous transformer-based models that use convolutions in decoders as feature refiners, our method inverts the transformer-convolution encoder-decoder architecture. Specifically, for each block in our encoder, we renovate the design of conventional convolutional blocks and utilize multi-scale convolutional features to evoke spatial attention via a simple element-wise multiplication following [25]. We found such a simple way to build spatial attention is more efficient than both the standard convolutions and self-attention in spatial information encoding. For decoder, we collect multi-level features from different stages and use Hamburger [22] to further extract global context. Under this setting, our method can obtain multi-scale context from local to global, achieve adaptability in spatial and channel dimensions, and aggregate information from low to high levels.
|
| 27 |
+
|
| 28 |
+
Our network, termed SegNeXt, is mostly composed of convolutional operations except the decoder part, which contains a decomposition-based Hamburger module [22] (Ham) for global information extraction. This makes our SegNeXt much more efficient than previous segmentation methods that heavily rely on transformers. As shown in Fig. 1, SegNeXt outperforms recent transformer-based methods significantly. In particular, our SegNeXt-S outperforms SegFormer-B2 ( $8 1 . 3 \%$ vs. $8 1 . 0 \%$ ) using only about 1/6 (124.6G vs. 717.1G) computational cost and $1 / 2$ parameters (13.9M vs. 27.6M) when dealing with high-resolution urban scenes from the Cityscapes dataset.
|
| 29 |
+
|
| 30 |
+
Our contributions can be summarized as follows:
|
| 31 |
+
|
| 32 |
+
• We identify the characteristics that a good semantic segmentation model should own and present a novel tailored network architecture, termed SegNeXt, that evokes spatial attention via multi-scale convolutional features.
|
| 33 |
+
• We show that an encoder with simple and cheap convolutions can still perform better than vision transformers, especially when processing object details, while it requires much less computational cost.
|
| 34 |
+
|
| 35 |
+
• Our method improves the performance of state-of-the-art semantic segmentation methods by a large margin on various segmentation benchmarks, including ADE20K, Cityscapes, COCO-Stuff, Pascal VOC, Pascal Context, and iSAID.
|
| 36 |
+
|
| 37 |
+
# 2 Related Work
|
| 38 |
+
|
| 39 |
+
# 2.1 Semantic Segmentation
|
| 40 |
+
|
| 41 |
+
Semantic segmentation is a fundamental computer vision task. Since FCN [60] was proposed, convolutional neural networks (CNNs) [1, 71, 98, 106, 20, 99, 79, 21, 51] have achieved great success and become a popular architecture for semantic segmentation. Recently, transformer-based methods [108, 90, 100, 73, 70, 50, 10, 9] have shown great potentials and outperform CNN-based methods.
|
| 42 |
+
|
| 43 |
+
In the era of deep learning, the architecture of segmentation models can be roughly divided into two parts: encoder and decoder. For the encoder, researchers usually adopt popular classification networks (e.g., ResNet [28], ResNeXt [91] and DenseNet [33]) instead of tailored architecture. However, semantic segmentation is a kind of dense prediction task, which is different from image classification. The improvement in classification may not appear in the challenging segmentation task [29]. Thus, some tailored encoders appear, including Res2Net [21], HRNet [79], SETR [108], SegFormer [90], HRFormer [100], MPViT [44], DPT [70], etc. For the decoder, it is often used in cooperating with encoders to achieve better results. There are different types of decoders for different goals, including achieving multi-scale receptive fields [106, 6, 88], collecting multi-scale semantics [71, 90, 7], enlarging receptive field [4, 4, 69], strengthening edge features [107, 2, 15, 48, 102], and capturing global context [20, 35, 101, 46, 24, 27, 103].
|
| 44 |
+
|
| 45 |
+
In this paper, we summarize the characteristics of those successful models designed for semantic segmentation and present a CNN-based model, named SegNeXt. The most related work to our paper, is [69], which decomposes a $k \times k$ convolution into a pair of $k \times 1$ and $1 \times k$ convolutions. Though this work has shown large convolutional kernels matter in semantic segmentation, it ignores the importance of multi-scale receptive field and does not consider how to leverage these multi-scale features extracted by large kernels for segmentation in the form of attention.
|
| 46 |
+
|
| 47 |
+
# 2.2 Multi-Scale Networks
|
| 48 |
+
|
| 49 |
+
Designing multi-scale network is one of the popular directions in computer vision. For segmentation models, multi-scale blocks appear in both the encoder [79, 21, 75] and the decoder [106, 98, 5] parts. GoogleNet [75] is one of the most related multi-scale architectures to our method, which uses a multi-branch structure to achieve multi-scale feature extraction. Another work that is related to our method is HRNet [79]. In the deeper stages, HRNet also keeps high-resolution features, which are aggregated with low-resolution features, to enable multi-scale feature extraction.
|
| 50 |
+
|
| 51 |
+
Different from previous methods, SegNeXt, besides capturing multi-scale features in encoder, introduces an efficient attention mechanism and employs cheaper and larger kernel convolutions. These enable our model to achieve higher performance than the aforementioned segmentation methods.
|
| 52 |
+
|
| 53 |
+
# 2.3 Attention Mechanisms
|
| 54 |
+
|
| 55 |
+
Attention mechanism is a kind of adaptive selection process, which aims to make the network focus on the important part. Generally speaking, it can be divided into two categories in semantic segmentation [26], including channel attention and spatial attention. Different types of attentions play different roles. For instance, spatial attentions mainly care about the important spatial regions [16, 13, 64, 58, 23]. Differently, the goal of using channel attention is to make the network selectively attend to those important objects, which has been demonstrated important in previous works [31, 8, 80]. Speaking of the recent popular vision transformers [16, 58, 94, 81, 82, 57, 90, 34, 56, 100, 93], they usually ignore adaptability in channel dimension.
|
| 56 |
+
|
| 57 |
+
Visual attention network (VAN) [25] is the most related work to SegNeXt, which also proposes to leverage the large-kernel attention (LKA) mechanism to build both channel and spatial attention. Though VAN has achieved great performance in image classification, it neglects the role of multi-scale feature aggregation during the network design, which is crucial for segmentation-like tasks.
|
| 58 |
+
|
| 59 |
+

|
| 60 |
+
Figure 2: Illustration of the proposed MSCA and MSCAN. Here, $d , k _ { 1 } \times k _ { 2 }$ means a depth-wise convolution $( d )$ using a kernel size of $k _ { 1 } \times k _ { 2 }$ . We extract multi-scale features using convolutions and then utilize them as attention weights to reweigh the input of MSCA.
|
| 61 |
+
|
| 62 |
+
# 3 Method
|
| 63 |
+
|
| 64 |
+
In this section, we describe the architecture of the proposed SegNeXt in detail. Basically, we adopt an encoder-decoder architecture following most previous works, which is simple and easy to follow.
|
| 65 |
+
|
| 66 |
+
# 3.1 Convolutional Encoder
|
| 67 |
+
|
| 68 |
+
We adopt the pyramid structure for our encoder following most previous work [90, 4, 20]. For the building block in our encoder, we adopt a similar structure to that of ViT [16, 90] but what is different is that we do not use the self-attention mechanism but design a novel multi-scale convolutional attention (MSCA) module. As depicted in Fig. 2 (a), MSCA contains three parts: a depth-wise convolution to aggregate local information, multi-branch depth-wise strip convolutions to capture multi-scale context, and an $1 \times 1$ convolution to model relationship between different channels. The output of the $1 \times 1$ convolution is used as attention weights directly to reweigh the input of MSCA. Mathematically, our MSCA can be written as:
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
\begin{array} { r l } & { \mathrm { A t t } = \mathrm { C o n v } _ { 1 \times 1 } ( \displaystyle \sum _ { i = 0 } ^ { 3 } \mathrm { S c a l e } _ { i } ( \mathrm { D W } \mathrm { - C o n v } ( F ) ) ) , } \\ & { \mathrm { O u t } = \mathrm { A t t } \otimes F . } \end{array}
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
where $F$ represents the input feature. Att and Out are the attention map and output, respectively. $\otimes$ is the element-wise matrix multiplication operation. DW-Conv denotes depth-wise convolution and $\mathrm { S c a l e } _ { i }$ , $i \in \{ 0 , 1 , 2 , 3 \}$ , denotes the $i$ th branch in Fig. 2(b). Scale $^ 0$ is the identity connection. Following [69], in each branch, we use two depth-wise strip convolutions to approximate standard depth-wise convolutions with large kernels. Here, the kernel size for each branch is set to 7, 11, and 21, respectively. The reasons why we choose depth-wise strip convolutions are two-fold. On one hand, strip convolution is lightweight. To mimic a standard 2D convolution with kernel size $7 \times 7$ , we only need a pair of $7 \times 1$ and $1 \times 7$ convolutions. On the other hand, there are some strip-like objects, such as human and telephone pole in the segmentation scenes. Thus, strip convolution can be a complement of grid convolutions and helps extract strip-like features [69, 30].
|
| 75 |
+
|
| 76 |
+
Stacking a sequence of building blocks yields the proposed convolutional encoder, named MSCAN. For MSCAN, we adopt a common hierarchical structure, which contains four stages with decreasing spatial resolutions $\begin{array} { l } { \frac { H } { 4 } ^ { \bullet } \times \frac { W } { 4 } } \end{array}$ , ${ \frac { H } { 8 } } \times { \frac { W } { 8 } }$ , $\begin{array} { r } { \frac { H } { 1 6 } \times \frac { W } { 1 6 } } \end{array}$ and $\textstyle { \frac { H } { 3 2 } } \times { \frac { W } { 3 2 } }$ . Here, $H$ and $W$ are height and width of the input image, respectively. Each stage contains a down-sampling block and a stack of building blocks as described above. The down-sampling block has a convolution with stride 2 and kernel size $3 \times 3$ , followed by a batch normalization layer [36]. Note that, in each building block of MSCAN, we use batch normalization instead of layer normalization as we found batch normalization gains more for the segmentation performance.
|
| 77 |
+
|
| 78 |
+
Table 2: Detailed settings of different sizes of the proposed SegNeXt. In this table, ‘e.r.’ represents the expansion ratio in the feed-forward network. $C '$ and $\cdot _ { L } ,$ are the numbers of channels and building blocks, respectively. ‘Decoder dimension’ denotes the MLP dimension in the decoder. ‘Parameters’ are calculated on the ADE20K dataset [111]. Due to the different numbers of the categories in different datasets, the number of parameters may change slightly.
|
| 79 |
+
|
| 80 |
+
<table><tr><td rowspan=1 colspan=1>stage</td><td rowspan=1 colspan=1>output size|e.r.</td><td rowspan=1 colspan=1>SegNeXt-T</td><td rowspan=1 colspan=1>SegNeXt-S</td><td rowspan=1 colspan=1>SegNeXt-B</td><td rowspan=1 colspan=1>SegNeXt-L</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>C=32,L=3</td><td rowspan=1 colspan=1>C =64,L=2</td><td rowspan=1 colspan=1>C = 64,L =3</td><td rowspan=1 colspan=1>C =64,L=3</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>xxC8</td><td rowspan=1 colspan=1>C=64,L=3</td><td rowspan=1 colspan=1>C =128,L = 2</td><td rowspan=1 colspan=1>C=128,L=3</td><td rowspan=1 colspan=1>C=128,L=5</td></tr><tr><td rowspan=1 colspan=2>3</td><td rowspan=1 colspan=1>C = 160,L = 5</td><td rowspan=1 colspan=1>C = 320,L = 4</td><td rowspan=1 colspan=1>C = 320,L = 12</td><td rowspan=1 colspan=1>C = 320,L = 27</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>×wxC4</td><td rowspan=1 colspan=1>C = 256,L = 2</td><td rowspan=1 colspan=1>C = 512,L = 2</td><td rowspan=1 colspan=1>C = 512,L =3</td><td rowspan=1 colspan=1>C =512,L =3</td></tr><tr><td rowspan=1 colspan=2>Decoder dimension</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>1,024</td></tr><tr><td rowspan=1 colspan=2>Parameters (M)</td><td rowspan=1 colspan=1>4.3</td><td rowspan=1 colspan=1>13.9</td><td rowspan=1 colspan=1>27.6</td><td rowspan=1 colspan=1>48.9</td></tr></table>
|
| 81 |
+
|
| 82 |
+
We desgin four encoder models with different sizes, named MSCAN-T, MSCAN-S, MSCAN-B, and MSCAN-L, respectively. The corresponding overall segmentation models are termed SegNeXt-T, SegNeXt-S, SegNeXt-B, SegNeXt-L, respectively. Detailed network settings are displayed in Tab. 2.
|
| 83 |
+
|
| 84 |
+
# 3.2 Decoder
|
| 85 |
+
|
| 86 |
+
In segmentation models [90, 108, 4], the encoders are mostly pretrained on the ImageNet dataset. To capture high-level semantics, a decoder is usually necessary, which is applied upon the encoder. In this work, we investigate three simple decoder structures, which have been shown in Fig. 3. The first one, adopted in SegFormer [90], is a purely MLP-based structure. The second one is mostly adopted CNN-based models. In this kind of structure, the output of the encoder is directly used as the input to a heavy decoder head, like ASPP [4], PSP [106], and DANet [20]. The last one is the structure adopted in our SegNeXt. We aggregate features from the last three stages and use a lightweight Hamburger [22] to further model the global context. Combined with our powerful convolutional encoder, we found that using a lightweight decoder improves performance-computation efficiency.
|
| 87 |
+
|
| 88 |
+

|
| 89 |
+
Figure 3: Three different decoder designs.
|
| 90 |
+
|
| 91 |
+
It is worth nothing that unlike SegFormer whose decoder aggregates the features from Stage 1 to Stage 4, our decoder only receives features from the last three stages. This is because our SegNeXt is based on convolutions. The features from Stage 1 contain too much low-level information and hurts the performance. Besides, operations on Stage 1 bring heavy computational overhead. In our experiment section, we will show that our convolutional SegNeXt performs much better than the recent state-of-the-art transformer-based SegFormer [90] and HRFormer [100].
|
| 92 |
+
|
| 93 |
+
# 4 Experiments
|
| 94 |
+
|
| 95 |
+
Dataset. We evaluate our methods on seven popular datasets, including ImageNet-1K [14], ADE20K [111], Cityscapes [12], Pascal VOC [17], Pascal Context [65], COCO-Stuff [3], and iSAID [84]. ImageNet [14] is the best-known dataset for image classification, which contains
|
| 96 |
+
|
| 97 |
+
Table 3: Comparison with state-of-the-art methods on ImageNet validation set. ‘Acc.’ denotes Top-1 accuracy.
|
| 98 |
+
|
| 99 |
+
<table><tr><td rowspan=1 colspan=3>Method</td><td rowspan=1 colspan=1>Params. (M)</td><td rowspan=1 colspan=1>Acc. (%)</td></tr><tr><td rowspan=1 colspan=3>MiT-B0 [90]VAN-Tiny [25]MSCAN-T</td><td rowspan=1 colspan=1>3.74.14.2</td><td rowspan=1 colspan=1>70.575.475.9</td></tr><tr><td rowspan=1 colspan=3>MiT-B1 [90]VAN-Small [25]MSCAN-S</td><td rowspan=1 colspan=1>14.013.914.0</td><td rowspan=1 colspan=1>78.781.181.2</td></tr><tr><td rowspan=1 colspan=3>MiT-B2 [90]Swin-T[58]ConvNeXt-T[59]VAN-Base [25]MSCAN-B</td><td rowspan=1 colspan=1>25.428.328.626.626.8</td><td rowspan=1 colspan=1>81.681.382.182.883.0</td></tr><tr><td rowspan=5 colspan=3>MiT-B3 [28]Swin-S [58]ConvNeXt-S [58]VAN-Large [25]MSCAN-L</td><td rowspan=1 colspan=1>45.2</td><td rowspan=1 colspan=1>83.1</td></tr><tr><td rowspan=1 colspan=1>49.6</td><td rowspan=1 colspan=1>83.0</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>50.1</td><td rowspan=2 colspan=1>83.183.9</td></tr><tr><td rowspan=1 colspan=2>5]</td><td rowspan=1 colspan=1>44.8</td></tr><tr><td rowspan=1 colspan=1>45.2</td><td rowspan=1 colspan=1>83.9</td></tr></table>
|
| 100 |
+
|
| 101 |
+
Table 4: Comparison with state-of-the-art methods on the remote sensing dataset iSAID. Single-scale (SS) test is applied by default. Our SegNeXt-T has achieved state-of-the-art performance.
|
| 102 |
+
|
| 103 |
+
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Backbone</td><td rowspan=1 colspan=1>mIoU (%)</td></tr><tr><td rowspan=2 colspan=1>DenseASPP[95]PSPNet [106]</td><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>57.3</td></tr><tr><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>60.3</td></tr><tr><td rowspan=1 colspan=1>SemanticFPN [40]</td><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>62.1</td></tr><tr><td rowspan=1 colspan=1>RefineNet [54]</td><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>60.2</td></tr><tr><td rowspan=1 colspan=1>HRNet [79]</td><td rowspan=1 colspan=1>HRNetW-18</td><td rowspan=1 colspan=1>61.5</td></tr><tr><td rowspan=2 colspan=1>GSCNN[76]SFNet [49]</td><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>63.4</td></tr><tr><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>64.3</td></tr><tr><td rowspan=1 colspan=1>RANet [66]</td><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>62.1</td></tr><tr><td rowspan=1 colspan=1>PointRend [41]</td><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>62.8</td></tr><tr><td rowspan=1 colspan=1>FarSeg[109]</td><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>63.7</td></tr><tr><td rowspan=2 colspan=1>UperNet [89]PointFlow [47]</td><td rowspan=1 colspan=1>Swin-T</td><td rowspan=1 colspan=1>64.6</td></tr><tr><td rowspan=1 colspan=1>ResNet50</td><td rowspan=1 colspan=1>66.9</td></tr><tr><td rowspan=4 colspan=1>SegNeXt-TSegNeXt-SSegNeXt-BSegNeXt-L</td><td rowspan=1 colspan=1>MSCAN-T</td><td rowspan=1 colspan=1>68.3</td></tr><tr><td rowspan=1 colspan=1>MSCAN-S</td><td rowspan=1 colspan=1>68.8</td></tr><tr><td rowspan=1 colspan=1>MSCAN-B</td><td rowspan=1 colspan=1>69.9</td></tr><tr><td rowspan=1 colspan=1>MSCAN-L</td><td rowspan=1 colspan=1>70.3</td></tr></table>
|
| 104 |
+
|
| 105 |
+
1,000 categories. Similar to most segmentation methods, we use it to pretrain our MSCAN encoder. ADE20K [111] is a challenging dataset which contains 150 semantic classes. It consists of 20,210/2,000/3,352 images in the training, validation and test sets. Cityscapes [12] mainly focuses on urban scenes and contains 5.000 high-resolution images with 19 categories. There are 2,975/500/1,525 images for training, validation and testing, respectively. Pascal VOC [17] involves 20 foreground classes and a background class. After augmentation, it has 10, 582/1, 449/1, 456 images for training, validation and testing, respectively. Pascal Context [65] contains 59 foreground classes and a background class. The training set and validation set contain 4,996 and 5,104 images, respectively. COCO-Stuff [3] is also a challenging benchmark, which contains 172 semantic categories and 164k images in total. iSAID [84] is a large-scale aerial image segmentation benchmark, which includes 15 foreground classes and a background class. Its training, validation and test sets separately involve 1,411/458/937 images.
|
| 106 |
+
|
| 107 |
+
Implementation details. We conduct experiments by using Jittor [32] and Pytorch [68]. Our implementation is based on timm (Apache-2.0) [85] and mmsegmentation (Apache-2.0) [11] libraries for classification and segmentation, respectively. All encoders of our segmentation models are pretrained on the ImageNet-1K dataset [14]. We adopt Top-1 accuracy and mean Intersection over Union (mIoU) as our evaluation metrics for classification and segmentation, respectively. All models are trained on a node with 8 RTX 3090 GPUs.
|
| 108 |
+
|
| 109 |
+
For ImageNet pretraining, our data augmentation method and training settings are the same as DeiT [78]. For segmentation experiments, we adopt some common data augmentation including random horizontal flipping, random scaling (from 0.5 to 2) and random cropping. The batch size is set to 8 for the Cityscapes dataset and 16 for all the other datasets. AdamW [61] is applied to train our models. We set the initial learning rate as 0.00006 and employ the poly-learning rate decay policy. We train our model 160K iterations for ADE20K, Cityscapes and iSAID datasets and 80K iterations for COCO-Stuff, Pascal VOC and Pascal Context datasets. During testing, we use both the single-scale (SS) and multi-scale (MS) flip test strategies for a fair comparison. More details can be found in our supplementary materials.
|
| 110 |
+
|
| 111 |
+
# 4.1 Encoder Performance on ImageNet
|
| 112 |
+
|
| 113 |
+
ImageNet pretraining is a common strategy for training segmentation models [106, 5, 90, 100, 4]. Here, we compare the performance of our MSCAN with several recent popular CNN-based and transformer-based classification models. As shown in Tab. 3, our MSCAN achieves better results than the recent state-of-the-art CNN-based method, ConvNeXt [59] and outperforms popular transformerbased methods, like Swin Transformer [58] and MiT, the encoder of SegFormer [90].
|
| 114 |
+
|
| 115 |
+
Table 5: Performance of different attention mechanisms in decoder. SegNeXt-B w/ Ham means the MSCAN-B encoder plus the Ham decoder. FLOPs are calculated using the input size of $5 1 2 \times 5 1 2$ .
|
| 116 |
+
|
| 117 |
+
<table><tr><td>Architecture</td><td>Params. (M)</td><td>GFLOPs</td><td>mIoU (SS)</td><td>mIoU (MS)</td></tr><tr><td>SegNeXt-B w/ CC [35]</td><td>27.8</td><td>35.7</td><td>47.3</td><td>48.6</td></tr><tr><td>SegNeXt-B w/EMA [46]</td><td>27.4</td><td>32.3</td><td>48.0</td><td>49.1</td></tr><tr><td>SegNeXt-B w/ NL [83]</td><td>27.6</td><td>40.9</td><td>48.6</td><td>50.0</td></tr><tr><td>SegNeXt-B w/ Ham [22]</td><td>27.6</td><td>34.9</td><td>48.5</td><td>49.9</td></tr></table>
|
| 118 |
+
|
| 119 |
+
# 4.2 Ablation study
|
| 120 |
+
|
| 121 |
+
Ablation on MSCA design. We conduct ablation study on MSCA design on both ImageNet and ADE20K dataset. $\mathbf { K } \times \mathbf { K }$ branch contains a depth-wise $1 \times \mathrm { K }$ convolution and a $\textsf { K } \times 1$ depth-wise convolution. $1 \times 1$ conv means the channel mixing operation. Attention means the element-wise product, which makes the network obtain adaptive ability. Results are shown in Tab. 6. We can find that each part contributes to the final performance.
|
| 122 |
+
|
| 123 |
+
Table 6: Ablation study on the design of MSCA. Top-1 means Top-1 accuracy on ImageNet dataset and mIoU denotes mIoU on ADE20K benchmark. The results are based on MSCAN-T.
|
| 124 |
+
|
| 125 |
+
<table><tr><td>7 × 7branch</td><td></td><td>11 ×11 branch|21 × 21 branch</td><td>1×1Conv</td><td>Attention</td><td>Top-1</td><td>mIoU</td></tr><tr><td><xx<<></td><td>x<x<<></td><td>xx<<<></td><td><<<x<></td><td><<<<x></td><td>74.7</td><td>39.6</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>75.2</td><td>39.7</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>75.3</td><td>40.0</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>74.8</td><td>39.1</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>75.5</td><td>40.5</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>75.9</td><td>41.1</td></tr></table>
|
| 126 |
+
|
| 127 |
+
Global Context for Decoder. Decoder plays an important role in integrating global context from multi-scale features for segmentation models. Here, we investigate the influence of different global context modules on decoder. As shown in most previous works [83, 20], attention-based decoders achieves better performance for CNNs than pyramid structures [106, 4], we thus only show the results using attention-based decoders. Specifically, we show results with 4 different types of attentionbased decoders, including non-local (NL) attention [83] with $\mathcal { O } ( n ^ { 2 } )$ complexity and CCNet [35], EMANet [46], and HamNet [22] with ${ \mathcal { O } } ( n )$ complexity. As shown in Tab. 5, Ham achieves the best trade-off between complexity and performance. Therefore, we use Hamburger [22] in our decoder.
|
| 128 |
+
|
| 129 |
+
Table 7: Performance of different decoder structures. SegNeXt-T (a) means Fig. 3 (a) is used in decoder. FLOPs are calculated using the input size of $5 1 2 \times 5 1 2$ . SegNeXt-T (c) w/ stage 1 means the output of stage 1 is also sent into the decoder.
|
| 130 |
+
|
| 131 |
+
<table><tr><td>Architecture</td><td>Params. (M)</td><td>GFLOPs</td><td>mIoU (SS)</td><td>mIoU (MS)</td></tr><tr><td>SegNeXt-T (a)</td><td>4.4</td><td>10.0</td><td>40.3</td><td>41.1</td></tr><tr><td>SegNeXt-T (b)</td><td>4.2</td><td>4.9</td><td>30.9</td><td>40.6</td></tr><tr><td>SegNeXt-T (c)</td><td>4.3</td><td>6.6</td><td>41.1</td><td>42.2</td></tr><tr><td>SegNeXt-T (c) w/ stage 1</td><td>4.3</td><td>12.1</td><td>40.7</td><td>42.2</td></tr></table>
|
| 132 |
+
|
| 133 |
+
Decoder Structure. Unlike image classification, segmentation models need high-resolution outputs. We ablate three different decoder designs for segmentation, all of which have been shown in Fig. 3. The corresponding results are listed in Tab. 7. We can see that SegNeXt (c) achieves the best performance and the computational cost is also low.
|
| 134 |
+
|
| 135 |
+
Importance of Our MSCA. Here, we conduct experiments to demonstrate the importance of MSCA for segmentation. As a comparison, we follow VAN [25] and replace the multiple branches in our MSCA with a single convolution with a large kernel. As shown in Tab. 8 and Tab. 3, we can observe that though the performance of the two encoders is close in ImageNet classification, SegNeXt w/ MSCA yields much better results than the setting w/o MSCA. This indicates that aggregating multi-scale features is crucial in encoder for semantic segmentation.
|
| 136 |
+
|
| 137 |
+

|
| 138 |
+
Figure 4: Qualitative Comparison of SegNeXt-B and SegFormer-B2 on the Cityscapes dataset. More visual results can be found in our supplementary materials.
|
| 139 |
+
|
| 140 |
+
# 4.3 Comparison with state-of-the-art methods
|
| 141 |
+
|
| 142 |
+
In this subsection, we compare our method with state-of-the-art CNN-based methods, such as HRNet [79], ResNeSt [104], and EfficientNet [77], and transformer-based methods, like Swin Transformer [58], SegFormer [90], HRFormer [100], MaskFormer [10], and Mask2Former [9].
|
| 143 |
+
|
| 144 |
+
Performance-computation trade-off. ADE20K and Cityscapes are two widely used benchmarks in semantic segmentation. As shown in Fig. 1, we plot the performance-computation curves of different methods on the Cityscape and ADE20K validation set. Clearly, our method achieves the best trade-off between performance and computations compared to other state-of-the-art methods, like SegFormer [90], HRFormer [100], and MaskFormer [10].
|
| 145 |
+
|
| 146 |
+
Comparison with state-of-the-art transformers. We compare SegNeXt with state-of-the-art transformer models on the ADE20K, Cityscapes, COCO-Stuff and Pascal Context benchmarks. As shown in Tab. 9, SegNeXt-L surpasses Mask2Former with Swin-T backbone by 3.3 mIoU (51.0 v.s. 47.7) with similar parameters and computational cost on he ADE20K dataset. Moreover, SegNeXt-B yields $2 . 0 \mathrm { m I o U }$ improvement (48.5 v.s. 46.5) compared to SegFormer-B2 using only $56 \%$ computations on the ADE20K dataset. In particular, since the self-attention in SegFormer [90] is of quadratic complexity w.r.t., the input size while our method uses convolutions, this makes our method perform greatly well when dealing with high-resolution images from the Cityscapes dataset. For instance, SegNeXt-B gains 1.6 mIoU (81.0 v.s. 82.6) over SegFormer-B2 but uses $40 \%$ less computations. In Fig. 4, we also show a qualitative comparison with SegFormer. We can see that thanks to the proposed MSCA, our method recognizes well when processing object details.
|
| 147 |
+
|
| 148 |
+
Comparison with state-of-the-art CNNs. As shown in Tab. 4, Tab. 10, and Tab. 12, we compare our SegNeXt with state-of-the-art CNNs such as ResNeSt-269 [104], EfficientNet-L2 [112], and HRNetW48 [79] on the Pascal VOC 2012, Pascal Context, and iSAID datasets. SegNeXt-L outperforms the popular HRNet (OCR) [79, 99] model (60.3 v.s. 56.3) using even less parameters and computations, which is elaborately designed for the segmentation task. Moreover, SegNeXt-L performs even better than EfficientNet-L2 (NAS-FPN), which is pretrained on additional 300 million unavailable images, on the Pascal VOC 2012 test leaderboard. It is worth noting that EfficientNet-L2 (NAS-FPN) has 485M parameters, while SegNeXt-L has only 48.7M parameters.
|
| 149 |
+
|
| 150 |
+
Table 9: Comparison with state-of-the-art methods on the ADE20K, Cityscapes and COCO-Stuff benchmarks. The number of FLOPs (G) is calculated on the input size of $5 1 2 \times 5 1 2$ for ADE20K and COCO-Stuff, and $2 , 0 4 8 \times 1 , 0 2 4$ for Cityscapes. † means models pretrained on ImageNet-22K.
|
| 151 |
+
|
| 152 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">Params (M)</td><td colspan="3">ADE20K</td><td colspan="3">Cityscapes</td><td colspan="3">COCO-Stuff</td></tr><tr><td>GFLOPs</td><td>mIoU (SS/MS)</td><td></td><td>GFLOPs</td><td>mloU (SS/MS)</td><td></td><td>GFLOPs</td><td>mIoU (SS/MS)</td><td></td></tr><tr><td>Segformer-B0 [90]</td><td>3.8</td><td>8.4</td><td>37.4</td><td>38.0</td><td>125.5</td><td>76.2</td><td>78.1</td><td>8.4</td><td>35.6</td><td>-</td></tr><tr><td>SegNeXt-T</td><td>4.3</td><td>6.6</td><td>41.1</td><td>42.2</td><td>50.5</td><td>79.8</td><td>81.4</td><td>6.6</td><td>38.7</td><td>39.1</td></tr><tr><td>Segformer-B1 [90]</td><td>13.7</td><td>15.9</td><td>42.2</td><td>43.1</td><td>243.7</td><td>78.5</td><td>80.0</td><td>15.9</td><td>40.2</td><td>■</td></tr><tr><td>HRFormer-S[100]</td><td>13.5</td><td>109.5</td><td>44.0</td><td>45.1</td><td>835.7</td><td>80.0</td><td>81.0</td><td>109.5</td><td>37.9</td><td>38.9</td></tr><tr><td>SegNeXt-S</td><td>13.9</td><td>15.9</td><td>44.3</td><td>45.8</td><td>124.6</td><td>81.3</td><td>82.7</td><td>15.9</td><td>42.2</td><td>42.8</td></tr><tr><td>Segformer-B2 [90]</td><td>27.5</td><td>62.4</td><td>46.5</td><td>47.5</td><td>717.1</td><td>81.0</td><td>82.2</td><td>62.4</td><td>44.6</td><td>-</td></tr><tr><td>MaskFormer [10]</td><td>42</td><td>55</td><td>46.7</td><td>48.8</td><td>-</td><td>■</td><td>=</td><td>-</td><td>■</td><td>■</td></tr><tr><td>SegNeXt-B</td><td>27.6</td><td>34.9</td><td>48.5</td><td>49.9</td><td>275.7</td><td>82.6</td><td>83.8</td><td>34.9</td><td>45.8</td><td>46.3</td></tr><tr><td>SETR-MLA+[108]</td><td>310.6</td><td>-</td><td>48.6</td><td>50.1</td><td>-</td><td>79.3</td><td>82.2</td><td>-</td><td>-</td><td>-</td></tr><tr><td>DPT-Hybrid [70]</td><td>124.0</td><td>307.9</td><td>-</td><td>49.0</td><td>-</td><td>-</td><td>-</td><td>-</td><td>■</td><td>■</td></tr><tr><td>Segformer-B3 [90]</td><td>47.3</td><td>79.0</td><td>49.4</td><td>50.0</td><td>962.9</td><td>81.7</td><td>83.3</td><td>79.0</td><td>45.5</td><td>-</td></tr><tr><td>Mask2Former[9]</td><td>47</td><td>74</td><td>47.7</td><td>49.6</td><td></td><td>=</td><td>■</td><td>■</td><td>=</td><td>-</td></tr><tr><td>HRFormer-B[100]</td><td>56.2</td><td>280.0</td><td>48.7</td><td>50.0</td><td>2223.8</td><td>81.9</td><td>82.6</td><td>280.0</td><td>42.4</td><td>43.3</td></tr><tr><td>MaskFormer [10]</td><td>63</td><td>79</td><td>49.8</td><td>51.0</td><td>-</td><td>=</td><td>=</td><td>-</td><td>=</td><td>-</td></tr><tr><td>SegNeXt-L</td><td>48.9</td><td>70.0</td><td>51.0</td><td>52.1</td><td>577.5</td><td>83.2</td><td>83.9</td><td>70.0</td><td>46.5</td><td>47.2</td></tr></table>
|
| 153 |
+
|
| 154 |
+
Table 10: Comparison with state-of-the-art methods on Pascal VOC dataset. ∗ means COCO [55] pretraining. † denotes JFT-300M [74] pretraining. \$ utilizes additional 300M unlabeled images for pretraining.
|
| 155 |
+
|
| 156 |
+
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=2>Backbone</td><td rowspan=1 colspan=1>mIoU</td></tr><tr><td rowspan=7 colspan=1>DANet [20]OCRNet [99]HamNet [22]EncNet*[103]EMANet* [46]DeepLabV3+*[7]DeepLabV3+†[7]NAS-FPN$[112]</td><td rowspan=1 colspan=2>ResNet101HRNetV2-W48</td><td rowspan=1 colspan=1>82.684.5</td></tr><tr><td rowspan=1 colspan=2>ResNet101</td><td rowspan=1 colspan=1>85.9</td></tr><tr><td rowspan=4 colspan=2>ResNet101ResNet101Xception-71Xception-JFT</td><td rowspan=1 colspan=1>85.9</td></tr><tr><td rowspan=1 colspan=1>87.7</td></tr><tr><td rowspan=1 colspan=1>Xception-71</td><td rowspan=1 colspan=1>87.8</td></tr><tr><td rowspan=1 colspan=1>Xception-JFT</td><td rowspan=1 colspan=1>89.0</td></tr><tr><td rowspan=1 colspan=2>EfficientNet-L2</td><td rowspan=1 colspan=1>90.5</td></tr><tr><td rowspan=3 colspan=1>SegNeXt-TSegNeXt-SSegNeXt-BSegNeXt-L*</td><td rowspan=3 colspan=2>MSCAN-TMSCAN-SMSCAN-BMSCAN-L</td><td rowspan=1 colspan=1>82.7</td></tr><tr><td rowspan=1 colspan=1>85.3</td></tr><tr><td rowspan=1 colspan=1>87.590.6</td></tr></table>
|
| 157 |
+
|
| 158 |
+
Table 11: Comparison with state-of-the-art realtime methods on Cityscapes test dataset. We test our method with a single RTX-3090 GPU and AMD EPYC 7543 32-core processor CPU . Without using any optimizations, SegNeXt-T can achieve 25 frames per second (FPS), which meets the requirements of real-time applications.
|
| 159 |
+
|
| 160 |
+
<table><tr><td>Method</td><td>Input size</td><td>mIoU</td></tr><tr><td>ESPNet [62] ESPNetv2 [63]</td><td>512×1,024 512×1,024</td><td>60.3 66.2</td></tr><tr><td>ICNet [105] DFANet [45]</td><td>1,024 × 2,048 1,024 × 1,024</td><td>69.5 71.3</td></tr><tr><td>BiSeNet [97]</td><td>768 × 1,536</td><td>74.6</td></tr><tr><td>BiSeNetv2 [96]</td><td>512 × 1,024</td><td></td></tr><tr><td>DF2-Seg [52]</td><td>1,024 × 2.048</td><td>75.3</td></tr><tr><td>SwiftNet [67]</td><td></td><td>74.8</td></tr><tr><td></td><td>1,024 × 2.048</td><td>75.5</td></tr><tr><td>SFNet [49]</td><td>1,024 × 2,048</td><td>77.8</td></tr><tr><td>SegNeXt-T</td><td>768 × 1,536</td><td>78.0</td></tr></table>
|
| 161 |
+
|
| 162 |
+
Comparison with real-time methods. In addition to the state-of-the-art performance, our method is also suitable for real-time deployments. Even without any specific software or hardware acceleration, SegNeXt-T realizes 25 frames per second (FPS) using a single 3090 RTX GPU when dealing with an image of size $^ { 7 6 8 \times 1 , 5 3 6 }$ . As shown in Tab. 11, our method sets new state-of-the-art results for real-time segmentation on the Cityscapes test set.
|
| 163 |
+
|
| 164 |
+
# 4.4 Weakly-Supervised Semantic Segmentation
|
| 165 |
+
|
| 166 |
+
In this subsection, we apply the proposed network to the weakly-supervised semantic segmentation task. In this task, a pseudo segmentation map is often generated by a classification model using CAM [110]. Previous works mostly utilize VGGNet [72] or ResNets [28, 87] as the CAM generator. Here, we test the performance of the CAMs produced by our MSCAN. We use the EPS [43] architecture and follow the training strategies and recipes. The numerical results are shown in Tab. 13. We can see that simply replacing the ResNet38 backbone with our MSCAN can clearly improve the performance compared to the EPS baseline. When using our SegNeXt as the segmentation network, the performance gain increases further.
|
| 167 |
+
|
| 168 |
+
Table 12: Comparison on Pascal Context benchmark. The number of FLOPs is calculated with the input size of $5 1 2 \times 5 1 2$ . ∗ means ImageNet-22K pretraining. † denotes ADE20K pretraining.
|
| 169 |
+
|
| 170 |
+
<table><tr><td rowspan=1 colspan=3>Method</td><td rowspan=1 colspan=1>Backbone</td><td rowspan=1 colspan=3>Params.(M)</td><td rowspan=1 colspan=2>GFLOPs</td><td rowspan=1 colspan=1>mIoU (SS/MS)</td></tr><tr><td rowspan=1 colspan=3>DANet [20]</td><td rowspan=1 colspan=1>ResNet101</td><td rowspan=1 colspan=3>69.1</td><td rowspan=1 colspan=2>277.7</td><td rowspan=1 colspan=1>= 52.6</td></tr><tr><td rowspan=1 colspan=3>EMANet [46]</td><td rowspan=1 colspan=1>ResNet101</td><td rowspan=1 colspan=3>61.1</td><td rowspan=1 colspan=2>246.1</td><td rowspan=1 colspan=1>53.1</td></tr><tr><td rowspan=6 colspan=3>HamNet [22]HRNet (OCR) [79]DeepLabV3+[7]SETR-MLA*[108]HRFormer-B [100]DPT-Hybrid+[70]</td><td rowspan=5 colspan=1>ResNet101HRNetW48ResNeSt-269ViT-LargeHRFormer-B</td><td rowspan=2 colspan=3>69.174.5</td><td rowspan=1 colspan=2>277.9</td><td rowspan=1 colspan=1>55.2</td></tr><tr><td rowspan=1 colspan=2>-</td><td rowspan=1 colspan=1>= 56.2</td></tr><tr><td rowspan=3 colspan=3>1309.556.2</td><td rowspan=1 colspan=2>=</td><td rowspan=2 colspan=1>= 58.954.9 55.8</td></tr><tr><td rowspan=1 colspan=1>309.5</td><td rowspan=1 colspan=2>=</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>54.9</td></tr><tr><td rowspan=1 colspan=2>56.2</td><td rowspan=1 colspan=2>280.0</td><td rowspan=1 colspan=1>57.6 58.5</td></tr><tr><td rowspan=1 colspan=1>ViT-Hybrid</td><td rowspan=1 colspan=3>124.0</td><td rowspan=1 colspan=2>1</td><td rowspan=1 colspan=1>- 60.5</td></tr><tr><td rowspan=1 colspan=3>SegNeXt-TSegNeXt-S</td><td rowspan=1 colspan=1>MSCAN-T</td><td rowspan=1 colspan=3>4.2</td><td rowspan=1 colspan=2>6.6</td><td rowspan=1 colspan=1>51.2 53.3</td></tr><tr><td rowspan=1 colspan=1>SegNeXt-S</td><td></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>MSCAN-S</td><td rowspan=1 colspan=3>13.9</td><td rowspan=1 colspan=2>15.9</td><td rowspan=1 colspan=1>54.2 56.1</td></tr><tr><td rowspan=3 colspan=3>SegNeXt-BSegNeXt-LSegNeXt-Lt</td><td rowspan=1 colspan=1>SegNeXt-B</td><td rowspan=1 colspan=3>MSCAN-B</td><td rowspan=1 colspan=2>27.6</td><td rowspan=1 colspan=1>34.9</td></tr><tr><td rowspan=1 colspan=2>SegNeXt-L</td><td rowspan=1 colspan=1>MSCAN-L</td><td rowspan=1 colspan=3>48.8</td><td rowspan=1 colspan=2>70.0</td><td rowspan=1 colspan=1>58.7 60.3</td></tr><tr><td rowspan=1 colspan=1>MSCAN-L</td><td rowspan=1 colspan=3>48.8</td><td rowspan=1 colspan=2>70.0</td><td rowspan=1 colspan=1>59.2 60.9</td></tr></table>
|
| 171 |
+
|
| 172 |
+
Table 13: Comparisons to previous state-of-the-art weakly-supervised semantic segmentation approaches on the PASCAL VOC 2012 validation set. All the segmentation results are based on the ResNet backbone [28, 87] except ours which utilize MSCAN-B.
|
| 173 |
+
|
| 174 |
+
<table><tr><td>Methods</td><td>Network</td><td>Supervision</td><td>mIoU (%) on Val.</td></tr><tr><td>FickleNet2019 [42]</td><td>DeeplabV2</td><td>Image + Saliency</td><td>64.9</td></tr><tr><td>OAA2019 [37]</td><td>DeeplabV1</td><td>Image + Saliency</td><td>65.2</td></tr><tr><td>ICD2020 [18]</td><td>DeeplabV1</td><td>Image + Saliency</td><td>67.8</td></tr><tr><td>Multi-Est.2020 [19]</td><td>DeeplabV1</td><td>Image + Saliency</td><td>67.2</td></tr><tr><td>DRS2021 [39]</td><td>DeeplabV2</td><td>Image+ Saliency</td><td>71.2</td></tr><tr><td>Group-WSSS2021 [53]</td><td>DeeplabV2</td><td>Image+ Saliency</td><td>68.2</td></tr><tr><td>AuxSegNet2021 [92]</td><td>DeeplabV1</td><td>Image + Saliency</td><td>69.0</td></tr><tr><td>EDAM2021 [86]</td><td>DeeplabV1</td><td>Image + Saliency</td><td>70.9</td></tr><tr><td>EPS2021 [43]</td><td>DeeplabV2</td><td>Image + Saliency</td><td>70.9</td></tr><tr><td>L2G2022 [38]</td><td>DeeplabV1</td><td>Image + Saliency</td><td>72.0</td></tr><tr><td>MSCAN + EPS [43](Ours)</td><td>DeeplabV2</td><td>Image + Saliency</td><td>71.7</td></tr><tr><td>MSCAN + EPS [43] (Ours)</td><td>SegNeXt</td><td>Image + Saliency</td><td>72.2</td></tr></table>
|
| 175 |
+
|
| 176 |
+
# 5 Conclusions and Discussion
|
| 177 |
+
|
| 178 |
+
In this paper, we analyze previous successful segmentation models and find the good characteristics owned by them. Based on the findings, we present a tailored convolutional attention module MSCA and a CNN-style network SegNeXt. Experimental results demonstrate that SegNeXt surpasses current state-of-the-art transformer-based methods by a considerable margin.
|
| 179 |
+
|
| 180 |
+
Recently, transformer-based models have dominated various segmentation leaderboards. Instead, this paper shows that CNN-based methods can still perform better than transformer-based methods when using a proper design. We hope this paper could encourage researchers to further investigate the potential of CNNs.
|
| 181 |
+
|
| 182 |
+
Our model also has its limitations, for example, extending this method to large-scale models with $1 0 0 \mathbf { M } +$ parameters and the performance on other vision or NLP tasks. These will be addressed in our future works.
|
| 183 |
+
|
| 184 |
+
# Acknowledgment
|
| 185 |
+
|
| 186 |
+
This work was supported by the National Key R&D Program of China (NO. 2018AAA0100400) and the Natural Science Foundation of China (No. 62220106003, No. 62176130, and No. 62276145). We would like to thank Yi Zhang and Zhengyang Geng for their kind help in experiments.
|
| 187 |
+
|
| 188 |
+
References
|
| 189 |
+
[1] Badrinarayanan, V., Kendall, A., Cipolla, R.: Segnet: A deep convolutional encoder-decoder architecture for image segmentation. IEEE Transactions on Pattern Analysis and Machine Intelligence 39(12), 2481–2495 (2017)
|
| 190 |
+
[2] Bertasius, G., Shi, J., Torresani, L.: Semantic segmentation with boundary neural fields. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 3602–3610 (2016)
|
| 191 |
+
[3] Caesar, H., Uijlings, J., Ferrari, V.: Coco-stuff: Thing and stuff classes in context. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 1209–1218 (2018)
|
| 192 |
+
[4] Chen, L.C., Papandreou, G., Kokkinos, I., Murphy, K., Yuille, A.L.: Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. IEEE Transactions on Pattern Analysis and Machine Intelligence 40(4), 834–848 (2017)
|
| 193 |
+
[5] Chen, L.C., Papandreou, G., Schroff, F., Adam, H.: Rethinking atrous convolution for semantic image segmentation. arXiv preprint arXiv:1706.05587 (2017)
|
| 194 |
+
[6] Chen, L.C., Yang, Y., Wang, J., Xu, W., Yuille, A.L.: Attention to scale: Scale-aware semantic image segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 3640–3649 (2016)
|
| 195 |
+
[7] Chen, L.C., Zhu, Y., Papandreou, G., Schroff, F., Adam, H.: Encoder-decoder with atrous separable convolution for semantic image segmentation. In: European Conference on Computer Vision. pp. 801–818 (2018)
|
| 196 |
+
[8] Chen, L., Zhang, H., Xiao, J., Nie, L., Shao, J., Liu, W., Chua, T.S.: Sca-cnn: Spatial and channel-wise attention in convolutional networks for image captioning. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 5659–5667 (2017)
|
| 197 |
+
[9] Cheng, B., Misra, I., Schwing, A.G., Kirillov, A., Girdhar, R.: Masked-attention mask transformer for universal image segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 1290–1299 (2022)
|
| 198 |
+
[10] Cheng, B., Schwing, A., Kirillov, A.: Per-pixel classification is not all you need for semantic segmentation. Advances in Neural Information Processing Systems 34, 17864–17875 (2021)
|
| 199 |
+
[11] Contributors, M.: MMSegmentation: Openmmlab semantic segmentation toolbox and benchmark. https://github.com/open-mmlab/mmsegmentation(Apache-2.0) (2020)
|
| 200 |
+
[12] Cordts, M., Omran, M., Ramos, S., Rehfeld, T., Enzweiler, M., Benenson, R., Franke, U., Roth, S., Schiele, B.: The cityscapes dataset for semantic urban scene understanding. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 3213–3223 (2016)
|
| 201 |
+
[13] Dai, J., Qi, H., Xiong, Y., Li, Y., Zhang, G., Hu, H., Wei, Y.: Deformable convolutional networks. In: IEEE/CVF International Conference on Computer Vision. pp. 764–773 (2017)
|
| 202 |
+
[14] Deng, J., Dong, W., Socher, R., Li, L.J., Li, K., Fei-Fei, L.: Imagenet: A large-scale hierarchical image database. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 248–255. Ieee (2009)
|
| 203 |
+
[15] Ding, H., Jiang, X., Liu, A.Q., Thalmann, N.M., Wang, G.: Boundary-aware feature propagation for scene segmentation. In: IEEE/CVF International Conference on Computer Vision. pp. 6819–6829 (2019)
|
| 204 |
+
[16] Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al.: An image is worth 16x16 words: Transformers for image recognition at scale. In: International Conference on Learning Representations. (2020)
|
| 205 |
+
[17] Everingham, M., Van Gool, L., Williams, C.K., Winn, J., Zisserman, A.: The pascal visual object classes (voc) challenge. International Journal of Computer Vision 88(2), 303–338 (2010)
|
| 206 |
+
[18] Fan, J., Zhang, Z., Song, C., Tan, T.: Learning integral objects with intra-class discriminator for weakly-supervised semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 4283–4292 (2020)
|
| 207 |
+
[19] Fan, J., Zhang, Z., Tan, T.: Employing multi-estimations for weakly-supervised semantic segmentation. In: European Conference on Computer Vision. pp. 332–348. Springer (2020)
|
| 208 |
+
[20] Fu, J., Liu, J., Tian, H., Li, Y., Bao, Y., Fang, Z., Lu, H.: Dual attention network for scene segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 3146–3154 (2019)
|
| 209 |
+
[21] Gao, S.H., Cheng, M.M., Zhao, K., Zhang, X.Y., Yang, M.H., Torr, P.: Res2net: A new multiscale backbone architecture. IEEE Transactions on Pattern Analysis and Machine Intelligence 43(2), 652–662 (2021)
|
| 210 |
+
[22] Geng, Z., Guo, M.H., Chen, H., Li, X., Wei, K., Lin, Z.: Is attention better than matrix decomposition? In: International Conference on Learning Representations. (2021)
|
| 211 |
+
[23] Guo, M.H., Cai, J.X., Liu, Z.N., Mu, T.J., Martin, R.R., Hu, S.M.: Pct: Point cloud transformer. Computational Visual Media 7(2), 187–199 (2021)
|
| 212 |
+
[24] Guo, M.H., Liu, Z.N., Mu, T.J., Hu, S.M.: Beyond self-attention: External attention using two linear layers for visual tasks. arXiv preprint arXiv:2105.02358 (2021)
|
| 213 |
+
[25] Guo, M.H., Lu, C.Z., Liu, Z.N., Cheng, M.M., Hu, S.M.: Visual attention network. arXiv preprint arXiv:2202.09741 (2022)
|
| 214 |
+
[26] Guo, M.H., Xu, T.X., Liu, J.J., Liu, Z.N., Jiang, P.T., Mu, T.J., Zhang, S.H., Martin, R.R., Cheng, M.M., Hu, S.M.: Attention mechanisms in computer vision: A survey. Computational Visual Media 8(3), 329–367 (2022)
|
| 215 |
+
[27] He, J., Deng, Z., Zhou, L., Wang, Y., Qiao, Y.: Adaptive pyramid context network for semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 7519–7528 (2019)
|
| 216 |
+
[28] He, K., Zhang, X., Ren, S., Sun, J.: Deep residual learning for image recognition. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 770–778 (2016)
|
| 217 |
+
[29] He, T., Zhang, Z., Zhang, H., Zhang, Z., Xie, J., Li, M.: Bag of tricks for image classification with convolutional neural networks. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 558–567 (2019)
|
| 218 |
+
[30] Hou, Q., Zhang, L., Cheng, M.M., Feng, J.: Strip pooling: Rethinking spatial pooling for scene parsing. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 4003–4012 (2020)
|
| 219 |
+
[31] Hu, J., Shen, L., Sun, G.: Squeeze-and-excitation networks. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 7132–7141 (2018)
|
| 220 |
+
[32] Hu, S.M., Liang, D., Yang, G.Y., Yang, G.W., Zhou, W.Y.: Jittor: a novel deep learning framework with meta-operators and unified graph execution. Science China Information Sciences 63(222103), 1–21 (2020)
|
| 221 |
+
[33] Huang, G., Liu, Z., Van Der Maaten, L., Weinberger, K.Q.: Densely connected convolutional networks. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 4700– 4708 (2017)
|
| 222 |
+
[34] Huang, Z., Shi, X., Zhang, C., Wang, Q., Cheung, K.C., Qin, H., Dai, J., Li, H.: Flowformer: A transformer architecture for optical flow. arXiv preprint arXiv:2203.16194 (2022)
|
| 223 |
+
[35] Huang, Z., Wang, X., Huang, L., Huang, C., Wei, Y., Liu, W.: Ccnet: Criss-cross attention for semantic segmentation. In: IEEE/CVF International Conference on Computer Vision. pp. 603–612 (2019)
|
| 224 |
+
[36] Ioffe, S., Szegedy, C.: Batch normalization: Accelerating deep network training by reducing internal covariate shift. In: International Conference on Machine Learning. pp. 448–456. PMLR (2015)
|
| 225 |
+
[37] Jiang, P.T., Hou, Q., Cao, Y., Cheng, M.M., Wei, Y., Xiong, H.K.: Integral object mining via online attention accumulation. In: IEEE/CVF International Conference on Computer Vision. pp. 2070–2079 (2019)
|
| 226 |
+
[38] Jiang, P.T., Yang, Y., Hou, Q., Wei, Y.: $\mathrm { L } 2 \mathrm { g }$ : A simple local-to-global knowledge transfer framework for weakly supervised semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 16886–16896 (2022)
|
| 227 |
+
[39] Kim, B., Han, S., Kim, J.: Discriminative region suppression for weakly-supervised semantic segmentation. In: Association for the Advancement of Artificial Intelligence. pp. 1754–1761 (2021)
|
| 228 |
+
[40] Kirillov, A., Girshick, R., He, K., Dollar, P.: Panoptic feature pyramid networks. In: IEEE/CVF ´ Conference on Computer Vision and Pattern Recognition. pp. 6399–6408 (2019)
|
| 229 |
+
[41] Kirillov, A., Wu, Y., He, K., Girshick, R.: Pointrend: Image segmentation as rendering. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 9799–9808 (2020)
|
| 230 |
+
[42] Lee, J., Kim, E., Lee, S., Lee, J., Yoon, S.: Ficklenet: Weakly and semi-supervised semantic image segmentation using stochastic inference. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 5267–5276 (2019)
|
| 231 |
+
[43] Lee, S., Lee, M., Lee, J., Shim, H.: Railroad is not a train: Saliency as pseudo-pixel supervision for weakly supervised semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 5495–5505 (2021)
|
| 232 |
+
[44] Lee, Y., Kim, J., Willette, J., Hwang, S.J.: Mpvit: Multi-path vision transformer for dense prediction. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. (2022)
|
| 233 |
+
[45] Li, H., Xiong, P., Fan, H., Sun, J.: Dfanet: Deep feature aggregation for real-time semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 9522–9531 (2019)
|
| 234 |
+
[46] Li, X., Zhong, Z., Wu, J., Yang, Y., Lin, Z., Liu, H.: Expectation-maximization attention networks for semantic segmentation. In: IEEE/CVF International Conference on Computer Vision. pp. 9167–9176 (2019)
|
| 235 |
+
[47] Li, X., He, H., Li, X., Li, D., Cheng, G., Shi, J., Weng, L., Tong, Y., Lin, Z.: Pointflow: Flowing semantics through points for aerial image segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 4217–4226 (2021)
|
| 236 |
+
[48] Li, X., Li, X., Zhang, L., Cheng, G., Shi, J., Lin, Z., Tan, S., Tong, Y.: Improving semantic segmentation via decoupled body and edge supervision. In: European Conference on Computer Vision. pp. 435–452. Springer (2020)
|
| 237 |
+
[49] Li, X., You, A., Zhu, Z., Zhao, H., Yang, M., Yang, K., Tan, S., Tong, Y.: Semantic flow for fast and accurate scene parsing. In: European Conference on Computer Vision. pp. 775–793. Springer (2020)
|
| 238 |
+
[50] Li, X., Zhang, W., Pang, J., Chen, K., Cheng, G., Tong, Y., Loy, C.C.: Video k-net: A simple, strong, and unified baseline for video segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 18847–18857 (2022)
|
| 239 |
+
[51] Li, X., Zhao, H., Han, L., Tong, Y., Tan, S., Yang, K.: Gated fully fusion for semantic segmentation. In: Association for the Advancement of Artificial Intelligence. pp. 11418–11425 (2020)
|
| 240 |
+
[52] Li, X., Zhou, Y., Pan, Z., Feng, J.: Partial order pruning: for best speed/accuracy trade-off in neural architecture search. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 9145–9153 (2019)
|
| 241 |
+
[53] Li, X., Zhou, T., Li, J., Zhou, Y., Zhang, Z.: Group-wise semantic mining for weakly supervised semantic segmentation. In: Association for the Advancement of Artificial Intelligence. pp. 1984–1992 (2021)
|
| 242 |
+
[54] Lin, G., Milan, A., Shen, C., Reid, I.: Refinenet: Multi-path refinement networks for highresolution semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 1925–1934 (2017)
|
| 243 |
+
[55] Lin, T.Y., Maire, M., Belongie, S., Hays, J., Perona, P., Ramanan, D., Dollar, P., Zitnick, C.L.: ´ Microsoft coco: Common objects in context. In: European Conference on Computer Vision. pp. 740–755. Springer (2014)
|
| 244 |
+
[56] Liu, R., Deng, H., Huang, Y., Shi, X., Lu, L., Sun, W., Wang, X., Dai, J., Li, H.: Decoupled spatial-temporal transformer for video inpainting. arXiv preprint arXiv:2104.06637 (2021)
|
| 245 |
+
[57] Liu, R., Deng, H., Huang, Y., Shi, X., Lu, L., Sun, W., Wang, X., Dai, J., Li, H.: Fuseformer: Fusing fine-grained information in transformers for video inpainting. In: IEEE/CVF International Conference on Computer Vision. pp. 14040–14049 (2021)
|
| 246 |
+
[58] Liu, Z., Lin, Y., Cao, Y., Hu, H., Wei, Y., Zhang, Z., Lin, S., Guo, B.: Swin transformer: Hierarchical vision transformer using shifted windows. In: IEEE/CVF International Conference on Computer Vision. pp. 10012–10022 (2021)
|
| 247 |
+
[59] Liu, Z., Mao, H., Wu, C.Y., Feichtenhofer, C., Darrell, T., Xie, S.: A convnet for the 2020s. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 11976–11986 (2022)
|
| 248 |
+
[60] Long, J., Shelhamer, E., Darrell, T.: Fully convolutional networks for semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 3431–3440 (2015)
|
| 249 |
+
[61] Loshchilov, I., Hutter, F.: Decoupled weight decay regularization. In: International Conference on Learning Representations (2019)
|
| 250 |
+
[62] Mehta, S., Rastegari, M., Caspi, A., Shapiro, L., Hajishirzi, H.: Espnet: Efficient spatial pyramid of dilated convolutions for semantic segmentation. In: European Conference on Computer Vision. pp. 552–568 (2018)
|
| 251 |
+
[63] Mehta, S., Rastegari, M., Shapiro, L., Hajishirzi, H.: Espnetv2: A light-weight, power efficient, and general purpose convolutional neural network. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 9190–9200 (2019)
|
| 252 |
+
[64] Mnih, V., Heess, N., Graves, A., et al.: Recurrent models of visual attention. In: Advances in Neural Information Processing Systems. pp. 2204–2212 (2014)
|
| 253 |
+
[65] Mottaghi, R., Chen, X., Liu, X., Cho, N.G., Lee, S.W., Fidler, S., Urtasun, R., Yuille, A.: The role of context for object detection and semantic segmentation in the wild. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 891–898 (2014)
|
| 254 |
+
[66] Mou, L., Hua, Y., Zhu, X.X.: A relation-augmented fully convolutional network for semantic segmentation in aerial scenes. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 12416–12425 (2019)
|
| 255 |
+
[67] Orsic, M., Kreso, I., Bevandic, P., Segvic, S.: In defense of pre-trained imagenet architectures for real-time semantic segmentation of road-driving images. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 12607–12616 (2019)
|
| 256 |
+
[68] Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., et al.: Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems 32 (2019)
|
| 257 |
+
[69] Peng, C., Zhang, X., Yu, G., Luo, G., Sun, J.: Large kernel matters–improve semantic segmentation by global convolutional network. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 4353–4361 (2017)
|
| 258 |
+
[70] Ranftl, R., Bochkovskiy, A., Koltun, V.: Vision transformers for dense prediction. In: IEEE/CVF International Conference on Computer Vision. pp. 12179–12188 (2021)
|
| 259 |
+
[71] Ronneberger, O., Fischer, P., Brox, T.: U-net: Convolutional networks for biomedical image segmentation. In: International Conference on Medical Image Computing and ComputerAssisted Intervention. pp. 234–241. Springer (2015)
|
| 260 |
+
[72] Simonyan, K., Zisserman, A.: Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556 (2014)
|
| 261 |
+
[73] Strudel, R., Garcia, R., Laptev, I., Schmid, C.: Segmenter: Transformer for semantic segmentation. In: IEEE/CVF International Conference on Computer Vision. pp. 7262–7272 (2021)
|
| 262 |
+
[74] Sun, C., Shrivastava, A., Singh, S., Gupta, A.: Revisiting unreasonable effectiveness of data in deep learning era. In: IEEE/CVF International Conference on Computer Vision. pp. 843–852 (2017)
|
| 263 |
+
[75] Szegedy, C., Liu, W., Jia, Y., Sermanet, P., Reed, S., Anguelov, D., Erhan, D., Vanhoucke, V., Rabinovich, A.: Going deeper with convolutions. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 1–9 (2015)
|
| 264 |
+
[76] Takikawa, T., Acuna, D., Jampani, V., Fidler, S.: Gated-scnn: Gated shape cnns for semantic segmentation. In: IEEE/CVF International Conference on Computer Vision. pp. 5229–5238 (2019)
|
| 265 |
+
[77] Tan, M., Le, Q.: Efficientnet: Rethinking model scaling for convolutional neural networks. In: International conference on machine learning. pp. 6105–6114. PMLR (2019)
|
| 266 |
+
[78] Touvron, H., Cord, M., Douze, M., Massa, F., Sablayrolles, A., Jegou, H.: Training data- ´ efficient image transformers & distillation through attention. In: International Conference on Machine Learning. pp. 10347–10357. PMLR (2021)
|
| 267 |
+
[79] Wang, J., Sun, K., Cheng, T., Jiang, B., Deng, C., Zhao, Y., Liu, D., Mu, Y., Tan, M., Wang, X., et al.: Deep high-resolution representation learning for visual recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence (2020)
|
| 268 |
+
[80] Wang, Q., Wu, B., Zhu, P., Li, P., Zuo, W., Hu, Q.: Eca-net: Efficient channel attention for deep convolutional neural networks. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 11534–11542 (2020)
|
| 269 |
+
[81] Wang, W., Xie, E., Li, X., Fan, D.P., Song, K., Liang, D., Lu, T., Luo, P., Shao, L.: Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In: IEEE/CVF International Conference on Computer Vision. pp. 568–578 (2021)
|
| 270 |
+
[82] Wang, W., Xie, E., Li, X., Fan, D.P., Song, K., Liang, D., Lu, T., Luo, P., Shao, L.: Pvt v2: Improved baselines with pyramid vision transformer. Computational Visual Media 8(3), 415–424 (2022)
|
| 271 |
+
[83] Wang, X., Girshick, R., Gupta, A., He, K.: Non-local neural networks. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 7794–7803 (2018)
|
| 272 |
+
[84] Waqas Zamir, S., Arora, A., Gupta, A., Khan, S., Sun, G., Shahbaz Khan, F., Zhu, F., Shao, L., Xia, G.S., Bai, X.: isaid: A large-scale dataset for instance segmentation in aerial images. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshop. pp. 28–37 (2019)
|
| 273 |
+
[85] Wightman, R.: Pytorch image models. https://github.com/rwightman/ pytorch-image-models(Apache-2.0) (2019)
|
| 274 |
+
[86] Wu, T., Huang, J., Gao, G., Wei, X., Wei, X., Luo, X., Liu, C.H.: Embedded discriminative attention mechanism for weakly supervised semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 16765–16774 (2021) [87] Wu, Z., Shen, C., Van Den Hengel, A.: Wider or deeper: Revisiting the resnet model for visual recognition. Pattern Recognition. 90, 119–133 (2019)
|
| 275 |
+
[88] Xia, F., Wang, P., Chen, L.C., Yuille, A.L.: Zoom better to see clearer: Human and object parsing with hierarchical auto-zoom net. In: European Conference on Computer Vision. pp. 648–663. Springer (2016) [89] Xiao, T., Liu, Y., Zhou, B., Jiang, Y., Sun, J.: Unified perceptual parsing for scene understanding. In: European Conference on Computer Vision. pp. 418–434 (2018)
|
| 276 |
+
[90] Xie, E., Wang, W., Yu, Z., Anandkumar, A., Alvarez, J.M., Luo, P.: Segformer: Simple and efficient design for semantic segmentation with transformers. Advances in Neural Information Processing Systems 34 (2021)
|
| 277 |
+
[91] Xie, S., Girshick, R., Dollar, P., Tu, Z., He, K.: Aggregated residual transformations for deep ´ neural networks. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 1492–1500 (2017) [92] Xu, L., Ouyang, W., Bennamoun, M., Boussaid, F., Sohel, F., Xu, D.: Leveraging auxiliary tasks with affinity learning for weakly supervised semantic segmentation. In: IEEE/CVF International Conference on Computer Vision. pp. 6984–6993 (2021) [93] Xu, Y., Wei, H., Lin, M., Deng, Y., Sheng, K., Zhang, M., Tang, F., Dong, W., Huang, F., Xu, C.: Transformers in computational visual media: A survey. Computational Visual Media 8(1), 33–62 (2022)
|
| 278 |
+
[94] Yang, J., Li, C., Zhang, P., Dai, X., Xiao, B., Yuan, L., Gao, J.: Focal attention for long-range interactions in vision transformers. Advances in Neural Information Processing Systems 34, 30008–30022 (2021)
|
| 279 |
+
[95] Yang, M., Yu, K., Zhang, C., Li, Z., Yang, K.: Denseaspp for semantic segmentation in street scenes. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 3684–3692 (2018) [96] Yu, C., Gao, C., Wang, J., Yu, G., Shen, C., Sang, N.: Bisenet v2: Bilateral network with guided aggregation for real-time semantic segmentation. International Journal of Computer Vision 129(11), 3051–3068 (2021)
|
| 280 |
+
[97] Yu, C., Wang, J., Peng, C., Gao, C., Yu, G., Sang, N.: Bisenet: Bilateral segmentation network for real-time semantic segmentation. In: European Conference on Computer Vision. pp. 325–341 (2018)
|
| 281 |
+
[98] Yu, F., Koltun, V.: Multi-scale context aggregation by dilated convolutions. In: International Conference on Learning Representation (2016) [99] Yuan, Y., Chen, X., Wang, J.: Object-contextual representations for semantic segmentation. In: European Conference on Computer Vision. pp. 173–190. Springer (2020)
|
| 282 |
+
[100] Yuan, Y., Fu, R., Huang, L., Lin, W., Zhang, C., Chen, X., Wang, J.: Hrformer: High-resolution vision transformer for dense predict. Advances in Neural Information Processing Systems 34, 7281–7293 (2021)
|
| 283 |
+
[101] Yuan, Y., Huang, L., Guo, J., Zhang, C., Chen, X., Wang, J.: Ocnet: Object context network for scene parsing. arXiv preprint arXiv:1809.00916 (2018)
|
| 284 |
+
[102] Yuan, Y., Xie, J., Chen, X., Wang, J.: Segfix: Model-agnostic boundary refinement for segmentation. In: European Conference on Computer Vision. pp. 489–506. Springer (2020)
|
| 285 |
+
[103] Zhang, H., Dana, K., Shi, J., Zhang, Z., Wang, X., Tyagi, A., Agrawal, A.: Context encoding for semantic segmentation. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 7151–7160 (2018)
|
| 286 |
+
[104] Zhang, H., Wu, C., Zhang, Z., Zhu, Y., Lin, H., Zhang, Z., Sun, Y., He, T., Mueller, J., Manmatha, R., et al.: Resnest: Split-attention networks. arXiv preprint arXiv:2004.08955 (2020)
|
| 287 |
+
[105] Zhao, H., Qi, X., Shen, X., Shi, J., Jia, J.: Icnet for real-time semantic segmentation on high-resolution images. In: European Conference on Computer Vision. pp. 405–420 (2018)
|
| 288 |
+
[106] Zhao, H., Shi, J., Qi, X., Wang, X., Jia, J.: Pyramid scene parsing network. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 2881–2890 (2017)
|
| 289 |
+
[107] Zhen, M., Wang, J., Zhou, L., Li, S., Shen, T., Shang, J., Fang, T., Quan, L.: Joint semantic segmentation and boundary detection using iterative pyramid contexts. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 13666–13675 (2020)
|
| 290 |
+
[108] Zheng, S., Lu, J., Zhao, H., Zhu, X., Luo, Z., Wang, Y., Fu, Y., Feng, J., Xiang, T., Torr, P.H., et al.: Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 6881–6890 (2021)
|
| 291 |
+
[109] Zheng, Z., Zhong, Y., Wang, J., Ma, A.: Foreground-aware relation network for geospatial object segmentation in high spatial resolution remote sensing imagery. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 4096–4105 (2020)
|
| 292 |
+
[110] Zhou, B., Khosla, A., Lapedriza, A., Oliva, A., Torralba, A.: Learning deep features for discriminative localization. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 2921–2929 (2016)
|
| 293 |
+
[111] Zhou, B., Zhao, H., Puig, X., Fidler, S., Barriuso, A., Torralba, A.: Scene parsing through ade20k dataset. In: IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 633–641 (2017)
|
| 294 |
+
[112] Zoph, B., Ghiasi, G., Lin, T.Y., Cui, Y., Liu, H., Cubuk, E.D., Le, Q.: Rethinking pre-training and self-training. Advances in Neural Information Processing Systems 33, 3833–3845 (2020)
|
md/dev/WVX0NNVBBkV/WVX0NNVBBkV.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/_1bgdFHhA70/_1bgdFHhA70.md
ADDED
|
@@ -0,0 +1,435 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Evident: a Development Methodology and a Knowledge Base Topology for Data Mining, Machine Learning and General Knowledge Management
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Software has been developed for knowledge discovery, prediction and management
|
| 11 |
+
2 for over 30 years. However, there are still unresolved pain points when using
|
| 12 |
+
3 existing project development and artifact management methodologies. Historically,
|
| 13 |
+
4 there has been a lack of applicable methodologies. Further, methodologies that
|
| 14 |
+
5 have been applied, such as Agile, have several limitations including scientific
|
| 15 |
+
6 unfalsifiability that reduce their applicability. Evident, a development methodology
|
| 16 |
+
7 rooted in the philosophy of logical reasoning and EKB, a knowledge base topology,
|
| 17 |
+
8 are proposed. Many pain points in data mining, machine learning and general
|
| 18 |
+
9 knowledge management are alleviated conceptually. Evident can be extended
|
| 19 |
+
10 potentially to accelerate philosophical exploration, science discovery, education as
|
| 20 |
+
11 well as knowledge sharing & retention across the globe. EKB offers one solution
|
| 21 |
+
12 of storing information as knowledge, a granular level above data. Related topics in
|
| 22 |
+
13 computer history, software engineering, database, sensing hardware, philosophy,
|
| 23 |
+
14 and project & organization & military managements are also discussed.
|
| 24 |
+
|
| 25 |
+
# 15 1 Introduction
|
| 26 |
+
|
| 27 |
+
16 Necessity is the mother of invention, claimed Plato [1]. Deficient in rigorous scientific scrutinization
|
| 28 |
+
17 as the statement is, major methodology evolutions in software development did not emerge until the
|
| 29 |
+
18 emergence of major computer innovations and thereafter elevated effort orchestration needs.
|
| 30 |
+
19 In the 1940s, digital programmable electronic computers revolutionized scientific calculation done
|
| 31 |
+
20 previously with mechanical and analog computing machines [2]. Assembly (1947) [3, 4] and high
|
| 32 |
+
21 level (1953) [5, 6] programming languages rose to harness the unprecedented and ever-increasing
|
| 33 |
+
22 computing power, Eventually the term software was coined (1953) [7]. Two Software Development
|
| 34 |
+
23 Methodologies (SDMs) were proposed: 1. a project breakdown of sequential phases, the essence of
|
| 35 |
+
24 Waterfall (see Fig 1a), first presented no later than 1956 [8] and 2. iterative and incremental SDM,
|
| 36 |
+
25 the essence of Agile (see Fib 1b), first executed no later than 1957 [9].
|
| 37 |
+
26 In the 1960s, operating systems (1962) emerged to orchestrate multiple computation tasks[10]. This
|
| 38 |
+
27 signified the shift of computer development from single-task specialized machines for military and
|
| 39 |
+
28 academia to machines accessible to the general public. The shift was exemplified by The Mother of
|
| 40 |
+
29 All Demos (1968) which demonstrated many fundamental elements of personal computing for the
|
| 41 |
+
30 first time [11] and showed how software had evolved in both diversity and complexity. Meanwhile,
|
| 42 |
+
31 the first formal detailed diagram of the Waterfall methodology appeared in literature (See Fig 1a)
|
| 43 |
+
32 (1970) [12] and the name of Waterfall was ultimately coined (1976) [13]. Agile variants such as
|
| 44 |
+
33 evolutionary project management [14] and adaptive SDM [15] appeared in the early 1970s, although
|
| 45 |
+
34 no clear preference between Waterfall and Agile variants was found in the literature.
|
| 46 |
+
|
| 47 |
+
Table 1: Major Software Usage Evolutions and Methodology Developments
|
| 48 |
+
|
| 49 |
+
<table><tr><td rowspan=1 colspan=1>Period</td><td rowspan=1 colspan=1>Technology</td><td rowspan=1 colspan=1>Software Usage</td><td rowspan=1 colspan=1>Major Methodology Development</td></tr><tr><td rowspan=1 colspan=1>1940s</td><td rowspan=1 colspan=1>ProgramingLanguage</td><td rowspan=1 colspan=1>ScientificCalculation</td><td rowspan=1 colspan=1>First Waterfall variant presentation (1956) [8]; firstAgile variant execution (1957)[9].</td></tr><tr><td rowspan=1 colspan=1>1960s</td><td rowspan=1 colspan=1>OperatingSystem</td><td rowspan=1 colspan=1>Shifting toApplications</td><td rowspan=1 colspan=1>First detailed diagram of Waterfall idea(1970)[12],Waterfall name (1976)[13]; Agile variants: evolu-tionary project management [14] & adaptive SDM[15](early 1970s).</td></tr><tr><td rowspan=1 colspan=1>1980s</td><td rowspan=1 colspan=1>GUI&Internet</td><td rowspan=1 colspan=1>PC & InternetApplications</td><td rowspan=1 colspan=1>Waterfall standardized in military (1985)[20]; TheManifesto signed (2001)[24]. Agile significantlymore popular than Waterfall.</td></tr><tr><td rowspan=1 colspan=1>Around1990</td><td rowspan=1 colspan=1>DataStorage</td><td rowspan=1 colspan=1>Knowledge Dis-covery, Predictionand Management</td><td rowspan=1 colspan=1>NA</td></tr></table>
|
| 50 |
+
|
| 51 |
+

|
| 52 |
+
Fig1 a) A typical Waterfall design diagram [12] b) An iterative, evolutionary and incremental design cycle commonly viewed as Agile[9] and how DM can improve each design cycle by discovering Knowledge about user needs during Review.
|
| 53 |
+
|
| 54 |
+

|
| 55 |
+
Fig 2.Relations among DM, ML and KM for their pain points
|
| 56 |
+
|
| 57 |
+
In the 1980s, personal computers entered households[16] followed by graphic user interface (GUI) (1983) [16]. The Internet Protocol Suite (TCP/IP) was standardized (1982)[17] and commercial Internet service providers emerged (1989) [18, 19] Unprecedented user-computer interactions and user-user communications created tremendous software needs, while Waterfall was still widely deployed in software development. United States Department of Defense issued a military standard describing Waterfall as the required military software development process (1985) [20]. However, software user needs grew so fast that, the heavy Waterfall SDM failed to deliver in pace. Consequently, a number of light weight SDMs were proposed and practiced (1990s) [4, 21, 22, 23]. Eventually The Manifesto for Agile Software Development (The Manifesto) [24] was signed by 17 practitioners of light-weight SDM (2001) and became the de facto SDM.
|
| 58 |
+
|
| 59 |
+
47 Around 1990, data storage capacities grew significantly and software usages in Data Mining (DM,
|
| 60 |
+
48 defined as knowledge discovery from data) reached the tipping point. While data and software’s
|
| 61 |
+
49 storage manners differ between Von Neumann and Harvard architectures, data storage capacity growth
|
| 62 |
+
50 empowered software to discover knowledge supported by scientific evidence (defined as Knowledge)
|
| 63 |
+
51 that people never had access to. Corporations started to analyze customers’ behavior and make
|
| 64 |
+
52 business decisions based on Knowledge (1990s) [25]. The first DM methodology, Cross-Industry
|
| 65 |
+
53 Standard Process for Data Mining (CRISP-DM) was conceived (1996) [26, 27]. However, CRISP
|
| 66 |
+
54 DM and its variants appear more of a theoretical framework, offer little meaningful or actionable
|
| 67 |
+
55 guidance, and therefore have not gotten much traction. In addition, CRISP-DM is concerned only
|
| 68 |
+
56 with DM, not Machine Learning (ML, defined as to deliver an algorithm (Algo) for Knowledge
|
| 69 |
+
57 prediction) or Knowledge Management (KM) in general for science, medicine, military and so on.
|
| 70 |
+
58 Due to the absence of alternative methodologies(see Table 1), Agile is still being offered up for DM,
|
| 71 |
+
59 ML, and KM [28, 29] with questions being asked about its appropriateness [30, 31].
|
| 72 |
+
60 This paper discusses limitations in Agile as a scientific claim and why it may not address the current
|
| 73 |
+
61 pain points of DM, ML and KM, which are later summarized. Evident along with Evident Knowledge
|
| 74 |
+
62 Base (EKB) is proposed as a project development and artifact management methodology. Evident’s
|
| 75 |
+
63 potential in alleviating many current pain points is demonstrated conceptually. Unalleviated pain
|
| 76 |
+
64 points and future work to fulfill the potential are also discussed. Beyond software development,
|
| 77 |
+
65 Evident is illustrated to be applicable in many aspects of society. $E K B$ is demonstrated as one potential
|
| 78 |
+
66 infrastructure to store information as Knowledge, a granular level above data.
|
| 79 |
+
|
| 80 |
+
# 67 2 Agile ambiguity and unfasifiability
|
| 81 |
+
|
| 82 |
+
68 Most people regard Agile as iterative, evolutionary and incremental software development [9] (see
|
| 83 |
+
69 Fig 1b) and many claim to be Agile practitioners. However, Agile empirical evidence is mixed and
|
| 84 |
+
70 hard to find [32, 30] while no measurable scientific evidence has been found at all. Although control
|
| 85 |
+
71 experiment challenges or absence of quantitative project Agility measurements may explain no
|
| 86 |
+
72 measurable scientific evidence, concerns remain with the ambiguity with which Agile’s approaches
|
| 87 |
+
73 and scope are defined in The Manifesto.
|
| 88 |
+
|
| 89 |
+
# 74 2.1 Agile approaches are vaguely defined in The Manifesto
|
| 90 |
+
|
| 91 |
+
75 The Manifesto includes 4 values and 12 principles [24]. The goal is crystal clear: to rapidly deliver
|
| 92 |
+
76 quality software that meets user needs, but not so much can be found for how to get there. Most of
|
| 93 |
+
77 the Values and Principles appear to be goals but not approaches (see Appendix); some are concerned
|
| 94 |
+
78 with approaches but vaguely defined; only four principles are actionable, which turn out to have no
|
| 95 |
+
79 relevance in how to implement iterative, evolutionary or incremental development. Agile Alliance,
|
| 96 |
+
80 co-founded by some original signers of The Manifesto, defines Agile as “an umbrella term for a set
|
| 97 |
+
81 of frameworks and practices” from which Agile practitioners “figure out the right things to do given
|
| 98 |
+
82 your particular context.” [33] Unfortunately, no actionable approaches are defined.
|
| 99 |
+
83 Therefore although there are numerous frameworks under the Agile umbrella [34, 35], it’s impossible
|
| 100 |
+
84 to determine if a development practice is Agile and the claim of Agile practice becomes unfalsifiable.
|
| 101 |
+
85 Because falsifiability is the standard evaluating scientific against non-scientific claims introduced by
|
| 102 |
+
86 Karl Popper [36], Agile is not a scientific claim. Consequently, no observable scientific evidence can
|
| 103 |
+
87 prove or disprove Agile, because technically no one can determine if a project is Agile or not in the
|
| 104 |
+
88 first place. If an Agile rollout “fails”, Agile proponents can always argue that the Agile rollout was
|
| 105 |
+
89 not implemented correctly.
|
| 106 |
+
90 Meanwhile Agile practitioners cannot determine if they practice Agile correctly either. Projects
|
| 107 |
+
91 employing Agile frameworks such as Test Driven Development or Feature Driven Development
|
| 108 |
+
92 may not even realize that the projects may not be adaptive to new user needs. People who are
|
| 109 |
+
93 essentially practicing Waterfall may believe they are practicing Agile only because they implement
|
| 110 |
+
94 each sequential Waterfall phase incrementally or simply use Scrum or Kanban.
|
| 111 |
+
95 In defense, some proponents claim Agile as a philosophy [37, 38]. Granted Agile’s goal may fit into
|
| 112 |
+
96 Axiology, one of Philosophy’s four domains (the rest as Metaphysics, Epistemology and Logic) [39],
|
| 113 |
+
97 concerned with what is good, it appears to be a common understanding and offers little value when
|
| 114 |
+
98 Agile’s approaches are vaguely defined.
|
| 115 |
+
|
| 116 |
+
# 99 2.2 No scopes are defined in The Manifesto
|
| 117 |
+
|
| 118 |
+
“The right things to do given your particular context” by Agile Alliance [33] are expected to be found within Agile’s frameworks, otherwise Agile is not practiced right. With no scope defined, Agile seems to cover the scope of all softwares. However, some softwares have non-incremental needs or simply only one need, e.g. to solve one specific partial differential equation numerically. Their needs are either met or not at all. No iteration or evolutionary Agile design cycles exist.
|
| 119 |
+
|
| 120 |
+
05 Agile is also not applicable for Knowledge discovery tasks such as DM. In a typical Agile development
|
| 121 |
+
06 cycle (Fig 1b), Review phase is to discover Knowledge about user needs, which can be done through
|
| 122 |
+
07 DM. Therefore Agile should not be applicable to DM, one phase of its own design cycle.
|
| 123 |
+
|
| 124 |
+
Table 2: Pain Points of DM, ML and KM.
|
| 125 |
+
|
| 126 |
+
<table><tr><td rowspan=1 colspan=3>Pain Points for DM</td></tr><tr><td rowspan=4 colspan=1>Overall</td><td rowspan=1 colspan=1>Struggles to deliver fast with technical debt</td><td rowspan=1 colspan=1>abc</td></tr><tr><td rowspan=1 colspan=1>Project Progress not easily measurable</td><td rowspan=1 colspan=1>b</td></tr><tr><td rowspan=1 colspan=1>Uncertainty in project timeline</td><td rowspan=1 colspan=1>b</td></tr><tr><td rowspan=1 colspan=1>Activities not easily trackable or reproducible</td><td rowspan=1 colspan=1>bc</td></tr></table>
|
| 127 |
+
|
| 128 |
+
<table><tr><td rowspan=3 colspan=2></td><td></td><td rowspan=1 colspan=1>ao</td></tr><tr><td rowspan=1 colspan=1>Few general project design patterns</td><td rowspan=1 colspan=1>abc</td></tr><tr><td rowspan=1 colspan=1>Anti-patterns not uncommon</td><td rowspan=1 colspan=1>abc</td></tr><tr><td rowspan=4 colspan=2>Collabor-ation</td><td rowspan=1 colspan=1>No methodologies to orchestrate team of size commonly seen in softwaredevelopment</td><td rowspan=1 colspan=1>b</td></tr><tr><td rowspan=1 colspan=1>Few intuitive manners to divide task among team members</td><td rowspan=1 colspan=1>ab</td></tr><tr><td rowspan=1 colspan=1>Deficient common awareness in needs for process improvement</td><td rowspan=1 colspan=1>a</td></tr><tr><td rowspan=1 colspan=1>Tasks completed or ideas explored by team members cannot be easily found and reproduced causing duplicated work.</td><td rowspan=1 colspan=1>bc</td></tr><tr><td rowspan=4 colspan=2>Data</td><td rowspan=1 colspan=1>Data compromised in availability, accuracy and consistency during acquisition</td><td rowspan=1 colspan=1>X</td></tr><tr><td rowspan=1 colspan=1>Data preprocessing process not standardized such as data labeling, objectdetection (e.g. identify object pixels in images) causing unstable data depen- dency, cascade correction and uncertainty in project progress</td><td rowspan=1 colspan=1>b</td></tr><tr><td rowspan=1 colspan=1>Underutilized data may take unnecessary resource</td><td rowspan=1 colspan=1>b</td></tr><tr><td rowspan=1 colspan=1>Data may be presented in different data type such as integer, float or string,causing unnecessary data dependency for Algo and experiments</td><td rowspan=1 colspan=1>b</td></tr><tr><td rowspan=5 colspan=2>KnowledgeDiscovery /ML AlgoResearch</td><td rowspan=1 colspan=1>Off-the-shelf models are available for DM automation. However,DM au-tomation has not become a common practice.</td><td rowspan=1 colspan=1>abc</td></tr><tr><td rowspan=1 colspan=1>Inefficient in-house model code implementation not uncommon</td><td rowspan=1 colspan=1>b</td></tr><tr><td rowspan=1 colspan=1>No appropriate version control tools. Current version control tools such as git are designed to only keep the best version Algo/experiment available, whileDM and ML need multiple versions available concurrently for reference</td><td rowspan=1 colspan=1>abc</td></tr><tr><td rowspan=1 colspan=1>No easy solution to request flexible data storage, memory and computationcapacity as needed. Hard drive, RAM, CPU and GPU are dificult to allocateeven on the cloud.</td><td rowspan=1 colspan=1>X</td></tr><tr><td rowspan=1 colspan=1>earch</td><td rowspan=1 colspan=1>The use of other Algos’ output as input results in correction cascades</td><td rowspan=1 colspan=1>b</td></tr><tr><td rowspan=3 colspan=2></td><td rowspan=1 colspan=1>Algo is a sequential computation process different from typical softwareapplications with a number of independent features.Difficult to assign oneAlgo development into multiple team members</td><td rowspan=1 colspan=1>X</td></tr><tr><td rowspan=1 colspan=1> Algo user may have no clear understanding about the Algo and deploys it outside its scope.</td><td rowspan=1 colspan=1>b</td></tr><tr><td rowspan=1 colspan=1>Multiple programing language smell</td><td rowspan=1 colspan=1>X</td></tr><tr><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1>Pain Points for ML</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=9 colspan=2>AlgoProduction</td><td rowspan=1 colspan=1>Significant efforts of research Algo migration into production</td><td rowspan=1 colspan=1>bc</td></tr><tr><td rowspan=1 colspan=1>Even more significant efforts if production Algo is written in a differentlanguage than the language used in research, e.g. in embedded system</td><td rowspan=1 colspan=1>X</td></tr><tr><td rowspan=1 colspan=1>For Algo analyzing sensor data such as cameras or bio-sensors, product gradedata won't be available for Algo research until sensor hardware designs arecomplete.Algo becomes the product release bottleneck, resulting in either sub-optimal production Algo or delayed product release.</td><td rowspan=1 colspan=1>X</td></tr><tr><td rowspan=1 colspan=1>Production data source is inconsistent with research data source</td><td rowspan=1 colspan=1>X</td></tr><tr><td rowspan=1 colspan=1>Algo production is often done by team members, most likely software engi- neers,who did not produce the Algo, causing misuse</td><td rowspan=1 colspan=1>abc</td></tr><tr><td rowspan=1 colspan=1>Algo needs to load data in real time during production but most often not in real time during research, causing unnecessary Algo code re-factoring</td><td rowspan=1 colspan=1>b</td></tr><tr><td rowspan=1 colspan=1> Prototype Algo may be accidentally run in production causing damages</td><td rowspan=1 colspan=1>X</td></tr><tr><td rowspan=1 colspan=1>No straightforward way to organize codes repository for research and produc- tion team members work in the same repository</td><td rowspan=1 colspan=1>abc</td></tr><tr><td rowspan=1 colspan=1>Dead code path</td><td rowspan=1 colspan=1>b</td></tr><tr><td rowspan=3 colspan=2>FeedbackLoop</td><td rowspan=1 colspan=1> Algo update workflow not straight forward</td><td rowspan=1 colspan=1>b</td></tr><tr><td rowspan=1 colspan=1>Few clear pattern designs for monitoring Algo performance in production</td><td rowspan=1 colspan=1>b</td></tr><tr><td rowspan=1 colspan=1>Actions based on unseen data predicted by Algo may alter observed data</td><td rowspan=1 colspan=1>X</td></tr><tr><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1>Pain Points for KM</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=3 colspan=2>Manage-ment Tool</td><td rowspan=1 colspan=1>Few tools or resource help people check if Knowledge formed is well sup-ported by evidence, especially when evidence appears long after presumedKnowledge has been formed.</td><td rowspan=1 colspan=1>abc</td></tr><tr><td rowspan=1 colspan=1> Knowledge dissemination among community has always been a challenge.</td><td rowspan=1 colspan=1>abc</td></tr><tr><td rowspan=1 colspan=1>Knowledges formed by different organizations are not easy to combine</td><td rowspan=1 colspan=1>abc</td></tr></table>
|
| 129 |
+
|
| 130 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Knowledge formed within organizations is not easy to share and retain.</td><td rowspan=1 colspan=1>abc</td></tr><tr><td rowspan=1 colspan=1>Standardi-zation</td><td rowspan=1 colspan=1>Knowledge has been recorded in sentences or articles.Few standardized waysto represent general Knowledge.</td><td rowspan=1 colspan=1>abc</td></tr></table>
|
| 131 |
+
|
| 132 |
+
a/b/c: Pain points that can be alleviated by Evident’s character a, b or c. x: Pain points that cannot be alleviated by Evident.
|
| 133 |
+
|
| 134 |
+
# 108 3 Pain points for DM, ML and KM
|
| 135 |
+
|
| 136 |
+
109 Owing to the absence of applicable methodologies, pain points have been continuously reported for
|
| 137 |
+
110 DM, ML and KM [40, 41, 42, 43] (see Table 2) in the current big data era with explosive growth in
|
| 138 |
+
111 data volume, variety and velocity.
|
| 139 |
+
112 DM & ML’s Algo typically comprises a data computation flow (defined as a Model, supervised
|
| 140 |
+
113 or unsupervised), such as logistic regression, and its configuration, such as logistic regression
|
| 141 |
+
114 coefficients. DM employs off-the-shelf or in-house Models to discover Knowledge from data. ML
|
| 142 |
+
115 compares Knowledges discovered by DM by candidate models and deploys the one that performs best
|
| 143 |
+
116 with its configuration, as the production Algo, for Knowledge prediction in production. Therefore,
|
| 144 |
+
117 DM’s pain points still apply to ML. Meanwhile because DM and ML are special forms of KM, their
|
| 145 |
+
118 pain points are also applicable for KM (see Fig 2).
|
| 146 |
+
119 Generally speaking, DM has not been regarded highly collaborative and scalable activities to deliver
|
| 147 |
+
120 high throughput Knowledge. It’s rare to see hundreds of contributors in a DM project, unlike for
|
| 148 |
+
121 example some complicated open source software projects that, deliver promptly, efficiently and
|
| 149 |
+
122 continuously for years or even decades [44, 45]. It is also rare of mass Knowledge production
|
| 150 |
+
123 in a organized and standardized manner with high production yield for a unit period, commonly
|
| 151 |
+
124 seen in consumer products such as automobiles or toothpastes. DM often struggles to deliver
|
| 152 |
+
125 Knowledge rapidly with technical debts in reproducibility, measurability, trackability. DM needs
|
| 153 |
+
126 to not only handle artifacts of different modalities such as documents, codes and data, but also
|
| 154 |
+
127 address computation and data storage resource requests potentially across multiple platforms. Raw or
|
| 155 |
+
128 preprocessed data can be compromised in availability, accuracy and consistency. Data dependency
|
| 156 |
+
129 and entangled models often cause cascaded correction and uncertainty in project planning. In addition,
|
| 157 |
+
130 routine tasks such as quarterly or annual finance analysis mostly have not be automated. Tools and
|
| 158 |
+
131 project management methodologies are highly in demand to fulfill DM’s potential and deliver values.
|
| 159 |
+
132 In ML, the team members, usually software engineers or product managers, that deploy an Algo in
|
| 160 |
+
133 production to predict future data may not have produced the Algo and may misuse it. The Algo codes
|
| 161 |
+
134 are often refactored sometimes in different programming languages, operating systems or even in
|
| 162 |
+
135 fixed point instead of float point. If the Algo is to be deployed on a data acquisition product such
|
| 163 |
+
136 as cameras or bio-sensors, no product grade data are available for Algo research until the sensor
|
| 164 |
+
137 hardware design is finalized to enable data collection. Algo research therefore becomes the bottleneck
|
| 165 |
+
138 for product release. Frequently sub-optimal Algo is deployed to meet the deadline or projects become
|
| 166 |
+
139 delayed. What’s more, production data may come from different sources compared to research data
|
| 167 |
+
140 potentially caused by, e.g. sensor upgrade or downgrade, resulting in the under performance of
|
| 168 |
+
141 production Algo. After Algo deployment, no straightforward way exists to monitor Algo performance
|
| 169 |
+
142 or thereafter update Algo. Future Knowledge predicated by the deployed Algo may encourage
|
| 170 |
+
143 Algo users to alter decisions, which leads to the formation of future data with unanticipated hidden
|
| 171 |
+
144 feedback loops. In addition, prototype Algo or dead codes may be accidentally run in production
|
| 172 |
+
145 potentially causing catastrophic consequences.
|
| 173 |
+
146 Although scientific methods have guided people to discover Knowledge and improve practices such
|
| 174 |
+
147 as evidence-based medicine [46] and experiment based military development [47], people still form
|
| 175 |
+
148 Knowledge that lacks in supporting evidence [48]. One possible reason is the unavailability of tools
|
| 176 |
+
149 or resources to check if the Knowledge formed is well supported by evidence, especially when there
|
| 177 |
+
150 is a significant time gap between the Knowledge formed and the appearance of supporting evidence,
|
| 178 |
+
151 e.g. for long-term investments or corporation strategies. Knowledge dissemination and retention
|
| 179 |
+
152 are also huge challenges among the community and organization [49]. Furthermore, Knowledge is
|
| 180 |
+
153 mostly recorded in the form of articles. However, because articles writing has not been and probably
|
| 181 |
+
154 will never be standardized, Knowledge has not been able to be represented in a standardized manner
|
| 182 |
+
155 for definition, reference and storage. The same Knowledge recorded in different sentences or even
|
| 183 |
+
156 languages may be interpreted differently.
|
| 184 |
+
|
| 185 |
+
# 57 4 Evident: a project development and artifact management methodology
|
| 186 |
+
|
| 187 |
+
# 4.1 Definition and scope
|
| 188 |
+
|
| 189 |
+
Evident is a methodology of project, including but not limited to software, development and artifact management for DM, ML and KM, characterized by
|
| 190 |
+
|
| 191 |
+
a. project development mimicking a continuous process of logical reasoning in philosophy;
|
| 192 |
+
b. project activities or artifacts are broken into containers of Observations, Hypotheses and Tests (collectively defined as Containers);
|
| 193 |
+
c. directional association constructions towards and only towards Test Containers to represent Knowledge.
|
| 194 |
+
|
| 195 |
+
166 Observation is a collection of facts. A Hypothesis is Knowledge to be formed out of Observation. A
|
| 196 |
+
167 Test is a Hypothesis evaluation process using Observation to prove or disprove the Hypothesis with
|
| 197 |
+
168 or without confidence levels. Containers indicate Observations, Hypotheses and Tests can only be
|
| 198 |
+
169 added or removed as a block.
|
| 199 |
+
|
| 200 |
+

|
| 201 |
+
Fig 3 Induction,abductionand deduction Knowledge represented in Evident(Hypo: Hypothesis; Obs:Observation)
|
| 202 |
+
|
| 203 |
+

|
| 204 |
+
Fig 4 DM, ML processes represented in Evident.a) DM mimic Knowledge induction in Fig 3a; b) ML Research and Production mimic Knowledge abduction and Knowledge deduction in Fig 3b.
|
| 205 |
+
|
| 206 |
+
# 171 4.2 Knowledge representation
|
| 207 |
+
|
| 208 |
+
172 Loosely speaking, a Test associated with a Hypothesis and an Observation represents induction
|
| 209 |
+
173 Knowledge (see Fig 3a); a Test associated with a Hypothesis set and an Observation represents
|
| 210 |
+
174 abduction Knowledge (see Fig 3b), a Hypothesis associated Test that is also associated with an
|
| 211 |
+
175 induction or abduction Knowledge Test represents deduction Knowledge or prediction (see Fig 3a&b).
|
| 212 |
+
176 Deduction Knowledge becomes induction Knowledge once Observation proving or disproving
|
| 213 |
+
177 deduction Knowledge is associated with Test, while stay deducted Knowledge if the associated
|
| 214 |
+
178 Observation overlooks (fails to either prove or disprove), the deduction Knowledge. Multiple
|
| 215 |
+
179 Tests associated with the same pair of Hypothesis(es) and Observation represent multiple different
|
| 216 |
+
180 Knowledges based on different evaluation metrics (e.g. profit maximization or cost minimization) or
|
| 217 |
+
181 Observation usage strategies (e.g. cross-validation grouping) (see Fig 3c).
|
| 218 |
+
182 DM may be regarded as Knowledge induction with data as Observation, model as Hypothesis to
|
| 219 |
+
183 be evaluated and data analysis experiment as model test on data to form induction Knowledge with
|
| 220 |
+
184 statistical confidence (see Fig 4a). Similarly, ML is Knowledge abduction. An example is a data
|
| 221 |
+
185 analysis experiment that picks the best off-the-shelf or in-house model that best explains the data
|
| 222 |
+
186 to form the Algo for production (see Fig 4b). Experiments employing different cost functions (e.g.
|
| 223 |
+
7 RMSE, AUC or correlation coefficients), statistical confidence levels or data allocation strategies for
|
| 224 |
+
8 training and testing may result in different Knowledges or Algos.
|
| 225 |
+
|
| 226 |
+
# 4.3 Project development
|
| 227 |
+
|
| 228 |
+
Evident project developments are intuitively broken down into two granular levels: Knowledges and Containers. Mimicking logical reasoning in philosophy, each project period develops a batch of independent Knowledges or Containers assigned to teams of various sizes to maximize unit time throughput (see Fig 5). The next batches of Knowledge or Containers can be adaptively planned after period reviews or retrieved from backlogs. Evident is compatible with Kanban, Scrum or other development tools or frameworks for project planning and development of a single Knowledge or Container.Any tools or frameworks that do not compromise the project breakdown into Knowledge and Containers are applicable.
|
| 229 |
+
|
| 230 |
+

|
| 231 |
+
Fig.5 One exemplary Evident project development process to produce Knowledges in Fig 3 a&b&c.Circled tasks may take 1 team member 3 periods,or take a team of 3 members 1 period. Knowledge 11 represents Obs1& Hypo1& Test 11 in Fig 3a.
|
| 232 |
+
Fig.6 An exemplary EKB composed of Hypo, Obs and Test containers that can store induction, abduction and deduction Knowledgesin Fig3 a&b&c and project development artifacts in Fig 5 continuously.
|
| 233 |
+
|
| 234 |
+
# 4.4 Artifact management: EKB
|
| 235 |
+
|
| 236 |
+
Evident artifact management may build on a topology of a relational Knowledge base, named EKB, composed of Evident Containers and directional associations (see Fig 6). Knowledges can be reproduced by Containers stored in EKB. Oversimplified as a table, EKB columns represent Observations; rows represent Hypotheses; values represent Tests or Test to be done (TBD). A Test can only be associated with one Observation, even if the associated Observation overlooks the Hypothesis(es) associated with the Test. Any new Observation proving, disproving or overlooking the same Hypothesis(es) occupies a column in EKB.
|
| 237 |
+
|
| 238 |
+
# 4.4.1 EKB stores containers and Knowledges continuously
|
| 239 |
+
|
| 240 |
+
When new Hypotheses, Observations or deduction Knowledge Tests are developed, new rows or columns of TBDs are inserted. A Test associated with Hypothesis(es) and a Observation can be stored in the designated row and column to represent different Knowledges.
|
| 241 |
+
|
| 242 |
+
An induction Knowledge Test is placed in the row of its associated Hypothesis and the column of its associated Observation (see Fig 3a&c & Fig 6). An abduction Knowledge Test is placed in the row of the Hypothesis best explaining the Observation (see Fig 3b & Fig 6). A deduction Knowledge is placed in the row of its associated Hypothesis and the column of the pending Observation (see Fig 3a&b & Fig 6). Once an Observation becomes available proving or disproving the Hypothesis, a deduction Knowledge becomes an induction Knowledge. Multiple Tests representing different Knowledges can be placed in the same slot (see Fig 3c & Fig 6).
|
| 243 |
+
|
| 244 |
+
# 4.4.2 EKB supports relational database operations of Permutation And Join
|
| 245 |
+
|
| 246 |
+
EKB is similar to a relational database [50] with Observations as columns, Hypotheses as rows and Tests as values, but with potential associations among values for deduction Knowledges. Relational database operations independent of values associations, such as Permutation (switching rows and columns) and Join (merging EKBs) can be implemented without compromise in $E K B$ ; operations dependent on values associations such as Restriction (select rows), Projection (select columns) and Compositions (merge selected columns&rows from multiple EKBs) can only be implemented for EKBs storing only induction or abduction Knowledge and have no associations among Tests.
|
| 247 |
+
|
| 248 |
+
226 EKBs are highly flexible for team collaboration and maintenance. Different team members working
|
| 249 |
+
227 on different Containers can share one $E K B$ as the common work space to improve efficiency. Multiple
|
| 250 |
+
228 EKBs can be joined together without information loss so that Knowledges produced by different
|
| 251 |
+
229 teams or team members can be accumulated into one EKB. For EKBs storing only induction and
|
| 252 |
+
230 abduction Knowledge, all relational database operations are applicable, so that team members can
|
| 253 |
+
231 compose their own EKBs without keeping a potentially large team EKB on the local machines.
|
| 254 |
+
|
| 255 |
+
# 232 5 Advantages and pain points alleviated
|
| 256 |
+
|
| 257 |
+
233 Inspired by the philosophy of logical reasoning, Evident is intuitive to understand and follow. Project
|
| 258 |
+
234 activity and artifact containerization supports incremental as well as adaptive project planning and
|
| 259 |
+
235 artifact pattern abstraction. Disentangling Hypotheses and Observations reduces unnecessary de
|
| 260 |
+
236 pendency, cascade correction and uncertainty in project planning. Knowledge representation in
|
| 261 |
+
237 associations among artifacts can not only track Knowledge development, but also Knowledge devel
|
| 262 |
+
238 opment status (prove, disproved or overlooked), which improves project measurability, trackability
|
| 263 |
+
239 and reproducibility. Overall Evident may help applicable projects deliver fast and at scale with many
|
| 264 |
+
240 pain points alleviated in DM, ML and KM (see Table 2).
|
| 265 |
+
|
| 266 |
+
# 241 5.1 DM
|
| 267 |
+
|
| 268 |
+
242 Containerized Data and Models in Evident prevents unstable data dependency, model entanglement
|
| 269 |
+
243 and cascade correction. Dead data and codes can be easily identified and removed. Standardized
|
| 270 |
+
244 Models and Experiments encourage reuse of computationally efficient containers, support automatic
|
| 271 |
+
245 DM. Different experiments may use different optimization target function on the same Model and
|
| 272 |
+
246 Data to deliver different Knowledges for different users, e.g. Marketing vs Engineering managers.
|
| 273 |
+
247 Containerization is an alternative to the state of the art artifact version control, such as git, which
|
| 274 |
+
248 keeps only the one version of the code or data in the workspace with historic versions saved as
|
| 275 |
+
249 commits. Evident keeps all applicable versions available in the workspace for easy access. This may
|
| 276 |
+
250 appear to use more storage space. However current version control tools all save version commits as
|
| 277 |
+
251 snapshots [51], demanding comparable storage space of Evident if a Evident equivalent number of
|
| 278 |
+
252 versions are stored.
|
| 279 |
+
|
| 280 |
+
Evident granulates project activities into independent standardized Knowledge and Container levels, supports adaptive development, facilitates project planning among collaborators in teams of various sizes and reduces planning overhead. Artifacts are continuously stored in $E K B$ , making project development measurable, trackable, reproducible and scalable. Meanwhile once Containers are produced, Knowledge or documentation reports can be generated automatically instead of manually. Evident accelerates DM delivery in both short-term and long-term.
|
| 281 |
+
|
| 282 |
+
# 259 5.2 ML
|
| 283 |
+
|
| 284 |
+
A deployed Algo can be evaluated easily by re-applying the original Research Experiment on the production data. Different users involved in the deployment can understand the Algo’s scope and origins easily by examining the research Experiment (see Fig 4b). Research Experiments can load data in real time as Production Experiment, so that both Experiments can inherit the same design patterns with statistical analysis and evaluation metrics. The Production Experiment can report and examine the prediction performance at regular time intervals to detect production data pattern drift for either model reconfiguration or model replacement. Once a model with its configuration is retired from production, the production data is containerized and associated with the Production Experiment, transforming the Production Experiment into Research Experiment and a deduction Knowledge for prediction into an induction Knowledge that is also preserved in $E K B$ .
|
| 285 |
+
|
| 286 |
+
270 Because both research and production can operate on the same $E K B$ , research and production team
|
| 287 |
+
271 members can share the same workspace the way software engineers work on the same code repository,
|
| 288 |
+
272 facilitating the model migration from research to production and efficient team collaborations.
|
| 289 |
+
|
| 290 |
+
Knowledge formatting into design patterns of Containers provides a meaningful progress towards Knowledge standardization for improved definition, reference and storage compared to state of art sentences or articles. EKB with standardized Container templates may offer potential tools for people to examine the Hypotheses formed against evidence or Observations, facilitating evidence-based decision making and Knowledge development. EKB can not only facilitate Knowledge dissemination, accumulation and retention, but also label the development status of each Hypothesis as proved, disproved or overlooked, a desirable design pattern for projects and Knowledge Management.
|
| 291 |
+
|
| 292 |
+
# 6 Discussions
|
| 293 |
+
|
| 294 |
+
# 6.1 Significance
|
| 295 |
+
|
| 296 |
+
Evident may advance many society domains such as software, philosophy, science, business as well as Knowledge sharing and retention across the globe, thanks to its applicability to general KM.
|
| 297 |
+
|
| 298 |
+
EKB may make no smaller impacts than relational data base [50], the invention of which created a data base industry, as one solution to store information as Knowledge, a granular level above data.
|
| 299 |
+
|
| 300 |
+
# 6.2 Work to do
|
| 301 |
+
|
| 302 |
+
Work needs to be done regarding Evident ergodicity over logical reasoning in philosophy. If proved, Evident can support all logical reasoning in philosophy. No evidence has existed to prove or disprove the claim. Evident ergodicity is overlooked, stated in Evident language, especially considering logical reasoning in philosophy may evolve.
|
| 303 |
+
|
| 304 |
+
Control studies need to be done to show Evident can truly provide value. No tools tailored to support Evident project development planning and EKB are available, although some existing tools are applicable for use. Particularly the tools that allow unexpected alteration proof, easy access and visualization of Containers are in demand. More detailed discussions need to be done about how Evident help applicable projects with examples.
|
| 305 |
+
|
| 306 |
+
# 6.3 Pain points not alleviated
|
| 307 |
+
|
| 308 |
+
Evident offers no detailed guidance in development below Container level. For example, a Model or computation flow cannot be broken down further into smaller modules by Evident for incremental and adaptive development. Multiple languages smells and accidents running prototype Algo in production cannot be avoided by Evident either. In addition, Evident cannot control future observation alteration caused by decisions made by people based on Evident produced Knowledge.
|
| 309 |
+
|
| 310 |
+
Evident can only manage project artifacts of data or codes but not sensors or hardwares. Pain points caused in data acquisition such as availability, inaccuracy and inconsistency are out of Evident’s scope. Evident is incapable of improving computation hardware resources allocation either.
|
| 311 |
+
|
| 312 |
+
# 6.4 More words about Agile
|
| 313 |
+
|
| 314 |
+
Due to Agile’s ambiguity and unfalsifiability as a scientific claim, it might be a better practice to drop the term Agile and instead quote each framework currently under Agile on its own. Frameworks such as iterative and evolutionary development as well as Kanban are valuable although need to be employed discretionally. Practitioners should have better understood what exactly they were doing without being fuzzed by the buzzword Agile.
|
| 315 |
+
|
| 316 |
+
# 12 7 Conclusions
|
| 317 |
+
|
| 318 |
+
The paper proposes Evident as a project development and artifact management methodology for DM, ML and KM as well as $E K B$ as a Knowledge base topology. Evident and EKB have been shown of great value to alleviate many unresolved pain points. Evident has the potential to facilitate the advancement of many aspects of society due to its utility in general Knowledge management. $E K B$ may serve as the infrastructure for storing information as Knowledge, a granular level above data.
|
| 319 |
+
|
| 320 |
+
# A Appendix
|
| 321 |
+
|
| 322 |
+
# A.1 The following among the four Values and twelve Principles of The Manifesto [24] appear to be goals:
|
| 323 |
+
|
| 324 |
+
Value 4: Responding to change over following a plan;
|
| 325 |
+
Principle 1: Customer satisfaction by early and continuous delivery of valuable software. Principle 2: Welcome changing requirements, even in late development.
|
| 326 |
+
Principle 3: Deliver working software frequently (weeks rather than months)
|
| 327 |
+
Principle 7: Working software is the primary measure of progress
|
| 328 |
+
Principle 8: Sustainable development, able to maintain a constant pace
|
| 329 |
+
Principle 9: Continuous attention to technical excellence and good design
|
| 330 |
+
Principle 10 : Simplicity—the art of maximizing the amount of work not done—is essential
|
| 331 |
+
|
| 332 |
+
# A.2 The following in The Manifesto appear to be approaches but vaguely defined:
|
| 333 |
+
|
| 334 |
+
Value 1: Individuals and interactions over processes and tools
|
| 335 |
+
Value 2: Working software over comprehensive documentation
|
| 336 |
+
Value 3: Customer collaboration over contract negotiation
|
| 337 |
+
Principle 5: Projects are built around motivated individuals, who should be trusted
|
| 338 |
+
Principle 11: Best architectures, requirements, and designs emerge from self-organizing teams
|
| 339 |
+
|
| 340 |
+
# A.3 The following in The Manifesto appear to be actionable approaches but irrelevant of iterative, evolutionary or incremental development regarded as Agile by most people [9]:
|
| 341 |
+
|
| 342 |
+
Principle 4: Close, daily cooperation between business people and developers Principle 6: Face-to-face conversation is the best form of communication (co-location) Principle 12: Regularly, the team reflects on how to become more effective, and adjusts accordingly
|
| 343 |
+
|
| 344 |
+
# References
|
| 345 |
+
|
| 346 |
+
[1] B. Jowett and L. Campbell, Plato’s Republic : the Greek text. Oxford $:$ At the Clarendon Press, 1894.
|
| 347 |
+
[2] J. J. P. Eckert and J. W. Mauchly, “Electronic numerical integrator and computer,” New York, NY, 1947.
|
| 348 |
+
[3] A. D. Booth and K. H. Britten, “General considerations in the design of an all purpose electronic digital computer,” Tech. Rep., 1947.
|
| 349 |
+
[4] M. Campbell-Kelly, “The development of computer programming in britain (1945 to 1955),” Annals of the History of Computing, vol. 4, no. 2, pp. 121–139, 1982.
|
| 350 |
+
[5] P. Bentley, Digitized: The science of computers and how it shapes our world. New York: Oxford University Press, 2012.
|
| 351 |
+
[6] D. E. Knuth and L. T. Pardo, “Early development of programming languages,” A History of Computing in the Twentieth Century, 1980.
|
| 352 |
+
[7] R. R. Carhart, A Survey of the Current Status of the Electronic Reliability Problem. Santa Monica, CA: RAND Corporation, 1953.
|
| 353 |
+
[8] Symposium on advanced programming methods for digital computers : Washington, D.C., June 28, 29, 1956. Office of Naval Research, Dept. of the Navy, 1956. [9] C. Larman and V. R. Basili, “Iterative and incremental development: A brief history,” Computer, vol. 36, pp. 47–56, 2003.
|
| 354 |
+
[10] S. H. Lavington, A History of Manchester Computers. British Computer Society, 1998.
|
| 355 |
+
[11] T. Bardini, Bootstrapping: Douglas Engelbart, Coevolution, and the Origins of Personal Computing. Standford CA: Stanford University Press, 2000.
|
| 356 |
+
[12] W. W. Royce, “Managing the development of large software systems,” in Technical Papers of Western Electronic Show and Convention, 1970.
|
| 357 |
+
[13] T. E. Bell and T. A. Thayer, “Software requirements: Are they really a problem?” in Proceedings of the 2nd International Conference on Software Engineering. Washington, DC, USA: IEEE Computer Society Press, 1976.
|
| 358 |
+
[14] T. Gilb, Software Metrics. Winthrop Publishers, 1976.
|
| 359 |
+
[15] E. A. Edmonds, “A process for the development of software for nontechnical users as an adaptive system,” General Systems, vol. 19, p. 215–18, 1974.
|
| 360 |
+
[16] W. Isaacson, The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution. SIMON and SCHUSTER, 2014.
|
| 361 |
+
[17] J. L. Pelkey, “The history of computer communications,” April 2022. [Online]. Available: https://historyofcomputercommunications.info/
|
| 362 |
+
[18] R. Clarke, “Origins and nature of the internet in australia,” Emergence: Complexity and Organization, vol. 4, pp. 1990–1994, 2004.
|
| 363 |
+
[19] R. H. Zakon, “Hobbes’ internet timeline 25,” April 2022. [Online]. Available: https://www.zakon.org/robert/internet/timeline/
|
| 364 |
+
[20] “Military standard: Defense system software development by department of defense,” Jun 1985.
|
| 365 |
+
[21] J. M. Kerr and R. Hunter, Inside RAD: How to Build a Fully Functional System in 90 Days or Less. McGraw-Hill, 1993.
|
| 366 |
+
[22] R. Nagel and R. Dove, 21st Century Manufacturing Enterprise Strategy: An Industry-Led View. Diane Pub Co, 1991.
|
| 367 |
+
[23] A. Presley, J. Mills, and D. Liles, “Agile aerospace manufacturing,” 1995.
|
| 368 |
+
[24] M. Beedle, A. van Bennekum, and A. Cockburn, “Manifesto for agile software development,” April 2001. [Online]. Available: https://agilemanifesto.org/
|
| 369 |
+
[25] D. J. Power, “A brief history of decision support systems,” April 2022. [Online]. Available: http://DSSResources.COM/history/dsshistory.html
|
| 370 |
+
[26] R. Wirth and J. Hipp, “Crisp-dm: Towards a standard process model for data mining,” Proceedings of the 4th International Conference on the Practical Applications of Knowledge Discovery and Data Mining, 2000.
|
| 371 |
+
[27] IBM, “Crisp-dm help overview,” April 2022. [Online]. Available: https://www.ibm.com/docs/ en/spss-modeler/SaaS?topic=dm-crisp-help-overview
|
| 372 |
+
[28] Microsoft, “Agile development of data science projects,” April 2022. [Online]. Available: https://docs.microsoft.com/en-us/azure/architecture/data-science-process/agile-development
|
| 373 |
+
[29] “Agile data science by data science process alliance,” April 2022. [Online]. Available: https://www.datascience-pm.com/agile-data-science/
|
| 374 |
+
[30] I. Lee, “6 reasons why i think agile data science does not work,” April 2022. [Online]. Available: https://towardsdatascience.com/ 6-reasons-why-i-think-agile-data-science-does-not-work-ee4dd680bb59
|
| 375 |
+
[31] E. Yan, “Data science and agile (what works, and what doesn’t,” April 2022. [Online]. Available: https://eugeneyan.com/writing/data-science-and-agile-what-works-and-what-doesnt/
|
| 376 |
+
[32] T. Dyba and T. Dingsøyr, “Empirical studies of agile software development: A systematic review,” Information and Software Technology, vol. 50, no. 9, pp. 833–859, 2008.
|
| 377 |
+
[33] “Agile 101 by agile alliance,” April 2022. [Online]. Available: https://www.agilealliance.org/ agile101/
|
| 378 |
+
[34] P. Abrahamsson, O. Salo, J. Ronkainen, and J. Warsta, “Agile software development methods: Review and analysis,” 2017.
|
| 379 |
+
[35] A. L. Fruhling and A. E. Tarrell, “Best practices for implementing agile methods: A guide for department of defense software developers,” Information Systems and Quantitative Analysis Faculty Publications, vol. 27, 2007.
|
| 380 |
+
[36] K. Popper, The Logic of Scientific Discovery. London and New York: Routledge, 2002.
|
| 381 |
+
[37] S. Braams, “The software development landscape: A rationalization of agile software development as a strategy in the face of organizational complexity,” April 2022. [Online]. Available: http://essay.utwente.nl/80784/
|
| 382 |
+
[38] S. Forum, “Agile - methodology or framework or philosophy,” April 2022. [Online]. Available: https://www.scrum.org/forum/scrum-forum/6117/ agile-methodology-or-framework-or-philosophy
|
| 383 |
+
[39] T. Schick, Doing Philosophy: An Introduction Through Thought Experiments. Mcgraw-Hill, 2009.
|
| 384 |
+
[40] D. Sculley, G. Holt, D. Golovin, E. Davydov, T. Phillips, D. Ebner, V. Chaudhary, M. Young, J.-F. Crespo, and D. Dennison, “Hidden technical debt in machine learning systems,” in Advances in Neural Information Processing Systems, vol. 28. Curran Associates, Inc., 2015.
|
| 385 |
+
[41] H. H. Nithya Sambasivan, Shivani Kapania, “"everyone wants to do the model work, not the data work": Data cascades in high-stakes ai,” 2021.
|
| 386 |
+
[42] T. J. Sebastian Schelter, Felix Biessmann, “On challenges in machine learning model management,” IEEE Data Eng. Bull., 2018.
|
| 387 |
+
[43] F. Kumeno, “Sofware engneering challenges for machine learning applications: A literature review,” Intelligent Decision Technologies, vol. 13, no. 4, pp., vol. 13, no. 4, pp. 463–476, 2019.
|
| 388 |
+
[44] “Python,” April 2022. [Online]. Available: https://www.python.org/
|
| 389 |
+
[45] “Ubuntu,” April 2022. [Online]. Available: https://ubuntu.com/
|
| 390 |
+
[46] D. L. Sackett, “Evidence-based medicine,” Seminars in Perinatology, vol. 21, no. 1, pp. 3–5, 1997.
|
| 391 |
+
[47] S. Spear and T. Hone, “Succeeding in periods of change,” Proceedings U.S. Naval Institute, March 2022.
|
| 392 |
+
[48] LessWrong, “Welcome to lesswrong!” April 2022. [Online]. Available: https: //www.lesswrong.com/posts/bJ2haLkcGeLtTWaD5/welcome-to-lesswrong
|
| 393 |
+
[49] E. M. Rogers, Diffusion of innovations, 5th ed. New York, NY: Free Press, 2003.
|
| 394 |
+
[50] E. F. Codd, “A relational model of data for large shared data banks,” Commun. ACM, vol. 13, no. 6, p. 377–387, jun 1970.
|
| 395 |
+
[51] Git, “Git internals - git objects,” April 2022. [Online]. Available: https://book.git-scm.com/ book/en/v2/Git-Internals-Git-Objects
|
| 396 |
+
|
| 397 |
+
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:
|
| 398 |
+
|
| 399 |
+
• Did you include the license to the code and datasets? [Yes] See Section ??.
|
| 400 |
+
• Did you include the license to the code and datasets? [No] The code and the data are proprietary.
|
| 401 |
+
• Did you include the license to the code and datasets? [N/A]
|
| 402 |
+
|
| 403 |
+
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.
|
| 404 |
+
|
| 405 |
+
1. For all authors...
|
| 406 |
+
|
| 407 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 408 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 409 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes]
|
| 410 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 411 |
+
|
| 412 |
+
2. If you are including theoretical results...
|
| 413 |
+
|
| 414 |
+
(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]
|
| 415 |
+
|
| 416 |
+
3. If you ran experiments...
|
| 417 |
+
|
| 418 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [N/A]
|
| 419 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [N/A]
|
| 420 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A]
|
| 421 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A]
|
| 422 |
+
|
| 423 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 424 |
+
|
| 425 |
+
(a) If your work uses existing assets, did you cite the creators? [N/A]
|
| 426 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 427 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 428 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 429 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 430 |
+
|
| 431 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 432 |
+
|
| 433 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 434 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 435 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/a8qX5RG36jd/a8qX5RG36jd.md
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LasUIE: Unifying Information Extraction with Latent Adaptive Structure-aware Generative Language Model
|
| 2 |
+
|
| 3 |
+
Hao Fei 1 Shengqiong Wu 1 Jingye Li 2 Bobo Li 2 Fei Li 2 Libo Qin 1 Meishan Zhang 3∗ Min Zhang 3 Tat-Seng Chua 1 1 Sea-NExT Joint Lab, School of Computing, National University of Singapore 2Wuhan University 3 Harbin Institute of Technology (Shenzhen) {haofei37, liboqin, dcscts}@nus.edu.sg swu@u.nus.edu {theodorelee, boboli, lifei_csnlp}@whu.edu.cn mason.zms@gmail.com zhangmin2021@hit.edu.cn
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Universally modeling all typical information extraction tasks (UIE) with one generative language model (GLM) has revealed great potential by the latest study, where various IE predictions are unified into a linearized hierarchical expression under a GLM. Syntactic structure information, a type of effective feature which has been extensively utilized in IE community, should also be beneficial to UIE. In this work, we propose a novel structure-aware GLM, fully unleashing the power of syntactic knowledge for UIE. A heterogeneous structure inductor is explored to unsupervisedly induce rich heterogeneous structural representations by posttraining an existing GLM. In particular, a structural broadcaster is devised to compact various latent trees into explicit high-order forests, helping to guide a better generation during decoding. We finally introduce a task-oriented structure fine-tuning mechanism, further adjusting the learned structures to most coincide with the end-task’s need. Over 12 IE benchmarks across 7 tasks our system shows significant improvements over the baseline UIE system. Further in-depth analyses show that our GLM learns rich task-adaptive structural bias that greatly resolves the UIE crux, the long-range dependence issue and boundary identifying.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Information extraction (IE) is widely considered as one of the most kernel topics in natural language processing (NLP), which is defined as to identify the desired structural information from the unstructured texts [4, 63, 47, 44, 39, 29, 15]. There is a variety of IE and IE-derived tasks, yet all of which revolves around predicting two key elements: mention spans or/and their semantic relations. For example as in Fig. 1(b), NER detects the mention spans, while RE recognizes each possible mention and its associated mention with relation. In this regard, all the existing IE jobs can be reduced into three prototypes: span extraction, pair extraction and hyper-pair extraction, as depicted in Fig. 1(a).
|
| 12 |
+
|
| 13 |
+
In the era of deep learning, IE witnesses extraordinary developments, where especially the recent triumph of pre-trained language models (LMs) helps push the state-of-the-art (SoTA) IE performances amazingly [10, 3, 25, 80, 73]. Prior related works mostly design particular models for certain IE tasks in isolation; while the latest SoTA progress [42] is achieved by unifying all IE tasks with a single encoder-decoder GLM, i.e., UIE. As different IE tasks essentially share the similar nature (i.e., modeling span and relation features), it is proven that universally modeling multiple IE tasks helps further learning of general sharable knowledge from varying task sources, which makes UIE great potentials in real-world scenarios. In this work we inherit this wisdom and also focus on UIE.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: We reduce all the IE tasks into three prototypes (a) with representative examples (b). We unify all IEs with an encoder-decoder GLM (c). Both syntactic dependency (d) and constituency structure (e) plays a key but distinct role in IE, where the former helps solve long-range dependence problem and the latter benefits boundary detection issue. Best viewed with zooming in.
|
| 17 |
+
|
| 18 |
+
On the other hand, previous IE research extensively employs the external syntactic structure information, such as the dependency tree, for task improvements [5, 49, 45, 24, 52, 18]. Behind the enhancements is that IE structure corresponds much with the syntax structure explicitly, where the latter can essentially offer low-level linguistic bias for better learning the high-level semantic structure. As exemplified in Fig. 1(d), the dependency tree coincides much with structure of EE task as in Fig. 1(b). Importantly, some findings reveal that the LMs, being pre-trained on large corpus, capture structural syntax knowledge [68, 20, 23], which gives rise to LMs’ distinguishing promotion on IE. Yet probing tasks show that the auto-learned structure representations is weak, which inevitably limits the LM efficacy for IE [8, 30, 65]. Correspondingly, a line of researches fuse external syntax trees into LMs to reinforce the structure awareness, i.e., structure-aware LMs [71, 2, 38, 6].
|
| 19 |
+
|
| 20 |
+
Motivations. After carefully revisiting the existing literatures, we summarize four key limitations of syntactic structure-aware LMs that hamper IE from further improvements. First, existing structureaware LMs are mostly designed for one certain IE task (e.g., NER [69], RE [36]) instead of UIE, leaving the shared IE knowledge and the task-invariant syntax features unexploited. Second, current structure-aware LMs merely consider making use of one standalone type of syntax structures, i.e., mostly using the dependency trees [49, 24]. We however argue that as one core grammar, constituency syntax can serve complementary contributions for IEs. There are two common challenges of IEs: longrange dependence problem and boundary identifying, in which the dependency structure especially helps solve the former one [49, 45, 52] and the constituency syntax could mostly benefits the latter [79, 46, 54], as in Fig. 1(d)&(e). Thus it is best to simultaneously model both two heterogeneous structures [31, 17]. Third, existing works mostly integrate supervised syntax parse trees, where unfortunately, either the amount of manually annotated syntactic data (e.g., PTB) are largely limited, or the annotation noises from third-party parsers are inevitably introduced due to such explicit injection. Fourth, parsing syntax comes with task-irrelevant or indirect substructures (e.g., in Fig. 1(d) the black and dotted lines respectively), which would deteriorate the efficacy. Meanwhile, different IE tasks largely demand distinct bias of structural features, while current structure-aware LMs fail to fine-tune the structure knowledge to allow the structure bias best accord with end task’s need.
|
| 21 |
+
|
| 22 |
+
Contributions. On the above basis, we propose learning a latent adaptive structure-aware generative language model for UIE (namely LasUIE). First of all, we reduce UIE into three uniform prototypes, upon which we transform the UIE into generative paradigm with an encoder-decoder GLM, predicting the linearized hierarchical expression (i.e., spans&attributes, relations&types, as shown in Fig. 1(c)). Then, we adopt a three-stage of LM training procedure, where an additional structure-aware posttraining is added between the pre-training and fine-tuning stages for structure learning. Inspired by the progress of unsupervised grammar induction [58, 59, 28, 60], we design a heterogeneous structure inductor (HSI) module, where two heterogeneous syntactic structures are simultaneously measured and automatically learned. With HSI, our GLM initialized with existing pre-trained parameters, during post-training, performs unsupervised syntax induction based on unlabeled texts without relying on external syntax parses or any annotation labor (cf. Fig. 2).
|
| 23 |
+
|
| 24 |
+
Since the induced latent structural representations may be squeezed aside by the mainstay contextual representations in LM encoder, we further enhance the utility of syntax by introducing a structural broadcaster (SB) module (cf. Fig.2). SB compacts multiple varying latent trees from different encoding attention heads into an explicit constituency-like and a dependency-like forest respectively. During each decoding step, two heterogeneous syntactic forests are utilized to produce high-order features at global level for guiding better content generation. Finally, during the prompt-based fine-tuning stage we perform task-oriented structure adaptive tuning to narrow the gaps between the induced syntactic and task-specific structures (cf. Fig. 3). With policy gradient we dynamically adjust the attributes of two heterogeneous structures according to the feedback of end task performance.
|
| 25 |
+
|
| 26 |
+
Extensive experiments are performed on 12 representative data across 7 IE tasks. On both the supervised and low-resource settings our framework consistently shows improvements over the baseline systems. Via further analyses we verify that 1) unifying IE tasks by further modeling structure information in LM benefits IE substantially, especially in the low-resource scenario. 2) Integrating two heterogeneous structures brings mutual advantages for UIE, helping fully resolve the boundary identifying and long-range dependence issue. 3) Automatically inducing latent structures in LM with further task-oriented structural adaptation learning significantly consolidates the efficacy of structure knowledge for end tasks. 4) Different types of IE tasks rely subtly on varying structural bias, all of which can be flexibly learned and correctly satisfied by our system. Our resources can be found at https://github.com/ChocoWu/LasUIE.
|
| 27 |
+
|
| 28 |
+
# 2 Related Work
|
| 29 |
+
|
| 30 |
+
IE is a long-standing research topic in NLP, which includes various tasks as well as growing derivations [4, 63, 47, 44, 35, 78]. We reveal that essentially all the IE tasks can be summarized into three main prototypes, according to the combination numbers of ‘mention span’ and ‘semantic relation’ prediction targets: 1) span extraction, e.g., named entity recognition (NER) [9], aspectbased sentiment analysis (ABSA) [64], aspect-term extraction (ATE) [37]; 2) pair extraction, e.g., relation extraction (RE) [81, 34], aspect-opinion pair extraction (AOP) [85], aspect-based sentiment triplet extraction (ASTE) [50]; and 3) hyper-pair extraction, e.g., event extraction (EE) [21], semantic role labeling (SRL) [19], opinion role labeling (ORL) [27, 61]. Mostly prior IE researches all solve one particular task exclusively (or one specific IE type) [49, 72, 40, 77, 86], while they may unfortunately ignore certain task-invariant universal IE features. In this work, we consider the line of UIE, unifying all IE tasks to exploit the shared IE knowledge. And based on the above UIE prototypes, we develop a LM-based unified framework with generative paradigm.
|
| 31 |
+
|
| 32 |
+
Many efforts are paid for building LMs to handle IE tasks by taking advantages of the knowledge from large-scale pre-training [10, 3, 25, 80, 73]. Another line of IE researches propose injecting external knowledge into LMs or GLMs, such as knowledge graph (KG) [41, 26, 83, 16], syntax structure information [71, 2, 38, 6]. Comparing to the integration of domain-specific KG information for certain IE tasks, syntactic information would provide much broader generic features in the scope of UIE. The very latest research attention of LMs has been focused on the GLMs, the encoder-decoder paradigm LMs. GLMs transform various NLP tasks into a unified seq-to-seq scheme with some properly-designed prompt texts as additional inputs [32, 55, 80]. Very recently, Lu et al. (2022) [42] pioneer the UIE by casting the IE structure prediction into text generation with a GLM, with which our UIE modeling shares the same spirit. We however note that our work can advance in two major aspects. First, we consider the integration of additional structural knowledge in GLMs for UIE enhancements. Besides, [42] require supervisedly pre-training their UIE GLM on a large-scale annotated IE corpus, while our system automatically induces structure knowledge based merely on unlabeled texts without any further annotation and labor.
|
| 33 |
+
|
| 34 |
+
This work also closely relates to the line of structure-aware LMs. On the one hand, some researches propose directly introducing external syntax trees into LMs to reinforce the structure awareness. They mostly take the Transformer-based LMs as backbone, and fuse the syntax signals (annotations) from external parsers or PTB corpus by modifying the Transformer attentions [71, 38, 6]. Another line of structure-aware LMs directly induce syntax structure into LMs automatically, a.k.a., unsupervised grammar induction [7, 75, 58, 12, 59, 28]. We in this work borrow the success of unsupervised grammar induction, inducing rich structure information for LMs for better UIE. Inspired by the foundation of syntax distance measurements [58, 13, 60], we propose to induce linguistic structures and compose both the constituency and dependency syntax structures simultaneously.
|
| 35 |
+
|
| 36 |
+

|
| 37 |
+
Figure 2: Our LasUIE framework under $( a )$ unsupervised structure-aware post-training $\cdot y _ { \mapsto } ^ { ' }$ refers to prediction $y ^ { ' }$ with shift right in seq-to-seq procedure). Heterogeneous structure inductor module generates both constituency and dependency structures via (b) two heterogeneous syntax measurements.
|
| 38 |
+
|
| 39 |
+
# 3 Unifying Information Extraction with Text Generative Paradigm
|
| 40 |
+
|
| 41 |
+
As aforementioned, we reduce all IE jobs into the predictions of few structural elements: 1) spans and 2) relations, and without losing the generality of UIE, we also consider the predictions of 3) span attributes and 4) relation types. Using different combinations of the structural elements properly can construct a hierarchical IE structure. In other words, we can arrange these elements into a sequential textual expression, from which the actual IE target can be easily restored. Based on this we unifiedly model all IE tasks (i.e., UIE) by transforming the structure prediction into text generation. Fig. 1(c) illustrates the main idea. Such generative scheme also enables to take the advantage of the recent achievement of GLMs, such as BART [32] and T5 [55]. Taking an existing GLM as backbone, we reach the goal of end-to-end UIE as well as complex IE, such as overlapped and discontinuous cases [82, 14, 33]. Our LM encoder takes input text (i.e., $x$ ), and the decoder produces the linearized hierarchical expression (LHE), i.e., $y$ . Fig. 3 illustrates the input and output implications.
|
| 42 |
+
|
| 43 |
+
Input. The input text $x = \{ w _ { 1 } , \cdots , w _ { n } \}$ includes the raw sentence and task-specific label prompts. The label prompts contain the pre-defined task-specific labels, including span attributes $( ^ { \cdot } A t t r ^ { \cdot } )$ and relational types $( \ ' T y p e )$ , where each label is separated by a ‘<SPAN>’ or a ‘<REL>’ marker. Parts of the $\cdot _ { A t t r } ,$ and ‘Type’ labels will be copied and output in $y$ . We also insert a task identifier token $\mathrm { \hbar ^ { \circ } < T A S K > } ^ { \prime }$ to inform the model which task to predict.
|
| 44 |
+
|
| 45 |
+
Output. The output text $y$ is a linearized hierarchical expression that describes how the structural elements organize into the target structure, as depicted in Fig. 3. For example, in span extraction, $y$ should be a list of text spans and attribute labels, i.e., $\cdot \{ ( S p a n , A t t r ) , \cdot \cdot \cdot \} ^ \}$ . In pair extraction $y$ is a list of pairs, where a pair is represented as $^ { \ast } ( S p a n _ { i } , A t t r _ { i } [ T y p e _ { k } ] ( S p a n _ { j } , A t t r _ { j } ) ) ^ { \ast }$ in which $S p a n _ { j }$ is a subordinate mention of $S p a n _ { i }$ with a semantic relation $T y p e _ { k }$ . For hyper-pair extraction $y$ is a list of hyper-pairs represented as ‘ $( S p a n _ { i } , A t t r _ { i } [ T y p e _ { k } ] ( S p a n _ { j } , A t t r _ { j } ) [ T y p e _ { m } ] ( S p a n _ { i }$ k, Attrk) · · · )’.
|
| 46 |
+
|
| 47 |
+
It is also noteworthy that our LHE takes a similar scheme with [42] , but with difference. For example, in our scheme all the mention comes with an associated attribute label in any IE prototype; while in [42] the subordinate mentions have no attribute labels. Thus, our design could be more generalized.
|
| 48 |
+
|
| 49 |
+
# 4 Learning Latent Adaptive Structure-aware Generative Language Model
|
| 50 |
+
|
| 51 |
+
# 4.1 Overall Framework
|
| 52 |
+
|
| 53 |
+
The overall framework is built upon a Transformer-based encoder-decoder GLM, based on which we additionally add 1) a heterogeneous structure inductor module at top of the encoder for structural learning, 2) a structural broadcaster module between GLM encoder and decoder for enhancing the structural feature utility. Fig. 2 shows the overall architecture of our LasUIE GLM.
|
| 54 |
+
|
| 55 |
+
LasUIE takes a three-stage training process, where a structure-aware post-training is inserted between the pre-training and fine-tuning stages for structure learning. LasUIE takes an existing well pretrained GLM parameters (e.g., BART, T5) as initiation. During structure-aware post-training stage our GLM carries out unsupervised syntax induction based on unlabeled plain texts (cf. §4.2). Thereafter, LasUIE is fine-tuned on the in-house training data, along with which we perform task-oriented structure adaptive tuning (cf. $^ \mathrm { ~ \ S ~ } \mathrm { ~ ~ }$ . We also note that LasUIE takes a consistent paradigm of text-totext generation throughout the whole three stages, which ensures a minimum information loss from the early trainings to the final predicting.
|
| 56 |
+
|
| 57 |
+
# 4.2 Unsupervised Structure-aware Post-training
|
| 58 |
+
|
| 59 |
+
Heterogeneous structure inductor. As cast earlier, although LMs are able to learn certain linguistic knowledge from generic pre-training, the signal strength of learned syntax is quite weak to contribute IE enough [65, 30]. In the structure-aware post-training stage, we aim to unsupervisedly enrich our GLM with sufficient structural knowledge, reinforcing the awareness of linguistic syntax.
|
| 60 |
+
|
| 61 |
+
Inspired by Shen et al. (2021) [60], we explore a heterogeneous structure inductor (HSI) stacked on top of GLM encoder to reach the above goal. HSI induces linguistic structures based on the foundation of syntax distance measurements [58]. We employ two heterogeneous syntax measurements, i.e., $O ^ { C } { = } \{ o _ { 1 } ^ { c } , \cdots , o _ { n - 1 } ^ { c } \}$ $( o _ { < 1 } ^ { c } { = } o _ { > n - 1 } ^ { c } { = } \infty )$ ) for measuring constituency syntax, and $O ^ { D } { = } \{ o _ { 1 } ^ { d } , \cdot \cdot \cdot , o _ { n } ^ { d } \}$ for measuring dependency syntax. As illustrated in Fig. 2(b), $o _ { i } ^ { c }$ is a real value depicting the height of the lowest common ancestor between two consecutive words $w _ { i }$ and $w _ { i + 1 }$ ; while $o _ { i } ^ { d }$ is a real value describing the spanning distance between the words linking to $w _ { i }$ . Intuitively, bigger $o _ { i } ^ { c }$ means bigger information divergence of the split point between the two sides of phrasal span, and larger $o _ { i } ^ { d }$ implies wider range of connections, i.e., longer-term dependent relations. As revealed that the syntax features are best learned at lower layer of GLM encoder [23], HSI thus takes the first-layer encoding representations $ { \boldsymbol { h } } _ { i } ^ { 1 }$ as input and produce syntax context representations via convolution operation: $h _ { i } ^ { * } { = } \mathrm { C o n v } ( h _ { i } ^ { 1 } )$ . Based on $\boldsymbol { h } _ { i } ^ { * }$ , HSI represents $o _ { i } ^ { c }$ and $o _ { i } ^ { d }$ as:
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
o _ { i } ^ { c } = V ^ { c } \mathrm { T a n h } ( W [ h _ { i } ^ { * } ; h _ { i + 1 } ^ { * } ] ) , \quad o _ { i } ^ { d } = V ^ { d } \mathrm { T a n h } ( W h _ { i } ^ { * } ) .
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
Then, two rules are made for generating two heterogeneous syntax based on the two measurements [60], which also helps coordinate two types of structures so that they can co-exist together and legally.
|
| 68 |
+
|
| 69 |
+
$\blacktriangleright$ Rule $\Gamma _ { C } \colon A$ smallest constituent span $C _ { [ l , r ] }$ of $w _ { i }$ $\scriptstyle ( l < i < r )$ should satisfy $( o _ { l - 1 } ^ { c } > o _ { i } ^ { d } ) \& ( o _ { r } ^ { c } > o _ { i } ^ { d } )$ . For example as in Fig. 2(b), $o _ { 2 } ^ { c } ( = 4 ) > o _ { 3 } ^ { d } ( = 3 . \dot { 5 } )$ and $O _ { 8 } ^ { c } ( = \infty ) > O _ { 3 } ^ { d }$ , thus $C _ { [ 3 , 8 ] }$ is the valid minimum span for $w _ { 3 }$ .
|
| 70 |
+
|
| 71 |
+
▶ Rule $\Gamma _ { D }$ : Generalizing $w _ { i }$ as a potential span ${ \mathit { C } } _ { [ l = i , r = i ] }$ , the dependent head of any word in $C _ { [ l , r ] }$ is $w _ { j } a r g m a x _ { k \in [ l , r ] } ( o _ { k } ^ { d } )$ . For example, the maximum $o ^ { d }$ in constituent span of $C _ { [ 3 , 8 ] }$ is $o _ { 6 } ^ { d } { = } 4 . 5$ , thus dependent head of the word in $C _ { [ 3 , 8 ] }$ is $w _ { 6 }$ .
|
| 72 |
+
|
| 73 |
+
Based on rule $\Gamma _ { C }$ we first generate all possible phrasal spans and organize them into a constituency tree $\mathcal { T } ^ { C }$ , then constructing the dependency tree $\mathcal { T } ^ { D }$ according to rule $\Gamma _ { D }$ . We parameterize the above structure construction process so as to make it all differentiable, i.e., by describing into the probabilistic perspective. We represent the span $C _ { [ l , r ] }$ distribution as:
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
\begin{array} { r l } & { p _ { c } ( c _ { k } | w _ { i } ) = p ( w _ { i } | w _ { i } ) \cdot p ( w _ { r } | w _ { i } ) } \\ & { \qquad = [ \sigma ( o _ { i } ^ { d } - \underset { k \in [ l , i ) } { \mathrm { M a x } } ( o _ { k } ^ { c } ) ) - \sigma ( o _ { i } ^ { d } - \underset { k \in ( l , i ) } { \mathrm { M a x } } ( o _ { k } ^ { c } ) ) ] \cdot [ \sigma ( o _ { i } ^ { d } - \underset { k \in [ i , r ] } { \mathrm { M a x } } ( o _ { k } ^ { c } ) ) - \sigma ( o _ { i } ^ { d } - \underset { k \in [ i , r ] } { \mathrm { M a x } } ( o _ { k } ^ { c } ) ) ] , } \end{array}
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
where $c _ { k }$ is a short hand for $C _ { [ l , r ] }$ , $\sigma$ is a sigmoid function. We then depict the rule $\Gamma _ { D }$ , and represent the word-word dependent distribution:
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
p _ { d } ( w _ { j } | w _ { i } ) = p _ { d } ( w _ { j } | c _ { k } ) \cdot p _ { c } ( c _ { k } | w _ { i } ) = p _ { c } ( c _ { k } | w _ { i } ) \cdot \exp ( h _ { j } ^ { L } ) / \sum _ { k = l } ^ { r } \exp ( h _ { k } ^ { L } ) ,
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
where we use the top-layer encoder representation $h _ { i } ^ { L }$ , by which we encourage the final encoding representations to learn from the low-layer syntax-rich representations. We note that the above structure induction is carried out in each of multi-head attention blocks (total $M$ ) in Transformer. This means that multiple distinct syntax trees of each type (i.e., $\mathcal { T } ^ { C }$ and $\mathcal { T } ^ { D }$ ) will be induced.
|
| 86 |
+
|
| 87 |
+
Structural broadcaster. It is a high chance that in GLM encoder the mainstay contextual representations will weaken the structural features and thus hurt the structure utility at decoder. To combat this, we propose a SB module, by which we explicitly collect varying trees of a type and compacted them into a forest, respectively, i.e., constituency forest ${ \mathcal { F } } ^ { C }$ and dependency forest $\mathcal { F } ^ { D }$ . According to prior studies [48, 43, 62], comparing to the optimal 1-best syntax tree, a compact forest advances in higher structure recall, which allows to learn a better bias for task. In SB, the structural priors from the syntax forests are explicitly broadcast into each decoding step for guiding the generation process.
|
| 88 |
+
|
| 89 |
+
Technically, SB selects and ranks candidate tree substructures based on the probabilistic confidence (Eq.2&3), which are then compacted into a forest based on the K-best maximum spanning tree (MST) algorithm [1, 88]. We then model the two types of forests with a graph attention model (GAT) [67] respectively, during which the decoding representation $e$ at each step is attended to spot the high-order structural feature $\textbf { \em u }$ at global level:
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\boldsymbol { \mathsf { u } } ^ { c / d } = \mathrm { G A T } ( \mathcal { F } ^ { C / D } , e \mathrm { ~ ~ \mathsf ~ { ~ \xi ~ } ~ } | \mathrm { ~ ~ \xi ~ } h ^ { 1 } ) ,
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
\pmb { u } = \pmb { u } ^ { d } \oplus \pmb { u } ^ { c } .
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
Further via a cross-attention operation (cf. Fig. 3) we navigate the encoder representation $h ^ { L }$ and the structural feature $\textbf { \em u }$ into the updated encoder representation $e ^ { * }$ :
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
e ^ { * } = \mathrm { S o f t m a x } ( \frac { { \pmb h } ^ { L } \cdot { \pmb u } } { \sqrt { d } } ) \cdot { \pmb e } .
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
Post-training objectives. The first objective is performing seq-to-seq style language modeling, i.e., ‘corrupting $^ +$ reconstructing’ the inputs [32], which is identical to the pre-training objectives. We denote the language modeling loss as ${ \mathcal { L } } _ { W }$ .
|
| 106 |
+
|
| 107 |
+
Along with the language modeling we then promote the unsupervised structure induction, including the one for dependency syntax and the one for constituency syntax:
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\begin{array} { r l } & { \mathcal { L } _ { D } = - { \sum } _ { m } ^ { M } \sum _ { i } ^ { n } \sum _ { j } ^ { n } \log p _ { d } ( w _ { j } | w _ { i } ) , } \\ & { \mathcal { L } _ { C } = - { \sum } _ { m } ^ { M } \sum _ { i } ^ { n } \sum _ { k } ^ { K } [ \log p _ { c } ( c _ { k } | w _ { i } ) + \log ( \exp \phi ( c _ { k } ) / \mathcal { Z } ) ] , } \end{array}
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
where ϕ(ck)= $\phi \big ( c _ { k } \big ) = \frac { ( \pmb { h } ^ { c } ) ^ { T } \cdot \pmb { h } _ { [ l , r ] } ^ { L } } { | | \pmb { h } ^ { c } | | \cdot | | \pmb { h } _ { [ l , r ] } ^ { L } | | }$ is a span similarity score between the constituent phrase $c _ { k }$ and the counterpart text span derived from the top-layer encoder. $\mathcal { Z }$ is for normalization.
|
| 114 |
+
|
| 115 |
+
We also perform structure diversifying regularization (SDR), putting constraints on the varying trees induced from different multi-head encoder attentions so as to ensure structure diversification.
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
\begin{array} { r } { \mathcal { L } _ { S D R } = - \sum _ { m } ^ { M } \sum _ { k } ^ { M } \mathopen { } \mathclose \bgroup \left| \left| A _ { m } \odot A _ { k } \aftergroup \egroup \right| \aftergroup \egroup \right| , \quad k \neq m , } \end{array}
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+
where $A _ { m }$ or $A _ { k }$ is an attention map. We put all the above objectives together as the post-training target: $\mathcal { L } _ { P R T } = \mathcal { L } _ { W } + \mathcal { L } _ { D } + \mathcal { L } _ { C } + \mathcal { L } _ { S D R }$ .
|
| 122 |
+
|
| 123 |
+
# 4.3 Task-oriented Structure Fine-tuning
|
| 124 |
+
|
| 125 |
+
After structure-aware posttraining, our GLM is finally fine-tuned on a specific terminal IE task to learn the on-demand features. This target is an empirical risk minimization with cross-entropy loss:
|
| 126 |
+
|
| 127 |
+
$$
|
| 128 |
+
\begin{array} { r } { \mathcal { L } _ { T a s k } = - \sum ^ { D } \log p ( y | x ) , } \end{array}
|
| 129 |
+
$$
|
| 130 |
+
|
| 131 |
+
where $D$ is the mini-batch size.
|
| 132 |
+
|
| 133 |
+
Meanwhile, we perform further task-oriented structural finetuning, adapting the learned structure information to the taskspecific IE structures, for example, in dependency structure pruning those trivial word-word connections and adjusting the range
|
| 134 |
+
|
| 135 |
+

|
| 136 |
+
Figure 3: Fine-tuning our GLM with structure adaptive learning.
|
| 137 |
+
|
| 138 |
+
of dependent paths; in constituency structure refining the phrase widths and granularities. Our main idea is to amend the syntax attribute (i.e., dependency links and constituent compositions) by directly taking the feedback of end task performance. Therefore, we employ the stochastic policy gradient algorithm [76]. As shown in Fig. 3, the actions $a _ { i } ^ { c / d } \in ( - 1 , 1 )$ are real values sampled with probabilities from a Gaussian distribution, by which we maintain a continuous control over syntax measurements, i.e., $O ^ { D }$ and $O ^ { C }$ .
|
| 139 |
+
|
| 140 |
+
$$
|
| 141 |
+
\begin{array} { r l } & { \bar { a } _ { i } ^ { c / d } \sim \pi ^ { C / D } ( s _ { i } ^ { c / d } ; \theta ^ { c / d } ) = \mathcal { N } ( 0 , I ) , } \\ & { \quad \quad \quad \quad a _ { i } ^ { c / d } = 2 \sigma ( \bar { a } _ { i } ^ { c / d } ) - 1 , } \\ & { \quad \quad \quad \quad \quad o _ { i } ^ { c / d } : = a ^ { c / d } + o _ { i } ^ { c / d } , } \end{array}
|
| 142 |
+
$$
|
| 143 |
+
|
| 144 |
+
where the $\pmb { S } _ { i } ^ { c / d } { = } ( { \pmb { h } } _ { i } ^ { 1 } \oplus { \pmb { h } } _ { i } ^ { * } \oplus { \pmb { h } } _ { i } ^ { L } )$ are the state representations as the inputs of the policy agents. The policy agents $\pi ^ { C } ( \theta ^ { c } )$ and $\pi ^ { D } ( \theta ^ { d } )$ are two parameterized two-layer feedforward networks, respectively. We design the reward of the policy as the probability of correct task prediction, such that the structure adjustments are directly supervised by terminal task’s signals: $R ^ { C / D } = \log p ( y | x )$ The learning target of each policy is to maximize the corresponding expected reward:
|
| 145 |
+
|
| 146 |
+
$$
|
| 147 |
+
\begin{array} { l } { { \mathcal { L } _ { F D } = - \displaystyle \sum _ { ( a _ { 1 } ^ { d } s _ { 1 } ^ { d } \cdot \cdot \cdot \cdot a _ { n } ^ { d } s _ { n } ^ { d } ) } \prod _ { i } p ( a _ { i } ^ { d } | { \pmb s } _ { i } ^ { d } ; \theta ^ { d } ) \cdot R _ { i } ^ { D } , } } \\ { { \mathcal { L } _ { F C } = - \displaystyle \sum _ { ( a _ { 1 } ^ { c } s _ { 1 } ^ { c } \cdot \cdot \cdot \cdot a _ { n } ^ { c } s _ { n } ^ { c } ) } \prod _ { i } p ( a _ { i } ^ { c } | { \pmb s } _ { i } ^ { c } ; \theta ^ { c } ) \cdot R _ { i } ^ { C } . } } \end{array}
|
| 148 |
+
$$
|
| 149 |
+
|
| 150 |
+
We summarize all the fine-tuning targets: $\mathcal { L } _ { F T } { = } \mathcal { L } _ { T a s k } + \mathcal { L } _ { F S }$ , where $\mathcal { L } _ { F S } = \mathcal { L } _ { F D } + \mathcal { L } _ { F C }$
|
| 151 |
+
|
| 152 |
+
# 5 Experiments
|
| 153 |
+
|
| 154 |
+
# 5.1 Setups
|
| 155 |
+
|
| 156 |
+
We take the pre-trained T5 Base as default backbone GLM. We use the plain texts from Wikipedia2 and BooksCorpus3 corpora for the post-training. To cover all three UIE prototypes, we consider 7 representative IE tasks with corresponding data: 1) NER: CoNLL03 [66], OntoNote [53], ACE04 [11], ACE05 [22]; 2) RE: CoNLL04 [57], NYT [56], ACE05 [22]; 3) AOP: Res14 [51]; 4) ASTE: Res14 [51]; 5) ORL: MPQA [74]; 6) SRL: CoNLL12 [53]; 7) EE: ACE05 [22]. Each dataset has its own split, and we follow the same practice of the relevant prior works when using it.
|
| 157 |
+
|
| 158 |
+
We verify the IE performances under the traditional separate scheme and the recent unified scheme, respectively. 1) In separate ${ \pmb U } { \pmb E }$ , we compare with the current SoTA systems (all using Large version LM/GLM) of each specific data; meanwhile we implement a T5 (Base version) system, namely GEN-T5, using the same generative manner (based on prompt input, generating LHE as ours) for running each task individually. We also retrofit the GEN-T5 system by injecting into the external syntax parse trees via additional training on the syntax annotated corpus, including the dependency syntax $( + D e p S y n )$ , constituency syntax $( + C o n S y n )$ and both two types syntax (+Dep&ConSyn), respectively. 2) In unified ${ \cal I E }$ , we mainly make comparisons with the current UIE system [42]. Note that the default UIE model (marked as $\mathrm { U I E ^ { * \dagger } }$ ) in raw paper uses T5 Large and meanwhile takes additional supervised pre-training on the large-scale IE corpus (the version without supervised IE pre-training marked as $\mathrm { U I E } ^ { * }$ ). To ensure fair comparisons, we re-implement their system with T5-Base parameters and without supervised IE pre-training, marked as UIE. Same as to GEN-T5, we also retrofit the UIE model by integrating heterogeneous syntax parse trees in different combinations.
|
| 159 |
+
|
| 160 |
+
Following each of previous works, we use the F1 evaluation metrics. For each task, we consider the end-to-end prediction. For example, for the span extraction (NER), we measure if both the mention span and the mention attribute are correct. For the pair(/hyper-pair) extraction, we measure if the span boundary $\&$ span attribute & relation & type are all correct simultaneously.
|
| 161 |
+
|
| 162 |
+
# 5.2 Main Results
|
| 163 |
+
|
| 164 |
+
We present the overall comparison results on various IE tasks in Table 1 and Table 2 under the fully-supervised and low-resource scenario, respectively. As can be seen, our proposed LasUIE framework consistently outperforms the baseline UIE and other SoTA models on all tasks in both two learning scenarios, under both the Large or Base T5 initiations. This demonstrates the efficacy of our proposal. Also we compare the counterparts between M2-M5 and M9-M12, where the only difference between these generative methods lies in the seprate or unified modeling of IE. From the results we learn that the unified modeling of IE (i.e., UIE) is more effective than the traditional separate modeling of specific IE task. This verifies that the universal modeling helps share the task-invariant IE features, coinciding with the findings in [42].
|
| 165 |
+
|
| 166 |
+
Table 1: Overall IE performances by different methods (all using LM/GLM). Models with $\ast \left( \mathbf { M } \right. $ , M6, M7 & M8) refers to the use of Large version LM, where scores by M1, M6 & M7 are copied from their raw paper [42]. $\mathrm { U I E ^ { * \dagger } }$ (M6) takes additional supervised pre-training on the large-scale IE corpus. Bold: the best results among the comparisons using Large and Base LMs, respectively.
|
| 167 |
+
|
| 168 |
+
<table><tr><td rowspan="3" colspan="2">Task&Data</td><td colspan="3">Span Extraction</td><td colspan="4">Pair Extraction</td><td colspan="4">|Hyper-pair Extraction|</td><td rowspan="3">Avg.</td></tr><tr><td colspan="3">NER</td><td colspan="3">RE</td><td colspan="2">AOP ASTE</td><td colspan="2">ORL SRL</td></tr><tr><td>|CoNLL03 OntoNote ACE04 ACE05 |CoNLL04 NYT ACE05 Res14 Res14 |</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>4 |MPQA CoNLL12 ACE05|</td><td>EE</td></tr><tr><td colspan="10"></td><td></td><td></td><td></td><td></td></tr><tr><td>· Separate IE M1 SoTA*</td><td></td><td>93.2 91.9</td><td>86.8</td><td>84.7</td><td>73.6</td><td>92.7 65.6</td><td></td><td>69.373.6</td><td></td><td>53.0</td><td>73.5</td><td>48.3 75.5</td></tr><tr><td>M2 GEN-T5</td><td>91.0</td><td>89.1</td><td>84.3</td><td>83.0</td><td>69.4</td><td>90.3 60.2</td><td>62.5</td><td>71.8</td><td>49.8</td><td>69.3</td><td>43.7</td><td>72.0</td></tr><tr><td>M3 +DepSyn</td><td>91.5</td><td>89.5</td><td>84.9</td><td>83.4</td><td>70.3</td><td>91.8 62.4</td><td></td><td>64.372.6</td><td>51.5</td><td>70.8</td><td>45.5</td><td>73.2</td></tr><tr><td>M4 +ConSyn</td><td>92.1</td><td>90.0</td><td>85.3</td><td>83.8</td><td>69.8</td><td>90.9 61.5</td><td></td><td>63.1 72.3</td><td>50.7</td><td>70.1</td><td>44.3</td><td>72.8</td></tr><tr><td>M5 +Dep&ConSynl</td><td>92.3</td><td>90.4</td><td>85.3</td><td>84.0</td><td>71.2</td><td>92.1 63.3</td><td></td><td>66.073.0</td><td>51.8</td><td>71.3</td><td>46.2</td><td>73.9</td></tr><tr><td colspan="10">Unified IE</td><td></td><td></td><td></td></tr><tr><td>M6 UIE*t</td><td>93.0</td><td>/</td><td>86.9</td><td>85.8</td><td>75.0</td><td>1 66.0</td><td>/</td><td>74.5</td><td>/</td><td>/</td><td>/</td><td>/</td></tr><tr><td>M7 UIE*</td><td>92.1</td><td>/</td><td>86.5</td><td>85.5</td><td>73.1</td><td>93.5 64.7</td><td>/</td><td>/</td><td>/</td><td>/</td><td>/</td><td>/</td></tr><tr><td>M8 LasUIE*(Ours)</td><td>93.2</td><td>93.0</td><td>86.8</td><td>86.0</td><td>75.3</td><td>94.2 66.4</td><td></td><td>73.675.2</td><td>57.8</td><td>76.3</td><td>51.7</td><td>77.4</td></tr><tr><td>M9 UIE</td><td>91.4</td><td>89.7</td><td>85.0</td><td>83.5</td><td>70.5</td><td>91.0 61.6</td><td></td><td>65.8 72.8</td><td>50.8</td><td>70.2</td><td>44.6</td><td>73.1</td></tr><tr><td>M10 +DepSyn</td><td>91.8</td><td>90.0</td><td>85.3</td><td>83.7</td><td>71.2</td><td>92.0 62.9</td><td></td><td>67.673.5</td><td>52.0</td><td>71.5</td><td>46.4</td><td>74.0</td></tr><tr><td>M11 +ConSyn</td><td>92.0</td><td>90.5</td><td>85.6</td><td>84.0</td><td>70.8</td><td>91.3 62.1</td><td>66.1</td><td>73.1</td><td>51.3</td><td>71.0</td><td>45.2</td><td>73.6</td></tr><tr><td>M12 +Dep&ConSyn</td><td>92.3</td><td>90.7</td><td>85.8</td><td>84.5</td><td>71.7</td><td>92.4 63.4</td><td></td><td>68.2 73.7</td><td>53.6</td><td>72.6</td><td>47.0</td><td>74.6</td></tr><tr><td>M13LasUIE (Ours)</td><td>92.6</td><td>92.0</td><td>86.3</td><td>85.0</td><td>73.2</td><td>93.0 64.4</td><td></td><td>70.274.8</td><td>56.0</td><td>74.7</td><td>49.0</td><td>75.9</td></tr><tr><td>M14 w/o SB</td><td>92.0</td><td>90.7</td><td>85.5</td><td>84.2</td><td>71.5</td><td>91.8 62.9</td><td></td><td>68.373.4</td><td>54.7</td><td>73.4</td><td>47.7</td><td>74.6</td></tr><tr><td>M15 w/o LsDR</td><td>92.2</td><td>91.6</td><td>86.2</td><td>84.8</td><td>72.8</td><td>92.4 64.1</td><td></td><td>70.074.4</td><td>55.5</td><td>74.0</td><td>48.6</td><td>75.6</td></tr><tr><td>M16 w/oLFS</td><td>92.4</td><td>91.4</td><td>85.9</td><td>84.7</td><td>71.8</td><td>92.0 63.6</td><td>69.1 73.6</td><td></td><td>54.2</td><td>73.0</td><td>47.1</td><td>74.9</td></tr></table>
|
| 169 |
+
|
| 170 |
+
# 5.3 In-depth Analysis
|
| 171 |
+
|
| 172 |
+
To aid better understanding the strengths of our method, we further present in-depth analyses from varying angles, i.e., by asking four key questions concentrating on the structure-aware GLM for UIE.
|
| 173 |
+
|
| 174 |
+
Q1: Can fusing syntax structure knowledge into GLM contribute to UIE? Let’s compare the results in Table 1: M2 vs. M3&M4&M5 in separate IE setup, and M9 vs. M10&M11&M12 in unified IE setup, where either in separate or unified IE setup, integrating additional linguistic syntax features into GLM evidently improves all end task performances. Interestingly, different tasks can receive varying degree of improvements from the syntax features. Importantly, we see in Table 2 that with the aids of structure knowledge, the performances of low-resource transfer can be promoted, especially in the combination with the unified modeling of IE tasks. This proves that the syntactic structures in GLM can serve as IE task-invariant features, further contributing to UIE.
|
| 175 |
+
|
| 176 |
+
Q2: What are the differences to integrate the constituency and dependency syntactic structure? We now observe the results of different tasks in both Table 1&2, and we can find that on the span extraction type IE (i.e., NER) the improvements from constituency syntax prevail, while the dependency type of structure features dominate the pair-wise tasks, i.e., (hyper-)pair extraction. We further analyze the error rate on the predictions of two kernel elements of IE, i.e., boundary recognition and relation detection, respectively on various tasks. We see from Fig. 4 that the constituency structure more tends to offer key clues for the boundary recognition; while the dependent trees are more apt to cope with the relation detection, solving long-range dependence issue. This shows that two heterogeneous structures have complementary advantages to UIE. Thus, when combining both of them together, all the end tasks receive the enhancements to the greatest extent.
|
| 177 |
+
|
| 178 |
+

|
| 179 |
+
Figure 4: Error rates on boundary recognition and relation detection, respectively.
|
| 180 |
+
|
| 181 |
+
Q3: For UIE, is it more advanced for GLM to automatically learn latent structures than injecting external syntax parse trees? First, the comparisons in the main results directly prove the advance of using latent structural features for UIE. For example, under the fair comparison, our LasUIE beats the UIE $^ +$ Dep&ConSyn model with average $1 . 3 \% ( = 7 5 . 9 - 7 4 . 6 )$ F1 improvement. Even comparing with the $\mathrm { U I E ^ { * \bar { \Pi } } }$ that takes additional pre-training on large-scale supervised IE corpus, LasUIE keeps its superiority in almost all cases. This evidently verifies that it is necessary for LMs to automatically learn latent structure information for better UIE. The underlying reason of our model’s improvements could be that the dynamically learned richer structural knowledge in LasUIE largely avoids the noises that are introduced in external syntax parse annotations. Besides, as shown in Fig. 4, LasUIE reduces the errors on predicting the mention boundaries and relational pairings more significantly than the baseline counterparts.
|
| 182 |
+
|
| 183 |
+
Further we step into our LasUIE system itself, and inspect the ablation models, M14-M15, as shown in Table 1. We see that the proposed structural broadcaster module plays important role to the overall system, i.e., without SB, LasUIE is downgraded to the level of UIE $^ +$ Dep&ConSyn. Also the structure diversification regularization mechanism serves positive effect.
|
| 184 |
+
|
| 185 |
+
Q4: Is it necessary to further fine-tune the structures in GLM for UIE? According to the results of the ablation model, M16, in Table 1, we can directly claim the answer is positive. Without performing structural fine-tuning, the results by LasUIE hurt clearly, with averaged $1 . 0 \% ( = 7 5 . 9 - 7 4 . 9 )$ F1 drop. We next dig into the structural fine-tuning mechanism, analyzing how the auto-induced structural features influence the UIE performances.
|
| 186 |
+
|
| 187 |
+

|
| 188 |
+
Figure 5: Trajectories of the changing structure Figure 6: The distributions of the range of wordagreement rates and densities during task-oriented word dependency link (words) in forest $\mathcal { F } ^ { D }$ and structure fine-tuning, based on event extraction the constituency phrasal span width (words) in (ACE05). $X$ -axis is the iteration steps for fine- forest ${ \mathcal { F } } ^ { C }$ on each data. tuning. Bars means the task performances (F1).
|
| 189 |
+
|
| 190 |
+

|
| 191 |
+
|
| 192 |
+
We first study the changing trajectories of the 1) the structure agreement rates $\Omega ^ { D / C }$ and 2) the structure densities $\Delta ^ { D / \bar { C } }$ of the structural forests ${ \mathcal { F } } ^ { D / C }$ , during fine-tuning. $\Omega ^ { C }$ or $\Omega ^ { D }$ is defined as the percentage that gold spans correspond to the phrasal spans in the constituency forest ${ \mathcal { F } } ^ { C }$ , or the gold relational pairs coincide with the word-word edges in the dependency forest $\mathcal { F } ^ { D }$ . As plotted in Fig. 5, along with the fine-tuning process the task performance climbs gradually. Meanwhile, both the agreement rate $\Omega ^ { D / C }$ increases, which means that the structural fine-tuning indeed can effectively adjust the learned structural information towards task-specific. Also, the structural densities of two forests change from dense to sparse, which depicts a structure pruning process in our system.
|
| 193 |
+
|
| 194 |
+
Finally, in Fig. 6 we present the distribution of the range of word-word dependency links in $\mathcal { F } ^ { D }$ and distribution of the constituency phrasal span width in ${ \mathcal { F } } ^ { C }$ . We can discover that different end tasks rely on subtly varying structural features or attributes. For example, hyper-pair extraction tasks require longer-range dependency features for relation determination, comparing to the IE tasks of other prototypes. In turn, this certifies that our system can correctly learn the peculiar structural bias for a specific IE task, thanks to the task-oriented structure fine-tuning mechanism.
|
| 195 |
+
|
| 196 |
+
# 6 Conclusion and Discussion
|
| 197 |
+
|
| 198 |
+
This work investigates a novel structure-aware generative language model (GLM) that learns rich heterogeneous syntactic structure representations for better unified information extraction (UIE). First, a well pre-trained GLM is taken as backbone to reach the goal of UIE, feeding with label prompt-based texts and predicting linearized hierarchical expressions that describe the actual IE target. During post-training, the proposed heterogeneous structure inductor automatically generates rich structure information without relying on any additional syntax annotation. A structural broadcaster then compacts various trees into forests for enhancing the structural feature utility and guiding better context generation. The learned structural knowledge is further fine-tuned on the in-house training data so as to adapt into the task-specific need. Extensive experiments and in-depth analyses demonstrate the efficacy of our system on improving the UIE.
|
| 199 |
+
|
| 200 |
+
Potential impact and limitations of the work. The proposed structure-aware GLM learns syntactic knowledge relies only on the plain texts with easy access, without any cost of large-scale human-labor annotations. The system will benefit the development of IE community, i.e., training one single unified model for effectively solving various IE tasks, which especially addresses the issue of IE data annotation scarcity in the real-life applications. One biggest potential risk is that the GPU-based training of our language model will cost energy consumption and $\mathrm { { C O } _ { 2 } }$ emissions.
|
| 201 |
+
|
| 202 |
+
# Acknowledgments and Disclosure of Funding
|
| 203 |
+
|
| 204 |
+
This research is supported by the Sea-NExT Joint Lab. We would also like to thank the anonymous reviewers for their valuable feedbacks.
|
| 205 |
+
|
| 206 |
+
References
|
| 207 |
+
[1] Zeljko Agic. K-best spanning tree dependency parsing with verb valency lexicon reranking. In Proceedings of the International Conference on Computational Linguistics, pages 1–12, 2012.
|
| 208 |
+
[2] Mahtab Ahmed, Muhammad Rifayat Samee, and Robert E. Mercer. You only need attention to traverse trees. In Proceedings of the Annual Meeting of the Association for Computational Linguistics, pages 316–322, 2019.
|
| 209 |
+
[3] Christoph Alt, Marc Hübner, and Leonhard Hennig. Fine-tuning pre-trained transformer language models to distantly supervised relation extraction. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1388–1398, 2019.
|
| 210 |
+
[4] Peggy M. Andersen, Philip J. Hayes, Steven P. Weinstein, Alison K. Huettner, Linda M. Schmandt, and Irene B. Nirenburg. Automatic extraction of facts from press releases to generate news stories. In Third Conference on Applied Natural Language Processing, pages 170–177, 1992.
|
| 211 |
+
[5] Gabor Angeli, Melvin Jose Johnson Premkumar, and Christopher D. Manning. Leveraging linguistic structure for open domain information extraction. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing, pages 344–354, 2015.
|
| 212 |
+
[6] Jiangang Bai, Yujing Wang, Yiren Chen, Yaming Yang, Jing Bai, Jing Yu, and Yunhai Tong. Syntax-BERT: Improving pre-trained transformers with syntax trees. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 3011–3020, 2021.
|
| 213 |
+
[7] Jihun Choi, Kang Min Yoo, and Sang-goo Lee. Learning to compose task-specific tree structures. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, pages 5094–5101, 2018.
|
| 214 |
+
[8] Alexis Conneau, German Kruszewski, Guillaume Lample, Loïc Barrault, and Marco Baroni. What you can cram into a single \$&!#\* vector: Probing sentence embeddings for linguistic properties. In Proceedings of the Annual Meeting of the Association for Computational Linguistics, pages 2126–2136, 2018.
|
| 215 |
+
[9] Silviu Cucerzan and David Yarowsky. Language independent named entity recognition combining morphological and contextual evidence. In Proceedings of the Joint SIGDAT Conference on Empirical Methods in Natural Language Processing and Very Large Corpora, 1999.
|
| 216 |
+
[10] 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, pages 4171–4186, 2019.
|
| 217 |
+
[11] George R. Doddington, Alexis Mitchell, Mark A. Przybocki, Lance A. Ramshaw, Stephanie M. Strassel, and Ralph M. Weischedel. The automatic content extraction (ACE) program - tasks, data, and evaluation. In Proceedings of The Language Resources and Evaluation Conference, page 837–840, 2004.
|
| 218 |
+
[12] Andrew Drozdov, Patrick Verga, Mohit Yadav, Mohit Iyyer, and Andrew McCallum. Unsupervised latent tree induction with deep inside-outside recursive auto-encoders. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1129–1141, 2019.
|
| 219 |
+
[13] Hao Fei, Yafeng Ren, and Donghong Ji. Retrofitting structure-aware transformer language model for end tasks. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, pages 2151–2161, 2020.
|
| 220 |
+
[14] Hao Fei, Yafeng Ren, and Donghong Ji. Boundaries and edges rethinking: An end-to-end neural model for overlapping entity relation extraction. Information Processing & Management, 57(6):102311, 2020.
|
| 221 |
+
[15] Hao Fei, Donghong Ji, Bobo Li, Yijiang Liu, Yafeng Ren, and Fei Li. Rethinking boundaries: End-to-end recognition of discontinuous mentions with pointer networks. In Proceedings of the AAAI Conference on Artificial Intelligence, pages 12785–12793, 2021.
|
| 222 |
+
[16] Hao Fei, Yafeng Ren, Yue Zhang, Donghong Ji, and Xiaohui Liang. Enriching contextualized language model from knowledge graph for biomedical information extraction. Briefings in Bioinformatics, 22(3), 2021.
|
| 223 |
+
[17] Hao Fei, Shengqiong Wu, Yafeng Ren, Fei Li, and Donghong Ji. Better combine them together! integrating syntactic constituency and dependency representations for semantic role labeling. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 549–559, 2021.
|
| 224 |
+
[18] Hao Fei, Shengqiong Wu, Yafeng Ren, and Meishan Zhang. Matching structure for dual learning. In Proceedings of the International Conference on Machine Learning, ICML, pages 6373–6391, 2022.
|
| 225 |
+
[19] Daniel Gildea and Daniel Jurafsky. Automatic labeling of semantic roles. In Proceedings of the Annual Meeting of the Association for Computational Linguistics, pages 512–520, 2000.
|
| 226 |
+
[20] Yoav Goldberg. Assessing bert’s syntactic abilities. CoRR, abs/1901.05287, 2019.
|
| 227 |
+
[21] Harry Halpin and Johanna D. Moore. Event extraction in a plot advice agent. In Proceedings of the 21st International Conference on Computational Linguistics and 44th Annual Meeting of the Association for Computational Linguistics, pages 857–864, 2006.
|
| 228 |
+
[22] hristopher Walker, Stephanie Strassel, Julie Medero, and Kazuaki Maeda. Ace 2005 multilingual training corpus. In Proceedings of Philadelphia: Linguistic Data Consortium, 2006.
|
| 229 |
+
[23] Ganesh Jawahar, Benoît Sagot, and Djamé Seddah. What does BERT learn about the structure of language? In Proceedings of the Annual Meeting of the Association for Computational Linguistics, pages 3651–3657, 2019.
|
| 230 |
+
[24] Zhanming Jie and Wei Lu. Dependency-guided LSTM-CRF for named entity recognition. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, pages 3862–3872, 2019.
|
| 231 |
+
[25] Mandar Joshi, Danqi Chen, Yinhan Liu, Daniel S. Weld, Luke Zettlemoyer, and Omer Levy. Spanbert: Improving pre-training by representing and predicting spans. Transactions of the Association for Computational Linguistics, 8:64–77, 2020.
|
| 232 |
+
[26] Kornraphop Kawintiranon and Lisa Singh. Knowledge enhanced masked language model for stance detection. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 4725–4735, 2021.
|
| 233 |
+
[27] Soo-Min Kim and Eduard Hovy. Extracting opinions, opinion holders, and topics expressed in online news media text. In Proceedings of the Workshop on Sentiment and Subjectivity in Text, pages 1–8, 2006.
|
| 234 |
+
[28] Yoon Kim, Chris Dyer, and Alexander Rush. Compound probabilistic context-free grammars for grammar induction. In Proceedings of the Annual Meeting of the Association for Computational Linguistics, pages 2369–2385, 2019.
|
| 235 |
+
[29] Keshav Kolluru, Samarth Aggarwal, Vipul Rathore, Mausam, and Soumen Chakrabarti. IMoJIE: Iterative memory-based joint open information extraction. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5871–5886, 2020.
|
| 236 |
+
[30] Olga Kovaleva, Alexey Romanov, Anna Rogers, and Anna Rumshisky. Revealing the dark secrets of BERT. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, pages 4365–4374, 2019.
|
| 237 |
+
[31] Michael Lepori, Tal Linzen, and R. Thomas McCoy. Representations of syntax [MASK] useful: Effects of constituency and dependency structure in recursive LSTMs. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 3306–3316, 2020.
|
| 238 |
+
[32] Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In Proceedings of the Annual Meeting of the Association for Computational Linguistics, pages 7871–7880, 2020.
|
| 239 |
+
[33] Fei Li, ZhiChao Lin, Meishan Zhang, and Donghong Ji. A span-based model for joint overlapped and discontinuous named entity recognition. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, pages 4814–4828, 2021.
|
| 240 |
+
[34] Jingye Li, Kang Xu, Fei Li, Hao Fei, Yafeng Ren, and Donghong Ji. MRN: A locally and globally mention-based reasoning network for document-level relation extraction. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 1359–1370, 2021.
|
| 241 |
+
[35] Jingye Li, Hao Fei, Jiang Liu, Shengqiong Wu, Meishan Zhang, Chong Teng, Donghong Ji, and Fei Li. Unified named entity recognition as word-word relation classification. In Proceedings of the AAAI Conference on Artificial Intelligence, pages 10965–10973, 2022.
|
| 242 |
+
[36] Xiaoya Li, Jingrong Feng, Yuxian Meng, Qinghong Han, Fei Wu, and Jiwei Li. A unified MRC framework for named entity recognition. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5849–5859, 2020.
|
| 243 |
+
[37] Xin Li and Wai Lam. Deep multi-task learning for aspect term extraction with memory interaction. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, pages 2886–2892, 2017.
|
| 244 |
+
[38] Zhongli Li, Qingyu Zhou, Chao Li, Ke Xu, and Yunbo Cao. Improving BERT with syntax-aware local attention. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 645–653, 2021.
|
| 245 |
+
[39] Hongyu Lin, Yaojie Lu, Xianpei Han, and Le Sun. Adaptive scaling for sparse detection in information extraction. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, pages 1033–1043, July 2018.
|
| 246 |
+
[40] Ying Lin, Heng Ji, Fei Huang, and Lingfei Wu. A joint neural model for information extraction with global features. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7999–8009, 2020.
|
| 247 |
+
[41] Angli Liu, Jingfei Du, and Veselin Stoyanov. Knowledge-augmented language model and its application to unsupervised named-entity recognition. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1142– 1150, 2019.
|
| 248 |
+
[42] Yaojie Lu, Qing Liu, Dai Dai, Xinyan Xiao, Hongyu Lin, Xianpei Han, Le Sun, and Hua Wu. Unified structure generation for universal information extraction. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics, pages 5755–5772, 2022.
|
| 249 |
+
[43] Chunpeng Ma, Akihiro Tamura, Masao Utiyama, Tiejun Zhao, and Eiichiro Sumita. Forest-based neural machine translation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, pages 1253–1263, 2018.
|
| 250 |
+
[44] Xuezhe Ma and Eduard Hovy. End-to-end sequence labeling via bi-directional LSTM-CNNs-CRF. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pages 1064– 1074, 2016.
|
| 251 |
+
[45] Diego Marcheggiani and Ivan Titov. Encoding sentences with graph convolutional networks for semantic role labeling. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, pages 1506–1515, 2017.
|
| 252 |
+
[46] Diego Marcheggiani and Ivan Titov. Graph convolutions over constituent trees for syntax-aware semantic role labeling. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, pages 3915–3928, 2020.
|
| 253 |
+
[47] Mstislav Maslennikov and Tat-Seng Chua. A multi-resolution framework for information extraction from free text. In Proceedings of the 45th Annual Meeting of the Association of Computational Linguistics, pages 592–599, 2007.
|
| 254 |
+
[48] Haitao Mi and Liang Huang. Forest-based translation rule extraction. In Proceedings of the 2008 Conference on Empirical Methods in Natural Language Processing, pages 206–214, 2008.
|
| 255 |
+
[49] Makoto Miwa and Mohit Bansal. End-to-end relation extraction using LSTMs on sequences and tree structures. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pages 1105–1116, 2016.
|
| 256 |
+
[50] Haiyun Peng, Lu Xu, Lidong Bing, Fei Huang, Wei Lu, and Luo Si. Knowing what, how and why: A near complete solution for aspect-based sentiment analysis. In Proceedings of the AAAI Conference on Artificial Intelligence, pages 8600–8607, 2020.
|
| 257 |
+
[51] Maria Pontiki, Dimitris Galanis, John Pavlopoulos, Harris Papageorgiou, Ion Androutsopoulos, and Suresh Manandhar. SemEval-2014 task 4: Aspect based sentiment analysis. In Proceedings of the 8th International Workshop on Semantic Evaluation (SemEval 2014), pages 27–35, 2014.
|
| 258 |
+
[52] Amir Pouran Ben Veyseh, Tuan Ngo Nguyen, and Thien Huu Nguyen. Graph transformer networks with syntactic and semantic structures for event argument extraction. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 3651–3661, 2020.
|
| 259 |
+
[53] Sameer Pradhan, Alessandro Moschitti, Nianwen Xue, Hwee Tou Ng, Anders Björkelund, Olga Uryupina, Yuchen Zhang, and Zhi Zhong. Towards robust linguistic analysis using OntoNotes. In Proceedings of the Seventeenth Conference on Computational Natural Language Learning, pages 143–152, 2013.
|
| 260 |
+
[54] Xiaojun Quan, Zhengcheng Min, Kun Li, and Yunyi Yang. Compound aspect extraction by augmentation and constituency lattice. IEEE Transactions on Affective Computing, 2022.
|
| 261 |
+
[55] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21:140:1–140:67, 2020.
|
| 262 |
+
[56] Sebastian Riedel, Limin Yao, and Andrew McCallum. Modeling relations and their mentions without labeled text. In Proceedings of Machine Learning and Knowledge Discovery in Databases, European Conference, ECML PKDD, pages 148–163, 2010.
|
| 263 |
+
[57] Dan Roth and Wen-tau Yih. A linear programming formulation for global inference in natural language tasks. In Proceedings of the Eighth Conference on Computational Natural Language Learning (CoNLL2004) at HLT-NAACL, pages 1–8, 2004.
|
| 264 |
+
[58] Yikang Shen, Zhouhan Lin, Chin-Wei Huang, and Aaron C. Courville. Neural language modeling by jointly learning syntax and lexicon. In Proceedings of the International Conference on Learning Representations, 2018.
|
| 265 |
+
[59] Yikang Shen, Shawn Tan, Alessandro Sordoni, and Aaron C. Courville. Ordered neurons: Integrating tree structures into recurrent neural networks. In Proceedings of the International Conference on Learning Representations, 2019.
|
| 266 |
+
[60] Yikang Shen, Yi Tay, Che Zheng, Dara Bahri, Donald Metzler, and Aaron Courville. StructFormer: Joint unsupervised induction of dependency and constituency structure from masked language modeling. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, pages 7196–7209, 2021.
|
| 267 |
+
[61] Wenxuan Shi, Fei Li, Jingye Li, Hao Fei, and Donghong Ji. Effective token graph modeling using a novel labeling strategy for structured sentiment analysis. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics, pages 4232–4241, 2022.
|
| 268 |
+
[62] Linfeng Song, Yue Zhang, Daniel Gildea, Mo Yu, Zhiguo Wang, and Jinsong Su. Leveraging dependency forest for neural medical relation extraction. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, pages 208–218, 2019.
|
| 269 |
+
[63] Mihai Surdeanu, Sanda Harabagiu, John Williams, and Paul Aarseth. Using predicate-argument structures for information extraction. In Proceedings of the 41st Annual Meeting of the Association for Computational Linguistics, pages 8–15, 2003.
|
| 270 |
+
[64] Duyu Tang, Bing Qin, Xiaocheng Feng, and Ting Liu. Effective LSTMs for target-dependent sentiment classification. In Proceedings of the International Conference on Computational Linguistics, pages 3298–3307, 2016.
|
| 271 |
+
[65] Ian Tenney, Patrick Xia, Berlin Chen, Alex Wang, Adam Poliak, R. Thomas McCoy, Najoung Kim, Benjamin Van Durme, Samuel R. Bowman, Dipanjan Das, and Ellie Pavlick. What do you learn from context? probing for sentence structure in contextualized word representations. In Proceedings of the International Conference on Learning Representations, 2019.
|
| 272 |
+
[66] Erik F. Tjong Kim Sang and Fien De Meulder. Introduction to the CoNLL-2003 shared task: Languageindependent named entity recognition. In Proceedings of the Seventh Conference on Natural Language Learning at HLT-NAACL, pages 142–147, 2003.
|
| 273 |
+
[67] Petar Velickovic, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua Bengio. Graph attention networks. In Proceedings of the International Conference on Learning Representations, 2018.
|
| 274 |
+
[68] Jesse Vig and Yonatan Belinkov. Analyzing the structure of attention in a transformer language model. In Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 63–76, 2019.
|
| 275 |
+
[69] Jue Wang and Wei Lu. Two are better than one: Joint entity and relation extraction with table-sequence encoders. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, pages 1706–1721, 2020.
|
| 276 |
+
[70] Xinyu Wang, Yong Jiang, Nguyen Bach, Tao Wang, Zhongqiang Huang, Fei Huang, and Kewei Tu. Improving named entity recognition by external context retrieving and cooperative learning. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, pages 1800–1812, 2021.
|
| 277 |
+
[71] Yaushian Wang, Hung-Yi Lee, and Yun-Nung Chen. Tree transformer: Integrating tree structures into self-attention. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, pages 1061–1070, 2019.
|
| 278 |
+
[72] Yucheng Wang, Bowen Yu, Yueyang Zhang, Tingwen Liu, Hongsong Zhu, and Limin Sun. Tplinker: Single-stage joint extraction of entities and relations through token pair linking. In Proceedings of the International Conference on Computational Linguistics, pages 1572–1582, 2020.
|
| 279 |
+
[73] Ziqi Wang, Xiaozhi Wang, Xu Han, Yankai Lin, Lei Hou, Zhiyuan Liu, Peng Li, Juanzi Li, and Jie Zhou. CLEVE: Contrastive Pre-training for Event Extraction. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, pages 6283–6297, 2021.
|
| 280 |
+
[74] Janyce Wiebe, Theresa Wilson, and Claire Cardie. Annotating expressions of opinions and emotions in language. Language Resources and Evaluation, 39(2-3):165–210, 2005.
|
| 281 |
+
[75] Adina Williams, Andrew Drozdov, and Samuel R. Bowman. Do latent tree learning models identify meaningful structure in sentences? Transactions of the Association for Computational Linguistics, 6: 253–267, 2018.
|
| 282 |
+
[76] Ronald J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning, 8:229–256, 1992.
|
| 283 |
+
[77] Shengqiong Wu, Hao Fei, Yafeng Ren, Donghong Ji, and Jingye Li. Learn from syntax: Improving pairwise aspect and opinion terms extraction with rich syntactic knowledge. In Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, pages 3957–3963, 2021.
|
| 284 |
+
[78] Shengqiong Wu, Hao Fei, Fei Li, Donghong Ji, Meishan Zhang, Yijiang Liu, and Chong Teng. Mastering the explicit opinion-role interaction: Syntax-aided neural transition system for unified opinion role labeling. In Proceedings of the AAAI Conference on Artificial Intelligence, pages 3943–3951, 2022.
|
| 285 |
+
[79] Ying Xu, Christoph Ringlstetter, Mi-Young Kim, Grzegorz Kondrak, Randy Goebel, and Yusuke Miyao. A lexicalized tree kernel for open information extraction. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing, pages 279–284, 2015.
|
| 286 |
+
[80] Hang Yan, Tao Gui, Junqi Dai, Qipeng Guo, Zheng Zhang, and Xipeng Qiu. A unified generative framework for various NER subtasks. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, pages 5808–5822, 2021.
|
| 287 |
+
[81] Dmitry Zelenko, Chinatsu Aone, and Anthony Richardella. Kernel methods for relation extraction. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, pages 71–78, 2002.
|
| 288 |
+
[82] Xiangrong Zeng, Daojian Zeng, Shizhu He, Kang Liu, and Jun Zhao. Extracting relational facts by an end-to-end neural model with copy mechanism. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, pages 506–514, 2018.
|
| 289 |
+
[83] Taolin Zhang, Zerui Cai, Chengyu Wang, Minghui Qiu, Bite Yang, and Xiaofeng He. SMedBERT: A knowledge-enhanced pre-trained language model with structured semantics for medical text mining. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, pages 5882–5893, 2021.
|
| 290 |
+
[84] Wenxuan Zhang, Xin Li, Yang Deng, Lidong Bing, and Wai Lam. Towards generative aspect-based sentiment analysis. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, pages 504–510, 2021.
|
| 291 |
+
[85] He Zhao, Longtao Huang, Rong Zhang, Quan Lu, and Hui Xue. Spanmlt: A span-based multi-task learning framework for pair-wise aspect and opinion terms extraction. In Proceedings of the Annual Meeting of the Association for Computational Linguistics, pages 3239–3248, 2020.
|
| 292 |
+
[86] Hengyi Zheng, Rui Wen, Xi Chen, Yifan Yang, Yunyan Zhang, Ziheng Zhang, Ningyu Zhang, Bin Qin, Xu Ming, and Yefeng Zheng. PRGC: Potential relation and global correspondence based joint relational triple extraction. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, pages 6225– 6235, 2021.
|
| 293 |
+
[87] Zexuan Zhong and Danqi Chen. A frustratingly easy approach for entity and relation extraction. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 50–61, 2021.
|
| 294 |
+
[88] Ran Zmigrod, Tim Vieira, and Ryan Cotterell. On finding the k-best non-projective dependency trees. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, pages 1324–1337, 2021.
|
| 295 |
+
|
| 296 |
+
# Checklist
|
| 297 |
+
|
| 298 |
+
1. For all authors...
|
| 299 |
+
|
| 300 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 301 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 302 |
+
(c) Did you discuss any potential negative societal impacts of your work? [N/A]
|
| 303 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 304 |
+
|
| 305 |
+
2. If you are including theoretical results...
|
| 306 |
+
|
| 307 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [N/A]
|
| 308 |
+
|
| 309 |
+
3. If you ran experiments...
|
| 310 |
+
|
| 311 |
+
(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]
|
| 312 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 313 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 314 |
+
(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]
|
| 315 |
+
|
| 316 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 317 |
+
|
| 318 |
+
(a) If your work uses existing assets, did you cite the creators? [N/A]
|
| 319 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 320 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 321 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes]
|
| 322 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 323 |
+
|
| 324 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 325 |
+
|
| 326 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 327 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 328 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/biaOpY5gAo/biaOpY5gAo.md
ADDED
|
@@ -0,0 +1,501 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Stack More Layers Differently: High-Rank Training Through Low-Rank Updates
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Despite the dominance and effectiveness of scaling, resulting in large networks with
|
| 11 |
+
2 hundreds of billions of parameters, the necessity to train overparametrized models
|
| 12 |
+
3 remains poorly understood, and alternative approaches do not necessarily make
|
| 13 |
+
4 it cheaper to train high-performance models. In this paper, we explore low-rank
|
| 14 |
+
5 training techniques as an alternative approach to training large neural networks.
|
| 15 |
+
6 We introduce a novel method called ReLoRA, which utilizes low-rank updates to
|
| 16 |
+
7 train high-rank networks. We apply ReLoRA to pre-training transformer language
|
| 17 |
+
8 models with up to 350M parameters, and demonstrate comparable performance
|
| 18 |
+
9 to regular neural network training. Furthermore, we observe that the efficiency
|
| 19 |
+
10 of ReLoRA increases with model size, making it a promising approach for train
|
| 20 |
+
11 ing multi-billion-parameter networks efficiently. Our findings shed light on the
|
| 21 |
+
12 potential of low-rank training techniques and their implications for scaling laws.1
|
| 22 |
+
|
| 23 |
+
# 13 1 Introduction
|
| 24 |
+
|
| 25 |
+
14 Over the past decade, the machine learning field has been dominated by the trend of training
|
| 26 |
+
15 increasingly overparametrized networks or adopting the "stack more layers" approach [32, 21, 27].
|
| 27 |
+
16 The definition of a large network has evolved from models with 100 million [46, 39] to hundreds
|
| 28 |
+
17 of billions [8, 12] of parameters, which has made computational costs associated with training of
|
| 29 |
+
18 such networks prohibitive to most of the research groups. Despite this, the necessity to train models
|
| 30 |
+
19 which can have orders of magnitude more parameters than the training examples [8, 12, 16], is poorly
|
| 31 |
+
20 understood theoretically [25, 4, 60].
|
| 32 |
+
21 Alternative approaches to scaling, such as more compute-efficient scaling optima [22], retrieval
|
| 33 |
+
22 augmented models [28, 7], and the simple approach of training smaller models for longer [50], have
|
| 34 |
+
23 offered new interesting trade-offs. However, they do not bring us closer to understanding why we
|
| 35 |
+
24 need overparametrized models and rarely democratize the training of these models. For example,
|
| 36 |
+
25 training RETRO [7] requires a complex training setup and infrastructure capable of quickly searching
|
| 37 |
+
26 over trillions of tokens, while training LLaMA-6B [50] still requires hundreds of GPUs.
|
| 38 |
+
7 In contrast, approaches like zero-redundancy optimizers [43], 16-bit training [37], 8-bit inference [14],
|
| 39 |
+
28 and parameter-efficient fine-tuning (PEFT) [33] have played a crucial role in making large models
|
| 40 |
+
29 more accessible. Specifically, PEFT methods have enabled fine-tuning of billion-scale language or
|
| 41 |
+
30 diffusion models on consumer hardware. This raises the question: Can these approaches also benefit
|
| 42 |
+
31 pre-training?
|
| 43 |
+
|
| 44 |
+
On one hand, pre-training is exactly the step that allows for small modifications to the network to adapt it to new tasks. Aghajanyan et al. [1] demonstrated that the rank of the changes required
|
| 45 |
+
|
| 46 |
+

|
| 47 |
+
Figure 1: ReLoRA learns a high-rank network through a sequence of low-rank updates. It outperforms networks with the same trainable parameter count and achieves similar performance to training a full network at $1 0 0 \mathbf { M } +$ scale. The efficiency of ReLoRA increases with the model size, making it a viable candidate for multi-billion-parameter training.
|
| 48 |
+
|
| 49 |
+
34 to learn a task decreases the more you pre-train the network. On the other hand, multiple studies
|
| 50 |
+
35 have demonstrated the simplicity of features extracted and utilized by language and vision models,
|
| 51 |
+
36 along with their low intrinsic dimensionality [31, 17, 42, 47]. For instance, attention patterns in
|
| 52 |
+
37 transformers [51] often exhibit a small rank, which has been successfully leveraged to develop more
|
| 53 |
+
38 efficient variants of attention [52, 11]. Moreover, overparametrization is also not necessary for
|
| 54 |
+
39 training. The Lottery Ticket Hypothesis [17] empirically demonstrates that during initialization (or
|
| 55 |
+
40 early in training [18]), there exist sub-networks – winning tickets – that when trained in isolation
|
| 56 |
+
41 reach the performance of the full network.
|
| 57 |
+
42 In this study, we focus on low-rank training techniques and introduce ReLoRA that uses low-rank
|
| 58 |
+
43 updates to train a high-rank network. We empirically demonstrate that ReLoRA performs a high-rank
|
| 59 |
+
44 update and achieves performance similar to regular neural network training. The components of
|
| 60 |
+
45 ReLoRA include initial full-rank training of the neural network (similar to Frankle et al. [18]), LoRA
|
| 61 |
+
46 training, restarts, a jagged learning rate schedule, and partial optimizer resets. We evaluate ReLoRA
|
| 62 |
+
47 on transformer language models up to 350M parameters. We chose to focus on autoregressive
|
| 63 |
+
48 language modeling, as this approach has demonstrated its universality in most of the applications of
|
| 64 |
+
49 neural networks [41, 56, 3, 35, 10]. Finally, we observe that the efficiency of ReLoRA increases with
|
| 65 |
+
50 model size, making it a viable option for efficient training of multi-billion-parameter networks.
|
| 66 |
+
|
| 67 |
+
51 Each experiment in this study has used no more than 8 GPU days of compute.
|
| 68 |
+
|
| 69 |
+
# 52 2 Related work
|
| 70 |
+
|
| 71 |
+
53 Scaling versus Efficiency The relationship between overparametrization and neural network
|
| 72 |
+
54 trainability and generalization has been extensively studied [59, 5, 17, 38, 47], yet it remains a
|
| 73 |
+
55 mystery [60]. Moreover, scaling laws [27, 19, 22, 30, 2] demonstrate a simple and strong power-law
|
| 74 |
+
56 dependence between network size and its performance across a variety of modalities. This finding
|
| 75 |
+
57 not only supports overparametrization but also encourages the training of extraordinarily resource
|
| 76 |
+
58 intensive neural networks [8, 12, 16]. Nonetheless, the Lottery Ticket Hypothesis [17, 18] suggests
|
| 77 |
+
59 that overparametrization could, in principle, be minimized. Specifically, it shows that early in training,
|
| 78 |
+
60 subnetworks exist that can be trained to achieve the performance of the full network (winning tickets).
|
| 79 |
+
61 Parameter-efficient fine-tuning Aghajanyan et al. [1] found that pre-training reduces the amount
|
| 80 |
+
62 of change to the network, or its intrinsic dimensionality, to learn a new task through fine-tuning. I.e.,
|
| 81 |
+
63 larger networks or networks pre-trained on more data require smaller modifications in terms of the
|
| 82 |
+
64 rank of the range to learn a new task. This explains the success of parameter-efficient fine-tuning
|
| 83 |
+
65 methods [33] and has also motivated the development of low-rank fine-tuning methods such as LoRA
|
| 84 |
+
66 [23] and Compacter [36].
|
| 85 |
+
67 Low-rank neural network training Training low-rank representations has been explored in the
|
| 86 |
+
68 context of CNN compression, regularization, and efficient training [24, 26, 49, 44, 34, 57]. However,
|
| 87 |
+
69 most of these methods are either specific to CNNs, do not scale well, or have not been evaluated
|
| 88 |
+
70 on large transformers [51] with hundreds of millions of parameters, which can benefit greatly from
|
| 89 |
+
71 efficient training. While transformers have been shown to have a low-rank internal dimensionality
|
| 90 |
+
72 and representations [1, 52], the study by Bhojanapalli et al. [6] demonstrated that the low rank of key
|
| 91 |
+
73 and query projections in multi-head attention bottlenecks the performance of transformers. Our own
|
| 92 |
+
74 experiments (Section 3) also demonstrate that low-rank transformers perform significantly worse
|
| 93 |
+
75 compared to the full-rank baseline and ReLoRA.
|
| 94 |
+
|
| 95 |
+

|
| 96 |
+
Figure 2: Jagged cosine scheduler used in ReLoRA. On every ReLoRA reset, we set the learning rate to zero and perform a quick (50-100 steps) learning rate warmup back to the cosine schedule.
|
| 97 |
+
|
| 98 |
+
# 76 3 Method
|
| 99 |
+
|
| 100 |
+
Let’s start by revisiting linear algebra-101. In particular, we are interested in the rank of the sum of two matrices:
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\operatorname { r a n k } ( A + B ) \leq \operatorname { r a n k } ( A ) + \operatorname { r a n k } ( B ) .
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
79 This bound on the rank of the sum is tight: for a matrix A, $\operatorname { r a n k } ( \mathbf { A } ) < d i m ( \mathbf { A } )$ , there exists $\mathbf { B }$ ,
|
| 107 |
+
80 $\operatorname { r a n k } ( \mathbf { B } ) < d i m ( \mathbf { B } )$ such that sum of the matrices has a higher rank than either $\mathbf { A }$ or $\mathbf { B }$ . We want to
|
| 108 |
+
81 exploit this property to make a flexible parameter-efficient training method. We start with LoRA [23]
|
| 109 |
+
82 which is a parameter-efficient fine-tuning method based on the idea of low-rank updates. LoRA can
|
| 110 |
+
83 be applied to any linear operation parametrized through $W \in \mathbb { R } ^ { m \times n }$ . Specifically, LoRA decomposes
|
| 111 |
+
84 the weight update $\delta W$ into a low-rank product $W _ { A } W _ { B }$ as shown in Equation 2, where $s \in \mathbb R$ is a
|
| 112 |
+
85 fixed scaling factor usually equal to $\textstyle { \frac { 1 } { r } }$ .
|
| 113 |
+
|
| 114 |
+
$$
|
| 115 |
+
\begin{array} { l } { \delta W = s W _ { A } W _ { B } } \\ { W _ { A } \in \mathbb { R } ^ { \mathrm { i n } \times r } , W _ { B } \in \mathbb { R } ^ { r \times \mathrm { o u t } } } \end{array}
|
| 116 |
+
$$
|
| 117 |
+
|
| 118 |
+
86 In practice, LoRA is usually implemented by adding new trainable parameters $W _ { A }$ and $W _ { B }$ , which
|
| 119 |
+
87 could be merged back into the original parameters after training. Thus, even though Equation 1
|
| 120 |
+
88 allows the total update over training time $\sum _ { t } \delta W _ { t }$ to have a higher rank than any of the individual
|
| 121 |
+
89 matrices, LoRA implementations are restricted by the rank $r = \mathrm { m a x } _ { W _ { A } , W _ { B } } \mathrm { r a n k } ( W _ { A } W _ { B } )$ .
|
| 122 |
+
90 If we could restart LoRA, meaning we merge $W _ { A }$ and $W _ { B }$ during training and reset the values of
|
| 123 |
+
91 these matrices, we could increase the total rank of the update. Doing this multiple times brings the
|
| 124 |
+
92 total neural network update to
|
| 125 |
+
|
| 126 |
+
$$
|
| 127 |
+
\Delta W = \sum _ { t = 0 } ^ { T _ { 1 } } \delta W _ { t } + \sum _ { t = T _ { 1 } } ^ { T _ { 2 } } \delta W _ { t } + \cdot \cdot \cdot + \sum _ { t = T _ { N - 1 } } ^ { T _ { N } } \delta W _ { t } = s W _ { A } ^ { 1 } W _ { B } ^ { 1 } + s W _ { A } ^ { 2 } W _ { B } ^ { 2 } + \cdot \cdot \cdot + s W _ { A } ^ { N } W _ { B } ^ { N }
|
| 128 |
+
$$
|
| 129 |
+
|
| 130 |
+
where the sums are independent enough, meaning that rank93 $( W _ { A } ^ { i } W _ { B } ^ { i } ) + \operatorname { r a n k } ( W _ { A } ^ { j } W _ { B } ^ { j } ) \geq r .$
|
| 131 |
+
|
| 132 |
+
94 However, implementing restarts is not trivial in practice and requires certain modifications to the
|
| 133 |
+
95 optimization procedure. Naïve implementation causes the model to diverge right after the restart.
|
| 134 |
+
96 Unlike plain stochastic gradient descent, which solely relies on the value of the gradient at the current
|
| 135 |
+
97 optimization timestep, Adam [29] update is guided mainly by the first and second moments of the
|
| 136 |
+
98 gradient accumulated over the previous steps. In practice, gradient moment smoothing parameters $\beta _ { 1 }$
|
| 137 |
+
99 and $\beta _ { 2 }$ are usually very high $0 . 9 - 0 . 9 9 9$ . Let’s assume that at the reinitialization boundary $W _ { A } ^ { 1 }$ and
|
| 138 |
+
100 the corresponding gradient moments $m _ { A }$ and $v _ { A }$ , are full-rank $( r )$ . Then, after the merge-and-reinit,
|
| 139 |
+
101 continuing to use old gradient moments for $W _ { A } ^ { 2 }$ will guide it in the same direction as $W _ { A } ^ { 1 }$ and
|
| 140 |
+
102 optimize the same subspace.
|
| 141 |
+
103 To resolve this issue, we propose ReLoRA. ReLoRA performs a partial reset of the optimizer state
|
| 142 |
+
104 during merge-and-reinit and sets the learning rate to 0 with a subsequent warmup. Specifically, we set
|
| 143 |
+
105 $9 9 \%$ of low-magnitude optimizer state values to zero and use a jagged-cosine learning rate schedule
|
| 144 |
+
106 (Figure 2). Our ablation studies (Section 3) show that both of these modifications are required to
|
| 145 |
+
107 improve the performance over vanilla LoRA.
|
| 146 |
+
108 To reiterate, ReLoRA is a low-rank training method inspired by LoRA that uses restarts to increase
|
| 147 |
+
109 the effective rank of the update, uses partial optimizer reset, and a jagged scheduler to stabilize
|
| 148 |
+
110 training and warm starts. All of this allows ReLoRA to achieve performance comparable to full-rank
|
| 149 |
+
111 training, especially in large transformer networks, by only training a small set of parameters at a time.
|
| 150 |
+
112 ReLoRA is described in Algorithm 1.
|
| 151 |
+
113 Enhancing computational efficiency Unlike other low-rank training techniques [44, 49], ReLoRA
|
| 152 |
+
114 follows the LoRA approach by maintaining the frozen weights of the original network and adding
|
| 153 |
+
115 new trainable parameters. At first glance, this may appear computationally inefficient; however, the
|
| 154 |
+
116 differentiation between frozen and trainable parameters plays a crucial role in parameter-efficient
|
| 155 |
+
117 fine-tuning [33].
|
| 156 |
+
118 These methods achieve significant improvements in training time and memory efficiency by reducing
|
| 157 |
+
119 the size of the gradients and the optimizer states. Notably, Adam states consume twice as much
|
| 158 |
+
120 memory as the model weights. Moreover, it is common practice to maintain gradient accumulation
|
| 159 |
+
121 buffers in 32-bit precision for large networks, thereby adding significant overhead to the memory
|
| 160 |
+
122 consumption of gradients.
|
| 161 |
+
23 By substantially reducing the number of trainable parameters, ReLoRA enables the utilization of larger
|
| 162 |
+
24 batch sizes, maximizing hardware efficiency. Additionally, it reduces the bandwidth requirements in
|
| 163 |
+
25 distributed setups, which are often the limiting factor in large-scale training.
|
| 164 |
+
126 Furthermore, since the frozen parameters are not being updated between restarts, they can be kept in
|
| 165 |
+
127 a low-precision quantized format, further reducing their memory and computational impact. This
|
| 166 |
+
128 additional optimization contributes to overall improved efficiency in terms of memory utilization and
|
| 167 |
+
129 computational resources of ReLoRA and increases at scale.
|
| 168 |
+
|
| 169 |
+
# 130 4 Experiments
|
| 170 |
+
|
| 171 |
+
131 To evaluate the effectiveness of ReLoRA, we apply it to train a transformer language model on the C4
|
| 172 |
+
132 dataset [41] using various model sizes: 60M, 130M, 250M, and 350M. Language modeling has been
|
| 173 |
+
133 shown to be a fundamental task in machine learning [40], it enables text and image classification
|
| 174 |
+
134 [56], translation [8], programming [9], in-context learning, step-by-step reasoning [54], and many
|
| 175 |
+
135 other emergent abilities [53]. Given its significance, we focus solely on language modeling for the
|
| 176 |
+
136 purposes of this paper.
|
| 177 |
+
137 Architecture and training hyperparameters Our architecture is based on transformer [51] and
|
| 178 |
+
138 closely resembles LLaMA [50]. Namely, we use pre-normalization, RMSNorm [58], SwiGLU
|
| 179 |
+
139 activations [45], $\scriptstyle { \frac { 8 } { 3 } } h$ fully-connected hidden state size [50], and rotary embeddings [48]. All hyperpa
|
| 180 |
+
140 rameters are presented in Table 1.
|
| 181 |
+
141 We use bfloat16 for all floating point operations and Flash attention [13] for effective attention
|
| 182 |
+
142 computation. Compared to attention in LLaMA, which uses float32 for softmax computation, this
|
| 183 |
+
143 increased training throughput by $5 0 \mathrm { - } 1 0 0 \%$ without any training stability issues.
|
| 184 |
+
|
| 185 |
+
Algorithm 1 ReLoRA. $\theta$ is model parameters, $\hat { \theta }$ is model parameters with linear layers replaced with ReLoRA, $M$ and $V$ are Adam optimizer states, $\eta$ is learning rate scheduled according to a jagged scheduler, and finally, $q$ is the reinit frequency.
|
| 186 |
+
|
| 187 |
+
Require: $\theta , M , V , q , \eta$
|
| 188 |
+
1: for t in warm start steps do
|
| 189 |
+
2: Update $\theta , M , V , \eta$ {Regular training for warm start}
|
| 190 |
+
3: end for
|
| 191 |
+
4: for layer in model layers do
|
| 192 |
+
5: if layer is linear then
|
| 193 |
+
6: laye $\mathrm { \Delta \ r { \ r { \sim R e L o R A } } } ( W ^ { i } , W _ { A } ^ { i } , W _ { B } ^ { i } )$
|
| 194 |
+
7: Freeze $W ^ { i }$
|
| 195 |
+
8: end if
|
| 196 |
+
9: end for
|
| 197 |
+
10: for t in training steps do
|
| 198 |
+
11: Update $\hat { \theta }$ , $M , V$ {Training step with ReLoRA}
|
| 199 |
+
12: if $\mathbf { M O D } ( t , q ) = 0$ then
|
| 200 |
+
13: for l in model layers do
|
| 201 |
+
14: if l is linear then
|
| 202 |
+
15: $\begin{array} { r l } & { W ^ { i } \gets ( W ^ { i } + s W _ { A } ^ { i } W _ { B } ^ { i } ) } \\ & { W _ { A } ^ { i } \gets \mathrm { k a i m i n g \_ i n i t } ( W _ { A } ^ { i } ) ; W _ { B } ^ { i } \gets 0 } \\ & { M _ { W _ { A } ^ { i } } \gets \mathrm { p r u n e } ( M _ { W _ { A } ^ { i } } ) ; V _ { W _ { A } ^ { i } } \gets \mathrm { p r u n e } ( V _ { W _ { A } ^ { i } } ) } \\ & { \bullet \bullet ^ { o } \quad \mathrm { k a } ^ { \prime } \Pi \mathring { \mathbf { \Gamma } } ^ { \mathrm { u n i n g \_ i n i t } } \index { \mathbf { V } _ { W _ { A } ^ { i } } } \gets \mathrm { p r u n e } ( V _ { W _ { A } ^ { i } } ) } \end{array}$
|
| 203 |
+
16:
|
| 204 |
+
17:
|
| 205 |
+
18: end if
|
| 206 |
+
19: end for
|
| 207 |
+
20: Start $\eta$ warmup
|
| 208 |
+
21: end if
|
| 209 |
+
22: end for
|
| 210 |
+
23: return θ
|
| 211 |
+
144 Most of our models were trained on 8 RTX 4090 for one day or less. Due to computational constraints,
|
| 212 |
+
145 we train much smaller models than LLaMA, with the largest model having 350M parameters, the
|
| 213 |
+
146 same as BERT Large [15]. We select the number of pre-training tokens based on the Chinchilla
|
| 214 |
+
147 scaling laws [22] for all models, except for the largest one, which we train for 6.8B tokens while 9.5B
|
| 215 |
+
148 tokens are Chinchilla-optimal.
|
| 216 |
+
149 ReLoRA and baselines setup In our low-rank training experiments, ReLoRA replaces all attention
|
| 217 |
+
150 and fully-connected network parameters, while keeping the embeddings full-rank. The RMSNorm
|
| 218 |
+
151 parametrization remains unchanged. Since ReLoRA-wrapped models have fewer trainable parameters
|
| 219 |
+
152 than full-rank training, we include a Control baseline, which is a full-rank transformer with the same
|
| 220 |
+
153 number of trainable parameters as ReLoRA.
|
| 221 |
+
154 We initialize ReLoRA from a checkpoint of full-rank training at 5,000 update steps and reset it
|
| 222 |
+
155 every 5,000 steps thereafter, 3 times in total. After each reset, $9 9 \%$ of the optimizer state is pruned
|
| 223 |
+
156 based on magnitude, and the loss is warmed up for the next 100 iterations. ReLoRA parameters are
|
| 224 |
+
157 reinitialized following LoRA best practices, Kaiming initialization [20] for $A$ -matrix, and zeros for
|
| 225 |
+
158 $B$ -matrix. In case of not using the restarts, the $B$ -matrix also uses Kaiming initialization to avoid
|
| 226 |
+
159 gradient-symmetry issues.
|
| 227 |
+
|
| 228 |
+
Table 1: Hyperparameters of the language models trained in this study.
|
| 229 |
+
|
| 230 |
+
<table><tr><td>Params</td><td>Hidden</td><td>Heads</td><td>Layers</td><td>Learning rate</td><td>Batch (tokens)</td><td>Seq. len.</td><td>Tokens</td></tr><tr><td>60M</td><td>512</td><td>8</td><td>8</td><td>1e-3</td><td>122K</td><td>256</td><td>1.2B</td></tr><tr><td>130M</td><td>768</td><td>12</td><td>12</td><td>1e-3</td><td>154K</td><td>256</td><td>2.6B</td></tr><tr><td>250M</td><td>768</td><td>16</td><td>24</td><td>5e-4</td><td>590K</td><td>512</td><td>6.8B</td></tr><tr><td>350M</td><td>1024</td><td>16</td><td>24</td><td>5e-4</td><td>590K</td><td>512</td><td>6.8B</td></tr></table>
|
| 231 |
+
|
| 232 |
+
Table 2: Comparing perplexities between baseline methods and ReLoRA (lower is better). Control has the same number of trainable parameters as low-rank training. Low-rank training is bold if it outperforms the Control baseline. Notice that ReLoRA efficacy increases as the network size grows.
|
| 233 |
+
|
| 234 |
+
<table><tr><td></td><td>60M</td><td>130M</td><td>250M</td><td>350M</td></tr><tr><td>Full training</td><td>33.81</td><td>23.65</td><td>22.39</td><td>20.40</td></tr><tr><td>Control</td><td>36.52</td><td>27.30</td><td>29.12</td><td>23.65</td></tr><tr><td> Low-rank pre-training with LoRA</td><td>47.44</td><td>34.17</td><td>36.60</td><td>57.11</td></tr><tr><td>Low-rank pre-training with ReLoRA</td><td>38.28</td><td>25.04</td><td>23.28</td><td>22.48</td></tr><tr><td>No. of training tokens (billions)</td><td>1.2</td><td>2.6</td><td>6.8</td><td>6.8</td></tr></table>
|
| 235 |
+
|
| 236 |
+

|
| 237 |
+
Figure 3: Singular values spectra of the weight difference between ReLoRA and LoRA at 5,000 iterations (warm start) and 20,000 iterations. ReLoRA exhibits a closer resemblance to full-rank training singular values than LoRA, indicating its effectiveness in approximating full-rank behavior.
|
| 238 |
+
|
| 239 |
+
# 160 5 Results
|
| 240 |
+
|
| 241 |
+
Parameter-efficient pre-training Our main results are resented in Table 2. ReLoRA significantly outperforms low-rank LoRA training demonstrating the effectiveness of our proposed modifications (ablated in Section 3). Furthermore, ReLoRA achieves similar performance to full-rank training, and the performance gap diminishes as network size increases.
|
| 242 |
+
|
| 243 |
+
165 Interestingly, the only model in which ReLoRA couldn’t surpass the Control baseline was our smallest
|
| 244 |
+
166 model with 60M parameters. This observation suggests that ReLoRA is particularly effective in
|
| 245 |
+
167 improving the training of large networks, which aligns with our goal of developing a method that
|
| 246 |
+
168 improves large-network training.
|
| 247 |
+
169 High-rank training through low-rank updates To determine whether ReLoRA performs a higher
|
| 248 |
+
170 rank update than LoRA we plot the singular value spectrum of the difference between warm-start
|
| 249 |
+
171 weights and the final weights for ReLoRA, LoRA, and full-rank training. Figure 3 illustrates
|
| 250 |
+
172 significant qualitative differences between LoRA and ReLoRA for the singular values of $W _ { Q }$ , $W _ { K }$ ,
|
| 251 |
+
173 $W _ { V }$ , and $W _ { d o w n }$ .
|
| 252 |
+
174 While most of the singular values for LoRA are zero (Figure 4) with a noticeable number of
|
| 253 |
+
175 exceptionally high values above 1.5, ReLoRA exhibits a higher distribution mass between 0.1 and 1.0,
|
| 254 |
+
176 reminiscent of full-rank training. This observation emphasizes the significance of high-rank updates
|
| 255 |
+
177 and demonstrates the qualitative efficacy of ReLoRA, which accomplishes a high-rank update by
|
| 256 |
+
178 performing multiple low-rank updates.
|
| 257 |
+
|
| 258 |
+
# 179 5.1 Ablation studies
|
| 259 |
+
|
| 260 |
+
180 We conduct ablation studies on all four crucial components of ReLoRA: restarts, jagged schedule,
|
| 261 |
+
181 optimizer resets, and warm starts, utilizing the 130M-sized model. The results are presented in
|
| 262 |
+
182 Table 3. In this section, we will focus on and analyze certain combinations of these components.
|
| 263 |
+
183 LoRA ReLoRA, without the aforementioned components, is essentially equivalent to training
|
| 264 |
+
184 a low-rank network parameterized by LoRA. This approach yields remarkably high perplexity,
|
| 265 |
+
185 indicating that a simple matrix decomposition has significantly different training dynamics from
|
| 266 |
+
186 full-rank training.
|
| 267 |
+
187 Adding restarts and optimizer resets ReLoRA, without a jagged schedule and optimizer reset,
|
| 268 |
+
188 performs similarly to LoRA because old optimizer states force the newly initialized parameters
|
| 269 |
+
189 into the same subspace as the prior weights, limiting the model’s capacity. However, doing a naive
|
| 270 |
+
190 optimizer reset with ReLoRA causes the model to diverge. A jagged schedule helps to stabilize
|
| 271 |
+
191 training and has a positive impact on the mixture. In our initial experiments, we also observed that a
|
| 272 |
+
192 combination of partial optimizer reset and jagged scheduler allows for a quicker warm-up, as low as
|
| 273 |
+
193 50 steps, instead of hundreds of steps required when the optimizer is initialized from scratch.
|
| 274 |
+
194 Warm start The warm start shows the most significant improvement, dropping perplexity by
|
| 275 |
+
195 almost 10 points. To investigate whether post-warmup training contributes to the loss, we measured
|
| 276 |
+
196 the perplexity of the warmed-up network, which equals 27.03. It outperforms all low-rank methods
|
| 277 |
+
197 except for our final ReLoRA recipe but still demonstrates a significant difference from the final
|
| 278 |
+
198 network. This demonstrates the importance of early training, similar to the concept of the lottery
|
| 279 |
+
199 ticket hypothesis with rewinding [18].
|
| 280 |
+
|
| 281 |
+
<table><tr><td>Restarts</td><td>Jagged Schedule</td><td>Optimizer Reset</td><td>Warm Start</td><td>Perplexity (↓)</td></tr><tr><td></td><td>×</td><td>×</td><td>×</td><td>34.17</td></tr><tr><td>×</td><td>×</td><td>×</td><td>×</td><td>34.25</td></tr><tr><td>√</td><td>×</td><td>√</td><td>×</td><td>N/A</td></tr><tr><td>√</td><td>√</td><td>×</td><td>×</td><td>34.29</td></tr><tr><td>√</td><td>√</td><td>√</td><td>×</td><td>29.77</td></tr><tr><td>×</td><td>×</td><td>×</td><td>√</td><td>25.46</td></tr><tr><td>√</td><td>√</td><td>√</td><td>√</td><td>25.04</td></tr></table>
|
| 282 |
+
|
| 283 |
+

|
| 284 |
+
Table 3: Ablation studies of ReLoRA. Restarts and warm starts are essential for good performance. Using restarts and optimizer reset without a jagged schedule causes the model to diverge.
|
| 285 |
+
Figure 4: Number of singular values $< 0 . 1$ in attention and FCN projection matrices.
|
| 286 |
+
|
| 287 |
+
# 00 6 Conclusion
|
| 288 |
+
|
| 289 |
+
In this paper, we investigated low-rank training techniques for large transformer language models. We first examined the limitations of a simple low-rank matrix factorization (LoRA) approach and observed that it struggles to effectively train high-performing transformer models. To address this issue, we proposed a novel method called ReLoRA, which leverages the rank of sum property to train a high-rank network through multiple low-rank updates. Similar to the lottery ticket hypothesis with rewinding, ReLoRA employs a full-rank training warm start before transitioning to ReLoRA. Additionally, ReLoRA introduces a merge-and-reinit (restart) strategy, a jagged learning rate scheduler, and partial optimizer resets, which collectively enhance the efficiency of ReLoRA and bring it closer to full-rank training, particularly in large networks. ReLoRA efficiency increases with the network size making it a viable candidate for multi-billion-scale training.
|
| 290 |
+
|
| 291 |
+
211 We firmly believe that the development of low-rank training methods holds great promise for improv
|
| 292 |
+
212 ing the efficiency of training large language models and neural networks in general. Furthermore,
|
| 293 |
+
213 low-rank training has the potential to provide valuable insights for the advancement of deep learning
|
| 294 |
+
214 theories, aiding our understanding of neural network trainability through gradient descent and their
|
| 295 |
+
215 exceptional generalization capabilities in the overparametrized regime.
|
| 296 |
+
|
| 297 |
+
# 216 7 Limitations and Future Work
|
| 298 |
+
|
| 299 |
+
217 Scaling beyond 350M Due to limited computational resources, our experiments were constrained to
|
| 300 |
+
218 training language models with up to 350M parameters. Nonetheless, ReLoRA already demonstrates
|
| 301 |
+
219 promising results at this scale. However, we anticipate its true potential will be realized in the $1 \mathrm { B } +$
|
| 302 |
+
220 parameter region. Additionally, while the 350M model outperforms the Control baseline, it does not
|
| 303 |
+
221 continue the trend of narrowing the gap between ReLoRA and full-rank training. We attribute this to
|
| 304 |
+
222 suboptimal hyperparameter choice, which requires further investigation.
|
| 305 |
+
223 Furthermore, in 60-350M experiments, even though ReLoRA significantly reduces the number of
|
| 306 |
+
224 trainable parameters, we did not observe substantial improvements in memory and computation
|
| 307 |
+
225 for the networks of this size. To evaluate the efficiency of our current implementation at a larger
|
| 308 |
+
226 scale, we trained the 1.3B-parameter model for a small number of iterations to estimate memory and
|
| 309 |
+
227 compute improvements of ReLoRA. At this scale, we observe $30 \%$ memory consumption reduction
|
| 310 |
+
228 and $52 \%$ training throughput increase. We expect to observe even bigger improvements over the
|
| 311 |
+
229 full-training baseline for larger networks since the number of trainable parameters for ReLoRA,
|
| 312 |
+
230 similar to LoRA, increases at a much slower rate compared to the number of frozen parameters.
|
| 313 |
+
231 ReLoRA implementation could be further improved by effectively utilizing gradient checkpointing
|
| 314 |
+
232 for ReLoRA layers, custom backward functions, and converting frozen model weights to int8 or int4
|
| 315 |
+
233 quantized format [14].
|
| 316 |
+
|
| 317 |
+
Comparison to other low-rank training methods A number of approaches to low-rank training have been explored with other model architectures in earlier work [44, 49, 55]. Two aspects set our work apart from these earlier efforts. First, the approach we propose performs high-rank updates through low-rank training. Second, our work demonstrates competitiveness of the low-rank training methods in large-scale transformer language models with $1 0 0 \mathbf { M } +$ parameters.
|
| 318 |
+
|
| 319 |
+
# References
|
| 320 |
+
|
| 321 |
+
[1] A. Aghajanyan, S. Gupta, and L. Zettlemoyer. Intrinsic dimensionality explains the effectiveness of language model fine-tuning. 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 7319–7328, Online, Aug. 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.568. URL https://aclanthology.org/2021.acl-long.568.
|
| 322 |
+
[2] A. Aghajanyan, L. Yu, A. Conneau, W.-N. Hsu, K. Hambardzumyan, S. Zhang, S. Roller, N. Goyal, O. Levy, and L. Zettlemoyer. Scaling laws for generative mixed-modal language models, 2023.
|
| 323 |
+
[3] J.-B. Alayrac, J. Donahue, P. Luc, A. Miech, I. Barr, Y. Hasson, K. Lenc, A. Mensch, K. Millican, M. Reynolds, et al. Flamingo: a visual language model for few-shot learning. Advances in Neural Information Processing Systems, 35:23716–23736, 2022.
|
| 324 |
+
[4] Z. Allen-Zhu, Y. Li, and Z. Song. A convergence theory for deep learning via over-parameterization. In K. Chaudhuri and R. Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pages 242–252. PMLR, 09–15 Jun 2019. URL https://proceedings.mlr.press/v97/allen-zhu19a.html.
|
| 325 |
+
[5] M. Belkin, D. J. Hsu, S. Ma, and S. Mandal. Reconciling modern machine-learning practice and the classical bias–variance trade-off. Proceedings of the National Academy of Sciences, 116:15849 – 15854, 2018.
|
| 326 |
+
[6] S. Bhojanapalli, C. Yun, A. S. Rawat, S. Reddi, and S. Kumar. Low-rank bottleneck in multi-head attention models. In International Conference on Machine Learning, pages 864–873. PMLR, 2020.
|
| 327 |
+
[7] S. Borgeaud, A. Mensch, J. Hoffmann, T. Cai, E. Rutherford, K. Millican, G. B. Van Den Driessche, J.-B. Lespiau, B. Damoc, A. Clark, D. De Las Casas, A. Guy, J. Menick, R. Ring, T. Hennigan, S. Huang,
|
| 328 |
+
|
| 329 |
+
261 L. Maggiore, C. Jones, A. Cassirer, A. Brock, M. Paganini, G. Irving, O. Vinyals, S. Osindero, K. Simonyan,
|
| 330 |
+
262 J. Rae, E. Elsen, and L. Sifre. Improving language models by retrieving from trillions of tokens. In
|
| 331 |
+
263 K. Chaudhuri, S. Jegelka, L. Song, C. Szepesvari, G. Niu, and S. Sabato, editors, Proceedings of the
|
| 332 |
+
264 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning
|
| 333 |
+
265 Research, pages 2206–2240. PMLR, 17–23 Jul 2022. URL https://proceedings.mlr.press/v162/
|
| 334 |
+
266 borgeaud22a.html.
|
| 335 |
+
267 [8] T. Brown, B. Mann, N. Ryder, M. Subbiah, J. D. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry,
|
| 336 |
+
268 A. Askell, S. Agarwal, A. Herbert-Voss, G. Krueger, T. Henighan, R. Child, A. Ramesh, D. Ziegler, J. Wu,
|
| 337 |
+
269 C. Winter, C. Hesse, M. Chen, E. Sigler, M. Litwin, S. Gray, B. Chess, J. Clark, C. Berner, S. McCandlish,
|
| 338 |
+
270 A. Radford, I. Sutskever, and D. Amodei. Language models are few-shot learners. In H. Larochelle,
|
| 339 |
+
271 M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing
|
| 340 |
+
272 Systems, volume 33, pages 1877–1901. Curran Associates, Inc., 2020. URL https://proceedings.
|
| 341 |
+
273 neurips.cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf.
|
| 342 |
+
274 [9] M. Chen, J. Tworek, H. Jun, Q. Yuan, H. P. de Oliveira Pinto, J. Kaplan, H. Edwards, Y. Burda, N. Joseph,
|
| 343 |
+
275 G. Brockman, A. Ray, R. Puri, G. Krueger, M. Petrov, H. Khlaaf, G. Sastry, P. Mishkin, B. Chan, S. Gray,
|
| 344 |
+
276 N. Ryder, M. Pavlov, A. Power, L. Kaiser, M. Bavarian, C. Winter, P. Tillet, F. P. Such, D. Cummings,
|
| 345 |
+
277 M. Plappert, F. Chantzis, E. Barnes, A. Herbert-Voss, W. H. Guss, A. Nichol, A. Paino, N. Tezak, J. Tang,
|
| 346 |
+
278 I. Babuschkin, S. Balaji, S. Jain, W. Saunders, C. Hesse, A. N. Carr, J. Leike, J. Achiam, V. Misra,
|
| 347 |
+
279 E. Morikawa, A. Radford, M. Knight, M. Brundage, M. Murati, K. Mayer, P. Welinder, B. McGrew,
|
| 348 |
+
280 D. Amodei, S. McCandlish, I. Sutskever, and W. Zaremba. Evaluating large language models trained on
|
| 349 |
+
281 code. 2021.
|
| 350 |
+
282 [10] J. Cho, J. Lei, H. Tan, and M. Bansal. Unifying vision-and-language tasks via text generation. In
|
| 351 |
+
283 International Conference on Machine Learning, pages 1931–1942. PMLR, 2021.
|
| 352 |
+
284 [11] K. M. Choromanski, V. Likhosherstov, D. Dohan, X. Song, A. Gane, T. Sarlós, P. Hawkins, J. Q. Davis,
|
| 353 |
+
285 A. Mohiuddin, L. Kaiser, D. B. Belanger, L. J. Colwell, and A. Weller. Rethinking attention with performers.
|
| 354 |
+
286 In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7,
|
| 355 |
+
287 2021. OpenReview.net, 2021. URL https://openreview.net/forum?id=Ua6zuk0WRH.
|
| 356 |
+
288 [12] A. Chowdhery, S. Narang, J. Devlin, M. Bosma, G. Mishra, A. Roberts, P. Barham, H. W. Chung, C. Sutton,
|
| 357 |
+
289 S. Gehrmann, P. Schuh, K. Shi, S. Tsvyashchenko, J. Maynez, A. Rao, P. Barnes, Y. Tay, N. M. Shazeer,
|
| 358 |
+
290 V. Prabhakaran, E. Reif, N. Du, B. C. Hutchinson, R. Pope, J. Bradbury, J. Austin, M. Isard, G. Gur-Ari,
|
| 359 |
+
291 P. Yin, T. Duke, A. Levskaya, S. Ghemawat, S. Dev, H. Michalewski, X. García, V. Misra, K. Robinson,
|
| 360 |
+
292 L. Fedus, D. Zhou, D. Ippolito, D. Luan, H. Lim, B. Zoph, A. Spiridonov, R. Sepassi, D. Dohan, S. Agrawal,
|
| 361 |
+
293 M. Omernick, A. M. Dai, T. S. Pillai, M. Pellat, A. Lewkowycz, E. Moreira, R. Child, O. Polozov, K. Lee,
|
| 362 |
+
294 Z. Zhou, X. Wang, B. Saeta, M. Díaz, O. Firat, M. Catasta, J. Wei, K. S. Meier-Hellstern, D. Eck, J. Dean,
|
| 363 |
+
295 S. Petrov, and N. Fiedel. Palm: Scaling language modeling with pathways. ArXiv, abs/2204.02311, 2022.
|
| 364 |
+
296 [13] T. Dao, D. Y. Fu, S. Ermon, A. Rudra, and C. Re. Flashattention: Fast and memory-efficient exact attention
|
| 365 |
+
297 with IO-awareness. In A. H. Oh, A. Agarwal, D. Belgrave, and K. Cho, editors, Advances in Neural
|
| 366 |
+
298 Information Processing Systems, 2022. URL https://openreview.net/forum?id=H4DqfPSibmx.
|
| 367 |
+
299 [14] T. Dettmers, M. Lewis, Y. Belkada, and L. Zettlemoyer. GPT3.int8(): 8-bit matrix multiplication for
|
| 368 |
+
300 transformers at scale. In A. H. Oh, A. Agarwal, D. Belgrave, and K. Cho, editors, Advances in Neural
|
| 369 |
+
301 Information Processing Systems, 2022. URL https://openreview.net/forum?id=dXiGWqBoxaD.
|
| 370 |
+
302 [15] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. BERT: Pre-training of deep bidirectional transformers
|
| 371 |
+
303 for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the
|
| 372 |
+
304 Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short
|
| 373 |
+
305 Papers), pages 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics.
|
| 374 |
+
306 doi: 10.18653/v1/N19-1423. URL https://aclanthology.org/N19-1423.
|
| 375 |
+
307 [16] W. Fedus, B. Zoph, and N. Shazeer. Switch transformers: Scaling to trillion parameter models with simple
|
| 376 |
+
308 and efficient sparsity. J. Mach. Learn. Res., 23(1), jan 2022. ISSN 1532-4435.
|
| 377 |
+
309 [17] J. Frankle and M. Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In
|
| 378 |
+
310 International Conference on Learning Representations, 2019. URL https://openreview.net/forum?
|
| 379 |
+
311 id=rJl-b3RcF7.
|
| 380 |
+
312 [18] J. Frankle, G. Karolina Dziugaite, D. M. Roy, and M. Carbin. Stabilizing the lottery ticket hypothesis.
|
| 381 |
+
313 arXiv e-prints, pages arXiv–1903, 2019.
|
| 382 |
+
314 [19] B. Ghorbani, O. Firat, M. Freitag, A. Bapna, M. Krikun, X. García, C. Chelba, and C. Cherry. Scaling
|
| 383 |
+
315 laws for neural machine translation. ArXiv, abs/2109.07740, 2021.
|
| 384 |
+
316 [20] K. He, X. Zhang, S. Ren, and J. Sun. Delving deep into rectifiers: Surpassing human-level performance on
|
| 385 |
+
317 imagenet classification. CoRR, abs/1502.01852, 2015. URL http://arxiv.org/abs/1502.01852.
|
| 386 |
+
318 [21] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. 2016 IEEE Conference
|
| 387 |
+
319 on Computer Vision and Pattern Recognition (CVPR), pages 770–778, 2016.
|
| 388 |
+
320 [22] J. Hoffmann, S. Borgeaud, A. Mensch, E. Buchatskaya, T. Cai, E. Rutherford, D. de las Casas, L. A.
|
| 389 |
+
321 Hendricks, J. Welbl, A. Clark, T. Hennigan, E. Noland, K. Millican, G. van den Driessche, B. Damoc,
|
| 390 |
+
322 A. Guy, S. Osindero, K. Simonyan, E. Elsen, O. Vinyals, J. W. Rae, and L. Sifre. An empirical analysis
|
| 391 |
+
323 of compute-optimal large language model training. In A. H. Oh, A. Agarwal, D. Belgrave, and K. Cho,
|
| 392 |
+
324 editors, Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/
|
| 393 |
+
325 forum?id $\equiv$ iBBcRUlOAPR.
|
| 394 |
+
326 [23] E. J. Hu, yelong shen, P. Wallis, Z. Allen-Zhu, Y. Li, S. Wang, L. Wang, and W. Chen. LoRA: Low-rank
|
| 395 |
+
327 adaptation of large language models. In International Conference on Learning Representations, 2022.
|
| 396 |
+
328 URL https://openreview.net/forum?id=nZeVKeeFYf9.
|
| 397 |
+
329 [24] Y. Idelbayev and M. A. Carreira-Perpinan. Low-rank compression of neural nets: Learning the rank of
|
| 398 |
+
330 each layer. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages
|
| 399 |
+
331 8046–8056, 2020. doi: 10.1109/CVPR42600.2020.00807.
|
| 400 |
+
332 [25] A. Jacot, F. Gabriel, and C. Hongler. Neural tangent kernel: Convergence and generalization in neural
|
| 401 |
+
333 networks. In Proceedings of the 32nd International Conference on Neural Information Processing Systems,
|
| 402 |
+
334 NIPS’18, page 8580–8589, Red Hook, NY, USA, 2018. Curran Associates Inc.
|
| 403 |
+
335 [26] M. Jaderberg, A. Vedaldi, and A. Zisserman. Speeding up convolutional neural networks with low
|
| 404 |
+
336 rank expansions. In Proceedings of the British Machine Vision Conference. BMVA Press, 2014. doi:
|
| 405 |
+
337 http://dx.doi.org/10.5244/C.28.88.
|
| 406 |
+
338 [27] J. Kaplan, S. McCandlish, T. J. Henighan, T. B. Brown, B. Chess, R. Child, S. Gray, A. Radford, J. Wu,
|
| 407 |
+
339 and D. Amodei. Scaling laws for neural language models. ArXiv, abs/2001.08361, 2020.
|
| 408 |
+
340 [28] U. Khandelwal, O. Levy, D. Jurafsky, L. Zettlemoyer, and M. Lewis. Generalization through memorization:
|
| 409 |
+
341 Nearest neighbor language models. In International Conference on Learning Representations, 2020. URL
|
| 410 |
+
342 https://openreview.net/forum?id=HklBjCEKvH.
|
| 411 |
+
343 [29] D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2015.
|
| 412 |
+
344 [30] T. Klug and R. Heckel. Scaling laws for deep learning based image reconstruction. In The Eleventh
|
| 413 |
+
345 International Conference on Learning Representations, 2023. URL https://openreview.net/forum?
|
| 414 |
+
346 id=op-ceGueqc4.
|
| 415 |
+
347 [31] O. Kovaleva, A. Romanov, A. Rogers, and A. Rumshisky. Revealing the dark secrets of bert. In Proceedings
|
| 416 |
+
348 of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International
|
| 417 |
+
349 Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4365–4374, 2019.
|
| 418 |
+
350 [32] A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural
|
| 419 |
+
351 networks. In F. Pereira, C. Burges, L. Bottou, and K. Weinberger, editors, Advances in Neural Information
|
| 420 |
+
352 Processing Systems, volume 25. Curran Associates, Inc., 2012. URL https://proceedings.neurips.
|
| 421 |
+
353 cc/paper_files/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf.
|
| 422 |
+
354 [33] V. Lialin, V. Deshpande, and A. Rumshisky. Scaling down to scale up: A guide to parameter-efficient
|
| 423 |
+
355 fine-tuning, 2023.
|
| 424 |
+
356 [34] R. Lin, C.-Y. Ko, Z. He, C. Chen, Y. Cheng, H. Yu, G. Chesi, and N. Wong. Hotcake: Higher order tucker
|
| 425 |
+
357 articulated kernels for deeper cnn compression. In 2020 IEEE 15th International Conference on Solid-State
|
| 426 |
+
358 & Integrated Circuit Technology (ICSICT), pages 1–4, 2020. doi: 10.1109/ICSICT49897.2020.9278257.
|
| 427 |
+
359 [35] J. Lu, C. Clark, R. Zellers, R. Mottaghi, and A. Kembhavi. UNIFIED-IO: A unified model for vision,
|
| 428 |
+
360 language, and multi-modal tasks. In The Eleventh International Conference on Learning Representations,
|
| 429 |
+
361 2023. URL https://openreview.net/forum?id=E01k9048soZ.
|
| 430 |
+
362 [36] R. K. mahabadi, J. Henderson, and S. Ruder. Compacter: Efficient low-rank hypercomplex adapter layers.
|
| 431 |
+
363 In A. Beygelzimer, Y. Dauphin, P. Liang, and J. W. Vaughan, editors, Advances in Neural Information
|
| 432 |
+
364 Processing Systems, 2021. URL https://openreview.net/forum?id=bqGK5PyI6-N.
|
| 433 |
+
365 [37] P. Micikevicius, S. Narang, J. Alben, G. Diamos, E. Elsen, D. Garcia, B. Ginsburg, M. Houston,
|
| 434 |
+
366 O. Kuchaiev, G. Venkatesh, and H. Wu. Mixed precision training. In International Conference on
|
| 435 |
+
367 Learning Representations, 2018. URL https://openreview.net/forum?id=r1gs9JgRZ.
|
| 436 |
+
368 [38] P. Nakkiran, G. Kaplun, Y. Bansal, T. Yang, B. Barak, and I. Sutskever. Deep double descent: where bigger
|
| 437 |
+
369 models and more data hurt. Journal of Statistical Mechanics: Theory and Experiment, 2021, 2019.
|
| 438 |
+
370 [39] A. Radford, K. Narasimhan, T. Salimans, I. Sutskever, et al. Improving language understanding by
|
| 439 |
+
371 generative pre-training. 2018.
|
| 440 |
+
372 [40] A. Radford, J. Wu, R. Child, D. Luan, D. Amodei, and I. Sutskever. Language models are unsupervised
|
| 441 |
+
373 multitask learners. 2019.
|
| 442 |
+
374 [41] C. Raffel, N. Shazeer, A. Roberts, K. Lee, S. Narang, M. Matena, Y. Zhou, W. Li, and P. J. Liu. Exploring
|
| 443 |
+
375 the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research,
|
| 444 |
+
376 21(140):1–67, 2020. URL http://jmlr.org/papers/v21/20-074.html.
|
| 445 |
+
377 [42] A. Raganato, Y. Scherrer, and J. Tiedemann. Fixed encoder self-attention patterns in transformer-based
|
| 446 |
+
378 machine translation. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages
|
| 447 |
+
379 556–568, 2020.
|
| 448 |
+
380 [43] S. Rajbhandari, J. Rasley, O. Ruwase, and Y. He. Zero: Memory optimizations toward training trillion
|
| 449 |
+
381 parameter models. In SC20: International Conference for High Performance Computing, Networking,
|
| 450 |
+
382 Storage and Analysis, pages 1–16, 2020. doi: 10.1109/SC41405.2020.00024.
|
| 451 |
+
383 [44] S. Schotthöfer, E. Zangrando, J. Kusch, G. Ceruti, and F. Tudisco. Low-rank lottery tickets: finding efficient
|
| 452 |
+
384 low-rank neural networks via matrix differential equations. In S. Koyejo, S. Mohamed, A. Agarwal,
|
| 453 |
+
385 D. Belgrave, K. Cho, and A. Oh, editors, Advances in Neural Information Processing Systems, volume 35,
|
| 454 |
+
386 pages 20051–20063. Curran Associates, Inc., 2022. URL https://proceedings.neurips.cc/paper_
|
| 455 |
+
387 files/paper/2022/file/7e98b00eeafcdaeb0c5661fb9355be3a-Paper-Conference.pdf.
|
| 456 |
+
388 [45] N. Shazeer. Glu variants improve transformer, 2020.
|
| 457 |
+
389 [46] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In
|
| 458 |
+
390 Y. Bengio and Y. LeCun, editors, 3rd International Conference on Learning Representations, ICLR 2015,
|
| 459 |
+
391 San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015. URL http://arxiv.org/
|
| 460 |
+
392 abs/1409.1556.
|
| 461 |
+
393 [47] S. P. Singh, G. Bachmann, and T. Hofmann. Analytic insights into structure and rank of neural network
|
| 462 |
+
394 hessian maps. In A. Beygelzimer, Y. Dauphin, P. Liang, and J. W. Vaughan, editors, Advances in Neural
|
| 463 |
+
395 Information Processing Systems, 2021. URL https://openreview.net/forum?id=otDgw7LM7Nn.
|
| 464 |
+
396 [48] J. Su, Y. Lu, S. Pan, B. Wen, and Y. Liu. Roformer: Enhanced transformer with rotary position embedding.
|
| 465 |
+
397 ArXiv, abs/2104.09864, 2021.
|
| 466 |
+
398 [49] Y. Sui, M. Yin, W. Yang, Y. Gong, J. Xiao, H. Phan, D. Ding, X. Xu, S. Liu, Z. Chen, and B. Yuan. ELRT:
|
| 467 |
+
399 Towards efficient low-rank training for compact neural networks, 2023. URL https://openreview.
|
| 468 |
+
400 net/forum?id=TC39w69m8bB.
|
| 469 |
+
401 [50] H. Touvron, T. Lavril, G. Izacard, X. Martinet, M.-A. Lachaux, T. Lacroix, B. Rozière, N. Goyal, E. Hambro,
|
| 470 |
+
402 F. Azhar, A. Rodriguez, A. Joulin, E. Grave, and G. Lample. Llama: Open and efficient foundation language
|
| 471 |
+
403 models. arXiv preprint arXiv:2302.13971, 2023.
|
| 472 |
+
404 [51] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin.
|
| 473 |
+
405 Attention is all you need. Advances in neural information processing systems, 30, 2017.
|
| 474 |
+
406 [52] S. Wang, B. Z. Li, M. Khabsa, H. Fang, and H. Ma. Linformer: Self-attention with linear complexity.
|
| 475 |
+
407 arXiv preprint arXiv:2006.04768, 2020.
|
| 476 |
+
408 [53] J. Wei, Y. Tay, R. Bommasani, C. Raffel, B. Zoph, S. Borgeaud, D. Yogatama, M. Bosma, D. Zhou,
|
| 477 |
+
409 D. Metzler, E. H. Chi, T. Hashimoto, O. Vinyals, P. Liang, J. Dean, and W. Fedus. Emergent abilities
|
| 478 |
+
410 of large language models. Transactions on Machine Learning Research, 2022. ISSN 2835-8856. URL
|
| 479 |
+
411 https://openreview.net/forum?id=yzkSU5zdwD. Survey Certification.
|
| 480 |
+
412 [54] J. Wei, X. Wang, D. Schuurmans, M. Bosma, brian ichter, F. Xia, E. H. Chi, Q. V. Le, and D. Zhou.
|
| 481 |
+
413 Chain of thought prompting elicits reasoning in large language models. In A. H. Oh, A. Agarwal,
|
| 482 |
+
414 D. Belgrave, and K. Cho, editors, Advances in Neural Information Processing Systems, 2022. URL
|
| 483 |
+
415 https://openreview.net/forum?id=_VjQlMeSB_J.
|
| 484 |
+
416 [55] H. Yang, M. Tang, W. Wen, F. Yan, D. Hu, A. Li, H. H. Li, and Y. Chen. Learning low-rank deep neural
|
| 485 |
+
417 networks via singular vector orthogonality regularization and singular value sparsification. 2020 IEEE/CVF
|
| 486 |
+
418 Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), pages 2899–2908, 2020.
|
| 487 |
+
419 [56] J. Yu, Z. Wang, V. Vasudevan, L. Yeung, M. Seyedhosseini, and Y. Wu. Coca: Contrastive captioners are
|
| 488 |
+
420 image-text foundation models. Transactions on Machine Learning Research, 2022. ISSN 2835-8856. URL
|
| 489 |
+
421 https://openreview.net/forum?id=Ee277P3AYC.
|
| 490 |
+
422 [57] X. Yuan, P. H. P. Savarese, and M. Maire. Growing efficient deep networks by structured contin
|
| 491 |
+
423 uous sparsification. In International Conference on Learning Representations, 2021. URL https:
|
| 492 |
+
424 //openreview.net/forum?id=wb3wxCObbRT.
|
| 493 |
+
425 [58] B. Zhang and R. Sennrich. Root mean square layer normalization. In H. Wallach, H. Larochelle,
|
| 494 |
+
426 A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing
|
| 495 |
+
427 Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper_
|
| 496 |
+
428 files/paper/2019/file/1e8a19426224ca89e83cef47f1e7f53b-Paper.pdf.
|
| 497 |
+
429 [59] C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals. Understanding deep learning requires
|
| 498 |
+
430 rethinking generalization. In International Conference on Learning Representations, 2017. URL
|
| 499 |
+
431 https://openreview.net/forum?id=Sy8gdB9xx.
|
| 500 |
+
432 [60] C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals. Understanding deep learning (still) requires
|
| 501 |
+
433 rethinking generalization. Communications of the ACM, 64:107 – 115, 2021.
|
md/dev/dUSI4vFyMK/dUSI4vFyMK.md
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Convergence for score-based generative modeling with polynomial complexity
|
| 2 |
+
|
| 3 |
+
Holden Lee Department of Applied Mathematics and Statistics Johns Hopkins University hlee283@jhu.edu
|
| 4 |
+
|
| 5 |
+
Jianfeng Lu
|
| 6 |
+
Department of Mathematics Duke University
|
| 7 |
+
jianfeng@math.duke.edu
|
| 8 |
+
|
| 9 |
+
Yixin Tan Department of Mathematics Duke University yixin.tan@duke.edu
|
| 10 |
+
|
| 11 |
+
# Abstract
|
| 12 |
+
|
| 13 |
+
Score-based generative modeling (SGM) is a highly successful approach for learning a probability distribution from data and generating further samples. We prove the first polynomial convergence guarantees for the core mechanic behind SGM: drawing samples from a probability density $p$ given a score estimate (an estimate of $\nabla \ln p$ ) that is accurate in $L ^ { 2 } ( p )$ . Compared to previous works, we do not incur error that grows exponentially in time or that suffers from a curse of dimensionality. Our guarantee works for any smooth distribution and depends polynomially on its log-Sobolev constant. Using our guarantee, we give a theoretical analysis of score-based generative modeling, which transforms white-noise input into samples from a learned data distribution given score estimates at different noise scales. Our analysis gives theoretical grounding to the observation that an annealed procedure is required in practice to generate good samples, as our proof depends essentially on using annealing to obtain a warm start at each step. Moreover, we show that a predictor-corrector algorithm gives better convergence than using either portion alone.
|
| 14 |
+
|
| 15 |
+
# 1 Introduction
|
| 16 |
+
|
| 17 |
+
A key task in machine learning is to learn a probability distribution from data, in a way that allows efficient generation of additional samples from the learned distribution. Score-based generative modeling (SGM) is one empirically successful approach that implicitly learns the probability distribution by learning how to transform white noise into the data distribution, and gives stateof-the-art performance for generating images and audio [SE19; Dat+19; Gra+19; SE20; $\mathrm { S o n } { + } 2 0 \mathrm { b }$ ; $\mathrm { M e n } { + } 2 1$ ; $\mathbf { S o n } { + } 2 1 \mathbf { b }$ ; Son $+ 2 1 \mathrm { a }$ ; $\mathrm { J i n } { + } 2 2 ^ { \cdot }$ ]. It also yields a conditional generation process for inverse problems [DN21]. The basic idea behind score-based generative modeling is to first estimate the score function from data $[ \mathrm { S o n } { + } 2 0 \mathrm { a } ]$ and then to sample the distribution based on the learned score function. Other approaches for generative modeling include generative adversarial networks (GANs) $[ \mathrm { G o o { + } 1 4 }$ ; ACB17], normalizing flows [DSB16], variational autoencoders [KW19], and energybased models [ZML16]. While score-based generative modeling has achieved great success, its theoretical analysis is still lacking and is the focus of our work.
|
| 18 |
+
|
| 19 |
+
# 1.1 Background
|
| 20 |
+
|
| 21 |
+
General framework. The score function of a distribution $P$ with density $p$ is defined as the gradient of the log-pdf, $\nabla \ln p$ . Its significance arises from the fact that knowing the score function allows running a variety of sampling algorithms, based on discretizations of stochastic differential equations (SDE’s), to sample from $p$ . SGM consists of two steps: first, learning an estimate of the score function for a sequence of “noisy” versions of the data distribution $P _ { \mathrm { d a t a } }$ , and second, using the score function in lieu of the gradient of the log-pdf in the chosen sampling algorithm. We now describe each of these steps more precisely.
|
| 22 |
+
|
| 23 |
+
First, a method of adding noise to the data distribution is fixed; this takes the form of evolving a (forward) stochastic differential equation (SDE) starting from the data distribution. We fix a sequence of noise levels $\sigma _ { 1 } < \cdots < \sigma _ { N }$ . For $\sigma \in \{ \sigma _ { 1 } , \dots , \sigma _ { N } \}$ , let the resulting distributions be $P _ { \sigma ^ { 2 } }$ and the distributions conditional on the starting data point be $P _ { \sigma ^ { 2 } } ( \cdot | x )$ . Typically, $\sigma _ { 1 }$ is chosen so that $P _ { \sigma _ { 1 } ^ { 2 } } \approx P _ { \mathrm { d a t a } }$ and $P _ { \sigma _ { N } ^ { 2 } }$ is close to some “prior” distribution that is easy to sample from, such as $N ( 0 , \sigma _ { N } ^ { 2 } I _ { d } )$ . While the score $\nabla \ln p _ { \sigma ^ { 2 } }$ cannot be estimated directly, it turns out that a de-noising objective that is equivalent to the score-matching objective can be calculated [SE19]. This de-noising objective can be estimated from samples $( X , { \tilde { X } } )$ where $\widetilde { X } \sim P _ { \sigma ^ { 2 } } ( \cdot | x )$ . The objective is represented and optimized within an expressive function class, typically neural networks, to obtain a $L ^ { 2 }$ -estimate of the score, that is, $s _ { \theta } ( x , \overbar { \sigma } ^ { 2 } )$ such that
|
| 24 |
+
|
| 25 |
+
$$
|
| 26 |
+
\begin{array} { r l } { { \mathbb { E } _ { { x } \sim { P } _ { \sigma ^ { 2 } } } [ \| s _ { \theta } ( x , \sigma ^ { 2 } ) - \nabla \ln { p } _ { \sigma ^ { 2 } } ( x ) \| ^ { 2 } ] } \quad } & { { } } \end{array}
|
| 27 |
+
$$
|
| 28 |
+
|
| 29 |
+
is small.
|
| 30 |
+
|
| 31 |
+
The reason we estimate the score function $\nabla \ln p _ { \sigma ^ { 2 } }$ is that there are a variety of sampling algorithms—based on simulating SDE’s—that can sample from $p$ given access to $\nabla \ln p$ , including Langevin Monte Carlo and Hamiltonian Monte Carlo. The second step is then to use the estimated score function $s _ { \theta } ( x , t )$ in lieu of the exact gradient in the sampling algorithm to successively obtain samples from $p _ { \sigma _ { N } ^ { 2 } } , \ldots , p _ { \sigma _ { 1 } ^ { 2 } }$ . This sequence interpolates smoothly between the prior distribution (e.g., $N ( 0 , \sigma _ { N } ^ { 2 } I _ { d } ) )$ and the data distribution $P _ { \mathrm { d a t a } }$ ; such an “annealing” or “homotopy” method is required in practice to generate good samples $[ \mathrm { S o n } { + } 2 0 \mathrm { b } ]$ .
|
| 32 |
+
|
| 33 |
+
Examples of SGM’s. There have been several instantiations of this general approach. [SE19] add gaussian noise to the data and then use Langevin diffusion at a discrete set of noise levels $\sigma _ { N } > \cdots > \sigma _ { 1 }$ as the sampling algorithm. $[ \mathrm { S o n } { + } 2 0 \mathrm { b } ]$ take the continuous perspective and consider a more general framework, where the forward process can be any reasonable SDE. Then a natural reverse $S D E$ evolves the final distribution $p _ { \sigma _ { N } ^ { 2 } }$ back to the data distribution; this process can be simulated with the estimated score. They consider methods based on two different SDE’s: score-matching Langevin diffusion (SMLD) based on adding Gaussian noise and denosing diffusion probabilistic models (DDPM) $[ \mathrm { S o h + } 1 5$ ; HJA20], based on the Ornstein-Uhlenbeck process. Note that a difference with MCMC-based methods is that these SDE’s are evolved for a fixed amount of time, rather than until convergence. However, they can be combined with MCMC-based methods such as Langevin diffusion in the predictor-corrector approach for improved convergence. [DVK21] include Hamiltonian dynamics: they augment the state space with a velocity variable and consider a critically-damped version of the Ornstein-Uhlenbeck process. Finally, we note the work of [De $+ 2 1 ]$ , who introduce the Diffusion Schrodinger Bridge method to learn a diffusion that more quickly ¨ transforms the prior into the data distribution.
|
| 34 |
+
|
| 35 |
+
We will give a general analysis framework for SGM’s that applies to the algorithms in both [SE19] and $[ \mathrm { S o n } { + } 2 0 \mathrm { b } ]$ .
|
| 36 |
+
|
| 37 |
+
# 1.2 Prior work and challenges for theory
|
| 38 |
+
|
| 39 |
+
Although the literature on convergence for Langevin Monte Carlo [DM17; CB18; ${ \mathrm { C h e } } + 1 8$ ; Dal17; DK19; MMS20; EHZ21] and related sampling algorithms is extensive, prior works mainly consider the case of exact or stochastic gradients. In contrast, by the structure of the loss function (1), the score function learned in SGM is only accurate in $L ^ { 2 } ( p )$ . This poses a significant challenge for analysis, as the stationary distribution of Langevin diffusion with $L ^ { 2 } ( p )$ -accurate gradient can be arbitrarily far from $p$ (see Appendix D). Hence, any analysis must be utilizing the short/mediumterm convergence, while overcoming the potential issue of long-term behavior of convergence to an incorrect distribution.
|
| 40 |
+
|
| 41 |
+
[BMR20] give the first theoretical analysis of SGM, and in particular, Langevin Monte Carlo with $L ^ { 2 } ( p )$ -accurate gradients. First, they show using uniform generalization bounds that optimizing the de-noising autoencoder (DAE) objective does in fact give a $L ^ { 2 } ( p )$ -accurate score function, with sample complexity depending on the complexity of the function class. They analyze convergence of LMC in Wasserstein distance. However, the error they obtain (Theorem 13) only decreases as $\varepsilon ^ { 1 / d }$ where $\varepsilon$ is the accuracy of the score estimate—so it suffers from the curse of dimensionality—and increases exponentially in the time that the process is run, the dimension, and the smoothness of the distribution, as in ODE/SDE discretization arguments that do not depend on contractivity.
|
| 42 |
+
|
| 43 |
+
[De $+ 2 1 ]$ give an analysis for $[ \mathrm { S o n } { + } 2 0 \mathrm { b } ]$ in TV distance that requires a $L ^ { \infty }$ -accurate score function and depends exponentially on the amount of time the reverse SDE is run. Although exponential dependence is bad in general, it is mollified using their Diffusion Schrodinger Bridge (DSB) approach, ¨ as it allows running for a shorter, fixed amount of time, before the forward SDE converges to the prior distribution. However, this supposes that a good solution can be found for the DSB problem, and theoretical guarantees may be difficult to obtain.
|
| 44 |
+
|
| 45 |
+
We overcome the challenges of analysis with a $L ^ { 2 } ( p )$ -accurate gradient, and give the first analysis with only polynomial dependence on running time, dimension, and smoothness of the distribution, with rates that are a fixed power of $\varepsilon$ . Our convergence result is in TV distance. We assume only smoothness conditions and a bounded log-Sobolev constant of the data distribution, a weaker condition than the dissipativity condition required by [BMR20]. We introduce a general framework for analysis of sampling algorithms given $L ^ { 2 }$ -accurate gradients (score function) based on constructing a “bad set” with small measure and showing convergence of the discretized process conditioned on not hitting the bad set. We use our framework to give an end-to-end analysis for both the algorithms in [SE19] and $[ \mathrm { S o n } { + } 2 0 \mathrm { b } ]$ , and illuminate the relative performance of different methods in practice.
|
| 46 |
+
|
| 47 |
+
# 1.3 Notation and organization
|
| 48 |
+
|
| 49 |
+
Through out the paper, $p ( x ) \propto e ^ { - V ( x ) }$ denotes the target distribution in $\mathbb { R } ^ { d }$ and $V : \mathbb { R } ^ { d } \mathbb { R }$ is referred to as the potential. We abuse notation by identifying a measure with its density when context allows. We write $a \wedge b : = \operatorname* { m i n } \{ a , b \}$ and $a \vee b : = \operatorname* { m a x } \{ a , b \}$ . We use $a = O ( b )$ or $b = \Omega ( a )$ to indicate that $a \leq C b$ for a universal constant $C > 0$ . Also, we write $a = \Theta ( b )$ if there are universal constants $c ^ { \prime } > c > 0$ such that $c b \leq a \leq c b$ , and the notation ${ \tilde { O } } ( \cdot )$ means it hides polylog factors in the parameters. Definite integrals without limits are taken over $\mathbb { R } ^ { d }$ .
|
| 50 |
+
|
| 51 |
+
In Section 2 we explain our main results for Langevin Monte Carlo with $L ^ { 2 } ( p )$ -accurate score estimate and use it to derive convergence bounds for the annealed LMC method of [SE19]. In Section 3, we give our main results for the predictor-corrector algorithms of $[ \mathrm { S o n } { + } 2 0 \mathrm { b } ]$ based on simulating reverse SDE’s. Our proofs are based on a common framework which we introduce in Section 4. Full proofs are in the appendix.
|
| 52 |
+
|
| 53 |
+
# 2 Results for Langevin dynamics with estimated score
|
| 54 |
+
|
| 55 |
+
Let $p ( x ) \propto e ^ { - V ( x ) }$ be a probability density on $\mathbb { R } ^ { d }$ such that $V$ is $C ^ { 1 }$ . Langevin diffusion with stationary distribution $p$ is the stochastic process defined by the SDE
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
d x _ { t } = - \nabla V ( x _ { t } ) d t + \sqrt { 2 } d w _ { t } ,
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
where $w _ { t }$ is a standard Brownian Motion in $\mathbb { R } ^ { d }$ . The rate of convergence to $p$ in $\chi ^ { 2 }$ and $\mathrm { K L }$ divergences are given by the Poincare and log-Sobolev constants of ´ $p$ , respectively; see Section E.1. To obtain the Langevin Monte Carlo (LMC) algorithm, we take the Euler-Murayama discretization of the SDE. We define LMC with score estimate $s ( x ) \approx - \nabla V ( x )$ and step size $h$ by
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
x _ { ( k + 1 ) h } = x _ { k h } + h \cdot s ( x _ { k h } ) + \sqrt { 2 h } \cdot \xi _ { k h } , \mathrm { w h e r e } \xi _ { k h } \sim N ( 0 , I _ { d } ) .
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
We make the following assumptions on the density $p$ and the score estimate $s$ , which we will use throughout this paper.
|
| 68 |
+
|
| 69 |
+
Assumption 1. $p$ is a probability density on $\mathbb { R } ^ { d }$ such that the following hold.
|
| 70 |
+
|
| 71 |
+
1. $\ln { p }$ is $C ^ { 1 }$ and $L$ -smooth, that is, $\nabla \ln p$ is $L$ -Lipschitz. We assume $L \geq 1$ .
|
| 72 |
+
|
| 73 |
+
2. $p$ satisfies a log-Sobolev inequality with constant $C _ { \mathrm { L S } }$ . We assume $C _ { \mathrm { L S } } \geq 1$
|
| 74 |
+
|
| 75 |
+
3. (Moments) $\| \mathbb { E } _ { p } x \| \leq M _ { 1 }$ and ${ \mathbb E } _ { p } \left\| x \right\| ^ { 2 } \le M _ { 2 }$ .
|
| 76 |
+
|
| 77 |
+
We note that the uniform Lipschitzness assumption (1) helps ensure a unique strong solution to the Langevin diffusion, as in [BMR20]. One special case where one can prove Lipschitzness for all $t$ is when $p _ { 0 }$ is strongly log-concave $[ \mathrm { L e e } + 2 1$ , Lemma 28]. Although satisfying a log-Sobolev inequality (3) is a significant assumption, it is standard for analysis of Langevin Monte Carlo [VW19]. It is much weaker than assumptions in previous works [BMR20], including log-concave distributions and distributions satisfying strong dissipativity, and is stable under bounded perturbations. See Section E.1 for background on functional inequalities.
|
| 78 |
+
|
| 79 |
+
Assumption 2. Let p be a given probability density on $\mathbb { R } ^ { d }$ such that $\ln { p }$ is $C ^ { 1 }$ . The score estimate $s : \mathbb { R } ^ { d } \overset { ^ { - } } { \to } \mathbb { R } ^ { d }$ satisfies the following.
|
| 80 |
+
|
| 81 |
+
1. s is a $C ^ { 1 }$ function that is $L _ { s }$ -Lipschitz. We assume $L _ { s } \ge 1$ .
|
| 82 |
+
|
| 83 |
+
2. The error in the score estimate is bounded in $L ^ { 2 }$
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\begin{array} { r } { \| \nabla \ln p - s \| _ { L ^ { 2 } ( p ) } ^ { 2 } = \mathbb { E } _ { p } [ \| \nabla \ln p ( x ) - s ( x ) \| ^ { 2 } ] \le \varepsilon ^ { 2 } . } \end{array}
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
# 2.1 Langevin with $L ^ { 2 }$ -accurate score estimate
|
| 90 |
+
|
| 91 |
+
Our first main result gives an error bound between the sampled distribution and $p$ , assuming $L ^ { 2 }$ - accurate score function estimate.
|
| 92 |
+
|
| 93 |
+
Theorem 2.1 (LMC with $L ^ { 2 }$ -accurate score estimate). Let $p : \mathbb { R } ^ { d } \mathbb { R }$ be a probability density satisfying Assumption $I ( I , 2 )$ with $L \geq 1$ and $s : \mathbb { R } ^ { d } \mathbb { R } ^ { d }$ be a score estimate satisfying Assumption 2(2). Consider the accuracy requirement in TV and $\chi ^ { 2 } \colon 0 < \varepsilon _ { \mathrm { T V } } < 1 , 0 < \varepsilon _ { \chi } < 1$ , and suppose furthermore the starting distribution satisfies $\chi ^ { 2 } ( p _ { 0 } | | p ) \leq K _ { \chi } ^ { 2 }$ . Then if
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
\varepsilon = O \left( \frac { \varepsilon _ { \mathrm { T V } } \varepsilon _ { \chi } ^ { 3 } } { d L ^ { 2 } C _ { \mathrm { L S } } ^ { 5 / 2 } ( \ln ( 2 K _ { \chi } / \varepsilon _ { \chi } ^ { 2 } ) \vee K _ { \chi } ) } \right) ,
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
then running (LMC-SE) with score estimate $s$ , step size $\begin{array} { r } { h \ \mathrm { ~ = ~ } \ \Theta \biggl ( \frac { \varepsilon _ { \chi } ^ { 2 } } { d L ^ { 2 } C _ { \mathrm { L S } } } \biggr ) } \end{array}$ and time $T =$ $\begin{array} { r } { \Theta \Big ( C _ { \mathrm { L S } } \ln \Big ( \frac { 2 K _ { \chi } } { \varepsilon _ { \chi } ^ { 2 } } \Big ) \Big ) } \end{array}$ results in a distribution $p _ { T }$ such that $p _ { T }$ is $\varepsilon _ { \mathrm { T V } }$ -far in TV distance from a distribution $\overline { { p } } _ { T }$ , where $\overline { { p } } _ { T }$ satisfies $\chi ^ { 2 } ( \overline { { p } } _ { T } | | p ) \leq \varepsilon _ { \chi } ^ { 2 }$ . In particular, taking $\varepsilon _ { \chi } = \varepsilon _ { \mathrm { T V } }$ , we have the error guarantee that $\mathrm { T V } ( p _ { T } , p ) \leq 2 \varepsilon _ { \mathrm { T V } }$ .
|
| 100 |
+
|
| 101 |
+
Note that the error bound is only achieved when running LMC for a moderate time; this is consistent with the fact that the stationary distribution of LMC with a $L ^ { 2 }$ -score estimate can be arbitrarily far from $p$ . Note also that we need a warm start in $\chi ^ { 2 }$ -divergence: to obtain fixed errors $\varepsilon _ { \mathrm { T V } } , \varepsilon _ { \chi }$ , the required accuracy for the score estimate is inversely proportional to $K _ { \chi }$ . Intuitively, we must suffer from such a dependence because if the starting distribution is very far away, then there is no guarantee that $\| \nabla \ln \bar { p } ( x _ { t } ) - s ( x _ { t } ) \| ^ { 2 }$ is small on average during the sampling algorithm. Finally, although we can state a result purely in terms of TV distance, we need this more precise formulation to prove a result for annealed Langevin dynamics.
|
| 102 |
+
|
| 103 |
+
# 2.2 Annealed Langevin dynamics with estimated score
|
| 104 |
+
|
| 105 |
+
In light of the warm start requirement in Theorem 2.1, we typically cannot directly sample from $p _ { \mathrm { d a t a } }$ or its approximation. Hence, [SE19] proposed using annealed Langevin dynamics: consider a sequence of noise levels $\sigma _ { N } > \cdots > \sigma _ { 1 } \approx 0$ giving rise to a sequence of distributions pσ2N , . . . , pσ21 ≈ pdata, where pσ2 = p ∗ φσ2 , φσ2 being the density of N (0, σ2Id). For large enough $\sigma _ { N } , \varphi _ { \sigma _ { N } ^ { 2 } } \approx p _ { \sigma _ { N } ^ { 2 } }$ provides a warm start to $p _ { \sigma _ { N } ^ { 2 } }$ . We then successively run LMC using score estimates for $p _ { \sigma _ { k } ^ { 2 } }$ , with the approximate sample for $p _ { \sigma _ { k } ^ { 2 } }$ giving a warm start for $p _ { \sigma _ { k - 1 } ^ { 2 } }$ . We obtain the following algorithm and error estimate.
|
| 106 |
+
|
| 107 |
+
INPUT: Noise levels $0 \leq \sigma _ { 1 } < . . . < \sigma _ { M }$ ; score function estimates $s ( \cdot , \sigma _ { m } )$ (estimates of $\nabla \ln ( p * \varphi _ { \sigma _ { m } ^ { 2 } } ) )$ , step sizes $h _ { m }$ , and number of steps $N _ { m }$ for $1 \leq m \leq M$ .
|
| 108 |
+
Draw $x ^ { ( M + 1 ) } \sim N ( 0 , \sigma _ { M } ^ { 2 } I _ { d } )$ .
|
| 109 |
+
for from to 1 do
|
| 110 |
+
|
| 111 |
+
Starting from $x _ { 0 } ^ { ( m ) } = x ^ { ( m + 1 ) }$ , run (LMC-SE) with $s ( x , \sigma _ { m } )$ and step size $h _ { m }$ for $N _ { m }$ steps, and let the final sample be $x ^ { ( m ) }$ .
|
| 112 |
+
|
| 113 |
+
# end for
|
| 114 |
+
|
| 115 |
+
OUTPUT: Return $x ^ { ( 1 ) }$ , approximate sample from $p * \varphi _ { \sigma _ { 1 } ^ { 2 } }$
|
| 116 |
+
|
| 117 |
+
Theorem 2.2 (Annealed LMC with $L ^ { 2 }$ -accurate score estimate). Let $p : \mathbb { R } ^ { d } \mathbb { R }$ be a probability density satisfying Assumption 1 for $M _ { 1 } = O ( d )$ , and let $p _ { \sigma ^ { 2 } } : = p * \varphi _ { \sigma ^ { 2 } }$ . Suppose furthermore that $\nabla \ln p _ { \sigma ^ { 2 } }$ is $L$ -Lipschitz for every $\sigma \geq 0$ . Given $\sigma _ { \operatorname* { m i n } } > 0$ , there exists a sequence $\sigma _ { \mathrm { m i n } } = \sigma _ { 1 } <$ $\cdots < \sigma _ { M }$ with $\begin{array} { r } { M = O \left( \sqrt { d } \log \left( \frac { d C _ { \mathrm { L S } } } { \sigma _ { \mathrm { m i n } } ^ { 2 } } \right) \right) } \end{array}$ such that for each $m$ , $i f$
|
| 118 |
+
|
| 119 |
+
$$
|
| 120 |
+
\begin{array} { r l } & { \left\| \nabla \ln ( p _ { \sigma _ { m } ^ { 2 } } ) - s ( \cdot , \sigma _ { m } ^ { 2 } ) \right\| _ { L ^ { 2 } ( p _ { \sigma _ { m } ^ { 2 } } ) } ^ { 2 } = \mathbb { E } _ { p _ { \sigma _ { m } ^ { 2 } } } [ \left\| \nabla \ln p _ { \sigma _ { m } ^ { 2 } } ( x ) - s ( x , \sigma _ { m } ^ { 2 } ) \right\| ^ { 2 } ] \leq \varepsilon ^ { 2 } . } \\ & { \qquad w i t h \varepsilon : = \widetilde { \cal O } \left( \frac { \varepsilon _ { \mathrm { T V } } ^ { 4 . 5 } } { d ^ { 3 . 2 5 } L ^ { 2 } C _ { \mathrm { L S } } ^ { 2 . 5 } } \right) } \end{array}
|
| 121 |
+
$$
|
| 122 |
+
|
| 123 |
+
then $x ^ { ( 1 ) }$ is a sample from a distribution $q$ such that $\mathrm { T V } ( q , p _ { \sigma _ { 1 } ^ { 2 } } ) \leq \varepsilon _ { \mathrm { T V } }$
|
| 124 |
+
|
| 125 |
+
Note that we assume a score estimate with error $\varepsilon$ at all noise scales; this corresponds to using an objective function that is a maximum of the score-matching objective over all noise levels, rather than an average over all noise levels as more commonly used in practice. However, these two losses are at most a factor of $M$ apart.
|
| 126 |
+
|
| 127 |
+
The proof shows that the noise levels $\sigma _ { k }$ can be chosen as a geometric sequence, which matches the choice used in practice [SE20]. The additional dependence on $d$ and $\varepsilon _ { \mathrm { T V } }$ in Theorem 2.2 compared to Theorem 2.1 comes from requiring a sequence of $\widetilde { O } ( \sqrt { d } )$ noise levels and an additional factor in $\chi ^ { 2 }$ -divergence we suffer at the beginning of each level $m$ . In the next section, we will find that using a reverse SDE to evolve the samples between the noise levels—called a predictor step—will improve the rate and time complexity.
|
| 128 |
+
|
| 129 |
+
# 3 Results for reverse SDE’s with estimated score
|
| 130 |
+
|
| 131 |
+
To improve the empirical performance of score-based generative modeling, $[ \mathrm { S o n } { + } 2 0 \mathrm { b } ]$ consider a general framework where noise is injected into a data distribution $p _ { \mathrm { d a t a } }$ via a forward SDE,
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
d \tilde { x } _ { t } = f ( \tilde { x } _ { t } , t ) d t + g ( t ) d w _ { t } , \ t \in [ 0 , T ] ,
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
where $\widetilde x _ { 0 } \sim \widetilde p _ { 0 } : = p _ { \mathrm { d a t a } }$ . Let $\widetilde { p } _ { t }$ denote the distribution of $\widetilde { x } _ { t }$ $\widetilde { p } _ { t }$ is used instead of $p _ { t }$ to distine e e e eguish with the Gaussian-convolved distribution used in Annealed Langevin dynamics as in $\ S 2 . 2 )$ . Remarkably, $\widetilde { x } _ { t }$ also satisfies a reverse-time SDE,
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
d \widetilde { \boldsymbol { x } } _ { t } = [ f ( \widetilde { \boldsymbol { x } } _ { t } , t ) - g ( t ) ^ { 2 } \nabla \ln \widetilde { p } _ { t } ( \widetilde { \boldsymbol { x } } _ { t } ) ] d t + g ( t ) d \widetilde { \boldsymbol { w } } _ { t } , t \in [ 0 , T ] ,
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
where $\tilde { w } _ { t }$ is a backward Brownian Motion [And82]. By carefully choosing $f$ and $g$ , we can expect that $\tilde { p } _ { T }$ is approximately equal to some prior distribution $\tilde { q } _ { T }$ (e.g., a centered Gaussian) which we can accurately sample from. Then we hope that starting with some $\tilde { y } _ { T } \sim p _ { \mathrm { p r i o r } } = \tilde { q } _ { T } \approx \tilde { p } _ { T }$ and running the reverse-time process, we will get a good sample $\tilde { y } _ { 0 } \sim \tilde { q } _ { 0 } \approx p _ { \mathrm { d a t a } }$ .
|
| 144 |
+
|
| 145 |
+
The case where $f \equiv 0$ and $g \equiv 1$ recovers the simple case of convolving with a Gaussian as used in $\ S 2 . 2$ ; note, however that the reverse-time SDE differs from Langevin diffusion in having a larger (and time-varying) drift relative to the diffusion. $[ \mathrm { S o n } { + } 2 0 \mathrm { b } ]$ highlight the following two special cases. We will focus on DDPM while noting that our analysis applies more generically.
|
| 146 |
+
|
| 147 |
+
SMLD Score-matching Langevin diffusion: $f \equiv 0$ . In this case, $\widetilde { p } _ { t } \ = \ \widetilde { p } _ { 0 } * \ \varphi _ { \int _ { 0 } ^ { t } g ( s ) ^ { 2 } d s }$ , so $[ \mathrm { S o n } { + } 2 0 \mathrm { b } ]$ call this a variance-exploding (VE) SDE. As is common for annealing-based algorithms, [SE19; $\mathbf { S o n } { + } 2 0 \mathbf { b } ]$ suggest choosing an exponential schedule, so that $g ( t ) = a b ^ { t }$ for constants $a , b$ . We take $\begin{array} { r } { p _ { \mathrm { p r i o r } } = N ( 0 , \int _ { 0 } ^ { T } g ( s ) ^ { 2 } d s \cdot I _ { d } ) } \end{array}$ .
|
| 148 |
+
|
| 149 |
+
DDPM Denoising diffusion probabilistic modeling: $\begin{array} { r } { f ( x , t ) = - \frac { 1 } { 2 } g ( t ) ^ { 2 } x } \end{array}$ . This is an OrnsteinUhlenbeck process with time rescaling, $\begin{array} { r } { \widetilde { p } _ { t } = M _ { - \frac { 1 } { 2 } \int _ { 0 } ^ { t } g ( s ) ^ { 2 } d s \sharp } \widetilde { p } _ { 0 } \ast \varphi _ { 1 - e ^ { - \int _ { 0 } ^ { t } g ( s ) ^ { 2 } d s } } } \end{array}$ , where $M _ { \alpha } ( x ) = \alpha x$ . $[ \mathrm { S o n } { + } 2 0 \mathrm { b } ]$ call this a variance-preserving (VP) SDE, as the variance converges towards $I _ { d }$ . Because it displays exponential convergence towards $N ( 0 , I _ { d } )$ , it can be run for a smaller amount of normalized time $\textstyle \int _ { 0 } ^ { t } g ( s ) ^ { 2 } d s$ . $[ \mathrm { S o n } { + } 2 0 \mathrm { b } ]$ suggest the choice $g ( t ) = \sqrt { b + \alpha t }$ . We take $p _ { \mathrm { p r i o r } } = N ( 0 , ( 1 - e ^ { - \int _ { 0 } ^ { t } g ( s ) ^ { 2 } d s } ) I _ { d } ) \approx N ( 0 , I _ { d } ) .$
|
| 150 |
+
|
| 151 |
+
To obtain an algorithm, we consider the following discretization and approximation of (4); note that in all cases of interest the integrals can be analytically evaluated. We reverse time so that $t$ corresponds to $T - t$ of the forward process. As we are free to rescale time in the SDE, we assume without loss of generality that the step sizes are constant. The predictor step is
|
| 152 |
+
|
| 153 |
+
$$
|
| 154 |
+
\begin{array} { r l r } { { z _ { ( k + 1 ) h } = z _ { k h } - \int _ { k h } ^ { ( k + 1 ) h } [ f ( z _ { k h } , T - t ) - g ( T - t ) ^ { 2 } \cdot s ( z _ { k h } , T - k h ) ] d t } } \\ & { } & \\ & { } & { + \int _ { k h } ^ { ( k + 1 ) h } g ( T - t ) d w _ { t } , } \end{array}
|
| 155 |
+
$$
|
| 156 |
+
|
| 157 |
+
where $\begin{array} { r } { \int _ { k h } ^ { ( k + 1 ) h } g ( T - t ) d w _ { t } } \end{array}$ is distributed as $\begin{array} { r } { N ( 0 , \int _ { k h } ^ { ( k + 1 ) h } g ( T - t ) ^ { 2 } d t \cdot I _ { d } ) } \end{array}$ . Following $[ \mathrm { S o n } { + } 2 0 \mathrm { b } ]$ , we call these predictor steps as the samples aim to track the distributions $\widetilde { p } _ { T - k h }$ . Note that we flip the time. For simplicity of presentation, we consider the case $g \ \equiv \ 1$ . We note that although the choice of the schedule does matter in practice, what really matters in our theoretical analysis is the integral $\textstyle \int _ { 0 } ^ { t } g ( s ) ^ { 2 } d s$ . This means that different choices of $g$ are related by only a rescaling of time, i.e., for different $g$ and $\tilde { g }$ , we can always choose total times $T$ and $\tilde { T }$ , such that $\begin{array} { r } { \int _ { 0 } ^ { T } g ( s ) ^ { 2 } d s = \int _ { 0 } ^ { \tilde { T } } \tilde { g } ( s ) ^ { 2 } d s } \end{array}$ . While it seems that choosing large $g ( t )$ could reduce the total time $T$ , in our analysis (e.g., Lemma C.15) we need the time step-size $h$ to be ${ \cal O } ( 1 / g ( T ) ^ { 2 } )$ and hence the total computational cost, which is roughly $O ( T / h )$ , does not change significantly.
|
| 158 |
+
|
| 159 |
+
Theorem 3.1 (Predictor with $L ^ { 2 }$ -accurate score estimate, DDPM). Let $p _ { \mathrm { d a t a } } : \mathbb { R } ^ { d } \mathbb { R }$ be a probability density satisfying Assumption $^ { l }$ with $M _ { 2 } = O ( d )$ , and let $\widetilde { p } _ { t }$ be the distribution resulting from evolving the forward $S D E$ according to DDPM with $g \equiv 1$ e. Suppose furthermore that $\nabla \ln \widetilde { p } _ { t }$ is $L$ -Lipschitz for every $t \geq 0$ , and that each $s ( \cdot , t )$ satisfies Assumption 2. Then if
|
| 160 |
+
|
| 161 |
+
$$
|
| 162 |
+
\varepsilon = O \left( \frac { \varepsilon _ { \mathrm { T V } } ^ { 4 } } { ( C _ { \mathrm { L S } } + d ) C _ { \mathrm { L S } } ^ { 5 / 2 } ( L \vee L _ { s } ) ^ { 2 } ( \ln ( C _ { \mathrm { L S } } d ) \vee C _ { \mathrm { L S } } \ln ( 1 / \varepsilon _ { \mathrm { T V } } ^ { 2 } ) ) } \right) ,
|
| 163 |
+
$$
|
| 164 |
+
|
| 165 |
+
running (P) starting from $p _ { \mathrm { p r i o r } }$ for time $\begin{array} { r } { T = \Theta \left( \ln ( C _ { \mathrm { L S } } d ) \vee C _ { \mathrm { L S } } \ln \left( \frac { 1 } { \varepsilon _ { \mathrm { T V } } } \right) \right) } \end{array}$ and step size $h \ =$ $\begin{array} { r } { \Theta \left( \frac { \varepsilon _ { \mathrm { T V } } ^ { 2 } } { C _ { \mathrm { L S } } ( C _ { \mathrm { L S } } + d ) ( L \vee L _ { s } ) ^ { 2 } } \right) } \end{array}$ results in a distribution $q _ { T }$ so that $\mathrm { T V } ( q _ { T } , p _ { \mathrm { d a t a } } ) \leq \varepsilon _ { \mathrm { T V } } .$ .
|
| 166 |
+
|
| 167 |
+
A more precise statement of the Theorem can be found in the Appendix. Although we state our theorem for DDPM, we describe in Appendix C how it can be adapted to other SDE’s like SMLD and the sub-VP SDE; the primary SDE-dependent bound we need is a bound on $\begin{array} { r } { \nabla \ln \frac { \widetilde { p } _ { t } } { \widetilde { p } _ { t + h } } } \end{array}$ . Because the predictor is tracking a changing distribution $p _ { t }$ e, we incur more error terms and worse dependence on parameters $( C _ { \mathrm { L S } } , L )$ than in LMC (Theorem 2.1). Motivated by this, we intersperse the predictor steps with LMC steps—called corrector steps in this context—to give additional time for the process to mix, resulting in improved dependence on parameters.
|
| 168 |
+
|
| 169 |
+
Theorem 3.2 (Predictor-corrector with $L ^ { 2 }$ -accurate score estimate). Keep the setup of Theorem 3.1.
|
| 170 |
+
|
| 171 |
+
$$
|
| 172 |
+
\varepsilon = { \cal O } \left( \frac { \varepsilon _ { \mathrm { T V } } ^ { 4 } } { d L ^ { 2 } C _ { \mathrm { L S } } ^ { 5 / 2 } \ln ( 1 / \varepsilon _ { \chi } ^ { 2 } ) } \right) ,
|
| 173 |
+
$$
|
| 174 |
+
|
| 175 |
+
then Algorithm 2 with appropriate choices of $\begin{array} { r } { T = \Theta \left( \ln ( C _ { \mathrm { L S } } d ) \lor C _ { \mathrm { L S } } \log \left( \frac { 1 } { \varepsilon _ { \mathrm { T V } } } \right) \right) } \end{array}$ , $N _ { m }$ , corrector step sizes $h _ { m }$ and predictor step size $h$ , produces $a$ sample from a distribution $q _ { T }$ such that $\mathrm { T V } ( q _ { T } , p _ { \mathrm { d a t a } } ) < \varepsilon _ { \mathrm { T V } }$ .
|
| 176 |
+
|
| 177 |
+
<table><tr><td>INPUT: Time T, predictor step size h; number of corrector steps Nm per predictor step, corrector step sizeshm</td></tr><tr><td>Draw zo ~ Pprior from the prior distribution.</td></tr><tr><td></td></tr><tr><td>for m from1to T/h do (Predictor) Take a step of (P) to obtain Zmh from z(m-1)h, with f,g as in SMLD or DDPM.</td></tr><tr><td>(Corrector) Starting from 2mh,0 := 2mh, run (LMC-SE) with s(z,T - mh) and step size hm</td></tr><tr><td>for N steps,and let zmh ← zmh,N.</td></tr><tr><td>end for OUTPUT: Return zT,approximate sample from pdata·</td></tr></table>
|
| 178 |
+
|
| 179 |
+
The assumption on $\varepsilon _ { \mathrm { T V } }$ is for convenience in stating our bound. In comparison to using the predictor step alone (Theorem 3.1), note that in the bound on $\varepsilon$ , we obtain the improved rate of the corrector step as in Theorem 2.1; this is because the predictor step only needs to track the actual distribution in $\chi ^ { 2 }$ -divergence with error $O ( 1 )$ , and the final corrector steps are responsible for decreasing the error to $\varepsilon _ { \mathrm { T V } }$ . In comparison to the Annealed Langevin sampler (Algorithm 1, Theorem 2.2), which can be viewed as using the corrector step alone, adding a predictor step provides a better warm start for the distribution at the next smaller noise level, resulting in better dependence on parameters. Thus the predictor-corrector algorithm combines the strengths of the predictor and corrector steps. For realworld data, it can be challenging to estimate TV-distance between distributions given only samples, and hence difficult to check consistency with empirical observations. However, our claim that using a corrector can improve the convergence rate of DDPM/SMLD is consistent with the simulation results in Section 4.2 of $[ \mathrm { S o n } { + } 2 0 \mathrm { b } ]$ .
|
| 180 |
+
|
| 181 |
+
# 4 Theoretical framework and proof sketches
|
| 182 |
+
|
| 183 |
+
The main idea of our analysis framework is to convert a $L ^ { 2 }$ error guarantee to a $L ^ { \infty }$ error guarantee by excluding a bad set, formalized in the following theorem.
|
| 184 |
+
|
| 185 |
+
Theorem 4.1. Let $( \Omega , \mathcal { F } , \mathbb { P } )$ be a probability space and $\{ \mathcal { F } _ { n } \}$ be a filtration of the sigma field $\mathcal { F }$ Suppose $X _ { n } \sim p _ { n }$ , $Z _ { n } \sim q _ { n } ,$ , and $\overline { { Z } } _ { n } \sim \overline { { q } } _ { n }$ are ${ \mathcal { F } } _ { n }$ -adapted random processes taking values in $\Omega$ and $B _ { n } \subseteq \Omega$ are sets such that the following hold for every $n \in { \mathbb { N } } _ { 0 }$ .
|
| 186 |
+
|
| 187 |
+
2. $\chi ^ { 2 } ( \overline { { q } } _ { n } | | p _ { n } ) \leq D _ { n } ^ { 2 }$ .
|
| 188 |
+
|
| 189 |
+
3. $\mathbb { P } ( X _ { n } \in B _ { n } ) \le \delta _ { n }$
|
| 190 |
+
|
| 191 |
+
Then the following hold.
|
| 192 |
+
|
| 193 |
+
$$
|
| 194 |
+
\mathrm { T V } ( q _ { n } , \overline { { q } } _ { n } ) \leq \sum _ { k = 0 } ^ { n - 1 } ( D _ { k } ^ { 2 } + 1 ) ^ { 1 / 2 } \delta _ { k } ^ { 1 / 2 } \qquad \mathrm { T V } ( p _ { n } , q _ { n } ) \leq D _ { n } + \sum _ { k = 0 } ^ { n - 1 } ( D _ { k } ^ { 2 } + 1 ) ^ { 1 / 2 } \delta _ { k } ^ { 1 / 2 }
|
| 195 |
+
$$
|
| 196 |
+
|
| 197 |
+
For our setting, we will take the “bad sets” $B _ { n }$ to be the set of $x$ where $\| s _ { \theta } ( x ) - \nabla \ln p \|$ is large, $q _ { n }$ to be the discretized process with estimated score, and $\overline { { q } } _ { n }$ to be the discretized process with estimated score except in $B _ { n }$ where the error is large. Because $\overline { { q } } _ { n }$ uses an $L ^ { \infty }$ -accurate score estimate, we can use existing techniques for analyzing Langevin Monte Carlo [VW19; EHZ21; Che+21] to bound $\chi ^ { 2 } ( \overline { { q } } _ { n } | | p _ { n } ) \ :$ .
|
| 198 |
+
|
| 199 |
+
Proof. We bound using condition 1 and Cauchy-Schwarz:
|
| 200 |
+
|
| 201 |
+
$$
|
| 202 |
+
\begin{array} { r l } & { \displaystyle ^ { \mathfrak { n } } \big ( Z _ { n } \ne \overline { { Z } } _ { n } \big ) \le \mathbb { P } \left( \bigcup _ { k = 1 } ^ { n - 1 } \big \{ Z _ { k } \in B _ { k } \big \} \right) \le \sum _ { k = 0 } ^ { n - 1 } \mathbb { P } \left( Z _ { k } \in B _ { k } \right) = \sum _ { k = 0 } ^ { n - 1 } \mathbb { E } _ { q _ { k } } \mathbb { 1 } _ { B _ { k } } } \\ & { \qquad \le \displaystyle \sum _ { k = 0 } ^ { n - 1 } \left( \mathbb { E } _ { p _ { k } } \left( \frac { q _ { k } } { p _ { k } } \right) ^ { 2 } \right) ^ { 1 / 2 } ( \mathbb { E } _ { p _ { k } } \mathbb { 1 } _ { B _ { k } } ) ^ { 1 / 2 } = \sum _ { k = 0 } ^ { n - 1 } ( D _ { k } ^ { 2 } + 1 ) ^ { 1 / 2 } \delta _ { k } ^ { 1 } } \end{array}
|
| 203 |
+
$$
|
| 204 |
+
|
| 205 |
+
The second inequality then follows from the triangle inequality and Cauchy-Schwarz:
|
| 206 |
+
|
| 207 |
+
$$
|
| 208 |
+
\begin{array} { r l r } { { \mathrm { T V } ( p _ { n } , q _ { n } ) \leq \mathrm { T V } ( p _ { n } , \overline { { q } } _ { n } ) + \mathrm { T V } ( \overline { { q } } _ { n } , q _ { n } ) } } \\ & { } & \\ & { } & { \leq \sqrt { \chi ^ { 2 } ( \overline { { q } } _ { n } | | p _ { n } ) } + \mathrm { T V } ( \overline { { q } } _ { n } , q _ { n } ) \leq D _ { n } + \displaystyle \sum _ { k = 0 } ^ { n - 1 } ( D _ { k } ^ { 2 } + 1 ) ^ { 1 / 2 } \delta _ { k } ^ { 1 / 2 } . } \end{array}
|
| 209 |
+
$$
|
| 210 |
+
|
| 211 |
+
It now remains to give $\chi ^ { 2 }$ convergence bounds under $L ^ { \infty }$ -accurate score estimate. The following theorem may be of independent interest.
|
| 212 |
+
|
| 213 |
+
Theorem 4.2 (LMC under $L ^ { \infty }$ bound on gradient error). Let $p : \mathbb { R } ^ { d } \mathbb { R }$ be a probability density satisfying Assumption $I ( I , 2 )$ and $s : \mathbb { R } ^ { d } \mathbb { R } ^ { d }$ be a score estimate $s$ with error bounded in $L ^ { \infty }$ : for some ε1 ≤ q $\begin{array} { r } { \varepsilon _ { 1 } \leq \sqrt { \frac { 1 } { 4 8 C _ { \mathrm { L S } } } } } \end{array}$ ,
|
| 214 |
+
|
| 215 |
+
$$
|
| 216 |
+
\| \nabla \ln p - s \| _ { \infty } = \operatorname* { m a x } _ { x \in \mathbb { R } ^ { d } } \| \nabla \ln p ( x ) - s ( x ) \| \| \leq \varepsilon _ { 1 } .
|
| 217 |
+
$$
|
| 218 |
+
|
| 219 |
+
Let $N \in { \mathbb { N } } _ { 0 }$ and $\begin{array} { r } { 0 < h \leq \frac { 1 } { 4 3 9 2 d C _ { \mathrm { L S } } L ^ { 2 } } } \end{array}$ , and assume $L \geq 1$ . Let $q _ { n h }$ denote the nth iterate of LMC with step size $h$ score estimate s. Then
|
| 220 |
+
|
| 221 |
+
$$
|
| 222 |
+
\chi ^ { 2 } ( q _ { ( k + 1 ) h } | | p ) \leq \exp \left( - \frac { h } { 4 C _ { \mathrm { L S } } } \right) \chi ^ { 2 } ( q _ { k h } | | p ) + 1 7 0 d L ^ { 2 } h ^ { 2 } + 5 \varepsilon _ { 1 } ^ { 2 } h
|
| 223 |
+
$$
|
| 224 |
+
|
| 225 |
+
and
|
| 226 |
+
|
| 227 |
+
$$
|
| 228 |
+
{ \chi ^ { 2 } } ( q _ { N h } | | p ) \leq \exp \left( - \frac { N h } { 4 C _ { \mathrm { L S } } } \right) \chi ^ { 2 } ( q _ { 0 } | | p ) + 6 8 0 d L ^ { 2 } h C _ { \mathrm { L S } } + 2 0 \varepsilon _ { 1 } ^ { 2 } C _ { \mathrm { L S } } \leq \exp \left( - \frac { N h } { 4 C _ { \mathrm { L S } } } \right) \chi ^ { 2 } ( q _ { 0 } | | p ) + 1
|
| 229 |
+
$$
|
| 230 |
+
|
| 231 |
+
Following $[ \mathrm { C h e } + 2 1 ]$ , we prove this by first defining a continuous-time interpolation $q _ { t }$ of the discrete process, and then deriving a differential inequality for $\chi ^ { 2 } ( q _ { t } | | p )$ using the log-Sobolev inequality for $p$ . Compared to $[ \mathrm { C h e } + 2 1 ]$ , we incur an extra error term arising from the inaccurate gradient.
|
| 232 |
+
|
| 233 |
+
This allows us to sketch the proof of Theorem 2.1; a complete proof is in Section B.
|
| 234 |
+
|
| 235 |
+
Proof sketch of Theorem 2.1. We first define the bad set where the error in the score estimate is large,
|
| 236 |
+
|
| 237 |
+
$$
|
| 238 |
+
B : = \{ \| \nabla \ln p ( x ) - s ( x ) \| > \varepsilon _ { 1 } \}
|
| 239 |
+
$$
|
| 240 |
+
|
| 241 |
+
for some $\varepsilon _ { 1 }$ to be chosen. Then by Chebyshev’s inequality, $\begin{array} { r } { P ( B ) \leq \left( \frac { \varepsilon } { \varepsilon _ { 1 } } \right) ^ { 2 } = : \delta } \end{array}$ . Let $\overline { { q } } _ { n h }$ be the discretized process, but where the score estimate is set to be equal to $\nabla \ln p$ on $B$ ; note it agrees with $q _ { n h }$ as long as it has not hit $B$ . Because $\overline { { q } } _ { n h }$ uses a score estimate that has $L ^ { \infty }$ -error $\varepsilon _ { 1 }$ , Theorem 4.2 gives a bound for $\chi ^ { 2 } ( \overline { { q } } _ { N h } | | p )$ . Then Theorem 4.1 gives
|
| 242 |
+
|
| 243 |
+
$$
|
| 244 |
+
{ \operatorname { F V } } ( q _ { n h } , \overline { { q } } _ { n h } ) \le \sum _ { k = 0 } ^ { n - 1 } ( \chi ^ { 2 } ( \overline { { q } } _ { k h } \| p ) + 1 ) ^ { 1 / 2 } P ( B ) ^ { 1 / 2 } \le \sum _ { k = 0 } ^ { n - 1 } \left( \exp \left( - \frac { k h } { 8 C _ { \mathrm { L S } } } \right) \chi ^ { 2 } ( q _ { 0 } \| p ) ^ { 1 / 2 } + 1 \right) \delta ^ { 1 / 2 }
|
| 245 |
+
$$
|
| 246 |
+
|
| 247 |
+
The theorem then follows from choosing parameters so that χ2(qT ||p) ≤ ε2χ and TV(qT , qT ) ≤ $\varepsilon _ { \mathrm { T V } }$ .
|
| 248 |
+
|
| 249 |
+
We remark that the main inefficiency in the proof comes from the use of Chebyshev’s inequality, and a $L ^ { p }$ bound on the error for $p > 2$ will improve the bound.
|
| 250 |
+
|
| 251 |
+
Proof sketch of Theorem 2.2. Choosing the sequence $\sigma _ { 1 } < \cdots < \sigma _ { M }$ to be geometric with ratio $1 + \frac { 1 } { \sqrt { d } }$ ensures that the $\chi ^ { 2 }$ -divergence between successive distributions $p _ { \sigma _ { m } ^ { 2 } }$ is $O ( 1 )$ . Then, choosing $\sigma _ { M } ^ { 2 } = \Omega ( C _ { \mathrm { L S } } d )$ ensures we have a warm start for the highest noise level: $\chi ^ { 2 } ( \operatorname { \rho _ { p r i o r } } \lvert \lvert p _ { \sigma _ { M } ^ { 2 } } ) = O ( 1 )$ . This uses $\begin{array} { r } { O \left( \sqrt { d } \log \left( \frac { d C _ { \mathrm { L S } } } { \sigma _ { \mathrm { m i n } } ^ { 2 } } \right) \right) } \end{array}$ noise levels. Chebyshev’s inequality can be used to show that the distribution of the final sample $x ^ { ( m ) }$ for $p _ { \sigma _ { m } ^ { 2 } }$ is ${ \cal O } ( \varepsilon _ { \mathrm { T V } } / M )$ close to a distribution that is ${ \cal O } ( M / \varepsilon _ { \mathrm { T V } } )$ in in $\chi ^ { 2 }$ -divergence from Theorem 2.1 then $p _ { \sigma _ { m + 1 } ^ { 2 } }$ . This gives the warm st the required bound for rt parameter . Note that $K _ { \chi } = ( M / \varepsilon _ { \mathrm { T V } } ) ^ { 1 / 2 }$ ; substitutinged from each $\varepsilon$ level add to ${ \cal O } ( \varepsilon _ { \mathrm { T V } } )$ . □
|
| 252 |
+
|
| 253 |
+
To analyze the predictor-based algorithms, we also first prove convergence bounds under $L ^ { \infty }$ - accurate score estimate.
|
| 254 |
+
|
| 255 |
+
Theorem 4.3 (Predictor steps under $L ^ { \infty }$ bound on score estimate, DDPM). Let $p : \mathbb { R } ^ { d } \mathbb { R }$ be a probability density satisfying Assumption $I$ and $s ( \cdot , t ) : \mathbb { R } ^ { d } \to \mathbb { R } ^ { d }$ be a score estimate s with error bounded in $L ^ { \infty }$ for each $t \in [ 0 , T ]$ :
|
| 256 |
+
|
| 257 |
+
$$
|
| 258 |
+
\| \nabla \ln p - s ( \cdot , t ) \| _ { \infty } = \operatorname* { m a x } _ { x \in \mathbb { R } ^ { d } } \| \nabla \ln \widetilde { p } _ { t } ( x ) - s ( x , t ) \| \| \le \varepsilon _ { 1 } .
|
| 259 |
+
$$
|
| 260 |
+
|
| 261 |
+
Consider DDPM with $g \equiv 1$ , $T \geq 1 \vee \ln ( C _ { \mathrm { L S } } d ) ,$ , and $\begin{array} { r } { h = O \left( \frac { 1 } { C _ { \mathrm { L S } } ( d + C _ { \mathrm { L S } } ) ( L \vee L _ { s } ) ^ { 2 } } \right) } \end{array}$ . (Recall that $p _ { k h }$ and $q _ { k h }$ are the $k$ -th iterate of LMC with step size $h$ and true/estimated score respectively.) Then
|
| 262 |
+
|
| 263 |
+
$$
|
| 264 |
+
\chi ^ { 2 } ( q _ { ( k + 1 ) h } | | p _ { ( k + 1 ) h } ) \leq \chi ^ { 2 } ( q _ { k h } | | p _ { k h } ) e ^ { \left( - \frac { 1 } { 8 C _ { 1 S } } + 8 \varepsilon _ { 1 } ^ { 2 } \right) h } + O ( \varepsilon _ { 1 } ^ { 2 } h + ( L _ { s } ^ { 2 } + L ^ { 2 } d ) h ^ { 2 } )
|
| 265 |
+
$$
|
| 266 |
+
|
| 267 |
+
$\begin{array} { r } { \varepsilon _ { 1 } < \frac { 1 } { 1 2 8 C _ { \mathrm { L S } } } } \end{array}$
|
| 268 |
+
|
| 269 |
+
$$
|
| 270 |
+
\chi ^ { 2 } ( q _ { N h } | | p _ { N h } ) \leq e ^ { - \frac { N h } { 1 6 C _ { 1 S } } } \chi ^ { 2 } ( q _ { 0 } | | p _ { 0 } ) + O \left( C _ { \mathrm { L S } } \left( \varepsilon _ { 1 } ^ { 2 } + ( L _ { s } ^ { 2 } + L ^ { 2 } d ) h \right) \right) .
|
| 271 |
+
$$
|
| 272 |
+
|
| 273 |
+
Moreover, for $q _ { 0 } = p _ { \mathrm { p r i o r } } , \chi ^ { 2 } ( q _ { 0 } | | p _ { 0 } ) \leq e ^ { - T / 2 } C _ { \mathrm { L S } } d .$
|
| 274 |
+
|
| 275 |
+
We give a more precise statement in Section C. Note that unlike the case for LMC as in Theorem 4.2, the base density $p _ { t }$ is also evolving in time, which produces additional error terms and necessitates a more involved analysis. The additional error terms can be bounded using the Donsker-Varadhan variational principle, concentration for distributions satisfying LSI, and error bounds between $p _ { t }$ and $p _ { t + h }$ for small $h$ .
|
| 276 |
+
|
| 277 |
+
Here, we only state the result about DDPM, which has better bounds than SMLD (when $g \equiv 1$ ) because both the forward and backwards processes exhibit better mixing properties: the warm start improves exponentially rather than inversely with $T$ , and the log-Sobolev constant is uniformly bounded by that of $p _ { \mathrm { d a t a } }$ rather than increasing. However, the analysis in Section C can be directly applied to SMLD and other models as well. We also note there is a sense in which DDPM and SMLD are equivalent under a rescaling in time and space (see discussion in Section C.2).
|
| 278 |
+
|
| 279 |
+
Note that the choice of $h$ is necessary for exponential decay of error; as if $h$ is not small enough, we would get an exponential growing instead of decaying factor in the one-step error (See Section C for details). Such an $h$ may however still be a suitable choice when used in conjunction with a corrector step. Moreover, as $\varepsilon _ { 1 } \to 0$ , with appropriate choice of $T$ and $h$ , $q _ { N h }$ and $p _ { N h }$ can be made arbitrarily close.
|
| 280 |
+
|
| 281 |
+
Theorem 3.1 now follows from the $L ^ { \infty }$ result (Theorem 4.3) in the same way that Theorem 2.1 follows from Theorem 4.2.
|
| 282 |
+
|
| 283 |
+
To prove Theorem 3.2, it suffices to run the corrector steps only at the lowest noise level, that is, set $N _ { m } = 0$ for $1 \leq m < T / h$ , although we note that interleaving the predictor and corrector steps does empirically help with mixing. The proof follows from using the predictor and the corrector theorems in series: first apply Theorem 3.1 with $\varepsilon _ { \chi } = O ( 1 )$ to show that the predictor results a warm start $p _ { \mathrm { d a t a } }$ , then use Theorem 2.1 to show the corrector reduces the error to the desired $\varepsilon _ { \mathrm { T V } }$ .
|
| 284 |
+
|
| 285 |
+
# 5 Conclusion
|
| 286 |
+
|
| 287 |
+
We introduced a general framework to analyze SDE-based sampling algorithms given a $L ^ { 2 }$ -error score estimate, and used it to obtain the first convergence bounds for several score-based generative models with polynomial complexity in all parameters. Our analysis can potentially be adapted to other SDE’s and sampling algorithms beyond Langevin Monte Carlo. There is also room for improving our analysis to better use smoothing properties of the SDE’s and compare different choices of the diffusion speed $g$ .
|
| 288 |
+
|
| 289 |
+
We present several interesting further directions to explore. In addition to extending the analysis to other SGM’s and comparing their theoretical performance (relative to each other as well as other approaches to generative modeling), we propose the following.
|
| 290 |
+
|
| 291 |
+
Analysis for multimodal distributions. Our assumption of a bounded log-Sobolev constant essentially limits the analysis to distributions that are close to unimodal. However, SGM’s are empirically successful at modeling multimodal distributions [SE19], and in fact perform better with multimodal distributions than other approaches such as GAN’s. Can we analyze the convergence for simple multimodal distributions, such as a mixture of distributions each with bounded log-Sobolev constant? Positive results on sampling from multimodal distributions such as [GLR18] suggest this is possible, as the sequence of noised distributions is natural for annealing and tempering methods (see [GLR18, Remark 7.2]).
|
| 292 |
+
|
| 293 |
+
Weakening conditions on the score estimate. The assumption that we have a score estimate that is $O ( 1 )$ -accurate in $L ^ { 2 }$ , although weaker than the usual assumptions for theoretical analysis, is in fact still a strong condition in practice that seems unlikely to be satisfied (and difficult to check) when learning complex distributions such as distributions of images. What would a reasonable weaker condition be, and in what sense can we still obtain reasonable samples?
|
| 294 |
+
|
| 295 |
+
Guarantees for learning the score function. Our analysis assumes a $L ^ { 2 }$ -estimate of the score function is given, but the question remains of when we can find such an estimate. What natural conditions on distributions allow their score functions to be learned by a neural network? Various works have considered the representability of data distributions by diffusion-like processes [TR19], but the questions of optimization and generalization appear more challenging.
|
| 296 |
+
|
| 297 |
+
# Acknowledgements
|
| 298 |
+
|
| 299 |
+
We thank Andrej Risteski for helpful conversations. This work was done in part while $\mathrm { H L }$ was visiting the Simons Institute for the Theory of Computing. The work was supported in part by National Science Foundation via awards DMS-2012286 and CCF-1934964 (Duke Tripods).
|
| 300 |
+
|
| 301 |
+
# References
|
| 302 |
+
|
| 303 |
+
[ACB17] Martin Arjovsky, Soumith Chintala, and Leon Bottou. “Wasserstein generative ad- ´ versarial networks”. In: International conference on machine learning. PMLR. 2017, pp. 214–223.
|
| 304 |
+
[And82] Brian DO Anderson. “Reverse-time diffusion equation models”. In: Stochastic Processes and their Applications 12.3 (1982), pp. 313–326.
|
| 305 |
+
[BGL13] Dominique Bakry, Ivan Gentil, and Michel Ledoux. Analysis and geometry of Markov diffusion operators. Vol. 348. Springer Science & Business Media, 2013.
|
| 306 |
+
[BL02] Herm Jan Brascamp and Elliott H Lieb. “On extensions of the Brunn-Minkowski and Prekopa-Leindler theorems, including inequalities for log concave functions, and with ´ an application to the diffusion equation”. In: Inequalities. Springer, 2002, pp. 441–464.
|
| 307 |
+
[BMR20] Adam Block, Youssef Mroueh, and Alexander Rakhlin. “Generative modeling with denoising auto-encoders and Langevin sampling”. In: arXiv preprint arXiv:2002.00107 (2020).
|
| 308 |
+
[CB18] Xiang Cheng and Peter Bartlett. “Convergence of Langevin MCMC in KLdivergence”. In: Algorithmic Learning Theory. PMLR. 2018, pp. 186–211.
|
| 309 |
+
[Cha04] Djalil Chafa¨ı. “Entropies, convexity, and functional inequalities, On $\Phi$ -entropies and $\Phi$ -Sobolev inequalities”. In: Journal of Mathematics of Kyoto University 44.2 (2004), pp. 325–363.
|
| 310 |
+
[Che+18] Xiang Cheng, Niladri S Chatterji, Peter L Bartlett, and Michael I Jordan. “Underdamped Langevin MCMC: A non-asymptotic analysis”. In: Conference on learning theory. PMLR. 2018, pp. 300–323.
|
| 311 |
+
[Che+21] Sinho Chewi, Murat A Erdogdu, Mufan Bill Li, Ruoqi Shen, and Matthew Zhang. “Analysis of Langevin Monte Carlo from Poincare to Log-Sobolev”. In: ´ arXiv preprint arXiv:2112.12662 (2021).
|
| 312 |
+
[Dal17] Arnak S Dalalyan. “Theoretical guarantees for approximate sampling from smooth and log-concave densities”. In: Journal of the Royal Statistical Society: Series B (Statistical Methodology) 79.3 (2017), pp. 651–676.
|
| 313 |
+
[Dat+19] Sumanth Dathathri, Andrea Madotto, Janice Lan, Jane Hung, Eric Frank, Piero Molino, Jason Yosinski, and Rosanne Liu. “Plug and play language models: A simple approach to controlled text generation”. In: arXiv preprint arXiv:1912.02164 (2019).
|
| 314 |
+
[De $+ 2 1 ]$ 1 Valentin De Bortoli, James Thornton, Jeremy Heng, and Arnaud Doucet. “Diffusion Schrodinger bridge with applications to score-based generative modeling”. In: ¨ Advances in Neural Information Processing Systems 34 (2021).
|
| 315 |
+
[DK19] Arnak S Dalalyan and Avetik Karagulyan. “User-friendly guarantees for the Langevin Monte Carlo with inaccurate gradient”. In: Stochastic Processes and their Applications 129.12 (2019), pp. 5278–5311.
|
| 316 |
+
[DM17] Alain Durmus and Eric Moulines. “Nonasymptotic convergence analysis for the unadjusted Langevin algorithm”. In: The Annals of Applied Probability 27.3 (2017), pp. 1551–1587.
|
| 317 |
+
[DN21] Prafulla Dhariwal and Alexander Nichol. “Diffusion models beat gans on image synthesis”. In: Advances in Neural Information Processing Systems 34 (2021).
|
| 318 |
+
[DSB16] Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. “Density estimation using real nvp”. In: arXiv preprint arXiv:1605.08803 (2016).
|
| 319 |
+
[DVK21] Tim Dockhorn, Arash Vahdat, and Karsten Kreis. “Score-Based Generative Modeling with Critically-Damped Langevin Diffusion”. In: arXiv preprint arXiv:2112.07068 (2021).
|
| 320 |
+
[EHZ21] Murat A. Erdogdu, Rasa Hosseinzadeh, and Matthew S. Zhang. “Convergence of Langevin Monte Carlo in Chi-Squared and Renyi Divergence”. In: arXiv preprint arXiv:2007.11612 (2021).
|
| 321 |
+
[GLR18] Rong Ge, Holden Lee, and Andrej Risteski. “Beyond log-concavity: provable guarantees for sampling multi-modal distributions using simulated tempering langevin monte carlo”. In: Proceedings of the 32nd International Conference on Neural Information Processing Systems. 2018, pp. 7858–7867.
|
| 322 |
+
$[ \mathrm { G o o } { + } 1 4 ]$ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. “Generative adversarial nets”. In: Advances in neural information processing systems 27 (2014).
|
| 323 |
+
[Gra+19] Will Grathwohl, Kuan-Chieh Wang, Jorn-Henrik Jacobsen, David Duvenaud, Moham-¨ mad Norouzi, and Kevin Swersky. “Your classifier is secretly an energy based model and you should treat it like one”. In: arXiv preprint arXiv:1912.03263 (2019).
|
| 324 |
+
[Har04] Gilles Harge. “A convex/log-concave correlation inequality for Gaussian measure and ´ an application to abstract Wiener spaces”. In: Probability theory and related fields 130.3 (2004), pp. 415–440.
|
| 325 |
+
[HJA20] Jonathan Ho, Ajay Jain, and Pieter Abbeel. “Denoising diffusion probabilistic models”. In: Advances in Neural Information Processing Systems 33 (2020), pp. 6840–6851.
|
| 326 |
+
$[ \mathrm { J i n } \substack { + 2 2 } ]$ Bowen Jing, Gabriele Corso, Renato Berlinghieri, and Tommi Jaakkola. “Subspace Diffusion Generative Models”. In: arXiv preprint arXiv:2205.01490 (2022).
|
| 327 |
+
[KW19] Diederik P Kingma and Max Welling. “An introduction to variational autoencoders”. In: arXiv preprint arXiv:1906.02691 (2019).
|
| 328 |
+
[Lee+21] Holden Lee, Chirag Pabbaraju, Anish Sevekari, and Andrej Risteski. “Universal Approximation for Log-concave Distributions using Well-conditioned Normalizing Flows”. In: arXiv preprint arXiv:2107.02951 (2021).
|
| 329 |
+
[Men+21] 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.
|
| 330 |
+
[MMS20] Mateusz B Majka, Aleksandar Mijatovic, and Łukasz Szpruch. “Nonasymptotic ´ bounds for sampling algorithms without log-concavity”. In: The Annals of Applied Probability 30.4 (2020), pp. 1534–1581.
|
| 331 |
+
[SE19] 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.
|
| 332 |
+
[SE20] Yang Song and Stefano Ermon. “Improved techniques for training score-based generative models”. In: arXiv preprint arXiv:2006.09011 (2020).
|
| 333 |
+
$[ { \mathrm { S o h } } + 1 5 ]$ Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. “Deep unsupervised learning using nonequilibrium thermodynamics”. In: International Conference on Machine Learning. PMLR. 2015, pp. 2256–2265.
|
| 334 |
+
$[ \mathrm { S o n } { + } 2 0 \mathrm { a } ]$ Yang Song, Sahaj Garg, Jiaxin Shi, and Stefano Ermon. “Sliced score matching: A scalable approach to density and score estimation”. In: Uncertainty in Artificial Intelligence. PMLR. 2020, pp. 574–584.
|
| 335 |
+
$[ \mathrm { S o n } { + } 2 0 \mathrm { b } ]$ 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. 2020.
|
| 336 |
+
$[ \mathrm { S o n } { + } 2 1 \mathrm { a } ]$ Yang Song, Conor Durkan, Iain Murray, and Stefano Ermon. “Maximum likelihood training of score-based diffusion models”. In: Advances in Neural Information Processing Systems 34 (2021).
|
| 337 |
+
$[ \mathsf { S o n } { + } 2 1 \mathsf { b } ]$ Yang Song, Liyue Shen, Lei Xing, and Stefano Ermon. “Solving Inverse Problems in Medical Imaging with Score-Based Generative Models”. In: arXiv preprint arXiv:2111.08005 (2021).
|
| 338 |
+
[TR19] Belinda Tzen and Maxim Raginsky. “Theoretical guarantees for sampling and inference in generative models with latent diffusions”. In: Conference on Learning Theory. PMLR. 2019, pp. 3084–3114.
|
| 339 |
+
[VW19] Santosh Vempala and Andre Wibisono. “Rapid convergence of the unadjusted langevin algorithm: Isoperimetry suffices”. In: Advances in neural information processing systems 32 (2019), pp. 8094–8106.
|
| 340 |
+
[ZML16] Junbo Zhao, Michael Mathieu, and Yann LeCun. “Energy-based generative adversarial network”. In: arXiv preprint arXiv:1609.03126 (2016).
|
| 341 |
+
|
| 342 |
+
1. For all authors...
|
| 343 |
+
|
| 344 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 345 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 346 |
+
(c) Did you discuss any potential negative societal impacts of your work? [N/A]
|
| 347 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 348 |
+
|
| 349 |
+
2. If you are including theoretical results...
|
| 350 |
+
|
| 351 |
+
(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]
|
| 352 |
+
|
| 353 |
+
3. If you ran experiments...
|
| 354 |
+
|
| 355 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [N/A]
|
| 356 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [N/A]
|
| 357 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A]
|
| 358 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A]
|
| 359 |
+
|
| 360 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 361 |
+
|
| 362 |
+
(a) If your work uses existing assets, did you cite the creators? [N/A]
|
| 363 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 364 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 365 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 366 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 367 |
+
|
| 368 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 369 |
+
|
| 370 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 371 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 372 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/dz79MhQXWvg/dz79MhQXWvg.md
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Weakly supervised causal representation learning
|
| 2 |
+
|
| 3 |
+
Johann Brehmer∗ Qualcomm AI Research† jbrehmer@qti.qualcomm.com
|
| 4 |
+
|
| 5 |
+
Pim de Haan∗ Qualcomm AI Research† QUVA Lab, University of Amsterdam pim@qti.qualcomm.com
|
| 6 |
+
|
| 7 |
+
Phillip Lippe QUVA Lab, University of Amsterdam p.lippe@uva.nl
|
| 8 |
+
|
| 9 |
+
Taco Cohen Qualcomm AI Research† tacos@qti.qualcomm.com
|
| 10 |
+
|
| 11 |
+
# Abstract
|
| 12 |
+
|
| 13 |
+
Learning high-level causal representations together with a causal model from unstructured low-level data such as pixels is impossible from observational data alone. We prove under mild assumptions that this representation is however identifiable in a weakly supervised setting. This involves a dataset with paired samples before and after random, unknown interventions, but no further labels. We then introduce implicit latent causal models, variational autoencoders that represent causal variables and causal structure without having to optimize an explicit discrete graph structure. On simple image data, including a novel dataset of simulated robotic manipulation, we demonstrate that such models can reliably identify the causal structure and disentangle causal variables.
|
| 14 |
+
|
| 15 |
+
# 1 Introduction
|
| 16 |
+
|
| 17 |
+
The dynamics of many systems can be described in terms of some high-level variables and causal relations between them. Often, these causal variables are not known but only observed in some unstructured, low-level representation, such as the pixels of a camera feed. Learning the causal representations together with the causal structure between them is a challenging problem and may be important for instance for applications in robotics and autonomous driving [1]. Without prior assumptions on the data-generating process or supervision, it is impossible to uniquely identify the causal variables and their causal structure [2, 3].
|
| 18 |
+
|
| 19 |
+
In this work, we show that a weak form of supervision is sufficient to identify both the causal representations and the structural causal model between them. We consider a setting in which we have access to data pairs, representing the system before and after a randomly chosen, unknown intervention while preserving the noise. This may approximate the generative process of data collected from a video feed of an external agent or demonstrator interacting with a system. Neither labels on the intervention targets nor active control of the interventions are necessary for our identifiability theorem, making this setting useful for offline learning. We prove that with this form of weak supervision, and under certain assumptions (including that the interventions are stochastic and perfect and that all interventions occur in the dataset), latent causal models (LCMs)— structural causal models (SCMs) together with a decoder from the causal factors to the data space— are identifiable up to a relabelling and elementwise reparameterizations of the causal variables.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: We learn to represent pixels $x$ as causal variables $z$ . The bottom shows the effect of intervening on one variable. We prove that variables and causal model can be identified from samples $( x , { \tilde { x } } )$ .
|
| 23 |
+
|
| 24 |
+
We then discuss two practical methods for LCM inference. First, we define explicit latent causal models (ELCMs) as a variational autoencoder (VAE) [4] in which the causal variables are the latent variables and the prior is based on an SCM. While this approach works in simple problems, it can be finicky and is difficult to scale. We trace this to a major challenge in causal representation learning, namely that it is a chicken-and-egg problem: it can be difficult to learn the causal variables when the causal graph is not yet learned, and it is difficult to learn the graph without knowing the variables.
|
| 25 |
+
|
| 26 |
+
To overcome this optimization difficulty, we introduce a second model class: implicit latent causal models (ILCMs). These models can represent causal structure and variables without requiring an explicit, discrete graph representation, which makes gradient-based optimization easier. Nevertheless, these models still contain the causal structure implicitly, and we discuss two algorithms that can extract it after the model is trained. Finally, we demonstrate ILCMs on synthetic datasets, including the new CausalCircuit dataset of a robot arm interacting with a causally connected system of light switches. We show that these models can robustly learn the true causal variables and the causal structure from pixels.
|
| 27 |
+
|
| 28 |
+
# 2 Related work
|
| 29 |
+
|
| 30 |
+
Our work builds on the work of Locatello et al. [5] on disentangled representation learning. The authors introduce a similar weakly supervised setting where observations are collected before and after unknown interventions. In contrast to our work, however, they focus on disentangled representations, i. e. (conditionally) independent factors of variation with a trivial causal graph, which our work subsumes as a special case. Other relevant works on disentangled representation learning and (nonlinear) independent component analysis include Refs. [6–12].
|
| 31 |
+
|
| 32 |
+
The problem of causal representation learning has been gaining attention lately, see the recent review by Schölkopf et al. [1]. Lu et al. [13] learn causal representations by observing similar causal models in different environments. von Kügelgen et al. [14] use the weakly supervised setting to study selfsupervised learning, using a known but non-trivial causal graph between content and style factors. Lippe et al. [15] learn causal representations from time-series data from labelled interventions, assuming that causal effects are not instantaneous but can be temporally resolved. Yang et al. [16] propose to train a VAE with an SCM prior, but require the true causal variables as labels. Other relevant works include Refs. [17–21]. To the best of our knowledge, our work is the first to provide identifiability guarantees for arbitrary, unknown causal graphs in this weakly supervised setting.
|
| 33 |
+
|
| 34 |
+
# 3 Identifiability of latent causal models from weak supervision
|
| 35 |
+
|
| 36 |
+
In this section, we show theoretically that causal variables and causal mechanisms are identifiable from weak supervision. In Sec. 4 we will then demonstrate how we can learn causal models in practice by training a causally structured VAE.
|
| 37 |
+
|
| 38 |
+
# 3.1 Setup
|
| 39 |
+
|
| 40 |
+
We begin by defining latent causal models and the weakly supervised setting. Here, we only provide informal definitions and assume familiarity with common concepts from causality as introduced for instance in Ref. [22]. We provide a complete and precise treatment in Appendix A and discuss limitations of our setup and possible generalizations in Appendix B.
|
| 41 |
+
|
| 42 |
+
We describe the causal structure between latent variables as a Structural Causal Model (SCM). An SCM $\mathcal { C }$ describes the relation between causal variables $z _ { 1 } , \ldots , z _ { n }$ with domains $\mathcal { Z } _ { i }$ and noise variables $\epsilon _ { 1 } , \ldots , \epsilon _ { n }$ with domains $\mathcal { E } _ { i }$ along a directed acyclic graph (DAG) $\mathcal G ( \mathcal C )$ . Causal mechanisms $\begin{array} { r } { f _ { i } : \mathcal { E } _ { i } \times \prod _ { j \in \mathbf { p a } _ { i } } \mathcal { Z } _ { j } \to \mathcal { Z } _ { i } } \end{array}$ describe how the value of a causal variable is determined from the associated noise variables, as well as the values of its parents in the graph. Finally, an SCM includes a probability measure for the noise variables.
|
| 43 |
+
|
| 44 |
+
An SCM entails a unique solution s : $\mathcal { E } \mathcal { Z }$ defined by successively applying the causal mechanisms. We require the causal mechanisms to be pointwise diffeomorphic, that is, for any value of the parents $z _ { \mathbf { p a } _ { i } }$ we have that $f _ { i } ( \cdot ; z _ { \mathbf { p a } _ { i } } )$ is invertible, differentiable, and its inverse is differentiable.3 Then $s$ is also diffeomorphic and thus noise variables can be uniquely inferred from causal variables. This simplifies the weakly supervised distribution, as the only stochasticity comes from the noise variables and the intervention. The SCM also entails an observational distribution $p c ( z )$ (Markov with respect to the graph of the SCM), which is the pushforward of $p \varepsilon$ through the solution.
|
| 45 |
+
|
| 46 |
+
A perfect, stochastic intervention $( I , ( \bar { \tilde { f } } _ { i } ) _ { i \in I } )$ modifies an SCM by replacing for a subset of the causal variables, called the intervention target set $I \subset \{ 1 , . . . , n \}$ , the causal mechanism $f _ { i }$ with a new mechanism $\tilde { f } _ { i } : \mathcal { E } _ { i } \to \mathcal { Z } _ { i }$ , which does not depend on the parents. The intervened SCM has a new solution $\tilde { s } _ { I } : \mathcal { E } \to \mathcal { Z }$ . We call interventions atomic if the number of targeted variables is one or zero.
|
| 47 |
+
|
| 48 |
+

|
| 49 |
+
Figure 2: In LCM $\mathcal { M }$ , $z _ { i }$ denotes whether the $i$ -th stone from the front is standing. Intervening on the second variable, $z _ { 2 }$ , leads to $\tilde { z }$ . The decoder $g$ renders $z , \tilde { z }$ as images $x , { \tilde { x } }$ . LCM $\mathcal { M } ^ { \prime }$ has an equivalent representation in which $z _ { i } ^ { \prime }$ denotes whether the $i$ -th stone from the back has fallen. In Thm. 1, we prove that if and only if two causal models have the same pixel distribution $p ( x , { \tilde { x } } )$ , there exists an LCM isomorphism $\varphi$ : an element-wise reparameterization of the causal variables plus a permutation of the ordering that commutes with interventions and causal mechanisms.
|
| 50 |
+
|
| 51 |
+
We will reason about generative models in a data space $\mathcal { X }$ , in which the causal structure is latent. Also including a distribution of interventions (as in Ref. [23]), we define LCMs:
|
| 52 |
+
|
| 53 |
+
Definition 1 (Latent causal model (LCM)). A latent causal model $\mathcal { M } = \langle \mathcal { C } , \mathcal { X } , g , \mathcal { Z } , p _ { \mathcal { T } } \rangle$ consists of
|
| 54 |
+
|
| 55 |
+
• an acyclic SCM $\mathcal { C }$ , which is faithful (all independencies are encoded in its graph $I 2 4 J )$ , • an observation space $\mathcal { X }$ ,
|
| 56 |
+
• a decoder $g : { \mathcal { Z } } { \mathcal { X } }$ that is diffeomorphic onto its image,
|
| 57 |
+
• a set $\mathcal { T }$ of interventions on $\mathcal { C }$ , and
|
| 58 |
+
• a probability measure $p _ { \mathbb { Z } }$ over $\mathcal { T }$ .
|
| 59 |
+
|
| 60 |
+
We define two LCMs as equivalent if all of their components are equal up to a permutation of the causal variables and elementwise diffeomorphic reparameterizations of each variable, see Fig. 2.
|
| 61 |
+
|
| 62 |
+
Definition 2 (LCM isomorphism (informal)). Let $\begin{array} { r l r } { \mathcal { M } } & { { } = } & { \langle { \mathcal C } , { \mathcal X } , g , { \mathcal Z } , p _ { { \mathcal Z } } \rangle } \end{array}$ and $\begin{array} { r l } { \mathcal { M } ^ { \prime } } & { { } = } \end{array}$ $\langle { \mathcal { C } } ^ { \prime } , { \mathcal { X } } , { g } ^ { \prime } , { \mathcal { T } } ^ { \prime } , { p } _ { { \mathcal { T } } ^ { \prime } } ^ { \prime } \rangle$ be two LCMs with identical observation space. An LCM isomorphism between them is a graph isomorphism $\psi : \mathcal { G } ( \mathcal { C } ) \mathcal { G } ( \mathcal { C } ^ { \prime } )$ together with elementwise diffeomorphisms for noise and causal variables that tell us how to reparameterize them, such that the structure functions, noise distributions, decoder, intervention set, and intervention distribution of $\mathcal { M } ^ { \prime }$ are compatible with the corresponding elements of $\mathcal { M }$ reparameterized through the graph isomorphism and elementwise diffeomorphisms. $\mathcal { M }$ and $\mathcal { M } ^ { \prime }$ are equivalent, $\mathcal { M } \sim \mathcal { M } ^ { \prime }$ , if and only if there is an LCM isomorphism between them.
|
| 63 |
+
|
| 64 |
+
Following Locatello et al. [5], we define a generative process of pre- and post-interventional data:4
|
| 65 |
+
|
| 66 |
+
Definition 3 (Weakly supervised generative process). Consider an LCM $\mathcal { M }$ where the underlying SCM has continuous noise spaces $\mathcal { E } _ { i }$ , independent probabilities $p \varepsilon _ { i }$ , and admits a solution s. We define the weakly supervised generative process of data pairs $( x , \tilde { x } ) \sim p _ { \mathcal { M } } ^ { \chi } ( x , \tilde { x } )$ as follows:
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
\begin{array} { r l r l r l r l r l } { \epsilon \sim p \varepsilon , } & { } & & { \epsilon \sim p \varepsilon , } & { } & & { z = s ( \epsilon ) , } & { } & { x = g ( z ) , } \\ { I \sim p \tau , } & { } & & { \forall i \in I , \tilde { \epsilon } _ { i } \sim p _ { \tilde { \varepsilon } _ { i } } , } & { } & { \forall i \notin I , \tilde { \epsilon } _ { i } = \epsilon _ { i } , } & { } & { \tilde { z } = \tilde { s } _ { I } ( \tilde { \epsilon } ) , } & { } & { \tilde { x } = g ( \tilde { z } ) . } \end{array}
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
# 3.2 Identifiability result
|
| 73 |
+
|
| 74 |
+
The main theoretical result of this paper is that an LCM $\mathcal { M }$ can be identified from $p ( x , { \tilde { x } } )$ up to a relabeling and elementwise transformations of the causal variables:
|
| 75 |
+
|
| 76 |
+
Theorem 1 (Identifiability of $\mathbb { R }$ -valued LCMs from weak supervision). Let $\mathcal { M } = \langle \mathcal { C } , \mathcal { X } , g , \mathcal { Z } , p _ { \mathcal { T } } \rangle$ and $\mathcal { M } ^ { \prime } = \langle \mathcal { C } ^ { \prime } , \mathcal { X } , g ^ { \prime } , \mathcal { T } ^ { \prime } , \bar { p } _ { \mathcal { T } ^ { \prime } } ^ { \prime } \rangle$ be LCMs with the following properties:
|
| 77 |
+
|
| 78 |
+
• The LCMs have an identical observation space $\mathcal { X }$ .
|
| 79 |
+
• The SCMs $\mathcal { C }$ and $\scriptstyle { \mathcal { C } } ^ { \prime }$ both consist of $n$ real-valued endogeneous causal variables and corresponding exogenous noise variables, i. e. $\mathcal { E } _ { i } = \mathcal { Z } _ { i } = \mathcal { Z } _ { i } ^ { \prime } = \mathcal { E } _ { i } ^ { \prime } = \mathbb { R }$ .
|
| 80 |
+
• The intervention sets $\mathcal { T }$ and $\mathcal { T } ^ { \prime }$ consist of all atomic, perfect interventions, $\begin{array} { r l } { { \mathcal { Z } } } & { { } = } \end{array}$ $\{ \emptyset , \{ z _ { 0 } \} , \dots , \{ z _ { n } \} \}$ and similar for $\mathcal { T } ^ { \prime }$ .
|
| 81 |
+
• The intervention distribution $p \tau$ and $p _ { { \mathcal { T } } ^ { \prime } } ^ { \prime }$ have full support.
|
| 82 |
+
|
| 83 |
+
Then the following two statements are equivalent:
|
| 84 |
+
|
| 85 |
+
1. The LCMs entail equal weakly supervised distributions, $p _ { \mathcal { M } } ^ { \chi } ( x , \tilde { x } ) = p _ { \mathcal { M } ^ { \prime } } ^ { \chi } ( x , \tilde { x } ) $ .
|
| 86 |
+
2. The LCMs are equivalent in the sense of Def. 2, $\mathcal { M } \sim \mathcal { M } ^ { \prime }$ .
|
| 87 |
+
|
| 88 |
+
Let us summarize the key steps of our proof, which we provide in its entirety in Sec. A in the supplementary material. The direction $2 \Rightarrow 1$ follows from the definition of equivalence. The direction $1 \Rightarrow 2$ is proven constructively along the following steps:
|
| 89 |
+
|
| 90 |
+
1. We begin by defining a diffeomorphism $\varphi = g ^ { \prime - 1 } \circ g : \mathcal { Z } \ : \ : \mathcal { Z } ^ { \prime }$ and note that if $z , \tilde { z } \sim \overline { { p _ { \mathcal { C } } ^ { z } ( z , \tilde { z } ) } }$ , the weakly supervised distribution of causal variables of model $\mathcal { C }$ , then $\varphi ( z ) , \varphi ( \tilde { z } ) \sim p _ { \mathcal { C } ^ { \prime } } ^ { \mathcal { Z } ^ { \prime } } ( z ^ { \prime } , \tilde { z } ^ { \prime } )$ . The distribution over $z , \tilde { z }$ is a mixture, where each intervention target $I$ gives a mixture component; each component is supported on a different $( n + 1 )$ - dimensional submanifold. Therefore, there exists a bijection between the components $\psi : [ n ] [ n ]$ that maps intervention targets $I$ in $\mathcal { M }$ to intervention targets $I ^ { \prime } = \bar { \psi } ( I )$ in $\mathcal { M } ^ { \prime }$ . Furthermore, because the joint distribution $z , \tilde { z }$ is preserved by $\varphi$ , first mapping with $\varphi$ , then intervening, $\mathcal { Z } \stackrel { \varphi } { \to } \mathcal { Z } ^ { \prime } \stackrel { I ^ { \prime } } { \to } \widetilde { \mathcal { Z } } ^ { \prime }$ , equals $\mathcal { Z } \stackrel { I } { \to } \widetilde { \mathcal { Z } } \stackrel { \varphi } { \to } \widetilde { \mathcal { Z } } ^ { \prime }$ .
|
| 91 |
+
|
| 92 |
+
2. Because $I = \{ i \}$ is a perfect intervention, for the map $\mathcal { Z } \stackrel { \varphi } { } \mathcal { Z } ^ { \prime } \stackrel { I ^ { \prime } } { } \widetilde { \mathcal { Z } } ^ { \prime } ,$ $\tilde { z } _ { i ^ { \prime } } ^ { \prime }$ is independent of $z ^ { \prime }$ . Thus, in both maps, $\tilde { z } _ { i ^ { \prime } } ^ { \prime }$ is independent of $z$ . This means that for the path through $\widetilde { z }$ , the intervention sample $\tilde { z } _ { i }$ is transformed into $\tilde { z } _ { i ^ { \prime } } ^ { \prime }$ independently of $z$ . For $\mathbb { R }$ -valued variables, this statistical independence implies that the transformation is constant in $z$ , and thus $\varphi ( z ) _ { i ^ { \prime } }$ is constant in $z _ { j }$ for $j \neq i$ . $\varphi$ is therefore an elementwise reparametrization.
|
| 93 |
+
|
| 94 |
+
3. Using this, we can show that $\psi$ is a causal graph isomorphism and that it is compatible with the causal mechanisms. This proves LCM equivalence $\mathcal { M } \sim \mathcal { M } ^ { \prime }$ .
|
| 95 |
+
|
| 96 |
+
# 4 Practical latent causal models
|
| 97 |
+
|
| 98 |
+
Theorem 1 means that it is possible to learn causal structure from pixel-level data in the weakly supervised setting. Consider a system that is described by an unknown true LCM and assume that we have access to data pairs $( x , { \tilde { x } } )$ sampled from its probability density. Then we can train another LCM with learnable components by maximum likelihood. Assuming sufficient data and perfect optimization, this model’s density will match that of the ground-truth LCM. Our identifiability result guarantees that the trained LCM then has the same causal variables and causal structure as the ground truth, up to relabelling.
|
| 99 |
+
|
| 100 |
+
In the following, we describe two neural LCM implementations that can be trained on data.
|
| 101 |
+
|
| 102 |
+

|
| 103 |
+
Figure 3: ILCM architecture. Pre- and post-intervention data (left) are encoded to noise encodings and intervention targets, which are then decoded back to the data space. To compute the prior probability density, the noise encodings are transformed into causal variables with the neural solution function.
|
| 104 |
+
|
| 105 |
+
# 4.1 Explicit latent causal models (ELCMs)
|
| 106 |
+
|
| 107 |
+
To implement LCMs with neural networks, we use the variational autoencoder (VAE) framework [4]. We first consider an approach where the causal variables $( z , \tilde { z } )$ are the latent variables. Data $( x , { \tilde { x } } )$ and latents $( z , \tilde { z } )$ are linked by a stochastic encoder $q ( z | x )$ and decoder $p ( x | z )$ ; unlike the deterministic decoder from Sec. 3 this allows us to map high-dimensional data spaces (like images) to low-dimensional causal variables. The causal structure is encoded in the prior $p ( z , \tilde { z } )$ and consists of a learnable causal graph and learnable causal mechanisms $f _ { i }$ . The first contribution to the prior density is the observational probability density $p ( z )$ , which factorizes according to the causal graph into components $p \big ( z _ { i } | z _ { \mathbf { p a } _ { i } } \big )$ , which are given by fixed base densities and the causal mechanisms. The second contribution is the interventional conditional density $p ( \tilde { z } | z )$ , which is also computable from the graph and causal mechanisms. The model can be trained on the ELBO loss, a variational bound on $- \log p ( x , \tilde { x } )$ . For more details, see Appendix E.
|
| 108 |
+
|
| 109 |
+
We call this an explicit latent causal model (ELCM), as the model directly parameterizes all components of an LCM. In particular, ELCMs contain an explicit representation of the causal graph and causal mechanisms. The graph can be learned by an exhaustive search over all DAGs or through a differentiable DAG parameterization [26–29] and gradient descent.
|
| 110 |
+
|
| 111 |
+
In our experiments with ELCMs, which we describe in Appendix E, we find that optimally trained ELCMs indeed correctly identify the causal structure and disentangle causal variables on simple datasets. However, jointly learning explicit graph and variable representations presents a challenging optimization problem. In particular, we observe that the loss landscape has local minima corresponding to wrong graph configurations.
|
| 112 |
+
|
| 113 |
+
# 4.2 Implicit latent causal models (ILCMs)
|
| 114 |
+
|
| 115 |
+
To enable causal representation learning in a more robust, scalable way, we propose a second LCM implementation: Implicit Latent Causal Models (ILCMs). Like ELCMs, ILCMs are also variational autoencoders with a causally structured prior. The key difference is that ILCMs represent the causal structure through neural solution functions $s ( e )$ . Under our assumption of diffeomorphic causal mechanisms, the solution function—which maps the vector of noise variables to the causal variables— contains the same information as the causal graph and causal mechanisms that we parameterize with neural networks in ELCMs (see Appendix C). However, unlike ELCMs, this parameterization does not require an explicit graph parameterization. In practice, ILCMs are thus easier to train than ELCMs.
|
| 116 |
+
|
| 117 |
+
Latents The latent variables in an ILCMs are noise encodings, defined through the inverse solution function as $e = s ^ { - 1 } ( z )$ and $\tilde { e } = s ^ { - 1 } ( \tilde { z } )$ . The pre-intervention noise encoding $e$ is identical to the SCM noise variables. The post-intervention noise encoding $\tilde { e }$ corresponds to the value of the SCM noise variables that would have generated the post-intervention causal variables $\tilde { z }$ under the unintervened SCM mechanisms. ILCMs contain a stochastic encoder $q ( e | x )$ and decoder $p ( x | e )$ that map data $( x , { \tilde { x } } )$ to noise encodings $( e , \tilde { e } )$ .
|
| 118 |
+
|
| 119 |
+
Noise encodings have the convenient property that under an intervention with intervention targets $I$ , precisely the components $e _ { I }$ change value: $e _ { i } \neq \tilde { e } _ { i } \Leftrightarrow i \in I$ with probability 1. We prove this property in Appendix A. This means that from noise encodings $e , \tilde { e }$ , we can infer interventions easily. We use a simple heuristic intervention encoder that assigns higher intervention probability $q ( i \in I | x , \tilde { x } )$ to a component $i$ the more this component of the noise encoding changes under interventions:
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\begin{array} { r } { \log q ( i \in I | x , \tilde { x } ) \sim h \big ( \mu _ { e } ( x ) _ { i } - \mu _ { e } ( \tilde { x } ) _ { i } \big ) , } \end{array}
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
where $\mu _ { e } ( x )$ is the mean function of the noise encoder $q ( e | x )$ and $h$ is a quadratic function with learnable parameters. Both the equality pattern of $e$ under interventions and this heuristic intervention encoder are similar to the ones used for disentangled representation learning in Ref. [5].
|
| 126 |
+
|
| 127 |
+
Prior Given encoders for noise encodings and intervention targets, let us now write down the prior $\boldsymbol { p } ( \boldsymbol { e } , \tilde { e } , I )$ , which encodes the structure of the weakly supervised setting. The intervention-target prior $p ( I )$ and the pre-intervention noise distribution $p ( e )$ are given by simple base densities, which we choose as uniform categorical and standard Gaussian, respectively. The post-intervention noise encodings $\tilde { e }$ follow the conditional probability distribution
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
p ( \widetilde e | e , I ) = \prod _ { i \notin I } \delta ( \widetilde e _ { i } - e _ { i } ) \prod _ { i \in I } p ( \widetilde e _ { i } | e ) = \prod _ { i \notin I } \delta ( \widetilde e _ { i } - e _ { i } ) \prod _ { i \in I } \widetilde p ( \bar { z } _ { i } ) \left| \frac { \partial \bar { z } _ { i } } { \partial \widetilde e _ { i } } \right| , \quad \bar { z } _ { i } = \bar { s } _ { i } ( \widetilde e _ { i } ; e _ { \backslash i } ) .
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
In the second equality we have parameterized the conditional density $p ( \tilde { e } _ { i } | e )$ with a conditional normalizing flow consisting of a learnable diffeomorphic transformation $\tilde { e } _ { i } \mapsto \bar { z } _ { i } = \bar { s } _ { i } ( \tilde { e } _ { i } ; e _ { \backslash i } )$ and a base density $\tilde { p }$ on $\bar { z } _ { i }$ , which we choose as standard Gaussian.
|
| 134 |
+
|
| 135 |
+
How does this prior encode causal structure? We rely on three key properties of SCMs, shown in Appendix A: 1) the noise variables $e _ { i }$ are independent of each other; 2) upon intervening on variable $i$ , the post-intervention causal variable $\tilde { z } _ { i }$ are independent of all $e _ { j }$ ; 3) while for the other variables $j \neq i$ , the noise encodings are unchanged $\tilde { e } _ { j } = e _ { j }$ . These three properties are ensured in the ILCM prior in Eq. (3). We show in Appendix C that therefore each ILCM is equivalent to a unique ELCM. For each variable $i$ , the ILCM function $\bar { s } _ { i }$ is equal to the solution function $s _ { i }$ of the equivalent ELCM, which maps from noise variables to causal variable $z _ { i }$ .
|
| 136 |
+
|
| 137 |
+
Thus, by learning to transform $\tilde { e } _ { i }$ into $\tilde { z } _ { i } = \bar { s } ( \tilde { e } _ { i } ; e )$ in the ILCM, we learn the solution function of the corresponding ELCM. This implicitly describes both the causal graph and the causal mechanisms $f _ { i }$ . We can thus learn a causal model without ever explicitly modelling a graph.5
|
| 138 |
+
|
| 139 |
+
The final question is how to implement the first terms in Eq. (3), which encode that those noise encodings that are not part of the intervention targets $I$ should not change value under the intervention. We enforce this in the encoder by setting the non-intervention components of $e$ and $\tilde { e }$ to the same value [similar to 5]. In Appendix $\textrm { C }$ this procedure is described in more detail. We will refer to this projective noise encoder as $q ( e , \tilde { e } | x , \tilde { x } , I )$ .
|
| 140 |
+
|
| 141 |
+
Learning Putting everything together, an ILCM consists of an intervention encoder $q ( I | x , \tilde { x } )$ , a noise encoder $q ( e , \tilde { e } | x , \tilde { x } , I )$ , a noise decoder $p ( x | e )$ , and transformations / solution functions $s _ { i } ( \cdot ; e )$ , see Fig. 3. All of these components are implemented with neural networks and learnable, see Appendix $\textrm { C }$ for details. The lower bound on the joint log likelihood of pre-intervention and postintervention data is given by
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
\begin{array} { r l } & { \log p ( x , \tilde { x } ) \geq \mathbb { E } _ { I \sim q ( I | x , \tilde { x } ) } \mathbb { E } _ { e , \tilde { e } \sim q ( e , \tilde { e } | x , \tilde { x } , I ) } \left[ \log p ( I ) + \log p ( e ) + \log p ( \tilde { e } | e , I ) \right. } \\ & { ~ \qquad \left. - \log q ( I | x , \tilde { x } ) - \log q ( e , \tilde { e } | x , \tilde { x } , I ) + \log p ( x | e ) + \log p ( \tilde { x } | \tilde { e } ) \right] . } \end{array}
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
The model is trained by minimizing the corresponding VAE loss, learning to map low-level data to noise variables (with $q$ ) and to map noise variables to causal variables (with $s$ ). The expectation over $I$ is computed via summation, but could alternatively be done with sampling.
|
| 148 |
+
|
| 149 |
+
In practice, we find it beneficial to add a regularization term to the loss that disincentivizes collapse to a lower-dimensional submanifold of the latent space. For each batch of training data, we compute the batch-aggregate intervention posterior $q _ { I } ( I ) \stackrel { - } { = } \mathbb { E } _ { x , \tilde { x } \in \mathrm { b a t c h } } [ q ( I | x , \tilde { x } ) ]$ . To the beta-VAE loss we then add the negative entropy of this distribution, weighted with a hyperparameter.
|
| 150 |
+
|
| 151 |
+
Downstream tasks Despite the implicit representation of causal structure, we argue that ILCMs let us solve various tasks:
|
| 152 |
+
|
| 153 |
+
• Causal representation learning / disentanglement: ILCMs allow us to map low-level data $x$ to causal variables $z$ by applying the encoder $q$ followed by the solution functions $s$ .
|
| 154 |
+
• Intervention inference: It is also straightforward to infer intervention targets from an observed pair $( x , { \tilde { x } } )$ of pre-intervention and post-intervention data, as this just requires evaluating the intervention-target encoder $q _ { I } ( x , \tilde { x } )$ .
|
| 155 |
+
• Causal discovery / identification: We propose two methods to infer the causal graphs after training an ILCM. One is to use an off-the-shelf method for causal discovery on the learned representations. Since the ILCM allows us to infer intervention targets, we can use intervention-based algorithms. In this paper, we use ENCO [28], a recent differentiable causal discovery method that exploits interventions to obtain acyclic graphs without requiring constrained optimization. Alternatives to ENCO include DCDI [27] and GIES [30]. Alternatively, we can analyze the causal structure implicitly represented in the learned solution functions $s _ { i }$ . We propose a heuristic algorithm that proceeds in three steps. First, it infers the topological order by sorting variables such that $s _ { i }$ only depends on $e _ { j }$ if $z _ { i }$ is after $z _ { j }$ in the topological order. It then iteratively rewrites the solution functions such that they only depend on ancestors in the topological order. Finally, it determines which causal ancestors are direct parents by testing the functional dependence of the causal mechanisms. We describe this algorithm in more detail in Appendix C. Generation of interventions and counterfactuals: The ILCM entails a generative model for pairs of pre- and post-intervention data. It is straightforward to sample from the joint distribution $p ( x , \tilde { x } , I )$ , from the conditional $p ( x , \tilde { x } | I )$ , or from the conditional $p ( \tilde { x } | x , \bar { I } )$ .
|
| 156 |
+
|
| 157 |
+
# 5 Experiments
|
| 158 |
+
|
| 159 |
+
Finally, we demonstrate latent causal models in practice. Here we focus on implicit LCMs; explicit LCMs are demonstrated in similar experiments in Appendix E. We evaluate the causal graphs learned by the ILCM models either with ENCO (ILCM-E) or with the heuristic algorithm described above (ILCM-H).
|
| 160 |
+
|
| 161 |
+
Baselines Since we are to the best of our knowledge the first to study causal representation learning in this weakly supervised setting, we are not aware of any baseline methods designed for this task. We nevertheless compare ILCMs to three other methods. First, we define a disentanglement VAE that models the weakly supervised process, but assumes independent factors of variation rather than a non-trivial causal structure between the variables. This baseline is similar to the method proposed by Ref. [5], but it differs in some implementation details to be more comparable to our ILCM setup. We infer the causal graph between the learned representations with ENCO (dVAE-E). We also compare to an unstructured $\beta$ -VAE that treats $x$ and $\tilde { x }$ as i. i. d. and uses a standard Gaussian prior. Finally, for the pixel-level data, we consider a slot attention model [31], which segments the image unsupervisedly into as many objects as there are causal variables. The latent representation associated to each object is considered a learned causal variable.
|
| 162 |
+
|
| 163 |
+
# 5.1 2D toy experiment
|
| 164 |
+
|
| 165 |
+
We first demonstrate LCMs in a pedagogical toy experiment with $\mathcal { X } = \mathcal { Z } = \mathbb { R } ^ { 2 }$ . Training data is generated from a nonlinear SCM with the graph $z _ { 1 } z _ { 2 }$ and mapped to the data space through a randomly initialized normalizing flow.
|
| 166 |
+
|
| 167 |
+
An ILCM trained in the weakly supervised setting is able to reconstruct the causal factors accurately up to elementwise reparameterizations, as shown in Fig. 4. In Tbl. 1 we quantify the quality of the learned representations with the DCI disentanglement score [32]. We find that our LCM is able to disentangle the causal factors almost perfectly, while the baselines, which assume independent factors of variation, fail as expected. Both the ILCM and the dVAE baseline infer the intervention targets with high accuracy. Finally, we test the quality of the learned causal graphs. We infer the implicit graph with ENCO and the heuristic algorithm discussed above. In both cases, the learned causal graph is identical to the correct one, whereas the representations found by the dVAE baseline induce a wrong graph.
|
| 168 |
+
|
| 169 |
+

|
| 170 |
+
Figure 4: 2D toy data with graph $z _ { 1 } ^ { * } \to z _ { 2 } ^ { * }$ . The grey grids show the map between true causal factors, data, and latent causal factors learned by the LCM. The mint dots indicate the observational data distribution, the arrows from $z$ to $\tilde { z }$ show interventions targeting $z _ { 1 } ^ { * }$ (red) or $z _ { 2 } ^ { * }$ (blue). The fact that axis-aligned lines in the true latent space are mapped to axis-aligned lines in the learned latent space implies that the disentanglement succeeded.
|
| 171 |
+
|
| 172 |
+
# 5.2 Causal3DIdent
|
| 173 |
+
|
| 174 |
+
We then turn to pixel-level data and more complex causal graphs. We test ILCMs on an adaptation of the Causal3DIdent dataset [14], which contains images of three-dimensional objects under variable positions and lighting conditions. We consider three causal variables representing object hue, the spotlight hue, and the position of the spotlight. We construct six versions of this dataset, each with a different causal graph, randomly initialized nonlinear structure functions, and heteroskedastic noise. These are mapped to images with a resolution of $6 4 \times 6 4$ see Fig. 5 for examples.
|
| 175 |
+
|
| 176 |
+
ILCMs are again able to disentangle the causal variables reliably. The results in Tbl. 1 show that the learned representations are more disentangled than those learned by methods that do not account for causal structure. The LCM as well as the dVAE baseline can infer interventions with almost perfect accuracy. We demonstrate this in Fig. 5 by comparing true and inferred interventions, see Sec. D.3 of the supplementary material for details. The ILCMs also learn the causal graphs accurately, while the acausal dVAE-E baseline does in most cases not find the correct causal graphs.
|
| 177 |
+
|
| 178 |
+

|
| 179 |
+
Figure 5: Causal3DIdent before (top) and after (middle) interventions, and post-intervention samples generated from the ILCM under the intervention inferred from the data (bottom), indicating we correctly learned to intervene.
|
| 180 |
+
|
| 181 |
+
# 5.3 CausalCircuit
|
| 182 |
+
|
| 183 |
+
While Causal3DIdent provides a good test of the ability to disentangle features that materialize in pixel space in different ways, like through the position of lights and the color of objects, the underlying causal structure we imposed may feel rather ad-hoc. To explore causal representation learning in a more intuitively causal setting, we introduce a new dataset, which we call CausalCircuit.
|
| 184 |
+
|
| 185 |
+

|
| 186 |
+
Figure 6: Varying learned causal factors vs. intervening on them. With a trained ILCM, we encode a single test image (left column). In the top row, we then vary the latent $z _ { 1 }$ independently, without computing causal effects, and show the corresponding reconstructed images. Only the robot arm position changes, highlighting that we learned a disentangled representation. In the bottom row we instead intervene on $z _ { 1 }$ and observe the causal effects: the robot arm may activate lights, which in turn can affect other lights in the circuit.
|
| 187 |
+
|
| 188 |
+
The CausalCircuit system consists of a robot arm that can interact with multiple touch-sensitive lights. The lights are connected with a stochastic circuit: a light is more likely to be on if its button is pressed or if its parent lights are on. The robot arm itself can be seen as part of the causal system. Concretely, we consider the causal graph shown in Fig. 7. This system is observed from a fixed-position camera, and we generate samples in $5 1 2 \times 5 1 2 \times 3$ resolution with MuJoCo [33], see Sec. D.4 of the supplementary material for more details.
|
| 189 |
+
|
| 190 |
+

|
| 191 |
+
Figure 7: Causal graph of the CausalCircuit dataset.
|
| 192 |
+
|
| 193 |
+
ILCMs are again able to disentangle the causal variables reliably and better than the acausal baselines, see Tbl. 1. As shown in Appendix D, the slot attention model fails because the lights have no limited spatial extent and thus are not well represented by segments of the image. Interventions are identified with high accuracy. ILCMs also correctly learn the causal graph shown in Fig. 6, both when extracted with ENCO and with our heuristic algorithm. In Fig. 6 we demonstrate how ILCMs let us infer and manipulate causal factors and reason about interventions.
|
| 194 |
+
|
| 195 |
+
By studying variations of this dataset, we tested the limitations of our method. We find that it works reliably only as long as the causal variables are continuous (that is, when we model the lights with a continuous intensity). As soon as we consider discrete states, the assumptions of our identifiability theorem are violated and the model has difficulty disentangling these variables.
|
| 196 |
+
|
| 197 |
+
# 5.4 Scaling with graph size
|
| 198 |
+
|
| 199 |
+
Finally, we study how LCMs scale with the size of the causal system. We generate simple synthetic datasets with $\mathcal { X } = \mathcal { Z } = \mathbb { R } ^ { n }$ . For each dimension $n$ , we generate three datasets, using linear SCMs with random DAGs, in which each edge in a fixed topological order is sampled from a Bernoulli distribution with probability 0.5. The causal variables are mapped to the data space through a randomly sampled $S O ( n )$ rotation.
|
| 200 |
+
|
| 201 |
+
We find that ILCMs are able to reliably disentangle the causal variables in systems with up to approximately 10 causal variables, see Fig. 8. In this regime, the true causal graphs are also identified with good accuracy, see Sec. D.5 of the supplementary material. In larger causal systems, both disentanglement and graph accuracy become worse; more work is required to improve the scaling of our approach to causal representation learning.
|
| 202 |
+
|
| 203 |
+

|
| 204 |
+
Figure 8: Scaling with graph size. LCMs disentangle causal variables robustly in simple systems with up to $\sim 1 0$ causal variables.
|
| 205 |
+
|
| 206 |
+
# 6 Discussion
|
| 207 |
+
|
| 208 |
+
What makes a variable causal? One school of thought is that it that causal variables are those aspects of a system that can be intervened upon [34]. Following this logic, we find it interesting to ask: can we uniquely determine the causal variables underlying a system just by observing the effect of interventions?
|
| 209 |
+
|
| 210 |
+
In this work we have found a partial answer to this question: we have shown in theory and practice that under certain assumptions, causal variables and their causal structure are identifiable from low-level representations like the pixels of a camera feed if the system is observed before and after random, unlabeled interventions. Our identifiability theorem extends the results by Locatello et al. [5] from independent factors of variation (trivial causal graphs) to arbitrary causal graphs.
|
| 211 |
+
|
| 212 |
+
Latent causal structure can be described in a variational autoencoder setup. However, a straightforward, explicit parameterization of the causal structure requires simultaneously learning the variables and the causal graph. We found that leads to challenging optimization problems, especially when scaling to larger systems. As a
|
| 213 |
+
|
| 214 |
+
Table 1: Experiment results. We compare our ILCM-E (using ENCO for graph inference) and ILCM-H (with a heuristic for graph inference) to disentanglement VAE (dVAE-E), unstructured $\beta$ - VAE, and slot attention baselines. We show the DCI disentanglement score $( D )$ , the accuracy of intervention inference (Acc), and structural Hamming distance (SHD) between learned and true graph. Best results in bold.
|
| 215 |
+
|
| 216 |
+
<table><tr><td>Dataset</td><td>Method</td><td>D</td><td>Acc</td><td>SHD</td></tr><tr><td>2D toy data</td><td>ILCM-E (ours) ILCM-H (ours) dVAE-E β-VAE</td><td>0.99 0.99 0.35 0.52</td><td>0.96 0.96 0.96 1</td><td>0.00 0.00 1.00 1</td></tr><tr><td>Causal3DIdent</td><td>ILCM-E (ours) ILCM-H (ours) dVAE-E ��-VAE Slot attention</td><td>0.99 0.99 0.82 0.66 0.60</td><td>0.98 0.98 0.98 1 1</td><td>0.00 0.17 1.67 1 1</td></tr><tr><td>CausalCircuit</td><td>ILCM-E (ours) ILCM-H (ours) dVAE-E β-VAE Slot attention</td><td>0.97 0.97 0.34 0.39 0.38</td><td>1.00 1.00 1.00 / 1</td><td>0.00 0.00 5.00</td></tr></table>
|
| 217 |
+
|
| 218 |
+
more robust alternative, we introduced implicit latent causal models (ILCMs), which parameterize causal structure without requiring an explicit graph representation. We also discussed two algorithms for extracting the learned causal mechanisms and graph after training.
|
| 219 |
+
|
| 220 |
+
In first experiments, we demonstrated that ILCMs let us reliably disentangle causal factors, identify causal graphs, and infer interventions from unstructured pixel data. For these experiments, we introduced the new CausalCircuit dataset, which consists of images of a robot arm interacting with connected switches and lights.
|
| 221 |
+
|
| 222 |
+
The setting we consider is motivated by a potentially useful scenario: learning causal structure from passive observations of an agent (or demonstrator) interacting with a causal system. However, it is currently far from practical. Our identifiability result relies on a number of assumptions, including that interventions are stochastic and perfect, that all atomic interventions may be observed, and that the causal variables are real-valued. In addition, realistic temporal sequence data are not likely to exactly correspond to a causal system before and after an intervention (while preserving the noise variables); whether our causal abstraction provides a useful approximation remains to be tested. We discuss these requirements and their potential relaxation in Appendix B. Similarly, our practical implementation has so far been restricted to simplified datasets with relatively few, continuous causal variables, and when trying to relax these limitations we saw the model performance decrease quickly. While more work will be required to make latent causal models applicable to real-world settings, we believe that our results demonstrate that causal representation learning is possible without explicit labels.
|
| 223 |
+
|
| 224 |
+
Acknowledgments We want to thank Joey Bose, Thomas Kipf, Dominik Neuenfeld, and Frank Rösler for useful discussions and Gabriele Cesa, Yang Yang, and Yunfan Zhang for helping with our experiments.
|
| 225 |
+
|
| 226 |
+
References
|
| 227 |
+
[1] Bernhard Schölkopf, Francesco Locatello, Stefan Bauer, Nan Rosemary Ke, Nal Kalchbrenner, Anirudh Goyal, and Yoshua Bengio. Toward causal representation learning. Proceedings of the IEEE, 109(5):612–634, 2021.
|
| 228 |
+
[2] Frederick Eberhardt. Green and grue causal variables. Synthese, 193(4):1029–1046, 2016.
|
| 229 |
+
[3] Francesco Locatello, Stefan Bauer, Mario Lucic, Gunnar Raetsch, Sylvain Gelly, Bernhard Schölkopf, and Olivier Bachem. Challenging common assumptions in the unsupervised learning of disentangled representations. 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 4114–4124. PMLR, 2019.
|
| 230 |
+
[4] Diederik P. Kingma and Max Welling. Auto-Encoding Variational Bayes. In 2nd International Conference on Learning Representations, ICLR 2014, Banff, AB, Canada, April 14-16, 2014, Conference Track Proceedings, 2014.
|
| 231 |
+
[5] Francesco Locatello, Ben Poole, Gunnar Rätsch, Bernhard Schölkopf, Olivier Bachem, and Michael Tschannen. Weakly-supervised disentanglement without compromises. In International Conference on Machine Learning, pages 6348–6359. PMLR, 2020.
|
| 232 |
+
[6] Aapo Hyvärinen and Erkki Oja. Independent component analysis: algorithms and applications. Neural Networks, 13:411–430, 2000.
|
| 233 |
+
[7] Rui Shu, Yining Chen, Abhishek Kumar, Stefano Ermon, and Ben Poole. Weakly Supervised Disentanglement with Guarantees. In International Conference on Learning Representations, 2020.
|
| 234 |
+
[8] Ilyes Khemakhem, Diederik Kingma, Ricardo Monti, and Aapo Hyvarinen. Variational Autoencoders and Nonlinear ICA: A Unifying Framework. In Silvia Chiappa and Roberto Calandra, editors, Proceedings of the Twenty Third International Conference on Artificial Intelligence and Statistics, volume 108 of Proceedings of Machine Learning Research, pages 2207–2217. PMLR, 2020.
|
| 235 |
+
[9] Hermanni Hälvä, Sylvain Le Corff, Luc Lehéricy, Jonathan So, Yongjie Zhu, Elisabeth Gassiat, and Aapo Hyvarinen. Disentangling Identifiable Features from Noisy Data with Structured Nonlinear ICA. In A. Beygelzimer, Y. Dauphin, P. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, 2021.
|
| 236 |
+
[10] Luigi Gresele, Julius von Kügelgen, Vincent Stimper, Bernhard Schölkopf, and Michel Besserve. Independent mechanism analysis, a new concept? In A. Beygelzimer, Y. Dauphin, P. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, 2021.
|
| 237 |
+
[11] Weiran Yao, Yuewen Sun, Alex Ho, Changyin Sun, and Kun Zhang. Learning Temporally Causal Latent Processes from General Temporal Data. In International Conference on Learning Representations, 2022.
|
| 238 |
+
[12] Sebastien Lachapelle, Pau Rodriguez, Rémi Le, Yash Sharma, Katie E Everett, Alexandre Lacoste, and Simon Lacoste-Julien. Disentanglement via Mechanism Sparsity Regularization: A New Principle for Nonlinear ICA. In First Conference on Causal Learning and Reasoning, 2022.
|
| 239 |
+
[13] Chaochao Lu, Yuhuai Wu, Jose Miguel Hernández-Lobato, and Bernhard Schölkopf. Nonlinear ´ invariant risk minimization: A causal approach. arXiv preprint arXiv:2102.12353, 2021.
|
| 240 |
+
[14] Julius von Kügelgen, Yash Sharma, Luigi Gresele, Wieland Brendel, Bernhard Schölkopf, Michel Besserve, and Francesco Locatello. Self-Supervised Learning with Data Augmentations Provably Isolates Content from Style. In Thirty-Fifth Conference on Neural Information Processing Systems, 2021.
|
| 241 |
+
[15] Phillip Lippe, Sara Magliacane, Sindy Löwe, Yuki M. Asano, Taco Cohen, and Efstratios Gavves. CITRIS: Causal Identifiability from Temporal Intervened Sequences. In Proceedings of the 39th International Conference on Machine Learning, ICML, 2022.
|
| 242 |
+
[16] Mengyue Yang, Furui Liu, Zhitang Chen, Xinwei Shen, Jianye Hao, and Jun Wang. CausalVAE: Disentangled representation learning via neural structural causal models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9593–9602, 2021.
|
| 243 |
+
[17] Jeffrey Adams, Niels Hansen, and Kun Zhang. Identification of partially observed linear causal models: Graphical conditions for the non-gaussian and heterogeneous cases. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P.S. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, volume 34, pages 22822–22833. Curran Associates, Inc., 2021. URL https://proceedings.neurips.cc/paper/2021/file/ c0f6fb5d3a389de216345e490469145e-Paper.pdf.
|
| 244 |
+
[18] Feng Xie, Ruichu Cai, Biwei Huang, Clark Glymour, Zhifeng Hao, and Kun Zhang. Generalized independent noise condition for estimating latent variable causal graphs. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 14891–14902. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/file/ aa475604668730af60a0a87cc92604da-Paper.pdf.
|
| 245 |
+
[19] Bohdan Kivva, Goutham Rajendran, Pradeep Ravikumar, and Bryon Aragam. Learning latent causal graphs via mixture oracles. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P.S. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, volume 34, pages 18087–18101. Curran Associates, Inc., 2021. URL https://proceedings.neurips. cc/paper/2021/file/966aad8981dcc75b5b8ab04427a833b2-Paper.pdf.
|
| 246 |
+
[20] Krzysztof Chalupka, Pietro Perona, and Frederick Eberhardt. Visual causal feature learning. Uncertainty in Artificial Intelligence, December 2014.
|
| 247 |
+
[21] Sander Beckers and Joseph Y Halpern. Abstracting causal models. Proc. Conf. AAAI Artif. Intell., 33:2678–2685, July 2019.
|
| 248 |
+
[22] Jonas Peters, Dominik Janzing, and Bernhard Schölkopf. Elements of causal inference: foundations and learning algorithms. The MIT Press, 2017.
|
| 249 |
+
[23] Paul K Rubenstein, Sebastian Weichwald, Stephan Bongers, Joris M Mooij, Dominik Janzing, Moritz Grosse-Wentrup, and Bernhard Schölkopf. Causal consistency of structural equation models. Uncertainty in Artificial Intelligence, July 2017.
|
| 250 |
+
[24] Judea Pearl. Causality : models, reasoning, and inference. Cambridge University Press, Cambridge, U.K. New York, 2000. ISBN 978-0521895606.
|
| 251 |
+
[25] Stephan Bongers, Patrick Forré, Jonas Peters, and Joris M. Mooij. Foundations of Structural Causal Models with Cycles and Latent Variables. Annals of Statistics, 49(5):2885–2915, 2021. doi: 10.1214/21-AOS2064.
|
| 252 |
+
[26] Eric Jang, Shixiang Gu, and Ben Poole. Categorical Reparameterization with Gumbel-Softmax. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings, 2017.
|
| 253 |
+
[27] Philippe Brouillard, Sébastien Lachapelle, Alexandre Lacoste, Simon Lacoste-Julien, and Alexandre Drouin. Differentiable Causal Discovery from Interventional Data. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin, editors, Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
|
| 254 |
+
[28] Phillip Lippe, Taco Cohen, and Efstratios Gavves. Efficient Neural Causal Discovery without Acyclicity Constraints. In International Conference on Learning Representations, 2022.
|
| 255 |
+
[29] Bertrand Charpentier, Simon Kibler, and Stephan Günnemann. Differentiable DAG sampling. March 2022.
|
| 256 |
+
[30] Alain Hauser and Peter Bühlmann. Characterization and Greedy Learning of Interventional Markov Equivalence Classes of Directed Acyclic Graphs. Journal of Machine Learning Research, 13(1):2409–2464, 2012. ISSN 1532-4435.
|
| 257 |
+
[31] Francesco Locatello, Dirk Weissenborn, Thomas Unterthiner, Aravindh Mahendran, Georg Heigold, Jakob Uszkoreit, Alexey Dosovitskiy, and Thomas Kipf. Object-centric learning with slot attention. Advances in Neural Information Processing Systems, 33:11525–11538, 2020.
|
| 258 |
+
[32] Cian Eastwood and Christopher K I Williams. A framework for the quantitative evaluation of disentangled representations. International Conference on Learning Representations, February 2018.
|
| 259 |
+
[33] 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, pages 5026–5033, October 2012.
|
| 260 |
+
|
| 261 |
+
# Checklist
|
| 262 |
+
|
| 263 |
+
1. For all authors...
|
| 264 |
+
|
| 265 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 266 |
+
(b) Did you describe the limitations of your work? [Yes] We strive to be transparent about the limitations of our work. In the theory section we list the assumptions, in the experiment section we discuss observed failures, and in the conclusions and in Appendix B we discuss the requirements of our approach again.
|
| 267 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Appendix F.
|
| 268 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 269 |
+
|
| 270 |
+
2. If you are including theoretical results...
|
| 271 |
+
|
| 272 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] We provide our list of assumptions in Sec. 5 and Appendix A and further discuss them in Appendix B.
|
| 273 |
+
(b) Did you include complete proofs of all theoretical results? [Yes] Our identifiability theorem is proven in Appendix A,
|
| 274 |
+
|
| 275 |
+
3. If you ran experiments...
|
| 276 |
+
|
| 277 |
+
(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] Not yet, but we aim to publish them as soon as we obtain approval to do so.
|
| 278 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We provide these details in Appendix D.
|
| 279 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No]
|
| 280 |
+
(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]
|
| 281 |
+
|
| 282 |
+
If you are using existing assets (e.g., code, data, models) or curating/releasing new asse
|
| 283 |
+
|
| 284 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] We use the Causal3DIdent dataset from von Kügelgen et al. [14].
|
| 285 |
+
(b) Did you mention the license of the assets? [No]
|
| 286 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No] We strive to publish our CausalCircuit dataset as soon as possible.
|
| 287 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] We only consider synthetic data showing simulated objects.
|
| 288 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 289 |
+
|
| 290 |
+
ou used crowdsourcing or conducted research with human subjects...
|
| 291 |
+
|
| 292 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 293 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 294 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/f-fVCElZ-G1/f-fVCElZ-G1.md
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ZeroQuant: Efficient and Affordable Post-Training Quantization for Large-Scale Transformers
|
| 2 |
+
|
| 3 |
+
Zhewei Yao⇤ , Reza Yazdani Aminabadi, Minjia Zhang, Xiaoxia Wu, Conglong Li, Yuxiong He
|
| 4 |
+
|
| 5 |
+
Microsoft {zheweiyao, yazdani.reza, minjiaz, xiaoxiawu, conglong.li, yuxhe}@microsoft.com
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
How to efficiently serve ever-larger trained natural language models in practice has become exceptionally challenging even for powerful cloud servers due to their prohibitive memory/computation requirements. In this work, we present an efficient and affordable post-training quantization approach to compress large Transformer-based models, termed as ZeroQuant. ZeroQuant is an end-to-end quantization and inference pipeline with three main components: (1) a fine-grained hardware-friendly quantization scheme for both weight and activations; (2) a novel affordable layer-by-layer knowledge distillation algorithm (LKD) even without the access to the original training data; (3) a highly-optimized quantization system backend support to remove the quantization/dequantization overhead. As such, we are able to show that: (1) ZeroQuant can reduce the precision for weights and activations to INT8 in a cost-free way for both BERT and GPT-3-style models with minimal accuracy impact, which leads to up to $5 . 1 9 \mathrm { x } / 4 . 1 6 \mathrm { x }$ speedup on those models compared to FP16 inference; (2) ZeroQuant plus LKD affordably quantize the weights in the fully-connected module to INT4 along with INT8 weights in the attention module and INT8 activations, resulting in $3 \mathbf { x }$ memory footprint reduction compared to the FP16 model; (3) ZeroQuant can be directly applied to two of the largest open-sourced language models, including $\mathrm { G P T - J _ { 6 B } }$ and GPT- $\mathrm { \cdot N e o X _ { 2 0 B } }$ , for which our INT8 model achieves similar accuracy as the FP16 model but achieves up to $5 . 2 \mathrm { x }$ better efficiency.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Large-scale natural language models have been widely adopted in different applications, e.g., natural language understanding using BERT [64] and generation tasks using GPT-style models [49]. Although those models have achieved cutting-edge accuracy results, as the model size keeps increasing dramatically, the requirements of memory footprint and the computational cost to deploy them become a major bottleneck, even on cloud servers with powerful GPU devices.
|
| 14 |
+
|
| 15 |
+
One promising way to alleviate this challenge is quantization, which can reduce the bit precision for both weight and activations for lower memory footprint and faster compute (e.g., INT8 Tensor cores on T4/A100). However, quantization usually requires retraining (also known as quantization aware training, or QAT in short) to recover the accuracy degradation from representation loss of weight and activations. To enable QAT, the full training pipeline is usually required, including the training data and compute resources, to finetune the model. Access to those components is now oftentimes not available, and QAT is also a time-consuming process, particularly for those large-scale models.
|
| 16 |
+
|
| 17 |
+
Recently, zero-shot quantization [10, 47] and post-training quantization (PTQ) [46, 39] are proposed to address the training-data access and compute requirement challenges since PTQ generally requires no (or minimal) retraining. But most of those works primarily focus on computer vision problems on relatively small scales. More recently, [7] shows promising PTQ results on BERT. However, (1) its main focus is on high-precision quantization (INT8/FP16) on $\mathbf { B E R T _ { b a s e } }$ , (2) it does not consider other billion-scale generative models (GPT-3-style models [9]). More importantly, most of these works do not report real latency improvement, putting the usefulness of these methods in improving inference latency into question. For example, existing work often do not discuss the quantization/dequantization cost associated with different quantization schemes, which in fact has a big impact to the performance benefit of using low precision.
|
| 18 |
+
|
| 19 |
+
Besides, for extreme quantization (e.g., INT4), knowledge distillation is usually used to boost performance, which adds another source of expensive computation cost as compared to QAT. Furthermore, in order to achieve better accuracy performance, hidden-states knowledge distillation, e.g., [3, 81], is usually applied for the quantized model. This would put significant pressure on the GPU memory and the compute resource requirement since both the teacher and student models needed to be loaded into the GPU memory for training.
|
| 20 |
+
|
| 21 |
+
In this paper, we present ZeroQuant, an end-to-end post-training quantization and inference pipeline, to address those challenges, targeting both INT8 and INT4/INT8 mixed-precision quantization. Specifically, our contributions are:
|
| 22 |
+
|
| 23 |
+
• We apply fine-grained hardware-friendly quantization schemes on both weight and activations, i.e., group-wise quantization for weight and token-wise quantization for activations. Both quantization schemes can significantly reduce the quantization error and retain hardware acceleration properties.
|
| 24 |
+
• We propose a novel layer-by-layer knowledge distillation method (LKD) for INT4/INT8 mixedprecision quantization, where the neural network is quantized layer-by-layer through distillation with minimal iterations and even without the access to the original training data. As such, at any given moment, the device memory is primarily populated only with a single extra layer’s footprint, making billion-scale model distillation feasible with limited training budget and GPU devices.
|
| 25 |
+
• We develop a highly optimized inference backend, which eliminates the expensive computation cost of quantization/dequantization operators, enabling latency speedups on INT8 Tensor cores on modern GPU hardware.
|
| 26 |
+
• Our empirical results show that: – ZeroQuant enables quantizing BERT and GPT-3-style models into INT8 weight and activations to retain accuracy without incurring any retraining cost. Compared to FP16 inference, our INT8 model achieves up to $5 . 1 9 \mathrm { x } / 4 . 1 6 \mathrm { x }$ speedup on $\mathrm { B E R T _ { b a s e } / G P T } { - 3 _ { 3 5 0 \mathrm { M } } }$ on A100 GPUs. ZeroQuant plus LKD can do INT4/INT8 mixed-precision quantization for BERT and GPT3-style models. This results in a $3 \mathbf { x }$ memory footprint reduction with marginal accuracy loss as compared to the FP16 model. Also, thanks to the lightweight of LKD, we can finish the quantization process in 33s (10 minutes) for $\mathbf { B E R T _ { b a s e } }$ $\mathrm { ( B E R T _ { l a r g e } } ,$ ). We also demonstrate that LKD can use other datasets to achieve similar performance to the original training data. We demonstrate the scalability of ZeroQuant on two of the largest open-sourced language models, i.e, $\mathrm { G P T - J _ { 6 B } }$ and GPT- $\mathrm { N e o X } _ { 2 0 \mathrm { B } }$ , with INT8 quantization. ZeroQuant can achieve $3 . 6 7 \mathrm { x }$ speedup over the FP16 model for $\mathrm { G P T - J _ { 6 B } }$ and (2) reduce the GPU requirement for inference from 2 to 1 and latency from $6 5 \mathrm { m s }$ to $2 5 \mathrm { m s }$ for GPT- $\mathrm { \cdot N e o X _ { 2 0 B } }$ (i.e., $5 . 2 \mathrm { x }$ better system efficiency in total).
|
| 27 |
+
|
| 28 |
+
# 2 Related Work
|
| 29 |
+
|
| 30 |
+
Model compression has been explored from different aspects [26, 38, 40, 35, 44, 21, 25, 51, 19, 76, 41, 27, 56, 60, 29, 61, 69, 34, 15, 39, 32]. Among those, quantization is one of the most promising directions as it directly reduces the memory footprint and compute intensity. Here, we focus on quantization for NLP models and briefly discuss the related work.
|
| 31 |
+
|
| 32 |
+
The majority of quantization works can be categorized into quantization-aware training (QAT). [57, 78] are the first few works to quantize BERT models using integer numbers for both weight and activations. Particularly, [57] utilizes Hessian information to push the weight bit-precision to even INT2/INT4, and it also proposes group-wise quantization to quantize the weight matrix in a more fine-grained granularity compared to single matrix quantization. [22] introduces quantization noise to alleviate the variations of QAT. [81, 3] leverage very expensive knowledge distillation [27] and data augmentation [29] to ternarize/binarize weights. [30] combines knowledge distillation [29] and learned step size quantization [20] to quantize the weight to 2–8 bits. Recently, [62] also uses knowledge distillation to compress GPT-2 models on task-specific problems to INT2. All those works quantize models using the original training datasets. More importantly they need retraining or finetuning the full model to recover the accuracy, and such compute cost on extra-large models, like [58, 12], can be hardly affordable for most research labs or practitioners.
|
| 33 |
+
|
| 34 |
+
One solution to overcome the compute cost challenge is post-training quantization (PTQ). However, PTQ often induces a significant drop in accuracy because the network can be sensitive to quantization errors. Along this line, one of the first works applied to Transformer-based [65] models is [77]. The authors introduce centroid-based quantization method, where outlier numbers use FP32 format and the rest numbers are quantized using non-uniform quantization. As such, it is hard to get the real inference latency benefit on general compute accelerators, e.g., CPU and GPU, because the parallel processing units in these hardware do not support efficient computation of mixed data types. More recently, [7] introduces high-precision activation quantization (FP16) for part of the model to overcome the high dynamic activation ranges. However, to the best of our knowledge, (1) How to apply PTQ on GPT-3-style models while achieving high accuracy has not been studied in any of previous work yet; (2) How to apply PTQ on billion (or even a dozen of billions) scale model is still under-explored; (3) Efficient inference system backend is still missing, especially for fine-grained quantization schemes, making it hard to achieve low latency on commodity hardware. ZeroQuant resolves all those limitations by considering the system backend into the algorithm design and we verify its capability on both BERT and large-scale GPT-3-style (up to 20 billion, i.e., GP $\left[ - \mathrm { N e o } \mathrm { X } _ { 2 0 \mathrm { B } } \right]$ ) models for various tasks.
|
| 35 |
+
|
| 36 |
+
# 3 Background and Challenge
|
| 37 |
+
|
| 38 |
+
# 3.1 Transformer Architecture
|
| 39 |
+
|
| 40 |
+
The transformer architecture usually has three components: an embedding layer, a stack of encoder/decoder layers, and a final classifier. In this paper, we focus on quantizing the encoder/decoder layers, i.e., the transformer block, because it is often the most memory and compute intensive components in the entire architecture. With a transformer block, there are two sub-layers, the multi-head self-attention (MHSA) and the feed-forward connection (FFC). We give a short review later and please refer to [65] for more details. At high level, transformer models can be broadly categorized to three branches: encoder-only models (BERT) [64], decoder-only models (GPT-3-style) [49], and encoder-decoder models (T5) [50]. In this paper, we focus on encoder-only and decoder-only models but our approach can be applied to encoder-decoder models as well.
|
| 41 |
+
|
| 42 |
+

|
| 43 |
+
Figure 1: The illustration of a Transformer-block.
|
| 44 |
+
|
| 45 |
+
Transformer Block Assume the input of an encoder layer is $\boldsymbol { X }$ , the query, key, value, attention output, FFC dense, and FFC output matrices are $W _ { q }$ , $W _ { k }$ , $W _ { v }$ , $W _ { o }$ , $W _ { h - 4 h }$ , and $W _ { 4 h - h }$ , respectively. Then the forward propagation of a transformer-block is illustrated in Figure 1, where LN is the layer normalization, Softmax is the softmax operator, and GeLU is the activation function.
|
| 46 |
+
|
| 47 |
+
# 3.2 Quantization Background
|
| 48 |
+
|
| 49 |
+
Quantization maps high-precision numbers, e.g., FP16/FP32, to its low-precision counterpart, e.g., INT4/INT8, to reduce the model footprint and improve the compute performance. In this work, we use uniform symmetric scalar quantizers. That is to say, if we have a vector/matrix, $\mathbf { x }$ , the quantization is applied as
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
\mathbf { x } _ { q u a n t i z e } = r o u n d \left( c l a m p ( \frac { \mathbf { x } } { S } , - 2 ^ { b i t - 1 } , 2 ^ { b i t - 1 } - 1 ) \right) ,
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+
Table 1: Post training quantization results of GPT- $\cdot 3 _ { 3 5 0 \mathrm { M } }$ on 20 zero-shot evaluation datesets. Here WxAy means x-/y-bit for weight/activation. Particularly, for W4/8, we quantize the MHSA’s weight to INT8 and FFC’s weight to INT4. Please see Table I.1 for the results of all 20 tasks.
|
| 56 |
+
|
| 57 |
+
<table><tr><td>Precision</td><td>Lambada (↑)</td><td>PIQA (↑)</td><td>OpenBookQA(↑)</td><td>RTE (↑)</td><td>ReCoRd (↑)</td><td>Ave.19 Tasks (↑)</td><td>Wikitext-2 (↓)</td></tr><tr><td>W16A16</td><td>49.3</td><td>66.3</td><td>29.4</td><td>53.8</td><td>75.1</td><td>38.9</td><td>21.5</td></tr><tr><td>W8A16</td><td>49.3</td><td>66.1</td><td>29.6</td><td>54.2</td><td>74.8</td><td>38.5</td><td>22.1</td></tr><tr><td>W16A8</td><td>44.7</td><td>64.8</td><td>28.2</td><td>52.7</td><td>69.2</td><td>37.8</td><td>24.6</td></tr><tr><td>W8A8</td><td>42.6</td><td>64.1</td><td>28.0</td><td>53.1</td><td>67.5</td><td>37.8</td><td>26.2</td></tr><tr><td>W4/8A16</td><td>0.00</td><td>51.4</td><td>30.2</td><td>52.7</td><td>16.1</td><td>28.9</td><td>1.76e5</td></tr></table>
|
| 58 |
+
|
| 59 |
+
where bit is the number of bit we use to represent the quantized value, and $S$ is the scaling factor. For weight matrix quantization, $S$ is generally computed as $S = m a x \left( a b s ( \mathbf { x } ) \right)$ , since the weight matrix is static during inference. On the other hand, activations’ range is dynamic during inference so that an accurate $S$ requires dynamic calculation during inference. However, to achieve best latency reduction, coarse-grained static quantization is usually applied in practice, where $S$ is calibrated using training data (e.g., momentum based averaging) and fixed during inference [24]. Although static quantization achieves better latency reduction, it also limits the quantization representation for activations, which is discussed below.
|
| 60 |
+
|
| 61 |
+
# 3.3 Post Training Quantization
|
| 62 |
+
|
| 63 |
+
Post-training quantization (PTQ) exhibits great compression efficiency compared to quantizationaware training (QAT) since PTQ is usually applied to quantize the model without retraining. A common strategy of PTQ is to feed the training data to the network and calibrate the scaling factor, $S$ , using the running mean. Please see Appendix A.1 for more details.
|
| 64 |
+
|
| 65 |
+
Some work has been done for $\mathbf { B E R T _ { b a s e } }$ models [7] with INT8 weight and mixed INT8/FP16 activation quantization. However, there is no investigation for (1) even lower bit-precision PTQ on BERT models and (2) large-scale GPT-3-style models. Here, we briefly discuss the challenge of the application of PTQ on both BERT (in Appendix C) and GPT-3-style models.
|
| 66 |
+
|
| 67 |
+

|
| 68 |
+
Figure 2: The activation range (left) and row-wise weight range of the attention output matrix (right) of different layers on the pretrained GPT- $3 _ { 3 5 0 \mathrm { M } }$ . See Figure C.1 for the results of $\mathbf { B E R T _ { b a s e } }$ .
|
| 69 |
+
|
| 70 |
+
The results of $\mathrm { G P T } { \cdot } 3 _ { 3 5 0 \mathrm { M } }$ with PTQ are shown in Table 1. As can be seen, the INT8 activation quantization (i.e., the row of W16A8) causes the primary accuracy loss. Further pushing the weight to INT8 (i.e., the row of W8A8) does not change the accuracy of zero-shot evaluation tasks but leads the causal language modeling task (Wikitext-2) to worse perplexity score, which demonstrates the sensitivity of generation tasks as compared to other zero-shot evaluation problems. For W4/8A16, on some accuracy-based tasks, GPT- $3 _ { 3 5 0 \mathrm { M } }$ still achieves reasonable performance like OpenBookQA but it loses accuracy on the majority of the rest tasks. Particularly, for Wikitext-2, GPT- $\cdot 3 _ { 3 5 0 \mathrm { M } }$ with W4/8A16 cannot generate any meaningful text anymore. Please also see Appendix C for the analysis for BERT.
|
| 71 |
+
|
| 72 |
+
Dynamic Activation Range To investigate why INT8 activation leads to significant accuracy drop for both BERT and GPT-3-style models, we plot the token-wise (i.e., the hidden state of each token) range of each activation for different transformer layers of GPT- $\cdot 3 _ { 3 5 0 \mathrm { M } }$ in Figure 2 (left). As can be seen, different tokens have dramatically different activation ranges. For example, the maximum range of the last layer is around 35 but the minimum range is close to 8. This larger variance in the activation range makes it difficult to use a fixed quantization range (usually the maximum value) for all tokens to retain the prediction accuracy, because the limited representation power for small range tokens is going to hurt the accuracy performance.
|
| 73 |
+
|
| 74 |
+
Different Ranges of Neurons in Weight Matrices Similarly, we plot the row-wise (i.e., the output dimension) weight range of the attention output matrix $( W _ { o } )$ of GPT- $\cdot 3 _ { 3 5 0 \mathrm { M } }$ in Figure 2 (right). There is a $1 0 \mathrm { x }$ difference between the largest magnitudes of different rows and this leads to the worse generation performance of the INT8 weight PTQ. This also makes it very challenging when INT4 quantization is applied as the INT4 only has 16 numbers and a $1 0 \mathrm { x }$ smaller range leads to 2 (or 3) numbers for the representations of those smaller-range rows.
|
| 75 |
+
|
| 76 |
+
This analysis results also indicate why more expensive hidden-states knowledge distillation [3, 37] is used for ultra-low precision quantization to close the accuracy gap. However, as the training cost of knowledge distillation for large-scale models is too high, a lightweight and efficient method is desirable for PTQ.
|
| 77 |
+
|
| 78 |
+
# 4 Methodology
|
| 79 |
+
|
| 80 |
+
# 4.1 Fine-grained Hardware-friendly Quantization Scheme
|
| 81 |
+
|
| 82 |
+
As shown in Section 3, even applying INT8 PTQ to BERT/GPT-3-style models leads to significant accuracy degradation. The key challenge is the representation of INT8 cannot fully capture the different numerical ranges of different rows in weight matrices and different activation tokens. One way to address this is to use group-wise (token-wise) quantization for the weight matrix (activations).
|
| 83 |
+
|
| 84 |
+
Group-wise Quantization for Weights Group-wise weight matrix quantization has first been proposed in [57], where a weight matrix $\mathbf { W } \in \mathbb { R } ^ { n \times m }$ is partitioned in to $g$ groups, and each group is quantized separately. However, in [57], the authors only apply this for quantization aware training. More importantly, they do not consider the hardware efficiency constraint and they do not have a system backend support. As such, they lack the real latency reduction benefit.
|
| 85 |
+
|
| 86 |
+
In our design, we consider the hardware constraint from Ampere Architecture of GPUs (e.g, A100), where the compute unit is based on Warp Matrix Multiply and Accumulate (WMMA) tiling size [54] to achieve the best speedup. Later, we will show that our group-wise quantization leads to much better accuracy as compared to single-matrix quantization due to its finer-granularity quantization while still achieving great latency reduction.
|
| 87 |
+
|
| 88 |
+
Token-wise Quantization for Activations As mentioned in Section 3 and Appendix 3.2, a common practice for existing PTQ work is to use static quantization for activation, where the min/max range is calculated at an offline calibration phase. Such a method might be sufficient for small scale models where the variance in the activation range is small. However, as analyzed in Section 3, there is a huge variance in the activation range for large-scale transformer models such as GPT- $\cdot 3 _ { 3 5 0 \mathrm { M } }$ and $\mathbf { B E R T _ { b a s e } }$ . As such, a static quantization scheme (often applied to all tokens/samples) would lead to significant accuracy drop. One natural idea to overcome this issue is to adopt finer-grained token-wise quantization and dynamically calculate the min/max range for each token to reduce the quantization error from activations. Our evaluation in Section 5 also shows that token-wise quantization for activation significantly improves the accuracy of GPT-3-style and BERT models.
|
| 89 |
+
|
| 90 |
+
However, directly applying token-wise quantization using existing DL frameworks, such as the PyTorch quantization suite, would lead to significant quantization and dequantization cost because token-wise quantization introduces additional operations that lead to expensive data movement overhead between the GPU compute units and the main memory. To address this issue, we build a highly optimized inference backend for token-wise quantization of transformer models. For example, the inference backend of ZeroQuant employs so called kernel fusion technique to fuse quantization operator with its previous operator, like layer normalization, to alleviate the data movement cost from token-wise quantization. Similarly, the dequantization cost of the different GeMMs’ output is alleviated by scaling the INT32 accumulation using both the weight and activation quantization scales, before writing the final FP16 result back to the main memory for the next FP16 operator (like GeLU). Those optimization will be discussed in more details in Section 4.3.
|
| 91 |
+
|
| 92 |
+

|
| 93 |
+
Figure 3: The illustration of normal (left) and our fused (right) INT8 GeMM.
|
| 94 |
+
|
| 95 |
+
Token-wise quantization can significantly reduce the representation error for quantized activations. Also, as it does not need to calibrate the activation range, later we will show that there is no quantization-related cost (e.g., activation range calibration) for a moderate quantization scheme (INT8 weight with INT8 activation) for ZeroQuant.
|
| 96 |
+
|
| 97 |
+
# 4.2 Layer-by-layer Knowledge Distillation with Affordable Cost
|
| 98 |
+
|
| 99 |
+
Knowledge distillation (KD) is one of the most powerful methods to alleviate the accuracy degradation after model compression. However, there are several limitations of KD, especially for hidden-states KD on large-scale language models: (1) KD needs to hold a teacher and a student model together during the training, which dramatically increases the memory and compute cost; (2) KD usually requires full training of the student model. Therefore, several copies (gradient, first/second order momentum) of the weight parameters need to be stored in memory to update the model; (3) KD generally requires original training data, which sometimes are not accessible due to privacy/confidential issues.
|
| 100 |
+
|
| 101 |
+
To address those limitations, we present our layer-by-layer distillation (LKD) algorithm. Assume the target model for quantization has $N$ transformer blocks, $L _ { 1 } , . . . , L _ { N }$ , the accessible dataset has input $( X , Y )$ , which can be the original training data or datasets from other resources. Our LKD quantizes the network layer-by-layer and uses its original (i.e., unquantized) version as the teacher model. More specifically, assume layer $L _ { k }$ is going to be quantized, and its quantized version is $\widehat { L } _ { k }$ . Then we use the output of the $L _ { k - 1 }$ (i.e., by running inference on $X$ over the first $k - 1$ layers) as the input of $L _ { k }$ and $\widehat { \widehat { L } } _ { k }$ , measure the difference, and do the model update to $L _ { k }$ , i.e.,
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\mathcal { L } _ { L K D , k } = M S E \left( L _ { k } \cdot L _ { k - 1 } \cdot L _ { k - 2 } \cdot \ldots \cdot L _ { 1 } ( \pmb { X } ) - \widehat { L } _ { k } \cdot L _ { k - 1 } \cdot L _ { k - 2 } \cdot \ldots \cdot L _ { 1 } ( \pmb { X } ) \right) ,
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
where $M S E$ is the mean square loss, and it can be also replaced by other losses (e.g., KL divergence) as well. As can be seen, (1) our LKD does not need to hold a separate teacher as we use the same $L _ { 1 }$ to $L _ { k - 1 }$ for both teacher/student model. As such, the only extra model cost we have is $L _ { k }$ ; (2) the memory overhead of optimizer states are significantly reduced as the only optimizing layer is $L _ { k }$ ; (3) as we never optimize the end-to-end model, the training does not depend on the label anymore. Later, we will show that LKD does not rely on the original training data in Section 5.6.
|
| 108 |
+
|
| 109 |
+
# 4.3 Quantization-Optimized Transformer Kernels
|
| 110 |
+
|
| 111 |
+
Both optimizing the inference latency and model size is crucial for serving large-scale transformer models in practice. During inference, the batch size is often relatively small, so the inference latency of the model primarily depends on the time of loading inference needed data from the main memory. By quantizing the weights and activations to lower precision, we reduce the data volume needed to load those data, which allows more effective use of memory bandwidth and higher loading throughput. However, simply converting weights/activations to INT8 does not guarantee improved latency because there are additional data movement overhead associated with quantization/dequantization operations as shown in Figure 3 (red box). Such an overhead becomes expensive and in some cases surpasses the performance benefits of using low precision. To reap the accuracy improvement from token-wise quantization while obtaining improved latency, we now present our optimizations that maximize the memory bandwidth utilization to speed up inference latency for ZeroQuant.
|
| 112 |
+
|
| 113 |
+
CUTLASS INT8 GeMM To support INT8 computation, we use CUTLASS [6] INT8 GeMM implementation tuned for different batch sizes. Unlike standard GPU backend library, such as cuDNN, using CUTLASS allows us to more flexibly fuse quantization operation before and after GeMM to reduce kernel launching and data-movement overhead.
|
| 114 |
+
|
| 115 |
+
Fusing Token-wise Activation Quantization Token-wise quantization/dequantization introduce many additional operations that lead to extra data movement cost. To eliminate these cost, we use kernel fusion [68] to fuse quantization operation for activation with its previous element-wise and/or reduction operations such as bias-add, GeLU, and LayerNorm into a single operator, as illustrated by the green box in Figure 3. For the dequantization operation (e.g., dequantizing the integer output from the GeMM operator), we similarly fuse it with our custom GeMM schedule to avoid additional read/write accesses to the main memory as illustrated by the blue box in Figure 3.
|
| 116 |
+
|
| 117 |
+
Table 2: Result of $\mathbf { B E R T _ { b a s e } }$ on the development set of GLUE benchmark (except WNLI). $[ 5 7 ] ^ { + }$ uses 128 groups for weight matrix which is hard to get GPU acceleration. $[ 7 ] ^ { * }$ uses mixed INT8 and FP16 activation, and it directly reports the average metric of MNLI/MRPC/QQP/STS-B, which is basically the average of the two metrics we used for our runs.
|
| 118 |
+
|
| 119 |
+
<table><tr><td>Precision (Method)</td><td>CoLA</td><td>MNLI-m</td><td>MNLI-mm</td><td>MRPC</td><td>QNLI</td><td>QQP</td><td>RTE</td><td>SST-2</td><td>STS-B</td><td>Ave.</td><td>Ave. Time (s)</td></tr><tr><td>W16A16 (Baseline)</td><td>59.72</td><td>84.94</td><td>85.06</td><td>86.27/90.57</td><td>92.15</td><td>91.51/88.56</td><td>72.20</td><td>93.23</td><td>90.06/89.59</td><td>83.95</td><td>N/A</td></tr><tr><td>W8A8 [57](QAT)+</td><td></td><td>83.91</td><td>83.83</td><td></td><td></td><td></td><td></td><td>92.83</td><td></td><td></td><td></td></tr><tr><td>W8A8 [78](QAT)</td><td>58.48</td><td></td><td></td><td>-/89.56</td><td>90.62</td><td>/87.96</td><td>68.78</td><td>92.24</td><td>89.04/-</td><td></td><td></td></tr><tr><td>W8A8 (QAT)</td><td>61.21</td><td>84.80</td><td>84.64</td><td>83.82/88.85</td><td>91.29</td><td>91.29/88.28</td><td>71.12</td><td>92.89</td><td>88.39/88.18</td><td>83.37</td><td>2900</td></tr><tr><td>W8A8 (PTQ)</td><td>56.06</td><td>79.99</td><td>81.06</td><td>75.49/79.67</td><td>87.35</td><td>89.92/86.82</td><td>48.38</td><td>91.40</td><td>86.58/86.44</td><td>77.41</td><td>6</td></tr><tr><td>W8A8/16 [7](PTQ)*</td><td>58.63</td><td>82.67</td><td>82.67</td><td>88.74</td><td>90.41</td><td>89.40</td><td>68.95</td><td>92.66</td><td>88.00</td><td>82.46</td><td>Unknown</td></tr><tr><td>W8A8 (ZeroQuant)</td><td>59.59</td><td>84.83</td><td>85.13</td><td>86.03/90.39</td><td>91.98</td><td>91.45/88.46</td><td>71.12</td><td>93.12</td><td>90.09/89.62</td><td>83.75</td><td>0</td></tr><tr><td>W4/8A16 (PTQ)</td><td>0.00</td><td>16.74</td><td>16.95</td><td>31.62/0.00</td><td>50.74</td><td>63.18/0.00</td><td>47.29</td><td>70.64</td><td>16.48/15.91</td><td>33.11</td><td>6</td></tr><tr><td>W4/8A16 (ZeroQuant)</td><td>57.29</td><td>82.69</td><td>83.27</td><td>84.56/88.40</td><td>90.04</td><td>86.52/79.49</td><td>70.76</td><td>92.78</td><td>88.46/88.61</td><td>81.65</td><td>0</td></tr><tr><td>W4/8A16 (ZeroQuant-LKD)</td><td>58.50</td><td>83.16</td><td>83.69</td><td>84.80/89.31</td><td>90.83</td><td>88.94/84.12</td><td>70.04</td><td>92.78</td><td>88.49/88.67</td><td>82.35</td><td>31</td></tr><tr><td>W4/8A8 (ZeroQuant)</td><td>56.69</td><td>82.46</td><td>83.06</td><td>84.07/88.03</td><td>90.13</td><td>87.04/80.50</td><td>70.76</td><td>92.78</td><td>88.07/88.44</td><td>81.55</td><td>0</td></tr><tr><td>W4/8A8 (ZeroQuant-LKD)</td><td>58.80</td><td>83.09</td><td>83.65</td><td>85.78/89.90</td><td>90.76</td><td>89.16/84.85</td><td>71.84</td><td>93.00</td><td>88.16/88.55</td><td>82.71</td><td>31</td></tr></table>
|
| 120 |
+
|
| 121 |
+
By doing the above optimizations, we are able to show significant latency reduction for BERT and GPT-3-style models in Section 5. Please see Appendix D for more details about our system optimization.
|
| 122 |
+
|
| 123 |
+
# 5 Results
|
| 124 |
+
|
| 125 |
+
Experimental Details To evaluate the proposed ZeroQuant, we test it on both BERT and GPT-3 models. For BERT, we tested both $\mathbf { B E R T _ { b a s e } }$ and $\mathbf { B E R T _ { l a r g e } }$ on GLUE benchmark; and for GPT-3-style models, we tested the GPT- $\cdot 3 _ { 3 5 0 \mathrm { M } }$ (i.e., GPT-3-style model with 350M parameters) and GPT- $\boldsymbol { \cdot } 3 _ { 1 . 3 \mathrm { B } }$ (i.e., GPT-3-style model with 1.3B parameters) on 20 zero-shot evaluation tasks, including 19 accuracybased tasks and 1 language modeling generation task. To illustrate the scalability of the proposed ZeroQuant, we also directly apply it to two of the largest open-sourced GPT-3-style models, i.e., $\mathrm { G P T - J _ { 6 B } }$ [67] and GPT- $\mathrm { N e o X } _ { 2 0 \mathrm { B } }$ [5]. We use a fixed set of hyperparameters for all the LKD-related experiments even though tuning them may benefit our results. Please see Appendix A.2 for more training details and see Appendix A.3 for the reported metrics for BERT. To provide a comprehensive study, we also include a tuning result in Appendix E on BERT and an ablation study for different proposed components in Section 5.5.
|
| 126 |
+
|
| 127 |
+
Notation Explanation We use WxAy to represent using $\mathbf { X }$ -bit for weight quantization and y-bit for activation quantization. Unless specific explanation, for W4/8, we quantize the MHSA’s weight to INT8 and FFC’s weight to INT4; for A8/16, we use FP16 activation for self-attention calculation (i.e., the GeMM related to $W _ { q / k / v , }$ ) and use INT8 for the rest calculation. We use ZeroQuant to represent the method with only fine-grained quantization schemes and use ZeroQuant-LKD to represent the method with both fine-grained quantization schemes and LKD.
|
| 128 |
+
|
| 129 |
+
A summary of results is shown in Appendix B. We also include (1) the results required by reviewers in Appendix G; (2) the speedup explanation .
|
| 130 |
+
|
| 131 |
+
# 5.1 Main Results of BERT
|
| 132 |
+
|
| 133 |
+
$\mathbf { B E R T _ { b a s e } }$ We report the results of $\mathbf { B E R T _ { b a s e } }$ in Table 2. For W8A8, the average accuracy of PTQ degrades more than 10 points. However, ZeroQuant can achieve 83.75 scores, which is only 0.2 lower than baseline. Particularly, as ZeroQuant has no activation range calibration phase, the cost of ZeroQuant is 0 which is even cheaper than standard PTQ. As compared to [7], our method achieves a better average score (1.29 higher). Meanwhile, as compared to INT8 activation used in ZeroQuant, [7] uses mixed INT8 and FP16 activation.
|
| 134 |
+
|
| 135 |
+
We also compare our method with our internal trained QAT and other QAT works [57, 78]. As can be seen, with comparable accuracy results as those QAT methods, ZeroQuant can save the retraining cost from 2900s to 0s for INT8 quantization.
|
| 136 |
+
|
| 137 |
+
Table 3: Result of $\mathbf { B E R T _ { l a r g e } }$ on the development set of GLUE benchmark (except WNLI). $+ \mathrm { { { \mathbf { W } } e } }$ extensively tuned the learning rate for QAT (see Appendix F for more details).
|
| 138 |
+
|
| 139 |
+
<table><tr><td>Precision (Method)</td><td>CoLA</td><td>MNLI-m</td><td>MNLI-mm</td><td>MRPC</td><td>QNLI</td><td>QQP</td><td>RTE</td><td>SST-2</td><td>STS-B</td><td>Ave.</td><td>Ave. Time (s)</td></tr><tr><td>W16A16 (Baseline)</td><td>63.35</td><td>86.65</td><td>85.91</td><td>87.99/91.62</td><td>92.24</td><td>91.08/88.08</td><td>74.01</td><td>93.46</td><td>90.34/90.11</td><td>85.03</td><td>N/A</td></tr><tr><td>W8A8 [78](QAT)</td><td></td><td></td><td></td><td>/90.9</td><td>91.74</td><td></td><td></td><td></td><td>90.12/-</td><td></td><td></td></tr><tr><td>W8A8 (QAT)+</td><td>59.85</td><td>86.65</td><td>86.35</td><td>85.29/89.43</td><td>92.55</td><td>91.60/88.60</td><td>61.37</td><td>93.23</td><td>87.55/87.65</td><td>82.78</td><td>7181</td></tr><tr><td>W8A8 (PTQ)</td><td>60.57</td><td>75.69</td><td>76.94</td><td>81.13/84.93</td><td>88.49</td><td>84.04/74.35</td><td>46.93</td><td>91.74</td><td>62.75/55.77</td><td>73.54</td><td>31</td></tr><tr><td>W8A8 (ZeroQuant)</td><td>63.38</td><td>86.52</td><td>85.64</td><td>87.75/91.50</td><td>92.31</td><td>91.09/88.05</td><td>72.56</td><td>93.35</td><td>90.45/90.19</td><td>84.81</td><td>0</td></tr><tr><td>W4/8A16 (PTQ)</td><td>0.00</td><td>16.85</td><td>33.24</td><td>68.38/80.89</td><td>51.25</td><td>63.18/0.00</td><td>52.71</td><td>52.41</td><td>-5.74/-8.51</td><td>35.73</td><td>31</td></tr><tr><td>W4/8A16 (ZeroQuant)</td><td>62.99</td><td>84.77</td><td>84.42</td><td>87.50/91.16</td><td>91.63</td><td>90.03/86.41</td><td>48.01</td><td>92.16</td><td>89.49/89.28</td><td>81.23</td><td>0</td></tr><tr><td>W4/8A16 (ZeroQuant-LKD)</td><td>63.72</td><td>84.90</td><td>84.81</td><td>87.99/91.39</td><td>91.45</td><td>90.34/86.92</td><td>51.62</td><td>92.43</td><td>89.46/89.29</td><td>81.85</td><td>550</td></tr><tr><td>W4/8A8 (ZeroQuant)</td><td>62.34</td><td>84.62</td><td>84.25</td><td>87.75/91.38</td><td>91.87</td><td>89.86/86.09</td><td>47.65</td><td>91.97</td><td>89.39/89.17</td><td>81.06</td><td>0</td></tr><tr><td>W4/8A8 (ZeroQuant-LKD)</td><td>63.51</td><td>84.70</td><td>84.71</td><td>88.73/91.99</td><td>91.73</td><td>90.25/86.74</td><td>49.82</td><td>92.09</td><td>89.34/89.08</td><td>81.62</td><td>550</td></tr></table>
|
| 140 |
+
|
| 141 |
+
Table 4: Post training quantization result of GPT- $\cdot 3 _ { 3 5 0 \mathrm { M } }$ on 20 zero-shot evaluation datasets. Please see Table I.1 for the results of all 20 tasks.
|
| 142 |
+
|
| 143 |
+
<table><tr><td>Precision (Method)</td><td>Lambada (↑)</td><td>PIQA (↑)</td><td>OpenBookQA(↑)</td><td>RTE(↑)</td><td>ReCoRd(↑)</td><td>Ave.19 Tasks (↑)</td><td>Wikitext-2 (↓)</td><td>Time Cost</td></tr><tr><td>W16A16</td><td>49.3</td><td>66.3</td><td>29.4</td><td>53.8</td><td>75.1</td><td>38.9</td><td>21.5</td><td>N/A</td></tr><tr><td>W8A8 (PTQ)</td><td>42.6</td><td>64.1</td><td>28.0</td><td>53.1</td><td>67.5</td><td>37.8</td><td>26.2</td><td>7 mins</td></tr><tr><td>W8A8 (ZeroQuant)</td><td>51.0</td><td>66.5</td><td>29.2</td><td>53.4</td><td>74.9</td><td>38.7</td><td>21.7</td><td>0</td></tr><tr><td>W4/8A16 (PTQ)</td><td>0.00</td><td>51.4</td><td>30.2</td><td>52.7</td><td>16.1</td><td>28.9</td><td>1.76e5</td><td>7 mins</td></tr><tr><td>W4/8A16 (ZeroQuant)</td><td>10.1</td><td>58.5</td><td>27.2</td><td>52.0</td><td>56.5</td><td>33.5</td><td>88.6</td><td>0</td></tr><tr><td>W4/8A16 (ZeroQuant-LKD)</td><td>39.8</td><td>63.8</td><td>29.4</td><td>53.1</td><td>70.1</td><td>37.0</td><td>30.6</td><td>1.1 hours</td></tr><tr><td>W4/8A8 (ZeroQuant)</td><td>10.5</td><td>57.7</td><td>28.0</td><td>52.7</td><td>55.3</td><td>33.4</td><td>92.1</td><td>0</td></tr><tr><td>W4/8A8 (ZeroQuant-LKD)</td><td>37.4</td><td>61.8</td><td>28.2</td><td>53.1</td><td>68.5</td><td>36.6</td><td>31.1</td><td>1.1 hours</td></tr></table>
|
| 144 |
+
|
| 145 |
+
For the more aggressive weight quantization with minimal (or no) training quantization, i.e., W4/8A16, PTQ fully loses all accuracy (pure random prediction). However, ZeroQuant can still achieve an 81.65 average score. On top of ZeroQuant, if we add our LKD, the accuracy can be further boosted to 82.35 with a cost of 31s per task using only a single GPU, which is $9 3 . 5 \mathrm { x }$ cheaper than INT8 QAT quantization. We also test ZeroQuant and ZeroQuant-LKD under the W4/8A8 quantization scheme and both of them achieve similar accuracy performance as W4/8A16. If hyper-parameter tuning is applied to LKD, ZeroQuant-LKD can achieve an 83.22 average score under W4/8A8, which is similar to QAT’s W8A8 result. Please see Appendix E for more details.
|
| 146 |
+
|
| 147 |
+
$\mathbf { B E R T _ { l a r g e } }$ We test our methods on $\mathbf { B E R T _ { l a r g e } }$ as well and the results are shown in Table 3. Similar to $\mathrm { B E R T _ { b a s e } ^ { - } }$ , ZeroQuant achieves much better accuracy than PTQ methods. As compared to QAT methods, ZeroQuant has comparable results on larger datasets (like MNLI/QQP) and has better performance on small tasks (e.e., CoLA/MRPC/RTE). We actually tune QAT for multiple learning rates but cannot get even better performance for those small tasks (see Appendix F for more details).
|
| 148 |
+
|
| 149 |
+
For more aggressive quantization schemes, like W4/8A16 and W4/8A8, ZeroQuant and ZeroQuantLKD still achieve good accuracy except for RTE but the model size is about $3 \mathbf { x }$ smaller than FP16 counterpart. This is aligned with the INT8 QAT results, which lose significantly more accuracy on RTE. Thanks to the lightweight cost of LKD, it only takes about 550s to finish each task even on $\mathbf { B E R T _ { l a r g e } }$ , which is $1 3 \mathrm { x }$ cheaper than QAT.
|
| 150 |
+
|
| 151 |
+
# 5.2 Main Results of GPT-3-style Models
|
| 152 |
+
|
| 153 |
+
$\mathbf { G P T } \mathbf { - } 3 _ { 3 5 0 \mathbf { M } }$ We first test ZeroQuant and ZeroQuant-LKD on GPT- $\cdot 3 _ { 3 5 0 \mathrm { M } }$ and report the result in Table 4. The first interesting finding of zero-shot evaluation on GPT-3-stype models is that the accuracy performance of accuracy-based tasks is more tolerant to quantization than generation tasks. For instance, W8A8 PTQ has a $1 . 1 \%$ average accuracy drop on 19 accuracy-based tasks as compared to 4.7 points loss on Wikitext-2. Comparing ZeroQuant with PTQ using W8A8, we can reduce the accuracy gap from $1 . 1 \%$ to $0 . 2 \%$ and the perplexity (PPL) gap from 4.7 to 0.2 with no activation range calibration cost.
|
| 154 |
+
|
| 155 |
+
For W4/8A16 quantization scheme, PTQ can hardly predict reasonable answers for the majority of tasks and its generation performance on Wikitext-2 is fully crashed. As a comparison, ZeroQuant still achieves non-trivial performance on some tasks but its generation performance significantly degrades on Wikitext-2. LKD brings a significant performance boost for this W4/8A16 setting. Note that ZeroQuant-LKD increases the accuracy from 33.5 to 37.0 and decreases the PPL from 88.6 to 30.6 compared to ZeroQuant, and the entire cost of this is just 3.1 hours on a single A100 GPU. Note that this is about $0 . 0 2 7 \%$ GPU hours of the full pretraining cost (128 A100 GPUs for 32 hours). Similar to W4/8A16, ZeroQuant-LKD achieves much better performance than ZeroQuant on W4/8A8 by using the lightweight LKD.
|
| 156 |
+
|
| 157 |
+
Table 5: Post training quantization result of GPT- $3 _ { 1 . 3 \mathrm { B } }$ on 20 zero-shot evaluation datasets. Please see Table I.2 for the results of all 20 tasks.
|
| 158 |
+
|
| 159 |
+
<table><tr><td>Precision (Method)</td><td>Lambada (↑)</td><td>PIQA(↑)</td><td>OpenBookQA (↑)</td><td>RTE(↑)</td><td>ReCoRd(↑)</td><td>Ave.19 Tasks (↑)</td><td>Wikitext-2 (↓)</td><td>Time Cost</td></tr><tr><td>W16A16</td><td>61.3</td><td>71.4</td><td>33.6</td><td>53.1</td><td>82.6</td><td>42.4</td><td>15.3</td><td>N/A</td></tr><tr><td>W8A8 (PTQ)</td><td>54.8</td><td>67.7</td><td>16.6</td><td>54.5</td><td>75.7</td><td>40.5</td><td>18.9</td><td>13 mins</td></tr><tr><td>W8A8 (ZeroQuant)</td><td>62.6</td><td>70.7</td><td>33.4</td><td>52.7</td><td>80.9</td><td>42.3</td><td>15.7</td><td>0</td></tr><tr><td>W4/8A16 (PTQ)</td><td>0.00</td><td>50.4</td><td>27.0</td><td>50.9</td><td>15.8</td><td>29.0</td><td>1.35e5</td><td>13 mins</td></tr><tr><td>W4/8A16 (ZeroQuant)</td><td>43.9</td><td>66.5</td><td>30.0</td><td>52.7</td><td>77.3</td><td>39.38</td><td>21.9</td><td>0</td></tr><tr><td>W4/8A16 (ZeroQuant-LKD)</td><td>59.4</td><td>69.5</td><td>31.6</td><td>52.7</td><td>79.7</td><td>41.5</td><td>17.6</td><td>3 hours</td></tr><tr><td>W4/8A8 (ZeroQuant)</td><td>46.8</td><td>66.4</td><td>28.8</td><td>52.7</td><td>76.2</td><td>39.24</td><td>24.1</td><td>0</td></tr><tr><td>W4/8A8 (ZeroQuant-LKD)</td><td>48.7</td><td>68.1</td><td>29.0</td><td>52.0</td><td>77.4</td><td>39.90</td><td>18.2</td><td>3 hours</td></tr></table>
|
| 160 |
+
|
| 161 |
+
Table 6: The speedup of our W8A8 as compared to W16A16. We measure the end-to-end average latency for the entire BERT model, and the time reported is in milliseconds.
|
| 162 |
+
|
| 163 |
+
<table><tr><td rowspan="2">Seq Len BS</td><td rowspan="2">Precision</td><td colspan="8">128</td><td colspan="8">256</td></tr><tr><td>2</td><td></td><td>4</td><td>8</td><td>16</td><td>16</td><td>64</td><td>128</td><td>1</td><td>2</td><td>4</td><td>8</td><td>16</td><td>16</td><td>64</td><td>128</td></tr><tr><td rowspan="3">BERTbase</td><td>W16A16</td><td>2.45</td><td>3.22</td><td>3.85</td><td>5.51</td><td>9.96</td><td>17.93</td><td>34.25</td><td>67.08</td><td>3.13</td><td>4.05</td><td>5.70</td><td>10.55</td><td>19.27</td><td>36.69</td><td>71.75</td><td>140.0</td></tr><tr><td>W8A8</td><td>1.08</td><td>1.16</td><td>1.42</td><td>1.76</td><td>2.58</td><td>3.90</td><td>6.74</td><td>12.92</td><td>1.22</td><td>1.44</td><td>2.08</td><td>2.88</td><td>4.10</td><td>7.80</td><td>14.66</td><td>28.13</td></tr><tr><td>Speedup</td><td>2.27</td><td>2.78</td><td>2.71</td><td>3.13</td><td>3.86</td><td>4.60</td><td>5.08</td><td>5.19</td><td>2.57</td><td>2.81</td><td>2.74</td><td>3.66</td><td>4.70</td><td>4.70</td><td>4.89</td><td>4.98</td></tr><tr><td rowspan="3">BERTlarge</td><td>W16A16</td><td>5.45</td><td>6.38</td><td>8.73</td><td>13.88</td><td>26.34</td><td>48.59</td><td>92.49</td><td>183.4</td><td>6.39</td><td>8.94</td><td>14.66</td><td>27.99</td><td>51.94</td><td>98.78</td><td>195.9</td><td>384.5</td></tr><tr><td>W8A8</td><td>2.08</td><td>2.58</td><td>2.84</td><td>3.79</td><td>6.21</td><td>10.28</td><td>18.86</td><td>36.62</td><td>2.55</td><td>3.36</td><td>4.16</td><td>6.88</td><td>11.61</td><td>21.20</td><td>41.24</td><td>79.90</td></tr><tr><td>Speedup</td><td>2.62</td><td>2.47</td><td>3.07</td><td>3.66</td><td>4.24</td><td>4.73</td><td>4.90</td><td>5.01</td><td>2.51</td><td>2.66</td><td>3.52</td><td>4.07</td><td>4.47</td><td>4.66</td><td>4.75</td><td>4.81</td></tr></table>
|
| 164 |
+
|
| 165 |
+
GPT- $\mathbf { \lambda } _ { \mathbf { 3 1 . 3 B } }$ The results of GPT- $\cdot 3 _ { 1 . 3 \mathrm { B } }$ are shown in Table 5. Similar to GPT- $3 _ { 3 5 0 \mathrm { M } }$ , for W8A8, ZeroQuant has much better performance than PTQ with less no activation calibration cost, particularly for the generation task Wikitext-2 (3.2 points lower). Also, for W4/8 quantization, LKD can bring non-trivial performance gain for ZeroQuant. The cost of LKD is about $0 . 0 2 \%$ of the full pre-training cost (128 A100 GPUs for 120 hours)
|
| 166 |
+
|
| 167 |
+
# 5.3 Latency Reduction of BERT and GPT-3-style Models
|
| 168 |
+
|
| 169 |
+
We compare the inference speed of BERT between FP16 and our INT8 versions in Table 6 on a single 40G-A100 GPU. Using our efficient quantization kernel implementation and operator fusion, the INT8 model can achieve $2 . 2 7 { - } 5 . 1 9 \mathrm { x }$ speedup on $\mathbf { B E R T _ { b a s e } }$ and $2 . 4 7 { - } 5 . 0 1 \mathrm { x }$ on $\mathbf { B E R T _ { l a r g e } }$ .
|
| 170 |
+
|
| 171 |
+
We also include the latency comparison of GPT-3-style models between FP16 and our INT8 version. Particularly, we use the model to generate the first 50 tokens based on a given text and measure the average latency. Our INT8 model leads to $4 . 1 6 \mathrm { x } / 4 . 0 6 \mathrm { x }$ speedup for $\mathrm { G P T } { - } 3 _ { 3 5 0 \mathrm { M } } / \mathrm { G P T } { - } 3 _ { 1 . 3 \mathrm { B } }$ as compared to the FP16 counterpart.
|
| 172 |
+
|
| 173 |
+
# 5.4 A Showcase of GPT- $\mathbf { J _ { 6 B } }$ and GPT-NeoX20B
|
| 174 |
+
|
| 175 |
+
To demonstrate the scalability of ZeroQuant, we applied it to two of the largest open-sourced models, i.e., $\mathrm { G P T - J _ { 6 B } }$ and G $\mathrm { P T } \mathrm { - N e o } X _ { 2 0 \mathrm { B } }$ , which have 6B and 20B parameters separately.
|
| 176 |
+
|
| 177 |
+
We report the results of $\mathrm { G P T - J _ { 6 B } }$ in Table 7 on three generation datasets, i.e., PTB [42], Wikitext-2, and Wikitext-103 [43]. As can be seen, as compared to FP16 precision, ZeroQuant achieves similar PPL on all three different tasks. To compare the latency, we again use the average latency number to generate the first 50 tokens. Our W8A8 can get up to $3 . 6 7 \mathrm { x }$ speedup compared to the FP16 version.
|
| 178 |
+
|
| 179 |
+
To quantize GPT- $\mathrm { \cdot N e o X _ { 2 0 B } }$ to W8A8 for all GeMMs, the accuracy significantly decreases. We retrieve the quantization of each weight matrix and of each activation, and finally find out that the activation quantization for the attention calculation (i.e., the input of self-attention) causes the accuracy loss. We conjecture that this is because of the sensitivity of the self-attention module for extra-large models (20B) but cannot verify this for other models due to the lack of open-sourced extra-large models and the full evaluation pipeline. As such, we leave the input activation for self-attention in FP16 and quantize the rest to INT8. The results are shown in Table 8. Our W8A8/16 achieves similar accuracy performance but can reduce both the GPU resource requirement (from 2 A100 GPUs to 1) and the latency from $6 5 \mathrm { m s }$ to $2 5 \mathrm { m s }$ , which together lead to $5 . 2 \mathrm { x }$ better throughput/efficiency.
|
| 180 |
+
|
| 181 |
+
# 5.5 Ablation Study of Different Components
|
| 182 |
+
|
| 183 |
+
To investigate the performance gain of each component we introduced in Section 4, i.e., group-wise weight quantization, token-wise activation quantization, and lightweight layer-by-layer knowledge distillation, we here do an ablation study on $\mathbf { B E R T _ { l a r g e } }$ with W4/8A8.
|
| 184 |
+
|
| 185 |
+
Table 7: Post training quantization result of GPT$\mathrm { J } _ { 6 \mathrm { B } }$ on three zero-shot generation tasks
|
| 186 |
+
|
| 187 |
+
<table><tr><td>Precision PTB</td><td>Wikitext-2 Wikitext-103</td><td></td><td>Latency</td></tr><tr><td>W16A16 20.47</td><td>10.35</td><td>10.35</td><td>29.13ms (1x)</td></tr><tr><td>W8A8 20.97</td><td>10.51</td><td>10.52</td><td>7.94ms (3.67x)</td></tr></table>
|
| 188 |
+
|
| 189 |
+
Table 8: Post training quantization result of GPTNeoX20B on 19 zero-shot evaluation datasets. Please see Table I.4 for the results of all 19 tasks.
|
| 190 |
+
|
| 191 |
+
<table><tr><td colspan="4">Precision Lambada PIQA Ave.19 Tasks Latency</td></tr><tr><td>W16A16</td><td>71.7 77.7</td><td>50.5</td><td>2×65ms (1x)</td></tr><tr><td>W8A8/16</td><td>71.9 78.3</td><td>50.4</td><td>1×25ms (5.2x)</td></tr></table>
|
| 192 |
+
|
| 193 |
+
Table 9: Ablation study of different components for $\mathbf { B E R T _ { l a r g e } }$ on the development set of GLUE. The quantization scheme used here is W4/8A8. Here, GQ is the abbreviation of group-wise weight quantization, TQ is the abbreviation of token-wise activation quantization.
|
| 194 |
+
|
| 195 |
+
<table><tr><td>GQ</td><td>TQ</td><td>LKD</td><td>CoLA</td><td>MNLI-m</td><td>MNLI-mm</td><td>MRPC</td><td>QNLI</td><td>QQP</td><td>RTE</td><td>SST-2</td><td>STS-B</td><td>Ave.</td></tr><tr><td></td><td></td><td>X</td><td>-0.79</td><td>33.07</td><td>32.94</td><td>68.38/80.54</td><td>49.42</td><td>63.18/0.00</td><td>52.71</td><td>52.29</td><td>-4.27/-1.90</td><td>35.85</td></tr><tr><td></td><td></td><td>X</td><td>59.81</td><td>66.63</td><td>68.79</td><td>68.63/71.17</td><td>83.87</td><td>78.24/61.30</td><td>46.93</td><td>89.45</td><td>54.58/32.52</td><td>66.52</td></tr><tr><td>x</</td><td>xx/</td><td>X</td><td>62.34</td><td>84.62</td><td>84.25</td><td>87.75/91.38</td><td>91.87</td><td>89.86/86.09</td><td>47.65</td><td>91.97</td><td>89.39/89.17</td><td>81.06</td></tr><tr><td>√</td><td>√</td><td>√</td><td>63.51</td><td>84.70</td><td>84.71</td><td>88.73/91.99</td><td>91.73</td><td>90.25/86.74</td><td>49.82</td><td>92.09</td><td>89.34/89.08</td><td>81.62</td></tr></table>
|
| 196 |
+
|
| 197 |
+
Table 10: Post training quantization result of GPT- $\cdot 3 _ { 3 5 0 \mathrm { M } }$ on 20 zero-shot evaluation datesets The quantization scheme here is W4/8A8. Please see Table I.3 for the results of all 20 tasks.
|
| 198 |
+
|
| 199 |
+
<table><tr><td>Method</td><td>Data Resource</td><td>Lambada (↑)</td><td>PIQA (↑)</td><td>OpenBookQA (↑)</td><td>RTE(↑)</td><td>ReCoRd (↑)</td><td>Ave.19 Tasks (↑)</td><td>Wikitext-2 (↓)</td></tr><tr><td>ZeroQuant</td><td></td><td>10.5</td><td>57.7</td><td>28.0</td><td>52.7</td><td>55.3</td><td>33.4</td><td>92.1</td></tr><tr><td>ZeroQuant-LKD</td><td>Random data</td><td>26.1</td><td>59.3</td><td>29.2</td><td>50.5</td><td>64.9</td><td>34.5</td><td>40.6</td></tr><tr><td>ZeroQuant-LKD</td><td>Wikipedia</td><td>33.9</td><td>62.4</td><td>28.0</td><td>52.7</td><td>69.5</td><td>36.2</td><td>30.4</td></tr><tr><td>ZeroQuant-LKD</td><td>Original data</td><td>37.4</td><td>61.8</td><td>28.2</td><td>53.1</td><td>68.5</td><td>36.6</td><td>31.1</td></tr></table>
|
| 200 |
+
|
| 201 |
+
We present the results in Table 9. As can be seen, group-wise weight quantization boosts the accuracy (random-guess prediction) from PTQ to a non-trivial result (66.52). Further adding token-wise quantization improves 14.54 points accuracy performance. On top of those (i.e., ZeroQuant), LKD further brings a 0.56 point gain.
|
| 202 |
+
|
| 203 |
+
# 5.6 No Access to The Original Training Data
|
| 204 |
+
|
| 205 |
+
As mentioned in previous sections, the original training data are oftentimes hard to access due to the privacy and/or confidential issues. Therefore, we here study the performance of our LKD when there is no direct access to the original training data. As the distillation objective of our LKD does not depend on the label, the training data used for LKD can be very flexible.
|
| 206 |
+
|
| 207 |
+
We compare the performance of GPT- $\cdot 3 _ { 3 5 0 \mathrm { M } }$ on W4/8A8 quantization scheme using three different training data resources, i.e., random data (using random integer number to generate token ids), Wikipedia (using Huggingface to get the data2), and original PILE dataset.
|
| 208 |
+
|
| 209 |
+
The results are shown in Table 10. Compared to ZeroQuant, LKD using random data can boost the accuracy by $1 . 1 \%$ and reduce the PPL from 92.1 to 40.6. The reason why random data can still significantly improve the performance is that LKD does not optimize the end-to-end pipeline and it only layer-by-layer learns the internal dependency from the teacher model. Therefore, random data can also provide meaningful information. Using Wikipedia data from Huggingface can further improve the accuracy to 36.2 and reduce the PPL to 30.4, which is comparable to the results using the original data. This indicates that a clean text dataset can be used for LKD when we do not have access to the original full dataset.
|
| 210 |
+
|
| 211 |
+
# 6 Conclusions
|
| 212 |
+
|
| 213 |
+
With the rapid growth of large model sizes, we have reach a point to consider how to serve those models in practice. Although several works demonstrate that post-training quantization can be applied to BERT models, to the best of our knowledge, there have been no existing works on (1) billion-scale GPT-3-style models, (2) ultra-low precision post-training quantization, and (3) end-to-end solution of how to efficiently serve the quantized model online. In this work, we offer fine-grained compression schemes for both weight and activations to enable INT8 quantization for up to 20B-scale models ( $\mathrm { \bf J P T - N e o X } _ { 2 0 \mathrm { B } }$ ). We also offer a novel affordable layer-by-layer knowledge distillation for ultra-low precision quantization, which leads to $3 \mathbf { x }$ model size reduction compared to FP16 model while achieving minimal accuracy degradation. Furthermore, we provide a system backend support and show up to $5 . 1 9 \mathrm { x }$ speedup on BERT models and $5 . 2 \mathrm { x }$ better efficiency on GPT-NeoX20B.
|
| 214 |
+
|
| 215 |
+
References
|
| 216 |
+
[1] Ardavan Afshar, Ioakeim Perros, Evangelos E Papalexakis, Elizabeth Searles, Joyce Ho, and Jimeng Sun. Copa: Constrained parafac2 for sparse & large datasets. In Proceedings of the 27th ACM International Conference on Information and Knowledge Management, pages 793–802, 2018.
|
| 217 |
+
[2] Reza Yazdani Aminabadi, Samyam Rajbhandari, Minjia Zhang, Ammar Ahmad Awan, Cheng Li, Du Li, Elton Zheng, Jeff Rasley, Shaden Smith, Olatunji Ruwase, et al. Deepspeed inference: Enabling efficient inference of transformer models at unprecedented scale. arXiv preprint arXiv:2207.00032, 2022.
|
| 218 |
+
[3] 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.
|
| 219 |
+
[4] Jonathan Berant, Andrew Chou, Roy Frostig, and Percy Liang. Semantic parsing on Freebase from question-answer pairs. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1533–1544, Seattle, Washington, USA, October 2013. Association for Computational Linguistics.
|
| 220 |
+
[5] Sid Black, Stella Biderman, Alex Andonian, Quentin Anthony, Preetham Gali, Leo Gao, Eric Hallahan, Josh Levy-Kramer, Connor Leahy, Lucas Nestler, Kip Parker, Jason Phang, Michael Pieler, Shivanshu Purohit, Tri Songz, Phil Wang, and Samuel Weinbach. GPT-NeoX: Large scale autoregressive language modeling in pytorch, 2021.
|
| 221 |
+
[6] NVIDIA blog. CUTLASS: Fast Linear Algebra in CUDA $\mathrm { C } { + + }$ . https://developer.nvid ia.com/blog/cutlass-linear-algebra-cuda/, December 2017.
|
| 222 |
+
[7] Yelysei Bondarenko, Markus Nagel, and Tijmen Blankevoort. Understanding and overcoming the challenges of efficient transformer quantization. arXiv preprint arXiv:2109.12948, 2021.
|
| 223 |
+
[8] Michael Boratko, Harshit Padigela, Divyendra Mikkilineni, Pritish Yuvraj, Rajarshi Das, Andrew McCallum, Maria Chang, Achille Fokoue-Nkoutche, Pavan Kapanipathi, Nicholas Mattei, et al. A systematic classification of knowledge, reasoning, and context within the arc dataset. arXiv preprint arXiv:1806.00358, 2018.
|
| 224 |
+
[9] 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.
|
| 225 |
+
[10] Yaohui Cai, Zhewei Yao, Zhen Dong, Amir Gholami, Michael W Mahoney, and Kurt Keutzer. Zeroq: A novel zero shot quantization framework. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13169–13178, 2020.
|
| 226 |
+
[11] Daniel Cer, Mona Diab, Eneko Agirre, Inigo Lopez-Gazpio, and Lucia Specia. Semeval-2017 task 1: Semantic textual similarity-multilingual and cross-lingual focused evaluation. arXiv preprint arXiv:1708.00055, 2017.
|
| 227 |
+
[12] 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.
|
| 228 |
+
[13] Christopher Clark, Kenton Lee, Ming-Wei Chang, Tom Kwiatkowski, Michael Collins, and Kristina Toutanova. Boolq: Exploring the surprising difficulty of natural yes/no questions. arXiv preprint arXiv:1905.10044, 2019.
|
| 229 |
+
[14] Ido Dagan, Dan Roth, Mark Sammons, and Fabio Massimo Zanzotto. Recognizing textual entailment: Models and applications. Synthesis Lectures on Human Language Technologies, 6(4):1–220, 2013.
|
| 230 |
+
[15] Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Łukasz Kaiser. Universal transformers. arXiv preprint arXiv:1807.03819, 2018.
|
| 231 |
+
[16] 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.
|
| 232 |
+
[17] Jesse Dodge, Gabriel Ilharco, Roy Schwartz, Ali Farhadi, Hannaneh Hajishirzi, and Noah Smith. Fine-tuning pretrained language models: Weight initializations, data orders, and early stopping. arXiv preprint arXiv:2002.06305, 2020.
|
| 233 |
+
[18] William B Dolan and Chris Brockett. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005), 2005.
|
| 234 |
+
[19] Zhen Dong, Zhewei Yao, Amir Gholami, Michael W Mahoney, and Kurt Keutzer. HAWQ: Hessian aware quantization of neural networks with mixed-precision. In Proceedings of the IEEE International Conference on Computer Vision, pages 293–302, 2019.
|
| 235 |
+
[20] Steven K Esser, Jeffrey L McKinstry, Deepika Bablani, Rathinakumar Appuswamy, and Dharmendra S Modha. Learned step size quantization. arXiv preprint arXiv:1902.08153, 2019.
|
| 236 |
+
[21] Angela Fan, Edouard Grave, and Armand Joulin. Reducing transformer depth on demand with structured dropout. arXiv preprint arXiv:1909.11556, 2019.
|
| 237 |
+
[22] Angela Fan, Pierre Stock, Benjamin Graham, Edouard Grave, Remi Gribonval, Herve Jegou, and Armand Joulin. Training with quantization noise for extreme fixed-point compression. arXiv preprint arXiv:2004.07320, 2020.
|
| 238 |
+
[23] Leo Gao, Stella Biderman, Sid Black, Laurence Golding, Travis Hoppe, Charles Foster, Jason Phang, Horace He, Anish Thite, Noa Nabeshima, et al. The pile: An 800gb dataset of diverse text for language modeling. arXiv preprint arXiv:2101.00027, 2020.
|
| 239 |
+
[24] Amir Gholami, Sehoon Kim, Zhen Dong, Zhewei Yao, Michael W Mahoney, and Kurt Keutzer. A survey of quantization methods for efficient neural network inference. arXiv preprint arXiv:2103.13630, 2021.
|
| 240 |
+
[25] Mitchell A Gordon, Kevin Duh, and Nicholas Andrews. Compressing bert: Studying the effects of weight pruning on transfer learning. arXiv preprint arXiv:2002.08307, 2020.
|
| 241 |
+
[26] Song Han, Jeff Pool, John Tran, and William Dally. Learning both weights and connections for efficient neural network. In Advances in neural information processing systems, pages 1135–1143, 2015.
|
| 242 |
+
[27] Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. Workshop paper in NIPS, 2014.
|
| 243 |
+
[28] Shankar Iyer, Nikhil Dandekar, and Kornl Csernai. First quora dataset release: Question pairs.(2017). URL https://data. quora. com/First-Quora-Dataset-Release-Question-Pairs, 2017.
|
| 244 |
+
[29] 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.
|
| 245 |
+
[30] Jing Jin, Cai Liang, Tiancheng Wu, Liqin Zou, and Zhiliang Gan. Kdlsq-bert: A quantized bert combining knowledge distillation with learned step size quantization. arXiv preprint arXiv:2101.05938, 2021.
|
| 246 |
+
[31] 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.
|
| 247 |
+
[32] Sehoon Kim, Amir Gholami, Zhewei Yao, Michael W Mahoney, and Kurt Keutzer. I-bert: Integer-only bert quantization. In International conference on machine learning, pages 5506– 5518. PMLR, 2021.
|
| 248 |
+
[33] Guokun Lai, Qizhe Xie, Hanxiao Liu, Yiming Yang, and Eduard Hovy. Race: Large-scale reading comprehension dataset from examinations. arXiv preprint arXiv:1704.04683, 2017.
|
| 249 |
+
[34] Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. Albert: A lite bert for self-supervised learning of language representations. arXiv preprint arXiv:1909.11942, 2019.
|
| 250 |
+
[35] Yann LeCun, John S Denker, and Sara A Solla. Optimal brain damage. In Advances in neural information processing systems, pages 598–605, 1990.
|
| 251 |
+
[36] Hector Levesque, Ernest Davis, and Leora Morgenstern. The winograd schema challenge. In Thirteenth International Conference on the Principles of Knowledge Representation and Reasoning. Citeseer, 2012.
|
| 252 |
+
[37] Fengfu Li, Bo Zhang, and Bin Liu. Ternary weight networks. arXiv preprint arXiv:1605.04711, 2016.
|
| 253 |
+
[38] Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. arXiv preprint arXiv:1608.08710, 2016.
|
| 254 |
+
[39] Zhenhua Liu, Yunhe Wang, Kai Han, Wei Zhang, Siwei Ma, and Wen Gao. Post-training quantization for vision transformer. Advances in Neural Information Processing Systems, 34, 2021.
|
| 255 |
+
[40] Huizi Mao, Song Han, Jeff Pool, Wenshuo Li, Xingyu Liu, Yu Wang, and William J Dally. Exploring the regularity of sparse structure in convolutional neural networks. Workshop paper in CVPR, 2017.
|
| 256 |
+
[41] Yihuan Mao, Yujing Wang, Chufan Wu, Chen Zhang, Yang Wang, Yaming Yang, Quanlu Zhang, Yunhai Tong, and Jing Bai. Ladabert: Lightweight adaptation of bert through hybrid model compression. arXiv preprint arXiv:2004.04124, 2020.
|
| 257 |
+
[42] Mary Ann Marcinkiewicz. Building a large annotated corpus of english: The penn treebank. Using Large Corpora, page 273, 1994.
|
| 258 |
+
[43] Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. In International Conference on Learning Representations, 2017.
|
| 259 |
+
[44] Paul Michel, Omer Levy, and Graham Neubig. Are sixteen heads really better than one? arXiv preprint arXiv:1905.10650, 2019.
|
| 260 |
+
[45] Todor Mihaylov, Peter Clark, Tushar Khot, and Ashish Sabharwal. Can a suit of armor conduct electricity? a new dataset for open book question answering. arXiv preprint arXiv:1809.02789, 2018.
|
| 261 |
+
[46] Markus Nagel, Rana Ali Amjad, Mart Van Baalen, Christos Louizos, and Tijmen Blankevoort. Up or down? adaptive rounding for post-training quantization. In International Conference on Machine Learning, pages 7197–7206. PMLR, 2020.
|
| 262 |
+
[47] Markus Nagel, Mart van Baalen, Tijmen Blankevoort, and Max Welling. Data-free quantization through weight equalization and bias correction. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1325–1334, 2019.
|
| 263 |
+
[48] Denis Paperno, Germán Kruszewski, Angeliki Lazaridou, Quan Ngoc Pham, Raffaella Bernardi, Sandro Pezzelle, Marco Baroni, Gemma Boleda, and Raquel Fernández. The lambada dataset: Word prediction requiring a broad discourse context. arXiv preprint arXiv:1606.06031, 2016.
|
| 264 |
+
[49] Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019.
|
| 265 |
+
[50] 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.
|
| 266 |
+
[51] Alessandro Raganato, Yves Scherrer, and Jörg Tiedemann. Fixed encoder self-attention patterns in transformer-based machine translation. arXiv preprint arXiv:2002.10260, 2020.
|
| 267 |
+
[52] Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. SQuAD: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250, 2016.
|
| 268 |
+
[53] Jeff Rasley, Samyam Rajbhandari, Olatunji Ruwase, and Yuxiong He. Deepspeed: System optimizations enable training deep learning models with over 100 billion parameters. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 3505–3506, 2020.
|
| 269 |
+
[54] Greg Ruetsch. Using tensor cores in cuda fortran. Nvidia Blog, 2021.
|
| 270 |
+
[55] Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. Winogrande: An adversarial winograd schema challenge at scale. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 8732–8740, 2020.
|
| 271 |
+
[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.
|
| 272 |
+
[57] 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 AAAI, pages 8815–8821, 2020.
|
| 273 |
+
[58] 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.
|
| 274 |
+
[59] Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Y Ng, and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pages 1631–1642, 2013.
|
| 275 |
+
[60] Siqi Sun, Yu Cheng, Zhe Gan, and Jingjing Liu. Patient knowledge distillation for bert model compression. arXiv preprint arXiv:1908.09355, 2019.
|
| 276 |
+
[61] 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.
|
| 277 |
+
[62] Chaofan Tao, Lu Hou, Wei Zhang, Lifeng Shang, Xin Jiang, Qun Liu, Ping Luo, and Ngai Wong. Compression of generative pre-trained language models via quantization. arXiv preprint arXiv:2203.10705, 2022.
|
| 278 |
+
[63] Sandeep Tata and Jignesh M Patel. Piqa: An algebra for querying protein data sets. In 15th International Conference on Scientific and Statistical Database Management, 2003., pages 141–150. IEEE, 2003.
|
| 279 |
+
[64] Ian Tenney, Dipanjan Das, and Ellie Pavlick. Bert rediscovers the classical nlp pipeline. arXiv:1905.05950, 2019.
|
| 280 |
+
[65] 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.
|
| 281 |
+
[66] 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.
|
| 282 |
+
[67] Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax, May 2021.
|
| 283 |
+
[68] Guibin Wang, Yisong Lin, and Wei Yi. Kernel fusion: An effective method for better power efficiency on multithreaded GPU. In Peidong Zhu, Lizhe Wang, Feng Xia, Huajun Chen, Ian McLoughlin, Shiao-Li Tsao, Mitsuhisa Sato, Sun-Ki Chai, and Irwin King, editors, 2010 IEEE/ACM Int’l Conference on Green Computing and Communications, GreenCom 2010, & Int’l Conference on Cyber, Physical and Social Computing, CPSCom 2010, Hangzhou, China, December 18-20, 2010, pages 344–350. IEEE Computer Society, 2010.
|
| 284 |
+
[69] 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. arXiv preprint arXiv:2002.10957, 2020.
|
| 285 |
+
[70] Alex Warstadt, Amanpreet Singh, and Samuel R Bowman. Neural network acceptability judgments. arXiv preprint arXiv:1805.12471, 2018.
|
| 286 |
+
[71] Adina Williams, Nikita Nangia, and Samuel Bowman. A broad-coverage challenge corpus for sentence understanding through inference. 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 1112–1122, 2018.
|
| 287 |
+
[72] Adina Williams, Tristan Thrush, and Douwe Kiela. Anlizing the adversarial natural language inference dataset. arXiv preprint arXiv:2010.12729, 2020.
|
| 288 |
+
[73] Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, et al. HuggingFace’s Transformers: State-of-the-art natural language processing. ArXiv, pages arXiv–1910, 2019.
|
| 289 |
+
[74] Hao Wu, Patrick Judd, Xiaojie Zhang, Mikhail Isaev, and Paulius Micikevicius. Integer quantization for deep learning inference: Principles and empirical evaluation. arXiv preprint arXiv:2004.09602, 2020.
|
| 290 |
+
[75] Vikas Yadav, Steven Bethard, and Mihai Surdeanu. Quick and (not so) dirty: Unsupervised selection of justification sentences for multi-hop question answering. arXiv preprint arXiv:1911.07176, 2019.
|
| 291 |
+
[76] Zhewei Yao, Linjian Ma, Sheng Shen, Kurt Keutzer, and Michael W Mahoney. Mlpruning: A multilevel structured pruning framework for transformer-based models. arXiv preprint arXiv:2105.14636, 2021.
|
| 292 |
+
[77] Ali Hadi Zadeh, Isak Edo, Omar Mohamed Awad, and Andreas Moshovos. Gobo: Quantizing attention-based nlp models for low latency and energy efficient inference. In 2020 53rd Annual IEEE/ACM International Symposium on Microarchitecture (MICRO), pages 811–824. IEEE, 2020.
|
| 293 |
+
[78] Ofir Zafrir, Guy Boudoukh, Peter Izsak, and Moshe Wasserblat. Q8BERT: Quantized 8bit bert. arXiv preprint arXiv:1910.06188, 2019.
|
| 294 |
+
[79] 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.
|
| 295 |
+
[80] Sheng Zhang, Xiaodong Liu, Jingjing Liu, Jianfeng Gao, Kevin Duh, and Benjamin Van Durme. Record: Bridging the gap between human and machine commonsense reading comprehension. arXiv preprint arXiv:1810.12885, 2018.
|
| 296 |
+
[81] Wei Zhang, Lu Hou, Yichun Yin, Lifeng Shang, Xiao Chen, Xin Jiang, and Qun Liu. Ternarybert: Distillation-aware ultra-low bit bert. arXiv preprint arXiv:2009.12812, 2020.
|
| 297 |
+
|
| 298 |
+
# Checklist
|
| 299 |
+
|
| 300 |
+
1. For all authors...
|
| 301 |
+
|
| 302 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 303 |
+
(b) Did you describe the limitations of your work? [Yes] Please see Appendix H.
|
| 304 |
+
(c) Did you discuss any potential negative societal impacts of your work? [N/A] ZeroQuant a common machine learning technique.
|
| 305 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 306 |
+
|
| 307 |
+
2. If you are including theoretical results...
|
| 308 |
+
|
| 309 |
+
(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]
|
| 310 |
+
|
| 311 |
+
3. If you ran experiments...
|
| 312 |
+
|
| 313 |
+
(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 very comprehensive experimental details in Appendix A.
|
| 314 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] All details are in Appendix A.
|
| 315 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] Our results are based on a single set of hyperparameters. So it does not rely on the randomness. However, we do provide a tuning results in Appendix E.
|
| 316 |
+
(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] Those are in Appendix A.
|
| 317 |
+
|
| 318 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 319 |
+
|
| 320 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] We cited all dataset and github repository used in the paper.
|
| 321 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 322 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 323 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 324 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 325 |
+
|
| 326 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 327 |
+
|
| 328 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 329 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 330 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/f3zNgKga_ep/f3zNgKga_ep.md
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Video Diffusion Models
|
| 2 |
+
|
| 3 |
+
Jonathan Ho∗ jonathanho@google.com
|
| 4 |
+
|
| 5 |
+
Tim Salimans∗ salimans@google.com
|
| 6 |
+
|
| 7 |
+
Alexey Gritsenko agritsenko@google.com
|
| 8 |
+
|
| 9 |
+
William Chan williamchan@google.com
|
| 10 |
+
|
| 11 |
+
Mohammad Norouzi mnorouzi@google.com
|
| 12 |
+
|
| 13 |
+
David J. Fleet davidfleet@google.com
|
| 14 |
+
|
| 15 |
+
# Abstract
|
| 16 |
+
|
| 17 |
+
Generating temporally coherent high fidelity video is an important milestone in generative modeling research. We make progress towards this milestone by proposing a diffusion model for video generation that shows very promising initial results. Our model is a natural extension of the standard image diffusion architecture, and it enables jointly training from image and video data, which we find to reduce the variance of minibatch gradients and speed up optimization. To generate long and higher resolution videos we introduce a new conditional sampling technique for spatial and temporal video extension that performs better than previously proposed methods. We present the first results on a large text-conditioned video generation task, as well as state-of-the-art results on established benchmarks for video prediction and unconditional video generation. Supplementary material is available at https://video-diffusion.github.io/.
|
| 18 |
+
|
| 19 |
+
# 1 Introduction
|
| 20 |
+
|
| 21 |
+
Diffusion models have recently been producing high quality results in image generation and audio generation [e.g. 28, 39, 40, 16, 23, 36, 48, 60, 42, 10, 29], and there is significant interest in validating diffusion models in new data modalities. In this work, we present first results on video generation using diffusion models, for both unconditional and conditional settings.
|
| 22 |
+
|
| 23 |
+
We show that high quality videos can be generated using essentially the standard formulation of the Gaussian diffusion model [46], with little modification other than straightforward architectural changes to accommodate video data within the memory constraints of deep learning accelerators. We train models that generate a fixed number of video frames using a 3D U-Net diffusion model architecture, and we enable generating longer videos by applying this model autoregressively using a new method for conditional generation. We additionally show the benefits of joint training on video and image modeling objectives. We test our methods on video prediction and unconditional video generation, where we achieve state-of-the-art sample quality scores, and we also show promising first results on text-conditioned video generation.
|
| 24 |
+
|
| 25 |
+
# 2 Background
|
| 26 |
+
|
| 27 |
+
A diffusion model [46, 47, 22] specified in continuous time [53, 48, 10, 28] is a generative model with latents $\mathbf { z } = \{ \mathbf { z } _ { t } | t \in [ 0 , 1 ] \}$ obeying a forward process $q ( \mathbf { z } | \mathbf { x } )$ starting at data $\mathbf { x } \sim p ( \mathbf { x } )$ . The forward process is a Gaussian process that satisfies the Markovian structure:
|
| 28 |
+
|
| 29 |
+
$$
|
| 30 |
+
\begin{array} { r } { q ( \mathbf { z } _ { t } | \mathbf { x } ) = \mathcal { N } ( \mathbf { z } _ { t } ; \alpha _ { t } \mathbf { x } , \sigma _ { t } ^ { 2 } \mathbf { I } ) , \quad q ( \mathbf { z } _ { t } | \mathbf { z } _ { s } ) = \mathcal { N } ( \mathbf { z } _ { t } ; ( \alpha _ { t } / \alpha _ { s } ) \mathbf { z } _ { s } , \sigma _ { t | s } ^ { 2 } \mathbf { I } ) } \end{array}
|
| 31 |
+
$$
|
| 32 |
+
|
| 33 |
+
where $0 \leq s < t \leq 1$ , $\sigma _ { t | s } ^ { 2 } = ( 1 - e ^ { \lambda _ { t } - \lambda _ { s } } ) \sigma _ { t } ^ { 2 }$ , and $\alpha _ { t } , \sigma _ { t }$ specify a differentiable noise schedule whose log signal-to-noise-ratio $\lambda _ { t } = \log [ \alpha _ { t } ^ { 2 } / \sigma _ { t } ^ { 2 } ]$ decreases with $t$ until $q ( \mathbf { z } _ { 1 } ) \approx \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ .
|
| 34 |
+
|
| 35 |
+
Training Learning to reverse the forward process for generation can be reduced to learning to denoise ${ \mathbf z } _ { t } \sim q ( { \mathbf z } _ { t } | { \mathbf x } )$ into an estimate $\hat { \mathbf { x } } _ { \theta } ( { \mathbf z } _ { t } , \lambda _ { t } ) \approx { \mathbf x }$ for all $t$ (we will drop the dependence on $\lambda _ { t }$ to simplify notation). We train this denoising model $\hat { \mathbf { x } } _ { \theta }$ using a weighted mean squared error loss
|
| 36 |
+
|
| 37 |
+
$$
|
| 38 |
+
\mathbb { E } _ { \epsilon , t } \big [ w ( \lambda _ { t } ) \| \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) - \mathbf { x } \| _ { 2 } ^ { 2 } \big ]
|
| 39 |
+
$$
|
| 40 |
+
|
| 41 |
+
over uniformly sampled times $t \in [ 0 , 1 ]$ . This reduction of generation to denoising can be justified as optimizing a weighted variational lower bound on the data log likelihood under the diffusion model, or as a form of denoising score matching [56, 47, 22, 28]. In practice, we use the $\epsilon$ -prediction parameterization, defined as $\hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) = ( \mathbf { z } _ { t } - \sigma _ { t } \mathbf { \epsilon } _ { \theta } ( \mathbf { z } _ { t } ) ) / \alpha _ { t }$ , and train $\epsilon _ { \theta }$ using a mean squared error in $\epsilon$ space with $t$ sampled according to a cosine schedule [37]. This corresponds to a particular weighting $w ( \lambda _ { t } )$ for learning a scaled score estimate $\epsilon _ { \theta } ( \mathbf { z } _ { t } ) \approx - \sigma _ { t } \nabla _ { \mathbf { z } _ { t } } \log p ( \mathbf { z } _ { t } )$ , where $p \bar { ( \mathbf { z } _ { t } ) }$ is the true density of $\mathbf { z } _ { t }$ under $\mathbf { x } \sim p ( \mathbf { x } )$ [22, 28, 48]. We also train using the $\mathbf { v }$ -prediction parameterization for certain models [42].
|
| 42 |
+
|
| 43 |
+
Sampling We use a variety of diffusion model samplers in this work. One is the discrete time ancestral sampler [22] with sampling variances derived from lower and upper bounds on reverse process entropy [46, 22, 37]. To define this sampler, first note that the forward process can be described in reverse as ${ q ( \mathbf { z } _ { s } | \mathbf { \bar { z } } _ { t } , \mathbf { x } ) } = \mathcal { N } ( \mathbf { z } _ { s } ; \tilde { \mu } _ { s | t } ( \mathbf { \bar { z } } _ { t } ^ { \cdot } , \mathbf { x } ) , \tilde { \sigma } _ { s | t } ^ { 2 } \mathbf { I } )$ (noting $s < t$ ), where
|
| 44 |
+
|
| 45 |
+
$$
|
| 46 |
+
\tilde { \mu } _ { s | t } ( \mathbf { z } _ { t } , \mathbf { x } ) = e ^ { \lambda _ { t } - \lambda _ { s } } ( \alpha _ { s } / \alpha _ { t } ) \mathbf { z } _ { t } + ( 1 - e ^ { \lambda _ { t } - \lambda _ { s } } ) \alpha _ { s } \mathbf { x } \quad \mathrm { a n d } \quad \tilde { \sigma } _ { s | t } ^ { 2 } = ( 1 - e ^ { \lambda _ { t } - \lambda _ { s } } ) \sigma _ { s } ^ { 2 } .
|
| 47 |
+
$$
|
| 48 |
+
|
| 49 |
+
Starting at ${ \bf z } _ { 1 } \sim \mathcal { N } ( { \bf 0 } , { \bf I } )$ , the ancestral sampler follows the rule
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
\mathbf { z } _ { s } = \tilde { \pmb { \mu } } _ { s | t } ( \mathbf { z } _ { t } , \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) ) + \sqrt { ( \tilde { \sigma } _ { s | t } ^ { 2 } ) ^ { 1 - \gamma } ( \sigma _ { t | s } ^ { 2 } ) ^ { \gamma } } \epsilon
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+
where $\epsilon$ is standard Gaussian noise, $\gamma$ is a hyperparameter that controls the stochasticity of the sampler [37], and $s , t$ follow a uniformly spaced sequence from 1 to 0.
|
| 56 |
+
|
| 57 |
+
Another sampler, which we found especially effective with our new method for conditional generation (Section 3.1), is the predictor-corrector sampler [48]. Our version of this sampler alternates between the ancestral sampler step (4) and a Langevin correction step of the form
|
| 58 |
+
|
| 59 |
+
$$
|
| 60 |
+
\mathbf { z } _ { s } \gets \mathbf { z } _ { s } - \frac { 1 } { 2 } \delta \sigma _ { s } \epsilon _ { \theta } ( \mathbf { z } _ { s } ) + \sqrt { \delta } \sigma _ { s } \epsilon ^ { \prime }
|
| 61 |
+
$$
|
| 62 |
+
|
| 63 |
+
where $\delta$ is a step size which we fix to 0.1 here, and $\epsilon ^ { \prime }$ is another independent sample of standard Gaussian noise. The purpose of the Langevin step is to help the marginal distribution of each $\mathbf { z } _ { s }$ generated by the sampler to match the true marginal under the forward process starting at $\mathbf { x } \sim p ( \mathbf { x } )$ .
|
| 64 |
+
|
| 65 |
+
In the conditional generation setting, the data $\mathbf { x }$ is equipped with a conditioning signal $\mathbf { c }$ , which may represent a class label, text caption, or other type of conditioning. To train a diffusion model to fit $p ( \mathbf { x } | \mathbf { c } )$ , the only modification that needs to be made is to provide c to the model as $\hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } )$ . Improvements to sample quality can be obtained in this setting by using classifier-free guidance [20]. This method samples using adjusted model predictions $\tilde { \epsilon } _ { \theta }$ , constructed via
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\tilde { \epsilon } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } ) = ( 1 + w ) \epsilon _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } ) - w \epsilon _ { \theta } ( \mathbf { z } _ { t } ) ,
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
where $w$ is the guidance strength, $\begin{array} { r } { \mathbf { \epsilon } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } ) = \frac { 1 } { \sigma _ { t } } ( \mathbf { z } _ { t } - \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } , \mathbf { c } ) ) } \end{array}$ is the regular conditional model prediction, and $\boldsymbol { \epsilon } _ { \boldsymbol { \theta } } ( \mathbf { z } _ { t } )$ is a prediction from an unconditional model jointly trained with the conditional model (if $\mathbf { c }$ consists of embedding vectors, unconditional modeling can be represented as $\mathbf { c } = \mathbf { 0 }$ ). For $w > 0$ this adjustment has the effect of over-emphasizing the effect of conditioning on the signal c, which tends to produce samples of lower diversity but higher quality compared to sampling from the regular conditional model [20]. The method can be interpreted as a way to guide the samples towards areas where an implicit classifier $p ( \mathbf { c } | \mathbf { z } _ { t } )$ has high likelihood, and is an adaptation of the explicit classifier guidance method proposed by [16].
|
| 72 |
+
|
| 73 |
+
# 3 Video diffusion models
|
| 74 |
+
|
| 75 |
+
Our approach to video generation using diffusion models is to use the standard diffusion model formalism described in Section 2 with a neural network architecture suitable for video data. Each of our models is trained to jointly model a fixed number of frames at a fixed spatial resolution. To extend sampling to longer sequences of frames or higher spatial resolutions, we will repurpose our models with a conditioning technique described later in Section 3.1.
|
| 76 |
+
|
| 77 |
+
In prior work on image modeling, the standard architecture for $\hat { \mathbf { x } } _ { \theta }$ in an image diffusion model is a U-Net [38, 44], which is a neural network architecture constructed as a spatial downsampling pass followed by a spatial upsampling pass with skip connections to the downsampling pass activations. The network is built from layers of 2D convolutional residual blocks, for example in the style of the Wide ResNet [65], and each such convolutional block is followed by a spatial attention block [55, 58, 11]. Conditioning information, such as c and $\lambda _ { t }$ , is provided to the network in the form of an embedding vector added into each residual block (we find it helpful for our models to process these embedding vectors using several MLP layers before adding).
|
| 78 |
+
|
| 79 |
+
We propose to extend this image diffusion model architecture to video data, given by a block of a fixed number of frames, using a particular type of 3D U-Net [13] that is factorized over space and time. First, we modify the image model architecture by changing each 2D convolution into a space-only 3D convolution, for instance, we change each 3x3 convolution into a 1x3x3 convolution (the first axis indexes video frames, the second and third index the spatial height and width). The attention in each spatial attention block remains as attention over space; i.e., the first axis is treated as a batch axis. Second, after each spatial attention block, we insert a temporal attention block that performs attention over the first axis and treats the spatial axes as batch axes. We use relative position embeddings [45] in each temporal attention block so that the network can distinguish ordering of frames in a way that does not require an absolute notion of video time. We visualize the model architecture in Fig. 1.
|
| 80 |
+
|
| 81 |
+

|
| 82 |
+
Figure 1: The 3D U-Net architecture for $\hat { \mathbf { x } } _ { \theta }$ in the diffusion model. Each block represents a 4D tensor with axes labeled as frames $\times$ height $\times$ width $\times$ channels, processed in a space-time factorized manner as described in Section 3. The input is a noisy video $\mathbf { z } _ { t }$ , conditioning c, and the log SNR $\lambda _ { t }$ . The downsampling/upsampling blocks adjust the spatial input resolution height $\times$ width by a factor of 2 through each of the $K$ blocks. The channel counts are specified using channel multipliers $M _ { 1 }$ , $M _ { 2 } , . . . , M _ { K }$ , and the upsampling pass has concatenation skip connections to the downsampling pass.
|
| 83 |
+
|
| 84 |
+
The use of factorized space-time attention is known to be a good choice in video transformers for its computational efficiency [2, 5, 21]. An advantage of our factorized space-time architecture, which is unique to our video generation setting, is that it is particularly straightforward to mask the model to run on independent images rather than a video, simply by removing the attention operation inside each time attention block and fixing the attention matrix to exactly match each key and query vector at each video timestep. The utility of doing so is that it allows us to jointly train the model on both video and image generation. We find in our experiments that this joint training is important for sample quality (Section 4).
|
| 85 |
+
|
| 86 |
+
# 3.1 Reconstruction-guided sampling for improved conditional generation
|
| 87 |
+
|
| 88 |
+
The videos we consider modeling typically consist of hundreds to thousands of frames, at a frame rate of at least 24 frames per second. To manage the computational requirements of training our models, we only train on a small subset of say 16 frames at a time. However, at test time we can generate longer videos by extending our samples. For example, we could first generate a video $\mathbf { x } ^ { \mathrm { a } } \sim p _ { \theta } ( \mathbf { x } )$ consisting of 16 frames, and then extend it with a second sample $\mathbf { x } ^ { \mathrm { { b } } } \sim p _ { \theta } ( \mathbf { x } ^ { \mathrm { { b } } } | \mathbf { x } ^ { \mathrm { { a } } } )$ . If $\mathbf { x } ^ { \mathrm { { b } } }$ consists of frames following $\mathbf { x } ^ { \mathrm { a } }$ , this allows us to autoregressively extend our sampled videos to arbitrary lengths, which we demonstrate in Section 4.3.3. Alternatively, we could choose $\mathbf { x } ^ { \mathrm { a } }$ to represent a video of lower frame rate, and then define $\mathbf { x } ^ { \mathrm { { b } } }$ to be those frames in between the frames of $\mathbf { x } ^ { \mathrm { a } }$ . This allows one to then to upsample a video temporally, similar to how [34] generate high resolution images through spatial upsampling.
|
| 89 |
+
|
| 90 |
+
Both approaches require one to sample from a conditional model, $p _ { \theta } ( \mathbf { x } ^ { \mathrm { { b } } } | \mathbf { x } ^ { \mathrm { { a } } } )$ . This conditional model could be trained explicitly, but it can also be derived approximately from our unconditional model $p _ { \theta } ( \mathbf { x } )$ by imputation, which has the advantage of not requiring a separately trained model. For example, [48] present a general method for conditional sampling from a jointly trained diffusion model $p _ { \theta } ( \mathbf { x } = \mathbf { \bar { \rho } } [ \mathbf { x } ^ { \mathrm { a } } , \mathbf { x } ^ { \mathrm { b } } ] )$ : In their approach to sampling from $\bar { p } _ { \theta } ( \mathbf { x } ^ { \bar { \mathbf { b } } } | \mathbf { x } ^ { \mathrm { a } } )$ , the sampling procedure for updating $\mathbf { z } _ { s } ^ { \mathrm { b } }$ is unchanged from the standard method for sampling from $p _ { \theta } ( \mathbf { z } _ { s } | \mathbf { z } _ { t } )$ , with $\mathbf { \dot { z } } _ { s } = [ \mathbf { z } _ { s } ^ { \mathrm { a } } , \mathbf { z } _ { s } ^ { \mathrm { b } } ]$ , but the samples for $\mathbf { z } _ { s } ^ { \mathrm { a } }$ are replaced by exact samples from the forward process, $q ( \mathbf { z } _ { s } ^ { \mathrm { a } } | \mathbf { x } ^ { \mathrm { a } } )$ , at each iteration. The samples $\mathbf { z } _ { s } ^ { \mathrm { a } }$ then have the correct marginal distribution by construction, and the samples $\mathbf { z } _ { s } ^ { \mathrm { b } }$ will conform with $\mathbf { z } _ { s } ^ { \mathrm { a } }$ through their effect on the denoising model $\hat { \mathbf { x } } _ { \theta } \big ( \bigl [ \mathbf { z } _ { t } ^ { \mathrm { a } } , \mathbf { z } _ { t } ^ { \mathrm { b } } \bigr ] \big )$ . Similarly, we could sample $\mathbf { z } _ { s } ^ { \mathrm { a } }$ from $q ( \mathbf { z } _ { s } ^ { \mathrm { a } } | \mathbf { x } ^ { \mathrm { a } } , \mathbf { z } _ { t } ^ { \mathrm { a } } )$ , which follows the correct conditional distribution in addition to the correct marginal. We will refer to both of these approaches as the replacement method for conditional sampling from diffusion models.
|
| 91 |
+
|
| 92 |
+
When we tried the replacement method to conditional sampling, we found it to not work well for our video models: Although samples $\mathbf { x } ^ { \mathrm { { b } } }$ looked good in isolation, they were often not coherent with $\mathbf { x } ^ { \mathrm { a } }$ . This is caused by a fundamental problem with this replacement sampling method. That is, the latents $\mathbf { z } _ { s } ^ { \mathrm { b } }$ are updated in the direction provided by $\hat { \mathbf { x } } _ { \theta } ^ { \hat { \mathbf { b } } } ( \mathbf { z } _ { t } ) \approx \mathbb { E } _ { q } [ \mathbf { x } ^ { b } | \mathbf { z } _ { t } ]$ , while what is needed instead is $\mathbb { E } _ { q } [ \mathbf { x } ^ { b } | \mathbf { z } _ { t } , \mathbf { x } ^ { a } ]$ . Writing this in terms of the score of the data distribution, we get $\mathbb { E } _ { q } [ { \mathbf { x } } ^ { b } | { \mathbf { z } } _ { t } , { \mathbf { x } } ^ { a } ] = \mathbb { E } _ { q } [ { \mathbf { x } } ^ { b } | { \mathbf { z } } _ { t } ] + ( \sigma _ { t } ^ { 2 } / \alpha _ { t } ) \nabla _ { { \mathbf { z } } _ { t } ^ { b } } \log q ( { \mathbf { x } } ^ { a } | { \mathbf { z } } _ { t } )$ , where the second term is missing in the replacement method. Assuming a perfect denoising model, plugging in this missing term would make conditional sampling exact. Since $q ( \mathbf { x } ^ { a } | \mathbf { z } _ { t } )$ is not available in closed form, however, we instead propose to approximate it using a Gaussian of the form $q ( \mathbf { x } ^ { a } | \mathbf { z } _ { t } ) \approx \mathcal { N } [ \hat { \mathbf { x } } _ { \theta } ^ { \mathrm { a } } ( \mathbf { z } _ { t } ) , ( \sigma _ { t } ^ { 2 } / \alpha _ { t } ^ { 2 } ) \mathrm { I } ]$ , where $\hat { \mathbf { x } } _ { \theta } ^ { \mathrm { a } } ( \mathbf { z } _ { t } )$ is a reconstruction of the conditioning data $\mathbf { x } ^ { \mathrm { a } }$ provided by our denoising model. Assuming a perfect model, this approximation becomes exact as $t \to 0$ , and empirically we find it to be good for larger $t$ also. Plugging in the approximation, and adding a weighting factor $w _ { r }$ , our proposed method to conditional sampling is a variant of the replacement method with an adjusted denoising model, $\tilde { \mathbf { x } } _ { \theta } ^ { b }$ , defined by
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
\tilde { \mathbf { x } } _ { \theta } ^ { b } ( \mathbf { z } _ { t } ) = \hat { \mathbf { x } } _ { \theta } ^ { b } ( \mathbf { z } _ { t } ) - \frac { w _ { r } \alpha _ { t } } { 2 } \nabla _ { \mathbf { z } _ { t } ^ { b } } \| \mathbf { x } ^ { a } - \hat { \mathbf { x } } _ { \theta } ^ { a } ( \mathbf { z } _ { t } ) \| _ { 2 } ^ { 2 } .
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
The additional gradient term in this expression can be interpreted as a form of guidance [16, 20] based on the model’s reconstruction of the conditioning data, and we therefore refer to this method as reconstruction-guided sampling, or simply reconstruction guidance. Like with other forms of guidance, we find that choosing a larger weighting factor, $w _ { r } \ > 1$ , tends to improve sample quality. We empirically investigate reconstruction guidance in Section 4.3.3, where we find it to work surprisingly well, especially when combined with predictor-corrector samplers using Langevin diffusion [48].
|
| 99 |
+
|
| 100 |
+
Reconstruction guidance also extends to the case of spatial interpolation (or super-resolution), in which the mean squared error loss is imposed on a downsampled version of the model prediction, and backpropagation is performed through this downsampling. In this setting, we have low resolution ground truth videos $\mathbf { x } ^ { a }$ (e.g. at the 64x64 spatial resolution), which may be generated from a low resolution model, and we wish to upsample them into high resolution videos (e.g. at the $1 2 8 \mathrm { x } 1 2 8$ spatial resolution) using an unconditional high resolution diffusion model $\hat { \mathbf { x } } _ { \theta }$ . To accomplish this, we adjust the high resolution model as follows:
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\widetilde { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) = \hat { \mathbf { x } } _ { \theta } ( \mathbf { z } _ { t } ) - \frac { w _ { r } \alpha _ { t } } { 2 } \nabla _ { \mathbf { z } _ { t } } \| \mathbf { x } ^ { a } - \hat { \mathbf { x } } _ { \theta } ^ { a } ( \mathbf { z } _ { t } ) \| _ { 2 } ^ { 2 }
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
where $\hat { \mathbf { x } } _ { \theta } ^ { a } ( \mathbf { z } _ { t } )$ is our model’s reconstruction of the low-resolution video from $\mathbf { z } _ { t }$ , which is obtained by downsampling the high resolution output of the model using a differentiable downsampling algorithm such as bilinear interpolation. Note that it is also possible to simultaneously condition on low resolution videos while autoregressively extending samples at the high resolution using the same reconstruction guidance method. In Fig. 2, we show samples of this approach for extending 16x64x64 low resolution samples at frameskip 4 to 64x128x128 samples at frameskip 1 using a $9 { \bf x } 1 2 8 { \bf x } 1 2 8$ diffusion model.
|
| 107 |
+
|
| 108 |
+
# 4 Experiments
|
| 109 |
+
|
| 110 |
+
We report our results on video diffusion models for unconditional video generation (Section 4.1), conditional video generation (video prediction) (Section 4.2), and text-conditioned video generation (Section 4.3). We evaluate our models using standard metrics such as FVD [54], FID [19], and IS [43]; details on evaluation are provided below alongside each benchmark. Samples and additional results are provided at https://video-diffusion.github.io/. Architecture hyperparameters, training details, and compute resources are listed in Appendix A.
|
| 111 |
+
|
| 112 |
+
# 4.1 Unconditional video modeling
|
| 113 |
+
|
| 114 |
+
To demonstrate our approach on unconditional generation, we use a popular benchmark of Soomro et al. [49] for unconditional modeling of video. The benchmark consists of short clips of people performing one of 101 activities, and was originally collected for the purpose of training action recognition models. We model short segments of 16 frames from this dataset, downsampled to a spatial resolution of 64x64. In Table 1 we present perceptual quality scores for videos generated by our model, and we compare against methods from the literature, finding that our method strongly improves upon the previous state-of-the-art.
|
| 115 |
+
|
| 116 |
+
We use the data loader provided by TensorFlow Datasets [1] without further processing, and we train on all 13,320 videos. Similar to previous methods, we use the C3D network $[ 5 1 ] ^ { 2 }$ for calculating FID and IS, using 10,000 samples generated from our model. C3D internally resizes input data to the $1 1 2 \mathrm { x } 1 1 2$ spatial resolution, so perceptual scores are approximately comparable even when the data is sampled at a different resolution originally. As discussed by [64], methods in the literature are unfortunately not always consistent in the data preprocessing that is used, which may lead to small differences in reported scores between papers. The Inception Score we calculate for real data $( \approx 6 0 )$ is consistent with that reported by [26], who also report a higher real data Inception score of $\approx 9 0$ for data sampled at the $1 2 8 \mathrm { x } 1 2 8$ resolution, which indicates that our 64x64 model might be at a disadvantage compared to works that generate at a higher resolution. Nevertheless, our model obtains the best perceptual quality metrics that we could find in the literature.
|
| 117 |
+
|
| 118 |
+
<table><tr><td>Method</td><td>Resolution</td><td>FID↓</td><td>IS个</td></tr><tr><td>MoCoGAN[52]</td><td>16x64x64</td><td>26998 ± 33</td><td>12.42</td></tr><tr><td>TGAN-F [26]</td><td>16x64x64</td><td>8942.63 ± 3.72</td><td>13.62</td></tr><tr><td>TGAN-ODE [18]</td><td>16x64x64</td><td>26512 ± 27</td><td>15.2</td></tr><tr><td>TGAN-F [26]</td><td>16x128x128</td><td>7817 ±10</td><td>22.91 ± .19</td></tr><tr><td>VideoGPT[62]</td><td>16x128x128</td><td></td><td>24.69 ± 0.30</td></tr><tr><td>TGAN-v2 [41]</td><td>16x64x64</td><td>3431±19</td><td>26.60 ± 0.47</td></tr><tr><td>TGAN-v2 [41]</td><td>16x128x128</td><td>3497± 26</td><td>28.87 ± 0.47</td></tr><tr><td>DVD-GAN [14]</td><td>16x128x128</td><td></td><td>32.97 ± 1.7</td></tr><tr><td>Video Diffusion (ours)</td><td>16x64x64</td><td>295±3</td><td>57 ± 0.62</td></tr><tr><td>real data</td><td>16x64x64</td><td></td><td>60.2</td></tr></table>
|
| 119 |
+
|
| 120 |
+
Table 1: Unconditional video modeling results on UCF101.
|
| 121 |
+
|
| 122 |
+
# 4.2 Video prediction
|
| 123 |
+
|
| 124 |
+
A common benchmark task for evaluating generative models of video is video prediction, where the model is given the first frame(s) of a video and is asked to generate the remainder. Models that do well on this conditional generation task are usually trained explicitly for this conditional setting, for example by being autoregressive across frames. Although our models are instead only trained unconditionally, we can adapt them to the video prediction setting by using the guidance method proposed in section 3.1. Here we evaluate this method on two popular video prediction benchmarks, obtaining state-of-the-art results.
|
| 125 |
+
|
| 126 |
+
BAIR Robot Pushing We evaluate video prediction performance on BAIR Robot Pushing [17], a standard benchmark in the video literature consisting of approximately 44000 videos of robot pushing motions at the $6 4 \mathrm { x } 6 4$ spatial resolution. Methods for this benchmark are conditioned on 1 frame and generate the next 15. Results are listed in Table 2. Following the evaluation protocol of [4] and others, we calculate FVD [54] using the I3D network [8] by comparing $1 0 0 \times 2 5 6$ model samples against the 256 examples in the evaluation set.
|
| 127 |
+
|
| 128 |
+
Kinetics-600 We additionally evaluate video prediction performance on the Kinetics-600 benchmark [27, 9]. Kinetics-600 contains approximately 400 thousand training videos depicting 600 different activities. We train unconditional models on this dataset at the $6 4 \times 6 4$ resolution and evaluate on 50 thousand randomly sampled videos from the test set, where we condition on a randomly sampled subsequence of 5 frames and generate the next 11 frames. Like previous works, we calculate FVD and Inception Score using the I3D network [8]. See Table 3 for results. In our reported results we sample test videos without replacement, and we use the same randomly selected subsequences for generating model samples and for defining the ground truth, since this results in the lowest bias and variance in the reported FVD metric. However, from personal communication we learned that [33, 14] instead sampled with replacement, and used a different random seed when sampling the ground truth data. We find that this way of evaluating raises the FVD obtained by our model slightly, from 16.2 to 16.9. Inception Score is unaffected.
|
| 129 |
+
|
| 130 |
+
Table 2: Video prediction on BAIR Robot Pushing.
|
| 131 |
+
|
| 132 |
+
<table><tr><td rowspan=1 colspan=3>Method FVD↓</td></tr><tr><td rowspan=1 colspan=3>DVD-GAN [14] 109.8</td></tr><tr><td rowspan=1 colspan=3>VideoGPT[62] 103.3</td></tr><tr><td rowspan=1 colspan=2>TrIVD-GAN-FP[33]</td><td rowspan=1 colspan=1>103.3</td></tr><tr><td rowspan=1 colspan=2>Transframer [35]</td><td rowspan=1 colspan=1>100</td></tr><tr><td rowspan=1 colspan=2>CCVS [31]</td><td rowspan=1 colspan=1>99</td></tr><tr><td rowspan=2 colspan=3>VideoTransformer[59] 94FitVid [4] 93.6NUWA [61] 86.9</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>93.6</td></tr><tr><td rowspan=1 colspan=3>Video Diffusion (ours)ancestral sampler, 512 steps 68.19Langevin sampler,256 steps 66.92</td></tr></table>
|
| 133 |
+
|
| 134 |
+
Table 3: Video prediction on Kinetics-600.
|
| 135 |
+
|
| 136 |
+
<table><tr><td>Method</td><td>FVD↓</td><td>IS↑</td></tr><tr><td>Video Transformer [59] DVD-GAN-FP [14] Video VQ-VAE [57]</td><td>170±5 69.1 ± 0.78 64.3 ± 2.04</td><td></td></tr><tr><td>CCVS [31] TrIVD-GAN-FP[33] Transframer [35]</td><td>55±1 25.74 ± 0.66 25.4</td><td>12.54</td></tr><tr><td>Video Diffusion (ours) ancestral, 256 steps Langevin,128 steps</td><td>18.6 16.2 ± 0.34</td><td>15.39 15.64</td></tr></table>
|
| 137 |
+
|
| 138 |
+
# 4.3 Text-conditioned video generation
|
| 139 |
+
|
| 140 |
+
The remaining experiments reported are on text-conditioned video generation. In this text-conditioned video generation setting, we employ a dataset of 10 million captioned videos, and we condition the diffusion model on captions in the form of BERT-large embeddings [15] processed using attention pooling. We consider two model sizes: a small model for the joint training ablation, and a large model for generating the remaining results (both architectures are described in detail in Appendix A), and we explore the effects of joint video-image training, classifier-free guidance, and our newly proposed reconstruction guidance method for autoregressive extension and simultaneous spatial and temporal super-resolution. We report the following metrics in this section on 4096 samples: the video metric FVD, and the Inception-based image metrics FID and IS measured by averaging activations across frames (FID/IS-avg) and by measuring the first frame only (FID/IS-first). For FID and FVD, we report two numbers which are measured against the training and validation sets, respectively. For IS, we report two numbers which are averaged scores across 1 split and 10 splits of samples, respectively.
|
| 141 |
+
|
| 142 |
+

|
| 143 |
+
Figure 2: Text-conditioned video samples from a cascade of two models. First samples are generated from a $1 6 \mathrm { x } 6 4 \mathrm { x } 6 4$ frameskip 4 model. Then those samples are treated as ground truth for simultaneous super-resolution and autoregressive extension to $6 4 \mathrm { x } 1 2 8 \mathrm { x } 1 2 8$ using a $9 \mathrm { x } 1 2 8 \mathrm { x } 1 2 8$ frameskip 1 model. Both models are conditioned on the text prompt. In this figure, the text prompt, low resolution frames, and high resolution frames are visualized in sequence. See Fig. 5 for more samples.
|
| 144 |
+
|
| 145 |
+
# 4.3.1 Joint training on video and image modeling
|
| 146 |
+
|
| 147 |
+
As described in Section 3, one of the main advantages of our video architecture is that it allows us to easily train the model jointly on video and image generative modeling objectives. To implement this joint training, we concatenate random independent image frames to the end of each video sampled from the dataset, and we mask the attention in the temporal attention blocks to prevent mixing information across video frames and each individual image frame. We choose these random independent images from random videos within the same dataset; in future work we plan to explore the effect of choosing images from other larger image-only datasets.
|
| 148 |
+
|
| 149 |
+
Table 4 reports results for an experiment on text-conditioned $1 6 \mathrm { x } 6 4 \mathrm { x } 6 4$ videos, where we consider training on an additional 0, 4, or 8 independent image frames per video. One can see clear improvements in video and image sample quality metrics as more independent image frames are added. Adding independent image frames has the effect of reducing variance of the gradient at the expense of some bias for the video modeling objective, and thus it can be seen as a memory optimization to fit more independent examples in a batch.
|
| 150 |
+
|
| 151 |
+
Table 4: Improved sample quality due to image-video joint training on text-to-video generation.
|
| 152 |
+
|
| 153 |
+
<table><tr><td>Image frames</td><td>FVD↓</td><td>FID-avg↓</td><td>IS-avg↑</td><td>FID-first↓</td><td>IS-first↑</td></tr><tr><td>0</td><td>202.28/205.42</td><td>37.52/37.40</td><td>7.91/7.58</td><td>41.14/40.87</td><td>9.23/8.74</td></tr><tr><td>4</td><td>68.11/70.74</td><td>18.62/18.42</td><td>9.02/8.53</td><td>22.54/22.19</td><td>10.58/9.91</td></tr><tr><td>8</td><td>57.84/60.72</td><td>15.57/15.44</td><td>9.32/8.82</td><td>19.25/18.98</td><td>10.81/10.12</td></tr></table>
|
| 154 |
+
|
| 155 |
+
# 4.3.2 Effect of classifier-free guidance
|
| 156 |
+
|
| 157 |
+
Table 5 reports results that verify the effectiveness of classifier-free guidance [20] on text-to-video generation. As expected, there is clear improvement in the Inception Score-like metrics with higher guidance weight, while the FID-like metrics improve and then degrade with increasing guidance weight. Similar findings have been reported on text-to-image generation [36].
|
| 158 |
+
|
| 159 |
+

|
| 160 |
+
Figure 3 shows the effect of classifier-free guidance [20] on a text-conditioned video model. Similar to what was observed in other work that used classifier-free guidance on text-conditioned image generation [36] and class-conditioned image generation [20, 16], adding guidance increases the sample fidelity of each individual image and emphases the effect of the conditioning signal.
|
| 161 |
+
Figure 3: Example frames from a random selection of videos generated by our $1 6 \mathrm { x } 6 4 \mathrm { x } 6 4$ textconditioned model. Left: unguided samples, right: guided samples using classifier-free guidance.
|
| 162 |
+
|
| 163 |
+
Table 5: Effect of classifier-free guidance on text-to-video generation (large models). Sample quality is reported for 16x64x64 models trained on frameskip 1 and 4 data. The model was jointly trained on 8 independent image frames per 16-frame video.
|
| 164 |
+
|
| 165 |
+
<table><tr><td>Frameskip</td><td>Guidance weight</td><td>FVD↓</td><td>FID-avg↓</td><td>IS-avg↑</td><td>FID-first↓</td><td>IS-first↑</td></tr><tr><td>1</td><td>1.0</td><td>41.65/43.70</td><td>12.49/12.39</td><td>10.80/10.07</td><td>16.42/16.19</td><td>12.17/11.22</td></tr><tr><td></td><td>2.0</td><td>50.19/48.79</td><td>10.53/10.47</td><td>13.22/12.10</td><td>13.91/13.75</td><td>14.81/13.46</td></tr><tr><td></td><td>5.0</td><td>163.74/160.21</td><td>13.54/13.52</td><td>14.80/13.46</td><td>17.07/16.95</td><td>16.40/14.75</td></tr><tr><td>4</td><td>1.0</td><td>56.71/60.30</td><td>11.03/10.93</td><td>9.40/8.90</td><td>16.21/15.96</td><td>11.39/10.61</td></tr><tr><td></td><td>2.0</td><td>54.28/51.95</td><td>9.39/9.36</td><td>11.53/10.75</td><td>14.21/14.04</td><td>13.81/12.63</td></tr><tr><td></td><td>5.0</td><td>185.89/176.82</td><td>11.82/11.78</td><td>13.73/12.59</td><td>16.59/16.44</td><td>16.24/14.62</td></tr></table>
|
| 166 |
+
|
| 167 |
+
# 4.3.3 Autoregressive video extension for longer sequences
|
| 168 |
+
|
| 169 |
+
In Section 3.1 we proposed the reconstruction guidance method for conditional sampling from diffusion models, an improvement over the replacement method of [48]. In Table 6 we present results on generating longer videos using both techniques, and find that our proposed method indeed improves over the replacement method in terms of perceptual quality scores.
|
| 170 |
+
|
| 171 |
+
Figure 4 shows the samples of our reconstruction guidance method for conditional sampling compared to the replacement method (Section 3.1) for the purposes of generating long samples in a blockautoregressive manner (Section 4.3.3). The samples from the replacement method clearly show a lack of temporal coherence, since frames from different blocks throughout the generated videos appear to be uncorrelated samples (conditioned on c). The samples from the reconstruction guidance method, by contrast, are clearly temporally coherent over the course of the entire autoregressive generation process. Figure 2 additionally shows samples of using the reconstruction guidance method to simultaneously condition on low frequency, low resolution videos while autoregressively extending temporally at a high resolution.
|
| 172 |
+
|
| 173 |
+
Table 6: Generating $6 4 \mathrm { x } 6 4 \mathrm { x } 6 4$ videos using autoregressive extension of 16x64x64 models.
|
| 174 |
+
|
| 175 |
+
<table><tr><td>Guidance weight</td><td>Conditioning method</td><td>FVD↓</td><td>FID-avg↓</td><td>IS-avg↑</td><td>FID-first↓</td><td>IS-first↑</td></tr><tr><td rowspan="2">2.0</td><td>reconstruction guidance</td><td>136.22/134.55</td><td>13.77/13.62</td><td>10.30/9.66</td><td>16.34/16.46</td><td>14.67/13.37</td></tr><tr><td>replacement</td><td>451.45/436.16</td><td>25.95/25.52</td><td>7.00/6.75</td><td>16.33/16.46</td><td>14.67/13.34</td></tr><tr><td rowspan="2">5.0</td><td>reconstruction guidance</td><td>133.92/133.04</td><td>13.59/13.58</td><td>10.31/9.65</td><td>16.28/16.53</td><td>15.09/13.72</td></tr><tr><td>replacement</td><td>456.24/441.93</td><td>26.05/25.69</td><td>7.04/6.78</td><td>16.30/16.54</td><td>15.11/13.69</td></tr></table>
|
| 176 |
+
|
| 177 |
+

|
| 178 |
+
Figure 4: Comparing the replacement method (left) vs the reconstruction guidance method (right) for conditioning for block-autoregressive generation of 64 frames from a 16 frame model. Video frames are displayed over time from left to right; each row is an independent sample. The replacement method suffers from a lack of temporal coherence, unlike the reconstruction guidance method.
|
| 179 |
+
|
| 180 |
+
# 5 Related work
|
| 181 |
+
|
| 182 |
+
Prior work on video generation has usually employed other types of generative models, notably, autoregressive models, VAEs, GANs, and normalizing flows [e.g. 3, 4, 32, 30, 14, 59, 62, 57]. Related work on model classes similar to diffusion models includes [25, 24]. Concurrent work [63] proposes a diffusion-based approach to video generation that uses an image diffusion model to predict each individual frame within a RNN temporal autoregressive model. Our video diffusion model, by contrast, jointly models entire videos (blocks of frames) using a 3D video architecture with interleaved spatial and temporal attention, and we extend to long sequence lengths by filling in frames or autoregressive temporal extension.
|
| 183 |
+
|
| 184 |
+
# 6 Conclusion
|
| 185 |
+
|
| 186 |
+
We have introduced diffusion models for video modeling, thus bringing recent advances in generative modeling using diffusion models to the video domain. We have shown that with straightforward extensions of conventional U-Net architectures for 2D image modeling to 3D space-time, with factorized space-time attention blocks, one can learn effective generative models for video data using the standard formulation of the diffusion model. This includes unconditional models, text-conditioned models, and video prediction models.
|
| 187 |
+
|
| 188 |
+
We have additionally demonstrated the benefits of joint image-video training and classifier-free guidance for video diffusion models on both video and image sample quality metrics, and we also introduced a new reconstruction-guided conditional sampling method that outperforms existing replacement or imputation methods for conditional sampling from unconditionally trained models. Our reconstruction guidance method can generate long sequences using either frame interpolation (or temporal super-resolution) or extrapolation in an auto-regressive fashion, and also can perform spatial super-resolution. We look forward to investigating this method in a wider variety of conditioning settings.
|
| 189 |
+
|
| 190 |
+
Our goal with this work is to advance research on methods in generative modeling, and our methods have the potential to positively impact creative downstream applications. As with prior work in generative modeling, however, our methods have the potential for causing harmful impact and could enhance malicious or unethical uses of generative models, such as fake content generation, harassment, and misinformation spread, and thus we have decided not to release our models. Like all generative models, our models reflect the biases of their training datasets and thus may require curation to ensure fair results from sampling. In particular, our text-to-video models inherit the challenges faced by prior work on text-to-image models, and our future work will involve auditing for forms of social bias, similar to [6, 7, 50, 12] for image-to-text and image labeling models. We see our work as only a starting point for further investigation on video diffusion models and investigation into their societal implications, and we will aim to explore benchmark evaluations for social and cultural bias in the video generation setting and make the necessary research advances to address them.
|
| 191 |
+
|
| 192 |
+
References
|
| 193 |
+
[1] TensorFlow Datasets, a collection of ready-to-use datasets. https://www.tensorflow.org/ datasets, 2022.
|
| 194 |
+
[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.
|
| 195 |
+
[3] Mohammad Babaeizadeh, Chelsea Finn, Dumitru Erhan, Roy H Campbell, and Sergey Levine. Stochastic variational video prediction. arXiv preprint arXiv:1710.11252, 2017.
|
| 196 |
+
[4] Mohammad Babaeizadeh, Mohammad Taghi Saffar, Suraj Nair, Sergey Levine, Chelsea Finn, and Dumitru Erhan. FitVid: Overfitting in pixel-level video prediction. arXiv preprint arXiv:2106.13195, 2021.
|
| 197 |
+
[5] Gedas Bertasius, Heng Wang, and Lorenzo Torresani. Is space-time attention all you need for video understanding. arXiv preprint arXiv:2102.05095, 2(3):4, 2021.
|
| 198 |
+
[6] Joy Buolamwini and Timnit Gebru. Gender shades: Intersectional accuracy disparities in commercial gender classification. In Conference on Fairness, Accountability and Transparency, FAT 2018, 23-24 February 2018, New York, NY, USA, Proceedings of Machine Learning Research. PMLR, 2018.
|
| 199 |
+
[7] Kaylee Burns, Lisa Hendricks, Trevor Darrell, and Anna Rohrbach. Women also snowboard: Overcoming bias in captioning models. In European Conference on Computer Vision (ECCV), 2018.
|
| 200 |
+
[8] 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.
|
| 201 |
+
[9] Joao Carreira, Eric Noland, Andras Banki-Horvath, Chloe Hillier, and Andrew Zisserman. A short note about kinetics-600. arXiv preprint arXiv:1808.01340, 2018.
|
| 202 |
+
[10] Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, and William Chan. WaveGrad: Estimating gradients for waveform generation. International Conference on Learning Representations, 2021.
|
| 203 |
+
[11] Xi Chen, Nikhil Mishra, Mostafa Rohaninejad, and Pieter Abbeel. PixelSNAIL: An improved autoregressive generative model. In International Conference on Machine Learning, pages 863–871, 2018.
|
| 204 |
+
[12] Jaemin Cho, Abhay Zala, and Mohit Bansal. Dall-eval: Probing the reasoning skills and social biases of text-to-image generative transformers. arxiv:2202.04053, 2022.
|
| 205 |
+
[13] Özgün Çiçek, Ahmed Abdulkadir, Soeren S Lienkamp, Thomas Brox, and Olaf Ronneberger. 3d u-net: learning dense volumetric segmentation from sparse annotation. In International conference on medical image computing and computer-assisted intervention, pages 424–432. Springer, 2016.
|
| 206 |
+
[14] Aidan Clark, Jeff Donahue, and Karen Simonyan. Adversarial video generation on complex datasets. arXiv preprint arXiv:1907.06571, 2019.
|
| 207 |
+
[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, NAACL-HLT, pages 4171–4186. Association for Computational Linguistics, 2019.
|
| 208 |
+
[16] Prafulla Dhariwal and Alexander Nichol. Diffusion models beat GANs on image synthesis. Advances in Neural Information Processing Systems, 34, 2021.
|
| 209 |
+
[17] Frederik Ebert, Chelsea Finn, Alex X Lee, and Sergey Levine. Self-supervised visual planning with temporal skip connections. In CoRL, pages 344–356, 2017.
|
| 210 |
+
[18] Cade Gordon and Natalie Parde. Latent neural differential equations for video generation. In NeurIPS 2020 Workshop on Pre-registration in Machine Learning, pages 73–86. PMLR, 2021.
|
| 211 |
+
[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 Advances in Neural Information Processing Systems, pages 6626–6637, 2017.
|
| 212 |
+
[20] Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. In NeurIPS 2021 Workshop on Deep Generative Models and Downstream Applications, 2021.
|
| 213 |
+
[21] Jonathan Ho, Nal Kalchbrenner, Dirk Weissenborn, and Tim Salimans. Axial attention in multidimensional transformers. arXiv preprint arXiv:1912.12180, 2019.
|
| 214 |
+
[22] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In Advances in Neural Information Processing Systems, pages 6840–6851, 2020.
|
| 215 |
+
[23] 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.
|
| 216 |
+
[24] 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.
|
| 217 |
+
[25] Zahra Kadkhodaie and Eero P Simoncelli. Solving linear inverse problems using the prior implicit in a denoiser. arXiv preprint arXiv:2007.13640, 2020.
|
| 218 |
+
[26] Emmanuel Kahembwe and Subramanian Ramamoorthy. Lower dimensional kernels for video discriminators. Neural Networks, 132:506–520, 2020.
|
| 219 |
+
[27] 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.
|
| 220 |
+
[28] Diederik P Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational diffusion models. arXiv preprint arXiv:2107.00630, 2021.
|
| 221 |
+
[29] Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. DiffWave: A versatile diffusion model for audio synthesis. In 9th International Conference on Learning Representations, ICLR, 2021.
|
| 222 |
+
[30] Manoj Kumar, Mohammad Babaeizadeh, Dumitru Erhan, Chelsea Finn, Sergey Levine, Laurent Dinh, and Durk Kingma. VideoFlow: A flow-based generative model for video. arXiv preprint arXiv:1903.01434, 2019.
|
| 223 |
+
[31] Guillaume Le Moing, Jean Ponce, and Cordelia Schmid. Ccvs: Context-aware controllable video synthesis. Advances in Neural Information Processing Systems, 34, 2021.
|
| 224 |
+
[32] Alex X Lee, Richard Zhang, Frederik Ebert, Pieter Abbeel, Chelsea Finn, and Sergey Levine. Stochastic adversarial video prediction. arXiv preprint arXiv:1804.01523, 2018.
|
| 225 |
+
[33] Pauline Luc, Aidan Clark, Sander Dieleman, Diego de Las Casas, Yotam Doron, Albin Cassirer, and Karen Simonyan. Transformation-based adversarial video prediction on large-scale data. arXiv preprint arXiv:2003.04035, 2020.
|
| 226 |
+
[34] Jacob Menick and Nal Kalchbrenner. Generating high fidelity images with subscale pixel networks and multidimensional upscaling. In International Conference on Learning Representations, 2019.
|
| 227 |
+
[35] Charlie Nash, João Carreira, Jacob Walker, Iain Barr, Andrew Jaegle, Mateusz Malinowski, and Peter Battaglia. Transframer: Arbitrary frame prediction with generative models. arXiv preprint arXiv:2203.09494, 2022.
|
| 228 |
+
[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.
|
| 229 |
+
[37] Alexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In Marina Meila and Tong Zhang, editors, Proceedings of the 38th International Conference on Machine Learning, ICML, 2021.
|
| 230 |
+
[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.
|
| 231 |
+
[39] Chitwan Saharia, William Chan, Huiwen Chang, Chris A Lee, Jonathan Ho, Tim Salimans, David J Fleet, and Mohammad Norouzi. Palette: Image-to-image diffusion models. arXiv preprint arXiv:2111.05826, 2021.
|
| 232 |
+
[40] 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.
|
| 233 |
+
[41] Masaki Saito, Shunta Saito, Masanori Koyama, and Sosuke Kobayashi. Train sparsely, generate densely: Memory-efficient unsupervised training of high-resolution temporal GAN. International Journal of Computer Vision, 128(10):2586–2606, 2020.
|
| 234 |
+
[42] Tim Salimans and Jonathan Ho. Progressive distillation for fast sampling of diffusion models. In International Conference on Learning Representations, 2021.
|
| 235 |
+
[43] Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In Advances in Neural Information Processing Systems, pages 2234–2242, 2016.
|
| 236 |
+
[44] Tim Salimans, Andrej Karpathy, Xi Chen, and Diederik P Kingma. PixelCNN $^ { + + }$ : Improving the PixelCNN with discretized logistic mixture likelihood and other modifications. In International Conference on Learning Representations, 2017.
|
| 237 |
+
[45] Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. Self-attention with relative position representations. arXiv preprint arXiv:1803.02155, 2018.
|
| 238 |
+
[46] 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, 2015.
|
| 239 |
+
[47] Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. In Advances in Neural Information Processing Systems, pages 11895–11907, 2019.
|
| 240 |
+
[48] 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.
|
| 241 |
+
[49] Khurram Soomro, Amir Roshan Zamir, and Mubarak Shah. A dataset of 101 human actions classes from videos in the wild. CRCV-TR-12-01, 2012.
|
| 242 |
+
[50] Ryan Steed and Aylin Caliskan. Image representations learned with unsupervised pre-training contain human-like biases. In Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency, FAccT ’21, page 701–713. Association for Computing Machinery, 2021.
|
| 243 |
+
[51] 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.
|
| 244 |
+
[52] Sergey Tulyakov, Ming-Yu Liu, Xiaodong Yang, and Jan Kautz. Mocogan: Decomposing motion and content for video generation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1526–1535, 2018.
|
| 245 |
+
[53] Belinda Tzen and Maxim Raginsky. Neural stochastic differential equations: Deep latent gaussian models in the diffusion limit. arXiv preprint arXiv:1905.09883, 2019.
|
| 246 |
+
[54] 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.
|
| 247 |
+
[55] 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.
|
| 248 |
+
[56] Pascal Vincent. A connection between score matching and denoising autoencoders. Neural Computation, 23(7):1661–1674, 2011.
|
| 249 |
+
[57] Jacob Walker, Ali Razavi, and Aäron van den Oord. Predicting video with vqvae. arXiv preprint arXiv:2103.01950, 2021.
|
| 250 |
+
[58] 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.
|
| 251 |
+
[59] Dirk Weissenborn, Oscar Täckström, and Jakob Uszkoreit. Scaling autoregressive video models. In International Conference on Learning Representations, 2019.
|
| 252 |
+
[60] Jay Whang, Mauricio Delbracio, Hossein Talebi, Chitwan Saharia, Alexandros G Dimakis, and Peyman Milanfar. Deblurring via stochastic refinement. arXiv preprint arXiv:2112.02475, 2021.
|
| 253 |
+
[61] Chenfei Wu, Jian Liang, Lei Ji, Fan Yang, Yuejian Fang, Daxin Jiang, and Nan Duan. NÜWA: Visual synthesis pre-training for neural visual world creation. arXiv preprint arXiv:2111.12417, 2021.
|
| 254 |
+
[62] Wilson Yan, Yunzhi Zhang, Pieter Abbeel, and Aravind Srinivas. Videogpt: Video generation using vq-vae and transformers. arXiv preprint arXiv:2104.10157, 2021.
|
| 255 |
+
[63] Ruihan Yang, Prakhar Srivastava, and Stephan Mandt. Diffusion probabilistic modeling for video generation. arXiv preprint arXiv:2203.09481, 2022.
|
| 256 |
+
[64] Vladyslav Yushchenko, Nikita Araslanov, and Stefan Roth. Markov decision process for video generation. In Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops, pages 0–0, 2019.
|
| 257 |
+
[65] Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
|
| 258 |
+
|
| 259 |
+
# Checklist
|
| 260 |
+
|
| 261 |
+
1. For all authors...
|
| 262 |
+
|
| 263 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 264 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 265 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes]
|
| 266 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 267 |
+
|
| 268 |
+
2. If you are including theoretical results...
|
| 269 |
+
|
| 270 |
+
(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]
|
| 271 |
+
|
| 272 |
+
3. If you ran experiments...
|
| 273 |
+
|
| 274 |
+
(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]
|
| 275 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 276 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 277 |
+
(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]
|
| 278 |
+
|
| 279 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 280 |
+
|
| 281 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 282 |
+
(b) Did you mention the license of the assets? [N/A] Licenses of existing assets can be found via the citations we provided.
|
| 283 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 284 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 285 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes]
|
| 286 |
+
|
| 287 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 288 |
+
|
| 289 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 290 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 291 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/fARM4P0gAJV/fARM4P0gAJV.md
ADDED
|
@@ -0,0 +1,441 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Explainable Spatio-Temporal Forecasting with Shape Functions
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Spatio-temporal modeling and forecasting are challenging due to their complicated
|
| 11 |
+
2 spatial dependence, temporal dynamics, and scenarios. Many statistical models,
|
| 12 |
+
3 such as Spatial Auto-regression Model (SAR) and Spatial Dynamic Panel Data
|
| 13 |
+
4 Model (SDPD), are restricted by a pre-specified spatial weight matrix and thus
|
| 14 |
+
5 are limited to reflect its flexibility. Graph-based or convolution-based methods
|
| 15 |
+
6 can learn more flexible representations, but they fail to show the exact interactions
|
| 16 |
+
7 between locations due to the lack of explainability. This paper proposes a spatial re
|
| 17 |
+
8 gression model with shape functions to address the limitations of existing methods.
|
| 18 |
+
9 Our method learns the shape functions by incorporating shape constraints, which
|
| 19 |
+
10 are able to capture spatial variability or distance-based effects over distance. There
|
| 20 |
+
11 fore, our approach enjoys a learnable spatial weight matrix with a distance-based
|
| 21 |
+
12 explanation. We demonstrate our method’s efficiency and forecasting performance
|
| 22 |
+
13 on synthetic and real data.
|
| 23 |
+
|
| 24 |
+
# 14 1 Introduction
|
| 25 |
+
|
| 26 |
+
15 Spatio-temporal data is widely observed in many areas, such as transportation (33; 27), climatology
|
| 27 |
+
16 (2), and environmental research(19). The popularity of spatio-temporal data brings varieties of tasks
|
| 28 |
+
17 for researchers, and one of the key tasks is forecasting. Spatio-temporal data has some inherent
|
| 29 |
+
18 characteristics, namely, spatial dependence and temporal dynamics, which need to be considered for
|
| 30 |
+
19 modeling and forecasting.
|
| 31 |
+
20 Spatial dependence means that the observations at different locations are not independent, and
|
| 32 |
+
21 observations at closer locations often have a stronger correlation. In the statistics community,
|
| 33 |
+
22 extensive research has been conducted to model spatial dependence, and various spatial models have
|
| 34 |
+
23 been proposed. For example, in the spatial autoregressive (SAR) models, the spatial dependence is
|
| 35 |
+
24 modeled by a product of an unknown parameter and a pre-specified spatial weight matrix (4; 1; 11; 12).
|
| 36 |
+
25 Combined with the panel data, various types of spatial panel data models have been used to analyze
|
| 37 |
+
26 spatio-temporal data (35; 13; 7; 22). One limitation of the autoregressive models is that the elements
|
| 38 |
+
27 of the spatial weight matrix are pre-specified, such as an inverse distance. Although these pre
|
| 39 |
+
28 specified spatial weight matrices are applied to capture decreased distance-based effects, they fail to
|
| 40 |
+
29 capture complex distance relations in real-world applications.
|
| 41 |
+
30 Researchers in the computer science community have developed various methods modeling spatio
|
| 42 |
+
31 temporal data using deep neural networks. Various neural network architectures have been proposed
|
| 43 |
+
32 and applied to spatio-temporal forecasting, for example, spatio-temporal LSTM (31), fully connected
|
| 44 |
+
33 gated graph architecture (20), Convolutional LSTM (23) and etc. One advantage of these methods
|
| 45 |
+
34 is that they can incorporate unstructured data and rely on a high-performance computing platform
|
| 46 |
+
35 to learn complicated representations for spatio-temporal problems. However, a critical limitation of
|
| 47 |
+
36 these methods is that they fail to explain how the spatial interaction works explicitly. The lack of
|
| 48 |
+
37 interpretability restricts its reliability and deep insights into the underlying spatio-temporal process.
|
| 49 |
+
38 The explanation can be obtained if we can estimate the coefficient matrix that intuitively explains
|
| 50 |
+
39 spatio-temporal interactions.
|
| 51 |
+
40 In this paper, we propose an Explainable Spatio-Temporal Forecasting (ESTF) model, which utilizes
|
| 52 |
+
41 a spatial autoregressive model with shape functions to address the current limitations. Our method
|
| 53 |
+
42 extends the vector autoregressive (VAR) model (24) by incorporating distance information into the
|
| 54 |
+
43 temporal coefficient matrix using shape functions (3). The shape constraints are designed to be
|
| 55 |
+
44 consistent with the common fact that observations from neighbours have stronger spatial dependence
|
| 56 |
+
45 versus long-distance pairs. It is known as Tobler’s First Law, which is "Everything is related to
|
| 57 |
+
46 everything else, but near things are more related than distant things"(26; 18). Unlike the pre-specified
|
| 58 |
+
47 spatial weight matrix, this coefficient matrix is learnable and is thus more flexible in capturing
|
| 59 |
+
48 real-world complex spatial relations. Moreover, the shape functions are represented as a combination
|
| 60 |
+
49 of basis functions, and thus a smaller number of parameters needs to be estimated. Finally, ESTF can
|
| 61 |
+
50 be easily extended to forecasting in non-stationary scenarios using a dynamic spatial weight matrix.
|
| 62 |
+
51 We conduct experiments on both simulated and real data, and the results demonstrate that our method
|
| 63 |
+
52 achieves better forecast accuracy and is computationally efficient and more explainable.
|
| 64 |
+
|
| 65 |
+
# 53 2 Related work
|
| 66 |
+
|
| 67 |
+
54 Statistical models Several works focus on temporal dynamics when considering spatio-temporal
|
| 68 |
+
55 forecasting problems. The classical time series models, such as VAR, and ARIMA models, are applied
|
| 69 |
+
56 to spatio-temporal process modeling(21; 38). Besides, a spatial weight matrix is also introduced to the
|
| 70 |
+
57 ARIMA model to capture spatial dependence (28). The non-stationarity, particularly unit-root non
|
| 71 |
+
58 stationarity, is mainly modeled by ARIMA or Co-integration models. In addition, spatial regression
|
| 72 |
+
59 models or panel data are classical models in econometrics and can also be applied to model spatio
|
| 73 |
+
60 temporal problems. These models, for example, spatial auto-regression models, take spatial weight
|
| 74 |
+
61 matrix into consideration and estimate parameters in the framework of regression. However, the
|
| 75 |
+
62 common characteristics of these models need a pre-specified spatial weight matrix(35; 6). Elements
|
| 76 |
+
63 in the matrices are generally an inverse distance of corresponding locations. Meanwhile, these
|
| 77 |
+
64 spatial models focus on statistical inference on the scalar parameters placed before the spatial weight
|
| 78 |
+
65 matrix(25). Although there are many choices for the spatial weight matrix, such as inverse distance,
|
| 79 |
+
66 adjacency relationships, and K-nearest neighbors, there is a lack of research on estimating the spatial
|
| 80 |
+
67 weight matrix. The pre-specified spatial weight matrix restricts models’ application and fails to
|
| 81 |
+
68 capture more complicated underlying spatial dependence. Some researchers developed a sparse
|
| 82 |
+
69 spatio-temporal model that can estimate a sparse spatial weight matrix (17). The strict sparse setting
|
| 83 |
+
70 also restricts the wide application of the spatial weight matrix.
|
| 84 |
+
71 Graph-based methods Graph-based methods are widely applied for a non-Euclidean domain.
|
| 85 |
+
72 Some types of spatio-temporal data, for example, traffic flow data or brain network data, can be
|
| 86 |
+
73 represented as graphs. The graph structures well model the complicated spatial dependence. Thus,
|
| 87 |
+
74 the definition or pre-specified graphs structure is normally required when developing a graph-based
|
| 88 |
+
75 model. Related works can be found in (30; 14). The common typical method is GraphCNN, which is
|
| 89 |
+
76 to apply a convolutional transformation to the neighbors of each node (29; 34). The graph convolution
|
| 90 |
+
77 can capture patterns and features in the spatial domain. Graph-based methods have been proposed
|
| 91 |
+
78 and widely applied to lots of real cases. Traffic flow data modeling and forecasting is a popular topic
|
| 92 |
+
79 in this area (30; 20). Other topics, for example, climate sensor data (16), video (10) and etc, are also
|
| 93 |
+
80 applied by variant graph-based models. RNN or LSTM combined with graphs, i.e., a sequence of
|
| 94 |
+
81 graphs, are also considered in spatio-temporal forecasting problems (10).
|
| 95 |
+
82 CNN-based methods Unlike graph-based methods, CNN-based methods are more suitable for
|
| 96 |
+
83 modeling spatio-temporal data collected in regular grid locations. It applies filters to find relationships
|
| 97 |
+
84 between neighboring inputs. Although some works (32) applied convolution neural networks to
|
| 98 |
+
85 model non-grid traffic data, it is more common to see CNN-based methods process grid structures,
|
| 99 |
+
86 e.g., images, video rather than a general domain. As some spatio-temporal data are collected from a
|
| 100 |
+
87 regular grid in the Euclidean space (29), they thus can be viewed as a kind of special image. The CNN
|
| 101 |
+
88 structure combined with RNN or LSTM has been developed to make forecasting for spatio-temporal
|
| 102 |
+
89 data, for example, diffusion convolutional RNN (15), Convolutional LSTM networks (23; 36)and etc.
|
| 103 |
+
|
| 104 |
+
# 90 3 Proposed method
|
| 105 |
+
|
| 106 |
+
# 3.1 Problem formulation and notation
|
| 107 |
+
|
| 108 |
+
We use a $n \times 1$ vector $\mathbf { X _ { t } } ~ = ~ \{ \mathbf { x _ { 1 t } } , \mathbf { x _ { 2 t } } , \cdot \cdot \cdot , \mathbf { x _ { n t } } \}$ to denote observations at time $t$ , where $n$ is the number of locations. At each location $i$ , $\bf { S _ { i } } = ( c _ { i } ^ { x } , c _ { i } ^ { y } )$ is the coordinates of the location $i$ . The distance between location $\mathbf { S _ { i } }$ and $\mathbf { S _ { j } }$ is $d _ { i j } = \sqrt { ( d _ { i j } ^ { x } ) ^ { 2 } + ( d _ { i j } ^ { y } ) ^ { 2 } }$ , where $d _ { i j } ^ { x } = | c _ { i } ^ { x } - c _ { j } ^ { x } |$ and $d _ { i j } ^ { y } = | c _ { i } ^ { y } - c _ { j } ^ { y } |$ . Our goal is to make forecasting for spatio-temporal data: given training data set $\mathbf { X _ { 1 } } , \mathbf { X _ { 2 } } , \cdots , \mathbf { X _ { T } }$ , we would like to make forecasting for the next $h$ , $\hat { \mathbf { X } } _ { T + 1 } , \cdot \cdot \cdot , \hat { \mathbf { X } } _ { T + h }$ .
|
| 109 |
+
|
| 110 |
+
# 3.2 The stationary spatio-temporal model with shape functions
|
| 111 |
+
|
| 112 |
+
98 We first consider the stationary case. To model the spatio-temporal stationary process, we consider
|
| 113 |
+
99 the following model
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
\mathbf { X _ { t } } = \sum _ { \mathbf { k } = 1 } ^ { \mathbf { p } } \mathbf { W _ { k } } \mathbf { X _ { t - k } } + \epsilon _ { \mathbf { t } } ,
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
100 where $\mathbf { W _ { k } }$ is a spatial weight matrix for capturing the spatial dependence at $\log k$ , and $\epsilon _ { \mathbf { t } }$ is white noise. Moreover, we assume the 101 $( i , j )$ th element of $\mathbf { W _ { k } }$ , $w _ { i j } ^ { ( k ) }$ , depends on the distance $d _ { i j }$ . That is, 102 w(k)ij depends on a function $f _ { k } ( d _ { i j } )$ .
|
| 120 |
+
|
| 121 |
+
103 For spatio-temporal data, the spatial dependence, represented by $w _ { i j } ^ { ( k ) }$ , between locations decreases
|
| 122 |
+
104 as the distance between two locations increases. In other words, there is a shape constraint for
|
| 123 |
+
105 the function $f _ { k } ( d )$ , such as a decreasing function. In order to estimate the shape function, we
|
| 124 |
+
106 model $f _ { k } ( d )$ as a linear combination of basis functions $g _ { i } ( d ) , i = 1 , 2 , \cdots , m$ . More specifically,
|
| 125 |
+
107 the shape function $f _ { k } ( d )$ is a linear combination of basis functions and coefficients with positive
|
| 126 |
+
108 value $\bar { f _ { k } } ( d ) = a _ { 1 , k } ^ { 2 } \bar { g _ { 1 } } ( \dot { d } ) + \cdot \cdot \cdot + a _ { m , k } ^ { 2 } g _ { m } ( d )$ , where $a _ { 1 , k } , \cdots , a _ { m , k }$ are parameters to be estimated.
|
| 127 |
+
109 The constraint of decrease needs parameters non-negative and thus each parameters squared. The
|
| 128 |
+
110 spatial weight matrix can take the value of decreased shape function directly. The element of $\mathbf { W _ { k } }$
|
| 129 |
+
111 is $w _ { i j . } ^ { ( k ) } = f _ { k } ( d _ { i j } )$ . The details of the shape function and the corresponding basis functions can be
|
| 130 |
+
112 found in Section 3.4
|
| 131 |
+
|
| 132 |
+
The parameters in shape functions can be estimated from the neural network illustrated in Figure 1. The neural network can be trained from the following criterion:
|
| 133 |
+
|
| 134 |
+
$$
|
| 135 |
+
\operatorname* { m i n } _ { \{ W _ { k } \} _ { k = 1 } ^ { p } } \sum _ { t = 1 } ^ { T } | | \mathbf { X _ { t } } - \hat { \mathbf { X _ { t } } } | | ^ { 2 } = \sum _ { \mathbf { t } = 1 } ^ { \mathbf { T } } | | \mathbf { X _ { t } } - \sum _ { \mathbf { k } = 1 } ^ { \mathbf { p } } \hat { \mathbf { W _ { k } } } \hat { \mathbf { X _ { t - k } } } | | ^ { 2 } .
|
| 136 |
+
$$
|
| 137 |
+
|
| 138 |
+
# 113 3.3 The non-stationary spatio-temporal model with time-variant shape functions
|
| 139 |
+
|
| 140 |
+
114 The static spatial weight matrix $\mathbf { W _ { k } }$ can reflect spatial dependence and thus can be applied to
|
| 141 |
+
115 stationary scenarios. Next, we consider the nonstationary case. Therefore, we extend the stationary
|
| 142 |
+
116 model to non-stationary cases. The spatial weight matrices only reflect static relationships across time
|
| 143 |
+
117 lags in the static model. Unlike these settings, we change spatial weight matrices to be time-variant.
|
| 144 |
+
118 The spatial weight matrices formed by time-variant shape functions can thus capture non-stationary
|
| 145 |
+
119 dynamic spatial dependence. The non-stationary model has the form below,
|
| 146 |
+
|
| 147 |
+
$$
|
| 148 |
+
\mathbf { X _ { t } } = \sum _ { \mathbf { k } = 1 } ^ { \mathbf { p } } \mathbf { W _ { t , k } } \mathbf { X _ { t - k } } + \epsilon _ { \mathbf { t } } .
|
| 149 |
+
$$
|
| 150 |
+
|
| 151 |
+
where $\epsilon _ { \mathbf { t } }$ is white noise, and $\mathbf { W _ { t , k } }$ relies on shape function $f _ { t , k } ( d )$ . Similar with stationary settings, the time-variant shape functions are still represented as a linear combination of basis functions $g _ { i } ( d ) , i = 1 , 2 , \cdots , \bar { m }$ . The coefficients are therefore time-variant. The shape function at time $t$ has the form below $f _ { t , k } ( d ) = a _ { 1 , t , k } ^ { 2 } g _ { 1 } ( d ) + \cdot \cdot \cdot + a _ { m , t , k } ^ { 2 } g _ { m } ( d )$ . Unlike stationary setting, the coefficients of nonstationary setting, $\{ a _ { i , t , k } \} _ { i = 1 } ^ { m }$ , depend on the time $t$ . The non-stationary model can be trained from the criterion by minimizing
|
| 152 |
+
|
| 153 |
+
$$
|
| 154 |
+
\operatorname* { m i n } _ { \{ W _ { t } , k \} _ { k = 1 } ^ { p } } | | \mathbf { X _ { t } } - \hat { \mathbf { X _ { t } } } | | ^ { 2 } = | | \mathbf { X _ { t } } - \sum _ { \mathbf { k } = 1 } ^ { \mathbf { p } } \hat { \mathbf { W } } _ { \mathbf { t } , \mathbf { k } } \hat { \mathbf { X } } _ { \mathbf { t - k } } | | ^ { 2 } .
|
| 155 |
+
$$
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
Figure 1: The neural network for the stationary spatio-temporal process (left) and non-stationary spatio-temporal process (right).
|
| 159 |
+
|
| 160 |
+
# 122 3.4 The basis functions for shape functions
|
| 161 |
+
|
| 162 |
+
123 The shape functions are integrated into our model to obtain distance-based explanations in stationary
|
| 163 |
+
124 and non-stationary scenarios. The motivation of the proposed shape functions is that as the distance
|
| 164 |
+
125 between two observations increases, the effects between these two locations decreases. These distance
|
| 165 |
+
126 based effects can be reflected in spatial weight matrix W and each element in the matrix can measure
|
| 166 |
+
127 how the corresponding locations interact. The shape function is represented as a linear combination of
|
| 167 |
+
128 basis functions. The basis functions, satisfying shape constraint, rely on the corresponding definition
|
| 168 |
+
129 of basis functions.
|
| 169 |
+
130 Definition of basis functions for various shape constraints. We list the definition of basis functions
|
| 170 |
+
131 for increased and decreased shape (3). The distance quantile among $\{ d _ { i _ { 1 } , j _ { 1 } } , d _ { i _ { 2 } , j _ { 2 } } , \dots , d _ { i _ { N } , j _ { N } } \}$ at
|
| 171 |
+
132 quantile level $q _ { 1 } , q _ { 2 } , \cdots , q _ { m }$ is denoted by $\{ d _ { ( 1 ) } , d _ { ( 2 ) } , \cdots , d _ { ( m ) } \}$ , where $0 \leq q _ { 1 } < q _ { 2 } < \cdot \cdot \cdot < q _ { m } \leq$
|
| 172 |
+
1 and 133 $\{ q _ { 1 } , q _ { 2 } , \cdot \cdot \cdot , q _ { m } \} = \{ { \textstyle \frac { 1 } { m } } , { \textstyle \frac { 2 } { m } } , \cdot \cdot \cdot , 1 \}$ . Here, we can set the number of $m < < n ^ { 2 }$ , and thus, the
|
| 173 |
+
number of parameters is significantly reduced.
|
| 174 |
+
135 For the constraint of monotone decreasing function, the basis function is defined as $g _ { i } ( d ) = \mathbf { 1 } _ { \left\{ \mathbf { d } < \mathbf { d } _ { \left( \mathbf { i } \right) } \right\} }$ .
|
| 175 |
+
136 The basis function for the shape function with the constraint of concave decrease is defined as
|
| 176 |
+
137 $g _ { i } ( d ) = ( d _ { ( i ) } - d ) \mathbf { 1 } _ { \{ \mathbf { d } _ { ( i ) } \leq \mathbf { d } \} }$ and convex decrease is defined as $g _ { i } ( d ) = ( d _ { ( i ) } - d ) \mathbf { 1 } _ { \{ \mathbf { d } \leq \mathbf { d } _ { ( i ) } \} }$ , for
|
| 177 |
+
138 $1 \leq i \leq m$ . Figure 2 shows the definition of basis functions for monotone decreased and increased
|
| 178 |
+
139 shape functions, respectively. We only present four basis functions for each shape and each of them
|
| 179 |
+
140 is related to four quantile levels. The dashed lines indicate the turning points for each basis function
|
| 180 |
+
141 and they equal one or zero at the beginning and turn to zero or one at turning points.
|
| 181 |
+
143 The stationary model requires fixed shape functions and related spatial weight matrix are time
|
| 182 |
+
144 invariant. Given training data set $\mathbf { X _ { 1 } } , \mathbf { X _ { 2 } } , \cdots , \mathbf { X _ { T } }$ , we can estimate spatial weight matrix
|
| 183 |
+
145 ${ \hat { W } } _ { 1 } , { \hat { W } } _ { 2 } , \cdot \cdot \cdot , { \hat { W } } _ { p }$ and make forecasting iteratively. That is $\begin{array} { r } { \hat { { \bf X } } _ { T + 1 } = \sum _ { k = 1 } ^ { p } \hat { W } _ { k } { \bf X _ { T + 1 - k } } , \hat { { \bf X } } _ { T + 2 } = } \end{array}$
|
| 184 |
+
146 $\begin{array} { r } { \hat { W } _ { 1 } \hat { \mathbf { X } } _ { T + 1 } + \sum _ { k = 2 } ^ { \bar { p } } \hat { W } _ { k } \mathbf { X } _ { \mathbf { T } + 2 - \mathbf { k } } , \cdot \cdot \cdot \hat { \mathbf { X } } _ { T + h } = \sum _ { k = 1 } ^ { p } \hat { W } _ { k } \hat { \mathbf { X } } _ { T + h - k } } \end{array}$ .
|
| 185 |
+
|
| 186 |
+

|
| 187 |
+
Figure 2: The basis functions for decreased shape (left) and for increased shape (right). The arrows indicate domain of each basis functions.
|
| 188 |
+
|
| 189 |
+
The non-stationary model incorporate time-variant spatial weight matrix ${ \hat { W } } _ { t , \cdot } .$ . Given the training data set $\mathbf { X _ { 1 } } , \mathbf { X _ { 2 } } , \cdots , \mathbf { X _ { T } }$ , we can obtain corresponding shape functions $\hat { f } _ { 1 , \cdot } , \hat { f } _ { 2 , \cdot } , \cdot \cdot \cdot , \hat { f } _ { T , \cdot }$ , where · denotes time lag. For lag $p = 1$ , we can use $\{ \hat { f } _ { t } \} _ { t = 1 } ^ { T }$ to represent time-variant shape functions for convenience. We can make dynamic forecasts for the next $h$ windows. One simple forecasting method is to use $\hat { W } _ { T , k }$ to make forecast for $\hat { \mathbf { X } } _ { T + h }$ , that is
|
| 190 |
+
|
| 191 |
+
$$
|
| 192 |
+
\hat { \mathbf { X } } _ { T + h } = \sum _ { k = 1 } ^ { p } \hat { W } _ { T , k } \mathbf { X } _ { \mathbf { T } + \mathbf { h } - \mathbf { k } } .
|
| 193 |
+
$$
|
| 194 |
+
|
| 195 |
+
The alternative method is to retrain the new forecast to obtain the latest shape functions as well as spatial weight matrix. Given long-term forecast window $L$ , we first make short-term forecast for $h$ steps
|
| 196 |
+
|
| 197 |
+
$$
|
| 198 |
+
\hat { \mathbf { X } } _ { T + h } = \sum _ { k = 1 } ^ { p } \hat { W } _ { T + h , k } \mathbf { X } _ { \mathbf { T } + \mathbf { h } - \mathbf { k } } ,
|
| 199 |
+
$$
|
| 200 |
+
|
| 201 |
+
where 147 $h = 1 , 2 , \cdots$ and $\hat { W } _ { T + h , k }$ is estimated by training forecast value of $\hat { \mathbf { X } } _ { T + h - k }$ . We repeat the 148 process until $L$ steps in total have been predicted.
|
| 202 |
+
|
| 203 |
+
49 We summarize the whole process of our model when making spatio-temporal forecasts.
|
| 204 |
+
|
| 205 |
+
Step 1 Given the observation $\{ \mathbf { X _ { t } } \} _ { \mathbf { t = 1 } } ^ { \mathbf { T } }$ and its coordinates, calculate all distance pairs among all locations, denoted by $\{ d _ { i _ { 1 } , j _ { i } } , \cdot \cdot \cdot , d _ { i _ { N } , j _ { N } } \}$ .
|
| 206 |
+
|
| 207 |
+
Step 2 Calculate $\textstyle \left\{ { \frac { 1 } { m } } , { \frac { 2 } { m } } , \cdots , 1 \right\}$ quantile levels and obtain corresponding distance quantile value $\{ d _ { ( 1 ) } , d _ { ( 2 ) } , \cdots , \ " { d _ { ( m ) } } \}$ .
|
| 208 |
+
|
| 209 |
+
Step 3 Determine the shape constraints and construct corresponding basis functions. Specify the time lag $p$ .
|
| 210 |
+
|
| 211 |
+
Step 4 Train the model according to the illustration of Figure 1.
|
| 212 |
+
|
| 213 |
+
# 157 4 Experiment
|
| 214 |
+
|
| 215 |
+
158 In order to assess our model in stationary and non-stationary scenarios, we synthesize data. Then,
|
| 216 |
+
159 we apply our model to make some comparisons. On the one hand, we need to evaluate how
|
| 217 |
+
160 the estimated shape functions look and assess their similarity and accuracy. On the other hand,
|
| 218 |
+
161 our model can make spatio-temporal forecasting after estimating for spatial weight matrix. The
|
| 219 |
+
162 basic idea for completing the two goals is to set up the expected shape function and compare
|
| 220 |
+
163 estimated parameters with the real one. Next, we assess the forecasting performance with baseline
|
| 221 |
+
164 models. Codes and data for replicating our experiments are anonymously published at https:
|
| 222 |
+
165 //anonymous.4open.science/r/STVAR-F16E/.
|
| 223 |
+
|
| 224 |
+
# 166 4.1 Simulation for stationary model
|
| 225 |
+
|
| 226 |
+
Here, we synthesize 100 stationary spatio-temporal data sets. The spatial domain consists of 30 locations and their coordinates can be found at https://anonymous.4open.science/r/ STVAR-F16E/. For each location, we observe 500 values. The observation is generated from the stationary model $\begin{array} { r } { X _ { t } = \sum _ { k = 1 } ^ { p } W _ { k } X _ { t - k } + \epsilon _ { t } } \end{array}$ , where $\epsilon _ { t }$ is randomly generated from the standard normal distribution. The next step is to construct random spatial weight matrices for each synthesized data set. The shape functions are set to be decreasing, and we set them as a logarithmic function:
|
| 227 |
+
|
| 228 |
+
$$
|
| 229 |
+
\alpha ( - \log ( d + 1 ) + \log ( 1 7 0 ) ) ,
|
| 230 |
+
$$
|
| 231 |
+
|
| 232 |
+
167 where $\alpha$ is randomly generated from uniform distribution [0.05,0.06] but kept to be fixed for each
|
| 233 |
+
168 simulated data set. We use $d + 1$ to avoid zero value. This setting can make the real shape function
|
| 234 |
+
169 decrease and make it equal to zero when $d = 1 6 9$ . The stationary model can iteratively generate the
|
| 235 |
+
170 $\mathbf { X _ { t } }$ given initial value $\mathbf { X _ { 0 } }$ , where $\mathbf { X _ { 0 } }$ is randomly generated from a uniform distribution with bounds
|
| 236 |
+
171 [-0.01,0.01]. The time lags are set as $p = 1$ .
|
| 237 |
+
172 Estimation for shape functions. In Figure 3,
|
| 238 |
+
173 the estimated shape function is presented in red,
|
| 239 |
+
174 while the real shape function is presented in blue.
|
| 240 |
+
175 It can be seen that the estimated shape function
|
| 241 |
+
176 can capture the trend of the real shape function.
|
| 242 |
+
177 Training details. The first 300 steps are used as
|
| 243 |
+
178 training data, saving the last 200 steps for eval
|
| 244 |
+
179 uation. We train all models for 100 epochs with
|
| 245 |
+
180 Adam optimizer (5) and a learning rate of 0.01.
|
| 246 |
+
181 The process involves parallel training across 10
|
| 247 |
+
182 CPUs. We select 100 quantile levels, and thus
|
| 248 |
+
183 100 basis functions $g _ { i } ( d )$ were generated as the
|
| 249 |
+
184 inputs for the model.
|
| 250 |
+
185 Assessment for forecasting. We assess the fore
|
| 251 |
+
186 casting performance for the stationary model
|
| 252 |
+
187 with baseline models. As introduced in the liter
|
| 253 |
+
188 ature review, the baseline models are selected from the VAR model(21), the spatial panel data(SPE)
|
| 254 |
+
189 model that applied pre-specified spatial weigh matrix (28), graph-based models (20; 37) and
|
| 255 |
+
190 convolution-based models (15; 23). The error metrics are mean absolute error and root mean squared
|
| 256 |
+
191 error defined by 1Nn PNj=1 Pni=1 $\begin{array} { r } { \frac { 1 } { N n } \sum _ { j = 1 } ^ { N } \sum _ { i = 1 } ^ { n } \frac { \sum _ { t = T } ^ { T + h } | \hat { X } _ { i t } ^ { ( j ) } - X _ { i t } ^ { ( j ) } | } { h } } \end{array}$ , $\begin{array} { r } { \frac { 1 } { N n } \sum _ { j = 1 } ^ { N } \sum _ { i = 1 } ^ { n } \sqrt { \frac { 1 } { h } \sum _ { t = T } ^ { T + h } ( X _ { i t } ^ { ( j ) } - \hat { X } _ { i t } ^ { ( j ) } ) ^ { 2 } } } \end{array}$ ,
|
| 257 |
+
192 respectively. The Table 1 shows the six baseline models with the proposed model. As totally we
|
| 258 |
+
193 have 100 synthesised data sets, $X _ { i t } ^ { ( j ) }$ and $\hat { X } _ { i t } ^ { ( j ) }$ denote $i - t h$ variable in $j - t h$ data sets. $n = 3 0$ is
|
| 259 |
+
194 the number of locations and $N = 1 0 0$ is the number of synthesised data. We conducted one-step
|
| 260 |
+
195 forecasting for the next 200 observations.
|
| 261 |
+
96 Compared with baseline models, the proposed model performs better under the metric MAE and
|
| 262 |
+
97 RMSE. The proposed method outperforms the closest competing method, DC-RNN, by $10 \%$ .
|
| 263 |
+
|
| 264 |
+

|
| 265 |
+
Figure 3: The sample of estimated shape function. Distances are shown every $2 0 ^ { t h }$ quantile.
|
| 266 |
+
|
| 267 |
+
# 198 4.2 Experiments for non-stationary model
|
| 268 |
+
|
| 269 |
+
We conduct a simulation for the non-stationary model with time lag $p = 1$ and synthesize 100 data sets using a similar approach to the stationary model simulation. The initial value $\mathbf { X _ { 0 } }$ and $\epsilon _ { t }$ are generated from a uniform and normal distribution respectively. The locations of observations are the same as those in the stationary model simulation. In order to construct $W _ { t }$ , the time-varying shape functions are created under the decreased constraint. The shape function at time $t$ is constructed as
|
| 270 |
+
|
| 271 |
+
$$
|
| 272 |
+
\alpha _ { t } ( - \log ( d + 1 ) + \log ( 1 7 0 ) ) ,
|
| 273 |
+
$$
|
| 274 |
+
|
| 275 |
+
99 where $\alpha _ { t }$ controls the level of value at each time $t$ . $\epsilon _ { t }$ is generated from a normal distribution. $\mathbf { X _ { 0 } }$ is
|
| 276 |
+
00 generated from a uniform distribution with bound [-0.001,0.001].
|
| 277 |
+
201 Shape functions settings and estimation. The shape functions are set as time-variant, as they can
|
| 278 |
+
202 simulate the non-stationary process across time. We specified $\alpha _ { 0 }$ at $t = 0$ from uniform distribution
|
| 279 |
+
203 $[ 1 \times 1 0 ^ { - 4 } , 2 \times 1 0 ^ { - 4 } ]$ and then make an interpolation from $\alpha _ { 0 }$ to $\alpha _ { 5 0 0 }$ . The total length for every
|
| 280 |
+
204 location is 500 and we set $\alpha _ { 5 0 0 } = 1 0 \times \alpha _ { 0 }$ . For example, generally if $\alpha _ { 0 } ~ = ~ 0 . 0 0 0 1$ , we have
|
| 281 |
+
205 $\begin{array} { r } { \alpha _ { t } = 0 . 0 0 0 1 ( 1 - \frac { t } { T } ) + 0 . 0 0 1 \frac { t } { T } } \end{array}$ , where $T = 5 0 0$ . This setting guarantee that shape functions vary
|
| 282 |
+
206 from lower level to higher level. The larger $\alpha _ { t }$ is, the more larger distance-based effects they have.
|
| 283 |
+
207 Thus, the corresponding spatial weight matrix consists of dynamic shape functions and can reflect the
|
| 284 |
+
208 non-stationary dependence among each site. We present the estimated shape functions in Figure 4
|
| 285 |
+
209 and compare them with the real ones.
|
| 286 |
+
10 Training details. Similar to the stationary simulation, the train-test split is $3 0 0 - 2 0 0$ over the data
|
| 287 |
+
11 size of 500. However, we train all models for 100 epochs with Adam optimizer (5) at a learning rate
|
| 288 |
+
12 of 0.001. We train models in parallel across 10 CPUs.
|
| 289 |
+
|
| 290 |
+

|
| 291 |
+
Figure 4: The sample of estimated shape function for the 120 testing time steps. Distances are shown every $4 0 ^ { t h }$ quantile.
|
| 292 |
+
|
| 293 |
+
Forecasting performance. The forecasting performance is assessed by the same metrics used in the previous simulation for the stationary case. We made a one-step forecast by our model. As for the baseline models, we adjusted their published code accordingly. The results show that the proposed model can still capture non-stationary processes compared with baseline models. The proposed method outperforms the other competing methods. The error metric is shown in Table 1.
|
| 294 |
+
|
| 295 |
+
Table 1: The error metrics with baseline models for simulation.
|
| 296 |
+
|
| 297 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="2">Stationary Simulation</td><td colspan="2">Non-stationary Simulation</td></tr><tr><td>MAE</td><td>RMSE</td><td>MAE</td><td>RMSE</td></tr><tr><td>VAR</td><td>2.9611 ± 1.8573</td><td>3.2588 ± 1.8077</td><td>2.4426 ±1.2285</td><td>2.7676 ± 1.2015</td></tr><tr><td>SPM</td><td>1.8850 ± 0.6348</td><td>1.8671 ± 0.6778</td><td>2.1918 ± 0.7350</td><td>2.2161 ± 0.6876</td></tr><tr><td>DC-RNN</td><td>0.8960 ± 0.0370</td><td>1.1168 ± 0.0426</td><td>0.9017 ± 0.0358</td><td>1.1328 ± 0.0463</td></tr><tr><td>FC-GAGA</td><td>2.5425 ± 0.2965</td><td>3.1066 ± 0.3633</td><td>1.0270 ± 0.0080</td><td>1.2939 ± 0.0120</td></tr><tr><td>GMAN</td><td>1.6806 ± 0.1491</td><td>1.9293 ± 0.1483</td><td>1.5714 ± 0.1104</td><td>1.8608 ± 0.1155</td></tr><tr><td>ConvLSTM</td><td>2.9495 ± 0.2980</td><td>3.2509 ± 0.2887</td><td>2.2478 ± 0.2295</td><td>2.5469 ± 0.2324</td></tr><tr><td>ESTF</td><td>0.7997 ± 0.0015</td><td>1.0017 ± 0.0016</td><td>0.8075 ± 0.0016</td><td>1.0112 ± 0.0020</td></tr></table>
|
| 298 |
+
|
| 299 |
+
# 218 4.3 Real case studies
|
| 300 |
+
|
| 301 |
+
Air quality data. We apply our model to air quality data, which records air quality in California over 2021 1. The daily mean of $\mathrm { P M } 2 . 5$ is recorded across 172 sites.
|
| 302 |
+
|
| 303 |
+
We obtain the first 200 steps for training and perform forecasting for the next 165 steps. All models are trained for 100 epochs using Adam optimizer (5), at a learning rate of 0.01 and batch size of 50. We present the estimated time-variant shape functions in supplemental file. The value of shape functions decays to zero at around 5.926, which is $80 \%$ quantile in the sample of distance pairs. In other words, the distance-based effects decay to zero at a distance equal or larger than 5.926. Our
|
| 304 |
+
|
| 305 |
+
226 model has ideal performance with low time consummation compared with baseline models. We put
|
| 306 |
+
227 detailed forecasting results of simulation and real cases in a supplemental file.
|
| 307 |
+
228 The result is shown in Table 2. The ESTF performs best in terms of RMSE, while the DC-RNN
|
| 308 |
+
229 method performs best in terms of MAE. For the computational time, the ESTF method is significantly
|
| 309 |
+
230 faster than most machine learning methods, and only takes around $1 / 1 0$ time of DC-RNN. In Figure 5,
|
| 310 |
+
231 MAE, RMSE, and time are presented with different numbers of $m$ . As $m$ increases, the computational
|
| 311 |
+
232 time increases while both MAE and RMSE decrease. There is a significant increase in the forecasting
|
| 312 |
+
233 performance when $m$ increases from 10 to 50. For $m > 5 0$ , the forecasting performance does not
|
| 313 |
+
234 increase much as $m$ increases.
|
| 314 |
+
235 One key advantage of the ESTF method is that we can make an explicit distance-based explanation
|
| 315 |
+
236 for our dataset. Figure 6 shows the distance-based effects at time $t = 9$ . We only present the effects
|
| 316 |
+
237 using a threshold to obtain a more concise visualization. The estimated shape function $\hat { f } _ { 9 }$ ranges
|
| 317 |
+
238 from 0 to 9.8 and we set 5 as the threshold. The red line indicates the value of the shape function
|
| 318 |
+
239 larger than 7, while the gray line indicates the value between 5 and 7. Figure 6 shows how any two
|
| 319 |
+
240 locations interact and measure the distance-based effects quantitatively. For example, air quality
|
| 320 |
+
241 monitoring sites around the Greater Los Angeles(red circle in Figure 6) area have a strong spatial
|
| 321 |
+
242 interaction with each other, such as node 7 and node 8.
|
| 322 |
+
|
| 323 |
+

|
| 324 |
+
Figure 6: The significant distance-based effect Figure 5: Comparing efficiency vs. performanceamong all 30 locations. trade-off at different quantile values.
|
| 325 |
+
|
| 326 |
+

|
| 327 |
+
|
| 328 |
+
# 4.4 $S O _ { 2 }$ data
|
| 329 |
+
|
| 330 |
+
Texas is the second largest manufacturing state in the USA and prediction for $S O _ { 2 }$ is critical task for researchers. The data 2 records daily $S O _ { 2 }$ at 31 locations in 2021. More detailed spatial information can be found in the supplemental file. The numeric result is listed in Table 2.
|
| 331 |
+
|
| 332 |
+
Table 2: The error metrics with baseline models for real case study. Clock time (in seconds) for real case study is recorded when training each model for 100 epochs on a single CPU.
|
| 333 |
+
|
| 334 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="6">Air quality data</td><td rowspan="2">SO2 data Training Time (s)</td><td rowspan="2">Inference Time (s)</td></tr><tr><td>MAE</td><td>RMSE</td><td>Training time (s)</td><td>Inference Time (s)</td><td>MAE</td><td>RMSE</td></tr><tr><td>VAR</td><td>16.9844</td><td>22.3410</td><td>3.56</td><td>0.04</td><td>6.2705</td><td>9.1388</td><td>3.330</td><td>0.016</td></tr><tr><td>SPM</td><td>8.4547</td><td>13.8262</td><td>0.31</td><td>0.03</td><td>7.1453</td><td>9.1086</td><td>0.143</td><td>0.027</td></tr><tr><td>DC-RNN</td><td>4.7157</td><td>9.3873</td><td>203</td><td>1.211</td><td>3.5094</td><td>6.8681</td><td>264.215</td><td>1.366</td></tr><tr><td>FC-GAGA</td><td>7.8671</td><td>18.1870</td><td>181</td><td>2.759</td><td>4.5976</td><td>7.7528</td><td>169.425</td><td>2.889</td></tr><tr><td>GMAN</td><td>12.5268</td><td>17.3817</td><td>140</td><td>1.823</td><td>4.1099</td><td>7.4806</td><td>172.016</td><td>1.581</td></tr><tr><td>ConvLSTM</td><td>12.6292</td><td>17.9149</td><td>53</td><td>1.940</td><td>4.1445</td><td>8.0688</td><td>96.233</td><td>1.656</td></tr><tr><td>ESTF</td><td>5.2237</td><td>9.2169</td><td>22</td><td>1.625</td><td>4.2966</td><td>6.8307</td><td>31.050</td><td>1.868</td></tr></table>
|
| 335 |
+
|
| 336 |
+
247 Similar conclusions can be drawn in $S O _ { 2 }$ data as that of air quality data. The ESTF model performs
|
| 337 |
+
248 best under the RMSE metric, while DC-RNN is best in the MAE metric. In terms of training time,
|
| 338 |
+
251 The efficiency analysis and performance at different quantiles are shown in Figure 7. Together with
|
| 339 |
+
252 Figure 5, we can see that the increasing number of basis functions does not have much improvement
|
| 340 |
+
253 when the number of basis functions is larger than 50, while the training time increases as the number
|
| 341 |
+
254 of basis functions increases. The spatial distribution at time $t = 9 0$ is presented in Figure 8 where
|
| 342 |
+
255 coordinates are denoted by latitude and longitude. Two significant clusters, representing Houston
|
| 343 |
+
256 and Dallas respectively, have the strongest distance-based effect. It quantitatively shows how these
|
| 344 |
+
257 neighbors affect each other. Counties around Dallas-Fort Worth metropolitan area show strong
|
| 345 |
+
258 interaction, which should be noted by environmental policy-makers. More detailed results are
|
| 346 |
+
259 presented in the supplemental file.
|
| 347 |
+
|
| 348 |
+

|
| 349 |
+
Figure 8: The significant distance-based effect Figure 7: Comparing efficiency vs. performanceamong all 31 locations at $t = 9 0$ trade-off at different quantile values.
|
| 350 |
+
|
| 351 |
+

|
| 352 |
+
|
| 353 |
+
# 260 5 Discussion
|
| 354 |
+
|
| 355 |
+
This paper applies learnable shape functions to capture distance-based effects. It can model dynamic spatial dependence for stationary and non-stationary spatio-temporal data based on their distance. The model does not have the limitations of classical statistical spatial models and provides a more explanatory model than usual deep learning methods. Furthermore, some spatio-temporal data, such as temperature for sea surface and air quality monitoring data, usually viewed as collected from the continuous field, are more suitable for the proposed models since these kinds of data follow the basic rule that variability between two locations is significantly affected by their distance. However, some spatio-temporal data, such as traffic flow or some biology data, do not follow the rule. As a result, the spatial dependence may rely on road structure or biological mechanisms instead of distance. It is worth researching such data by considering graph structure when estimating spatial weight matrix. In addition, we can develop spatio-temporal causal inference based on the ESTF model. Grander causal analysis can be done by fitting the first-order VAR model (24). The estimation of the coefficients matrix of the VAR model attracts researchers’ interest as it can be treated as a causal transition matrix. In the causal inference community, lots of work have been conducted on the VAR model (8; 9). However, there is a lack of research on causal inference under the spatio-temporal process. The quantitative distance-based effects in ESTF can be further researched and extended to develop a spatio-temporal causal model.
|
| 356 |
+
|
| 357 |
+
# References
|
| 358 |
+
|
| 359 |
+
[1] ANSELIN, L. Spatial econometrics: methods and models, vol. 4. Springer Science & Business Media, 1988.
|
| 360 |
+
[2] CASTRUCCIO, S., AND GENTON, M. G. Principles for statistical inference on big spatiotemporal data from climate models. Statistics & Probability Letters 136 (2018), 92–96.
|
| 361 |
+
|
| 362 |
+
[3] CHEN, Y., AND SAMWORTH, R. J. Generalized additive and index models with shape constraints. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 78, 4 (2016), 729–754. [4] CLIFF, A. Spatial autocorrelation: Technical report. [5] DIEDERIK, K., JIMMY, B., ET AL. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980 (2014), 273–297. [6] DOU, B., PARRELLA, M. L., AND YAO, Q. Generalized Yule–Walker estimation for spatiotemporal models with unknown diagonal coefficients. Journal of Econometrics 194, 2 (2016), 369–382. [7] ELHORST, J. P. Spatial panel data models. In Spatial econometrics. Springer, 2014, pp. 37–93. [8] GEIGER, P., ZHANG, K., SCHOELKOPF, B., GONG, M., AND JANZING, D. Causal inference by identification of vector autoregressive processes with hidden components. In International Conference on Machine Learning (2015), PMLR, pp. 1917–1925. [9] GONG, M., ZHANG, K., SCHÖLKOPF, B., GLYMOUR, C., AND TAO, D. Causal discovery from temporally aggregated time series. In Uncertainty in artificial intelligence: proceedings of the... conference. Conference on Uncertainty in Artificial Intelligence (2017), vol. 2017, NIH Public Access. [10] JAIN, A., ZAMIR, A. R., SAVARESE, S., AND SAXENA, A. Structural-rnn: Deep learning on spatio-temporal graphs. In Proceedings of the ieee conference on computer vision and pattern recognition (2016), pp. 5308–5317. [11] KELEJIAN, H. H., AND PRUCHA, I. R. A generalized spatial two-stage least squares procedure for estimating a spatial autoregressive model with autoregressive disturbances. The Journal of Real Estate Finance and Economics 17, 1 (1998), 99–121. [12] LEE, L.-F. Asymptotic distributions of quasi-maximum likelihood estimators for spatial autoregressive models. Econometrica 72, 6 (2004), 1899–1925. [13] LEE, L.-F., AND YU, J. Some recent developments in spatial panel data models. Regional Science and Urban Economics 40, 5 (2010), 255–271. [14] LI, M., AND ZHU, Z. Spatial-temporal fusion graph neural networks for traffic flow forecasting. In Proceedings of the AAAI conference on artificial intelligence (2021), vol. 35, pp. 4189–4196. [15] LI, Y., YU, R., SHAHABI, C., AND LIU, Y. Diffusion convolutional recurrent neural network: Data-driven traffic forecasting. arXiv preprint arXiv:1707.01926 (2017). [16] LIN, Y., MAGO, N., GAO, Y., LI, Y., CHIANG, Y.-Y., SHAHABI, C., AND AMBITE, J. L. Exploiting spatiotemporal patterns for accurate air quality forecasting using deep learning. In Proceedings of the 26th ACM SIGSPATIAL international conference on advances in geographic information systems (2018), pp. 359–368. [17] MA, Y., GUO, S., AND WANG, H. Sparse spatio-temporal autoregressions by profiling and bagging. Journal of Econometrics (2021). [18] MILLER, H. J. Tobler’s first law and spatial analysis. Annals of the association of American geographers 94, 2 (2004), 284–289. [19] MOKBEL, M. F., XIONG, X., HAMMAD, M. A., AND AREF, W. G. Continuous query processing of spatio-temporal data streams in place. GeoInformatica 9, 4 (2005), 343–365. 324 [20] ORESHKIN, B. N., AMINI, A., COYLE, L., AND COATES, M. J. FC-GAGA: Fully connected gated graph architecture for spatio-temporal traffic forecasting. In Proc. AAAI Conf. Artificial Intell (2021). [21] QIAN, G., TORDESILLAS, A., AND ZHENG, H. Landslide forecast by time series modeling and analysis of high-dimensional and non-stationary ground motion data. Forecasting 3, 4 (2021), 850–867.
|
| 363 |
+
|
| 364 |
+
330 [22] QU, X., LEE, L.-F., AND YU, J. QML estimation of spatial dynamic panel data models with
|
| 365 |
+
331 endogenous time varying spatial weights matrices. Journal of Econometrics 197, 2 (2017),
|
| 366 |
+
332 173–201.
|
| 367 |
+
333 [23] SHI, X., CHEN, Z., WANG, H., YEUNG, D.-Y., WONG, W.-K., AND WOO, W.-C. Convolu
|
| 368 |
+
334 tional lstm network: A machine learning approach for precipitation nowcasting. Advances in
|
| 369 |
+
335 neural information processing systems 28 (2015).
|
| 370 |
+
336 [24] SIMS, C. A. Macroeconomics and reality. Econometrica: journal of the Econometric Society
|
| 371 |
+
337 (1980), 1–48.
|
| 372 |
+
338 [25] SU, L. Semiparametric GMM estimation of spatial autoregressive models. Journal of Econo
|
| 373 |
+
339 metrics 167, 2 (2012), 543–560.
|
| 374 |
+
340 [26] TOBLER, W. R. A computer movie simulating urban growth in the detroit region. Economic
|
| 375 |
+
341 geography 46, sup1 (1970), 234–240.
|
| 376 |
+
342 [27] WANG, D., AND CHENG, T. A spatio-temporal data model for activity-based transport demand
|
| 377 |
+
343 modelling. International Journal of Geographical Information Science 15, 6 (2001), 561–585.
|
| 378 |
+
344 [28] WANG, H., QIAN, G., AND TORDESILLAS, A. Modeling big spatio-temporal geo-hazards data
|
| 379 |
+
345 for forecasting by error-correction cointegration and dimension-reduction. Spatial Statistics 36
|
| 380 |
+
346 (2020), 100432.
|
| 381 |
+
347 [29] WANG, S., CAO, J., AND YU, P. Deep learning for spatio-temporal data mining: A survey.
|
| 382 |
+
348 IEEE transactions on knowledge and data engineering (2020).
|
| 383 |
+
349 [30] WANG, X., CHEN, C., MIN, Y., HE, J., YANG, B., AND ZHANG, Y. Efficient metropolitan
|
| 384 |
+
350 traffic prediction based on graph recurrent neural network. arXiv preprint arXiv:1811.00740
|
| 385 |
+
351 (2018).
|
| 386 |
+
352 [31] WANG, Y., LONG, M., WANG, J., GAO, Z., AND YU, P. S. PredRNN: Recurrent neural
|
| 387 |
+
353 networks for predictive learning using spatio-temporal LSTMs. In Advances in Neural Informa
|
| 388 |
+
354 tion Processing Systems (2017), I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus,
|
| 389 |
+
355 S. Vishwanathan, and R. Garnett, Eds., vol. 30, Curran Associates, Inc.
|
| 390 |
+
356 [32] WU, Y., AND TAN, H. Short-term traffic flow forecasting with spatial-temporal correlation in a
|
| 391 |
+
357 hybrid deep learning framework. arXiv preprint arXiv:1612.01022 (2016).
|
| 392 |
+
358 [33] YANG, S., MA, W., PI, X., AND QIAN, S. A deep learning approach to real-time parking
|
| 393 |
+
359 occupancy prediction in transportation networks incorporating multiple spatio-temporal data
|
| 394 |
+
360 sources. Transportation Research Part C: Emerging Technologies 107 (2019), 248–265.
|
| 395 |
+
361 [34] YU, B., YIN, H., AND ZHU, Z. Spatio-temporal graph convolutional networks: A deep
|
| 396 |
+
362 learning framework for traffic forecasting. arXiv preprint arXiv:1709.04875 (2017).
|
| 397 |
+
363 [35] YU, J., DE JONG, R., AND LEE, L.-F. Quasi-maximum likelihood estimators for spatial
|
| 398 |
+
364 dynamic panel data with fixed effects when both n and t are large. Journal of Econometrics 146,
|
| 399 |
+
365 1 (2008), 118–134.
|
| 400 |
+
366 [36] YUAN, Z., ZHOU, X., AND YANG, T. Hetero-convlstm: A deep learning approach to traffic
|
| 401 |
+
367 accident prediction on heterogeneous spatio-temporal data. In Proceedings of the 24th ACM
|
| 402 |
+
368 SIGKDD International Conference on Knowledge Discovery & Data Mining (2018), pp. 984–
|
| 403 |
+
369 992.
|
| 404 |
+
370 [37] ZHENG, C., FAN, X., WANG, C., AND QI, J. Gman: A graph multi-attention network for
|
| 405 |
+
371 traffic prediction. In Proceedings of the AAAI Conference on Artificial Intelligence (2020),
|
| 406 |
+
372 vol. 34, pp. 1234–1241.
|
| 407 |
+
373 [38] ZHOU, S., BONDELL, H., TORDESILLAS, A., RUBINSTEIN, B. I., AND BAILEY, J. Early
|
| 408 |
+
374 identification of an impending rockslide location via a spatially-aided gaussian mixture model.
|
| 409 |
+
375 The Annals of Applied Statistics 14, 2 (2020), 977–992.
|
| 410 |
+
|
| 411 |
+
1. For all authors...
|
| 412 |
+
|
| 413 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 414 |
+
(b) Did you describe the limitations of your work? [Yes] We describe limitations in discussion section
|
| 415 |
+
(c) Did you discuss any potential negative societal impacts of your work? [No]
|
| 416 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 417 |
+
|
| 418 |
+
2. If you are including theoretical results...
|
| 419 |
+
|
| 420 |
+
(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]
|
| 421 |
+
|
| 422 |
+
3. If you ran experiments...
|
| 423 |
+
|
| 424 |
+
(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 upload data and code to github
|
| 425 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Please check training details in simulation and real case section
|
| 426 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 427 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] They are included in training details
|
| 428 |
+
|
| 429 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 430 |
+
|
| 431 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 432 |
+
(b) Did you mention the license of the assets? [Yes]
|
| 433 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
|
| 434 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 435 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 436 |
+
|
| 437 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 438 |
+
|
| 439 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 440 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 441 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/fcO9Cgn-X-R/fcO9Cgn-X-R.md
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Capturing Failures of Large Language Models via Human Cognitive Biases
|
| 2 |
+
|
| 3 |
+
Erik Jones UC Berkeley erjones@berkeley.edu
|
| 4 |
+
|
| 5 |
+
Jacob Steinhardt UC Berkeley jsteinhardt@berkeley.edu
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Large language models generate complex, open-ended outputs: instead of outputting a class label they write summaries, generate dialogue, or produce working code. In order to asses the reliability of these open-ended generation systems, we aim to identify qualitative categories of erroneous behavior, beyond identifying individual errors. To hypothesize and test for such qualitative errors, we draw inspiration from human cognitive biases—systematic patterns of deviation from rational judgement. Specifically, we use cognitive biases as motivation to (i) generate hypotheses for problems that models may have, and (ii) develop experiments that elicit these problems. Using code generation as a case study, we find that OpenAI’s Codex errs predictably based on how the input prompt is framed, adjusts outputs towards anchors, and is biased towards outputs that mimic frequent training examples. We then use our framework to elicit high-impact errors such as incorrectly deleting files. Our results indicate that experimental methodology from cognitive science can help characterize how machine learning systems behave.1
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Recent large language models have achieved new, exciting capabilities. In contrast to traditional classifiers, these models can generate open-ended text, enabling use cases like summarization [Stiennon et al., 2020], dialog [Thoppilan et al., 2022], and code generation [Chen et al., 2021]
|
| 14 |
+
|
| 15 |
+
The open-ended power of these systems, however, poses new reliability challenges. We must understand not only when systems err, but also the kinds of errors they make, as some errors are much more costly than others. For example, erroneous code that does not compile is less dangerous than code that deletes all files in the home directory. Studying how frequently an error occurs is difficult, as the same error (e.g. delete all files) can appear in a wide range of syntactically diverse outputs. In order to better reason about how complex systems err, we need methods to test whether systems make the same qualitative error across different prompts, even when the generated outputs differ.
|
| 16 |
+
|
| 17 |
+
To study these reliability challenges, we primarily focus on code generation models. Such models complete programs from comments, descriptions of code functionality, or initial lines of code. Code generation is particularly amenable to study since it is objective: generated solutions are unambiguously correct or incorrect. Yet it is also open-ended: the set of programs a model could output is arbitrarily large, so the rate at which a specific program is outputted is not very descriptive.
|
| 18 |
+
|
| 19 |
+
Many of the reliability challenges posed by code generation models, and open-ended systems broadly, also arise when studying qualitative failures in human decision making. These failures, called cognitive biases, are systematic ways in which humans deviate from rational judgment [Tversky and Kahneman, 1974]. For example, Tversky and Kahneman find that humans inadequately adjust estimates away from initial values, and disproportionately recall distinctive examples. To uncover cognitive biases, Tversky and Kahneman ask questions that are crafted to systematically reveal some qualitative irrationality. They uncover insights into human behavior from the diverse responses, without complete mechanistic insight into the minds that they aim to analyze.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Illustration of our experimental framework. We use a cognitive bias (framing effect) to inspire a potential code generation failure mode (relying on irrelevant information). We then transform inputs in a way that we suspect will elicit the failure mode (prepending sum). We evaluate whether the modifications lower accuracy, and if the output is an instance of the targeted failure mode.
|
| 23 |
+
|
| 24 |
+
In this work, we extend Tversky and Kahneman’s experimental methodology and results to elicit failure modes of large code and language models, without relying on complete mechanistic insight into their behavior (Figure 1). Given a potential failure mode (e.g. relying on irrelevant information in the input), we construct a transformation over inputs that largely preserves semantics, but that we suspect will elicit the failure (e.g. prepending an irrelevant function). We first test if the model is sensitive to the transformation, by measuring if it decreases accuracy. Then, we check that the model outputs have elements that are indicative of the targeted failure (e.g. copies the irrelevant function).
|
| 25 |
+
|
| 26 |
+
We draw on four different cognitive biases to hypothesize potential failures of OpenAI’s Codex [Chen et al., $\boxed { 2 0 2 1 }$ and Salesforce’s CodeGen $[ [ \mathrm { N i j k a m p ~ e t ~ a l . } ] [ \overline { { 2 0 2 2 } } ] ]$ , then apply our framework to each. Our results indicate that these models often rely on irrelevant information when generating solutions, adjust solutions towards related-but-incorrect solutions, are biased based on training-set frequencies, and reverts to computationally simpler problems when faced with a complex calculation. We also apply our framework to OpenAI’s GPT-3 [Brown et al., 2020], and show that it updates its predictions towards anchors, and predictably adjusts its responses based on the question framing.
|
| 27 |
+
|
| 28 |
+
Finally, we show that our framework can uncover high-impact errors: errors that are harmful and difficult to undo. Specifically, we use our framework to systematically generate prompts where Codex erroneously deletes files. Our results indicate that experimental methodology from cognitive science can help uncover failure modes of complex machine learning systems.
|
| 29 |
+
|
| 30 |
+
# 2 Related Work
|
| 31 |
+
|
| 32 |
+
Large language models. Recent work has developed large, capable, autoregressive language models, which predict future tokens from past tokens [Radford et al., 2019, Wang and Komatsuzaki, 2021, Brown et al., 2020, Chen et al., 2021, Rae et al., 2021]. These models can be used for open-ended generation tasks such as summarization [Stiennon et al., 2020, Ziegler et al., 2019, Rothe et al., 2020], dialogue [Ram et al., 2018, Thoppilan et al., 2022], and long form question answering [Fan et al., 2019] , among others. Model-generated code has been used to solve both programming and statistics questions [Chen et al., 2021, Tang et al., 2021].
|
| 33 |
+
|
| 34 |
+
There is some existing work studying failures of large language models. Benchmarks that measure model performance on multiple choice questions [Wang et al., 2019b,a, Hendrycks et al., 2021b], mathematics [Hendrycks et al., 2021c, Cobbe et al., 2021], long-form question answering [Lin et al., 2021, Gabriel et al., 2021, Shuster et al., 2021, Krishna et al., 2021], and coding problems [Hendrycks et al., 2021a, Chen et al., 2021] reveal inputs that the model errs on, but not the kind of error it makes. Another line of work shows that test-based language models can internalize bias and stereotypes [Sheng et al., 2019, Nadeem et al., 2020, Groenwold et al., 2020, Blodgett et al., 2021, Gehman et al., 2020], and proposes applying fairness measurements from cognitive social sciences to machine learning systems [Jacobs and Wallach, 2021]. Some work adversarially prompts models to leak training data [Carlini et al., 2020], or output specific content [Wallace et al., 2019, Carlini et al., $\boxed { 2 0 2 0 } ]$ . And a final line of work identifies additional potential failures of current and future machine learning systems [Bender et al., 2021, Bommasani et al., 2021, Weidinger et al., 2021].
|
| 35 |
+
|
| 36 |
+

|
| 37 |
+
Figure 2: Left. Example of a HumanEval problem from Chen et al. [2021] . The problem contains a prompt (blue), a canonical solution to the prompt (green), and a few test-cases (black). The prompt contains two components: a function signature (first line), and a docstring (remaining lines). Right. Illustration of our framing experiment. The transformed prompt (everything above the black line) contains an irrelevant preceding function (IPF) prepended to a prompt from HumanEval (blue). The IPF contains a randomly chosen prompt from HumanEval (purple) and a framing line (red). The output Codex generates (below the black line) matches the framing line. When we omit the random HumanEval prompt and the framing line (leaving only blue), Codex produces the correct output.
|
| 38 |
+
|
| 39 |
+
Cognitive biases. Tversky and Kahneman [1974] define human cognitive biases: systematic patterns of deviation from rational judgment. They observe that humans employ heuristics when computing probabilities or assessing values, and that these heuristics lead to predictable errors. Follow-up work has added to, refined, and validated the set of known cognitive biases [Tversky and Kahneman, 1973, 1981, Strack et al., 1988, Kahneman and Frederick, 2002, Windhager et al., 2010, Meyer, 2014].
|
| 40 |
+
|
| 41 |
+
Some known failure modes of large language models resemble cognitive biases. Zhao et al. [2021] and Liu et al. [2021] show that the specific random samples used for few-shot learning can change GPT-3’s prediction on binary and multiple choice tasks. Similarly, Wallace et al. [2019] show that innocuous prompts can routinely generate toxic model output. Our framework builds on this work by (i) identifying the link to cognitive biases, (ii) focusing on open-ended generation, and (iii) leveraging Tversky and Kahneman’s experimental methodology to elicit qualitative failure modes.
|
| 42 |
+
|
| 43 |
+
# 3 Code Generation Experiments
|
| 44 |
+
|
| 45 |
+
# 3.1 Models
|
| 46 |
+
|
| 47 |
+
We study two code models: OpenAI’s Codex [Chen et al., 2021], and Salesforce’s CodeGen. [Nijkamp et al., 2022]. Both models are autoregressive—given a sequence of previous tokens, they predict the next token. Practitioners query these code models with partial programs, docstrings, or function signatures, and obtain completions as output.
|
| 48 |
+
|
| 49 |
+
Codex. We study OpenAI’s Codex, a large language model trained to generate code from docstrings [Chen et al., 2021]. We use the OpenAI API to query the “davinci-001” version of Codex, and use greedy decoding to generate solutions. Details of this model architecture are not public, but it is likely similar to the largest model from Chen et al. [2021]: a 12B parameter version of GPT-3 [Brown et al., 2020] that is fine-tuned on GitHub instead of the CommonCrawl.
|
| 50 |
+
|
| 51 |
+
CodeGen. We additionally study the 6.2 billion parameter “mono” version of CodeGen, which is trained on text data and fine-tuned on GitHub. Unlike Codex, the weights of CodeGen are publicly available,2 so we run inference locally. We use greedy decoding to generate solutions.
|
| 52 |
+
|
| 53 |
+
# 3.2 Benchmarks
|
| 54 |
+
|
| 55 |
+
In order to identify whether code models some failure mode, we need to generate prompts that elicit that failure. To do so, we systematically apply transformations to standard prompts. We use two benchmarks as sources of prompts to transform: HumanEval, and MathEquations.
|
| 56 |
+
|
| 57 |
+
<table><tr><td>Framing Line</td><td>Model</td><td>ORIGINAL</td><td>FRAMED</td><td>ORIGINAL</td><td>FRAMED</td></tr><tr><td rowspan="2">raise NotImplemented</td><td>CODEX</td><td>32.9</td><td>2.4</td><td>1.4</td><td>91.7</td></tr><tr><td>CODEGEN</td><td>25.6</td><td>1.5</td><td>0.0</td><td>79.3</td></tr><tr><td rowspan="2">pass</td><td>CoDEX</td><td>32.9</td><td>3.0</td><td>9.7</td><td>92.7</td></tr><tr><td>CODEGEN</td><td>25.6</td><td>2.1</td><td>0.0</td><td>78.7</td></tr><tr><td rowspan="2">assert False</td><td>CODEX</td><td>32.9</td><td>3.3</td><td>0.0</td><td>92.7</td></tr><tr><td>CODEGEN</td><td>25.6</td><td>4.2</td><td>0.1</td><td>72.6</td></tr><tr><td rowspan="2">return False</td><td>CODEX</td><td>32.9</td><td>4.9</td><td>11.5</td><td>65.6</td></tr><tr><td>CODEGEN</td><td>25.6</td><td>3.6</td><td>0.0</td><td>64.6</td></tr><tr><td rowspan="2">print("Hello world!")</td><td>CODEX</td><td>32.9</td><td>10.6</td><td>0.0</td><td>62.2</td></tr><tr><td>CODEGEN</td><td>25.6</td><td>11.0</td><td>0.0</td><td>58.2</td></tr></table>
|
| 58 |
+
|
| 59 |
+
Table 1: Results of the framing experiments. We compare functional accuracy and the rate at which framing line is outputted over HumanEval with (framed) and without (original) irrelevant preceding functions. We find that the irrelevant preceding functions lower functional accuracy across all framing lines for Codex and CodeGen. Moreover, we find that the outputted function often appears verbatim in the generated output, suggesting that both models rely on irrelevant information in the prompt.
|
| 60 |
+
|
| 61 |
+
HumanEval. We use the HumanEval benchmark as a diverse source of “normal” prompts [Chen et al., $\boxed { 2 0 2 1 }$ . HumanEval contains 164 programming problems, each of which includes a function signature and a docstring. The docstring contains an English description of the desired functionality and a few example input-output pairs. HumanEval also contains a canonical solution for each program, which we use in Section $\underline { { \bar { \vert 3 . 3 . 2 \vert } } }$ We give an example problem from HumanEval in Figure 2.
|
| 62 |
+
|
| 63 |
+
MathEquations. We also curate a set of prompts of basic arithmetic functions. For example, we prompt Codex to “Write a function that sums the squares of its inputs”, or “Write a function that sums its inputs called product_plus_five”. Further details are given in Sections 3.3.3 an 3.3.4.
|
| 64 |
+
|
| 65 |
+
# 3.3 Empirical results
|
| 66 |
+
|
| 67 |
+
In this section, we show how cognitive biases can (i) inspire hypotheses for potential failure modes, and (ii) help us design experiments to test these hypotheses. Our approach has three steps. First, we construct a transformation over prompts that largely preserves semantics, but that we suspect will elicit a specific cognitive-bias-inspired failure mode. Next, we measure if code models are sensitive to the transformation, by measuring the decrease in accuracy. And finally, we check that the generated output has elements that are indicative of the targeted failure mode. Our approach mirrors the high-level methodology from Tversky and Kahneman [1974]; we empirically elicit specific failure modes using targeted prompts, without complete mechanistic insight into the system that we study.
|
| 68 |
+
|
| 69 |
+
We draw inspiration from four cognitive biases: the framing effect (Tversky and Kahneman [1981] Section 3.3.1), anchoring (Tversky and Kahneman [1974]; Section $\underline { { \overline { { | 3 . 3 . 2 ) } } } }$ , the availability heuristic (Tversky and Kahneman [1973]; Section 3.3.3), and attribute substitution (Kahneman and Frederick [2002]; Section 3.3.4).
|
| 70 |
+
|
| 71 |
+
# 3.3.1 Inspiration: Framing effect
|
| 72 |
+
|
| 73 |
+
We first draw inspiration from the framing effect: predictable shifts in human responses when the same problem is framed in different ways [Tversky and Kahneman, 1981]. In their study identifying the effect, Tversky and Kahneman [1981] find that subjects favor certainly saving 200 people over saving 600 with probability $\overline { { 1 / 3 } }$ , yet prefer losing 600 with probability 2/3 over certainly losing 400 (even though these are equivalent). At its core, the framing effect shows how humans can rely on semantically irrelevant information when they make decisions.
|
| 74 |
+
|
| 75 |
+
Using the framing effect as inspiration, we hypothesize that code generation models may generate solutions exclusively from irrelevant information in the prompt. To elicit this failure, we transform HumanEval prompts by prepending irrelevant preceding functions. Specifically, to generate irrelevant preceding functions, we combine a random prompt from HumanEval with a framing line. We test five framing lines: raise NotImplementedError , pass , assert False , return False , and print("Hello world!") . We first check that prepending these irrelevant preceding functions decreases functional accuracy.3 Next, to test if models relied on irrelevant information in the prompt, we measure how much more frequently the framing line appears verbatim in the generated output.
|
| 76 |
+
|
| 77 |
+

|
| 78 |
+
Figure 3: Illustration of our anchoring experiment using a real example (expanded in Figure 7). We construct the anchor function (left) by taking the function signature from the HumanEval prompt (blue), appending $n$ lines of the canonical solution (green), then adding anchoring lines (red). We construct the full prompt (center) by combining the anchor function, the original HumanEval prompt, and the first $n$ lines of the canonical solution. The solution Codex generates (right) combines elements of a canonical solution (checks condition and adds to ret.), with the anchor function (for var loop).
|
| 79 |
+
|
| 80 |
+
We report the results of our framing experiments in Table 1. We find that adding irrelevant preceding functions consistently lowers functional accuracy, by between 22.3 and 30.5 points for Codex, across the different framing lines we tested. Moreover, both models frequently generate the framing line: $81 \%$ of the time for Codex and $7 0 . 7 \%$ of time for CodeGen, compared to only $4 . 5 \%$ and $0 . 0 \%$ over untransformed prompts respectively. These results suggest that code generation models can erroneously rely on irrelevant information in the prompt in predictable ways, even in the extreme case when doing so contradicts the type specification in the function signature (return False ).
|
| 81 |
+
|
| 82 |
+
# 3.3.2 Inspiration: Anchoring
|
| 83 |
+
|
| 84 |
+
We next draw inspiration from anchoring: humans’ tendency to insufficiently adjust their estimates away from initial values. For example, Tversky and Kahneman $\mathbb { \underline { { \lVert \mathbf { 9 7 4 } } \rVert } }$ find that subjects’ median estimate for the fraction of African countries in the UN shifts from $2 5 \%$ to $45 \%$ , based on whether they were first asked if the fraction was greater or less than $10 \%$ and $65 \%$ , respectively. Anchoring captures how humans adjust to partial information, versus irrelevant information (framing effect).
|
| 85 |
+
|
| 86 |
+
Using anchoring as inspiration, we hypothesize that code generation models may adjust their output towards related solutions, when these solutions are included in the prompt. To elicit this failure, we prepend anchor functions to prompts: functions that are similar to a valid solution for a HumanEval prompt, but contain some error. We first check that prepending these anchor functions decreases functional accuracy, as in Section $3 . 3 . 1 .$ Next, to test if models adjust their output towards related solutions, we check that the generated solution contains elements of the anchor function.
|
| 87 |
+
|
| 88 |
+
We aim to construct anchor functions that are similar to functions in HumanEval prompts and that compile, but are incorrect. To do so, we take a prefix of the canonical solution, then add additional anchor lines that produce an incorrect output. See Figure $\triangledown$ for an example. We describe two types of anchor lines, and how we test their influence on the generated solutions, in the following paragraphs.
|
| 89 |
+
|
| 90 |
+
Print-var anchor lines. We first study print-var anchor lines, which iterate over all variables in the function signature and print their values. For a function with inputs var1 and var2 , the associated print-var anchor lines are:
|
| 91 |
+
|
| 92 |
+
for var in [var1, var2]: print(var)
|
| 93 |
+
|
| 94 |
+
To study the influence of the print-var anchor lines on the solution, we measure how often (i) just the first line (for loop), and (ii) just the second line (print statement) appear in the generated solution.
|
| 95 |
+
|
| 96 |
+
Add-var anchor lines. We also study add-var anchor lines, which return the sum of all variables in the function signature (converted to strings). For a function with inputs var1 and var2 , the add-var anchor lines are:
|
| 97 |
+
|
| 98 |
+

|
| 99 |
+
Figure 4: Results of the print-var anchoring experiment. Left. We measure the functional accuracy of Codex (top) and CodeGen (bottom) with no anchor function prepended (baseline acc) and with a printvar anchor function prepended (anchor acc), and find that prepending the anchor function consistently lowers accuracy. Right. We measure the influence of the anchor function on the generated solution by plotting the fraction of generated solutions that contain “for var in ” from the print-var anchor prompt (for var loop), the fraction of generated solutions that include “print(var) ” (prints var), and the fraction of generated solutions that output the anchor function verbatim without additional content (exact copy), as a function of the number of canonical solution lines added to the prompt.
|
| 100 |
+
|
| 101 |
+
tmp = str(var1) $^ +$ str(var2) return tmp
|
| 102 |
+
|
| 103 |
+
To study the influence of the add-var anchor lines on the solution, we measure how often return tmp appears in the generated solution.
|
| 104 |
+
|
| 105 |
+
Print-var results. In Figure 4, we show that prepending print-var anchor functions consistently lowers Codex and CodeGens’ functional accuracies across different number of prompted canonical solution lines. We vary the number of canonical solution lines to study prompts of different difficulties; as the number of solution lines increases, the number remaining lines models must produce decreases.4
|
| 106 |
+
|
| 107 |
+
We additionally find that elements of anchor function often appear in both models’ outputs, suggesting that code generation models adjust their solutions towards related solutions. In Figure $^ { 4 , }$ we see that Codex generates for var in $3 2 \% { - } 6 1 \%$ of solutions when at least one line of the canonical solution is included, and generates print(var) in $2 6 \% - 4 4 \%$ of solutions. CodeGen’s behavior is qualitatively similar. Both models sometimes even incorporate the anchor lines into correct solutions; on Codex, the for var loop is used in a correct solution for $3 \% - 1 1 \%$ of all outputs, while print(var) is used in a correct solution for $1 \% - 9 \%$ of outputs.
|
| 108 |
+
|
| 109 |
+
Control experiments. One concern might be that models just outputs the anchor function verbatim, as in Section $\underline { { \left. 3 . 3 . 1 \right. } }$ but we find that this does not explain the full results—both models include anchor lines in many solutions that do not copy the anchor function verbatim. We also find that changing the name of the anchor function leads to only negligible changes; see Appendix A.1 for details.
|
| 110 |
+
|
| 111 |
+
Add-var results. We next consider results for add-var anchor lines. Full results for the add-var anchor prompts are presented in Appendix $\mathbf { A . l }$ and are qualitatively similar to the print-var results.
|
| 112 |
+
|
| 113 |
+
One again, we find that prepending the anchor function consistently lowers functional accuracy. Moreover, the outputted solutions often include an anchor line. For example, Codex and CodeGen generate return tmp in $2 6 \% - 4 6 \%$ and $1 3 \% - 7 9 \%$ of solutions respectively, depending on how many canonical solution lines we prompt with. These results are not caused by models outputting the anchoring function verbatim: this only occurs between $7 \%$ and $12 \%$ of the time for Codex, and $4 \%$ and $12 \%$ for CodeGen. Overall, our findings suggest that code generation models can err by adjusting its output towards related solutions, when the solutions are included in the prompt.
|
| 114 |
+
|
| 115 |
+
Write a function that squares the sum of its inputs
|
| 116 |
+
|
| 117 |
+
Write a function that sums its inputs called product_plus_2
|
| 118 |
+
|
| 119 |
+
def square_sum(x, y): return $\texttt { x } \star \texttt { 2 } + \texttt { y } \star \texttt { 2 }$
|
| 120 |
+
|
| 121 |
+
Figure 5: Left. Availability heuristic example where Codex mixes up the order of operations. The correct function signature (blue), square_sum matches the prompt. However, the incorrect function call (red) instead squares its inputs before summing them. The prompt is above the horizontal line, while the generated code is below. Right. Attribute substitution example where Codex relies on the function name to generate output. Codex correctly generates the desired function name (blue), but errs by using the function name instead of the prompt to generate the return statement (red).
|
| 122 |
+
|
| 123 |
+
# 3.3.3 Inspiration: Availability heuristic
|
| 124 |
+
|
| 125 |
+
We next draw inspiration from the availability heuristic: the tendency of humans to evaluate how frequently an example occurs based on how easy it is to recall. For example, Tversky and Kahneman $\mathbb { \underline { { \lVert \nabla ^ { 9 } 7 3 \rVert } } }$ find that humans tend to incorrectly report that there are more first words that start with “r” and “k” than have third letter “r” and “k”, because the former quickly come to mind.
|
| 126 |
+
|
| 127 |
+
Using the availability heuristic as motivation, we hypothesize that code generation models may err by outputting solutions to related prompts that appear more frequently in the training set. To elicit this failure, we start with prompts that apply a unary operation before a binary operation (unary-first), then flip the order (binary-first). Programmers tend to apply unary operations first (e.g. when computing Euclidean distances or variances), so we conjecture that they appear more frequently on GitHub. We first check that flipping the order of operations decreases accuracy. Next, to test if code generation models instead outputs related prompts that occur more frequently in the training set, we measure whether code generation models instead output the unary-first solution.
|
| 128 |
+
|
| 129 |
+
We consider all 12 combinations of the binary operations sum, difference, and product, with unary operations square, cube, quadruple, and square root. Focusing on Codex,5 we find that accuracy drops from $50 \%$ to $17 \%$ when flipping the order from unary-first to binary-first. Among combinations where flipping the order leads to error, we find that $7 5 \%$ of the binary-first outputs are the unary-first solution. We exhibit one such error in Figure $\boxed { 5 }$ when prompted to square the sum of its inputs, Codex generates the correct function name (square_sum ), but reverses the order of operations. Our results suggest that Codex can err by outputting solutions to related, frequent prompts in the training set.
|
| 130 |
+
|
| 131 |
+
Control experiments. One worry is that the dip in performance is due the instructional nature of our prompts. We rule this out by evaluating Codex on prompts where the docstring appears beneath the function signature and is a definition rather than command, to more closely mimic some functions on GitHub. We obtain qualitatively similar results on these prompts, see Appendix A.4 for details.
|
| 132 |
+
|
| 133 |
+
# 3.3.4 Inspiration: Attribute substitution
|
| 134 |
+
|
| 135 |
+
Finally, we draw inspiration from attribute substitution: the human tendency to respond to a complicated question using a simpler, related question [Kahneman and Frederick, 2002]. For example, a professor when asked how likely a candidate is to be tenured, may instead respond with how impressive they found their job talk.
|
| 136 |
+
|
| 137 |
+
Using attribute substitution as inspiration, we hypothesize that Codex may use simple-but-incorrect heuristics to generate solutions. To elicit this failure, we add requests for conflicting function names to MathEquation prompts. For example, in Figure 5 we prompt Codex to write a program that sums its inputs called product_plus_2 . We first check that adding conflicting function names decreases Codex’s functional accuracy. Next, to test if Codex uses simple-but-incorrect heuristics to generate solutions, we check whether the generate solution matches the function name.
|
| 138 |
+
|
| 139 |
+
We evaluate Codex using 90 MathEquation prompts where the desired solution and requested function name differ. To construct prompts, we begin with a prompt that Codex originally solves
|
| 140 |
+
|
| 141 |
+
<table><tr><td>Name location</td><td>Correct</td><td>Matches function name</td><td>Other error</td></tr><tr><td>No name</td><td>100.0</td><td>=</td><td>0.0</td></tr><tr><td>Docstring</td><td>4.4</td><td>80.0</td><td>15.6</td></tr><tr><td>Function signature</td><td>4.4</td><td>70.0</td><td>25.6</td></tr><tr><td>Name first</td><td>4.6</td><td>51.7</td><td>43.7</td></tr></table>
|
| 142 |
+
|
| 143 |
+
Table 2: Results of the attribute substitution experiments. We report accuracy when we do not request a contradictory function name (no name), we request a function name in the docstring (docstring), in the function signature below the docstring (function signature), or above the docstring (name first). Overall, we find that Codex frequently generates solutions based on the function name.
|
| 144 |
+
|
| 145 |
+
(sum, difference, or product), then append a request for a specific, contradictory function name (see Appendix $\underline { { \vert \mathbf { A . } 4 \vert } }$ for full implementation details).
|
| 146 |
+
|
| 147 |
+
We report our experimental results in Table $\triangledown$ When we request a conflicting function name, Codex’s accuracy drops from $100 \%$ to only $4 . 4 \% - 4 . 6 \%$ . This finding holds whether we request the function name in the docstring, write it in the function signature below the docstring, or write the function name over a simple description on the function. Moreover, for between $52 \%$ and $80 \%$ of prompts, Codex responds with the function specified in the function name. Our results indicate that Codex can err by using simple-but-incorrect heuristics to generate solutions.
|
| 148 |
+
|
| 149 |
+
# 4 GPT-3 Results
|
| 150 |
+
|
| 151 |
+
In this section, we extend our study from Codex to GPT-3. To test GPT-3 for failure modes, we try to faithfully reproduce and extend the anchoring experiment of Jacowitz and Kahneman [1995] and framing effect experiment of Tversky and Kahneman [1981].
|
| 152 |
+
|
| 153 |
+
Anchoring. As in Section 3.3.2 we study Section 3.3.2, we study anchoring: humans’ tendency to insufficiently adjust their estimates away from an initial value [Tversky and Kahneman, 1974]. We largely replicate the anchoring study presented in Jacowitz and Kahneman [1995], but test the “davinci-001” version of OpenAI’s GPT-3 instead of humans.
|
| 154 |
+
|
| 155 |
+
In their original experiment, Jacowitz and Kahneman asked students to estimate quantities such as the length of the Mississippi river in miles. They then asked new students to estimate the same quantities, but first gave them a upper or lower bound on the true answer (e.g. the Mississippi river is longer than 700 miles), which they call anchors. They find that students tend to underestimate the true quantity when prompted with the lower anchor, and overestimate it when prompted with the upper anchor.
|
| 156 |
+
|
| 157 |
+
We adapt the anchoring study from Jacowitz and Kahneman [1995] by finding the true answer for 14 of their 15 original questions6, then computing upper and lower anchors by increasing and decreasing the true answer by a fixed percentage $p$ . See Appendix $\mathbf { B . l }$ for a full list of questions and true answers. As an example, if the actual answer is 2000 and $p$ is $5 0 \%$ , the upper anchor is 3000 and the lower anchor is 1000. We use this bound as an anchor, so that a typical prompt might be:
|
| 158 |
+
|
| 159 |
+
What is the length of the Mississippi River (in miles)? Answer:
|
| 160 |
+
|
| 161 |
+
To study anchoring in GPT-3, we measure how prepending the anchor changes GPT-3’s estimate. We categorize four potential changes: the estimate does not change, the estimate shifts towards the anchor, the estimate shifts away from the anchor, and the estimate is gibberish. We report the results in Table $^ 3 .$ for $p \in \{ 2 0 \% , 5 0 \% \}$ . We find that GPT-3 routinely updates its estimate when an anchor is prepended, and tends to shift the estimate towards the anchor. We also find that while GPT-3’s updated estimate sometimes matches the anchor exactly $67 \%$ of the time), it also often lands between the anchor and the original prediction, mirroring the behavior of humans.
|
| 162 |
+
|
| 163 |
+
Our replication has a few limitations. Like the original study our sample size is small, we construct prompts with templates, and many of the outputs—on average $41 \%$ —are gibberish. Nevertheless, our results suggest that GPT-3 incorporates the anchor during estimation.
|
| 164 |
+
|
| 165 |
+
Anchor change to model output
|
| 166 |
+
|
| 167 |
+
<table><tr><td>p</td><td>No change</td><td>Towards anchor</td><td>Away from anchor</td><td>Gibberish</td></tr><tr><td>20%</td><td>10.7</td><td>28.6</td><td>10.7</td><td>50.0</td></tr><tr><td>50%</td><td>14.3</td><td>42.9</td><td>10.7</td><td>32.1</td></tr></table>
|
| 168 |
+
|
| 169 |
+
Table 3: Results of the adaptation of the anchoring study from Jacowitz and Kahneman [1995] on GPT-3. We consider anchors that are $20 \%$ and $50 \%$ increases and decreases from the ground truth answer, and measure how often GPT-3’s revised prediction does not change, shifts towards / away from the anchor, or is gibberish, aggregated across lower and upper anchors.
|
| 170 |
+
|
| 171 |
+
un
|
| 172 |
+
Delete all files in an inputted directory that import all
|
| 173 |
+
of statsmodels, plotly, seaborn, and scipy
|
| 174 |
+
“””
|
| 175 |
+
import os
|
| 176 |
+
import re
|
| 177 |
+
def delete_all(directory): for root, dir, file in os.walk(directory): for f in files: with open(os.path.join(root, f), ‘r’) as fp: if re.search(“import statsmodels”, fp.read()): os.remove(os.path.join(root, f))
|
| 178 |
+
|
| 179 |
+

|
| 180 |
+
Figure 6: Left. Example where Codex incorrectly deletes files. We prompt Codex to delete files containing all of statsmodels, plotly, seaborn, and scipy. Codex correctly iterates through all files in the inputted directory (blue), but then incorrectly deletes all files containing statsmodels (red), as attribute substitution suggests. Right. Plot describing the errors Codex makes as a function of the number of packages. We find that Codex often incorrectly deletes files if they contain any of the listed packages, and relies more on just the first package as the number of packages increases.
|
| 181 |
+
|
| 182 |
+
Framing effect. As in Section $3 . 3 . 1 ,$ we study the framing effect: predictable shifts in human responses when the same problem is framed in different ways. We largely replicate the framing experiment presented in Tversky and Kahneman [1981]: we compare GPT-3’s responses to two equivalent decisions: choosing to either deterministically save (or let die) some fraction of a population, or to probabilistically save (let die) the whole population.
|
| 183 |
+
|
| 184 |
+
We measure the rate at which GPT-3 chooses the probabilistic option across different population sizes and different fractions / probabilities. See Section $\boxed { \mathbf { B } . 2 }$ for full results. When using the probability in the original study, GPT-3 qualitatively mirrors humans: it chooses the probabilistic option far more frequently under the “not save” framing than under the “save framing”. However, for higher probabilities, GPT-3 consistently chooses the probabilistic option for both framings; we conjecture that humans could exhibit similar behavior in this regime, since the probabilistic option is more certain. Overall, our results suggest that GPT-3 selects different options based on the framing, and could be a test-bed to identify qualitative human behaviors without running full human studies.
|
| 185 |
+
|
| 186 |
+
# 5 High-Impact Errors
|
| 187 |
+
|
| 188 |
+
We have shown how our framework helps us elicit failures of large language models. In this section, we use our framework to construct cases where Codex makes high-impact errors: harmful errors that are hard to undo. Specifically, we construct prompts where Codex incorrectly deletes files.
|
| 189 |
+
|
| 190 |
+
As in Section $3 . 3 . 4$ we draw inspiration from attribute substitution: the tendency of humans to respond to a complex question with a simpler, related question. Using attribute substitution as motivation, we hypothesize that Codex may simplify complex expressions such as conjunctions. Instead of checking all components of a conjunction at once, it might “give up��� and consider subsets of the components individually (e.g. checking for $A$ or $A \lor B$ instead of $A \land B$ ). To elicit this failure, we prompt Codex to delete files containing specific sets of package imports; see Figure $6$ for an example. We measure how often Codex generates a simpler output that erroneously deletes files, as well as how often it produces the correct output. See Appendix $\boxed { \mathbf { C } }$ for additional details.
|
| 191 |
+
|
| 192 |
+
We test for two types of simpler outputs: code deleting all files containing first package in the set (i.e. $A$ instead of $A \land B$ ), and code deleting all files containing any package in the set (i.e. $A \lor B$ instead of $A \land B )$ ). The latter operation is computationally simpler than checking if a file contains all packages, since Codex can delete a file whenever a single package in the set appears.
|
| 193 |
+
|
| 194 |
+
In Figure $\textcircled { 6 }$ we illustrate the breakdown of the errors Codex makes as a function of the number of package imports in the prompt. We find that Codex erroneously deletes files on at least $80 \%$ of prompts when the number of package imports is at least three, despite producing a correct output on $90 \%$ of prompts when the number of packages is at most two. Moreover, we find that Codex increasingly errs by using only the first package as the problem gets more challenging (i.e. the number of packages increases), as attribute substitution predicts.
|
| 195 |
+
|
| 196 |
+
Control experiments. To very that our findings generalize to different classes of realistic prompts, we test Codex on prompts containing a descriptive docstring beneath the function signature delete_all_with_libraries(directory). We observe qualitatively similar results, though we find more instances of low-impact errors; see Appendix $\mathbf { \bar { C } }$ for details. Overall, our results demonstrate how our framework can preemptively elicit high-impact errors, like erroneous deletions.
|
| 197 |
+
|
| 198 |
+
# 6 Discussion
|
| 199 |
+
|
| 200 |
+
In this work, we identify and test for classes of errors that open-ended generation systems can make, using cognitive biases as motivation. To do so, we generate hypotheses for potential qualitative failure modes, then construct transformations over prompts that elicit these failures. Our experiments uncover deficiencies of Codex, CodeGen, and GPT-3, and elicit high-impact errors that are challenging to undo. While we focus on a few specific failure modes, future work could apply our framework to uncover additional failures. Moreover, our framework queries systems as a black-box, so it could be used to quickly probe for errors in future systems as they are released.
|
| 201 |
+
|
| 202 |
+
Some of our results highlight how optimizing likelihood could be at odds with human intent. For example, over GitHub, programs may more often match their function signature than docstring (Section $3 . 3 . 3 )$ , or tend to complete to pass if the preceding function does (Section 3.3.1). Nevertheless, our results elicit qualitative errors regardless of the “correct” behavior (i.e. even when what is incorrect and correct flips), and demonstrate the importance of documenting qualitative failures.
|
| 203 |
+
|
| 204 |
+
The reliability challenges posed by the open-ended generation systems that we study sometimes also apply to classifiers. Some classification errors can be more costly than others [Oakden-Rayner et al., 2020], classifiers may use irrelevant information to make predictions $\lVert \overline { { \mathrm { S a g a w a ~ e t ~ a l . } \rVert \mathbb { 2 0 } 2 0 } } \rVert$ , and input-level transformations like universal adversarial triggers $\rVert \overline { { \mathrm { W a l l a c e ~ e t ~ a l . } } } \rVert \overline { { 2 0 1 9 } } \rVert$ and distribution shifts [Hendrycks and Dietterich, $\boxed { 2 0 1 9 }$ induce errors. However, while classification errors may be succinctly summarized with a confusion matrix, generation errors cannot, since each output appears infrequently. To tame the large output space, our transformations must induce categories of errors that we can reliably measure. Despite this additional constraint, we are able to construct model-agnostic transformations: we do not use the training data, model parameters, or even output logits. Our success in this restricted setting demonstrates the comparative brittleness of completion systems.
|
| 205 |
+
|
| 206 |
+
We present a method to systematically elicit errors from large language models. While we believe our work is important to understand model behavior, bad actors could exploit the errors we reveal (e.g. by deleting files on systems with a Codex back-end). Nevertheless, we introduce new robustness challenges for developers and identify misuses of these models, which we feel supersedes this risk.
|
| 207 |
+
|
| 208 |
+
As a subroutine in our experimental pipeline, we use cognitive biases as inspiration to identify potential failure modes. This is an example of using a reference system—a system that is analogous to the ML models we study in some meaningful way—to generate insights into ML systems [Steinhardt, $\boxed { 2 0 2 2 }$ We use humans as the reference, focusing specifically on their susceptibility to cognitive biases. Other references, such as complex systems or evolution, may uncover new errors and insights. Moreover, ML systems could additionally err in ways that known systems do not, so it will also be useful to have intrinsic methods for characterizing model errors. Overall, our work underscores the need for more extensive testing of generative ML systems before their widespread deployment.
|
| 209 |
+
|
| 210 |
+
# Acknowledgements
|
| 211 |
+
|
| 212 |
+
We thank the anonymous reviewers, Ruiqi Zhong, Jean-Stanislas Denain, Aditi Raghunathan, Jessy Lin, and Lawrence Chan for feedback. This work was supported by NSF Award Grant no. 1804794.
|
| 213 |
+
|
| 214 |
+
# References
|
| 215 |
+
|
| 216 |
+
Emily Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchel. On the dangers of stochastic parrots: Can language models be too big? In ACM Conference on Fairness, Accountability, and Transparency (FAccT), 2021.
|
| 217 |
+
|
| 218 |
+
Su Lin Blodgett, Gilsinia Lopez, Alexandra Olteanu, Robert Sim, and Hanna Wallach. Stereotyping norwegian salmon: An inventory of pitfalls in fairness benchmark datasets. In Association for Computational Linguistics (ACL), 2021.
|
| 219 |
+
|
| 220 |
+
Rishi Bommasani, Drew A. Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S. Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, Erik Brynjolfsson, Shyamal Buch, Dallas Card, Rodrigo Castellon, Niladri Chatterji, Annie Chen, Kathleen Creel, Jared Quincy Davis, Dorottya Demszky, Chris Donahue, Moussa Doumbouya, Esin Durmus, Stefano Ermon, John Etchemendy, Kawin Ethayarajh, Li Fei-Fei, Chelsea Finn, Trevor Gale, Lauren Gillespie, Karan Goel, Noah Goodman, Shelby Grossman, Neel Guha, Tatsunori Hashimoto, Peter Henderson, John Hewitt, Daniel E. Ho, Jenny Hong, Kyle Hsu, Jing Huang, Thomas Icard, Saahil Jain, Dan Jurafsky, Pratyusha Kalluri, Siddharth Karamcheti, Geoff Keeling, Fereshte Khani, Omar Khattab, Pang Wei Koh, Mark Krass, Ranjay Krishna, Rohith Kuditipudi, Ananya Kumar, Faisal Ladhak, Mina Lee, Tony Lee, Jure Leskovec, Isabelle Levent, Xiang Lisa Li, Xuechen Li, Tengyu Ma, Ali Malik, Christopher D. Manning, Suvir Mirchandani, Eric Mitchell, Zanele Munyikwa, Suraj Nair, Avanika Narayan, Deepak Narayanan, Ben Newman, Allen Nie, Juan Carlos Niebles, Hamed Nilforoshan, Julian Nyarko, Giray Ogut, Laurel Orr, Isabel Papadimitriou, Joon Sung Park, Chris Piech, Eva Portelance, Christopher Potts, Aditi Raghunathan, Rob Reich, Hongyu Ren, Frieda Rong, Yusuf Roohani, Camilo Ruiz, Jack Ryan, Christopher Ré, Dorsa Sadigh, Shiori Sagawa, Keshav Santhanam, Andy Shih, Krishnan Srinivasan, Alex Tamkin, Rohan Taori, Armin W. Thomas, Florian Tramèr, Rose E. Wang, William Wang, Bohan Wu, Jiajun Wu, Yuhuai Wu, Sang Michael Xie, Michihiro Yasunaga, Jiaxuan You, Matei Zaharia, Michael Zhang, Tianyi Zhang, Xikun Zhang, Yuhui Zhang, Lucia Zheng, Kaitlyn Zhou, and Percy Liang. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258, 2021.
|
| 221 |
+
|
| 222 |
+
Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
|
| 223 |
+
|
| 224 |
+
Nicholas Carlini, Florian Tramer, Eric Wallace, Matthew Jagielski, Ariel Herbert-Voss, Katherine Lee, Adam Roberts, Tom Brown, Dawn Song, Ulfar Erlingsson, Alina Oprea, and Colin Raffel. Extracting training data from large language models. arXiv preprint arXiv:2012.07805, 2020.
|
| 225 |
+
|
| 226 |
+
Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plappert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Josh Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021.
|
| 227 |
+
|
| 228 |
+
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. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.
|
| 229 |
+
|
| 230 |
+
Angela Fan, Yacine Jernite, Ethan Perez, David Grangier, Jason Weston, and Michael Auli. ELI5: Long form question answering. In Association for Computational Linguistics (ACL), 2019.
|
| 231 |
+
|
| 232 |
+
Saadia Gabriel, Asli Celikyilmaz, Rahul Jha, Yejin Choi, and Jianfeng Gao. GO FIGURE: A meta evaluation of factuality in summarization. In Findings of the Association for Computational Linguistics (Findings of ACL), 2021.
|
| 233 |
+
|
| 234 |
+
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.
|
| 235 |
+
|
| 236 |
+
Sophie Groenwold, Lily Ou, Aesha Parekh, Samhita Honnavalli, Sharon Levy, Diba Mirza, and William Yang Wang. Investigating african-american vernacular english in transformer-based text generation. In Empirical Methods in Natural Language Processing (EMNLP), 2020.
|
| 237 |
+
|
| 238 |
+
Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations (ICLR), 2019.
|
| 239 |
+
|
| 240 |
+
Dan Hendrycks, Steven Basart, Saurav Kadavath, Mantas Mazeika, Akul Arora, Ethan Guo, Collin Burns, Samir Puranik, Horace He, Dawn Song, and Jacob Steinhardt. Measuring coding challenge competence with APPS. In Advances in Neural Information Processing Systems (NeurIPS), 2021a.
|
| 241 |
+
|
| 242 |
+
Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. In International Conference on Learning Representations (ICLR), 2021b.
|
| 243 |
+
|
| 244 |
+
Dan Hendrycks, Collin Burns, Saurav Kadavath, Akul Arora, Steven Basart, Eric Tang, Dawn Song, and Jacob Steinhardt. Measuring mathematical problem solving with the MATH dataset. In Advances in Neural Information Processing Systems (NeurIPS), 2021c.
|
| 245 |
+
|
| 246 |
+
Abigail Z. Jacobs and Hanna Wallach. Measurement and fairness. In ACM Conference on Fairness, Accountability, and Transparency (FAccT), 2021.
|
| 247 |
+
|
| 248 |
+
Karen E. Jacowitz and Daniel Kahneman. Measures of anchoring in estimation tasks. Personality and Social Psychology Bulletin, 21(11):1161–1166, 1995.
|
| 249 |
+
|
| 250 |
+
Daniel Kahneman and Shane Frederick. Representativeness revisited: Attribute substitution in intuitive judgment. In Heuristics and Biases: The Psychology of Intuitive Judgement, pages 49–81. 2002.
|
| 251 |
+
|
| 252 |
+
Kalpesh Krishna, Aurko Roy, and Mohit Iyyer. Hurdles to progress in long-form question answering. In North American Association for Computational Linguistics (NAACL), 2021.
|
| 253 |
+
|
| 254 |
+
Stephanie Lin, Jacob Hilton, and Owain Evans. Truthfulqa: Measuring how models mimic human falsehoods. arXiv preprint arXiv:2109.07958, 2021.
|
| 255 |
+
|
| 256 |
+
Jiachang Liu, Dinghan Shen, Yizhe Zhang, Bill Dolan, Lawrence Carin, and Weizhu Chen. What makes good in-context examples for GPT-3. arXiv preprint arXiv:2101.06804, 2021.
|
| 257 |
+
|
| 258 |
+
David E. Meyer. Semantic priming well established. Science, 345(6196):523–523, 2014.
|
| 259 |
+
|
| 260 |
+
Moin Nadeem, Anna Bethke, and Siva Reddy. Stereoset: Measuring stereotypical bias in pretrained language models. arXiv preprint arXiv:2004.09456, 2020.
|
| 261 |
+
|
| 262 |
+
Erik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu, Huam Wang, Yingbo Zhou, Silvio Savarese, and Caiming Xiong. A conversational paradigm for program synthesis. arXiv preprint arXiv:2203.13474, 2022.
|
| 263 |
+
|
| 264 |
+
Luke Oakden-Rayner, Jared Dunnmon, Gustavo Carneiro, and Christopher Ré. 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, 2020.
|
| 265 |
+
|
| 266 |
+
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI Blog, 1(8), 2019.
|
| 267 |
+
|
| 268 |
+
Jack W. Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, Francis Song, J. Aslanides, Sarah Henderson, Roman Ring, Susannah Young, Eliza Rutherford, Tom Hennigan, Jacob Menick, Albin Cassirer, Richard Powell, G. V. D. Driessche, Lisa Anne Hendricks, Maribeth Rauh, Po-Sen Huang, Amelia Glaese, Johannes Welbl, Sumanth Dathathri, Saffron Huang, Jonathan Uesato, John F. J. Mellor, I. Higgins, Antonia Creswell, Nathan McAleese, Amy Wu, Erich Elsen, Siddhant M. Jayakumar, Elena Buchatskaya, D. Budden, Esme Sutherland, K. Simonyan, Michela Paganini, L. Sifre, Lena Martens, Xiang Lorraine Li, A. Kuncoro, Aida Nematzadeh, E. Gribovskaya, Domenic Donato, Angeliki Lazaridou, A. Mensch, J. Lespiau, Maria Tsimpoukelli, N. Grigorev, Doug Fritz, Thibault Sottiaux, Mantas Pajarskas, Tobias Pohlen, Zhitao Gong, Daniel Toyama, Cyprien de Masson d’Autume, Yujia Li, Tayfun Terzi, Vladimir Mikulik, I. Babuschkin, Aidan Clark, Diego de Las Casas, Aurelia Guy, Chris Jones, James Bradbury, Matthew Johnson, Blake A. Hechtman, Laura Weidinger, Iason Gabriel, William S. Isaac, Edward Lockhart, Simon Osindero, Laura Rimell, Chris Dyer, Oriol Vinyals, Kareem W. Ayoub, Jeff Stanway, L. Bennett, D. Hassabis, K. Kavukcuoglu, and Geoffrey Irving. Scaling language models: Methods, analysis & insights from training gopher. arXiv, 2021.
|
| 269 |
+
|
| 270 |
+
Ashwin Ram, Rohit Prasad, Chandra Khatri, Anu Venkatesh, Raefer Gabriel, Qing Liu, Jeff Nunn, Behnam Hedayatnia, Ming Cheng, Ashish Nagar, Eric King, Kate Bland, Amanda Wartick, Yi Pan, Han Song, Sk Jayadevan, Gene Hwang, and Art Pettigrue. Conversational ai: The science behind the alexa prize. arXiv preprint arXiv:1801.03604, 2018.
|
| 271 |
+
|
| 272 |
+
Sascha Rothe, Shashi Narayan, and Aliaksei Severyn. Leveraging pre-trained checkpoints for sequence generation tasks. Transactions of the Association for Computational Linguistics (TACL), 8:264–280, 2020.
|
| 273 |
+
|
| 274 |
+
Shiori Sagawa, Pang Wei Koh, Tatsunori B. Hashimoto, and Percy Liang. Distributionally robust neural networks for group shifts: On the importance of regularization for worst-case generalization. In International Conference on Learning Representations (ICLR), 2020.
|
| 275 |
+
|
| 276 |
+
Emily Sheng, Kai-Wei Chang, Premkumar Natarajan, and Nanyun Peng. The woman worked as a babysitter: On biases in language generation. In Empirical Methods in Natural Language Processing (EMNLP), 2019.
|
| 277 |
+
|
| 278 |
+
Kurt Shuster, Spencer Poff, Moya Chen, Douwe Kiela, and Jason Weston. Retrieval augmentation reduces hallucination in conversation. arXiv preprint arXiv:2104.07567, 2021.
|
| 279 |
+
|
| 280 |
+
Jacob Steinhardt. Anchor weights for ML. Bounded Regret, 2022.
|
| 281 |
+
|
| 282 |
+
Nisan Stiennon, Long Ouyang, Jeff Wu, Daniel M. Ziegler, Ryan Lowe, Chelsea Voss, Alec Radford, Dario Amodei, and Paul Christiano. Learning to summarize from human feedback. In Advances in Neural Information Processing Systems (NeurIPS), 2020.
|
| 283 |
+
|
| 284 |
+
Fritz Strack, Leonard L. Martin, and Nobert Schwarz. Priming and communication: Social determinants of information use in judgments of life satisfaction. European Journal of Social Psychology, 18(5):429–442, 1988.
|
| 285 |
+
|
| 286 |
+
Leonard Tang, Elizabeth Ke, Nikhil Singh, Nakul Verma, and Iddo Drori. Solving probability and statistics problems by program synthesis. arXiv preprint arXiv:2111.08276, 2021.
|
| 287 |
+
|
| 288 |
+
Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, Heng-Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, YaGuang Li, Hongrae Lee, Huaixiu Steven 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, Igor Krivokon, Will Rusch, Marc Pickett, Kathleen Meier-Hellstern, Meredith Ringel Morris, Tulsee Doshi, Renelito Delos Santos, Toju Duke, Johnny Soraker, Ben Zevenbergen, Vinodkumar Prabhakaran, Mark Diaz, Ben Hutchinson, Kristen Olson, Alejandra Molina, Erin Hoffman-John, Josh Lee, Lora Aroyo, Ravi Rajakumar, Alena Butryna, Matthew Lamm, Viktoriya Kuzmina, Joe 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 preprint arXiv:2201.08239, 2022.
|
| 289 |
+
|
| 290 |
+
Amos Tversky and Daniel Kahneman. Availability: A heuristic for judging frequency and probability. Cognitive Psychology, 5(2):207–232, 1973.
|
| 291 |
+
|
| 292 |
+
Amos Tversky and Daniel Kahneman. Judgment under uncertainty: Heuristics and biases. Science, 185(4157):1124–1131, 1974.
|
| 293 |
+
|
| 294 |
+
Amos Tversky and Daniel Kahneman. The framing of decisions and the psychology of choice. Science, 211(4481):453–458, 1981.
|
| 295 |
+
|
| 296 |
+
Eric Wallace, Shi Feng, Nikhil Kandpal, Matt Gardner, and Sameer Singh. Universal adversarial triggers for attacking and analyzing NLP. In Empirical Methods in Natural Language Processing (EMNLP), 2019.
|
| 297 |
+
|
| 298 |
+
Alex Wang, Yada Pruksachatkun, Nikita Nangia, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. SuperGLUE: A stickier benchmark for general-purpose language understanding systems. In Advances in Neural Information Processing Systems (NeurIPS), 2019a.
|
| 299 |
+
|
| 300 |
+
Alex Wang, Amapreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In International Conference on Learning Representations (ICLR), 2019b.
|
| 301 |
+
|
| 302 |
+
Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 billion parameter autoregressive language model, 2021.
|
| 303 |
+
|
| 304 |
+
Laura Weidinger, John Mellor, Maribeth Rauh, Conor Griffin, Jonathan Uesato, Po-Sen Huang, Myra Cheng, Mia Glaese, Borja Balle, Atoosa Kasirzadeh, Zac Kenton, Sasha Brown, Will Hawkins, Tom Stepleton, Courtney Biles, Abeba Birhane, Julia Haas, Laura Rimell, Lisa Anne Hendricks, William Isaac, Sean Legassick, Geoffrey Irving, and Iason Gabriel. Ethical and social risks of harm from language models. arXiv preprint arXiv:2112.04359, 2021.
|
| 305 |
+
|
| 306 |
+
Sonja Windhager, Florian Hutzler, Claus-Christian Carbon, Elisabeth Oberzaucher, Katrin Schaefer, Truls Thorstensen, Helmut Leder, and Karl Grammer. Laying eyes on headlights: Eye movements suggest facial features in cars. Collegium Antropologicum, 34(3):1075–1080, 2010.
|
| 307 |
+
|
| 308 |
+
Tony Z. Zhao, Eric Wallace, Shi Feng, Dan Klein, and Sameer Singh. Calibrate before use: Improving few-shot performance of language models. In International Conference on Machine Learning (ICML), 2021.
|
| 309 |
+
|
| 310 |
+
Daniel M. Ziegler, Nisan Stiennon, Jeffrey Wu, Tom B. Brown, Alec Radford, Dario Amodei, Paul Christiano, and Geoffrey Irving. Fine-tuning language models from human preferences. arXiv preprint arXiv:1909.08593, 2019.
|
| 311 |
+
|
| 312 |
+
# Checklist
|
| 313 |
+
|
| 314 |
+
1. For all authors...
|
| 315 |
+
|
| 316 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 317 |
+
(b) Did you describe the limitations of your work? [Yes] See discussion.
|
| 318 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See discussion.
|
| 319 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 320 |
+
|
| 321 |
+
2. If you are including theoretical results...
|
| 322 |
+
|
| 323 |
+
(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]
|
| 324 |
+
|
| 325 |
+
3. If you ran experiments...
|
| 326 |
+
|
| 327 |
+
(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] Included in the supplement.
|
| 328 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We do not train new models, but in Section 3.1 and Section 4 we provide details about the models we evaluate.
|
| 329 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] Our experiments consider the deterministic rollout of models on fixed prompts.
|
| 330 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A] We do not train models in this work.
|
| 331 |
+
|
| 332 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 333 |
+
|
| 334 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] We cite GPT-3 and Codex, and give credit to OpenAI.
|
| 335 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 336 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 337 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 338 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 339 |
+
|
| 340 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 341 |
+
|
| 342 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 343 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 344 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/h4r00NGkjR/h4r00NGkjR.md
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# VideoComposer: Compositional Video Synthesis with Motion Controllability
|
| 2 |
+
|
| 3 |
+
Xiang Wang1∗ Hangjie Yuan1∗ Shiwei Zhang1∗ Dayou Chen1∗ Jiuniu Wang1 Yingya Zhang1 Yujun Shen2 Deli Zhao1 Jingren Zhou1
|
| 4 |
+
|
| 5 |
+
1Alibaba Group 2Ant Group {xiaolao.wx, yuanhangjie.yhj, zhangjin.zsw}@alibaba-inc.com {dayou.cdy, wangjiuniu.wjn, yingya.zyy, jingren.zhou}@alibaba-inc.com {shenyujun0302, zhaodeli}@gmail.com
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
The pursuit of controllability as a higher standard of visual content creation has yielded remarkable progress in customizable image synthesis. However, achieving controllable video synthesis remains challenging due to the large variation of temporal dynamics and the requirement of cross-frame temporal consistency. Based on the paradigm of compositional generation, this work presents VideoComposer that allows users to flexibly compose a video with textual conditions, spatial conditions, and more importantly temporal conditions. Specifically, considering the characteristic of video data, we introduce the motion vector from compressed videos as an explicit control signal to provide guidance regarding temporal dynamics. In addition, we develop a Spatio-Temporal Condition encoder (STCencoder) that serves as a unified interface to effectively incorporate the spatial and temporal relations of sequential inputs, with which the model could make better use of temporal conditions and hence achieve higher inter-frame consistency. Extensive experimental results suggest that VideoComposer is able to control the spatial and temporal patterns simultaneously within a synthesized video in various forms, such as text description, sketch sequence, reference video, or even simply hand-crafted motions. The code and models are publicly available at https://videocomposer.github.io.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Driven by the advances in computation, data scaling and architectural design, current visual generative models, especially diffusion-based models, have made remarkable strides in automating content creation, empowering designers to generate realistic images or videos from a textual prompt as input [24, 48, 53, 62]. These approaches typically train a powerful diffusion model [48] conditioned by text [23] on large-scale video-text and image-text datasets [2, 51], reaching unprecedented levels of fidelity and diversity. However, despite this impressive progress, a significant challenge remains in the limited controllability of the synthesis system, which impedes its practical applications.
|
| 14 |
+
|
| 15 |
+
Most existing methods typically achieve controllable generation mainly by introducing new conditions, such as segmentation maps [48, 65], inpainting masks [72] or sketches [38, 79], in addition to texts. Expanding upon this idea, Composer [28] proposes a new generative paradigm centered on the concept of compositionality, which is capable of composing an image with various input conditions, leading to remarkable flexibility. However, Composer primarily focuses on considering multi-level conditions within the spatial dimension, hence it may encounter difficulties when comes to video generation due to the inherent properties of video data. This challenge arises from the complex temporal structure of videos, which exhibits a large variation of temporal dynamics while simultaneously maintaining temporal continuity among different frames. Therefore, incorporating suitable temporal conditions with spatial clues to facilitate controllable video synthesis becomes significantly essential.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
(d) Text, style, hand-crafted motions and hand-crafted sketch
|
| 19 |
+
Figure 1: Compositional video synthesis. (a-c) VideoComposer is capable of generating videos that adhere to textual, spatial and temporal conditions or their subsets; (d) VideoComposer can synthesize videos conforming to expected motion patterns (red stroke) and shape patterns (white stroke) derived from two simple strokes.
|
| 20 |
+
|
| 21 |
+
Above observations motivate the proposed VideoComposer, which equips video synthesis with improved controllability in both spatial and temporal perception. For this purpose, we decompose a video into three kinds of representative factors, i.e., textual condition, spatial conditions and the crucial temporal conditions, and then train a latent diffusion model to recompose the input video conditioned by them. In particular, we introduce the video-specific motion vector as a kind of temporal guidance during video synthesis to explicitly capture the inter-frame dynamics, thereby providing direct control over the internal motions. To ensure temporal consistency, we additionally present a unified STC-encoder that captures the spatio-temporal relations within sequential input utilizing cross-frame attention mechanisms, leading to an enhanced cross-frame consistency of the output videos. Moreover, STC-encoder serves as an interface that allows for efficient and unified utilization of the control signals from various condition sequences. As a result, VideoComposer is capable of flexibly composing a video with diverse conditions while simultaneously maintaining the synthesis quality, as shown in Fig. 1. Notably, we can even control the motion patterns with simple hand-crafted motions, such as an arrow indicating the moon’s trajectory in Fig. 1d, a feat that is nearly impossible with current methods. Finally, we demonstrate the efficacy of VideoComposer through extensive qualitative and quantitative results, and achieve exceptional creativity in the various downstream generative tasks.
|
| 22 |
+
|
| 23 |
+
# 2 Related work
|
| 24 |
+
|
| 25 |
+
Image synthesis with diffusion models. Recently, research efforts on image synthesis have shifted from utilizing GANs [18], VAEs [31], and flow models [14] to diffusion models [9, 19, 23, 32, 34, 54, 59, 74, 80, 81] due to more stable training, enhanced sample quality, and increased flexibility in a conditional generation. Regarding image generation, notable works such as DALL-E 2 [46] and GLIDE [40] employ diffusion models for text-to-image generation by conducting the diffusion process in pixel space, guided by CLIP [44] or classifier-free approaches. Imagen [50] introduces generic large language models, i.e., T5 [45], improving sample fidelity. The pioneering work LDMs [48] uses an autoencoder [15] to reduce pixel-level redundancy, making LDMs computationally efficient. Regarding image editing, pix2pix-zero [42] and prompt-to-prompt editing [21] follow instructional texts by manipulating cross-attention maps. Imagic [29] interpolates between an optimized embedding and the target embedding derived from text instructions to manipulate images. DiffEdit [11] introduces automatically generated masks to assist text-driven image editing. To enable conditional synthesis with flexible input, ControlNet [79] and T2I-Adapter [38] incorporate a specific spatial condition into the model, providing more fine-grained control. One milestone, Composer [28], trains a multi-condition diffusion model that broadly expands the control space and displays remarkable results. Nonetheless, this compositionality has not yet been proven effective in video synthesis, and VideoComposer aims to fill this gap.
|
| 26 |
+
|
| 27 |
+
Video synthesis with diffusion models. Previous methods [13, 58, 67] usually adopt GANs for video synthesis. Recent research has demonstrated the potential of employing diffusion models for high-quality video synthesis [5, 20, 25, 30, 36, 62, 75]. Notably, ImagenVideo [24] and Make-AVideo [53] both model the video distribution in pixel space, which limits their applicability due to high computational demands. In contrast, MagicVideo [83] models the video distribution in the latent space, following the paradigm of LDMs [48], significantly reducing computational overhead. With the goal of editing videos guided by texts, VideoP2P [33] and vid2vid-zero [66] manipulate the crossattention map, while Dreamix [37] proposes an image-video mixed fine-tuning strategy. However, their generation or editing processes solely rely on text-based instructions [44, 45]. A subsequent work, Gen-1 [16], integrates depth maps alongside texts using cross-attention mechanisms to provide structural guidance. Both MCDiff [8] and LaMD [27] target motion-guided video generation; the former focuses on generating human action videos and encodes the dynamics by tracking the keypoints and reference points, while the latter employs a learnable motion latent to improve quality. Nevertheless, incorporating the guidance from efficient motion vectors or incorporating multiple guiding conditions within a single model is seldom explored in the general video synthesis field.
|
| 28 |
+
|
| 29 |
+
Motion modeling. Motion cues play a crucial role in video understanding fields, such as action recognition [1, 4, 6, 43, 60, 63, 64], action detection [10, 68, 77, 82], human video generation [39, 41, 67], etc. Pioneering works [1, 6, 39, 43, 63, 67] usually leverage hand-crafted dense optical flow [76] to embed motion information or design various temporal structures to encode long-range temporal representations. Due to the high computational demands of optical flow extraction, several attempts in compressed video recognition [7, 52, 69, 78] have begun to utilize more efficient motion vectors as an alternative to represent motions and have shown promising performance. In contrast to these works, we delve into the role of motions in video synthesis and demonstrate that motion vectors can enhance temporal controllability through a well-designed architecture.
|
| 30 |
+
|
| 31 |
+
# 3 VideoComposer
|
| 32 |
+
|
| 33 |
+
In this section, we will comprehensively present VideoComposer to showcase how it can enhance the controllability of video synthesis and enable the creation of highly customized videos. Firstly, we in brief introduce Video Latent Diffusion Models (VLDMs) upon which VideoComposer is designed, given their impressive success in various generative tasks. Subsequently, we delve into the details of
|
| 34 |
+
|
| 35 |
+

|
| 36 |
+
Figure 2: Overall architecture of VideoComposer. First, a video is decomposed into three types of conditions, including textual condition, spatial conditions and temporal conditions. Then, we feed these conditions into the unified STC-encoder or the CLIP model to embed control signals. Finally, the resulting conditions are leveraged to jointly guide VLDMs for denoising.
|
| 37 |
+
|
| 38 |
+
VideoComposer’s architecture, including the composable conditions and unified Spatio-Temporal Condition encoder (STC-encoder) as illustrated in Fig. 2. Finally, the concrete implementations, including the training and inference processes, will be analyzed.
|
| 39 |
+
|
| 40 |
+
# 3.1 Preliminaries
|
| 41 |
+
|
| 42 |
+
Compared to images, processing video requires substantial computational resources. Intuitively, adapting image diffusion models that process in the pixel space [40, 46] to the video domain impedes the scaling of VideoComposer to web-scale data. Consequently, we adopt a variant of LDMs that operate in the latent space, where local fidelity could be maintained to preserve the visual manifold.
|
| 43 |
+
|
| 44 |
+
Perceptual video compression. To efficiently process video data, we follow LDMs by introducing a pre-trained encoder [15] to project a given video $\pmb { x } \in \mathbb { R } ^ { F \times H \times W \times 3 }$ into a latent representation $\begin{array} { r } { z \ = \ \mathcal { E } ( \pmb { x } ) } \end{array}$ , where $\boldsymbol { z } ~ \in ~ \mathbb { R } ^ { F \times \mathbf { \bar { h } } \times \mathbf { \bar { w } } \times \boldsymbol { c } }$ . Subsequently, a decoder $\mathcal { D }$ is adopted to map the latent representations back to the pixel space $\bar { \pmb x } = \mathcal { D } ( \pmb z )$ . We set $H / h = W / w = \bar { 8 }$ for rapid processing.
|
| 45 |
+
|
| 46 |
+
Diffusion models in the latent space. To learn the actual video distribution $\mathbb { P } ( x )$ , diffusion models [23, 54] learn to denoise a normally-distributed noise, aiming to recover realistic visual content. This process simulates the reverse process of a Markov Chain of length $T$ . $T$ is set to 1000 by default. To perform the reverse process on the latent, it injects noise to $_ { z }$ to obtain a noise-corrupted latent ${ \boldsymbol { z } } _ { t }$ following [48]. Subsequently, we apply a denoising function $\epsilon _ { \theta } ( \cdot , \cdot , t )$ on ${ \boldsymbol { z } } _ { t }$ and selected conditions $^ c$ , where $t \in \{ 1 , . . . , T \}$ . The optimized objective can be formulated as:
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
\mathcal { L } _ { V L D M } = \mathbb { E } _ { \mathcal { E } ( x ) , \epsilon \in \mathcal { N } ( 0 , 1 ) , c , t } \left[ \| \epsilon - \epsilon _ { \theta } ( z _ { t } , c , t ) \| _ { 2 } ^ { 2 } \right]
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
To exploit the inductive bias of locality and temporal inductive bias of sequentiality during denoising, we instantiate $\epsilon _ { \theta } ( \cdot , \cdot , t )$ as a 3D UNet augmented with temporal convolution and cross-attention mechanism following [25, 49, 62].
|
| 53 |
+
|
| 54 |
+
# 3.2 VideoComposer
|
| 55 |
+
|
| 56 |
+
Videos as composable conditions. We decompose videos into three distinct types of conditions, i.e., textual conditions, spatial conditions and crucially temporal conditions, which can jointly determine the spatial and temporal patterns in videos. Notably, VideoComposer is a generic compositional framework. Therefore, more customized conditions can be incorporated into VideoComposer depending on the downstream application and are not limited to the decompositions listed above.
|
| 57 |
+
|
| 58 |
+
Textual condition. Textual descriptions provide an intuitive indication of videos in terms of coarsegrained visual content and motions. In our implementation, we employ the widely used pre-trained text encoder from OpenCLIP ViT-H/14 to obtain semantic embeddings of text descriptions.
|
| 59 |
+
|
| 60 |
+
Spatial conditions. To achieve fine-grained spatial control and diverse stylization, we apply three spatial conditions to provide structural and stylistic guidance: i) Single image. Video is made up of consecutive images, and a single image usually reveals the content and structure of this video. We select the first frame of a given video as a spatial condition to perform image-to-video generation. ii) Single sketch. We extract sketch of the first video frame using PiDiNet [55] as the second spatial condition and encourage VideoComposer to synthesize temporal-consistent video according to the structure and texture within the single sketch. iii) Style. To further transfer the style from one image to the synthesized video, we choose the image embedding as the stylistic guidance, following [3, 28]. We apply a pre-trained image encoder from OpenCLIP ViT-H/14 to extract the stylistic representation.
|
| 61 |
+
|
| 62 |
+
Temporal conditions. To accomplish finer control along the temporal dimension, we introduce four temporal conditions: i) Motion vector. Motion vector as a videospecific element is represented as two-dimension vectors, i.e., horizontal and vertical orientations. It explicitly encodes the pixel-wise movements between two adjacent frames, as visualized by red arrows in Fig. 3. Due to the natural properties of motion vector, we treat this condition as a motion control signal for temporal-smooth synthesis. Following [52, 69], we extract motion vectors in standard
|
| 63 |
+
|
| 64 |
+

|
| 65 |
+
Figure 3: Examples of motion vectors.
|
| 66 |
+
|
| 67 |
+
MPEG-4 format from compressed videos. ii) Depth sequence. To introduce depth information, we utilize the pre-trained model from [47] to extract depth maps of video frames. iii) Mask sequence. To facilitate video regional editing and inpainting, we manually add masks. We introduce tube masks [17, 57] to mask out videos and enforce the model to predict the masked regions based on observable information. iv) Sketch sequence. Compared with the single sketch, sketch sequence can provide more control details and thus achieve precisely customized synthesis.
|
| 68 |
+
|
| 69 |
+
STC-encoder. Sequential conditions contain rich and complex space-time dependencies, posing challenges for controllable guidance. In order to enhance the temporal awareness of input conditions, we design a Spatio-Temporal Condition encoder (STC-encoder) to incorporate the space-time relations, as shown in Fig. 2. Specifically, a light-weight spatial architecture consisting of two 2D convolutions and an average pooling layer is first applied to the input sequences, aiming to extract local spatial information. Subsequently, the resulting condition sequence is fed into a temporal Transformer layer [61] for temporal modeling. In this way, STC-encoder facilitates the explicit embedding of temporal cues, allowing for a unified condition interface for diverse inputs, thereby enhancing inter-frame consistency. It is worth noting that we repeat the spatial conditions of a single image and single sketch along the temporal dimension to ensure their consistency with temporal conditions, hence facilitating the condition fusion process.
|
| 70 |
+
|
| 71 |
+
After processing the conditions by STC-encoder, the final condition sequences are all in an identical spatial shape to ${ \boldsymbol { z } } _ { t }$ and then fused by element-wise addition. Finally, we concatenate the merged condition sequence with $z _ { t }$ along the channel dimension as control signals. For textual and stylistic conditions organized as a sequence of embeddings, we utilize the cross-attention mechanism to inject textual and stylistic guidance.
|
| 72 |
+
|
| 73 |
+
# 3.3 Training and inference
|
| 74 |
+
|
| 75 |
+
Two-stage training strategy. Although VideoComposer can initialize with the pre-training of LDMs [48], which mitigates the training difficulty to some extent, the model still struggles in learning to simultaneously handle temporal dynamics and synthesize video content from multiple compositions. To address this issue, we leverage a two-stage training strategy to optimize VideoComposer. Specifically, the first stage targets pre-training the model to specialize in temporal modeling through text-to-video generation. In the second stage, we optimize VideoComposer to excel in video synthesis controlled by the diverse conditions through compositional training.
|
| 76 |
+
|
| 77 |
+
Inference. During inference, DDIM [80] is employed to enhance the sample quality and improve inference efficiency. We incorporate classifier-free guidance [22] to ensure that the generative results adhere to specified conditions. The generative process can be formalized as:
|
| 78 |
+
|
| 79 |
+

|
| 80 |
+
Figure 4: Compositional image-to-video generation. We showcase six examples, each displaying two generated videos. The upper video is generated using a given single frame as the spatial condition and a textual condition describing the scene. The lower video is generated by incorporating an additional sequence of temporal conditions to facilitate finer control over the temporally evolving structure.
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
\hat { \epsilon } _ { \theta } ( z _ { t } , c , t ) = \epsilon _ { \theta } ( z _ { t } , c _ { 1 } , t ) + \omega ( \epsilon _ { \theta } ( z _ { t } , c _ { 2 } , t ) - \epsilon _ { \theta } ( z _ { t } , c _ { 1 } , t ) )
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
where $\omega$ is the guidance scale; $c _ { 1 }$ and $c _ { 2 }$ are two sets of conditions. This guidance mechanism extrapolates between two condition sets, placing emphasis on the elements in $\left( c _ { 2 } \ \backslash \ c _ { 1 } \right)$ and empowering flexible application. For instance, in text-driven video inpainting, $c _ { 2 }$ represents the expected caption and a masked video, while $c _ { 1 }$ is an empty caption and the same masked video.
|
| 87 |
+
|
| 88 |
+
# 4 Experiments
|
| 89 |
+
|
| 90 |
+
# 4.1 Experimental setup
|
| 91 |
+
|
| 92 |
+
Datasets. To optimize VideoComposer, we leverage two widely recognized and publicly accessible datasets: WebVid10M [2] and LAION-400M [51]. WebVid10M [2] is a large-scale benchmark scrapped from the web that contains 10.3M video-caption pairs. LAION-400M [51] is an imagecaption paired dataset, filtered using CLIP [44].
|
| 93 |
+
|
| 94 |
+
Evaluation metrics. We utilize two metrics to evaluate VideoComposer: i) To evaluate video continuity, we follow Gen-1 [16] to compute the average CLIP cosine similarity of two consecutive frames, serving as a frame consistency metric; ii) To evaluate motion controllability, we adopt end-point-error [56, 73] as a motion control metric, which measures the Euclidean distance between the predicted and the ground truth optical flow for each pixel.
|
| 95 |
+
|
| 96 |
+
# 4.2 Composable video generation with versatile conditions
|
| 97 |
+
|
| 98 |
+
In this section, we demonstrate the ability of VideoComposer to tackle various tasks in a controllable and versatile manner, leveraging its inherent compositionality. It’s important to note that the conditions employed in these examples are customizable to specific requirements. We also provide additional results in the supplementary material for further reference.
|
| 99 |
+
|
| 100 |
+

|
| 101 |
+
Figure 5: Compositional video inpainting. By manually adding masks to videos, VideoComposer can perform video inpainting, facilitating the restoration of the corrupted parts according to textual instructions. Furthermore, by incorporating temporal conditions specifying the visual structure, VideoComposer can perform customized inpainting that conforms to the prescribed structure.
|
| 102 |
+
|
| 103 |
+
Compositional Image-to-video generation. Compositional training with a single image endows VideoComposer with the ability of animating static images. In Fig. 4, we present six examples to demonstrate this ability. VideoComposer is capable of synthesizing videos conformed to texts and the initial frame. To further obtain enhanced control over the structure, we can incorporate additional temporal conditions. We observe resultant videos consistently adhere to the given conditions.
|
| 104 |
+
|
| 105 |
+
Compositional video inpainting. Jointly training with masked video endows the model with the ability of filling the masked regions with prescribed content, as shown in Fig. 5. VideoComposer can replenish the mask-corrupted regions based on textual descriptions. By further incorporating temporal conditions, i.e, depth maps and sketches, we obtain more advanced control over the structure.
|
| 106 |
+
|
| 107 |
+
Compositional sketch-to-video generation. Compositional training with single sketch empowers VideoComposer with the ability of animating static sketches, as illustrated in Fig. 6. We observe that VideoComposer synthesizes videos conforming to texts and the initial sketch. Furthermore, we observe that the inclusion of mask and style guidance can facilitate structure and style control.
|
| 108 |
+
|
| 109 |
+
# 4.3 Comparative experimental results
|
| 110 |
+
|
| 111 |
+
Depth-to-video controllability comparison. In Fig. 7, we compare our VideoComposer with Text2Video-Zero [30] and existing state-of-the-art Gen-1 [16]. We observed that Text2Video-Zero suffers from appearance inconsistency and structural flickering due to the lack of temporal awareness. Meanwhile, Gen-1 produces a video with color inconsistency and structure misalignment (revealed by the orientation of the bird head). The video generated by VideoComposer is faithful to the structure of the input depth sequence and maintains a continuous appearance. This shows the superiority of our VideoComposer in terms of controllability.
|
| 112 |
+
|
| 113 |
+
Text-to-video generation performance. Although VideoComposer is not specifically tailored for text-to-video generation, its versatility allows VideoComposer to perform the traditional text-to-video generation task effectively. In Tab. 1, we follow the evaluation settings in Video LDM [5] to adopt
|
| 114 |
+
|
| 115 |
+

|
| 116 |
+
Figure 6: Compositional sketch-to-video generation. In the first example, the upper video is generated using text and a single sketch as the conditions, while the lower is generated by using an additional mask sequence for finer control over the temporal patterns. For the last two examples, the upper video is generated using a single sketch and a textual condition, while the lower is generated with an additional style from a specified image.
|
| 117 |
+
|
| 118 |
+
Table 1: Text-to-video generation performance on MSR-VTT.
|
| 119 |
+
|
| 120 |
+
<table><tr><td>Method</td><td>Zero-shot</td><td>FVD↓</td><td>CLIPSIM↑</td></tr><tr><td>GODIVA [70] Niwa [71] CogVideo (Chinese) [26]</td><td>No No Yes</td><td></td><td>0.2402 0.2439</td></tr><tr><td>CogVideo (English) [26] MagicVideo [83] Make-A-Video [53]</td><td>Yes Yes Yes</td><td>= 1294 1290</td><td>0.2614 0.2631 0.3049</td></tr><tr><td>Video LDM [5] Text-to-video pre-training (First stage) VideoComposer</td><td>Yes Yes Yes</td><td>- 1 803 580</td><td>0.2929 0.2876 0.2932</td></tr></table>
|
| 121 |
+
|
| 122 |
+
Fréchet Video Distance (FVD) and CLIP Similarity (CLIPSIM) as evaluation metrics and present the quantitative results of text-to-video generation on MSR-VTT dataset compared to other existing methods. The results in the table demonstrate that VideoComposer achieves competitive performance compared to state-of-the-art text-to-video approaches. In addition, VideoComposer outperforms our first-stage text-to-video pre-training, demonstrating that VideoComposer can achieve compositional generation without sacrificing its capability of text-to-video generation. In the future, we aim to advance VideoComposer by leveraging stronger text-to-video models for more powerful synthesis.
|
| 123 |
+
|
| 124 |
+
# 4.4 Experimental results of motion control
|
| 125 |
+
|
| 126 |
+
Quantitative evaluation. To validate superior motion controllability, we utilize the motion control metric. We randomly select 1000 caption-video pairs and synthesize corresponding videos. The results are presented in Tab. 2. We observe that the inclusion of motion vectors as a condition reduce the motion control error, indicating an enhancement of motion controllability. The incorporation of STC-encoder further advances the motion controllability.
|
| 127 |
+
|
| 128 |
+

|
| 129 |
+
Figure 7: Comparison with methods for controllable video generation. Results are generated utilizing the textual condition and the depth sequence in the first row. Text2Video-Zero suffers from appearance inconsistency and structural flickering due to the lack of temporal awareness. Gen-1 produces a video with color inconsistency and structural misalignment. The video generated by VideoComposer is faithful to the structure of the input depth sequence and maintains a continuous appearance.
|
| 130 |
+
|
| 131 |
+
“American Staffordshire Terrier is lying on the floor in an abandoned building”
|
| 132 |
+
|
| 133 |
+

|
| 134 |
+
Figure 8: Video-to-video translation. We extract a sequence of depth maps, sketches or motion vectors from the source video, along with textual descriptions, to perform the translation. By utilizing motion vectors, we achieve static-background removal.
|
| 135 |
+
|
| 136 |
+
“Barn Swallow nesting at a bird box”
|
| 137 |
+
Table 2: Evaluating the motion controllability. “Text" and “MV" represent the utilization of text and motion vectors as conditions for generation.
|
| 138 |
+
|
| 139 |
+
<table><tr><td>Method</td><td>Text</td><td>MV</td><td>Motion control ↓</td></tr><tr><td>w/o STC-encoder</td><td>>></td><td></td><td>4.03</td></tr><tr><td>w/o STC-encoder</td><td></td><td>√</td><td>2.67</td></tr><tr><td>VideoComposer</td><td></td><td></td><td>2.18</td></tr></table>
|
| 140 |
+
|
| 141 |
+
Motion vectors prioritizing moving visual cues. Thanks to the nature of motion vectors, which encode inter-frame variation, static regions within an image are inherently omitted. This prioritization of moving regions facilitates motion control during synthesis. In Fig. 8, we present results of videoto-video translation to substantiate such superiority. We observe that motion vectors exclude the static background, i.e., human legs, a feat that other temporal conditions such as depth maps and sketches cannot accomplish. This advantage lays the foundation for a broader range of applications.
|
| 142 |
+
|
| 143 |
+
Versatile motion control with motion vectors. Motion vectors, easily derived from hand-crafted strokes, enable more versatile motion control. In Fig. 9, we present visualization comparing CogVideo [26] and VideoComposer. While CogVideo is limited to insufficient text-guided motion control, VideoComposer expands this functionality by additionally leveraging motion vectors derived from hand-crafted strokes to facilitate more flexible and precise motion control.
|
| 144 |
+
|
| 145 |
+
# 4.5 Ablation study
|
| 146 |
+
|
| 147 |
+
In this subsection, we conduct qualitative and quantitative analysis on VideoComposer, aiming to demonstrate the effectiveness of incorporating STC-encoder.
|
| 148 |
+
|
| 149 |
+
Quantitative analysis. In Tab. 3, we present the frame consistency metric computed on 1000 test videos. We observe that incorporating STC-encoder augments the frame consistency, which we attribute to its temporal modeling capacity. This observation holds for various temporal conditions such as sketches, depth maps and motion vectors.
|
| 150 |
+
|
| 151 |
+

|
| 152 |
+
Figure 9: Versatile motion control using hand-crafted motions. (a) Limited motion control using CogVideo [26]. (b) Fine-grained and flexible motion control, empowered by VideoComposer.
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
Figure 10: Qualitative ablation study. We present three representative examples. The last two rows of videos display generated videos conditioned on a textual condition and one additional temporal condition (i.e., sketches, depth maps or motion vectors). Regions exhibiting deficiencies or fidelity are emphasized within red boxes.
|
| 156 |
+
|
| 157 |
+
Qualitative analysis. In Fig. 10, we exemplify the usefulness of STC-encoder. We observe that in the first example, videos generated by VideoComposer without STCencoder generally adhere to the sketches but omit certain detailed information, such as several round-shaped ingredients. For the left two examples, VideoComposer without STCencoder generates videos that are structurally inconsistent with conditions. We can also spot the noticeable defects in terms of human faces and poses. Thus, all the above examples can validate the effectiveness of STC-encoder.
|
| 158 |
+
|
| 159 |
+
Table 3: Quantitative ablation study of STC-encoder. “Conditions" denotes the conditions utilized for generation.
|
| 160 |
+
|
| 161 |
+
<table><tr><td>Method</td><td>Conditions</td><td>Frame consistency ↑</td></tr><tr><td>w/o STC-encoder</td><td>Text and sketch sequence</td><td>0.910</td></tr><tr><td>VideoComposer w/o STC-encoder</td><td>Text and</td><td>0.923 0.922</td></tr><tr><td>VideoComposer</td><td>depth sequence</td><td>0.928</td></tr><tr><td>w/o STC-encoder</td><td>Text and</td><td>0.915</td></tr><tr><td>VideoComposer</td><td>motion vectors</td><td>0.927</td></tr></table>
|
| 162 |
+
|
| 163 |
+
# 5 Conclusion
|
| 164 |
+
|
| 165 |
+
In this paper, we present VideoComposer, which aims to explore the compositionality within the realm of video synthesis, striving to obtain a flexible and controllable synthesis system. In particular, we explore the use of temporal conditions for videos, specifically motion vectors, as powerful control signals to provide guidance in terms of temporal dynamics. An STC-encoder is further designed as a unified interface to aggregate the spatial and temporal dependencies of the sequential inputs for inter-frame consistency. Our experiments, which involve the combination of various conditions to augment controllability, underscore the pivotal role of our design choices and reveal the impressive creativity of the proposed VideoComposer.
|
| 166 |
+
|
| 167 |
+
References
|
| 168 |
+
[1] Anurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun, Mario Luciˇ c, and Cordelia Schmid. Vivit: A ´ video vision transformer. In ICCV, pages 6836–6846, 2021.
|
| 169 |
+
[2] Max Bain, Arsha Nagrani, Gül Varol, and Andrew Zisserman. Frozen in time: A joint video and image encoder for end-to-end retrieval. In ICCV, pages 1728–1738, 2021.
|
| 170 |
+
[3] 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.
|
| 171 |
+
[4] Gedas Bertasius, Heng Wang, and Lorenzo Torresani. Is space-time attention all you need for video understanding? In ICML, volume 2, page 4, 2021.
|
| 172 |
+
[5] Andreas Blattmann, Robin Rombach, Huan Ling, Tim Dockhorn, Seung Wook Kim, Sanja Fidler, and Karsten Kreis. Align your latents: High-resolution video synthesis with latent diffusion models. In CVPR, pages 22563–22575, 2023.
|
| 173 |
+
[6] Joao Carreira and Andrew Zisserman. Quo vadis, action recognition? a new model and the kinetics dataset. In CVPR, pages 6299–6308, 2017.
|
| 174 |
+
[7] Jiawei Chen and Chiu Man Ho. Mm-vit: Multi-modal video transformer for compressed video action recognition. In WACV, pages 1910–1921, 2022.
|
| 175 |
+
[8] Tsai-Shien Chen, Chieh Hubert Lin, Hung-Yu Tseng, Tsung-Yi Lin, and Ming-Hsuan Yang. Motionconditioned diffusion model for controllable video synthesis. arXiv preprint arXiv:2304.14404, 2023.
|
| 176 |
+
[9] Xi Chen, Lianghua Huang, Yu Liu, Yujun Shen, Deli Zhao, and Hengshuang Zhao. Anydoor: Zero-shot object-level image customization. arXiv preprint arXiv:2307.09481, 2023.
|
| 177 |
+
[10] Feng Cheng and Gedas Bertasius. Tallformer: Temporal action localization with a long-memory transformer. In ECCV, pages 503–521, 2022.
|
| 178 |
+
[11] Guillaume Couairon, Jakob Verbeek, Holger Schwenk, and Matthieu Cord. Diffedit: Diffusion-based semantic image editing with mask guidance. arXiv preprint arXiv:2210.11427, 2022.
|
| 179 |
+
[12] Tri Dao, Dan Fu, Stefano Ermon, Atri Rudra, and Christopher Ré. Flashattention: Fast and memoryefficient exact attention with io-awareness. NeurIPS, pages 16344–16359, 2022.
|
| 180 |
+
[13] Emily Denton and Rob Fergus. Stochastic video generation with a learned prior. In ICML, pages 1174–1183. PMLR, 2018.
|
| 181 |
+
[14] Laurent Dinh, David Krueger, and Yoshua Bengio. Nice: Non-linear independent components estimation. arXiv preprint arXiv:1410.8516, 2014.
|
| 182 |
+
[15] Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In CVPR, pages 12873–12883, 2021.
|
| 183 |
+
[16] Patrick Esser, Johnathan Chiu, Parmida Atighehchian, Jonathan Granskog, and Anastasis Germanidis. Structure and content-guided video synthesis with diffusion models. arXiv preprint arXiv:2302.03011, 2023.
|
| 184 |
+
[17] Christoph Feichtenhofer, Yanghao Li, Kaiming He, et al. Masked autoencoders as spatiotemporal learners. In NeurIPS, pages 35946–35958, 2022.
|
| 185 |
+
[18] Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks. Communications of the ACM, pages 139–144, 2020.
|
| 186 |
+
[19] Shaozhe Hao, Kai Han, Shihao Zhao, and Kwan-Yee K Wong. Vico: Detail-preserving visual condition for personalized text-to-image generation. arXiv preprint arXiv:2306.00971, 2023.
|
| 187 |
+
[20] William Harvey, Saeid Naderiparizi, Vaden Masrani, Christian Weilbach, and Frank Wood. Flexible diffusion modeling of long videos. arXiv preprint arXiv:2205.11495, 2022.
|
| 188 |
+
[21] Amir Hertz, Ron Mokady, Jay Tenenbaum, Kfir Aberman, Yael Pritch, and Daniel Cohen-Or. Prompt-toprompt image editing with cross attention control. arXiv preprint arXiv:2208.01626, 2022.
|
| 189 |
+
[22] Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598, 2022.
|
| 190 |
+
[23] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. NeurIPS, pages 6840–6851, 2020.
|
| 191 |
+
[24] 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.
|
| 192 |
+
[25] Jonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J Fleet. Video diffusion models. arXiv preprint arXiv:2204.03458, 2022.
|
| 193 |
+
[26] Wenyi Hong, Ming Ding, Wendi Zheng, Xinghan Liu, and Jie Tang. Cogvideo: Large-scale pretraining for text-to-video generation via transformers. arXiv preprint arXiv:2205.15868, 2022.
|
| 194 |
+
[27] Yaosi Hu, Zhenzhong Chen, and Chong Luo. Lamd: Latent motion diffusion for video generation. arXiv preprint arXiv:2304.11603, 2023.
|
| 195 |
+
[28] Lianghua Huang, Di Chen, Yu Liu, Yujun Shen, Deli Zhao, and Jingren Zhou. Composer: Creative and controllable image synthesis with composable conditions. arXiv preprint arXiv:2302.09778, 2023.
|
| 196 |
+
[29] Bahjat Kawar, Shiran Zada, Oran Lang, Omer Tov, Huiwen Chang, Tali Dekel, Inbar Mosseri, and Michal Irani. Imagic: Text-based real image editing with diffusion models. arXiv preprint arXiv:2210.09276, 2022.
|
| 197 |
+
[30] Levon Khachatryan, Andranik Movsisyan, Vahram Tadevosyan, Roberto Henschel, Zhangyang Wang, Shant Navasardyan, and Humphrey Shi. Text2video-zero: Text-to-image diffusion models are zero-shot video generators. arXiv preprint arXiv:2303.13439, 2023.
|
| 198 |
+
[31] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
|
| 199 |
+
[32] Pandeng Li, Chen-Wei Xie, Hongtao Xie, Liming Zhao, Lei Zhang, Yun Zheng, Deli Zhao, and Yongdong Zhang. Momentdiff: Generative video moment retrieval from random to real. In NeurIPS, 2023.
|
| 200 |
+
[33] Shaoteng Liu, Yuechen Zhang, Wenbo Li, Zhe Lin, and Jiaya Jia. Video-p2p: Video editing with crossattention control. arXiv preprint arXiv:2303.04761, 2023.
|
| 201 |
+
[34] Zhiheng Liu, Ruili Feng, Kai Zhu, Yifei Zhang, Kecheng Zheng, Yu Liu, Deli Zhao, Jingren Zhou, and Yang Cao. Cones: Concept neurons in diffusion models for customized generation. arXiv preprint arXiv:2303.05125, 2023.
|
| 202 |
+
[35] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
|
| 203 |
+
[36] Zhengxiong Luo, Dayou Chen, Yingya Zhang, Yan Huang, Liang Wang, Yujun Shen, Deli Zhao, Jingren Zhou, and Tieniu Tan. Videofusion: Decomposed diffusion models for high-quality video generation. In CVPR, 2023.
|
| 204 |
+
[37] Eyal Molad, Eliahu Horwitz, Dani Valevski, Alex Rav Acha, Yossi Matias, Yael Pritch, Yaniv Leviathan, and Yedid Hoshen. Dreamix: Video diffusion models are general video editors. arXiv preprint arXiv:2302.01329, 2023.
|
| 205 |
+
[38] Chong Mou, Xintao Wang, Liangbin Xie, Jian Zhang, Zhongang Qi, Ying Shan, and Xiaohu Qie. T2iadapter: Learning adapters to dig out more controllable ability for text-to-image diffusion models. arXiv preprint arXiv:2302.08453, 2023.
|
| 206 |
+
[39] Haomiao Ni, Changhao Shi, Kai Li, Sharon X Huang, and Martin Renqiang Min. Conditional image-tovideo generation with latent flow diffusion models. In CVPR, pages 18444–18455, 2023.
|
| 207 |
+
[40] 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.
|
| 208 |
+
[41] Katsunori Ohnishi, Shohei Yamamoto, Yoshitaka Ushiku, and Tatsuya Harada. Hierarchical video generation from orthogonal information: Optical flow and texture. In AAAI, volume 32, 2018.
|
| 209 |
+
[42] Gaurav Parmar, Krishna Kumar Singh, Richard Zhang, Yijun Li, Jingwan Lu, and Jun-Yan Zhu. Zero-shot image-to-image translation. arXiv preprint arXiv:2302.03027, 2023.
|
| 210 |
+
[43] Zhaofan Qiu, Ting Yao, and Tao Mei. Learning spatio-temporal representation with pseudo-3d residual networks. In ICCV, pages 5533–5541, 2017.
|
| 211 |
+
[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 ICML, pages 8748–8763, 2021.
|
| 212 |
+
[45] 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, pages 5485–5551, 2020.
|
| 213 |
+
[46] 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.
|
| 214 |
+
[47] 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, pages 1623–1637, 2020.
|
| 215 |
+
[48] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In CVPR, pages 10684–10695, 2022.
|
| 216 |
+
[49] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In MICCAI, pages 234–241, 2015.
|
| 217 |
+
[50] 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. NeurIPS, pages 36479–36494, 2022.
|
| 218 |
+
[51] Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion-400m: Open dataset of clip-filtered 400 million image-text pairs. arXiv preprint arXiv:2111.02114, 2021.
|
| 219 |
+
[52] Zheng Shou, Xudong Lin, Yannis Kalantidis, Laura Sevilla-Lara, Marcus Rohrbach, Shih-Fu Chang, and Zhicheng Yan. Dmc-net: Generating discriminative motion cues for fast compressed video action recognition. In CVPR, pages 1268–1277, 2019.
|
| 220 |
+
[53] 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.
|
| 221 |
+
[54] Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In ICCV, pages 2256–2265, 2015.
|
| 222 |
+
[55] Zhuo Su, Wenzhe Liu, Zitong Yu, Dewen Hu, Qing Liao, Qi Tian, Matti Pietikäinen, and Li Liu. Pixel difference networks for efficient edge detection. In ICCV, pages 5117–5127, 2021.
|
| 223 |
+
[56] Zachary Teed and Jia Deng. Raft: Recurrent all-pairs field transforms for optical flow. In ECCV, pages 402–419, 2020.
|
| 224 |
+
[57] Zhan Tong, Yibing Song, Jue Wang, and Limin Wang. Videomae: Masked autoencoders are data-efficient learners for self-supervised video pre-training. In NeurIPS, 2022.
|
| 225 |
+
[58] Sergey Tulyakov, Ming-Yu Liu, Xiaodong Yang, and Jan Kautz. Mocogan: Decomposing motion and content for video generation. In CVPR, pages 1526–1535, 2018.
|
| 226 |
+
[59] Arash Vahdat, Karsten Kreis, and Jan Kautz. Score-based generative modeling in latent space. NeurIPS, pages 11287–11302, 2021.
|
| 227 |
+
[60] Gül Varol, Ivan Laptev, and Cordelia Schmid. Long-term temporal convolutions for action recognition. IEEE transactions on pattern analysis and machine intelligence, pages 1510–1517, 2017.
|
| 228 |
+
[61] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. NeurIPS, 2017.
|
| 229 |
+
[62] Jiuniu Wang, Hangjie Yuan, Dayou Chen, Yingya Zhang, Xiang Wang, and Shiwei Zhang. Modelscope text-to-video technical report. arXiv preprint arXiv:2308.06571, 2023.
|
| 230 |
+
[63] Limin Wang, Yuanjun Xiong, Zhe Wang, Yu Qiao, Dahua Lin, Xiaoou Tang, and Luc Van Gool. Temporal segment networks: Towards good practices for deep action recognition. In ECCV, pages 20–36, 2016.
|
| 231 |
+
[64] Limin Wang, Zhan Tong, Bin Ji, and Gangshan Wu. Tdn: Temporal difference networks for efficient action recognition. In CVPR, pages 1895–1904, 2021.
|
| 232 |
+
[65] 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.
|
| 233 |
+
[66] Wen Wang, Kangyang Xie, Zide Liu, Hao Chen, Yue Cao, Xinlong Wang, and Chunhua Shen. Zero-shot video editing using off-the-shelf image diffusion models. arXiv preprint arXiv:2303.17599, 2023.
|
| 234 |
+
[67] Yaohui Wang, Piotr Bilinski, Francois Bremond, and Antitza Dantcheva. G3an: Disentangling appearance and motion for video generation. In CVPR, pages 5264–5273, 2020.
|
| 235 |
+
[68] Philippe Weinzaepfel, Zaid Harchaoui, and Cordelia Schmid. Learning to track for spatio-temporal action localization. In ICCV, pages 3164–3172, 2015.
|
| 236 |
+
[69] Chao-Yuan Wu, Manzil Zaheer, Hexiang Hu, R Manmatha, Alexander J Smola, and Philipp Krähenbühl. Compressed video action recognition. In CVPR, pages 6026–6035, 2018.
|
| 237 |
+
[70] 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.
|
| 238 |
+
[71] Chenfei Wu, Jian Liang, Lei Ji, Fan Yang, Yuejian Fang, Daxin Jiang, and Nan Duan. Nüwa: Visual synthesis pre-training for neural visual world creation. In ECCV, pages 720–736. Springer, 2022.
|
| 239 |
+
[72] Shaoan Xie, Zhifei Zhang, Zhe Lin, Tobias Hinz, and Kun Zhang. Smartbrush: Text and shape guided object inpainting with diffusion model. arXiv preprint arXiv:2212.05034, 2022.
|
| 240 |
+
[73] Haofei Xu, Jing Zhang, Jianfei Cai, Hamid Rezatofighi, and Dacheng Tao. Gmflow: Learning optical flow via global matching. In CVPR, pages 8121–8130, 2022.
|
| 241 |
+
[74] Zeyue Xue, Guanglu Song, Qiushan Guo, Boxiao Liu, Zhuofan Zong, Yu Liu, and Ping Luo. Raphael: Text-to-image generation via large mixture of diffusion paths. arXiv preprint arXiv:2305.18295, 2023.
|
| 242 |
+
[75] Ruihan Yang, Prakhar Srivastava, and Stephan Mandt. Diffusion probabilistic modeling for video generation. arXiv preprint arXiv:2203.09481, 2022.
|
| 243 |
+
[76] Christopher Zach, Thomas Pock, and Horst Bischof. A duality based approach for realtime tv-l 1 optical flow. In Pattern Recognition, pages 214–223, 2007.
|
| 244 |
+
[77] Runhao Zeng, Wenbing Huang, Mingkui Tan, Yu Rong, Peilin Zhao, Junzhou Huang, and Chuang Gan. Graph convolutional networks for temporal action localization. In ICCV, pages 7094–7103, 2019.
|
| 245 |
+
[78] Bowen Zhang, Limin Wang, Zhe Wang, Yu Qiao, and Hanli Wang. Real-time action recognition with enhanced motion vector cnns. In CVPR, pages 2718–2726, 2016.
|
| 246 |
+
[79] Lvmin Zhang and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models. arXiv preprint arXiv:2302.05543, 2023.
|
| 247 |
+
[80] Qinsheng Zhang, Molei Tao, and Yongxin Chen. gddim: Generalized denoising diffusion implicit models. arXiv preprint arXiv:2206.05564, 2022.
|
| 248 |
+
[81] Shihao Zhao, Dongdong Chen, Yen-Chun Chen, Jianmin Bao, Shaozhe Hao, Lu Yuan, and Kwan-Yee K Wong. Uni-controlnet: All-in-one control to text-to-image diffusion models. In NeurIPS, 2023.
|
| 249 |
+
[82] Yue Zhao, Yuanjun Xiong, Limin Wang, Zhirong Wu, Xiaoou Tang, and Dahua Lin. Temporal action detection with structured segment networks. In ICCV, pages 2914–2923, 2017.
|
| 250 |
+
[83] Daquan Zhou, Weimin Wang, Hanshu Yan, Weiwei Lv, Yizhe Zhu, and Jiashi Feng. Magicvideo: Efficient video generation with latent diffusion models. arXiv preprint arXiv:2211.11018, 2022.
|
| 251 |
+
|
| 252 |
+

|
| 253 |
+
Figure A11: Compositional sketch sequence-to-video generation. We showcase five examples, each displaying a video generated from a sequence of sketches and a textual description. The final example additionally incorporates a style condition.
|
| 254 |
+
|
| 255 |
+
# Appendix
|
| 256 |
+
|
| 257 |
+
In this Appendix, we first elaborate on more implementation details (Appendix A) and present more experimental results (Appendix B). Next, we provide a section of discussion (Appendix C) on the limitations and potential societal impact of VideoComposer.
|
| 258 |
+
|
| 259 |
+
# A More implementation details
|
| 260 |
+
|
| 261 |
+
Pre-training details. We adopt AdamW [35] as the default optimizer with a learning rate set to $5 \times 1 0 ^ { - 5 }$ . In total, VideoComposer is pre-trained for $4 0 0 \mathrm { k }$ steps, with the first and second stage being pre-trained for $1 3 2 \mathrm { k }$ steps and $2 6 8 \mathrm { k }$ steps, respectively. In terms of two-stage pre-training, we allocate one fourth of GPUs to perform image pre-training, while the rest of the GPUs are dedicated to video pre-training. We use center crop and randomly sample video frames to compose the video input whose $F = 1 6$ , $H = 2 5 6$ and $W = 2 5 6$ . During the second stage pre-training, we adhere to [28], using a probability of 0.1 to keep all conditions, a probability of 0.1 to discard all conditions, and an independent probability of 0.5 to keep or discard a specific condition. Regarding the use of
|
| 262 |
+
|
| 263 |
+
WebVid10M [2], we sample frames from videos using various strides to ensure frame rate equal to 4, aiming to maintain a consistent frame rate. We train VideoComposer jointly on video-text and image-text pairs by treating images as ‘one-frame’ videos. When using image-text pairs for training, the shape of the input noise is $1 \times h \times w \times c$ , where the temporal length is 1 (i.e., $F = 1$ ). In experiments, we use separate STC-encoders for different conditions without weight sharing. In our ablation study of STC-encoder, the baseline method $( w / o$ STC-encoder) entails removing the temporal Transformer in STC-encoder while retaining the spatial convolution, designed to verify the effectiveness of incorporating temporal modeling. The spatial convolution remains in place to ensure the dimensions of all input conditions are consistent.
|
| 264 |
+
|
| 265 |
+
The structure of 3D UNet as $\epsilon _ { \theta } ( \cdot , \cdot , t )$ . To leverage the benefits of LDMs pre-trained on web-scale image data, i.e., Stable Diffusion2, we extend the 2D UNet to a 3D UNet by introducing temporal modeling layers. Specifically, within a single UNet block, we employ four essential building blocks: spatial convolution, temporal convolution, spatial transformer and temporal transformer. The spatial blocks are inherited from LDMs, while temporal processing blocks are newly introduced. Regarding temporal convolution, we stack four convolutions with $1 \times 1 \times 3$ kernel, ensuring the temporal receptive field is ample for capturing temporal dependencies; regarding temporal transformer, we stack one Transformer layer and accelerate its inference using flash attention [12].
|
| 266 |
+
|
| 267 |
+
More details about two-stage training strategy. The two-stage training strategy utilized in VideoComposer is designed to methodologically address the learning challenge. In the first stage, VideoComposer focuses on learning the temporal dynamics by only leveraging the textual condition. This foundation allows for a focused understanding of temporal relationships within the video content. In the second stage, VideoComposer builds on the temporal modeling ability acquired from the first stage to perform compositional training. In this stage, it extends its learning by utilizing all three kinds of conditions: textual, spatial, and temporal conditions. The major difference between the two stages lies in this incorporation of additional conditions, leading to a comprehensive learning of synthesizing video content from multiple compositions.
|
| 268 |
+
|
| 269 |
+
# B More experimental results
|
| 270 |
+
|
| 271 |
+
In this subsection, we aim to provide additional experiments that complement the findings presented in the main paper and showcase more versatile controlling cases.
|
| 272 |
+
|
| 273 |
+
Compositional sketch sequence-to-video generation. Compositional training with sketch sequences enables VideoComposer to possess the ability of generation videos adhering to sketch sequences. This generation paradigm lays more emphasis on the structure control, which differs from compositional sketch-to-video generation and can be viewed as video-to-video translation. In Fig. A11, we exemplify this capacity. We observe videos’ fidelity to the provided conditions, including texts, sketches and style.
|
| 274 |
+
|
| 275 |
+
Compositional depth sequence-to-video generation. Conducting compositional training with depth sequences allows VideoComposer to effectively generate videos in accordance with depth sequences. In Fig. A12, we illustrate this capability. Videos generated with VideoComposer faithfully adhere to the given conditions, including text prompts, depth maps, and style.
|
| 276 |
+
|
| 277 |
+
Motion transfer. Incorporating motion vectors as a composition of videos enables motion transferability. In Fig. A13, we conduct experiments to demonstrate such capability. Through utilizing hand-crafted motion vectors or motion vectors extracted from off-the-shelf source videos, we can transfer the motion patterns to synthesized videos.
|
| 278 |
+
|
| 279 |
+
# C Discussion
|
| 280 |
+
|
| 281 |
+
Limitations. Due to the absence of a publicly available large-scale and high-quality dataset, we have developed VideoComposer using the watermarked WebVid10M dataset. As a result, the synthesized videos contain watermarks, which affect the generation quality and lead to less visually appealing results. Furthermore, in order to reduce the training cost, the resolution of the generated videos is limited to $2 5 6 \times 2 5 6$ . Consequently, some delicate details might not be sufficiently clear. In the future, we plan to utilize super-resolution models to expand the resolution of the generated videos to improve the visual quality.
|
| 282 |
+
|
| 283 |
+

|
| 284 |
+
Figure A12: Compositional depth sequence-to-video generation. We showcase five examples, each displaying a video generated from a sequence of depth maps and a textual description. The final example additionally incorporates a style condition.
|
| 285 |
+
|
| 286 |
+
Potential societal impact. VideoComposer, as a generic video synthesis technology, possesses the potential to revolutionize the content creation industry, offering unprecedented flexibility and creativity, and hence, promising significant commercial advantages. Traditional content creation processes are labor- and cost-intensive. VideoComposer could alleviate these burdens by enabling designers to manipulate subjects, styles, and scenes through instructions spanning human-written text, and styles and subjects sourced from other images. Moreover, VideoComposer could potentially revolutionize education industry by creating unique and customized video scenarios for teaching complex concepts.
|
| 287 |
+
|
| 288 |
+
However, it’s necessary to note that VideoComposer also represents a dual-use technology with inherent risks to society. As with prior generative foundation models, such as Imagen Video [24] and Make-A-Video [53], VideoComposer inherits the implicit knowledge embedded within the pre-trained model (i.e., StableDiffusion) and the pre-trained dataset (i.e., WebVid and LAION). Potential issues include but not limited to the propagation of social biases (such as gender and racial bias) and the creation of offensive content.
|
| 289 |
+
|
| 290 |
+

|
| 291 |
+
Figure A13: Motion transfer. We showcase four examples, each displaying a video generated from a single image and motions. In the first three examples, we transfer the motion patterns in a source video to the generated video by extracting and utilizing motion vectors. The final example incorporates hand-crafted motions instead.
|
| 292 |
+
|
| 293 |
+
Given that VideoComposer is a research-oriented project aimed at investigating compositionality in diffusion-based video synthesis, our primary focus lies in scientific exploration and proof of concept. If VideoComposer is deployed beyond the scope of research, we strongly recommend several precautionary measures to ensure its responsible and ethical use: (i) Rigorous evaluation and oversight of the deployment context should be conducted; (ii) Necessary filtering of prompts and generated content should be implemented to prevent misuse.
|
md/dev/hX5Ia-ION8Y/hX5Ia-ION8Y.md
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MCVD: Masked Conditional Video Diffusion for Prediction, Generation, and Interpolation
|
| 2 |
+
|
| 3 |
+
Vikram Voleti∗ Mila, University of Montreal Canada vikram.voleti@umontreal.ca
|
| 4 |
+
|
| 5 |
+
Alexia Jolicoeur-Martineau\* Mila, University of Montreal Canada alexia.jolicoeur-martineau@mail.mcgill.ca
|
| 6 |
+
|
| 7 |
+
Christopher Pal Mila, Polytechnique Montreal Canada CIFAR AI Chair ServiceNow Research
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
Video prediction is a challenging task. The quality of video frames from current state-of-the-art (SOTA) generative models tends to be poor and generalization beyond the training data is difficult. Furthermore, existing prediction frameworks are typically not capable of simultaneously handling other video-related tasks such as unconditional generation or interpolation. In this work, we devise a generalpurpose framework called Masked Conditional Video Diffusion (MCVD) for all of these video synthesis tasks using a probabilistic conditional score-based denoising diffusion model, conditioned on past and/or future frames. We train the model in a manner where we randomly and independently mask all the past frames or all the future frames. This novel but straightforward setup allows us to train a single model that is capable of executing a broad range of video tasks, specifically: future/past prediction – when only future/past frames are masked; unconditional generation – when both past and future frames are masked; and interpolation – when neither past nor future frames are masked. Our experiments show that this approach can generate high-quality frames for diverse types of videos. Our MCVD models are built from simple non-recurrent 2D-convolutional architectures, conditioning on blocks of frames and generating blocks of frames. We generate videos of arbitrary lengths autoregressively in a block-wise manner. Our approach yields SOTA results across standard video prediction and interpolation benchmarks, with computation times for training models measured in 1-12 days using $\leq 4$ GPUs.
|
| 12 |
+
|
| 13 |
+
Project page: https://mask-cond-video-diffusion.github.io Code: https://mask-cond-video-diffusion.github.io/
|
| 14 |
+
|
| 15 |
+
# 1 Introduction
|
| 16 |
+
|
| 17 |
+
Predicting what one may visually perceive in the future is closely linked to the dynamics of objects and people. As such, this kind of prediction relates to many crucial human decision-making tasks ranging from making dinner to driving a car. If video models could generate full-fledged videos in pixel-level detail with plausible futures, agents could use them to make better decisions, especially safety-critical ones. Consider, for example, the task of driving a car in a tight situation at high speed. Having an accurate model of the future could mean the difference between damaging a car or something worse. We can obtain some intuitions about this scenario by examining the predictions of our model in Figure 1, where we condition on two frames and predict 28 frames into the future for a car driving around a corner. We can see that this is enough time for two different painted arrows to pass under the car. If one zooms in, one can inspect the relative positions of the arrow and the Mercedes hood ornament in the real versus predicted frames. Pixel-level models of trajectories, pedestrians, potholes, and debris on the road could one day improve the safety of vehicles.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Our approach generates high quality frames many steps into the future: Given two conditioning frames from the Cityscapes [Cordts et al., 2016] validation set (top left), we show 7 predicted future frames in row 2 below, then skip to frames 20-28, autoregressively predicted in row 4. Ground truth frames are shown in rows 1 and 3. Notice the initial large arrow advancing and passing under the car. In frame 20 (the far left of the 3rd and 4th row), the initially small and barely visible second arrow in the background of the conditioning frames has advanced into the foreground. Result generated by our MCVD concat model variant. Note that some Cityscapes videos contain brightness changes, which may explain the brightness change in this sample.
|
| 21 |
+
|
| 22 |
+
Although beneficial to decision making, video generation is an incredibly challenging problem; not only must high-quality frames be generated, but the changes over time must be plausible and ideally drawn from an accurate and potentially complex distribution over probable futures. Looking far in time is exceptionally hard given the exponential increase in possible futures. Generating video from scratch or unconditionally further compounds the problem because even the structure of the first frame must be synthesized. Also related to video generation are the simpler tasks of a) video prediction, predicting the future given the past, and b) interpolation, predicting the in-between given past and future. Yet, both problems remain challenging. Specialized tools exist to solve the various video tasks, but they rarely solve more than one task at a time.
|
| 23 |
+
|
| 24 |
+
Given the monumental task of general video generation, current approaches are still very limited despite the fact that many state of the art methods have hundreds of millions of parameters [Wu et al., 2021, Weissenborn et al., 2019, Villegas et al., 2019, Babaeizadeh et al., 2021]. While industrial research is capable of looking at even larger models, current methods frequently underfit the data, leading to blurry videos, especially in the longer-term future and recent work has examined ways in improve parameter efficiency [Babaeizadeh et al., 2021]. Our objective here is to devise a video generation approach that generates high-quality, time-consistent videos within our computation budget of $\leq 4$ GPU) and computation times for training models $\leq$ two weeks. Fortunately, diffusion models for image synthesis have demonstrated wide success, which strongly motivated our use of this approach. Our qualitative results in Figure 1 also indicate that our particular approach does quite well at synthesizing frames in the longer-term future (i.e., frame 29 in the bottom right corner).
|
| 25 |
+
|
| 26 |
+
One family of diffusion models might be characterized as Denoising Diffusion Probabilistic Models (DDPMs) [Sohl-Dickstein et al., 2015, Ho et al., 2020, Dhariwal and Nichol, 2021], while another as Score-based Generative Models (SGMs) [Song and Ermon, 2019, Li et al., 2019, Song and Ermon, 2020, Jolicoeur-Martineau et al., 2021a]. However, these approaches have effectively merged into a field we shall refer to as score-based diffusion models, which work by defining a stochastic process from data to noise and then reversing that process to go from noise to data. Their main benefits are that they generate very 1) high-quality and 2) diverse data samples. One of their drawbacks is that solving the reverse process is relatively slow, but there are ways to improve speed [Song et al., 2020,
|
| 27 |
+
|
| 28 |
+
Jolicoeur-Martineau et al., 2021b, Salimans and Ho, 2022, Liu et al., 2022, Xiao et al., 2022]. Given their massive success and attractive properties, we focus here on developing our framework using score-based diffusion models for video prediction, generation, and interpolation.
|
| 29 |
+
|
| 30 |
+
Our work makes the following contributions:
|
| 31 |
+
|
| 32 |
+
1. A conditional video diffusion approach for video prediction and interpolation that yields SOTA results.
|
| 33 |
+
2. A conditioning procedure based on masking past and/or future frames in a blockwise manner giving a single model the ability to solve multiple video tasks: future/past prediction, unconditional generation, and interpolation.
|
| 34 |
+
3. A sliding window blockwise autoregressive conditioning procedure to allow fast and coherent long-term generation (Figure 2).
|
| 35 |
+
4. A convolutional U-net neural architecture integrating recent developments with a conditional normalization technique we call SPAce-TIme-Adaptive Normalization (SPATIN) (Figure 3).
|
| 36 |
+
|
| 37 |
+
By conditioning on blocks of frames in the past and optionally blocks of frames even further in the future, we are able to better ensure that temporal dynamics are transferred across blocks of samples, i.e. our networks can learn implicit models of spatio-temporal dynamics to inform frame generation. Unlike many other approaches, we do not have explicit model components for spatio-temporal derivatives or optical flow or recurrent blocks.
|
| 38 |
+
|
| 39 |
+
# 2 Conditional Diffusion for Video
|
| 40 |
+
|
| 41 |
+
Let $\mathbf { x } _ { 0 } \in \mathbb { R } ^ { d }$ be a sample from the data distribution $p _ { \mathrm { d a t a } }$ . A sample $\mathbf { x } _ { \mathrm { 0 } }$ can corrupted from $t = 0$ to $t = T$ through the Forward Diffusion Process (FDP) with the following transition kernel:
|
| 42 |
+
|
| 43 |
+
$$
|
| 44 |
+
q _ { t } ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } ) = \mathcal { N } ( \mathbf { x } _ { t } ; \sqrt { 1 - \beta _ { t } } \mathbf { x } _ { t - 1 } , \beta _ { t } \mathbf { I } ) ,
|
| 45 |
+
$$
|
| 46 |
+
|
| 47 |
+
Furthermore, $\mathbf { x } _ { t }$ can be sampled directly from $\mathbf { x } _ { \mathrm { 0 } }$ using the following accumulated kernel:
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
q _ { t } ( \mathbf { x } _ { t } | \mathbf { x } _ { 0 } ) = \mathcal { N } ( \mathbf { x } _ { t } ; \sqrt { \bar { \alpha } _ { t } } \mathbf { x } _ { 0 } , ( 1 - \bar { \alpha } _ { t } ) \mathbf { I } ) \implies \mathbf { x } _ { t } = \sqrt { \bar { \alpha } _ { t } } \mathbf { x } _ { 0 } + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
where $\begin{array} { r } { \bar { \alpha } _ { t } = \prod _ { s = 1 } ^ { t } ( 1 - \beta _ { s } ) } \end{array}$ , and $\mathbf { \epsilon } \gets \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ .
|
| 54 |
+
|
| 55 |
+
Generating new samples can be done by reversing the FDP and solving the Reverse Diffusion Process (RDP) starting from Gaussian noise $\mathbf { x } _ { T }$ . It can be shown (Song et al. [2021], Ho et al. [2020]) that the RDP can be computed using the following transition kernel:
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
\begin{array} { r l } & { p _ { t } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } , \mathbf { x } _ { 0 } ) = \mathcal { N } ( \mathbf { x } _ { t - 1 } ; \tilde { \mu } _ { t } ( \mathbf { x } _ { t } , \mathbf { x } _ { 0 } ) , \tilde { \beta } _ { t } \mathbf { I } ) , } \\ { \mathrm { w h e r e } \quad \tilde { \mu } _ { t } ( \mathbf { x } _ { t } , \mathbf { x } _ { 0 } ) = \displaystyle \frac { \sqrt { \bar { \alpha } _ { t - 1 } } \beta _ { t } } { 1 - \bar { \alpha } _ { t } } \mathbf { x } _ { 0 } + \frac { \sqrt { \alpha _ { t } } \left( 1 - \bar { \alpha } _ { t - 1 } \right) } { 1 - \bar { \alpha } _ { t } } \mathbf { x } _ { t } \quad \mathrm { a n d } \quad \tilde { \beta } _ { t } = \displaystyle \frac { 1 - \bar { \alpha } _ { t - 1 } } { 1 - \bar { \alpha } _ { t } } \beta _ { t } } \end{array}
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
Since $\mathbf { x } _ { \mathrm { 0 } }$ given $\mathbf { x } _ { t }$ is unknown, it can be estimated using eq. (2): $\hat { \mathbf { x } } _ { 0 } = \left( \mathbf { x } _ { t } - \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon \right) / \sqrt { \bar { \alpha } _ { t } }$ , where $\epsilon _ { \theta } ( \mathbf { x } _ { t } | t )$ estimates $\epsilon$ using a time-conditional neural network parameterized by $\theta$ . This allows us to reverse the process from noise to data. The loss function of the neural network is:
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
L ( \theta ) = \mathbb { E } _ { t , \mathbf { x } _ { 0 } \sim p _ { \mathrm { d a t a } } , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } ) } \Big [ \big \| \epsilon - \epsilon _ { \theta } \big ( \sqrt { \bar { \alpha } _ { t } } \mathbf { x } _ { 0 } + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon \mid t \big ) \big \| _ { 2 } ^ { 2 } \Big ]
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
Note that estimating $\epsilon$ is equivalent to estimating a scaled version of the score function (i.e., the gradient of the log density) of the noisy data:
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\nabla _ { \mathbf { x } _ { t } } \log q _ { t } ( \mathbf { x } _ { t } \mid \mathbf { x } _ { 0 } ) = - \frac { 1 } { 1 - \bar { \alpha } _ { t } } ( \mathbf { x } _ { t } - \sqrt { \bar { \alpha } _ { t } } \mathbf { x } _ { 0 } ) = - \frac { 1 } { \sqrt { 1 - \bar { \alpha } _ { t } } } \epsilon
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
Thus, data generation through denoising depends on the score-function, and can be seen as noiseconditional score-based generation.
|
| 74 |
+
|
| 75 |
+
Score-based diffusion models can be straightforwardly adapted to video by considering the joint distribution of multiple continuous frames. While this is sufficient for unconditional video generation, other tasks such as video interpolation and prediction remain unsolved. A conditional video prediction model can be approximately derived from the unconditional model using imputation [Song et al., 2021]; indeed, the contemporary work of Ho et al. [2022] attempts to use this technique; however, their approach is based on an approximate conditional model.
|
| 76 |
+
|
| 77 |
+
# 2.1 Video Prediction via Conditional Diffusion
|
| 78 |
+
|
| 79 |
+
future given past immediate future e we have . We con $p$ past frames tion the abo $\mathbf { p } = \left\{ \mathbf { p } ^ { i } \right\} _ { i = 1 } ^ { p }$ and ode $k$ current frames in the on the past frames to $\mathbf { x } _ { 0 } = \left\{ \mathbf { x } _ { 0 } ^ { i } \right\} _ { i = 1 } ^ { k }$
|
| 80 |
+
predict the current frames:
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
L _ { \mathrm { v i d p r e d } } ( \theta ) = \mathbb { E } _ { t , [ \mathbf { p } , \mathbf { x } _ { 0 } ] \sim p _ { \mathrm { d a t a } } , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } ) } \Big [ \big \| \epsilon - \epsilon _ { \theta } \big ( \sqrt { \bar { \alpha } _ { t } } \mathbf { x } _ { 0 } + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon \mid \mathbf { p } , t \big ) \big \| ^ { 2 } \Big ]
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
Given a model trained as above, video prediction for subsequent time steps can be achieved by blockwise autoregressively predicting current video frames conditioned on previously predicted frames (see Figure 2). We use variants of the network shown in Figure 3 to model $\epsilon _ { \theta }$ in Equation 6 here, and for Equation 7 and Equation 8 below.
|
| 87 |
+
|
| 88 |
+

|
| 89 |
+
|
| 90 |
+
# 2.2 Video Prediction $^ +$ Generation via Masked Conditional Diffusion
|
| 91 |
+
|
| 92 |
+
Our approach above allows video prediction, but not unconditional video generation. As a second approach, we extend the same framework to video generation by masking (zeroing-out) the past frames with probability $p _ { \mathrm { m a s k } } = 1 / 2$ using binary mask $m _ { p }$ . The network thus learns to predict the noise added without any past frames for context. Doing so means that we can perform conditional as well as unconditional frame generation, i.e., video prediction and generation with the same network. This leads to the following loss $_ { \mathfrak { z } }$ is the Bernouilli distribution):
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
L _ { \mathrm { v i d g e n } } ( \theta ) = \mathbb { E } _ { t , [ \mathbf { p } , \mathbf { x } _ { 0 } ] \sim p _ { \mathrm { d a t a } } , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } ) , m _ { p } \sim \mathcal { B } ( p _ { \mathrm { m a x } } ) } \Big [ \big \| \epsilon - \epsilon _ { \theta } \big ( \sqrt { \bar { \alpha } _ { t } } \mathbf { x } _ { 0 } + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon \mid m _ { p } \mathbf { p } , t \big ) \big \| ^ { 2 } \Big ]
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
We hypothesize that this dropout-like [Srivastava et al., 2014] approach will also serve as a form of regularization, improving the model’s ability to perform predictions conditioned on the past. We see positive evidence of this effect in our experiments – see the MCVD past-mask model variants in Tables 3 and 9 versus without past-masking. Note that random masking is used only during training.
|
| 99 |
+
|
| 100 |
+
# 2.3 Video Prediction $^ +$ Generation $^ +$ Interpolation via Masked Conditional Diffusion
|
| 101 |
+
|
| 102 |
+
We now have a design for video prediction and generation, but it still cannot perform video interpolation nor past prediction from the future. As a third and final approach, we show how to build a general model for solving all four video tasks. Assume we have $p$ past frames, $k$ current frames, and $f$ future frames $\mathbf { f } = \left\{ \mathbf { f } ^ { i } \right\} _ { i = 1 } ^ { f }$ We randomly mask the $p$ past frames with probability $p _ { m a s k } = 1 / 2$ , and similarly randomly mask the $f$ future frames with the same probability (but sampled separately). Thus, future or past prediction is when only future or past frames are masked. Unconditional generation is when both past and future frames are masked. Video interpolation is when neither past nor future frames are masked. The loss function for this general video machinery is:
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
{ \cal L } ( \theta ) = \mathbb { E } _ { t , [ { \bf p } , { \bf x } _ { 0 } , { \bf f } ] \sim p _ { \mathrm { d a t } } , \epsilon \sim \mathcal { N } ( { \bf 0 } , { \bf I } ) , ( m _ { p } , m _ { f } ) \sim \mathcal { B } ( p _ { \mathrm { m a x } } ) } \left[ \left\| \epsilon - \epsilon _ { \theta } \big ( \sqrt { \bar { \alpha } _ { t } } { \bf x } _ { 0 } + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon \mid m _ { p } { \bf p } , m _ { f } { \bf f } , t \big ) \right\| ^ { 2 } \right]
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+

|
| 109 |
+
Figure 3: We give noisy current frames to a U-Net whose residual blocks receive conditional information from past/future frames and noise-level. The output is the predicted noise in the current frames, which we use to denoise the current frames. At test time, we start from pure noise.
|
| 110 |
+
|
| 111 |
+
# 2.4 Our Network Architecture
|
| 112 |
+
|
| 113 |
+
For our denoising network we use a U-net architecture [Ronneberger et al., 2015, Honari et al., 2016, Salimans et al., 2017] combining the improvements from Song et al. [2021] and Dhariwal and Nichol [2021]. This architecture uses a mix of 2D convolutions [Fukushima and Miyake, 1982], multi-head self-attention [Cheng et al., 2016], and adaptive group-norm [Wu and He, 2018]. We use positional encodings of the noise level $\mathrm { \Phi } _ { t } \in [ 0 , 1 ] )$ ) and process it using a transformer style positional embedding:
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
\mathbf { e } ( t ) = \left[ \dots , \cos \left( t c ^ { \frac { - 2 d } { D } } \right) , \sin \left( t c ^ { \frac { - 2 d } { D } } \right) , \dots \right] ^ { \mathrm { T } } ,
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
where $d = 1 , \ldots , D / 2$ , $D$ is the number of dimensions of the embedding, and $c = 1 0 0 0 0$ . This embedding vector is passed through a fully connected layer, followed by an activation function and another fully connected layer. Each residual block has an fully connected layer that adapts the embedding to the correct dimensionality.
|
| 120 |
+
|
| 121 |
+
To provide $\mathbf { x } _ { t }$ , p, and f to the network, we separately concatenate the past/future conditional frames and the noisy current frames in the channel dimension. The concatenated noisy current frames are directly passed as input to the network. Meanwhile, the concatenated conditional frames are passed through an embedding that influences the conditional normalization akin to SPatially-Adaptive (DE)normalization (SPADE) [Park et al., 2019]; to account for the effect of time/motion, we call this approach SPAce-TIme-Adaptive Normalization (SPATIN). In addition to SPATIN, we also try directly concatenating the conditional and noisy current frames together and passing them as the input. In our experiments below we show some results with SPATIN and some with concatenation (concat). For simple video prediction with Equation 6, we experimented with 3D convolutions and 3D attention However, this requires an exorbitant amount of memory, and we found no benefit in using 3D layers over 2D layers at the same memory (i.e., the biggest model that fits in 4 GPUs). Thus, we did not explore this idea further. We also tried and found no benefit from gamma noise [Nachmani et al., 2021], L1 loss, and F-PNDM sampling [Liu et al., 2022].
|
| 122 |
+
|
| 123 |
+
# 3 Related work
|
| 124 |
+
|
| 125 |
+
Score-based diffusion models have been used for image editing [Meng et al., 2022, Saharia et al., 2021, Nichol et al., 2021] and our approach to video generation might be viewed as an analogy to classical image inpainting, but in the temporal dimension. The GLIDE or Guided Language to Image Diffusion for Generation and Editing approach of Nichol et al. [2021] uses CLIP-guided diffusion for image editing, while Denoising Diffusion Restoration Models (DDRM) Kawar et al. [2022] additionally condition on a corrupted image to restore the clean image. Adversarial variants of score-based diffusion models have been used to enhance quality [Jolicoeur-Martineau et al., 2021a] or speed [Xiao et al., 2022].
|
| 126 |
+
|
| 127 |
+
Contemporary work to our own such as that of Ho et al. [2022] and Yang et al. [2022] also examine video generation using score-based diffusion models. However, the Video Diffusion Models (VDMs) work of Ho et al. [2022] approximates conditional distributions using a gradient method for conditional sampling from their unconditional model formulation. In contrast, our approach directly works with a conditional diffusion model, which we obtain through masked conditional training, thereby giving us the exact conditional distribution as well as the ability to generate unconditionally. Their experiments focus on: a) unconditional video generation, and b) text-conditioned video generation, whereas our work focuses primarily on predicting future video frames from the past, using our masked conditional generation framework. The Residual Video Diffusion (RVD) of Yang et al. [2022] is only for video prediction, and it uses a residual formulation to generate frames autoregressively one at a time. Meanwhile, ours directly models the conditional frames to generate multiple frames in a block-wise autoregressive manner.
|
| 128 |
+
|
| 129 |
+
Recurrent neural network (RNN) techniques were early candidates for modern deep neural architectures for video prediction and generation. Early work combined RNNs with a stochastic latent variable (SV2P) Babaeizadeh et al. [2018a] and was optimized by variational inference. The stochastic video generation (SVG) approach of Denton and Fergus [2018] learned both prior and a per time step latent variable model, which influences the dynamics of an LSTM at each step. The model is also trained in a manner similar to a variational autoencoder, i.e., it was another form of variational RNN (vRNN). To address the fact that vRNNs tend to lead to blurry results, Castrejón et al. [2019] (Hier-vRNN) increased the expressiveness of the latent distributions using a hierarchy of latent variables. We compare qualitative result of SVG and Hier-vRNN with the MCVD concat variant of our method in Figure 4. Other vRNN-based models include SAVP Lee et al. [2018], SRVP Franceschi et al. [2020], SLAMP Akan et al. [2021].
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
Figure 4: Comparing future prediction methods on Cityscapes: SVG-LP (Top Row), Hier-vRNNs (Second Row), Our Method (Third Row), Ground Truth (Bottom Row). Frame 2, a ground truth conditioning frame is shown in first column, followed by frames: 3, 5, 10 and 20 generated by each method vs the ground truth at the bottom.
|
| 133 |
+
|
| 134 |
+
The well known Transformer paradigm [Vaswani et al., 2017] from natural language processing has also been explored for video. The Video-GPT work of Yan et al. [2021] applied an autoregressive GPT style [Brown et al., 2020] transformer to the codes produced from a VQ-VAE [Van Den Oord et al., 2017]. The Video Transformer work of Weissenborn et al. [2019] models video using 3-D spatiotemporal volumes without linearizing positions in the volume. They examine local self-attention over small non-overlapping sub-volumes or 3D blocks. This is done partly to accelerate computations on TPU hardware. Their work also observed that the peak signal-to-noise ratio (PSNR) metric and the mean-structural similarity (SSIM) metrics [Wang et al., 2004] were developed for images, and have serious flaws when applied to videos. PSNR prefers blurry videos and SSIM does not correlate well to perceptual quality. Like them, we focus on the recently proposed Frechet Video Distance (FVD) [Unterthiner et al., 2018], computed over entire videos and which is sensitive to visual quality, temporal coherence, and diversity of samples. Rakhimov et al. [2020] (LVT) used transformers to predict the dynamics of video in latent space. Le Moing et al. [2021] (CCVS) also predict in latent space, that of an adversarially trained autoencoder, and also add a learnable optical flow module.
|
| 135 |
+
|
| 136 |
+
Generative Adversarial Network (GAN) based approaches to video generation have also been studied extensively. Vondrick et al. [2016] proposed an early GAN architecture for video, using a spatio-temporal CNN. Villegas et al. [2017] proposed a strategy for separating motion and content into different pathways of a convolutional LSTM based encoder-decoder RNN. Saito et al. [2017] (TGAN) predicted a sequence of latents using a temporal generator, and then the sequence of frames from those latents using an image generator. TGANv2 Saito et al. [2020] improved its memory efficiency. MoCoGAN Tulyakov et al. [2018] explored style and content separation, but within a CNN framework. Yushchenko et al. [2019] used the MoCoGAN framework by re-formulating the video prediction problem as a Markov Decision Process (MDP). FutureGAN Aigner and Körner [2018] used spatio-temporal 3D convolutions in an encoder decoder architecture, and elements of the progressive GAN Karras et al. [2018] approach to improve image quality. TS-GAN Munoz et al. [2021] facilitated information flow between consecutive frames. TriVD-GAN Luc et al. [2020] proposes a novel recurrent unit in the generator to handle more complex dynamics, while DIGAN Yu et al. [2022] uses implicit neural representations in the generator.
|
| 137 |
+
|
| 138 |
+
Video interpolation was the subject of a flurry of interest in the deep learning community a number of years ago [Niklaus et al., 2017, Jiang et al., 2018, Xue et al., 2019, Bao et al., 2019]. However, these architectures tend to be fairly specialized to the interpolation task, involving optical flow or motion field modelling and computations. Frame interpolation is useful for video compression; therefore, many other lines of work have examined interpolation from a compression perspective. However, these architectures tend to be extremely specialized to the video compression task [Yang et al., 2020].
|
| 139 |
+
|
| 140 |
+
The Cutout approach of DeVries and Taylor [2017] has examined the idea of cutting out small continuous regions of an input image, such as small squares. Dropout [Srivastava et al., 2014] at the FeatureMap level was proposed and explored under the name of SpatialDropout in Tompson et al. [2015]. Input Dropout [de Blois et al., 2020] has been examined in the context of dropping different channels of multi-modal input imagery, such as the dropping of the RGB channels or depth map channels during training, then using the model without one of the modalities during testing, e.g. in their work they drop the depth channel.
|
| 141 |
+
|
| 142 |
+
Regarding our block-autoregressive approach, previous video prediction models were typically either 1) non-recurrent: predicting all $n$ frames simultaneously with no way of adding more frames (most GAN-based methods), or 2) recurrent in nature, predicting 1 frame at a time in an autoregressive fashion. The benefit of the non-recurrent type is that you can generate videos faster than 1 frame at a time while allowing for generating as many frames as needed. The disadvantage is that it is slower than generating all frames at once, and takes up more memory and compute at each iteration. Our model finds a sweet spot in between in that it is block-autoregressive: generating $k < n$ frames at a time recurrently to finally obtain $n$ frames.
|
| 143 |
+
|
| 144 |
+
# 4 Experiments
|
| 145 |
+
|
| 146 |
+
We show the results of our video prediction experiments on test data that was never seen during training in Tables $1 \textrm { -- } 4$ for Stochastic Moving MNIST (SMMNIST) 2, KTH 3, BAIR 4, and Cityscapes 5respectively. We present unconditional generation results for BAIR in Table 5 and UCF-101 6 in Table 6, and interpolation results for SMMNIST, KTH, and BAIR in Table 7.
|
| 147 |
+
|
| 148 |
+
Datasets: We generate $1 2 8 \mathrm { x } 1 2 8$ images for Cityscapes and $6 4 \mathrm { x } 6 4$ images for the other datasets. See our Appendix and supplementary material for additional visual results. Our choice of datasets is in order of progressive difficulty: 1) SMMNIST: black-and-white digits; 2) KTH: grayscale single-humans; 3) BAIR: color, multiple objects, simple scene; 4) Cityscapes: color, natural complex natural driving scene; 5) UCF101: color, 101 categories of natural scenes. We process these datasets similarly to prior works. For Cityscapes, each video is center-cropped, then resized to $1 2 8 \times 1 2 8$ . For UCF101, each video clip is center-cropped at $2 4 0 \times 2 4 0$ and resized to $6 4 { \times } 6 4$ , taking care to maintain the train-test splits.
|
| 149 |
+
|
| 150 |
+
Unless otherwise specified, we set the mask probability to 0.5 when masking was used. For sampling, we report results using the sampling methods DDPM [Ho et al., 2020] or DDIM [Song et al., 2020] with only 100 sampling steps, though our models were trained with 1000, to make sampling faster. We observe that the metrics are generally better using DDPM than DDIM (except for UCF
|
| 151 |
+
|
| 152 |
+
Table 1: Video prediction results on SMMNIST $( 6 4 \times 6 4 )$ for 10 predicted frames conditioned on 5 past frames. We predicted 10 trajectories per real video, and report the average FVD and maximum SSIM, averaged across 256 test videos.
|
| 153 |
+
|
| 154 |
+
<table><tr><td>SMMNIST[5 →10; trained on k]</td><td>k</td><td>FVD↓</td><td>SSIM↑</td></tr><tr><td>SVG [Denton and Fergus, ,2018]</td><td>10</td><td>90.81</td><td>0.688</td></tr><tr><td> vRNN 1L [Castrej6n et al., 2019]</td><td>10</td><td>63.81</td><td>0.763</td></tr><tr><td> Hier-vRNN [Castrej6n et al., 2019]</td><td>10</td><td>57.17</td><td>0.760</td></tr><tr><td>MCVD concat (Ours)</td><td>5</td><td>25.63</td><td>0.786</td></tr><tr><td>MCVD : spatin (Ours)</td><td>5</td><td>23.86</td><td>0.780</td></tr></table>
|
| 155 |
+
|
| 156 |
+
101). Using 1000 sampling steps could yield better results.
|
| 157 |
+
|
| 158 |
+
Note that all our models are trained to predict only 4-5 current frames at a time, unlike other models that predict ${ \geq } 1 0 $ . We use these models to then autoregressively predict longer sequences for prediction or generation. This was done in order to fit the models in our GPU memory budget. Despite this disadvantage, we find that our MCVD models perform better than many previous SOTA methods.
|
| 159 |
+
|
| 160 |
+
Metrics: As mentioned earlier, we primarily use the FVD metric for comparison across models as FVD measures both fidelity and diversity of the generated samples. Previous works compare Frechet Inception Distance (FID) [Heusel et al., 2017] and Inception Score (IS) [Salimans et al., 2016], adapted to videos by replacing the Inception network with a 3D-convolutional network that takes video input. FVD is
|
| 161 |
+
|
| 162 |
+
Table 2: Video prediction results on KTH $( 6 4 \times 6 4 )$ , predicting 30 and 40 frames using models trained to predict $k$ frames at a time. All models condition on 10 past frames, on 256 test videos.
|
| 163 |
+
|
| 164 |
+
<table><tr><td>KTH[10→ pred; trained on k]|k pred</td><td></td><td>|FVD↓</td><td>PSNR↑</td><td>SSIM↑</td></tr><tr><td>SAVP [Lee et al., 2018]</td><td>10 30</td><td>374±3</td><td>26.5</td><td>0.756</td></tr><tr><td>MCVD concat (Ours)</td><td>5 30</td><td>323±3</td><td>27.5</td><td>0.835</td></tr><tr><td> SLAMP [Akan et al., 2021]</td><td>10 30</td><td>228±5</td><td>29.4</td><td>0.865</td></tr><tr><td>SRVP [Franceschi et al., 2020]</td><td>10 30</td><td>222±3</td><td>29.7</td><td>0.870</td></tr><tr><td>MCVD concat (Ours)</td><td>5</td><td>40 276.7</td><td>26.40</td><td>0.812</td></tr><tr><td> SAVP-VAE [Lee et al., 2018]</td><td>10</td><td>40 145.7</td><td>26.00</td><td>0.806</td></tr><tr><td>Grid-keypoints [Gao et al., 2021]</td><td>10</td><td>40</td><td>144.2</td><td>27.11 0.837</td></tr></table>
|
| 165 |
+
|
| 166 |
+
computed similarly to FID, but using an I3D network trained on the huge video dataset Kinetics-400.
|
| 167 |
+
We also report PSNR and SSIM.
|
| 168 |
+
|
| 169 |
+
Ablation studies: In Table 3 we compare models that use concatenated raw pixels as input to U-Net blocks (concat) to SPATIN variants. We also compare no-masking to past-masking variants, i.e. models which are only trained predict the future vs. models which are regularized by being trained for prediction and unconditional generation. It can be seen that our model works across different choices of past frames and generates better quality for shorter videos. This is expected from models of this kind. Moreover, it can be seen that the model trained on the two tasks of Prediction and Generation (i.e., the models with past-mask) performs better than the model trained only on Prediction!
|
| 170 |
+
|
| 171 |
+
In addition, the appendix contains an ablation study in Table 9 on the different design choices: concat vs concat past-future-mask vs spatin vs spatin future-mask vs spatin past-future-mask. It can be seen that concat is, in general, better than spatin. It can also be seen that the past-future-mask variant, which is a general model capable of all three tasks, performs better at the individual tasks than the models trained only on the individual task. This was demonstrated in Table 3 as well. This shows that the model gains very helpful insights while generalizing to all three tasks, which it does not while training only on the individual task.
|
| 172 |
+
|
| 173 |
+
We conducted preliminary experiments with a larger number of frames. Since the models with a larger number of frames were bigger, we could only run them for a shorter time with a smaller batch size than the smaller models. In general, we found that larger models did not substantially improve the results. We attribute this to the fact that using more frames means that the model should be given more capacity, but we could not increase it due to our computational budget constraints. We emphasize that our method works very well with fewer computational resources.
|
| 174 |
+
|
| 175 |
+
Examining these results we remark that we have SOTA performance for prediction on SMMNIST, BAIR and the challenging Cityscapes evaluation. Our Cityscapes model yields an FVD of 145.5, whereas the best previous result of which we are aware is 418. The quality of our Cityscapes results are illustrated visually in Figure 1 and Figure 2 and in the additional examples provided in our Appendix. While our completely unconditional generation results are strong, we note that when past masking is used to regularize future predicting models, we see clear performance gains in Table 3. Finally, in Table 7 we see that our interpolation results are SOTA by a wide margin, across experiments on SMMNIST, KTH and BAIR – even compared to architectures much more specialized for interpolation.
|
| 176 |
+
|
| 177 |
+
It can be seen that our proposed method generates better quality videos, even though it was trained on a shorter number of frames than other methods. It can also be seen that training on multiple tasks using random masking improves the quality of generated frames than training on the individual tasks.
|
| 178 |
+
|
| 179 |
+
Table 3: Video prediction results on BAIR $( 6 4 \times 6 4 )$ conditioning on $p$ past frames and predicting pred frames in the future, using models trained to predict $k$ frames at at time.
|
| 180 |
+
|
| 181 |
+
<table><tr><td>BAIR(64 × 64) [past p → pred ; trained on k]|</td><td>p</td><td>k</td><td>pred</td><td>FVD↓</td><td>PSNR↑</td><td>SSIM↑</td></tr><tr><td>LVT [Rakhimov et al., 2020]</td><td>1</td><td>15</td><td>15</td><td>125.8</td><td>1</td><td>1</td></tr><tr><td>DVD-GAN-FP [Clark et al., 2019]</td><td>1</td><td>15</td><td>15</td><td>109.8</td><td>1</td><td>1</td></tr><tr><td>MCVD spatin (Ours)</td><td>1</td><td>5</td><td>15</td><td>103.8</td><td>18.8</td><td>0.826</td></tr><tr><td>TrIVD-GAN-FP [Luc et al., 2020]</td><td>1</td><td>15</td><td>15</td><td>103.3</td><td>1</td><td>1</td></tr><tr><td>VideoGPT[Yan et al., 2021]</td><td>1</td><td>15</td><td>15</td><td>103.3</td><td>1</td><td>1</td></tr><tr><td>CCVS [Le Moing et al., 2021]</td><td>1</td><td>15</td><td>15</td><td>99.0</td><td>1</td><td>一</td></tr><tr><td>MCVD concat (Ours)</td><td>1</td><td>5</td><td>15</td><td>98.8</td><td>18.8</td><td>0.829</td></tr><tr><td>MCVD spatin past-mask (Ours)</td><td>1</td><td>5</td><td>15</td><td>96.5</td><td>18.8</td><td>0.828</td></tr><tr><td>MCVD concat past-mask (Ours)</td><td>1</td><td>5</td><td>15</td><td>95.6</td><td>18.8</td><td>0.832</td></tr><tr><td>Video Transformer [Weissenborn et al., 2019]</td><td>1</td><td>15</td><td>15</td><td>94-96a</td><td>1</td><td>1</td></tr><tr><td>FitVid [Babaeizadeh et al., 2021]</td><td>1</td><td>15</td><td>15</td><td>93.6</td><td></td><td>一</td></tr><tr><td>MCVD concat past-future-mask (Ours)</td><td>1</td><td>5</td><td>15</td><td>89.5</td><td>16.9</td><td>0.780</td></tr><tr><td>SAVP [Lee et al., 2018]</td><td>2</td><td>14</td><td>14</td><td>116.4</td><td>1</td><td>1</td></tr><tr><td>MCVD spatin (Ours)</td><td></td><td>5</td><td>14</td><td>94.1</td><td>19.1</td><td>0.836</td></tr><tr><td>MCVD spatin past-mask (Ours)</td><td>22222</td><td>5</td><td>14</td><td>90.5</td><td>19.2</td><td>0.837</td></tr><tr><td>MCVD concat (Ours)</td><td></td><td>5</td><td>14</td><td>90.5</td><td>19.1</td><td>0.834</td></tr><tr><td>MCVD concat past-future-mask (Ours)</td><td></td><td>5</td><td>14</td><td>89.6</td><td>17.1</td><td>0.787</td></tr><tr><td>MCVD concat past-mask (Ours)</td><td></td><td>5</td><td>14</td><td>87.9</td><td>19.1</td><td>0.838</td></tr><tr><td>SAVP [Lee et al., 2018]</td><td>2</td><td>10</td><td>28</td><td>143.4</td><td>1</td><td>0.795</td></tr><tr><td>Hier-vRNN [Castrej6n et al., 2019]</td><td></td><td>10</td><td>28</td><td>143.4</td><td>1</td><td>0.822</td></tr><tr><td>MCVD spatin (Ours)</td><td></td><td>5</td><td>28</td><td>132.1</td><td>17.5</td><td>0.779</td></tr><tr><td>MCVD spatin past-mask (Ours)</td><td>222222</td><td>5</td><td>28</td><td>127.9</td><td>17.7</td><td>0.789</td></tr><tr><td>MCVD concat (Ours)</td><td></td><td>5</td><td>28</td><td>120.6</td><td>17.6</td><td>0.785</td></tr><tr><td>MCVD concat past-mask (Ours)</td><td></td><td>5</td><td>28</td><td>119.0</td><td>17.7</td><td>0.797</td></tr><tr><td>MCVD concat past-future-mask (Ours)</td><td></td><td>5</td><td>28</td><td>118.4</td><td>16.2</td><td>0.745</td></tr></table>
|
| 182 |
+
|
| 183 |
+
a 94 on only the first frames, 96 on all subsequences of test frames
|
| 184 |
+
|
| 185 |
+
Table 4: Video prediction on Cityscapes $( 1 2 8 \times 1 2 8 )$ conditioning on 2 frames and predicting 28. SPATIN seems to produce a drift towards brighter images with a color balance shift in frames further from the start frame on Cityscapes, resulting in increased FVD for SPATIN than the CONCAT variant.
|
| 186 |
+
|
| 187 |
+
<table><tr><td>Cityscapes (128 × 128)[2 -→28; trained on k]</td><td>k</td><td>FVD↓</td><td>LPIPS↓</td><td>SSIM↑</td></tr><tr><td> SVG-LP Denton and Fergus [2018]</td><td>10</td><td>1300.26</td><td>0.549 ± 0.06</td><td>0.574 ± 0.08</td></tr><tr><td> vRNN 1L Castrej6n et al. [2019]</td><td>10</td><td>682.08</td><td>0.304 ± 0.10</td><td>0.609 ± 0.11</td></tr><tr><td>Hier-vRNN Castrej6n et al. [2019]</td><td>10</td><td>567.51</td><td>0.264 ± 0.07</td><td>0.628 ± 0.10</td></tr><tr><td>GHVAE Wu et al. [2021]</td><td>10</td><td>418.00</td><td>0.193 ± 0.014</td><td>0.740 ± 0.04</td></tr><tr><td>MCVD spatin past-mask (Ours)</td><td>5</td><td>184.81</td><td>0.121 ± 0.05</td><td>0.720 ± 0.11</td></tr><tr><td>MCVD concat past-mask (Ours)</td><td>5</td><td>141.31</td><td>0.112 ± 0.05</td><td>0.690 ± 0.12</td></tr></table>
|
| 188 |
+
|
| 189 |
+
# 5 Conclusion
|
| 190 |
+
|
| 191 |
+
We have shown how to obtain SOTA video prediction and interpolation results with randomly masked conditional video diffusion models using a relatively simple architecture. We found that past-masking was able to improve performance across all model variants and configurations tested. We believe our approach may pave the way forward toward high quality larger-scale video generation.
|
| 192 |
+
|
| 193 |
+
Limitations. Videos generated by these models are still small compared to real movies, and they can still become blurry or inconsistent when the number of generated frames is very large. Our unconditional generation results on the highly diverse UCF-101 dataset are still far from perfect. More work is clearly needed to scale these
|
| 194 |
+
|
| 195 |
+
Table 5: Unconditional generation of BAIR video frames.
|
| 196 |
+
|
| 197 |
+
<table><tr><td>BAIR (64 × 64) [0 → pred; trained on 5]|pred|FVD↓</td><td></td><td></td></tr><tr><td>MCVD spatin past-mask (Ours)</td><td>16</td><td>267.8</td></tr><tr><td>MCVD concat past-mask (Ours)</td><td>16</td><td>228.5</td></tr><tr><td>MCVD spatin past-mask (Ours)</td><td>30</td><td>399.8</td></tr><tr><td>MCVD concat past-mask (Ours)</td><td>30</td><td>348.2</td></tr></table>
|
| 198 |
+
|
| 199 |
+
models to larger datasets with more diversity and with longer duration video. As has been the case in many other settings, simply using larger models with many more parameters is a strategy that is likely to improve the quality and flexibility of these models – we were limited to 4 GPUs for our work here. There is also a need for faster sampling methods capable of maintaining quality over time.
|
| 200 |
+
|
| 201 |
+
Given our strong interpolation results, conditional diffusion models which generate skipped frames could make it possible to generate much longer, but consistent video through a strategy of first generating sparse distant frames in a block, followed by an interpolative diffusion step for the missing frames.
|
| 202 |
+
|
| 203 |
+
Table 6: Unconditional generation of UCF-101 video frames.
|
| 204 |
+
|
| 205 |
+
<table><tr><td>UCF-101 (64 × 64) [0→ 16; trained on k]</td><td>k</td><td>FVD↓</td></tr><tr><td>MoCoGAN-MDP [Yushchenko et al., 2019]</td><td>16</td><td>1277.0</td></tr><tr><td>MCVD concat past-mask (Ours)</td><td>4</td><td>1228.3</td></tr><tr><td>TGANv2 [Saito et al., 2020]</td><td>16</td><td>1209.0</td></tr><tr><td>MCVD spatin past-mask (Ours)</td><td>4</td><td>1143.0</td></tr><tr><td>DIGAN [Yu et al., 2022]</td><td>16</td><td>655.0</td></tr></table>
|
| 206 |
+
|
| 207 |
+
Table 7: Video Interpolation results $( 6 4 \times 6 4 )$ . Given $p \operatorname { p a s t } + f$ future frames interpolate $k$ frames. Reporting average of the best metrics out of $n$ trajectories per test sample. $\downarrow ( p + f )$ and $\uparrow k$ is harder. We used MCVD spatin past-mask for SMMNIST and KTH, and MCVD concat past-future-mask for BAIR. We also include results on SMMNIST for a "pure" model trained without any masking.
|
| 208 |
+
|
| 209 |
+
<table><tr><td rowspan="2"></td><td colspan="4">SMMNIST (64× 64) p+fkn</td><td colspan="3">KTH(64× 64)</td><td colspan="4">BAIR (64× 64)</td></tr><tr><td></td><td></td><td></td><td>|PSNR↑ SSIM↑</td><td></td><td>p+fkn</td><td>|PSNR↑SSIM↑</td><td></td><td></td><td>p+fkn</td><td>|PSNR↑ SSIM↑</td></tr><tr><td>SVG-LP Denton and Fergus [2018]</td><td>18 7100</td><td></td><td>13.543</td><td>0.741</td><td>18</td><td>7100</td><td>28.131 0.883</td><td></td><td>187100</td><td></td><td>18.648 0.846</td></tr><tr><td>FSTN Lu et al. [2017]</td><td>18</td><td>7100</td><td>14.730</td><td>0.765</td><td>18</td><td>7100</td><td>29.431 0.899</td><td></td><td>187100</td><td>19.908</td><td>0.850</td></tr><tr><td>SepConv Niklaus et al. [2017]</td><td>18 7100</td><td></td><td>14.759</td><td>0.775</td><td>18</td><td>7100</td><td>29.210 0.904</td><td></td><td>187100</td><td></td><td>21.615 0.877</td></tr><tr><td>SuperSloMo Jiang et al. [2018]</td><td>18 7100</td><td></td><td>13.387</td><td>0.749</td><td>18</td><td>7100</td><td>28.756 0.893</td><td></td><td>1 二</td><td></td><td>一</td></tr><tr><td> SDVI full Xu et al. [2020]</td><td>18 7100</td><td></td><td>16.025</td><td>0.842</td><td>18</td><td>7100</td><td>29.190 0.901</td><td></td><td>18 7100</td><td>21.432</td><td>0.880</td></tr><tr><td>SDVI Xu et al. [2020]</td><td>167100</td><td></td><td>14.857</td><td>0.782</td><td>16</td><td>7100</td><td>26.907 0.831</td><td></td><td>16 7100</td><td>19.694</td><td>0.852</td></tr><tr><td rowspan="2">MCVD (Ours)</td><td>10 10 100</td><td></td><td>20.944</td><td>0.854</td><td>15 10100</td><td></td><td>34.669 0.943</td><td></td><td>45100</td><td>25.162</td><td>0.932</td></tr><tr><td>10510</td><td></td><td>27.693</td><td>0.941</td><td></td><td></td><td>34.068</td><td>0.942</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td>pure</td><td>18.385</td><td>0.802</td><td>10</td><td>15 10 10 510</td><td>35.611</td><td>0.963</td><td>4510</td><td>23.408</td><td>0.914</td></tr></table>
|
| 210 |
+
|
| 211 |
+
Broader Impacts. High-quality video generation is potentially a powerful technology that could be used by malicious actors for applications such as creating fake video content. Our formulation focuses on capturing the distributions of real video sequences. High-quality video prediction could one day find use in applications such as autonomous vehicles, where the cost of errors could be high. Diffusion methods have shown great promise for covering the modes of real probability distributions. In this context, diffusion-based techniques for generative modelling may be a promising avenue for future research where the ability to capture modes properly is safety critical. Another potential point of impact is the amount of computational resources being spent for these applications involving the high fidelity and voluminous modality of video data. We emphasize the use of limited resources in achieving better or comparable results. Our submission provides evidence for more efficient computation involving fewer GPU hours spent in training time.
|
| 212 |
+
|
| 213 |
+
# Acknowledgments and Disclosure of Funding
|
| 214 |
+
|
| 215 |
+
We thank Digital Research Alliance of Canada for the GPUs which were used in this work. Alexia, Vikram thank their wives and cat for their support. We thank CIFAR for support under the AI Chairs program, and NSERC for support under the Discovery grants program, application ID 5018358.
|
| 216 |
+
|
| 217 |
+
# References
|
| 218 |
+
|
| 219 |
+
Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3213–3223, 2016.
|
| 220 |
+
|
| 221 |
+
Bohan Wu, Suraj Nair, Roberto Martin-Martin, Li Fei-Fei, and Chelsea Finn. Greedy hierarchical variational autoencoders for large-scale video prediction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2318–2328, 2021.
|
| 222 |
+
|
| 223 |
+
Dirk Weissenborn, Oscar Täckström, and Jakob Uszkoreit. Scaling autoregressive video models. arXiv preprint arXiv:1906.02634, 2019.
|
| 224 |
+
|
| 225 |
+
Ruben Villegas, Arkanath Pathak, Harini Kannan, Dumitru Erhan, Quoc V Le, and Honglak Lee. High fidelity video prediction with large stochastic recurrent neural networks. Advances in Neural Information Processing Systems, 32, 2019.
|
| 226 |
+
|
| 227 |
+
Mohammad Babaeizadeh, Mohammad Taghi Saffar, Suraj Nair, Sergey Levine, Chelsea Finn, and Dumitru Erhan. Fitvid: Overfitting in pixel-level video prediction. arXiv preprint arXiv:2106.13195, 2021.
|
| 228 |
+
|
| 229 |
+
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.
|
| 230 |
+
|
| 231 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 2020.
|
| 232 |
+
|
| 233 |
+
Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems, 34, 2021.
|
| 234 |
+
|
| 235 |
+
Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in Neural Information Processing Systems, 2019.
|
| 236 |
+
|
| 237 |
+
Zengyi Li, Yubei Chen, and Friedrich T Sommer. Learning energy-based models in high-dimensional spaces with multi-scale denoising score matching. arXiv preprint arXiv:1910.07762, 2019.
|
| 238 |
+
|
| 239 |
+
Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. Advances in Neural Information Processing Systems, 2020.
|
| 240 |
+
|
| 241 |
+
Alexia Jolicoeur-Martineau, Rémi Piché-Taillefer, Rémi Tachet des Combes, and Ioannis Mitliagkas. Adversarial score matching and improved sampling for image generation. International Conference on Learning Representations, 2021a. URL arXivpreprintarXiv:2009.05475.
|
| 242 |
+
|
| 243 |
+
Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv:2010.02502, October 2020. URL https://arxiv.org/abs/2010.02502.
|
| 244 |
+
|
| 245 |
+
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, 2021b.
|
| 246 |
+
|
| 247 |
+
Tim Salimans and Jonathan Ho. Progressive distillation for fast sampling of diffusion models. arXiv preprint arXiv:2202.00512, 2022.
|
| 248 |
+
|
| 249 |
+
Luping Liu, Yi Ren, Zhijie Lin, and Zhou Zhao. Pseudo numerical methods for diffusion models on manifolds. arXiv preprint arXiv:2202.09778, 2022.
|
| 250 |
+
|
| 251 |
+
Zhisheng Xiao, Karsten Kreis, and Arash Vahdat. Tackling the generative learning trilemma with denoising diffusion GANs. In International Conference on Learning Representations (ICLR), 2022.
|
| 252 |
+
|
| 253 |
+
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. URL arXivpreprintarXiv:2011.13456.
|
| 254 |
+
|
| 255 |
+
Jonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J. Fleet. Video diffusion models, 2022. URL https://arxiv.org/abs/2204.03458.
|
| 256 |
+
|
| 257 |
+
Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(56):1929–1958, 2014.
|
| 258 |
+
|
| 259 |
+
Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computerassisted intervention, pages 234–241. Springer, 2015.
|
| 260 |
+
|
| 261 |
+
Sina Honari, Jason Yosinski, Pascal Vincent, and Christopher Pal. Recombinator networks: Learning coarse-to-fine feature aggregation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 5743–5752, 2016.
|
| 262 |
+
|
| 263 |
+
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.
|
| 264 |
+
|
| 265 |
+
Kunihiko Fukushima and Sei Miyake. Neocognitron: A self-organizing neural network model for a mechanism of visual pattern recognition. In Competition and cooperation in neural nets, pages 267–285. Springer, 1982.
|
| 266 |
+
|
| 267 |
+
Jianpeng Cheng, Li Dong, and Mirella Lapata. Long short-term memory-networks for machine reading. arXiv preprint arXiv:1601.06733, 2016.
|
| 268 |
+
|
| 269 |
+
Yuxin Wu and Kaiming He. Group normalization. In Proceedings of the European conference on computer vision (ECCV), pages 3–19, 2018.
|
| 270 |
+
|
| 271 |
+
Taesung Park, Ming-Yu Liu, Ting-Chun Wang, and Jun-Yan Zhu. Semantic image synthesis with spatially-adaptive normalization. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 2337–2346, 2019.
|
| 272 |
+
|
| 273 |
+
Eliya Nachmani, Robin San Roman, and Lior Wolf. Denoising diffusion gamma models. arXiv preprint arXiv:2110.05948, 2021.
|
| 274 |
+
|
| 275 |
+
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.
|
| 276 |
+
|
| 277 |
+
Chitwan Saharia, William Chan, Huiwen Chang, Chris A Lee, Jonathan Ho, Tim Salimans, David J Fleet, and Mohammad Norouzi. Palette: Image-to-image diffusion models. arXiv preprint arXiv:2111.05826, 2021.
|
| 278 |
+
|
| 279 |
+
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.
|
| 280 |
+
|
| 281 |
+
Bahjat Kawar, Michael Elad, Stefano Ermon, and Jiaming Song. Denoising diffusion restoration models. arXiv preprint arXiv:2201.11793, 2022.
|
| 282 |
+
|
| 283 |
+
Ruihan Yang, Prakhar Srivastava, and Stephan Mandt. Diffusion probabilistic modeling for video generation. arXiv preprint arXiv:2203.09481, 2022.
|
| 284 |
+
|
| 285 |
+
Mohammad Babaeizadeh, Chelsea Finn, Dumitru Erhan, Roy H Campbell, and Sergey Levine. Stochastic variational video prediction. In International Conference on Learning Representations, 2018a.
|
| 286 |
+
|
| 287 |
+
Emily Denton and Rob Fergus. Stochastic video generation with a learned prior. In Proceedings of the 35th International Conference on Machine Learning, pages 1174–1183, 2018.
|
| 288 |
+
|
| 289 |
+
Lluís Castrejón, Nicolas Ballas, and Aaron C. Courville. Improved conditional vrnns for video prediction. ArXiv, abs/1904.12165, 2019.
|
| 290 |
+
|
| 291 |
+
Alex X. Lee, Richard Zhang, Frederik Ebert, Pieter Abbeel, Chelsea Finn, and Sergey Levine. Stochastic adversarial video prediction. ArXiv, abs/1804.01523, 2018.
|
| 292 |
+
|
| 293 |
+
Jean-Yves Franceschi, Edouard Delasalles, Mickaël Chen, Sylvain Lamprier, and Patrick Gallinari. Stochastic latent residual video prediction. In International Conference on Machine Learning, pages 3233–3246. PMLR, 2020.
|
| 294 |
+
|
| 295 |
+
Adil Kaan Akan, Erkut Erdem, Aykut Erdem, and Fatma Güney. Slamp: Stochastic latent appearance and motion prediction. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 14728–14737, 2021.
|
| 296 |
+
|
| 297 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Adv. Neural Inform. Process. Syst., volume 30, 2017.
|
| 298 |
+
|
| 299 |
+
Wilson Yan, Yunzhi Zhang, Pieter Abbeel, and Aravind Srinivas. Videogpt: Video generation using vq-vae and transformers. arXiv preprint arXiv:2104.10157, 2021.
|
| 300 |
+
|
| 301 |
+
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. Adv. Neural Inform. Process. Syst., 33:1877–1901, 2020.
|
| 302 |
+
|
| 303 |
+
Aaron Van Den Oord, Oriol Vinyals, et al. Neural discrete representation learning. Adv. Neural Inform. Process. Syst., 30, 2017.
|
| 304 |
+
|
| 305 |
+
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.
|
| 306 |
+
|
| 307 |
+
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.
|
| 308 |
+
|
| 309 |
+
Ruslan Rakhimov, Denis Volkhonskiy, Alexey Artemov, Denis Zorin, and Evgeny Burnaev. Latent video transformer. arXiv preprint arXiv:2006.10704, 2020.
|
| 310 |
+
|
| 311 |
+
Guillaume Le Moing, Jean Ponce, and Cordelia Schmid. Ccvs: Context-aware controllable video synthesis. Advances in Neural Information Processing Systems, 34, 2021.
|
| 312 |
+
|
| 313 |
+
Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. Advances in neural information processing systems, 29, 2016.
|
| 314 |
+
|
| 315 |
+
Ruben Villegas, Jimei Yang, Seunghoon Hong, Xunyu Lin, and Honglak Lee. Decomposing motion and content for natural video sequence prediction. In International Conference on Learning Representations, 2017.
|
| 316 |
+
|
| 317 |
+
Masaki Saito, Eiichi Matsumoto, and Shunta Saito. Temporal generative adversarial nets with singular value clipping. In Proceedings of the IEEE international conference on computer vision, pages 2830–2839, 2017.
|
| 318 |
+
|
| 319 |
+
Masaki Saito, Shunta Saito, Masanori Koyama, and Sosuke Kobayashi. Train sparsely, generate densely: Memory-efficient unsupervised training of high-resolution temporal gan. International Journal of Computer Vision, 128(10):2586–2606, 2020.
|
| 320 |
+
|
| 321 |
+
Sergey Tulyakov, Ming-Yu Liu, Xiaodong Yang, and Jan Kautz. Mocogan: Decomposing motion and content for video generation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1526–1535, 2018.
|
| 322 |
+
|
| 323 |
+
Vladyslav Yushchenko, Nikita Araslanov, and Stefan Roth. Markov decision process for video generation. In Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops, pages 0–0, 2019.
|
| 324 |
+
|
| 325 |
+
Sandra Aigner and Marco Körner. Futuregan: Anticipating the future frames of video sequences using spatio-temporal 3d convolutions in progressively growing gans. arXiv preprint arXiv:1810.01325, 2018.
|
| 326 |
+
|
| 327 |
+
Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. In Int. Conf. Learn. Represent., 2018.
|
| 328 |
+
|
| 329 |
+
Andres Munoz, Mohammadreza Zolfaghari, Max Argus, and Thomas Brox. Temporal shift gan for large scale video generation. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 3179–3188, 2021.
|
| 330 |
+
|
| 331 |
+
Pauline Luc, Aidan Clark, Sander Dieleman, Diego de Las Casas, Yotam Doron, Albin Cassirer, and Karen Simonyan. Transformation-based adversarial video prediction on large-scale data. arXiv preprint arXiv:2003.04035, 2020.
|
| 332 |
+
|
| 333 |
+
Sihyun Yu, Jihoon Tack, Sangwoo Mo, Hyunsu Kim, Junho Kim, Jung-Woo Ha, and Jinwoo Shin. Generating videos with dynamics-aware implicit generative adversarial networks. In International Conference on Learning Representations, 2022.
|
| 334 |
+
|
| 335 |
+
Simon Niklaus, Long Mai, and Feng Liu. Video frame interpolation via adaptive convolution. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 670–679, 2017.
|
| 336 |
+
|
| 337 |
+
Huaizu Jiang, Deqing Sun, Varun Jampani, Ming-Hsuan Yang, Erik Learned-Miller, and Jan Kautz. Super slomo: High quality estimation of multiple intermediate frames for video interpolation. In IEEE Conf. Comput. Vis. Pattern Recog., pages 9000–9008, 2018.
|
| 338 |
+
|
| 339 |
+
Tianfan Xue, Baian Chen, Jiajun Wu, Donglai Wei, and William T Freeman. Video enhancement with task-oriented flow. Int. J. Comput. Vis., 127(8):1106–1125, 2019.
|
| 340 |
+
|
| 341 |
+
Wenbo Bao, Wei-Sheng Lai, Chao Ma, Xiaoyun Zhang, Zhiyong Gao, and Ming-Hsuan Yang. Depthaware video frame interpolation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3703–3712, 2019.
|
| 342 |
+
|
| 343 |
+
Ren Yang, Fabian Mentzer, Luc Van Gool, and Radu Timofte. Learning for video compression with recurrent auto-encoder and recurrent probability model. IEEE Journal of Selected Topics in Signal Processing, 15(2):388–401, 2020.
|
| 344 |
+
|
| 345 |
+
Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017.
|
| 346 |
+
|
| 347 |
+
Jonathan Tompson, Ross Goroshin, Arjun Jain, Yann LeCun, and Christoph Bregler. Efficient object localization using convolutional networks. In IEEE Conf. Comput. Vis. Pattern Recog., pages 648–656, 2015.
|
| 348 |
+
|
| 349 |
+
Sébastien de Blois, Mathieu Garon, Christian Gagné, and Jean-François Lalonde. Input dropout for spatially aligned modalities. In IEEE Int. Conf. Image Process., pages 733–737, 2020.
|
| 350 |
+
|
| 351 |
+
Nitish Srivastava, Elman Mansimov, and Ruslan Salakhudinov. Unsupervised learning of video representations using lstms. In International conference on machine learning, pages 843–852. PMLR, 2015.
|
| 352 |
+
|
| 353 |
+
Christian Schuldt, Ivan Laptev, and Barbara Caputo. Recognizing human actions: a local svm approach. In Proceedings of the 17th International Conference on Pattern Recognition, 2004. ICPR 2004., volume 3, pages 32–36. IEEE, 2004.
|
| 354 |
+
|
| 355 |
+
Frederik Ebert, Chelsea Finn, Alex X Lee, and Sergey Levine. Self-supervised visual planning with temporal skip connections. In CoRL, pages 344–356, 2017.
|
| 356 |
+
|
| 357 |
+
Khurram Soomro, Amir Roshan Zamir, and Mubarak Shah. Ucf101: A dataset of 101 human actions classes from videos in the wild. arXiv preprint arXiv:1212.0402, 2012.
|
| 358 |
+
|
| 359 |
+
Xiaojie Gao, Yueming Jin, Qi Dou, Chi-Wing Fu, and Pheng-Ann Heng. Accurate grid keypoint learning for efficient video prediction. In 2021 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 5908–5915. IEEE, 2021.
|
| 360 |
+
|
| 361 |
+
Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In Advances in neural information processing systems, pages 6626–6637, 2017.
|
| 362 |
+
|
| 363 |
+
Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, Xi Chen, and Xi Chen. Improved techniques for training gans. In Advances in Neural Information Processing Systems, 2016.
|
| 364 |
+
|
| 365 |
+
Aidan Clark, Jeff Donahue, and Karen Simonyan. Adversarial video generation on complex datasets. arXiv preprint arXiv:1907.06571, 2019.
|
| 366 |
+
|
| 367 |
+
Chaochao Lu, Michael Hirsch, and Bernhard Scholkopf. Flexible spatio-temporal networks for video prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6523–6531, 2017.
|
| 368 |
+
|
| 369 |
+
Qiangeng Xu, Hanwang Zhang, Weiyue Wang, Peter Belhumeur, and Ulrich Neumann. Stochastic dynamics for video infilling. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 2714–2723, 2020.
|
| 370 |
+
|
| 371 |
+
Seiya Tokui, Ryosuke Okuta, Takuya Akiba, Yusuke Niitani, Toru Ogawa, Shunta Saito, Shuji Suzuki, Kota Uenishi, Brian Vogel, and Hiroyuki Yamazaki Vincent. Chainer: A deep learning framework for accelerating the research cycle. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 2002–2011, 2019.
|
| 372 |
+
|
| 373 |
+
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.
|
| 374 |
+
|
| 375 |
+
Mohammad Babaeizadeh, Chelsea Finn, Dumitru Erhan, Roy H. Campbell, and Sergey Levine. Stochastic variational video prediction. International Conference on Learning Representations, 2018b.
|
| 376 |
+
|
| 377 |
+
Matthias Minderer, Chen Sun, Ruben Villegas, Forrester Cole, Kevin P Murphy, and Honglak Lee. Unsupervised learning of object structure and dynamics from videos. Advances in Neural Information Processing Systems, 32, 2019.
|
| 378 |
+
|
| 379 |
+
Beibei Jin, Yu Hu, Qiankun Tang, Jingyu Niu, Zhiping Shi, Yinhe Han, and Xiaowei Li. Exploring spatial-temporal multi-frequency analysis for high-fidelity and temporal-consistency video prediction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4554–4563, 2020.
|
md/dev/luEG3j9LW5-/luEG3j9LW5-.md
ADDED
|
@@ -0,0 +1,432 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# BIDIRECTIONAL LEARNING FOR OFFLINE MODELBASED BIOLOGICAL SEQUENCE DESIGN
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Offline model-based optimization aims to maximize a black-box objective function with a static dataset of designs and their scores. In this paper, we focus on biological sequence design to maximize some sequence score. A recent approach employs bidirectional learning, combining a forward mapping for exploitation and a backward mapping for constraint, and it relies on the neural tangent kernel (NTK) of an infinitely wide network to build a proxy model. Though effective, the NTK cannot learn features because of its parametrization, and its use prevents the incorporation of powerful pre-trained Language Models (LMs) that can capture the rich biophysical information in millions of biological sequences. We adopt an alternative proxy model, adding a linear head to a pre-trained LM, and propose a linearization scheme. This yields a closed-form loss and also takes into account the biophysical information in the pre-trained LM. In addition, the forward mapping and the backward mapping play different roles and thus deserve different weights during sequence optimization. To achieve this, we train an auxiliary model and leverage its weak supervision signal via a bi-level optimization framework to effectively learn how to balance the two mappings. Further, by extending the framework, we develop the first learning rate adaptation module Adaptive- $\eta$ , which is compatible with all gradient-based algorithms for offline model-based optimization. Experimental results on DNA/protein sequence design tasks verify the effectiveness of our algorithm. Our code is available here.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Offline model-based optimization aims to maximize a black-box objective function with a static dataset of designs and their scores. This offline setting is realistic since in many real-world scenarios we do not have interactive access to the ground-truth evaluation. The design tasks of interest include material, aircraft, and biological sequence (Trabucco et al., 2021). In this paper, we focus on biological sequence design, including DNA sequence and protein sequence, with the goal of maximizing some specified property of these sequences.
|
| 12 |
+
|
| 13 |
+
A wide variety of methods have been proposed for biological sequence design, including evolutionary algorithms (Sinai et al., 2020; Ren et al., 2022), reinforcement learning methods (Angermueller et al., 2019), Bayesian optimization (Terayama et al., 2021), search/sampling using generative models (Brookes et al., 2019; Chan et al., 2021), and GFlowNets (Jain et al., 2022). Recently, gradient-based techniques have emerged as an effective alternative (Trabucco et al., 2021). These approaches first train a deep neural network (DNN) on the static dataset as a proxy and then obtain the new designs by directly performing gradient ascent steps on the existing designs. Such methods have been widely used in biological sequence design (Norn et al., 2021; Tischer et al., 2020; Linder & Seelig, 2020). One obstacle is the out-of-distribution issue, where the trained proxy model is inaccurate for the newly generated sequences.
|
| 14 |
+
|
| 15 |
+
To mitigate the out-of-distribution issue, recent work proposes regularization of the model (Trabucco et al., 2021; Yu et al., 2021; Fu & Levine, 2021) or the design itself (Chen et al., 2022). The first category focuses on training a better proxy by introducing inductive biases such as robustness (Yu et al., 2021). The second category introduces bidirectional learning (Chen et al., 2022), which consists of a forward mapping and a backward mapping, to optimize the design directly. Specifically, the backward mapping leverages the high-scoring design to predict the static dataset and vice versa for the forward mapping, which distills the information of the static dataset into the high-scoring design. This approach achieves state-of-the-art performances on a variety of tasks. Though effective, the proposed bidirectional learning relies on the neural tangent kernel (NTK) of an infinite-width model to yield a closed-form loss, which is a key component of its successful operation. The NTK cannot learn features due to its parameterization (Yang & Hu, 2021) and thus the bidirectional learning cannot incorporate the wealth of biophysical information from Language Models (LMs) pre-trained over a vast corpus of unlabelled sequences (Elnaggar et al., 2021; Ji et al., 2021).
|
| 16 |
+
|
| 17 |
+
To solve this issue, we construct a proxy model by combining a finite-width pre-trained LM with an additional layer. We then linearize the resultant proxy model, inspired by the recent progress in deep linearization (Achille et al., 2021; Dukler et al., 2022). This scheme not only yields a closed-form loss but also exploits the rich biophysical information that has been distilled in the pre-trained LM. In addition, the forward mapping encourages exploitation in the sequence space and the backward mapping serves as a constraint to mitigate the out-of-distribution issue. It is important to maintain an appropriate balance between exploitation and constraint, and this can vary across design tasks as well as during the optimization process. We introduce a hyperparameter $\gamma$ to control the balance, and develop a bi-level optimization framework Adaptive- $\gamma$ . In this framework, we train an auxiliary model and leverage its weak supervision signal to effectively update $\gamma$ . To sum up, we propose BIdirectional learning for model-based Biological sequence design (BIB). Last but not least, since the offline nature prohibits standard cross-validation strategies for hyperparameter tuning, all gradient-based offline model-based algorithms preset the learning rate $\eta$ . There is a danger of a poor selection, and to address this, we propose to extend Adaptive- $\gamma$ to Adaptive- $\eta$ , which effectively adapts the learning rate $\eta$ via the weak supervision signal from the trained auxiliary model. To the best of our knowledge, Adaptive- $\eta$ is the first learning rate adaptation module for gradient-based algorithms on offline model-based optimization. Experiments on DNA and protein sequence design tasks verify the effectiveness of BIB and Adaptive- $\eta$ .
|
| 18 |
+
|
| 19 |
+
To summarize, our contributions are three-fold:
|
| 20 |
+
|
| 21 |
+
• Instead of adopting the NTK, we propose to construct a proxy model by combining a pre-trained biological LM with an additional trainable layer. We then linearize the proxy model, leveraging the recent progress on deep linearization. This yields a closed-form loss computation in bidirectional learning and allows us to exploit the rich biophysical information distilled into the LM via pretraining over millions of biological sequences.
|
| 22 |
+
• We propose a bi-level optimization framework Adaptive- $\gamma$ where we leverage weak signals from an auxiliary model to achieve a satisfactory trade-off between exploitation and constraint.
|
| 23 |
+
• We further extend this bi-level optimization framework to Adaptive- $\eta$ . As the first learning rate tuning scheme in offline model-based optimization, Adaptive- $\eta$ allows learning rate adaptation for any gradient-based algorithm.
|
| 24 |
+
|
| 25 |
+
# 2 PRELIMINARIES
|
| 26 |
+
|
| 27 |
+
# 2.1 OFFLINE MODEL-BASED OPTIMIZATION
|
| 28 |
+
|
| 29 |
+
Offline model-based optimization aims to find a design $\boldsymbol { X }$ to maximize some unknown objective $f ( X )$ . This can be formally written as,
|
| 30 |
+
|
| 31 |
+
$$
|
| 32 |
+
X ^ { * } = \arg \operatorname* { m a x } _ { X } f ( X ) ,
|
| 33 |
+
$$
|
| 34 |
+
|
| 35 |
+
where we have access to a size- $N$ dataset $\mathcal { D } = \{ ( \boldsymbol { X } _ { 1 } , \boldsymbol { y } _ { 1 } ) \} , \cdot \cdot \cdot , \{ ( \boldsymbol { X } _ { N } , \boldsymbol { y } _ { N } ) \}$ with $X _ { i }$ representing a certain design and $y _ { i }$ denoting the design score. In this paper, $X _ { i }$ represents a biological sequence design, including DNA and protein sequences, and $y _ { i }$ represents a property of the biological sequence such as the fluorescence level of the green fluorescent protein (Sarkisyan et al., 2016).
|
| 36 |
+
|
| 37 |
+
# 2.2 BIOLOGICAL SEQUENCE REPRESENTATION
|
| 38 |
+
|
| 39 |
+
Following (Norn et al., 2021; Killoran et al., 2017; Linder & Seelig, 2021), we adopt the positionspecific scoring matrix to represent a length- $L$ protein sequence as $\breve { X } \in \mathbb { R } ^ { L \times 2 0 }$ , where 20 represents 20 different kinds of amino acids. For a real-world protein sequence, $X [ l , : ] \ : ( 0 \leq l \leq L - 1 )$ i s a
|
| 40 |
+
|
| 41 |
+

|
| 42 |
+
Figure 1: Illustration of bidirectional learning Chen et al. (2022) where $( X _ { l } , y _ { l } )$ denotes the static dataset, $y _ { h }$ is a large predefined target score and $X _ { h }$ is the high-scoring design we aim to find.
|
| 43 |
+
|
| 44 |
+
one-hot vector denoting one kind of amino acid. During optimization, $X [ l , : ]$ is a continuous vector and $s o f t m a x ( X [ l , : ] )$ represents the probability distribution of all 20 amino acids in the position $l$ . Similarly, for a DNA sequence, we have $\pmb { X } \in \tilde { \mathbb { R } ^ { L \times 4 } }$ where 4 represents 4 different DNA bases.
|
| 45 |
+
|
| 46 |
+
The protein sequence $\boldsymbol { X }$ is fed into the embedding layer of the LM, which produces the embedding,
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
\pmb { e } = E M B ( s o f t m a x ( \pmb { X } ) ) .
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
The main block of the LM takes $e$ as input and outputs biophysical features. The DNA LM, which adopts the $k$ -mer representation, is a little different from protein LMs. See Appendix A.1 for details.
|
| 53 |
+
|
| 54 |
+
# 2.3 GRADIENT ASCENT ON SEQUENCE
|
| 55 |
+
|
| 56 |
+
A common approach to the posed offline model-based optimization problem is to train a proxy $f _ { \pmb { \theta } } ( \pmb { X } )$ on the offline dataset,
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
\pmb { \theta } ^ { * } = \arg \operatorname* { m i n } _ { \pmb { \theta } } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } ( f _ { \pmb { \theta } } ( X _ { i } ) - y _ { i } ) ^ { 2 } .
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
Then we can obtain the high-scoring design $X _ { h }$ by $T$ gradient ascent steps:
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
{ \mathbf { } } X _ { t + 1 } = X _ { t } + \eta \nabla _ { { \mathbf { } } X } f _ { \theta ^ { * } } ( X ) | _ { X = X _ { t } } , \quad { \mathrm { f o r ~ } } t \in [ 0 , T - 1 ] ,
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
where the high-scoring design $X _ { h }$ can be obtained as $X _ { T }$ .
|
| 69 |
+
|
| 70 |
+
Considering the discrete nature of biological sequences, the input of $f _ { \theta } ( \cdot )$ should be discrete one-hot vectors. Following (Norn et al., 2021), we can perform the conversion and predict the score via:
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
\begin{array} { r l } & { \hat { X } _ { i } = s o f t m a x ( { X } _ { i } ) , } \\ & { \quad { Z } _ { i } = o n e h o t ( a r g m a x ( \hat { X } _ { i } ) ) , } \\ & { \quad \hat { y } = f _ { \pmb { \theta } } ( { Z } _ { i } ) . } \end{array}
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
Then the gradient regarding $X _ { i }$ can be approximated as,
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\frac { d f _ { \pmb \theta } ( Z _ { i } ) } { d { \pmb x } _ { i } } \approx \frac { d f _ { \pmb \theta } ( Z _ { i } ) } { d z _ { i } } \frac { d \hat { \pmb x } _ { i } } { d { \pmb x } _ { i } } ,
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where we unroll the matrices $X _ { i } , \hat { X } _ { i }$ and $\boldsymbol { Z } _ { i }$ as vectors $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ , $\hat { \mathbf { x } } _ { i }$ and $z _ { i }$ for notational convenience. This approximation allows us to use backpropagation directly from the proxy to the sequence design $X _ { i }$ . For brevity, we will still use $f _ { \pmb { \theta } } ( \pmb { X } _ { i } )$ to represent the proxy.
|
| 83 |
+
|
| 84 |
+
# 2.4 BIDIRECTIONAL LEARNING
|
| 85 |
+
|
| 86 |
+
As shown in Figure 1, bidirectional learning (Chen et al., 2022), consists of two mappings: the forward mapping leverages the static dataset $\cdot$ to predict the score $\cdot$ of the high-scoring
|
| 87 |
+
|
| 88 |
+
design $\cdot$ , and the backward mapping leverages the high-scoring design data $( X _ { h } , y _ { h } )$ to predict the static dataset $( X _ { l } , y _ { l } )$ . The forward mapping loss can be written as
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
\mathcal { L } _ { l 2 h } ( \boldsymbol { X } _ { h } ) = \| \boldsymbol { y } _ { h } - \boldsymbol { f } _ { \theta ^ { * } } ^ { l } ( \boldsymbol { X } _ { h } ) \| ^ { 2 } ,
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
where $\cdot$ is given by
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
-
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
where $\cdot$ is a regularization parameter. The backward mapping loss can be written as
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\mathcal { L } _ { h 2 l } ( \boldsymbol { X } _ { h } ) = \| \boldsymbol { y } _ { l } - f _ { \theta ^ { * } ( \boldsymbol { X } _ { h } ) } ^ { h } ( \boldsymbol { X } _ { l } ) \| ^ { 2 } ,
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
where $\cdot$ is given by
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
-
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
The high-scoring design $\cdot$ can be optimized by minimizing the bidirectional learning loss $\mathcal { L } ( X _ { h } ) =$ $\mathcal { L } _ { l 2 h } ( X _ { h } ) + \mathcal { L } _ { h 2 l } ( X _ { h } )$ .
|
| 113 |
+
|
| 114 |
+
# 3 METHOD
|
| 115 |
+
|
| 116 |
+
In this section, we first illustrate how to leverage deep linearization to compute the bidirectional learning loss in a closed form. Subsequently, we introduce a hyperparameter $\gamma$ to control the balance between the forward mapping and the backward mapping. We then develop a novel bi-level optimization framework Adaptive- $\gamma$ , which leverages a weak supervision signal from an auxiliary model to effectively update $\gamma$ . Last but not least, we extend this framework to Adaptive- $\eta$ , which enables us to adapt the learning rate $\eta$ for all gradient-based offline model-based algorithms. We summarize our method in Algorithm 1.
|
| 117 |
+
|
| 118 |
+
# 3.1 DEEP LINEARIZATION FOR BIDIRECTIONAL LEARNING
|
| 119 |
+
|
| 120 |
+
In bidirectional learning, the backward mapping loss is intractable for a finite neural network, so Chen et al. (2022) employ a neural network with infinite width, which yields a closed-form loss via the NTK. This however makes it impossible to incorporate the rich biophysical information that has been distilled into a pre-trained LM (Yang & Hu, 2021). Considering this, we construct a proxy model by combining a finite-width pre-trained LM with an additional layer. We then linearize the resultant proxy model, inspired by the recent progress in deep linearization which has established that an overparameterized DNN model is close to its linearization (Achille et al., 2021; Dukler et al., 2022).
|
| 121 |
+
|
| 122 |
+
Denote by $\pmb { \theta _ { 0 } } = ( \pmb { \theta _ { p t } } , \pmb { \theta _ { i n i t } ^ { l i n } } ) \in \mathcal { R } ^ { D \times 1 }$ the proxy model parameters derived by combining the parameters of the pre-trainedpaper, we adopt the pre-traine $\operatorname { L M } \theta _ { p t }$ and a random initialization of the linear layer ERT (Ji et al., 2021) and Prot-BERT (Elnagga $\theta _ { i n i t } ^ { l i n }$ . In thisl., 2021) models, and compute the average of token embeddings as the extracted feature, which is fed into the linear layer to build the proxy. Then we can construct a linear approximation for the proxy model:
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
f _ { \pmb \theta } ( \pmb X ) \approx f _ { \pmb \theta _ { 0 } } ( \pmb X ) + \nabla \pmb \theta \ = f _ { \pmb \theta _ { 0 } } ( \pmb X ) \cdot ( \pmb \theta - \pmb \theta _ { 0 } ) ,
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
where $f _ { \theta } ( X ) , f _ { \theta _ { 0 } } ( X ) \in \mathcal { R } , \bigtriangledown _ { \theta } f _ { \theta _ { 0 } } ( X ) \in \mathcal { R } ^ { 1 \times L }$ and $\_$ . Intuitively, if the fine-tuning does not significantly change $\pmb { \theta _ { 0 } }$ , then this linearization is a good approximation. By leveraging this linearization, we can obtain a closed-form solution for Eq.(12) as:
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
\pmb { \theta } ^ { \ast } ( \pmb { X } _ { h } ) = ( \nabla \theta f _ { \theta _ { 0 } } ( \pmb { X } _ { h } ) ^ { \top } \nabla \theta ~ f _ { \theta _ { 0 } } ( \pmb { X } _ { h } ) + \beta \pmb { I } ) ^ { - 1 } \nabla \theta ~ f _ { \theta _ { 0 } } ( \pmb { X } _ { h } ) \top ( y _ { h } - f _ { \theta _ { 0 } } ( \pmb { X } _ { h } ) ) + \theta _ { 0 } .
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
Building on this result, we can compute the bidirectional learning loss as:
|
| 135 |
+
|
| 136 |
+
$$
|
| 137 |
+
\begin{array} { l } { \displaystyle \mathcal { L } _ { b i } ( \pmb { X } _ { h } ) = \frac { 1 } { 2 } ( \| y _ { h } - \pmb { K } _ { X _ { h } X _ { l } } ( \pmb { K } _ { X _ { l } X _ { l } } + \beta \pmb { I } ) ^ { - 1 } ( y _ { l } - f _ { \pmb { \theta _ { 0 } } } ( \pmb { X } _ { l } ) ) \| ^ { 2 } } \\ { \displaystyle + \| y _ { l } - \pmb { K } _ { X _ { l } X _ { h } } ( \pmb { K } _ { X _ { h } X _ { h } } + \beta \pmb { I } ) ^ { - 1 } ( y _ { h } - f _ { \pmb { \theta _ { 0 } } } ( \pmb { X } _ { h } ) ) \| ^ { 2 } ) , } \end{array}
|
| 138 |
+
$$
|
| 139 |
+
|
| 140 |
+
where $K ( X _ { i } , X _ { j } ) = \bigtriangledown \theta \ f _ { \theta _ { 0 } } ( X _ { i } ) \top \bigtriangledown \theta \ f _ { \theta _ { 0 } } ( X _ { j } )$ . Following (Dukler et al., 2022), we can also only linearize the last layer of the network for simplicity, which defines the following kernel,
|
| 141 |
+
|
| 142 |
+
$$
|
| 143 |
+
\begin{array} { r } { K ( X _ { i } , X _ { j } ) = B E R T ( X _ { i } ) ^ { \top } B E R T ( X _ { j } ) , } \end{array}
|
| 144 |
+
$$
|
| 145 |
+
|
| 146 |
+
where $B E R T ( \pmb { X } )$ denotes the feature of the sequence $\boldsymbol { X }$ extracted by BERT. Its kernel nature makes this approach suitable for small-data tasks (Arora et al., 2020), especially in drug discovery where the labeling cost of DNA/proteins is high.
|
| 147 |
+
|
| 148 |
+
Algorithm 1 Bidirectional Learning for Offline Model-based Biological Sequence Design
|
| 149 |
+
|
| 150 |
+
<table><tr><td>Input: Static dataset D =(Xt, yt),predefined target score yh = 1O, # of iterations T, pre-trained biological LM parameterized by 0o,auxiliary model faux(*),regularization /β. Output: High-scoring design X*.</td></tr><tr><td>1: Initialize Xo as the sequence with the highest score in D</td></tr><tr><td>2: forT←0toT-1do</td></tr><tr><td>3: Leverage Adaptive-γ in Sec 3.2 to update the balance γ by Eq. (21)</td></tr><tr><td>4: if Adapt learning rate then</td></tr><tr><td>5: Leverage Adaptive-n in Sec 3.3 to update the learning rate η by Eq. (23)</td></tr><tr><td>6: Optimize X by minimizing the bidirectional learning loss Lbi(X,,γ) in Eq. (17): 7:</td></tr><tr><td>Xr+1= X,-nOPT(VxLbi(X.,γ)) 8: Return X* = XT</td></tr></table>
|
| 151 |
+
|
| 152 |
+
# 3.2 ADAPTIVE- $\gamma$
|
| 153 |
+
|
| 154 |
+
The forward mapping and the backward mapping play different roles in the sequence optimization process: the forward mapping encourages the high-scoring sequence to search for a higher target score (exploitation) and the backward mapping serves as a constraint. Since different sequences require different degrees of constraint, we introduce an extra hyperparameter $\gamma \in [ 0 , 1 ]$ to control the balance between the corresponding terms in the loss function:
|
| 155 |
+
|
| 156 |
+
$$
|
| 157 |
+
\mathcal { L } _ { b i } ( \boldsymbol { X } _ { h } , \gamma ) = \gamma \mathcal { L } _ { l 2 h } ( \boldsymbol { X } _ { h } ) + ( 1 - \gamma ) \mathcal { L } _ { h 2 l } ( \boldsymbol { X } _ { h } ) .
|
| 158 |
+
$$
|
| 159 |
+
|
| 160 |
+
Thus $\gamma = 1 . 0$ corresponds to the forward mapping alone, $\gamma = 0$ results in backward mapping, and $\gamma = 0 . 5$ leads to the bidirectional loss of (Chen et al., 2022).
|
| 161 |
+
|
| 162 |
+
It is non-trivial to determine the most suitable value for $\gamma$ since we do not know the ground-truth score for a new design. One possible solution is to train an auxiliary $f _ { a u x } ( \cdot )$ to serve as a proxy evaluation. A reasonable auxiliary is a simple regression model fitted to the offline dataset. Although this auxiliary model cannot yield ground-truth scores, it can provide weak supervision signals to update $\gamma$ , since the auxiliary model and the bidirectional learning provide complementary information. This is similar to co-teaching (Han et al., 2018) where two models leverage each other’s view.
|
| 163 |
+
|
| 164 |
+
Formally, we introduce the Adaptive- $\gamma$ framework. Given a good choice of $\gamma$ , the produced $X _ { h }$ is expected to have a high score $f _ { a u x } ( \pmb { X } _ { h } )$ , based on which we can choose $\gamma$ . To make the search for $\gamma$ more efficient, we can formulate this process as a bi-level optimization problem:
|
| 165 |
+
|
| 166 |
+
$$
|
| 167 |
+
\begin{array} { r } { \gamma ^ { * } = \underset { \gamma } { \arg \operatorname* { m a x } } f _ { a u x } \big ( X _ { h } ^ { * } ( \gamma ) \big ) , \ } \\ { \mathrm { s . t . } \quad X _ { h } ^ { * } ( \gamma ) = \underset { X _ { h } } { \arg \operatorname* { m i n } } \mathcal { L } _ { b i } \big ( X _ { h } , \gamma \big ) . \ } \end{array}
|
| 168 |
+
$$
|
| 169 |
+
|
| 170 |
+
We can then use the hyper-gradient $\frac { \partial f _ { a u x } ( \pmb { X } _ { h } ^ { * } ( \gamma ) ) } { \partial \gamma }$ to update $\gamma$ . Specifically, the inner level solution can be approximated via a gradient descent step with a learning rate $\eta$ :
|
| 171 |
+
|
| 172 |
+
$$
|
| 173 |
+
\mathbf { } X _ { h } ^ { * } ( \gamma ) = X _ { h } - \eta \frac { d \mathcal { L } _ { b i } ( X _ { h } , \gamma ) } { d X _ { h } ^ { \top } } .
|
| 174 |
+
$$
|
| 175 |
+
|
| 176 |
+
For the outer level, we update $\gamma$ by hyper-gradient ascent:
|
| 177 |
+
|
| 178 |
+
$$
|
| 179 |
+
\gamma = \gamma + \eta ^ { ' } \frac { d f _ { a u x } ( \pmb { X } _ { h } ^ { * } ( \gamma ) ) } { d \gamma } = \gamma + \eta ^ { ' } \frac { d f _ { a u x } ( \pmb { X } _ { h } ) } { d \pmb { x } _ { h } } \frac { d \mathcal { L } _ { b i } ( \pmb { X } _ { h } , \gamma ) } { d \pmb { x } _ { h } ^ { \top } } ,
|
| 180 |
+
$$
|
| 181 |
+
|
| 182 |
+
where we unroll the matrix $X _ { h }$ as a vector $\scriptstyle { \mathbf { 2 } } \mathbf { } \boldsymbol { { k } } _ { h }$ for better illustration.
|
| 183 |
+
|
| 184 |
+
# 3.3 ADAPTIVE- $\eta$
|
| 185 |
+
|
| 186 |
+
We now extend the Adaptive- $\gamma$ framework to Adaptive- $\eta$ . As the first learning rate adaptation module for offline model-based optimization, Adaptive- $\eta$ is compatible with all gradient-based algorithms and can effectively finetune the learning rate $\eta$ via the auxiliary model’s weak supervision signal. All gradient-based methods that maximize $\mathcal { L } _ { \boldsymbol { \theta } } ( X )$ with respect to $\boldsymbol { X }$ have the following general form:
|
| 187 |
+
|
| 188 |
+
$$
|
| 189 |
+
X _ { t + 1 } = X _ { t } + \eta O P T ( \nabla _ { X } \mathcal { L } _ { \theta } ( X ) | _ { X = X _ { t } } ) , \quad \mathrm { f o r } t \in [ 0 , \mathrm { T } - 1 ] ,
|
| 190 |
+
$$
|
| 191 |
+
|
| 192 |
+
where $\eta$ represents the learning rate of the optimizer. For methods such as simple gradient ascent (Grad), COMs (Trabucco et al., 2021), ROMA ( $\mathrm { Y u }$ et al., 2021) and NEMO (Fu & Levine, 2021), $\mathcal { L } _ { \boldsymbol { \theta } } ( \cdot )$ is related to the proxy model $f _ { \theta } ( \cdot )$ ; for BDI Chen et al. (2022) and our proposed method, BIB, $\mathcal { L } _ { \boldsymbol { \theta } } ( \cdot )$ is the negative of the bidirectional learning loss, i.e., $\mathcal { L } _ { \theta } = - \mathcal { L } _ { b i }$ .
|
| 193 |
+
|
| 194 |
+
Though the learning rate $\eta$ can be adapted in some optimizers such as Adam (Kingma & Ba, 2015), these adaptations rely on only the past optimization history and do not consider the weak supervision signal from the auxiliary model. Our Adaptive- $\eta$ optimizes $\eta$ by solving:
|
| 195 |
+
|
| 196 |
+
$$
|
| 197 |
+
\eta ^ { * } = \arg \operatorname* { m a x } _ { \eta } f _ { a u x } ( X _ { h } ^ { * } ( \eta ) ) ,
|
| 198 |
+
$$
|
| 199 |
+
|
| 200 |
+
where $\eta$ can be updated via gradient ascent methods. Considering the sequence optimization procedure is highly sensitive to the learning rate $\eta$ , we reset $\eta$ to $\eta _ { 0 }$ at each iteration and update $\eta$ from $\eta _ { 0 }$ ,
|
| 201 |
+
|
| 202 |
+
$$
|
| 203 |
+
\eta = \eta _ { 0 } - \eta ^ { ' } \frac { d f _ { a u x } ( X _ { h } ^ { * } ( \eta ) ) } { d \eta } .
|
| 204 |
+
$$
|
| 205 |
+
|
| 206 |
+
In general, this serves to stabilize the optimization procedure.
|
| 207 |
+
|
| 208 |
+
# 4 EXPERIMENTS
|
| 209 |
+
|
| 210 |
+
We conduct extensive experiments on DNA and protein design tasks, and aim to answer three research questions: (1) How does BIB compare with state-of-the-art algorithms? (2) Is every design component necessary in BIB? (3) Does the Adaptive- $\eta$ module improve gradient-based methods?
|
| 211 |
+
|
| 212 |
+
# 4.1 BENCHMARK
|
| 213 |
+
|
| 214 |
+
We conduct experiments on two DNA tasks: TFBind8(r) and TFBind10(r), following (Chen et al., 2022) and three protein tasks: avGFP, AAV and E4B, in (Ren et al., 2022) which have the most data points. See See Appendix A.2 for details.
|
| 215 |
+
|
| 216 |
+
Following (Trabucco et al., 2021), we select the top $N = 1 2 8$ most promising sequences for each comparison method. Among these sequences, we report the maximum normalized ground truth score as the evaluation metric following (Ren et al., 2022).
|
| 217 |
+
|
| 218 |
+
# 4.2 COMPARISON METHODS
|
| 219 |
+
|
| 220 |
+
We compare BIB with two groups of baselines: the gradient-based methods and the non-gradientbased methods. For a fair comparison, the pre-trained LM is used for all methods involving a proxy and we don’t finetune the LM. The gradient-based methods include: 1) Grad: gradient ascent on existing sequences to obtain new sequences; 2) COMs (Trabucco et al., 2021): lower bounds the DNN model by the ground-truth values and then applies gradient ascent; 3) ROMA (Yu et al., 2021): incorporates a smoothness prior into the DNN model before gradient ascent steps; 4) NEMO (Fu & Levine, 2021): leverages the normalized maximum-likelihood estimator to bound the distance between the DNN model and the ground-truth values; 5) BDI (Chen et al., 2022): adopts the infinitely wide neural network and its NTK to yield a closed-form bidirectional learning loss.
|
| 221 |
+
|
| 222 |
+
The non-gradient-based methods include: 1) BO-qEI (Wilson et al., 2017): builds an acquisition function for sequence exploration; 2) CMA-ES (Hansen, 2006): estimates the covariance matrix to adjust the sequence distribution towards the high-scoring region; 3) AdaLead (Sinai et al., 2020): performs a hill-climbing search on the proxy and then queries the sequences with high predictions; 4) CbAS (Brookes et al., 2019): builds a generative model for sequences above a property threshold and gradually adapts the distribution by increasing the threshold; 5) PEX (Ren et al., 2022): prioritizes the evolutionary search for protein sequences with low mutation counts; 6) GENH (Chan et al., 2021): enhances the score through a learned latent space.
|
| 223 |
+
|
| 224 |
+
# 4.3 TRAINING DETAILS
|
| 225 |
+
|
| 226 |
+
We follow the training setting in (Chen et al., 2022) if not specified. We choose $O P T$ as the Adam optimizer (Kingma & Ba, 2015) for all gradient-based methods. We implement the auxiliary model
|
| 227 |
+
|
| 228 |
+
Table 1: Experimental results (maximum normalized ground truth score) for comparison.
|
| 229 |
+
|
| 230 |
+
<table><tr><td>Method</td><td>TFBind8(r)</td><td>TFBind10(r)</td><td>avGFP</td><td>AAV</td><td>E4B</td><td>RankMean</td><td>RankMedian</td></tr><tr><td>D(best)</td><td>0.242</td><td>0.248</td><td>0.742</td><td>0.452</td><td>0.224</td><td></td><td></td></tr><tr><td>BO-qEI</td><td>0.940 ±0.032</td><td>0.595 ±0.028</td><td>1.700 ± 0.020</td><td>0.591 ± 0.002</td><td>0.436±0.004</td><td>6.0/12</td><td>7.0/12</td></tr><tr><td>CMA-ES</td><td>0.930 ±0.034</td><td>0.617±0.031</td><td>5.488 ± 0.056</td><td>0.470±0.006</td><td>0.748 ± 0.009</td><td>6.0/12</td><td>6.0/12</td></tr><tr><td>AdaLead</td><td>0.941 ± 0.032</td><td>0.602±0.028</td><td>1.611 ± 0.009</td><td>0.581 ± 0.002</td><td>0.433 ± 0.003</td><td>6.2/12</td><td>8.0/12</td></tr><tr><td>CbAS</td><td>0.878± 0.049</td><td>0.610 ±0.035</td><td>1.371 ± 0.016</td><td>0.543± 0.002</td><td>0.349 ± 0.003</td><td>8.6/12</td><td>10.0/12</td></tr><tr><td>PEX</td><td>0.924 ± 0.041</td><td>0.612 ± 0.026</td><td>1.546 ± 0.019</td><td>0.588±0.002</td><td>0.397 ± 0.004</td><td>7.2/12</td><td>8.0/12</td></tr><tr><td>GENH</td><td>0.323 ± 0.000</td><td>0.448 ±0.000</td><td>0.835 ±0.000</td><td>0.452 ± 0.000</td><td>0.228 ±0.000</td><td>11.4/12</td><td>11.0/12</td></tr><tr><td>Grad</td><td>0.941±0.026</td><td>0.630±0.029</td><td>4.869± 0.042</td><td>0.463±0.005</td><td>1.219 ± 0.061</td><td>4.8/12</td><td>4.0/12</td></tr><tr><td>COMs</td><td>0.921 ± 0.039</td><td>0.637 ± 0.065</td><td>3.873±0.080</td><td>0.511 ± 0.005</td><td>0.829 ± 0.026</td><td>5.6/12</td><td>5.0/12</td></tr><tr><td>ROMA</td><td>0.926 ± 0.032</td><td>0.634±0.061</td><td>5.621 ± 0.143</td><td>0.471 ± 0.005</td><td>1.198 ± 0.042</td><td>4.8/12</td><td>4.0/12</td></tr><tr><td>NEMO</td><td>0.930 ±0.038</td><td>0.632 ±0.024</td><td>4.624 ± 0.087</td><td>0.505 ± 0.005</td><td>1.036 ± 0.046</td><td>5.0/12</td><td>5.0/12</td></tr><tr><td>BDI</td><td>0.823 ± 0.000</td><td>0.678 ±0.000</td><td>0.742 ± 0.000</td><td>0.452 ±0.000</td><td>0.224 ± 0.000</td><td>9.4/12</td><td>11.0/12</td></tr><tr><td>BIB(ours)</td><td>0.952±0.033</td><td>0.639±0.032</td><td>8.084±0.224</td><td>0.501±0.007</td><td>1.255 ± 0.029</td><td>2.4/12</td><td>1.0/12</td></tr></table>
|
| 231 |
+
|
| 232 |
+
as a linear layer with the feature from the pre-trained LM. We set the number of iterations $T$ as 25 for all experiments following (Norn et al., 2021) and $\eta _ { 0 }$ as 0.1 following (Chen et al., 2022). We run every setting over 16 trials and report the average score. See Appendix A.3 for other details.
|
| 233 |
+
|
| 234 |
+
# 4.4 RESULTS AND ANALYSIS
|
| 235 |
+
|
| 236 |
+
We report all experimental results in Table 1 and plot the ranking statistics in Figure 2. We make the following observations. (1) As shown in Table 1, BIB consistently outperforms the Grad method on all tasks, which demonstrates that our BIB can effectively mitigate the out-of-distribution issue. (2) Furthermore, BIB outperforms BDI on 4 out of 5 tasks, which demonstrates the effectiveness of the pre-trained biological LM over NTK. The reason why BDI outperforms BIB on TFBind10(r) may be that short sequences do not rely much on the rich sequential information from the pre-trained LM. (3) As shown in Figure 2, the gradient-based methods generally perform better than the non-gradient-based methods, as also observed by Trabucco et al. (2021). (4) The gradient-based methods are inferior for the AAV task.
|
| 237 |
+
|
| 238 |
+
One possible reason is that the design space of AAV $( 2 0 ^ { 2 8 } )$ is much smaller than those of avGFP $( 2 0 ^ { \overline { { 2 3 9 } } } )$ and E4B $( 2 0 ^ { 1 0 2 } )$ ), which makes the generative modeling and evolutionary algorithms more suitable. (5) This conjecture is also supported by the experimental results on two DNA design tasks. We compute the average ranking of gradient-based methods and non-grad-based methods on TFBind10(r) as 3.5 and 9.5, respectively, and the average ranking of gradient-based methods and non-grad-based methods on TFBind8(r) as 5.8 and 6.8, respectively. The advantage of gradient-based methods are larger $\_$ ) in TFBind10(r) than that $( 6 . 8 - 5 . 8 = 1 . 0 $ ) in TFBind8(r). (6) The generative modeling methods CbAS and GENH yield poor results on all tasks, probably because the high-dimensional data distribution is very hard to model. (7) Overall, BIB attains the best performance in 3 out of 5 tasks and achieves the best ranking results as shown in Table 1 and Figure 2.
|
| 239 |
+
|
| 240 |
+

|
| 241 |
+
Figure 2: Rank minima and maxima are represented by whiskers; vertical lines and black triangles denote medians and means.
|
| 242 |
+
|
| 243 |
+
We also visualize the trend of performance (the maximum normalized ground truth score) and tradeoff $\gamma$ as a function of $T$ on TFBind8(r) in Figure 3(a) and avGFP in Figure 3(b). The performance generally increases with the time step $T$ and then stabilizes, which demonstrates the effectiveness and robustness of BIB. Furthermore, we find that the $\gamma$ values of TFBind8(r) and avGFP generally increase at first. This means that BIB reduces the impact of the constraint to encourage a more aggressive search for a high target value during the initial phase. Then $\gamma$ of TFBind8(r) continues to increase while the $\gamma$ of avGFP decreases. We conjecture that the difference is caused by the sequence length. Small mutations of a biological sequence are enough to yield a good candidate (Ren et al., 2022). For the length-239 protein in avGFP, dramatic mutations 1) are not necessary and 2) can easily lead to out-of-distribution points. The weak supervision signal from the auxiliary model therefore encourages a tighter constraint towards the static dataset. By contrast, the DNA sequence is relatively short and a more widespread search of the sequence space can yield better results. To investigate this conjecture, we further visualize the trend of E4B in Figure 3(c). E4B also has long sequences (102) and we can observe its similar first-increase-then-decrease trend, although it is not as pronounced.
|
| 244 |
+
|
| 245 |
+

|
| 246 |
+
Figure 3: Trend of performance and trade-off $\gamma$ as a function of $T$ .
|
| 247 |
+
|
| 248 |
+
Table 2: Ablation studies on BIB components.
|
| 249 |
+
|
| 250 |
+
<table><tr><td>Task</td><td>γ=0.0</td><td>γ=1.0</td><td>γ=0.5</td><td>γ=0.5+Joint</td><td>BIB</td><td>BIB +Ada-n</td></tr><tr><td>TFBind8(r)</td><td>0.936</td><td>0.933</td><td>0.947</td><td>0.935</td><td>0.952</td><td>0.956</td></tr><tr><td>TFBind10(r)</td><td>0.611</td><td>0.637</td><td>0.616</td><td>0.622</td><td>0.639</td><td>0.639</td></tr><tr><td>avGFP</td><td>6.051</td><td>7.588</td><td>7.940</td><td>7.920</td><td>8.084</td><td>8.197</td></tr><tr><td>AAV</td><td>0.449</td><td>0.458</td><td>0.480</td><td>0.420</td><td>0.501</td><td>0.525</td></tr><tr><td>E4B</td><td>0.778</td><td>0.903</td><td>1.198</td><td>1.176</td><td>1.255</td><td>1.301</td></tr></table>
|
| 251 |
+
|
| 252 |
+
# 4.5 ABLATION STUDIES
|
| 253 |
+
|
| 254 |
+
In this subsection, we conduct ablation studies to verify the effectiveness of the forward mapping, the backward mapping, and the Adaptive- $\gamma$ module of BIB. We report the experimental results in Table 2.
|
| 255 |
+
|
| 256 |
+
Forward mapping & Backward mapping. We can observe that bidirectional learning $( \gamma = 0 . 5 )$ performs better than both forward mapping $( \gamma = 1 . 0 $ ) and backward mapping $( \gamma = 0 . 0 $ ) alone in most tasks, which demonstrates the effectiveness of forward mapping and backward mapping. The advantage of bidirectional mappings over the forward mapping is larger in the long-sequence tasks like avGFP (238) and E4B (102) compared with the short-sequence tasks. A possible explanation is that the constraint is more important for long sequence tasks than short sequence design since the search space is large and many mutations can easily go out of distribution.
|
| 257 |
+
|
| 258 |
+
Adaptive- $\gamma$ . BIB learns $\gamma$ and this leads to improvements over bidirectional mappings $( \gamma = 0 . 5 )$ for all tasks, verifying the effectiveness of Adaptive- $\gamma$ . We also consider the following variant,
|
| 259 |
+
|
| 260 |
+
$$
|
| 261 |
+
X ^ { \ast } = \arg \operatorname* { m i n } _ { X _ { h } } \mathcal { L } _ { b i } ( X _ { h } , 0 . 5 ) - f _ { a u x } ( X _ { h } ) ,
|
| 262 |
+
$$
|
| 263 |
+
|
| 264 |
+
which jointly optimizes the bidirectional learning loss $\mathcal { L } _ { b i } ( X _ { h } , 0 . 5 )$ and the auxiliary term $f _ { a u x } ( \pmb { X } _ { h } )$ We found this yields similar or even worse results than pure bidirectional learning. The reason may be that the weak supervision signal from $f _ { a u x } ( \pmb { X } _ { h } )$ can serve as a guide to update the scalar $\gamma$ but not as a component of the main optimization objective that directly updates the sequence.
|
| 265 |
+
|
| 266 |
+
In the final column of Table 2, we examine the performance of the Adaptive- $\eta$ module. Adding this module leads to improvements on all five tasks, which demonstrates its effectiveness.
|
| 267 |
+
|
| 268 |
+
# 4.6 ADAPTIVE- $\eta$
|
| 269 |
+
|
| 270 |
+
In this subsection, we aim to further demonstrate the effectiveness of the Adaptive- $\eta$ module on all six gradient-based methods. We conduct experiments on two tasks: TFBind8(r) and avGFP. Since the use of the infinitely wide neural network leads to poor performance for BDI, we modify its implementation via deep linearization so that it can make use of the pre-trained LM.
|
| 271 |
+
|
| 272 |
+
As shown in Table 3, Adaptive- $\eta$ provides a consistent gain for all scenarios, which demonstrates the widespread applicability and effectiveness of the module. Furthermore, Adaptive- $\eta$ leads to a maximum improvement of $1 . 4 \%$ in TFBind8(r) and $1 2 . 5 \%$ in avGFP. ROMA is the algorithm that benefits the most. One possible explanation is that ROMA incorporates a local smoothness prior that leads to more stable gradients, with which Adaptive- $\eta$ can be more effective. Similar to Sec 4.5, we
|
| 273 |
+
|
| 274 |
+
Table 3: Adaptive- $\eta$ on all gradient-based methods.
|
| 275 |
+
|
| 276 |
+
<table><tr><td rowspan="2">Method</td><td colspan="6">TFBind8(r)</td><td colspan="6">avGFP</td></tr><tr><td>Grad</td><td>COMs</td><td>ROMA</td><td>NEMO</td><td>BDI</td><td>BIB</td><td>Grad</td><td>COMs</td><td>ROMA</td><td>NEMO</td><td>BDI</td><td>BIB</td></tr><tr><td>Normal</td><td>0.941</td><td>0.921</td><td>0.926</td><td>0.930</td><td>0.947</td><td>0.952</td><td>4.869</td><td>3.873</td><td>5.621</td><td>4.624</td><td>7.940</td><td>8.084</td></tr><tr><td>Joint</td><td>0.941</td><td>0.921</td><td>0.931</td><td>0.932</td><td>0.935</td><td>0.925</td><td>4.869</td><td>3.836</td><td>6.438</td><td>3.078</td><td>7.920</td><td>7.823</td></tr><tr><td>Gain</td><td>0.000</td><td>0.000</td><td>0.005</td><td>0.002</td><td>-0.008</td><td>-0.027</td><td>0.000</td><td>-0.037</td><td>0.116</td><td>-1.546</td><td>-0.020</td><td>-0.261</td></tr><tr><td>Ada-n</td><td>0.941</td><td>0.928</td><td>0.939</td><td>0.935</td><td>0.951</td><td>0.956</td><td>5.235</td><td>4.027</td><td>6.322</td><td>4.658</td><td>7.966</td><td>8.197</td></tr><tr><td>Gain</td><td>0.000</td><td>0.007</td><td>0.013</td><td>0.005</td><td>0.004</td><td>0.004</td><td>0.366</td><td>0.154</td><td>0.701</td><td>0.034</td><td>0.026</td><td>0.113</td></tr></table>
|
| 277 |
+
|
| 278 |
+
consider the following variant,
|
| 279 |
+
|
| 280 |
+
$$
|
| 281 |
+
\boldsymbol { X } ^ { * } = \arg \operatorname* { m a x } _ { \boldsymbol { X } _ { h } } \mathcal { L } _ { \boldsymbol { \theta } } ( \boldsymbol { X } _ { h } ) + f _ { a u x } ( \boldsymbol { X } _ { h } ) ,
|
| 282 |
+
$$
|
| 283 |
+
|
| 284 |
+
which performs joint optimization instead of bi-level optimization on two objectives. As shown in Table 3, joint optimization generally deteriorates the performance. This again verifies that the auxiliary model can only serve as a guide instead of contributing to the main objective.
|
| 285 |
+
|
| 286 |
+
# 5 RELATED WORK
|
| 287 |
+
|
| 288 |
+
Biological sequence design. There has been a wide range of algorithms for biological sequence design. Evolutionary algorithms (Sinai et al., 2020; Ren et al., 2022) leverage the learned surrogate model to provide evolution guidance towards the high-scoring region. Angermueller et al. (2019) propose a flexible reinforcement learning framework where sequence design is a sequential decisionmaking problem. Bayesian optimization methods propose candidate solutions via an acquisition function (Terayama et al., 2021). Deep generative model methods design sequences in the latent space (Chan et al., 2021) or gradually adapt the distribution towards the high-scoring region (Brookes et al., 2019). GFlowNets (Jain et al., 2022) amortize the cost of search over learning and encourage diversity. Gradient-based methods leverage a surrogate model and its gradient information to maximize the desired property (Chen et al., 2022; Norn et al., 2021; Tischer et al., 2020; Linder & Seelig, 2020). Our proposed BIB belongs to the last category and leverages the rich biophysical information (Ji et al., 2021; Elnaggar et al., 2021) to directly optimize the biological sequence.
|
| 289 |
+
|
| 290 |
+
Offline model-based optimization. A majority of sequence design algorithms (Angermueller et al., 2019; Sinai et al., 2020; Ren et al., 2022) focus on the online setting where wet-lab experimental results in the current round are analyzed to propose candidates in the next round. The problem of this setting is that wet-lab experiments are often very expensive, and thus a pure data-driven, offline approach is attractive and has received substantial research attention recently (Trabucco et al., 2022; Kolli et al., 2022). Gradient-based methods have proven to be effective (Trabucco et al., 2021; Yu et al., 2021; Fu & Levine, 2021; Chen et al., 2022). Among these algorithms, Chen et al. (2022) propose bidirectional mappings to distill information from the static dataset into a high-scoring design, which achieves state-of-the-art performances on a variety of tasks. However, this bidirectional learning is designed for general tasks, like robot and material design, and the rich biophysical information in millions of biological sequences is ignored. In this paper, we leverage recent advances in deep linearization to incorporate the rich biophysical information into bidirectional learning.
|
| 291 |
+
|
| 292 |
+
# 6 CONCLUSION
|
| 293 |
+
|
| 294 |
+
In this paper, we propose bidirectional learning for offline model-based biological sequence. Our work is built on the recently proposed bidirectional learning approach (Chen et al., 2022), which is designed for general inputs and relies on the NTK of an infinitely wide network to yield a closed-form loss computation. Though effective, the NTK cannot learn features. We build a proxy model using the pre-trained LM model with a linear head and apply the deep linearization scheme to the proxy, which can yield a closed-form loss and incorporate the wealth of biophysical information at the same time. In addition, we propose Adaptive- $\gamma$ to maintain a proper balance between the forward mapping and the backward mapping by leveraging the weak supervision signal from an auxiliary model. Based on this framework, we further propose Adaptive- $\eta$ , the first learning rate adaptation strategy compatible with all gradient-based offline model-based algorithms. Experimental results on DNA and protein sequence design tasks verify the effectiveness of BIB and Adaptive- $\eta$ .
|
| 295 |
+
|
| 296 |
+
# 7 ETHICS STATEMENT
|
| 297 |
+
|
| 298 |
+
Protein sequence design aims to find a protein sequence with a particular biological function, which has a broad application scope. This can lead to improved drugs that are highly beneficial to society. For instance, designing the antibody protein for SARS-COV-2 can potentially save millions of human lives (Kumar et al., 2021) and designing novel anti-microbial peptides (short protein sequences) is central to tackling the growing public health risks caused by anti-microbial resistance (Murray et al., 2022). Unfortunately, it is possible to direct the research results towards harmful purposes such as the design of biochemical weapons. As researchers, we believe that we must be aware of the potential harm of any research outcomes, and carefully consider whether the possible benefits outweigh the risks of harmful consequences. We also must recognize that we cannot control how the research may be used. In the case of this paper, we are confident that there is a much greater chance that the research outcomes will have a beneficial effect. We do not consider that there are any immediate ethical concerns with the research endeavour.
|
| 299 |
+
|
| 300 |
+
# 8 REPRODUCIBILITY STATEMENT
|
| 301 |
+
|
| 302 |
+
We provide the code implementation of BIB and Adaptive- $\eta$ here and we also attach the code in the supplementary material. We describe the DNA/protein benchmarks in Sec. 4.1 and the training details in Sec. 4.3. We also explain how to obtain the sequence embedding from the pre-trained LM and how to perform gradient ascent steps on the sequence in Sec. 2.
|
| 303 |
+
|
| 304 |
+
# REFERENCES
|
| 305 |
+
|
| 306 |
+
Alessandro Achille, Aditya Golatkar, Avinash Ravichandran, Marzia Polito, and Stefano Soatto. Lqf: linear quadratic fine-tuning. In Proc. Comp. Vision. Pattern. Rec.(CVPR), 2021.
|
| 307 |
+
|
| 308 |
+
Christof Angermueller, David Dohan, David Belanger, Ramya Deshpande, Kevin Murphy, and Lucy Colwell. Model-based reinforcement learning for biological sequence design. In Proc. Int. Conf. Learning Rep. (ICLR), 2019.
|
| 309 |
+
|
| 310 |
+
Sanjeev Arora, Simon S. Du, Zhiyuan Li, Ruslan Salakhutdinov, Ruosong Wang, and Dingli Yu. Harnessing the power of infinitely wide deep nets on small-data tasks. In Proc. Int. Conf. Learning Rep. (ICLR), 2020.
|
| 311 |
+
|
| 312 |
+
Luis A Barrera et al. Survey of variation in human transcription factors reveals prevalent DNA binding changes. Science, 2016.
|
| 313 |
+
|
| 314 |
+
David Brookes, Hahnbeom Park, and Jennifer Listgarten. Conditioning by adaptive sampling for robust design. In Proc. Int. Conf. Machine Learning (ICML), 2019.
|
| 315 |
+
|
| 316 |
+
Drew H Bryant, Ali Bashir, Sam Sinai, Nina K Jain, Pierce J Ogden, Patrick F Riley, George M Church, Lucy J Colwell, and Eric D Kelsic. Deep diversification of an AAV capsid protein by machine learning. Nature Biotechnology, 2021.
|
| 317 |
+
|
| 318 |
+
Alvin Chan, Ali Madani, Ben Krause, and Nikhil Naik. Deep extrapolation for attribute-enhanced generation. Proc. Adv. Neur. Inf. Proc. Syst (NeurIPS), 2021.
|
| 319 |
+
|
| 320 |
+
Can Chen, Yingxue Zhang, Jie Fu, Xue Liu, and Mark Coates. Bidirectional learning for offline infinite-width model-based optimization. Proc. Adv. Neur. Inf. Proc. Syst (NeurIPS), 2022.
|
| 321 |
+
|
| 322 |
+
Yonatan Dukler, Alessandro Achille, Giovanni Paolini, Avinash Ravichandran, Marzia Polito, and Stefano Soatto. DIVA: Dataset derivative of a learning task. In Proc. Int. Conf. Learning Rep. (ICLR), 2022.
|
| 323 |
+
|
| 324 |
+
Ahmed Elnaggar, Michael Heinzinger, Christian Dallago, Ghalia Rehawi, Yu Wang, Llion Jones, Tom Gibbs, Tamas Feher, Christoph Angerer, Martin Steinegger, et al. ProtTrans: towards cracking the language of lifes code through self-supervised deep learning and high performance computing. IEEE Trans. Pattern Analysis and Machine Intelligence, 2021.
|
| 325 |
+
|
| 326 |
+
Justin Fu and Sergey Levine. Offline model-based optimization via normalized maximum likelihood estimation. Proc. Int. Conf. Learning Rep. (ICLR), 2021.
|
| 327 |
+
|
| 328 |
+
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. Proc. Adv. Neur. Inf. Proc. Syst (NeurIPS), 2018.
|
| 329 |
+
|
| 330 |
+
Nikolaus Hansen. The CMA evolution strategy: a comparing review. Towards A New Evolutionary Computation, 2006.
|
| 331 |
+
|
| 332 |
+
Moksh Jain, Emmanuel Bengio, Alex Hernandez-Garcia, Jarrid Rector-Brooks, Bonaventure FP Dossou, Chanakya Ajit Ekbote, Jie Fu, Tianyu Zhang, Michael Kilgour, Dinghuai Zhang, et al. Biological sequence design with GFlowNets. In Proc. Int. Conf. Machine Learning (ICML), 2022.
|
| 333 |
+
|
| 334 |
+
Yanrong Ji, Zhihan Zhou, Han Liu, and Ramana V Davuluri. DNABERT: pre-trained bidirectional encoder representations from transformers model for DNA-language in genome. Bioinformatics, 2021.
|
| 335 |
+
|
| 336 |
+
Nathan Killoran, Leo J Lee, Andrew Delong, David Duvenaud, and Brendan J Frey. Generating and designing DNA with deep generative models. arXiv preprint arXiv:1712.06148, 2017.
|
| 337 |
+
|
| 338 |
+
Diederik P Kingma and Jimmy Ba. Adam: a method for stochastic optimization. In Proc. Int. Conf. Learning Rep. (ICLR), 2015.
|
| 339 |
+
|
| 340 |
+
Sathvik Kolli, Amy X. Lu, Xinyang Geng, Aviral Kumar, and Sergey Levine. Data-driven optimization for protein design: workflows, algorithms and metrics. In ICLR2022 Machine Learning for Drug Discovery, 2022.
|
| 341 |
+
|
| 342 |
+
Vikash Kumar, Haiguang Liu, and Chun Wu. Drug repurposing against SARS-CoV-2 receptor binding domain using ensemble-based virtual screening and molecular dynamics simulations. Computers in Biology and Medicine, 2021.
|
| 343 |
+
|
| 344 |
+
Johannes Linder and Georg Seelig. Fast differentiable DNA and protein sequence optimization for molecular design. arXiv preprint arXiv:2005.11275, 2020.
|
| 345 |
+
|
| 346 |
+
Johannes Linder and Georg Seelig. Fast activation maximization for molecular sequence design. BMC Bioinformatics, 2021.
|
| 347 |
+
|
| 348 |
+
Christopher JL Murray, Kevin Shunji Ikuta, Fablina Sharara, Lucien Swetschinski, Gisela Robles Aguilar, Authia Gray, Chieh Han, Catherine Bisignano, Puja Rao, Eve Wool, et al. Global burden of bacterial antimicrobial resistance in 2019: a systematic analysis. The Lancet, 2022.
|
| 349 |
+
|
| 350 |
+
Christoffer Norn, Basile IM Wicky, David Juergens, Sirui Liu, David Kim, Doug Tischer, Brian Koepnick, Ivan Anishchenko, David Baker, and Sergey Ovchinnikov. Protein sequence design by conformational landscape optimization. Proceedings of the National Academy of Sciences, 2021.
|
| 351 |
+
|
| 352 |
+
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. Proc. Adv. Neur. Inf. Proc. Syst (NeurIPS), 2019.
|
| 353 |
+
|
| 354 |
+
Zhizhou Ren, Jiahan Li, Fan Ding, Yuan Zhou, Jianzhu Ma, and Jian Peng. Proximal exploration for model-guided protein sequence design. Proc. Int. Conf. Machine Learning (ICML), 2022.
|
| 355 |
+
|
| 356 |
+
Karen S Sarkisyan et al. Local fitness landscape of the green fluorescent protein. Nature, 2016.
|
| 357 |
+
|
| 358 |
+
Sam Sinai, Richard Wang, Alexander Whatley, Stewart Slocum, Elina Locane, and Eric D Kelsic. Adalead: a simple and robust adaptive greedy search algorithm for sequence design. arXiv preprint arXiv:2010.02141, 2020.
|
| 359 |
+
|
| 360 |
+
Lea M Starita, Jonathan N Pruneda, Russell S Lo, Douglas M Fowler, Helen J Kim, Joseph B Hiatt, Jay Shendure, Peter S Brzovic, Stanley Fields, and Rachel E Klevit. Activity-enhancing mutations in an E3 ubiquitin ligase identified by high-throughput mutagenesis. Proceedings of the National Academy of Sciences, 2013.
|
| 361 |
+
|
| 362 |
+
Kei Terayama, Masato Sumita, Ryo Tamura, and Koji Tsuda. Black-box optimization for automated discovery. Accounts of Chemical Research, 2021.
|
| 363 |
+
|
| 364 |
+
Doug Tischer, Sidney Lisanza, Jue Wang, Runze Dong, Ivan Anishchenko, Lukas F Milles, Sergey Ovchinnikov, and David Baker. Design of proteins presenting discontinuous functional sites using deep learning. Biorxiv, 2020.
|
| 365 |
+
|
| 366 |
+
Brandon Trabucco, Aviral Kumar, Xinyang Geng, and Sergey Levine. Conservative objective models for effective offline model-based optimization. In Proc. Int. Conf. Machine Learning (ICML), 2021.
|
| 367 |
+
|
| 368 |
+
Brandon Trabucco, Xinyang Geng, Aviral Kumar, and Sergey Levine. Design-Bench: benchmarks for data-driven offline model-based optimization. arXiv preprint arXiv:2202.08450, 2022.
|
| 369 |
+
|
| 370 |
+
James T Wilson, Riccardo Moriconi, Frank Hutter, and Marc Peter Deisenroth. The reparameterization trick for acquisition functions. arXiv preprint arXiv:1712.00424, 2017.
|
| 371 |
+
|
| 372 |
+
Greg Yang and Edward J Hu. Tensor programs iv: feature learning in infinite-width neural networks. In Proc. Int. Conf. Machine Learning (ICML), 2021.
|
| 373 |
+
|
| 374 |
+
Sihyun Yu, Sungsoo Ahn, Le Song, and Jinwoo Shin. Roma: robust model adaptation for offline model-based optimization. Proc. Adv. Neur. Inf. Proc. Syst (NeurIPS), 2021.
|
| 375 |
+
|
| 376 |
+
# A APPENDIX
|
| 377 |
+
|
| 378 |
+
# A.1 DNA EMBEDDING
|
| 379 |
+
|
| 380 |
+
To incorporate richer contextual information, the DNA LM Ji et al. (2021) adopts the $k$ -mer sequence representation, which is widely used in DNA sequence analysis. For example, the sequence AT GGCT has its 3-mer representation as $\{ A T G , T G G , G G C , G { \dot { C } } T \}$ . In this paper, we adopt its 3-mer representation and compute the probability of the 3-mer token by multiplying the probabilities of the three individual bases. The 3-mer representation is then sent to the pre-trained DNA LM.
|
| 381 |
+
|
| 382 |
+
# A.2 DATASET DETAILS
|
| 383 |
+
|
| 384 |
+
We conduct experiments on two DNA tasks following (Chen et al., 2022) and three protein tasks in (Ren et al., 2022) which have the most data points. We report the dataset details in Table 4.
|
| 385 |
+
|
| 386 |
+
DNA Task 1 TFBind8(r). The goal is to find a length-8 DNA sequence to maximize the binding activity score with a particular transcription factor, SIX6REFR1 (Barrera et al., 2016). We sample 5000 data points for the offline algorithms following (Chen et al., 2022).
|
| 387 |
+
|
| 388 |
+
DNA Task 2 TFBind10(r). The task TFBind10(r) is the same as TFBind8(r) except that the goal is to find a length-10 DNA sequence. Both DNA tasks measure the entire search space and we adopt these measurements as the approximate ground-truth evaluation.
|
| 389 |
+
|
| 390 |
+
Protein Task 1 avGFP. This task aims to find a protein sequence with approximately 239 amino acids to maximize the fluorescence level of Green Fluorescent Proteins (Sarkisyan et al., 2016). The task oracle is constructed by using the full unobserved dataset (around 52,000 points) following (Ren et al., 2022). The oracle passes the average of the residue embeddings from the pre-trained Prot-T5 (Elnaggar et al., 2021) into a linear layer and then fits the dataset. The following two task oracles take the same form. The offline algorithms can only access the lowest-scoring 26,000 data points.
|
| 391 |
+
|
| 392 |
+
Protein Task 2 AAV. The goal is to engineer a 28-amino acid segment (positions 561–588) of the VP1 protein to remain viable for gene therapy (Bryant et al., 2021). We use the entire 284, 000 data points to build the oracle and the lowest-scoring 142, 000 points for the offline algorithms.
|
| 393 |
+
|
| 394 |
+
Protein Task 3 E4B. This task aims to design a protein (around 102 amino acids) to maximize the ubiquitination rate to the target protein (Starita et al., 2013). The full dataset consisting of around 100, 000 points is used to build the oracle and the bottom half is used for the offline algorithms.
|
| 395 |
+
|
| 396 |
+
The parameterization of the oracle is different from that of the regression model from two aspects: 1) model architecture; 2) pre-trained information source. First, the oracle adopts the Prot-T5 model which consists of an encoder and a decoder, while the regression model adopts the Prot-BERT model which only has an encoder. Second, Prot-T5 is trained on the BFD and UniRef100 datasets and ProtBert is trained on the UniRef50 dataset. These two points demonstrate that the oracle and the regression model are different function classes. We choose the Prot-T5 model as the oracle because this is the state-of-the-art protein LM to extract features and recent work Elnaggar et al. (2021) has demonstrated its effectiveness. In order to test how related the Prot-T5 (oracle)/Prot-BERT(proxy) models are, we trained them on a sampled training dataset and compared the test predictions of the testing set. By evaluating the Pearson correlation coefficient (PCC) between the two prediction errors PCC(ProtT5 predictions - test labels, ProtBERT predictions -test labels), we obtain $- 0 . 0 0 5 3$ on avGFP, $- 0 . 0 0 0 5$ on AAV, and $\cdot$ on E4B. These results suggest that the two models are not strongly related in terms of the predictions they form.
|
| 397 |
+
|
| 398 |
+
Table 4: Dataset details.
|
| 399 |
+
|
| 400 |
+
<table><tr><td>Task</td><td>Metric</td><td>Min of D</td><td>Max of D</td><td>Min of Dentire</td><td>Max of Dentire</td></tr><tr><td>TFBind8(r)</td><td>binding activity</td><td>0.000</td><td>0.242</td><td>0.000</td><td>1.000</td></tr><tr><td>TFBind10(r)</td><td>binding activity</td><td>-1.859</td><td>-0.869</td><td>-1.859</td><td>2.129</td></tr><tr><td>avGFP</td><td>fluorescence level</td><td>1.283</td><td>3.553</td><td>1.283</td><td>4.123</td></tr><tr><td>AAV</td><td>viruses viability</td><td>-11.176</td><td>-1.399</td><td>-11.176</td><td>9.536</td></tr><tr><td>E4B</td><td>ubiquitination rate</td><td>-3.589</td><td>-0.984</td><td>-3.589</td><td>8.998</td></tr></table>
|
| 401 |
+
|
| 402 |
+
Table 5: Experimental results on different pre-trained LMs for comparison.
|
| 403 |
+
|
| 404 |
+
<table><tr><td>Pre-trainedLM</td><td>avGFP</td><td>AAV</td><td>E4B</td></tr><tr><td>ProtAlbert</td><td>3.567±0.456</td><td>0.478±0.004</td><td>0.552±0.023</td></tr><tr><td>ProtBert(adopted)</td><td>8.084±0.224</td><td>0.501 ± 0.007</td><td>1.255 ± 0.029</td></tr><tr><td>ProtBert-BFD</td><td>8.240±0.094</td><td>0.549 ± 0.009</td><td>1.880 ± 0.054</td></tr></table>
|
| 405 |
+
|
| 406 |
+
Following (Trabucco et al., 2021), we select the top $\cdot$ most promising sequences for each comparison method. Among these sequences, we report the maximum normalized ground truth score as the evaluation metric following (Ren et al., 2022).
|
| 407 |
+
|
| 408 |
+
# A.3 TRAINING DETAILS
|
| 409 |
+
|
| 410 |
+
We use Pytorch (Paszke et al., 2019) to run all experiments on one V100 GPU. Following the setting in Norn et al. (2021), we introduce a length- $L$ protein sequence as a continuous random matrix $\pmb { X } _ { h } \in R ^ { L \times 2 0 }$ ( $\mathbf { \bar { X } } _ { h } \in R ^ { L \times 4 }$ for DNA), initialized using a normal distribution with the mean 0 and the standard deviation of 0.01. To make this sequence correspond correctly to the candidate sequence, we exchange the largest value in $X [ l , : ]$ with the value in the amino acid index.
|
| 411 |
+
|
| 412 |
+
# A.4 DIFFERENT PRETRAINED LMS
|
| 413 |
+
|
| 414 |
+
As shown in Table 5, we have tested the ProtBERT, ProtAlbert, and ProtBert-BFD models and found that better-quality models generally work better. The publicly available pre-trained DNA models are limited and thus we only perform experiments on the protein tasks. Elnaggar et al. (2021) demonstrate that the language model performances follow the ordering: ProtBert-BFD $\cdot$ ProtBert $>$ ProtAlbert. We can see that the performance ranks over the three protein tasks avGFP, AAV, and E4B are the same.
|
| 415 |
+
|
| 416 |
+
# A.5 DIFFERENT DATASET SIZE
|
| 417 |
+
|
| 418 |
+
As shown in Table 6, we have tested the performance of BDI as a function of dataset size $\mathrm { N } = \mathrm { 2 0 }$ , 40, 60, 80, 100) in TFBind8(r) and TFBind10(r) since they have exact oracle evaluations. We see that performance is already good for $\cdot$ for TFBind8(r) and $\Nu { = } 4 0$ for TFBind10(r).
|
| 419 |
+
|
| 420 |
+
# A.6 RANKING PERFORMANCE
|
| 421 |
+
|
| 422 |
+
As for prediction performances, the rank should be: a $\cdot$ linearized pre-trained $\mathrm { L M } > \mathrm { N T K }$ . We have conducted experiments to verify this. We sample half of the data, train a model to predict another
|
| 423 |
+
|
| 424 |
+
Table 6: Experimental results on different size datasets for comparison.
|
| 425 |
+
|
| 426 |
+
<table><tr><td>Dataset size</td><td>20</td><td>40</td><td>60</td><td>80</td><td>100</td></tr><tr><td>TFBind8(r)</td><td>0.849± 0.027</td><td>0.883± 0.036</td><td>0.890± 0.033</td><td>0.911 ± 0.042</td><td>0.923± 0.049</td></tr><tr><td>TFBind10(r)</td><td>0.248±0.000</td><td>0.596±0.035</td><td>0.602±0.023</td><td>0.616±0.024</td><td>0.632±0.036</td></tr></table>
|
| 427 |
+
|
| 428 |
+
Table 7: Mean squared prediction losses for comparison.
|
| 429 |
+
|
| 430 |
+
<table><tr><td>Method</td><td>TFBind8(r)</td><td>TFBind10(r)</td><td>avGFP</td><td>AAV</td><td>E4B</td></tr><tr><td>Finetuned NN</td><td>0.101±0.001</td><td>1.130 ± 0.041</td><td>0.411± 0.197</td><td>5.148± 0.074</td><td>0.683±0.012</td></tr><tr><td>Linearized NN</td><td>0.107±0.000</td><td>1.618 ± 0.000</td><td>0.735 ± 0.000</td><td>23.041±0.000</td><td>1.050 ± 0.000</td></tr><tr><td>NTK</td><td>0.111± 0.000</td><td>1.840 ± 0.000</td><td>0.807± 0.000</td><td>24.451 ± 0.000</td><td>1.075 ± 0.000</td></tr></table>
|
| 431 |
+
|
| 432 |
+
half data, and report the mean squared loss here and in Appendix A.6 Table 7. A small mean squared loss indicates a good prediction performance; thus, we have verified the above ranking order.
|
md/dev/n0OeTdNRG0Q/n0OeTdNRG0Q.md
ADDED
|
@@ -0,0 +1,418 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EFFICIENT SHARPNESS-AWARE MINIMIZATION FOR IMPROVED TRAINING OF NEURAL NETWORKS
|
| 2 |
+
|
| 3 |
+
Jiawei $\mathbf { D } \mathbf { u } ^ { 1 , 2 }$ , Hanshu $\mathbf { Y a n } ^ { 2 }$ , Jiashi Feng2 , Joey Tianyi Zhou1∗, Liangli Zhen4 , Rick Siow Mong $\mathbf { G o h ^ { 4 } }$ , Vincent Y. F. Tan3,2
|
| 4 |
+
|
| 5 |
+
1Centre for Frontier AI Research (CFAR), A\*STAR, Singapore,
|
| 6 |
+
2Department of Electrical and Computer Engineering, National University of Singapore
|
| 7 |
+
3Department of Mathematics, National University of Singapore
|
| 8 |
+
4Institute of High Performance Computing (IHPC), A\*STAR, Singapore
|
| 9 |
+
{dujiawei, hanshu.yan}@u.nus.edu,vtan@nus.edu.sg
|
| 10 |
+
jshfeng@gmail.com, Joey.tianyi.zhou@gmail.com
|
| 11 |
+
{zhen liangli, gohsm}@ihpc.a-star.edu.sg
|
| 12 |
+
|
| 13 |
+
# ABSTRACT
|
| 14 |
+
|
| 15 |
+
Overparametrized Deep Neural Networks (DNNs) often achieve astounding performances, but may potentially result in severe generalization error. Recently, the relation between the sharpness of the loss landscape and the generalization error has been established by Foret et al. (2020), in which the Sharpness Aware Minimizer (SAM) was proposed to mitigate the degradation of the generalization. Unfortunately, SAM’s computational cost is roughly double that of base optimizers, such as Stochastic Gradient Descent (SGD). This paper thus proposes Efficient Sharpness Aware Minimizer (ESAM), which boosts SAM’s efficiency at no cost to its generalization performance. ESAM includes two novel and efficient training strategies—Stochastic Weight Perturbation and Sharpness-Sensitive Data Selection. In the former, the sharpness measure is approximated by perturbing a stochastically chosen set of weights in each iteration; in the latter, the SAM loss is optimized using only a judiciously selected subset of data that is sensitive to the sharpness. We provide theoretical explanations as to why these strategies perform well. We also show, via extensive experiments on the CIFAR and ImageNet datasets, that ESAM enhances the efficiency over SAM from requiring $\bar { 1 } 0 0 \%$ extra computational overhead to $4 0 \%$ vis- $\grave { \mathbf { a } }$ -vis base optimizers, while test accuracies are preserved or even improved. Our codes are avaliable at https://github.com/dydjw9/Efficient_SAM.
|
| 16 |
+
|
| 17 |
+
# 1 INTRODUCTION
|
| 18 |
+
|
| 19 |
+
Deep learning has achieved astounding performances in many fields by relying on larger numbers of parameters and increasingly sophisticated optimization algorithms. However, DNNs with far more parameters than training samples are more prone to poor generalization. Generalization is arguably the most fundamental and yet mysterious aspect of deep learning.
|
| 20 |
+
|
| 21 |
+
Several studies have been conducted to better understand the generalization of DNNs and to train DNNs that generalize well across the natural distribution (Keskar et al., 2017; Neyshabur et al., 2017; Chaudhari et al., 2019; Zhang et al., 2019; Wu et al., 2020; Foret et al., 2020; Zhang et al., 2021). For example, Keskar et al. (2017) investigate the effect of batch size on neural networks’ generalization ability. Zhang et al. (2019); Zhou et al. (2021) propose optimizers for training DNNs with improved generalization ability. Specifically, Hochreiter & Schmidhuber (1995), Li et al. (2018) and Dinh et al. (2017) argue that the geometry of the loss landscape affects generalization and DNNs with a flat minimum can generalize better. The recent work by Foret et al. (2020) proposes an effective training algorithm Sharpness Aware Minimizer (SAM) for obtaining a flat minimum. SAM employs a base optimizer such as Stochastic Gradient Descent (Nesterov, 1983) or Adam (Kingma & Ba, 2015) to minimize both the vanilla training loss and the sharpness. The sharpness, which describes the flatness of a minimum, is characterized using eigenvalues of the Hessian matrix by Keskar et al. (2017). SAM quantifies the sharpness as the maximized change of training loss when a constraint perturbation is added to current weights. As a result, SAM leads to a flat minimum and significantly improves the generalization ability of the trained DNNs. SAM and its variants have been shown to outperform the state-of-the-art across a variety of deep learning benchmarks (Kwon et al., 2021; Chen et al., 2021; Galatolo et al., 2021; Zheng et al., 2021). Regrettably though, SAM and its variants achieve such remarkable performance at the expense of doubling the computational overhead of the given base optimizers, which minimize the training loss with a single forward and backward propagation step. SAM requires an additional propagation step compared to the base optimizers to resolve the weight perturbation for quantifying the sharpness. The extra propagation step requires the same computational overhead as the single propagation step used by base optimizers, resulting in SAM’s computational overhead being doubled $( 2 \times )$ . As demonstrated in Figure 1, SAM achieves higher test accuracy (i.e., $8 4 . 4 6 \%$ vs. $8 1 . 8 9 \%$ ) at the expense of sacrificing half of the training speed of the base optimizer (i.e., 276 imgs/s vs. 557 imgs/s).
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
Figure 1: Training Speed vs. Accuracy of SGD, SAM and ESAM evaluated by PyramidNet on CIFAR100. ESAM improves the efficiency with better accuracy compared to SAM.
|
| 25 |
+
|
| 26 |
+
In this paper, we aim to improve the efficiency of SAM but preserve its superior performance in generalization. We propose Efficient Sharpness Aware Minimizer (ESAM), which consists of two training strategies Stochastic Weight Perturbation (SWP) and Sharpnesssensitive Data Selection $( S D S )$ , both of which reduce computational overhead and preserve the performance of SAM. On the one hand, SWP approximates the sharpness by searching weight perturbation within a stochastically chosen neighborhood of the current weights. SWP preserves the performance by ensuring that the expected weight perturbation is identical to that solved by SAM. On the other hand, SDS improves efficiency by approximately optimizing weights based on the sharpnesssensitive subsets of batches. These subsets consist of samples whose loss values increase most w.r.t. the weight perturbation and consequently can better quantify the sharpness of DNNs. As a result, the sharpness calculated over the subsets can serve as an upper bound of the SAM’s sharpness, ensuring that SDS’s performance is comparable to that of SAM’s.
|
| 27 |
+
|
| 28 |
+
We verify the effectiveness of ESAM on the CIFAR10, CIFAR100 (Krizhevsky et al., 2009) and ImageNet (Deng et al., 2009) datasets with five different DNN architectures. The experimental results demonstrate that ESAM obtains flat minima at a cost of only $4 0 \%$ (vs. SAM’s $100 \%$ ) extra computational overhead over base optimizers. More importantly, ESAM achieves better performance in terms of the test accuracy compared to SAM. In a nutshell, our contributions are as follows:
|
| 29 |
+
|
| 30 |
+
• We propose two novel and effective training strategies Stochastic Weight Perturbation (SWP) and Sharpness-sensitive Data Selection (SDS). Both strategies are designed to improve efficiency without sacrificing performance. The empirical results demonstrate that both of the proposed strategies can improve both the efficiency and effectiveness of SAM. • We introduce the ESAM, which integrates SWP and SDS. ESAM improves the generalization ability of DNNs with marginally additional computational cost compared to standard training.
|
| 31 |
+
|
| 32 |
+
The rest of this paper is structured in this way. Section 2.1 introduces SAM and its computational issues. Section 2.2 and Section 2.3 discuss how the two proposed training strategies SWP and SDS are designed respectively. Section 3 verifies the effectiveness of ESAM across a variety of datasets and DNN architectures. Section 4 presents the related work and Section 5 concludes this paper.
|
| 33 |
+
|
| 34 |
+
# 2 METHODOLOGY
|
| 35 |
+
|
| 36 |
+
We start with recapitulating how SAM achieves a flat minimum with small sharpness, which is quantified by resolving a maximization problem. To compute the sharpness, SAM requires additional forward and backward propagation and results in the doubling of the computational overhead
|
| 37 |
+
|
| 38 |
+
# Algorithm 1 Efficient SAM (ESAM)
|
| 39 |
+
|
| 40 |
+
Input: Network $f _ { \theta }$ with parameters $\theta = ( \theta _ { 1 } , \theta _ { 2 } , \ldots , \theta _ { N } )$ ; Training set $\mathbb { S }$ ; Batch size $b$ ; Learning rate $\eta > 0$ ; Neighborhood size $\rho > 0$ ; Number of iterations $A$ ; SWP hyperparameter $\beta$ ; SDS hyperparameter $\gamma$ .
|
| 41 |
+
|
| 42 |
+
Output: A flat minimum solution $\hat { \theta }$
|
| 43 |
+
|
| 44 |
+
<table><tr><td colspan="2">1:fora=1 to A do</td></tr><tr><td>2:</td><td>Sample a mini-batch B C S with size b.</td></tr><tr><td>3:</td><td>for n=1 to N do</td></tr><tr><td>4:</td><td>if 0n is chosen by probability β then</td></tr><tr><td>5:</td><td>En←i=VθnLB(fe) SWP in B1</td></tr><tr><td>6:</td><td>else</td></tr><tr><td>7:</td><td>En←0</td></tr><tr><td>8:</td><td>@←(∈1,.,éN) >Assign Weight Perturbation</td></tr><tr><td>9:</td><td>Compute l(fe+ε, Xi, yi) and construct B+ with selection ratio γ (Equation 6)</td></tr><tr><td>10:</td><td>Compute gradients g = VθLB+(fθ+ε) SDS in B2</td></tr><tr><td>11:</td><td>Update weightsθ ←θ-ng</td></tr></table>
|
| 45 |
+
|
| 46 |
+
compared to base optimizers. Following that, we demonstrate how we derive and propose ESAM, which integrates SWP and SDS, to maximize efficiency while maintaining the performance. We introduce SWP and SDS in Sections 2.2 and 2.3 respectively. Algorithm 1 shows the overall proposed ESAM algorithm.
|
| 47 |
+
|
| 48 |
+
Throughout this paper, we denote a neural network $f$ with weight parameters $\theta$ as $f _ { \theta }$ . The weights are contained in the vector $\theta = ( \theta _ { 1 } , \theta _ { 2 } , \ldots , \theta _ { N } )$ , where $N$ is the number of weight units in the neural network. Given a training dataset $\mathbb { S }$ that contains samples i.i.d. drawn from a distribution $\mathcal { D }$ , the network is trained to obtain optimal weights $\hat { \theta }$ via empirical risk minimization (ERM), i.e.,
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
\hat { \theta } = \underset { \theta } { \arg \operatorname* { m i n } } \left\{ L _ { \mathbb { S } } ( f _ { \theta } ) = \frac { 1 } { \left| \mathbb { S } \right| } \sum _ { ( x _ { i } , y _ { i } ) \in \mathbb { S } } \ell ( f _ { \theta } , x _ { i } , y _ { i } ) \right\} .
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
where $\ell$ can be an arbitrary loss function. We take $\ell$ to be the cross entropy loss in this paper. The population loss is defined as $L _ { \mathcal { D } } ( f _ { \theta } ) \ \triangleq \ \mathbb { E } _ { ( x _ { i } , y _ { i } ) \sim \mathcal { D } } \big [ \ell ( f _ { \theta } , x _ { i } , y _ { i } ) \big ]$ . In each training iteration, optimizers sample a mini-batch $\mathbb { B } \subset \mathbb { S }$ with size $b$ to update parameters.
|
| 55 |
+
|
| 56 |
+
# 2.1 SHARPNESS-AWARE MINIMIZATION AND ITS COMPUTATIONAL DRAWBACK
|
| 57 |
+
|
| 58 |
+
To improve the generalization capability of DNNs, Foret et al. (2020) proposed the SAM training strategy for searching flat minima. SAM trains DNNs by solving the following min-max optimization problem,
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \epsilon : \| \epsilon \| _ { 2 } \leq \rho } L _ { \mathbb { S } } ( f _ { \theta + \epsilon } ) .
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
Given $\theta$ , the inner optimization attempts to find a weight perturbation $\epsilon$ in Euclidean ball with radius $\rho$ that maximizes the empirical loss. The maximized loss at weights $\theta$ is the sum of the empirical loss and the sharpness, which is defined to be $\begin{array} { r } { R _ { \mathbb { S } } ( f _ { \theta } ) = \operatorname* { m a x } _ { \epsilon : \| \epsilon \| _ { 2 } < \rho } [ L _ { \mathbb { S } } ( f _ { \theta + \epsilon } ) - L _ { \mathbb { S } } ( f _ { \theta } ) ] } \end{array}$ . This sharpness is quantified by the maximal change of empirical loss when a perturbation $\epsilon$ (whose norm is constrained by $\rho \mathrm { \hbar }$ ) is added to $\theta$ . The min-max problem encourages SAM to find flat minima.
|
| 65 |
+
|
| 66 |
+
For a certain set of weights $\theta$ , Foret et al. (2020) theoretically justifies that the population loss of DNNs can be upper-bounded by the sum of sharpness, empirical loss, and a regularization term on the norm of weights (refer to Equation 3). Thus, by minimizing the sharpness together with the empirical loss, SAM produces optimized solutions for DNNs with flat minima, and the resultant models can thus generalize better (Foret et al., 2020; Chen et al., 2021; Kwon et al., 2021). Indeed, we have
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
L _ { \mathcal { D } } ( f _ { \theta } ) \leq R _ { \mathbb { S } } ( f _ { \theta } ) + L _ { \mathbb { S } } ( f _ { \theta } ) + \lambda \| \theta \| _ { 2 } ^ { 2 } = \operatorname* { m a x } _ { \epsilon : \| \epsilon \| _ { 2 } \leq \rho } L _ { \mathbb { S } } ( f _ { \theta + \epsilon } ) + \lambda \| \theta \| _ { 2 } ^ { 2 } .
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
In practice, SAM first approximately solves the inner optimization by means of a single-step gradient descent method, i.e.,
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
\hat { \epsilon } = \operatorname * { a r g m a x } _ { \epsilon : \| \epsilon \| _ { 2 } < \rho } L _ { \mathbb { S } } ( f _ { \theta + \epsilon } ) \approx \rho \nabla _ { \theta } L _ { \mathbb { S } } ( f _ { \theta } ) .
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
The sharpness at weights $\theta$ is approximated by $R _ { \mathbb { S } } ( f _ { \theta } ) = L _ { \mathbb { S } } ( f _ { \theta + \hat { \epsilon } } ) - L _ { \mathbb { S } } ( f _ { \theta } )$ . Then, a base optimizer, such as SGD (Nesterov, 1983) or Adam (Kingma & Ba, 2015), updates the DNNs’ weights to minimize $L _ { \mathbb { S } } ( f _ { \theta + \hat { \epsilon } } )$ . We refer to $L _ { \mathbb { S } } ( f _ { \theta + \hat { \epsilon } } )$ as the SAM loss. Overall, SAM requires two forward and two backward operations to update weights once. We refer to the forward and backward propagation for approximating $\hat { \epsilon }$ as $F _ { 1 }$ and $B _ { 1 }$ and those for updating weights by base optimizers as $F _ { 2 }$ and $B _ { 2 }$ respectively. Although SAM can effectively improve the generalization of DNNs, it additionally requires one forward and one backward operation $F _ { 1 }$ and $B _ { 1 }$ ) in each training iteration. Thus, SAM results in a doubling of the computational overhead compared to the use of base optimizers.
|
| 79 |
+
|
| 80 |
+
To improve the efficiency of SAM, we propose ESAM, which consists of two strategies—SWP and SDS, to accelerate the sharpness approximation phase and the weight updating phase. Specifically, on the one hand, when estimating $\hat { \epsilon }$ around weight vector $\theta$ , SWP efficiently approximates ˆ by randomly selecting each parameter with a given probability to form a subset of weights to be perturbed. The reduction of the number of perturbed parameters results in lower computational overhead during the backward propagation. SWP rescales the resultant weight perturbation so as to assure that the expected weight perturbation equals to $\hat { \epsilon }$ , and the generalization capability thus will not be significantly degraded. On the other hand, when updating weights via base optimizers, instead of computing the upper bound $L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } )$ over a whole batch of samples, SDS selects a subset of samples, $\mathbb { B } ^ { + }$ , whose loss values increase the most with respect to the perturbation ˆ. Optimizing the weights based on a fewer number of samples decreases the computational overhead (in a linear fashion). We further justify that $L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } )$ can be upper bounded by $L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } )$ and consequently the generalization capability can be preserved. In general, ESAM works much more efficiently and performs as well as SAM in terms of the generalization capability.
|
| 81 |
+
|
| 82 |
+
# 2.2 STOCHASTIC WEIGHT PERTURBATION
|
| 83 |
+
|
| 84 |
+
This section elaborates on the first efficiency enhancement strategy, SWP, and explains why SWP can effectively reduce computational overhead while preserving the generalization capability.
|
| 85 |
+
|
| 86 |
+
To efficiently approximate ${ \hat { \epsilon } } ( \theta , \mathbb { S } )$ during the sharpness estimation phase, SWP randomly chooses a subset $\tilde { \boldsymbol { \theta } } = \{ \theta _ { I _ { 1 } } , \theta _ { I _ { 2 } } , . . . \}$ from the original set of weights $\theta = ( \theta _ { 1 } , \ldots , \theta _ { N } )$ to perform backpropagation $B _ { 1 }$ . Each parameter is selected to be in the subvector $\tilde { \theta }$ with some probability $\beta$ , which can be tuned as a hyperparameter. SWP approximates the weight perturbation with $\rho \nabla _ { \tilde { \theta } } L _ { \mathbb { S } } ( f _ { \theta } )$ . To be formal, we introduce a gradient mask $\mathbf { m } = ( m _ { 1 } , \dots , m _ { N } )$ where $m _ { i } \stackrel { \mathrm { i . i . d . } } { \sim } \mathrm { B e r n } ( \beta )$ for all $i \in \{ 1 , \ldots , N \}$ . Then, we have $\rho \nabla _ { \tilde { \theta } } L _ { \mathbb { S } } ( f _ { \theta } ) = \mathbf { m } ^ { \top } \hat { \epsilon } ( \theta , \mathbb { B } )$ . To ensure the expected weight perturbation of SWP equals to $\hat { \epsilon }$ , we scale $\rho \nabla _ { \tilde { \theta } } L _ { \mathbb { S } } ( f _ { \theta } )$ by a factor of $\frac { 1 } { \beta }$ . Finally, SWP produces an approximate solution of the inner maximization as
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\mathbf { \boldsymbol { a } } ( \theta , \mathbb { B } ) = \frac { \mathbf { \boldsymbol { m } } ^ { \top } \boldsymbol { \hat { \epsilon } } ( \theta , \mathbb { B } ) } { \beta } .
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
Computation Ideally, SWP reduces the overall computational overhead in proportion to $1 - \beta$ in $B _ { 1 }$ . However, there exists some parameters not included in $\tilde { \theta }$ that are still required to be updated in the backpropagation step. This additional computational overhead is present due to the use of the chain rule, which calculates the entire set of gradients with respect to the parameters along a propagation path. This additional computational overhead slightly increases in deeper neural networks. Thus, the amount of reduction in the computational overhead is positively correlated to $1 - \beta$ . In practice, $\beta$ is tuned to maximize SWP’s efficiency while maintaining a generalization performance comparable to SAM’s.
|
| 93 |
+
|
| 94 |
+
Generalization We will next argue that SWP’s generalization performance can be preserved when compared to SAM by showing that the expected weight perturbation ${ \pmb a } ( \theta , { \mathbb { B } } )$ of SWP equals to the original SAM’s perturbation $\hat { \epsilon } ( \theta , \mathbb { B } )$ in the sense of the $\ell _ { 2 }$ norm and direction. We denote the expected SWP perturbation by $\bar { \mathbf { a } } ( \theta , \mathbb { B } )$ , where
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\bar { \pmb { a } } ( \theta , \mathbb { B } ) _ { [ i ] } = \mathbb { E } [ \pmb { a } ( \theta , \mathbb { B } ) _ { [ i ] } ] = \frac { 1 } { \beta } \cdot \beta \hat { \epsilon } ( \theta , \mathbb { B } ) _ { [ i ] } = \hat { \epsilon } ( \theta , \mathbb { B } ) _ { [ i ] } ,
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
for $i \in \{ 1 , \ldots , N \}$ . Thus, it holds that
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\| \bar { \boldsymbol { a } } ( \theta , \mathbb { B } ) \| _ { 2 } = \| \hat { \epsilon } ( \theta , \mathbb { B } ) \| _ { 2 } \quad \mathrm { a n d } \quad \mathrm { C o s S i m } \big ( \bar { \boldsymbol { a } } ( \theta , \mathbb { B } ) , \hat { \boldsymbol { \epsilon } } ( \theta , \mathbb { B } ) \big ) = 1 ,
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
showing that the expected weight perturbation of SWP is the same as that of SAM’s.
|
| 107 |
+
|
| 108 |
+
# 2.3 SHARPNESS-SENSITIVE DATA SELECTION
|
| 109 |
+
|
| 110 |
+
In this section, we introduce the second efficiency enhancement technique, SDS, which reduces computational overhead of SAM linearly as the number of selected samples decreases. We also explain why the generalization capability of SAM is preserved by SDS.
|
| 111 |
+
|
| 112 |
+
In the sharpness estimation phase, we obtain the approximate solution ˆof the inner maximization. Perturbing weights along this direction significantly increases the average loss over a batch $\mathbb { B }$ . To improve the efficiency but still control the upper bound $L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } )$ , we select a subset of samples from the whole batch. The loss values of this subset of samples increase most when the weights are perturbed by $\hat { \epsilon }$ . To be specific, SDS splits the mini-batch $\mathbb { B }$ into the following two subsets
|
| 113 |
+
|
| 114 |
+
$$
|
| 115 |
+
\begin{array} { r l } & { \mathbb { B } ^ { + } : = \big \{ ( x _ { i } , y _ { i } ) \in \mathbb { B } : \ell ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } ) - \ell ( f _ { \theta } , x _ { i } , y _ { i } ) > \alpha \big \} , } \\ & { \mathbb { B } ^ { - } : = \big \{ ( x _ { i } , y _ { i } ) \in \mathbb { B } : \ell ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } ) - \ell ( f _ { \theta } , x _ { i } , y _ { i } ) < \alpha \big \} , } \end{array}
|
| 116 |
+
$$
|
| 117 |
+
|
| 118 |
+

|
| 119 |
+
Figure 2: Illustration on the loss changes of samples in $\mathbb { B } ^ { + }$ and $\mathbb { B } ^ { - }$ along the weight perturbation ˆ. The average loss of samples in $\mathbb { B } ^ { + }$ increases the most along the perturbation
|
| 120 |
+
|
| 121 |
+
where $\mathbb { B } ^ { + }$ is termed as the sharpness-sensitive subset and the direction ˆ. threshold $\alpha$ controls the size of $\mathbb { B } ^ { + }$ . We let $\gamma = | \mathbb { B } ^ { + } | / | \mathbb { B } |$ be the ratio of the number of selected samples with respect to the batch size. In practice, $\gamma$ determines the exact value of $\alpha$ and serves as a predefined hyperparameter of SDS. As illustrated in Figure 2, when $\alpha = 0$ , the gradient of the weights evaluated on $\mathbb { B } ^ { + }$ aligns with the direction of $\hat { \epsilon }$ and the loss values of the samples in $\mathbb { B } ^ { + }$ will increase with respect to the weight perturbation $\hat { \epsilon }$ .
|
| 122 |
+
|
| 123 |
+
Computation SDS reduces the computational overhead in $F _ { 2 }$ and $B _ { 2 }$ . The reduction is linear in $1 - \gamma$ . The hyperparameter $\gamma$ can be tuned to meet up distinct requirements in efficiency and performance. SDS is configured the same as SWP for maximizing efficiency with comparable performance to SAM.
|
| 124 |
+
|
| 125 |
+
Generalization For the generalization capability, we now justify that the SAM loss computing over the batch $\mathbb { B }$ , $L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } )$ , can be approximately upper bounded by the corresponding loss evaluated only on $\mathbb { B } ^ { + }$ , $L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } )$ . From Equation 3, we have
|
| 126 |
+
|
| 127 |
+
$$
|
| 128 |
+
\begin{array} { r l } & { L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } ) = \gamma L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } ) + ( 1 - \gamma ) L _ { \mathbb { B } ^ { - } } ( f _ { \theta + \hat { \epsilon } } ) } \\ & { \quad \quad \quad \quad = L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } ) + ( 1 - \gamma ) [ L _ { \mathbb { B } ^ { - } } ( f _ { \theta + \hat { \epsilon } } ) - L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } ) ] } \\ & { \quad \quad \quad \quad = L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } ) + ( 1 - \gamma ) [ R _ { \mathbb { B } ^ { - } } ( f _ { \theta } ) + L _ { \mathbb { B } ^ { - } } ( f _ { \theta } ) - R _ { \mathbb { B } ^ { + } } ( f _ { \theta } ) - L _ { \mathbb { B } ^ { + } } ( f _ { \theta } ) ] . } \end{array}
|
| 129 |
+
$$
|
| 130 |
+
|
| 131 |
+
On the one hand, since $\begin{array} { r } { { \cal R } _ { \mathbb { B } } ( f _ { \theta } ) = \frac { 1 } { | \mathbb { B } | } \sum _ { ( x _ { i } , y _ { i } ) \in \mathbb { B } } [ \ell ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } ) - \ell ( f _ { \theta } , x _ { i } , y _ { i } ) ] } \end{array}$ represents the average sharpness of the batch $\mathbb { B }$ , by Equation 6, we have $R _ { \mathbb { B } ^ { - } } ( f _ { \theta } ) \leq R _ { \mathbb { B } } ( f _ { \theta } ) \leq R _ { \mathbb { B } ^ { + } } ( f _ { \theta } )$ , and
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
R _ { \mathbb { B } ^ { - } } ( f _ { \theta } ) - R _ { \mathbb { B } ^ { + } } ( f _ { \theta } ) \leq 0 .
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
On the other hand, $\mathbb { B } ^ { + }$ and $\mathbb { B } ^ { - }$ are constructed by sorting $\ell ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } ) - \ell ( f _ { \theta } , x _ { i } , y _ { i } )$ , which is positively correlated to $l ( f _ { \theta } , x _ { i } , y _ { i } )$ (Li et al., 2019) (more details can be found in Appendix A.2). Thus, we have
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
L _ { \mathbb { B } ^ { - } } ( f _ { \theta } ) - L _ { \mathbb { B } ^ { + } } ( f _ { \theta } ) \leq 0 .
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
Therefore, by Equation 8 and Equation 9, we have
|
| 144 |
+
|
| 145 |
+
$$
|
| 146 |
+
L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } ) \leq L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } ) .
|
| 147 |
+
$$
|
| 148 |
+
|
| 149 |
+
Experimental results in Figure 5 corroborate that $R _ { \mathbb { B } ^ { - } } ( f _ { \theta } ) - R _ { \mathbb { B } ^ { + } } ( f _ { \theta } ) < 0$ and $L _ { \mathbb { B } ^ { - } } ( f _ { \theta } ) \ – L _ { \mathbb { B } ^ { + } } ( f _ { \theta } ) <$ 0. Besides, Figure 6 verifies that the selected batch $\mathbb { B } ^ { + }$ is sufficiently representative to mimic the gradients of $\mathbb { B }$ since $\mathbb { B } ^ { + }$ has a significantly higher cosine similarity with $\mathbb { B }$ compared to $\mathbb { B } ^ { - }$ in terms of the computed gradients. According to Equation 10, one can utilize $L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } )$ as a proxy to the real objective to minimize of the overall loss $L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } )$ with a smaller number of samples. As a result, SDS improves SAM’s efficiency without performance degradation.
|
| 150 |
+
|
| 151 |
+
# 3 EXPERIMENTS
|
| 152 |
+
|
| 153 |
+
This section demonstrates the effectiveness of our proposed ESAM algorithm. We conduct experiments on several benchmark datasets: CIFAR-10 (Krizhevsky et al., 2009), CIFAR-100 (Krizhevsky et al., 2009) and ImageNet (Deng et al., 2009), using various model architectures: ResNet (He et al., 2016), Wide ResNet (Zagoruyko & Komodakis, 2016), and PyramidNet (Han et al., 2017). We demonstrate the proposed ESAM improves the efficiency of vanilla SAM by speeding up to $4 0 . 3 \%$ computational overhead with better generalization performance. We report the main results in Table 1 and Table 2. Besides, we perform an ablation study on the two proposed strategies of ESAM (i.e., SWP and SDS). The experimental results in Table 3 and Figure 3 indicate that both strategies improve SAM’s efficiency and performance.
|
| 154 |
+
|
| 155 |
+
# 3.1 RESULTS
|
| 156 |
+
|
| 157 |
+
CIFAR10 and CIFAR100 We start from evaluating ESAM on the CIFAR-10 and CIFAR-100 image classification datasets. The evaluation is carried out on three different model architectures: ResNet18 (He et al., 2016), WideResNet-28-10 (Zagoruyko & Komodakis, 2016) and PyramidNet-110 (Han et al., 2017). We set all the training settings, including the maximum number of training epochs, iterations per epoch, and data augmentations, the same for fair comparison among SGD, SAM and ESAM. Additionally, the other hyperparameters of SGD, SAM and ESAM have been tuned separately for optimal test accuracies using grid search.
|
| 158 |
+
|
| 159 |
+
We train all the models with 3 different random seeds using a batch size of 128, weight decay $1 0 ^ { - 4 }$ and cosine learning rate decay (Loshchilov & Hutter, 2017). The training epochs are set to be 200 for ResNet-18 (He et al., 2016), WideResNet-28-10 (Zagoruyko & Komodakis, 2016), and 300 for PyramidNet-110 (Han et al., 2017). We set $\beta = 0 . 6$ and $\gamma = 0 . 5$ for ResNet-18 and PyramidNet110 models; and set $\beta = 0 . 5$ and $\gamma = 0 . 5$ for WideResNet-28-10. The above-mentioned $\beta$ and $\gamma$ are optimal for efficiency with comparable performance compared to SAM. The details of training setting are listed in Appendix A.7. We record the best test accuracies obtained by SGD, SAM and ESAM in Table 1.
|
| 160 |
+
|
| 161 |
+
The experimental results indicate that our proposed ESAM can increase the training speed by up to $4 0 . 3 0 \%$ in comparison with SAM. Concerning the performance, ESAM outperforms SAM in the six sets of experiments. The best efficiency of ESAM is reported in CIFAR10 trained with ResNet-18 (Training speed $1 4 0 . 3 \%$ vs. SAM $1 0 0 \%$ ). The best accuracy is reported in CIFAR100 trained with PyramidNet110 (Accuracy $8 5 . 5 6 \%$ vs. SAM $8 4 . 4 6 \%$ ). ESAM improves efficiency and achieves better performance compared to SAM in CIFAR10/100 benchmarks.
|
| 162 |
+
|
| 163 |
+
Table 1: Classification accuracies and training speed on the CIFAR-10 and CIFAR-100 datasets. Computational overhead is quantified by #images processed per second (images/s). The numbers in parentheses (·) indicate the ratio of ESAM’s training speed w.r.t. SAM.
|
| 164 |
+
|
| 165 |
+
<table><tr><td></td><td colspan="2">CIFAR-10</td><td colspan="2">CIFAR-100</td></tr><tr><td>ResNet-18</td><td>Accuracy</td><td>images/s</td><td>Accuracy</td><td> images/s</td></tr><tr><td>SGD</td><td>95.41± 0.03</td><td>3,387</td><td>78.17± 0.05</td><td>3,483</td></tr><tr><td>SAM</td><td>96.52± 0.13</td><td>1,717(100.0%)</td><td>80.17± 0.17</td><td>1,730 (100.0%)</td></tr><tr><td>ESAM</td><td>96.56± 0.08</td><td>2,409 (140.3%)</td><td>80.41± 0.10</td><td>2,423 (140.0%)</td></tr><tr><td>Wide-28-10</td><td> Accuracy</td><td>images/s</td><td> Accuracy</td><td>images/s</td></tr><tr><td>SGD</td><td>96.34± 0.12</td><td>801</td><td>81.56± 0.13</td><td>792</td></tr><tr><td>SAM</td><td>97.27± 0.11</td><td>396 (100.0%)</td><td>83.42±0.04</td><td>391 (100.0%)</td></tr><tr><td>ESAM</td><td>97.29± 0.11</td><td>550 (138.9%)</td><td>84.51± 0.01</td><td>545 (139.4%)</td></tr><tr><td>PyramidNet-110</td><td> Accuracy</td><td>images/s</td><td>Accuracy</td><td>images/s</td></tr><tr><td>SGD</td><td>96.62± 0.10</td><td>580</td><td>81.89±0.17</td><td>555</td></tr><tr><td>SAM</td><td>97.30 ± 0.10</td><td>289 (100.0%)</td><td>84.46±0.04</td><td>276 (100.0%)</td></tr><tr><td>ESAM</td><td>97.81± 0.01</td><td>401 (138.7%)</td><td>85.56± 0.05</td><td>381 (137.9%)</td></tr></table>
|
| 166 |
+
|
| 167 |
+
ImageNet To evaluate ESAM’s effectiveness on a large-scale benchmark dataset, we conduct experiments on ImageNet Datasets.The 1000 class ImageNet dataset contains roughly 1.28 million training images and 50, 000 validation images with $4 6 9 \times 3 8 7$ averaged resolution. The ImageNet dataset is more representative (of real-world scenarios) and persuasive (of a method’s effectiveness) than CIFAR datasets. We resize the images on ImageNet to $2 2 4 \times 2 2 4$ resolution to train ResNet-50 and ResNet-101 models. We train 90 epochs and set the optimal hyperparameters for SGD, SAM and ESAM as suggested by Chen et al. (2021), and the details are listed in appendix A.7. We use $\beta = 0 . 6$ and $\gamma = 0 . 7$ for ResNet-50 and ResNet-101. We employ the $m$ -sharpness strategy for both SAM and ESAM with $m = 1 2 8$ , which is the same as that suggested in Zheng et al. (2021).
|
| 168 |
+
|
| 169 |
+
Table 2: Classification accuracies and training speed on the ImageNet dataset. The numbers in parentheses (·) indicate the ratio of ESAM’s training speed w.r.t. SAM’s. Results with \* are referred to Chen et al. (2021)
|
| 170 |
+
|
| 171 |
+
<table><tr><td></td><td colspan="2">ResNet-50</td><td colspan="2">ResNet-101</td></tr><tr><td>ImageNet</td><td> Accuracy</td><td>images/s</td><td> Accuracy</td><td> images/s</td></tr><tr><td>SGD</td><td>76.00*</td><td>1,327</td><td>77.80*</td><td>891</td></tr><tr><td>SAM</td><td>76.70*</td><td>654 (100.0%)</td><td>78.60*</td><td>438 (100.0%)</td></tr><tr><td>ESAM</td><td>77.05</td><td>846 (129.3%)</td><td>79.09</td><td>564 (128.7%)</td></tr></table>
|
| 172 |
+
|
| 173 |
+
The experimental results are reported in Table 2. The results indicate that the performance of ESAM on large-scale datasets is consistent with the two (smaller) CIFAR datasets. ESAM outperforms SAM by $0 . 3 5 \%$ to $0 . 4 9 \%$ in accuracy and, more importantly, enjoys $2 8 . 7 \%$ faster training speed compared to SAM. As the $\gamma$ we used here is larger than the one used in CIFAR datasets, the training speed of ESAM here is slightly slower than that in the CIFAR datasets.
|
| 174 |
+
|
| 175 |
+
These experiments demonstrate that ESAM outperforms SAM on a variety of benchmark datasets for widely-used DNNs’ architectures in terms of training speed and classification accuracies.
|
| 176 |
+
|
| 177 |
+
# 3.2 ABLATION AND PARAMETER STUDIES
|
| 178 |
+
|
| 179 |
+
To better understand the effectiveness of SWP and SDS in improving the performance and efficiency compared to SAM, we conduct four sets of ablation studies on CIFAR-10 and CIFAR-100 datasets using ResNet-18 and WideResNet-28-10 models, respectively. We consider two variants of ESAM: (i) only with SWP, (ii) only with SDS. The rest of the experimental settings are identical to the settings described in Section 3.1. We conduct grid search over the interval [0.3, 0.9] for $\beta$ and the interval [0.3, 0.9] for $\gamma$ , with a same step size of 0.1. We report the grid search results in Figure 3. We use $\beta = 0 . 6 , \gamma = 0 . 5$ for ResNet-18; and set $\beta = 0 . 5$ , $\gamma = 0 . 5$ for WideResNet-28-10 in the four sets of ablation studies. The ablation study results are reported in Table 3.
|
| 180 |
+
|
| 181 |
+
Table 3: Ablation Study of ESAM on CIFAR-10 and CIFAR100. The numbers in brackets [·] represent the accuracy improvement in comparison to SGD. The numbers in parentheses (·) indicate the ratio of ESAM’s training speed to SAM’s. Green color indicates improvement compared to SAM, whereas red color suggests a degradation.
|
| 182 |
+
|
| 183 |
+
<table><tr><td></td><td colspan="2">CIFAR-10</td><td colspan="2">CIFAR-100</td></tr><tr><td>ResNet-18</td><td>Accuracy</td><td>images/s</td><td>Accuracy</td><td>images/s</td></tr><tr><td>SGD</td><td>95.41</td><td>3,387</td><td>78.17</td><td>3,438</td></tr><tr><td>SAM</td><td>96.52 [+1.11]</td><td>1,717 (100.0%)</td><td>80.17 [+2.00]</td><td>1,730 (100.0%)</td></tr><tr><td>+ ESAM-SWP</td><td>96.74 [+1.33]</td><td>1,896 (110.5%)</td><td>80.53 [+2.36]</td><td>1,887 (109.1%)</td></tr><tr><td>+ ESAM-SDS</td><td>96.45 [+1.04]</td><td>2,105 (122.6%)</td><td>80.38 [+2.21]</td><td>2,103 (121.5%)</td></tr><tr><td>ESAM</td><td>96.56 [+1.15]</td><td>2,409 (140.3%)</td><td>80.41 [+2.24]</td><td>2,423 (140.9%)</td></tr><tr><td>Wide-28-10</td><td> Accuracy</td><td> images/s</td><td> Accuracy</td><td>images/s</td></tr><tr><td>SGD</td><td>96.34</td><td>801</td><td>81.56</td><td>792</td></tr><tr><td>SAM</td><td>97.27 [+0.93]</td><td>396 (100.0%)</td><td>83.42 [+1.86]</td><td>391 (100.0%)</td></tr><tr><td>+ ESAM-SWP</td><td>97.37 [+1.03]</td><td>430 (108.5%)</td><td>84.44 [+2.88]</td><td>423 (108.3%)</td></tr><tr><td>+ ESAM-SDS</td><td>97.24 [+0.90]</td><td>495 (124.8%)</td><td>84.46 [+2.90]</td><td>492 (125.8%)</td></tr><tr><td>ESAM</td><td>97.29 [+0.95]</td><td>551 (138.9%)</td><td>84.51 [+2.95]</td><td>545 (139.4%)</td></tr></table>
|
| 184 |
+
|
| 185 |
+

|
| 186 |
+
Figure 3: Parameter study of SWP and SDS. The connected dots refer to SWP and SDS with different parameters; the isolated dots refer to the final results of SGD, SAM, and ESAM.
|
| 187 |
+
|
| 188 |
+
ESAM-SWP As shown in Table 3, SWP improves SAM’s training speed by $8 . 3 \%$ to $1 0 . 5 \%$ , and achieves better performance at the same time. SWP can further improve the efficiency by using a smaller $\beta$ . The best performance of SWP is obtained when $\beta = 0 . 6$ for ResNet-18 and $\beta = 0 . 5$ for WideResNet-28-10. The four sets of experiments indicate that $\beta$ is consistent among different architectures and datasets. Therefore, we set $\beta = 0 . 6$ for PyramidNet on CIFAR10/100 datasets and ResNet on ImageNet datasets.
|
| 189 |
+
|
| 190 |
+
ESAM-SDS SDS also significantly improves the efficiency by $2 1 . 5 \%$ to $2 5 . 8 \%$ compared to SAM. It outperforms SAM’s performance on CIFAR100 datasets, and achieves comparable performance on CIFAR10 datasets. SDS can outperform SAM on both datasets with both architectures with little degradation to the efficiency, as demonstrated in Figure 3. Across all experiments, $\gamma = 0 . 5$ is the smallest value that is optimal for efficiency while maintaining comparable performance to SAM.
|
| 191 |
+
|
| 192 |
+
Visualization of Loss Landscapes To visualize the sharpness of the flat minima obtained by ESAM, we plot the loss landscapes trained with SGD, SAM and ESAM on the ImageNet dataset. We display the loss landscapes in Figure 4, following the plotting algorithm in Li et al. (2018). The $x \mathrm { - }$ and $y$ - axes represent two random sampled orthogonal Gaussian perturbations. We sampled $1 0 0 \times 1 0 0$ points for 10 groups random Gaussian perturbations. The displayed loss landscapes are the results we obtained by averaging over ten groups of random perturbations. It can be clearly seen that both SAM and ESAM improve the sharpness significantly in comparison to SGD.
|
| 193 |
+
|
| 194 |
+
To summarize, SWP and SDS both reduce the computational overhead and accelerate training compared to SAM. Most importantly, both these strategies achieve a comparable or better performance than SAM. In practice, by configuring the $\beta$ and $\gamma$ , ESAM can meet a variety of user-defined efficiency and performance requirements.
|
| 195 |
+
|
| 196 |
+
# 4 RELATED WORK
|
| 197 |
+
|
| 198 |
+
The concept of regularizing sharpness for better generalization dates back to (Hochreiter & Schmidhuber, 1995). By using an MDL-based argument, which clarifies that a statistical model with fewer bits to describe can have better generalization ability, Hochreiter & Schmidhuber (1995) claim that a flat minimum can alleviate overfitting issues. Following that, more studies were proposed to investigate the connection between the flat minima with the generalization abilities (Keskar et al., 2017; Dinh et al., 2017; Liu et al., 2020; Li et al., 2018; Dziugaite & Roy, 2017; Jiang et al., 2019; Moosavi-Dezfooli et al., 2019). Keskar et al. (2017) starts by investigating the phenomenon that training with a larger batch size results in worse generalization ability. The authors found that the sharpness of the minimum is critical in accounting for the observed phenomenon. Keskar et al. (2017) and Dinh et al. (2017) both argue that the sharpness can be characterized using the eigenvalues of the Hessian. Although they also define specific notions and methods to quantify sharpness, they do not propose complete training strategies to find minima that are relative “flat”.
|
| 199 |
+
|
| 200 |
+

|
| 201 |
+
Figure 4: Cross-entropy loss landscapes of the ResNet50 model on the ImageNet dataset trained with SGD, SAM, and ESAM.
|
| 202 |
+
|
| 203 |
+
SAM (Foret et al., 2020) leverages the connection between “flat” minima and the generalization error to train DNNs that generalize well across the natural distribution. Inspired by Keskar et al. (2017) and Dinh et al. (2017), SAM first proposes the quantification of the sharpness, which is achieved by solving a maximization problem. Then, SAM proposes a complete training algorithm to improve the generalization abilities of DNNs. SAM is demonstrated to achieve state-of-the-art performance in a variety of deep learning benchmarks, including image classification, natural language processing, and noisy learning (Foret et al., 2020; Chen et al., 2021; Kwon et al., 2021; Pham et al., 2021; Yuan et al., 2021; Jia et al., 2021).
|
| 204 |
+
|
| 205 |
+
A series of SAM-related works has been proposed. A work that was done contemporaneously SAM (Wu et al., 2020) also regularizes the sharpness term in adversarial training and achieves much more robust generalization performance against adversarial attacks. Many works focus on combining SAM with other training strategies or architectures (Chen et al., 2021; Wang et al., 2022; Tseng et al., 2021), or apply SAM on other tasks (Zheng et al., 2021; Damian et al., 2021; Galatolo et al., 2021). Kwon et al. (2021) improves SAM’s sharpness by adaptively scaling the size of the nearby search space $\rho$ in relation to the size of parameters. Liu et al. (2022) leverages the past calculated weight perturbations to save SAM’s computations. However, most of these works overlook the fact that SAM improves generalization at the expense of the doubling the computational overhead. As a result, most of the SAM-related works suffer from the same efficiency drawback as SAM. This computational cost prevents SAM from being widely used in large-scale datasets and architectures, particularly in real-world applications, which motivates us to propose ESAM to efficiently improve the generalization ability of DNNs.
|
| 206 |
+
|
| 207 |
+
# 5 CONCLUSION
|
| 208 |
+
|
| 209 |
+
In this paper, we propose the Efficient Sharpness Aware Minimizer (ESAM) to enhance the efficiency of vanilla SAM. The proposed ESAM integrates two novel training strategies, namely, SWP and SDS, both of which are derived based on theoretical underpinnings and are evaluated over a variety of datasets and DNN architectures. Both SAM and ESAM are two-step training strategies consisting of sharpness estimation and weight updating. In each step, gradient back-propagation is performed to compute the weight perturbation or updating. In future research, we will explore how to combine the two steps into one by utilizing the information of gradients in previous iterations so that the computational overhead of ESAM can be reduced to the same as base optimizers.
|
| 210 |
+
|
| 211 |
+
# ACKNOWLEDGEMENT
|
| 212 |
+
|
| 213 |
+
Jiawei Du and Joey Tianyi Zhou are suppored by Joey Tianyi Zhou’s A\*STAR SERC Central Research Fund.
|
| 214 |
+
|
| 215 |
+
Hanshu Yan and Vincent Tan are funded by a Singapore National Research Foundation (NRF) Fellowship (R-263-000-D02-281) and a Singapore Ministry of Education AcRF Tier 1 grant (R-263- 000-E80-114).
|
| 216 |
+
|
| 217 |
+
We would like to express our special thanks of gratitude to Dr. Yuan Li for helping us conduct experiments on ImageNet, and Dr. Wang Yangzihao for helping us implement Distributed Data Parallel codes.
|
| 218 |
+
|
| 219 |
+
# REFERENCES
|
| 220 |
+
|
| 221 |
+
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.
|
| 222 |
+
|
| 223 |
+
Xiangning Chen, Cho-Jui Hsieh, and Boqing Gong. When vision transformers outperform resnets without pretraining or strong data augmentations. arXiv preprint arXiv:2106.01548, 2021.
|
| 224 |
+
|
| 225 |
+
Alex Damian, Tengyu Ma, and Jason D Lee. Label noise sgd provably prefers flat global minimizers. Advances in Neural Information Processing Systems, 34, 2021.
|
| 226 |
+
|
| 227 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009.
|
| 228 |
+
|
| 229 |
+
Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp minima can generalize for deep nets. In International Conference on Machine Learning, pp. 1019–1028. PMLR, 2017.
|
| 230 |
+
|
| 231 |
+
Jiawei Du, Hu Zhang, Joey Tianyi Zhou, Yi Yang, and Jiashi Feng. Query-efficient meta attack to deep neural networks. In International Conference on Learning Representations, 2019.
|
| 232 |
+
|
| 233 |
+
Gintare Karolina Dziugaite and Daniel M Roy. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. arXiv preprint arXiv:1703.11008, 2017.
|
| 234 |
+
|
| 235 |
+
Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware minimization for efficiently improving generalization. In International Conference on Learning Representations, 2020.
|
| 236 |
+
|
| 237 |
+
Alessio Galatolo, Alfred Nilsson, Roderick Karlemstrand, and Yineng Wang. Using early-learning regularization to classify real-world noisy data. arXiv preprint arXiv:2105.13244, 2021.
|
| 238 |
+
|
| 239 |
+
Dongyoon Han, Jiwhan Kim, and Junmo Kim. Deep pyramidal residual networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5927–5935, 2017.
|
| 240 |
+
|
| 241 |
+
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.
|
| 242 |
+
|
| 243 |
+
Sepp Hochreiter and Jurgen Schmidhuber. Simplifying neural nets by discovering flat minima. In ¨ Advances in neural information processing systems, pp. 529–536, 1995.
|
| 244 |
+
|
| 245 |
+
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, pp. 4904–4916. PMLR, 2021.
|
| 246 |
+
|
| 247 |
+
Yiding Jiang, Behnam Neyshabur, Hossein Mobahi, Dilip Krishnan, and Samy Bengio. Fantastic generalization measures and where to find them. In International Conference on Learning Representations, 2019.
|
| 248 |
+
|
| 249 |
+
Nitish Shirish Keskar, Jorge Nocedal, Ping Tak Peter Tang, Dheevatsa Mudigere, and Mikhail Smelyanskiy. On large-batch training for deep learning: Generalization gap and sharp minima. In 5th International Conference on Learning Representations, ICLR 2017, 2017.
|
| 250 |
+
|
| 251 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR (Poster), 2015.
|
| 252 |
+
|
| 253 |
+
Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. CIFAR-10 and CIFAR-100 datasets. URl: https://www. cs. toronto. edu/kriz/cifar. html, 6(1):1, 2009.
|
| 254 |
+
|
| 255 |
+
Jungmin Kwon, Jeongseop Kim, Hyunseo Park, and In Kwon Choi. Asam: Adaptive sharpnessaware minimization for scale-invariant learning of deep neural networks. In International Conference on Machine Learning, pp. 5905–5914. PMLR, 2021.
|
| 256 |
+
|
| 257 |
+
Buyu Li, Yu Liu, and Xiaogang Wang. Gradient harmonized single-stage detector. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 8577–8584, 2019.
|
| 258 |
+
|
| 259 |
+
Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer, and Tom Goldstein. Visualizing the loss landscape of neural nets. Advances in neural information processing systems, 31, 2018.
|
| 260 |
+
|
| 261 |
+
Chen Liu, Mathieu Salzmann, Tao Lin, Ryota Tomioka, and Sabine Susstrunk. On the loss landscape ¨ of adversarial training: Identifying challenges and how to overcome them. Advances in Neural Information Processing Systems, 33:21476–21487, 2020.
|
| 262 |
+
|
| 263 |
+
Yong Liu, Siqi Mai, Xiangning Chen, Cho-Jui Hsieh, and Yang You. Towards efficient and scalable sharpness-aware minimization. arXiv preprint arXiv:2203.02714, 2022.
|
| 264 |
+
|
| 265 |
+
Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. 2017.
|
| 266 |
+
|
| 267 |
+
Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Jonathan Uesato, and Pascal Frossard. Robustness via curvature regularization, and vice versa. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9078–9086, 2019.
|
| 268 |
+
|
| 269 |
+
Yurii E Nesterov. A method for solving the convex programming problem with convergence rate $O ( 1 / k ^ { 2 } )$ . In Dokl. akad. nauk Sssr, volume 269, pp. 543–547, 1983.
|
| 270 |
+
|
| 271 |
+
Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nati Srebro. Exploring generalization in deep learning. Advances in neural information processing systems, 30, 2017.
|
| 272 |
+
|
| 273 |
+
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.
|
| 274 |
+
|
| 275 |
+
Chongli Qin, James Martens, Sven Gowal, Dilip Krishnan, Krishnamurthy Dvijotham, Alhussein Fawzi, Soham De, Robert Stanforth, and Pushmeet Kohli. Adversarial robustness through local linearization. Advances in Neural Information Processing Systems, 32, 2019.
|
| 276 |
+
|
| 277 |
+
Ching-Hsun Tseng, Shin-Jye Lee, Jia-Nan Feng, Shengzhong Mao, Yu-Ping Wu, Jia-Yu Shang, Mou-Chung Tseng, and Xiao-Jun Zeng. Upanets: Learning from the universal pixel attention networks. arXiv preprint arXiv:2103.08640, 2021.
|
| 278 |
+
|
| 279 |
+
Pichao Wang, Xue Wang, Hao Luo, Jingkai Zhou, Zhipeng Zhou, Fan Wang, Hao Li, and Rong Jin. Scaled relu matters for training vision transformers. 2022.
|
| 280 |
+
|
| 281 |
+
Dongxian Wu, Shu-Tao Xia, and Yisen Wang. Adversarial weight perturbation helps robust generalization. Advances in Neural Information Processing Systems, 33:2958–2969, 2020.
|
| 282 |
+
|
| 283 |
+
Hanshu Yan, Jiawei Du, Vincent Tan, and Jiashi Feng. On robustness of neural ordinary differential equations. In International Conference on Learning Representations, 2019.
|
| 284 |
+
|
| 285 |
+
Hanshu Yan, Jingfeng Zhang, Gang Niu, Jiashi Feng, Vincent YF Tan, and Masashi Sugiyama. CIFS: Improving adversarial robustness of CNNs via channel-wise importance-based feature selection. International Conference on Machine Learning, 2021.
|
| 286 |
+
Li Yuan, Qibin Hou, Zihang Jiang, Jiashi Feng, and Shuicheng Yan. Volo: Vision outlooker for visual recognition. arXiv preprint arXiv:2106.13112, 2021.
|
| 287 |
+
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In British Machine Vision Conference 2016. British Machine Vision Association, 2016.
|
| 288 |
+
Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning (still) requires rethinking generalization. Communications of the ACM, 64(3):107– 115, 2021.
|
| 289 |
+
Michael Zhang, James Lucas, Jimmy Ba, and Geoffrey E Hinton. Lookahead optimizer: k steps forward, 1 step back. Advances in Neural Information Processing Systems, 32, 2019.
|
| 290 |
+
Yaowei Zheng, Richong Zhang, and Yongyi Mao. Regularizing neural networks via adversarial model perturbation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8156–8165, 2021.
|
| 291 |
+
Pan Zhou, Hanshu Yan, Xiaotong Yuan, Jiashi Feng, and Shuicheng Yan. Towards understanding why lookahead generalizes better than SGD and beyond. In Proc. Conf. Neural Information Processing Systems, 2021.
|
| 292 |
+
|
| 293 |
+
# A APPENDIX
|
| 294 |
+
|
| 295 |
+
# A.1 THE ALGORITHM OF SAM
|
| 296 |
+
|
| 297 |
+
The algorithm of SAM is demonstrated in Algorithm 2.
|
| 298 |
+
|
| 299 |
+
# Algorithm 2 SGD vs. SAM
|
| 300 |
+
|
| 301 |
+
Input: Network $f _ { \theta }$ , $\theta = ( \theta _ { 1 } , \theta _ { 1 } , \ldots , \theta _ { N } )$ , Training set $\mathbb { S }$ , Batch size $b$ , Learning rate $\eta$ , Neighborhood size $\rho$ , Iterations $A$ .
|
| 302 |
+
|
| 303 |
+
Output: A minimum solution $\tilde { \theta }$ .
|
| 304 |
+
|
| 305 |
+
1: for $a = 1$ to $A$ do
|
| 306 |
+
2: Sample $\mathbb { B }$ with size b that $\mathbb { B } \subset \mathbb { S }$
|
| 307 |
+
3: if SGD then
|
| 308 |
+
4: $\hat { \epsilon } \gets 0$
|
| 309 |
+
5: else if SAM then
|
| 310 |
+
6: $\hat { \epsilon } \nabla _ { \theta } L _ { \mathbb { B } } ( f _ { \theta } )$
|
| 311 |
+
7: Compute $\boldsymbol { g } = \nabla _ { \boldsymbol { \theta } } L _ { \mathbb { B } } ( f _ { \boldsymbol { \theta } + \hat { \epsilon } } )$
|
| 312 |
+
8: update the weights $\theta \theta - \eta g$
|
| 313 |
+
|
| 314 |
+
# A.2 OPTIMIZING OVER SUBSET $\mathbb { B } ^ { + }$ IS REPRESENTATIVE
|
| 315 |
+
|
| 316 |
+
The sharpness-sensitive subset $\mathbb { B } ^ { + }$ is constructed by sorting $\ell ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } ) - \ell ( f _ { \theta } , x _ { i } , y _ { i } )$ , which is positively correlated to $l ( f _ { \theta } , x _ { i } , y _ { i } )$ . By a first-order Taylor series approximation,
|
| 317 |
+
|
| 318 |
+
$$
|
| 319 |
+
\begin{array} { r } { \ell \big ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } \big ) - \ell \big ( f _ { \theta } , x _ { i } , y _ { i } \big ) = \hat { \epsilon } \cdot \nabla _ { \theta } \ell \big ( f _ { \theta } , x _ { i } , y _ { i } \big ) + o \big ( \| \hat { \epsilon } \| \big ) . } \end{array}
|
| 320 |
+
$$
|
| 321 |
+
|
| 322 |
+
By Equation 4, $\hat { \epsilon }$ is the aggregated gradients of each instance in the complete dataset $\mathbb { B }$ , i.e.,
|
| 323 |
+
|
| 324 |
+
$$
|
| 325 |
+
\hat { \epsilon } = \underset { \epsilon : | | \epsilon | | _ { 2 } < \rho } { \arg \operatorname* { m a x } } L _ { \mathbb { S } } ( f _ { \theta + \epsilon } ) \approx \rho \nabla _ { \theta } L _ { \mathbb { S } } ( f _ { \theta } ) = \sum _ { i = 1 } ^ { | \mathbb { B } | } \nabla _ { \theta } \ell ( f _ { \theta } , x _ { i } , y _ { i } ) ,
|
| 326 |
+
$$
|
| 327 |
+
|
| 328 |
+
which indicates that $\ell ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } ) \ - \ \ell ( f _ { \theta } , x _ { i } , y _ { i } )$ is positively correlated to the gradient $\nabla _ { \theta } \ell ( f _ { \theta } , x _ { i } , y _ { i } )$ . Li et al. (2019) claims that the difficult examples in deep learning (the training samples with high training loss) produce gradients with larger magnitudes. Therefore, $\ell ( f _ { \theta + \hat { \epsilon } } , x _ { i } , y _ { i } ) -$ $\ell ( f _ { \theta } , x _ { i } , y _ { i } )$ is positively correlated to $l ( f _ { \theta } , x _ { i } , y _ { i } )$ . We also demonstrate the correlation empirically.
|
| 329 |
+
|
| 330 |
+
We conduct experiments to verify Equation 9 and Equation 10. In Figure 5, We plot the four losses, $L _ { \mathbb { B } ^ { + } } ( f _ { \theta } ) , L _ { \mathbb { B } ^ { - } } \bar { ( } f _ { \theta } ) , L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } )$ , and $L _ { \mathbb { B } ^ { - } } ( f _ { \theta + \hat { \epsilon } } )$ w.r.t the epochs. The experimental results verify that Equation 9 and Equation 10 hold for every training epoch.
|
| 331 |
+
|
| 332 |
+
Moreover, we conduct experiments to demonstrate that optimizing over the subset $\mathbb { B } ^ { + }$ is much more representative than the subset $\mathbb { B } ^ { - }$ . We compare the updating gradients computed from $\mathbb { B } ^ { + } , \mathbb { B } ^ { - }$ and a random subset $\mathbb { B } _ { \mathrm { r a n d } }$ that $\vert \mathbb { B } _ { \mathrm { r a n d } } \vert = \vert \mathbb { B } ^ { + } \vert = \vert \mathbb { B } ^ { - } \vert$ to those computed from $\mathbb { B }$ by calculating the cosine similarity inspired by (Du et al., 2019), i.e.
|
| 333 |
+
|
| 334 |
+
$$
|
| 335 |
+
\begin{array} { r l } & { \mathrm { C o s S i m } ( \nabla _ { \theta } L _ { \mathbb { B } ^ { + } } ( f _ { \theta + \hat { \epsilon } } ) , \nabla _ { \theta } L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } ) ) , } \\ & { \mathrm { C o s S i m } ( \nabla _ { \theta } L _ { \mathbb { B } ^ { - } } ( f _ { \theta + \hat { \epsilon } } ) , \nabla _ { \theta } L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } ) ) , } \\ & { \mathrm { C o s S i m } ( \nabla _ { \theta } L _ { \mathbb { B } _ { \mathrm { r a n d } } } ( f _ { \theta + \hat { \epsilon } } ) , \nabla _ { \theta } L _ { \mathbb { B } } ( f _ { \theta + \hat { \epsilon } } ) ) . } \end{array}
|
| 336 |
+
$$
|
| 337 |
+
|
| 338 |
+
In Figure 6, we plot the cosine similarities in each training epoch evaluated with ResNet-18, Wide28-10 on CIFAR10. In terms of the computed gradients, the experimental results show that $\mathbb { B } ^ { + }$ has the highest cosine similarities with $\mathbb { B }$ than $\mathbb { B } ^ { - }$ and the random set $\mathbb { B } _ { \mathrm { r a n d } }$ .
|
| 339 |
+
|
| 340 |
+
# A.3 LINEARITY MEASUREMENT OF SWP
|
| 341 |
+
|
| 342 |
+
As the experimental results in Figure 3 demonstrated, SWP can also improve the accuracy of ESAM compared to SAM. We will investigate the advantage of SWP in terms of generalization in the future research. Here we provide a discussion about the accuracy improvement contributed by SWP. A plausible reason for such improvement is that SWP leads to a better inner maximization solved in equation 2. The current solution of $\hat { \epsilon }$ is approximated by assuming $L _ { \mathbb { S } } ( f _ { \theta } )$ is a linear function. Therefore, the $\hat { \epsilon }$ would result in a better inner maximization if $L _ { \mathbb { S } } ( f _ { \theta } )$ is “more linear” with respect to $\theta$ . Inspired by (Qin et al., 2019; Yan et al., 2019; 2021), we measure the linearity of the loss function by
|
| 343 |
+
|
| 344 |
+

|
| 345 |
+
Figure 5: The SAM loss and the empirical loss calculated over the selected subsets $\mathbb { B } ^ { + }$ , $\mathbb { B } ^ { - }$ , w.r.t the epochs, as evaluated with ResNet-18, Wide-28-10 on CIFAR10 and CIFAR100. The subset $\mathbb { B } ^ { + }$ selected by SDS has much higher SAM loss and empirical loss than $\mathbb { B } ^ { - }$ among all the four groups of experiments.
|
| 346 |
+
|
| 347 |
+

|
| 348 |
+
Figure 6: The cosine similarity between the gradients computed from subsets $\mathbb { B } ^ { + }$ , $\mathbb { B } ^ { - }$ , and $\mathbb { B } _ { \mathrm { r a n d } }$ with $\mathbb { B }$ , as evaluated with ResNet-18, Wide-28-10 on CIFAR10 and CIFAR100. The gradients from the subset $\mathbb { B } ^ { + }$ selected by SDS has much higher cosine similarity with the gradients from $\mathbb { B }$ than the gradients from $\mathbb { B } ^ { - }$ and $\mathbb { B } _ { \mathrm { r a n d } }$ among all the four groups of experiments.
|
| 349 |
+
|
| 350 |
+
$$
|
| 351 |
+
\zeta ( \epsilon , \mathbb { B } ) = | L _ { \mathbb { B } } ( f _ { \theta + \epsilon } ) - L _ { \mathbb { B } } ( f _ { \theta } ) - \epsilon ^ { \top } \nabla _ { \theta } L _ { \mathbb { B } } ( f _ { \theta } ) | .
|
| 352 |
+
$$
|
| 353 |
+
|
| 354 |
+
We conduct experiments on the CIFAR10 dataset with ResNet-18 model to verify that SWP can improve the linearity $\zeta ( \epsilon , \mathbb { B } )$ of the loss function $L _ { \mathbb { S } } ( f _ { \theta } )$ . We compare the linearity of ESAM with the $\beta$ ranging from $\{ 0 . 2 , 0 . 3 , . . . , 0 . 9 \}$ to the SAM. The results are demonstrated in Figure 7. It can
|
| 355 |
+
|
| 356 |
+

|
| 357 |
+
Figure 7: The linearity measurement of SWP evaluated with the ResNet18 model on the CIFAR10 dataset compared with SAM. The experimental results indicate that a smaller $\beta$ can result in better linearity.
|
| 358 |
+
|
| 359 |
+
be shown that SWP will result in a better linearity as the $\beta$ decreases. However, decreasing $\beta$ will also reduce the magnitude of ˆ and thus result in a worse inner maximization in equation 2. We observe that $\beta = \{ \bar { 0 . 5 } , 0 . 6 \}$ is optimal to balance the accuracy and efficiency of ESAM.
|
| 360 |
+
|
| 361 |
+
# A.4 REDUCED COMPUTATIONAL OVERHEAD CONTRIBUTED BY SWP
|
| 362 |
+
|
| 363 |
+
Formulation We formulate the saved computational overhead contributed by SWP here. We discuss and examine the computational overhead in the PyTorch framework. Suppose that the NN we discussed here has $N$ layers. The most unit of parameters $( D \times C \times H \times W )$ is the entire parameters of a layer in NN, where $D$ is the number of kernels, $C$ is the number of channels, $H$ and $W$ are the height and width of the input. SWP select each basic parameter unit to compute gradients (i.e. requries grad $=$ True) with probability $\beta$ . We use $g ( N , \beta )$ to measure the saved computational overhead in terms of percentage contributed by SWP compared to the vanilla SAM.
|
| 364 |
+
|
| 365 |
+
The computational overhead $g ( N , \beta )$ is reduced not just by calculating gradients, but also by the storing and hooking gradients. Because the storing and hooking operations of each parameter’s gradients are independent to each other, the computational overhead saved from storing and hooking are proportional to $1 - \beta$ and irrelevant to the depth $N$ of NN. In addition, the storing and hooking gradients are the dominant factor that result in the reduced computational overhead according to our toy example in the following.
|
| 366 |
+
|
| 367 |
+
Next we discuss the saved computational overhead that stems from the calculation operations in the general case. Some layers in the DNNs with complicated architectures such as DenseNet and ViT, may have multiple basic parameter units in the same layer and be connected across any other layers. Suppose the $n _ { t h }$ layer has $K ( n )$ basic parameter units, let $p ^ { n }$ be the calculation-free rate of a certain parameter unit in $n _ { t h }$ layer, we have $p ^ { n } = ( 1 - \beta ) ^ { K ( n ) } \cdot p ^ { n - 1 }$ . Therefore, $p ^ { n } = ( 1 - \beta ) ^ { \sum _ { j = 1 } ^ { n } K ( j ) } \approx$ $( 1 - \beta ) ^ { n \bar { K } }$ , where $\begin{array} { r } { \bar { K } = \frac { 1 } { N } \sum _ { j = 1 } ^ { N } K ( j ) } \end{array}$ . Assumed that the computations of each layer are the same, by summing up the saved computational overhead of all parameters, we have
|
| 368 |
+
|
| 369 |
+
$$
|
| 370 |
+
\begin{array} { l } { \displaystyle g ( N , \beta ) = k _ { 1 } ( 1 - \beta ) + k _ { 2 } \sum _ { n = i } ^ { N } \frac { p ^ { n } } { N } } \\ { \displaystyle \approx k _ { 1 } ( 1 - \beta ) + \frac { k _ { 2 } ( 1 - \beta ) } { N [ 1 - ( 1 - \beta ) ^ { \tilde { K } } ] } } \\ { \displaystyle \approx k _ { 1 } ( 1 - \beta ) + \frac { k _ { 2 } ^ { \prime } ( 1 - \beta ) } { N \beta } . } \end{array}
|
| 371 |
+
$$
|
| 372 |
+
|
| 373 |
+
where k1, k2 are determined by the computing time of calculation, k02 = k2β[1−(1−β)K¯ ] .
|
| 374 |
+
|
| 375 |
+
However, the commonly used DNNs’ architectures such as ResNet only have one basic parameter unit in each layer. Besides, each layer of them is connected in serial with the next layer. Then, we have $p ^ { n } = ( 1 \bar { ~ } - \beta ) \cdot p ^ { n - 1 }$ . Therefore, $p ^ { n } = ( 1 - \beta ) ^ { n }$ . The saved calculation contributed by the parameter unit is $\scriptstyle { \frac { 1 } { N } } p ^ { n }$ . By summing up the saved computational overhead of all parameters, we have
|
| 376 |
+
|
| 377 |
+
$$
|
| 378 |
+
\begin{array} { l } { \displaystyle g ( N , \beta ) = k _ { 1 } ( 1 - \beta ) + k _ { 2 } \sum _ { n = i } ^ { N } \frac { p ^ { n } } { N } } \\ { \displaystyle = k _ { 1 } ( 1 - \beta ) + \frac { k _ { 2 } } { N } \frac { 1 - \beta - ( 1 - \beta ) ^ { N } } { \beta } } \\ { \displaystyle \approx k _ { 1 } ( 1 - \beta ) + \frac { k _ { 2 } ( 1 - \beta ) } { N \beta } . } \end{array}
|
| 379 |
+
$$
|
| 380 |
+
|
| 381 |
+
where $k _ { 1 }$ , $k _ { 2 }$ are determined by the computing time of calculation, storing and hooking gradients.
|
| 382 |
+
|
| 383 |
+
Toy Example We conducted a toy example on the CIFAR10 dataset with two MLPs. Each fully connected layer of MLP is the same with a size of 3, 000 for both in and out features. The first mlp is for the special case that $\bar { K } = 1$ , where each layer has only one basic parameter unit and is connected in serial with the next layer. We examined $\dot { N } = \{ 5 0 , 7 5 , 1 0 0 , 1 2 5 \}$ and $\beta = \{ 0 . 1 , . . . , 0 . 9 , 1 . 0 \}$ to record the saved computational overhead in percentage. Part of the results are reported in Table A.4. By linear regression, we have $k _ { 1 } = 0 . 3 1 8 5 , k _ { 2 } = 0 . 1 3 1 0$ , and the returned $\Dot { R } ^ { 2 } \ = \ 0 . 9 9 8 3$ . The second mlp is for the general case that $\bar { K } > 1$ , where each layer may have multiple basic parameter units in the same layer and be connected across any other layers. We examined $N = \{ 3 5 , 5 0 , 6 5 , 7 5 \}$ and $\beta = \{ 0 . 1 , . . . , 0 . 9 , 1 . 0 \}$ to record the saved computational overhead in percentage. Part of the results are reported in Table A.4. By linear regression, we have $k _ { 1 } = 0 . 3 1 4 3 , k _ { 2 } = 0 . 0 7 3 7$ , and the returned $\mathbf { \bar { \mathit { R } } ^ { 2 } } = 0 . 9 9 8 9$ . The above experimental results verify the formulation of the reduced computational overhead contributed by SWP in equation 11 and equation 12.
|
| 384 |
+
|
| 385 |
+
<table><tr><td>N</td><td>B</td><td>g(N,β)</td></tr><tr><td>50</td><td>0.9 0.5</td><td>3.42%</td></tr><tr><td>50 50</td><td>0.1</td><td>16.28% 30.08%</td></tr><tr><td>75</td><td>0.9</td><td>3.44%</td></tr><tr><td>75</td><td>0.5</td><td>15.79%</td></tr><tr><td>75</td><td>0.1</td><td>30.42%</td></tr><tr><td>100</td><td>0.9</td><td></td></tr><tr><td>100</td><td></td><td>3.37%</td></tr><tr><td></td><td>0.5</td><td>15.86%</td></tr><tr><td>100</td><td>0.1</td><td>29.56%</td></tr><tr><td>125</td><td>0.9</td><td>2.94%</td></tr><tr><td>125</td><td>0.5</td><td>14.87%</td></tr><tr><td>125</td><td>0.1</td><td>29.42%</td></tr></table>
|
| 386 |
+
|
| 387 |
+
<table><tr><td rowspan=1 colspan=1>N</td><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>g(N,β)</td></tr><tr><td rowspan=2 colspan=1>25</td><td rowspan=1 colspan=1>0.9</td><td rowspan=1 colspan=1>2.88%</td></tr><tr><td rowspan=1 colspan=1>0.5</td><td rowspan=1 colspan=1>15.54%</td></tr><tr><td rowspan=1 colspan=1>25</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>30.03%</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>0.9</td><td rowspan=1 colspan=1>2.34%</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>0.5</td><td rowspan=1 colspan=1>15.10%</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>29.83%</td></tr><tr><td rowspan=1 colspan=1>65</td><td rowspan=1 colspan=1>0.9</td><td rowspan=1 colspan=1>2.23%</td></tr><tr><td rowspan=1 colspan=1>65</td><td rowspan=1 colspan=1>0.5</td><td rowspan=1 colspan=1>14.95%</td></tr><tr><td rowspan=1 colspan=1>65</td><td rowspan=1 colspan=1>0.</td><td rowspan=1 colspan=1>29.22%</td></tr><tr><td rowspan=1 colspan=1>75</td><td rowspan=1 colspan=1>0.9</td><td rowspan=1 colspan=1>2.22%</td></tr><tr><td rowspan=1 colspan=1>75</td><td rowspan=1 colspan=1>0.5</td><td rowspan=1 colspan=1>15.10%</td></tr><tr><td rowspan=1 colspan=1>75</td><td rowspan=1 colspan=1>0.1</td><td rowspan=1 colspan=1>28.68%</td></tr></table>
|
| 388 |
+
|
| 389 |
+
Table 4: The special case that $\bar { K } = 1$ . By linear regression, $k _ { 1 } = 0 . 3 1 8 5 , k _ { 2 } = 0 . 1 3 1 0$ , and the returned $R ^ { 2 } = 0 . 9 9 8 3$ .
|
| 390 |
+
|
| 391 |
+
Table 5: The general case that $\bar { K } > 1$ . By linear regression, $\bar { k _ { 1 } } = 0 . 3 1 4 3 , \bar { k _ { 2 } } = 0 . 0 7 3 7$ , and the returned $R ^ { 2 } = 0 . 9 9 8 9$ .
|
| 392 |
+
|
| 393 |
+
# A.5 VISUALIZATION OF LOSS LANDSCAPES WITH RESPECT TO ADVERSARIAL WEIGHT PERTURBATIONS
|
| 394 |
+
|
| 395 |
+
We visualize the sharpness of the flat minima with respect to adversarial weight perturbations of SGD,SAM and ESAM on the Cifar10 dataset. The $x$ - and $y$ -axes represent two orthogonal adversarial weight perturbations, which are $\eta \nabla _ { \theta } L _ { \mathbb { B } _ { x } } ( f _ { \theta } )$ and $\eta \nabla _ { \theta } L _ { \mathbb { B } _ { y } } ( f _ { \theta } )$ respectively, where $\eta$ is the learning rate during training. $\mathbb { B } _ { x }$ and $\mathbb { B } _ { y }$ are the randomly sampled subsets of batch $\mathbb { B }$ , and $\begin{array} { r } { | \mathbb { B } _ { x } | = | \mathbb { B } _ { y } | = \frac { 1 } { 2 } | \mathbb { B } | } \end{array}$ , $\mathbb { B } _ { x } \cup \mathbb { B } _ { y } = \mathbb { B }$ . We display the loss landscape in Figure 8, which demonstrates that both SAM and ESAM improve the sharpness significantly in comparison to SGD.
|
| 396 |
+
|
| 397 |
+

|
| 398 |
+
Figure 8: Cross-entropy loss landscapes of the ResNet18 model respect to adversarial weight perturbations on the CIFAR10 dataset trained with SGD, SAM, and ESAM.
|
| 399 |
+
|
| 400 |
+
# A.6 EVALUATION OF ESAM ON VIT-S/16
|
| 401 |
+
|
| 402 |
+
SAM has also been demonstrated to be effective on the new vision Transformer(ViT) architecture (Chen et al., 2021). Therefore, we also evaluate ESAM with ViT-S/16 on ImageNet Datasets. We use $\beta = 0 . 5$ and $\gamma = 0 . 7$ for ViT-S/16, which share the same hyperparameters as ResNet-50 and ResNet-101 in section 3.1. The results are reported in Table 6, which indicate that ESAM can still be effective to improve efficiency in ViT-S/16 architecture. In particular, ESAM-SWP achieves much better accuracy than SAM $8 0 . 8 8 \%$ v.s. $8 0 . 3 4 \%$ ).
|
| 403 |
+
|
| 404 |
+
Table 6: Classification accuracies and training speed of ViT-S/16 on the ImageNet dataset.
|
| 405 |
+
|
| 406 |
+
<table><tr><td></td><td colspan="2">ViT-S/16</td></tr><tr><td>ImageNet</td><td>Accuracy</td><td> images/s</td></tr><tr><td>SGD</td><td>79.72</td><td>1,133</td></tr><tr><td>SAM</td><td>80.34</td><td>581</td></tr><tr><td>ESAM-SWP</td><td>80.88</td><td>616</td></tr><tr><td>ESAM-SDS</td><td>79.97</td><td>693</td></tr><tr><td>ESAM</td><td>80.46</td><td>734</td></tr></table>
|
| 407 |
+
|
| 408 |
+
# A.7 TRAINING DETAILS
|
| 409 |
+
|
| 410 |
+
We tune the training parameters of SGD, SAM, and ESAM, by using grid searches. The learning rate is chosen from the set $\{ 0 . 0 1 , 0 . 0 5 , 0 . 1 , 0 . 2 \}$ , the weight decay from the set $\{ 5 \times 1 0 ^ { - 4 } , 1 \times 1 \bar { 0 } ^ { - 3 } \}$ , and the batch size from the set $\{ 6 4 , 1 2 8 , 2 5 6 \}$ . This is done to attain the best accuracies. The exact training hyperparameters are reported in Table 7. On the ImageNet datasets, limited by the computing resource, we follow and slightly modify the optimal hyperparameters as suggested by Chen et al. (2021) for SGD, SAM and ESAM. The exact training hyperparameters are reported in Table 8.
|
| 411 |
+
|
| 412 |
+
Table 7: Hyperparameters for training from scratch on CIFAR10 and CIFAR100
|
| 413 |
+
|
| 414 |
+
<table><tr><td>ResNet-18</td><td colspan="3">CIFAR-10 SGD SAM</td><td colspan="3">CIFAR-100 SGD SAM ESAM</td></tr><tr><td>Epoch</td><td></td><td>200</td><td>ESAM</td><td></td><td>200</td><td></td></tr><tr><td>Batch size</td><td></td><td>128</td><td></td><td></td><td>128</td><td></td></tr><tr><td>Data augmentation</td><td></td><td>Basic</td><td></td><td></td><td>Basic</td><td></td></tr><tr><td>Peak learning rate</td><td></td><td>0.05</td><td></td><td></td><td>0.05</td><td></td></tr><tr><td>Learning rate decay</td><td></td><td>Cosine</td><td></td><td></td><td>Cosine</td><td></td></tr><tr><td>Weight decay</td><td>5×10-4</td><td>1 ×10-3</td><td>1 ×10-3</td><td>5×10-4</td><td>1×10-3</td><td>1 ×10-3</td></tr><tr><td>p</td><td>1</td><td>0.05</td><td>0.05</td><td>1</td><td>0.05</td><td>0.05</td></tr><tr><td>Wide-28-10</td><td>SGD</td><td>SAM</td><td>ESAM</td><td>SGD</td><td>SAM</td><td>ESAM</td></tr><tr><td>Epoch</td><td></td><td>200</td><td></td><td></td><td>200</td><td></td></tr><tr><td>Batch size</td><td></td><td>256</td><td></td><td></td><td>256</td><td></td></tr><tr><td>Data augmentation</td><td></td><td>Basic</td><td></td><td></td><td>Basic</td><td></td></tr><tr><td>Peak learning rate</td><td></td><td>0.05</td><td></td><td></td><td>0.05</td><td></td></tr><tr><td>Learning rate decay</td><td></td><td>Cosine</td><td></td><td></td><td>Cosine</td><td></td></tr><tr><td>Weight decay</td><td>5×10-4</td><td>1×10-3</td><td>1×10-3</td><td>5×10-4</td><td>1×10-3</td><td>1 ×10-3</td></tr><tr><td>p</td><td>1</td><td>0.1</td><td>0.1</td><td>-</td><td>0.1</td><td>0.1</td></tr><tr><td>PyramidNet-110</td><td>SGD</td><td>SAM</td><td>ESAM</td><td>SGD</td><td></td><td>ESAM</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>SAM</td><td></td></tr><tr><td>Epoch</td><td></td><td>300</td><td></td><td></td><td>300</td><td></td></tr><tr><td>Batch size</td><td></td><td>256</td><td></td><td></td><td>256</td><td></td></tr><tr><td>Data augmentation</td><td></td><td>Basic</td><td></td><td></td><td>Basic</td><td></td></tr><tr><td>Peak learning rate</td><td></td><td>0.1</td><td></td><td></td><td>0.1</td><td></td></tr><tr><td>Learning rate decay</td><td></td><td>Cosine</td><td></td><td></td><td>Cosine</td><td></td></tr><tr><td>Weight decay</td><td></td><td>5×10-4</td><td></td><td></td><td>5×10-4</td><td></td></tr><tr><td>P</td><td></td><td>0.2</td><td>0.2</td><td></td><td>0.2</td><td>0.2</td></tr></table>
|
| 415 |
+
|
| 416 |
+
Table 8: Hyperparameters for training from scratch on ImageNet
|
| 417 |
+
|
| 418 |
+
<table><tr><td>ImageNet</td><td>ResNet-50 SGD SAM ESAM</td><td colspan="2">ResNet-110 SGD SAM ESAM</td></tr><tr><td>Epoch</td><td>90</td><td>90</td><td></td></tr><tr><td>Batch size</td><td>512</td><td>512</td><td></td></tr><tr><td>Data augmentation</td><td>Inception-style</td><td>Inception-style</td><td></td></tr><tr><td>Peak learning rate</td><td>0.2</td><td>0.2</td><td></td></tr><tr><td>Learning rate decay</td><td>Cosine</td><td>Cosine</td><td></td></tr><tr><td>Weight decay</td><td>1×10-4</td><td>1×10-4</td><td></td></tr><tr><td>p</td><td>0.05 0.05</td><td>0.05</td><td>0.05</td></tr><tr><td>Input resolution</td><td>224× 224</td><td>224× 224</td><td></td></tr></table>
|
md/dev/n7XbkHOwKn6/n7XbkHOwKn6.md
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CogVideo: Large-scale Pretraining for Text-to-Video Generation via Transformers
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Large-scale pretrained transformers have created milestones in text (GPT-3) and
|
| 11 |
+
2 text-to-image (DALL-E and CogView) generation. Its application to video gen
|
| 12 |
+
3 eration is still facing many challenges: The potential huge computation makes
|
| 13 |
+
4 it unafforable for a full training; The scarcity and weak relevance of text-video
|
| 14 |
+
5 datasets hinder the model to understand complex movement semantics. In this
|
| 15 |
+
6 work, we present 9B-parameter transformer CogVideo, trained by inheriting a
|
| 16 |
+
7 pretrained text-to-image model, CogView2. We also propose multi-frame-rate
|
| 17 |
+
8 hierarchical training strategy to better align text and video clips. As (probably)
|
| 18 |
+
9 the first open-source large-scale pretrained text-to-video model, CogVideo outper
|
| 19 |
+
10 forms all publicly available models at a large margin in both machine and human
|
| 20 |
+
11 evaluations.
|
| 21 |
+
|
| 22 |
+

|
| 23 |
+
Figure 1: Samples generated by CogVideo. The actual text inputs are in Chinese. Each sample is a 4-second clip of 32 frames, and here we sample 9 frames uniformly for display purpose.
|
| 24 |
+
|
| 25 |
+
# 12 1 Introduction
|
| 26 |
+
|
| 27 |
+
13 Autoregressive transformers, e.g. DALL-E [19] and CogView [5], have revolutionized text-to-image
|
| 28 |
+
14 generation recently. It is natural to investigate the potential of autoregressive transformers on text
|
| 29 |
+
15 to-video generation. Previous works followed this basic framework [36, 9], e.g. VideoGPT [37],
|
| 30 |
+
16 verifying its superiority over GAN-based methods [4, 27], but are still far from satisfaction.
|
| 31 |
+
17 One common challenge is that the generated video frames tend to gradually deviate from the text
|
| 32 |
+
18 prompt, making the generated characters hard to perform the desired actions. Vanilla autoregressive
|
| 33 |
+
19 models might be good at synthesizing videos with regular (e.g. straightly moving cars) or random
|
| 34 |
+
20 patterns (e.g. speaking by randomly moving lips), but fail on text prompt such as “a lion is drinking
|
| 35 |
+
21 water”. The main difference between the two cases is that, in the former case the first frame already
|
| 36 |
+
22 provides sufficient information for the subsequent changes, while in the latter the model has to
|
| 37 |
+
23 precisely understand the action “drink” in order to correctly generate the desired action — the lion
|
| 38 |
+
24 lifts the glass to its lip, drinks and then puts down the glass.
|
| 39 |
+
25 Why do the autoregressive transformers well understand the text-image relations, but struggle to
|
| 40 |
+
26 understand the text-action relations in videos? We hypothesize that the datasets and the way to utilize
|
| 41 |
+
27 them are the main reasons.
|
| 42 |
+
28 First, it is possible to collect billions of high-quality text-image pairs from Internet [19], but the
|
| 43 |
+
29 text-video data are more scarce. The largest annotated text-video dataset, VATEX [32], has only
|
| 44 |
+
30 41,250 videos. The retrieval-based text-video pairs, e.g. Howto100M [17], are weakly relevant and
|
| 45 |
+
31 most of them only describe the scene without the temporal information.
|
| 46 |
+
32 Second, the duration of videos varies a lot. Previous models split the video into many clips with a
|
| 47 |
+
33 fixed number of frames for training, which destroys the alignment between the text and its temporal
|
| 48 |
+
34 counterparts in the video. If a “drinking” video is split into four individual clips of “holding a glass”,
|
| 49 |
+
35 “lifting”, “drinking” and “putting down” with the same text “drinking”, the model will be confused to
|
| 50 |
+
36 learn the accurate meaning of drinking.
|
| 51 |
+
37 Present Work. Here we present a large-scale pretrained text-to-video generative model, CogVideo,
|
| 52 |
+
38 which is of 9.4 billion parameters and trained on 5.4 million text-video pairs. We build CogVideo
|
| 53 |
+
39 based on a pretrained text-to-image model, CogView2 [6], in order to inherit the knowledge learned
|
| 54 |
+
40 from the text-image pretraining. To ensure the alignment between text and its temporal counterparts
|
| 55 |
+
41 in the video, we propose the multi-frame-rate hierarchical training. The flexibility of the textual
|
| 56 |
+
42 condition makes it possible to simply prepend a piece of text describing the frame rate to the original
|
| 57 |
+
43 text prompt for modeling different frame rates. To keep the text-video alignment, we choose a proper
|
| 58 |
+
44 frame rate description to include the complete action in each training sample. The frame rate token
|
| 59 |
+
45 also controls the intensity of the changes throughout continuous frames in generation. Specifically,
|
| 60 |
+
46 we train a sequential generation model and a frame interpolation model. The former model generates
|
| 61 |
+
47 key frames according to the text, and the latter recursively fill the middle frames by varying the frame
|
| 62 |
+
48 rates to make the video coherent. As shown in Figure 1, CogVideo can generate high-resolution
|
| 63 |
+
49 $( 4 8 0 \times 4 8 0 )$ videos. Human evaluation demonstrates that CogVideo outperforms all publicly available
|
| 64 |
+
50 models at a large margin. Our main contributions can be concluded as follows:
|
| 65 |
+
|
| 66 |
+
• We present CogVideo, which is the largest and the first open-source pretrained transformer for text-to-video generation in the general domain.
|
| 67 |
+
• CogVideo elegantly and efficiently finetunes a text-to-video generative model from a pretrained text-to-image generative model, avoiding the expensive full pretraining from scratch.
|
| 68 |
+
• We propose the multi-frame-rate hierarchical training to better align text-clip pairs, which significantly improves the generation accuracy, in particular for movements of complex semantics. This training strategy endows CogVideo with the capacity of controlling the intensity of changes during the generation.
|
| 69 |
+
|
| 70 |
+
# 9 2 Related Work
|
| 71 |
+
|
| 72 |
+
# 2.1 Video Generation
|
| 73 |
+
|
| 74 |
+
61 Video generation is a long-standing research topic. Most previous works focus on the next-frame
|
| 75 |
+
62 prediction task — forecasting the future frames based on the first video frame. Early works, e.g.
|
| 76 |
+
63 CDNA [8] and PredRNN [33], leverage deterministic methods to directly predict the next frame
|
| 77 |
+
64 via CNNs or RNNs. However, these deterministic models are unable to capture the stochastic
|
| 78 |
+
65 temporal patterns and synthesize coherent complex scenes. Generative models, especially Generative
|
| 79 |
+
66 Adversarial Networks [10] (GANs), begin to dominate the area as they can perform unconditional or
|
| 80 |
+
67 class-conditional video synthesis without the first frames. VGAN [31] is the first one to use GAN
|
| 81 |
+
68 for video generation. It decomposes video to a static background and a moving foreground, and
|
| 82 |
+
69 then generates them with 2D and 3D convolutional networks respectively. TGAN[20] proposes
|
| 83 |
+
70 to separately generate the temporal latent variables and spatial information, and MoCoGAN [27]
|
| 84 |
+
71 similarly decomposes the latent space into context and motion subspaces. DIGAN [38] applies
|
| 85 |
+
72 implicit neural representations for video encoding. Recently, text-to-video generation emerges as a
|
| 86 |
+
73 promising direction. The framework of VQVAE [29] and autoregressive transformers [30, 1] quickly
|
| 87 |
+
74 becomes the mainstream method [35, 36, 9]. Ho et al. [11] proposes video diffusion model along with
|
| 88 |
+
75 a gradient method recently for text-to-video generation. The previous methods are basically trained
|
| 89 |
+
76 on a specific dataset, e.g. UCF-101 [23], making the trained model domain-specific. Moreover, most
|
| 90 |
+
77 of these models are not publicly available.
|
| 91 |
+
|
| 92 |
+
# 78 2.2 Autoregressive Transformer
|
| 93 |
+
|
| 94 |
+
79 Recent years have witnessed the autoregressive transformer emerging as a powerful generative model.
|
| 95 |
+
80 The autoregressive models become the most prevalent framework for text generation [24]. With
|
| 96 |
+
81 its prominent capacity of fitting, transformer [30] gradually becomes the standard neural structure
|
| 97 |
+
82 for text generation. One milestone is GPT-3 [1]. In computer vision, van den Oord et al. [29]
|
| 98 |
+
83 first proposes to train a VQVAE to compress the image into a sequence of tokens from a learned
|
| 99 |
+
84 dictionary, which can be efficiently handled by autoregressive models. VQ-GAN [7] learns a more
|
| 100 |
+
85 semantic-aware dictionary for unconditional image generation. In the text-to-image generation, pre
|
| 101 |
+
86 trained autoregressive transformers such as DALL-E [19] and CogView [5] have shown superiority
|
| 102 |
+
87 in open-domain image generation. Besides the pure GPT-style generation, CogView2 [6] proposes a
|
| 103 |
+
88 new language model CogLM for infilling in the image generation.
|
| 104 |
+
89 Recent autoregressive transformers [18, 37, 35, 36] have also shown their superiority in video
|
| 105 |
+
90 generation. Among them, GODIVA [35] and NÜWA [36] focus on the open-domain text-to-video
|
| 106 |
+
91 generation. However, they simply generate frames or frame blocks one by one in a chronological
|
| 107 |
+
92 order, and may suffer from poor text-video alignment (Cf. $\ S 1$ ).
|
| 108 |
+
|
| 109 |
+
# 93 3 Method
|
| 110 |
+
|
| 111 |
+
94 In this section, we first introduce multi-frame-rate hierarchical training to better align text and
|
| 112 |
+
95 video semantics in $\ S \ 3 . 1$ , and then illustrate an efficient method dual-channel attention to inherit
|
| 113 |
+
96 the knowledge in pretrained text-image models for video generation in $\ S \ 3 . 2$ . To overcome the
|
| 114 |
+
97 large memory and time overhead caused by the large model and long sequence, we refer to Swin
|
| 115 |
+
98 Attention [14] and extend it to autoregressive video generation in $\ S \ 3 . 3$ .
|
| 116 |
+
|
| 117 |
+
# 99 3.1 Multi-frame-rate Hierarchical Training
|
| 118 |
+
|
| 119 |
+
100 Here we present the multi-frame-rate hierarchical training and generation. We follow the framework
|
| 120 |
+
101 of VQVAE [29] and first tokenize each frame into image tokens. Each training sample consists
|
| 121 |
+
102 of 5 frame of tokens, but our training method differs in the construction of training sequences and
|
| 122 |
+
103 generation process.
|
| 123 |
+
|
| 124 |
+
Training. The key design is to add a frame-rate token to the text and sample frames at this frame-rate to compose a fixed-length training sequence. The motivations are two folds:
|
| 125 |
+
|
| 126 |
+
06 (1) Directly separating the long video into clips at a fixed frame-rate often leads to semantic mis
|
| 127 |
+
07 matching. We still use the full text but the truncated clip might only contain incomplete action.
|
| 128 |
+
08 (2) The adjacent frames are usually very similar. A giant change over the previous frame will
|
| 129 |
+
09 probably incur a large loss. This will lead the models less inclined to explore the long-range
|
| 130 |
+
10 correlation because to simply copy the previous frame acts like a shortcut.
|
| 131 |
+
111 Therefore, in each training sample we want the text and the frames match as possible. We predefined
|
| 132 |
+
112 a series of frame-rates, and select the lowest frame-rate for each text-video pair, as long as we can
|
| 133 |
+
113 sample at least 5 frames at this frame-rate in the video.
|
| 134 |
+
114 Although the above method increase the alignment of text and video, the generation at a low frame
|
| 135 |
+
115 rate could be incoherent. We train another frame interpolation model to insert transition frames to the
|
| 136 |
+
116 generated samples of the sequential generation model. Thanks to the generality of CogLM [6], the
|
| 137 |
+
117 two models can share the same structure and training process only with different attention masks.
|
| 138 |
+
|
| 139 |
+

|
| 140 |
+
Figure 2: Multi-frame-rate hierarchical generation framework in CogVideo. Input sequence includes frame rate, text, frame tokens. [B] (Begin-of-image) is a separator token, inherited from $\mathrm { C o g V i e w } 2$ . In stage 1, $T _ { s }$ frames are generated sequentially on condition of frame rate and text. Then in stage 2, generated frames are re-input as bidirectional attention regions to recursively interpolate frames. Frame rate can be adjusted during both stages. Bidirectional attention regions are highlighted in blue , and unidirectional regions are highlighted in green .
|
| 141 |
+
|
| 142 |
+
Generation The multi-frame-rate hierarchical generation is a recursive process, illustrated in Figure 2. Specifically, the generation pipeline consists of a sequential generation stage and a recursive interpolation stage:
|
| 143 |
+
|
| 144 |
+
(1) Sequentially generate $T _ { s }$ key frames based on a low frame rate and text. The input sequence is [{Frame Rate}{Text} [B] {Frame1} ... {Frame $T _ { s } \mathbf { \boldsymbol { \mathbf { \jmath } } } )$ . In practice, we always set $T _ { s } = 5$ and the minimum sampling frame rate to 1 fps.
|
| 145 |
+
(2) Recursively interpolate frames based on the text, frame rate and known frames. In each round of interpolation, we split generated frames into multiple $\lceil \frac { T _ { s } } { 2 } \rceil$ -frame blocks overlapping at the beginning and the end, and interpolate a frame between the successive frames in each block. The input sequence is [{Frame Rate}{Text} [B] {Frame1} ... {Frame $T _ { s } \mathbf { \ } )$ , where Frame $\begin{array} { r } { 2 i ( i = 1 , 2 , . . . , \lfloor \frac { T _ { s } } { 2 } \rfloor ) } \end{array}$ are to be autoregressively generated. By recursively halfing {Frame Rate}, we can conduct finer and finer interpolation to generate videos of many frames.
|
| 146 |
+
|
| 147 |
+
130 The effect of CogLM. Tasks such as frame interpolation rely heavily on bidirectional information.
|
| 148 |
+
131 However, most previous works use GPT [35, 37, 36], which is unidirectional. To be aware of the
|
| 149 |
+
132 bidirectional context, we adopt Cross-Modal General Language Model (CogLM) proposed in [6]
|
| 150 |
+
133 which unites bidirectional context-aware mask prediction and autoregressive generation by dividing
|
| 151 |
+
134 tokens into unidirectional and bidirectional attention regions. While bidirectional regions can attend
|
| 152 |
+
135 to all bidirectional regions, unidirectional regions can attend to all bidirectional regions and previous
|
| 153 |
+
136 unidirectional regions. As shown in 2, (1) all frames in stage 1 and the 2nd, 4th frames in stage
|
| 154 |
+
137 2 are in the unidirectional region; (2) {Frame Rate}, {Text} and all other frames belong to the
|
| 155 |
+
138 bidirectional region. In this way, bidirectional attention context is fully exploited in text and given
|
| 156 |
+
139 frames without interfering auto-regressive frame prediction.
|
| 157 |
+
|
| 158 |
+
# 3.2 Dual-channel Attention
|
| 159 |
+
|
| 160 |
+
Large-scale pretraining usually demands a large dataset. For open
|
| 161 |
+
42 domain text-to-video generation, ideally we need the dataset to
|
| 162 |
+
43 cover sufficient text-video pairs to infer both spatial and tem
|
| 163 |
+
4 poral correlation between video and text. However, to collect
|
| 164 |
+
5 high quality text-video pairs is often difficult, expensive and time
|
| 165 |
+
46 consuming.
|
| 166 |
+
147 A natural idea is to make use of the image data to facilitate the
|
| 167 |
+
148 learning of spatial semantics. Video Diffusion Model [11] and
|
| 168 |
+
149 NÜWA [36] try to add text-image pairs into text-video training,
|
| 169 |
+
150 which achieves better results on multiple metrics. However, as
|
| 170 |
+
151 for training a video-only generation model, adding image data
|
| 171 |
+
152 will significantly increase training cost, especially in large-scale
|
| 172 |
+
153 pretraining scenarios.
|
| 173 |
+
154 In this paper, we propose to leverage pretrained image generation
|
| 174 |
+
155 models instead of image data. Pretrained text-to-image models,
|
| 175 |
+
156 e.g. CogView2 [6], already have a good command of the text
|
| 176 |
+
157 image relations. The coverage of the dataset to train these model
|
| 177 |
+
158 is also larger than that of videos.
|
| 178 |
+
|
| 179 |
+

|
| 180 |
+
Figure 3: Dual-channel attention. We initialize Attentionplus the same as Attention-base so that the model behaves exactly the same as CogView2 when it is initialized.
|
| 181 |
+
|
| 182 |
+
The proposed technique is dual-channel attention, where we only
|
| 183 |
+
|
| 184 |
+
160 add a new spatial-temporal attention channel to the pretrained CogView2 [6] at each transformer
|
| 185 |
+
161 layer. All the parameters in the CogView2 are frozen in the training, and only the parameters in the
|
| 186 |
+
162 newly added attention layer(See the Attention-plus in Figure 3) are trainable.
|
| 187 |
+
163 Here we also emphasize that directly finetuning CogView2 for text-to-video generation cannot well
|
| 188 |
+
164 inherit the knowledge, because the temporal attention follows a different attention pattern and quickly
|
| 189 |
+
165 ruins the pretrained weights during the initial phase of training with large gradients.
|
| 190 |
+
|
| 191 |
+
166 Specifically, a Transformer layer with dual-channel attention can be computed as
|
| 192 |
+
|
| 193 |
+
$$
|
| 194 |
+
\begin{array} { r l } & { \hat { x } _ { l } = \mathrm { L a y e r N o r m } ( x _ { l } ) , } \\ & { \widetilde { x } _ { l } = \alpha \cdot \mathrm { A t t e n t i o n - b a s e } ( \hat { x } _ { l } ) + ( 1 - \alpha ) , \cdot \mathrm { A t t e n t i o n - p l u s } ( \hat { x } _ { l } ) , } \\ & { x _ { l + 1 } = \mathrm { F F N } ( \mathrm { L a y e r N o r m } ( x _ { l } + \widetilde { x } _ { l } ) ) , } \end{array}
|
| 195 |
+
$$
|
| 196 |
+
|
| 197 |
+
167 where $x _ { l }$ denotes input features of layer $l$ ; Attention-base and Attention-plus denote two attention
|
| 198 |
+
168 channels; FFN and LayerNorm represent Feed-Forward Networks and LayerNorm respectively; $\alpha$
|
| 199 |
+
169 is a vector with length of hidden-size and normalized to $( 0 , 1 )$ . The whole structure is the same as
|
| 200 |
+
170 CogView2 when ignoring Attention-plus.
|
| 201 |
+
171 Both channels are computed as normal multi-head attention with a certain receptive field formulated
|
| 202 |
+
172 as follows. For token at $( t , x , y )$ in frame block of size $( T _ { s } , X , Y )$ (where $( t , x , y )$ corresponds to
|
| 203 |
+
173 coordination along time, height and width dimension), receptive field RF is a 3D block with extent
|
| 204 |
+
174 $l _ { t } , l _ { x } , l _ { y } \in \mathbb { N } ^ { + }$ :
|
| 205 |
+
|
| 206 |
+
$$
|
| 207 |
+
\mathrm { R F } _ { ( t , x , y ) } = \{ ( k , i , j ) \Bigm | | x - i | < l _ { x } , | y - j | < l _ { y } , | t - k | < l _ { t } , ( k , i , j ) \notin \mathrm { M a s k } _ { ( t , x , y ) } \} ,
|
| 208 |
+
$$
|
| 209 |
+
|
| 210 |
+
175 where $\mathbf { M a s k } _ { ( t , x , y ) }$ represents CogLM attention mask for token $( t , x , y )$ . For Attention-base, we
|
| 211 |
+
176 restrict receptive field to current frame, i.e, $l _ { x } = X , l _ { y } = Y , l _ { t } = 1$ , to fully use $\mathrm { C o g V i e w } 2$ ’s spatial
|
| 212 |
+
177 modeling ability (therefore referred to as spatial channel). For Attention-plus, which is the only
|
| 213 |
+
178 new parameters in CogVideo, we set receptive field to a 3D local block throughout the whole time
|
| 214 |
+
179 dimension, i.e. $l _ { x } = A _ { x } , l _ { y } = A _ { y } , l _ { t } = T _ { s }$ (therefore referred to as temporal channel). $A _ { x }$ , $A _ { y }$
|
| 215 |
+
180 are hyper-parameters satisfying $A _ { x } \leq X , A _ { y } \leq Y$ . With $A _ { x }$ and $A _ { y }$ , CogVideo is able to flexibly
|
| 216 |
+
181 trade off between quadratic attention cost and size of receptive field. In practice, we use shifted
|
| 217 |
+
182 window attention [15] as a approximation of 3D block attention and extend it to CogLM scenario, as
|
| 218 |
+
183 illustrated in subsection 3.3.
|
| 219 |
+
184 It is worth noting that two channels are fused and share the same FFN in each layer, because FFN
|
| 220 |
+
185 is a module of heavy parameters containing much vision knowledge. Due to similarity between
|
| 221 |
+
186 images and videos, bringing its knowledge to temporal channel will facilitate video modeling. Finally,
|
| 222 |
+
187 sharing FFN can reduce parameters, thus speed up training and reduce memory overhead.
|
| 223 |
+
|
| 224 |
+
# 3.3 Shifted Window Attention in Auto-regressive Generation
|
| 225 |
+
|
| 226 |
+
189 To overcome large time and memory overhead in temporal channel during training and inference,
|
| 227 |
+
190 we refer to Swin Attention proposed in [14] and extend it to auto-regressive scenario by applying
|
| 228 |
+
191 auto-regressive attention mask in shifted windows.
|
| 229 |
+
192 Different from non-autoregressive scenario which original Swin
|
| 230 |
+
193 Transformer explores, we propose that Swin Attention can fur
|
| 231 |
+
194 ther accelerate auto-regressive inference because of restricted
|
| 232 |
+
195 receptive field. As shown in Figure 4, receptive field is re
|
| 233 |
+
196 stricted by
|
| 234 |
+
|
| 235 |
+
• Auto-regressive mask. A token can only attend to previous frames or tokens before itself in current frame. • Shifted window. Only tokens within distance of window size in both width and height dimension can be directly attended to.
|
| 236 |
+
|
| 237 |
+

|
| 238 |
+
Figure 4: Receptive field (in yellow or green) for the token in red box. Shifted window size is $2 \times 2$ in this example.
|
| 239 |
+
|
| 240 |
+
02 Suppose $X , Y$ is the height and width of each frame, and $A _ { x } , A _ { y }$
|
| 241 |
+
|
| 242 |
+
203 are the height and width of shifted window. For two tokens at $( t _ { 1 } , x _ { 1 } , y _ { 1 } )$ and $( t _ { 2 } , x _ { 2 } , y _ { 2 } ) , t _ { 1 } < t _ { 2 }$
|
| 243 |
+
04 the latter cannot attend to the former either directly or indirectly if
|
| 244 |
+
|
| 245 |
+
$$
|
| 246 |
+
( x _ { 1 } - x _ { 2 } ) Y + ( y _ { 1 } - y _ { 2 } ) \geq ( t _ { 2 } - t _ { 1 } + 1 ) ( A _ { x } Y + A _ { y } )
|
| 247 |
+
$$
|
| 248 |
+
|
| 249 |
+
205 is satisfied. That is to say, the i-th token in frame $t _ { 1 }$ can be generated with the $( i - A _ { x } Y + A _ { y } )$ -th
|
| 250 |
+
206 token in frame $t _ { 1 } + 1$ in parallel. In this way, we can generate $\lfloor \frac { X Y } { A _ { x } Y + A _ { y } } \rfloor$ tokens in parallel at most,
|
| 251 |
+
207 thus greatly enhance parallelism and accelerate inference compared to auto-regressive with standard
|
| 252 |
+
208 attention which can only generate one token at a time.
|
| 253 |
+
|
| 254 |
+
# 4 Training
|
| 255 |
+
|
| 256 |
+
Based on methods above, the training details of CogVideo are listed as follows:
|
| 257 |
+
|
| 258 |
+
Model. The backbone of CogVideo in both stages is a Transformer with dual-channel attention. The Transformer has 48 layers, with the hidden size of 3072 in each attention channel, 48 attention heads and 9.4 billion parameters in total. Among them, 6 billion parameters are fixed to CogView2’s parameters, which includes Position-wise Feed-Forward Networks (FFN), spatial channel of dualchannel Attention, first frame’s positional embeddings and all image and text vocabulary embeddings. The specific implementation of Transformer structure is almost identical to CogView [5] such as using Sandwich LayerNorm and PB-Relax to stablize training. Shifted CogLM attention window is adoppted in recursive interpolation model with window size $1 0 \times 1 0$ .
|
| 259 |
+
|
| 260 |
+
Dataset. We pretrain our model on a dataset of 5.4 million captioned videos with a spatial resolution of $1 6 0 \mathrm { x } 1 6 0$ . For sequential generation model (Stage-1), we adjust frame rate in each sample to accomodate the whole video, while the minimum frame rate is set to 1 fps. For recursive interpolation model(Stage-2), we split videos into clips of different length to accomodate prediction on multiple frame rates including 2,4,8 fps.
|
| 261 |
+
|
| 262 |
+
Pretraining. The sequence lengths in both stages are 2065, consisting of 64 text tokens, 5 (frames) $\textbf { \em X } 4 0 0$ (per frame) image tokens, and 1 seperator token. Both text and images are tokenized with icetk1.The parameters are updated by Adam with max learning rate $= 2 \times 1 0 ^ { - \hat { 4 } }$ , $\beta _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 5$ weight decay $= 1 \times 1 0 ^ { - 2 }$ . See Appendix for pretraining details.
|
| 263 |
+
|
| 264 |
+
Table 1: (Left) Video generation performance on UCF-101. Class labels are used as text inputs. \* denotes the model is trained on the training split of UCF-101 only. (Right) Video generation performance on Kinetics-600. Metrics are measured on generated videos of 16 frames priming on first 5 frames, following settings in [18]. $^ { * * }$ denotes groundtruth used in FVD testing is blurred with our image tokenizer icetk.
|
| 265 |
+
|
| 266 |
+
<table><tr><td>Method</td><td>IS (↑)</td><td>FVD (↓)</td></tr><tr><td>VideoGPT[37]</td><td>24.69</td><td>1</td></tr><tr><td>DVD-GAN[4]</td><td>27.38</td><td>1</td></tr><tr><td>TGANv2[21]*</td><td>28.87</td><td>1209</td></tr><tr><td>MoCoGAN-HD[25]</td><td>32.36</td><td>838</td></tr><tr><td>DIGAN[38]*</td><td>29.71</td><td>655</td></tr><tr><td>DIGAN[38]</td><td>32.70</td><td>577</td></tr><tr><td>TATS-base[9]</td><td>79.28</td><td>332</td></tr><tr><td>CogVideo (Ours)</td><td>50.46</td><td>626</td></tr><tr><td>CogVideo (Ours)**</td><td>1</td><td>545</td></tr></table>
|
| 267 |
+
|
| 268 |
+
<table><tr><td>Method</td><td>FVD</td></tr><tr><td>Latent Video Tranformer[18] Video Transformer[34] DVD-GAN-FP[4]</td><td>224.73 170 69.15</td></tr><tr><td>TriVD-GAN-FP[16]</td><td>25.74</td></tr><tr><td>CogVideo (Ours) CogVideo (Ours)**</td><td>109.23 59.55</td></tr></table>
|
| 269 |
+
|
| 270 |
+
# 228 5 Experiments
|
| 271 |
+
|
| 272 |
+
# 5.1 Machine Evaluation
|
| 273 |
+
|
| 274 |
+
Machine evaluation is conducted on two popular benchmarks for video generation, i.e., UCF101 [23] and Kinetics-600 [3]. Following Rakhimov et al. [18], Yu et al. [38], we use Fréchet Video Distance(FVD) [28] and Inception score(IS) [22] as metrics in the evaluation. FVD is calculated based on I3D model[2] trained on Kinetics-400, and IS is based on C3D model [26] which was first trained with Sports-1M dataset [12] and then fine-tuned on the UCF101 dataset. Our evaluation code is the same as the official TGAN-v2 implementation2.
|
| 275 |
+
|
| 276 |
+
UCF-101 is a human action dataset consisted of 13,320 videos annotated with 101 action classes. Due to the image style and frame rate gap between CogVideo’s training set and UCF-101, we use class labels as the input text and fine-tune CogVideo on the whole dataset for 10,000 iterations with batch size $= 1 9 2$ . During inference, we sample class labels according to the class distribution. FVD and IS are evaluated over 2048 and 10,000 samples respectively, following Yu et al. [38]. Results are shown in Table 1 (Left).
|
| 277 |
+
|
| 278 |
+
Kinetics-600 dataset contains 600 classes of human action videos, with roughly $3 5 0 \mathrm { k }$ train and $5 0 \mathrm { k }$ test videos in total. We use the action category as input text, and fine-tune CogVideo on the training set for 12,000 iterations with batch size of 640. Following the setup of Weissenborn et al. [34], Rakhimov et al. [18], we center-crop and down-sample each frame to $6 4 \mathrm { x } 6 4$ , and measure with FVD. Results are shown in Table 1 (Right).
|
| 279 |
+
|
| 280 |
+
# 5.2 Human Evaluation
|
| 281 |
+
|
| 282 |
+
To further evaluate CogVideo, we invite 90 anonymous evaluators to rate for CogVideo and other opensource baselines including GAN-based model TGANv2 [21] and GPT-based model VideoGPT [37]. 30 classes in UCF101 are randomly picked as text conditions, and several aspects are rated (See Appendix for details). For VideoGPT, we use the official unconditonal pretrained model3 to generate samples. For TGANv2, we use the official source code to train an unconditional generation model under the same setting as that in Saito et al. [21]. To assign unconditionally generated samples into corresponding categories, we choose TSM [13] as the action recognition model and only samples with confidence ${ > } 8 0 \%$ . Results in Figure 5 show that CogVideo significantly outperforms baselines on multiple important aspects including frame texture, motion realism and semantice relevance, and achieves the top score by overall quality. It can be seen that $4 9 . 5 3 \%$ evaluators choose CogVideo as the best method, and only $1 5 . 4 2 \%$ and $5 . 6 \%$ favor VideoGPT and TGANv2, respectively.
|
| 283 |
+
|
| 284 |
+

|
| 285 |
+
Figure 5: Human evaluation results. "CogVideo 1Stage" refers to the method in ablation study, which generates videos sequentially with CogVideo’s Stage-1 Model only by recursively reinserting last 2 generated frames into input and generate future frames.
|
| 286 |
+
|
| 287 |
+
Table 2: Ablation study on a 5,000-sample subset of Kinetcis-600’s testset. FVD is evaluated on generated 11-frame samples priming on 5 frames and ground-truth blurred by our image tokenizer. The setting column indicates the difference between each method and CogVideo. Models of each setting are trained on Kinetics-600 trainset for 10,000 iterations with batch size of 320.
|
| 288 |
+
|
| 289 |
+
<table><tr><td>Method</td><td>Setting</td><td>FVD (↓)</td></tr><tr><td>CogVideo</td><td>None</td><td>108.27</td></tr><tr><td>1-stage Generation(Noverlap = 1)</td><td>-hierarchical</td><td>137.13</td></tr><tr><td>1-stage Generation(Noverlap = 2)</td><td>-hierarchical</td><td>120.82</td></tr><tr><td>Initialzed to CogView2</td><td>-Pretrain</td><td>124.92</td></tr><tr><td>Randomly Initialzed</td><td>- Pretrain - CogView</td><td>166.13</td></tr></table>
|
| 290 |
+
|
| 291 |
+
# 5.3 Ablation Study
|
| 292 |
+
|
| 293 |
+
To verify the effectiveness of hierarchical multi-frame-rate generation and incorporating CogView2, we conduct ablation study quantitatively and qualitatively on Kinetics-600 and UCF-101 datasets.
|
| 294 |
+
|
| 295 |
+
Hierarchical multi-frame-rate generation. In comparison with CogVideo, we fine-tune a 1-stage video generation model on Kinetics-600 from the sequential generation model in CogVideo, which generates long videos by recursively reinserting last $N _ { o v e r l a p }$ frames into the input to sample next $N _ { s } - N _ { o v e r l a p }$ frames. Larger $N _ { o v e r l a p }$ means more previous frames can be utilized during the inference, but will increase time overhead.
|
| 296 |
+
|
| 297 |
+
Dual-channel attention with CogView2’s weights. We additionally train (1) A randomly initialized model; (2) A model incorporating CogView2’s weights but leaving temporal channel randomly initialized and unfixed (equivalent to CogVideo without pretraining on videos) on Kinetics-600.
|
| 298 |
+
|
| 299 |
+
# 5.3.1 Quantitative Evaluation
|
| 300 |
+
|
| 301 |
+
All aforementioned models have been trained for 11,000 iterations with batch size of 160. Quantitative results are shown in Table 2. We can see that the hierarchical method is clearly superior to 1-stage generation with different $N _ { s }$ and model initialized with CogView2’s weights has lower FVD than randomly initialized one.
|
| 302 |
+
|
| 303 |
+
Figure 6 plots the training loss curve of (1) finetuning CogVideo; (2) training model from random initialization; (3) training model initialized to CogView2 and partially 280 fixed. We can see that CogView2 endows model with a good initialization point from which the loss function can converge faster to a lower value. Also, fixing part of the parameters to CogView2 reduce optimization cost, which gains more than $2 \mathbf { x }$ acceleration when using optimization CPU-offload mode in deepspeed.
|
| 304 |
+
|
| 305 |
+

|
| 306 |
+
Figure 6: Training loss in ablation study.
|
| 307 |
+
|
| 308 |
+

|
| 309 |
+
Figure 7: Video samples in ablation study, which are generated priming on class label and first 5 frames in Kinetics-600. All samples are down sampled by extracting one in every three frames for display purpose. (a) Use fine-tuned CogVideo to hierarchically generate samples. (b) Train a model on Kinetics-600 which is initialized as and partially fixed to CogView2, and hierarchically generate samples. (c) Train a model on Kinetics-600 which is randomly initialized, and hierarchically generate samples. (d)(e) Use fine-tuned CogVideo to generate frames in 1 stage with different $N _ { o v e r l a p }$ .
|
| 310 |
+
|
| 311 |
+
# 5.3.2 Qualitative Evaluation
|
| 312 |
+
|
| 313 |
+
Qualitative comparison is shown in Figure 7. While model trained from random initialization tends to produce irrational deformation, model incorporating CogView2 is able to model objects better. And samples generated hierarchically performs better on content consistency and motion rationalization.
|
| 314 |
+
|
| 315 |
+
We also conduct human evaluation between 1-stage and hierarchical video generation model under the same setting as 5.2. As shown in 5, hierarchical model, i.e. CogVideo, outperforms 1-stage model on semantic relevance, motion realism as well as texture quality. This is probably because 1-stage model tends to constantly generate small movements which make the whole video unrealistic, and if one generated frame collapses, the subsequent frames often suffer from severe degradation.
|
| 316 |
+
|
| 317 |
+
# 6 Conclusion
|
| 318 |
+
|
| 319 |
+
We present CogVideo, to the best of our knowledge, the largest and the first open-source pretrained transformer for text-to-video generation for the general domain. CogVideo is also the first attempt to efficiently leverage pretrained text-to-image generative model to text-to-video generation model without hurting its image generation capacity. With the proposed multi-frame-rate hierarchical training framework, CogVideo is endowed with better understanding of text-video relation and ability to control the intensity of changes during generation. We extend swin attention to CogLM, which achieves acceleration in both training and inference. There are still some limitations in CogVideo, e.g. restriction on length of the input sequence still exists due to the large scale of model and limitation of GPU memory, and we leave them for future work.
|
| 320 |
+
|
| 321 |
+
Broader Impact. This paper aims to advance the open-domain text-to-video generation, which will ease the effort of short video and digital art creation. The efficient training method transfers knowledge from text-to-image models to text-to-video models, which helps avoid training from scratch, and thus reduce the energy consumption and carbon emission. A negative impact is the risk of misinformation. To alleviate it, we can train an additional classifier to discriminate the fakes. We believe the benefits outweigh the downsides.
|
| 322 |
+
|
| 323 |
+
References
|
| 324 |
+
[1] T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
|
| 325 |
+
[2] J. Carreira and A. 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.
|
| 326 |
+
[3] J. Carreira, E. Noland, A. Banki-Horvath, C. Hillier, and A. Zisserman. A short note about kinetics-600. arXiv preprint arXiv:1808.01340, 2018.
|
| 327 |
+
[4] A. Clark, J. Donahue, and K. Simonyan. Adversarial video generation on complex datasets. arXiv preprint arXiv:1907.06571, 2019.
|
| 328 |
+
[5] M. Ding, Z. Yang, W. Hong, W. Zheng, C. Zhou, D. Yin, J. Lin, X. Zou, Z. Shao, H. Yang, et al. Cogview: Mastering text-to-image generation via transformers. Advances in Neural Information Processing Systems, 34, 2021.
|
| 329 |
+
[6] M. Ding, W. Zheng, W. Hong, and J. Tang. Cogview2: Faster and better text-to-image generation via hierarchical transformers. arXiv preprint arXiv:2204.14217, 2022.
|
| 330 |
+
[7] P. Esser, R. Rombach, and B. Ommer. Taming transformers for high-resolution image synthesis. arXiv preprint arXiv:2012.09841, 2020.
|
| 331 |
+
[8] C. Finn, I. Goodfellow, and S. Levine. Unsupervised learning for physical interaction through video prediction. Advances in neural information processing systems, 29, 2016.
|
| 332 |
+
[9] S. Ge, T. Hayes, H. Yang, X. Yin, G. Pang, D. Jacobs, J.-B. Huang, and D. Parikh. Long video generation with time-agnostic vqgan and time-sensitive transformer. arXiv preprint arXiv:2204.03638, 2022.
|
| 333 |
+
[10] I. J. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial networks. arXiv preprint arXiv:1406.2661, 2014.
|
| 334 |
+
[11] J. Ho, T. Salimans, A. Gritsenko, W. Chan, M. Norouzi, and D. J. Fleet. Video diffusion models. arXiv preprint arXiv:2204.03458, 2022.
|
| 335 |
+
[12] A. Karpathy, G. Toderici, S. Shetty, T. Leung, R. Sukthankar, and L. 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.
|
| 336 |
+
[13] J. Lin, C. Gan, and S. Han. Tsm: Temporal shift module for efficient video understanding. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 7083–7093, 2019.
|
| 337 |
+
[14] Z. Liu, Y. Lin, Y. Cao, H. Hu, Y. Wei, Z. Zhang, S. Lin, and B. Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 10012–10022, 2021.
|
| 338 |
+
[15] Z. Liu, J. Ning, Y. Cao, Y. Wei, Z. Zhang, S. Lin, and H. Hu. Video swin transformer. arXiv preprint arXiv:2106.13230, 2021.
|
| 339 |
+
[16] P. Luc, A. Clark, S. Dieleman, D. d. L. Casas, Y. Doron, A. Cassirer, and K. Simonyan. Transformation-based adversarial video prediction on large-scale data. arXiv preprint arXiv:2003.04035, 2020.
|
| 340 |
+
[17] 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. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 2630–2640, 2019.
|
| 341 |
+
[18] R. Rakhimov, D. Volkhonskiy, A. Artemov, D. Zorin, and E. Burnaev. Latent video transformer. arXiv preprint arXiv:2006.10704, 2020.
|
| 342 |
+
[19] A. Ramesh, M. Pavlov, G. Goh, S. Gray, C. Voss, A. Radford, M. Chen, and I. Sutskever. Zero-shot text-to-image generation. arXiv preprint arXiv:2102.12092, 2021.
|
| 343 |
+
[20] M. Saito, E. Matsumoto, and S. Saito. Temporal generative adversarial nets with singular value clipping. In Proceedings of the IEEE international conference on computer vision, pages 2830–2839, 2017.
|
| 344 |
+
[21] M. Saito, S. Saito, M. Koyama, and S. Kobayashi. Train sparsely, generate densely: Memoryefficient unsupervised training of high-resolution temporal gan. International Journal of Computer Vision, 128(10):2586–2606, 2020.
|
| 345 |
+
[22] T. Salimans, I. Goodfellow, W. Zaremba, V. Cheung, A. Radford, and X. Chen. Improved techniques for training gans. In Proceedings of the 30th International Conference on Neural Information Processing Systems, pages 2234–2242, 2016.
|
| 346 |
+
[23] K. Soomro, A. R. Zamir, and M. Shah. Ucf101: A dataset of 101 human actions classes from videos in the wild. arXiv preprint arXiv:1212.0402, 2012.
|
| 347 |
+
[24] I. Sutskever, J. Martens, and G. Hinton. Generating text with recurrent neural networks. In ICML’11, page 1017–1024, 2011.
|
| 348 |
+
[25] Y. Tian, J. Ren, M. Chai, K. Olszewski, X. Peng, D. N. Metaxas, and S. Tulyakov. A good image generator is what you need for high-resolution video synthesis. arXiv preprint arXiv:2104.15069, 2021.
|
| 349 |
+
[26] D. Tran, L. Bourdev, R. Fergus, L. Torresani, and M. Paluri. Learning spatiotemporal features with 3d convolutional networks. In Proceedings of the IEEE international conference on computer vision, pages 4489–4497, 2015.
|
| 350 |
+
[27] S. Tulyakov, M.-Y. Liu, X. Yang, and J. Kautz. Mocogan: Decomposing motion and content for video generation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1526–1535, 2018.
|
| 351 |
+
[28] T. Unterthiner, S. van Steenkiste, K. Kurach, R. Marinier, M. Michalski, and S. Gelly. Towards accurate generative models of video: A new metric & challenges. arXiv preprint arXiv:1812.01717, 2018.
|
| 352 |
+
[29] A. van den Oord, O. Vinyals, and K. Kavukcuoglu. Neural discrete representation learning. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 6309–6318, 2017.
|
| 353 |
+
[30] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin. Attention is all you need. arXiv preprint arXiv:1706.03762, 2017.
|
| 354 |
+
[31] C. Vondrick, H. Pirsiavash, and A. Torralba. Generating videos with scene dynamics. Advances in neural information processing systems, 29, 2016.
|
| 355 |
+
[32] X. Wang, J. Wu, J. Chen, L. Li, Y.-F. Wang, and W. Y. Wang. Vatex: A large-scale, highquality multilingual dataset for video-and-language research. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 4581–4591, 2019.
|
| 356 |
+
[33] Y. Wang, M. Long, J. Wang, Z. Gao, and P. S. Yu. Predrnn: Recurrent neural networks for predictive learning using spatiotemporal lstms. Advances in neural information processing systems, 30, 2017.
|
| 357 |
+
[34] D. Weissenborn, O. Täckström, and J. Uszkoreit. Scaling autoregressive video models. arXiv preprint arXiv:1906.02634, 2019.
|
| 358 |
+
[35] C. Wu, L. Huang, Q. Zhang, B. Li, L. Ji, F. Yang, G. Sapiro, and N. Duan. Godiva: Generating open-domain videos from natural descriptions. arXiv preprint arXiv:2104.14806, 2021.
|
| 359 |
+
[36] C. Wu, J. Liang, L. Ji, F. Yang, Y. Fang, D. Jiang, and N. Duan. N\" uwa: Visual synthesis pre-training for neural visual world creation. arXiv preprint arXiv:2111.12417, 2021.
|
| 360 |
+
[37] W. Yan, Y. Zhang, P. Abbeel, and A. Srinivas. Videogpt: Video generation using vq-vae and transformers. arXiv preprint arXiv:2104.10157, 2021.
|
| 361 |
+
[38] S. Yu, J. Tack, S. Mo, H. Kim, J. Kim, J.-W. Ha, and J. Shin. Generating videos with dynamicsaware implicit generative adversarial networks. arXiv preprint arXiv:2202.10571, 2022.
|
| 362 |
+
|
| 363 |
+
# Checklist
|
| 364 |
+
|
| 365 |
+
1. For all authors...
|
| 366 |
+
|
| 367 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 368 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 369 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes]
|
| 370 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 371 |
+
|
| 372 |
+
2. If you are including theoretical results...
|
| 373 |
+
|
| 374 |
+
(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]
|
| 375 |
+
|
| 376 |
+
3. If you ran experiments...
|
| 377 |
+
|
| 378 |
+
(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 later.
|
| 379 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 380 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No]
|
| 381 |
+
(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]
|
| 382 |
+
|
| 383 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 384 |
+
|
| 385 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] See footnotes.
|
| 386 |
+
(b) Did you mention the license of the assets? [No]
|
| 387 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 388 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No]
|
| 389 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No]
|
| 390 |
+
|
| 391 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 392 |
+
|
| 393 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [Yes] See supplemental material.
|
| 394 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 395 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [Yes]
|
md/dev/r9hNv76KoT3/r9hNv76KoT3.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/ucASPPD9GKN/ucASPPD9GKN.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/v54eUIayFh/v54eUIayFh.md
ADDED
|
@@ -0,0 +1,520 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UniControl: A Unified Diffusion Model for Controllable Visual Generation In the Wild
|
| 2 |
+
|
| 3 |
+
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 } } }$
|
| 4 |
+
|
| 5 |
+
†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
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
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
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
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].
|
| 14 |
+
|
| 15 |
+
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.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
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.
|
| 19 |
+
|
| 20 |
+
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.
|
| 21 |
+
|
| 22 |
+
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.
|
| 23 |
+
|
| 24 |
+
Table 1: Architecture and Model Size (#Params): UniControl vs. Multi-ControlNet
|
| 25 |
+
|
| 26 |
+
<table><tr><td></td><td>Stable Diffusion</td><td>ControlNet</td><td>MoE-Adapter</td><td>TaskHyperNet</td><td>Total</td></tr><tr><td>UniControl</td><td>1065.7M</td><td>361M</td><td>0.06M</td><td>12.7M</td><td>1.44B</td></tr><tr><td>Multi-ControlNet</td><td>1065.7M</td><td>361M×9</td><td>-</td><td>-</td><td>4.32B</td></tr></table>
|
| 27 |
+
|
| 28 |
+
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:
|
| 29 |
+
|
| 30 |
+
• We present UniControl, a unified model capable of handling various visual conditions for the controllable visual generation.
|
| 31 |
+
|
| 32 |
+
• 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.
|
| 33 |
+
|
| 34 |
+
• 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.
|
| 35 |
+
|
| 36 |
+
• 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.
|
| 37 |
+
|
| 38 |
+
# 2 Related Works
|
| 39 |
+
|
| 40 |
+
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.
|
| 41 |
+
|
| 42 |
+
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
|
| 43 |
+
|
| 44 |
+
ControlNet [21] are both built upon previous works on diffusion-based text-to-image generation [9].
|
| 45 |
+
[36] introduces the compositional conditions to guide visual generation.
|
| 46 |
+
|
| 47 |
+
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.
|
| 48 |
+
|
| 49 |
+
# 3 UniControl
|
| 50 |
+
|
| 51 |
+
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.
|
| 52 |
+
|
| 53 |
+
# 3.1 Training Setup
|
| 54 |
+
|
| 55 |
+
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.
|
| 56 |
+
|
| 57 |
+
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:
|
| 58 |
+
|
| 59 |
+
# Task-Aware Vision-Language Condition
|
| 60 |
+
|
| 61 |
+

|
| 62 |
+
Visual Condition $\mathcal { T } _ { c }$
|
| 63 |
+
|
| 64 |
+
Language Prompt :
|
| 65 |
+
“Camp on a mountain top: Birthday Presents,
|
| 66 |
+
Adventure, Outdoor, Mountain Camps, Great
|
| 67 |
+
View, Places, Hiking, Mornings Lights,
|
| 68 |
+
Himalayan Sunri”
|
| 69 |
+
|
| 70 |
+

|
| 71 |
+
Target output
|
| 72 |
+
|
| 73 |
+
Task Instruction $c _ { \mathrm { t a s k } }$ : “Canny Edge to Image”
|
| 74 |
+
|
| 75 |
+
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]:
|
| 76 |
+
|
| 77 |
+
$\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 )$ .
|
| 78 |
+
|
| 79 |
+
# 3.2 Model Design
|
| 80 |
+
|
| 81 |
+
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.
|
| 82 |
+
|
| 83 |
+

|
| 84 |
+
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.
|
| 85 |
+
|
| 86 |
+
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.
|
| 87 |
+
|
| 88 |
+
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.
|
| 89 |
+
|
| 90 |
+
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
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\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 } ) ,
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
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.
|
| 97 |
+
|
| 98 |
+

|
| 99 |
+
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.
|
| 100 |
+
|
| 101 |
+
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].
|
| 102 |
+
|
| 103 |
+
# 3.3 Task Generalization Ability
|
| 104 |
+
|
| 105 |
+
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:
|
| 106 |
+
|
| 107 |
+
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".
|
| 108 |
+
|
| 109 |
+
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.
|
| 110 |
+
|
| 111 |
+
# 4 Experiments
|
| 112 |
+
|
| 113 |
+
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.
|
| 114 |
+
|
| 115 |
+
# 4.1 Experiment Setup
|
| 116 |
+
|
| 117 |
+
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.
|
| 118 |
+
|
| 119 |
+

|
| 120 |
+
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.
|
| 121 |
+
|
| 122 |
+
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):
|
| 123 |
+
|
| 124 |
+
• Canny (2.8M): Utilize the Canny edge detector [57] with randomized thresholds.
|
| 125 |
+
|
| 126 |
+
• HED (2.8M): Deploy the Holistically-nested edge detection [58] for robust boundary determination.
|
| 127 |
+
|
| 128 |
+
• Depth (2.8M): Employ the Midas [59] for monocular depth estimation.
|
| 129 |
+
|
| 130 |
+
• Normal (2.8M): Use the depth estimation results from the depth task to estimate scene or object surface normals.
|
| 131 |
+
|
| 132 |
+
• Segmentation (2.8M): Implement the Uniformer [60] model, pre-trained on the ADE20K [61] dataset, to generate segmentation maps across 150 classes.
|
| 133 |
+
|
| 134 |
+
• Object Bounding Box (874K): Utilize YOLO V4 [62] pre-trained on the COCO [63] dataset for bounding box labelling across 80 object classes.
|
| 135 |
+
|
| 136 |
+
• Human Skeleton (1.3M): Employ the pre-trained Openpose [64] model to generate human skeleton labels from source images.
|
| 137 |
+
|
| 138 |
+
• Image Outpainting (2.8M): Create boundary masks for source images with random masking percentages from $20 \%$ to $80 \%$ .
|
| 139 |
+
|
| 140 |
+
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.
|
| 141 |
+
|
| 142 |
+
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.
|
| 143 |
+
|
| 144 |
+

|
| 145 |
+
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).
|
| 146 |
+
|
| 147 |
+

|
| 148 |
+
Figure 6: User study between our method and official ControlNet checkpoints on six tasks. Our method outperforms ControlNet on all tasks.
|
| 149 |
+
|
| 150 |
+
# 4.2 Visual Comparison
|
| 151 |
+
|
| 152 |
+
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.
|
| 153 |
+
|
| 154 |
+
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.
|
| 155 |
+
|
| 156 |
+

|
| 157 |
+
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$ .
|
| 158 |
+
|
| 159 |
+
# 4.3 Quantitative Evaluation
|
| 160 |
+
|
| 161 |
+
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.
|
| 162 |
+
|
| 163 |
+
Table 2: Image Perceptual Distance
|
| 164 |
+
|
| 165 |
+
<table><tr><td></td><td>Canny↓</td><td>HED↓</td><td>Normal↓</td><td>Depth↓</td><td>Pose↓</td><td>Segmentation ↓</td></tr><tr><td>UniControl</td><td>0.546</td><td>0.466</td><td>0.623</td><td>0.654</td><td>0.741</td><td>0.693</td></tr><tr><td>ControlNet</td><td>0.577</td><td>0.582</td><td>0.778</td><td>0.700</td><td>0.747</td><td>0.693</td></tr></table>
|
| 166 |
+
|
| 167 |
+
Image Perceptual Metric. We evaluate the distance between our output and the ground truth image. As we aim to obtain
|
| 168 |
+
|
| 169 |
+
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.
|
| 170 |
+
|
| 171 |
+
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.
|
| 172 |
+
|
| 173 |
+
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.
|
| 174 |
+
|
| 175 |
+
Table 3: Quantitative Comparison (FID)
|
| 176 |
+
|
| 177 |
+
<table><tr><td></td><td>Canny↓</td><td>HED↓</td><td>Depth ↓</td><td>Normal↓</td><td>Seg↓</td><td>Pose↓</td></tr><tr><td>GLIGEN [67]</td><td>24.9</td><td>27.8</td><td>25.8</td><td>27.7</td><td>-</td><td>=</td></tr><tr><td>T2I-Adapter [68]</td><td>23.6</td><td>1</td><td>25.4</td><td>-</td><td>27.1</td><td>28.9</td></tr><tr><td>ControlNet [21]</td><td>22.7</td><td>25.1</td><td>25.5</td><td>28.4</td><td>26.7</td><td>28.8</td></tr><tr><td>UniControl</td><td>22.9</td><td>23.6</td><td>21.3</td><td>23.4</td><td>25.5</td><td>27.4</td></tr></table>
|
| 178 |
+
|
| 179 |
+
Table 4: Ablation Study (FID)
|
| 180 |
+
|
| 181 |
+
<table><tr><td>MoE-Adapter</td><td>TaskHyperNet</td><td>Canny↓</td><td>HED↓</td><td>Depth ↓</td><td>Normal↓</td><td>Seg↓</td><td>Pose↓</td><td>Avg</td></tr><tr><td></td><td>X</td><td>27.2</td><td>29.0</td><td>27.6</td><td>28.8</td><td>29.1</td><td>30.2</td><td>28.7</td></tr><tr><td></td><td></td><td>24.5</td><td>26.1</td><td>23.7</td><td>24.8</td><td>26.9</td><td>28.3</td><td>25.7</td></tr><tr><td>x<></td><td>X</td><td>22.9</td><td>23.6</td><td>21.3</td><td>23.4</td><td>25.5</td><td>27.4</td><td>24.0</td></tr></table>
|
| 182 |
+
|
| 183 |
+
# 4.4 Zero-shot Generalization
|
| 184 |
+
|
| 185 |
+
We further showcase the surprising capabilities of our method to undertake the zero-shot challenge of hybrid conditions combination and unseen tasks generalization.
|
| 186 |
+
|
| 187 |
+
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.
|
| 188 |
+
|
| 189 |
+
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.
|
| 190 |
+
|
| 191 |
+
# 5 Conclusion and Discussion
|
| 192 |
+
|
| 193 |
+
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.
|
| 194 |
+
|
| 195 |
+
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.
|
| 196 |
+
|
| 197 |
+
# References
|
| 198 |
+
|
| 199 |
+
[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.
|
| 200 |
+
|
| 201 |
+
[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.
|
| 202 |
+
|
| 203 |
+
[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.
|
| 204 |
+
|
| 205 |
+
[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.
|
| 206 |
+
|
| 207 |
+
[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.
|
| 208 |
+
|
| 209 |
+
[6] OpenAI. Gpt-4 technical report, 2023.
|
| 210 |
+
|
| 211 |
+
[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.
|
| 212 |
+
|
| 213 |
+
[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.
|
| 214 |
+
|
| 215 |
+
[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.
|
| 216 |
+
|
| 217 |
+
[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.
|
| 218 |
+
|
| 219 |
+
[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.
|
| 220 |
+
|
| 221 |
+
[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.
|
| 222 |
+
|
| 223 |
+
[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.
|
| 224 |
+
|
| 225 |
+
[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.
|
| 226 |
+
|
| 227 |
+
[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/.
|
| 228 |
+
|
| 229 |
+
[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.
|
| 230 |
+
|
| 231 |
+
[17] OpenAI. Chatgpt. https://openai.com/blog/chatgpt/, 2022.
|
| 232 |
+
|
| 233 |
+
[18] Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. NeurIPS, 34:8780–8794, 2021.
|
| 234 |
+
|
| 235 |
+
[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.
|
| 236 |
+
|
| 237 |
+
[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.
|
| 238 |
+
|
| 239 |
+
[21] Lvmin Zhang and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models. arXiv preprint arXiv:2302.05543, 2023.
|
| 240 |
+
|
| 241 |
+
[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.
|
| 242 |
+
|
| 243 |
+
[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.
|
| 244 |
+
|
| 245 |
+
[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.
|
| 246 |
+
|
| 247 |
+
[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.
|
| 248 |
+
|
| 249 |
+
[26] David Ha, Andrew M. Dai, and Quoc V. Le. Hypernetworks. In International Conference on Learning Representations, 2017.
|
| 250 |
+
|
| 251 |
+
[27] Johannes Von Oswald, Christian Henning, Benjamin F Grewe, and João Sacramento. Continual learning with hypernetworks. arXiv preprint arXiv:1906.00695, 2019.
|
| 252 |
+
|
| 253 |
+
[28] Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In ICML, pages 2256–2265. PMLR, 2015.
|
| 254 |
+
|
| 255 |
+
[29] Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in Neural Information Processing Systems, 32, 2019.
|
| 256 |
+
|
| 257 |
+
[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.
|
| 258 |
+
|
| 259 |
+
[31] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. NeurIPS, 33:6840–6851, 2020.
|
| 260 |
+
|
| 261 |
+
[32] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv:2010.02502, October 2020. URL https://arxiv.org/abs/2010.02502.
|
| 262 |
+
|
| 263 |
+
[33] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In MICCAI, pages 234–241. Springer, 2015.
|
| 264 |
+
|
| 265 |
+
[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.
|
| 266 |
+
[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.
|
| 267 |
+
[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.
|
| 268 |
+
[37] Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. In CVPR, 2017.
|
| 269 |
+
[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.
|
| 270 |
+
[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.
|
| 271 |
+
[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.
|
| 272 |
+
[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.
|
| 273 |
+
[42] Bram Wallace, Akash Gokul, and Nikhil Naik. Edict: Exact diffusion inversion via coupled transformations. arXiv preprint arXiv:2211.12446, 2022.
|
| 274 |
+
[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.
|
| 275 |
+
[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.
|
| 276 |
+
[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.
|
| 277 |
+
[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.
|
| 278 |
+
[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.
|
| 279 |
+
[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.
|
| 280 |
+
[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.
|
| 281 |
+
[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.
|
| 282 |
+
[51] Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598, 2022.
|
| 283 |
+
|
| 284 |
+
[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.
|
| 285 |
+
|
| 286 |
+
[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.
|
| 287 |
+
|
| 288 |
+
[54] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
|
| 289 |
+
|
| 290 |
+
[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.
|
| 291 |
+
|
| 292 |
+
[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.
|
| 293 |
+
|
| 294 |
+
[57] John Canny. A computational approach to edge detection. IEEE Transactions on pattern analysis and machine intelligence, pages 679–698, 1986.
|
| 295 |
+
|
| 296 |
+
[58] Saining Xie and Zhuowen Tu. Holistically-nested edge detection. In Proceedings of the IEEE international conference on computer vision, pages 1395–1403, 2015.
|
| 297 |
+
|
| 298 |
+
[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.
|
| 299 |
+
|
| 300 |
+
[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.
|
| 301 |
+
|
| 302 |
+
[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.
|
| 303 |
+
|
| 304 |
+
[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.
|
| 305 |
+
|
| 306 |
+
[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.
|
| 307 |
+
|
| 308 |
+
[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.
|
| 309 |
+
|
| 310 |
+
[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.
|
| 311 |
+
|
| 312 |
+
[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.
|
| 313 |
+
|
| 314 |
+
[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.
|
| 315 |
+
|
| 316 |
+
# Appendix
|
| 317 |
+
|
| 318 |
+
# A Details of Implementation
|
| 319 |
+
|
| 320 |
+
# A.1 MOE-Style Adapter
|
| 321 |
+
|
| 322 |
+
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.
|
| 323 |
+
|
| 324 |
+
# A.2 Task-aware HyperNet
|
| 325 |
+
|
| 326 |
+
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.
|
| 327 |
+
|
| 328 |
+
# A.3 Data Collection
|
| 329 |
+
|
| 330 |
+
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.
|
| 331 |
+
|
| 332 |
+
# B Numerical Analysis of Task-Aware Modulated ControlNet
|
| 333 |
+
|
| 334 |
+
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.
|
| 335 |
+
|
| 336 |
+
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
|
| 337 |
+
|
| 338 |
+
$$
|
| 339 |
+
{ \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 } } ) .
|
| 340 |
+
$$
|
| 341 |
+
|
| 342 |
+
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 )$ .
|
| 343 |
+
|
| 344 |
+
Gradient Analysis. We analyze the gradient of the modulated part
|
| 345 |
+
|
| 346 |
+
$$
|
| 347 |
+
\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 } } ) ,
|
| 348 |
+
$$
|
| 349 |
+
|
| 350 |
+
where $I$ is the input of the zero convolution layer.
|
| 351 |
+
|
| 352 |
+
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.
|
| 353 |
+
|
| 354 |
+
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.
|
| 355 |
+
|
| 356 |
+
To conclude, the new task-aware Modulated ControlNet can still be efficiently updated and learned even if the convolution layers are initialized to zero.
|
| 357 |
+
|
| 358 |
+
# C Zero-shot-task Results and Analysis
|
| 359 |
+
|
| 360 |
+
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.
|
| 361 |
+
|
| 362 |
+
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.
|
| 363 |
+
|
| 364 |
+
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.
|
| 365 |
+
|
| 366 |
+
# D Details of User Study
|
| 367 |
+
|
| 368 |
+
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.
|
| 369 |
+
|
| 370 |
+

|
| 371 |
+
“Contemporary Bedroom Designs 2015 modern bedroom designs intended design”
|
| 372 |
+
|
| 373 |
+

|
| 374 |
+
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.
|
| 375 |
+
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.
|
| 376 |
+
|
| 377 |
+

|
| 378 |
+
Figure 10: Mturk interface to select the better generated image.
|
| 379 |
+
|
| 380 |
+

|
| 381 |
+
Figure 11: User study results of User Sketch to image generation.
|
| 382 |
+
|
| 383 |
+
# E Failure Cases
|
| 384 |
+
|
| 385 |
+
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.
|
| 386 |
+
|
| 387 |
+
# F Additional Results
|
| 388 |
+
|
| 389 |
+
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.
|
| 390 |
+
|
| 391 |
+

|
| 392 |
+
|
| 393 |
+

|
| 394 |
+
“La tricoteuse Realism William Adolphe Bouguereau Oil Paintings”
|
| 395 |
+
|
| 396 |
+

|
| 397 |
+
|
| 398 |
+
“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”
|
| 399 |
+
|
| 400 |
+

|
| 401 |
+
Figure 12: Failure Cases: distorted body (row one); blurred faces (row two); incorrect creation (row three).
|
| 402 |
+
|
| 403 |
+

|
| 404 |
+
|
| 405 |
+
“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”
|
| 406 |
+
|
| 407 |
+

|
| 408 |
+
Figure 13: More zero-shot-task deblurring results.
|
| 409 |
+
|
| 410 |
+
Gray Image
|
| 411 |
+
|
| 412 |
+

|
| 413 |
+
|
| 414 |
+
Our Result
|
| 415 |
+
|
| 416 |
+

|
| 417 |
+
|
| 418 |
+
# “Long White Casual Wedding Dress”
|
| 419 |
+
|
| 420 |
+

|
| 421 |
+
|
| 422 |
+

|
| 423 |
+
|
| 424 |
+
“Pixie Cropped Short Layered Synthetic Wig for Women-KAMI WIGS”
|
| 425 |
+
|
| 426 |
+

|
| 427 |
+
Figure 14: More zero-shot-task gray-to-RGB colorization results.
|
| 428 |
+
|
| 429 |
+

|
| 430 |
+
|
| 431 |
+
“Early morning view over the town of Tinerhir, south of the Todra Gorge, Morocco, North Africa, Africa”
|
| 432 |
+
|
| 433 |
+

|
| 434 |
+
“A lone duck basks in the calm lake's mirror reflection of the Chugach mountain valley”
|
| 435 |
+
|
| 436 |
+

|
| 437 |
+
“Chancellor of the Exchequer Rishi Sunak was the most high-profile, and unexpected, appointment of the day”
|
| 438 |
+
|
| 439 |
+

|
| 440 |
+
“Contemporary Bedroom Designs 2015 modern bedroom designs intended design “
|
| 441 |
+
Figure 15: More zero-shot-task image in-painting results. The in-painting MOE adapter weights are directly inherited from outpainting.
|
| 442 |
+
|
| 443 |
+

|
| 444 |
+
|
| 445 |
+

|
| 446 |
+
Figure 17: HED to Image Generation
|
| 447 |
+
|
| 448 |
+
(d) “A young girl who is brushing her teeth with a toothbrush.”
|
| 449 |
+
|
| 450 |
+

|
| 451 |
+
Figure 18: Depth to Image Generation
|
| 452 |
+
|
| 453 |
+

|
| 454 |
+
|
| 455 |
+

|
| 456 |
+
|
| 457 |
+

|
| 458 |
+
Figure 19: Surface Normal to Image Generation
|
| 459 |
+
|
| 460 |
+

|
| 461 |
+
|
| 462 |
+

|
| 463 |
+
|
| 464 |
+
(a) “Photo of handsome man in black leather jacket”
|
| 465 |
+
|
| 466 |
+

|
| 467 |
+
Input Image<Captio
|
| 468 |
+
|
| 469 |
+

|
| 470 |
+
Our Method Outputhe snow.
|
| 471 |
+
|
| 472 |
+
(b) “A woman is sitting near a prominent landmark”
|
| 473 |
+
|
| 474 |
+

|
| 475 |
+
Our Method Outputdesk
|
| 476 |
+
|
| 477 |
+
(c) “A man that has ski’s and is standing in the snow.”
|
| 478 |
+
|
| 479 |
+

|
| 480 |
+
Input Image<
|
| 481 |
+
Figure 20: Human Pose Skeleton to Image Generation
|
| 482 |
+
|
| 483 |
+
(d) “A woman is sitting in front of a desk”
|
| 484 |
+
|
| 485 |
+

|
| 486 |
+
|
| 487 |
+

|
| 488 |
+
Input Image
|
| 489 |
+
|
| 490 |
+

|
| 491 |
+
Our Method Output
|
| 492 |
+
|
| 493 |
+
(a) “A bench at the beach next to the sea”ion>: Water traffic along the Thames by Big
|
| 494 |
+
|
| 495 |
+

|
| 496 |
+
|
| 497 |
+

|
| 498 |
+
Our Method Output
|
| 499 |
+
|
| 500 |
+
(b) “Water traffic along the Thames by Big Ben”
|
| 501 |
+
|
| 502 |
+

|
| 503 |
+
|
| 504 |
+
(c) “A well-lit and well-decorated living room shows a glimpse of a glass front door through the corridor.”
|
| 505 |
+
|
| 506 |
+

|
| 507 |
+
Figure 22: Segmentation Map (by Uniformer-ADE20K) to Image Generation
|
| 508 |
+
|
| 509 |
+

|
| 510 |
+
Figure 23: Image Outpainting
|
| 511 |
+
|
| 512 |
+
(d) “Beautiful kitchen grand scale living pinterest for Kitchen cabinets lowes with old world metal wall art”
|
| 513 |
+
|
| 514 |
+

|
| 515 |
+
|
| 516 |
+

|
| 517 |
+
(a) “A Limited Edition, Fine Art photograph of a beautiful sunrise at Lake Jackson in Sebring, Florida. Available as a Fine Art print”
|
| 518 |
+
Figure 24: User Sketch to Image Generation
|
| 519 |
+
|
| 520 |
+
(d) “Superhero watching over city. No transparency used. Basic (linear) gradients. A4 proportions.”
|
md/dev/w6fj2r62r_H/w6fj2r62r_H.md
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Torsional Diffusion for Molecular Conformer Generation
|
| 2 |
+
|
| 3 |
+
Bowen Jing,∗ 1 Gabriele Corso,∗ 1 Jeffrey Chang,2 Regina Barzilay,1 Tommi Jaakkola1 1CSAIL, Massachusetts Institute of Technology 2Dept. of Physics, Harvard University
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
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.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
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.
|
| 12 |
+
|
| 13 |
+
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.
|
| 14 |
+
|
| 15 |
+
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.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
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.
|
| 19 |
+
|
| 20 |
+
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.
|
| 21 |
+
|
| 22 |
+
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.
|
| 23 |
+
|
| 24 |
+
Our main contributions are:
|
| 25 |
+
|
| 26 |
+
• 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.
|
| 27 |
+
• 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.
|
| 28 |
+
• 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.
|
| 29 |
+
|
| 30 |
+
# 2 Background
|
| 31 |
+
|
| 32 |
+
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):
|
| 33 |
+
|
| 34 |
+
$$
|
| 35 |
+
d \mathbf { x } = \mathbf { f } ( \mathbf { x } , t ) ~ d t + g ( t ) ~ d \mathbf { w } , ~ t \in ( 0 , T )
|
| 36 |
+
$$
|
| 37 |
+
|
| 38 |
+
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
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
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 } }
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
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.
|
| 45 |
+
|
| 46 |
+
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.
|
| 47 |
+
|
| 48 |
+
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.
|
| 49 |
+
|
| 50 |
+
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].
|
| 51 |
+
|
| 52 |
+
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.
|
| 53 |
+
|
| 54 |
+
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.
|
| 55 |
+
|
| 56 |
+
# 3 Torsional Diffusion
|
| 57 |
+
|
| 58 |
+
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$ .
|
| 59 |
+
|
| 60 |
+
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.
|
| 61 |
+
|
| 62 |
+
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.
|
| 63 |
+
|
| 64 |
+
# 3.1 Diffusion modeling on $\mathbb { T } ^ { m }$
|
| 65 |
+
|
| 66 |
+
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].
|
| 67 |
+
|
| 68 |
+
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$ .
|
| 69 |
+
|
| 70 |
+
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
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
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)
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
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
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
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]
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
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.
|
| 83 |
+
|
| 84 |
+
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 }$ .
|
| 85 |
+
|
| 86 |
+
# 3.2 Torsional score framework
|
| 87 |
+
|
| 88 |
+
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].
|
| 89 |
+
|
| 90 |
+
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.
|
| 91 |
+
|
| 92 |
+

|
| 93 |
+
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.
|
| 94 |
+
|
| 95 |
+
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).
|
| 96 |
+
|
| 97 |
+
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 } )$ ,
|
| 98 |
+
|
| 99 |
+
$$
|
| 100 |
+
\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}
|
| 101 |
+
$$
|
| 102 |
+
|
| 103 |
+
where $\hat { \bf r } _ { b _ { i } c _ { i } } = ( x _ { c _ { i } } - x _ { b _ { i } } ) / \vert \vert x _ { c _ { i } } - x _ { b _ { i } } \vert \vert .$
|
| 104 |
+
|
| 105 |
+
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.
|
| 106 |
+
|
| 107 |
+
# 3.3 Parity equivariance
|
| 108 |
+
|
| 109 |
+
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,
|
| 110 |
+
|
| 111 |
+
Proposition 2. I $^ { \prime } p ( \pmb { \tau } ( C ) \mid L ( C ) ) = p ( \pmb { \tau } ( - C ) \mid L ( - C ) )$ , then for all diffusion times $t$
|
| 112 |
+
|
| 113 |
+
$$
|
| 114 |
+
\nabla _ { \tau } \log { p _ { t } ( \tau ( C ) \mid L ( C ) ) } = - \nabla _ { \tau } \log { p _ { t } ( \tau ( - C ) \mid L ( - C ) ) }
|
| 115 |
+
$$
|
| 116 |
+
|
| 117 |
+
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 }$ .
|
| 118 |
+
|
| 119 |
+
# 3.4 Score network architecture
|
| 120 |
+
|
| 121 |
+
Based on sections 3.2 and 3.3, the desiderata for the score model are:
|
| 122 |
+
|
| 123 |
+
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.
|
| 124 |
+
|
| 125 |
+
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.
|
| 126 |
+
|
| 127 |
+
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.
|
| 128 |
+
|
| 129 |
+
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.
|
| 130 |
+
|
| 131 |
+
# 3.5 Likelihood
|
| 132 |
+
|
| 133 |
+
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]:
|
| 134 |
+
|
| 135 |
+
$$
|
| 136 |
+
\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
|
| 137 |
+
$$
|
| 138 |
+
|
| 139 |
+
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.
|
| 140 |
+
|
| 141 |
+
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):
|
| 142 |
+
|
| 143 |
+
Proposition 3. Let $\mathbf { x } \in C ( \tau , L )$ be a centered7 conformer in Euclidean space. Then,
|
| 144 |
+
|
| 145 |
+
$$
|
| 146 |
+
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 ) } } }
|
| 147 |
+
$$
|
| 148 |
+
|
| 149 |
+
7Additional formalism is needed for translations, but it is independent of the conformer and can be ignored.
|
| 150 |
+
|
| 151 |
+
where the indices $\alpha , \beta$ are integers between $^ { l }$ and $m + 3 .$ . For $1 \leq \alpha \leq m$ , $J _ { \alpha } ^ { ( k ) }$ is defined as
|
| 152 |
+
|
| 153 |
+
$$
|
| 154 |
+
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.
|
| 155 |
+
$$
|
| 156 |
+
|
| 157 |
+
and for $\alpha \in \{ m + 1 , m + 2 , m + 3 \}$ as
|
| 158 |
+
|
| 159 |
+
$$
|
| 160 |
+
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 } ,
|
| 161 |
+
$$
|
| 162 |
+
|
| 163 |
+
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.
|
| 164 |
+
|
| 165 |
+
# 3.6 Energy-based training
|
| 166 |
+
|
| 167 |
+
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.
|
| 168 |
+
|
| 169 |
+
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
|
| 170 |
+
|
| 171 |
+
# Algorithm 1: Energy-based training epoch
|
| 172 |
+
|
| 173 |
+
Input: Boltzmann density $\tilde { p }$ , training pairs $\{ ( G _ { i } , L _ { i } ) \} _ { i }$ , torsional diffusion model $q$
|
| 174 |
+
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 } }$ ;
|
| 175 |
+
|
| 176 |
+
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.
|
| 177 |
+
|
| 178 |
+
# 4 Experiments
|
| 179 |
+
|
| 180 |
+
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.
|
| 181 |
+
|
| 182 |
+
# 4.1 Conformer matching
|
| 183 |
+
|
| 184 |
+
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.
|
| 185 |
+
|
| 186 |
+
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.
|
| 187 |
+
|
| 188 |
+
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 ~ }$ .
|
| 189 |
+
|
| 190 |
+
<table><tr><td></td><td colspan="4">Recall</td><td colspan="4">Precision</td></tr><tr><td></td><td colspan="2">Coverage ↑</td><td colspan="2">AMR↓</td><td colspan="2">Coverage ↑</td><td colspan="2">AMR↓</td></tr><tr><td>Method</td><td>Mean</td><td>Med</td><td>Mean</td><td>Med</td><td>Mean</td><td>Med</td><td>Mean</td><td>Med</td></tr><tr><td>RDKit ETKDG</td><td>38.4</td><td>28.6</td><td>1.058</td><td>1.002</td><td>40.9</td><td>30.8</td><td>0.995</td><td>0.895</td></tr><tr><td>OMEGA</td><td>53.4</td><td>54.6</td><td>0.841</td><td>0.762</td><td>40.5</td><td>33.3</td><td>0.946</td><td>0.854</td></tr><tr><td>GeoMol</td><td>44.6</td><td>41.4</td><td>0.875</td><td>0.834</td><td>43.0</td><td>36.4</td><td>0.928</td><td>0.841</td></tr><tr><td>GeoDiff</td><td>42.1</td><td>37.8</td><td>0.835</td><td>0.809</td><td>24.9</td><td>14.5</td><td>1.136</td><td>1.090</td></tr><tr><td>Torsional Diffusion</td><td>72.7</td><td>80.0</td><td>0.582</td><td>0.565</td><td>55.2</td><td>56.9</td><td>0.778</td><td>0.729</td></tr></table>
|
| 191 |
+
|
| 192 |
+
# 4.2 Experimental setup
|
| 193 |
+
|
| 194 |
+
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.
|
| 195 |
+
|
| 196 |
+
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.
|
| 197 |
+
|
| 198 |
+
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].
|
| 199 |
+
|
| 200 |
+
# 4.3 Ensemble RMSD
|
| 201 |
+
|
| 202 |
+
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.
|
| 203 |
+
|
| 204 |
+
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.
|
| 205 |
+
|
| 206 |
+

|
| 207 |
+
Figure 3: Mean coverage for recall (left) and precision (right) when varying the threshold value $\delta$ on GEOM-DRUGS.
|
| 208 |
+
|
| 209 |
+
Table 2: Median AMR and runtime (core-secs per conformer) of machine learning methods, evaluated on CPU for comparison with RDKit.
|
| 210 |
+
|
| 211 |
+
<table><tr><td>Method</td><td>Steps</td><td>AMR-R</td><td>AMR-P</td><td>Runtime</td></tr><tr><td>RDKit</td><td>1</td><td>1.002</td><td>0.895</td><td>0.10</td></tr><tr><td>GeoMol</td><td>1</td><td>0.834</td><td>0.841</td><td>0.18</td></tr><tr><td>GeoDiff</td><td>5000</td><td>0.809</td><td>1.090</td><td>305</td></tr><tr><td>Torsional</td><td>5</td><td>0.685</td><td>0.963</td><td>1.76</td></tr><tr><td>Diffusion</td><td>10</td><td>0.580</td><td>0.791</td><td>2.82</td></tr><tr><td></td><td>20</td><td>0.565</td><td>0.729</td><td>4.90</td></tr></table>
|
| 212 |
+
|
| 213 |
+
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.
|
| 214 |
+
|
| 215 |
+
<table><tr><td>Method</td><td>E</td><td>μ</td><td>△</td><td>Emin</td></tr><tr><td>RDKit</td><td>0.81</td><td>0.52</td><td>0.75</td><td>1.16</td></tr><tr><td>OMEGA</td><td>0.68</td><td>0.66</td><td>0.68</td><td>0.69</td></tr><tr><td>GeoMol</td><td>0.42</td><td>0.34</td><td>0.59</td><td>0.40</td></tr><tr><td>GeoDiff</td><td>0.31</td><td>0.35</td><td>0.89</td><td>0.39</td></tr><tr><td>Tor. Diff.</td><td>0.22</td><td>0.35</td><td>0.54</td><td>0.13</td></tr></table>
|
| 216 |
+
|
| 217 |
+
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.
|
| 218 |
+
|
| 219 |
+
# 4.4 Ensemble properties
|
| 220 |
+
|
| 221 |
+
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.
|
| 222 |
+
|
| 223 |
+
# 4.5 Torsional Boltzmann generator
|
| 224 |
+
|
| 225 |
+
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.
|
| 226 |
+
|
| 227 |
+
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.
|
| 228 |
+
|
| 229 |
+
Table 4: Effective sample size (out of 32) given by importance sampling weights over the torsional Boltzmann density.
|
| 230 |
+
|
| 231 |
+
<table><tr><td colspan="3"></td><td colspan="2">Temp. (K)</td></tr><tr><td>Method</td><td>Steps</td><td>1000</td><td>500</td><td>300</td></tr><tr><td>Uniform</td><td>1</td><td>1.71</td><td>1.21</td><td>1.02</td></tr><tr><td rowspan="3">AIS</td><td>5</td><td>2.20</td><td>1.36</td><td>1.18</td></tr><tr><td>20</td><td>3.12</td><td>1.76</td><td>1.30</td></tr><tr><td>100</td><td>6.72</td><td>3.12</td><td>2.06</td></tr><tr><td>Torsional</td><td>5</td><td>7.28</td><td>3.60</td><td>3.04</td></tr><tr><td>BG</td><td>20</td><td>11.42</td><td>6.42</td><td>4.68</td></tr></table>
|
| 232 |
+
|
| 233 |
+
# 5 Conclusion
|
| 234 |
+
|
| 235 |
+
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.
|
| 236 |
+
|
| 237 |
+
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.
|
| 238 |
+
|
| 239 |
+
# Acknowledgments
|
| 240 |
+
|
| 241 |
+
We pay tribute to Octavian-Eugen Ganea (1987-2022), dear colleague, mentor, and friend without whom this work would have never been possible.
|
| 242 |
+
|
| 243 |
+
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).
|
| 244 |
+
|
| 245 |
+
# References
|
| 246 |
+
|
| 247 |
+
Brian DO Anderson. Reverse-time diffusion equation models. Stochastic Processes and their Applications, 1982.
|
| 248 |
+
|
| 249 |
+
Simon Axelrod and Rafael Gómez-Bombarelli. Geom, energy-annotated molecular conformations for property prediction and molecular generation. Scientific Data, 2022.
|
| 250 |
+
|
| 251 |
+
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.
|
| 252 |
+
|
| 253 |
+
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.
|
| 254 |
+
|
| 255 |
+
Evan E Bolton, Sunghwan Kim, and Stephen H Bryant. Pubchem3d: conformer generation. Journal of cheminformatics, 2011.
|
| 256 |
+
|
| 257 |
+
Sean M Carroll. Spacetime and geometry. Cambridge University Press, 2019.
|
| 258 |
+
|
| 259 |
+
Gregory S Chirikjian. Stochastic models, information theory, and Lie groups, volume 2: Analytic methods and modern applications, volume 2. Springer Science & Business Media, 2011.
|
| 260 |
+
|
| 261 |
+
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.
|
| 262 |
+
|
| 263 |
+
David F Crouse. On implementing 2d rectangular assignment algorithms. IEEE Transactions on Aerospace and Electronic Systems, 2016.
|
| 264 |
+
|
| 265 |
+
Valentin De Bortoli, Emile Mathieu, Michael Hutchinson, James Thornton, Yee Whye Teh, and Arnaud Doucet. Riemannian score-based generative modeling. arXiv preprint, 2022.
|
| 266 |
+
|
| 267 |
+
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.
|
| 268 |
+
|
| 269 |
+
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.
|
| 270 |
+
|
| 271 |
+
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.
|
| 272 |
+
|
| 273 |
+
Thomas A Halgren. Merck molecular force field. i. basis, form, scope, parameterization, and performance of mmff94. Journal of computational chemistry, 1996.
|
| 274 |
+
|
| 275 |
+
Paul CD Hawkins. Conformation generation: the state of the art. Journal of Chemical Information and Modeling, 2017.
|
| 276 |
+
|
| 277 |
+
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.
|
| 278 |
+
|
| 279 |
+
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.
|
| 280 |
+
|
| 281 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 2020.
|
| 282 |
+
|
| 283 |
+
Michael F Hutchinson. A stochastic estimator of the trace of the influence matrix for laplacian smoothing splines. Communications in Statistics-Simulation and Computation, 1989.
|
| 284 |
+
|
| 285 |
+
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.
|
| 286 |
+
|
| 287 |
+
Bowen Jing, Gabriele Corso, Renato Berlinghieri, and Tommi Jaakkola. Subspace diffusion generative models. arXiv preprint arXiv:2205.01490, 2022.
|
| 288 |
+
|
| 289 |
+
Leslie Kish. Survey sampling. Number 04; HN29, K5. 1965.
|
| 290 |
+
|
| 291 |
+
Jonas Köhler, Andreas Krämer, and Frank Noé. Smooth normalizing flows. Advances in Neural Information Processing Systems, 2021.
|
| 292 |
+
|
| 293 |
+
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.
|
| 294 |
+
|
| 295 |
+
Greg Landrum et al. Rdkit: A software suite for cheminformatics, computational chemistry, and predictive modeling, 2013.
|
| 296 |
+
|
| 297 |
+
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.
|
| 298 |
+
|
| 299 |
+
Shitong Luo, Chence Shi, Minkai Xu, and Jian Tang. Predicting molecular conformation via dynamic graph score matching. Advances in Neural Information Processing Systems, 2021.
|
| 300 |
+
|
| 301 |
+
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.
|
| 302 |
+
|
| 303 |
+
Laurence Illing Midgley, Vincent Stimper, Gregor NC Simm, and José Miguel Hernández-Lobato. Bootstrap your flow. arXiv preprint, 2021.
|
| 304 |
+
|
| 305 |
+
Maria A Miteva, Frederic Guyon, and Pierre Tuffery. Frog2: Efficient 3d conformation ensemble generator for small compounds. Nucleic acids research, 2010.
|
| 306 |
+
|
| 307 |
+
Radford M Neal. Annealed importance sampling. Statistics and computing, 2001.
|
| 308 |
+
|
| 309 |
+
Alex Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, 2021.
|
| 310 |
+
|
| 311 |
+
Frank Noé, Simon Olsson, Jonas Köhler, and Hao Wu. Boltzmann generators: Sampling equilibrium states of many-body systems with deep learning. Science, 2019.
|
| 312 |
+
|
| 313 |
+
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.
|
| 314 |
+
|
| 315 |
+
Martin Quack. How important is parity violation for molecular and biomolecular chirality? Angewandte Chemie International Edition, 2002.
|
| 316 |
+
|
| 317 |
+
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.
|
| 318 |
+
|
| 319 |
+
Tim Salimans and Jonathan Ho. Progressive distillation for fast sampling of diffusion models. In International Conference on Learning Representations, 2022.
|
| 320 |
+
|
| 321 |
+
Vıctor Garcia Satorras, Emiel Hoogeboom, and Max Welling. E (n) equivariant graph neural networks. In International Conference on Machine Learning, 2021.
|
| 322 |
+
|
| 323 |
+
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.
|
| 324 |
+
|
| 325 |
+
Chence Shi, Shitong Luo, Minkai Xu, and Jian Tang. Learning gradient fields for molecular conformation generation. In International Conference on Machine Learning, 2021.
|
| 326 |
+
|
| 327 |
+
Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in Neural Information Processing Systems, 2019.
|
| 328 |
+
|
| 329 |
+
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.
|
| 330 |
+
|
| 331 |
+
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.
|
| 332 |
+
|
| 333 |
+
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.
|
| 334 |
+
|
| 335 |
+
Arash Vahdat, Karsten Kreis, and Jan Kautz. Score-based generative modeling in latent space. In Advances in Neural Information Processing Systems, 2021.
|
| 336 |
+
|
| 337 |
+
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.
|
| 338 |
+
|
| 339 |
+
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.
|
| 340 |
+
|
| 341 |
+
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.
|
| 342 |
+
|
| 343 |
+
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.
|
| 344 |
+
|
| 345 |
+
# Checklist
|
| 346 |
+
|
| 347 |
+
1. For all authors...
|
| 348 |
+
|
| 349 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 350 |
+
(b) Did you describe the limitations of your work? [Yes] See Appendix F
|
| 351 |
+
(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.
|
| 352 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 353 |
+
|
| 354 |
+
2. If you are including theoretical results...
|
| 355 |
+
|
| 356 |
+
(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.
|
| 357 |
+
|
| 358 |
+
3. If you ran experiments...
|
| 359 |
+
|
| 360 |
+
(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.
|
| 361 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix G.
|
| 362 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Appendix H.
|
| 363 |
+
(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.
|
| 364 |
+
|
| 365 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 366 |
+
|
| 367 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 368 |
+
(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.
|
| 369 |
+
(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.
|
| 370 |
+
(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.
|
| 371 |
+
(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.
|
| 372 |
+
|
| 373 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 374 |
+
|
| 375 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 376 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 377 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/xnuN2vGmZA0/xnuN2vGmZA0.md
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# VITA: Video Instance Segmentation via Object Token Association
|
| 2 |
+
|
| 3 |
+
Miran Heo⇤ Yonsei University
|
| 4 |
+
|
| 5 |
+
Sukjun Hwang⇤ Yonsei University
|
| 6 |
+
|
| 7 |
+
Seoung Wug Oh Adobe Research
|
| 8 |
+
|
| 9 |
+
Joon-Young Lee Adobe Research
|
| 10 |
+
|
| 11 |
+
Seon Joo Kim Yonsei University
|
| 12 |
+
|
| 13 |
+
{miran, sj.hwang, seonjookim}@yonsei.ac.kr
|
| 14 |
+
|
| 15 |
+
{seoh, jolee}@adobe.com
|
| 16 |
+
|
| 17 |
+
# Abstract
|
| 18 |
+
|
| 19 |
+
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.
|
| 20 |
+
|
| 21 |
+
# 1 Introduction
|
| 22 |
+
|
| 23 |
+
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.
|
| 24 |
+
|
| 25 |
+
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?”
|
| 26 |
+
|
| 27 |
+

|
| 28 |
+
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.
|
| 29 |
+
|
| 30 |
+
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.
|
| 31 |
+
|
| 32 |
+
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.
|
| 33 |
+
|
| 34 |
+
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.
|
| 35 |
+
|
| 36 |
+
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.
|
| 37 |
+
|
| 38 |
+
# 2 Related Works
|
| 39 |
+
|
| 40 |
+
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.
|
| 41 |
+
|
| 42 |
+
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.
|
| 43 |
+
|
| 44 |
+

|
| 45 |
+
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.
|
| 46 |
+
|
| 47 |
+
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)).
|
| 48 |
+
|
| 49 |
+
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.
|
| 50 |
+
|
| 51 |
+
# 3 Method
|
| 52 |
+
|
| 53 |
+
In this section, we first give a brief overview of Mask2Former $ { \mathbb { I } } ^ { \| \ b { 7 } \| }$ , a frame-level detector for VITA.
|
| 54 |
+
Then, we introduce the architecture of our proposed VITA, which is built on top of Mask2Former.
|
| 55 |
+
Finally, we describe how VITA handles extremely long videos in a complete-offline manner.
|
| 56 |
+
|
| 57 |
+
# 3.1 Frame-level Detector
|
| 58 |
+
|
| 59 |
+
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.
|
| 60 |
+
|
| 61 |
+
# 3.2 VITA
|
| 62 |
+
|
| 63 |
+
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.
|
| 64 |
+
|
| 65 |
+
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.
|
| 66 |
+
|
| 67 |
+
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.
|
| 68 |
+
|
| 69 |
+

|
| 70 |
+
Figure 3: Illustration of an Object Encoder layer. Blocks with dashed line are local windows, and indicates an object token.
|
| 71 |
+
|
| 72 |
+
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.
|
| 73 |
+
|
| 74 |
+
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
|
| 75 |
+
|
| 76 |
+
Decoder shows fast convergence speed while achieving high accuracy. Furthermore, the compact input greatly saves memories, thus facilitates processing long and high-resolution videos.
|
| 77 |
+
|
| 78 |
+
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 }$ .
|
| 79 |
+
|
| 80 |
+
# 3.3 Clip-wise losses
|
| 81 |
+
|
| 82 |
+
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).
|
| 83 |
+
|
| 84 |
+
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
|
| 85 |
+
|
| 86 |
+

|
| 87 |
+
Figure 4: Similarity loss. $\bigcirc$ and $\sqcap$ indicate video query and frame query, respectively. Same color represents same GT instance ID.
|
| 88 |
+
|
| 89 |
+
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.
|
| 90 |
+
|
| 91 |
+
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 }$ .
|
| 92 |
+
|
| 93 |
+
# 4 Experiments
|
| 94 |
+
|
| 95 |
+
# 4.1 Datasets
|
| 96 |
+
|
| 97 |
+
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.
|
| 98 |
+
|
| 99 |
+
Table 1: Comparisons on YouTube-VIS 2019.
|
| 100 |
+
|
| 101 |
+
<table><tr><td rowspan=1 colspan=3>Method Backbone</td><td rowspan=1 colspan=1>AP AP50 AP75 AR1 AR10</td></tr><tr><td rowspan=9 colspan=1>NNTai (rer)</td><td rowspan=9 colspan=1>MaskTrackR-CNNB2MaskTrackR-CNN32Cross VIS [33]Cross VIS [33]PCAN日PCAN日EfficientVIS四EfficientVIS29VISOLO四</td><td rowspan=1 colspan=1>ResNet-50</td><td rowspan=1 colspan=1>30.3 51.1 32.6 31.0 35.5</td></tr><tr><td rowspan=1 colspan=1>ResNet-101</td><td rowspan=1 colspan=1>31.8 53.0 33.6 33.2 37.6</td></tr><tr><td rowspan=1 colspan=1>ResNet-50</td><td rowspan=1 colspan=1>36.3 56.8 38.9 35.6 40.7</td></tr><tr><td rowspan=6 colspan=1>ResNet-101ResNet-50ResNet-101ResNet-50ResNet-101ResNet-50</td><td rowspan=1 colspan=1>36.6 57.3 39.7 36.0 42.0</td></tr><tr><td rowspan=1 colspan=1>36.1 54.9 39.4 36.3 41.6</td></tr><tr><td rowspan=1 colspan=1>37.6 57.2 41.3 37.2 43.9</td></tr><tr><td rowspan=1 colspan=1>37.9 59.7 43.0 40.3 46.6</td></tr><tr><td rowspan=1 colspan=1>39.8 61.8 44.7 42.1 49.8</td></tr><tr><td rowspan=1 colspan=1>38.6 56.3 43.7 35.7 42.5</td></tr><tr><td rowspan=13 colspan=1>Ouiiii</td><td rowspan=10 colspan=1>VisTR[28]VisTR [28]IFC因IFC园TeViT [34]SeqFormer四SeqFormer四SeqFormer四Mask2Former-VIS回Mask2Former-VIS回Mask2Former-VIS回</td><td rowspan=1 colspan=1>ResNet-50</td><td rowspan=1 colspan=1>35.6 56.8 37.0 35.2 40.2</td></tr><tr><td rowspan=1 colspan=1>ResNet-101</td><td rowspan=1 colspan=1>38.6 61.3 42.3 37.6 44.2</td></tr><tr><td rowspan=1 colspan=1>ResNet-50</td><td rowspan=1 colspan=1>41.2 65.1 44.6 42.3 49.6</td></tr><tr><td rowspan=1 colspan=1>ResNet-101</td><td rowspan=1 colspan=1>42.6 66.6 46.3 43.5 51.4</td></tr><tr><td rowspan=6 colspan=1>MsgShifTResNet-50ResNet-101Swin-LResNet-50ResNet-101Swin-L</td><td rowspan=1 colspan=1>46.6 71.3 51.6 44.9 54.3</td></tr><tr><td rowspan=1 colspan=1>47.4 69.8 51.8 45.5 54.8</td></tr><tr><td rowspan=1 colspan=1>49.0 71.1 55.7 46.8 56.9</td></tr><tr><td rowspan=1 colspan=1>59.3 82.1 66.4 51.7 64.4</td></tr><tr><td rowspan=1 colspan=1>46.4 68.0 50.0 1 1</td></tr><tr><td rowspan=1 colspan=1>49.2 72.8 54.2 = =60.4 84.4 67.0 = =</td></tr><tr><td rowspan=3 colspan=1>VITA (Ours)</td><td rowspan=3 colspan=1>ResNet-50ResNet-101Swin-L</td><td rowspan=1 colspan=1>49.8 72.6 54.5 49.4 61.0</td></tr><tr><td rowspan=1 colspan=1>51.9 75.4 57.0 49.6 59.1</td></tr><tr><td rowspan=1 colspan=1>63.0 86.9 67.9 56.3 68.1</td></tr></table>
|
| 102 |
+
|
| 103 |
+
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.
|
| 104 |
+
|
| 105 |
+
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.
|
| 106 |
+
|
| 107 |
+
# 4.2 Implementation Details
|
| 108 |
+
|
| 109 |
+
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.
|
| 110 |
+
|
| 111 |
+
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.
|
| 112 |
+
|
| 113 |
+
<table><tr><td rowspan="2">Method</td><td colspan="5">YouTube-VIS 2021</td><td colspan="5">OVIS</td></tr><tr><td>AP</td><td>AP50</td><td>AP75</td><td>AR1</td><td>AR10</td><td>AP</td><td>AP50</td><td>AP75</td><td>AR1</td><td>AR10</td></tr><tr><td>MaskTrack R-CNN 32]</td><td>28.6</td><td>48.9</td><td>29.6</td><td>26.5</td><td>33.8</td><td>10.8</td><td>25.3</td><td>8.5</td><td>7.9</td><td>14.9</td></tr><tr><td>CMaskTrack R-CNN [23]</td><td>-</td><td>=</td><td>=</td><td>=</td><td>-</td><td>15.4</td><td>33.9</td><td>13.1</td><td>9.3</td><td>20.0</td></tr><tr><td>STMask [19]</td><td>31.1</td><td>50.4</td><td>33.5</td><td>26.9</td><td>35.6</td><td>15.4</td><td>33.8</td><td>12.5</td><td>8.9</td><td>21.3</td></tr><tr><td>Cross VIS [33]</td><td>34.2</td><td>54.4</td><td>37.9</td><td>30.4</td><td>38.2</td><td>14.9</td><td>32.7</td><td>12.1</td><td>10.3</td><td>19.8</td></tr><tr><td>IFC [5]</td><td>35.2</td><td>55.9</td><td>37.7</td><td>32.6</td><td>42.9</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>VISOLO [12]</td><td>36.9</td><td>54.7</td><td>40.2</td><td>30.6</td><td>40.9</td><td>15.3</td><td>31.0</td><td>13.8</td><td>11.1</td><td>21.7</td></tr><tr><td>TeViTt B4]</td><td>37.9</td><td>61.2</td><td>42.1</td><td>35.1</td><td>44.6</td><td>17.4</td><td>34.9</td><td>15.0</td><td>11.2</td><td>21.8</td></tr><tr><td>SeqFormer[ 眉</td><td>40.5</td><td>62.4</td><td>43.7</td><td>36.1</td><td>48.1</td><td>-</td><td>1</td><td>1</td><td>-</td><td>1</td></tr><tr><td>Mask2Former-VIS 回</td><td>40.6</td><td>60.9</td><td>41.8</td><td>-</td><td>1</td><td>1</td><td>-</td><td>1</td><td>1</td><td>1</td></tr><tr><td>VITA (Ours)</td><td>45.7</td><td>67.4</td><td>49.5</td><td>40.9</td><td>53.6</td><td>19.6</td><td>41.2</td><td>17.4</td><td>11.7</td><td>26.0</td></tr><tr><td>SeqFormert [30]</td><td>51.8</td><td>74.6</td><td>58.2</td><td>42.8</td><td>58.1</td><td>-</td><td>1</td><td>1</td><td>1</td><td>-</td></tr><tr><td>Mask2Former-VIS‡ 回</td><td>52.6</td><td>76.4</td><td>57.2</td><td>-</td><td>-</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>VITA (Ours)‡</td><td>57.5</td><td>80.6</td><td>61.0</td><td>47.7</td><td>62.6</td><td>27.7</td><td>51.9</td><td>24.9</td><td>14.9</td><td>33.0</td></tr></table>
|
| 114 |
+
|
| 115 |
+
# 4.3 Main Results
|
| 116 |
+
|
| 117 |
+
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].
|
| 118 |
+
|
| 119 |
+
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.
|
| 120 |
+
|
| 121 |
+
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.
|
| 122 |
+
|
| 123 |
+
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.
|
| 124 |
+
|
| 125 |
+
Table 3: Impact of local windows of varying sizes in Object Encoder.
|
| 126 |
+
|
| 127 |
+
<table><tr><td>W</td><td>AP</td><td>AP50</td><td>AP75</td><td>AR1</td><td>AR10</td></tr><tr><td>3</td><td>49.4</td><td>72.2</td><td>54.4</td><td>48.6</td><td>60.9</td></tr><tr><td>6</td><td>49.8</td><td>72.6</td><td>54.5</td><td>49.4</td><td>61.0</td></tr><tr><td>12</td><td>50.0</td><td>73.0</td><td>54.7</td><td>49.0</td><td>60.8</td></tr><tr><td>All</td><td>50.1</td><td>72.4</td><td>54.7</td><td>49.0</td><td>60.6</td></tr></table>
|
| 128 |
+
|
| 129 |
+
Table 5: Use of different heuristic association algorithms on OVIS valid set.
|
| 130 |
+
|
| 131 |
+
<table><tr><td>Length</td><td>Algorithm</td><td>AP</td><td>AP50</td><td>AP75</td></tr><tr><td>36</td><td>Greedy Hungarian</td><td>18.8 18.4</td><td>39.4 38.9</td><td>17.1 16.3</td></tr><tr><td>48</td><td>Greedy Hungarian</td><td>18.8 19.1</td><td>39.0 39.1</td><td>17.1 17.4</td></tr><tr><td>All</td><td>None</td><td>19.6</td><td>41.2</td><td>17.4</td></tr></table>
|
| 132 |
+
|
| 133 |
+
Table 4: Maximum number of frames that can be processed at once using a single Titan XP.
|
| 134 |
+
|
| 135 |
+
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Max Frames360 × 640 720×1280</td></tr><tr><td rowspan=1 colspan=1>VisTR [28]IFC园Mask2Former-VIS回</td><td rowspan=1 colspan=1>46 12123 3881 20</td></tr><tr><td rowspan=1 colspan=1>W=3VITA(Ours) W=6W = 12</td><td rowspan=1 colspan=1>26771392741</td></tr></table>
|
| 136 |
+
|
| 137 |
+
Table 6: Pruning tokens by different ratios $r$
|
| 138 |
+
|
| 139 |
+
<table><tr><td>r</td><td>一 AP</td><td>AP50</td><td>AP75</td><td>AR1</td><td>AR10</td></tr><tr><td>1.0</td><td>49.8</td><td>72.6</td><td>54.5</td><td>49.4</td><td>61.0</td></tr><tr><td>0.75</td><td>49.7</td><td>72.5</td><td>54.4</td><td>48.7</td><td>61.0</td></tr><tr><td>0.5</td><td>48.9</td><td>72.1</td><td>52.0</td><td>48.3</td><td>60.9</td></tr><tr><td>0.25</td><td>48.1</td><td>71.6</td><td>51.6</td><td>47.4</td><td>59.8</td></tr></table>
|
| 140 |
+
|
| 141 |
+
# 4.4 Ablation Studies
|
| 142 |
+
|
| 143 |
+
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.
|
| 144 |
+
|
| 145 |
+
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.
|
| 146 |
+
|
| 147 |
+
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].
|
| 148 |
+
|
| 149 |
+
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.
|
| 150 |
+
|
| 151 |
+
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.
|
| 152 |
+
|
| 153 |
+

|
| 154 |
+
Figure 5: Train speed comparison with Mask2Former-VIS $\textcircled { 6 }$ . $\dagger$ indicates the same training setup with VITA.
|
| 155 |
+
|
| 156 |
+
Table 7: Results on YouTube-VIS 2019 with freezing detector pretrained on COCO.
|
| 157 |
+
|
| 158 |
+
<table><tr><td>Backbone</td><td>Freeze</td><td>AP</td><td>AP50</td><td>AP75</td><td>AR1</td><td>AR10</td></tr><tr><td>ResNet-50</td><td>厂</td><td>49.8 40.9</td><td>72.6 61.9</td><td>54.5 44.6</td><td>49.4 43.1</td><td>61.0 53.1</td></tr><tr><td>ResNet-101</td><td></td><td>51.9</td><td>75.4</td><td>57.0</td><td>49.6</td><td>59.1</td></tr><tr><td></td><td>1</td><td>43.2</td><td>64.4</td><td>48.7</td><td>46.1</td><td>55.9</td></tr><tr><td>Swin-L</td><td></td><td>63.0</td><td>86.9</td><td>67.9</td><td>56.3</td><td>68.1</td></tr><tr><td></td><td>1</td><td>53.4</td><td>75.9</td><td>58.7</td><td>51.9</td><td>64.3</td></tr></table>
|
| 159 |
+
|
| 160 |
+
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.
|
| 161 |
+
|
| 162 |
+
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.
|
| 163 |
+
|
| 164 |
+
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.
|
| 165 |
+
|
| 166 |
+
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.
|
| 167 |
+
|
| 168 |
+
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.
|
| 169 |
+
|
| 170 |
+

|
| 171 |
+
Figure 6: Visualization of predictions from the frame-level detector and VITA. Instances with the same identity are displayed in the same color.
|
| 172 |
+
|
| 173 |
+
# 5 Limitations
|
| 174 |
+
|
| 175 |
+
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.
|
| 176 |
+
|
| 177 |
+
# 6 Conclusion
|
| 178 |
+
|
| 179 |
+
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.
|
| 180 |
+
|
| 181 |
+
# Acknowledgements
|
| 182 |
+
|
| 183 |
+
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.
|
| 184 |
+
|
| 185 |
+
# Broader Impact
|
| 186 |
+
|
| 187 |
+
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.
|
| 188 |
+
|
| 189 |
+
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.
|
| 190 |
+
|
| 191 |
+
References
|
| 192 |
+
[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.
|
| 193 |
+
[2] Gedas Bertasius and Lorenzo Torresani. Classifying, segmenting, and tracking object instances in video with mask propagation. In CVPR, 2020.
|
| 194 |
+
[3] Guillem Brasó and Laura Leal-Taixé. Learning a neural solver for multiple object tracking. In CVPR, 2020.
|
| 195 |
+
[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.
|
| 196 |
+
[5] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, 2020.
|
| 197 |
+
[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.
|
| 198 |
+
[7] Bowen Cheng, Ishan Misra, Alexander G Schwing, Alexander Kirillov, and Rohit Girdhar. Masked-attention mask transformer for universal image segmentation. In CVPR, 2022.
|
| 199 |
+
[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.
|
| 200 |
+
[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.
|
| 201 |
+
[10] Yang Fu, Linjie Yang, Ding Liu, Thomas S Huang, and Humphrey Shi. Compfeat: Comprehensive feature aggregation for video instance segmentation. In AAAI, 2021.
|
| 202 |
+
[11] Peng Gao, Minghang Zheng, Xiaogang Wang, Jifeng Dai, and Hongsheng Li. Fast convergence of detr with spatially modulated co-attention. In ICCV, 2021.
|
| 203 |
+
[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.
|
| 204 |
+
[13] Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross Girshick. Mask r-cnn. In ICCV, 2017.
|
| 205 |
+
[14] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
|
| 206 |
+
[15] Sukjun Hwang, Miran Heo, Seoung Wug Oh, and Seon Joo Kim. Video instance segmentation using inter-frame communication transformers. In NeurIPS, 2021.
|
| 207 |
+
[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.
|
| 208 |
+
[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.
|
| 209 |
+
[18] Harold W Kuhn. The hungarian method for the assignment problem. In Naval research logistics quarterly, 1955.
|
| 210 |
+
[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.
|
| 211 |
+
[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.
|
| 212 |
+
[21] Dongfang Liu, Yiming Cui, Wenbo Tan, and Yingjie Chen. Sg-net: Spatial granularity network for one-stage video instance segmentation. In CVPR, 2021.
|
| 213 |
+
[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.
|
| 214 |
+
[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.
|
| 215 |
+
[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.
|
| 216 |
+
[25] Zhiqing Sun, Shengcao Cao, Yiming Yang, and Kris M Kitani. Rethinking transformer-based set prediction for object detection. In ICCV, 2021.
|
| 217 |
+
[26] Siyu Tang, Mykhaylo Andriluka, Bjoern Andres, and Bernt Schiele. Multiple people tracking by lifted multicut and person re-identification. In CVPR, 2017.
|
| 218 |
+
[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.
|
| 219 |
+
[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.
|
| 220 |
+
[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.
|
| 221 |
+
[30] Junfeng Wu, Yi Jiang, Wenqing Zhang, Xiang Bai, and Song Bai. Seqformer: a frustratingly simple model for video instance segmentation. In ECCV, 2022.
|
| 222 |
+
[31] Yuxin Wu, Alexander Kirillov, Francisco Massa, Wan-Yen Lo, and Ross Girshick. Detectron2. https://github.com/facebookresearch/detectron2, 2019.
|
| 223 |
+
[32] Linjie Yang, Yuchen Fan, and Ning Xu. Video instance segmentation. In ICCV, 2019.
|
| 224 |
+
[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.
|
| 225 |
+
[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.
|
| 226 |
+
[35] Li Zhang, Yuan Li, and Ramakant Nevatia. Global data association for multi-object tracking using network flows. In CVPR, 2008.
|
| 227 |
+
[36] Xingyi Zhou, Tianwei Yin, Vladlen Koltun, and Phillip Krähenbühl. Global tracking transformers. In CVPR, 2022.
|
| 228 |
+
[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.
|
md/dev/yb3HOXO3lX2/yb3HOXO3lX2.md
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Defining and Characterizing Reward Hacking
|
| 2 |
+
|
| 3 |
+
Joar Skalse∗ University of Oxford
|
| 4 |
+
|
| 5 |
+
Nikolaus H. R. Howe Mila, Université de Montréal
|
| 6 |
+
|
| 7 |
+
Dmitrii Krasheninnikov University of Cambridge
|
| 8 |
+
|
| 9 |
+
David Krueger∗ University of Cambridge
|
| 10 |
+
|
| 11 |
+
# Abstract
|
| 12 |
+
|
| 13 |
+
We provide the first formal definition of reward hacking, a phenomenon where optimizing an imperfect proxy reward function, $\tilde { \mathcal { R } }$ , leads to poor performance according to the true reward function, $\mathcal { R }$ . We say that a proxy is unhackable if increasing the expected proxy return can never decrease the expected true return. Intuitively, it might be possible to create an unhackable proxy by leaving some terms out of the reward function (making it “narrower”) or overlooking fine-grained distinctions between roughly equivalent outcomes, but we show this is usually not the case. A key insight is that the linearity of reward (in state-action visit counts) makes unhackability a very strong condition. In particular, for the set of all stochastic policies, two reward functions can only be unhackable if one of them is constant. We thus turn our attention to deterministic policies and finite sets of stochastic policies, where non-trivial unhackable pairs always exist, and establish necessary and sufficient conditions for the existence of simplifications, an important special case of unhackability. Our results reveal a tension between using reward functions to specify narrow tasks and aligning AI systems with human values.
|
| 14 |
+
|
| 15 |
+
# 1 Introduction
|
| 16 |
+
|
| 17 |
+
It is well known that optimising a proxy can lead to unintended outcomes: a boat spins in circles collecting “powerups” instead of following the race track in a racing game (Clark and Amodei, 2016); an evolved circuit listens in on radio signals from nearby computers’ oscillators instead of building its own (Bird and Layzell, 2002); universities reject the most qualified applicants in order to appear more selective and boost their ratings (Golden, 2001). In the context of reinforcement learning (RL), such failures are called reward hacking.
|
| 18 |
+
|
| 19 |
+
For AI systems that take actions in safety-critical real world environments such as autonomous vehicles, algorithmic trading, or content recommendation systems, these unintended outcomes can be catastrophic. This makes it crucial to align autonomous AI systems with their users’ intentions. Precisely specifying which behaviours are or are not desirable is challenging, however. One approach to this specification problem is to learn an approximation of the true reward function $\mathrm { N g }$ et al., 2000; Ziebart, 2010; Leike et al., 2018). Optimizing a learned proxy reward can be dangerous, however; for instance, it might overlook side-effects (Krakovna et al., 2018; Turner et al., 2019) or encourage power-seeking (Turner et al., 2021) behavior. This raises the question motivating our work: When is it safe to optimise a proxy?
|
| 20 |
+
|
| 21 |
+
To begin to answer this question, we consider a somewhat simpler one: When could optimising a proxy lead to worse behaviour? “Optimising”, in this context, does not refer to finding a global, or even local, optimum, but rather running a search process, such as stochastic gradient descent (SGD), that yields a sequence of candidate policies, and tends to move towards policies with higher (proxy) reward. We make no assumptions about the path through policy space that optimisation takes.1 Instead, we ask whether there is any way in which improving a policy according to the proxy could make the policy worse according to the true reward; this is equivalent to asking if there exists a pair of policies $\pi _ { 1 } , \pi _ { 2 }$ where the proxy prefers $\pi _ { 1 }$ , but the true reward function prefers $\pi _ { 2 }$ . When this is the case, we refer to this pair of true reward function and proxy reward function as hackable.
|
| 22 |
+
|
| 23 |
+
Given the strictness of our definition, it is not immediately apparent that any non-trivial examples of unhackable reward function pairs exist. And indeed, if we consider the set of all stochastic policies, they do not (Section 5.1). However, restricting ourselves to any finite set of policies guarantees at least one non-trivial unhackable pair (Section 5.2).
|
| 24 |
+
|
| 25 |
+
Intuitively, we might expect the proxy to be a “simpler” version of the true reward function. Noting that the definition of unhackability is symmetric, we introduce the asymmetric special case of simplification, and arrive at similar theoretical results for this notion.2 In the process, and through examples, we show that seemingly natural ways of simplifying reward functions often fail to produce simplifications in our formal sense, and in fact fail to rule out the potential for reward hacking.
|
| 26 |
+
|
| 27 |
+
We conclude with a discussion of the implications and limitations of our work. Briefly, our work suggests that a proxy reward function must satisfy demanding standards in order for it to be safe to optimize. This in turn implies that the reward functions learned by methods such as reward modeling and inverse RL are perhaps best viewed as auxiliaries to policy learning, rather than specifications that should be optimized. This conclusion is weakened, however, by the conservativeness of our chosen definitions; future work should explore when hackable proxies can be shown to be safe in a probabilistic or approximate sense, or when subject to only limited optimization.
|
| 28 |
+
|
| 29 |
+
# 2 Example: Cleaning Robot
|
| 30 |
+
|
| 31 |
+
Consider a household robot tasked with cleaning a house with three rooms: Attic , Bedroom , and Kitchen . The robot’s (deterministic) policy is a vector indicating which rooms it cleans: $\pi = [ \pi _ { 1 } , \pi _ { 2 } , \pi _ { 3 } ] \in \{ 0 , 1 \} ^ { 3 }$ . The robot receives a (non-negative) reward of $r _ { 1 } , r _ { 2 } , r _ { 3 }$ for cleaning the attic, bedroom, and kitchen, respectively, and the total reward is given by $J ( \pi ) = \pi \cdot r$ . For example, if $r = [ 1 , 2 , 3 ]$ and the robot cleans the attic and the kitchen, it receives a reward of $1 + 3 = 4$ .
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
Figure 1: An illustration of hackable and unhackable proxy rewards arising from overlooking rewarding features. A human wants their house cleaned. In (a), the robot draws an incorrect conclusion because of the proxy; this could lead to hacking. In (b), no such hacking can occur: the proxy is unhackable.
|
| 35 |
+
|
| 36 |
+
At least two ideas come to mind when thinking about “simplifying” a reward function. The first one is overlooking rewarding features: suppose the true reward is equal for all the rooms, $r _ { \mathrm { t r u e } } = [ 1 , 1 , 1 ]$ , but we only ask the robot to clean the attic and bedroom, $r _ { \mathrm { p r o x y } } = [ 1 , 1 , 0 ]$ . In this case, $r _ { \mathrm { p r o x y } }$ and $r _ { \mathrm { t r u e } }$ are unhackable. However, if we ask the robot to only clean the attic, $r _ { \mathrm { p r o x y } } = [ 1 , 0 , 0 ]$ , this is hackable with respect to $r _ { \mathrm { t r u e } }$ . To see this, note that according to $r _ { \mathrm { p r o x y } }$ cleaning the attic $\begin{array} { r } { J _ { \mathrm { p r o x y } } = 1 } \end{array}$ ) is better than cleaning the bedroom and the kitchen $\mathbf { \nabla } _ { J _ { \mathrm { p r o x y } } } = 0 _ { \cdot } ^ { \cdot }$ . Yet, $r _ { \mathrm { t r u e } }$ says that cleaning the attic $J _ { \mathrm { t r u e } } = 1 )$ is worse than cleaning the bedroom and the kitchen $J _ { \mathrm { t r u e } } = 2$ ). This situation is illustrated in Figure 1.
|
| 37 |
+
|
| 38 |
+
The second seemingly natural way to simplify a reward function is overlooking fine details: suppose $r _ { \mathrm { t r u e } } = [ 1 , 1 . 5 , 2 ]$ , and we ask the robot to clean all the rooms, $r _ { \mathrm { p r o x y } } = [ 1 , 1 , 1 ]$ . For these values, the proxy and true reward are unhackable. However, with a slightly less balanced true reward function such as $r _ { \mathrm { t r u e } } = [ 1 , 1 . 5 , 3 ]$ the proxy does lead to hacking, since the robot would falsely calculate that it’s better to clean the attic and the bedroom than the kitchen alone.
|
| 39 |
+
|
| 40 |
+
These two examples illustrate that while simplification of reward functions is sometimes possible, attempts at simplification can easily lead to reward hacking. Intuitively, omitting/overlooking details is okay so long as all these details are not as important together as any of the details that we do share. In general, it is not obvious what the proxy must look like to avoid reward hacking, suggesting we should take great care when using proxies. For this specific environment, a proxy and a true reward are hackable exactly when there are two sets of rooms $S _ { 1 } , S _ { 2 }$ such that the true reward gives strictly higher value to cleaning $S _ { 1 }$ than it does to cleaning $S _ { 2 }$ , and the proxy says the opposite: $J _ { 1 } ( S _ { 1 } ) > J _ { 1 } ( S _ { 2 } )$ & $J _ { 2 } ( S _ { 1 } ) < J _ { 2 } ( S _ { 2 } )$ . For a proof of this statement, see Appendix D.2.1.
|
| 41 |
+
|
| 42 |
+
# 3 Related Work
|
| 43 |
+
|
| 44 |
+
While we are the first to define hackability, we are far from the first to study specification hacking. The observation that optimizing proxy metrics tends to lead to perverse instantiations is often called “Goodhart’s Law”, and is attributed to Goodhart (1975). Manheim and Garrabrant (2018) provide a list of four mechanisms underlying this observation.
|
| 45 |
+
|
| 46 |
+
Examples of such unintended behavior abound in both RL and other areas of AI; Krakovna et al. (2020) provide an extensive list. Notable recent instances include a robot positioning itself between the camera and the object it is supposed to grasp in a way that tricks the reward model (Amodei et al., 2017), the previously mentioned boat race example (Clark and Amodei, 2016), and a multitude of examples of reward model hacking in Atari (Ibarz et al., 2018). Reward hacking can occur suddenly. Ibarz et al. (2018) and Pan et al. (2022) showcase plots similar to one in Figure 2, where optimizing the proxy (either a learned reward model or a hand-specified reward function) first leads to both proxy and true rewards increasing, and then to a sudden phase transition where the true reward collapses while the proxy continues going up.
|
| 47 |
+
|
| 48 |
+

|
| 49 |
+
Figure 2: An illustration of reward hacking when optimizing a hackable proxy. The true reward first increases and then drops off, while the proxy reward continues to increase.
|
| 50 |
+
|
| 51 |
+
Note that not all of these examples correspond to optimal behavior according to the proxy. Indeed, convergence to suboptimal policies is a well-known issue in RL (Thrun and Schwartz, 1993). As a consequence, improving optimization often leads to unexpected, qualitative changes in behavior. For instance, Zhang et al. (2021) demonstrate a novel cartwheeling behavior in the widely studied Half-Cheetah environment that exceeds previous performance so greatly that it breaks the simulator. The unpredictability of RL optimization is a key motivation for our definition of hackability, since we cannot assume that agents will find an optimal policy. Neither can we rule out the possibility of sudden improvements in proxy reward and corresponding qualitative changes in behavior. Unhackability could provide confidence that reward hacking will not occur despite these challenges.
|
| 52 |
+
|
| 53 |
+
Despite the prevalence and potential severity of reward hacking, to our knowledge Pan et al. (2022) provide the first peer-reviewed work that focuses specifically on it, although Everitt et al. (2017) tackle the closely related issue of reward corruption. The work of Pan et al. (2022) is purely empirical; they manually construct proxy rewards for several diverse environments, and evaluate whether optimizing these proxies leads to reward hacking; in 5 out of 9 of their settings, it does. In another closely related work, Zhuang and Hadfield-Menell (2020) examine what happens when the proxy reward function depends on a strict subset of features relevant for the true reward. They show that optimizing the proxy reward can lead to arbitrarily low true reward under suitable assumptions. This can be seen as a seemingly valid simplification of the true reward that turns out to be (highly) hackable. While their result only applies to environments with decreasing marginal utility and increasing opportunity cost, we demonstrate hackability is an issue in arbitrary MDPs.
|
| 54 |
+
|
| 55 |
+
Hackability is particularly concerning given arguments that reward optimizing behavior tends to be power-seeking (Turner et al., 2021). But Leike et al. (2018) establish that any desired behavior (power-seeking or not) can in principle be specified as optimal via a reward function.3 However, unlike us, they do not consider the entire policy preference ordering. Meanwhile, Abel et al. (2021) note that Markov reward functions cannot specify arbitrary orderings over policies or trajectories, although they do not consider hackability. Previous works consider reward functions to be equivalent if they preserve the ordering over policies (Ng et al., 1999, 2000). Unhackability relaxes this, allowing equalities to be refined to inequalities, and vice versa. Unhackability provides a notion of what it means to be “aligned enough”; Brown et al. (2020b) provide an alternative. They say a policy is $\varepsilon$ -value aligned if its value at every state is close enough to optimal (according to the true reward function). Neither notion implies the other.
|
| 56 |
+
|
| 57 |
+
Reward tampering (Everitt et al., 2017; Kumar et al., 2020; Uesato et al., 2020; Everitt et al., 2021) can be viewed as a special case of reward hacking, and refers to an agent corrupting the process generating reward signals, e.g. by tampering with sensors, memory registers storing the reward signal, or other hardware. Everitt et al. (2017) introduce the Corrupt Reward MDP (CRMDP), to model this possibility. A CRMDP distinguishes corrupted and uncorrupted rewards; these are exactly analogous to the proxy and true reward discussed in our work and others. Leike et al. (2018) distinguish reward tampering from reward gaming, where an agent achieves inappropriately high reward without tampering. However, in principle, a reward function could prohibit all forms of tampering if the effects of tampering are captured in the state. So this distinction is somewhat imprecise, and the CRMDP framework is general enough to cover both forms of hacking.
|
| 58 |
+
|
| 59 |
+
Our notion of simplification bears a close resemblance to quantilization (Taylor, 2016). Quantilization returns a random policy from the top $\mathrm { n } \%$ best policies. This is similar to equating the values of those policies, but a simplification may also equate the values of the bottom/middle $\mathrm { n } \%$ , etc. Thus simplification may achieve a similar effect to quantilization without assuming that we are free to choose from among the best policies.
|
| 60 |
+
|
| 61 |
+
# 4 Preliminaries
|
| 62 |
+
|
| 63 |
+
We begin with an overview of reinforcement learning (RL) to establish our notation and terminology.
|
| 64 |
+
Section 4.2 introduces our novel definitions of hackability and simplification.
|
| 65 |
+
|
| 66 |
+
# 4.1 Reinforcement Learning
|
| 67 |
+
|
| 68 |
+
We expect readers to be familiar with the basics of RL, which can be found in Sutton and Barto (2018). RL methods attempt to solve a sequential decision problem, typically formalised as a Markov decision process (MDP) , which is a tuple $( S , A , T , I , \mathcal { R } , \gamma )$ where $S$ is a set of states, $A$ is a set of actions, $T : S \times A \to \Delta ( S )$ is a transition function, $I \in \Delta ( S )$ is an initial state distribution, $\mathcal { R }$ is a reward function, the most general form of which is $\mathcal { R } : S \times A \times S \Delta ( \mathbb { R } )$ , and $\gamma \in [ 0 , 1 ]$ is the discount factor. Here $\Delta ( X )$ is the set of all distributions over $X$ . A stationary policy is a function $\pi : S \to \Delta ( A )$ that specifies a distribution over actions in each state, and a non-stationary policy is a function $\vec { \pi } : ( S \times \bar { A } ) ^ { * } \times S \Delta ( A )$ , where $^ *$ is the Kleene star. A trajectory $\tau$ is a path $s _ { 0 } , a _ { 0 } , r _ { 0 } , \ldots$ through the MDP tnted sum of rewards ding to , and th $T , I ,$ , and ue of $\mathcal { R }$ . The return of a trajectorypolicy is the expected return $\begin{array} { r } { G ( \tau ) \dot { = } \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r _ { t } } \end{array}$
|
| 69 |
+
$J ( \pi ) \doteq \mathbb { E } _ { \tau \sim \pi } [ G ( \tau ) ]$ . We derive policy (preference) orderings from reward functions by ordering policies according to their value. In this paper, we assume that $S$ and $A$ are finite, that $| { \cal A } | > 1$ , that all states are reachable, and that $\mathcal { R } ( s , a , s ^ { \prime } )$ has finite mean for all $s , a , s ^ { \prime }$ .
|
| 70 |
+
|
| 71 |
+
In our work, we consider various reward functions for a given environment, which is then formally a Markov decision process without reward $M D P \setminus \overline { { \mathcal { R } } } \doteq ( S , A , T , I , \_ , \gamma )$ . Having fixed an $M D P \setminus \mathcal { R }$ , any reward function can be viewed as a function of only the current state and action by marginalizing over transitions: $\begin{array} { r } { \mathcal { R } ( s , a ) \doteq \sum _ { s ^ { \prime } \sim T ( s ^ { \prime } \mid s , a ) } \mathcal { R } ( s , a , s ^ { \prime } ) } \end{array}$ , we adopt this view from here on. We define the (discounted) visit counts of a policy as $\begin{array} { r } { \mathcal { F } ^ { \pi } ( s , a ) \doteq \mathbb { E } _ { \tau \sim \pi } [ \sum _ { i = 0 } ^ { \infty } \gamma ^ { i } \mathbb { 1 } ( s _ { i } = s , a _ { i } = a ) ] } \end{array}$ Note that $\begin{array} { r } { J ( \pi ) = \sum _ { s , a } \mathcal { R } ( s , a ) \mathcal { F } ^ { \pi } ( s , a ) } \end{array}$ , which we also write as $\langle \mathcal { R } , \mathcal { F } ^ { \pi } \rangle$ . When considering multiple reward functions in an $M D P \setminus \mathcal { R }$ , we define $J _ { \mathcal { R } } ( \pi ) \doteq \langle \mathcal { R } , \mathcal { F } ^ { \pi } \rangle$ and sometimes use
|
| 72 |
+
|
| 73 |
+
$J _ { i } ( \pi ) \doteq \langle { \mathcal { R } } _ { i } , { \mathcal { F } } ^ { \pi } \rangle$ as shorthand. We also use $\mathcal { F } : \Pi \mathbb { R } ^ { | S | | A | }$ to denote the embedding of policies into Euclidean space via their visit counts, and define $\mathcal { F } ( \dot { \Pi } ) \doteq \{ \mathcal { F } ( \pi : \pi \in \dot { \Pi } ) \}$ for any $\dot { \Pi }$ . Moreover, we also use a second way to embed policies into Euclidean space; let $\mathcal { G } ( \pi )$ be the $| S | | A |$ -dimensional vector where $\mathcal { G } ( \pi ) [ s , a ] = \pi ( a \mid s )$ , and let $\mathcal { G } ( \dot { \Pi } ) \doteq \{ \mathcal { G } ( \pi : \pi \in \dot { \Pi } ) \}$ .
|
| 74 |
+
|
| 75 |
+
# 4.2 Definitions and Basic Properties of Hackability and Simplification
|
| 76 |
+
|
| 77 |
+
Here, we formally define hackability as a binary relation between reward functions.
|
| 78 |
+
|
| 79 |
+
Definition 1. A pair of reward functions $\mathcal { R } _ { 1 } , \mathcal { R } _ { 2 }$ are hackable relative to policy set $\Pi$ and an environment $( S , A , T , I , \_ , \gamma )$ if there exist $\pi , \pi ^ { \prime } \in \Pi$ such that
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
J _ { 1 } ( \pi ) < J _ { 1 } ( \pi ^ { \prime } ) \& J _ { 2 } ( \pi ) > J _ { 2 } ( \pi ^ { \prime } ) ,
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
else they are unhackable.
|
| 86 |
+
|
| 87 |
+
Note that an unhackable reward pair can have $J _ { 1 } ( \pi ) < J _ { 1 } ( \pi ^ { \prime } ) \& J _ { 2 } ( \pi ) = J _ { 2 } ( \pi ^ { \prime } )$ or vice versa. Unhackability is symmetric; this can be seen be swapping $\pi$ and $\pi ^ { \prime }$ in Definition 1. It is not transitive, however. In particular, the constant reward function is unhackable with respect to any other reward function, so if it were transitive, any pair of policies would be unhackable. Additionally, we say that $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are equivalent on a set of policies $\Pi$ if $J _ { 1 }$ and $J _ { 2 }$ induce the same ordering of $\Pi$ , and that $\mathcal { R }$ is trivial on $\Pi$ if $J ( \pi ) = J ( \pi ^ { \prime } )$ for all $\pi , \pi ^ { \prime } \in \Pi$ . It is clear that $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are unhackable whenever they are equivalent, or one of them is trivial, but this is relatively uninteresting. Our central question is if and when there are other unhackable reward pairs.
|
| 88 |
+
|
| 89 |
+
The symmetric nature of this definition is counter-intuitive, given that our motivation distinguishes the proxy and true reward functions. We might break this symmetry by only considering policy sequences that monotonically increase the proxy, however, this is equivalent to our original definition of hackability: think of $\mathcal { R } _ { 1 }$ as the proxy, and consider the sequence $\pi , \pi ^ { \prime }$ . We could also restrict ourselves to policies that are approximately optimal according to the proxy; Corollary 2 shows that Theorem 1 applies regardless of this restriction. Finally, we define simplification as an asymmetric special-case of unhackability; Theorem 3 shows this is in fact a more demanding condition.
|
| 90 |
+
|
| 91 |
+
Definition 2. $\mathcal { R } _ { 2 }$ is a simplification of $\mathcal { R } _ { 1 }$ relative to policy set $\Pi$ if for all $\pi , \pi ^ { \prime } \in \Pi$ ,
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
J _ { 1 } ( \pi ) < J _ { 1 } ( \pi ^ { \prime } ) \implies J _ { 2 } ( \pi ) \le J _ { 2 } ( \pi ^ { \prime } ) \ \& \ J _ { 1 } ( \pi ) = J _ { 1 } ( \pi ^ { \prime } ) \implies J _ { 2 } ( \pi ) = J _ { 2 } ( \pi ^ { \prime } )
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
and there exist $\pi , \pi ^ { \prime } \in \Pi$ such that $J _ { 2 } ( \pi ) = J _ { 2 } ( \pi ^ { \prime } )$ but $J _ { 1 } ( \pi ) \ne J _ { 1 } ( \pi ^ { \prime } )$ . Moreover, if $\mathcal { R } _ { 2 }$ is trivial then we say that this is a trivial simplification.
|
| 98 |
+
|
| 99 |
+
Intuitively, while unhackability allows replacing inequality with equality – or vice versa – a simplification can only replace inequalities with equality, collapsing distinctions between policies. When $\mathcal { R } _ { 1 }$ is a simplification of $\mathcal { R } _ { 2 }$ , we also say that $\mathcal { R } _ { 2 }$ is a refinement of $\mathcal { R } _ { 1 }$ . We denote this relationship as $\mathcal { R } _ { 1 } \leq \mathcal { R } _ { 2 }$ or $\mathcal { R } _ { 2 } \ \trianglerighteq { \mathcal { R } _ { 1 } }$ ; the narrowing of the triangle at $R _ { 1 }$ represents the collapsing of distinctions between policies. If $\mathcal { R } _ { 1 } \overset { \vartriangle } { \ v u } \overset { \vartriangle } { \ v u } \mathcal { R } _ { 2 } \overset { \vartriangle } { \ v u } \geq \mathcal { R } _ { 3 }$ , then we have that $\mathcal { R } _ { 1 } , \mathcal { R } _ { 3 }$ are unhackable,4 but if $\mathcal { R } _ { 1 } \trianglerighteq { 2 } \mathcal { R } _ { 2 } \triangleleft \mathscr { R } _ { 3 }$ , then this is not necessarily the case.5
|
| 100 |
+
|
| 101 |
+
Note that these definitions are given relative to some $M D P \setminus \mathcal { R }$ , although we often assume the environment in question is clear from context and suppress this dependence. The dependence on the policy set $\Pi$ , on the other hand, plays a critical role in our results.
|
| 102 |
+
|
| 103 |
+
# 5 Results
|
| 104 |
+
|
| 105 |
+
Our results are aimed at understanding when it is possible to have an unhackable proxy reward function. We first establish (in Section 5.1) that (non-trivial) unhackability is impossible when considering the set of all policies. We might imagine that restricting ourselves to a set of sufficiently good (according to the proxy) policies would remove this limitation, but we show that this is not the case. We then analyze finite policy sets (with deterministic policies as a special case), and establish necessary and sufficient conditions for unhackability and simplification. Finally, we demonstrate via example that non-trivial simplifications are also possible for some infinite policy sets in Section 5.3.
|
| 106 |
+
|
| 107 |
+
# 5.1 Non-trivial Unhackability Requires Restricting the Policy Set
|
| 108 |
+
|
| 109 |
+
We start with a motivating example. Consider the setting shown in Figure 3, where the agent can move left/stay-still/right and gets a reward depending on its state. Let the Gaussian (blue) be the true reward $\mathcal { R } _ { 1 }$ and the step function (orange) be the proxy $\mathcal { R } _ { 2 }$ . These are hackable. To see this, consider being at state $B$ . Let $\pi ( B )$ travel to $A$ or $C$ with 50/50 chance, and compare with the policy $\pi ^ { \prime }$ that stays at $B$ . Then we have that $J _ { 1 } ( \pi ) > J _ { 1 } ( \overline { { \pi } } ^ { \prime } )$ and $J _ { 2 } ( \pi ) \overline { { { < } } } \bar { J _ { 2 } } ( \pi ^ { \prime } )$ .
|
| 110 |
+
|
| 111 |
+
Generally, we might hope that some environments allow for unhackable reward pairs that are not equivalent or trivial. Here we show that this is not the case, unless we impose restrictions on the set of policies we consider.
|
| 112 |
+
|
| 113 |
+

|
| 114 |
+
Figure 3: Two reward functions. While the step function may seem like a simplification of the Gaussian, these reward functions are hackable.
|
| 115 |
+
|
| 116 |
+
First note that if we consider non-stationary policies, this result is relatively straightforward. Suppose $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are unhackable and non-trivial on the set $\Pi ^ { N }$ of all non-stationary policies, and let $\pi ^ { \star }$ be a policy that maximises $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ ) reward, and $\pi _ { \perp }$ be a policy that minimises $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ ) reward. Then the policy $\pi _ { \lambda }$ that plays $\pi ^ { \star }$ with probability $\lambda$ and $\pi _ { \perp }$ with probability $1 - \lambda$ is a policy in $\Pi ^ { N }$ . Moreover, for any $\pi$ there are two unique $\alpha , \beta \in [ 0 , 1 ]$ such that $J _ { 1 } ( \pi ) = J _ { 1 } ( \pi _ { \alpha } )$ and $J _ { 2 } ( \pi ) = J _ { 2 } ( \pi _ { \beta } )$ . Now, if $\alpha \neq \beta$ , then either $J _ { 1 } ( \pi ) < J _ { 1 } ( \pi _ { \delta } )$ and ${ \bf \dot { \cal J } } _ { 2 } ( \pi ) > { \cal J } _ { 2 } ( \pi _ { \delta } )$ , or vice versa, for $\delta = ( \alpha + \beta ) / 2$ . If $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are unhackable then this cannot happen, so it must be that $\alpha = \beta$ This, in turn, implies that $J _ { 1 } ( \pi ) = J _ { 1 } ( \pi ^ { \prime } )$ iff $J _ { 2 } ( \pi ) = J _ { 2 } ( \pi ^ { \prime } )$ , and so $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are equivalent. This means that no interesting unhackability can occur on the set of all non-stationary policies.
|
| 117 |
+
|
| 118 |
+
The same argument cannot be applied to the set of stationary policies, because $\pi _ { \lambda }$ is typically not stationary, and mixing stationary policies’ action probabilities does not have the same effect. For instance, consider a hallway environment where an agent can either move left or right. Mixing the “always go left” and “always go right” policies corresponds to picking a direction and sticking with it, whereas mixing their action probabilities corresponds to choosing to go left or right independently at every time-step. However, we will see that there still cannot be any interesting unhackability on this policy set, and, more generally, that there cannot be any interesting unhackability on any set of policies which contains an open subset. Formally, a set of (stationary) policies $\dot { \Pi }$ is open if $\mathcal { G } ( \dot { \Pi } )$ is open in the smallest affine space that contains $\mathcal { G } ( \Pi )$ , for the set of all stationary policies $\Pi$ . We will use the following lemma:
|
| 119 |
+
|
| 120 |
+
Lemma 1. In any $M D P \setminus \mathcal { R } ,$ if Π˙ is an open set of policies, then $\mathcal { F } ( \dot { \Pi } )$ is open in $\mathbb { R } ^ { | S | ( | A | - 1 ) }$ , and $\mathcal { F }$ is a homeomorphism between $\mathcal { G } ( \dot { \Pi } )$ and $\mathcal { F } ( \dot { \Pi } )$ .
|
| 121 |
+
|
| 122 |
+
Using this lemma, we can show that interesting unhackability is impossible on any set of stationary policies $\hat { \Pi }$ which contains an open subset $\dot { \Pi }$ . Roughly, if $\mathcal { F } ( \dot { \Pi } )$ is open, and $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are non-trivial and unhackable on $\dot { \Pi }$ , then the fact that $J _ { 1 }$ and $J _ { 2 }$ have a linear structure on $\mathcal { F } ( \hat { \Pi } )$ implies that $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ must be equivalent on $\dot { \Pi }$ . From this, and the fact that $\mathcal { F } ( \dot { \Pi } )$ is open, it follows that $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are equivalent everywhere.
|
| 123 |
+
|
| 124 |
+
Theorem 1. In any $M D P \setminus { \mathcal { R } } ,$ if Πˆ contains an open set, then any pair of reward functions that are unhackable and non-trivial on $\hat { \Pi }$ are equivalent on $\hat { \Pi }$ .
|
| 125 |
+
|
| 126 |
+
Since simplification is a special case of unhackability, this also implies that non-trivial simplification is impossible for any such policy set. Also note that Theorem 1 makes no assumptions about the transition function, etc. From this result, we can show that interesting unhackability always is impossible on the set $\Pi$ of all (stationary) policies. In particular, note that the set $\tilde { \Pi }$ of all policies that always take each action with positive probability is an open set, and that $\tilde { \Pi } \subset \Pi$ .
|
| 127 |
+
|
| 128 |
+
Corollary 1. In any $M D P \backslash \mathcal { R } ,$ , any pair of reward functions that are unhackable and non-trivial on the set of all (stationary) policies Π are equivalent on Π.
|
| 129 |
+
|
| 130 |
+
Theorem 1 can also be applied to many other policy sets. For example, we might not care about the hackability resulting from policies with low proxy reward, as we would not expect a sufficiently good learning algorithm to learn such policies. This leads us to consider the following definition:
|
| 131 |
+
|
| 132 |
+
Definition 3. A (stationary) policy $\pi$ is $\varepsilon$ -suboptimal if $J ( \pi ) \geq J ( \pi ^ { \star } ) - \varepsilon$
|
| 133 |
+
|
| 134 |
+
Alternatively, if the learning algorithm always uses a policy that is “nearly” deterministic (but with some probability of exploration), then we might not care about hackability resulting from very stochastic policies, leading us to consider the following definition:
|
| 135 |
+
|
| 136 |
+
Definition 4. A (stationary) policy $\pi$ is $\delta$ -deterministic if $\forall s \in S \exists a \in A : \mathbb { P } ( \pi ( s ) = a ) \geq \delta .$
|
| 137 |
+
|
| 138 |
+
Unfortunately, both of these sets contain open subsets, which means they are subject to Theorem 1.
|
| 139 |
+
|
| 140 |
+
Corollary 2. In any $M D P \setminus \mathcal { R } ,$ any pair of reward functions that are unhackable and non-trivial on the set of all $\varepsilon$ -suboptimal policies $\mathit { \Omega } ^ { \prime } \varepsilon > 0 \mathit { \Omega } .$ ) $\Pi ^ { \varepsilon }$ are equivalent on $\Pi ^ { \varepsilon }$ , and any pair of reward functions that are unhackable and non-trivial on the set of all $\delta$ -deterministic policies $\delta < 1$ ) $\Pi ^ { \delta }$ are equivalent on Πδ.
|
| 141 |
+
|
| 142 |
+
Intuitively, Theorem 1 can be applied to any policy set with “volume” in policy space.
|
| 143 |
+
|
| 144 |
+
# 5.2 Finite Policy Sets
|
| 145 |
+
|
| 146 |
+
Having established that interesting unhackability is impossible relative to the set of all policies, we now turn our attention to the case of finite policy sets. Note that this includes the set of all deterministic policies, since we restrict our analysis to finite MDPs. Surprisingly, here we find that non-trivial non-equivalent unhackable reward pairs always exist.
|
| 147 |
+
|
| 148 |
+
Theorem 2. For any $M D P \setminus \mathcal R$ , any finite set of policies Πˆ containing at least two $\pi , \pi ^ { \prime }$ such that $\mathcal { F } ( \pi ) \neq \mathcal { F } ( \pi ^ { \prime } )$ , and any reward function $\mathcal { R } _ { 1 }$ , there is a non-trivial reward function $\mathcal { R } _ { 2 }$ such that $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are unhackable but not equivalent.
|
| 149 |
+
|
| 150 |
+
This proof proceeds by finding a path from $\mathcal { R } _ { 1 }$ to another reward function $\mathcal { R } _ { 3 }$ that is hackable with respect to $\mathcal { R } _ { 1 }$ . Along the way to reversing one of $\mathcal { R } _ { 1 }$ ’s inequalities, we must encounter a reward function $\mathcal { R } _ { 2 }$ that instead replaces it with equality. In the case that $\mathrm { d i m } ( \hat { \Pi } ) = 3$ , we can visualize moving along this path as rotating the contour lines of a reward function defined on the space containing the policies’ discounted state-action occupancies, see Figure 4. This path can be constructed so as to avoid any reward functions that produce trivial policy orderings, thus guaranteeing $\mathcal { R } _ { 2 }$ is non-trivial. For a simplification to exist, we require some further conditions, as established by the following theorem:
|
| 151 |
+
|
| 152 |
+
Theorem 3. Let $\hat { \Pi }$ be a finite set of policies, and $\mathcal { R } _ { 1 }$ a reward function. The following procedure determines if there exists a non-trivial simplification of $\mathcal { R } _ { 1 }$ in a given $M D P \setminus \mathcal R$ :
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
Figure 4: An illustration of the state-action ocRotating the reward to make V(π3) equal V(π4) first sets V(π1) equal V(π2) cupancy space with a reward function defined over it. Points correspond to policies’ stateaction occupancies. Shading intensity indicates expected reward. Rotating the reward function to make $J ( \pi _ { 3 } ) > J ( \pi _ { 4 } )$ passes through a reward function that sets $\dot { J ( \pi _ { 1 } ) } = J ( \pi _ { 2 } ) \dot { }$ . Solid black lines are contour lines of the original reward function, dotted blue lines are contour lines of the rotated reward function.
|
| 156 |
+
|
| 157 |
+
1. Let $E _ { 1 } \ldots E _ { m }$ be the partition of $\hat { \Pi }$ where $\pi , \pi ^ { \prime }$ belong to the same set iff $J ( \pi ) = J ( \pi ^ { \prime } )$ .
|
| 158 |
+
|
| 159 |
+
2. For each such set $E _ { i }$ , select a policy $\pi _ { i } \in E _ { i }$ and let $Z _ { i }$ be the set of vectors that is obtained by subtracting $\mathcal { F } ( \pi _ { i } )$ from each element of $\mathcal { F } ( E _ { i } )$ .
|
| 160 |
+
|
| 161 |
+
Then there is a non-trivial simplification of $\mathcal { R }$ iff $\dim ( Z _ { 1 } \cup \dotsb \cup Z _ { m } ) \leq \dim ( { \mathcal { F } } ( { \hat { \Pi } } ) ) - 2$ , where $\mathrm { d i m } ( S )$ is the number of linearly independent vectors in $S$ .
|
| 162 |
+
|
| 163 |
+
The proof proceeds similarly to Theorem 2. However, in Theorem 2 it was sufficient to show that there are no trivial reward functions along the path from $\mathcal { R } _ { 1 }$ to $\mathcal { R } _ { 3 }$ , whereas here we additionally need that if $J ( \pi ) = J ( \pi ^ { \prime } )$ then $J ^ { \prime } ( \pi ) = \bar { J } ^ { \prime } ( \pi ^ { \prime } )$ for all functions $\mathcal { R } _ { 2 }$ on the path — this is what the extra conditions ensure.
|
| 164 |
+
|
| 165 |
+
Theorem 3 is opaque, but intuitively, the cases where $\mathcal { R } _ { 1 }$ cannot be simplified are those where $\mathcal { R } _ { 1 }$ imposes many different equality constraints that are difficult to satisfy simultaneously. We can think of $\dim ( { \mathcal { F } } ( \Pi ) )$ as measuring how diverse the behaviours of policies in policy set $\Pi$ are. Having a less diverse policy set means that a given policy ordering imposes fewer constraints on the reward function, creating more potential for simplification. The technical conditions of this proof determine when the diversity of $\Pi$ is or is not sufficient to prohibit simplification, as measured by $\dim ( Z _ { 1 } \cup \dots \cup Z _ { m } )$ .
|
| 166 |
+
|
| 167 |
+
Projecting $E _ { i }$ to $Z _ { i }$ simply moves these spaces to the origin, so that we can compare the directions in which they vary (i.e. their span). By assumption, $E _ { i } \cap E _ { j } = \{ \}$ , but $\operatorname { s p a n } ( Z _ { i } ) \cap \operatorname { s p a n } ( Z _ { j } )$ will include the origin, and may also contain linear subspaces of dimension greater than 0. This is the case exactly when there are a pair of policies in $E _ { i }$ and a pair of policies in $E _ { j }$ that differ by the same visit counts, for example, when the environment contains an obstacle that could be circumnavigated in several different ways (with an impact on visit counts, but no impact on reward), and the policies in $E _ { i }$ and $E _ { j }$ both need to circumnavigate it before doing something else. Roughly speaking, $\mathrm { d i m } ( Z _ { 1 } \cup \dots \cup Z _ { m } )$ is large when either (i) we have very large and diverse sets of policies in $\hat { \Pi }$ that get the same reward according to $\mathcal { R }$ , or (ii) we have a large number of different sets of policies that get the same reward according to $\mathcal { R }$ , and where there are different kinds of diversity in the behaviour of the policies in each set. There are also intuitive special cases of Theorem 3. For example, as noted before, if $E _ { i }$ is a singleton then $Z _ { i }$ has no impact on $\dim ( Z _ { 1 } \cup \dotsb \cup Z _ { m } )$ . This implies the following corollary:
|
| 168 |
+
|
| 169 |
+
Corollary 3. For any finite set of policies $\hat { \Pi } ,$ , any environment, and any reward function $\mathcal { R } , i f | \hat { \Pi } | \geq 2$ and $J ( \pi ) \ne J ( \pi ^ { \prime } )$ for all $\pi , \pi ^ { \prime } \in \hat { \Pi }$ then there is a non-trivial simplification of $\mathcal { R }$ .
|
| 170 |
+
|
| 171 |
+
A natural question is whether any reward function is guaranteed to have a non-trivial simplification on the set of all deterministic policies. As it turns out, this is not the case. For concreteness, and to build intuition for this result, we examine the set of deterministic policies in a simple $M D P \setminus \mathcal R$ with $S = \{ 0 , 1 \} , A = \{ 0 , 1 \} , T ( s , a ) = a , I = \{ 0 : 0 . 5 , 1 : 0 . 5 \} , \gamma = 0 . 5 .$ Denote $\pi _ { i j }$ the policy that takes action $i$ from state 0 and action $j$ from state 1. There are exactly four deterministic policies. We find that of the $4 ! = 2 4$ possible policy orderings, 12 are realizable via some reward function. In each of those 12 orderings, exactly two policies (of the six available pairs of policies in the ordering) can be set to equal value without resulting in the trivial reward function (which pair can be equated depends on the ordering in consideration). Attempting to set three policies equal always results in the trivial reward simplification.
|
| 172 |
+
|
| 173 |
+
For example, given the ordering $\pi _ { 0 0 } \leq \pi _ { 0 1 } \leq \pi _ { 1 1 } \leq \pi _ { 1 0 }$ , the simplification $\pi _ { 0 0 } = \pi _ { 0 1 } < \pi _ { 1 1 } < \pi _ { 1 0 }$ is represented by $R = \left[ { \begin{array} { l l } { 0 \ 3 } \\ { 2 \ 1 } \end{array} } \right]$ , where $\begin{array} { r } { \mathcal { R } ( s , a ) = R [ s , a ] } \end{array}$ : for example, here taking action 1 from state 0 gives reward $\mathcal { R } ( 0 , 1 ) = \mathbf { \bar { 3 } }$ . But there is no reward function representing a non-trivial simplification of this ordering with $\pi _ { 0 1 } = \pi _ { 1 1 }$ . We develop and release a software suite to compute these results. Given an environment and a set of policies, it can calculate all policy orderings represented by some reward function. Also, for a given policy ordering, it can calculate all nontrivial simplifications and reward functions that represent them. For a link to the repository, as well as a full exploration of these policies, orderings, and simplifications, see Appendix D.3.
|
| 174 |
+
|
| 175 |
+
# 5.3 Unhackability in Infinite Policy Sets
|
| 176 |
+
|
| 177 |
+
The results in Section 5.1 do not characterize unhackability for infinite policy sets that do not contain open sets. Here, we provide two examples of such policy sets; one of them admits unhackable reward pairs and the other does not. Consider policies $A , B , C$ , and reward functions $\mathcal { R } _ { 1 }$ with $J _ { 1 } ( C ) \overset { = } { < } J _ { 1 } ( B ) < J _ { 1 } ( A )$ and $\mathcal { R } _ { 2 }$ with $J _ { 2 } ( C ) = J _ { 2 } ( B ) < J _ { 2 } ( A )$ . Policy sets $\Pi _ { a } = \{ A \} \cup \{ \lambda B +$ $( 1 - \lambda ) C : \lambda \in [ 0 , 1 ] \}$ and $\Pi _ { b } = \{ A \} \cup \{ \lambda B + ( 1 - \lambda ) C : \lambda \in [ 0 , 1 ] \}$ are depicted in Figure 5; the vertical axis represents policies’ values according to $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ . For $\Pi _ { a }$ , $\mathcal { R } _ { 2 }$ is a simplification of $\mathcal { R } _ { 1 }$ , but for $\Pi _ { b }$ , it is not, since $J _ { 1 } ( X ) < J _ { 1 } ( Y )$ and $J _ { 2 } ( X ) > J _ { 2 } ( Y )$ .
|
| 178 |
+
|
| 179 |
+
# 6 Discussion
|
| 180 |
+
|
| 181 |
+
We reflect on our results and identify limitations in Section 6.1. In Section 6.2, we discuss how our work can inform discussions about the appropriateness, potential risks, and limitations of using of reward functions as specifications of desired behavior.
|
| 182 |
+
|
| 183 |
+

|
| 184 |
+
Figure 5: Infinite policy sets that do not contain open sets sometimes allow simplification (a), but not always (b). Points A, B, C represent deterministic policies, while the bold lines between them represent stochastic policies. The y-axis gives the values of the policies according to reward functions $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ . We attempt to simplify $\mathcal { R } _ { 1 }$ by rotating the reward function such that $J _ { 2 } ( B ) = J _ { 2 } ( C )$ ; in the figure, we instead (equivalently) rotate the triangle along the AB axis, leading to the red triangle. In (a), $\mathcal { R } _ { 2 }$ simplifies $\mathcal { R } _ { 1 }$ , setting all policies along the BC segment equal in value (but still lower than A). In (b), $\mathcal { R } _ { 2 }$ swaps the relative value of policies $\mathbf { X }$ and $\mathbf { Y }$ $\begin{array} { r } { J _ { 1 } ( X ) < J _ { 1 } ( Y ) = J _ { 2 } ( Y ) < J _ { 2 } ( X ) ) } \end{array}$ and so does not simplify $\mathcal { R } _ { 1 }$ .
|
| 185 |
+
|
| 186 |
+
# 6.1 Limitations
|
| 187 |
+
|
| 188 |
+
Our work has a number of limitations. We have only considered finite MDPs and Markov reward functions, leaving more general environments for future work. While we characterized hackability and simplification for finite policy sets, the conditions for simplification are somewhat opaque, and our characterization of infinite policy sets remains incomplete.
|
| 189 |
+
|
| 190 |
+
As previously discussed, our definition of hackability is strict, arguably too strict. Nonetheless, we believe that understanding the consequences of this strict definition is an important starting point for further theoretical work in this area.
|
| 191 |
+
|
| 192 |
+
The main issue with the strictness of our definition has to do with the symmetric nature of hackability. The existence of complex behaviors that yield low proxy reward and high true reward is much less concerning than the reverse, as these behaviors are unlikely to be discovered while optimizing the proxy. For example, it is very unlikely that our agent would solve climate change in the course of learning how to wash dishes. Note that the existence of simple behaviors with low proxy reward and high true reward is concerning; these could arise early in training, leading us to trust the proxy, only to later see the true reward decrease as the proxy is further optimized. To account for this issue, future work should explore more realistic assumptions about the probability of encountering a given sequence of policies when optimizing the proxy, and measure hackability in proportion to this probability.
|
| 193 |
+
|
| 194 |
+
We could allow for approximate unhackability by only considering pairs of policies ranked differently by the true and proxy reward functions as evidence of hacking iff their value according to the true reward function differs by more than some $\varepsilon$ . Probabilistic unhackability could be defined by looking at the number of misordered policies; this would seem to require making assumptions about the probability of encountering a given policy when optimizing the proxy.
|
| 195 |
+
|
| 196 |
+
Finally, while unhackability is a guarantee that no hacking will occur, hackability is far from a guarantee of hacking. Extensive empirical work is necessary to better understand the factors that influence the occurrence and severity of reward hacking in practice.
|
| 197 |
+
|
| 198 |
+
# 6.2 Implications
|
| 199 |
+
|
| 200 |
+
How should we specify our preferences for AI systems’ behavior? And how detailed a specification is required to achieve a good outcome? In reinforcement learning, the goal of maximizing (some) reward function is often taken for granted, but a number of authors have expressed reservations about this approach (Gabriel, 2020; Dobbe et al., 2021; Hadfield-Menell et al., 2016b, 2017; Bostrom, 2014). Our work has several implications for this discussion, although we caution against drawing any strong conclusions due to the limitations mentioned in Section 6.1.
|
| 201 |
+
|
| 202 |
+
One source of confusion and disagreement is the role of the reward function; it is variously considered as a means of specifying a task (Leike et al., 2018) or encoding broad human values (Dewey, 2011); such distinctions are discussed by Christiano (2019) and Gabriel (2020). We might hope to use Markov reward functions to specify narrow tasks without risking behavior that goes against our broad values. However, if we consider the “narrow task” reward function as a proxy for the true “broad values” reward function, our results indicate that this is not possible: these two reward functions will invariably be hackable. Such reasoning suggests that reward functions must instead encode broad human values, or risk being hacked. This seems challenging, perhaps intractably so, indicating that alternatives to reward optimization may be more promising. Potential alternatives include imitation learning (Ross et al., 2011), constrained RL (Szepesvári, 2020), quantilizers (Taylor, 2016), and incentive management (Everitt et al., 2019).
|
| 203 |
+
|
| 204 |
+
Scholars have also criticized the assumption that human values can be encoded as rewards (Dobbe et al., 2021), and challenged the use of metrics more broadly (O’Neil, 2016; Thomas and Uminsky, 2022), citing Goodhart’s Law (Manheim and Garrabrant, 2018; Goodhart, 1975). A concern more specific to the optimization of reward functions is power-seeking (Turner et al., 2021; Bostrom, 2012; Omohundro, 2008). Turner et al. (2021) prove that optimal policies tend to seek power in most MDPs and for most reward functions. Such behavior could lead to human disempowerment; for instance, an AI system might disable its off-switch (Hadfield-Menell et al., 2016a). Bostrom (2014) and others have argued that power-seeking makes even slight misspecification of rewards potentially catastrophic, although this has yet to be rigorously established.
|
| 205 |
+
|
| 206 |
+
Despite such concerns, approaches to specification based on learning reward functions remain popular (Fu et al., 2017; Stiennon et al., 2020; Nakano et al., 2021). So far, reward hacking has usually been avoidable in practice, although some care must be taken (Stiennon et al., 2020). Proponents of such approaches have emphasized the importance of learning a reward model in order to exceed human performance and generalize to new settings (Brown et al., 2020a; Leike et al., 2018). But our work indicates that such learned rewards are almost certainly hackable, and so cannot be safely optimized. Thus we recommend viewing such approaches as a means of learning a policy in a safe and controlled setting, which should then be validated before being deployed.
|
| 207 |
+
|
| 208 |
+
# 7 Conclusion
|
| 209 |
+
|
| 210 |
+
Our work begins the formal study of reward hacking in reinforcement learning. We formally define hackability and simplification of reward functions, and show conditions for the (non-)existence of non-trivial examples of each. We find that unhackability is quite a strict condition, as the set of all policies never contains non-trivial unhackable pairs of reward functions. Thus in practice, reward hacking must be prevented by limiting the set of possible policies, or controlling (e.g. limiting) optimization. Alternatively, we could pursue approaches not based on optimizing reward functions.
|
| 211 |
+
|
| 212 |
+
# References
|
| 213 |
+
|
| 214 |
+
Abel, D., Dabney, W., Harutyunyan, A., Ho, M. K., Littman, M., Precup, D., and Singh, S. (2021). On the Expressivity of Markov Reward. Advances in Neural Information Processing Systems, 34.
|
| 215 |
+
Amodei, D., Christiano, P., and Ray, A. (2017). Learning from Human Preferences. OpenAI https: //openai.com/blog/deep-reinforcement-learning-from-human-preferences/.
|
| 216 |
+
Bird, J. and Layzell, P. (2002). The evolved radio and its implications for modelling the evolution of novel sensors. In Proceedings of the 2002 Congress on Evolutionary Computation. CEC’02 (Cat. No. 02TH8600), volume 2, pages 1836–1841. IEEE.
|
| 217 |
+
Bostrom, N. (2012). The superintelligent will: Motivation and instrumental rationality in advanced artificial agents. Minds and Machines, 22(2):71–85.
|
| 218 |
+
Bostrom, N. (2014). Superintelligence: Paths, Dangers, Strategies.
|
| 219 |
+
Brown, D. S., Goo, W., and Niekum, S. (2020a). Better-than-demonstrator imitation learning via automatically-ranked demonstrations. In Conference on robot learning, pages 330–359. PMLR.
|
| 220 |
+
Brown, D. S., Schneider, J., Dragan, A. D., and Niekum, S. (2020b). Value Alignment Verification. CoRR, abs/2012.01557.
|
| 221 |
+
Christiano, P. (2019). Ambitious vs. narrow value learning. AI Alignment Forum. https://www.alignmentforum.org/posts/SvuLhtREMy8wRBzpC/ ambitious-vs-narrow-value-learning.
|
| 222 |
+
Clark, J. and Amodei, D. (2016). Faulty Reward Functions in the Wild. OpenAI Codex https: //openai.com/blog/faulty-reward-functions/.
|
| 223 |
+
Dewey, D. (2011). Learning What to Value. In Schmidhuber, J., Thórisson, K. R., and Looks, M., editors, Artificial General Intelligence: 4th International Conference, AGI 2011, pages 309–314, Berlin, Heidelberg. Springer Berlin Heidelberg.
|
| 224 |
+
Dobbe, R., Gilbert, T. K., and Mintz, Y. (2021). Hard Choices in Artificial Intelligence. CoRR, abs/2106.11022.
|
| 225 |
+
Everitt, T., Hutter, M., Kumar, R., and Krakovna, V. (2021). Reward tampering problems and solutions in reinforcement learning: A causal influence diagram perspective. Synthese, 198(27):6435–6467.
|
| 226 |
+
Everitt, T., Krakovna, V., Orseau, L., Hutter, M., and Legg, S. (2017). Reinforcement learning with a corrupted reward channel. arXiv preprint arXiv:1705.08417.
|
| 227 |
+
Everitt, T., Ortega, P. A., Barnes, E., and Legg, S. (2019). Understanding agent incentives using causal influence diagrams. Part I: Single action settings. arXiv preprint arXiv:1902.09980.
|
| 228 |
+
Fu, J., Luo, K., and Levine, S. (2017). Learning robust rewards with adversarial inverse reinforcement learning. arXiv preprint arXiv:1710.11248.
|
| 229 |
+
Gabriel, I. (2020). Artificial intelligence, values, and alignment. Minds and machines, 30(3):411–437.
|
| 230 |
+
Golden, D. (2001). Glass Floor: Colleges Reject Top Applicants, Accepting Only the Students Likely to Enroll. The Wall Street Journal. https://www.wsj.com/articles/ SB991083160294634500.
|
| 231 |
+
Goodhart, C. A. (1975). Problems of monetary management: the UK experience. In of Australia, R. B., editor, Papers in monetary economics. Reserve Bank of Australia.
|
| 232 |
+
Hadfield-Menell, D., Dragan, A., Abbeel, P., and Russell, S. (2016a). The Off-Switch Game. CoRR, abs/1611.08219.
|
| 233 |
+
Hadfield-Menell, D., Dragan, A. D., Abbeel, P., and Russell, S. J. (2016b). Cooperative Inverse Reinforcement Learning. CoRR, abs/1606.03137.
|
| 234 |
+
Hadfield-Menell, D., Milli, S., Abbeel, P., Russell, S. J., and Dragan, A. (2017). Inverse reward design. Advances in neural information processing systems, 30.
|
| 235 |
+
Ibarz, B., Leike, J., Pohlen, T., Irving, G., Legg, S., and Amodei, D. (2018). Reward learning from human preferences and demonstrations in atari. Advances in neural information processing systems, 31.
|
| 236 |
+
Krakovna, V., Orseau, L., Kumar, R., Martic, M., and Legg, S. (2018). Penalizing side effects using stepwise relative reachability. CoRR, abs/1806.01186.
|
| 237 |
+
Krakovna, V., Uesato, J., Mikulik, V., Rahtz, M., Everitt, T., Kumar, R., Kenton, Z., Leike, J., and Legg, S. (2020). Specification gaming: the flip side of AI ingenuity.
|
| 238 |
+
Kumar, R., Uesato, J., Ngo, R., Everitt, T., Krakovna, V., and Legg, S. (2020). Realab: An embedded perspective on tampering. arXiv preprint arXiv:2011.08820.
|
| 239 |
+
Leike, J., Krueger, D., Everitt, T., Martic, M., Maini, V., and Legg, S. (2018). Scalable agent alignment via reward modeling: a research direction. CoRR, abs/1811.07871.
|
| 240 |
+
Manheim, D. and Garrabrant, S. (2018). Categorizing Variants of Goodhart’s Law. CoRR, abs/1803.04585.
|
| 241 |
+
Nakano, R., Hilton, J., Balaji, S., Wu, J., Ouyang, L., Kim, C., Hesse, C., Jain, S., Kosaraju, V., Saunders, W., et al. (2021). WebGPT: Browser-assisted question-answering with human feedback. arXiv preprint arXiv:2112.09332.
|
| 242 |
+
Ng, A. Y., Harada, D., and Russell, S. (1999). Policy invariance under reward transformations: Theory and application to reward shaping. In Icml, volume 99, pages 278–287.
|
| 243 |
+
Ng, A. Y., Russell, S. J., et al. (2000). Algorithms for inverse reinforcement learning. In Icml, volume 1, page 2.
|
| 244 |
+
Omohundro, S. M. (2008). The basic AI drives.
|
| 245 |
+
O’Neil, C. (2016). Weapons of math destruction: How big data increases inequality and threatens democracy. Crown Publishing Group.
|
| 246 |
+
Pan, A., Bhatia, K., and Steinhardt, J. (2022). The Effects of Reward Misspecification: Mapping and Mitigating Misaligned Models. arXiv preprint arXiv:2201.03544.
|
| 247 |
+
Ross, S., Gordon, G., and Bagnell, D. (2011). 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.
|
| 248 |
+
Stiennon, N., Ouyang, L., Wu, J., Ziegler, D., Lowe, R., Voss, C., Radford, A., Amodei, D., and Christiano, P. F. (2020). Learning to summarize with human feedback. Advances in Neural Information Processing Systems, 33:3008–3021.
|
| 249 |
+
Sutton, R. S. and Barto, A. G. (2018). Reinforcement learning: An introduction. MIT press.
|
| 250 |
+
Szepesvári, C. (2020). Constrained MDPs and the reward hypothesis. http://readingsml. blogspot.com/2020/03/constrained-mdps-and-reward-hypothesis.html.
|
| 251 |
+
Taylor, J. (2016). Quantilizers: A safer alternative to maximizers for limited optimization. In Workshops at the Thirtieth AAAI Conference on Artificial Intelligence.
|
| 252 |
+
Thomas, R. L. and Uminsky, D. (2022). Reliance on metrics is a fundamental challenge for AI. Patterns, 3(5):100476.
|
| 253 |
+
Thrun, S. and Schwartz, A. (1993). Issues in using function approximation for reinforcement learning. In Proceedings of the 1993 Connectionist Models Summer School Hillsdale, NJ. Lawrence Erlbaum, volume 6.
|
| 254 |
+
Turner, A. M., Hadfield-Menell, D., and Tadepalli, P. (2019). Conservative Agency via Attainable Utility Preservation. CoRR, abs/1902.09725.
|
| 255 |
+
Turner, A. M., Smith, L., Shah, R., Critch, A., and Tadepalli, P. (2021). Optimal Policies Tend to Seek Power. Advances in Neural Information Processing Systems.
|
| 256 |
+
Uesato, J., Kumar, R., Krakovna, V., Everitt, T., Ngo, R., and Legg, S. (2020). Avoiding tampering incentives in deep rl via decoupled approval. arXiv preprint arXiv:2011.08827.
|
| 257 |
+
Zhang, B., Rajan, R., Pineda, L., Lambert, N., Biedenkapp, A., Chua, K., Hutter, F., and Calandra, R. (2021). On the Importance of Hyperparameter Optimization for Model-based Reinforcement Learning. CoRR, abs/2102.13651.
|
| 258 |
+
Zhuang, S. and Hadfield-Menell, D. (2020). Consequences of misaligned AI. Advances in Neural Information Processing Systems, 33:15763–15773.
|
| 259 |
+
Ziebart, B. D. (2010). Modeling purposeful adaptive behavior with the principle of maximum causal entropy. Carnegie Mellon University.
|
md/dev/z9NLqoFvZ0/z9NLqoFvZ0.md
ADDED
|
@@ -0,0 +1,481 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# State-wise Constrained Policy Optimization
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Reinforcement Learning (RL) algorithms have shown tremendous success in simu
|
| 11 |
+
2 lation environments, but their application to real-world problems faces significant
|
| 12 |
+
3 challenges, with safety being a major concern. In particular, enforcing state-wise
|
| 13 |
+
4 constraints is essential for many challenging tasks such as autonomous driving
|
| 14 |
+
5 and robot manipulation. However, existing safe RL algorithms under the frame
|
| 15 |
+
6 work of Constrained Markov Decision Process (CMDP) do not consider state-wise
|
| 16 |
+
7 constraints. To address this gap, we propose State-wise Constrained Policy Opti
|
| 17 |
+
8 mization (SCPO), the first general-purpose policy search algorithm for state-wise
|
| 18 |
+
9 constrained reinforcement learning. SCPO provides guarantees for state-wise con
|
| 19 |
+
10 straint satisfaction in expectation. In particular, we introduce the framework of
|
| 20 |
+
11 Maximum Markov Decision Process, and prove that the worst-case safety violation
|
| 21 |
+
12 is bounded under SCPO. We demonstrate the effectiveness of our approach on
|
| 22 |
+
13 training neural network policies for extensive robot locomotion tasks, where the
|
| 23 |
+
14 agent must satisfy a variety of state-wise safety constraints. Our results show
|
| 24 |
+
15 that SCPO significantly outperforms existing methods and can handle state-wise
|
| 25 |
+
16 constraints in high-dimensional robotics tasks.
|
| 26 |
+
|
| 27 |
+
# 17 1 Introduction
|
| 28 |
+
|
| 29 |
+
18 Reinforcement learning (RL) has achieved remarkable progress in games and control tasks [Mnih
|
| 30 |
+
19 et al., 2015, Vinyals et al., 2019, Brown and Sandholm, 2018, He et al., 2022, Zhao et al., 2019].
|
| 31 |
+
20 However, one major barrier that limits the application of RL algorithms to real-world problems is
|
| 32 |
+
21 the lack of safety assurance. RL agents learn to make reward-maximizing decisions, which may
|
| 33 |
+
22 violate safety constraints. For example, an RL agent controlling a self-driving car may receive high
|
| 34 |
+
23 rewards by driving at high speeds but will be exposed to high chances of collision. Although the
|
| 35 |
+
24 reward signals can be designed to penalize risky behaviors, there is no guarantee for safety. In other
|
| 36 |
+
25 words, RL agents may sometimes prioritize maximizing the reward over ensuring safety, which can
|
| 37 |
+
26 lead to unsafe or even catastrophic outcomes [Gu et al., 2022]
|
| 38 |
+
27 Emerging in the literature, safe RL aims to provide safety guarantees during or after training. Early
|
| 39 |
+
28 attempts have been made under the framework of constrained Markov Decision Process, where the
|
| 40 |
+
29 majority of works enforce cumulative constraints or chance constraints [Ray et al., 2019, Achiam
|
| 41 |
+
30 et al., 2017a, Liu et al., 2021]. In real-world applications, however, many critical constraints are
|
| 42 |
+
31 instantaneous. For instance, collision avoidance must be enforced at all times for autonomous
|
| 43 |
+
32 cars [Zhao et al., 2023]. Another example is that when a robot holds a glass, the robot can only
|
| 44 |
+
33 release the glass when the glass is on a stable surface. The violation of those constraints will lead to
|
| 45 |
+
34 irreversible failures of the task. In this work, we focus on state-wise (instantaneous) constraints.
|
| 46 |
+
35 The State-wise Constrained Markov Decision Process (SCMDP) is a novel formulation in reinforce
|
| 47 |
+
36 ment learning that requires policies to satisfy hard state-wise constraints. Unlike cumulative or
|
| 48 |
+
37 probabilistic constraints, state-wise constraints demand full compliance at each time step as for
|
| 49 |
+
38 malized by Zhao et al. [2023]. Existing state-wise safe RL methods can be categorized based on
|
| 50 |
+
39 whether safety is ensured during training. There is a fundamental limitation that it is impossible to
|
| 51 |
+
40 guarantee hard state-wise safety during training without prior knowledge of the dynamic model. The
|
| 52 |
+
41 best we can achieve in a model free setting is to learn to satisfy the constraints using as few samples
|
| 53 |
+
42 as possible, which is the focus of this paper. We aim to provide theoretical guarantees on state-wise
|
| 54 |
+
43 safety violation and worst case reward degredation during training.
|
| 55 |
+
44 Our approach is underpinned by a key insight that constraining the maximum violation is equivalent
|
| 56 |
+
45 to enforcing state-wise safety. This insight leads to a novel formulation of MDP called the Maximum
|
| 57 |
+
46 Markov Decision Process (MMDP). With MMDP, we establish a new theoretical result that provides
|
| 58 |
+
47 a bound on the difference between the maximum cost of two policies for episodic tasks. This result
|
| 59 |
+
48 expands upon the cumulative discounted reward and cost bounds for policy search using trust regions,
|
| 60 |
+
49 as previously documented in literature [Achiam et al., 2017b]. We leverage this result to design a
|
| 61 |
+
50 policy improvement step that not only guarantees worst-case performance degradation but also ensures
|
| 62 |
+
51 state-wise cost constraints. Our proposed algorithm, State-wise Constrained Policy Optimization
|
| 63 |
+
52 (SCPO), approximates the theoretically-justified update, which achieves a state-of-the-art trade-off
|
| 64 |
+
53 between safety and performance. Through experiments, we demonstrate that SCPO effectively
|
| 65 |
+
54 trains neural network policies with thousands of parameters on high-dimensional simulated robot
|
| 66 |
+
55 locomotion tasks; and is able to optimize rewards while enforcing state-wise safety constraints. This
|
| 67 |
+
56 work represents a significant step towards developing practical safe RL algorithms that can be applied
|
| 68 |
+
57 to many real-world problems.
|
| 69 |
+
|
| 70 |
+
# 58 2 Related Work
|
| 71 |
+
|
| 72 |
+
# 2.1 Cumulative Safety
|
| 73 |
+
|
| 74 |
+
60 Cumulative safety requires that the expected discounted return with respect to some cost function is
|
| 75 |
+
61 upper-bounded over the entire trajectory. One representative approach is constrained policy optimiza
|
| 76 |
+
62 tion (CPO) [Achiam et al., $\dot { \underline { 2 0 1 7 a } }$ , which builds on a theoretical bound on the difference between
|
| 77 |
+
63 the costs of different policies and derives a policy improvement procedure to ensure constraints
|
| 78 |
+
64 satisfaction. Another approach is interior-point policy optimization (IPO) $\mathbb { \underline { { | L i u \ e t \ a l . } } } , \bigstar$ , which
|
| 79 |
+
65 augments the reward-maximizing objective with logarithmic barrier functions as penalty functions
|
| 80 |
+
66 to accommodate the constraints. Other methods include Lagrangian methods [Ray et al., 2019]
|
| 81 |
+
67 which use adaptive penalty coefficients to enforce constraints and projection-based constrained
|
| 82 |
+
68 policy optimization (PCPO) $\mathrm { \parallel Y a n g e t a l . } , \mathrm { \text2 0 2 0 a } \mathrm { ] }$ which projects trust-region policy updates onto the
|
| 83 |
+
69 constraint set. Although our focus is on a different setting of constraints, existing methods are still
|
| 84 |
+
70 valuable references for illustrating the advantages of our SCPO. By utilizing MMDP, SCPO breaks
|
| 85 |
+
71 the conventional safety-reward trade-off, which results in stronger convergence of state-wise safety
|
| 86 |
+
72 constraints and guaranteed performance degradation bounds.
|
| 87 |
+
|
| 88 |
+
# 73 2.2 State-wise Safety
|
| 89 |
+
|
| 90 |
+
74 Hierarchical Policy One way to enforce state-wise safety constraints is to use hierarchical policies,
|
| 91 |
+
75 with an RL policy generating reward-maximizing actions, and a safety monitor modifying the actions
|
| 92 |
+
76 to satisfy state-wise safety constraints. Such an approach often requires a perfect safety critic to
|
| 93 |
+
77 function well. For example, conservative safety critics (CSC) [Bharadhwaj et al., 2020] propose
|
| 94 |
+
78 a safe critic $Q _ { C } ( s , a )$ , providing a conservative estimate of the likelihood of being unsafe given a
|
| 95 |
+
79 state-action pair. If the safety violation exceeds a predefined threshold, a new action is re-sampled
|
| 96 |
+
80 from the policy until it passes the safety critic. However, this approach is time-consuming. On
|
| 97 |
+
81 the other hand, optimization-based methods such as gradient descent or quadratic programming
|
| 98 |
+
82 can be used to find a safe action that satisfies the constraint while staying close to the reference
|
| 99 |
+
83 action. Unrolling safety layer (USL) $[ [ \mathrm { Z h a n g e t a l . } , [ 2 0 2 2 \mathrm { a } ] ]$ follows a similar hierarchical structure as
|
| 100 |
+
84 CSC but performs gradient descent on the reference action iteratively until the constraint is satisfied
|
| 101 |
+
85 based on learned safety critic $Q _ { C } ( s , a )$ . Finally, instead of using gradient descent, Lyapunov-based
|
| 102 |
+
86 policy gradient (LPG) $[ \mathbb { C h o w e t a l . } ] \mathbb { 2 0 1 9 } ]$ and SafeLayer $\underline { { \mathrm { | } \mathbf { D a l a l \acute { e t a l . } } \mathbf { \lbrack 2 0 1 8 \rbrack } } }$ directly solve quadratic
|
| 103 |
+
87 programming (QP) to project actions to the safe action set induced by the linearized versions of some
|
| 104 |
+
88 learned critic $Q _ { C } ( s , a )$ . All these approaches suffer from safety violations due to imperfect critic
|
| 105 |
+
89 $Q _ { C } ( s , a )$ , while those solving QPs further suffer from errors due to the linear approximation of the
|
| 106 |
+
90 critic. To avoid those issues, we propose SCPO as an end-to-end policy which does not explicitly
|
| 107 |
+
91 maintain a safety monitor.
|
| 108 |
+
92 End-to-End Policy End-to-end policies maximize task rewards while ensuring safety at the same
|
| 109 |
+
93 time. Related work regarding state-wise safety after convergence has been explored recently. Some
|
| 110 |
+
94 approaches [Liang et al., 2018, Tessler et al., 2018] solve a primal-dual optimization problem to
|
| 111 |
+
95 satisfy the safety constraint in expectation. However, the associated optimization is hard in practice
|
| 112 |
+
96 because the optimization problem changes at every learning step. Bohez et al. [2019] approaches
|
| 113 |
+
97 the same setting by augmenting the reward with the sum of the constraint penalty weighted by the
|
| 114 |
+
98 Lagrangian multiplier. Although claimed state-wise safety performance, the aforementioned methods
|
| 115 |
+
99 do not provide theoretical guarantee and fail to achieve near-zero safety violation in practice. He
|
| 116 |
+
100 et al. $\underline { { \hat { \left\| 2 0 2 3 \right\| } } }$ proposes AutoCost to automatically find an appropriate cost function using evolutionary
|
| 117 |
+
101 search over the space of cost functions as parameterized by a simple neural network. It is empirically
|
| 118 |
+
102 shown that the evolved cost functions achieve near-zero safety violation, however, no theoretical
|
| 119 |
+
103 guarantee is provided, and extensive computation is required. FAC $[ \mathbb { M } \mathrm { a } \mathrm { e t } \mathrm { a l } . ] [ 2 0 2 1 ]$ does provide
|
| 120 |
+
104 theoretically guaranteed state-wise safety via parameterized Lagrange functions. However, FAC
|
| 121 |
+
105 replies on strong assumptions and performs poorly in practice. To resolve the above issues, we
|
| 122 |
+
106 propose SCPO as an easy-to-implement and theoretically sound approach with no prior assumptions
|
| 123 |
+
107 on the underlying safety functions.
|
| 124 |
+
|
| 125 |
+
# 08 3 Problem Formulation
|
| 126 |
+
|
| 127 |
+
# 3.1 Preliminaries
|
| 128 |
+
|
| 129 |
+
In this paper, we are especially interested in guaranteeing safety for episodic tasks, which falls within in the scope of finite-horizon Markov Decision Process (MDP). An MDP is specified by a tuple $( S , { \mathcal { A } } , \gamma , R , P , \mu )$ , where $s$ is the state space, and $\mathcal { A }$ is the control space, $R : S \times \mathcal { A } \mapsto \mathbb { R }$ is the reward function, $0 \leq \gamma < 1$ is the discount factor, $\mu : S \mapsto \mathbb { R }$ is the initial state distribution, and $P : \mathcal { S } \times \mathcal { A } \times \mathcal { S } \mapsto \mathbb { R }$ is the transition probability function. $P ( s ^ { \prime } | s , a )$ is the probability of transitioning to state $s ^ { \prime }$ given that the previous state was $s$ and the agent took action $a$ at state $s$ . A stationary policy $\pi : { \bar { \mathcal { S } } } \mapsto { \mathcal { P } } ( { \mathcal { A } } )$ is a map from states to a probability distribution over actions, with $\pi ( a | s )$ denoting the probability of selecting action $a$ in state $s$ . We denote the set of all stationary policies by ⇧. Subsequently, we denote $\pi _ { \theta }$ as the policy that is parameterized by the parameter $\theta$ .
|
| 130 |
+
|
| 131 |
+
119 The standard goal for MDP is to learn a policy $\pi$ that maximizes a performance measure $\mathcal { I } _ { 0 } ( \pi )$ which
|
| 132 |
+
120 is computed via the discounted sum of reward:
|
| 133 |
+
|
| 134 |
+
$$
|
| 135 |
+
\mathcal { I } _ { 0 } ( \pi ) = \mathbb { E } _ { \tau \sim \pi } \left[ \sum _ { { t = 0 } } ^ { H } \gamma ^ { t } R ( s _ { t } , a _ { t } , s _ { t + 1 } ) \right] ,
|
| 136 |
+
$$
|
| 137 |
+
|
| 138 |
+
121 where $H \in \mathbb { N }$ is the horizon, ${ \boldsymbol \tau } = [ s _ { 0 } , a _ { 0 } , s _ { 1 } , \cdot \cdot \cdot ] ,$ , and $\tau \sim \pi$ is shorthand for that the distribution
|
| 139 |
+
122 over trajectories depends on $\pi : s _ { 0 } \sim \mu , a _ { t } \sim \pi ( \cdot | s _ { t } ) , s _ { t + 1 } \sim P ( \cdot | s _ { t } , a _ { t } )$ .
|
| 140 |
+
|
| 141 |
+
# 123 3.2 State-wise Constrained Markov Decision Process
|
| 142 |
+
|
| 143 |
+
124 A constrained Markov Decision Process (CMDP) is an MDP augmented with constraints that restrict
|
| 144 |
+
125 the set of allowable policies. Specifically, CMDP introduces a set of cost functions, $C _ { 1 } , C _ { 2 } , \cdots , C _ { m }$ ,
|
| 145 |
+
126 where $C _ { i } : S \times A \times S \mapsto \mathbb { R }$ maps the state action transition tuple into a cost value. Analogous to $\mathbb { \underline { { \left( 1 \right) } } }$ ,
|
| 146 |
+
127 we denote
|
| 147 |
+
|
| 148 |
+
$$
|
| 149 |
+
\mathcal { I } _ { C _ { i } } ( \pi ) = \mathbb { E } _ { \tau \sim \pi } \left[ \sum _ { t = 0 } ^ { H } \gamma ^ { t } C _ { i } ( s _ { t } , a _ { t } , s _ { t + 1 } ) \right]
|
| 150 |
+
$$
|
| 151 |
+
|
| 152 |
+
as the cost measure for policy 128 $\pi$ with respect to cost function $C _ { i }$ . Hence, the set of feasible stationary 129 policies for CMDP is then defined as follows, where $d _ { i } \in \mathbb { R }$ :
|
| 153 |
+
|
| 154 |
+
$$
|
| 155 |
+
\Pi _ { C } = \{ \pi \in \Pi \vert \forall i , { \mathcal { I } } _ { C _ { i } } ( \pi ) \leq d _ { i } \} .
|
| 156 |
+
$$
|
| 157 |
+
|
| 158 |
+
130 In CMDP, the objective is to select a feasible stationary policy $\pi _ { \theta }$ that maximizes the performance
|
| 159 |
+
131 measure:
|
| 160 |
+
|
| 161 |
+
$$
|
| 162 |
+
\operatorname* { m a x } _ { \pi } \mathcal { I } _ { 0 } ( \pi ) , \ : \ : \mathbf { s . t . } \pi \in \Pi _ { C } .
|
| 163 |
+
$$
|
| 164 |
+
|
| 165 |
+
132 In this paper, we are interested in a special type of CMDP where the safety specification is to persis
|
| 166 |
+
133 tently satisfy a hard cost constraint at every step (as opposed to cumulative costs over trajectories),
|
| 167 |
+
134 which we refer to as State-wise Constrained Markov Decision Process (SCMDP). Like CMDP,
|
| 168 |
+
135 SCMDP uses the set of cost functions $C _ { 1 } , C _ { 2 } , \cdots , C _ { m }$ to evaluate the instantaneous cost of state
|
| 169 |
+
136 action transition tuples. Unlike CMDP, SCMDP requires the cost for every state action transition to
|
| 170 |
+
137 satisfy a hard constraint. Hence, the set of feasible stationary policies for SCMDP is defined as
|
| 171 |
+
|
| 172 |
+
$$
|
| 173 |
+
\bar { \Pi } _ { C } = \{ \pi \in \Pi \big | \forall i , \ \mathbb { E } _ { ( s _ { t } , a _ { t } , s _ { t + 1 } ) \sim \tau , \tau \sim \pi } \big [ C _ { i } ( s _ { t } , a _ { t } , s _ { t + 1 } ) \big ] \le w _ { i } \}
|
| 174 |
+
$$
|
| 175 |
+
|
| 176 |
+
138 where $w _ { i } \in \mathbb { R }$ . Then the objective for SCMDP is to find a feasible stationary policy from $\bar { \Pi } _ { C }$ that
|
| 177 |
+
139 maximizes the performance measure. Formally,
|
| 178 |
+
|
| 179 |
+
$$
|
| 180 |
+
\operatorname* { m a x } _ { \pi } \mathcal { I } _ { 0 } ( \pi ) , \ : \ : \mathbf { s . t . } \pi \in \bar { \Pi } _ { C }
|
| 181 |
+
$$
|
| 182 |
+
|
| 183 |
+
# 140 3.3 Maximum Markov Decision Process
|
| 184 |
+
|
| 185 |
+
141 Note that for $( 6 )$ , every state-action transition pair corresponds to a constraint, which is intractable to
|
| 186 |
+
142 solve using conventional reinforement learning algorithms. Our intuition is that, instead of directly
|
| 187 |
+
143 constraining the cost of each possible state-action transition, we can constrain the expected maximum
|
| 188 |
+
144 state-wise cost along the trajectory, which is much easier to solve. Following that intuition, we define
|
| 189 |
+
145 a novel Maximum Markov-Decision Process (MMDP), which further extends CMDP via (i) a set of
|
| 190 |
+
146 up-to-now maximum state-wise costs $M \doteq [ M _ { 1 } , M _ { 2 } , \cdot \cdot \cdot , M _ { m } ]$ where $M _ { i } \in \mathcal { M } \subset \mathbb { R }$ , and (ii) a set
|
| 191 |
+
147 of cost increment functions, $D _ { 1 } , D _ { 2 } , \cdots , D _ { m }$ , where $D _ { i } : ( \mathcal { S } , \mathcal { M } ^ { m } ) \times \mathcal { A } \times \mathcal { S } \mapsto [ 0 , \mathbb { R } ^ { + } ]$ maps the
|
| 192 |
+
148 augmented state action transition tuple into a non-negative cost increment. We define the augmented
|
| 193 |
+
149 state $\hat { s } = ( s , M ) \in ( S , \mathcal { M } ^ { m } ) \doteq \hat { S }$ , where $\hat { S }$ is the augmented state space. Formally,
|
| 194 |
+
|
| 195 |
+
$$
|
| 196 |
+
D _ { i } \big ( \hat { s } _ { t } , a _ { t } , \hat { s } _ { t + 1 } \big ) = \operatorname* { m a x } \{ C _ { i } \big ( s _ { t } , a _ { t } , s _ { t + 1 } \big ) - M _ { i t } , 0 \} .
|
| 197 |
+
$$
|
| 198 |
+
|
| 199 |
+
By setting 150 $D _ { i } \big ( \hat { s } _ { 0 } , a _ { 0 } , \hat { s } _ { 1 } \big ) \ : = \ : C _ { i } \big ( s _ { 0 } , a _ { 0 } , s _ { 1 } \big )$ , we have $\begin{array} { r } { M _ { i t } = \sum _ { k = 0 } ^ { t - 1 } D _ { i } \big ( \hat { s } _ { k } , a _ { k } , \hat { s } _ { k + 1 } \big ) } \end{array}$ for $t \geq 1$ 151 Hence, we define expected maximum state-wise cost (or $D _ { i }$ -return) for $\pi$ :
|
| 200 |
+
|
| 201 |
+
$$
|
| 202 |
+
\mathcal { I } _ { D _ { i } } ( \pi ) = \mathbb { E } _ { \tau \sim \pi } \left[ \sum _ { t = 0 } ^ { H } D _ { i } \big ( \hat { s } _ { t } , a _ { t } , \hat { s } _ { t + 1 } \big ) \right] .
|
| 203 |
+
$$
|
| 204 |
+
|
| 205 |
+
152 Importantly, $\textcircled{8}$ is the key component of MMDP and differs our work from existing safe RL ap
|
| 206 |
+
153 proaches that are based on CMDP cost measure $( 2 )$ . With $( 8 ) , ( 6 )$ can be rewritten as:
|
| 207 |
+
|
| 208 |
+
$$
|
| 209 |
+
\operatorname* { m a x } _ { \pi } \mathcal { I } ( \pi ) , \ \mathbf { s . t . } \forall i , \mathcal { I } _ { D _ { i } } ( \pi ) \leq w _ { i } ,
|
| 210 |
+
$$
|
| 211 |
+
|
| 212 |
+
154 where $\begin{array} { r } { \mathcal { I } ( \pi ) = \mathbb { E } _ { \tau \sim \pi } \left[ \sum _ { t = 0 } ^ { H } \gamma ^ { t } R ( \hat { s } _ { t } , a _ { t } , \hat { s } _ { t + 1 } ) \right] } \end{array}$ and $R ( \hat { s } , a , \hat { s } ^ { \prime } ) \doteq R ( s , a , s ^ { \prime } )$ . With $R ( \tau )$ being the
|
| 213 |
+
155 discounted return of a trajectory, we define the on-policy value function as $\begin{array} { r } { V ^ { \pi } ( \hat { s } ) \doteq \mathbb { E } _ { \tau \sim \pi } [ R ( \tau ) | \hat { s } _ { 0 } = } \end{array}$
|
| 214 |
+
156 $\hat { s } ]$ , the on-policy action-value function as $Q ^ { \pi } ( \hat { s } , a ) \doteq \perp _ { \tau \sim \pi } [ R ( \tau ) | \hat { s } _ { 0 } = \hat { s } , a _ { 0 } = a ] .$ , and the advantage
|
| 215 |
+
157 function as $A ^ { \pi } ( { \hat { s } } , a ) \doteq Q ^ { \pi } ( { \hat { s } } , a ) - V ^ { \pi } ( { \hat { s } } )$ . Lastly, we define on-policy value functions, action-value
|
| 216 |
+
158 functions, and advantage functions for the cost increments in analogy to $V ^ { \pi }$ , $Q ^ { \pi }$ , and $A ^ { \pi }$ , with $D _ { i }$
|
| 217 |
+
159 replacing $R$ , respectively. We denote those by $V _ { D _ { i } } ^ { \pi }$ , $Q _ { D _ { i } } ^ { \pi }$ and $A _ { D _ { i } } ^ { \pi }$ .
|
| 218 |
+
|
| 219 |
+
# 160 4 State-wise Constrained Policy Optimization
|
| 220 |
+
|
| 221 |
+
161 To solve large and continuous MDPs, policy search algorithms search for the optimal policy within a
|
| 222 |
+
162 set $\Pi _ { \theta } \subset \Pi$ of parametrized policies. In local policy search [Peters and Schaal, $\boxed { 2 0 0 8 }$ , the policy is
|
| 223 |
+
163 iteratively updated by maximizing $\mathcal { I } ( \pi )$ over a local neighborhood of the most recent policy $\pi _ { k }$ . In
|
| 224 |
+
164 local policy search for SCMDPs, policy iterates must be feasible, so optimization is over $\Pi _ { \theta } \bigcap { \bar { \Pi } } _ { C }$ .
|
| 225 |
+
165 The optimization problem is:
|
| 226 |
+
|
| 227 |
+
$$
|
| 228 |
+
\begin{array} { r l } & { \pi _ { k + 1 } = \underset { \pi \in \Pi _ { \theta } } { \mathbf { a r g m a x } } \mathcal { I } ( \pi ) , } \\ & { ~ \mathrm { s . t . } \mathcal { D } i s t ( \pi , \pi _ { k } ) \leq \delta , } \\ & { ~ \mathcal { I } _ { D _ { i } } ( \pi ) \leq w _ { i } , i = 1 , \cdot \cdot \cdot , m . } \end{array}
|
| 229 |
+
$$
|
| 230 |
+
|
| 231 |
+
166 where $\mathcal { D } i s t$ is some distance measure, and $\delta > 0$ is a step size. For actual implementation, we need
|
| 232 |
+
167 to evaluate the constraints first in order to determine the feasible set. However, it is challenging to
|
| 233 |
+
168 evaluate the constraints using samples during the learning process. In this work, we propose SCPO
|
| 234 |
+
169 inspired by recent trust region optimization methods $\boxed { \mathrm { S c h u l m a n ~ e t ~ a l . } } \boxed { 2 0 1 5 } ]$ . SCPO approximates
|
| 235 |
+
170 $\underline { { \hat { \left( \mathrm { 1 0 } \right) } } }$ using (i) KL divergence distance metric $\mathcal { D } i s t$ and (ii) surrogate functions for the objective and
|
| 236 |
+
171 constraints, which can be easily estimated from samples on $\pi _ { k }$ . Mathematically, SCPO requires
|
| 237 |
+
172 the policy update at each iteration is bounded within a trust region, and updates policy via solving
|
| 238 |
+
173 following optimization:
|
| 239 |
+
|
| 240 |
+
$$
|
| 241 |
+
\begin{array} { r l } & { \mathrm { \tt \tt 1 } = \underset { \pi \in \Pi _ { \theta } } { \bf { r g m a x } } \ \underset { \hat { a } \sim \pi ^ { \pi } } { \mathbb { E } } \big [ A ^ { \pi _ { k } } \big ( \hat { s } , a \big ) \big ] } \\ & { \mathrm { s . t . } \ \mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi _ { k } } } \big [ \mathcal { D } _ { K L } \big ( \pi \| \pi _ { k } \big ) [ \hat { s } ] \big ] \leq \delta , } \\ & { \mathrm { \tt \top } _ { D _ { i } } \big ( \pi _ { k } \big ) + \underset { \hat { a } \sim \pi } { \mathbb { E } } \bigg [ A _ { D _ { i } } ^ { \pi _ { k } } \big ( \hat { s } , a \big ) \bigg ] + 2 \big ( H + 1 \big ) \epsilon _ { D _ { i } } ^ { \pi } \sqrt { \frac { 1 } { 2 } \delta } \leq w _ { i } , i = 1 , \cdots , m . } \end{array}
|
| 242 |
+
$$
|
| 243 |
+
|
| 244 |
+
174 where $\mathcal { D } _ { K L } ( \pi ^ { \prime } \| \pi ) [ \hat { s } ]$ is $\mathrm { K L }$ divergence between two policy $( \pi ^ { \prime } , \pi )$ at state $\hat { s }$ , the set $\{ \pi \in$
|
| 245 |
+
175 $\Pi _ { \theta } ~ : ~ \mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi _ { k } } } [ \mathcal { D } _ { K L } ( \pi \| \pi _ { k } ) [ \hat { s } ] ] \le \delta \}$ is called trust region, $\begin{array} { r } { d ^ { \pi _ { k } } \doteq ( 1 - \gamma ) \sum _ { t = 0 } ^ { H } \gamma ^ { t } P ( \hat { s } _ { t } = \hat { s } | \pi _ { k } ) } \end{array}$
|
| 246 |
+
176 $\begin{array} { r } { \bar { d } ^ { \pi _ { k } } \doteq \sum _ { t = 0 } ^ { H } P ( \hat { s } _ { t } = \hat { s } | \pi _ { k } ) } \end{array}$ and $\epsilon _ { D _ { i } } ^ { \pi } \doteq \mathbf { m } \mathbf { a x } _ { \hat { s } } \vert \mathbb { E } _ { a \sim \pi } [ A _ { D _ { i } } ^ { \pi _ { k } } ( \hat { s } , a ) ] \vert$ t=0 . We then show that SCPO guaran
|
| 247 |
+
177 tees (i) worst case maximum state-wise cost violation, and (ii) worst case performance degradation
|
| 248 |
+
178 for policy update, by establishing new bounds on the difference in returns between two stochastic
|
| 249 |
+
179 policies $\pi$ and $\pi ^ { \prime }$ for MMDPs.
|
| 250 |
+
180 Theoretical Guarantees for SCPO We start with the theoretical foundation for our approach,
|
| 251 |
+
181 i.e. a new bound on the difference in state-wise maximum cost between two arbitrary policies. The
|
| 252 |
+
182 following theorem connects the difference in maximum state-wise cost between two arbitrary policies
|
| 253 |
+
183 to the total variation divergence between them. Here total variation divergence between discrete
|
| 254 |
+
184 probability distributions $p , q$ is defined as $\begin{array} { r } { \mathcal { D } _ { T V } ( p | | q ) = \frac { 1 } { 2 } \sum _ { i } | p _ { i } - q _ { i } | } \end{array}$ . This measure can be easily
|
| 255 |
+
185 extended to continuous states and actions by replacing the sums with integrals. Thus, the total variation
|
| 256 |
+
186 divergence between two policy $( \pi ^ { \prime } , \pi )$ at state $\hat { s }$ is defined as: $\mathcal { D } _ { T V } ( \pi ^ { \prime } \| \bar { \pi } ) [ \hat { s } ] = \mathcal { D } _ { T V } ( \pi ^ { \prime } ( \cdot | \hat { s } ) \| \pi ( \cdot | \hat { s } ) )$ .
|
| 257 |
+
187 188 $\epsilon _ { D } ^ { \pi ^ { \prime } } \doteq \mathbf { m a x } _ { \hat { s } } \vert \mathbb { E } _ { a \sim \pi ^ { \prime } } [ A _ { D } ^ { \pi } ( \hat { s } , a ) ] \vert$ ate State-wis, and define $\begin{array} { r } { \bar { d } ^ { \pi } = \sum _ { t = 0 } ^ { H } P ( \hat { s } _ { t } = \hat { s } | \pi ) } \end{array}$ For any policies as the non-disco $\pi ^ { \prime } , \pi$ , with aug
|
| 258 |
+
189 mented state distribution using $\pi$ , then the following bound holds:
|
| 259 |
+
|
| 260 |
+
$$
|
| 261 |
+
\begin{array} { r } { \mathcal { I } _ { D } ( \pi ^ { \prime } ) - \mathcal { I } _ { D } ( \pi ) \leq \underset { \underset { a \sim \pi ^ { \prime } } { \hat { s } \sim \bar { d } ^ { \pi ^ { \prime } } } } { \mathbb { E } } \left[ A _ { D } ^ { \pi } ( \hat { s } , a ) + 2 ( H + 1 ) \epsilon _ { D } ^ { \pi ^ { \prime } } \mathcal { D } _ { T V } ( \pi ^ { \prime } | | \pi ) [ \hat { s } ] \right] . } \end{array}
|
| 262 |
+
$$
|
| 263 |
+
|
| 264 |
+
190 The proof for Theorem $^ 1$ is summarized in Appendix $\boxed { \mathrm { A } }$ Next, we note the following relationship
|
| 265 |
+
191 between the total variation divergence and the KL divergence [Boyd et al., 2003, Achiam et al., 2017a]:
|
| 266 |
+
192 $\begin{array} { r } { \mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi } } [ \mathcal { D } _ { \underline { { T } } V } ( p \| q ) [ \hat { s } ] ] \leq \sqrt { \frac { 1 } { 2 } \mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi } } [ \mathcal { D } _ { K L } ( p \| q ) [ \hat { s } ] ] } } \end{array}$ . The following bound then follows directly from
|
| 267 |
+
193 Theorem 1:
|
| 268 |
+
|
| 269 |
+
$$
|
| 270 |
+
\mathcal { I } _ { D } ( \pi ^ { \prime } ) \leq \mathcal { I } _ { D } ( \pi ) + \underset { \ a \sim \pi ^ { \prime } } { \mathbb { E } } \bigg [ A _ { D } ^ { \pi } ( \hat { s } , a ) + 2 ( H + 1 ) \epsilon _ { D } ^ { \pi ^ { \prime } } \sqrt { \frac { 1 } { 2 } \mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi } } [ \mathcal { D } _ { K L } ( \pi ^ { \prime } \| \pi ) [ \hat { s } ] ] } \bigg ] .
|
| 271 |
+
$$
|
| 272 |
+
|
| 273 |
+
194 By Equation $\textcircled { 1 3 }$ , we have a guarantee for satisfaction of maximum state-wise constraints:
|
| 274 |
+
|
| 275 |
+
195 Proposition 1 (SCPO Update Constraint Satisfaction). Suppose $\pi _ { k } , \pi _ { k + 1 }$ are related by $\textcircled { 1 1 }$ , then
|
| 276 |
+
196 $D _ { i }$ -return for $\pi _ { k + 1 }$ satisfies
|
| 277 |
+
|
| 278 |
+
$$
|
| 279 |
+
\forall i , { \mathcal { T } } _ { D _ { i } } ( \pi _ { k + 1 } ) \leq w _ { i } .
|
| 280 |
+
$$
|
| 281 |
+
|
| 282 |
+
198 Proposition $\mathbb { I }$ presents the first constraint satisfaction guarantee under MMDP. Unlike trust region
|
| 283 |
+
199 methods such as CPO and TRPO, which assume a discounted sum characteristic, MMDP’s non
|
| 284 |
+
200 discounted sum characteristic invalidates these theories. As the maximum state-wise cost is calculated
|
| 285 |
+
201 through a summation of non-discounted increments, analysis must be performed on a finite horizon to
|
| 286 |
+
202 upper bound the worst-case summation. In contrast, the theory behind CPO relies on infinite horizon
|
| 287 |
+
203 analysis with discounted constraint assumptions, which is not applicable for MMDP settings.
|
| 288 |
+
|
| 289 |
+
Next, we provide the performance guarantee of SCPO. Previous analyses of performance guarantees have focused on infinite-horizon MDP. We generalize the analysis to finite-horizon MDP, inspired by previous work [Kakade and Langford, $\begin{array} { r } { \boxed { 2 0 0 2 } , } \end{array}$ Schulman et al., 2015, Achiam et al., 2017a], and prove it in Appendix B. The infinite-horizon case can be viewed as a special case of the finite-horizon setting.
|
| 290 |
+
|
| 291 |
+
Proposition 2 (SCPO Update Worst Performance Degradation). Suppose $\pi _ { k }$ , $\pi _ { k + 1 }$ are related by $\textcircled { 1 1 }$ , with $\epsilon ^ { \pi _ { k + 1 } } \doteq \mathbf { m } \mathbf { a x } _ { \hat { s } } | \mathbb { E } _ { a \sim \pi _ { k + 1 } } [ A ^ { \pi _ { k } } ( \hat { s } , a ) ] |$ , then performance return for $\pi _ { k + 1 }$ satisfies
|
| 292 |
+
|
| 293 |
+
$$
|
| 294 |
+
\mathcal { I } ( \pi _ { k + 1 } ) - \mathcal { I } ( \pi _ { k } ) \geq - \frac { \sqrt { 2 \delta } \gamma \epsilon ^ { \pi _ { k + 1 } } } { 1 - \gamma } .
|
| 295 |
+
$$
|
| 296 |
+
|
| 297 |
+
# 211 5 Practical Implementation
|
| 298 |
+
|
| 299 |
+
212 In this section, we show how to (a) implement an efficient approximation to the update $( 1 1 )$ , (b)
|
| 300 |
+
213 encourage learning even when $( 1 1 )$ becomes infeasible, and (c) handle the difficulty of fitting
|
| 301 |
+
214 augmented value $V _ { D _ { i } } ^ { \pi }$ which is unique to our novel MMDP formulation. The full SCPO pseudocode
|
| 302 |
+
215 is given as algorithm 1 in appendix C.
|
| 303 |
+
216 Practical implementation with sample-based estimation We first estimate the objective and
|
| 304 |
+
217 constraints in $\mathbb { \underline { { ( 1 1 ) } } }$ using samples. Note that we can replace the expected advantage on rewards using
|
| 305 |
+
218 an importance sampling estimator with a sampling distribution $\pi _ { k }$ [Achiam et al., $\boxed { 2 0 1 7 \mathrm { a } }$ as
|
| 306 |
+
|
| 307 |
+
$$
|
| 308 |
+
\mathbb { E } _ { \hat { s } \sim d ^ { \pi _ { k } } , a \sim \pi } [ A ^ { \pi _ { k } } ( \hat { s } , a ) ] = \mathbb { E } _ { \hat { s } \sim d ^ { \pi _ { k } } , a \sim \pi _ { k } } \left[ \frac { \pi ( a | \hat { s } ) } { \pi _ { k } ( a | \hat { s } ) } A ^ { \pi _ { k } } ( \hat { s } , a ) \right] .
|
| 309 |
+
$$
|
| 310 |
+
|
| 311 |
+
219 $( 1 4 )$ allows us to replace $A ^ { \pi _ { k } }$ with empirical estimates at each state-action pair $( \hat { s } , a )$ from rollouts
|
| 312 |
+
220 by the previous policy $\pi _ { k }$ . The empirical estimate of reward advantage is given by $R ( \hat { s } , a , \hat { s } ^ { \prime } ) +$
|
| 313 |
+
221 $\gamma \dot { V } ^ { \pi _ { k } } ( \bar { \hat { s } } ^ { \prime } ) - { V } ^ { \pi _ { k } } ( \hat { s } )$ . $V ^ { \pi _ { k } } \left( \hat { s } \right)$ can be computed at each augmented state by taking the discounted
|
| 314 |
+
222 future return. The same can be applied to the expected advantage with respect to cost increments, with
|
| 315 |
+
223 the sample estimates given by $\begin{array} { r } { \bar { D _ { i } } ( \hat { s } , a , \hat { s } ^ { \prime } ) + \bar { V _ { D _ { i } } ^ { \pi _ { k } } } ( \hat { s } ^ { \prime } ) - { V _ { D _ { i } } ^ { \pi _ { k } } } ( \hat { s } ) } \end{array}$ . $V _ { D _ { i } } ^ { \pi _ { k } } \left( \hat { s } \right)$ is computed by taking the
|
| 316 |
+
224 non-discounted future $D _ { i }$ -return. To proceed, we convexify $( 1 1 )$ by approximating the objective and
|
| 317 |
+
225 cost constraint via first-order expansions, and the trust region constraint via second-order expansions.
|
| 318 |
+
226 Then, $\textcircled{1 1 }$ can be efficiently solved using duality [Achiam et al., $\underline { { 2 0 1 7 a } }$ .
|
| 319 |
+
227 Infeasible constraints An update to $\theta$ is computed every time $\textcircled { 1 1 }$ is solved. However, due to
|
| 320 |
+
228 approximation errors, sometimes $( 1 1 )$ can become infeasible. In that case, we follow [Achiam
|
| 321 |
+
229 et al., 2017a] to propose an recovery update that only decreases the constraint value within the trust
|
| 322 |
+
230 region. In addition, approximation errors can also cause the proposed policy update (either feasible
|
| 323 |
+
231 or recovery) to violate the original constraints in $( 1 1 )$ . Hence, each policy update is followed by
|
| 324 |
+
232 a backtracking line search to ensure constraint satisfaction. If all these fails, we relax the search
|
| 325 |
+
233 condition by also accepting decreasing expected advantage with respect to the costs, when the cost
|
| 326 |
+
234 constraints are already violated. Denoting $c _ { i } \doteq \mathcal { J } _ { D _ { i } } ( \pi _ { k } ) + 2 ( H + 1 ) \epsilon _ { D } ^ { \pi } \sqrt { \delta / 2 } - w _ { i }$ , the above criteria
|
| 327 |
+
235 can be summarized as
|
| 328 |
+
|
| 329 |
+
$$
|
| 330 |
+
\mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi _ { k } } } [ \mathcal { D } _ { K L } ( \pi \| \pi _ { k } ) [ \hat { s } ] ] \le \delta
|
| 331 |
+
$$
|
| 332 |
+
|
| 333 |
+
$$
|
| 334 |
+
\mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi _ { k } } , a \sim \pi } \left[ A _ { D _ { i } } ^ { \pi _ { k } } ( \hat { s } , a ) \right] - \mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi _ { k } } , a \sim \pi _ { k } } \left[ A _ { D _ { i } } ^ { \pi _ { k } } ( \hat { s } , a ) \right] \leq \operatorname* { m a x } ( - c _ { i } , 0 ) .
|
| 335 |
+
$$
|
| 336 |
+
|
| 337 |
+
Note that the previous expected advantage 236 $\mathbb { E } _ { \hat { s } \sim \bar { d } ^ { \pi _ { k } } , a \sim \pi _ { k } } \left[ A _ { D _ { i } } ^ { \pi _ { k } } ( \hat { s } , a ) \right]$ is also estimated from rollouts 237 by $\pi _ { k }$ and converges to zero asymptotically, which recovers the original cost constraints in $\textcircled { 1 1 }$ .
|
| 338 |
+
|
| 339 |
+
238 Imbalanced cost value targets A critical step in solving $\textcircled { 1 1 }$ is to fit the cost increment value
|
| 340 |
+
239 functions $V _ { D _ { i } } ^ { \pi _ { k } } ( \hat { s } _ { t } )$ . By definition, $V _ { D _ { i } } ^ { \pi _ { k } } ( \hat { s } _ { t } )$ is equal to the maximum cost increment in any future
|
| 341 |
+
240 i i state over the maximal state-wise cost so far. In other words, the true $V _ { D _ { i } } ^ { \pi _ { k } }$ will always be zero for all
|
| 342 |
+
241 $\hat { s } _ { t : H }$ when the maximal state-wise cost has already occurred before time $t$ . In practice, this causes
|
| 343 |
+
242 the distribution of cost increment value function to be highly zero-skewed and makes the fitting very
|
| 344 |
+
243 hard. To mitigate the problem, we sub-sample the zero-valued targets to match the population of
|
| 345 |
+
244 non-zero values. We provide more analysis on this trick in Q3 in section $\boxed { 6 . 2 }$
|
| 346 |
+
|
| 347 |
+
In our experiments, we aim to answer these questions:
|
| 348 |
+
|
| 349 |
+
Q1 How does SCPO compare with other state-of-theart methods for safe RL?
|
| 350 |
+
|
| 351 |
+
Q2 What benefits are demonstrated by constraining the maximum state-wise cost?
|
| 352 |
+
|
| 353 |
+
Q3 How do the sub-sampling trick of SCPO impact its performance?
|
| 354 |
+
|
| 355 |
+
# 6.1 Experiment Setups
|
| 356 |
+
|
| 357 |
+
New Safety Gym To showcase the effectiveness of our state-wise constrained policy optimization approach, we enhance the widely recognized safe reinforcement learning benchmark environment, Safety $\mathrm { G y m } [ \mathrm { R a y \ e t \ a l . } ] \ [ \mathrm { 2 0 1 9 } ]$ , by incorporating additional robots and constraints. Subsequently, we perform a series of experiments on this augmented environment.
|
| 358 |
+
|
| 359 |
+
Our experiments are based on five different robots: (i) Point: Figure $2 \mathrm { a } \mathrm { A }$ point-mass robot $( \mathcal { A } \subseteq \mathbb { R } ^ { 2 }$ ) that can move on the ground. (ii) Swimmer: Figure $\bigstar$ A three-link robot $( \mathcal { A } \subseteq \mathbb { R } ^ { 2 }$ ) that can move on the ground. (iii) Walker: Figure 2d A bipedal robot $[ A \subseteq \mathbb { R } ^ { 1 0 } ]$ that can move on the ground. (iv) Ant: Figure $\mathbf { \left\lfloor 2 c \right\rfloor A }$ quadrupedal robot $\mathcal { A } \subseteq \mathbb { R } ^ { 8 \cdot }$ ) that can move on the ground. (v) Drone: Figure $2 \mathrm { e } \mathrm { A }$ quadrotor robot $\bar { ( \mathcal { A } \subseteq \mathbb { R } ^ { 4 } ) }$ that can move in the air.
|
| 360 |
+
|
| 361 |
+

|
| 362 |
+
Figure 1: Comparison of results from two representative test suites in high dimensional systems (Ant and Walker).
|
| 363 |
+
|
| 364 |
+
268 All of the experiments are based on the goal task where the robot must navigate to a goal. Additionally,
|
| 365 |
+
269 since we are interested in episodic tasks (finite-horizon MDP), the environment will be reset once the
|
| 366 |
+
270 goal is reached. For the robots that can move in 3D spaces (e.g, the Drone robot), we also design a
|
| 367 |
+
271 new 3D goal task with a sphere goal floating in the 3D space. Three different types of constraints are
|
| 368 |
+
272 considered: (i) Hazard: Dangerous areas as shown in Figure $3 \mathrm { a } .$ Hazards are trespassable circles on
|
| 369 |
+
273 the ground. The agent is penalized for entering them. (ii) 3D Hazard: 3D Dangerous areas as shown
|
| 370 |
+
274 in Figure $3 \mathbf { b } .$ 3D Hazards are trespassable spheres in the air. The agent is penalized for entering them.
|
| 371 |
+
(iii) Pillar: Fixed obstacles as shown in Figure 3c. The agent is penalized for hitting them.
|
| 372 |
+
276 Considering different robots, constraint types, and constraint difficulty levels, we design 14 test suites
|
| 373 |
+
277 with 5 types of robots and 9 types of constraints, which are summarized in Table 1 in Appendix. We
|
| 374 |
+
278 name these test suites as {Robot}-{Constraint Type}-{Constraint Number}.
|
| 375 |
+
279 Comparison Group The methods in the comparison group include: (i) unconstrained RL algorithm
|
| 376 |
+
280 TRPO [Schulman et al., 2015] (ii) end-to-end constrained safe RL algorithms CPO [Achiam et al.,
|
| 377 |
+
281 2017a], TRPO-Lagrangian [Bohez et al., 2019], TRPO-FAC [Ma et al., 2021], TRPO-IPO [Liu et al.,
|
| 378 |
+
282 2020], PCPO [Yang et al., 2020b], and (iii) hierarchical safe RL algorithms TRPO-SL (TRPO-Safety
|
| 379 |
+
283 Layer) [Dalal et al., $\boxed { 2 0 1 8 }$ , TRPO-USL (TRPO-Unrolling Safety Layer) [Zhang et al., 2022b] . We
|
| 380 |
+
284 select TRPO as our baseline method since it is state-of-the-art and already has safety-constrained
|
| 381 |
+
285 derivatives that can be tested off-the-shelf. For hierarchical safe RL algorithms, we employ a warm-up
|
| 382 |
+
286 phase $1 / 3$ of the whole epochs) which does unconstrained TRPO training, and the generated data
|
| 383 |
+
287 will be used to pre-train the safety critic for future epochs. For all experiments, the policy $\pi$ , the value
|
| 384 |
+
288 $( V ^ { \pi } , V _ { D } ^ { \pi } )$ are all encoded in feedforward neural networks using two hidden layers of size (64,64)
|
| 385 |
+
289 with tanh activations. More details are provided in Appendix D.
|
| 386 |
+
290 Evaluation Metrics For comparison, we evaluate algorithm performance based on (i) reward
|
| 387 |
+
291 performance, (ii) average episode cost and (iii) cost rate. Comparison metric details are provided
|
| 388 |
+
292 in Appendix $\mathbf { D } . 3 .$ We set the limit of cost to 0 for all the safe RL algorithms since we aim to avoid
|
| 389 |
+
293 any violation of the constraints. For our comparison, we implement the baseline safe RL algorithms
|
| 390 |
+
294 exactly following the policy update / action correction procedure from the original papers. We
|
| 391 |
+
295 emphasize that in order for the comparison to be fair, we give baseline safe RL algorithms every
|
| 392 |
+
296 advantage that is given to SCPO, including equivalent trust region policy updates.
|
| 393 |
+
|
| 394 |
+

|
| 395 |
+
Figure 2: Robots for benchmark problems in upgraded Safety Gym.
|
| 396 |
+
|
| 397 |
+

|
| 398 |
+
Figure 3: Constraints for benchmark problems in upgraded Safety Gym.
|
| 399 |
+
|
| 400 |
+

|
| 401 |
+
Figure 4: Comparison of results from four representative test suites in low dimensional systems (Point, Swimmer, and Drone).
|
| 402 |
+
|
| 403 |
+
# 6.2 Evaluating SCPO and Comparison Analysis
|
| 404 |
+
|
| 405 |
+
Low Dimension System We select four representative test suites on low dimensional system (Point, Swimmer, Drone) and summarize the comparison results on Figure $\mathbb { E } ,$ which demonstrate that SCPO is successful at approximately enforcing zero constraints violation safety performance in all environments after the policy converges. Specifically, compared with the baseline safe RL methods, SCPO is able to achieve (i) near zero average episode cost and (ii) significantly lower cost rate without sacrificing reward performance. The baseline end-to-end safe RL methods (TRPOLagrangian, TRPO-FAC, TRPO-IPO, CPO, PCPO) fail to achieve the near zero cost performance
|
| 406 |
+
|
| 407 |
+
305 even when the cost limit is set to be 0. The baseline hierarchical safe RL methods (TRPO-SL,
|
| 408 |
+
306 TRPO-USL) also fail to achieve near zero cost performance even with an explicit safety layer to
|
| 409 |
+
307 correct the unsafe action at every time step. End-to-end safe RL algorithms fail since all methods
|
| 410 |
+
308 rely on CMDP to minimize the discounted cumulative cost while SCPO directly work with MMDP
|
| 411 |
+
309 to restrict the state-wise maximum cost by Proposition $\nsupseteq$ We also observe that TRPO-SL fails to
|
| 412 |
+
310 lower the violation during training, due to the fact that the linear approximation of cost function
|
| 413 |
+
311 $C ( \hat { s } _ { t } , a , \hat { s } _ { t + 1 } )$ [Dalal et al., 2018] becomes inaccurate when the dynamics are highly nonlinear like
|
| 414 |
+
312 the ones we used in MuJoCo [Todorov et al., 2012]. More detailed metrics for comparison and
|
| 415 |
+
313 experimental results on test suites with low dimension systems are summarized in Appendix D.3.
|
| 416 |
+
314 High Dimension System To demonstrate the scalability and per
|
| 417 |
+
315 formance of SCPO in high-dimensional systems, we conducted ad
|
| 418 |
+
316 ditional tests on the Ant-Hazard-8 and Walker-Hazard-8 suites, with
|
| 419 |
+
317 8-dimensional and 10-dimensional control spaces, respectively. The
|
| 420 |
+
318 comparison results for high-dimensional systems are summarized in
|
| 421 |
+
319 Figure $\bigtriangledown$ which show that SCPO outperforms all other baselines in
|
| 422 |
+
320 enforcing zero safety violation without compromising performance
|
| 423 |
+
321 in terms of return. SCPO rapidly stabilizes the cost return around
|
| 424 |
+
322 zero and significantly reduces the cost rate, while the other baselines
|
| 425 |
+
323 fail to converge to a policy with near-zero cost. The comparison
|
| 426 |
+
324 results of both low dimension and high dimension systems answer
|
| 427 |
+
325 Q1.
|
| 428 |
+
326 Maximum State-wise Cost As pointed in Section 3.3, the under
|
| 429 |
+
327 lying magic for enabling near-zero safety violation is to restrict the maximum state-wise cost to stay
|
| 430 |
+
328 around zero. To have a better understanding of this process, we visualize the evolution of maximum
|
| 431 |
+
329 state-wise cost for SCPO on the challenging high-dimensional Ant-Hazard-8 and Walker-Hazard-8
|
| 432 |
+
330 test suites in Figure $5$ , which answers Q2.
|
| 433 |
+
|
| 434 |
+

|
| 435 |
+
Figure 5: Maximum state-wise cost
|
| 436 |
+
|
| 437 |
+
Ablation on Sub-sampling Imbalanced Cost Increment Value Targets As pointed in Section $\textcircled { 5 }$ fitting $V _ { D _ { i } } ^ { \pi _ { k } } \left( \hat { s } _ { t } \right)$ is a critical step towards solving SCPO, which is challenging due to zero-skewed distribution of cost increment value function. To demonstrate the necessity of sub-sampling for solving this challenge, we compare the performance of SCPO with and without sub-sampling trick on the aerial robot test suite, summarized in Figure $6 .$ It is evident that with sub-sampling, the agent achieves higher rewards and more importantly, converges to near-zero costs.
|
| 438 |
+
|
| 439 |
+

|
| 440 |
+
Figure 6: SCPO sub-sampling ablation study with Drone-3DHazard-8
|
| 441 |
+
|
| 442 |
+
That is because sub-sampling effectively balances the cost increment value targets and improves the fitting of $V _ { D _ { i } } ^ { \pi _ { k } } ( \hat { s } _ { t } )$ . We also attempted to solve the imbalance issue via over-sampling non-zero targets, but did not observe promising results. This ablation study provides insights into Q3.
|
| 443 |
+
|
| 444 |
+
# 45 7 Conclusion and Future Work
|
| 445 |
+
|
| 446 |
+
This paper proposed SCPO, the first general-purpose policy search algorithm for state-wise constrained RL. Our approach provides guarantees for state-wise constraint satisfaction at each iteration, allows training of high-dimensional neural network policies while ensuring policy behavior, and is based on a new theoretical result on Maximum Markov Decision Process. We demonstrate SCPO’s effectiveness on robot locomotion tasks, showing its significant performance improvement compared to existing methods and ability to handle state-wise constraints.
|
| 447 |
+
|
| 448 |
+
Limitation and future work One limitation of our work is that, although SCPO satisfies state-wise constraints, the theoretical results are valid only in expectation, meaning that constraint violations are still possible during deployment. To address that, we will study absolute state-wise constraint satisfaction, i.e. bounding the maximal possible state-wise cost, which is even stronger than the current result (satisfaction in expectation).
|
| 449 |
+
|
| 450 |
+
357 References 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. 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. Noam Brown and Tuomas Sandholm. Superhuman ai for heads-up no-limit poker: Libratus beats top professionals. Science, 359(6374):418–424, 2018. Tairan He, Yuge Zhang, Kan Ren, Minghuan Liu, Che Wang, Weinan Zhang, Yuqing Yang, and Dongsheng Li. Reinforcement learning with automated auxiliary loss search. arXiv preprint arXiv:2210.06041, 2022. Wei-Ye Zhao, Xi-Ya Guan, Yang Liu, Xiaoming Zhao, and Jian Peng. Stochastic variance reduction for deep q-learning. arXiv preprint arXiv:1905.08152, 2019. Shangding Gu, Long Yang, Yali Du, Guang Chen, Florian Walter, Jun Wang, Yaodong Yang, and Alois Knoll. A review of safe reinforcement learning: Methods, theory and applications. arXiv preprint arXiv:2205.10330, 2022. Alex Ray, Joshua Achiam, and Dario Amodei. Benchmarking safe exploration in deep reinforcement learning. CoRR, abs/1910.01708, 2019. Joshua Achiam, David Held, Aviv Tamar, and Pieter Abbeel. Constrained policy optimization. In International conference on machine learning, pages 22–31. PMLR, 2017a. Yongshuai Liu, Avishai Halev, and Xin Liu. Policy learning with constraints in model-free reinforcement learning: A survey. In The 30th International Joint Conference on Artificial Intelligence (IJCAI), 2021. Weiye Zhao, Tairan He, Rui Chen, Tianhao Wei, and Changliu Liu. State-wise safe reinforcement learning: A survey. The 32nd International Joint Conference on Artificial Intelligence (IJCAI), 2023.
|
| 451 |
+
384 Joshua Achiam, David Held, Aviv Tamar, and Pieter Abbeel. Constrained policy optimization. In International Conference on Machine Learning, pages 22–31. PMLR, 2017b. Yongshuai Liu, Jiaxin Ding, and Xin Liu. IPO: interior-point policy optimization under constraints. CoRR, abs/1910.09615, 2019. URL http://arxiv.org/abs/1910.09615. Tsung-Yen Yang, Justinian Rosca, Karthik Narasimhan, and Peter J. Ramadge. Projection-based constrained policy optimization. CoRR, abs/2010.03152, 2020a. URL https://arxiv.org/ abs/2010.03152. Homanga Bharadhwaj, Aviral Kumar, Nicholas Rhinehart, Sergey Levine, Florian Shkurti, and Animesh Garg. Conservative safety critics for exploration. arXiv preprint arXiv:2010.14497, 2020. Linrui Zhang, Qin Zhang, Li Shen, Bo Yuan, Xueqian Wang, and Dacheng Tao. Evaluating model-free reinforcement learning toward safety-critical tasks. arXiv preprint arXiv:2212.05727, 2022a. Yinlam Chow, Ofir Nachum, Aleksandra Faust, Edgar Duenez-Guzman, and Mohammad Ghavamzadeh. Lyapunov-based safe policy optimization for continuous control. ICML 2019 Workshop RL4RealLife, abs/1901.10031, 2019. Gal Dalal, Krishnamurthy Dvijotham, Matej Vecerik, Todd Hester, Cosmin Paduraru, and Yuval Tassa. Safe exploration in continuous action spaces. CoRR, abs/1801.08757, 2018. Qingkai Liang, Fanyu Que, and Eytan Modiano. Accelerated primal-dual policy optimization for safe reinforcement learning. arXiv preprint arXiv:1802.06480, 2018.
|
| 452 |
+
402 Chen Tessler, Daniel J Mankowitz, and Shie Mannor. arXiv preprint arXiv:1805.11074, 2018.
|
| 453 |
+
|
| 454 |
+
403 Steven Bohez, Abbas Abdolmaleki, Michael Neunert, Jonas Buchli, Nicolas Heess, and Raia Hadsell.
|
| 455 |
+
404 Value constrained model-free continuous control. arXiv preprint arXiv:1902.04623, 2019.
|
| 456 |
+
405 Tairan He, Weiye Zhao, and Changliu Liu. Autocost: Evolving intrinsic cost for zero-violation
|
| 457 |
+
406 reinforcement learning. Proceedings of the AAAI Conference on Artificial Intelligence, 2023.
|
| 458 |
+
407 Haitong Ma, Yang Guan, Shegnbo Eben Li, Xiangteng Zhang, Sifa Zheng, and Jianyu Chen. Feasible
|
| 459 |
+
408 actor-critic: Constrained reinforcement learning for ensuring statewise safety. arXiv preprint
|
| 460 |
+
409 arXiv:2105.10682, 2021.
|
| 461 |
+
410 Jan Peters and Stefan Schaal. Reinforcement learning of motor skills with policy gradients. Neural
|
| 462 |
+
411 networks, 21(4):682–697, 2008.
|
| 463 |
+
412 John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region
|
| 464 |
+
413 policy optimization. In International conference on machine learning, pages 1889–1897. PMLR,
|
| 465 |
+
414 2015.
|
| 466 |
+
415 Stephen Boyd, Lin Xiao, and Almir Mutapcic. Subgradient methods. lecture notes of EE392o,
|
| 467 |
+
416 Stanford University, Autumn Quarter, 2004:2004–2005, 2003.
|
| 468 |
+
417 Sham Kakade and John Langford. Approximately optimal approximate reinforcement learning. In
|
| 469 |
+
418 Proceedings of the Nineteenth International Conference on Machine Learning, pages 267–274,
|
| 470 |
+
419 2002.
|
| 471 |
+
420 Yongshuai Liu, Jiaxin Ding, and Xin Liu. Ipo: Interior-point policy optimization under constraints.
|
| 472 |
+
421 In Proceedings of the AAAI conference on artificial intelligence, volume 34, pages 4940–4947,
|
| 473 |
+
422 2020.
|
| 474 |
+
423 Tsung-Yen Yang, Justinian Rosca, Karthik Narasimhan, and Peter J Ramadge. Projection-based
|
| 475 |
+
424 constrained policy optimization. arXiv preprint arXiv:2010.03152, 2020b.
|
| 476 |
+
425 Linrui Zhang, Qin Zhang, Li Shen, Bo Yuan, and Xueqian Wang. Saferl-kit: Evaluating efficient
|
| 477 |
+
426 reinforcement learning methods for safe autonomous driving. arXiv preprint arXiv:2206.08528,
|
| 478 |
+
427 2022b.
|
| 479 |
+
428 Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control.
|
| 480 |
+
429 In 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pages 5026–5033.
|
| 481 |
+
430 IEEE, 2012.
|
md/dev/zGvRdBW06F5/zGvRdBW06F5.md
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# On-Device Training Under 256KB Memory
|
| 2 |
+
|
| 3 |
+
Ji $\mathbf { L i n ^ { 1 * } }$ Ligeng $\mathbf { Z } \mathbf { h } \mathbf { u } ^ { 1 * }$ Wei-Ming Chen1 Wei-Chen Wang1 Chuang Gan2 Song Han1 1MIT 2MIT-IBM Watson AI Lab https://tinyml.mit.edu/on-device-training
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
On-device training enables the model to adapt to new data collected from the sensors by fine-tuning a pre-trained model. Users can benefit from customized AI models without having to transfer the data to the cloud, protecting the privacy. However, the training memory consumption is prohibitive for IoT devices that have tiny memory resources. We propose an algorithm-system co-design framework to make on-device training possible with only $2 5 6 K B$ of memory. On-device training faces two unique challenges: (1) the quantized graphs of neural networks are hard to optimize due to low bit-precision and the lack of normalization; (2) the limited hardware resource (memory and computation) does not allow full backpropagation. To cope with the optimization difficulty, we propose QuantizationAware Scaling to calibrate the gradient scales and stabilize 8-bit quantized training. To reduce the memory footprint, we propose Sparse Update to skip the gradient computation of less important layers and sub-tensors. The algorithm innovation is implemented by a lightweight training system, Tiny Training Engine, which prunes the backward computation graph to support sparse updates and offload the runtime auto-differentiation to compile time. Our framework is the first practical solution for on-device transfer learning of visual recognition on tiny IoT devices (e.g., a microcontroller with only 256KB SRAM), using less than 1/1000 of the memory of PyTorch and TensorFlow while matching the accuracy. Our study enables IoT devices not only to perform inference but also to continuously adapt to new data for on-device lifelong learning. A video demo can be found here.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
On-device training allows us to adapt the pre-trained model to newly collected sensory data after deployment. By training and adapting locally on the edge, the model can learn to improve its predictions and perform lifelong learning and user customization. For example, fine-tuning a language model enables continual learning from users’ typing and writing; adapting a vision model enables recognizing new objects from a mobile camera. By bringing training closer to the sensors, it also helps to protect user privacy when handling sensitive data (e.g., healthcare).
|
| 12 |
+
|
| 13 |
+
However, on-device training on tiny edge devices is extremely challenging and fundamentally different from cloud training. Tiny IoT devices (e.g., microcontrollers) typically have a limited SRAM size like 256KB. Such a small memory budget is hardly enough for the inference of deep learning models [47, 46, 7, 11, 43, 24, 44, 59], let alone the training, which requires extra computation for the backward and extra memory for intermediate activation [18]. On the other hand, modern deep training frameworks (e.g., PyTorch [56], TensorFlow [4]) are usually designed for cloud servers and require a large memory footprint $( > 3 0 0 \mathbf { M B } )$ ) even when training a small model (e.g., MobileNetV2-w0.35 [60]) with batch size 1 (Figure. 1).
|
| 14 |
+
|
| 15 |
+
The huge gap $( > 1 0 0 0 \times )$ makes it impossible to run on tiny IoT devices with current frameworks and algorithms. Current deep learning training systems like PyTorch [56], TensorFlow [4], JAX [10],
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1. Algorithm and system co-design reduces the training memory from 303MB (PyTorch) to 141KB with the same transfer learning accuracy, leading to $2 3 0 0 \times$ reduction. The numbers are measured with MobilenetV2- w0.35 [60], batch size 1 and resolution $1 2 8 \times 1 2 8$ . It can be deployed to a microcontroller with 256KB SRAM.
|
| 19 |
+
|
| 20 |
+
MXNet [16], etc. do not consider the tight resources on edge devices. Edge deep learning inference frameworks like TVM [17], TF-Lite [3], NCNN [2], etc. provide a slim runtime, but lack the support for back-propagation. Though there are low-cost efficient transfer learning algorithms like training only the final classifier layer, bias-only update [12], etc., the accuracy drop is significant (Figure 9), and existing training system can not realize the theoretical saving into measured saving. Furthermore, devices like microcontrollers are bare-metal and do not have an operational system and the runtime support needed by existing training frameworks. Therefore, we need to jointly design the algorithm and the system to enable tiny on-device training.
|
| 21 |
+
|
| 22 |
+
In this paper, we aim to bridge the gap and enable tiny on-device training with algorithm-system co-design. We investigate tiny on-device training and find two unique challenges: (1) the model is quantized on edge devices. A real quantized graph is difficult to optimize due to low-precision tensors and the lack of Batch Normalization layers [33]; (2) the limited hardware resource (memory and computation) of tiny hardware does not allow full back-propagation, whose memory usage can easily exceed the SRAM of microcontrollers by more than an order of magnitude. Only updating the last layer leads to poor accuracy (Figure 9). To cope with the optimization difficulty, we propose Quantization-Aware Scaling $( Q A S )$ to automatically scale the gradient of tensors with different bit-precisions, which effectively stabilizes the training and matches the accuracy of the floatingpoint counterpart (Section 2.1). QAS is hyper-parameter free and no tuning is required. To reduce the memory footprint of the full backward computation, we propose Sparse Update to skip the gradient computation of less important layers and sub-tensors. We developed an automated method based on contribution analysis to find the best update scheme under different memory budgets (Section 2.2). Finally, we propose a lightweight training system, Tiny Training Engine (TTE) , to implement the algorithm innovation (Section 2.3). TTE is based on code generation; it offloads the auto-differentiation to the compile-time to greatly cut down the runtime overhead. It also supports advanced graph optimization like graph pruning and reordering to support sparse updates, achieving measured memory saving and speedup.
|
| 23 |
+
|
| 24 |
+
Our framework is the first solution to enable tiny on-device training of convolutional neural networks under 256KB memory budget. (1) Our solution enables weight update not only for the classifier but also for the backbone, which provides a high transfer learning accuracy (Figure 9). For tinyML application VWW [20], our on-device finetuned model matches the accuracy of cloud training+edge deployment, and surpasses the common requirement of tinyML (MLPerf Tiny [8]) by $9 \%$ . (2) Our system-algorithm co-design scheme effectively reduces the memory footprint. As shown in Figure 1, the proposed techniques greatly reduce the memory usage by more than $1 0 0 \times$ compared to the best edge training framework we can find (MNN [35]). (3) Our framework also greatly accelerates training, reducing the per-iteration time by more than $2 0 \times$ compared to dense update and vanilla system design (Figure 10). (4) We deployed our training system to a Cortex M7 microcontroller STM32F746 to demonstrate the feasibility, suggesting that tiny IoT devices can not only perform inference but also training to adapt to new data. Our study paves the way for lifelong on-device learning and opens up new possibilities for privacy-preserving device personalization.
|
| 25 |
+
|
| 26 |
+
# 2 Approach
|
| 27 |
+
|
| 28 |
+
Preliminaries. Neural networks usually need to be quantized to fit the limited memory of edge devices for inference [47, 34]. For a $\tt f p 3 2$ linear layer $\mathbf { y } _ { \mathtt { f p 3 2 } } = \mathbf { W } _ { \mathtt { f p 3 2 } } \mathbf { x } _ { \mathtt { f p 3 2 } } + \mathbf { b } _ { \mathtt { f p 3 2 } }$ , the int8
|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
Figure 2. Real quantized graphs (our optimized graph, designed for efficiency) vs. fake quantized graphs (for QAT, designed for simulation). The fake quantize graphs cannot provide memory saving due to floating-point operations. We need to use real quantized graph to fit the tight memory constraint.
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
Figure 3. The quantized model has a very different weight/gradient norm ratio (i.e., $\lVert \mathbf { W } \rVert / \lVert \mathbf { G } \rVert )$ compared to the floating-point model at training time. QAS stabilizes the $\lVert \mathbf { W } \rVert / \lVert \mathbf { G } \rVert$ ratio and helps optimization. For example, in the highlighted area, the ratios of the quantized model fluctuate dramatically in a zigzag pattern (weight, bias, weight, bias, ...); after applying QAS, the pattern stabilizes and matches the $\tt f p 3 2$ counterpart.
|
| 35 |
+
|
| 36 |
+
quantized counterpart is:
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\begin{array} { r } { \bar { \mathbf { y } } _ { \mathrm { i n t 8 } } = \mathtt { c a s t 2 i n t 8 } \big [ s _ { \mathrm { f p 3 2 } } \cdot \big ( \bar { \mathbf { W } } _ { \mathrm { i n t 8 } } \bar { \mathbf { x } } _ { \mathrm { i n t 8 } } + \bar { \mathbf { b } } _ { \mathrm { i n t 3 2 } } \big ) \big ] , } \end{array}
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
where ¯· denotes the tensor being quantized to fixed-point numbers, and $s$ is a floating-point scaling factor to project the results back into int8 range. We call it real quantized graphs (Figure 2(a)) since tensors are in int8 format. To keep the memory efficiency, we deploy and update the real quantized graph on microcontrollers, and keep the updated weights as $\dot { 1 } \mathrm { n t } 8$ . The update formula is: $\mathbf { \dot { \bar { W } } } _ { \mathrm { i n t 8 } } ^ { \prime } = \mathbf { \bar { c } } \mathbf { a } \mathbf { s } \mathbf { t } 2 \mathbf { i } \mathrm { n } \mathbf { t } 8 ( \mathbf { \bar { W } } _ { \mathrm { i n t 8 } } - \alpha \cdot \mathbf { G } _ { \mathbf { \bar { W } } } )$ , where $\alpha$ is the learning rate, and $\mathbf { G } _ { \bar { \mathbf { W } } }$ is the gradient of the weights. The gradient computation is also performed in $\dot { 1 } \mathrm { n t } 8$ for better computation efficiency.
|
| 43 |
+
|
| 44 |
+
We update the real quantized graph for training, which is fundamentally different to quantizationaware training (QAT), where a fake quantized graph (Figure 2(b)) is trained on the cloud, and converted to a real one for deployment. As shown in Figure 2(b), the fake quantization graph uses $\mathtt { f p 3 2 }$ , leading to no memory or computation savings. Real quantized graphs are for efficiency, while fake quantized graphs are for simulation.
|
| 45 |
+
|
| 46 |
+
# 2.1 Optimizing Real Quantized Graphs
|
| 47 |
+
|
| 48 |
+
Unlike fine-tuning floating-point model on the cloud, training with a real quantized graph is difficult: the quantized graph has tensors of different bit-precisions (int8, int32, fp32, shown in Equation 1) and lacks Batch Normalization [33] layers (fused), leading to unstable gradient update.
|
| 49 |
+
|
| 50 |
+
Gradient scale mismatch. When optimizing a quantized graph, the accuracy is lower compared to the floating-point counterpart. We hypothesize that the quantization process distorts the gradient update. To verify the idea, we plot the ratio between weight norm and gradient norm (i.e., $\lVert \mathbf { W } \rVert / \lVert \mathbf { G } \rVert )$ for each tensor at the beginning of the training on the CIFAR dataset [40] in Figure 3. The ratio curve is very different after quantization: (1) the ratio is much larger (could be addressed by adjusting the learning rate); (2) the ratio has a different pattern after quantization. Take the highlighted area (red box) as an example, the quantized ratios have a zigzag pattern, differing from the floating-point curve. If we use a fixed learning rate for all the tensors, then the update speed of each tensor would be very different compared to the floating-point case, leading to inferior accuracy. We empirically find that adaptive-learning rate optimizers like Adam [36] cannot fully address the issue (Section 3.2).
|
| 51 |
+
|
| 52 |
+

|
| 53 |
+
Figure 4. Different update paradigms of two linear layers in a deep neural network.
|
| 54 |
+
|
| 55 |
+
Quantization-aware scaling (QAS). To address the problem, we propose a hyper-parameter-free learning rate scaling rule, QAS. Consider a 2D weight matrix of a linear layer $\mathbf { W } \in \mathbb { R } ^ { c _ { 1 } \times c _ { 2 } }$ , where $c _ { 1 } , c _ { 2 }$ are the input and output channel. To perform per-tensor quantization\*, we compute a scaling rate $s _ { \mathbf { W } } \in \mathbb { R }$ , such that $\bar { \bf W }$ ’s largest magnitude is $2 ^ { 7 } - 1 = 1 2 7$ :
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
\mathbf { W } = s _ { \mathbf { W } } \cdot \left( \mathbf { W } / s _ { \mathbf { W } } \right) \overset { \mathrm { q u a n t i z e } } { \approx } s _ { \mathbf { W } } \cdot \bar { \mathbf { W } } , \quad \mathbf { G } _ { \bar { \mathbf { W } } } \approx s _ { \mathbf { W } } \cdot \mathbf { G } _ { \mathbf { W } } ,
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
The process (roughly) preserves the mathematical functionality during the forward (Equation 1), but it distorts the magnitude ratio between the weight and its corresponding gradient:
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
\| \bar { \mathbf { W } } \| / \| \mathbf { G } _ { \bar { \mathbf { W } } } \| \approx \| \mathbf { W } / s _ { \mathbf { W } } \| / \| s _ { \mathbf { W } } \cdot \mathbf { G } _ { \mathbf { W } } \| = s _ { \mathbf { W } } ^ { - 2 } \cdot \| \mathbf { W } \| / \| \mathbf { G } \| .
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
We find that the weight and gradient ratios are off by $s _ { \mathbf { W } } ^ { - 2 }$ , leading to the distorted pattern in Figure 3: (1) the scaling factor is far smaller than 1, making the weight-gradient ratio much larger; (2) weights and biases have different data type (int8 vs. int32) and thus have scaling factors of very different magnitude, leading to the zigzag pattern. To solve the issue, we propose Quantization-Aware Scaling (QAS) by compensating the gradient of the quantized graph according to Equation 3:
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\tilde { \bf G } _ { \bar { \bf W } } = { \bf G } _ { \bar { \bf W } } \cdot s _ { \bf W } ^ { - 2 } , \quad \tilde { \bf G } _ { \bar { \bf b } } = { \bf G } _ { \bar { \bf b } } \cdot s _ { \bf W } ^ { - 2 } \cdot s _ { \bf x } ^ { - 2 } = { \bf G } _ { \bar { \bf b } } \cdot s ^ { - 2 }
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
where s 2X is the scaling factor for quantizing input $\mathbf { x }$ (a scalar following [34], note that $s = s _ { \mathbf { W } } \cdot s _ { \mathbf { x } }$ in Equation 1). We plot the $\lVert \mathbf { W } \rVert / \lVert \mathbf { G } \rVert$ curve with QAS in Figure 3 ( $\mathrm { i n t } 8 { + }$ scale). After scaling, the gradient ratios match the floating-point counterpart. QAS enables fully quantized training (int8 for both forward and backward) while matching the accuracy of the floating-point training (Table 1).
|
| 74 |
+
|
| 75 |
+
# 2.2 Memory-Efficient Sparse Update
|
| 76 |
+
|
| 77 |
+
Though QAS makes optimizing a quantized model possible, updating the whole model (or even the last several blocks) requires a large amount of memory, which is not affordable for the tinyML setting. We propose to sparsely update the layers and the tensors.
|
| 78 |
+
|
| 79 |
+
Sparse layer/tensor update. Pruning techniques prove to be quite successful for achieving sparsity and reducing model size [29, 30, 48, 31, 50, 49]. Instead of pruning weights for inference, we "prune" the gradient during backpropagation, and update the model sparsely. Given a tight memory budget, we skip the update of the less important parameters to reduce memory usage and computation cost. We consider updating a linear layer $\mathbf { y } = \mathbf { W } \mathbf { x } + \mathbf { b }$ (similar analysis applies to convolutions). Given the output gradient $\mathbf { G _ { y } }$ from the later layer, we can compute the gradient update by $\mathbf { G } _ { \mathbf { W } } = f _ { 1 } ( \mathbf { G } _ { \mathbf { y } } , \mathbf { x } )$ and $\mathbf { G } _ { \mathbf { b } } ^ { - } = f _ { 2 } ( \mathbf { G } _ { \mathbf { y } } )$ . Notice that updating the biases does not require saving the intermediate activation x, leading to a lighter memory footprint $[ 1 2 ]$ ; while updating the weights is more memory-intensive but also more expressive. For hardware like microcontrollers, we also need an extra copy for the updated parameters since the original ones are stored in read-only FLASH [47]. Given the different natures of updating rules, we consider the sparse update rule in three aspects (Figure 4): (1) Bias update: how many layers should we backpropagate to and update the biases (bias update is cheap, we always update the biases if we have backpropagated to a layer). (2) Sparse layer update: select a subset of layers to update the corresponding weights. (3) Sparse tensor update: we further allow updating a subset of weight channels to reduce the cost.
|
| 80 |
+
|
| 81 |
+
However, finding the right sparse update scheme under a memory budget is challenging due to the large combinational space. For MCUNet [47] model with 43 convolutional layers and weight update ratios from $\{ 0 , 1 / 8 , 1 / \bar { 4 } , 1 / 2 , 1 \}$ , the combination is about $1 0 ^ { 3 0 }$ , making exhaustive search impossible.
|
| 82 |
+
|
| 83 |
+

|
| 84 |
+
|
| 85 |
+
Figure C ribu on analysis o pdating ses and wei a) For as update, the accuracy generally goes higher as more layers are updated, but plateaus soon. (b) For updating the weight of a specific layer, the laterbackward & update layers appear to be more important; the first point-wise conv (pw1) in an inverted bottleneck block [60] appears(a) backward graph gen (b) graph pruning (c) graph reordering (d) deploy to be more important; and the gains are bigger with more channels updated. (c) The automated selection based on contribution analysis is effective: the actual downstream accuracy shows a positive correlation with $\scriptstyle \sum$ acc.
|
| 86 |
+
|
| 87 |
+

|
| 88 |
+
Figure 6. The workflow of our Tiny Training Engine (TTE). (a,b) Our engine traces the forward graph for a given model and derives the corresponding backward graph at compile time. The red cycles denote the gradient descent operators. (c) To reduce memory requirements, nodes related with frozen weights (colored in light blue) are pruned from backward computation. (d) To minimize memory footprint, the gradient descent operators are re-ordered to be interlaced with backward computations (colored in yellow). (e) TTE compiles forward and backward graphs using code generation and deploys training on tiny IoT devices (best viewed in colors).
|
| 89 |
+
|
| 90 |
+
Automated selection with contribution analysis. We propose to automatically derive the sparse update scheme by contribution analysis. We find the contribution of each parameter (weight/bias) to the downstream accuracy. Given a convolutional neural network with $l$ layers, we measure the accuracy improvement from (1) biases: the improvement of updating last $k$ biases $\mathbf { b } _ { l } , \mathbf { b } _ { l - 1 } , . . . , \mathbf { b } _ { l - k + 1 }$ (bias-only update) compared to only updating the classifier, defined as $\Delta \mathrm { a c c } _ { \mathbf { b } [ : k ] }$ ; (2) weights: the improvement of updating the weight of one extra layer $\mathbf { W } _ { i }$ (with a channel update ratio $r$ ) compared to bias-only update, defined as $\Delta \mathrm { a c c } _ { \mathbf { W } i , r }$ . An example of the contribution analysis can be found in Figure 5 (MCUNet on Cars [39] dataset; please find more results in appendix Section F). After we find $\Delta \mathrm { a c c } _ { \mathbf { b } [ : k ] }$ and $\Delta \mathrm { a c c } _ { \mathbf { W } i }$ $( 1 \leq k , i \leq l )$ , we solve an optimization problem to find:
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
k ^ { * } , \mathbf { i } ^ { * } , \mathbf { r } ^ { * } = \operatorname* { m a x } _ { k , \mathbf { i } , \mathbf { r } } ( \Delta \mathrm { a c c } _ { \mathbf { b } [ \cdot k ] } + \sum _ { i \in \mathbf { i } , r \in \mathbf { r } } \Delta \mathrm { a c c } _ { { \mathbf { w } } i , r } ) \quad \mathrm { s . t . ~ M e m o r y } ( k , \mathbf { i } , \mathbf { r } ) \leq \mathrm { c o n s t r a i n t } ,
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
where i is a collection of layer indices whose weights are updated, and $\mathbf { r }$ is the corresponding update ratios (1/8, 1/4, 1/2, 1). Intuitively, by solving this optimization problem, we find the combination of (#layers for bias update, the subset of weights to update), such that the total contribution are maximized while the memory overhead does not exceed the constraint. The problem can be efficiently solved with evolutionary search (see Section D). Here we assume that the accuracy contribution of each tensor $\Delta \mathrm { a c c } )$ can be summed up. Such approximation is quite effective (Figure 5(c)).
|
| 97 |
+
|
| 98 |
+
# 2.3 Tiny Training Engine (TTE)
|
| 99 |
+
|
| 100 |
+
The theoretical saving from real quantized training and sparse update does not translate to measured memory saving in existing deep learning frameworks, due to the redundant runtime and the lack of graph pruning. We co-designed an efficient training system, Tiny Training Engine (TTE), to transform the above algorithms into slim binary codes (Figure 6).
|
| 101 |
+
|
| 102 |
+
Compile-time differentiation and code generation. TTE offloads the auto-differentiation from the runtime to the compile-time, generating a static backward graph which can be pruned and optimized (see below) to reduce the memory and computation. TTE is based on code generation: it compiles the optimized graphs to executable binaries on the target hardware, which minimizes the runtime library size and removes the need for host languages like Python (typically uses Megabytes of memory).
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 7. Memory footprint reduction by operator reordering. With operator reordering, TTE can apply in-place gradient update and perform operator fusion to avoid large intermediate tensors to reduce memory footprint. We profiled MobileNetV2-w0.35 in this figure (same as Figure 1).
|
| 106 |
+
|
| 107 |
+
Backward graph pruning for sparse update. We prune the redundant nodes in the backward graph before compiling it to binary codes. For sparse layer update, we prune away the gradient nodes of the frozen weights, only keeping the nodes for bias update. Afterwards, we traverse the graph to find unused intermediate nodes due to pruning (e.g., saved input activation) and apply dead-code elimination (DCE) to remove the redundancy. For sparse tensor update, we introduce a sub-operator slicing mechanism to split a layer’s weights into trainable and frozen parts; the backward graph of the frozen subset is removed. Our compiler translates the sparse update algorithm into measured memory saving, reducing the training memory $7 . 9 \times$ without losing accuracy (Figure 10(a), blue v.s. yellow).
|
| 108 |
+
|
| 109 |
+
Operator reordering and in-place update. The execution order of different operations affects the life cycle of tensors and the overall memory footprint. This has been well-studied for inference [6, 44] but not for training due to the extra complexity. Traditional training frameworks usually derive the gradients of all the trainable parameters before applying the update. Such a practice leads to significant memory waste for storing the gradients. By reordering operators, we can immediately apply the gradient update to a specific tensor (in-place update) before back-propagating to earlier layers, so that the gradient can be released. As such, we trace the dependency of all tensors (weights, gradients, activation) and reorder the operators, so that some operators can be fused to reduce memory footprint (by $2 . 4 \substack { - 3 . 2 \times }$ , Figure 10(a), yellow v.s. red). The memory life cycle analysis in Figure 7 reflects the memory saving from in-place gradient update and operator fusion.
|
| 110 |
+
|
| 111 |
+
# 3 Experiments
|
| 112 |
+
|
| 113 |
+
# 3.1 Setups
|
| 114 |
+
|
| 115 |
+
Training. We used three popular tinyML models in our experiments: MobileNetV2 [60] (width multiplier 0.35, backbone 17M MACs, 0.25M Param), ProxylessNAS [13] (width multiplier 0.3, backbone 19M MACs, 0.33M Param), MCUNet [47] (the 5FPS ImageNet model, backbone 23M MACs, 0.48M Param). We pre-trained the models on ImageNet [22] and perform post-training quantization [34]. The quantized models are fine-tuned on downstream datasets to evaluate the transfer learning capacity. We perform the training and memory/latency measurement on a microcontroller STM32F746 (320KB SRAM, 1MB Flash) using a single batch size. To faster obtain the accuracy statistics on multiple downstream datasets, we simulate the training results on GPUs, and we verified that the simulation obtains the same level of accuracy compared to training on microcontrollers. Please refer to the the appendix (Section C) for detailed training hyper-parameters. We also provide a video demo of deploying our training system on microcontroller in the appendix (Section A).
|
| 116 |
+
|
| 117 |
+
Datasets. We measure the transfer learning accuracy on multiple downstream datasets and report the average accuracy [37]. We follow [12] to use a set of vision datasets including Cars [39], CIFAR10 [40], CIFAR-100 [40], CUB [67], Flowers [54], Food [9], and Pets $[ 5 5 ]$ . We fine-tuned the models on all these datasets for 50 epochs following [12]. We also include VWW dataset [20], a
|
| 118 |
+
|
| 119 |
+
Table 1. Updating real quantized graphs (int8) for the fine-tuning is difficult: the accuracy falls behind the floating-point counterpart (fp32), even with adaptive learning rate optimizers like Adam [36] and LARS [68]. QAS helps to bridge the accuracy gap without memory overhead (slightly higher due to randomness). The numbers are for updating the last two blocks of MCUNet-5FPS [47] model.
|
| 120 |
+
|
| 121 |
+
<table><tr><td rowspan="2">Precision</td><td rowspan="2">Optimizer</td><td colspan="8">Accuracy(%)(MCUNet backbone: 23MMACs,0.48M Param)</td><td rowspan="2">Avg Acc.</td></tr><tr><td>Cars</td><td>CF10</td><td>CF100</td><td>CUB</td><td>Flowers</td><td>Food</td><td>Pets</td><td>vww</td></tr><tr><td>fp32</td><td>SGD-M</td><td>56.7</td><td>86.0</td><td>63.4</td><td>56.2</td><td>88.8</td><td>67.1</td><td>79.5</td><td>88.7</td><td>73.3</td></tr><tr><td rowspan="4">int8</td><td>SGD-M</td><td>31.2</td><td>75.4</td><td>54.5</td><td>55.1</td><td>84.5</td><td>52.5</td><td>81.0</td><td>85.4</td><td>64.9</td></tr><tr><td>Adam [36]</td><td>54.0</td><td>84.5</td><td>61.0</td><td>58.5</td><td>87.2</td><td>62.6</td><td>80.1</td><td>86.5</td><td>71.8</td></tr><tr><td>LARS [68]</td><td>5.1</td><td>64.8</td><td>39.5</td><td>9.6</td><td>28.8</td><td>46.5</td><td>39.1</td><td>85.0</td><td>39.8</td></tr><tr><td>SGD-M+QAS</td><td>55.2</td><td>86.9</td><td>64.6</td><td>57.8</td><td>89.1</td><td>64.4</td><td>80.9</td><td>89.3</td><td>73.5</td></tr></table>
|
| 122 |
+
|
| 123 |
+

|
| 124 |
+
Figure 8. Training and validation loss curves w/ and w/o QAS. QAS effectively helps convergence, leading to better accuracy. The results are from updating the last two blocks of the MCUNet model on the Cars dataset.
|
| 125 |
+
|
| 126 |
+
widely used benchmark for tinyML applications. We train on VWW for 10 epochs following [47].
|
| 127 |
+
We used resolution 128 for all datasets and models for a fair comparison.
|
| 128 |
+
|
| 129 |
+
Memory estimation. The memory usage of a computation graph is related to its implementation [6, 44, 47, 46]. We provide two settings for memory measurement: (1) analytic profiling: we count the size of extra tensors required for backward computation, including the saved intermediate activation, binary truncation task, and the updated weights. The size is implementation-agnostic. It is used for a fast profiling; (2) on-device profiling: we measure the actual memory usage when running model training on an STM32F746 MCU (320KB SRAM, 1MB Flash). We used TinyEngineV2 [46] as the backend and $2 \times 2$ patch-based inference [46] for the initial stage to reduce the forward peak memory. The measured memory determines whether a solution can be deployed on the hardware.
|
| 130 |
+
|
| 131 |
+
# 3.2 Experimental Results
|
| 132 |
+
|
| 133 |
+
Quantization-aware scaling (QAS) addresses the optimization difficulty. We fine-tuned the last two blocks (simulate low-cost fine-tuning) of MCUNet to various downstream datasets (Table 1). With momentum SGD, the training accuracy of the quantized model (int8) falls behind the floatingpoint counterpart due to the optimization difficulty. Adaptive learning rate optimizers like Adam [36] can improve the accuracy but are still lower than the $\tt f p 3 2$ fine-tuning results; it also costs $3 \times$ memory consumption due to second-order momentum, which is not desired for tinyML settings. LARS [68] cannot converge well on most datasets despite extensive hyper-parameter tuning (over both learning rate and the "trust coefficient"). We hypothesize that the aggressive gradient scaling rule of LARS makes the training unstable. The accuracy gap is closed when we apply QAS, matching the accuracy of floating-point training at no extra memory cost. The learning curves (fine-tuning) of MCUNet on the Cars dataset w/ and w/o QAS are also provided in Figure 8. Therefore, QAS effectively helps optimization.
|
| 134 |
+
|
| 135 |
+
Sparse update obtains better accuracy at lower memory. We compare the performance of our searched sparse update schemes with two baseline methods: fine-tuning only biases of the last $k$ layers; fine-tuning weights and biases of the last $k$ layers (including fine-tuning the full model, when $k$ equals to the total #layers). For each configuration, we measure the average accuracy on the 8 downstream datasets and the analytic extra memory usage. We also compare with a simple baseline by only fine-tuning the classifier. As shown in Figure 9, the accuracy of classifier-only update is low due to the limited learning capacity. Updating the classifier alone is not enough; we also need to update the backbone. Bias-only update outperforms classifier-only update but the accuracy quickly plateaus and does not improve even more biases are tuned. For updating last $k$ layers, the accuracy generally goes higher as more layers are tuned; however, it has a very large memory footprint. Take MCUNet as an example, updating the last two blocks leads to an extra memory surpassing 256KB, making it infeasible for IoT devices/microcontrollers. Our sparse update scheme can achieve higher downstream accuracy at a much lower memory cost: compared to updating last $k$ layers, sparse update can achieve higher downstream accuracy with smaller memory footprint. We also measure the highest accuracy achievable by updating the last $k$ layers (including fine-tuning the full model§) as the baseline upper bound (denoted as "upper bound"). Interestingly, our sparse update achieves a better downstream accuracy compared to the baseline best statistics. We hypothesize that the sparse update scheme alleviates over-fitting or makes momentum-free optimization easier.
|
| 136 |
+
|
| 137 |
+

|
| 138 |
+
Figure 9. Sparse update can achieve higher transfer learning accuracy using $4 . 5 \ – 7 . 5 \times$ smaller extra memory (analytic) compared to updating the last $k$ layers. For classifier-only update, the accuracy is low due to limited capacity. Bias-only update can achieve a higher accuracy but plateaus soon.
|
| 139 |
+
|
| 140 |
+

|
| 141 |
+
Figure 10. Measured peak memory and latency: (a) Sparse update with TTE graph optimization can reduce the measured peak memory by $2 0 – 2 1 \times$ for different models, making training feasible on tiny edge devices. (b) Graph optimization consistently reduces the peak memory for different sparse update schemes (denoted by different average transfer learning accuracies). (c) Sparse update with TTE operators achieves $2 3 – 2 5 \times$ faster training speed compared to the full update with TF-Lite Micro operators, leading to less energy usage. Note: for sparse update, we choose the config that achieves the same accuracy as full update.
|
| 142 |
+
|
| 143 |
+
Matching cloud training accuracy for tinyML. Remarkably, the downstream accuracy of our on-device training has matched or even surpassed the accuracy of cloud-trained results on tinyML application VWW [20]. Our framework uses 206KB measured SRAM while achieving $8 9 . 1 \%$ top1 accuracy for on-device training (we used gradient accumulation for the VWW dataset; see the appendix Section C for details). The result is higher than the accuracy of the same model reported by the state-of-the-art solution MCUNet $( 8 8 . 7 \%$ , trained on cloud and deployed to MCU). Both settings transfer the ImageNet pre-trained model to VWW. The on-device accuracy is far above the common requirement for tinyML $( > 8 0 \%$ by MLPerf Tiny [8]) and surpassed the results of industry solution TF-Lite Micro+MobileNetV2 ( $8 6 . 2 \%$ [47] under 256KB, inference-only, no training support).
|
| 144 |
+
|
| 145 |
+
Tiny Training Engine: memory saving. We measure the training memory of three models on STM32F746 MCU to compare the memory saving from TTE. We measure the peak SRAM usage under three settings: general full update, sparse update, and sparse update with TTE graph reordering (Figure 10(a)). The sparse update effectively reduces peak memory by $7 . 9 \times$ compared to the full update thanks to the graph pruning mechanism, while achieving the same or higher transfer learning accuracy (compare the data points connected by arrows in Figure 9). The memory is further reduced with operator reordering, leading to $2 0 - 2 1 \times$ total memory saving. With both techniques, the training of all 3 models fits 256KB SRAM. We also compare the memory saving of reordering under different update schemes on MCUNet (Figure 9(b), indicated by different accuracy levels). Reordering consistently reduces the peak memory for different sparse update schemes of varying learning capacities.
|
| 146 |
+
|
| 147 |
+

|
| 148 |
+
Figure 11. (a) The weight and activation memory cost of updating each layer of MCUNet (analytic). We find that the activation cost is high for the starting layers; the weight cost is high for the later layers; the overall memory cost is low for the middle layers. (b) Dissecting the sparse update scheme: we update the biases of the last 22 layers due to its low activation cost. For weight update, we update some middle layers due to its low memory cost, and update partial channels of the two later layers since they are important for accuracy (Figure 5).
|
| 149 |
+
|
| 150 |
+
Tiny Training Engine: faster training. We further measure the training latency per image on the STM32F746 MCU with three settings: full update with TF-Lite Micro kernels, sparse update with TF-Lite Micro kernels, and sparse update with TTE kernels (Figure 10(c)). Notice that TF-Lite does not support training; we just used the kernel implementation to measure latency. By graph optimization and exploiting multiple compiler optimization approaches (such as loop unrolling and tiling), our sparse update $^ +$ TTE kernels can significantly enhance the training speed by $2 3 – 2 5 \times$ compared to the full update $^ +$ TF-Lite Micro kernels, leading to energy saving and making training practical. Note that TF-Lite with full update leads to OOM, so we report the projected latency according to the average speed of each op type (marked in dashed columns).
|
| 151 |
+
|
| 152 |
+
# 3.3 Ablation Studies and Analysis
|
| 153 |
+
|
| 154 |
+
Dissecting update schedules. We visualize the update schedule of the MCUNet [47] model searched under 100KB extra memory (analytic) in Figure 11 (lower subfigure (b), with 10 classes). It updates the biases of the last 22 layers, and sparsely updates the weights of 6 layers (some are sub-tensor update). The initial 20 layers are frozen and run forward only. To understand why this scheme makes sense, we also plot the memory cost from activation and weight when updating each layer in the upper subfigure (a). We see a clear pattern: the activation cost is high for the initial layers; the weight cost is high for the ending layers; while the total memory cost is low when we update the middle layers (layer index 18-30). The update scheme matches the memory pattern: to skip the initial stage of high activation memory, we only update biases of the later stage of the network; we update the weights of 4 intermediate layers due to low overall memory cost; we also update the partial weights of two later layers (1/8 and 1/4 weights) due to their high contribution to the downstream accuracy (Figure 5). Interestingly, all the updated weights are from the first point-wise convolution in each inverted residual block [60] as they generally have a higher contribution to accuracy (the peak points on the zigzag curve in Figure 5(b)).
|
| 155 |
+
|
| 156 |
+
Effectiveness of contribution analysis. We verify if the update scheme search based on contribution analysis is effective. We collect several data points during the search process (the update scheme and the search criteria, i.e., the sum of acc). We train the model with each update scheme to get the average accuracy on the downstream datasets (the real optimization target) and plot the comparison in Figure 5(c). We observe a positive correlation, indicating the effectiveness of the search.
|
| 157 |
+
|
| 158 |
+
Sub-channel selection. Similar to weight pruning, we need to select the subset of channels for sub-tensor update. We update the last two blocks of the MCUNet [47] model and only 1/4 of the weights for each layer to compare the accuracy of different channel selection methods (larger magnitude, smaller magnitude, and random). The results are quite similar (within $0 . 2 \%$ accuracy difference). Channel selection is not very important for transfer learning (unlike pruning). We choose to update the channels with a larger weight magnitude since it has slightly higher accuracy.
|
| 159 |
+
|
| 160 |
+
# 4 Related Work
|
| 161 |
+
|
| 162 |
+
Efficient transfer learning. There are several ways to reduce the transfer learning cost compared to fine-tuning the full model [38, 21, 37]. The most straightforward way is to only update the classifier layer [15, 23, 26, 61], but the accuracy is low when the domain shift is large [12]. Later studies investigate other tuning methods including updating biases [12, 70], updating normalization layer parameters [53, 25], updating small parallel branches [12, 32], etc. These methods only reduce the trainable parameter number but lack the study on system co-design to achieve real memory savings. Most of them do not fit tinyML settings (cannot handle quantized graph and lack of BatchNorm [33]).
|
| 163 |
+
|
| 164 |
+
Systems for deep learning. The success of deep learning is built on top of popular training frameworks such as PyTorch [56], TensorFlow [5], MXNet [16], JAX [10], etc. These systems usually depend on a host language (e.g. Python) and various runtimes, which brings significant overhead $\left( > 3 0 0 \mathbf { M } \mathbf { B } \right)$ and does not fit tiny edge devices. Inference libraries like TVM [17], TF-Lite [3], MNN [35], NCNN [1], TensorRT [2], and OpenVino [65] provide lightweight runtime environments but do not support training (only MNN has preliminary support for full model training). None of the existing frameworks can fit tiny IoT devices with tight memory constraints.
|
| 165 |
+
|
| 166 |
+
Tiny deep learning on microcontrollers. Tiny deep learning on microcontrollers is challenging. Existing work explores model compression (pruning [29, 30, 48, 31, 50, 69, 45], quantization [29, 57, 66, 19, 59, 42, 47, 34]) and neural architecture search [71, 72, 64, 47, 7, 43, 24, 51, 47, 46] to reduce the required resource of deep learning models. There are several deep learning systems for tinyML (TF-Micro [5], CMSIS-NN [41], TinyEngine [47], MicroTVM [17], CMix-NN [14], etc.). However, the above algorithms and systems are only for inference but not training. There are several preliminary attempts to explore training on microcontrollers [58, 28, 63, 62]. However, due to the lack of efficient algorithm and system support, they are only able to tune one layer or a very small model, while our work supports the tuning of modern CNNs for real-life applications.
|
| 167 |
+
|
| 168 |
+
# 5 Conclusion
|
| 169 |
+
|
| 170 |
+
In this paper, we propose the first solution to enable tiny on-device training on microcontrollers under a tight memory budget of 256KB. Our algorithm system co-design solution significantly reduces the training memory (more than $1 0 0 0 \times$ compared with PyTorch and TensorFlow) and periteration latency (more than $2 0 \times$ speedup over TensorFlow-Lite Micro), allowing us to obtain higher downstream accuracy. Our study suggests that tiny IoT devices can not only perform inference but also continuously adapt to new data for lifelong learning.
|
| 171 |
+
|
| 172 |
+
Limitations and societal impacts. Our work achieves the first practical solution for transfer learning on tiny microcontrollers. However, our current study is limited to vision recognition with CNNs. In the future, we would like to extend to more modalities (e.g., audio) and more models (e.g., RNNs, Transformers). Our study improves tiny on-device learning, which helps to protect the privacy on sensitive data (e.g., healthcare). However, to design and benchmark our method, we experimented on many downstream datasets, leading to a fair amount of electricity consumption.
|
| 173 |
+
|
| 174 |
+
# Acknowledgments
|
| 175 |
+
|
| 176 |
+
We thank National Science Foundation (NSF), MIT-IBM Watson AI Lab, MIT AI Hardware Program, Amazon, Intel, Qualcomm, Ford, Google for supporting this research.
|
| 177 |
+
|
| 178 |
+
# References
|
| 179 |
+
|
| 180 |
+
[1] Ncnn : A high-performance neural network inference computing framework optimized for mobile platforms. https://github.com/Tencent/ncnn.
|
| 181 |
+
[2] Nvidia tensorrt, an sdk for high-performance deep learning inference. https://developer.nvidia. com/tensorrt.
|
| 182 |
+
[3] Tensorflow lite. https://www.tensorflow.org/lite.
|
| 183 |
+
[4] Martín Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dandelion Mané, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viégas, Oriol Vinyals, Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. Software available from tensorflow.org.
|
| 184 |
+
[5] Martín Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: A system for large-scale machine learning. In OSDI, 2016.
|
| 185 |
+
[6] Byung Hoon Ahn, Jinwon Lee, Jamie Menjay Lin, Hsin-Pai Cheng, Jilei Hou, and Hadi Esmaeilzadeh. Ordering chaos: Memory-aware scheduling of irregularly wired neural networks for edge devices. arXiv preprint arXiv:2003.02369, 2020.
|
| 186 |
+
[7] Colby Banbury, Chuteng Zhou, Igor Fedorov, Ramon Matas, Urmish Thakker, Dibakar Gope, Vijay Janapa Reddi, Matthew Mattina, and Paul Whatmough. Micronets: Neural network architectures for deploying tinyml applications on commodity microcontrollers. Proceedings of Machine Learning and Systems, 3, 2021.
|
| 187 |
+
[8] Colby R Banbury, Vijay Janapa Reddi, Max Lam, William Fu, Amin Fazel, Jeremy Holleman, Xinyuan Huang, Robert Hurtado, David Kanter, Anton Lokhmotov, et al. Benchmarking tinyml systems: Challenges and direction. arXiv preprint arXiv:2003.04821, 2020.
|
| 188 |
+
[9] Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101–mining discriminative components with random forests. In European conference on computer vision, pages 446–461. Springer, 2014.
|
| 189 |
+
[10] 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.
|
| 190 |
+
[11] Alessio Burrello, Angelo Garofalo, Nazareno Bruschi, Giuseppe Tagliavini, Davide Rossi, and Francesco Conti. Dory: Automatic end-to-end deployment of real-world dnns on low-cost iot mcus. IEEE Transactions on Computers, 70(8):1253–1268, 2021.
|
| 191 |
+
[12] Han Cai, Chuang Gan, Ligeng Zhu, and Song Han. Tinytl: Reduce activations, not trainable parameters for efficient on-device learning. arXiv preprint arXiv:2007.11622, 2020.
|
| 192 |
+
[13] Han Cai, Ligeng Zhu, and Song Han. ProxylessNAS: Direct Neural Architecture Search on Target Task and Hardware. In ICLR, 2019.
|
| 193 |
+
[14] Alessandro Capotondi, Manuele Rusci, Marco Fariselli, and Luca Benini. Cmix-nn: Mixed low-precision cnn library for memory-constrained edge devices. IEEE Transactions on Circuits and Systems II: Express Briefs, 67(5):871–875, 2020.
|
| 194 |
+
[15] Ken Chatfield, Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Return of the devil in the details: Delving deep into convolutional nets. In BMVC, 2014.
|
| 195 |
+
[16] Tianqi Chen, Mu Li, Yutian Li, Min Lin, Naiyan Wang, Minjie Wang, Tianjun Xiao, Bing Xu, Chiyuan Zhang, and Zheng Zhang. Mxnet: A flexible and efficient machine learning library for heterogeneous distributed systems. arXiv preprint arXiv:1512.01274, 2015.
|
| 196 |
+
[17] Tianqi Chen, Thierry Moreau, Ziheng Jiang, Lianmin Zheng, Eddie Yan, Haichen Shen, Meghan Cowan, Leyuan Wang, Yuwei Hu, Luis Ceze, et al. $\{ \mathrm { T V M } \}$ : An automated end-to-end optimizing compiler for deep learning. In OSDI, 2018.
|
| 197 |
+
[18] Tianqi Chen, Bing Xu, Chiyuan Zhang, and Carlos Guestrin. Training deep nets with sublinear memory cost. arXiv preprint arXiv:1604.06174, 2016.
|
| 198 |
+
[19] Jungwook Choi, Zhuo Wang, Swagath Venkataramani, Pierce I-Jen Chuang, Vijayalakshmi Srinivasan, and Kailash Gopalakrishnan. Pact: Parameterized clipping activation for quantized neural networks. arXiv preprint arXiv:1805.06085, 2018.
|
| 199 |
+
[20] Aakanksha Chowdhery, Pete Warden, Jonathon Shlens, Andrew Howard, and Rocky Rhodes. Visual wake words dataset. arXiv preprint arXiv:1906.05721, 2019.
|
| 200 |
+
[21] Yin Cui, Yang Song, Chen Sun, Andrew Howard, and Serge Belongie. Large scale fine-grained categorization and domain-specific transfer learning. In CVPR, 2018.
|
| 201 |
+
[22] 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.
|
| 202 |
+
[23] Jeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. Decaf: A deep convolutional activation feature for generic visual recognition. In ICML, 2014.
|
| 203 |
+
[24] Igor Fedorov, Ryan P Adams, Matthew Mattina, and Paul Whatmough. Sparse: Sparse architecture search for cnns on resource-constrained microcontrollers. In NeurIPS, 2019.
|
| 204 |
+
[25] Jonathan Frankle, David J Schwab, and Ari S Morcos. Training batchnorm and only batchnorm: On the expressive power of random features in cnns. arXiv preprint arXiv:2003.00152, 2020.
|
| 205 |
+
[26] Chuang Gan, Naiyan Wang, Yi Yang, Dit-Yan Yeung, and Alex G Hauptmann. Devnet: A deep event network for multimedia event detection and evidence recounting. In CVPR, pages 2568–2577, 2015.
|
| 206 |
+
[27] 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.
|
| 207 |
+
[28] Marc Monfort Grau, Roger Pueyo Centelles, and Felix Freitag. On-device training of machine learning models on microcontrollers with a look at federated learning. In Proceedings of the Conference on Information Technology for Social Good, pages 198–203, 2021.
|
| 208 |
+
[29] Song Han, Huizi Mao, and William J Dally. Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffman Coding. In ICLR, 2016.
|
| 209 |
+
[30] Yihui He, Ji Lin, Zhijian Liu, Hanrui Wang, Li-Jia Li, and Song Han. AMC: AutoML for Model Compression and Acceleration on Mobile Devices. In ECCV, 2018.
|
| 210 |
+
[31] Yihui He, Xiangyu Zhang, and Jian Sun. Channel pruning for accelerating very deep neural networks. In ICCV, 2017.
|
| 211 |
+
[32] Edward Hu, Yelong Shen, Phil Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Lu Wang, and Weizhu Chen. Lora: Low-rank adaptation of large language models, 2021.
|
| 212 |
+
[33] Sergey Ioffe and Christian Szegedy. Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift. In ICML, 2015.
|
| 213 |
+
[34] Benoit Jacob, Skirmantas Kligys, Bo Chen, Menglong Zhu, Matthew Tang, Andrew Howard, Hartwig Adam, and Dmitry Kalenichenko. Quantization and training of neural networks for efficient integerarithmetic-only inference. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2704–2713, 2018.
|
| 214 |
+
[35] Xiaotang Jiang, Huan Wang, Yiliu Chen, Ziqi Wu, Lichuan Wang, Bin Zou, Yafeng Yang, Zongyang Cui, Yu Cai, Tianhang Yu, et al. Mnn: A universal and efficient inference engine. arXiv preprint arXiv:2002.12418, 2020.
|
| 215 |
+
[36] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 216 |
+
[37] 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.
|
| 217 |
+
[38] Simon Kornblith, Jonathon Shlens, and Quoc V Le. Do better imagenet models transfer better? In CVPR, 2019.
|
| 218 |
+
[39] Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained categorization. In Proceedings of the IEEE international conference on computer vision workshops, pages 554–561, 2013.
|
| 219 |
+
[40] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
|
| 220 |
+
[41] Liangzhen Lai, Naveen Suda, and Vikas Chandra. Cmsis-nn: Efficient neural network kernels for arm cortex-m cpus. arXiv preprint arXiv:1801.06601, 2018.
|
| 221 |
+
[42] Hamed F Langroudi, Vedant Karia, Tej Pandit, and Dhireesha Kudithipudi. Tent: Efficient quantization of neural networks on the tiny edge with tapered fixed point. arXiv preprint arXiv:2104.02233, 2021.
|
| 222 |
+
[43] Edgar Liberis, Łukasz Dudziak, and Nicholas D Lane. µnas: Constrained neural architecture search for microcontrollers. arXiv preprint arXiv:2010.14246, 2020.
|
| 223 |
+
[44] Edgar Liberis and Nicholas D Lane. Neural networks on microcontrollers: saving memory at inference via operator reordering. arXiv preprint arXiv:1910.05110, 2019.
|
| 224 |
+
[45] Edgar Liberis and Nicholas D Lane. Differentiable network pruning for microcontrollers. arXiv preprint arXiv:2110.08350, 2021.
|
| 225 |
+
[46] Ji Lin, Wei-Ming Chen, Han Cai, Chuang Gan, and Song Han. Mcunetv2: Memory-efficient patch-based inference for tiny deep learning. arXiv preprint arXiv:2110.15352, 2021.
|
| 226 |
+
[47] Ji Lin, Wei-Ming Chen, Yujun Lin, John Cohn, Chuang Gan, and Song Han. Mcunet: Tiny deep learning on iot devices. In NeurIPS, 2020.
|
| 227 |
+
[48] Ji Lin, Yongming Rao, Jiwen Lu, and Jie Zhou. Runtime neural pruning. In NeurIPS, 2017.
|
| 228 |
+
[49] Zechun Liu, Haoyuan Mu, Xiangyu Zhang, Zichao Guo, Xin Yang, Kwang-Ting Cheng, and Jian Sun. MetaPruning: Meta Learning for Automatic Neural Network Channel Pruning. In ICCV, 2019.
|
| 229 |
+
[50] Zhuang Liu, Jianguo Li, Zhiqiang Shen, Gao Huang, Shoumeng Yan, and Changshui Zhang. Learning efficient convolutional networks through network slimming. In ICCV, 2017.
|
| 230 |
+
[51] Bo Lyu, Hang Yuan, Longfei Lu, and Yunye Zhang. Resource-constrained neural architecture search on edge devices. IEEE Transactions on Network Science and Engineering, 2021.
|
| 231 |
+
[52] Philipp Moritz, Robert Nishihara, Stephanie Wang, Alexey Tumanov, Richard Liaw, Eric Liang, Melih Elibol, Zongheng Yang, William Paul, Michael I Jordan, et al. Ray: A distributed framework for emerging {AI} applications. In 13th USENIX Symposium on Operating Systems Design and Implementation (OSDI 18), pages 561–577, 2018.
|
| 232 |
+
[53] Pramod Kaushik Mudrakarta, Mark Sandler, Andrey Zhmoginov, and Andrew Howard. K for the price of 1: Parameter-efficient multi-task and transfer learning. In ICLR, 2019.
|
| 233 |
+
[54] Maria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In 2008 Sixth Indian Conference on Computer Vision, Graphics & Image Processing, pages 722–729. IEEE, 2008.
|
| 234 |
+
[55] Omkar M Parkhi, Andrea Vedaldi, Andrew Zisserman, and CV Jawahar. Cats and dogs. In 2012 IEEE conference on computer vision and pattern recognition, pages 3498–3505. IEEE, 2012.
|
| 235 |
+
[56] 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.
|
| 236 |
+
[57] Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. Xnor-net: Imagenet classification using binary convolutional neural networks. In ECCV, 2016.
|
| 237 |
+
[58] Haoyu Ren, Darko Anicic, and Thomas A Runkler. Tinyol: Tinyml with online-learning on microcontrollers. In 2021 International Joint Conference on Neural Networks (IJCNN), pages 1–8. IEEE, 2021.
|
| 238 |
+
[59] Manuele Rusci, Alessandro Capotondi, and Luca Benini. Memory-driven mixed low precision quantization for enabling deep network inference on microcontrollers. In MLSys, 2020.
|
| 239 |
+
[60] Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. MobileNetV2: Inverted Residuals and Linear Bottlenecks. In CVPR, 2018.
|
| 240 |
+
[61] Ali Sharif Razavian, Hossein Azizpour, Josephine Sullivan, and Stefan Carlsson. Cnn features off-the-shelf: an astounding baseline for recognition. In CVPR Workshops, 2014.
|
| 241 |
+
[62] Bharath Sudharsan, John G Breslin, and Muhammad Intizar Ali. Globe2train: A framework for distributed ml model training using iot devices across the globe. In 2021 IEEE SmartWorld, Ubiquitous Intelligence & Computing, Advanced & Trusted Computing, Scalable Computing & Communications, Internet of People and Smart City Innovation (SmartWorld/SCALCOM/UIC/ATC/IOP/SCI), pages 107–114. IEEE, 2021.
|
| 242 |
+
[63] Bharath Sudharsan, Piyush Yadav, John G Breslin, and Muhammad Intizar Ali. Train $^ { + + }$ : An incremental ml model training algorithm to create self-learning iot devices. In 2021 IEEE SmartWorld, Ubiquitous Intelligence & Computing, Advanced & Trusted Computing, Scalable Computing & Communications, Internet of People and Smart City Innovation (SmartWorld/SCALCOM/UIC/ATC/IOP/SCI), pages 97–106. IEEE, 2021.
|
| 243 |
+
[64] 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 CVPR, 2019.
|
| 244 |
+
[65] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. arXiv preprint arXiv:1706.03762, 2017.
|
| 245 |
+
[66] Kuan Wang, Zhijian Liu, Yujun Lin, Ji Lin, and Song Han. HAQ: Hardware-Aware Automated Quantization with Mixed Precision. In CVPR, 2019.
|
| 246 |
+
[67] Peter Welinder, Steve Branson, Takeshi Mita, Catherine Wah, Florian Schroff, Serge Belongie, and Pietro Perona. Caltech-ucsd birds 200. Technical Report CNS-TR-201, Caltech, 2010.
|
| 247 |
+
[68] Yang You, Igor Gitman, and Boris Ginsburg. Large batch training of convolutional networks. arXiv preprint arXiv:1708.03888, 2017.
|
| 248 |
+
[69] Jiecao Yu, Andrew Lukefahr, David Palframan, Ganesh Dasika, Reetuparna Das, and Scott Mahlke. Scalpel: Customizing dnn pruning to the underlying hardware parallelism. ACM SIGARCH Computer Architecture News, 45(2):548–560, 2017.
|
md/train/S1WRibb0Z/S1WRibb0Z.md
ADDED
|
@@ -0,0 +1,448 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EXPRESSIVE POWER OF RECURRENT NEURAL NET-WORKS
|
| 2 |
+
|
| 3 |
+
Valentin Khrulkov Skolkovo Institute of Science and Technology valentin.khrulkov@skolkovotech.ru
|
| 4 |
+
|
| 5 |
+
Alexander Novikov National Research University Higher School of Economics Institute of Numerical Mathematics RAS novikov@bayesgroup.ru
|
| 6 |
+
|
| 7 |
+
# Ivan Oseledets
|
| 8 |
+
|
| 9 |
+
Skolkovo Institute of Science and Technology Institute of Numerical Mathematics RAS i.oseledets@skoltech.ru
|
| 10 |
+
|
| 11 |
+
# ABSTRACT
|
| 12 |
+
|
| 13 |
+
Deep neural networks are surprisingly efficient at solving practical tasks, but the theory behind this phenomenon is only starting to catch up with the practice. Numerous works show that depth is the key to this efficiency. A certain class of deep convolutional networks – namely those that correspond to the Hierarchical Tucker (HT) tensor decomposition – has been proven to have exponentially higher expressive power than shallow networks. I.e. a shallow network of exponential width is required to realize the same score function as computed by the deep architecture. In this paper, we prove the expressive power theorem (an exponential lower bound on the width of the equivalent shallow network) for a class of recurrent neural networks – ones that correspond to the Tensor Train (TT) decomposition. This means that even processing an image patch by patch with an RNN can be exponentially more efficient than a (shallow) convolutional network with one hidden layer. Using theoretical results on the relation between the tensor decompositions we compare expressive powers of the HT- and TT-Networks. We also implement the recurrent TT-Networks and provide numerical evidence of their expressivity.
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
Deep neural networks solve many practical problems both in computer vision via Convolutional Neural Networks (CNNs) (LeCun et al. (1995); Szegedy et al. (2015); He et al. (2016)) and in audio and text processing via Recurrent Neural Networks (RNNs) (Graves et al. (2013); Mikolov et al. (2011); Gers et al. (1999)). However, although many works focus on expanding the theoretical explanation of neural networks success (Martens & Medabalimi (2014); Delalleau & Bengio (2011); Cohen et al. (2016)), the full theory is yet to be developed.
|
| 18 |
+
|
| 19 |
+
One line of work focuses on expressive power, i.e. proving that some architectures are more expressive than others. Cohen et al. (2016) showed the connection between Hierarchical Tucker (HT) tensor decomposition and CNNs, and used this connection to prove that deep CNNs are exponentially more expressive than their shallow counterparts. However, no such result exists for Recurrent Neural Networks. The contributions of this paper are three-fold.
|
| 20 |
+
|
| 21 |
+
1. We show the connection between recurrent neural networks and Tensor Train decomposition (see Sec. 4);
|
| 22 |
+
2. We formulate and prove the expressive power theorem for the Tensor Train decomposition (see Sec. 5), which – on the language of RNNs – can be interpreted as follows: to (exactly) emulate a recurrent neural network, a shallow (non-recurrent) architecture of exponentially larger width is required;
|
| 23 |
+
|
| 24 |
+
3. Combining the obtained and known results, we compare the expressive power of recurrent (TT), convolutional (HT), and shallow (CP) networks with each other (see Table 2).
|
| 25 |
+
|
| 26 |
+

|
| 27 |
+
Figure 1: Recurrent-type neural architecture that corresponds to the Tensor Train decomposition. Gray circles are bilinear maps (for details see Section 4).
|
| 28 |
+
|
| 29 |
+
# 2 DEEP LEARNING AND TENSOR NETWORKS
|
| 30 |
+
|
| 31 |
+
In this section, we review the known connections between tensor decompositions and deep learning and then show the new connection between Tensor Train decomposition and recurrent neural networks.
|
| 32 |
+
|
| 33 |
+
Suppose that we have a classification problem and a dataset of pairs $\{ ( \boldsymbol { X } ^ { ( b ) } , \boldsymbol { y } ^ { ( b ) } ) \} _ { b = 1 } ^ { N }$ . Let us assume that each object $X ^ { ( b ) }$ is represented as a sequence of vectors
|
| 34 |
+
|
| 35 |
+
$$
|
| 36 |
+
X ^ { ( b ) } = ( \mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } , . . . \mathbf { x } _ { d } ) , \quad \mathbf { x } _ { k } \in \mathbb { R } ^ { n } ,
|
| 37 |
+
$$
|
| 38 |
+
|
| 39 |
+
which is often the case. To find this kind of representation for images, several approaches are possible. The approach that we follow is to split an image into patches of small size, possibly overlapping, and arrange the vectorized patches in a certain order. An example of this procedure is
|
| 40 |
+
|
| 41 |
+

|
| 42 |
+
Figure 2: Representation of an image in the form of Eq. (1). A window of size $7 \times 7$ moves across the image of size $2 8 \times 2 8$ extracting image patches, which are then vectorized and arranged into a matrix of size $4 9 \times 1 6$ .
|
| 43 |
+
|
| 44 |
+
presented on Fig. 2.
|
| 45 |
+
|
| 46 |
+
We use lower-dimensional representations of $\{ \mathbf { x } _ { k } \} _ { k = 1 } ^ { d }$ . For this we introduce a collection of parameter dependent feature maps $\{ f _ { \theta _ { \ell } } : \mathbb { R } ^ { n } \mathbb { R } \} _ { \ell = 1 } ^ { \bar { m } }$ , which are organized into a representation map
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
f _ { \theta } : \mathbb { R } ^ { n } \mathbb { R } ^ { m } .
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
A typical choice for such a map is
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
f _ { \theta } ( \mathbf { x } ) = \sigma ( A \mathbf { x } + b ) ,
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
that is an affine map followed by some nonlinear activation $\sigma$ . In the image case if $X$ was constructed using the procedure described above, the map $f _ { \theta }$ resembles the traditional convolutional maps – each image patch is projected by an affine map with parameters shared across all the patches, which is followed by a pointwise activation function.
|
| 59 |
+
|
| 60 |
+
Score functions considered in Cohen et al. (2016) can be written in the form
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
l _ { y } ( X ) = \langle \mathcal { W } _ { y } , \Phi ( X ) \rangle ,
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
where $\Phi ( X )$ is a feature tensor, defined as
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
\Phi ( X ) ^ { i _ { 1 } i _ { 2 } \ldots i _ { d } } = f _ { \theta _ { i _ { 1 } } } ( { \bf x } _ { 1 } ) f _ { \theta _ { i _ { 2 } } } ( { \bf x } _ { 2 } ) \ldots f _ { \theta _ { i _ { d } } } ( { \bf x } _ { d } ) ,
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
and $\mathcal { W } _ { y } \in \mathbb { R } ^ { m \times m \times . . . m }$ is a trainable weight tensor. Inner product in Eq. (2) is just a total sum of the entry-wise product of $\Phi ( X )$ and $\mathcal { W } _ { y }$ . It is also shown that the hypothesis space of the form Eq. (2) has the universal representation property for $m \infty$ . Similar score functions were considered in Novikov et al. (2016); Stoudenmire & Schwab (2016).
|
| 73 |
+
|
| 74 |
+
Storing the full tensor $\mathcal { W } _ { y }$ requires an exponential amount of memory, and to reduce the number of degrees of freedom one can use a tensor decompositions. Various decompositions lead to specific network architectures and in this context, expressive power of such a network is effectively measured by ranks of the decomposition, which determine the complexity and a total number of degrees of freedom. For the Hierarchical Tucker (HT) decomposition, Cohen et al. (2016) proved the expressive power property, i.e. that for almost any tensor $\mathcal { W } _ { y }$ its HT-rank is exponentially smaller than its CPrank. We analyze Tensor Train-Networks (TT-Networks), which correspond to a recurrent-type architecture. We prove that these networks also have exponentially larger representation power than shallow networks (which correspond to the CP-decomposition).
|
| 75 |
+
|
| 76 |
+
# 3 TENSOR FORMATS REMINDER
|
| 77 |
+
|
| 78 |
+
In this section we briefly review all the necessary definitions. As a $d$ -dimensional tensor $\mathcal { X }$ we simply understand a multidimensional array:
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\mathcal { X } \in \mathbb { R } ^ { n _ { 1 } \times n _ { 2 } \times \hdots \times n _ { d } } .
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
To work with tensors it is convenient to use their matricizations, which are defined as follows. Let us choose some subset of axes $s ~ = ~ \{ i _ { 1 } , i _ { 2 } \dots i _ { m _ { s } } \}$ of $\mathcal { X }$ , and denote its compliment by $t = \{ j _ { 1 } , j _ { 2 } \ldots j _ { d - m _ { s } } \}$ , e.g. for a 4 dimensional tensor $s$ could be $\{ 1 , 3 \}$ and $t$ is $\{ 2 , 4 \}$ . Then matricization of $\mathcal { X }$ specified by $( s , t )$ is a matrix
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
\mathcal { X } ^ { ( s , t ) } \in \mathbb { R } ^ { n _ { i _ { 1 } } n _ { i _ { 2 } } \ldots n _ { i _ { m _ { s } } } \times n _ { j _ { 1 } } n _ { j _ { 2 } } \ldots n _ { j _ { d - m _ { s } } } } ,
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
obtained simply by transposing and reshaping the tensor $\mathcal { X }$ into matrix, which in practice e.g. in Python, is performed using numpy.reshape function. Let us now introduce tensor decompositions we will use later.
|
| 91 |
+
|
| 92 |
+
# 3.1 CANONICAL
|
| 93 |
+
|
| 94 |
+
Canonical decomposition, also known as CANDECOMP/PARAFAC or CP-decomposition for short (Harshman (1970); Carroll & Chang (1970)), is defined as follows
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\mathcal { X } ^ { i _ { 1 } i _ { 2 } \ldots i _ { d } } = \sum _ { \alpha = 1 } ^ { r } \mathbf { v } _ { 1 , \alpha } ^ { i _ { 1 } } \mathbf { v } _ { 2 , \alpha } ^ { i _ { 2 } } \cdot \cdot \cdot \mathbf { v } _ { d , \alpha } ^ { i _ { d } } , \quad \mathbf { v } _ { i , \alpha } \in \mathbb { R } ^ { n _ { i } } .
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
The minimal $r$ such that this decomposition exists is called the canonical or $C P$ -rank of $\mathcal { X }$ . We will use the following notation
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\operatorname { r a n k } _ { C P } \mathcal { X } = r .
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
When rankCP $\mathcal { X } = 1$ it can be written simply as
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
\begin{array} { r } { \mathcal { X } ^ { i _ { 1 } i _ { 2 } \ldots i _ { d } } = \mathbf { v } _ { 1 } ^ { i _ { 1 } } \mathbf { v } _ { 2 } ^ { i _ { 2 } } \ldots \mathbf { v } _ { d } ^ { i _ { d } } , } \end{array}
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
which means that modes of $\mathcal { X }$ are perfectly separated from each other. Note that storing all entries of a tensor $\mathcal { X }$ requires $O ( n ^ { d } )$ memory, while its canonical decomposition takes only $O ( d n r )$ . However, the problems of determining the exact CP-rank of a tensor and finding its canonical decomposition are NP-hard, and the problem of approximating a tensor by a tensor of lower CP-rank is ill-posed.
|
| 113 |
+
|
| 114 |
+
# 3.2 TENSOR TRAIN
|
| 115 |
+
|
| 116 |
+
A tensor $\mathcal { X }$ is said to be represented in the Tensor Train (TT) format (Oseledets (2011)) if each element of $\mathcal { X }$ can be computed as follows
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
\mathcal { X } ^ { i _ { 1 } i _ { 2 } \ldots i _ { d } } = \sum _ { \alpha _ { 1 } = 1 } ^ { r _ { 1 } } \sum _ { \alpha _ { 2 } = 1 } ^ { r _ { 2 } } \cdots \sum _ { \alpha _ { d - 1 } = 1 } ^ { r _ { d - 1 } } G _ { 1 } ^ { i _ { 1 } \alpha _ { 1 } } G _ { 2 } ^ { \alpha _ { 1 } i _ { 2 } \alpha _ { 2 } } \cdots G _ { d } ^ { \alpha _ { d - 1 } i _ { d } } ,
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
where the tensors $G _ { k } \ \in \ \mathbb { R } ^ { r _ { k - 1 } \times n _ { k } \times r _ { k } }$ $( r _ { 0 } = r _ { d } = 1 $ by definition) are the so-called TT-cores. The element-wise minimal ranks $\mathbf { r } = \left( r _ { 1 } , \dots r _ { d - 1 } \right)$ such that decomposition (5) exists are called TT-ranks
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
\operatorname { r a n k } _ { T T } \mathcal { X } = { \bf r } .
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
Note that for fixed values of $i _ { 1 } , i _ { 2 } \dots , i _ { d }$ , the right-hand side of Eq. (5) is just a product of matrices
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
G _ { 1 } [ 1 , i _ { 1 } , : ] { \cal G } _ { 2 } [ : , i _ { 2 } , : ] \dots { \cal G } _ { d } [ : , i _ { d } , 1 ] .
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
Storing $\mathcal { X }$ in the TT-format requires $O ( d n r ^ { 2 } )$ memory and thus also achieves significant compression of the data. Given some tensor $\mathcal { X }$ , the algorithm for finding its TT-decomposition is constructive and is based on a sequence of Singular Value Decompositions (SVDs), which makes it more numerically stable than CP-format. We also note that when all the TT-ranks equal to each other
|
| 135 |
+
|
| 136 |
+
$$
|
| 137 |
+
\operatorname { r a n k } _ { T T } \mathcal { X } = ( r , r , \dots , r ) ,
|
| 138 |
+
$$
|
| 139 |
+
|
| 140 |
+
we will sometimes write for simplicity
|
| 141 |
+
|
| 142 |
+
$$
|
| 143 |
+
\operatorname { r a n k } _ { T T } \mathcal { X } = r .
|
| 144 |
+
$$
|
| 145 |
+
|
| 146 |
+
# 3.3 HIERARCHICAL TUCKER
|
| 147 |
+
|
| 148 |
+
A further generalization of the TT-format leads to the so-called Hierarchical Tucker (HT) format. The definition of the HT-format is a bit technical and requires introducing the dimension tree (Grasedyck, 2010, Definition 3.1). In the next section we will provide an informal introduction into the HT-format, and for more details, we refer the reader to Grasedyck (2010); Grasedyck & Hackbusch (2011); Hackbusch (2012).
|
| 149 |
+
|
| 150 |
+
# 4 ARCHITECTURES BASED ON TENSOR DECOMPOSITIONS
|
| 151 |
+
|
| 152 |
+

|
| 153 |
+
Figure 3: Nodes performing multilinear map of their inputs. $d$ -linear unit is specified by a $d + 1$ dimensional core $G$ .
|
| 154 |
+
|
| 155 |
+
To construct the tensorial networks we introduce bilinear and multilinear units, which perform a bilinear (multilinear) map of their inputs (see Fig. 3 for an illustration). Suppose that $\mathbf { x } \in \mathbb { R } ^ { n } , \mathbf { y } \in$ $\mathbb { R } ^ { m }$ and $G \in \mathbb { R } ^ { n \times m \times k }$ . Then a bilinear unit $G$ performs a bilinear map $G : \mathbb { R } ^ { n } \times \mathbb { R } ^ { m } \mathbb { R } ^ { k }$ , defined by the formula
|
| 156 |
+
|
| 157 |
+
$$
|
| 158 |
+
\begin{array} { l } { { \displaystyle G ( { \bf x } , { \bf y } ) = { \bf z } , } } \\ { { \displaystyle { \bf z } ^ { k } = \sum _ { i , j } G ^ { i j k } { \bf x } ^ { i } { \bf y } ^ { j } } . } \end{array}
|
| 159 |
+
$$
|
| 160 |
+
|
| 161 |
+
Similarly, for $\mathbf { x } _ { 1 } \in \mathbb { R } ^ { n _ { 1 } } , . . . \mathbf { x } _ { d } \in \mathbb { R } ^ { n _ { d } }$ , a multilinear unit $G \in \mathbb { R } ^ { n _ { 1 } \times n _ { 2 } \times \ldots \times n _ { d } \times n _ { j } }$ defines a multilinear map $\begin{array} { r } { G : \prod _ { k = 1 } ^ { d } \mathbb { R } ^ { n _ { k } } \mathbb { R } ^ { n _ { j } } } \end{array}$ by the formula
|
| 162 |
+
|
| 163 |
+
$$
|
| 164 |
+
\begin{array} { l } { { \displaystyle G ( { \bf x } _ { 1 } , { \bf x } _ { 2 } , \ldots , { \bf x } _ { d } ) = { \bf z } } } \\ { { \displaystyle { \bf z } ^ { j } = \sum _ { i _ { 1 } , i _ { 2 } , \ldots , i _ { d } } G ^ { i _ { 1 } i _ { 2 } \ldots i _ { d } j } { \bf x } _ { 1 } ^ { i _ { 1 } } { \bf x } _ { 2 } ^ { i _ { 2 } } \ldots { \bf x } _ { d } ^ { i _ { d } } } . } \end{array}
|
| 165 |
+
$$
|
| 166 |
+
|
| 167 |
+
In the rest of this section, we describe how to compute the score functions $l _ { y } ( X )$ (see Eq. (1)) for each class label $y$ , which then could be fed into the loss function (such as cross-entropy). The architecture we propose to implement the score functions is illustrated on Fig. 1. For a vector $\mathbf { r } = ( r _ { 1 } , r _ { 2 } , \ldots r _ { d - 1 } )$ of positive integers (rank hyperparameter) we define bilinear units
|
| 168 |
+
|
| 169 |
+
$$
|
| 170 |
+
G _ { k } \in \mathbb { R } ^ { r _ { k - 1 } \times m \times r _ { k } } ,
|
| 171 |
+
$$
|
| 172 |
+
|
| 173 |
+
with $r _ { 0 } = r _ { d } = 1$ . Note that because $r _ { 0 } = 1$ , the first unit $G _ { 1 }$ is in fact just a linear map, and because $r _ { d } = 1$ the output of the network is just a number. On a step $k \geq 2$ the representation $f _ { \theta } ( \mathbf { x } _ { k } )$ and output of the unit $G _ { k - 1 }$ of size $r _ { k }$ are fed into the unit $G _ { k }$ . Thus we obtain a recurrent-type neural network with multiplicative connections and without non-linearities.
|
| 174 |
+
|
| 175 |
+
To draw a connection with the Tensor Train decomposition we make the following observation. For each of the class labels $y$ let us construct the tensor $\mathcal { W } _ { y }$ using the definition of TT-decomposition (Eq. (5)) and taking $\{ G _ { k } \} _ { k = 1 } ^ { d }$ used for constructing $l _ { y } ( X )$ as its TT-cores. Using the definition of the Eq. (3) we find that the score functions computed by the network from Fig. 1 are given by the formula
|
| 176 |
+
|
| 177 |
+
$$
|
| 178 |
+
l _ { y } ( X ) = \sum _ { i _ { 1 } , i _ { 2 } , \ldots i _ { d } } W _ { y } ^ { i _ { 1 } i _ { 2 } \ldots i _ { d } } \Phi ( X ) ^ { i _ { 1 } i _ { 2 } \ldots i _ { d } } ,
|
| 179 |
+
$$
|
| 180 |
+
|
| 181 |
+
which is verified using Eq. (5) and Eq. (3). Thus, we can conclude that the network presented on Fig. 1 realizes the TT-decomposition of the weight tensor. We also note that the size of the output of the bilinear unit $G _ { k }$ in the TT-Network is equal to $r _ { k }$ , which means that the TT-ranks correspond to the width of the network.
|
| 182 |
+
|
| 183 |
+
Let us now consider other tensor decompositions of the weight tensors $\mathcal { W } _ { y }$ , construct corresponding network architectures, and compare their properties with the original TT-Network.
|
| 184 |
+
|
| 185 |
+

|
| 186 |
+
Figure 4: Examples of networks corresponding to various tensor decompositions.
|
| 187 |
+
|
| 188 |
+
A network corresponding to the CP-decomposition is visualized on Fig. 4a. Each multilinear unit $G _ { \alpha }$ is given by a summand in the formula Eq. (4), namely
|
| 189 |
+
|
| 190 |
+
$$
|
| 191 |
+
G _ { \alpha } ^ { i _ { 1 } i _ { 2 } \ldots i _ { d } } = { \bf v } _ { 1 , \alpha } ^ { i _ { 1 } } { \bf v } _ { 2 , \alpha } ^ { i _ { 2 } } \ldots { \bf v } _ { d , \alpha } ^ { i _ { d } } , \quad \alpha \in \{ 1 , \ldots r \} .
|
| 192 |
+
$$
|
| 193 |
+
|
| 194 |
+
Note that the output of each $G _ { \alpha }$ in this case is just a number, and in total there are $\mathrm { r a n k } _ { C P } \mathcal { W } _ { y }$ multilinear units. Their outputs are then summed up by the $\Sigma$ node. As before rank of the decomposition corresponds to the width of the network. However, in this case the network is shallow, meaning that there is only one hidden layer.
|
| 195 |
+
|
| 196 |
+
On the Fig. 4b a network of other kind is presented. Tensor decomposition which underlies it is the Hierarchical Tucker decomposition, and hence we call it the HT-Network. It is constructed using a binary tree, where each node other than leaf corresponds to a bilinear unit, and leaves correspond to linear units. Inputs are fed into leaves, and this data is passed along the tree to the root, which outputs a number. Ranks, in this case, are just the sizes of the outputs of the intermediate units. We will denote them by $\operatorname { r a n k } _ { H T } \mathcal { X }$ . These are networks considered in Cohen et al. (2016), where the expressive power of such networks was analyzed and was argued that they resemble traditional CNNs. In general Hierarchical Tucker decomposition may be constructed using an arbitrary tree, but not much theory is known in general case.
|
| 197 |
+
|
| 198 |
+
Our main theoretical results are related to a comparison of the expressive power of these kinds of networks. Namely, the question that we ask is as follows. Suppose that we are given a TT-Network. How complex would be a CP- or HT-Network realizing the same score function? A natural measure of complexity, in this case, would be the rank of the corresponding tensor decomposition. To make transitioning between tensor decompositions and deep learning vocabulary easier, we introduce the following table.
|
| 199 |
+
|
| 200 |
+
Table 1: Correspondence between languages of Tensor Analysis and Deep Learning.
|
| 201 |
+
|
| 202 |
+
<table><tr><td>Tensor Decompositions</td><td>Deep Learning</td></tr><tr><td>CP-decomposition</td><td>shallow network</td></tr><tr><td>TT-decomposition</td><td>RNN</td></tr><tr><td>HT-decomposition</td><td>CNN</td></tr><tr><td>rankof the decomposition</td><td>width of the network</td></tr></table>
|
| 203 |
+
|
| 204 |
+
# 5 THEORETICAL ANALYSIS
|
| 205 |
+
|
| 206 |
+
In this section we prove the expressive power theorem for the Tensor Train decomposition, that is we prove that given a random $d$ -dimensional tensor in the TT format with ranks r and modes $n$ , with probability 1 this tensor will have exponentially large CP-rank. Note that the reverse result can not hold true since TT-ranks can not be larger than CP-ranks: rankT T $\mathcal { X } \le \mathrm { r a n k } _ { C P } \mathcal { X }$ .
|
| 207 |
+
|
| 208 |
+
It is known that the problem of determining the exact CP-rank of a tensor is NP-hard.
|
| 209 |
+
|
| 210 |
+
To bound CP-rank of a tensor the following lemma is useful.
|
| 211 |
+
|
| 212 |
+
Lemma 1. Let $\chi ^ { i _ { 1 } i _ { 2 } \ldots i _ { d } }$ and $\operatorname { r a n k } _ { C P } \mathcal { X } \ = \ r$ . Then for any matricization $\chi ( s , t )$ we have rank $\mathcal { X } ^ { ( s , t ) } \leq r$ , where the ordinary matrix rank is assumed.
|
| 213 |
+
|
| 214 |
+
Proof. Proof is based on the following observation. Let
|
| 215 |
+
|
| 216 |
+
$$
|
| 217 |
+
\mathcal { A } ^ { i _ { 1 } i _ { 2 } \ldots i _ { d } } = \mathbf { v } _ { 1 } ^ { i _ { 1 } } \mathbf { v } _ { 2 } ^ { i _ { 2 } } \ldots \mathbf { v } _ { d } ^ { i _ { d } } ,
|
| 218 |
+
$$
|
| 219 |
+
|
| 220 |
+
be a CP-rank 1 tensor. Note for any $s , t$
|
| 221 |
+
|
| 222 |
+
$$
|
| 223 |
+
\operatorname { r a n k } \mathcal { A } ^ { ( s , t ) } = 1 ,
|
| 224 |
+
$$
|
| 225 |
+
|
| 226 |
+
because $\mathcal { A } ^ { ( s , t ) }$ can be written as $\mathbf { u } \mathbf { w } ^ { T }$ for some $\mathbf { u }$ and $\mathbf { w }$ . Then the statement of the lemma follows from the facts that matricization is a linear operation, and that for matrices
|
| 227 |
+
|
| 228 |
+
$$
|
| 229 |
+
\operatorname { r a n k } ( A + B ) \leq \operatorname { r a n k } A + \operatorname { r a n k } B .
|
| 230 |
+
$$
|
| 231 |
+
|
| 232 |
+
We use this lemma to provide a lower bound on the CP-rank in the theorem formulated below. For example, suppose that we found some matricization of a tensor $\mathcal { X }$ which has matrix rank $r$ . Then, by using the lemma we can estimate that $\operatorname { r a n k } _ { C P } \mathcal { X } \geq r$ .
|
| 233 |
+
|
| 234 |
+
Let us denote $\mathbf { n } = \left( n _ { 1 } , n _ { 2 } \ldots n _ { d } \right)$ . Set of all tensors $\mathcal { X }$ with mode sizes n representable in TT-format with
|
| 235 |
+
|
| 236 |
+
$$
|
| 237 |
+
\mathrm { r a n k } _ { T T } \boldsymbol { \mathcal { X } } \leq { \bf r } ,
|
| 238 |
+
$$
|
| 239 |
+
|
| 240 |
+
for some vector of positive integers $\mathbf { r }$ (inequality is understood entry-wise) forms an irreducible algebraic variety (Shafarevich $\&$ Hirsch (1994)), which we denote by $\mathcal { M } _ { \mathbf { r } }$ . This means that $\mathcal { M } _ { \mathbf { r } }$ is defined by a set of polynomial equations in $\mathbb { R } ^ { n _ { 1 } \times n _ { 2 } \dots n _ { d } }$ , and that it can not be written as a union (not necessarily disjoint) of two proper non-empty algebraic subsets. An example where the latter property does not hold would be the union of axes $x = 0$ and $y = 0$ in $\mathbb { R } ^ { 2 }$ , which is an algebraic set defined by the equation $x y = 0$ . The main fact that we use about irreducible algebraic varieties is that any proper algebraic subset of them necessarily has measure 0 (Ilyashenko & Yakovenko (2008)).
|
| 241 |
+
|
| 242 |
+
For simplicity let us assume that number of modes $d$ is even, that all mode sizes are equal to $n$ , and we consider $\mathcal { M } _ { \mathbf { r } }$ with $\mathbf { r } = ( r , r \ldots r )$ , so for any $\mathcal { X } \in \mathcal { M } _ { \bf r }$ we have
|
| 243 |
+
|
| 244 |
+
$$
|
| 245 |
+
\operatorname { r a n k } _ { T T } \mathcal { X } \leq ( r , r , \ldots , r ) ,
|
| 246 |
+
$$
|
| 247 |
+
|
| 248 |
+
entry-wise.
|
| 249 |
+
|
| 250 |
+
As the main result we prove the following theorem
|
| 251 |
+
|
| 252 |
+
Theorem 1. Suppose that $d = 2 k$ is even. Define the following set
|
| 253 |
+
|
| 254 |
+
$$
|
| 255 |
+
B = \{ \mathcal { X } \in \mathcal { M } _ { \mathbf { r } } : \mathrm { r a n k } _ { C P } \mathcal { X } < q ^ { \frac { d } { 2 } } \} ,
|
| 256 |
+
$$
|
| 257 |
+
|
| 258 |
+
where $q = \operatorname* { m i n } \{ n , r \}$ .
|
| 259 |
+
|
| 260 |
+
Then
|
| 261 |
+
|
| 262 |
+
$$
|
| 263 |
+
\mu ( B ) = 0 ,
|
| 264 |
+
$$
|
| 265 |
+
|
| 266 |
+
where $\mu$ is the standard Lebesgue measure on $\mathcal { M } _ { \mathbf { r } }$
|
| 267 |
+
|
| 268 |
+
Proof. Our proof is based on applying Lemma 1 to a particular matricization of $\mathcal { X }$ . Namely, we would like to show that for $s = \{ 1 , 3 , \ldots d - 1 \}$ , $t = \{ 2 , 4 , \dots d \}$ the following set
|
| 269 |
+
|
| 270 |
+
$$
|
| 271 |
+
B ^ { ( s , t ) } = \{ \mathcal { X } \in \mathcal { M } _ { \mathbf { r } } : \operatorname { r a n k } \mathcal { X } ^ { ( s , t ) } \leq q ^ { \frac { d } { 2 } } - 1 \} ,
|
| 272 |
+
$$
|
| 273 |
+
|
| 274 |
+
has measure 0. Indeed, by Lemma 1 we have
|
| 275 |
+
|
| 276 |
+
$$
|
| 277 |
+
B \subset B ^ { ( s , t ) } ,
|
| 278 |
+
$$
|
| 279 |
+
|
| 280 |
+
so if $\mu ( B ^ { ( s , t ) } ) = 0$ then $\mu ( B ) = 0$ as well. Note that $B ^ { ( s , t ) }$ is an algebraic subset of $\mathcal { M } _ { \mathbf { r } }$ given by the conditions that the determinants of all $q ^ { \frac { d } { 2 } } \times q ^ { \frac { d } { 2 } }$ submatrices of $\chi ( s , t )$ are equal to 0. Thus to show that $\mu ( B ^ { ( s , t ) } ) = 0$ we need to find at least one $\mathcal { X }$ such that rank $\chi ^ { ( s , t ) } \geq q ^ { \frac { d } { 2 } }$ . This follows from the fact that because $B ^ { ( s , t ) }$ is an algebraic subset of the irreducible algebraic variety $\mathcal { M } _ { \mathbf { r } }$ , it is either equal to $\mathcal { M } _ { \mathbf { r } }$ or has measure 0, as was explained before.
|
| 281 |
+
|
| 282 |
+
One way to construct such tensor is as follows. Let us define the following tensors:
|
| 283 |
+
|
| 284 |
+
$$
|
| 285 |
+
\begin{array} { r l } & { G _ { 1 } ^ { i _ { 1 } \alpha _ { 1 } } = \delta _ { i _ { 1 } \alpha _ { 1 } } , G _ { 1 } \in \mathbb { R } ^ { 1 \times n \times r } } \\ & { G _ { k } ^ { \alpha _ { k - 1 } i _ { k } \alpha _ { k } } = \delta _ { i _ { k } \alpha _ { k - 1 } } , G _ { k } \in \mathbb { R } ^ { r \times n \times 1 } , k = 2 , 4 , 6 , \dots , d - 2 } \\ & { G _ { k } ^ { \alpha _ { k - 1 } i _ { k } \alpha _ { k } } = \delta _ { i _ { k } \alpha _ { k } } , G _ { k } \in \mathbb { R } ^ { 1 \times n \times r } , k = 3 , 5 , 7 , \dots , d - 1 } \\ & { G _ { d } ^ { \alpha _ { d - 1 } i _ { d } } = \delta _ { i _ { d } \alpha _ { d - 1 } } , G _ { d } \in \mathbb { R } ^ { r \times n \times 1 } } \end{array}
|
| 286 |
+
$$
|
| 287 |
+
|
| 288 |
+
where $\delta _ { i \alpha }$ is the Kronecker delta symbol:
|
| 289 |
+
|
| 290 |
+
$$
|
| 291 |
+
\delta _ { i \alpha } = { \left\{ \begin{array} { l l } { 1 , } & { { \mathrm { i f ~ } } i = \alpha , } \\ { 0 , } & { { \mathrm { i f ~ } } i \neq \alpha . } \end{array} \right. }
|
| 292 |
+
$$
|
| 293 |
+
|
| 294 |
+
The TT-ranks of the tensor $\mathcal { X }$ defined by the TT-cores (9) are equal to $\begin{array} { r l } { \operatorname { r a n k } _ { T T } \mathcal { X } } & { { } = } \end{array}$ $( r , 1 , r , \ldots , r , 1 , r )$ .
|
| 295 |
+
|
| 296 |
+
Lets consider the following matricization of the tensor $\mathcal { X }$
|
| 297 |
+
|
| 298 |
+
$$
|
| 299 |
+
\chi ^ { ( i _ { 1 } , i _ { 3 } , . . . , i _ { d - 1 } ) , ( i _ { 2 } , i _ { 4 } , . . . , i _ { d } ) }
|
| 300 |
+
$$
|
| 301 |
+
|
| 302 |
+
The following identity holds true for any values of indices such that $i _ { k } = 1 , \ldots , q , k = 1 , \ldots , d$ .
|
| 303 |
+
|
| 304 |
+
$$
|
| 305 |
+
\begin{array} { l } { { \displaystyle \chi ^ { ( i _ { 1 } , i _ { 3 } , \dots , i _ { d - 1 } ) , ( i _ { 2 } , i _ { 4 } , \dots , i _ { d } ) } = \sum _ { \alpha _ { 1 } , \dots , \alpha _ { d - 1 } } G _ { 1 } ^ { i _ { 1 } \alpha _ { 1 } } \dots G _ { d } ^ { \alpha _ { d - 1 } i _ { d } } = } } \\ { { \displaystyle \sum _ { \alpha _ { 1 } , \dots , \alpha _ { d - 1 } } \delta _ { i _ { 1 } \alpha _ { 1 } } \delta _ { i _ { 2 } \alpha _ { 1 } } \delta _ { i _ { 3 } \alpha _ { 3 } } \dots \delta _ { i _ { d } , \alpha _ { d - 1 } } = \delta _ { i _ { 1 } i _ { 2 } } \delta _ { i _ { 3 } i _ { 4 } } \dots \delta _ { i _ { d - 1 } i _ { d } } } } \end{array}
|
| 306 |
+
$$
|
| 307 |
+
|
| 308 |
+
The last equality holds because $\begin{array} { r } { \sum _ { \alpha _ { k } = 1 } ^ { r } \delta _ { i _ { k } \alpha _ { k } } \delta _ { i _ { k + 1 } \alpha _ { k } } = \delta _ { i _ { k } i _ { k + 1 } } } \end{array}$ for any $i _ { k } = 1 , \dots , q$ . We obtain that
|
| 309 |
+
|
| 310 |
+
$$
|
| 311 |
+
\chi ^ { ( i _ { 1 } , i _ { 3 } , \ldots , i _ { d - 1 } ) , ( i _ { 2 } , i _ { 4 } , \ldots , i _ { d } ) } = \delta _ { i _ { 1 } i _ { 2 } } \delta _ { i _ { 3 } i _ { 4 } } \ldots \delta _ { i _ { d - 1 } i _ { d } } = I ^ { ( i _ { 1 } , i _ { 3 } , \ldots , i _ { d - 1 } ) , ( i _ { 2 } , i _ { 4 } , \ldots , i _ { d } ) } ,
|
| 312 |
+
$$
|
| 313 |
+
|
| 314 |
+
where $I$ is the identity matrix of size $q ^ { d / 2 } \times q ^ { d / 2 }$ where $q = \operatorname* { m i n } \{ n , r \}$
|
| 315 |
+
|
| 316 |
+
To summarize, we found an example of a tensor $\mathcal { X }$ such that $\mathrm { r a n k } _ { T T } \boldsymbol { \mathcal { X } } \leq \mathbf { r }$ and the matricization $\chi ^ { ( i _ { 1 } , i _ { 3 } , . . . , i _ { d - 1 } ) , ( i _ { 2 } , i _ { 4 } , . . . , i _ { d } ) }$ has a submatrix being equal to the identity matrix of size $\boldsymbol { q } ^ { d / 2 } \times \boldsymbol { q } ^ { d / 2 }$ , and hence rank $\chi ^ { ( i _ { 1 } , i _ { 3 } , . . . , i _ { d - 1 } ) , ( i _ { 2 } , i _ { 4 } , . . . , i _ { d } ) } \geq q ^ { d / 2 }$ .
|
| 317 |
+
|
| 318 |
+
This means that the canonical $\operatorname { r a n k } _ { C P } \mathcal { X } \geq q ^ { d / 2 }$ which concludes the proof.
|
| 319 |
+
|
| 320 |
+
In other words, we have proved that for all TT-Networks besides negligible set, the equivalent CPNetwork will have exponentially large width. To compare the expressive powers of the HT- and TT-Networks we use the following theorem (Grasedyck, 2010, Section 5.3.2).
|
| 321 |
+
|
| 322 |
+
Theorem 2. For any tensor $\mathcal { X }$ the following estimates hold.
|
| 323 |
+
|
| 324 |
+
$\bullet \ { \mathrm { I f ~ r a n k } } _ { T T } \ x \leq r , { \mathrm { t h e n ~ r a n k } } _ { H T } \ x \leq r ^ { 2 } .$ • If rankHT X ≤ r, then rankT T $\mathcal { X } \leq r ^ { \log _ { 2 } ( d ) / 2 }$
|
| 325 |
+
|
| 326 |
+
It is also known that this bounds are sharp (see Buczynska et al. ´ (2015)). Thus, we can summarize all the results in the following Table 2.
|
| 327 |
+
|
| 328 |
+
Table 2: Comparison of the expressive power of various networks. Given a network of width $r$ , specified in a column, rows correspond to the upper bound on the width of the equivalent network of other type (we assume that the number of feature maps $m$ is greater than the width of the network $r$ ).
|
| 329 |
+
|
| 330 |
+
<table><tr><td></td><td>TT-Network</td><td>HT-Network</td><td>CP-Network</td></tr><tr><td>TT-Network</td><td></td><td>rlog2(d)/2</td><td>r</td></tr><tr><td>HT-Network</td><td>江</td><td>r</td><td>r</td></tr><tr><td>CP-Network</td><td>≥r</td><td>≥r</td><td>r</td></tr></table>
|
| 331 |
+
|
| 332 |
+
Example that requires exponential width in a shallow network A particular example used to prove Theorem 1 is not important per se since the Theorem states that TT is exponentially more expressive than CP for almost any tensor (for a set of tensors of measure one). However, to illustrate how the Theorem translates into neural networks consider the following example.
|
| 333 |
+
|
| 334 |
+
Consider the task of getting $d$ input vectors with $n$ elements each and aiming to compute the following measure of similarity between $\mathbf { x } _ { 1 } , \ldots , \mathbf { x } _ { d / 2 }$ and $\mathbf { X } _ { d / 2 + 1 } , \ldots , \mathbf { X } _ { d }$ :
|
| 335 |
+
|
| 336 |
+
$$
|
| 337 |
+
l ( X ) = \bigl ( \mathbf { x } _ { 1 } ^ { \mathsf { T } } \mathbf { x } _ { d / 2 + 1 } \bigr ) \ldots \bigl ( \mathbf { x } _ { d / 2 } ^ { \mathsf { T } } \mathbf { x } _ { d } \bigr )
|
| 338 |
+
$$
|
| 339 |
+
|
| 340 |
+
We argue that it can be done with a TT-Network of width $n$ by using the TT-tensor $\mathcal { X }$ defined in the proof of Theorem 1 and feeding the input vectors in the following order: $\mathbf { x } _ { 1 } , \mathbf { x } _ { d / 2 + 1 } , . . . \mathbf { x } _ { d / 2 } , \mathbf { x } _ { d }$ . The CP-network representing the same function will have $n ^ { d / 2 }$ terms (and hence $n ^ { d / 2 }$ width) and will correspond to expanding brackets in the expression (12).
|
| 341 |
+
|
| 342 |
+
The case of equal TT-cores In analogy to the traditional RNNs we can consider a special class of Tensor Trains with the property that all the intermediate TT-cores are equal to each other: $G _ { 2 } =$ $G _ { 3 } = \cdot \cdot \cdot = G _ { d - 1 }$ , which allows for processing sequences of varied length. We hypothesize that for this class exactly the same result as in Theorem 1 holds i.e. if we denote the variety of Tensor Trains with equal TT-cores by $\mathcal { M } _ { \bf r } ^ { e q }$ , we believe that the following hypothesis holds true:
|
| 343 |
+
|
| 344 |
+
Hypothesis 1. Theorem 1 is also valid if $\mathcal { M } _ { \mathbf { r } }$ is replaced by $\mathcal { M } _ { \bf r } ^ { e q }$ .
|
| 345 |
+
|
| 346 |
+
To prove it we can follow the same route as in the proof of Theorem 1. While we leave finding an analytical example of a tensor with the desired property of rank maximality to a future work, we have verified numerically that randomly generated tensors $\mathcal { X }$ from $\mathcal { M } _ { \bf r } ^ { e q }$ with $d = 6$ , $n$ ranging from 2 to 10 and $r$ ranging from 2 to 20 (we have checked 1000 examples for each possible combination) indeed satisfy $\operatorname { r a n k } _ { C P } \mathcal { X } \geq q ^ { \frac { d } { 2 } }$ .
|
| 347 |
+
|
| 348 |
+

|
| 349 |
+
Figure 5: Decision boundaries of the TT-Network on toy 2-D datasets.
|
| 350 |
+
|
| 351 |
+
# 6 EXPERIMENTS
|
| 352 |
+
|
| 353 |
+
In this section, we experimentally check if indeed – as suggested by Theorem 1 – the CP-Networks require exponentially larger width compared to the TT-Networks to fit a dataset to the same level of accuracy. This is not clear from the theorem since for natural data, functions that fit this data may lay in the neglectable set where the ranks of the TT- and CP-networks are related via a polynomial function (in contrast to the exponential relationship for all function outside the neglectable set). Other possible reasons why the theory may be disconnected with practice are optimization issues (although a certain low-rank tensor exists, we may fail to find it with SGD) and the existence of the feature maps, which were not taken into account in the theory.
|
| 354 |
+
|
| 355 |
+
To train the TT- and CP-Networks, we implemented them in TensorFlow (Abadi et al. (2015)) and used Adam optimizer with batch size 32 and learning rate sweeping across $\{ 4 \mathrm { e } { - } 3 , 2 \mathrm { e } { - } 3 , 1 \mathrm { e } { - } 3 , 5 \mathrm { e } { - } 4 \}$ values. Since we are focused on assessing the expressivity of the format (in contrast to its sensitivity to hyperparameters), we always choose the best performing run according to the training loss.
|
| 356 |
+
|
| 357 |
+
For the first experiment, we generate two-dimensional datasets with Scikit-learn tools ‘moons‘ and ‘circles‘ (Pedregosa et al. (2011)) and for each training example feed the two features as two patches into the TT-Network (see Fig. 5). This example shows that the TT-Networks can implement nontrivial decision boundaries.
|
| 358 |
+
|
| 359 |
+
For the next experiments, we use computer vision datasets MNIST (LeCun et al. (1990)) and CIFAR10 (Krizhevsky & Hinton (2009)). MNIST is a collection of 70000 handwritten digits, CIFAR-10 is a dataset of 60000 natural images which are to be classified into 10 classes such as bird or cat. We feed raw pixel data into the TT- and CP-Networks (which extract patches and apply a trainable feature map to them, see Section 2). In our experiments we choose patch size to be $8 \times 8$ , feature maps to be affine maps followed by the ReLU activation and we set number of such feature maps to 4. For MNIST, both TT- and CP-Networks show reasonable performance (1.0 train accuracy, 0.95 test accuracy without regularizers, and 0.98 test accuracy with dropout 0.8 applied to each patch) even with ranks less than 5, which may indicate that the dataset is too simple to draw any conclusion, but serves as a sanity check.
|
| 360 |
+
|
| 361 |
+
We report the training accuracy for CIFAR-10 on Fig. 6. Note that we did not use regularizers of any sort for this experiment since we wanted to compare expressive power of networks (the best test accuracy we achieved this way on CIFAR-10 is 0.45 for the TT-Network and 0.2 for the CPNetwork). On practice, the expressive power of the TT-Network is only polynomially better than that of the CP-network (Fig. 6), probably because of the reasons discussed above.
|
| 362 |
+
|
| 363 |
+
# 7 RELATED WORK
|
| 364 |
+
|
| 365 |
+
A large body of work is devoted to analyzing the theoretical properties of neural networks (Cybenko (1989); Hornik et al. (1989); Shwartz-Ziv & Tishby (2017)). Recent studies focus on depth efficiency (Raghu et al. (2017); Montufar et al. (2014); Eldan & Shamir (2016); Sutskever et al. (2013)), in most cases providing worst-case guaranties such as bounds between deep and shallow networks width. Two works are especially relevant since they analyze depth efficiency from the viewpoint of tensor decompositions: expressive power of the Hierarchical Tucker decomposition (Cohen et al. (2016)) and its generalization to handle activation functions such as ReLU (Cohen & Shashua (2016)). However, all of the works above focus on feedforward networks, while we tackle recurrent architectures. The only other work that tackles expressivity of RNNs is the concurrent work that applies the TT-decomposition to explicitly modeling high-order interactions of the previous hidden states and analyses the expressive power of the resulting architecture (Yu et al., 2017). This work, although very related to ours, analyses a different class of recurrent models.
|
| 366 |
+
|
| 367 |
+

|
| 368 |
+
Figure 6: Train accuracy on CIFAR-10 for the TT- and CP-Networks wrt rank of the decomposition and total number of parameters (feature size 4 was used). Note that with rank increase the CPNetworks sometimes perform worse due to optimization issues.
|
| 369 |
+
|
| 370 |
+
Models similar to the TT-Network were proposed in the literature but were considered from the practical point of view in contrast to the theoretical analyses provided in this paper. Novikov et al. (2016); Stoudenmire & Schwab (2016) proposed a model that implements Eq. (2), but with a predefined (not learnable) feature map $\Phi$ . Wu et al. (2016) explored recurrent neural networks with multiplicative connections, which can be interpreted as the TT-Networks with bilinear maps that are shared $G _ { k } = G$ and have low-rank structure imposed on them.
|
| 371 |
+
|
| 372 |
+
# 8 CONCLUSION
|
| 373 |
+
|
| 374 |
+
In this paper, we explored the connection between recurrent neural networks and Tensor Train decomposition and used it to prove the expressive power theorem, which states that a shallow network of exponentially large width is required to mimic a recurrent neural network. The downsides of this approach is that it provides worst-case analysis and do not take optimization issues into account. In the future work, we would like to address the optimization issues by exploiting the Riemannian geometry properties of the set of TT-tensors of fixed rank and extend the analysis to networks with non-linearity functions inside the recurrent connections (as was done for CNNs in Cohen & Shashua (2016)).
|
| 375 |
+
|
| 376 |
+
# ACKNOWLEDGEMENTS
|
| 377 |
+
|
| 378 |
+
This study was supported by the Ministry of Education and Science of the Russian Federation (grant 14.756.31.0001).
|
| 379 |
+
|
| 380 |
+
# REFERENCES
|
| 381 |
+
|
| 382 |
+
Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, ´ Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Watten- ´ berg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL https://www.tensorflow.org/. Software available from tensorflow.org.
|
| 383 |
+
|
| 384 |
+
Weronika Buczynska, Jarosław Buczy ´ nski, and Mateusz Michałek. The Hackbusch conjecture on ´ tensor formats. Journal de Mathematiques Pures et Appliqu ´ ees ´ , 104(4):749–761, 2015.
|
| 385 |
+
|
| 386 |
+
J Douglas Carroll and Jih-Jie Chang. Analysis of individual differences in multidimensional scaling via an N-way generalization of Eckart-Young decomposition. Psychometrika, 35(3):283–319, 1970.
|
| 387 |
+
|
| 388 |
+
Nadav Cohen and Amnon Shashua. Convolutional rectifier networks as generalized tensor decompositions. In International Conference on Machine Learning, pp. 955–963, 2016.
|
| 389 |
+
|
| 390 |
+
Nadav Cohen, Or Sharir, and Amnon Shashua. On the expressive power of deep learning: A tensor analysis. In Conference on Learning Theory, pp. 698–728, 2016.
|
| 391 |
+
|
| 392 |
+
George Cybenko. Approximation by superpositions of a sigmoidal function. Mathematics of Control, Signals, and Systems (MCSS), 2(4):303–314, 1989.
|
| 393 |
+
|
| 394 |
+
Olivier Delalleau and Yoshua Bengio. Shallow vs. deep sum-product networks. In Advances in Neural Information Processing Systems, pp. 666–674, 2011.
|
| 395 |
+
|
| 396 |
+
Ronen Eldan and Ohad Shamir. The power of depth for feedforward neural networks. In Conference on Learning Theory, pp. 907–940, 2016.
|
| 397 |
+
|
| 398 |
+
Felix A Gers, Jurgen Schmidhuber, and Fred Cummins. Learning to forget: Continual prediction ¨ with LSTM. 1999.
|
| 399 |
+
|
| 400 |
+
Lars Grasedyck. Hierarchical singular value decomposition of tensors. SIAM Journal on Matrix Analysis and Applications, 31(4):2029–2054, 2010.
|
| 401 |
+
|
| 402 |
+
Lars Grasedyck and Wolfgang Hackbusch. An introduction to hierarchical (H-) rank and TT-rank of tensors with examples. Computational Methods in Applied Mathematics Comput. Methods Appl. Math., 11(3):291–304, 2011.
|
| 403 |
+
|
| 404 |
+
Alex Graves, Abdel-rahman Mohamed, and Geoffrey Hinton. Speech recognition with deep recurrent neural networks. In Acoustics, speech and signal processing (icassp), 2013 ieee international conference on, pp. 6645–6649. IEEE, 2013.
|
| 405 |
+
|
| 406 |
+
Wolfgang Hackbusch. Tensor spaces and numerical tensor calculus, volume 42. Springer Science & Business Media, 2012.
|
| 407 |
+
|
| 408 |
+
Richard A Harshman. Foundations of the parafac procedure: models and conditions for an ”explanatory” multimodal factor analysis. 1970.
|
| 409 |
+
|
| 410 |
+
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.
|
| 411 |
+
|
| 412 |
+
Kurt Hornik, Maxwell Stinchcombe, and Halbert White. Multilayer feedforward networks are universal approximators. Neural networks, 2(5):359–366, 1989.
|
| 413 |
+
|
| 414 |
+
Yu S Ilyashenko and Sergei Yakovenko. Lectures on analytic differential equations, volume 86. American Mathematical Soc., 2008.
|
| 415 |
+
|
| 416 |
+
Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
|
| 417 |
+
|
| 418 |
+
Yann LeCun, Bernhard E Boser, John S Denker, Donnie Henderson, Richard E Howard, Wayne E Hubbard, and Lawrence D Jackel. Handwritten digit recognition with a back-propagation network. In Advances in neural information processing systems, pp. 396–404, 1990.
|
| 419 |
+
|
| 420 |
+
Yann LeCun, Yoshua Bengio, et al. Convolutional networks for images, speech, and time series. The handbook of brain theory and neural networks, 3361(10):1995, 1995.
|
| 421 |
+
|
| 422 |
+
James Martens and Venkatesh Medabalimi. On the expressive efficiency of sum product networks. arXiv preprint arXiv:1411.7717, 2014.
|
| 423 |
+
|
| 424 |
+
Toma´s Mikolov, Stefan Kombrink, Luk ˇ a´s Burget, Jan ˇ Cernock ˇ y, and Sanjeev Khudanpur. Exten- \` sions of recurrent neural network language model. In Acoustics, Speech and Signal Processing (ICASSP), 2011 IEEE International Conference on, pp. 5528–5531. IEEE, 2011.
|
| 425 |
+
|
| 426 |
+
Guido F Montufar, Razvan Pascanu, Kyunghyun Cho, and Yoshua Bengio. On the number of linear regions of deep neural networks. In Advances in neural information processing systems, pp. 2924–2932, 2014.
|
| 427 |
+
|
| 428 |
+
Alexander Novikov, Mikhail Trofimov, and Ivan Oseledets. Exponential machines. arXiv preprint arXiv:1605.03795, 2016.
|
| 429 |
+
|
| 430 |
+
Ivan V Oseledets. Tensor-train decomposition. SIAM Journal on Scientific Computing, 33(5):2295– 2317, 2011.
|
| 431 |
+
|
| 432 |
+
F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.
|
| 433 |
+
|
| 434 |
+
Maithra Raghu, Ben Poole, Jon Kleinberg, Surya Ganguli, and Jascha Sohl-Dickstein. On the expressive power of deep neural networks. In Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 2847–2854, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR.
|
| 435 |
+
|
| 436 |
+
Igor Rostislavovich Shafarevich and Kurt Augustus Hirsch. Basic algebraic geometry, volume 2. Springer, 1994.
|
| 437 |
+
|
| 438 |
+
Ravid Shwartz-Ziv and Naftali Tishby. Opening the black box of deep neural networks via information. arXiv preprint arXiv:1703.00810, 2017.
|
| 439 |
+
|
| 440 |
+
Edwin Stoudenmire and David J Schwab. Supervised learning with tensor networks. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 4799–4807. Curran Associates, Inc., 2016.
|
| 441 |
+
|
| 442 |
+
Ilya Sutskever, James Martens, George Dahl, and Geoffrey Hinton. On the importance of initialization and momentum in deep learning. In International conference on machine learning, pp. 1139–1147, 2013.
|
| 443 |
+
|
| 444 |
+
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, pp. 1–9, 2015.
|
| 445 |
+
|
| 446 |
+
Yuhuai Wu, Saizheng Zhang, Ying Zhang, Yoshua Bengio, and Ruslan R Salakhutdinov. On multiplicative integration with recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 2856–2864, 2016.
|
| 447 |
+
|
| 448 |
+
Rose Yu, Stephan Zheng, Anima Anandkumar, and Yisong Yue. Long-term forecasting using tensortrain RNNs. arXiv preprint arXiv:1711.00073, 2017.
|